window.thumbnails = {};
															thumbnails[3809017] = clik.newPhoto({"id":3809017,"src":"Passage_Of_Time_thumb.jpg","galleries_id":196801,"server_id":32,"link":"photo_3809017.html","width":130,"caption":"Passage Of Time","height":86});
															thumbnails[5248444] = clik.newPhoto({"id":5248444,"src":"Waiting_Room_thumb.jpg","galleries_id":194311,"server_id":32,"link":"photo_5248444.html","width":130,"caption":"Waiting Room","height":93});
															thumbnails[5248445] = clik.newPhoto({"id":5248445,"src":"Smashin_thumb.jpg","galleries_id":194311,"server_id":32,"link":"photo_5248445.html","width":130,"caption":"Smashin'","height":98});
															thumbnails[6400211] = clik.newPhoto({"id":6400211,"src":"Elsa_2869_cp_thumb.jpg","galleries_id":194311,"server_id":32,"link":"photo_6400211.html","width":130,"caption":"Elsa","height":92});
															thumbnails[6400215] = clik.newPhoto({"id":6400215,"src":"Daisy_3280_cp_thumb.jpg","galleries_id":330520,"server_id":32,"link":"photo_6400215.html","width":130,"caption":"Daisy","height":129});
															thumbnails[6400258] = clik.newPhoto({"id":6400258,"src":"Mum_3458_cp_thumb.jpg","galleries_id":330520,"server_id":32,"link":"photo_6400258.html","width":130,"caption":"Mum","height":130});
															thumbnails[3174918] = clik.newPhoto({"id":3174918,"src":"A_Stern_Look_thumb.jpg","galleries_id":196801,"server_id":32,"link":"photo_3174918.html","width":130,"caption":"A Stern Look","height":173});
															thumbnails[3174942] = clik.newPhoto({"id":3174942,"src":"Corridor_Of_Power_thumb.jpg","galleries_id":191775,"server_id":32,"link":"photo_3174942.html","width":130,"caption":"Corridor Of Power","height":217});
															thumbnails[3174952] = clik.newPhoto({"id":3174952,"src":"Loch_Inlet_thumb.jpg","galleries_id":191776,"server_id":32,"link":"photo_3174952.html","width":130,"caption":"Loch Inlet","height":201});
															thumbnails[3283983] = clik.newPhoto({"id":3283983,"src":"Stepping_Out_thumb.jpg","galleries_id":194311,"server_id":32,"link":"photo_3283983.html","width":130,"caption":"Stepping Out","height":86});
															thumbnails[3305963] = clik.newPhoto({"id":3305963,"src":"Yoga_For_Swans_thumb.jpg","galleries_id":194314,"server_id":32,"link":"photo_3305963.html","width":130,"caption":"Yoga For Swans","height":86});
															thumbnails[5841569] = clik.newPhoto({"id":5841569,"src":"Clematis_thumb.jpg","galleries_id":330520,"server_id":32,"link":"photo_5841569.html","width":130,"caption":"Clematis","height":86});
															thumbnails[3194797] = clik.newPhoto({"id":3194797,"src":"Tilly_thumb.jpg","galleries_id":196801,"server_id":32,"link":"photo_3194797.html","width":130,"caption":"Tilly","height":163});
															thumbnails[3194808] = clik.newPhoto({"id":3194808,"src":"Top_Gear_thumb.jpg","galleries_id":196801,"server_id":32,"link":"photo_3194808.html","width":130,"caption":"Top Gear","height":165});
															thumbnails[3194781] = clik.newPhoto({"id":3194781,"src":"Steamin_thumb.jpg","galleries_id":196801,"server_id":32,"link":"photo_3194781.html","width":130,"caption":"Steamin","height":143});
															thumbnails[5285381] = clik.newPhoto({"id":5285381,"src":"To_The_Falls_thumb.jpg","galleries_id":191776,"server_id":32,"link":"photo_5285381.html","width":130,"caption":"To The Falls","height":195});
															thumbnails[3174947] = clik.newPhoto({"id":3174947,"src":"Liquid_Gold_thumb.jpg","galleries_id":196801,"server_id":32,"link":"photo_3174947.html","width":130,"caption":"Liquid Gold","height":132});
															thumbnails[3223594] = clik.newPhoto({"id":3223594,"src":"Plain_Sailing_thumb.jpg","galleries_id":196801,"server_id":32,"link":"photo_3223594.html","width":130,"caption":"Plain Sailing","height":95});
															thumbnails[3174938] = clik.newPhoto({"id":3174938,"src":"Catch_Of_The_Day_thumb.jpg","galleries_id":194314,"server_id":32,"link":"photo_3174938.html","width":130,"caption":"Catch Of The Day","height":68});
															thumbnails[3194751] = clik.newPhoto({"id":3194751,"src":"Crazy_Ceiling1_thumb.jpg","galleries_id":191775,"server_id":32,"link":"photo_3194751.html","width":130,"caption":"Crazy Ceiling","height":178});
															thumbnails[3194775] = clik.newPhoto({"id":3194775,"src":"Spokes_thumb.jpg","galleries_id":196801,"server_id":32,"link":"photo_3194775.html","width":130,"caption":"Spokes","height":102});
															thumbnails[3223601] = clik.newPhoto({"id":3223601,"src":"Craigleith_thumb.jpg","galleries_id":191776,"server_id":32,"link":"photo_3223601.html","width":130,"caption":"Craigleith","height":92});
															thumbnails[3283990] = clik.newPhoto({"id":3283990,"src":"Leaf_Me_Alone_thumb.jpg","galleries_id":194311,"server_id":32,"link":"photo_3283990.html","width":130,"caption":"Leaf Me Alone","height":86});
															thumbnails[3808979] = clik.newPhoto({"id":3808979,"src":"Crocus_thumb.jpg","galleries_id":330520,"server_id":32,"link":"photo_3808979.html","width":130,"caption":"Crocus","height":137});
															thumbnails[3174945] = clik.newPhoto({"id":3174945,"src":"Crankie_thumb.jpg","galleries_id":196801,"server_id":32,"link":"photo_3174945.html","width":130,"caption":"Crankie","height":103});
															thumbnails[4256416] = clik.newPhoto({"id":4256416,"src":"Ripples_thumb.jpg","galleries_id":196801,"server_id":32,"link":"photo_4256416.html","width":130,"caption":"Ripples<br>\r\n","height":183});
															thumbnails[4256421] = clik.newPhoto({"id":4256421,"src":"Vanishing_Point_thumb.jpg","galleries_id":196801,"server_id":32,"link":"photo_4256421.html","width":130,"caption":"Vanishing Point","height":172});
															thumbnails[3558740] = clik.newPhoto({"id":3558740,"src":"The_Power_Of_One_thumb.jpg","galleries_id":191776,"server_id":32,"link":"photo_3558740.html","width":130,"caption":"The Power Of One","height":85});
															thumbnails[3194758] = clik.newPhoto({"id":3194758,"src":"Flaky_Stairs_thumb.jpg","galleries_id":191775,"server_id":32,"link":"photo_3194758.html","width":130,"caption":"Flaky Stairs","height":198});
															thumbnails[3194929] = clik.newPhoto({"id":3194929,"src":"Maisie Mallard_thumb.jpg","galleries_id":194314,"server_id":32,"link":"photo_3194929.html","width":130,"caption":"Maisie Mallard","height":71});
															thumbnails[3808986] = clik.newPhoto({"id":3808986,"src":"Remnants_thumb.jpg","galleries_id":194311,"server_id":32,"link":"photo_3808986.html","width":130,"caption":"Remnants","height":89});
															thumbnails[3809010] = clik.newPhoto({"id":3809010,"src":"From_The_Hide_thumb.jpg","galleries_id":191776,"server_id":32,"link":"photo_3809010.html","width":130,"caption":"From The Hide","height":85});
															thumbnails[6207005] = clik.newPhoto({"id":6207005,"src":"Evening_Glow_1708_cp_thumb.jpg","galleries_id":191776,"server_id":32,"link":"photo_6207005.html","width":130,"caption":"Evening Glow","height":85});
															thumbnails[3174936] = clik.newPhoto({"id":3174936,"src":"Eye_Spy_thumb.jpg","galleries_id":194314,"server_id":32,"link":"photo_3174936.html","width":130,"caption":"Eye Spy","height":214});
															thumbnails[3194771] = clik.newPhoto({"id":3194771,"src":"Shadows_thumb.jpg","galleries_id":191775,"server_id":32,"link":"photo_3194771.html","width":130,"caption":"Shadows","height":211});
															thumbnails[3808995] = clik.newPhoto({"id":3808995,"src":"Fringe_Benefits_thumb.jpg","galleries_id":194311,"server_id":32,"link":"photo_3808995.html","width":130,"caption":"Fringe Benefits","height":176});
															thumbnails[6207021] = clik.newPhoto({"id":6207021,"src":"Beech__Arcs_3269_cp_thumb.jpg","galleries_id":191776,"server_id":32,"link":"photo_6207021.html","width":130,"caption":"Beech Arcs","height":85});
															thumbnails[3174921] = clik.newPhoto({"id":3174921,"src":"Autumns_Last_Stand_thumb.jpg","galleries_id":191776,"server_id":32,"link":"photo_3174921.html","width":130,"caption":"Autumns Last Stand","height":86});
															thumbnails[3194788] = clik.newPhoto({"id":3194788,"src":"The_Doors_thumb.jpg","galleries_id":191775,"server_id":32,"link":"photo_3194788.html","width":130,"caption":"The Doors","height":209});
															thumbnails[3194815] = clik.newPhoto({"id":3194815,"src":"Trees_A_Crowd_thumb.jpg","galleries_id":191776,"server_id":32,"link":"photo_3194815.html","width":130,"caption":"Trees A Crowd","height":99});
															thumbnails[3305966] = clik.newPhoto({"id":3305966,"src":"Sshh_thumb.jpg","galleries_id":194314,"server_id":32,"link":"photo_3305966.html","width":130,"caption":"Sshh!","height":195});
															thumbnails[3808938] = clik.newPhoto({"id":3808938,"src":"A_Drop_Of_Snow_thumb.jpg","galleries_id":330520,"server_id":32,"link":"photo_3808938.html","width":130,"caption":"A Drop Of Snow","height":128});
															thumbnails[3558728] = clik.newPhoto({"id":3558728,"src":"The_Dark_Arcs_thumb.jpg","galleries_id":191775,"server_id":32,"link":"photo_3558728.html","width":130,"caption":"The Dark Arcs<br>\r\n","height":195});
															thumbnails[3174924] = clik.newPhoto({"id":3174924,"src":"Bridge_On_The_River_Tay_thumb.jpg","galleries_id":191776,"server_id":32,"link":"photo_3174924.html","width":130,"caption":"Bridge On The River Tay","height":73});
															thumbnails[3194740] = clik.newPhoto({"id":3194740,"src":"Car_Park_thumb.jpg","galleries_id":191775,"server_id":32,"link":"photo_3194740.html","width":130,"caption":"Car Park","height":92});
															thumbnails[5515511] = clik.newPhoto({"id":5515511,"src":"Kes_2228_cp_thumb.jpg","galleries_id":194314,"server_id":32,"link":"photo_5515511.html","width":130,"caption":"Kes","height":95});
															thumbnails[5248428] = clik.newPhoto({"id":5248428,"src":"Musica_cp_thumb.jpg","galleries_id":191775,"server_id":32,"link":"photo_5248428.html","width":130,"caption":"Musica","height":88});
															thumbnails[3174950] = clik.newPhoto({"id":3174950,"src":"Take_Your_Pick_thumb.jpg","galleries_id":194311,"server_id":32,"link":"photo_3174950.html","width":130,"caption":"Take Your Pick","height":134});
															thumbnails[3194805] = clik.newPhoto({"id":3194805,"src":"To_Let_thumb.jpg","galleries_id":191775,"server_id":32,"link":"photo_3194805.html","width":130,"caption":"To Let","height":92});
															thumbnails[5515529] = clik.newPhoto({"id":5515529,"src":"The_Wizard_2289_cp_thumb.jpg","galleries_id":194314,"server_id":32,"link":"photo_5515529.html","width":130,"caption":"The Wizard","height":87});
															thumbnails[3194764] = clik.newPhoto({"id":3194764,"src":"Into_The_Unknown_thumb.jpg","galleries_id":191775,"server_id":32,"link":"photo_3194764.html","width":130,"caption":"Into The Unknown","height":96});
															thumbnails[3194792] = clik.newPhoto({"id":3194792,"src":"The_Pipes_Are_Calling_thumb.jpg","galleries_id":194311,"server_id":32,"link":"photo_3194792.html","width":130,"caption":"The Pipes Are Calling","height":113});
															thumbnails[3174922] = clik.newPhoto({"id":3174922,"src":"Barcelona_Bricks_thumb.jpg","galleries_id":191775,"server_id":32,"link":"photo_3174922.html","width":130,"caption":"Barcelona Bricks","height":77});
															thumbnails[3174953] = clik.newPhoto({"id":3174953,"src":"Pampered_thumb.jpg","galleries_id":194311,"server_id":32,"link":"photo_3174953.html","width":130,"caption":"Pampered","height":98});
															thumbnails[3194767] = clik.newPhoto({"id":3194767,"src":"Reach_For_The_Sky_thumb.jpg","galleries_id":194311,"server_id":32,"link":"photo_3194767.html","width":130,"caption":"Reach For The Sky","height":90});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[191775] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Architecture","link":"gallery_191775.html","maxRecords":0.0,"photoIDs":[3174942.0,3194751.0,3194758.0,3194771.0,3194788.0,3558728.0,3194740.0,5248428.0,3194805.0,3194764.0,3174922.0],"skipIndex":0,"section_code":"gallery","featured_images":3174922.0,"id":191775,"singleSection":false});				  						galleries[191776] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Land And Sea","link":"gallery_191776.html","maxRecords":0.0,"photoIDs":[3174952.0,5285381.0,3223601.0,3558740.0,3809010.0,6207005.0,6207021.0,3174921.0,3194815.0,3174924.0],"skipIndex":0,"section_code":"gallery","featured_images":3174921.0,"id":191776,"singleSection":false});				  						galleries[330520] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Flowers","link":"gallery_330520.html","maxRecords":0.0,"photoIDs":[6400215.0,6400258.0,5841569.0,3808979.0,3808938.0],"skipIndex":0,"section_code":"gallery","featured_images":5841569.0,"id":330520,"singleSection":false});				  						galleries[194311] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Miscellaneous","link":"gallery_194311.html","maxRecords":0.0,"photoIDs":[5248444.0,5248445.0,6400211.0,3283983.0,3283990.0,3808986.0,3808995.0,3174950.0,3194792.0,3174953.0,3194767.0],"skipIndex":0,"section_code":"gallery","featured_images":"6400211,5248445,5248444,3808995,3808986,3283990,3283983,3194792,3194767,3174953","id":194311,"singleSection":false});				  						galleries[194314] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Wildlife","link":"gallery_194314.html","maxRecords":0.0,"photoIDs":[3305963.0,3174938.0,3194929.0,3174936.0,3305966.0,5515511.0,5515529.0],"skipIndex":0,"section_code":"gallery","featured_images":3174936.0,"id":194314,"singleSection":false});				  						galleries[196801] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Transport","link":"gallery_196801.html","maxRecords":0.0,"photoIDs":[3809017.0,3174918.0,3194797.0,3194808.0,3194781.0,3174947.0,3223594.0,3194775.0,3174945.0,4256416.0,4256421.0],"skipIndex":0,"section_code":"gallery","featured_images":4256421.0,"id":196801,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '6400258,6400215,6400211,5248444,5841569,3283983,5285381,3283990,3194775,3808986,6207005,6207021,5515511,5248428';
imageSets[2] = '5841569,4256421,3174936,3174921,3174922';
imageSets[3] = '6400258,6400215,6400211,6207021,6207005,5841569,5515529,5515511,5285381,5248445,5248444,5248428,4256421,4256416,3809017,3809010,3808995,3808986,3808979,3808938,3558740,3558728,3305966,3305963,3283990,3283983,3223601,3223594,3194929,3194815,3194808,3194805,3194797,3194792,3194788,3194781,3194775,3194771,3194767,3194764,3194758,3194751,3194740,3174953,3174952,3174950,3174947,3174945,3174942,3174938';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'www12.clikpic.com/deetus/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/deetus/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/deetus/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/deetus/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/deetus/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/deetus/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/deetus/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/deetus/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/deetus/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/deetus/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/deetus/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/deetus/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/deetus/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/deetus/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/deetus/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/deetus/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/deetus/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/deetus/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/deetus/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/deetus/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/deetus/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/deetus/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/deetus/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/deetus/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/deetus/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 && backgrounds[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 = 'illupho - Photography by Dave Tingle: ' + 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.payment_groups_id !== '') {
		temp += '<p>Buy this print online:</p>';
				temp += '<form id="paymentOptions" style="margin:0px;border:0px;" name="paymentOptions">';
											temp += '<select class="paymentlink" name="payment_options_id" onchange="updateItemValues($(this.form).next(\'#paymentForm\')[0],this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value);">';
		
		temp += getPaymentOptions(this.payment_groups_id);
		temp += '</select>';
		temp += '</form>';
				var item_option  = paymentGroups[this.payment_groups_id].options[0];
		if(paymentOptions[item_option]){
			var item_name  = paymentOptions[item_option].payment_option;
			var amount =  paymentOptions[item_option].price;
		}
			}
	else {
		
	}
	if (this.item_price !== '' || this.payment_groups_id !== '') {
			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;
	}
}

			

