window.thumbnails = new Object();
												thumbnails[3274482] = new thumbnail(3274482,'','Dancers','dancersweb_thumb.jpg',130, 88,15,'#');
												thumbnails[3274489] = new thumbnail(3274489,'','Baron Charteris','Martin-Charteris,-Baron-Cha_thumb.jpg',130, 166,15,'#');
												thumbnails[3334757] = new thumbnail(3334757,'','','DSC_2126-pola_thumb.jpg',130, 158,15,'#');
												thumbnails[140809] = new thumbnail(140809,'198990','Beach Football Malaysia','Beach football_thumb.jpg',130, 87,15,'photo_140809.html');
												thumbnails[140812] = new thumbnail(140812,'198990','Brixton Polling Day 1997','Brixton 1997_thumb.jpg',130, 139,15,'photo_140812.html');
												thumbnails[140813] = new thumbnail(140813,'198990','Paris Boules by Eiffel Tower','Paris Boules_thumb.jpg',130, 87,15,'photo_140813.html');
												thumbnails[140817] = new thumbnail(140817,'198990','Spitfires Goodwood','spitfires_thumb.jpg',130, 85,15,'photo_140817.html');
												thumbnails[140820] = new thumbnail(140820,'13011','Boys on Bikes','Boys on bikes_thumb.jpg',130, 87,15,'photo_140820.html');
												thumbnails[140821] = new thumbnail(140821,'13011','Ty Stand seen from B&Q','Long Shot Polaroid scan_thumb.jpg',130, 102,15,'photo_140821.html');
												thumbnails[140822] = new thumbnail(140822,'13011','Ty Stand','Ty stand_thumb.jpg',130, 102,15,'photo_140822.html');
												thumbnails[140824] = new thumbnail(140824,'13012','City traders','City traders panoramic_thumb.jpg',130, 48,15,'photo_140824.html');
												thumbnails[140826] = new thumbnail(140826,'13012','Stock Exchange Annual Report','Stock exchange AR_thumb.jpg',130, 164,15,'photo_140826.html');
												thumbnails[140828] = new thumbnail(140828,'13012','Isabel Preysler Spainish Vogue','Isabel Preysler_thumb.jpg',130, 179,15,'photo_140828.html');
												thumbnails[140830] = new thumbnail(140830,'13012','Goodwood Race Revial','Goodwood Car_thumb.jpg',130, 74,15,'photo_140830.html');
												thumbnails[140832] = new thumbnail(140832,'13012','Goodwood Race Revival start','Goodwood_thumb.jpg',130, 197,15,'photo_140832.html');
												thumbnails[140835] = new thumbnail(140835,'13012','Goodwood, plane landing ','goodwoodair_thumb.jpg',130, 89,15,'photo_140835.html');
												thumbnails[140840] = new thumbnail(140840,'13012','Consumers Association Annual Report','Consumer Association_thumb.jpg',130, 122,15,'photo_140840.html');
												thumbnails[140846] = new thumbnail(140846,'13012','Isabella Norman Fashion for Country Life','Isabella Norman_thumb.jpg',130, 178,15,'photo_140846.html');
												thumbnails[140850] = new thumbnail(140850,'13012','MOT model test shot','Polaroid fashion_thumb.jpg',130, 148,15,'photo_140850.html');
												thumbnails[140851] = new thumbnail(140851,'13020','Spainish Vogue','Contact Sheet Spainish Vogue_thumb.jpg',130, 101,15,'photo_140851.html');
												thumbnails[140852] = new thumbnail(140852,'13020','Ana Botella Spainish Vogue','Spainish Vogue Contact_thumb.jpg',130, 163,15,'photo_140852.html');
												thumbnails[140854] = new thumbnail(140854,'13011','Portsmouth 0 Everton 1','Football 1_thumb.jpg',130, 86,15,'photo_140854.html');
												thumbnails[171267] = new thumbnail(171267,'13020','Polling Station Stockwell 1997','Brixton Polling Contact_thumb.jpg',130, 98,15,'photo_171267.html');
												thumbnails[171269] = new thumbnail(171269,'13011','Portsmouth v Leeds Fratton Park, Couple leave ground','Couple leaving ground_thumb.jpg',130, 83,15,'photo_171269.html');
												thumbnails[171271] = new thumbnail(171271,'13011','5x4 Contact Sheets Fratton Park ','5x4 contacts fratton park_thumb.jpg',130, 193,15,'photo_171271.html');
												thumbnails[176284] = new thumbnail(176284,'13012','Basement of The Natural History Museum, London for Country Life','Natural History Mus_thumb.jpg',130, 195,15,'photo_176284.html');
												thumbnails[179186] = new thumbnail(179186,'13008','Nabeel Musawi, Iraqi National Congress Hyde Park.','Nabeel Musawi Iraqi National Congress Hyde Park_thumb.jpg',130, 89,15,'photo_179186.html');
												thumbnails[182970] = new thumbnail(182970,'13012','Isabel Preysler for Spainish Vogue','colour polaroid_thumb.jpg',130, 190,15,'photo_182970.html');
												thumbnails[217609] = new thumbnail(217609,'199572','Isabel Presyler for Spanish Vogue ','Isabel Presyler_thumb.jpg',130, 195,15,'photo_217609.html');
												thumbnails[245547] = new thumbnail(245547,'13008','Stirling Moss','Stirling Mossbw_thumb.jpg',130, 88,15,'photo_245547.html');
												thumbnails[245548] = new thumbnail(245548,'199572','Damon Hill','Damon Hillsml _thumb.jpg',130, 88,15,'photo_245548.html');
												thumbnails[245549] = new thumbnail(245549,'199572','David Coultard Racing Driver','Courtaldsml_thumb.jpg',130, 192,15,'photo_245549.html');
												thumbnails[245550] = new thumbnail(245550,'13012','Goodwood Race Revival','Racing girlgoodwood_thumb.jpg',130, 194,15,'photo_245550.html');
												thumbnails[279383] = new thumbnail(279383,'13009','Volvo Race Start June 2nd 2006 Portsmouth ','Volvo Race Start 3jc_thumb.jpg',130, 50,15,'photo_279383.html');
												thumbnails[279390] = new thumbnail(279390,'13009','Volvo Race Start June 2nd 2006 Portsmouth<br>\r\n','Volvo Race Start 2jc_thumb.jpg',130, 86,15,'photo_279390.html');
												thumbnails[748049] = new thumbnail(748049,'198990','Gosport Boys ,Gosport 1986','gosport boysweb_thumb.jpg',130, 88,15,'photo_748049.html');
												thumbnails[748053] = new thumbnail(748053,'198990','Danger Keep Out, Gosport 1986','godsport estateweb_thumb.jpg',130, 88,15,'photo_748053.html');
												thumbnails[3249207] = new thumbnail(3249207,'13023','Guggenheim','guggenheim 2_thumb.jpg',130, 158,15,'photo_3249207.html');
												thumbnails[3261800] = new thumbnail(3261800,'13009','Paris','boats3_thumb.jpg',130, 86,15,'photo_3261800.html');
												thumbnails[3261821] = new thumbnail(3261821,'13009','Place des Vosges, Paris','desvosges1_thumb.jpg',130, 195,15,'photo_3261821.html');
												thumbnails[3261825] = new thumbnail(3261825,'198990','','manonbench1_thumb.jpg',130, 96,15,'photo_3261825.html');
												thumbnails[3261836] = new thumbnail(3261836,'198990','Thailand','Thailandumbrella_thumb.jpg',130, 194,15,'photo_3261836.html');
												thumbnails[3262040] = new thumbnail(3262040,'13009','Serpentine, London','BOATS_thumb.jpg',130, 98,15,'photo_3262040.html');
												thumbnails[3262627] = new thumbnail(3262627,'13023','Skyscrapers','Skyscraperweb1_thumb.jpg',130, 158,15,'photo_3262627.html');
												thumbnails[3262712] = new thumbnail(3262712,'13023','Moma','couple in Momacroppola_thumb.jpg',130, 158,15,'photo_3262712.html');
												thumbnails[3262715] = new thumbnail(3262715,'13023','Central Park','central park taxispola_thumb.jpg',130, 158,15,'photo_3262715.html');
												thumbnails[3262915] = new thumbnail(3262915,'198990','Paris Cafe.','french tables web_thumb.jpg',130, 197,15,'photo_3262915.html');
												thumbnails[3262917] = new thumbnail(3262917,'198990','Waiters, Paris','ParisWaiters_thumb.jpg',130, 197,15,'photo_3262917.html');
												thumbnails[3262924] = new thumbnail(3262924,'13009','Bread Seller, Portugal','Portugal bread seller_thumb.jpg',130, 98,15,'photo_3262924.html');
												thumbnails[3262928] = new thumbnail(3262928,'13009','Venice ','venice 1web_thumb.jpg',130, 192,15,'photo_3262928.html');
												thumbnails[3262933] = new thumbnail(3262933,'13009','Tate Modern, closing time.','tate legsweb_thumb.jpg',130, 87,15,'photo_3262933.html');
												thumbnails[3262941] = new thumbnail(3262941,'13023','Coke','cocacola_thumb.jpg',130, 158,15,'photo_3262941.html');
												thumbnails[3262944] = new thumbnail(3262944,'13009','Naples','Naples rain_thumb.jpg',130, 98,15,'photo_3262944.html');
												thumbnails[3262945] = new thumbnail(3262945,'13009','Legs, Portugal ','portugallegs_thumb.jpg',130, 173,15,'photo_3262945.html');
												thumbnails[3274491] = new thumbnail(3274491,'13012','Fashion','model-tes_thumb.jpg',130, 182,15,'photo_3274491.html');
												thumbnails[3326120] = new thumbnail(3326120,'13023','Brooklyn Bridge','Brooklyn Bridge_thumb.jpg',130, 158,15,'photo_3326120.html');
												thumbnails[3326125] = new thumbnail(3326125,'13023','Empire State','Empire State_thumb.jpg',130, 158,15,'photo_3326125.html');
												thumbnails[3326129] = new thumbnail(3326129,'13023','Shopping','Shopping_thumb.jpg',130, 158,15,'photo_3326129.html');
												thumbnails[3326131] = new thumbnail(3326131,'13023','Jazz Club 2am','Jazz Club 2am _thumb.jpg',130, 158,15,'photo_3326131.html');
												thumbnails[3326164] = new thumbnail(3326164,'13009','Eiffel Tower','Eiffel-Tower_thumb.jpg',130, 124,15,'photo_3326164.html');
												thumbnails[3374662] = new thumbnail(3374662,'13020','Lord Snowdon for the Daily Mail','contact web_thumb.jpg',130, 105,15,'photo_3374662.html');
												thumbnails[3374694] = new thumbnail(3374694,'13023','Poster','poster 1-pola_thumb.jpg',130, 158,15,'photo_3374694.html');
												thumbnails[3374696] = new thumbnail(3374696,'13023','Rain','SANY0248-pola01_thumb.jpg',130, 158,15,'photo_3374696.html');
												thumbnails[3374701] = new thumbnail(3374701,'13009','','slide pix web_thumb.jpg',130, 128,15,'photo_3374701.html');
												thumbnails[7544841] = new thumbnail(7544841,'409080','Physics 1','Physics_1_thumb.jpg',130, 98,15,'photo_7544841.html');
												thumbnails[7544846] = new thumbnail(7544846,'409080','Physics 2','GP090319_thumb.jpg',130, 98,15,'photo_7544846.html');
												thumbnails[7544866] = new thumbnail(7544866,'409080','Physics 3','Physics_3_thumb.jpg',130, 98,15,'photo_7544866.html');
												thumbnails[7544867] = new thumbnail(7544867,'409080','Physics 4','Physics_4_thumb.jpg',130, 98,15,'photo_7544867.html');
												thumbnails[7547160] = new thumbnail(7547160,'13009','South of France','South_of_France_675_x_1030_thumb.jpg',85, 130,15,'photo_7547160.html');
												thumbnails[140818] = new thumbnail(140818,'198990','Venice','Venice_thumb.jpg',130, 131,15,'photo_140818.html');
												thumbnails[176863] = new thumbnail(176863,'13023','Taxi','Carbridgeweb_thumb.jpg',130, 158,15,'photo_176863.html');
												thumbnails[171128] = new thumbnail(171128,'198990','Parc de Monceau Paris 1990','Paris dogs1_thumb.jpg',130, 130,15,'photo_171128.html');
												thumbnails[176861] = new thumbnail(176861,'13023','Guggenheim ','Guggenheimolaroidweb_thumb.jpg',130, 158,15,'photo_176861.html');
												thumbnails[140811] = new thumbnail(140811,'198990','Dartmoor, rain approaching','Boat on lake_thumb.jpg',130, 127,15,'photo_140811.html');
												thumbnails[176859] = new thumbnail(176859,'13023','Downtown','Downtown_thumb.jpg',130, 158,15,'photo_176859.html');
												thumbnails[3242557] = new thumbnail(3242557,'13023','Rain','Raingirlweb_thumb.jpg',130, 158,15,'photo_3242557.html');
												thumbnails[3244133] = new thumbnail(3244133,'13023','Park','parkpolaroidweb_thumb.jpg',130, 158,15,'photo_3244133.html');
												thumbnails[3244139] = new thumbnail(3244139,'13023','Diner','Dinerweb4_thumb.jpg',130, 158,15,'photo_3244139.html');
												thumbnails[3244415] = new thumbnail(3244415,'13023','Hats','Hatshopweb_thumb.jpg',130, 158,15,'photo_3244415.html');
												thumbnails[3244752] = new thumbnail(3244752,'13023','Bike','Bikeweb_thumb.jpg',130, 158,15,'photo_3244752.html');
												thumbnails[140798] = new thumbnail(140798,'13008','Sean Campion <i>Stones in his Pockets for Vanity Fair<i>','Sean Campion_thumb.jpg',130, 136,15,'photo_140798.html');
												thumbnails[179160] = new thumbnail(179160,'13008','Alistair Little, Chef for Country Life.','Alistair Little_thumb.jpg',130, 130,15,'photo_179160.html');
												thumbnails[3326365] = new thumbnail(3326365,'198990','Vienna','Vienna_thumb.jpg',130, 87,15,'photo_3326365.html');
												thumbnails[140788] = new thumbnail(140788,'13008','Eve Arnold <i>Photographer<i>','Eve Arnold_thumb.jpg',130, 148,15,'photo_140788.html');
												thumbnails[140790] = new thumbnail(140790,'13008','Miss Isabella Norman <i>for Country Life<i>','girl in blue_thumb.jpg',130, 152,15,'photo_140790.html');
												thumbnails[140779] = new thumbnail(140779,'13008','Ana Botella Spanish Vogue','Ana botella_thumb.jpg',130, 180,15,'photo_140779.html');
												thumbnails[140786] = new thumbnail(140786,'13008','Cowdrey Park Sussex <i>for Country Life<i>','Cowdrey_thumb.jpg',130, 181,15,'photo_140786.html');
												thumbnails[7547145] = new thumbnail(7547145,'409080','Nuns, New York 2010','NY_nuns_520_x_834_thumb.jpg',81, 130,15,'photo_7547145.html');
												thumbnails[140796] = new thumbnail(140796,'13008','Maria Grachvogel <Fashion Designer<i>','Maria Grachvogel_thumb.jpg',130, 179,15,'photo_140796.html');
												thumbnails[7547157] = new thumbnail(7547157,'409080','Stockholm, Winter 2011','Stockholm_Guards_676_x_1103_thumb.jpg',80, 130,15,'photo_7547157.html');
												thumbnails[140799] = new thumbnail(140799,'13008','Lord Snowdon','Snowdon_thumb.jpg',130, 164,15,'photo_140799.html');
												thumbnails[176282] = new thumbnail(176282,'13008','The Rt Hon William Hague Official Portrait when Leader of the Opposition','RtHon William Hague MP_thumb.jpg',130, 167,15,'photo_176282.html');
												thumbnails[7547513] = new thumbnail(7547513,'409080','Do Not Enter, New York 2010','Do_not_enter_834_x_522_thumb.jpg',130, 81,15,'photo_7547513.html');
												thumbnails[140805] = new thumbnail(140805,'13008','Isabel Preysler <i>Spanish Vogue<i>','Spainish Vogue_thumb.jpg',130, 178,15,'photo_140805.html');
												thumbnails[140810] = new thumbnail(140810,'198990','Spanish Beach','beach poster _thumb.jpg',130, 201,15,'photo_140810.html');
												thumbnails[3374576] = new thumbnail(3374576,'204215','I have taken photographs since the age of13. After studying at Exeter College of Art I spent six years in London assisting Lord Snowdon. I then was a freelance photographer working for Design Groups and editiorial clients. I now work on long term photographic projects. ','DSC_2126-pola1_thumb.jpg',130, 158,15,'photo_3374576.html');
												thumbnails[3244906] = new thumbnail(3244906,'198000','','Naomi_thumb.jpg',130, 195,15,'photo_3244906.html');
												thumbnails[3245110] = new thumbnail(3245110,'198000','','Naomi-2_thumb.jpg',130, 86,15,'photo_3245110.html');
												thumbnails[3274498] = new thumbnail(3274498,'198000','','caro-wedding-pixweb_thumb.jpg',130, 197,15,'photo_3274498.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[204215] = new gallery(204215,'3374576','About ','section38900',[3374576],0, 0, '', 'section38900.html',0,1);
				  					galleries[199571] = new gallery(199571,'245548,245547,217609,179186,176282,140805,140799,140798,140796,140790,140788,140779','People ','gallery',[],0, 0, '', 'gallery_199571.html',0,0);
				  					galleries[13008] = new gallery(13008,'245547,179186,176282,140805,140799,140798,140796,140790,140788,140779','People in black and white','gallery',[179186,245547,140798,179160,140788,140790,140779,140786,140796,140799,176282,140805],0, 0, '199571', 'gallery_13008.html',0,0);
				  					galleries[199572] = new gallery(199572,'245548,217609','People in Colour','gallery',[217609,245548,245549],0, 0, '199571', 'gallery_199572.html',0,0);
				  					galleries[13011] = new gallery(13011,'171269,140854,140822,140820','Projects - Fratton Park Portsmouth','gallery',[140820,140821,140822,140854,171269,171271],0, 0, '', 'gallery_13011.html',0,0);
				  					galleries[198992] = new gallery(198992,'7547160,3374701,3326365,3326164,3262933,3262928,3262917,3262915,3261836,3261821,3261800,748053,748049,279390,279383,140818,140817,140813,140812,140811,140810,140809','Travel','gallery',[],0, 0, '', 'gallery_198992.html',0,0);
				  					galleries[198990] = new gallery(198990,'3326365,3262917,3262915,3261836,748053,748049,140818,140817,140813,140812,140811,140810,140809','Travel in black and white','gallery',[140809,140812,140813,140817,748049,748053,3261825,3261836,3262915,3262917,140818,171128,140811,3326365,140810],0, 0, '198992', 'gallery_198990.html',0,0);
				  					galleries[13009] = new gallery(13009,'7547160,3374701,3326164,3262933,3262928,3261821,3261800,279390,279383','Travel in colour','gallery',[279383,279390,3261800,3261821,3262040,3262924,3262928,3262933,3262944,3262945,3326164,3374701,7547160],0, 0, '198992', 'gallery_13009.html',0,0);
				  					galleries[198000] = new gallery(198000,'3244906','Wedding Photography ','section176222',[3244906,3245110,3274498],0, 0, '', 'section176222.html',0,1);
				  					galleries[13012] = new gallery(13012,'3274491,176284,140850,140846,140840,140835,140832,140830,140828,140826,140824','Commissioned','gallery',[140824,140826,140828,140830,140832,140835,140840,140846,140850,176284,182970,245550,3274491],0, 0, '', 'gallery_13012.html',0,0);
				  					galleries[13020] = new gallery(13020,'3374662,171267,140852,140851','Contact Sheets','gallery',[140851,140852,171267,3374662],0, 0, '', 'gallery_13020.html',0,0);
				  					galleries[13023] = new gallery(13023,'3374696,3326131,3326129,3326125,3326120,3262712,3262627,3249207,3244752,3244415,176863,176859','New York','gallery',[3249207,3262627,3262712,3262715,3262941,3326120,3326125,3326129,3326131,3374694,3374696,176863,176861,176859,3242557,3244133,3244139,3244415,3244752],0, 0, '', 'gallery_13023.html',0,0);
				  					galleries[409080] = new gallery(409080,'7547513,7547157,7547145,7544867,7544866,7544846,7544841','New Work','gallery',[7544841,7544846,7544866,7544867,7547145,7547157,7547513],0, 0, '', 'gallery_409080.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '7547513,7547160,7547157,7547145,7544867,7544866,7544846,7544841,3374701,3374696,3374662,3326365,3326164,3326131,3326129,3326125,3326120,3274491,3274489,3274482,3262933,3262928,3262924,3262917,3262915,3262712,3262627,3261836,3261821,3261800,3249207,3244752,3244415,3244139,3242557,748053,748049,279390,279383,245548,245547,217609,179186,179160,176863,176861,176859,171269,171267,171128,140854,140852,140851,140850,140846,140840,140835,140832,140830,140828,140826,140824,140820,140818,140817,140813,140812,140811,140810,140809,140805,140799,140798,140796,140790,140788,140779';
imageSets[2] = '7547513,7547160,7547157,7547145,7544867,7544866,7544846,7544841,3374701,3374696,3374662,3326365,3326164,3326131,3326129,3326125,3326120,3274491,3274489,3274482,3262933,3262928,3262917,3262915,3262712,3262627,3261836,3261821,3261800,3249207,3244906,3244752,3244415,748053,748049,279390,279383,245548,245547,217609,179186,176863,176859,176284,176282,171269,171267,140854,140852,140851,140850,140846,140840,140835,140832,140830,140828,140826,140824,140822,140820,140818,140817,140813,140812,140811,140810,140809,140805,140799,140798,140796,140790,140788,140779';
imageSets[3] = '7547513,7547160,7547157,7547145,7544867,7544866,7544846,7544841,140779';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/glp7007/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/glp7007/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/glp7007/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/glp7007/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/glp7007/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/glp7007/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/glp7007/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/glp7007/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/glp7007/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/glp7007/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/glp7007/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/glp7007/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/glp7007/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/glp7007/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/glp7007/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/glp7007/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/glp7007/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/glp7007/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/glp7007/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/glp7007/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/glp7007/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/glp7007/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 = 'www.grahampiggott.com: ' + 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>';
	}
					
				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>Order this print:</p>';
				temp = temp + '<p class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> ' + (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 + '<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;
	}
}

			

