window.thumbnails = {};
															thumbnails[2805433] = clik.newPhoto({"id":2805433,"src":"pp-(Pianissimo)_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"","height":111});
															thumbnails[5819622] = clik.newPhoto({"id":5819622,"src":"High_Fashion_for_web_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"\"High Fashion\"","height":173});
															thumbnails[5827659] = clik.newPhoto({"id":5827659,"src":"Ginger-for-web_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"\"Ginger!\"","height":174});
															thumbnails[3555617] = clik.newPhoto({"id":3555617,"src":"29_thumb.jpg","galleries_id":170925,"server_id":5,"link":"photo_3555617.html","width":130,"caption":"'Shotgun Clare'","height":169});
															thumbnails[3555752] = clik.newPhoto({"id":3555752,"src":"37_thumb.jpg","galleries_id":170925,"server_id":5,"link":"photo_3555752.html","width":130,"caption":"'Well, Really!'","height":170});
															thumbnails[3555755] = clik.newPhoto({"id":3555755,"src":"38_thumb.jpg","galleries_id":170925,"server_id":5,"link":"photo_3555755.html","width":130,"caption":"'The Heroin(e)'","height":169});
															thumbnails[2805412] = clik.newPhoto({"id":2805412,"src":"Celia Warnants 4_thumb.jpg","galleries_id":170924,"server_id":5,"link":"photo_2805412.html","width":130,"caption":"pp (Pianissimo)","height":87});
															thumbnails[3774883] = clik.newPhoto({"id":3774883,"src":"Rose1_thumb.jpg","galleries_id":175416,"server_id":5,"link":"photo_3774883.html","width":130,"caption":"Commissioned for a Paper Wedding Anniversary.<br>\r\n<br>\r\n2008","height":184});
															thumbnails[4582102] = clik.newPhoto({"id":4582102,"src":"Postcode-Gang-for-web_thumb.jpg","galleries_id":265443,"server_id":5,"link":"photo_4582102.html","width":130,"caption":"\"The Postcode Gang\"","height":79});
															thumbnails[4896854] = clik.newPhoto({"id":4896854,"src":"The-Boy-Next-Door-for-web_thumb.jpg","galleries_id":265443,"server_id":5,"link":"photo_4896854.html","width":130,"caption":"\"The Boy Next Door\" ","height":91});
															thumbnails[5147653] = clik.newPhoto({"id":5147653,"src":"On-British-Youth-for-web_thumb.jpg","galleries_id":265443,"server_id":5,"link":"photo_5147653.html","width":130,"caption":"\"On British Youth\"","height":172});
															thumbnails[5168783] = clik.newPhoto({"id":5168783,"src":"Living-Doll-for-web_thumb.jpg","galleries_id":265443,"server_id":5,"link":"photo_5168783.html","width":130,"caption":"\"Living Doll\"","height":173});
															thumbnails[5168790] = clik.newPhoto({"id":5168790,"src":"One-Sick-Puppy-for-web_thumb.jpg","galleries_id":265443,"server_id":5,"link":"photo_5168790.html","width":130,"caption":"\"One Sick Puppy\"","height":173});
															thumbnails[5168795] = clik.newPhoto({"id":5168795,"src":"Raving-Mad-for-web_thumb.jpg","galleries_id":265443,"server_id":5,"link":"photo_5168795.html","width":130,"caption":"\"Raving Mad\"","height":87});
															thumbnails[2805413] = clik.newPhoto({"id":2805413,"src":"Celia Warnants 3_thumb.jpg","galleries_id":170924,"server_id":5,"link":"photo_2805413.html","width":130,"caption":"pp (Pianissimo) (Detail)","height":87});
															thumbnails[2805444] = clik.newPhoto({"id":2805444,"src":"n502595652_1113053_3520_thumb.jpg","galleries_id":175416,"server_id":5,"link":"photo_2805444.html","width":130,"caption":"Rose Paper (in box).","height":149});
															thumbnails[2805415] = clik.newPhoto({"id":2805415,"src":"Celia Warnants 2_thumb.jpg","galleries_id":170924,"server_id":5,"link":"photo_2805415.html","width":130,"caption":"Installation Shot of 'Show RCA'. ","height":87});
															thumbnails[2805416] = clik.newPhoto({"id":2805416,"src":"4ar200840033040ast_thumb.jpg","galleries_id":170924,"server_id":5,"link":"photo_2805416.html","width":130,"caption":"Not Fit for Purpose","height":173});
															thumbnails[2805417] = clik.newPhoto({"id":2805417,"src":"yt6200803033203ast_thumb.jpg","galleries_id":170924,"server_id":5,"link":"photo_2805417.html","width":130,"caption":"Not Fit for Purpose (Detail)","height":177});
															thumbnails[2805418] = clik.newPhoto({"id":2805418,"src":"Celia Warnants 5_thumb.jpg","galleries_id":170924,"server_id":5,"link":"photo_2805418.html","width":130,"caption":"Paper Work.  2007-2008.","height":194});
															thumbnails[2805420] = clik.newPhoto({"id":2805420,"src":"Celia Warnants 1_thumb.jpg","galleries_id":170924,"server_id":5,"link":"photo_2805420.html","width":130,"caption":"Pay-Per-View 1,2&3. 2008.","height":87});
															thumbnails[2805422] = clik.newPhoto({"id":2805422,"src":"txd200832034432ast_thumb.jpg","galleries_id":170924,"server_id":5,"link":"photo_2805422.html","width":130,"caption":"Pay-Per-View 1 (Detail)","height":177});
															thumbnails[2805423] = clik.newPhoto({"id":2805423,"src":"0rnr200858034558ast-1_thumb.jpg","galleries_id":170924,"server_id":5,"link":"photo_2805423.html","width":130,"caption":"Pay-Per-View 2 (Detail)","height":177});
															thumbnails[2805424] = clik.newPhoto({"id":2805424,"src":"elt200838034638ast_thumb.jpg","galleries_id":170924,"server_id":5,"link":"photo_2805424.html","width":130,"caption":"Pay-Per-View 3 (Detail)","height":177});
															thumbnails[2900689] = clik.newPhoto({"id":2900689,"src":"100_3532_thumb.jpg","galleries_id":170924,"server_id":5,"link":"photo_2900689.html","width":129,"caption":"'A Fiddle'","height":189});
															thumbnails[2900715] = clik.newPhoto({"id":2900715,"src":"100_3535_thumb.jpg","galleries_id":170924,"server_id":5,"link":"photo_2900715.html","width":129,"caption":"'A Fiddle' (detail).","height":186});
															thumbnails[2928781] = clik.newPhoto({"id":2928781,"src":"GetAttachment_thumb.jpg","galleries_id":170924,"server_id":5,"link":"photo_2928781.html","width":130,"caption":"'A Fiddle' (Installation shot)","height":97});
															thumbnails[3885031] = clik.newPhoto({"id":3885031,"src":"violinforweb_thumb.jpg","galleries_id":170924,"server_id":5,"link":"photo_3885031.html","width":130,"caption":"'A Fiddle' (Installation shot)","height":196});
															thumbnails[3000801] = clik.newPhoto({"id":3000801,"src":"after school_thumb.jpg","galleries_id":170925,"server_id":5,"link":"photo_3000801.html","width":130,"caption":"'After School'","height":188});
															thumbnails[3000802] = clik.newPhoto({"id":3000802,"src":"clare_thumb.jpg","galleries_id":170925,"server_id":5,"link":"photo_3000802.html","width":130,"caption":"'Shotgun Clare'","height":187});
															thumbnails[3000803] = clik.newPhoto({"id":3000803,"src":"Well, Really!_thumb.jpg","galleries_id":170925,"server_id":5,"link":"photo_3000803.html","width":130,"caption":"'Well, Really'","height":180});
															thumbnails[3000805] = clik.newPhoto({"id":3000805,"src":"l_c848cf9ca176314f2db73c931619238d_thumb.jpg","galleries_id":170925,"server_id":5,"link":"photo_3000805.html","width":130,"caption":"'In a Bind'","height":181});
															thumbnails[3000806] = clik.newPhoto({"id":3000806,"src":"Stories For Bedtime (Covers)_thumb.jpg","galleries_id":170925,"server_id":5,"link":"photo_3000806.html","width":130,"caption":"'Stories for Bedtime'","height":43});
															thumbnails[5244176] = clik.newPhoto({"id":5244176,"src":"IMG_4372_thumb.jpg","galleries_id":265443,"server_id":5,"link":"photo_5244176.html","width":130,"caption":"\"Manderley\" ","height":93});
															thumbnails[3000807] = clik.newPhoto({"id":3000807,"src":"Stories For Bedtime(spines)_thumb.jpg","galleries_id":170925,"server_id":5,"link":"photo_3000807.html","width":130,"caption":"'Stories for Bedtime'","height":236});
															thumbnails[5244472] = clik.newPhoto({"id":5244472,"src":"JJ27_thumb.jpg","galleries_id":265443,"server_id":5,"link":"photo_5244472.html","width":130,"caption":"\"Maderley PV\"","height":90});
															thumbnails[3000809] = clik.newPhoto({"id":3000809,"src":"Stories For Bedtime (Detail)ppd_thumb.jpg","galleries_id":170925,"server_id":5,"link":"photo_3000809.html","width":130,"caption":"'Stories for Bedtime' (Detail)","height":117});
															thumbnails[7867252] = clik.newPhoto({"id":7867252,"src":"urbane_thumb.jpg","galleries_id":423357,"server_id":5,"link":"photo_7867252.html","width":130,"caption":"","height":193});
															thumbnails[7867264] = clik.newPhoto({"id":7867264,"src":"Screen_shot_2011-05-28_at_171.46.01_thumb.jpg","galleries_id":423357,"server_id":5,"link":"photo_7867264.html","width":130,"caption":"","height":264});
															thumbnails[7867427] = clik.newPhoto({"id":7867427,"src":"Screen_shot_2011-05-28_at_1712.58.52_thumb.jpg","galleries_id":423357,"server_id":5,"link":"photo_7867427.html","width":130,"caption":"","height":162});
															thumbnails[4270438] = clik.newPhoto({"id":4270438,"src":"Picture_9_thumb.jpg","galleries_id":170924,"server_id":5,"link":"photo_4270438.html","width":130,"caption":"Catalogue","height":89});
															thumbnails[3000804] = clik.newPhoto({"id":3000804,"src":"l_08b599ef7ac9ca19ff4e9b921f36bb51_thumb.jpg","galleries_id":286648,"server_id":5,"link":"photo_3000804.html","width":130,"caption":"Artist's Book Yearbook 08\/09","height":181});
															thumbnails[3656915] = clik.newPhoto({"id":3656915,"src":"Cealtimeout1_thumb.jpg","galleries_id":286648,"server_id":5,"link":"photo_3656915.html","width":130,"caption":"Time Out Article 2008.","height":174});
															thumbnails[3984561] = clik.newPhoto({"id":3984561,"src":"1243719145_thumb.jpg","galleries_id":286648,"server_id":5,"link":"photo_3984561.html","width":130,"caption":"RA Magazine Summer 09, page 47.","height":120});
															thumbnails[4108693] = clik.newPhoto({"id":4108693,"src":"Untitled-11_thumb.jpg","galleries_id":286648,"server_id":5,"link":"photo_4108693.html","width":130,"caption":"Culture Show, BBC 2, 17th June 2009.","height":306});
															thumbnails[5049487] = clik.newPhoto({"id":5049487,"src":"web_thumb.jpg","galleries_id":286648,"server_id":5,"link":"photo_5049487.html","width":130,"caption":"Dazed Digital - 4\/11\/09","height":153});
															thumbnails[5049470] = clik.newPhoto({"id":5049470,"src":"Picture_7_thumb.jpg","galleries_id":286648,"server_id":5,"link":"photo_5049470.html","width":130,"caption":"Spoonfed.co.uk - 5\/11\/09","height":120});
															thumbnails[5244244] = clik.newPhoto({"id":5244244,"src":"g2_thumb.jpg","galleries_id":286648,"server_id":5,"link":"photo_5244244.html","width":130,"caption":"Guardian Guide - 12\/12\/09","height":89});
															thumbnails[7963959] = clik.newPhoto({"id":7963959,"src":"screen-shot-2011-05-24-at-18-50-55_copy_87586885-1EC9-DFB6-09CDB64C5281EEA4_thumb.jpg","galleries_id":286648,"server_id":5,"link":"photo_7963959.html","width":130,"caption":"\"Steve\" the Film, 2010.","height":86});
															thumbnails[7867482] = clik.newPhoto({"id":7867482,"src":"screen-shot-2011-04-25-at-00-02-31_copy_thumb.jpg","galleries_id":286648,"server_id":5,"link":"photo_7867482.html","width":130,"caption":"ITV's Lewis April 2011","height":162});
															thumbnails[7964079] = clik.newPhoto({"id":7964079,"src":"Keira_2011-06-14_at_11.02.40_thumb.jpg","galleries_id":286648,"server_id":5,"link":"photo_7964079.html","width":130,"caption":"Artzine on Artrepublic.com June 2011","height":175});
															thumbnails[8565075] = clik.newPhoto({"id":8565075,"src":"Screen_shot_2011-09-19_at_20.47.56_thumb.jpg","galleries_id":286648,"server_id":5,"link":"photo_8565075.html","width":130,"caption":"Article by Once Was England September 2011","height":124});
															thumbnails[5731151] = clik.newPhoto({"id":5731151,"src":"25858_347139424450_248971934450_3341184_1232192_n_thumb.jpg","galleries_id":307585,"server_id":5,"link":"photo_5731151.html","width":130,"caption":"'Shotgun Clare' Shopper.","height":87});
															thumbnails[5439474] = clik.newPhoto({"id":5439474,"src":"Picture_112_thumb.jpg","galleries_id":307585,"server_id":5,"link":"photo_5439474.html","width":130,"caption":"'Shotgun Clare' Shopper.  ","height":192});
															thumbnails[5439484] = clik.newPhoto({"id":5439484,"src":"Picture_212_thumb.jpg","galleries_id":307585,"server_id":5,"link":"photo_5439484.html","width":130,"caption":"'Shotgun Clare' Shopper.","height":169});
															thumbnails[5731152] = clik.newPhoto({"id":5731152,"src":"25858_347139439450_248971934450_3341185_3076426_n_thumb.jpg","galleries_id":307585,"server_id":5,"link":"photo_5731152.html","width":130,"caption":"'Shotgun Clare' Shopper.","height":87});
															thumbnails[5807582] = clik.newPhoto({"id":5807582,"src":"Picture_212_0831634C-24E8-5EC4-4FB11CD7A01BFA72_thumb.jpg","galleries_id":307585,"server_id":5,"link":"photo_5807582.html","width":130,"caption":"Shotgun Clare Wallpaper","height":244});
															thumbnails[5842331] = clik.newPhoto({"id":5842331,"src":"Picture_1_thumb.jpg","galleries_id":307585,"server_id":5,"link":"photo_5842331.html","width":130,"caption":"Wallpaper","height":97});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[286648] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Press and Articles","link":"section343923.html","maxRecords":0.0,"photoIDs":[3000804.0,3656915.0,3984561.0,4108693.0,5049487.0,5049470.0,5244244.0,7963959.0,7867482.0,7964079.0,8565075.0],"skipIndex":0,"section_code":"section343923","featured_images":"8565075,7964079,7963959,7867482,5244244,5049487,5049470,4108693,3984561,3656915","id":286648,"singleSection":true});				  						galleries[299342] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"HASTE &#8800 SPEED ","link":"gallery_299342.html","maxRecords":0.0,"photoIDs":[],"skipIndex":0,"section_code":"gallery","featured_images":"","id":299342,"singleSection":false});				  						galleries[423357] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Urbane","link":"gallery_423357.html","maxRecords":0.0,"photoIDs":[7867252.0,7867264.0,7867427.0],"skipIndex":0,"section_code":"gallery","featured_images":7867252.0,"id":423357,"singleSection":false});				  						galleries[265443] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"On British Youth","link":"gallery_265443.html","maxRecords":0.0,"photoIDs":[4582102.0,4896854.0,5147653.0,5168783.0,5168790.0,5168795.0,5244176.0,5244472.0],"skipIndex":0,"section_code":"gallery","featured_images":5147653.0,"id":265443,"singleSection":false});				  						galleries[170924] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Paper Work","link":"gallery_170924.html","maxRecords":0.0,"photoIDs":[2805412.0,2805413.0,2805415.0,2805416.0,2805417.0,2805418.0,2805420.0,2805422.0,2805423.0,2805424.0,2900689.0,2900715.0,2928781.0,3885031.0,4270438.0],"skipIndex":0,"section_code":"gallery","featured_images":2805413.0,"id":170924,"singleSection":false});				  						galleries[307585] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Merchandise","link":"section368236.html","maxRecords":0.0,"photoIDs":[5731151.0,5439474.0,5439484.0,5731152.0,5807582.0,5842331.0],"skipIndex":0,"section_code":"section368236","featured_images":5439474.0,"id":307585,"singleSection":true});				  						galleries[170925] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Stories for Bedtime","link":"gallery_170925.html","maxRecords":0.0,"photoIDs":[3555617.0,3555752.0,3555755.0,3000801.0,3000802.0,3000803.0,3000805.0,3000806.0,3000807.0,3000809.0],"skipIndex":0,"section_code":"gallery","featured_images":3000803.0,"id":170925,"singleSection":false});				  						galleries[175416] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Commissions","link":"gallery_175416.html","maxRecords":0.0,"photoIDs":[3774883.0,2805444.0],"skipIndex":0,"section_code":"gallery","featured_images":2805444.0,"id":175416,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '3000802,7867252,7867427';
imageSets[2] = '5147653,2805444,2805413,3000803,5439474,7867252';
imageSets[3] = '8565075,7964079,7963959,7867482,7867427,7867264,7867252,5842331,5827659,5819622,5807582,5731152,5731151,5439484,5439474,5244472,5244244,5244176,5168795,5168790,5168783,5147653,5049487,5049470,4896854,4582102,4270438,4108693,3984561,3885031,3774883,3656915,3555755,3555752,3555617,3000809,3000807,3000806,3000805,3000804,3000803,3000802,3000801,2928781,2900715,2900689,2805444,2805433,2805424,2805423';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'www12.clikpic.com/Kilwax/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/Kilwax/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/Kilwax/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/Kilwax/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/Kilwax/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/Kilwax/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/Kilwax/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/Kilwax/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/Kilwax/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/Kilwax/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/Kilwax/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/Kilwax/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/Kilwax/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/Kilwax/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/Kilwax/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/Kilwax/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/Kilwax/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/Kilwax/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/Kilwax/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/Kilwax/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/Kilwax/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/Kilwax/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/Kilwax/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/Kilwax/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/Kilwax/images';
		break;
	}
		return val;
}

/***************************************************************************
* img = reference to image object in which to show image                   *
***************************************************************************/
function showHomeImage(img) {
	imageID = randomListVal('');
	if (!basic) {
		img.src = photos[imageID].src;
		img.width = photos[imageID].width;
		img.height = photos[imageID].height;
		img.parentNode.title = img.alt = photos[imageID].caption;
	} else {
		newImage = new Image(photos[imageID].width,photos[imageID].height);
		newImage.src = photos[imageID].src;
		document.images[img.name] = newImage;
		
	}
}

function getHomeImageLink(imageID) {
  	var href='', photo = backgrounds && backgrounds[imageID];
	if(photo){
		if (photo && photo.galleries_id != '') {
  			href = photo.fnGalleryLink();
  		}
  		  		else {
  				href += 'gallery.html';
  	  		}
	}
    return href;
}

/***************************************************************************
* Show a random image on home page from featured images                    *
***************************************************************************/
function showHomeImageInline(el, image_sets_id, href) {
	
	var css = {}, imageID,
	    imageSetsId = 1;
	if(image_sets_id){
		imageSetsId = image_sets_id;
	}
	imageID = randomListVal(imageSets[imageSetsId]);
	if (href == null && 'gallery' != '') {
					href = getHomeImageLink(imageID);
	}
	
	updateImage({nextPhoto: backgrounds[imageID], img:el.find('img')[0],
                $photo:el, $title:$('#homeimageTitleContainer'), $detail:$('#homeimageDetailsContainer'),                speed:0, href:href, css:css, onAfter: function(){                  this.closest('.contentsection').doManualAlign({				    inner: 'img',				    crop: 'a'				  });                }              });
}

/***************************************************************************
* Set 'img' to be a new image given its photo() object                     *
***************************************************************************/
function updateImage (options) {
	var defaults = {nextPhoto:'',field:'',img:'',$photo:'',$title:'',$detail:'',$detailContainer:'',
                    updateDocumentTitle:false,speed:0,href:false,css:false,updateHash:false,onAfter:null,onBefore:null},
		op = $.extend({},defaults,options),
		html = '', temp = '',
		photoId = op.nextPhoto.id,
		photoCaption = ''+op.nextPhoto.caption,
		photoSrc = op.nextPhoto.src;
	
	if (op.updateHash && clik.getIDInUrl(location.href,'photo') != op.nextPhoto.id) {
		clik.changeHash('photos_id=' + op.nextPhoto.id, true);
	}
		
	    if (op.$title.length > 0) {
  		op.$title.fadeGalleryDetails(photoCaption, op.speed);
    }
        if (op.updateDocumentTitle) {
						  document.title = 'Ceal Warnants : ' + photoCaption;
			    }
        if (op.$detail.length > 0) {
      	temp = op.nextPhoto.fnGetImageDetails();
	    op.$detail.fadeGalleryDetails(temp, op.speed, function(){
			if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
				toggleAddToCartConfirm(backgrounds, op.$detail);
			} else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
				toggleAddToCartConfirm(photos, op.$detail);
			}
			$('body').trigger('clikUpdate.popup');
	    });
    }
        $(op.$detailContainer).find('.replaceable[class*=replaceable_photo-]').each(function(){
    	var field = clik.getPrefixedClass(this.className, 'replaceable_photo-');
    	if (field in op.nextPhoto) {
    		$(this).fadeGalleryDetails(op.nextPhoto[field], op.speed);
    	}
    }).end().find('.replaceable.photoPayment').fadeGalleryDetails(op.nextPhoto.fnGetPaymentInfo(), op.speed, function(){
		if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
			toggleAddToCartConfirm(backgrounds, op.$detailContainer);
		} else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
			toggleAddToCartConfirm(photos, op.$detailContainer);
		}
		$('body').trigger('clikUpdate.popup');
	});
		if (op.$photo.length > 0) {
		html = $('<img/>',{
			'class': 'mainphoto photo',
			src: photoSrc,
			id: 'mainPic',
			name: 'mainPic',
			width: op.nextPhoto.width,
			height: op.nextPhoto.height,
			alt: photoCaption,
			css: op.css || {}
		});
		if (op.href) {
			if (op.href.match(/<a/)) {
				html = $(op.href).append(html);
			} else {
				html = $('<a/>', {
					href: op.href,
					title: photoCaption
				}).append(html);
			}
		} else {
			html = $('<a/>', {
				title: photoCaption
			}).append(html);
		}
		if (op.speed == 0) {			op.$photo.html(html);			if (op.onBefore) {			  	op.onBefore.apply(op.$photo);			}			if (op.onAfter) {			  	op.onAfter.apply(op.$photo);			}		} else {			op.$photo.stop(true,true).fadeReplaceWith(html,op.speed,'',function(){  				if (op.onAfter) {				  	op.onAfter.apply(this);				}				clik.doColumnResize(false, $(this).add(op.$detail).add(op.$title));			}, op.onBefore);
		}	}
    if (op.field) {
		op.field.value = photoId;
	} else {
		op.$photo.data('image_id', photoId);
    }
        if (!op.speed) {
      	clik.doColumnResize(false, op.$photo.add(op.$detail).add(op.$title));
    }
        
    return html;
	}

/***************************************************************************
* Toggle add to cart confirmation element and set up the click event for   *
* the 'Add to cart' button.                                                *
***************************************************************************/
function toggleAddToCartConfirm(array, root){
	if (typeof(array) !== 'object' || array === null) {
	  	array = photos;
	}
	if (!$(root).length) {		root = $('body');	}	if($('#paymentConfirm', root).length > 0){
		$('#paymentConfirm', root).hide();
		$('#paymentAddButton', root)
		.unbind()
		.click(function(){
						form = $('#paymentForm', root)[0];
			option_id = 0;
			if(form.item_option.value){
				option_id = form.item_option.value;
			}
			if(addItemToBasket(form.item_number.value,array,form.site.value,parseInt(form.quantity.value, 10),option_id)){
				if($.browser.msie){$('#paymentConfirm', root).text('Item added to cart').show();}
				else{
					$('#paymentConfirm', root).text('Item added to cart').fadeIn();
					dspOrderDetails(form.site.value);
				}
			}
			else{
				$('#paymentConfirm', root).text('Item not added - check cookies are enabled in your browser.').fadeIn();
			}
		});
	}
}

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
clik.photo.fnGetImageDetails = function(){
	var temp = '';
	if (this.description != '') {
		temp +=  '<div id="imageDescription">' + this.description + '</div>';
	}
		if (this.photo_ref != '') {
		temp += '<div class="imageinfo" id="imageRef"><strong>Ref: </strong>' + this.photo_ref + '</div>';
	}
		if (this.takendate != '') {
		
		temp += '<div class="imageinfo" id="imageDate"><strong>Date: </strong>' + this.takendate + '</div>';
	}
	
	if (this.location != '') {
		
		temp += '<div class="imageinfo" id="imageLocation"><strong>Location: </strong>' +  this.location + '</div>';
	}
	
	if (this.photographer != '') {
		
		temp += '<div class="imageinfo" id="imagePhotographer"><strong>Photographer: </strong>' + this.photographer + '</div>';
	}
				
				if (temp != '') {
		temp += '<div class="spacer"></div>';
	}
	return temp;
};

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
clik.photo.fnGetPaymentInfo = function(){
	var temp = '';
	if (this.item_price !== '') {
				temp += '<p>Order this print:</p>';
				temp += '<div class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> ' + (this.item_price).toFixed(2) + '</div>';
		var item_name  = this.purchase_instruction;
		var amount = (this.item_price).toFixed(2);
		var item_option  = 0;
	}
	else if (this.payment_groups_id !== '') {
		temp += '<p>Buy this print online:</p>';
				temp += '<form id="paymentOptions" style="margin:0px;border:0px;" name="paymentOptions">';
											temp += '<select class="paymentlink" name="payment_options_id" onchange="updateItemValues($(this.form).next(\'#paymentForm\')[0],this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value);">';
		
		temp += getPaymentOptions(this.payment_groups_id);
		temp += '</select>';
		temp += '</form>';
				var item_option  = paymentGroups[this.payment_groups_id].options[0];
		if(paymentOptions[item_option]){
			var item_name  = paymentOptions[item_option].payment_option;
			var amount =  paymentOptions[item_option].price;
		}
			}
	else {
		
	}
	if (this.item_price !== '' || this.payment_groups_id !== '') {
			temp += '<div class="clearing">&nbsp;</div>';
	}
	return temp;};

/***************************************************************************
* Pick a photo at random from the featured images of a gallery.            *
* Gallery_id = id of gallery to choose,                                    *
* img = reference to html image in                                         *
* which to show image                                                      *
***************************************************************************/
function showGalleryImage(gallery_id, img, updateLink) {
	
	if(img){
		if (location.hash.match('galleries_id=' + gallery_id) && (imageID = location.hash.match('.*photos_id=(.+)$'))) {
		  	imageID = imageID[1];
		} else {
		  	imageID = randomListVal(galleries[gallery_id].featured_images);
		}
		
		if (imageID != 0) {
			img.src = thumbnails[imageID].src;
			img.width = thumbnails[imageID].width;
			img.height = thumbnails[imageID].height;
			img.alt = galleries[gallery_id].title;
			if (updateLink) {
				$(img).parent().attr({					title: galleries[gallery_id].title				}).filter(function(){return this.href;}).attr({					href: thumbnails[imageID].fnGalleryLink(gallery_id)				});
			}
		}
	}
}

/***************************************************************************
* If we have dynamic HTML, replace the galleries link with a list that     *
* doesn't include thecurrent gallery                                       *
***************************************************************************/
function showGalleries(gallery_id) {
		
	
	if (!basic) {
		temp = '';
		for (i = 0; i < galleries.length; i++) {
						
			
			if (galleries[i].id != gallery_id) {
								
				if (temp != '') {
					temp += ' | ';
				}
								temp += '<a href="' + galleries[i].section_code + '_' + galleries[i].id + '.html">' + galleries[i].title + '</a>';
							}
		}
		document.all.galleryLinks.innerHTML = 'Other galleries: ' + temp;
	}
}

			

