window.thumbnails = new Object();
												thumbnails[5458089] = new thumbnail(5458089,'93092','Blankenberge Marina','ScanV001webjpg_thumb.jpg',130, 81,18,'photo_5458089.html');
												thumbnails[5458104] = new thumbnail(5458104,'93092','The Cycle Hire Shop in Bruges','D8T_0148webjpg_thumb.jpg',130, 87,18,'photo_5458104.html');
												thumbnails[5458161] = new thumbnail(5458161,'93092','A Flowery Corner of Bruges','D8T_0122webjpg_thumb.jpg',130, 93,18,'photo_5458161.html');
												thumbnails[5667995] = new thumbnail(5667995,'280184','Heather and Ben. One day old.','D8T_4812webjpg_thumb.jpg',130, 194,18,'photo_5667995.html');
												thumbnails[5458051] = new thumbnail(5458051,'18943','River Brede','D8T_4628webjpg_thumb.jpg',130, 87,18,'photo_5458051.html');
												thumbnails[5459131] = new thumbnail(5459131,'18943','Marker Post','D8T_4629webjpg_9992F898-1D09-001F-9913A378BA4FDDAC_thumb.jpg',130, 194,18,'photo_5459131.html');
												thumbnails[5458853] = new thumbnail(5458853,'280215','Kirk Fell','D8T_4423webjpg_9957ECA0-1D09-001F-9915B45C666173F6_thumb.jpg',130, 87,18,'photo_5458853.html');
												thumbnails[5458892] = new thumbnail(5458892,'280215','Pillar','D8T_4430webjpg_995A8A3E-1D09-001F-99A7EF0F1D5E56F3_thumb.jpg',130, 87,18,'photo_5458892.html');
												thumbnails[5458900] = new thumbnail(5458900,'280215','Wasdale Head Inn','D8T_4436webjpg_995D27AD-1D09-001F-997878C518F53A81_thumb.jpg',130, 87,18,'photo_5458900.html');
												thumbnails[5459006] = new thumbnail(5459006,'93176','1918 Phoenix 11.9 Tourer','D8T_4370webjpg_996FC6E3-1D09-001F-99B7BC46FC948EA9_thumb.jpg',130, 87,18,'photo_5459006.html');
												thumbnails[5459215] = new thumbnail(5459215,'18946','Derelict Cottage','V1002webjpg_99A7CA10-1D09-001F-99BB11DF0B7684CA_thumb.jpg',130, 98,18,'photo_5459215.html');
												thumbnails[5458518] = new thumbnail(5458518,'93279','Lioness','D8T_4247webjpg_99214FCB-1D09-001F-99828ACB804EF842_thumb.jpg',130, 87,18,'photo_5458518.html');
												thumbnails[5458524] = new thumbnail(5458524,'93279','Please Give Generously','D8T_4286webjpg_99237DB7-1D09-001F-997DB59751064188_thumb.jpg',130, 143,18,'photo_5458524.html');
												thumbnails[5458532] = new thumbnail(5458532,'93279','King Vulture','D8T_4306webjpg_99261932-1D09-001F-9990B42C7453514F_thumb.jpg',130, 87,18,'photo_5458532.html');
												thumbnails[5458584] = new thumbnail(5458584,'93279','A Shed-Load of Lemurs','D8T_4335webjpg2_thumb.jpg',130, 87,18,'photo_5458584.html');
												thumbnails[5458917] = new thumbnail(5458917,'280215','Summit of Brim Fell','D8T_4207webjpg_995F4B97-1D09-001F-99D105BFB6D571FB_thumb.jpg',130, 87,18,'photo_5458917.html');
												thumbnails[5458815] = new thumbnail(5458815,'280184','On the Via Ferrata, Honister','BILD5302web_thumb.jpg',130, 98,18,'photo_5458815.html');
												thumbnails[5458920] = new thumbnail(5458920,'280215','MV Swan','D8T_4093webjpg_996141C9-1D09-001F-9912F79ABAAC5BCB_thumb.jpg',130, 86,18,'photo_5458920.html');
												thumbnails[5458988] = new thumbnail(5458988,'280215','Lake Windermere Boat Trip','D8T_4104webjpg_9967566D-1D09-001F-99D8B6F563CC9719_thumb.jpg',130, 87,18,'photo_5458988.html');
												thumbnails[5459015] = new thumbnail(5459015,'93176','A Crashed Rolls Royce Merlin','D8T_4053webjpg_9972E8B5-1D09-001F-99BC8D76FE6ED943_thumb.jpg',130, 87,18,'photo_5459015.html');
												thumbnails[5458839] = new thumbnail(5458839,'280184','Liz at Summit of Holme Fell','D8T_4026webjpg_9953DF07-1D09-001F-9970C8F87F0462E9_thumb.jpg',130, 87,18,'photo_5458839.html');
												thumbnails[5458186] = new thumbnail(5458186,'157237','A Classic Car Rally in Mayenne','D8T_3714webjpg_thumb.jpg',130, 87,18,'photo_5458186.html');
												thumbnails[5459021] = new thumbnail(5459021,'93176','Renault Gordini R8','D8T_3722webjpg_99750C31-1D09-001F-99033559F2A67A12_thumb.jpg',130, 91,18,'photo_5459021.html');
												thumbnails[5458229] = new thumbnail(5458229,'157237','Mayenne','D8T_3665webjpg_thumb.jpg',130, 130,18,'photo_5458229.html');
												thumbnails[5458259] = new thumbnail(5458259,'157237','A Lake near Egliseneuve-d\'Entraigues','D8T_3598webjpg_thumb.jpg',130, 86,18,'photo_5458259.html');
												thumbnails[5458281] = new thumbnail(5458281,'157237','Puy Violent','D8T_3506websjpg_thumb.jpg',130, 87,18,'photo_5458281.html');
												thumbnails[5458300] = new thumbnail(5458300,'157237','Chateau de Val, Auvergne','D8T_3325webjpg_thumb.jpg',130, 84,18,'photo_5458300.html');
												thumbnails[5458309] = new thumbnail(5458309,'157237','Volcanoes in The Auvergne','D8T_3288webjpg_thumb.jpg',130, 87,18,'photo_5458309.html');
												thumbnails[5458318] = new thumbnail(5458318,'157237','Country Road in The Auvergne','D8T_3209webjpg_thumb.jpg',130, 87,18,'photo_5458318.html');
												thumbnails[5458327] = new thumbnail(5458327,'157237','Meat Stall in Besse-en-Chandesse','D8T_3193webjpg_thumb.jpg',130, 87,18,'photo_5458327.html');
												thumbnails[5458333] = new thumbnail(5458333,'157237','A Cafe in Besse-en-Chandesse','D8T_3140webjpg_98FE7790-1D09-001F-99D1B35F5EB05A79_thumb.jpg',130, 194,18,'photo_5458333.html');
												thumbnails[5459141] = new thumbnail(5459141,'18943','Hastings Lifeboat','D8T_3057webjpg_99973FB0-1D09-001F-99432D771A0658F3_thumb.jpg',130, 91,18,'photo_5459141.html');
												thumbnails[5458588] = new thumbnail(5458588,'93279','Four Horses at Brightling','D8T_2835webjpg_9930773F-1D09-001F-992167F8B6CBE166_thumb.jpg',130, 87,18,'photo_5458588.html');
												thumbnails[5459169] = new thumbnail(5459169,'18943','Hastings Fisherman','D8T_2531webjpg_999BBF6B-1D09-001F-99A44D304D344012_thumb.jpg',130, 87,18,'photo_5459169.html');
												thumbnails[5458337] = new thumbnail(5458337,'157237','Abbeville on a Sunday Morning.','D8T_1722webjpg_99019386-1D09-001F-99DA04B6F67C5275_thumb.jpg',130, 87,18,'photo_5458337.html');
												thumbnails[5458614] = new thumbnail(5458614,'93279','Suspicious Lioness','D8T_2441webjpg_99354077-1D09-001F-99A249F548372F4E_thumb.jpg',130, 87,18,'photo_5458614.html');
												thumbnails[5459059] = new thumbnail(5459059,'93176','Carousel on Brighton Pier','D8T_2143webjpg_9978370B-1D09-001F-99CFB474DA59CE11_thumb.jpg',130, 87,18,'photo_5459059.html');
												thumbnails[5459066] = new thumbnail(5459066,'93176','Turbo Booster','D8T_2149webjpg_997A202E-1D09-001F-9945A1A72199361F_thumb.jpg',130, 84,18,'photo_5459066.html');
												thumbnails[5459073] = new thumbnail(5459073,'93176','Funfair Ride on Brighton Pier','D8T_2152webjpg_997C651D-1D09-001F-99D13A23BCB5A91E_thumb.jpg',130, 87,18,'photo_5459073.html');
												thumbnails[5459077] = new thumbnail(5459077,'93176','Funfair Ride','D8T_2155webjpg_997E785D-1D09-001F-997FB36319404EF1_thumb.jpg',130, 87,18,'photo_5459077.html');
												thumbnails[5459083] = new thumbnail(5459083,'93176','\'Wild River\' Funfair Ride','D8T_2165webjpg_9980D3E1-1D09-001F-9982AAE478E4224C_thumb.jpg',130, 87,18,'photo_5459083.html');
												thumbnails[5459086] = new thumbnail(5459086,'93176','\'Booster\' Funfair Ride','D8T_2172webjpg_9982CCC3-1D09-001F-9977BB424ACEBD5D_thumb.jpg',130, 87,18,'photo_5459086.html');
												thumbnails[5458356] = new thumbnail(5458356,'157237','River Authie, Picardy','D8T_1742webjpg_99059F5A-1D09-001F-99E3C241CF9D731D_thumb.jpg',130, 87,18,'photo_5458356.html');
												thumbnails[5459089] = new thumbnail(5459089,'93176','Rotting Trawler','ScanV039webjpg_9985970E-1D09-001F-99C6D3CCC6582974_thumb.jpg',130, 94,18,'photo_5459089.html');
												thumbnails[5459093] = new thumbnail(5459093,'93176','Trawler on Dungeness Beach','ScanV044webjpg_9987F5EE-1D09-001F-9961AF47F67EE6E1_thumb.jpg',130, 96,18,'photo_5459093.html');
												thumbnails[5459095] = new thumbnail(5459095,'93176','A Fishing Boat on Dungeness Beach','ScanV040web_9989F567-1D09-001F-9917F1201ADF4F90_thumb.jpg',130, 98,18,'photo_5459095.html');
												thumbnails[5459181] = new thumbnail(5459181,'18943','Information Board and Lifebelt','ScanV018webjpg_999DE077-1D09-001F-99FB7CF5A3118355_thumb.jpg',130, 97,18,'photo_5459181.html');
												thumbnails[5459228] = new thumbnail(5459228,'18946','Herstmonceux Castle','D8T_1126webjpg_99AB6845-1D09-001F-99FAD2F871FA248B_thumb.jpg',130, 84,18,'photo_5459228.html');
												thumbnails[5458992] = new thumbnail(5458992,'280215','The Summit of Loughrigg Fell','D8T_0971webjpg_9969FC77-1D09-001F-99FAED5FC2F17590_thumb.jpg',130, 87,18,'photo_5458992.html');
												thumbnails[5459000] = new thumbnail(5459000,'280215','Low Water on The Old Man of Coniston','D8T_0770wejpg_996D4CCB-1D09-001F-9974B4D4F2865EA1_thumb.jpg',130, 87,18,'photo_5459000.html');
												thumbnails[5459262] = new thumbnail(5459262,'18948','A Pinocchio Shop in Collodi','D8T_0381webjpg_99B4D0F6-1D09-001F-990AAF36FB45EC38_thumb.jpg',130, 194,18,'photo_5459262.html');
												thumbnails[5459281] = new thumbnail(5459281,'18948','Tuscan Swimming Pool','D8T_0309webjpg_99BA003B-1D09-001F-99E92D7CFD2517D1_thumb.jpg',130, 85,18,'photo_5459281.html');
												thumbnails[5459338] = new thumbnail(5459338,'18948','Cynara Cardunculus','DSC_3658webjpg_99CECB4A-1D09-001F-99AB7BF211198195_thumb.jpg',130, 105,18,'photo_5459338.html');
												thumbnails[5458077] = new thumbnail(5458077,'93092','Blankenberge Beach','ScanV004webjpg_thumb.jpg',130, 66,18,'photo_5458077.html');
												thumbnails[5459096] = new thumbnail(5459096,'93176','Lifebell on a Windermere Steamer','D8T_0922webjpg_998E9628-1D09-001F-99803585DCAB46FF_thumb.jpg',130, 87,18,'photo_5459096.html');
												thumbnails[5458393] = new thumbnail(5458393,'42575','Beacon, Barn and Tree at Brede','DSC_3356web_990B10D8-1D09-001F-995B97829176FAB1_thumb.jpg',130, 86,18,'photo_5458393.html');
												thumbnails[5459235] = new thumbnail(5459235,'18946','Chesterfield Church','DSC_3172webjpg_thumb.jpg',130, 195,18,'photo_5459235.html');
												thumbnails[5459294] = new thumbnail(5459294,'18948','Rimini Railway Station','DSC_2888webjpg_thumb.jpg',130, 86,18,'photo_5459294.html');
												thumbnails[5462540] = new thumbnail(5462540,'18948','Locomotive Cleaning at Ravenna','DSC_2892webjpg_thumb.jpg',130, 86,18,'photo_5462540.html');
												thumbnails[5458428] = new thumbnail(5458428,'42575','Two Potted Agaves','DSC_2587webjpg_990FCA03-1D09-001F-99F800F9C109C8DD_thumb.jpg',130, 91,18,'photo_5458428.html');
												thumbnails[5459306] = new thumbnail(5459306,'18948','Lake Garda Umbrellas','DSC_2598webjpg_99BEED18-1D09-001F-99F0484C4083F765_thumb.jpg',130, 195,18,'photo_5459306.html');
												thumbnails[5459310] = new thumbnail(5459310,'18948','Inside a Limonaia','DSC_2415pdjpg_99C1340B-1D09-001F-99287EBECA745356_thumb.jpg',130, 196,18,'photo_5459310.html');
												thumbnails[5458623] = new thumbnail(5458623,'93279','Cows on Monte Baldo','DSC_2360webjpg_9938D074-1D09-001F-990E3206E79C81A7_thumb.jpg',130, 195,18,'photo_5458623.html');
												thumbnails[5458457] = new thumbnail(5458457,'42575','Mountains at Passo Gavia','DSC_1826webjpg_thumb.jpg',130, 86,18,'photo_5458457.html');
												thumbnails[5458627] = new thumbnail(5458627,'93279','Cheeky Sparrow','DSC_1712webjpg_993B2D31-1D09-001F-99EB503E14B79CAA_thumb.jpg',130, 86,18,'photo_5458627.html');
												thumbnails[5459128] = new thumbnail(5459128,'93176','Bond Bug','DSC_1465webjpg_9991136D-1D09-001F-994C3D0F94D1FA9E_thumb.jpg',130, 86,18,'photo_5459128.html');
												thumbnails[5459192] = new thumbnail(5459192,'18943','East Hill Lift, Hastings','DSC_0897webjpg_99A14107-1D09-001F-99F09389FCB097CF_thumb.jpg',130, 202,18,'photo_5459192.html');
												thumbnails[5459202] = new thumbnail(5459202,'18943','West Hill Lift, Hastings','DSC_0955webjpg_99A3D0AA-1D09-001F-99F138C96A5F85BB_thumb.jpg',130, 195,18,'photo_5459202.html');
												thumbnails[5458691] = new thumbnail(5458691,'93279','Cows\' Car Club','DSC_0754pdjpg_thumb.jpg',130, 86,18,'photo_5458691.html');
												thumbnails[5458469] = new thumbnail(5458469,'42575','Snowy Woods','DSC_0566webjpg_thumb.jpg',130, 86,18,'photo_5458469.html');
												thumbnails[5459342] = new thumbnail(5459342,'19038','Blue Tulip','DSC_0357webjpg_99D0A961-1D09-001F-992BCD28D172AB88_thumb.jpg',130, 173,18,'photo_5459342.html');
												thumbnails[5459254] = new thumbnail(5459254,'18946','Early English Vaulting','DSCN3106webjpg_99B27B1F-1D09-001F-999291AAD7C73792_thumb.jpg',130, 90,18,'photo_5459254.html');
												thumbnails[5459316] = new thumbnail(5459316,'18948','Villa Marina at Midnight','DSCN0065webjpg_99C34C5C-1D09-001F-99D9D9DC2475CBD0_thumb.jpg',130, 97,18,'photo_5459316.html');
												thumbnails[5459344] = new thumbnail(5459344,'19038','Marble Mere','DSC_1134webjpg_99D28729-1D09-001F-99ECE2E3258ECD8A_thumb.jpg',130, 86,18,'photo_5459344.html');
												thumbnails[5459350] = new thumbnail(5459350,'19038','The Path of Wonderment','DSCN0313webjpg_99D4FC8E-1D09-001F-99BFF78654D1B9E7_thumb.jpg',130, 186,18,'photo_5459350.html');
												thumbnails[5459357] = new thumbnail(5459357,'19038','Pleats','DSCN3499webjpg_thumb.jpg',130, 105,18,'photo_5459357.html');
												thumbnails[5459373] = new thumbnail(5459373,'19038','Magic Pond','DSCN0555ARTwebjpg_99D989E7-1D09-001F-996445CD1C75E8DD_thumb.jpg',130, 98,18,'photo_5459373.html');
												thumbnails[7543620] = new thumbnail(7543620,'18943','','D5T0167web_thumb.jpg',130, 86,18,'photo_7543620.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[93092] = new gallery(93092,'5458077','Belgium','gallery',[5458089,5458104,5458161,5458077],0, 0, '', 'gallery_93092.html',0,0);
				  					galleries[157237] = new gallery(157237,'5458300','France','gallery',[5458186,5458229,5458259,5458281,5458300,5458309,5458318,5458327,5458333,5458337,5458356],0, 0, '', 'gallery_157237.html',0,0);
				  					galleries[42575] = new gallery(42575,'5458428','In The Black','gallery',[5458393,5458428,5458457,5458469],0, 0, '', 'gallery_42575.html',0,0);
				  					galleries[93279] = new gallery(93279,'5458584','My Animal Friends','gallery',[5458518,5458524,5458532,5458584,5458588,5458614,5458623,5458627,5458691],0, 0, '', 'gallery_93279.html',0,0);
				  					galleries[280184] = new gallery(280184,'5458815','Personal Pics','gallery',[5667995,5458815,5458839],0, 0, '', 'gallery_280184.html',0,0);
				  					galleries[280215] = new gallery(280215,'5458900','The Lake District','gallery',[5458853,5458892,5458900,5458917,5458920,5458988,5458992,5459000],0, 0, '', 'gallery_280215.html',0,0);
				  					galleries[93176] = new gallery(93176,'5459006','Transport and Machinery','gallery',[5459006,5459015,5459021,5459059,5459066,5459073,5459077,5459083,5459086,5459089,5459093,5459095,5459096,5459128],0, 0, '', 'gallery_93176.html',0,0);
				  					galleries[18943] = new gallery(18943,'5458051','Around Sussex','gallery',[5458051,5459131,5459141,5459169,5459181,5459192,5459202,7543620],0, 0, '', 'gallery_18943.html',0,0);
				  					galleries[18946] = new gallery(18946,'5459228','Architectural Delights','gallery',[5459215,5459228,5459235,5459254],0, 0, '', 'gallery_18946.html',0,0);
				  					galleries[18948] = new gallery(18948,'5459281','Italy','gallery',[5459262,5459281,5459338,5459294,5462540,5459306,5459310,5459316],0, 0, '', 'gallery_18948.html',0,0);
				  					galleries[19038] = new gallery(19038,'5459350','My Arty Side','gallery',[5459342,5459344,5459350,5459357,5459373],0, 0, '', 'gallery_19038.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '5458051';
imageSets[2] = '5459350,5459281,5459228,5459006,5458900,5458815,5458584,5458428,5458300,5458077,5458051';
imageSets[3] = '7543620,5667995,5462540,5459373,5459357,5459350,5459344,5459342,5459338,5459316,5459310,5459306,5459294,5459281,5459262,5459254,5459235,5459228,5459215,5459202,5459192,5459181,5459169,5459141,5459131,5459128,5459096,5459095,5459093,5459089,5459086,5459083,5459077,5459073,5459066,5459059,5459021,5459015,5459006,5459000,5458992,5458988,5458920,5458917,5458900,5458892,5458853,5458839,5458815,5458691';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/MickSargent/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/MickSargent/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/MickSargent/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/MickSargent/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/MickSargent/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/MickSargent/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/MickSargent/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/MickSargent/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/MickSargent/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/MickSargent/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/MickSargent/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/MickSargent/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/MickSargent/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/MickSargent/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/MickSargent/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/MickSargent/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/MickSargent/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/MickSargent/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/MickSargent/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/MickSargent/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/MickSargent/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/MickSargent/images';
		break;
	}
		return val;
}

/***************************************************************************
* img = reference to image object in which to show image                   *
***************************************************************************/
function showHomeImage(img) {

	imageID = randomListVal('');
		if (!basic) {
	img.src = photos[imageID].src;
	img.width = photos[imageID].width;
	img.height = photos[imageID].height;
  img.parentNode.title = img.alt = photos[imageID].caption;
	}
	else {
		newImage = new Image(photos[imageID].width,photos[imageID].height);
		newImage.src = photos[imageID].src;
		document.images[img.name] = newImage;
				
	}
			}

function getHomeImageLink(imageID) {
  	var href='', photo = backgrounds && backgrounds[imageID];
	if(photo){
		if (photo && photo.galleries_id != '') {
  			href = photo.fnGalleryLink();
  		}
  		  		else {
  				href += 'gallery.html';
  	  		}
	}
    return href;
}
/***************************************************************************
* Show a random image on home page from featured images                    *
***************************************************************************/
function showHomeImageInline(el, image_sets_id, href) {
	
  var css = {}, imageID,
	    imageSetsId = 1;
	if(image_sets_id){
		imageSetsId = image_sets_id;
	}
	imageID = randomListVal(imageSets[imageSetsId]);
		if (href == null && 'gallery' != '') {
					href = getHomeImageLink(imageID);
	}
    
  updateImage({nextPhoto: backgrounds[imageID], img:el.find('img')[0],
                $photo:el, $title:$('#homeimageTitleContainer'), $detail:$('#homeimageDetailsContainer'),                speed:0, href:href, css:css, onAfter: function(){                  this.closest('.contentsection').doManualAlign({				    inner: 'img',				    crop: 'a'				  });                }              });
}

/***************************************************************************
* Set 'img' to be a new image given its photo() object                     *
***************************************************************************/
function updateImage (options) {
  var defaults = {nextPhoto:'',field:'',img:'',$photo:'',$title:'',$detail:'',
                    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 (!basic) {
    if (op.updateHash && clik.getIDInUrl(location.href,'photo') != op.nextPhoto.id) {
		clik.changeHash('photos_id=' + op.nextPhoto.id, true);
    }
				
    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));		  $('body').trigger('clikUpdate');		}, op.onBefore);
      }    }
    	if (op.field) {
		op.field.value = photoId;
	} else {
		op.$photo.data('image_id', photoId);
    }
	    if (op.$title.length > 0) {
  		op.$title.fadeGalleryDetails(photoCaption, op.speed);
    }
        if (op.updateDocumentTitle) {
						  document.title = 'Mick Sargent Photography: ' + photoCaption;
			    }
        if (op.$detail.length > 0) {
      temp = op.nextPhoto.fnGetImageDetails();
	    op.$detail.fadeGalleryDetails(temp, op.speed, function(){
	    var options = {};	    	      	      resizePhotoInfo(options);
        if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
  	      toggleAddToCartConfirm(backgrounds);
  	    } else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
  	      toggleAddToCartConfirm(photos);
  	    }
	    });
    }
        if (!op.speed) {      clik.doColumnResize(false, op.$photo.add(op.$detail).add(op.$title));      $('body').trigger('clikUpdate');    }        
    return html;			}
	else {
				
		window.location = 'photo_' + nextPhoto.id + '.html';
	}
		
}

/***************************************************************************
* Toggle add to cart confirmation element and set up the click event for   *
* the 'Add to cart' button.                                                *
***************************************************************************/
function toggleAddToCartConfirm(array){
  if (typeof(array) !== 'object') {
    array = photos;
  }
	if($('#paymentConfirm').length > 0){
		$('#paymentConfirm').hide();
		$('#paymentAddButton')
		.unbind()
		.click(function(){
						form = document.getElementById('paymentForm');
			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').text('Item added to cart').show();}
				else{
					$('#paymentConfirm').text('Item added to cart').fadeIn();
					dspOrderDetails(form.site.value);
				}
			}
			else{
				$('#paymentConfirm').text('Item not added - check cookies are enabled in your browser.').fadeIn();
			}
		});
	}
}
/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
photo.prototype.fnGetImageDetails = function(){
	var temp = '';
	if (this.description != '') {
		temp = temp +  '<p id="imageDescription">' + this.description + '</p>';
	}
		if (this.photo_ref != '') {
		temp = temp + '<p class="imageinfo" id="imageRef"><strong>Ref: </strong>' + this.photo_ref + '</p>';
	}
		if (this.takendate != '') {
				
		temp = temp + '<p class="imageinfo" id="imageDate"><strong>Date: </strong>' + this.takendate + '</p>';
	}
	
	if (this.location != '') {
				
		temp = temp + '<p class="imageinfo" id="imageLocation"><strong>Location: </strong>' +  this.location + '</p>';
	}
	
	if (this.photographer != '') {
				
		temp = temp + '<p class="imageinfo" id="imagePhotographer"><strong>Photographer: </strong>' + this.photographer + '</p>';
	}
					
	temp = temp + this.fnGetPaymentInfo();
				if (temp != '') {
		temp = temp + '<div class="spacer"></div>';
	}
	return temp;
};

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
photo.prototype.fnGetPaymentInfo = function(){
	var temp = '';
	if (this.item_price !== '') {
																		temp = temp + '<p>Buy now using PayPal:</p>';
				temp = temp + '<p class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> &pound;' + (this.item_price).toFixed(2) + '</p>';
		var item_name  = this.purchase_instruction;
		var amount = (this.item_price).toFixed(2);
		var item_option  = 0;
	}
	else if (this.payment_groups_id !== '') {
		temp = temp + '<p>Buy this print online:</p>';
				temp = temp + '<form id="paymentOptions" style="margin:0px;border:0px;" name="paymentOptions">';
											temp = temp + '<select class="paymentlink" name="payment_options_id" onchange="updateItemValues(document.forms.paymentForm,this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value);">';
				
		temp = temp + getPaymentOptions(this.payment_groups_id);
		temp = temp + '</select>';
		temp = 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 = temp + '<form id="paymentForm" style="margin:0px;border:0px;" name="paymentForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
	temp = temp + '<input type="hidden" name="item_name" value="'+item_name+'">';
								ref = '';
				if(this.photo_ref != ''){
					ref = this.photo_ref+' - '+this.caption;
				}
				else{
					ref = this.id+' - '+this.caption;
				}
				price = amount;					temp = temp + '<input type="hidden" name="cmd" value="_cart">';
	temp = temp + '<input type="hidden" name="business" value="mickspics@thepark707.wanadoo.co.uk">';
	temp = temp + '<input type="hidden" name="currency_code" value="GBP">';
	temp = temp + '<input type="hidden" name="add" value="1">';
					temp = temp + '<input type="hidden" name="amount" value="'+amount+'">';
	temp = temp + '<input type="hidden" name="item_number" value="'+ref+'">';
					temp = temp + '<input type=\"Submit\" value=\"Add to cart\" id=\"paymentAddButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
									temp = temp + '</form>';
								temp = temp + '<form id="paymentCartForm" style="margin:0px;" name="paymentCartForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
	temp = temp + '<input type="hidden" name="cmd" value="_cart">';
	temp = temp + '<input type="hidden" name="business" value="mickspics@thepark707.wanadoo.co.uk">';
	temp = temp + '<input type="hidden" name="display" value="1">';
	temp = temp + '<input type=\"Submit\" value=\"View cart\" id=\"paymentViewButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
	temp = temp + '</form>';
							temp = 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 + ' | ';
				}
				temp = temp + '<a href="' + galleries[i].section_code + '_' + galleries[i].id + '.html">' + galleries[i].title + '</a>';
			}
		}
		document.all.galleryLinks.innerHTML = 'Other galleries: ' + temp;
	}
}

			

