window.thumbnails = {};
															thumbnails[3476357] = clik.newPhoto({"id":3476357,"src":"FamilyJPG1_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":103});
															thumbnails[3476359] = clik.newPhoto({"id":3476359,"src":"new watch2_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":162});
															thumbnails[3476363] = clik.newPhoto({"id":3476363,"src":"Liz&JonJPG1_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":96});
															thumbnails[3476367] = clik.newPhoto({"id":3476367,"src":"playtime1_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":87});
															thumbnails[2723990] = clik.newPhoto({"id":2723990,"src":"00690_RT8JPG2_thumb.jpg","galleries_id":170839,"server_id":32,"link":"photo_2723990.html","width":130,"caption":"","height":87});
															thumbnails[3475280] = clik.newPhoto({"id":3475280,"src":"112_1300fc111_thumb.jpg","galleries_id":212518,"server_id":32,"link":"photo_3475280.html","width":130,"caption":"","height":87});
															thumbnails[3475282] = clik.newPhoto({"id":3475282,"src":"117_1788fc1_thumb.jpg","galleries_id":212518,"server_id":32,"link":"photo_3475282.html","width":130,"caption":"","height":87});
															thumbnails[3475285] = clik.newPhoto({"id":3475285,"src":"120_2043fc11_thumb.jpg","galleries_id":212518,"server_id":32,"link":"photo_3475285.html","width":130,"caption":"","height":64});
															thumbnails[3475286] = clik.newPhoto({"id":3475286,"src":"120_20892_thumb.jpg","galleries_id":212518,"server_id":32,"link":"photo_3475286.html","width":130,"caption":"","height":84});
															thumbnails[3475287] = clik.newPhoto({"id":3475287,"src":"120_20961_thumb.jpg","galleries_id":212518,"server_id":32,"link":"photo_3475287.html","width":130,"caption":"","height":86});
															thumbnails[3475290] = clik.newPhoto({"id":3475290,"src":"121_2145fc1_thumb.jpg","galleries_id":212518,"server_id":32,"link":"photo_3475290.html","width":130,"caption":"","height":78});
															thumbnails[3475292] = clik.newPhoto({"id":3475292,"src":"121_2183fc1_thumb.jpg","galleries_id":212518,"server_id":32,"link":"photo_3475292.html","width":130,"caption":"","height":82});
															thumbnails[3475294] = clik.newPhoto({"id":3475294,"src":"125_2558fc31_thumb.jpg","galleries_id":212518,"server_id":32,"link":"photo_3475294.html","width":130,"caption":"","height":99});
															thumbnails[3475295] = clik.newPhoto({"id":3475295,"src":"130_3041fc1_thumb.jpg","galleries_id":212518,"server_id":32,"link":"photo_3475295.html","width":130,"caption":"","height":91});
															thumbnails[3475297] = clik.newPhoto({"id":3475297,"src":"132_3263fc11_thumb.jpg","galleries_id":212518,"server_id":32,"link":"photo_3475297.html","width":130,"caption":"","height":87});
															thumbnails[3475298] = clik.newPhoto({"id":3475298,"src":"148_4820fc1_thumb.jpg","galleries_id":212518,"server_id":32,"link":"photo_3475298.html","width":130,"caption":"","height":81});
															thumbnails[3475300] = clik.newPhoto({"id":3475300,"src":"149_4949fc1_thumb.jpg","galleries_id":212518,"server_id":32,"link":"photo_3475300.html","width":130,"caption":"","height":86});
															thumbnails[3475303] = clik.newPhoto({"id":3475303,"src":"152_5246fc1_thumb.jpg","galleries_id":212518,"server_id":32,"link":"photo_3475303.html","width":130,"caption":"","height":89});
															thumbnails[3475304] = clik.newPhoto({"id":3475304,"src":"157_5706fc2_thumb.jpg","galleries_id":212518,"server_id":32,"link":"photo_3475304.html","width":130,"caption":"","height":86});
															thumbnails[3475305] = clik.newPhoto({"id":3475305,"src":"160_6074framed 11_thumb.jpg","galleries_id":212518,"server_id":32,"link":"photo_3475305.html","width":130,"caption":"","height":59});
															thumbnails[3475307] = clik.newPhoto({"id":3475307,"src":"00852_JFRfc1_thumb.jpg","galleries_id":212518,"server_id":32,"link":"photo_3475307.html","width":130,"caption":"","height":55});
															thumbnails[3475308] = clik.newPhoto({"id":3475308,"src":"00855_JFRfc1_thumb.jpg","galleries_id":212518,"server_id":32,"link":"photo_3475308.html","width":130,"caption":"","height":96});
															thumbnails[3475309] = clik.newPhoto({"id":3475309,"src":"DPP_0130b1_thumb.jpg","galleries_id":212518,"server_id":32,"link":"photo_3475309.html","width":130,"caption":"","height":84});
															thumbnails[3476336] = clik.newPhoto({"id":3476336,"src":"00709_RT8JPG1_thumb.jpg","galleries_id":170839,"server_id":32,"link":"photo_3476336.html","width":130,"caption":"","height":95});
															thumbnails[3476339] = clik.newPhoto({"id":3476339,"src":"00698_RT8JPG1_thumb.jpg","galleries_id":170839,"server_id":32,"link":"photo_3476339.html","width":130,"caption":"","height":106});
															thumbnails[3476343] = clik.newPhoto({"id":3476343,"src":"family aJPG1_thumb.jpg","galleries_id":170839,"server_id":32,"link":"photo_3476343.html","width":130,"caption":"","height":97});
															thumbnails[3476374] = clik.newPhoto({"id":3476374,"src":"FamilyJPG2_thumb.jpg","galleries_id":170839,"server_id":32,"link":"photo_3476374.html","width":130,"caption":"","height":103});
															thumbnails[3476382] = clik.newPhoto({"id":3476382,"src":"Liz&JonJPG2_thumb.jpg","galleries_id":170839,"server_id":32,"link":"photo_3476382.html","width":130,"caption":"","height":96});
															thumbnails[3476391] = clik.newPhoto({"id":3476391,"src":"new watch3_thumb.jpg","galleries_id":170839,"server_id":32,"link":"photo_3476391.html","width":130,"caption":"","height":162});
															thumbnails[3476394] = clik.newPhoto({"id":3476394,"src":"playtime2_thumb.jpg","galleries_id":170839,"server_id":32,"link":"photo_3476394.html","width":130,"caption":"","height":87});
															thumbnails[3476396] = clik.newPhoto({"id":3476396,"src":"Untitled-1JPG1_thumb.jpg","galleries_id":170839,"server_id":32,"link":"photo_3476396.html","width":130,"caption":"","height":170});
															thumbnails[3476407] = clik.newPhoto({"id":3476407,"src":"2 girlsJPG1_thumb.jpg","galleries_id":170770,"server_id":32,"link":"photo_3476407.html","width":130,"caption":"","height":103});
															thumbnails[3476408] = clik.newPhoto({"id":3476408,"src":"Cat 2JPG1_thumb.jpg","galleries_id":170770,"server_id":32,"link":"photo_3476408.html","width":130,"caption":"","height":87});
															thumbnails[3476411] = clik.newPhoto({"id":3476411,"src":"Cat 5aJPG1_thumb.jpg","galleries_id":170770,"server_id":32,"link":"photo_3476411.html","width":130,"caption":"","height":117});
															thumbnails[3476425] = clik.newPhoto({"id":3476425,"src":"clair 1_ppJPG1_thumb.jpg","galleries_id":170770,"server_id":32,"link":"photo_3476425.html","width":130,"caption":"","height":104});
															thumbnails[3476428] = clik.newPhoto({"id":3476428,"src":"Emma-1aJPG1_thumb.jpg","galleries_id":170770,"server_id":32,"link":"photo_3476428.html","width":130,"caption":"","height":192});
															thumbnails[3476437] = clik.newPhoto({"id":3476437,"src":"girl 2JPG1_thumb.jpg","galleries_id":170770,"server_id":32,"link":"photo_3476437.html","width":130,"caption":"","height":88});
															thumbnails[3476438] = clik.newPhoto({"id":3476438,"src":"Imogen ab1_ppJPG1_thumb.jpg","galleries_id":170770,"server_id":32,"link":"photo_3476438.html","width":130,"caption":"","height":130});
															thumbnails[3476439] = clik.newPhoto({"id":3476439,"src":"Jenny 1aJPG1_thumb.jpg","galleries_id":170770,"server_id":32,"link":"photo_3476439.html","width":130,"caption":"","height":198});
															thumbnails[3476440] = clik.newPhoto({"id":3476440,"src":"Katy-2a_ppJPG1_thumb.jpg","galleries_id":170770,"server_id":32,"link":"photo_3476440.html","width":130,"caption":"","height":196});
															thumbnails[3476441] = clik.newPhoto({"id":3476441,"src":"Katy-4JPG1_thumb.jpg","galleries_id":170770,"server_id":32,"link":"photo_3476441.html","width":130,"caption":"","height":185});
															thumbnails[3476442] = clik.newPhoto({"id":3476442,"src":"Kerry-4JPG1_thumb.jpg","galleries_id":170770,"server_id":32,"link":"photo_3476442.html","width":130,"caption":"","height":92});
															thumbnails[3476443] = clik.newPhoto({"id":3476443,"src":"Kerry-1psJPG1_thumb.jpg","galleries_id":170770,"server_id":32,"link":"photo_3476443.html","width":130,"caption":"","height":196});
															thumbnails[3476486] = clik.newPhoto({"id":3476486,"src":"couple in leatherJPG1_thumb.jpg","galleries_id":170935,"server_id":32,"link":"photo_3476486.html","width":130,"caption":"","height":168});
															thumbnails[3476488] = clik.newPhoto({"id":3476488,"src":"MaleJPG1_thumb.jpg","galleries_id":170935,"server_id":32,"link":"photo_3476488.html","width":130,"caption":"","height":185});
															thumbnails[3476491] = clik.newPhoto({"id":3476491,"src":"mike 2JPG1_thumb.jpg","galleries_id":170935,"server_id":32,"link":"photo_3476491.html","width":130,"caption":"","height":172});
															thumbnails[3476493] = clik.newPhoto({"id":3476493,"src":"mikeJPG1_thumb.jpg","galleries_id":170935,"server_id":32,"link":"photo_3476493.html","width":130,"caption":"","height":174});
															thumbnails[3476494] = clik.newPhoto({"id":3476494,"src":"sydJPG1_thumb.jpg","galleries_id":170935,"server_id":32,"link":"photo_3476494.html","width":130,"caption":"","height":197});
															thumbnails[3476497] = clik.newPhoto({"id":3476497,"src":"blue t shirtJPG1_thumb.jpg","galleries_id":170769,"server_id":32,"link":"photo_3476497.html","width":130,"caption":"","height":124});
															thumbnails[3476499] = clik.newPhoto({"id":3476499,"src":"Boy&girlJPG1_thumb.jpg","galleries_id":170769,"server_id":32,"link":"photo_3476499.html","width":130,"caption":"","height":179});
															thumbnails[3476500] = clik.newPhoto({"id":3476500,"src":"CherubJPG1_thumb.jpg","galleries_id":170769,"server_id":32,"link":"photo_3476500.html","width":130,"caption":"","height":95});
															thumbnails[3476501] = clik.newPhoto({"id":3476501,"src":"Cute 1JPG1_thumb.jpg","galleries_id":170769,"server_id":32,"link":"photo_3476501.html","width":130,"caption":"","height":179});
															thumbnails[3476533] = clik.newPhoto({"id":3476533,"src":"Driving1_thumb.jpg","galleries_id":170769,"server_id":32,"link":"photo_3476533.html","width":130,"caption":"","height":87});
															thumbnails[3476534] = clik.newPhoto({"id":3476534,"src":"girl 1aJPG1_thumb.jpg","galleries_id":170769,"server_id":32,"link":"photo_3476534.html","width":130,"caption":"","height":93});
															thumbnails[3476537] = clik.newPhoto({"id":3476537,"src":"IMG_0121JPG1_thumb.jpg","galleries_id":170769,"server_id":32,"link":"photo_3476537.html","width":130,"caption":"","height":185});
															thumbnails[3476540] = clik.newPhoto({"id":3476540,"src":"Laughter1_thumb.jpg","galleries_id":170769,"server_id":32,"link":"photo_3476540.html","width":130,"caption":"","height":96});
															thumbnails[3476543] = clik.newPhoto({"id":3476543,"src":"sad aJPG1_thumb.jpg","galleries_id":170769,"server_id":32,"link":"photo_3476543.html","width":130,"caption":"","height":94});
															thumbnails[3476544] = clik.newPhoto({"id":3476544,"src":"ToyJPG1_thumb.jpg","galleries_id":170769,"server_id":32,"link":"photo_3476544.html","width":130,"caption":"","height":187});
															thumbnails[3476562] = clik.newPhoto({"id":3476562,"src":"02421_JFRa_thumb.jpg","galleries_id":170770,"server_id":32,"link":"photo_3476562.html","width":130,"caption":"","height":87});
															thumbnails[3476563] = clik.newPhoto({"id":3476563,"src":"02483_JFRd_thumb.jpg","galleries_id":170770,"server_id":32,"link":"photo_3476563.html","width":130,"caption":"","height":138});
															thumbnails[3476565] = clik.newPhoto({"id":3476565,"src":"02500_JFRa_thumb.jpg","galleries_id":170770,"server_id":32,"link":"photo_3476565.html","width":130,"caption":"","height":99});
															thumbnails[3476568] = clik.newPhoto({"id":3476568,"src":"02587_JFRb_thumb.jpg","galleries_id":170770,"server_id":32,"link":"photo_3476568.html","width":130,"caption":"","height":190});
															thumbnails[3476575] = clik.newPhoto({"id":3476575,"src":"02664_JFRb copy_thumb.jpg","galleries_id":170770,"server_id":32,"link":"photo_3476575.html","width":130,"caption":"","height":81});
															thumbnails[3476577] = clik.newPhoto({"id":3476577,"src":"02668_JFRa_thumb.jpg","galleries_id":170770,"server_id":32,"link":"photo_3476577.html","width":130,"caption":"","height":87});
															thumbnails[3476589] = clik.newPhoto({"id":3476589,"src":"02691_JFRa_thumb.jpg","galleries_id":170770,"server_id":32,"link":"photo_3476589.html","width":130,"caption":"","height":195});
															thumbnails[3478933] = clik.newPhoto({"id":3478933,"src":"IMG_0093b_thumb.jpg","galleries_id":212518,"server_id":32,"link":"photo_3478933.html","width":130,"caption":"","height":193});
															thumbnails[3475265] = clik.newPhoto({"id":3475265,"src":"IMG_0160a_thumb.jpg","galleries_id":212518,"server_id":32,"link":"photo_3475265.html","width":130,"caption":"","height":81});
															thumbnails[3475279] = clik.newPhoto({"id":3475279,"src":"108_0807b&wfc21_thumb.jpg","galleries_id":212518,"server_id":32,"link":"photo_3475279.html","width":130,"caption":"","height":82});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[170839] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Families","link":"gallery_170839.html","maxRecords":0.0,"photoIDs":[2723990.0,3476336.0,3476339.0,3476343.0,3476374.0,3476382.0,3476391.0,3476394.0,3476396.0],"skipIndex":0,"section_code":"gallery","featured_images":2723990.0,"id":170839,"singleSection":false});				  						galleries[212518] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Miscellaneous","link":"gallery_212518.html","maxRecords":0.0,"photoIDs":[3475280.0,3475282.0,3475285.0,3475286.0,3475287.0,3475290.0,3475292.0,3475294.0,3475295.0,3475297.0,3475298.0,3475300.0,3475303.0,3475304.0,3475305.0,3475307.0,3475308.0,3475309.0,3478933.0,3475265.0,3475279.0],"skipIndex":0,"section_code":"gallery","featured_images":"3478933,3475309,3475308,3475307,3475305,3475304,3475303,3475300,3475298,3475297","id":212518,"singleSection":false});				  						galleries[170769] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Kids","link":"gallery_170769.html","maxRecords":0.0,"photoIDs":[3476497.0,3476499.0,3476500.0,3476501.0,3476533.0,3476534.0,3476537.0,3476540.0,3476543.0,3476544.0],"skipIndex":0,"section_code":"gallery","featured_images":"3476544,3476543,3476540,3476537,3476534,3476533,3476501,3476500,3476499,3476497","id":170769,"singleSection":false});				  						galleries[170770] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"women","link":"gallery_170770.html","maxRecords":0.0,"photoIDs":[3476407.0,3476408.0,3476411.0,3476425.0,3476428.0,3476437.0,3476438.0,3476439.0,3476440.0,3476441.0,3476442.0,3476443.0,3476562.0,3476563.0,3476565.0,3476568.0,3476575.0,3476577.0,3476589.0],"skipIndex":0,"section_code":"gallery","featured_images":"3476589,3476577,3476575,3476568,3476565,3476563,3476562,3476443,3476442,3476441","id":170770,"singleSection":false});				  						galleries[170935] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Men&Couples","link":"gallery_170935.html","maxRecords":0.0,"photoIDs":[3476486.0,3476488.0,3476491.0,3476493.0,3476494.0],"skipIndex":0,"section_code":"gallery","featured_images":"3476494,3476493,3476491,3476488,3476486","id":170935,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '3476589,3476577,3476544,3476534,3476500,3476486,3476438,3476428,3476411,2723990';
imageSets[2] = '2723990';
imageSets[3] = '3478933,3476589,3476577,3476575,3476568,3476565,3476563,3476562,3476544,3476543,3476540,3476537,3476534,3476533,3476501,3476500,3476499,3476497,3476494,3476493,3476491,3476488,3476486,3476443,3476442,3476441,3476440,3476439,3476438,3476437,3476428,3476425,3476411,3476408,3476407,3476396,3476394,3476391,3476382,3476374,3476367,3476363,3476359,3476357,3476343,3476339,3476336,3475309,3475308,3475307';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'www12.clikpic.com/falco1025/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/falco1025/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/falco1025/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/falco1025/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/falco1025/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/falco1025/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/falco1025/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/falco1025/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/falco1025/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/falco1025/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/falco1025/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/falco1025/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/falco1025/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/falco1025/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/falco1025/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/falco1025/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/falco1025/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/falco1025/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/falco1025/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/falco1025/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/falco1025/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/falco1025/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/falco1025/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/falco1025/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 = 'Bigger picture photography: ' + 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;
	}
}

			

