window.thumbnails = {};
															thumbnails[5823158] = clik.newPhoto({"id":5823158,"src":"Exhibition_2010-web_Poster_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":92,"caption":"","height":130});
															thumbnails[5158046] = clik.newPhoto({"id":5158046,"src":"A390072_thumb.jpg","galleries_id":267589,"server_id":5,"link":"photo_5158046.html","width":130,"caption":"Peaks In The Mist","height":76});
															thumbnails[5158157] = clik.newPhoto({"id":5158157,"src":"A38241_thumb.jpg","galleries_id":267589,"server_id":5,"link":"photo_5158157.html","width":130,"caption":"Field Barn At Sunrise","height":72});
															thumbnails[5159749] = clik.newPhoto({"id":5159749,"src":"Mebacha2_thumb.jpg","galleries_id":291715,"server_id":5,"link":"photo_5159749.html","width":102,"caption":"M1: Mebacha","height":130});
															thumbnails[5159761] = clik.newPhoto({"id":5159761,"src":"Dressed_to_-_Jim_Edmondson1234_thumb.jpg","galleries_id":267592,"server_id":5,"link":"photo_5159761.html","width":101,"caption":"Dressed to...","height":130});
															thumbnails[5159762] = clik.newPhoto({"id":5159762,"src":"ROMANI_WANRANI_by_Jim_Edmondson123_thumb.jpg","galleries_id":267592,"server_id":5,"link":"photo_5159762.html","width":96,"caption":"Romani Wanrani","height":130});
															thumbnails[5159820] = clik.newPhoto({"id":5159820,"src":"NixonLesRock_plant_with_bee_thumb.jpg","galleries_id":267591,"server_id":5,"link":"photo_5159820.html","width":130,"caption":"Rock Plant with Bee","height":98});
															thumbnails[5159825] = clik.newPhoto({"id":5159825,"src":"NixonLesThe_Mosque_thumb.jpg","galleries_id":267591,"server_id":5,"link":"photo_5159825.html","width":81,"caption":"The Mosque","height":130});
															thumbnails[5159926] = clik.newPhoto({"id":5159926,"src":"WingroveGarryStannage_View_thumb.jpg","galleries_id":267590,"server_id":5,"link":"photo_5159926.html","width":130,"caption":"Stanage View","height":47});
															thumbnails[5159928] = clik.newPhoto({"id":5159928,"src":"ARCTIC_TERN_by_Garry_Wingrove_thumb.jpg","galleries_id":267590,"server_id":5,"link":"photo_5159928.html","width":130,"caption":"Arctic Tern","height":92});
															thumbnails[5159972] = clik.newPhoto({"id":5159972,"src":"AskewRobertGreat_Tit1_thumb.jpg","galleries_id":267395,"server_id":5,"link":"photo_5159972.html","width":130,"caption":"Great Tit","height":125});
															thumbnails[5159982] = clik.newPhoto({"id":5159982,"src":"AskewRobertWaxwing_thumb.jpg","galleries_id":267395,"server_id":5,"link":"photo_5159982.html","width":109,"caption":"Waxwing","height":130});
															thumbnails[5165405] = clik.newPhoto({"id":5165405,"src":"A23351_thumb.jpg","galleries_id":291715,"server_id":5,"link":"photo_5165405.html","width":105,"caption":"M2: Mountain Hare","height":130});
															thumbnails[5252652] = clik.newPhoto({"id":5252652,"src":"A_Break_in_the_Clouds_thumb.jpg","galleries_id":295843,"server_id":5,"link":"photo_5252652.html","width":130,"caption":"A Break In The Clouds","height":77});
															thumbnails[5252654] = clik.newPhoto({"id":5252654,"src":"Niagara_Falls_thumb.jpg","galleries_id":295843,"server_id":5,"link":"photo_5252654.html","width":108,"caption":"Niagara Falls","height":130});
															thumbnails[5252656] = clik.newPhoto({"id":5252656,"src":"Top_Withern_thumb.jpg","galleries_id":295843,"server_id":5,"link":"photo_5252656.html","width":130,"caption":"Top Withern","height":87});
															thumbnails[5390977] = clik.newPhoto({"id":5390977,"src":"100_Chaffinch_Robert_Askew_thumb.jpg","galleries_id":291715,"server_id":5,"link":"photo_5390977.html","width":119,"caption":"D1: Chaffinch","height":130});
															thumbnails[5390983] = clik.newPhoto({"id":5390983,"src":"240_1_City_Jungle_thumb.jpg","galleries_id":291715,"server_id":5,"link":"photo_5390983.html","width":130,"caption":"D2: City Jungle","height":92});
															thumbnails[5390986] = clik.newPhoto({"id":5390986,"src":"110_2_The_Lone_Stranger_thumb.jpg","galleries_id":291715,"server_id":5,"link":"photo_5390986.html","width":53,"caption":"D3: The Lone Stranger","height":130});
															thumbnails[5390989] = clik.newPhoto({"id":5390989,"src":"160_DaisleyIanShades_of_the_White_Peak_thumb.jpg","galleries_id":291715,"server_id":5,"link":"photo_5390989.html","width":130,"caption":"D3: Shades of the White Peak","height":41});
															thumbnails[6988525] = clik.newPhoto({"id":6988525,"src":"HOPE_SPRINGS_ETERNAL_thumb.jpg","galleries_id":378718,"server_id":5,"link":"photo_6988525.html","width":130,"caption":"Hope Springs Eternal","height":90});
															thumbnails[6988527] = clik.newPhoto({"id":6988527,"src":"Meggett-reservoir-Borders-reflections_thumb.jpg","galleries_id":378718,"server_id":5,"link":"photo_6988527.html","width":91,"caption":"Meggett Reservoir, Borders reflections","height":130});
															thumbnails[6988528] = clik.newPhoto({"id":6988528,"src":"Sunset-from-Fiskavaig_thumb.jpg","galleries_id":378718,"server_id":5,"link":"photo_6988528.html","width":87,"caption":"Sunset from Fiskavaig","height":130});
															thumbnails[5575774] = clik.newPhoto({"id":5575774,"src":"Cuddles_thumb.jpg","galleries_id":291715,"server_id":5,"link":"photo_5575774.html","width":130,"caption":"C1: Cuddles","height":105});
															thumbnails[5575776] = clik.newPhoto({"id":5575776,"src":"Seranade_thumb.jpg","galleries_id":291715,"server_id":5,"link":"photo_5575776.html","width":92,"caption":"C2: Serenade","height":130});
															thumbnails[5575782] = clik.newPhoto({"id":5575782,"src":"Yaweee---_thumb.jpg","galleries_id":291715,"server_id":5,"link":"photo_5575782.html","width":116,"caption":"M2: Yawee","height":130});
															thumbnails[5575786] = clik.newPhoto({"id":5575786,"src":"BPC_contrasting_trees-2013_BW_final_print_thumb.jpg","galleries_id":291715,"server_id":5,"link":"photo_5575786.html","width":130,"caption":"M3: Twisted","height":93});
															thumbnails[5575756] = clik.newPhoto({"id":5575756,"src":"Cha-Cha-Cha-_thumb.jpg","galleries_id":304202,"server_id":5,"link":"photo_5575756.html","width":103,"caption":"M2: Cha Cha Cha","height":130});
															thumbnails[5575755] = clik.newPhoto({"id":5575755,"src":"Jamaica-Joe_thumb.jpg","galleries_id":304202,"server_id":5,"link":"photo_5575755.html","width":130,"caption":"M3: Jamaica Joe","height":103});
															thumbnails[5575754] = clik.newPhoto({"id":5575754,"src":"Yaya_thumb.jpg","galleries_id":304202,"server_id":5,"link":"photo_5575754.html","width":95,"caption":"C1: Ya Ya","height":130});
															thumbnails[5863821] = clik.newPhoto({"id":5863821,"src":"A20913_3E27D038-1EC9-D45B-1C64618E553F2568_thumb.jpg","galleries_id":267589,"server_id":5,"link":"photo_5863821.html","width":130,"caption":"D1: Farming Talk","height":73});
															thumbnails[5390928] = clik.newPhoto({"id":5390928,"src":"110_-_SanderlingRobert--Askew_thumb.jpg","galleries_id":304202,"server_id":5,"link":"photo_5390928.html","width":130,"caption":"D2: Sanderling","height":106});
															thumbnails[5390933] = clik.newPhoto({"id":5390933,"src":"180_-_Stormy_Weather_by_Les_Nixon_thumb.jpg","galleries_id":304202,"server_id":5,"link":"photo_5390933.html","width":84,"caption":"D3: Stormy Weather","height":130});
															thumbnails[5390939] = clik.newPhoto({"id":5390939,"src":"230_-_Lonscale_Fell_across_Derwent_water_thumb.jpg","galleries_id":304202,"server_id":5,"link":"photo_5390939.html","width":130,"caption":"D3: Lonscale Fell across Derwent water","height":59});
															thumbnails[5575693] = clik.newPhoto({"id":5575693,"src":"BPC_Down_the_Lane_thumb.jpg","galleries_id":304210,"server_id":5,"link":"photo_5575693.html","width":130,"caption":"M2: Down The Lane","height":87});
															thumbnails[5575706] = clik.newPhoto({"id":5575706,"src":"KoKo_Mebacha_thumb.jpg","galleries_id":304210,"server_id":5,"link":"photo_5575706.html","width":94,"caption":"C2: Koko Mebacha","height":130});
															thumbnails[5575702] = clik.newPhoto({"id":5575702,"src":"059_thumb.jpg","galleries_id":304210,"server_id":5,"link":"photo_5575702.html","width":130,"caption":"C3: Deer At Chatsworth","height":65});
															thumbnails[5575698] = clik.newPhoto({"id":5575698,"src":"Roibin_Chicks_700_x_560_pixels_Hilary_Tann_thumb.jpg","galleries_id":304210,"server_id":5,"link":"photo_5575698.html","width":130,"caption":"C3: Robin Chicks","height":104});
															thumbnails[5575555] = clik.newPhoto({"id":5575555,"src":"IMG_4260_thumb.jpg","galleries_id":304210,"server_id":5,"link":"photo_5575555.html","width":130,"caption":"D1: A Long Way Down","height":82});
															thumbnails[5575558] = clik.newPhoto({"id":5575558,"src":"NixonLesWhat__yer_looking_at_thumb.jpg","galleries_id":304210,"server_id":5,"link":"photo_5575558.html","width":130,"caption":"D1: What Are You Looking At?","height":66});
															thumbnails[5575551] = clik.newPhoto({"id":5575551,"src":"Dancing-Guard_thumb.jpg","galleries_id":304210,"server_id":5,"link":"photo_5575551.html","width":130,"caption":"D2: Dancing Guard","height":96});
															thumbnails[5575538] = clik.newPhoto({"id":5575538,"src":"AskewRobertNuthatch_thumb.jpg","galleries_id":304210,"server_id":5,"link":"photo_5575538.html","width":130,"caption":"D2: Nuthatch","height":98});
															thumbnails[5575543] = clik.newPhoto({"id":5575543,"src":"DysonLindahollow_medows_summer1_thumb.jpg","galleries_id":304210,"server_id":5,"link":"photo_5575543.html","width":130,"caption":"D3: Hollow Meadows Summer","height":45});
															thumbnails[5575549] = clik.newPhoto({"id":5575549,"src":"RobertAskewCoot_thumb.jpg","galleries_id":304210,"server_id":5,"link":"photo_5575549.html","width":130,"caption":"D3: Coot","height":79});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[291715] = clik.newGallery({"parentGallery":291714,"usePopups":true,"title":"1st Bi-Monthly","link":"gallery_291715.html","maxRecords":0.0,"photoIDs":[5159749.0,5165405.0,5390977.0,5390983.0,5390986.0,5390989.0,5575774.0,5575776.0,5575782.0,5575786.0],"skipIndex":0,"section_code":"gallery","featured_images":"5575786,5575782,5575776,5575774,5390989,5390986,5390983,5390977,5165405,5159749","id":291715,"singleSection":false});				  						galleries[304202] = clik.newGallery({"parentGallery":291714,"usePopups":true,"title":"2nd Bi-Monthly","link":"gallery_304202.html","maxRecords":0.0,"photoIDs":[5575756.0,5575755.0,5575754.0,5390928.0,5390933.0,5390939.0],"skipIndex":0,"section_code":"gallery","featured_images":"5575756,5575755,5575754,5390939,5390933,5390928","id":304202,"singleSection":false});				  						galleries[304210] = clik.newGallery({"parentGallery":291714,"usePopups":true,"title":"3rd Bi-Monthly","link":"gallery_304210.html","maxRecords":0.0,"photoIDs":[5575693.0,5575706.0,5575702.0,5575698.0,5575555.0,5575558.0,5575551.0,5575538.0,5575543.0,5575549.0],"skipIndex":0,"section_code":"gallery","featured_images":"5575706,5575702,5575698,5575693,5575558,5575555,5575551,5575549,5575543,5575538","id":304210,"singleSection":false});				  						galleries[291714] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Club Competitions","link":"gallery_291714.html","maxRecords":0.0,"photoIDs":[],"skipIndex":0,"section_code":"gallery","featured_images":"5575786,5575782,5575776,5575774,5575756,5575755,5575754,5575706,5575702,5575698","id":291714,"singleSection":false});				  						galleries[267395] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Rob Askew","link":"gallery_267395.html","maxRecords":0.0,"photoIDs":[5159972.0,5159982.0],"skipIndex":0,"section_code":"gallery","featured_images":"5159982,5159972","id":267395,"singleSection":false});				  						galleries[267589] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Ian Daisley","link":"gallery_267589.html","maxRecords":0.0,"photoIDs":[5158046.0,5158157.0,5863821.0],"skipIndex":0,"section_code":"gallery","featured_images":"5863821,5158157,5158046","id":267589,"singleSection":false});				  						galleries[295843] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Jon Reed","link":"gallery_295843.html","maxRecords":0.0,"photoIDs":[5252652.0,5252654.0,5252656.0],"skipIndex":0,"section_code":"gallery","featured_images":"5252656,5252654,5252652","id":295843,"singleSection":false});				  						galleries[267590] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Garry Wingrove","link":"gallery_267590.html","maxRecords":0.0,"photoIDs":[5159926.0,5159928.0],"skipIndex":0,"section_code":"gallery","featured_images":"5159928,5159926","id":267590,"singleSection":false});				  						galleries[267592] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Jim Edmondson","link":"gallery_267592.html","maxRecords":0.0,"photoIDs":[5159761.0,5159762.0],"skipIndex":0,"section_code":"gallery","featured_images":"5159762,5159761","id":267592,"singleSection":false});				  						galleries[267591] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Les Nixon","link":"gallery_267591.html","maxRecords":0.0,"photoIDs":[5159820.0,5159825.0],"skipIndex":0,"section_code":"gallery","featured_images":"5159825,5159820","id":267591,"singleSection":false});				  						galleries[378718] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Meg Jullien","link":"gallery_378718.html","maxRecords":0.0,"photoIDs":[6988525.0,6988527.0,6988528.0],"skipIndex":0,"section_code":"gallery","featured_images":"6988528,6988527,6988525","id":378718,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '6988528,6988527,6988525,5390989,5390983,5390977,5252656,5252654,5252652,5165405,5159982,5159928,5159749,5158046,5575774,5575782,5575754,5390928,5390933,5575693,5575702,5575698,5575555,5575543';
imageSets[3] = '6988528,6988527,6988525,5863821,5823158,5575786,5575782,5575776,5575774,5575756,5575755,5575754,5575706,5575702,5575698,5575693,5575558,5575555,5575551,5575549,5575543,5575538,5390989,5390986,5390983,5390977,5390939,5390933,5390928,5252656,5252654,5252652,5165405,5159982,5159972,5159928,5159926,5159825,5159820,5159762,5159761,5159749,5158157,5158046';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/iandaisley/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/iandaisley/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/iandaisley/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/iandaisley/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/iandaisley/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/iandaisley/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/iandaisley/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/iandaisley/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/iandaisley/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/iandaisley/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/iandaisley/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/iandaisley/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/iandaisley/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/iandaisley/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/iandaisley/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/iandaisley/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/iandaisley/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/iandaisley/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/iandaisley/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/iandaisley/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/iandaisley/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/iandaisley/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/iandaisley/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/iandaisley/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/iandaisley/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/iandaisley/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/iandaisley/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 = 'Bakewell Photo Club: ' + 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;
	}
}

			

