window.thumbnails = {};
thumbnails[8347832] = clik.newPhoto({"link":"#","caption":"","height":489,"id":8347832,"server_id":31,"src":"IMG_0593_170x640_thumb.jpg","galleries_id":"","width":130});
thumbnails[7613008] = clik.newPhoto({"link":"photo_7613008.html","caption":"Blackberries","height":131,"id":7613008,"server_id":31,"src":"IMG_0561_448x450_thumb.jpg","galleries_id":410566,"width":130});
thumbnails[7613014] = clik.newPhoto({"link":"photo_7613014.html","caption":"Fish","height":127,"id":7613014,"server_id":31,"src":"216_450x440_thumb.jpg","galleries_id":410566,"width":130});
thumbnails[7934068] = clik.newPhoto({"link":"photo_7934068.html","caption":"Winter","height":129,"id":7934068,"server_id":31,"src":"IMG_0289_450x448_thumb.jpg","galleries_id":410566,"width":130});
thumbnails[7934698] = clik.newPhoto({"link":"photo_7934698.html","caption":"Autumn","height":133,"id":7934698,"server_id":31,"src":"020_2_441x450_thumb.jpg","galleries_id":410566,"width":130});
thumbnails[7934752] = clik.newPhoto({"link":"photo_7934752.html","caption":"Summer","height":132,"id":7934752,"server_id":31,"src":"PB230099_0107_443x450_thumb.jpg","galleries_id":410566,"width":130});
thumbnails[7984541] = clik.newPhoto({"link":"photo_7984541.html","caption":"Hare","height":127,"id":7984541,"server_id":31,"src":"IMG_0275_450x440_thumb.jpg","galleries_id":429159,"width":130});
thumbnails[7984553] = clik.newPhoto({"link":"photo_7984553.html","caption":"Wave ","height":88,"id":7984553,"server_id":31,"src":"swimming_pool_200x136_thumb.jpg","galleries_id":429160,"width":130});
thumbnails[7984564] = clik.newPhoto({"link":"photo_7984564.html","caption":"Reflection and Movement","height":181,"id":7984564,"server_id":31,"src":"IMG_0009_324x450_thumb.jpg","galleries_id":429158,"width":130});
thumbnails[7984568] = clik.newPhoto({"link":"photo_7984568.html","caption":"Cat","height":126,"id":7984568,"server_id":31,"src":"P8220185_450x437_thumb.jpg","galleries_id":429159,"width":130});
thumbnails[7985385] = clik.newPhoto({"link":"photo_7985385.html","caption":"Kingfisher","height":98,"id":7985385,"server_id":31,"src":"P7260151_450x338_thumb.jpg","galleries_id":429159,"width":130});
thumbnails[7985431] = clik.newPhoto({"link":"photo_7985431.html","caption":"Day's End","height":118,"id":7985431,"server_id":31,"src":"IMG_0013_450x408_thumb.jpg","galleries_id":429158,"width":130});
thumbnails[7985440] = clik.newPhoto({"link":"photo_7985440.html","caption":"Ivy","height":175,"id":7985440,"server_id":31,"src":"IMG_0167_335x450_thumb.jpg","galleries_id":410566,"width":130});
thumbnails[7985443] = clik.newPhoto({"link":"photo_7985443.html","caption":"Spring","height":126,"id":7985443,"server_id":31,"src":"IMG_0226_450x435_thumb.jpg","galleries_id":410566,"width":130});
thumbnails[8055447] = clik.newPhoto({"link":"photo_8055447.html","caption":"Malmesbury Abbey","height":198,"id":8055447,"server_id":31,"src":"peters_photos_0057_295x450_thumb.jpg","galleries_id":429160,"width":130});
thumbnails[8062193] = clik.newPhoto({"link":"photo_8062193.html","caption":"Maltese Cross","height":122,"id":8062193,"server_id":31,"src":"27330002_450x422_thumb.jpg","galleries_id":410566,"width":130});
thumbnails[8065940] = clik.newPhoto({"link":"photo_8065940.html","caption":"Creation","height":128,"id":8065940,"server_id":31,"src":"IMG_0004_450x444_thumb.jpg","galleries_id":429158,"width":130});
thumbnails[8306805] = clik.newPhoto({"link":"photo_8306805.html","caption":"Stream 2","height":186,"id":8306805,"server_id":31,"src":"009_-_Copy_315x450_thumb.jpg","galleries_id":410566,"width":130});
thumbnails[8306806] = clik.newPhoto({"link":"photo_8306806.html","caption":"Shearwaters","height":253,"id":8306806,"server_id":31,"src":"IMG_0223_231x450_thumb.jpg","galleries_id":429159,"width":130});
thumbnails[8306808] = clik.newPhoto({"link":"photo_8306808.html","caption":"Rust and the Man","height":127,"id":8306808,"server_id":31,"src":"IMG_0017_450x441_thumb.jpg","galleries_id":429158,"width":130});
thumbnails[8306814] = clik.newPhoto({"link":"photo_8306814.html","caption":"Stream","height":127,"id":8306814,"server_id":31,"src":"IMG_0008_450x441_thumb.jpg","galleries_id":429158,"width":130});
thumbnails[8322151] = clik.newPhoto({"link":"photo_8322151.html","caption":"Journey","height":115,"id":8322151,"server_id":31,"src":"IMG_0363_527x468_thumb.jpg","galleries_id":429158,"width":130});
thumbnails[8322160] = clik.newPhoto({"link":"photo_8322160.html","caption":"I am a Rock","height":194,"id":8322160,"server_id":31,"src":"IMG_0120_302x450_thumb.jpg","galleries_id":429158,"width":130});
thumbnails[8323043] = clik.newPhoto({"link":"photo_8323043.html","caption":"Duck","height":173,"id":8323043,"server_id":31,"src":"P7260154_338x450_thumb.jpg","galleries_id":429159,"width":130});
thumbnails[8323053] = clik.newPhoto({"link":"photo_8323053.html","caption":"Running Hare","height":129,"id":8323053,"server_id":31,"src":"094_2_800x793_thumb.jpg","galleries_id":429159,"width":130});
thumbnails[8323162] = clik.newPhoto({"link":"photo_8323162.html","caption":"The Ark","height":93,"id":8323162,"server_id":31,"src":"img025_800x570_thumb.jpg","galleries_id":410566,"width":130});
thumbnails[8384138] = clik.newPhoto({"link":"photo_8384138.html","caption":"Wheatburst","height":125,"id":8384138,"server_id":31,"src":"2.__Wheatburst_450x433_thumb.jpg","galleries_id":410566,"width":130});
thumbnails[9156254] = clik.newPhoto({"link":"photo_9156254.html","caption":"Tracklements","height":98,"id":9156254,"server_id":31,"src":"IMG_601_thumb.JPG","galleries_id":410566,"width":130});
thumbnails[7930440] = clik.newPhoto({"link":"photo_7930440.html","caption":"St.Peter's Fish Window (detail)","height":191,"id":7930440,"server_id":31,"src":"571_306x450_thumb.jpg","galleries_id":429156,"width":130});
thumbnails[7931443] = clik.newPhoto({"link":"photo_7931443.html","caption":"Pentecost Window","height":214,"id":7931443,"server_id":31,"src":"IMG_0335_274x450_thumb.jpg","galleries_id":429156,"width":130});
thumbnails[7931448] = clik.newPhoto({"link":"photo_7931448.html","caption":"New Millennium Window","height":103,"id":7931448,"server_id":31,"src":"img073_450x355_thumb.jpg","galleries_id":429156,"width":130});
thumbnails[8062120] = clik.newPhoto({"link":"photo_8062120.html","caption":"Royal Artillery Window","height":303,"id":8062120,"server_id":31,"src":"IMG_0312_275x640_thumb.jpg","galleries_id":429156,"width":130});
thumbnails[8062124] = clik.newPhoto({"link":"photo_8062124.html","caption":"Regimental Window","height":303,"id":8062124,"server_id":31,"src":"IMG_0253_193x450_thumb.jpg","galleries_id":429156,"width":130});
thumbnails[8281442] = clik.newPhoto({"link":"photo_8281442.html","caption":"Print Maker's Window ","height":216,"id":8281442,"server_id":31,"src":"IMG_0346_271x450_thumb.jpg","galleries_id":429156,"width":130});
thumbnails[8322120] = clik.newPhoto({"link":"photo_8322120.html","caption":"St.Giles Window","height":174,"id":8322120,"server_id":31,"src":"IMG_0362_476x636_thumb.jpg","galleries_id":429156,"width":130});
thumbnails[8323599] = clik.newPhoto({"link":"photo_8323599.html","caption":"John Wycliffe Window","height":322,"id":8323599,"server_id":31,"src":"img032_258x640_thumb.jpg","galleries_id":429156,"width":130});
thumbnails[8323604] = clik.newPhoto({"link":"photo_8323604.html","caption":"Lily Window","height":174,"id":8323604,"server_id":31,"src":"IMG_0176_478x640_thumb.jpg","galleries_id":429156,"width":130});
thumbnails[8323609] = clik.newPhoto({"link":"photo_8323609.html","caption":"Lily Window (detail)","height":98,"id":8323609,"server_id":31,"src":"IMG_0184_640x480_thumb.jpg","galleries_id":429156,"width":130});
thumbnails[8323672] = clik.newPhoto({"link":"photo_8323672.html","caption":"Carpenter's Window","height":219,"id":8323672,"server_id":31,"src":"IMG_0206_380x640_thumb.jpg","galleries_id":429156,"width":130});
thumbnails[7612823] = clik.newPhoto({"link":"photo_7612823.html","caption":"Edwardian Window","height":76,"id":7612823,"server_id":31,"src":"IMG_0363_edited-1_450x264_thumb.jpg","galleries_id":429151,"width":130});
thumbnails[7984546] = clik.newPhoto({"link":"photo_7984546.html","caption":"Victorian Panel","height":188,"id":7984546,"server_id":31,"src":"IMG_0492_2_311x450_thumb.jpg","galleries_id":429151,"width":130});
thumbnails[8277427] = clik.newPhoto({"link":"photo_8277427.html","caption":" Decorative Front Door Panels","height":183,"id":8277427,"server_id":31,"src":"DSC00104_320x450_thumb.jpg","galleries_id":429151,"width":130});
thumbnails[8323686] = clik.newPhoto({"link":"photo_8323686.html","caption":"Decorative Windows","height":97,"id":8323686,"server_id":31,"src":"IMG_0320_800x595_thumb.jpg","galleries_id":429151,"width":130});
thumbnails[8323696] = clik.newPhoto({"link":"photo_8323696.html","caption":"Iris ","height":243,"id":8323696,"server_id":31,"src":"PC070132_0211_241x450_thumb.jpg","galleries_id":429151,"width":130});
thumbnails[8981409] = clik.newPhoto({"link":"photo_8981409.html","caption":"Traditional Door Panels","height":166,"id":8981409,"server_id":31,"src":"IMG_0454_thumb.JPG","galleries_id":429151,"width":130});
thumbnails[7612999] = clik.newPhoto({"link":"photo_7612999.html","caption":"Wheatburst","height":98,"id":7612999,"server_id":31,"src":"IMG_0271_450x338_thumb.jpg","galleries_id":429152,"width":130});
thumbnails[7985388] = clik.newPhoto({"link":"photo_7985388.html","caption":"Reflection & Movement","height":80,"id":7985388,"server_id":31,"src":"IMG_0165_450x277_thumb.jpg","galleries_id":429152,"width":130});
thumbnails[7985389] = clik.newPhoto({"link":"photo_7985389.html","caption":"Reflection & Movement II","height":105,"id":7985389,"server_id":31,"src":"IMG_0529_450x363_thumb.jpg","galleries_id":429152,"width":130});
thumbnails[7985390] = clik.newPhoto({"link":"photo_7985390.html","caption":"Flow","height":98,"id":7985390,"server_id":31,"src":"IMG_0164_450x338_thumb.jpg","galleries_id":429152,"width":130});
thumbnails[7985392] = clik.newPhoto({"link":"photo_7985392.html","caption":"Bespoke Bowl","height":127,"id":7985392,"server_id":31,"src":"IMG_0162_200x195_thumb.jpg","galleries_id":429152,"width":130});
thumbnails[7985407] = clik.newPhoto({"link":"photo_7985407.html","caption":"Trout","height":116,"id":7985407,"server_id":31,"src":"002_-_Copy_450x400_thumb.jpg","galleries_id":429152,"width":130});
thumbnails[7985413] = clik.newPhoto({"link":"photo_7985413.html","caption":"Wedding Bowl","height":98,"id":7985413,"server_id":31,"src":"IMG_0206_-_Copy_450x338_thumb.jpg","galleries_id":429152,"width":130});
thumbnails[8420853] = clik.newPhoto({"link":"photo_8420853.html","caption":"Stream","height":127,"id":8420853,"server_id":31,"src":"IMG_0008_450x4411_thumb.jpg","galleries_id":446046,"width":130});
thumbnails[8420879] = clik.newPhoto({"link":"photo_8420879.html","caption":"Day's End","height":118,"id":8420879,"server_id":31,"src":"IMG_0013_450x4081_thumb.jpg","galleries_id":446046,"width":130});
thumbnails[8420897] = clik.newPhoto({"link":"photo_8420897.html","caption":"Rust and the Man","height":127,"id":8420897,"server_id":31,"src":"IMG_0017_450x4411_thumb.jpg","galleries_id":446046,"width":130});
thumbnails[8420972] = clik.newPhoto({"link":"photo_8420972.html","caption":"Fish","height":127,"id":8420972,"server_id":31,"src":"216_450x4401_thumb.jpg","galleries_id":446046,"width":130});
thumbnails[8424777] = clik.newPhoto({"link":"photo_8424777.html","caption":"Reflection and Movement 11","height":105,"id":8424777,"server_id":31,"src":"IMG_0529_450x3631_thumb.jpg","galleries_id":446046,"width":130});
thumbnails[8981303] = clik.newPhoto({"link":"photo_8981303.html","caption":"Bespoke Bowl","height":107,"id":8981303,"server_id":31,"src":"IMG_0470_thumb.JPG","galleries_id":446046,"width":130});
thumbnails[9123440] = clik.newPhoto({"link":"photo_9123440.html","caption":"Merganser","height":127,"id":9123440,"server_id":31,"src":"IMG_0401_thumb.JPG","galleries_id":446046,"width":130});
thumbnails[9123443] = clik.newPhoto({"link":"photo_9123443.html","caption":"Day's End","height":120,"id":9123443,"server_id":31,"src":"IMG_406_thumb.JPG","galleries_id":446046,"width":130});
thumbnails[9123450] = clik.newPhoto({"link":"photo_9123450.html","caption":"Dove","height":126,"id":9123450,"server_id":31,"src":"IMG_410_thumb.JPG","galleries_id":446046,"width":130});
thumbnails[9123455] = clik.newPhoto({"link":"photo_9123455.html","caption":"Shearwaters","height":126,"id":9123455,"server_id":31,"src":"IMG_400_thumb.JPG","galleries_id":446046,"width":130});
thumbnails[9127546] = clik.newPhoto({"link":"photo_9127546.html","caption":"Running Hare","height":131,"id":9127546,"server_id":31,"src":"IMG_591_thumb.JPG","galleries_id":446046,"width":130});
thumbnails[9127569] = clik.newPhoto({"link":"photo_9127569.html","caption":"Bespoke Clock","height":131,"id":9127569,"server_id":31,"src":"016_3_thumb.JPG","galleries_id":446046,"width":130});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
galleries[429159] = clik.newGallery({"photoIDs":[7984541,7984568,7985385,8306806,8323043,8323053],"link":"gallery_429159.html","skipIndex":0,"section_code":"gallery","id":429159,"parentGallery":"","featured_images":7984541,"maxRecords":0,"usePopups":false,"singleSection":false,"title":"Animals\/Birds"});galleries[429156] = clik.newGallery({"photoIDs":[7930440,7931443,7931448,8062120,8062124,8281442,8322120,8323599,8323604,8323609,8323672],"link":"section513468.html","skipIndex":0,"section_code":"section513468","id":429156,"parentGallery":"","featured_images":"8323672,8323604,8323599,8322120","maxRecords":0,"usePopups":false,"singleSection":true,"title":"Church Windows"});galleries[429158] = clik.newGallery({"photoIDs":[7984564,7985431,8065940,8306808,8306814,8322151,8322160],"link":"gallery_429158.html","skipIndex":0,"section_code":"gallery","id":429158,"parentGallery":"","featured_images":"8322160,8322151,8306814,8306808,7984564","maxRecords":0,"usePopups":false,"singleSection":false,"title":"Contemporary"});galleries[429151] = clik.newGallery({"photoIDs":[7612823,7984546,8277427,8323686,8323696,8981409],"link":"section513469.html","skipIndex":0,"section_code":"section513469","id":429151,"parentGallery":"","featured_images":"8981409,8323696,8323686,8277427,7984546,7612823","maxRecords":0,"usePopups":false,"singleSection":true,"title":"Edwardian\/Victorian\/Traditional"});galleries[446046] = clik.newGallery({"photoIDs":[8420853,8420879,8420897,8420972,8424777,8981303,9123440,9123443,9123450,9123455,9127546,9127569],"link":"section536076.html","skipIndex":0,"section_code":"section536076","id":446046,"parentGallery":"","featured_images":"8424777,8420972,8420897,8420879,8420853","maxRecords":0,"usePopups":false,"singleSection":true,"title":"For Sale"});galleries[429152] = clik.newGallery({"photoIDs":[7612999,7985388,7985389,7985390,7985392,7985407,7985413],"link":"section513470.html","skipIndex":0,"section_code":"section513470","id":429152,"parentGallery":"","featured_images":"7985389,7985388","maxRecords":0,"usePopups":false,"singleSection":true,"title":"Fused Glass"});galleries[429160] = clik.newGallery({"photoIDs":[7984553,8055447],"link":"gallery_429160.html","skipIndex":0,"section_code":"gallery","id":429160,"parentGallery":"","featured_images":8055447,"maxRecords":0,"usePopups":false,"singleSection":false,"title":"Public Art"});galleries[410566] = clik.newGallery({"photoIDs":[7613008,7613014,7934068,7934698,7934752,7985440,7985443,8062193,8306805,8323162,8384138,9156254],"link":"gallery_410566.html","skipIndex":0,"section_code":"gallery","id":410566,"parentGallery":"","featured_images":"8384138,8323162,8306805,7934752,7934698","maxRecords":0,"usePopups":false,"singleSection":false,"title":"Gallery 1"});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[3] = '8424777,8420972,8420897,8420879,8420853,8384138,8323696,8323686,8323672,8323609,8323604,8323599,8323162,8323053,8323043,8322160,8322151,8322120,8306814,8306808,8306806,8306805,8281442,8277427,8065940,8062193,8062124,8062120,8055447,7985443,7985440,7985413,7985407,7985392,7985390,7985389,7985388,7985385,7984568,7984564,7984553,7984546,7984541,7934752,7934698';
imageSets[2] = '8424777,8420972,8420897,8420879,8420853,8384138,8323672,8323604,8323599,8323162,8322160,8322151,8322120,8306814,8306808,8306805,8055447,7985389,7985388,7984564,7984541,7934752,7934698';
imageSets[1] = '8424777,8420972,8420897,8420879,8420853,8384138,8347832,8323672,8323604,8323599,8323162,8322151,8322120,8306814,8306808,8306805,8055447,7985389,7985388,7984564,7984541,7934752,7934698';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/glassman/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/glassman/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/glassman/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/glassman/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/glassman/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/glassman/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/glassman/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/glassman/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/glassman/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/glassman/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/glassman/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/glassman/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/glassman/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/glassman/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/glassman/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/glassman/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/glassman/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/glassman/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/glassman/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/glassman/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/glassman/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/glassman/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/glassman/images';
		break;
	}
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/glassman/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/glassman/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/glassman/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/glassman/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 = 'Berry Stained Glass                               : ' + 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>';
	}
			
	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="GLASSMAN">';
			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;
	}
}

		

