window.thumbnails = {};
															thumbnails[5588496] = clik.newPhoto({"id":5588496,"src":"tia-for-web_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"","height":87});
															thumbnails[8565995] = clik.newPhoto({"id":8565995,"src":"6726_log_ride_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"","height":87});
															thumbnails[8769981] = clik.newPhoto({"id":8769981,"src":"001_7982_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"","height":98});
															thumbnails[8771049] = clik.newPhoto({"id":8771049,"src":"Sarah_by_JAspar1_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"Photo by Jaspar Wyatt","height":180});
															thumbnails[8771937] = clik.newPhoto({"id":8771937,"src":"Sarah_by_JAspar_layers_text_2__thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"photo taken by Jasper Wyatt","height":180});
															thumbnails[9011406] = clik.newPhoto({"id":9011406,"src":"255138_10150210873064178_591344177_6841108_2730381_n_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"Barcelona Exhibition 2011","height":86});
															thumbnails[9084046] = clik.newPhoto({"id":9084046,"src":"001_7973_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"Oct 2011","height":123});
															thumbnails[4224848] = clik.newPhoto({"id":4224848,"src":"daffs-ls-for-web_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"","height":186});
															thumbnails[4670345] = clik.newPhoto({"id":4670345,"src":"cu-bw-copy70percforweb_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"","height":87});
															thumbnails[3971597] = clik.newPhoto({"id":3971597,"src":"bruno-and-clarafor-web_thumb.jpg","galleries_id":174516,"server_id":5,"link":"photo_3971597.html","width":130,"caption":"","height":174});
															thumbnails[3971603] = clik.newPhoto({"id":3971603,"src":"alex-and-ellie-for-web_thumb.jpg","galleries_id":174516,"server_id":5,"link":"photo_3971603.html","width":130,"caption":"","height":199});
															thumbnails[3973500] = clik.newPhoto({"id":3973500,"src":"daisytoeforweb_thumb.jpg","galleries_id":174516,"server_id":5,"link":"photo_3973500.html","width":130,"caption":"","height":183});
															thumbnails[3973511] = clik.newPhoto({"id":3973511,"src":"martinsonswindow_thumb.jpg","galleries_id":174516,"server_id":5,"link":"photo_3973511.html","width":130,"caption":"","height":191});
															thumbnails[3973571] = clik.newPhoto({"id":3973571,"src":"olivia-bubble_thumb.jpg","galleries_id":174504,"server_id":5,"link":"photo_3973571.html","width":130,"caption":"","height":99});
															thumbnails[3973631] = clik.newPhoto({"id":3973631,"src":"ryan-bearfor-web_thumb.jpg","galleries_id":240511,"server_id":5,"link":"photo_3973631.html","width":130,"caption":"","height":106});
															thumbnails[3974758] = clik.newPhoto({"id":3974758,"src":"flute-for-webborder_thumb.jpg","galleries_id":174504,"server_id":5,"link":"photo_3974758.html","width":130,"caption":"","height":191});
															thumbnails[3984512] = clik.newPhoto({"id":3984512,"src":"bed-kidsfor-web_thumb.jpg","galleries_id":174516,"server_id":5,"link":"photo_3984512.html","width":130,"caption":"","height":126});
															thumbnails[3984514] = clik.newPhoto({"id":3984514,"src":"alexellieabovefor-web_thumb.jpg","galleries_id":174516,"server_id":5,"link":"photo_3984514.html","width":130,"caption":"","height":104});
															thumbnails[3984532] = clik.newPhoto({"id":3984532,"src":"rug-familyfor-web_thumb.jpg","galleries_id":174516,"server_id":5,"link":"photo_3984532.html","width":130,"caption":"","height":101});
															thumbnails[3984552] = clik.newPhoto({"id":3984552,"src":"shonafor-web_thumb.jpg","galleries_id":174504,"server_id":5,"link":"photo_3984552.html","width":130,"caption":"","height":105});
															thumbnails[3984611] = clik.newPhoto({"id":3984611,"src":"jessiegirlsfor-web_thumb.jpg","galleries_id":174516,"server_id":5,"link":"photo_3984611.html","width":130,"caption":"","height":185});
															thumbnails[3984623] = clik.newPhoto({"id":3984623,"src":"brunopaintforweb_thumb.jpg","galleries_id":174516,"server_id":5,"link":"photo_3984623.html","width":130,"caption":"","height":206});
															thumbnails[3984635] = clik.newPhoto({"id":3984635,"src":"oliver-familydarker_thumb.jpg","galleries_id":174516,"server_id":5,"link":"photo_3984635.html","width":130,"caption":"","height":177});
															thumbnails[3997543] = clik.newPhoto({"id":3997543,"src":"sammy-handlghtforweb_thumb.jpg","galleries_id":174505,"server_id":5,"link":"photo_3997543.html","width":130,"caption":"","height":93});
															thumbnails[3997578] = clik.newPhoto({"id":3997578,"src":"martinson-carpetforweb80_thumb.jpg","galleries_id":174516,"server_id":5,"link":"photo_3997578.html","width":130,"caption":"","height":86});
															thumbnails[3997859] = clik.newPhoto({"id":3997859,"src":"sheepskin-girlforweb60_thumb.jpg","galleries_id":174504,"server_id":5,"link":"photo_3997859.html","width":130,"caption":"","height":171});
															thumbnails[5588485] = clik.newPhoto({"id":5588485,"src":"894redonebw-copymillie-for-web_thumb.jpg","galleries_id":174504,"server_id":5,"link":"photo_5588485.html","width":130,"caption":"","height":89});
															thumbnails[6221981] = clik.newPhoto({"id":6221981,"src":"olga-nad-tab_thumb.jpg","galleries_id":174516,"server_id":5,"link":"photo_6221981.html","width":130,"caption":"","height":94});
															thumbnails[8565932] = clik.newPhoto({"id":8565932,"src":"final_7762_full_frame__my_edit_for_web__thumb.jpg","galleries_id":174505,"server_id":5,"link":"photo_8565932.html","width":130,"caption":"","height":90});
															thumbnails[8601701] = clik.newPhoto({"id":8601701,"src":"911final-bw_thumb.jpg","galleries_id":174505,"server_id":5,"link":"photo_8601701.html","width":130,"caption":"","height":92});
															thumbnails[8601988] = clik.newPhoto({"id":8601988,"src":"FINAL_7792_flat__otto_bw__thumb.jpg","galleries_id":174505,"server_id":5,"link":"photo_8601988.html","width":130,"caption":"","height":167});
															thumbnails[8603572] = clik.newPhoto({"id":8603572,"src":"elly-fairy-edited-for-web-_thumb.jpg","galleries_id":174504,"server_id":5,"link":"photo_8603572.html","width":130,"caption":"","height":193});
															thumbnails[8603781] = clik.newPhoto({"id":8603781,"src":"tia-926for-web_thumb.jpg","galleries_id":174504,"server_id":5,"link":"photo_8603781.html","width":130,"caption":"","height":87});
															thumbnails[8604090] = clik.newPhoto({"id":8604090,"src":"james-300dpieditfor-web_thumb.jpg","galleries_id":174516,"server_id":5,"link":"photo_8604090.html","width":130,"caption":"","height":94});
															thumbnails[8611955] = clik.newPhoto({"id":8611955,"src":"tiff-backlit-600dpi-backlitfor-web-_thumb.jpg","galleries_id":174504,"server_id":5,"link":"photo_8611955.html","width":130,"caption":"","height":171});
															thumbnails[8611975] = clik.newPhoto({"id":8611975,"src":"for-web-edited-feet-300dpi_thumb.jpg","galleries_id":240511,"server_id":5,"link":"photo_8611975.html","width":130,"caption":"","height":91});
															thumbnails[8612060] = clik.newPhoto({"id":8612060,"src":"nudie-smiley-tabitha_thumb.jpg","galleries_id":240511,"server_id":5,"link":"photo_8612060.html","width":130,"caption":"","height":180});
															thumbnails[8612218] = clik.newPhoto({"id":8612218,"src":"for-web-881bw_thumb.jpg","galleries_id":174516,"server_id":5,"link":"photo_8612218.html","width":130,"caption":"","height":85});
															thumbnails[8613213] = clik.newPhoto({"id":8613213,"src":"for-web-0110-finished-2011-795dylan36x25.5_thumb.jpg","galleries_id":174505,"server_id":5,"link":"photo_8613213.html","width":130,"caption":"","height":92});
															thumbnails[8613390] = clik.newPhoto({"id":8613390,"src":"for-web-final-392-hebe_thumb.jpg","galleries_id":174504,"server_id":5,"link":"photo_8613390.html","width":130,"caption":"","height":166});
															thumbnails[8613403] = clik.newPhoto({"id":8613403,"src":"for-web-final-5270icecream_thumb.jpg","galleries_id":174505,"server_id":5,"link":"photo_8613403.html","width":130,"caption":"","height":87});
															thumbnails[4224852] = clik.newPhoto({"id":4224852,"src":"daffssniff1055low-ressniff_thumb.jpg","galleries_id":174504,"server_id":5,"link":"photo_4224852.html","width":130,"caption":"","height":87});
															thumbnails[5330234] = clik.newPhoto({"id":5330234,"src":"pudding-lanscape-flat-for-web1_thumb.jpg","galleries_id":240511,"server_id":5,"link":"photo_5330234.html","width":130,"caption":"","height":87});
															thumbnails[4667254] = clik.newPhoto({"id":4667254,"src":"nightlightfinal-layerfor-webfinal_thumb.jpg","galleries_id":479090,"server_id":5,"link":"photo_4667254.html","width":130,"caption":"","height":87});
															thumbnails[8599696] = clik.newPhoto({"id":8599696,"src":"1519favebw-copyfor-web_thumb.jpg","galleries_id":479090,"server_id":5,"link":"photo_8599696.html","width":130,"caption":"Kickboxer","height":195});
															thumbnails[8601557] = clik.newPhoto({"id":8601557,"src":"829-drama-students-2bwfor-web_thumb.jpg","galleries_id":479090,"server_id":5,"link":"photo_8601557.html","width":130,"caption":"Actors","height":87});
															thumbnails[5562978] = clik.newPhoto({"id":5562978,"src":"brace-face-5656_thumb.jpg","galleries_id":452753,"server_id":5,"link":"photo_5562978.html","width":130,"caption":"","height":87});
															thumbnails[6221773] = clik.newPhoto({"id":6221773,"src":"pig-foodcu6110_thumb.jpg","galleries_id":452753,"server_id":5,"link":"photo_6221773.html","width":130,"caption":"","height":104});
															thumbnails[3997943] = clik.newPhoto({"id":3997943,"src":"second-rncforweb60_thumb.jpg","galleries_id":240512,"server_id":5,"link":"photo_3997943.html","width":130,"caption":"","height":187});
															thumbnails[4004961] = clik.newPhoto({"id":4004961,"src":"dark-blosson-grovefor-web_thumb.jpg","galleries_id":240512,"server_id":5,"link":"photo_4004961.html","width":130,"caption":"","height":125});
															thumbnails[8612247] = clik.newPhoto({"id":8612247,"src":"for-web-edited-bleeding-hearts-600pix_thumb.jpg","galleries_id":240512,"server_id":5,"link":"photo_8612247.html","width":130,"caption":"Bleeding Hearts - Darkroom lith print. ","height":79});
															thumbnails[6221779] = clik.newPhoto({"id":6221779,"src":"warehouse_thumb.jpg","galleries_id":454760,"server_id":5,"link":"photo_6221779.html","width":130,"caption":"the Better Body Shop, Sevenoaks. Photos for the gym's website.","height":104});
															thumbnails[8612589] = clik.newPhoto({"id":8612589,"src":"jonny-684bwthrooughwindow_thumb.jpg","galleries_id":454760,"server_id":5,"link":"photo_8612589.html","width":130,"caption":"","height":65});
															thumbnails[9011409] = clik.newPhoto({"id":9011409,"src":"254219_10150206377124178_591344177_6801322_4138230_n_thumb.jpg","galleries_id":474877,"server_id":5,"link":"photo_9011409.html","width":130,"caption":"me hanging my work in Girona Street Festival exhibition of 2011","height":115});
															thumbnails[9083875] = clik.newPhoto({"id":9083875,"src":"001_78391_thumb.jpg","galleries_id":479076,"server_id":5,"link":"photo_9083875.html","width":130,"caption":"Oct 2011","height":97});
															thumbnails[9083901] = clik.newPhoto({"id":9083901,"src":"001_86041_thumb.jpg","galleries_id":479076,"server_id":5,"link":"photo_9083901.html","width":130,"caption":"Jan 2012","height":87});
															thumbnails[9083922] = clik.newPhoto({"id":9083922,"src":"IMG_7959_thumb_1CA3F5F8-24E8-5EC4-4F2D6741A6EA14DD.JPG","galleries_id":479076,"server_id":5,"link":"photo_9083922.html","width":130,"caption":"Oct 2011","height":87});
															thumbnails[9083984] = clik.newPhoto({"id":9083984,"src":"001_7944_thumb.jpg","galleries_id":479076,"server_id":5,"link":"photo_9083984.html","width":130,"caption":" Oct 2011","height":87});
															thumbnails[9084010] = clik.newPhoto({"id":9084010,"src":"001_7982_1CCE5B81-24E8-5EC4-4F16491FD9FC6A3A_thumb.jpg","galleries_id":479076,"server_id":5,"link":"photo_9084010.html","width":130,"caption":"Oct 2011","height":98});
															thumbnails[9084052] = clik.newPhoto({"id":9084052,"src":"001_7971_thumb.jpg","galleries_id":479076,"server_id":5,"link":"photo_9084052.html","width":87,"caption":"Oct 2011","height":130});
															thumbnails[9084071] = clik.newPhoto({"id":9084071,"src":"001_8237_thumb.jpg","galleries_id":479076,"server_id":5,"link":"photo_9084071.html","width":130,"caption":"Nov 2011","height":87});
															thumbnails[9084079] = clik.newPhoto({"id":9084079,"src":"001_low_res_8130_thumb.jpg","galleries_id":479076,"server_id":5,"link":"photo_9084079.html","width":130,"caption":"Nov 2011","height":91});
															thumbnails[9084091] = clik.newPhoto({"id":9084091,"src":"001_8689_1_copy_thumb.jpg","galleries_id":479076,"server_id":5,"link":"photo_9084091.html","width":130,"caption":"Jan 2012 ","height":87});
															thumbnails[9084093] = clik.newPhoto({"id":9084093,"src":"00_8666_thumb.jpg","galleries_id":479076,"server_id":5,"link":"photo_9084093.html","width":130,"caption":"Jan 2012  ","height":94});
															thumbnails[9084094] = clik.newPhoto({"id":9084094,"src":"002_8156_thumb.jpg","galleries_id":479076,"server_id":5,"link":"photo_9084094.html","width":130,"caption":"Nov 2011","height":87});
															thumbnails[9084095] = clik.newPhoto({"id":9084095,"src":"003_1030719_thumb.jpg","galleries_id":479076,"server_id":5,"link":"photo_9084095.html","width":130,"caption":"Jan 2012   ","height":83});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[452753] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Band Photos ","link":"section546779.html","maxRecords":0.0,"photoIDs":[5562978.0,6221773.0],"skipIndex":0,"section_code":"section546779","featured_images":6221773.0,"id":452753,"singleSection":true});				  						galleries[454760] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Commercial ","link":"section550108.html","maxRecords":0.0,"photoIDs":[6221779.0,8612589.0],"skipIndex":0,"section_code":"section550108","featured_images":"8612589,6221779","id":454760,"singleSection":true});				  						galleries[474877] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Exhibitions ","link":"section577901.html","maxRecords":0.0,"photoIDs":[9011409.0],"skipIndex":0,"section_code":"section577901","featured_images":9011409.0,"id":474877,"singleSection":true});				  						galleries[174516] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Groups","link":"gallery_174516.html","maxRecords":0.0,"photoIDs":[3971597.0,3971603.0,3973500.0,3973511.0,3984512.0,3984514.0,3984532.0,3984611.0,3984623.0,3984635.0,3997578.0,6221981.0,8604090.0,8612218.0],"skipIndex":0,"section_code":"gallery","featured_images":3984635.0,"id":174516,"singleSection":false});				  						galleries[174504] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Girls ","link":"gallery_174504.html","maxRecords":0.0,"photoIDs":[3973571.0,3974758.0,3984552.0,3997859.0,5588485.0,8603572.0,8603781.0,8611955.0,8613390.0,4224852.0],"skipIndex":0,"section_code":"gallery","featured_images":"4224852,3997859","id":174504,"singleSection":false});				  						galleries[174505] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Boys","link":"gallery_174505.html","maxRecords":0.0,"photoIDs":[3997543.0,8565932.0,8601701.0,8601988.0,8613213.0,8613403.0],"skipIndex":0,"section_code":"gallery","featured_images":"8613403,8613213,8601988,8601701,8565932,3997543","id":174505,"singleSection":false});				  						galleries[479090] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Adults ","link":"section559306.html","maxRecords":0.0,"photoIDs":[4667254.0,8599696.0,8601557.0],"skipIndex":0,"section_code":"section559306","featured_images":"8601557,8599696,4667254","id":479090,"singleSection":true});				  						galleries[240511] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Babies","link":"gallery_240511.html","maxRecords":0.0,"photoIDs":[3973631.0,8611975.0,8612060.0,5330234.0],"skipIndex":0,"section_code":"gallery","featured_images":"8612060,8611975,5330234,3973631","id":240511,"singleSection":false});				  						galleries[240512] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Fine Art ","link":"section550109.html","maxRecords":0.0,"photoIDs":[3997943.0,4004961.0,8612247.0],"skipIndex":0,"section_code":"section550109","featured_images":"8612247,4004961,3997943","id":240512,"singleSection":true});				  						galleries[479076] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Nightlife","link":"section583624.html","maxRecords":0.0,"photoIDs":[9083875.0,9083901.0,9083922.0,9083984.0,9084010.0,9084052.0,9084071.0,9084079.0,9084091.0,9084093.0,9084094.0,9084095.0],"skipIndex":0,"section_code":"section583624","featured_images":"9084095,9084094,9084093,9084091,9084079,9084071,9084052,9084010,9083984,9083922","id":479076,"singleSection":true});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '9084091';
imageSets[2] = '6221773,3997859,3984635,4224852';
imageSets[3] = '9084095,9084094,9084093,9084091,9084079,9084071,9084052,9084046,9084010,9083984,9083922,9083901,9083875,9011409,9011406,8771937,8771049,8769981,8613403,8613390,8613213,8612589,8612247,8612218,8612060,8611975,8611955,8604090,8603781,8603572,8601988,8601701,8601557,8599696,8565995,8565932,6221981,6221779,6221773,5588496,5588485,5562978,5330234,4670345,4667254,4224852,4224848,4004961,3997943,3997859';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/sarahg/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/sarahg/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/sarahg/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/sarahg/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/sarahg/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/sarahg/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/sarahg/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/sarahg/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/sarahg/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/sarahg/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/sarahg/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/sarahg/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/sarahg/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/sarahg/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/sarahg/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/sarahg/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/sarahg/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/sarahg/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/sarahg/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/sarahg/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/sarahg/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/sarahg/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/sarahg/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/sarahg/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/sarahg/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/sarahg/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/sarahg/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 = 'Sarah Garrod 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>United Kingdom </strong>' +  this.location + '</div>';
	}
	
	if (this.photographer != '') {
		
		temp += '<div class="imageinfo" id="imagePhotographer"><strong>Photographer: </strong>' + this.photographer + '</div>';
	}
				
				if (temp != '') {
		temp += '<div class="spacer"></div>';
	}
	return temp;
};

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
clik.photo.fnGetPaymentInfo = function(){
	var temp = '';
	if (this.item_price !== '') {
				temp += '<p>Order this print:</p>';
				temp += '<div class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> ' + (this.item_price).toFixed(2) + '</div>';
		var item_name  = this.purchase_instruction;
		var amount = (this.item_price).toFixed(2);
		var item_option  = 0;
	}
		else {
		
	}
	if (this.item_price !== '') {
			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;
	}
}

			

