window.thumbnails = {};
															thumbnails[428177] = clik.newPhoto({"id":428177,"src":"can3_thumb.jpg","galleries_id":34088,"server_id":18,"link":"photo_428177.html","width":130,"caption":"Autumn","height":173});
															thumbnails[428181] = clik.newPhoto({"id":428181,"src":"Copy-of-calender-june_thumb.jpg","galleries_id":70173,"server_id":18,"link":"photo_428181.html","width":130,"caption":"Botanic Garden","height":84});
															thumbnails[428183] = clik.newPhoto({"id":428183,"src":"IMG_19431_1_thumb.jpg","galleries_id":70173,"server_id":18,"link":"photo_428183.html","width":130,"caption":"St Govan's Chapel","height":195});
															thumbnails[428186] = clik.newPhoto({"id":428186,"src":"IMG_19641a_thumb.jpg","galleries_id":70173,"server_id":18,"link":"photo_428186.html","width":130,"caption":"St. Govan's Chapel","height":178});
															thumbnails[428191] = clik.newPhoto({"id":428191,"src":"m2_thumb.jpg","galleries_id":34088,"server_id":18,"link":"photo_428191.html","width":130,"caption":"Colour Red","height":173});
															thumbnails[428193] = clik.newPhoto({"id":428193,"src":"m3_thumb.jpg","galleries_id":34088,"server_id":18,"link":"photo_428193.html","width":130,"caption":"Window in Red","height":176});
															thumbnails[428197] = clik.newPhoto({"id":428197,"src":"nj41_thumb.jpg","galleries_id":34088,"server_id":18,"link":"photo_428197.html","width":130,"caption":"Reflections","height":109});
															thumbnails[428198] = clik.newPhoto({"id":428198,"src":"ny11_thumb.jpg","galleries_id":34088,"server_id":18,"link":"photo_428198.html","width":130,"caption":"NY Sunset","height":147});
															thumbnails[428200] = clik.newPhoto({"id":428200,"src":"dig21_thumb.jpg","galleries_id":70173,"server_id":18,"link":"photo_428200.html","width":130,"caption":"Red Doors","height":84});
															thumbnails[428202] = clik.newPhoto({"id":428202,"src":"pink-doors1_thumb.jpg","galleries_id":70173,"server_id":18,"link":"photo_428202.html","width":130,"caption":"Red Gate","height":173});
															thumbnails[428203] = clik.newPhoto({"id":428203,"src":"HORSES-IN-THE-MIST1_thumb.jpg","galleries_id":34027,"server_id":18,"link":"photo_428203.html","width":130,"caption":"Horses in The Mist","height":87});
															thumbnails[428213] = clik.newPhoto({"id":428213,"src":"IMG_18851bw1_thumb.jpg","galleries_id":34027,"server_id":18,"link":"photo_428213.html","width":130,"caption":"Bridge View","height":195});
															thumbnails[428215] = clik.newPhoto({"id":428215,"src":"IMG_19751bw1_thumb.jpg","galleries_id":34027,"server_id":18,"link":"photo_428215.html","width":130,"caption":"Carew Castle","height":87});
															thumbnails[428216] = clik.newPhoto({"id":428216,"src":"j21_thumb.jpg","galleries_id":34027,"server_id":18,"link":"photo_428216.html","width":130,"caption":"Intermezzo","height":75});
															thumbnails[428218] = clik.newPhoto({"id":428218,"src":"New-York3bw1_thumb.jpg","galleries_id":34027,"server_id":18,"link":"photo_428218.html","width":130,"caption":"Reflections","height":173});
															thumbnails[428219] = clik.newPhoto({"id":428219,"src":"nj31_thumb.jpg","galleries_id":34027,"server_id":18,"link":"photo_428219.html","width":130,"caption":"Towards The Light","height":176});
															thumbnails[428220] = clik.newPhoto({"id":428220,"src":"ny21_thumb.jpg","galleries_id":34027,"server_id":18,"link":"photo_428220.html","width":130,"caption":"Standing Tall ","height":173});
															thumbnails[428222] = clik.newPhoto({"id":428222,"src":"sydney-harbor-bridge1_thumb.jpg","galleries_id":34027,"server_id":18,"link":"photo_428222.html","width":130,"caption":"Bridge Walkers","height":76});
															thumbnails[428224] = clik.newPhoto({"id":428224,"src":"w51_thumb.jpg","galleries_id":34027,"server_id":18,"link":"photo_428224.html","width":130,"caption":"Bird's Eye","height":87});
															thumbnails[428227] = clik.newPhoto({"id":428227,"src":"WALES_153-(1)1_thumb.jpg","galleries_id":34027,"server_id":18,"link":"photo_428227.html","width":130,"caption":"December Morning","height":173});
															thumbnails[429505] = clik.newPhoto({"id":429505,"src":"Llawhade-Castle_20060807_05_thumb.jpg","galleries_id":70173,"server_id":18,"link":"photo_429505.html","width":130,"caption":"Castle Window","height":195});
															thumbnails[430082] = clik.newPhoto({"id":430082,"src":"WALES_086pano_thumb.jpg","galleries_id":70173,"server_id":18,"link":"photo_430082.html","width":130,"caption":"Tenby Harbour","height":54});
															thumbnails[475712] = clik.newPhoto({"id":475712,"src":"IMG_2018_thumb.jpg","galleries_id":70173,"server_id":18,"link":"photo_475712.html","width":130,"caption":"Tenby ","height":37});
															thumbnails[507559] = clik.newPhoto({"id":507559,"src":"bookshop_thumb.jpg","galleries_id":70173,"server_id":18,"link":"photo_507559.html","width":130,"caption":"Laugharne Bookshop","height":195});
															thumbnails[549264] = clik.newPhoto({"id":549264,"src":"CANADA_0351_thumb.jpg","galleries_id":34088,"server_id":18,"link":"photo_549264.html","width":130,"caption":"Autumn","height":173});
															thumbnails[549266] = clik.newPhoto({"id":549266,"src":"solva harbour_thumb.jpg","galleries_id":70173,"server_id":18,"link":"photo_549266.html","width":130,"caption":"Solva Harbour late afternoon","height":156});
															thumbnails[575140] = clik.newPhoto({"id":575140,"src":"hol1_thumb.jpg","galleries_id":34027,"server_id":18,"link":"photo_575140.html","width":130,"caption":"On your Bike","height":69});
															thumbnails[818778] = clik.newPhoto({"id":818778,"src":"amroth-saundersfoot-008a_thumb.jpg","galleries_id":70173,"server_id":18,"link":"photo_818778.html","width":130,"caption":"Amroth","height":85});
															thumbnails[818779] = clik.newPhoto({"id":818779,"src":"amroth-saundersfoot-018a_thumb.jpg","galleries_id":70173,"server_id":18,"link":"photo_818779.html","width":130,"caption":"Amroth","height":198});
															thumbnails[818780] = clik.newPhoto({"id":818780,"src":"amroth-saundersfoot-020a_thumb.jpg","galleries_id":70173,"server_id":18,"link":"photo_818780.html","width":130,"caption":"Sands of Time","height":195});
															thumbnails[818782] = clik.newPhoto({"id":818782,"src":"amroth-saundersfoot-024a_thumb.jpg","galleries_id":70173,"server_id":18,"link":"photo_818782.html","width":130,"caption":"Saundersfoot","height":82});
															thumbnails[918891] = clik.newPhoto({"id":918891,"src":"beach Nolton haven copy_thumb.jpg","galleries_id":70173,"server_id":18,"link":"photo_918891.html","width":130,"caption":"Nolton Haven","height":183});
															thumbnails[918892] = clik.newPhoto({"id":918892,"src":"tenby seagull_thumb.jpg","galleries_id":70173,"server_id":18,"link":"photo_918892.html","width":130,"caption":"Tenby Seagull","height":173});
															thumbnails[1028583] = clik.newPhoto({"id":1028583,"src":"Solva thistle_thumb.jpg","galleries_id":70173,"server_id":18,"link":"photo_1028583.html","width":130,"caption":"Solva ","height":87});
															thumbnails[1028592] = clik.newPhoto({"id":1028592,"src":"Pembroke Castle_thumb.jpg","galleries_id":70173,"server_id":18,"link":"photo_1028592.html","width":130,"caption":"Pembroke Castle","height":60});
															thumbnails[1028601] = clik.newPhoto({"id":1028601,"src":"St Davids_032_thumb.jpg","galleries_id":70173,"server_id":18,"link":"photo_1028601.html","width":130,"caption":"St david's Cathedral","height":155});
															thumbnails[1028607] = clik.newPhoto({"id":1028607,"src":"horse_thumb.jpg","galleries_id":34027,"server_id":18,"link":"photo_1028607.html","width":130,"caption":"Horse","height":87});
															thumbnails[1028632] = clik.newPhoto({"id":1028632,"src":"seagul tenby_thumb.jpg","galleries_id":70173,"server_id":18,"link":"photo_1028632.html","width":130,"caption":"Birds Eye","height":87});
															thumbnails[1028644] = clik.newPhoto({"id":1028644,"src":"Tenby Harbour_thumb.jpg","galleries_id":70173,"server_id":18,"link":"photo_1028644.html","width":130,"caption":"Tenby Harbour","height":98});
															thumbnails[1028651] = clik.newPhoto({"id":1028651,"src":"Tenby rock_thumb.jpg","galleries_id":70173,"server_id":18,"link":"photo_1028651.html","width":130,"caption":"St Catherine's Fort","height":87});
															thumbnails[1172213] = clik.newPhoto({"id":1172213,"src":"AUSTRALIA-2-200322_thumb.jpg","galleries_id":34027,"server_id":18,"link":"photo_1172213.html","width":130,"caption":"Eucalyptus","height":130});
															thumbnails[1289666] = clik.newPhoto({"id":1289666,"src":"IMG_2136_thumb.jpg","galleries_id":70173,"server_id":18,"link":"photo_1289666.html","width":130,"caption":"Freshwater West","height":87});
															thumbnails[1289668] = clik.newPhoto({"id":1289668,"src":"two-horses_thumb.jpg","galleries_id":70173,"server_id":18,"link":"photo_1289668.html","width":130,"caption":"Two Shire Horses","height":87});
															thumbnails[1584918] = clik.newPhoto({"id":1584918,"src":"cow1_thumb.jpg","galleries_id":70173,"server_id":18,"link":"photo_1584918.html","width":130,"caption":"Hereford Bull","height":130});
															thumbnails[1584923] = clik.newPhoto({"id":1584923,"src":"cow2_thumb.jpg","galleries_id":70173,"server_id":18,"link":"photo_1584923.html","width":130,"caption":"Threesome","height":97});
															thumbnails[1584924] = clik.newPhoto({"id":1584924,"src":"IMG_3722_thumb.jpg","galleries_id":70173,"server_id":18,"link":"photo_1584924.html","width":130,"caption":"Charolais bull","height":195});
															thumbnails[1584928] = clik.newPhoto({"id":1584928,"src":"IMG_3730_thumb.jpg","galleries_id":70173,"server_id":18,"link":"photo_1584928.html","width":130,"caption":"Vietnamese Potbelly","height":195});
															thumbnails[1584934] = clik.newPhoto({"id":1584934,"src":"sherm-wedding-230_thumb.jpg","galleries_id":63162,"server_id":18,"link":"photo_1584934.html","width":130,"caption":"","height":87});
															thumbnails[1584938] = clik.newPhoto({"id":1584938,"src":"sherm-wedding-245_thumb.jpg","galleries_id":63162,"server_id":18,"link":"photo_1584938.html","width":130,"caption":"","height":128});
															thumbnails[3269406] = clik.newPhoto({"id":3269406,"src":"Still-Life_thumb.jpg","galleries_id":199308,"server_id":18,"link":"photo_3269406.html","width":130,"caption":"\"Still Life\"","height":184});
															thumbnails[3334039] = clik.newPhoto({"id":3334039,"src":"Hallway1_thumb.jpg","galleries_id":199308,"server_id":18,"link":"photo_3334039.html","width":130,"caption":"\"The Hallway\"","height":173});
															thumbnails[3334048] = clik.newPhoto({"id":3334048,"src":"Trees-b_thumb.jpg","galleries_id":34027,"server_id":18,"link":"photo_3334048.html","width":130,"caption":"In The Distance","height":44});
															thumbnails[4316694] = clik.newPhoto({"id":4316694,"src":"bernard-Thomasbw_thumb.jpg","galleries_id":254334,"server_id":18,"link":"photo_4316694.html","width":130,"caption":"Coracle Boat Builder 86 years old","height":195});
															thumbnails[4422536] = clik.newPhoto({"id":4422536,"src":"green-bridge_thumb.jpg","galleries_id":70173,"server_id":18,"link":"photo_4422536.html","width":130,"caption":"Green Bridge","height":86});
															thumbnails[5230967] = clik.newPhoto({"id":5230967,"src":"angie-2_thumb.jpg","galleries_id":254334,"server_id":18,"link":"photo_5230967.html","width":130,"caption":"","height":195});
															thumbnails[5230968] = clik.newPhoto({"id":5230968,"src":"xxx_thumb.jpg","galleries_id":254334,"server_id":18,"link":"photo_5230968.html","width":130,"caption":"","height":195});
															thumbnails[5234639] = clik.newPhoto({"id":5234639,"src":"DSC_4710_2885D3_thumb.jpg","galleries_id":254334,"server_id":18,"link":"photo_5234639.html","width":130,"caption":"","height":84});
															thumbnails[6158949] = clik.newPhoto({"id":6158949,"src":"DSC_5496_3494D3_DxOa-name_thumb.jpg","galleries_id":254334,"server_id":18,"link":"photo_6158949.html","width":130,"caption":"Mother and Son","height":86});
															thumbnails[814586] = clik.newPhoto({"id":814586,"src":"ws1_thumb.jpg","galleries_id":63162,"server_id":18,"link":"photo_814586.html","width":130,"caption":"","height":98});
															thumbnails[814587] = clik.newPhoto({"id":814587,"src":"ws2_thumb.jpg","galleries_id":63162,"server_id":18,"link":"photo_814587.html","width":130,"caption":"","height":122});
															thumbnails[814589] = clik.newPhoto({"id":814589,"src":"ws3_thumb.jpg","galleries_id":63162,"server_id":18,"link":"photo_814589.html","width":130,"caption":"","height":105});
															thumbnails[814591] = clik.newPhoto({"id":814591,"src":"ws4_thumb.jpg","galleries_id":63162,"server_id":18,"link":"photo_814591.html","width":130,"caption":"","height":131});
															thumbnails[814592] = clik.newPhoto({"id":814592,"src":"ws5_thumb.jpg","galleries_id":63162,"server_id":18,"link":"photo_814592.html","width":130,"caption":"","height":98});
															thumbnails[814593] = clik.newPhoto({"id":814593,"src":"ws6_thumb.jpg","galleries_id":63162,"server_id":18,"link":"photo_814593.html","width":130,"caption":"","height":98});
															thumbnails[814594] = clik.newPhoto({"id":814594,"src":"ws7_thumb.jpg","galleries_id":63162,"server_id":18,"link":"photo_814594.html","width":130,"caption":"","height":173});
															thumbnails[814583] = clik.newPhoto({"id":814583,"src":"ws8_thumb.jpg","galleries_id":63162,"server_id":18,"link":"photo_814583.html","width":130,"caption":"","height":98});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[34088] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Coloured Impressions Gallery","link":"gallery_34088.html","maxRecords":0.0,"photoIDs":[428177.0,428191.0,428193.0,428197.0,428198.0,549264.0],"skipIndex":0,"section_code":"gallery","featured_images":428191.0,"id":34088,"singleSection":false});				  						galleries[199308] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Limited editions 2011","link":"gallery_199308.html","maxRecords":0.0,"photoIDs":[3269406.0,3334039.0],"skipIndex":0,"section_code":"gallery","featured_images":"3334039,3269406","id":199308,"singleSection":false});				  						galleries[34027] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Monochrome Gallery","link":"gallery_34027.html","maxRecords":0.0,"photoIDs":[428203.0,428213.0,428215.0,428216.0,428218.0,428219.0,428220.0,428222.0,428224.0,428227.0,575140.0,1028607.0,1172213.0,3334048.0],"skipIndex":0,"section_code":"gallery","featured_images":"575140,428216","id":34027,"singleSection":false});				  						galleries[70173] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Pembrokeshire Gallery","link":"gallery_70173.html","maxRecords":0.0,"photoIDs":[428181.0,428183.0,428186.0,428200.0,428202.0,429505.0,430082.0,475712.0,507559.0,549266.0,818778.0,818779.0,818780.0,818782.0,918891.0,918892.0,1028583.0,1028592.0,1028601.0,1028632.0,1028644.0,1028651.0,1289666.0,1289668.0,1584918.0,1584923.0,1584924.0,1584928.0,4422536.0],"skipIndex":0,"section_code":"gallery","featured_images":"1584924,818779,428202","id":70173,"singleSection":false});				  						galleries[254334] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Portrait","link":"gallery_254334.html","maxRecords":0.0,"photoIDs":[4316694.0,5230967.0,5230968.0,5234639.0,6158949.0],"skipIndex":0,"section_code":"gallery","featured_images":5230968.0,"id":254334,"singleSection":false});				  						galleries[63162] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Wedding sample Gallery","link":"gallery_63162.html","maxRecords":0.0,"photoIDs":[1584934.0,1584938.0,814586.0,814587.0,814589.0,814591.0,814592.0,814593.0,814594.0,814583.0],"skipIndex":0,"section_code":"gallery","featured_images":814594.0,"id":63162,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '5230968,4316694,3269406,428216,428200';
imageSets[2] = '5230968,1584924,818779,575140,428216,428202,428191,814594';
imageSets[3] = '6158949,5234639,5230968,5230967,4422536,4316694,3334048,3334039,3269406,1584938,1584934,1584928,1584924,1584923,1584918,1289668,1289666,1172213,1028651,1028644,1028632,1028607,1028601,1028592,1028583,918892,918891,818782,818780,818779,818778,814594,814593,814592,814591,814589,814587,814586,814583,575140,549266,549264,507559,475712,430082,429505,428227,428224,428222,428220';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/oostermeijer/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/oostermeijer/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/oostermeijer/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/oostermeijer/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/oostermeijer/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/oostermeijer/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/oostermeijer/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/oostermeijer/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/oostermeijer/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/oostermeijer/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/oostermeijer/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/oostermeijer/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/oostermeijer/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/oostermeijer/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/oostermeijer/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/oostermeijer/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/oostermeijer/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/oostermeijer/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/oostermeijer/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/oostermeijer/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/oostermeijer/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/oostermeijer/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/oostermeijer/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/oostermeijer/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/oostermeijer/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/oostermeijer/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/oostermeijer/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 = 'TOUCHSTONE        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>Photograph by </strong>' + this.photographer + '</div>';
	}
				
	temp += this.fnGetPaymentInfo();
				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>Buy now using PayPal:</p>';
				temp += '<div class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> &pound;' + (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="updateCartValue($(this.form).next(\'#paymentForm\')[0],this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value); if(divShowing(\'paymentConfirm\')){fadeOut(\'paymentConfirm\', 3)};">';
		
		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 += '<form id="paymentForm" style="margin:0px;border:0px;" name="paymentForm">';
			temp += '	<input type="hidden" name="item_option" value="' + item_option + '">';
			temp += '	<input type="hidden" name="site" value="OOSTERMEIJER">';
			temp += '	<input type="hidden" name="item_number" value="'+ this.id +'">';
			temp += '	<input type="hidden" name="quantity" value="1">';
						temp += '	<input value="Add to cart" id="paymentAddButton" class="button" onmouseover="this.className=\'buttonHi\'\;" onmouseout="this.className=\'button\'\;" type="Button">';
							temp += '	<input value="View cart" id="paymentViewButton" class="button" onmouseover="this.className=\'buttonHi\';" onmouseout="this.className=\'button\';" type="Button" onclick="javascript:window.location=\'cart.html\'">';
			temp += '</form>';
						temp += '<div class="clearing">&nbsp;</div>';
			temp += '<div id="confirmContainer">';
			temp += '<div id="paymentConfirm">Item added to cart</div>';
			temp += '</div>';
			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;
	}
}

			

