window.thumbnails = {};
															thumbnails[2305739] = clik.newPhoto({"id":2305739,"src":"web 2_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"","height":194});
															thumbnails[2333606] = clik.newPhoto({"id":2333606,"src":"baldy LOW1_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"","height":87});
															thumbnails[2233344] = clik.newPhoto({"id":2233344,"src":"P1010127_thumb.jpg","galleries_id":147119,"server_id":5,"link":"photo_2233344.html","width":130,"caption":"","height":128});
															thumbnails[2237380] = clik.newPhoto({"id":2237380,"src":"P10101301_thumb.jpg","galleries_id":147119,"server_id":5,"link":"photo_2237380.html","width":130,"caption":"","height":129});
															thumbnails[2237383] = clik.newPhoto({"id":2237383,"src":"P10101251_thumb.jpg","galleries_id":147119,"server_id":5,"link":"photo_2237383.html","width":130,"caption":"","height":124});
															thumbnails[2237386] = clik.newPhoto({"id":2237386,"src":"DSC00023_thumb.jpg","galleries_id":147119,"server_id":5,"link":"photo_2237386.html","width":130,"caption":"","height":129});
															thumbnails[2237477] = clik.newPhoto({"id":2237477,"src":"P1010114_thumb.jpg","galleries_id":147119,"server_id":5,"link":"photo_2237477.html","width":130,"caption":"","height":130});
															thumbnails[2237923] = clik.newPhoto({"id":2237923,"src":"DSC00036_thumb.jpg","galleries_id":147119,"server_id":5,"link":"photo_2237923.html","width":130,"caption":"","height":134});
															thumbnails[2237959] = clik.newPhoto({"id":2237959,"src":"P1010139_thumb.jpg","galleries_id":147119,"server_id":5,"link":"photo_2237959.html","width":130,"caption":"","height":104});
															thumbnails[2238034] = clik.newPhoto({"id":2238034,"src":"P1010116_thumb.jpg","galleries_id":147119,"server_id":5,"link":"photo_2238034.html","width":130,"caption":"","height":131});
															thumbnails[2238055] = clik.newPhoto({"id":2238055,"src":"P1010119_thumb.jpg","galleries_id":147119,"server_id":5,"link":"photo_2238055.html","width":130,"caption":"","height":129});
															thumbnails[2238097] = clik.newPhoto({"id":2238097,"src":"IMAGE 7_thumb.jpg","galleries_id":147129,"server_id":5,"link":"photo_2238097.html","width":130,"caption":"","height":130});
															thumbnails[2238101] = clik.newPhoto({"id":2238101,"src":"_DSC0222_thumb.jpg","galleries_id":147129,"server_id":5,"link":"photo_2238101.html","width":130,"caption":"","height":131});
															thumbnails[2238123] = clik.newPhoto({"id":2238123,"src":"P1010001_thumb.jpg","galleries_id":147129,"server_id":5,"link":"photo_2238123.html","width":130,"caption":"","height":131});
															thumbnails[2238153] = clik.newPhoto({"id":2238153,"src":"_DSC0232_thumb.jpg","galleries_id":147129,"server_id":5,"link":"photo_2238153.html","width":130,"caption":"","height":131});
															thumbnails[2238158] = clik.newPhoto({"id":2238158,"src":"1972 1_thumb.jpg","galleries_id":147129,"server_id":5,"link":"photo_2238158.html","width":130,"caption":"","height":182});
															thumbnails[2238171] = clik.newPhoto({"id":2238171,"src":"gold hound_thumb.jpg","galleries_id":147129,"server_id":5,"link":"photo_2238171.html","width":130,"caption":"","height":124});
															thumbnails[2238174] = clik.newPhoto({"id":2238174,"src":"1972 2_thumb.jpg","galleries_id":147129,"server_id":5,"link":"photo_2238174.html","width":130,"caption":"","height":141});
															thumbnails[2238245] = clik.newPhoto({"id":2238245,"src":"image4_thumb.jpg","galleries_id":147376,"server_id":5,"link":"photo_2238245.html","width":130,"caption":"","height":128});
															thumbnails[2238246] = clik.newPhoto({"id":2238246,"src":"image 2_thumb.jpg","galleries_id":147376,"server_id":5,"link":"photo_2238246.html","width":130,"caption":"","height":129});
															thumbnails[2238249] = clik.newPhoto({"id":2238249,"src":"IMAGE 3_thumb.jpg","galleries_id":147376,"server_id":5,"link":"photo_2238249.html","width":130,"caption":"","height":129});
															thumbnails[2238251] = clik.newPhoto({"id":2238251,"src":"soyuz_thumb.jpg","galleries_id":147376,"server_id":5,"link":"photo_2238251.html","width":130,"caption":"","height":132});
															thumbnails[2238255] = clik.newPhoto({"id":2238255,"src":"landscape10 15by22web_thumb.jpg","galleries_id":147134,"server_id":5,"link":"photo_2238255.html","width":130,"caption":"","height":197});
															thumbnails[2238258] = clik.newPhoto({"id":2238258,"src":"tadhg goggles_thumb.jpg","galleries_id":147134,"server_id":5,"link":"photo_2238258.html","width":130,"caption":"","height":197});
															thumbnails[2238262] = clik.newPhoto({"id":2238262,"src":"turner2cropweb_thumb.jpg","galleries_id":147134,"server_id":5,"link":"photo_2238262.html","width":130,"caption":"","height":197});
															thumbnails[2238263] = clik.newPhoto({"id":2238263,"src":"Untitled-11_thumb.jpg","galleries_id":147134,"server_id":5,"link":"photo_2238263.html","width":130,"caption":"","height":201});
															thumbnails[2238267] = clik.newPhoto({"id":2238267,"src":"DSCF0454_thumb.jpg","galleries_id":147134,"server_id":5,"link":"photo_2238267.html","width":130,"caption":"","height":87});
															thumbnails[2238272] = clik.newPhoto({"id":2238272,"src":"gatherers_thumb.jpg","galleries_id":147134,"server_id":5,"link":"photo_2238272.html","width":130,"caption":"","height":99});
															thumbnails[2238274] = clik.newPhoto({"id":2238274,"src":"honans bull_thumb.jpg","galleries_id":147134,"server_id":5,"link":"photo_2238274.html","width":130,"caption":"","height":114});
															thumbnails[2272419] = clik.newPhoto({"id":2272419,"src":"bronze 71 x 71 cm 2006 mixed media1_thumb.jpg","galleries_id":147376,"server_id":5,"link":"photo_2272419.html","width":130,"caption":"","height":131});
															thumbnails[2272420] = clik.newPhoto({"id":2272420,"src":"funshin mor1_thumb.jpg","galleries_id":147376,"server_id":5,"link":"photo_2272420.html","width":130,"caption":"","height":119});
															thumbnails[2272424] = clik.newPhoto({"id":2272424,"src":"parkmore 71 x71 cm 2007 mixed media1_thumb.jpg","galleries_id":147129,"server_id":5,"link":"photo_2272424.html","width":130,"caption":"","height":131});
															thumbnails[3006664] = clik.newPhoto({"id":3006664,"src":"oo_thumb.jpg","galleries_id":147119,"server_id":5,"link":"photo_3006664.html","width":130,"caption":"","height":129});
															thumbnails[3006668] = clik.newPhoto({"id":3006668,"src":"1_thumb.jpg","galleries_id":147119,"server_id":5,"link":"photo_3006668.html","width":130,"caption":"","height":112});
															thumbnails[3006669] = clik.newPhoto({"id":3006669,"src":"2_thumb.jpg","galleries_id":147119,"server_id":5,"link":"photo_3006669.html","width":130,"caption":"","height":128});
															thumbnails[3006670] = clik.newPhoto({"id":3006670,"src":"Picturelkj_thumb.jpg","galleries_id":147119,"server_id":5,"link":"photo_3006670.html","width":130,"caption":"","height":92});
															thumbnails[3006929] = clik.newPhoto({"id":3006929,"src":"1111_thumb.jpg","galleries_id":147119,"server_id":5,"link":"photo_3006929.html","width":130,"caption":"","height":94});
															thumbnails[3006970] = clik.newPhoto({"id":3006970,"src":"Picture23ko copy_thumb.jpg","galleries_id":147119,"server_id":5,"link":"photo_3006970.html","width":130,"caption":"","height":92});
															thumbnails[4818827] = clik.newPhoto({"id":4818827,"src":"untitled_2008_thumb.jpg","galleries_id":147119,"server_id":5,"link":"photo_4818827.html","width":130,"caption":"","height":129});
															thumbnails[4818843] = clik.newPhoto({"id":4818843,"src":"boston_2008_thumb.jpg","galleries_id":147119,"server_id":5,"link":"photo_4818843.html","width":130,"caption":"","height":133});
															thumbnails[6385006] = clik.newPhoto({"id":6385006,"src":"DSC_00231_thumb.jpg","galleries_id":353119,"server_id":5,"link":"photo_6385006.html","width":130,"caption":"","height":86});
															thumbnails[6385007] = clik.newPhoto({"id":6385007,"src":"DSC_0024_thumb.jpg","galleries_id":353119,"server_id":5,"link":"photo_6385007.html","width":130,"caption":"","height":86});
															thumbnails[6385065] = clik.newPhoto({"id":6385065,"src":"DSC_00141_thumb.jpg","galleries_id":353119,"server_id":5,"link":"photo_6385065.html","width":130,"caption":"","height":86});
															thumbnails[6385105] = clik.newPhoto({"id":6385105,"src":"DSC_0071_thumb.jpg","galleries_id":353119,"server_id":5,"link":"photo_6385105.html","width":130,"caption":"","height":86});
															thumbnails[6385106] = clik.newPhoto({"id":6385106,"src":"DSC_0070_thumb.jpg","galleries_id":353119,"server_id":5,"link":"photo_6385106.html","width":130,"caption":"","height":86});
															thumbnails[6385116] = clik.newPhoto({"id":6385116,"src":"DSC_00052_thumb.jpg","galleries_id":353119,"server_id":5,"link":"photo_6385116.html","width":130,"caption":"","height":86});
															thumbnails[6385126] = clik.newPhoto({"id":6385126,"src":"DSC_00173_thumb.jpg","galleries_id":353119,"server_id":5,"link":"photo_6385126.html","width":130,"caption":"","height":86});
															thumbnails[6385132] = clik.newPhoto({"id":6385132,"src":"DSC_00251_thumb.jpg","galleries_id":353119,"server_id":5,"link":"photo_6385132.html","width":130,"caption":"","height":86});
															thumbnails[6385136] = clik.newPhoto({"id":6385136,"src":"DSC_0033_thumb.jpg","galleries_id":353119,"server_id":5,"link":"photo_6385136.html","width":130,"caption":"","height":86});
															thumbnails[6385138] = clik.newPhoto({"id":6385138,"src":"DSC_0337_thumb.jpg","galleries_id":353119,"server_id":5,"link":"photo_6385138.html","width":130,"caption":"","height":86});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[353119] = clik.newGallery({"parentGallery":"","usePopups":false,"title":2010.0,"link":"gallery_353119.html","maxRecords":0.0,"photoIDs":[6385006.0,6385007.0,6385065.0,6385105.0,6385106.0,6385116.0,6385126.0,6385132.0,6385136.0,6385138.0],"skipIndex":0,"section_code":"gallery","featured_images":"6385138,6385136,6385132,6385126,6385116,6385106,6385105,6385065,6385007,6385006","id":353119,"singleSection":false});				  						galleries[147119] = clik.newGallery({"parentGallery":"","usePopups":false,"title":2008.0,"link":"gallery_147119.html","maxRecords":0.0,"photoIDs":[2233344.0,2237380.0,2237383.0,2237386.0,2237477.0,2237923.0,2237959.0,2238034.0,2238055.0,3006664.0,3006668.0,3006669.0,3006670.0,3006929.0,3006970.0,4818827.0,4818843.0],"skipIndex":0,"section_code":"gallery","featured_images":"4818843,4818827,3006970,3006929,3006670,3006669,3006668,3006664,2237386,2237383,2237380,2233344","id":147119,"singleSection":false});				  						galleries[147129] = clik.newGallery({"parentGallery":"","usePopups":false,"title":2007.0,"link":"gallery_147129.html","maxRecords":0.0,"photoIDs":[2238097.0,2238101.0,2238123.0,2238153.0,2238158.0,2238171.0,2238174.0,2272424.0],"skipIndex":0,"section_code":"gallery","featured_images":"2238174,2238158,2238153","id":147129,"singleSection":false});				  						galleries[147376] = clik.newGallery({"parentGallery":"","usePopups":false,"title":2006.0,"link":"gallery_147376.html","maxRecords":0.0,"photoIDs":[2238245.0,2238246.0,2238249.0,2238251.0,2272419.0,2272420.0],"skipIndex":0,"section_code":"gallery","featured_images":"2238246,2238245","id":147376,"singleSection":false});				  						galleries[147134] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"earlier work","link":"gallery_147134.html","maxRecords":0.0,"photoIDs":[2238255.0,2238258.0,2238262.0,2238263.0,2238267.0,2238272.0,2238274.0],"skipIndex":0,"section_code":"gallery","featured_images":"2238263,2238262,2238258,2238255","id":147134,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '6385138,6385136,6385132,6385126,6385116,6385106,6385105,6385065,6385007,6385006,4818843,4818827,3006970,3006929,3006670,3006669,3006668,3006664,2333606,2305739,2238263,2238262,2238258,2238255,2238246,2238245,2238174,2238158,2238153,2237386,2237383,2237380,2233344';
imageSets[2] = '6385138,6385136,6385132,6385126,6385116,6385106,6385105,6385065,6385007,6385006,4818843,4818827,3006970,3006929,3006670,3006669,3006668,3006664,2333606,2305739,2238263,2238262,2238258,2238255,2238246,2238245,2238174,2238158,2238153,2237386,2237383,2237380,2233344';
imageSets[3] = '6385138,6385136,6385132,6385126,6385116,6385106,6385105,6385065,6385007,6385006,4818843,4818827,3006970,3006929,3006670,3006669,3006668,3006664,2333606,2305739,2272424,2272420,2272419,2238274,2238272,2238267,2238263,2238262,2238258,2238255,2238251,2238249,2238246,2238245,2238174,2238171,2238158,2238153,2238123,2238101,2238097,2238055,2238034,2237959,2237923';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/johnhanrahan/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/johnhanrahan/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/johnhanrahan/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/johnhanrahan/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/johnhanrahan/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/johnhanrahan/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/johnhanrahan/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/johnhanrahan/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/johnhanrahan/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/johnhanrahan/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/johnhanrahan/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/johnhanrahan/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/johnhanrahan/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/johnhanrahan/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/johnhanrahan/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/johnhanrahan/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/johnhanrahan/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/johnhanrahan/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/johnhanrahan/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/johnhanrahan/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/johnhanrahan/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/johnhanrahan/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/johnhanrahan/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/johnhanrahan/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/johnhanrahan/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/johnhanrahan/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/johnhanrahan/images';
		break;
	}
		return val;
}

/***************************************************************************
* img = reference to image object in which to show image                   *
***************************************************************************/
function showHomeImage(img) {
	imageID = randomListVal('');
	if (!basic) {
		img.src = photos[imageID].src;
		img.width = photos[imageID].width;
		img.height = photos[imageID].height;
		img.parentNode.title = img.alt = photos[imageID].caption;
	} else {
		newImage = new Image(photos[imageID].width,photos[imageID].height);
		newImage.src = photos[imageID].src;
		document.images[img.name] = newImage;
		
	}
}

function getHomeImageLink(imageID) {
  	var href='', photo = (backgrounds || photos || {})[imageID];
	if(photo){
		if (photo && photo.galleries_id != '') {
  			href = photo.fnGalleryLink();
  		}
  		  		else {
  				href += 'gallery.html';
  	  		}
	}
    return href;
}

/***************************************************************************
* Show a random image on home page from featured images                    *
***************************************************************************/
function showHomeImageInline(el, image_sets_id, href) {
	
	var css = {}, imageID,
	    imageSetsId = 1;
	if(image_sets_id){
		imageSetsId = image_sets_id;
	}
	imageID = randomListVal(imageSets[imageSetsId]);
	if (href == null && 'gallery' != '') {
					href = getHomeImageLink(imageID);
	}
	
	updateImage({nextPhoto: backgrounds[imageID], img:el.find('img')[0],
                $photo:el, $title:$('#homeimageTitleContainer'), $detail:$('#homeimageDetailsContainer'),                speed:0, href:href, css:css, onAfter: function(){                  this.closest('.contentsection').doManualAlign({				    inner: 'img',				    crop: 'a'				  });                }              });
}

/***************************************************************************
* Set 'img' to be a new image given its photo() object                     *
***************************************************************************/
function updateImage (options) {
	var defaults = {nextPhoto:'',field:'',img:'',$photo:'',$title:'',$detail:'',$detailContainer:'',
                    updateDocumentTitle:false,speed:0,href:false,css:false,updateHash:false,onAfter:null,onBefore:null},
		op = $.extend({},defaults,options),
		html = '', temp = '',
		photoId = op.nextPhoto.id,
		photoCaption = ''+op.nextPhoto.caption,
		photoSrc = op.nextPhoto.src;
	
	if (op.updateHash && clik.getIDInUrl(location.href,'photo') != op.nextPhoto.id) {
		clik.changeHash('photos_id=' + op.nextPhoto.id, true);
	}
		
	    if (op.$title.length > 0) {
  		op.$title.fadeGalleryDetails(photoCaption, op.speed);
    }
        if (op.updateDocumentTitle) {
						  document.title = 'jonhanrahan.com: ' + photoCaption;
			    }
        if (op.$detail.length > 0) {
      	temp = op.nextPhoto.fnGetImageDetails();
	    op.$detail.fadeGalleryDetails(temp, op.speed, function(){
			if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
				toggleAddToCartConfirm(backgrounds, op.$detail);
			} else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
				toggleAddToCartConfirm(photos, op.$detail);
			}
			$('body').trigger('clikUpdate.popup');
	    });
    }
        $(op.$detailContainer).find('.replaceable[class*=replaceable_photo-]').each(function(){
    	var field = clik.getPrefixedClass(this.className, 'replaceable_photo-');
    	if (field in op.nextPhoto) {
    		$(this).fadeGalleryDetails(op.nextPhoto[field], op.speed);
    	}
    }).end().find('.replaceable.photoPayment').fadeGalleryDetails(op.nextPhoto.fnGetPaymentInfo(), op.speed, function(){
		if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
			toggleAddToCartConfirm(backgrounds, op.$detailContainer);
		} else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
			toggleAddToCartConfirm(photos, op.$detailContainer);
		}
		$('body').trigger('clikUpdate.popup');
	});
		if (op.$photo.length > 0) {
		html = $('<img/>',{
			'class': 'mainphoto photo',
			src: photoSrc,
			id: 'mainPic',
			name: 'mainPic',
			width: op.nextPhoto.width,
			height: op.nextPhoto.height,
			alt: photoCaption,
			css: op.css || {}
		});
		if (op.href) {
			if (op.href.match(/<a/)) {
				html = $(op.href).append(html);
			} else {
				html = $('<a/>', {
					href: op.href,
					title: photoCaption
				}).append(html);
			}
		} else {
			html = $('<a/>', {
				title: photoCaption
			}).append(html);
		}
		if (op.speed == 0) {			op.$photo.html(html);			if (op.onBefore) {			  	op.onBefore.apply(op.$photo);			}			if (op.onAfter) {			  	op.onAfter.apply(op.$photo);			}		} else {			op.$photo.stop(true,true).fadeReplaceWith(html,op.speed,'',function(){  				if (op.onAfter) {				  	op.onAfter.apply(this);				}				clik.doColumnResize(false, $(this).add(op.$detail).add(op.$title));			}, op.onBefore);
		}	}
    if (op.field) {
		op.field.value = photoId;
	} else {
		op.$photo.data('image_id', photoId);
    }
        if (!op.speed) {
      	clik.doColumnResize(false, op.$photo.add(op.$detail).add(op.$title));
    }
        
    return html;
	}

/***************************************************************************
* Toggle add to cart confirmation element and set up the click event for   *
* the 'Add to cart' button.                                                *
***************************************************************************/
function toggleAddToCartConfirm(array, root){
	if (typeof(array) !== 'object' || array === null) {
	  	array = photos;
	}
	if (!$(root).length) {		root = $('body');	}	if($('#paymentConfirm', root).length > 0){
		$('#paymentConfirm', root).hide();
		$('#paymentAddButton', root)
		.unbind()
		.click(function(){
						form = $('#paymentForm', root)[0];
			option_id = 0;
			if(form.item_option.value){
				option_id = form.item_option.value;
			}
			if(addItemToBasket(form.item_number.value,array,form.site.value,parseInt(form.quantity.value, 10),option_id)){
				if($.browser.msie){$('#paymentConfirm', root).text('Item added to cart').show();}
				else{
					$('#paymentConfirm', root).text('Item added to cart').fadeIn();
					dspOrderDetails(form.site.value);
				}
			}
			else{
				$('#paymentConfirm', root).text('Item not added - check cookies are enabled in your browser.').fadeIn();
			}
		});
	}
}

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
clik.photo.fnGetImageDetails = function(){
	var temp = '';
	if (this.description != '') {
		temp +=  '<div id="imageDescription">' + this.description + '</div>';
	}
		if (this.photo_ref != '') {
		temp += '<div class="imageinfo" id="imageRef"><strong>Ref: </strong>' + this.photo_ref + '</div>';
	}
		if (this.takendate != '') {
		
		temp += '<div class="imageinfo" id="imageDate"><strong>Date: </strong>' + this.takendate + '</div>';
	}
	
	if (this.location != '') {
		
		temp += '<div class="imageinfo" id="imageLocation"><strong>Location: </strong>' +  this.location + '</div>';
	}
	
	if (this.photographer != '') {
		
		temp += '<div class="imageinfo" id="imagePhotographer"><strong>Photographer: </strong>' + this.photographer + '</div>';
	}
				
				if (temp != '') {
		temp += '<div class="spacer"></div>';
	}
	return temp;
};

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
clik.photo.fnGetPaymentInfo = function(){
	var temp = '';
	if (this.item_price !== '') {
				temp += '<p>Order this print:</p>';
				temp += '<div class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> ' + (this.item_price).toFixed(2) + '</div>';
		var item_name  = this.purchase_instruction;
		var amount = (this.item_price).toFixed(2);
		var item_option  = 0;
	}
		else {
		
	}
	if (this.item_price !== '') {
			temp += '<div class="clearing">&nbsp;</div>';
	}
	return temp;};

/***************************************************************************
* Pick a photo at random from the featured images of a gallery.            *
* Gallery_id = id of gallery to choose,                                    *
* img = reference to html image in                                         *
* which to show image                                                      *
***************************************************************************/
function showGalleryImage(gallery_id, img, updateLink) {
	
	if(img){
		if (location.hash.match('galleries_id=' + gallery_id) && (imageID = location.hash.match('.*photos_id=(.+)$'))) {
		  	imageID = imageID[1];
		} else {
		  	imageID = randomListVal(galleries[gallery_id].featured_images);
		}
		
		if (imageID != 0) {
			img.src = thumbnails[imageID].src;
			img.width = thumbnails[imageID].width;
			img.height = thumbnails[imageID].height;
			img.alt = galleries[gallery_id].title;
			if (updateLink) {
				$(img).parent().attr({					title: galleries[gallery_id].title				}).filter(function(){return this.href;}).attr({					href: thumbnails[imageID].fnGalleryLink(gallery_id)				});
			}
		}
	}
}

/***************************************************************************
* If we have dynamic HTML, replace the galleries link with a list that     *
* doesn't include thecurrent gallery                                       *
***************************************************************************/
function showGalleries(gallery_id) {
		
	
	if (!basic) {
		temp = '';
		for (i = 0; i < galleries.length; i++) {
						
			
			if (galleries[i].id != gallery_id) {
								
				if (temp != '') {
					temp += ' | ';
				}
								temp += '<a href="' + galleries[i].section_code + '_' + galleries[i].id + '.html">' + galleries[i].title + '</a>';
							}
		}
		document.all.galleryLinks.innerHTML = 'Other galleries: ' + temp;
	}
}

			

