window.thumbnails = new Object();
												thumbnails[44838] = new thumbnail(44838,'28293','Great Hall, British Museum','AT403Bmono_thumb.jpg',130, 86,18,'							photo_44838.html');
												thumbnails[44843] = new thumbnail(44843,'4615','Pumpkins, Vermont','AB1264_thumb.jpg',130, 86,18,'							photo_44843.html');
												thumbnails[44844] = new thumbnail(44844,'4616','Pig in muck','AD62EB_thumb.jpg',130, 85,18,'							photo_44844.html');
												thumbnails[44848] = new thumbnail(44848,'4617','Marble Temple, Bangkok','AH909B_thumb.jpg',130, 198,18,'							photo_44848.html');
												thumbnails[44850] = new thumbnail(44850,'4616','Sunflowers','AD62F5_thumb.jpg',130, 85,18,'							photo_44850.html');
												thumbnails[44851] = new thumbnail(44851,'4616','Grey seal','AD63021_thumb.jpg',130, 85,18,'							photo_44851.html');
												thumbnails[44852] = new thumbnail(44852,'4615','Fall foliage','Fall_thumb.jpg',130, 83,18,'							photo_44852.html');
												thumbnails[44854] = new thumbnail(44854,'28293','Eagle Owl','Owl_thumb.jpg',130, 135,18,'							photo_44854.html');
												thumbnails[44855] = new thumbnail(44855,'4617','Himalayan terraces','Terraces_thumb.jpg',130, 197,18,'							photo_44855.html');
												thumbnails[44856] = new thumbnail(44856,'4614','Thai Roses','Roses_thumb.jpg',130, 79,18,'							photo_44856.html');
												thumbnails[44858] = new thumbnail(44858,'4617','Woman and child','NepalBaby_thumb.jpg',130, 198,18,'							photo_44858.html');
												thumbnails[44859] = new thumbnail(44859,'4613','Westminster at night','Westminster_thumb.jpg',130, 85,18,'							photo_44859.html');
												thumbnails[44861] = new thumbnail(44861,'4614','Orange tulips','Tulips_thumb.jpg',130, 84,18,'							photo_44861.html');
												thumbnails[44862] = new thumbnail(44862,'4617','Pisa','Pisa_thumb.jpg',130, 198,18,'							photo_44862.html');
												thumbnails[44863] = new thumbnail(44863,'4613','London Eye','BigBen_thumb.jpg',130, 91,18,'							photo_44863.html');
												thumbnails[44864] = new thumbnail(44864,'4613','Nelson Mandela','Mandela_thumb.jpg',130, 129,18,'							photo_44864.html');
												thumbnails[44866] = new thumbnail(44866,'4617','Lake Phewa, Nepal','LakePhewa1_thumb.jpg',130, 92,18,'							photo_44866.html');
												thumbnails[44867] = new thumbnail(44867,'4613','South Bank Centre','NatTheatre1_thumb.jpg',130, 85,18,'							photo_44867.html');
												thumbnails[44868] = new thumbnail(44868,'4614','Chains','Chains2_thumb.jpg',130, 88,18,'							photo_44868.html');
												thumbnails[44871] = new thumbnail(44871,'4613','Big Ben','AJ81732_thumb.jpg',130, 206,18,'							photo_44871.html');
												thumbnails[64729] = new thumbnail(64729,'4613','Great Hall, British Museum','479_thumb.jpg',130, 86,18,'							photo_64729.html');
												thumbnails[64731] = new thumbnail(64731,'4617','Camels crossing river, Agra','099_thumb.jpg',130, 188,18,'							photo_64731.html');
												thumbnails[64733] = new thumbnail(64733,'4613','Swiss Re building & Tower of London','134_thumb.jpg',130, 88,18,'							photo_64733.html');
												thumbnails[64734] = new thumbnail(64734,'4617','Belly dancer costumes','3441_thumb.jpg',130, 86,18,'							photo_64734.html');
												thumbnails[64739] = new thumbnail(64739,'40435','Cod liver oil capsules','AAKM3F_thumb.jpg',130, 86,18,'							photo_64739.html');
												thumbnails[96714] = new thumbnail(96714,'28293','Classic car','ClassicCar_thumb.D1378.jpg',130, 199,18,'							photo_96714.html');
												thumbnails[96721] = new thumbnail(96721,'40435','Numberpad','DECTphone_thumb.D0058.jpg',130, 86,18,'							photo_96721.html');
												thumbnails[103363] = new thumbnail(103363,'4616','Bearcat','Bearcat_thumb.D2446.jpg',130, 184,18,'							photo_103363.html');
												thumbnails[103365] = new thumbnail(103365,'4616','Gorilla','Gorilla_thumb.D2420a.jpg',130, 175,18,'							photo_103365.html');
												thumbnails[103366] = new thumbnail(103366,'4616','Leopard','Leopard_thumb.d2456.jpg',130, 196,18,'							photo_103366.html');
												thumbnails[106195] = new thumbnail(106195,'4616','Wallaby','Wallaby_thumb.D2719.jpg',130, 183,18,'							photo_106195.html');
												thumbnails[106205] = new thumbnail(106205,'28293','David','DavidStatue_thumb.A.jpg',130, 197,18,'							photo_106205.html');
												thumbnails[111239] = new thumbnail(111239,'4617','Belly dancing','PICT32221_thumb.jpg',130, 196,18,'							photo_111239.html');
												thumbnails[191051] = new thumbnail(191051,'40435','All Sorts','Allsorts_thumb.d5485.jpg',130, 195,18,'							photo_191051.html');
												thumbnails[191054] = new thumbnail(191054,'4615','Fall color','fallcolor_thumb.jpg',130, 84,18,'							photo_191054.html');
												thumbnails[191056] = new thumbnail(191056,'40441','Fire eater','FireEater_thumb.d4540.jpg',130, 137,18,'							photo_191056.html');
												thumbnails[191057] = new thumbnail(191057,'40441','Merry-go-round','MerryGoRound_thumb.d4525.jpg',130, 86,18,'							photo_191057.html');
												thumbnails[191060] = new thumbnail(191060,'4614','Snowdrop','Snowdrops_thumb.d4803.jpg',130, 178,18,'							photo_191060.html');
												thumbnails[191072] = new thumbnail(191072,'4615','Sturbridge','Sturbridge_thumb.jpg',130, 90,18,'							photo_191072.html');
												thumbnails[208138] = new thumbnail(208138,'4613','BT Tower','POTower_thumb.d5365.jpg',130, 86,18,'							photo_208138.html');
												thumbnails[208139] = new thumbnail(208139,'4613','Langham Place','LanghamPlace_thumb.d5388.jpg',130, 196,18,'							photo_208139.html');
												thumbnails[337544] = new thumbnail(337544,'4615','Middlebury, VT','middlebury01_thumb.jpg',130, 181,18,'							photo_337544.html');
												thumbnails[337561] = new thumbnail(337561,'28293','Ullswater','Final_thumb.1016.jpg',130, 199,18,'							photo_337561.html');
												thumbnails[337562] = new thumbnail(337562,'28293','Zebra','ZebraPattern_thumb.jpg',130, 193,18,'							photo_337562.html');
												thumbnails[337563] = new thumbnail(337563,'4614','Winter','kWh_thumb.d5492.jpg',130, 86,18,'							photo_337563.html');
												thumbnails[337566] = new thumbnail(337566,'28293','Nepalese woman','Duotone_thumb.654.jpg',130, 169,18,'							photo_337566.html');
												thumbnails[475388] = new thumbnail(475388,'37520','Shutters 2','PICT6490a_thumb.jpg',130, 86,18,'							photo_475388.html');
												thumbnails[475389] = new thumbnail(475389,'37520','Shutters 1','PICT6489a_thumb.jpg',130, 86,18,'							photo_475389.html');
												thumbnails[475390] = new thumbnail(475390,'37520','No Ball Games','PICT6487a_thumb.jpg',130, 86,18,'							photo_475390.html');
												thumbnails[475391] = new thumbnail(475391,'37520','Lavender','PICT6447a_thumb.jpg',130, 86,18,'							photo_475391.html');
												thumbnails[475392] = new thumbnail(475392,'37520','Oignons','PICT6459a_thumb.jpg',130, 86,18,'							photo_475392.html');
												thumbnails[475393] = new thumbnail(475393,'37520','Olives','PICT6467a_thumb.jpg',130, 178,18,'							photo_475393.html');
												thumbnails[475394] = new thumbnail(475394,'37520','Cartes postales','PICT6486a_thumb.jpg',130, 195,18,'							photo_475394.html');
												thumbnails[523476] = new thumbnail(523476,'40435','Box of tissues','PICT7620_thumb.jpg',130, 159,18,'							photo_523476.html');
												thumbnails[523477] = new thumbnail(523477,'40435','Tennis balls','PICT7585_thumb.jpg',130, 246,18,'							photo_523477.html');
												thumbnails[523480] = new thumbnail(523480,'4615','Zoom burst, autumn','FallZoomburst_thumb.946.jpg',130, 83,18,'							photo_523480.html');
												thumbnails[523482] = new thumbnail(523482,'28293','Splash','PICT6897_thumb.jpg',130, 161,18,'							photo_523482.html');
												thumbnails[523483] = new thumbnail(523483,'40435','Wine spill','Wine_thumb.6849.jpg',130, 135,18,'							photo_523483.html');
												thumbnails[523484] = new thumbnail(523484,'4617','Smoothie stall','Bangkok_thumb.1094.jpg',130, 199,18,'							photo_523484.html');
												thumbnails[523485] = new thumbnail(523485,'40435','Microscope','Microscope_thumb.7461.jpg',130, 195,18,'							photo_523485.html');
												thumbnails[523486] = new thumbnail(523486,'4614','Gonks','ISO100_thumb.1285.jpg',130, 86,18,'							photo_523486.html');
												thumbnails[523488] = new thumbnail(523488,'4617','Floating market','Damnoen_thumb.614.jpg',130, 215,18,'							photo_523488.html');
												thumbnails[523490] = new thumbnail(523490,'4614','Stamps','Stamps_thumb.7454.jpg',130, 89,18,'							photo_523490.html');
												thumbnails[523491] = new thumbnail(523491,'40435','Mobile TV','PICT7544_thumb.jpg',130, 95,18,'							photo_523491.html');
												thumbnails[523493] = new thumbnail(523493,'4616','Red Breasted Goose','RedBreastedGoose_thumb.D0714.jpg',130, 168,18,'							photo_523493.html');
												thumbnails[523494] = new thumbnail(523494,'4617','Shell hunter','Sarawak_thumb.555.jpg',130, 173,18,'							photo_523494.html');
												thumbnails[523495] = new thumbnail(523495,'40441','Big surf','BigSurf_thumb.243.jpg',130, 66,18,'							photo_523495.html');
												thumbnails[523527] = new thumbnail(523527,'28293','Bluebells','Bluebell_thumb.206.jpg',130, 85,18,'							photo_523527.html');
												thumbnails[523528] = new thumbnail(523528,'28293','White out','631_thumb.jpg',130, 150,18,'							photo_523528.html');
												thumbnails[523530] = new thumbnail(523530,'40441','Dribbling','464_thumb.jpg',130, 79,18,'							photo_523530.html');
												thumbnails[523584] = new thumbnail(523584,'40435','Mobile','A4KM47_thumb.jpg',130, 92,18,'							photo_523584.html');
												thumbnails[523588] = new thumbnail(523588,'40441','Showjumping','AT404E_thumb.jpg',130, 97,18,'							photo_523588.html');
												thumbnails[523883] = new thumbnail(523883,'4617','Man & prayer wheel','091_thumb.jpg',130, 181,18,'							photo_523883.html');
												thumbnails[523885] = new thumbnail(523885,'4617','Agra','0991_thumb.jpg',130, 192,18,'							photo_523885.html');
												thumbnails[523887] = new thumbnail(523887,'28293','Cherhill','162_thumb.jpg',130, 194,18,'							photo_523887.html');
												thumbnails[523888] = new thumbnail(523888,'4616','Blue zoom','191_thumb.jpg',130, 84,18,'							photo_523888.html');
												thumbnails[523890] = new thumbnail(523890,'4614','Jetsam','476 copy_thumb.jpg',130, 85,18,'							photo_523890.html');
												thumbnails[523891] = new thumbnail(523891,'28293','Royal Crescent','509_thumb.jpg',130, 76,18,'							photo_523891.html');
												thumbnails[523894] = new thumbnail(523894,'40441','Thai boxing','958_thumb.jpg',130, 109,18,'							photo_523894.html');
												thumbnails[523913] = new thumbnail(523913,'4613','Charing Cross','CharingX_thumb.Dawn.155.jpg',130, 185,18,'							photo_523913.html');
												thumbnails[523916] = new thumbnail(523916,'4614','Deckchairs','Deckchair_thumb.jpg',130, 90,18,'							photo_523916.html');
												thumbnails[523918] = new thumbnail(523918,'4617','Floating market','FloatMarket1_thumb.jpg',130, 196,18,'							photo_523918.html');
												thumbnails[855111] = new thumbnail(855111,'40435','Splash!','PICT6893_thumb.jpg',130, 196,18,'							photo_855111.html');
												thumbnails[855113] = new thumbnail(855113,'4617','Grand Palace, Bangkok','Guard_thumb.1095.jpg',130, 199,18,'							photo_855113.html');
												thumbnails[855115] = new thumbnail(855115,'4616','White on white','6311_thumb.jpg',130, 150,18,'							photo_855115.html');
												thumbnails[855116] = new thumbnail(855116,'4614','Flip Flops','PICT7063_thumb.jpg',130, 86,18,'							photo_855116.html');
												thumbnails[855217] = new thumbnail(855217,'40441','Drummers drumming','Trooping_thumb.1107.jpg',130, 86,18,'							photo_855217.html');
												thumbnails[855218] = new thumbnail(855218,'40441','Rowing','723_thumb.jpg',130, 85,18,'							photo_855218.html');
												thumbnails[907537] = new thumbnail(907537,'4614','Watermelon','PICT10811_thumb.jpg',130, 91,18,'							photo_907537.html');
												thumbnails[915604] = new thumbnail(915604,'69638','','PICT9487_thumb.jpg',130, 87,18,'							photo_915604.html');
												thumbnails[915607] = new thumbnail(915607,'69638','','HarryDracula_thumb.625.jpg',130, 87,18,'							photo_915607.html');
												thumbnails[915609] = new thumbnail(915609,'69638','','PICT9258_thumb.jpg',130, 87,18,'							photo_915609.html');
												thumbnails[915611] = new thumbnail(915611,'69638','','PICT8628_thumb.jpg',130, 195,18,'							photo_915611.html');
												thumbnails[915613] = new thumbnail(915613,'69638','','PICT10463_thumb.jpg',130, 195,18,'							photo_915613.html');
												thumbnails[915615] = new thumbnail(915615,'69638','','PICT1225_thumb.jpg',130, 195,18,'							photo_915615.html');
												thumbnails[915617] = new thumbnail(915617,'69638','','WithHairlight9303_thumb.jpg',130, 195,18,'							photo_915617.html');
												thumbnails[915623] = new thumbnail(915623,'69638','','PICT8755Grey_thumb.jpg',130, 87,18,'							photo_915623.html');
												thumbnails[915625] = new thumbnail(915625,'69638','','KissDJ_thumb.10357.jpg',130, 87,18,'							photo_915625.html');
												thumbnails[915632] = new thumbnail(915632,'69638','','WithH-S9002_thumb.jpg',130, 87,18,'							photo_915632.html');
												thumbnails[916048] = new thumbnail(916048,'40435','Watermelon','PICT108111_thumb.jpg',130, 91,18,'							photo_916048.html');
												thumbnails[916081] = new thumbnail(916081,'40441','','PICT6759 copy_thumb.jpg',130, 86,18,'							photo_916081.html');
												thumbnails[916080] = new thumbnail(916080,'40435','','PICT8878_thumb.jpg',130, 196,18,'							photo_916080.html');
												thumbnails[916077] = new thumbnail(916077,'40435','','Stereo@f22_thumb.1020.jpg',130, 87,18,'							photo_916077.html');
												thumbnails[916076] = new thumbnail(916076,'40435','','PICT0234_thumb.jpg',130, 102,18,'							photo_916076.html');
												thumbnails[96715] = new thumbnail(96715,'4614','Peppers','Peppers_thumb.D1263.jpg',130, 196,18,'							photo_96715.html');
												thumbnails[96716] = new thumbnail(96716,'4614','Kettle','PICT0457_thumb.MRW.jpg',130, 196,18,'							photo_96716.html');
												thumbnails[523601] = new thumbnail(523601,'4617','Banana boat','Damnoen_thumb.110.jpg',130, 197,18,'							photo_523601.html');
												thumbnails[96718] = new thumbnail(96718,'4614','Hellebore','HelleboreO_thumb.D0341.jpg',130, 201,18,'							photo_96718.html');
												thumbnails[44873] = new thumbnail(44873,'4614','Pimentoes','A36N66_thumb.jpg',130, 193,18,'							photo_44873.html');
												thumbnails[44874] = new thumbnail(44874,'4614','Raspberries','AAKM6C_thumb.jpg',130, 127,18,'							photo_44874.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[40441] = new gallery(40441,'191056','Action','gallery',[191056,191057,523495,523530,523588,523894,855217,855218,916081],0, 0, '', '																																																																																																							gallery_40441.html',0,0);
				  					galleries[28293] = new gallery(28293,'106205,44854,44838','Monochrome','gallery',[44838,44854,96714,106205,337561,337562,337566,523482,523527,523528,523887,523891],0, 0, '', '																																																																																																							gallery_28293.html',0,0);
				  					galleries[37520] = new gallery(37520,'475390','Nice 2006','gallery',[475388,475389,475390,475391,475392,475393,475394],0, 0, '40442', '																																																																																																							gallery_37520.html',0,0);
				  					galleries[69638] = new gallery(69638,'915632','Portraits','gallery',[915604,915607,915609,915611,915613,915615,915617,915623,915625,915632],0, 0, '', '																																																																																																							gallery_69638.html',0,0);
				  					galleries[40435] = new gallery(40435,'523483,191051,96721,64739','Product photography','gallery',[64739,96721,191051,523476,523477,523483,523485,523491,523584,855111,916048,916080,916077,916076],0, 0, '', '																																																																																																							gallery_40435.html',0,0);
				  					galleries[40442] = new gallery(40442,'523918,523494,475390,191054,64731,44871,44863,44855,44852,44843','Travel ','gallery',[],0, 0, '', '																																																																																																							gallery_40442.html',0,0);
				  					galleries[4617] = new gallery(4617,'523918,523494,64731,44855','Heading East','gallery',[44848,44855,44858,44862,44866,64731,64734,111239,523484,523488,523494,523883,523885,523918,855113,523601],0, 0, '40442', '																																																																																																							gallery_4617.html',0,0);
				  					galleries[4613] = new gallery(4613,'44871,44863','London architecture','gallery',[44859,44863,44864,44867,44871,64729,64733,208138,208139,523913],0, 0, '40442', '																																																																																																							gallery_4613.html',0,0);
				  					galleries[4616] = new gallery(4616,'523888,106195,103365,44844','Wildlife','gallery',[44844,44850,44851,103363,103365,103366,106195,523493,523888,855115],0, 0, '', '																																																																																																							gallery_4616.html',0,0);
				  					galleries[4615] = new gallery(4615,'191054,44852,44843','New England','gallery',[44843,44852,191054,191072,337544,523480],0, 0, '40442', '																																																																																																							gallery_4615.html',0,0);
				  					galleries[4614] = new gallery(4614,'191060,96718,96715,44874,44868,44856','Still life','gallery',[44856,44861,44868,191060,337563,523486,523490,523890,523916,855116,907537,96715,96716,96718,44873,44874],0, 0, '', '																																																																																																							gallery_4614.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '523888,523527,475390,337561,191056,191051,96718,64733,44874,44838';
imageSets[2] = '915632,523918,523888,523494,523483,475390,191060,191056,191054,191051,106205,106195,103365,96721,96718,96715,64739,64731,44874,44871,44868,44863,44856,44855,44854,44852,44844,44843,44838';
imageSets[3] = '916081,916080,916077,916076,916048,915632,915625,915623,915617,915615,915613,915611,915609,915607,915604,907537,855218,855217,855116,855115,855113,855111,523918,523916,523913,523894,523891,523890,523888,523887,523885,523883,523601,523588,523584,523530,523528,523527,523495,523494,523493,523491,523490,523488,523486,523485,523484,523483,523482,523480';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/chrisgeorge/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/chrisgeorge/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/chrisgeorge/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/chrisgeorge/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://www.clikchurch.com/chrisgeorge/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/chrisgeorge/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/chrisgeorge/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/chrisgeorge/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/chrisgeorge/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/chrisgeorge/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/chrisgeorge/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/chrisgeorge/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/chrisgeorge/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/chrisgeorge/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/chrisgeorge/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/chrisgeorge/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/chrisgeorge/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/chrisgeorge/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/chrisgeorge/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/chrisgeorge/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/chrisgeorge/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/chrisgeorge/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));		}, 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 = 'Chris George 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));    }        
    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="chrisgeorge@compuserve.com">';
	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="chrisgeorge@compuserve.com">';
	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;
	}
}

			

