window.thumbnails = {};
															thumbnails[1047336] = clik.newPhoto({"id":1047336,"src":"close to the sea7_thumb.jpg","galleries_id":80329,"server_id":1,"link":"photo_1047336.html","width":130,"caption":"close to the sea SOLD<br>\r\n76x100cm","height":98});
															thumbnails[1690888] = clik.newPhoto({"id":1690888,"src":"swimming away_thumb.JPG","galleries_id":465666,"server_id":1,"link":"photo_1690888.html","width":130,"caption":"swimming away50x100cm £800","height":98});
															thumbnails[1938146] = clik.newPhoto({"id":1938146,"src":"splashing _thumb.JPG","galleries_id":80329,"server_id":1,"link":"photo_1938146.html","width":130,"caption":"splashing out  SOLD<br>\r\n50 x 100cms","height":98});
															thumbnails[2302540] = clik.newPhoto({"id":2302540,"src":"Be my friend1_thumb.JPG","galleries_id":465666,"server_id":1,"link":"photo_2302540.html","width":130,"caption":"Be my friend40x100cm £600","height":98});
															thumbnails[3124390] = clik.newPhoto({"id":3124390,"src":"by the lake_thumb.JPG","galleries_id":53218,"server_id":1,"link":"photo_3124390.html","width":130,"caption":"by the water<br>\r\n50x70cm SOLD","height":98});
															thumbnails[3124440] = clik.newPhoto({"id":3124440,"src":"across the field _thumb.JPG","galleries_id":53216,"server_id":1,"link":"photo_3124440.html","width":130,"caption":"across the field<br>\r\n20x25cm SOLD","height":98});
															thumbnails[3124495] = clik.newPhoto({"id":3124495,"src":"over there_thumb.JPG","galleries_id":194152,"server_id":1,"link":"photo_3124495.html","width":130,"caption":"over there<br>\r\n20x20cm<br>\r\nSOLD","height":98});
															thumbnails[3183613] = clik.newPhoto({"id":3183613,"src":"windy day1_thumb.JPG","galleries_id":194152,"server_id":1,"link":"photo_3183613.html","width":130,"caption":"windy day<br>\r\n12x18cm<br>\r\nSOLD","height":98});
															thumbnails[3388751] = clik.newPhoto({"id":3388751,"src":"somewhere over there2_thumb.JPG","galleries_id":194152,"server_id":1,"link":"photo_3388751.html","width":130,"caption":"somewhere over there<br>\r\n20x20cm SOLD","height":98});
															thumbnails[3395457] = clik.newPhoto({"id":3395457,"src":"across the sands_thumb.JPG","galleries_id":53088,"server_id":1,"link":"photo_3395457.html","width":130,"caption":"across the sands SOLD<br>\r\n45x61cm","height":98});
															thumbnails[3568804] = clik.newPhoto({"id":3568804,"src":"round_the_harbour_thumb.JPG","galleries_id":80329,"server_id":1,"link":"photo_3568804.html","width":130,"caption":"round the harbour30x50cm SOLD","height":98});
															thumbnails[3613126] = clik.newPhoto({"id":3613126,"src":"pink_rose_thumb.JPG","galleries_id":194152,"server_id":1,"link":"photo_3613126.html","width":130,"caption":"pink rose20x20cm SOLD","height":173});
															thumbnails[3641622] = clik.newPhoto({"id":3641622,"src":"skipping_along_the_beach_thumb.JPG","galleries_id":80329,"server_id":1,"link":"photo_3641622.html","width":130,"caption":"skipping along the beach 50x100cm SOLD","height":98});
															thumbnails[3641633] = clik.newPhoto({"id":3641633,"src":"fishing_thumb.JPG","galleries_id":194152,"server_id":1,"link":"photo_3641633.html","width":130,"caption":"fishing 20x20cm SOLD","height":173});
															thumbnails[3700682] = clik.newPhoto({"id":3700682,"src":"spring2_thumb.JPG","galleries_id":194152,"server_id":1,"link":"photo_3700682.html","width":130,"caption":"spring SOLD <br>\r\n20x20cm","height":173});
															thumbnails[3723927] = clik.newPhoto({"id":3723927,"src":"sometimes_there_are_stormy_days1_thumb.JPG","galleries_id":80329,"server_id":1,"link":"photo_3723927.html","width":130,"caption":"sometimes there are stormy days<br>\r\n40x100cm  SOLD","height":98});
															thumbnails[4057474] = clik.newPhoto({"id":4057474,"src":"mermaid_finding_treasure_thumb.JPG","galleries_id":80329,"server_id":1,"link":"photo_4057474.html","width":130,"caption":"mermaid finding treasure<br>\r\n40x100cm SOLD","height":98});
															thumbnails[4117118] = clik.newPhoto({"id":4117118,"src":"stepping_stones_thumb.JPG","galleries_id":465666,"server_id":1,"link":"photo_4117118.html","width":130,"caption":"stepping stones30x40cm £200","height":98});
															thumbnails[4475812] = clik.newPhoto({"id":4475812,"src":"coastal__thumb.JPG","galleries_id":80329,"server_id":1,"link":"photo_4475812.html","width":130,"caption":"coastal40x50cm SOLD","height":98});
															thumbnails[4475848] = clik.newPhoto({"id":4475848,"src":"on_the_hillside_thumb.JPG","galleries_id":194152,"server_id":1,"link":"photo_4475848.html","width":130,"caption":"on the hillside<br>\r\n20x20cm SOLD","height":98});
															thumbnails[4598354] = clik.newPhoto({"id":4598354,"src":"telling_the_tale_thumb.JPG","galleries_id":53218,"server_id":1,"link":"photo_4598354.html","width":130,"caption":"telling the tale <br>\r\n80 x 100cm SOLD","height":98});
															thumbnails[4611717] = clik.newPhoto({"id":4611717,"src":"still_thumb.JPG","galleries_id":80329,"server_id":1,"link":"photo_4611717.html","width":130,"caption":"still SOLD<br>\r\n50x100cm","height":98});
															thumbnails[5085292] = clik.newPhoto({"id":5085292,"src":"cat_and_moon_thumb.JPG","galleries_id":194152,"server_id":1,"link":"photo_5085292.html","width":130,"caption":"owl and moon SOLD<br>\r\n20x20cm","height":173});
															thumbnails[5085319] = clik.newPhoto({"id":5085319,"src":"place_by_the_sea_thumb.JPG","galleries_id":194152,"server_id":1,"link":"photo_5085319.html","width":130,"caption":"place by the sea20x20cm SOLD","height":173});
															thumbnails[5444292] = clik.newPhoto({"id":5444292,"src":"wide_open1_thumb.JPG","galleries_id":80329,"server_id":1,"link":"photo_5444292.html","width":130,"caption":"wide open 40x100cm<br>\r\nSOLD","height":98});
															thumbnails[5559416] = clik.newPhoto({"id":5559416,"src":"jumping_for_joy_thumb.jpg","galleries_id":80329,"server_id":1,"link":"photo_5559416.html","width":130,"caption":"jump for joy 100x100cm<br>\r\nSOLD","height":173});
															thumbnails[5987831] = clik.newPhoto({"id":5987831,"src":"storytelling_thumb.jpg","galleries_id":53218,"server_id":1,"link":"photo_5987831.html","width":130,"caption":"storytelling<br>\r\n60x80cm SOLD","height":98});
															thumbnails[6388136] = clik.newPhoto({"id":6388136,"src":"see_you_thumb.jpg","galleries_id":194152,"server_id":1,"link":"photo_6388136.html","width":130,"caption":"see you 20x20cm SOLD","height":173});
															thumbnails[7028555] = clik.newPhoto({"id":7028555,"src":"ashore1_thumb.jpg","galleries_id":380537,"server_id":1,"link":"photo_7028555.html","width":130,"caption":"ashore<br>\r\n30x40cm","height":98});
															thumbnails[7028558] = clik.newPhoto({"id":7028558,"src":"autumn_splash1_thumb.jpg","galleries_id":465666,"server_id":1,"link":"photo_7028558.html","width":130,"caption":"autumn splash30x40cm £95","height":98});
															thumbnails[7028561] = clik.newPhoto({"id":7028561,"src":"blowing_bubbles1_thumb.jpg","galleries_id":380537,"server_id":1,"link":"photo_7028561.html","width":130,"caption":"blowing bubbles<br>\r\n30x40cm","height":98});
															thumbnails[7028562] = clik.newPhoto({"id":7028562,"src":"floating1_thumb.jpg","galleries_id":380537,"server_id":1,"link":"photo_7028562.html","width":130,"caption":"floating <br>\r\n30x40cm","height":98});
															thumbnails[7304526] = clik.newPhoto({"id":7304526,"src":"country_life_thumb.jpg","galleries_id":53088,"server_id":1,"link":"photo_7304526.html","width":130,"caption":"country life 40x50cm SOLD","height":98});
															thumbnails[7429389] = clik.newPhoto({"id":7429389,"src":"hello_thumb.JPG","galleries_id":194152,"server_id":1,"link":"photo_7429389.html","width":130,"caption":"hello SOLD","height":173});
															thumbnails[7540981] = clik.newPhoto({"id":7540981,"src":"crowded_beach_thumb.jpg","galleries_id":465666,"server_id":1,"link":"photo_7540981.html","width":130,"caption":"crowded harbour 50x65cm £360","height":98});
															thumbnails[7540983] = clik.newPhoto({"id":7540983,"src":"along_the_freway_thumb.jpg","galleries_id":465666,"server_id":1,"link":"photo_7540983.html","width":130,"caption":"along the freeway 40x30cm £220","height":173});
															thumbnails[7540995] = clik.newPhoto({"id":7540995,"src":"holding_hands_thumb.jpg","galleries_id":465666,"server_id":1,"link":"photo_7540995.html","width":130,"caption":"holding hands 40x50cm £300","height":98});
															thumbnails[7945450] = clik.newPhoto({"id":7945450,"src":"the_madness_of_love1.90x90cm_mix_media_sarah_stokes_thumb.jpg","galleries_id":53218,"server_id":1,"link":"photo_7945450.html","width":130,"caption":"the madness of love SOLD 90x90cm","height":173});
															thumbnails[7945478] = clik.newPhoto({"id":7945478,"src":"oyster_love_thumb.jpg","galleries_id":194152,"server_id":1,"link":"photo_7945478.html","width":130,"caption":"oyster love 20 x 20cm £65","height":173});
															thumbnails[8531726] = clik.newPhoto({"id":8531726,"src":"at_cross_purposes_thumb.jpg","galleries_id":194152,"server_id":1,"link":"photo_8531726.html","width":130,"caption":"at cross purposes 20x20cm","height":173});
															thumbnails[8531731] = clik.newPhoto({"id":8531731,"src":"having_a_chat_with_the_fishes_thumb.jpg","galleries_id":465666,"server_id":1,"link":"photo_8531731.html","width":130,"caption":"having a chat with the fishes 65x90cm £800","height":98});
															thumbnails[8531746] = clik.newPhoto({"id":8531746,"src":"someones_saying_something_thumb.jpg","galleries_id":465666,"server_id":1,"link":"photo_8531746.html","width":130,"caption":"someone's saying something 40x50cm £260","height":98});
															thumbnails[8531756] = clik.newPhoto({"id":8531756,"src":"seas_not_shore_thumb.jpg","galleries_id":194152,"server_id":1,"link":"photo_8531756.html","width":130,"caption":"sea not shore","height":173});
															thumbnails[8531773] = clik.newPhoto({"id":8531773,"src":"seaside_reflection_thumb.jpg","galleries_id":194152,"server_id":1,"link":"photo_8531773.html","width":130,"caption":"seaside reflection","height":173});
															thumbnails[8566150] = clik.newPhoto({"id":8566150,"src":"sun_over_glimmer_1_thumb.jpg","galleries_id":465666,"server_id":1,"link":"photo_8566150.html","width":130,"caption":"sun over glimmer 20 x 20 cm £125","height":98});
															thumbnails[8678298] = clik.newPhoto({"id":8678298,"src":"where_the_boats_dont_float_thumb.jpg","galleries_id":465666,"server_id":1,"link":"photo_8678298.html","width":130,"caption":"where the boats don't float 40x50cm £200 SOLD","height":98});
															thumbnails[8798726] = clik.newPhoto({"id":8798726,"src":"place_thumb.jpg","galleries_id":194152,"server_id":1,"link":"photo_8798726.html","width":130,"caption":"place 20x30cm","height":98});
															thumbnails[8798761] = clik.newPhoto({"id":8798761,"src":"walking_towards_tomorrow_thumb.jpg","galleries_id":465666,"server_id":1,"link":"photo_8798761.html","width":130,"caption":"walking towards tomorrow 30x40cm £200","height":98});
															thumbnails[8822964] = clik.newPhoto({"id":8822964,"src":"the_country_at_the_end_of_the_road_thumb.jpg","galleries_id":53088,"server_id":1,"link":"photo_8822964.html","width":130,"caption":"the country at the end of the road 50x50cm £400","height":98});
															thumbnails[8822989] = clik.newPhoto({"id":8822989,"src":"stellar_shore_thumb.jpg","galleries_id":465666,"server_id":1,"link":"photo_8822989.html","width":130,"caption":"stellar shore 60x40cm £400","height":173});
															thumbnails[8875630] = clik.newPhoto({"id":8875630,"src":"above_the_clouds_thumb.jpg","galleries_id":465666,"server_id":1,"link":"photo_8875630.html","width":130,"caption":"above the clouds 50 x 120cm £1200","height":98});
															thumbnails[8875633] = clik.newPhoto({"id":8875633,"src":"van_gogh_in_new_york_thumb.jpg","galleries_id":465666,"server_id":1,"link":"photo_8875633.html","width":130,"caption":"van gogh in new york 40 x 100cm £500","height":98});
															thumbnails[8875636] = clik.newPhoto({"id":8875636,"src":"swimming_in_a_field_of_flowers_thumb.jpg","galleries_id":465666,"server_id":1,"link":"photo_8875636.html","width":130,"caption":"swimming in a field of flowers 60 x 40 cm £400","height":173});
															thumbnails[8894413] = clik.newPhoto({"id":8894413,"src":"playing_in_the_sun_thumb.jpg","galleries_id":465666,"server_id":1,"link":"photo_8894413.html","width":130,"caption":"playing in the sun £560","height":173});
															thumbnails[8894416] = clik.newPhoto({"id":8894416,"src":"in_the_cove_thumb.jpg","galleries_id":465666,"server_id":1,"link":"photo_8894416.html","width":130,"caption":"in the cove 50 x 70 cm £300","height":98});
															thumbnails[8909462] = clik.newPhoto({"id":8909462,"src":"playtime_thumb.jpg","galleries_id":465666,"server_id":1,"link":"photo_8909462.html","width":130,"caption":"playtime 40 x 50cm £300","height":98});
															thumbnails[8909466] = clik.newPhoto({"id":8909466,"src":"rosemoon_thumb.jpg","galleries_id":465666,"server_id":1,"link":"photo_8909466.html","width":130,"caption":"Rose moon 40 x 50 cm £400 SOLD","height":98});
															thumbnails[8909479] = clik.newPhoto({"id":8909479,"src":"opening_the_door1_thumb.jpg","galleries_id":465666,"server_id":1,"link":"photo_8909479.html","width":130,"caption":"opening the door 50 x 40cm £360","height":173});
															thumbnails[8909483] = clik.newPhoto({"id":8909483,"src":"travelling_through_thumb.jpg","galleries_id":465666,"server_id":1,"link":"photo_8909483.html","width":130,"caption":"travelling through 40 x 30cm £260","height":173});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[53218] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"abstractive","link":"section78229_53218.html","maxRecords":0.0,"photoIDs":[3124390.0,4598354.0,5987831.0,7945450.0],"skipIndex":0,"section_code":"section78229","featured_images":"7945450,5987831,4598354,3124390","id":53218,"singleSection":false});				  						galleries[380537] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Art on acetate","link":"section78229_380537.html","maxRecords":0.0,"photoIDs":[7028555.0,7028561.0,7028562.0],"skipIndex":0,"section_code":"section78229","featured_images":"7028562,7028561,7028555","id":380537,"singleSection":false});				  						galleries[465666] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Favourites still for sale","link":"section78229_465666.html","maxRecords":0.0,"photoIDs":[1690888.0,2302540.0,4117118.0,7028558.0,7540981.0,7540983.0,7540995.0,8531731.0,8531746.0,8566150.0,8678298.0,8798761.0,8822989.0,8875630.0,8875633.0,8875636.0,8894413.0,8894416.0,8909462.0,8909466.0,8909479.0,8909483.0],"skipIndex":0,"section_code":"section78229","featured_images":"8909483,8909479,8909466,8909462,8894416,8894413,8875636,8875633,8875630,8822989","id":465666,"singleSection":false});				  						galleries[53216] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"floral","link":"section78229_53216.html","maxRecords":0.0,"photoIDs":[3124440.0],"skipIndex":0,"section_code":"section78229","featured_images":3124440.0,"id":53216,"singleSection":false});				  						galleries[53088] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"landscape","link":"section78229_53088.html","maxRecords":0.0,"photoIDs":[3395457.0,7304526.0,8822964.0],"skipIndex":0,"section_code":"section78229","featured_images":"8822964,7304526,3395457","id":53088,"singleSection":false});				  						galleries[80329] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"seascapes","link":"section78229_80329.html","maxRecords":0.0,"photoIDs":[1047336.0,1938146.0,3568804.0,3641622.0,3723927.0,4057474.0,4475812.0,4611717.0,5444292.0,5559416.0],"skipIndex":0,"section_code":"section78229","featured_images":"5559416,5444292,4611717,4475812,4057474,3723927,3641622,3568804,1938146,1047336","id":80329,"singleSection":false});				  						galleries[194152] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"small gallery","link":"section78229_194152.html","maxRecords":0.0,"photoIDs":[3124495.0,3183613.0,3388751.0,3613126.0,3641633.0,3700682.0,4475848.0,5085292.0,5085319.0,6388136.0,7429389.0,7945478.0,8531726.0,8531756.0,8531773.0,8798726.0],"skipIndex":0,"section_code":"section78229","featured_images":"8798726,8531773,8531756,8531726,7945478,7429389,6388136,5085319,5085292,4475848","id":194152,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '8894413';
imageSets[3] = '8909483,8909479,8909466,8909462,8894416,8894413,8875636,8875633,8875630,8822989,8822964,8798761,8798726,8678298,8566150,8531773,8531756,8531746,8531731,8531726,7945478,7945450,7540995,7540983,7540981,7429389,7304526,7028562,7028561,7028558,7028555,6388136,5987831,5559416,5444292,5085319,5085292,4611717,4598354,4475848,4475812,4117118,4057474,3723927,3700682,3641633,3641622,3613126,3568804,3395457';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/sarahstokes/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/sarahstokes/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/sarahstokes/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/sarahstokes/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/sarahstokes/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/sarahstokes/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/sarahstokes/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/sarahstokes/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/sarahstokes/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/sarahstokes/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/sarahstokes/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/sarahstokes/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/sarahstokes/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/sarahstokes/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/sarahstokes/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/sarahstokes/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/sarahstokes/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/sarahstokes/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/sarahstokes/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/sarahstokes/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/sarahstokes/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/sarahstokes/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/sarahstokes/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/sarahstokes/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/sarahstokes/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/sarahstokes/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/sarahstokes/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 += 'section78229.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 && 'section78229' != '') {
					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 = 'sarahstokesart: ' + 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.item_price !== '') {
											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="SARAHSTOKES">';
			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;
	}
}

			

