window.thumbnails = {};
															thumbnails[2313427] = clik.newPhoto({"id":2313427,"src":"img003079_thumb.gif","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"* A summers day on the beach of a Devon resort.","height":103});
															thumbnails[2313362] = clik.newPhoto({"id":2313362,"src":"SNV80340 copy_thumb.gif","galleries_id":154419,"server_id":32,"link":"photo_2313362.html","width":130,"caption":"Bailey rests in the kitchen.","height":98});
															thumbnails[2313426] = clik.newPhoto({"id":2313426,"src":"img003147 copy_thumb.gif","galleries_id":151379,"server_id":32,"link":"photo_2313426.html","width":130,"caption":"Plymouth Hoe, backlit.","height":82});
															thumbnails[2313439] = clik.newPhoto({"id":2313439,"src":"img003207 copy_thumb.gif","galleries_id":151242,"server_id":32,"link":"photo_2313439.html","width":130,"caption":"* The Belvedere castle on Haldon Hill glows in the setting sun.","height":101});
															thumbnails[2313440] = clik.newPhoto({"id":2313440,"src":"img003157 copy_thumb.gif","galleries_id":151244,"server_id":32,"link":"photo_2313440.html","width":130,"caption":"* Blue boats on the beach.","height":101});
															thumbnails[2313446] = clik.newPhoto({"id":2313446,"src":"img003077_thumb.gif","galleries_id":151242,"server_id":32,"link":"photo_2313446.html","width":130,"caption":"* A window of flowers.","height":106});
															thumbnails[2313448] = clik.newPhoto({"id":2313448,"src":"img003038carjaggrey_thumb.gif","galleries_id":151231,"server_id":32,"link":"photo_2313448.html","width":130,"caption":"Green car, grey sky.","height":79});
															thumbnails[2313454] = clik.newPhoto({"id":2313454,"src":"CNV00014_thumb.gif","galleries_id":151240,"server_id":32,"link":"photo_2313454.html","width":130,"caption":"A bear washing.","height":87});
															thumbnails[2313464] = clik.newPhoto({"id":2313464,"src":"img0030341_thumb.gif","galleries_id":151240,"server_id":32,"link":"photo_2313464.html","width":130,"caption":"A family of baboons, Paignton Zoo.","height":87});
															thumbnails[2315798] = clik.newPhoto({"id":2315798,"src":"CNV00001_thumb.gif","galleries_id":151231,"server_id":32,"link":"photo_2315798.html","width":130,"caption":"Beauty in shape and form.","height":194});
															thumbnails[2315799] = clik.newPhoto({"id":2315799,"src":"img003036_thumb.gif","galleries_id":151231,"server_id":32,"link":"photo_2315799.html","width":130,"caption":"The jaguar pounces.","height":83});
															thumbnails[2315802] = clik.newPhoto({"id":2315802,"src":"img003204 copy_thumb.gif","galleries_id":154432,"server_id":32,"link":"photo_2315802.html","width":130,"caption":"* Paris, gargoyle.","height":103});
															thumbnails[2315809] = clik.newPhoto({"id":2315809,"src":"img003119_thumb.gif","galleries_id":151242,"server_id":32,"link":"photo_2315809.html","width":130,"caption":"* Exmouth harbour buildings, built on a concrete rock.","height":103});
															thumbnails[2315813] = clik.newPhoto({"id":2315813,"src":"img003155 copy_thumb.gif","galleries_id":154432,"server_id":32,"link":"photo_2315813.html","width":130,"caption":"* Statues in St Mark's square, Venice.","height":164});
															thumbnails[2315817] = clik.newPhoto({"id":2315817,"src":"img003125_thumb.gif","galleries_id":154432,"server_id":32,"link":"photo_2315817.html","width":130,"caption":"* Brussel's skyline at sunset.","height":118});
															thumbnails[2315819] = clik.newPhoto({"id":2315819,"src":"img003121_thumb.gif","galleries_id":154432,"server_id":32,"link":"photo_2315819.html","width":130,"caption":"* A building with the sky showing, Spain.","height":104});
															thumbnails[2315845] = clik.newPhoto({"id":2315845,"src":"img003143 copy_thumb.gif","galleries_id":151240,"server_id":32,"link":"photo_2315845.html","width":130,"caption":"Swan at sunset.","height":89});
															thumbnails[2315885] = clik.newPhoto({"id":2315885,"src":"img003112_thumb.gif","galleries_id":151242,"server_id":32,"link":"photo_2315885.html","width":130,"caption":"* The early morning sun gives texture to a Topsham, dutch style, house.","height":170});
															thumbnails[2315887] = clik.newPhoto({"id":2315887,"src":"img003205 copy_thumb.gif","galleries_id":152911,"server_id":32,"link":"photo_2315887.html","width":130,"caption":"* Telecom tower on its launch pad.","height":164});
															thumbnails[2316005] = clik.newPhoto({"id":2316005,"src":"img003116_thumb.gif","galleries_id":151244,"server_id":32,"link":"photo_2316005.html","width":130,"caption":"* A sunny day, beached boats and a parasol.","height":103});
															thumbnails[2316012] = clik.newPhoto({"id":2316012,"src":"img003212 copy_thumb.gif","galleries_id":151242,"server_id":32,"link":"photo_2316012.html","width":130,"caption":"* Clifton suspension bridge.","height":101});
															thumbnails[2316024] = clik.newPhoto({"id":2316024,"src":"img003141 copy_thumb.gif","galleries_id":151244,"server_id":32,"link":"photo_2316024.html","width":130,"caption":"Fishing boats, Budleigh Salterton.","height":80});
															thumbnails[2316033] = clik.newPhoto({"id":2316033,"src":"img003154 copy_thumb.gif","galleries_id":151240,"server_id":32,"link":"photo_2316033.html","width":130,"caption":"A tiger fishing.","height":83});
															thumbnails[2316097] = clik.newPhoto({"id":2316097,"src":"img003202 copy_thumb.gif","galleries_id":154432,"server_id":32,"link":"photo_2316097.html","width":130,"caption":"* Gladiators at Verona.","height":103});
															thumbnails[2316151] = clik.newPhoto({"id":2316151,"src":"img003078_thumb.gif","galleries_id":151244,"server_id":32,"link":"photo_2316151.html","width":130,"caption":"* Still boats on still water, the Exe estuary.","height":104});
															thumbnails[2316157] = clik.newPhoto({"id":2316157,"src":"img003158 copy_thumb.gif","galleries_id":151242,"server_id":32,"link":"photo_2316157.html","width":130,"caption":"* Powderham folly.","height":162});
															thumbnails[2316160] = clik.newPhoto({"id":2316160,"src":"img0031201_thumb.gif","galleries_id":151379,"server_id":32,"link":"photo_2316160.html","width":130,"caption":"* The beautiful Exe estuary at sunrise.","height":106});
															thumbnails[2316162] = clik.newPhoto({"id":2316162,"src":"img003113_thumb.gif","galleries_id":151379,"server_id":32,"link":"photo_2316162.html","width":130,"caption":"* Still water at sunset, Topsham.","height":105});
															thumbnails[2316253] = clik.newPhoto({"id":2316253,"src":"SNV80311 copy_thumb.gif","galleries_id":154419,"server_id":32,"link":"photo_2316253.html","width":130,"caption":"Vision takes a look outside.","height":173});
															thumbnails[2316256] = clik.newPhoto({"id":2316256,"src":"img003206 copy_thumb.gif","galleries_id":152911,"server_id":32,"link":"photo_2316256.html","width":130,"caption":"* Houses of Parliament.","height":103});
															thumbnails[2316261] = clik.newPhoto({"id":2316261,"src":"img003009_thumb.gif","galleries_id":151242,"server_id":32,"link":"photo_2316261.html","width":130,"caption":"The beautiful city of Exeter in the autumn.","height":191});
															thumbnails[2316262] = clik.newPhoto({"id":2316262,"src":"img003020_thumb.gif","galleries_id":151240,"server_id":32,"link":"photo_2316262.html","width":130,"caption":"Beauty in form, a killing machine.","height":87});
															thumbnails[2316270] = clik.newPhoto({"id":2316270,"src":"CNV00006_thumb.gif","galleries_id":151231,"server_id":32,"link":"photo_2316270.html","width":130,"caption":"A TVR parked amongst the boats.","height":87});
															thumbnails[2327104] = clik.newPhoto({"id":2327104,"src":"img003153 copy_thumb.gif","galleries_id":151231,"server_id":32,"link":"photo_2327104.html","width":130,"caption":"A minor reflection.","height":83});
															thumbnails[2327108] = clik.newPhoto({"id":2327108,"src":"img003208 copy_thumb.gif","galleries_id":152911,"server_id":32,"link":"photo_2327108.html","width":130,"caption":"London reflections.","height":101});
															thumbnails[2327114] = clik.newPhoto({"id":2327114,"src":"img003089_thumb.gif","galleries_id":151379,"server_id":32,"link":"photo_2327114.html","width":130,"caption":"* Storm over Exmouth.","height":100});
															thumbnails[2327137] = clik.newPhoto({"id":2327137,"src":"img003118_thumb.gif","galleries_id":151242,"server_id":32,"link":"photo_2327137.html","width":130,"caption":"* Cardiff reflection.","height":103});
															thumbnails[2327142] = clik.newPhoto({"id":2327142,"src":"img003114_thumb.gif","galleries_id":151242,"server_id":32,"link":"photo_2327142.html","width":130,"caption":"* @ Bristol.","height":103});
															thumbnails[2327150] = clik.newPhoto({"id":2327150,"src":"img003026_thumb.gif","galleries_id":151242,"server_id":32,"link":"photo_2327150.html","width":130,"caption":"* Cardiff building, old in new.","height":103});
															thumbnails[2327210] = clik.newPhoto({"id":2327210,"src":"img003215 copy_thumb.gif","galleries_id":151379,"server_id":32,"link":"photo_2327210.html","width":130,"caption":"Exmouth beach as the sun goes down.","height":103});
															thumbnails[2327213] = clik.newPhoto({"id":2327213,"src":"img003200 copy1_thumb.gif","galleries_id":152911,"server_id":32,"link":"photo_2327213.html","width":130,"caption":"Trafalgar square storm.","height":101});
															thumbnails[2327466] = clik.newPhoto({"id":2327466,"src":"img003070_thumb.gif","galleries_id":151836,"server_id":32,"link":"photo_2327466.html","width":130,"caption":"Holly is ready for her prom.","height":157});
															thumbnails[2327540] = clik.newPhoto({"id":2327540,"src":"DSC00209c_thumb.gif","galleries_id":151836,"server_id":32,"link":"photo_2327540.html","width":130,"caption":"Following the bride.","height":193});
															thumbnails[2332337] = clik.newPhoto({"id":2332337,"src":"img003213 copy_thumb.gif","galleries_id":151379,"server_id":32,"link":"photo_2332337.html","width":130,"caption":"On the way to the Turf hotel, Exe estuary.","height":102});
															thumbnails[2332341] = clik.newPhoto({"id":2332341,"src":"img003156 copy_thumb.gif","galleries_id":151242,"server_id":32,"link":"photo_2332341.html","width":130,"caption":"* Blue barn, blue sky.","height":104});
															thumbnails[2332356] = clik.newPhoto({"id":2332356,"src":"img003085_thumb.gif","galleries_id":151379,"server_id":32,"link":"photo_2332356.html","width":130,"caption":"* The flags of Plymouth's Hoe. ","height":105});
															thumbnails[2332368] = clik.newPhoto({"id":2332368,"src":"img003117_thumb.gif","galleries_id":154432,"server_id":32,"link":"photo_2332368.html","width":130,"caption":"* Granada through railings.","height":108});
															thumbnails[2332397] = clik.newPhoto({"id":2332397,"src":"img003152 copy_thumb.gif","galleries_id":151240,"server_id":32,"link":"photo_2332397.html","width":130,"caption":"Ouch!","height":83});
															thumbnails[2332461] = clik.newPhoto({"id":2332461,"src":"CNV00005_thumb.gif","galleries_id":151231,"server_id":32,"link":"photo_2332461.html","width":130,"caption":"Yellow truck on the road.","height":194});
															thumbnails[2332464] = clik.newPhoto({"id":2332464,"src":"DSC00172e_thumb.gif","galleries_id":151836,"server_id":32,"link":"photo_2332464.html","width":130,"caption":"Entering the church.","height":113});
															thumbnails[2332468] = clik.newPhoto({"id":2332468,"src":"img003159_thumb.jpg","galleries_id":154432,"server_id":32,"link":"photo_2332468.html","width":130,"caption":"* Cat at the Guigelheim museum.","height":103});
															thumbnails[2332471] = clik.newPhoto({"id":2332471,"src":"img003123_thumb.gif","galleries_id":154432,"server_id":32,"link":"photo_2332471.html","width":130,"caption":"* Bruges splendour.","height":197});
															thumbnails[2337260] = clik.newPhoto({"id":2337260,"src":"img003201 copy_thumb.gif","galleries_id":154432,"server_id":32,"link":"photo_2337260.html","width":130,"caption":"* Venice lamp and building.","height":103});
															thumbnails[2337262] = clik.newPhoto({"id":2337262,"src":"img003024devdartchurchautum_thumb.gif","galleries_id":151379,"server_id":32,"link":"photo_2337262.html","width":130,"caption":"Autumn at Dartington.","height":87});
															thumbnails[2337275] = clik.newPhoto({"id":2337275,"src":"imgbuildlonghouse1crop_thumb.gif","galleries_id":151242,"server_id":32,"link":"photo_2337275.html","width":130,"caption":"* Longleat, reflected glory.","height":121});
															thumbnails[2337276] = clik.newPhoto({"id":2337276,"src":"img003054_thumb.gif","galleries_id":151242,"server_id":32,"link":"photo_2337276.html","width":130,"caption":"* @ Bristol in the sunshine.","height":101});
															thumbnails[2337279] = clik.newPhoto({"id":2337279,"src":"img003214 copy_thumb.gif","galleries_id":151379,"server_id":32,"link":"photo_2337279.html","width":130,"caption":"* North Devon water spout.","height":104});
															thumbnails[2337284] = clik.newPhoto({"id":2337284,"src":"img003203 copy_thumb.gif","galleries_id":154432,"server_id":32,"link":"photo_2337284.html","width":130,"caption":"* Old building reflected in new, Prague.","height":103});
															thumbnails[2337365] = clik.newPhoto({"id":2337365,"src":"img003144 copy_thumb.gif","galleries_id":151240,"server_id":32,"link":"photo_2337365.html","width":130,"caption":"King of the beasts.","height":82});
															thumbnails[2337372] = clik.newPhoto({"id":2337372,"src":"img003142 copy_thumb.gif","galleries_id":151240,"server_id":32,"link":"photo_2337372.html","width":130,"caption":"The wolf keeps an eye on you.","height":80});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[151240] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Animals","link":"section193388_151240.html","maxRecords":0.0,"photoIDs":[2313454.0,2313464.0,2315845.0,2316033.0,2316262.0,2332397.0,2337365.0,2337372.0],"skipIndex":0,"section_code":"section193388","featured_images":"2337372,2337365,2332397,2316262,2316033,2315845,2313464,2313454","id":151240,"singleSection":false});				  						galleries[151242] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Architecture","link":"section193388_151242.html","maxRecords":0.0,"photoIDs":[2313439.0,2313446.0,2315809.0,2315885.0,2316012.0,2316157.0,2316261.0,2327137.0,2327142.0,2327150.0,2332341.0,2337275.0,2337276.0],"skipIndex":0,"section_code":"section193388","featured_images":"2337276,2337275,2332341,2327150,2327142,2327137,2316261,2316157,2316012,2315885,2315809,2313446,2313439","id":151242,"singleSection":false});				  						galleries[151244] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Boats","link":"section193388_151244.html","maxRecords":0.0,"photoIDs":[2313440.0,2316005.0,2316024.0,2316151.0],"skipIndex":0,"section_code":"section193388","featured_images":"2316151,2316024,2316005,2313440","id":151244,"singleSection":false});				  						galleries[151231] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Cars","link":"section193388_151231.html","maxRecords":0.0,"photoIDs":[2313448.0,2315798.0,2315799.0,2316270.0,2327104.0,2332461.0],"skipIndex":0,"section_code":"section193388","featured_images":"2332461,2327104,2316270,2315799,2315798,2313448","id":151231,"singleSection":false});				  						galleries[151379] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Devon landscapes","link":"section193388_151379.html","maxRecords":0.0,"photoIDs":[2313426.0,2316160.0,2316162.0,2327114.0,2327210.0,2332337.0,2332356.0,2337262.0,2337279.0],"skipIndex":0,"section_code":"section193388","featured_images":"2337279,2337262,2332356,2332337,2327210,2327114,2316162,2316160,2313426","id":151379,"singleSection":false});				  						galleries[152911] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"London","link":"section193388_152911.html","maxRecords":0.0,"photoIDs":[2315887.0,2316256.0,2327108.0,2327213.0],"skipIndex":0,"section_code":"section193388","featured_images":"2327213,2327108,2316256,2315887","id":152911,"singleSection":false});				  						galleries[154419] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Pet portraits","link":"section193388_154419.html","maxRecords":0.0,"photoIDs":[2313362.0,2316253.0],"skipIndex":0,"section_code":"section193388","featured_images":"2316253,2313362","id":154419,"singleSection":false});				  						galleries[154432] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Travel","link":"section193388_154432.html","maxRecords":0.0,"photoIDs":[2315802.0,2315813.0,2315817.0,2315819.0,2316097.0,2332368.0,2332468.0,2332471.0,2337260.0,2337284.0],"skipIndex":0,"section_code":"section193388","featured_images":"2337284,2337260,2332471,2332468,2332368,2316097,2315819,2315817,2315813,2315802","id":154432,"singleSection":false});				  						galleries[151836] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Weddings and social","link":"section193388_151836.html","maxRecords":0.0,"photoIDs":[2327466.0,2327540.0,2332464.0],"skipIndex":0,"section_code":"section193388","featured_images":"2332464,2327540,2327466","id":151836,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '2337372,2337365,2337284,2337279,2337276,2337275,2337262,2337260,2332471,2332468,2332461,2332397,2332368,2332356,2332341,2332337,2327540,2327466,2327213,2327210,2327150,2327142,2327137,2327114,2327108,2327104,2316270,2316262,2316261,2316256,2316253,2316162,2316160,2316157,2316151,2316097,2316033,2316024,2316012,2316005,2315887,2315885,2315845,2315819,2315817,2315813,2315809,2315802,2315799,2315798,2313464,2313454,2313448,2313446,2313440,2313439,2313427,2313426,2313362';
imageSets[2] = '2337372,2337365,2337284,2337279,2337276,2337275,2337262,2337260,2332471,2332468,2332464,2332461,2332397,2332368,2332356,2332341,2332337,2327540,2327466,2327213,2327210,2327150,2327142,2327137,2327114,2327108,2327104,2316270,2316262,2316261,2316256,2316253,2316162,2316160,2316157,2316151,2316097,2316033,2316024,2316012,2316005,2315887,2315885,2315845,2315819,2315817,2315813,2315809,2315802,2315799,2315798,2313464,2313454,2313448,2313446,2313440,2313439,2313427,2313426,2313362';
imageSets[3] = '2337372,2337365,2337284,2337279,2337276,2337275,2337262,2337260,2332471,2332468,2332464,2332461,2332397,2332368,2332356,2332341,2332337,2327540,2327466,2327213,2327210,2327150,2327142,2327137,2327114,2327108,2327104,2316270,2316262,2316261,2316256,2316253,2316162,2316160,2316157,2316151,2316097,2316033,2316024,2316012,2316005,2315887,2315885,2315845,2315819,2315817,2315813,2315809,2315802,2315799';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/photographybyroyadams/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/photographybyroyadams/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/photographybyroyadams/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/photographybyroyadams/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/photographybyroyadams/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/photographybyroyadams/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/photographybyroyadams/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/photographybyroyadams/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/photographybyroyadams/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/photographybyroyadams/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/photographybyroyadams/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/photographybyroyadams/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/photographybyroyadams/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/photographybyroyadams/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/photographybyroyadams/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/photographybyroyadams/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/photographybyroyadams/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/photographybyroyadams/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/photographybyroyadams/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/photographybyroyadams/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/photographybyroyadams/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/photographybyroyadams/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/photographybyroyadams/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/photographybyroyadams/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 += 'section193388.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 && 'section193388' != '') {
					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 = 'Photography by Roy Adams: ' + 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({					href: thumbnails[imageID].fnGalleryLink(gallery_id),					title: galleries[gallery_id].title				});
			}
		}
	}
}

/***************************************************************************
* 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;
	}
}

			

