window.thumbnails = {};
															thumbnails[5980100] = clik.newPhoto({"id":5980100,"src":"atmosphere_and_mood_thumb.jpg","galleries_id":337133,"server_id":5,"link":"photo_5980100.html","width":130,"caption":"\"Atmosphere and mood\"  oil  143cm x 111cm  £2250","height":98});
															thumbnails[5989341] = clik.newPhoto({"id":5989341,"src":"coastal_light_3_thumb.jpg","galleries_id":337133,"server_id":5,"link":"photo_5989341.html","width":130,"caption":"\"Coastal light 3\"  oil  30cm x 30cm  (overall framed size 50cm x 50cm)  £400 ","height":131});
															thumbnails[5989463] = clik.newPhoto({"id":5989463,"src":"coastal_light_4_thumb.jpg","galleries_id":337133,"server_id":5,"link":"photo_5989463.html","width":130,"caption":"\"Coastal light 4\"  oil  30cm x 30cm  (overall framed size 50cm x 50cm)  £400 ","height":127});
															thumbnails[5989481] = clik.newPhoto({"id":5989481,"src":"atmosphere_and_light__thumb.jpg","galleries_id":337133,"server_id":5,"link":"photo_5989481.html","width":130,"caption":"\"Atmosphere and light 7\"  oil  30cm x 30cm  (overall framed size 50cm x 50cm)  £400 ","height":131});
															thumbnails[5989491] = clik.newPhoto({"id":5989491,"src":"Suffolk_light_thumb.jpg","galleries_id":337133,"server_id":5,"link":"photo_5989491.html","width":130,"caption":"\"Suffolk skies\"  oil  30cm x 30cm  SOLD","height":125});
															thumbnails[5994944] = clik.newPhoto({"id":5994944,"src":"031_thumb.jpg","galleries_id":337133,"server_id":5,"link":"photo_5994944.html","width":130,"caption":"","height":125});
															thumbnails[5994992] = clik.newPhoto({"id":5994992,"src":"coastal_light_8_thumb.jpg","galleries_id":337133,"server_id":5,"link":"photo_5994992.html","width":130,"caption":"","height":121});
															thumbnails[5995050] = clik.newPhoto({"id":5995050,"src":"atmosphere_and_light_17_30cm_x_30cm_thumb.jpg","galleries_id":337133,"server_id":5,"link":"photo_5995050.html","width":130,"caption":"","height":132});
															thumbnails[5995077] = clik.newPhoto({"id":5995077,"src":"038_thumb.jpg","galleries_id":337133,"server_id":5,"link":"photo_5995077.html","width":130,"caption":"","height":131});
															thumbnails[5995091] = clik.newPhoto({"id":5995091,"src":"atmosphere_and_light_thumb.jpg","galleries_id":337133,"server_id":5,"link":"photo_5995091.html","width":130,"caption":"","height":130});
															thumbnails[5995097] = clik.newPhoto({"id":5995097,"src":"across_the_lake_thumb.jpg","galleries_id":337133,"server_id":5,"link":"photo_5995097.html","width":130,"caption":"\"Over the lake\"  oil  100cm x 100cm  £1200-00  SOLD","height":130});
															thumbnails[5995105] = clik.newPhoto({"id":5995105,"src":"solitude_90cm_x_60cm_thumb.jpg","galleries_id":337133,"server_id":5,"link":"photo_5995105.html","width":130,"caption":"","height":86});
															thumbnails[5995108] = clik.newPhoto({"id":5995108,"src":"solitude_no2_60cmx60cm_thumb.jpg","galleries_id":337133,"server_id":5,"link":"photo_5995108.html","width":130,"caption":"\"Solitude\"  oil  50cm x 50cm  SOLD","height":130});
															thumbnails[5995116] = clik.newPhoto({"id":5995116,"src":"5_thumb.jpg","galleries_id":337133,"server_id":5,"link":"photo_5995116.html","width":130,"caption":"","height":130});
															thumbnails[5995136] = clik.newPhoto({"id":5995136,"src":"Towards_the_horizon_50cmx50cm_thumb.jpg","galleries_id":337133,"server_id":5,"link":"photo_5995136.html","width":130,"caption":"","height":130});
															thumbnails[5995145] = clik.newPhoto({"id":5995145,"src":"a_and_l_thumb.jpg","galleries_id":337133,"server_id":5,"link":"photo_5995145.html","width":130,"caption":"\"Atmosphere and light 3\"  oil  30cm x 30cm  (overall framed size 50cm x 50cm)  £400 ","height":130});
															thumbnails[6044835] = clik.newPhoto({"id":6044835,"src":"coastal_light_10_thumb.jpg","galleries_id":337133,"server_id":5,"link":"photo_6044835.html","width":130,"caption":"","height":130});
															thumbnails[6044848] = clik.newPhoto({"id":6044848,"src":"coastal_light_11_thumb.jpg","galleries_id":337133,"server_id":5,"link":"photo_6044848.html","width":130,"caption":"","height":130});
															thumbnails[6044850] = clik.newPhoto({"id":6044850,"src":"coastal_light_6_thumb.jpg","galleries_id":337133,"server_id":5,"link":"photo_6044850.html","width":130,"caption":"\"Coastal light 2\"  oil  30cm x 30cm  (overall framed size 50cm x 50cm)  £400 ","height":130});
															thumbnails[6044851] = clik.newPhoto({"id":6044851,"src":"open_space__thumb.jpg","galleries_id":337133,"server_id":5,"link":"photo_6044851.html","width":130,"caption":"","height":130});
															thumbnails[6050075] = clik.newPhoto({"id":6050075,"src":"dancing_shadows_thumb.jpg","galleries_id":337133,"server_id":5,"link":"photo_6050075.html","width":130,"caption":"","height":98});
															thumbnails[6050076] = clik.newPhoto({"id":6050076,"src":"lakeland_light_thumb.jpg","galleries_id":337133,"server_id":5,"link":"photo_6050076.html","width":130,"caption":"","height":130});
															thumbnails[6050077] = clik.newPhoto({"id":6050077,"src":"004_thumb.jpg","galleries_id":337133,"server_id":5,"link":"photo_6050077.html","width":130,"caption":"","height":130});
															thumbnails[6050078] = clik.newPhoto({"id":6050078,"src":"beach_and_cloud_thumb.jpg","galleries_id":337133,"server_id":5,"link":"photo_6050078.html","width":130,"caption":"","height":130});
															thumbnails[6125161] = clik.newPhoto({"id":6125161,"src":"coastal_light_5_thumb.jpg","galleries_id":337133,"server_id":5,"link":"photo_6125161.html","width":130,"caption":"\"Coastal light 1\"  oil  30cm x 30cm  (overall framed size 50cm x 50cm)  £400 ","height":130});
															thumbnails[6584646] = clik.newPhoto({"id":6584646,"src":"over_the_marshes_owards_the_setting_sun_100x100cm_thumb.jpg","galleries_id":337133,"server_id":5,"link":"photo_6584646.html","width":130,"caption":"\"over the marshes towards the setting sun\"  100cm x 100cm   £1750-00   SOLD","height":113});
															thumbnails[6584716] = clik.newPhoto({"id":6584716,"src":"A-AND-L-NO2_thumb.jpg","galleries_id":337133,"server_id":5,"link":"photo_6584716.html","width":130,"caption":"","height":130});
															thumbnails[6584719] = clik.newPhoto({"id":6584719,"src":"A-AND-L-NO-3_thumb.jpg","galleries_id":337133,"server_id":5,"link":"photo_6584719.html","width":130,"caption":"","height":130});
															thumbnails[6780435] = clik.newPhoto({"id":6780435,"src":"oriental_thumb.jpg","galleries_id":337132,"server_id":5,"link":"photo_6780435.html","width":130,"caption":"","height":176});
															thumbnails[6392798] = clik.newPhoto({"id":6392798,"src":"nigel_kennedy_thumb.jpg","galleries_id":337132,"server_id":5,"link":"photo_6392798.html","width":130,"caption":"","height":195});
															thumbnails[5989580] = clik.newPhoto({"id":5989580,"src":"IMG_2518_thumb.jpg","galleries_id":337132,"server_id":5,"link":"photo_5989580.html","width":130,"caption":"","height":184});
															thumbnails[8500195] = clik.newPhoto({"id":8500195,"src":"IMG_5670_thumb.JPG","galleries_id":337132,"server_id":5,"link":"photo_8500195.html","width":130,"caption":"","height":192});
															thumbnails[5989229] = clik.newPhoto({"id":5989229,"src":"Simon_thumb.jpg","galleries_id":337132,"server_id":5,"link":"photo_5989229.html","width":130,"caption":"","height":134});
															thumbnails[6780438] = clik.newPhoto({"id":6780438,"src":"IMG_6866_thumb.JPG","galleries_id":337132,"server_id":5,"link":"photo_6780438.html","width":130,"caption":"","height":163});
															thumbnails[6786926] = clik.newPhoto({"id":6786926,"src":"Copy_of_IMG_2501_thumb.JPG","galleries_id":337132,"server_id":5,"link":"photo_6786926.html","width":130,"caption":"","height":155});
															thumbnails[5989213] = clik.newPhoto({"id":5989213,"src":"IMG_2498_thumb.JPG","galleries_id":337132,"server_id":5,"link":"photo_5989213.html","width":130,"caption":"","height":147});
															thumbnails[6783569] = clik.newPhoto({"id":6783569,"src":"IMG_48241_thumb.JPG","galleries_id":337132,"server_id":5,"link":"photo_6783569.html","width":130,"caption":"","height":179});
															thumbnails[6783572] = clik.newPhoto({"id":6783572,"src":"cycling2_thumb.jpg","galleries_id":337132,"server_id":5,"link":"photo_6783572.html","width":130,"caption":"","height":195});
															thumbnails[5989211] = clik.newPhoto({"id":5989211,"src":"Lily_thumb.jpg","galleries_id":337132,"server_id":5,"link":"photo_5989211.html","width":130,"caption":"","height":180});
															thumbnails[5989260] = clik.newPhoto({"id":5989260,"src":"poalo_nutini_thumb.JPG","galleries_id":337132,"server_id":5,"link":"photo_5989260.html","width":130,"caption":"","height":180});
															thumbnails[5989252] = clik.newPhoto({"id":5989252,"src":"paloma_faith1_thumb.JPG","galleries_id":337132,"server_id":5,"link":"photo_5989252.html","width":130,"caption":"","height":132});
															thumbnails[5989686] = clik.newPhoto({"id":5989686,"src":"radishes_thumb.jpg","galleries_id":337132,"server_id":5,"link":"photo_5989686.html","width":130,"caption":"","height":164});
															thumbnails[6786828] = clik.newPhoto({"id":6786828,"src":"IMG_4689_thumb.jpg","galleries_id":337132,"server_id":5,"link":"photo_6786828.html","width":130,"caption":"","height":148});
															thumbnails[5989276] = clik.newPhoto({"id":5989276,"src":"lizzy_thumb.jpg","galleries_id":337132,"server_id":5,"link":"photo_5989276.html","width":130,"caption":"","height":173});
															thumbnails[6802327] = clik.newPhoto({"id":6802327,"src":"IMG_9109_thumb.JPG","galleries_id":337132,"server_id":5,"link":"photo_6802327.html","width":130,"caption":"","height":187});
															thumbnails[5989688] = clik.newPhoto({"id":5989688,"src":"OMD_thumb.JPG","galleries_id":337132,"server_id":5,"link":"photo_5989688.html","width":130,"caption":"","height":197});
															thumbnails[5991904] = clik.newPhoto({"id":5991904,"src":"selfportrait_thumb.jpg","galleries_id":337132,"server_id":5,"link":"photo_5991904.html","width":130,"caption":"","height":189});
															thumbnails[5994532] = clik.newPhoto({"id":5994532,"src":"guitar_thumb.JPG","galleries_id":337132,"server_id":5,"link":"photo_5994532.html","width":130,"caption":"","height":180});
															thumbnails[5994529] = clik.newPhoto({"id":5994529,"src":"2011_leeds_robmarrison_thekills_thumb.JPG","galleries_id":337132,"server_id":5,"link":"photo_5994529.html","width":130,"caption":"","height":193});
															thumbnails[5994548] = clik.newPhoto({"id":5994548,"src":"poalo_nutini_2_thumb.JPG","galleries_id":337132,"server_id":5,"link":"photo_5994548.html","width":130,"caption":"","height":193});
															thumbnails[5989208] = clik.newPhoto({"id":5989208,"src":"Foals_thumb.JPG","galleries_id":337132,"server_id":5,"link":"photo_5989208.html","width":130,"caption":"","height":195});
															thumbnails[6159383] = clik.newPhoto({"id":6159383,"src":"kele_thumb.JPG","galleries_id":337132,"server_id":5,"link":"photo_6159383.html","width":130,"caption":"","height":181});
															thumbnails[8498446] = clik.newPhoto({"id":8498446,"src":"IMG_6543_thumb.JPG","galleries_id":337132,"server_id":5,"link":"photo_8498446.html","width":130,"caption":"","height":181});
															thumbnails[5997491] = clik.newPhoto({"id":5997491,"src":"lottie_thumb.jpg","galleries_id":337132,"server_id":5,"link":"photo_5997491.html","width":130,"caption":"","height":173});
															thumbnails[5994650] = clik.newPhoto({"id":5994650,"src":"IMG_7297_thumb.JPG","galleries_id":337132,"server_id":5,"link":"photo_5994650.html","width":130,"caption":"","height":195});
															thumbnails[8498420] = clik.newPhoto({"id":8498420,"src":"2011_leeds_robmarrison_crowd34_thumb.JPG","galleries_id":337132,"server_id":5,"link":"photo_8498420.html","width":130,"caption":"","height":185});
															thumbnails[6159381] = clik.newPhoto({"id":6159381,"src":"anna_calvi_thumb.JPG","galleries_id":337132,"server_id":5,"link":"photo_6159381.html","width":130,"caption":"","height":129});
															thumbnails[7314011] = clik.newPhoto({"id":7314011,"src":"IMG_3314_thumb.JPG","galleries_id":337132,"server_id":5,"link":"photo_7314011.html","width":130,"caption":"","height":130});
															thumbnails[5989199] = clik.newPhoto({"id":5989199,"src":"a_bit_of_old_rope_16_thumb.jpg","galleries_id":337132,"server_id":5,"link":"photo_5989199.html","width":130,"caption":"","height":141});
															thumbnails[6856721] = clik.newPhoto({"id":6856721,"src":"wave8_thumb.jpg","galleries_id":337132,"server_id":5,"link":"photo_6856721.html","width":130,"caption":"","height":137});
															thumbnails[5989638] = clik.newPhoto({"id":5989638,"src":"IMG_2952_thumb.JPG","galleries_id":337132,"server_id":5,"link":"photo_5989638.html","width":130,"caption":"","height":175});
															thumbnails[5994525] = clik.newPhoto({"id":5994525,"src":"IMG_2079_thumb.jpg","galleries_id":337132,"server_id":5,"link":"photo_5994525.html","width":130,"caption":"","height":127});
															thumbnails[5994673] = clik.newPhoto({"id":5994673,"src":"paolo_nutini_2_thumb.JPG","galleries_id":337132,"server_id":5,"link":"photo_5994673.html","width":130,"caption":"","height":185});
															thumbnails[6400205] = clik.newPhoto({"id":6400205,"src":"IMG_9336_thumb.JPG","galleries_id":337132,"server_id":5,"link":"photo_6400205.html","width":130,"caption":"","height":152});
															thumbnails[6949403] = clik.newPhoto({"id":6949403,"src":"monkey_hat_clickpic_thumb.jpg","galleries_id":337132,"server_id":5,"link":"photo_6949403.html","width":130,"caption":"","height":82});
															thumbnails[5989647] = clik.newPhoto({"id":5989647,"src":"kiss_B0852618-1D09-001F-99D7B969699191BE_thumb.jpg","galleries_id":337132,"server_id":5,"link":"photo_5989647.html","width":130,"caption":"","height":109});
															thumbnails[7277635] = clik.newPhoto({"id":7277635,"src":"IMG_9147_6DBD8FE3-1EC9-DFB6-096E19DB7B2120E6_thumb.JPG","galleries_id":337132,"server_id":5,"link":"photo_7277635.html","width":130,"caption":"","height":81});
															thumbnails[5989615] = clik.newPhoto({"id":5989615,"src":"IMG_1906_thumb.jpg","galleries_id":337132,"server_id":5,"link":"photo_5989615.html","width":130,"caption":"","height":109});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[337133] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"paintings","link":"section403624.html","maxRecords":0.0,"photoIDs":[5980100.0,5989341.0,5989463.0,5989481.0,5989491.0,5994944.0,5994992.0,5995050.0,5995077.0,5995091.0,5995097.0,5995105.0,5995108.0,5995116.0,5995136.0,5995145.0,6044835.0,6044848.0,6044850.0,6044851.0,6050075.0,6050076.0,6050077.0,6050078.0,6125161.0,6584646.0,6584716.0,6584719.0],"skipIndex":0,"section_code":"section403624","featured_images":"6584719,6584716,6584646,6125161,6050078,6050077,6050076,6050075,6044851,6044850,6044848,6044835,5995145,5995136,5995116,5995108,5995105,5995097,5995091,5995077,5995050,5994992,5994944,5989491,5989481,5989463,5989341,5980100","id":337133,"singleSection":true});				  						galleries[337132] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"photography","link":"section403623.html","maxRecords":0.0,"photoIDs":[6780435.0,6392798.0,5989580.0,8500195.0,5989229.0,6780438.0,6786926.0,5989213.0,6783569.0,6783572.0,5989211.0,5989260.0,5989252.0,5989686.0,6786828.0,5989276.0,6802327.0,5989688.0,5991904.0,5994532.0,5994529.0,5994548.0,5989208.0,6159383.0,8498446.0,5997491.0,5994650.0,8498420.0,6159381.0,7314011.0,5989199.0,6856721.0,5989638.0,5994525.0,5994673.0,6400205.0,6949403.0,5989647.0,7277635.0,5989615.0],"skipIndex":0,"section_code":"section403623","featured_images":"8498446,8498420,7314011,7277635,6949403,6856721,6802327,6786926,6786828,6783572,6783569,6780438,6780435,6400205,6392798,6159383,6159381,5997491,5994673,5994650,5994532,5994525,5991904,5989688,5989686,5989647,5989638,5989615,5989580,5989276,5989260,5989252,5989229,5989213,5989211,5989208,5989199","id":337132,"singleSection":true});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '7314011,6802327,6780435,6584716,6584646,6400205,6392798,6125161,5995097,5994992,5989615,5989580,5989491,5989481,5989341,5989260,5989252,5989213,5989211,5989208,5989199,5980100';
imageSets[2] = '8498446,8498420,7314011,7277635,6949403,6856721,6802327,6786926,6786828,6783572,6783569,6780438,6780435,6584719,6584716,6584646,6400205,6392798,6159383,6159381,6125161,6050078,6050077,6050076,6050075,6044851,6044850,6044848,6044835,5997491,5995145,5995136,5995116,5995108,5995105,5995097,5995091,5995077,5995050,5994992,5994944,5994673,5994650,5994532,5994525,5991904,5989688,5989686,5989647,5989638,5989615,5989580,5989491,5989481,5989463,5989341,5989276,5989260,5989252,5989229,5989213,5989211,5989208,5989199,5980100';
imageSets[3] = '8500195,8498446,8498420,7314011,7277635,6949403,6856721,6802327,6786926,6786828,6783572,6783569,6780438,6780435,6584719,6584716,6584646,6400205,6392798,6159383,6159381,6125161,6050078,6050077,6050076,6050075,6044851,6044850,6044848,6044835,5997491,5995145,5995136,5995116,5995108,5995105,5995097,5995091,5995077,5995050,5994992,5994944,5994673,5994650,5994548,5994532,5994529,5994525,5991904,5989688';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'www12.clikpic.com/robmarrison/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/robmarrison/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/robmarrison/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/robmarrison/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/robmarrison/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/robmarrison/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/robmarrison/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/robmarrison/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/robmarrison/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/robmarrison/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/robmarrison/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/robmarrison/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/robmarrison/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/robmarrison/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/robmarrison/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/robmarrison/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/robmarrison/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/robmarrison/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/robmarrison/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/robmarrison/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/robmarrison/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/robmarrison/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/robmarrison/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/robmarrison/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 += 'section403624.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 && 'section403624' != '') {
					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 = 'Rob Marrison : ' + 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;
	}
}

			

