window.thumbnails = {};
															thumbnails[8848380] = clik.newPhoto({"id":8848380,"src":"_TPK2506_thumb.jpg","galleries_id":463580,"server_id":15,"link":"photo_8848380.html","width":130,"caption":"Langtoft Village","height":192});
															thumbnails[8806170] = clik.newPhoto({"id":8806170,"src":"_TPK2473_thumb.jpg","galleries_id":236547,"server_id":15,"link":"photo_8806170.html","width":130,"caption":"","height":117});
															thumbnails[8806172] = clik.newPhoto({"id":8806172,"src":"_TPK2461-Edit-Edit_thumb.jpg","galleries_id":236547,"server_id":15,"link":"photo_8806172.html","width":130,"caption":"","height":104});
															thumbnails[8806175] = clik.newPhoto({"id":8806175,"src":"_TPK2380_thumb.jpg","galleries_id":236547,"server_id":15,"link":"photo_8806175.html","width":130,"caption":"","height":216});
															thumbnails[8806178] = clik.newPhoto({"id":8806178,"src":"_TPK2379_thumb.jpg","galleries_id":236547,"server_id":15,"link":"photo_8806178.html","width":130,"caption":"","height":141});
															thumbnails[8806179] = clik.newPhoto({"id":8806179,"src":"_TPK2379-2_thumb.jpg","galleries_id":236547,"server_id":15,"link":"photo_8806179.html","width":130,"caption":"","height":141});
															thumbnails[8806182] = clik.newPhoto({"id":8806182,"src":"_TPK2364_thumb.jpg","galleries_id":236547,"server_id":15,"link":"photo_8806182.html","width":130,"caption":"","height":109});
															thumbnails[8806187] = clik.newPhoto({"id":8806187,"src":"_TPK2141_thumb.jpg","galleries_id":236547,"server_id":15,"link":"photo_8806187.html","width":130,"caption":"","height":86});
															thumbnails[8806208] = clik.newPhoto({"id":8806208,"src":"_TPK2080_thumb.jpg","galleries_id":463580,"server_id":15,"link":"photo_8806208.html","width":130,"caption":"","height":147});
															thumbnails[8806211] = clik.newPhoto({"id":8806211,"src":"_TPK1952_thumb.jpg","galleries_id":236547,"server_id":15,"link":"photo_8806211.html","width":130,"caption":"","height":137});
															thumbnails[8806213] = clik.newPhoto({"id":8806213,"src":"_TPK1945_thumb.jpg","galleries_id":236547,"server_id":15,"link":"photo_8806213.html","width":130,"caption":"","height":171});
															thumbnails[8806214] = clik.newPhoto({"id":8806214,"src":"_TPK1942_thumb.jpg","galleries_id":236547,"server_id":15,"link":"photo_8806214.html","width":130,"caption":"","height":106});
															thumbnails[8806217] = clik.newPhoto({"id":8806217,"src":"_TPK1902_thumb.jpg","galleries_id":236547,"server_id":15,"link":"photo_8806217.html","width":130,"caption":"","height":163});
															thumbnails[8806220] = clik.newPhoto({"id":8806220,"src":"_TPK2446_thumb.jpg","galleries_id":463580,"server_id":15,"link":"photo_8806220.html","width":130,"caption":"","height":145});
															thumbnails[8673392] = clik.newPhoto({"id":8673392,"src":"_TPK2248_thumb.jpg","galleries_id":457759,"server_id":15,"link":"photo_8673392.html","width":130,"caption":"Rolls Royce","height":99});
															thumbnails[8673393] = clik.newPhoto({"id":8673393,"src":"_TPK2250_thumb.jpg","galleries_id":457759,"server_id":15,"link":"photo_8673393.html","width":130,"caption":"Rolls Royce","height":88});
															thumbnails[8673394] = clik.newPhoto({"id":8673394,"src":"_TPK2253_thumb.jpg","galleries_id":457759,"server_id":15,"link":"photo_8673394.html","width":130,"caption":"Old Rolls Royce","height":87});
															thumbnails[8673395] = clik.newPhoto({"id":8673395,"src":"_TPK2261_thumb.jpg","galleries_id":457759,"server_id":15,"link":"photo_8673395.html","width":130,"caption":"Silver Lady","height":122});
															thumbnails[8673396] = clik.newPhoto({"id":8673396,"src":"_TPK2264_thumb.jpg","galleries_id":457759,"server_id":15,"link":"photo_8673396.html","width":130,"caption":"","height":86});
															thumbnails[8673398] = clik.newPhoto({"id":8673398,"src":"_TPK2278_thumb.jpg","galleries_id":457759,"server_id":15,"link":"photo_8673398.html","width":130,"caption":"Limo","height":82});
															thumbnails[7717441] = clik.newPhoto({"id":7717441,"src":"_TPK0871_thumb.jpg","galleries_id":417704,"server_id":15,"link":"photo_7717441.html","width":130,"caption":"","height":82});
															thumbnails[7717599] = clik.newPhoto({"id":7717599,"src":"DSCF04141_thumb.jpg","galleries_id":417704,"server_id":15,"link":"photo_7717599.html","width":130,"caption":"","height":173});
															thumbnails[7717611] = clik.newPhoto({"id":7717611,"src":"DSCF04152_thumb.jpg","galleries_id":417704,"server_id":15,"link":"photo_7717611.html","width":130,"caption":"","height":173});
															thumbnails[7717612] = clik.newPhoto({"id":7717612,"src":"_TPK08701_thumb.jpg","galleries_id":417704,"server_id":15,"link":"photo_7717612.html","width":130,"caption":"","height":160});
															thumbnails[7717618] = clik.newPhoto({"id":7717618,"src":"_TPK08661_thumb.jpg","galleries_id":417704,"server_id":15,"link":"photo_7717618.html","width":130,"caption":"","height":187});
															thumbnails[7717620] = clik.newPhoto({"id":7717620,"src":"_TPK08321_thumb.jpg","galleries_id":417704,"server_id":15,"link":"photo_7717620.html","width":130,"caption":"","height":100});
															thumbnails[7717628] = clik.newPhoto({"id":7717628,"src":"_TPK08391_thumb.jpg","galleries_id":417704,"server_id":15,"link":"photo_7717628.html","width":130,"caption":"","height":178});
															thumbnails[7717633] = clik.newPhoto({"id":7717633,"src":"_TPK08421_thumb.jpg","galleries_id":417704,"server_id":15,"link":"photo_7717633.html","width":130,"caption":"","height":172});
															thumbnails[7717640] = clik.newPhoto({"id":7717640,"src":"_TPK08481_thumb.jpg","galleries_id":417704,"server_id":15,"link":"photo_7717640.html","width":130,"caption":"","height":124});
															thumbnails[7717642] = clik.newPhoto({"id":7717642,"src":"_TPK08501_thumb.jpg","galleries_id":417704,"server_id":15,"link":"photo_7717642.html","width":130,"caption":"","height":201});
															thumbnails[7717643] = clik.newPhoto({"id":7717643,"src":"_TPK08291_thumb.jpg","galleries_id":417704,"server_id":15,"link":"photo_7717643.html","width":130,"caption":"","height":97});
															thumbnails[7717644] = clik.newPhoto({"id":7717644,"src":"_TPK0826_thumb.jpg","galleries_id":417704,"server_id":15,"link":"photo_7717644.html","width":130,"caption":"","height":112});
															thumbnails[7717645] = clik.newPhoto({"id":7717645,"src":"_TPK0811_thumb.jpg","galleries_id":417704,"server_id":15,"link":"photo_7717645.html","width":130,"caption":"","height":86});
															thumbnails[7717646] = clik.newPhoto({"id":7717646,"src":"_TPK08101_thumb.jpg","galleries_id":417704,"server_id":15,"link":"photo_7717646.html","width":130,"caption":"","height":86});
															thumbnails[7717650] = clik.newPhoto({"id":7717650,"src":"_TPK07971_thumb.jpg","galleries_id":417704,"server_id":15,"link":"photo_7717650.html","width":130,"caption":"","height":178});
															thumbnails[7717653] = clik.newPhoto({"id":7717653,"src":"_TPK07841_thumb.jpg","galleries_id":417704,"server_id":15,"link":"photo_7717653.html","width":130,"caption":"","height":207});
															thumbnails[7717657] = clik.newPhoto({"id":7717657,"src":"DSCF0435-Edit1_thumb.jpg","galleries_id":417704,"server_id":15,"link":"photo_7717657.html","width":130,"caption":"","height":94});
															thumbnails[7717659] = clik.newPhoto({"id":7717659,"src":"DSCF0431-Edit-21_thumb.jpg","galleries_id":417704,"server_id":15,"link":"photo_7717659.html","width":130,"caption":"","height":97});
															thumbnails[7717661] = clik.newPhoto({"id":7717661,"src":"_TPK08711_thumb.jpg","galleries_id":417704,"server_id":15,"link":"photo_7717661.html","width":130,"caption":"","height":82});
															thumbnails[4482765] = clik.newPhoto({"id":4482765,"src":"IMG_1272_thumb.jpg","galleries_id":233279,"server_id":15,"link":"photo_4482765.html","width":130,"caption":"","height":96});
															thumbnails[4001706] = clik.newPhoto({"id":4001706,"src":"_MG_0357w_thumb.jpg","galleries_id":236547,"server_id":15,"link":"photo_4001706.html","width":130,"caption":"","height":124});
															thumbnails[3960641] = clik.newPhoto({"id":3960641,"src":"Owl-1_thumb.jpg","galleries_id":233279,"server_id":15,"link":"photo_3960641.html","width":130,"caption":"","height":115});
															thumbnails[3955950] = clik.newPhoto({"id":3955950,"src":"IMG_0222_thumb.JPG","galleries_id":233279,"server_id":15,"link":"photo_3955950.html","width":130,"caption":"","height":91});
															thumbnails[3949194] = clik.newPhoto({"id":3949194,"src":"IMG_0131_thumb.jpg","galleries_id":233279,"server_id":15,"link":"photo_3949194.html","width":130,"caption":"","height":150});
															thumbnails[3949206] = clik.newPhoto({"id":3949206,"src":"IMG_0139_thumb.jpg","galleries_id":233279,"server_id":15,"link":"photo_3949206.html","width":130,"caption":"","height":137});
															thumbnails[3950263] = clik.newPhoto({"id":3950263,"src":"IMG_0103CROP-50_thumb.jpg","galleries_id":236547,"server_id":15,"link":"photo_3950263.html","width":130,"caption":"","height":159});
															thumbnails[3895232] = clik.newPhoto({"id":3895232,"src":"_TTK1831-K20D_thumb.jpg","galleries_id":236547,"server_id":15,"link":"photo_3895232.html","width":130,"caption":"","height":128});
															thumbnails[3895236] = clik.newPhoto({"id":3895236,"src":"Fern_thumb.jpg","galleries_id":236547,"server_id":15,"link":"photo_3895236.html","width":130,"caption":"","height":153});
															thumbnails[3895817] = clik.newPhoto({"id":3895817,"src":"FIRE-FLOWER-web_thumb.jpg","galleries_id":236547,"server_id":15,"link":"photo_3895817.html","width":130,"caption":"","height":130});
															thumbnails[3895824] = clik.newPhoto({"id":3895824,"src":"Flowering-Cherry-web_thumb.jpg","galleries_id":236547,"server_id":15,"link":"photo_3895824.html","width":130,"caption":"","height":104});
															thumbnails[3869124] = clik.newPhoto({"id":3869124,"src":"Deep-in-the-Forest_thumb.jpg","galleries_id":236547,"server_id":15,"link":"photo_3869124.html","width":130,"caption":"","height":187});
															thumbnails[3869151] = clik.newPhoto({"id":3869151,"src":"New-and-Old-TK_thumb.jpg","galleries_id":236547,"server_id":15,"link":"photo_3869151.html","width":130,"caption":"","height":151});
															thumbnails[3895241] = clik.newPhoto({"id":3895241,"src":"Poppy-Head_thumb.jpg","galleries_id":236547,"server_id":15,"link":"photo_3895241.html","width":130,"caption":"","height":149});
															thumbnails[3839153] = clik.newPhoto({"id":3839153,"src":"_TEL1045W_thumb.jpg","galleries_id":233279,"server_id":15,"link":"photo_3839153.html","width":130,"caption":"","height":152});
															thumbnails[3839176] = clik.newPhoto({"id":3839176,"src":"meerkatW_thumb.jpg","galleries_id":233279,"server_id":15,"link":"photo_3839176.html","width":130,"caption":"","height":191});
															thumbnails[3839247] = clik.newPhoto({"id":3839247,"src":"TEL_0147w_thumb.jpg","galleries_id":233279,"server_id":15,"link":"photo_3839247.html","width":130,"caption":"","height":79});
															thumbnails[3839254] = clik.newPhoto({"id":3839254,"src":"TTK-2008---00114W_thumb.jpg","galleries_id":233279,"server_id":15,"link":"photo_3839254.html","width":130,"caption":"","height":162});
															thumbnails[3895777] = clik.newPhoto({"id":3895777,"src":"Little-Robin-5web_thumb.jpg","galleries_id":233279,"server_id":15,"link":"photo_3895777.html","width":130,"caption":"","height":104});
															thumbnails[3895759] = clik.newPhoto({"id":3895759,"src":"Busy-Bee10-06-06WEB_thumb.jpg","galleries_id":236547,"server_id":15,"link":"photo_3895759.html","width":130,"caption":"","height":130});
															thumbnails[3895761] = clik.newPhoto({"id":3895761,"src":"Daisy-Bee-1-web_thumb.jpg","galleries_id":236547,"server_id":15,"link":"photo_3895761.html","width":130,"caption":"","height":118});
															thumbnails[3895776] = clik.newPhoto({"id":3895776,"src":"Rose-Bud-web_thumb.jpg","galleries_id":236547,"server_id":15,"link":"photo_3895776.html","width":130,"caption":"","height":130});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[236547] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Flowers & Fungi","link":"gallery_236547.html","maxRecords":0.0,"photoIDs":[8806170.0,8806172.0,8806175.0,8806178.0,8806179.0,8806182.0,8806187.0,8806211.0,8806213.0,8806214.0,8806217.0,4001706.0,3950263.0,3895232.0,3895236.0,3895817.0,3895824.0,3869124.0,3869151.0,3895241.0,3895759.0,3895761.0,3895776.0],"skipIndex":0,"section_code":"gallery","featured_images":8806172.0,"id":236547,"singleSection":false});				  						galleries[463580] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"General","link":"gallery_463580.html","maxRecords":0.0,"photoIDs":[8848380.0,8806208.0,8806220.0],"skipIndex":0,"section_code":"gallery","featured_images":"8848380,8806208","id":463580,"singleSection":false});				  						galleries[457759] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Wedding Car's","link":"gallery_457759.html","maxRecords":0.0,"photoIDs":[8673392.0,8673393.0,8673394.0,8673395.0,8673396.0,8673398.0],"skipIndex":0,"section_code":"gallery","featured_images":8673392.0,"id":457759,"singleSection":false});				  						galleries[417704] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Weddings","link":"gallery_417704.html","maxRecords":0.0,"photoIDs":[7717441.0,7717599.0,7717611.0,7717612.0,7717618.0,7717620.0,7717628.0,7717633.0,7717640.0,7717642.0,7717643.0,7717644.0,7717645.0,7717646.0,7717650.0,7717653.0,7717657.0,7717659.0,7717661.0],"skipIndex":0,"section_code":"gallery","featured_images":"7717661,7717659,7717657,7717653,7717650,7717646,7717645,7717644,7717643,7717642","id":417704,"singleSection":false});				  						galleries[233279] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Wildlife","link":"gallery_233279.html","maxRecords":0.0,"photoIDs":[4482765.0,3960641.0,3955950.0,3949194.0,3949206.0,3839153.0,3839176.0,3839247.0,3839254.0,3895777.0],"skipIndex":0,"section_code":"gallery","featured_images":"4482765,3960641,3955950,3949206,3949194,3895777,3839254,3839247,3839176,3839153","id":233279,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '8848380,8806217,8806214,8806213,8806211,8806208,8806187,8806182,8806179,8806178,8806175,8806172,8806170,8673398,8673395,8673393,8673392,7717659,7717657,7717653,7717650,7717646,7717645,7717644,7717643,7717642,7717640,7717633,7717618,7717612,7717611,7717599';
imageSets[2] = '8848380,8806208,8806172,8673392';
imageSets[3] = '8673398,8673396,8673395,8673394,8673393,8673392,7717661,7717659,7717657,7717653,7717650,7717646,7717645,7717644,7717643,7717642,7717640,7717633,7717628,7717620,7717618,7717612,7717611,7717599,7717441,4482765,4001706,3960641,3955950,3950263,3949206,3949194,3895824,3895817,3895777,3895776,3895761,3895759,3895241,3895236,3895232,3869151,3869124,3839254,3839247,3839176,3839153';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/ttkkirton/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/ttkkirton/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/ttkkirton/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/ttkkirton/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/ttkkirton/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/ttkkirton/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/ttkkirton/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/ttkkirton/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/ttkkirton/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/ttkkirton/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/ttkkirton/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/ttkkirton/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/ttkkirton/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/ttkkirton/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/ttkkirton/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/ttkkirton/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/ttkkirton/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/ttkkirton/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/ttkkirton/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/ttkkirton/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/ttkkirton/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/ttkkirton/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/ttkkirton/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/ttkkirton/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/ttkkirton/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/ttkkirton/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/ttkkirton/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 = 'ttkphotography: ' + 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 !== '' || 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;
	}
}

			

