window.thumbnails = new Object();
												thumbnails[5381187] = new thumbnail(5381187,'','','sort_01_20090610_120006_thumb.jpg',130, 87,1,'#');
												thumbnails[5381191] = new thumbnail(5381191,'','','sort_04_20090610_112836_thumb.jpg',130, 87,1,'#');
												thumbnails[5466158] = new thumbnail(5466158,'','','sort_06_franzferdinand_22_copy_thumb.jpg',130, 87,1,'#');
												thumbnails[7177791] = new thumbnail(7177791,'','Steve Punt and Hugh Dennis','puntndennnis_19_thumb.jpg',87, 130,1,'#');
												thumbnails[5076283] = new thumbnail(5076283,'','Thomas Vermaelen','30_Thomas_Vermaelen_01_copy_thumb.jpg',130, 87,1,'#');
												thumbnails[5381208] = new thumbnail(5381208,'','','sort_08_20090610_121235_thumb.jpg',130, 87,1,'#');
												thumbnails[5076181] = new thumbnail(5076181,'','Peter Mandelson','120_20081030_125539_copy_thumb.jpg',94, 130,1,'#');
												thumbnails[5076207] = new thumbnail(5076207,'','Simon Amstell and Dan Swimer','amstell_07_thumb.jpg',130, 87,1,'#');
												thumbnails[5563648] = new thumbnail(5563648,'','','13_20100226_154723_2_thumb.jpg',87, 130,1,'#');
												thumbnails[5563669] = new thumbnail(5563669,'','','14_20100226_154621_thumb.jpg',100, 130,1,'#');
												thumbnails[5076256] = new thumbnail(5076256,'','Grandfather and grandson','26_20080524_165404_copy_thumb.jpg',130, 87,1,'#');
												thumbnails[5466175] = new thumbnail(5466175,'','','sort_15_michael_perham_10_copy_thumb.jpg',130, 87,1,'#');
												thumbnails[5563672] = new thumbnail(5563672,'','','15_20100226_162649_2_thumb.jpg',86, 130,1,'#');
												thumbnails[5076196] = new thumbnail(5076196,'','Dylan Moran','160_dylanmoran_06_copy2_thumb.jpg',130, 87,1,'#');
												thumbnails[5381238] = new thumbnail(5381238,'','','sort_16_20090610_130205_thumb.jpg',130, 87,1,'#');
												thumbnails[5466180] = new thumbnail(5466180,'','','sort_16_boatrace_01_thumb.jpg',130, 93,1,'#');
												thumbnails[5563673] = new thumbnail(5563673,'','','16_20100226_162729_thumb.jpg',101, 130,1,'#');
												thumbnails[5563680] = new thumbnail(5563680,'','','19_20100226_171119_thumb.jpg',130, 83,1,'#');
												thumbnails[5563782] = new thumbnail(5563782,'','','20_20100226_165626_21_thumb.jpg',87, 130,1,'#');
												thumbnails[5563783] = new thumbnail(5563783,'','','21_20100226_165716_21_thumb.jpg',90, 130,1,'#');
												thumbnails[5563786] = new thumbnail(5563786,'','','22_20100226_162533_thumb.jpg',130, 83,1,'#');
												thumbnails[5382616] = new thumbnail(5382616,'','','sort_23_20090618_170937_thumb.jpg',130, 93,1,'#');
												thumbnails[5563789] = new thumbnail(5563789,'','','24_20100226_161517_thumb.jpg',99, 130,1,'#');
												thumbnails[5563791] = new thumbnail(5563791,'','','25_20100226_171230_thumb.jpg',101, 130,1,'#');
												thumbnails[5563793] = new thumbnail(5563793,'','','26_hartnettcover_thumb.jpg',99, 130,1,'#');
												thumbnails[5563794] = new thumbnail(5563794,'','','27_hartnett_thumb.jpg',130, 86,1,'#');
												thumbnails[5563795] = new thumbnail(5563795,'','','28_20100226_170833A_thumb.jpg',130, 82,1,'#');
												thumbnails[5563797] = new thumbnail(5563797,'','','29_20100226_163848_thumb.jpg',108, 130,1,'#');
												thumbnails[5563798] = new thumbnail(5563798,'','','30_20100226_165917-2_thumb.jpg',130, 103,1,'#');
												thumbnails[5563802] = new thumbnail(5563802,'','','31_20100226_171833_thumb.jpg',130, 83,1,'#');
												thumbnails[5616201] = new thumbnail(5616201,'','','32_BJ_2010_02_082-085-NEU-1_thumb.jpg',130, 87,1,'#');
												thumbnails[5563803] = new thumbnail(5563803,'','','32_highres_00000499605800-1_thumb.jpg',89, 130,1,'#');
												thumbnails[5563804] = new thumbnail(5563804,'','','33_20100226_161358_thumb.jpg',130, 80,1,'#');
												thumbnails[5563805] = new thumbnail(5563805,'','','34_20100226_162121_2_thumb.jpg',87, 130,1,'#');
												thumbnails[5563806] = new thumbnail(5563806,'','','35_20100226_162205-2_2_thumb.jpg',130, 104,1,'#');
												thumbnails[5563808] = new thumbnail(5563808,'','','36_20100226_171319_thumb.jpg',130, 81,1,'#');
												thumbnails[5563810] = new thumbnail(5563810,'','','37_gangof4_thumb.jpg',130, 82,1,'#');
												thumbnails[5563811] = new thumbnail(5563811,'','','38_20100226_171420_thumb.jpg',99, 130,1,'#');
												thumbnails[5563814] = new thumbnail(5563814,'','','40_20100226_171924_thumb.jpg',130, 81,1,'#');
												thumbnails[5076177] = new thumbnail(5076177,'382644','Ginger Baker','20091030_153330A_thumb.jpg',86, 130,1,'photo_5076177.html');
												thumbnails[7705044] = new thumbnail(7705044,'382644','Phoenix','20090422_183242_thumb.jpg',130, 87,1,'photo_7705044.html');
												thumbnails[7420767] = new thumbnail(7420767,'382644','Rumer','rumer_09_thumb.jpg',87, 130,1,'photo_7420767.html');
												thumbnails[5076197] = new thumbnail(5076197,'382644','Robert Harris','robertharris_05_copy_thumb.jpg',86, 130,1,'photo_5076197.html');
												thumbnails[5076258] = new thumbnail(5076258,'382644','Lissie','20100610_121619_thumb.jpg',130, 90,1,'photo_5076258.html');
												thumbnails[5262413] = new thumbnail(5262413,'382644','Fiona Shaw','10_fionashaw_10_copy_thumb.jpg',86, 130,1,'photo_5262413.html');
												thumbnails[5470967] = new thumbnail(5470967,'382644','Mackenzie Crook','20100122_175358_thumb.jpg',88, 130,1,'photo_5470967.html');
												thumbnails[5076199] = new thumbnail(5076199,'382644','Jamie Oliver','10_F_K_7761_copy_thumb.jpg',88, 130,1,'photo_5076199.html');
												thumbnails[7566781] = new thumbnail(7566781,'382644','The Pains of Being Pure at Heart','painsband_05_thumb.jpg',130, 96,1,'photo_7566781.html');
												thumbnails[7246487] = new thumbnail(7246487,'382644','Leila Aboulela','LeilaAboulela_03A_thumb.jpg',91, 130,1,'photo_7246487.html');
												thumbnails[5076247] = new thumbnail(5076247,'382644','Pro-woodland campaigner','20_EL10375-06_copy_thumb.jpg',130, 87,1,'photo_5076247.html');
												thumbnails[5076246] = new thumbnail(5076246,'382644','Craig, Grimsby','harbourplacedaycentre_09_thumb.jpg',130, 87,1,'photo_5076246.html');
												thumbnails[5262412] = new thumbnail(5262412,'382644','Tamsin Greig','50_20091215_124932_thumb.jpg',130, 87,1,'photo_5262412.html');
												thumbnails[5076243] = new thumbnail(5076243,'382644','Faye Weldon','17_fayweldon_06copy_thumb.jpg',87, 130,1,'photo_5076243.html');
												thumbnails[7098392] = new thumbnail(7098392,'382644','Cadbury Factory Worker','125_20091120_121624-4_thumb.jpg',130, 87,1,'photo_7098392.html');
												thumbnails[5076205] = new thumbnail(5076205,'382644','Jon Snow','140_20090519_220314-3_thumb.jpg',98, 130,1,'photo_5076205.html');
												thumbnails[5076206] = new thumbnail(5076206,'382644','Jeanette Winterson','15_jeanette_02_copy_thumb.jpg',86, 130,1,'photo_5076206.html');
												thumbnails[5076190] = new thumbnail(5076190,'382644','Damian Ortega','damianortega_05_thumb.jpg',92, 130,1,'photo_5076190.html');
												thumbnails[5076204] = new thumbnail(5076204,'382644','Jonathan Miller','13_jonathanmiller_12_copy3_thumb.jpg',84, 130,1,'photo_5076204.html');
												thumbnails[5076200] = new thumbnail(5076200,'382644','Southall grocery store owner','20081127_141139_thumb.jpg',130, 87,1,'photo_5076200.html');
												thumbnails[5076180] = new thumbnail(5076180,'382644','John Irving','80_johnirving_04_copy_thumb.jpg',86, 130,1,'photo_5076180.html');
												thumbnails[5143621] = new thumbnail(5143621,'382644','Mika','40_mika_13_thumb.jpg',98, 130,1,'photo_5143621.html');
												thumbnails[5076255] = new thumbnail(5076255,'382644','Butcher at the Ginger Pig','25_gingerpig_09_copy_thumb.jpg',88, 130,1,'photo_5076255.html');
												thumbnails[5076249] = new thumbnail(5076249,'382644','War veteran shortly after having his medals stolen','22_KT10205-07_thumb.jpg',87, 130,1,'photo_5076249.html');
												thumbnails[1897710] = new thumbnail(1897710,'205666','Bingo players in west London wait for the next game to start','20071016-145141A_1_thumb.jpg',130, 87,1,'photo_1897710.html');
												thumbnails[2147250] = new thumbnail(2147250,'121514','','tube_engineers_06_thumb.jpg',130, 87,1,'photo_2147250.html');
												thumbnails[3001955] = new thumbnail(3001955,'184907','','486_natural_bodybuilders_01_1_thumb.jpg',130, 87,1,'photo_3001955.html');
												thumbnails[5465992] = new thumbnail(5465992,'184907','','20081026_134119_1_thumb.jpg',87, 130,1,'photo_5465992.html');
												thumbnails[1824527] = new thumbnail(1824527,'205666','A bingo caller at work in Gala Bingo, Feltham, west London','20071016-150433_1_thumb.jpg',130, 87,1,'photo_1824527.html');
												thumbnails[2147239] = new thumbnail(2147239,'121514','','tube_engineers_02_thumb.jpg',130, 87,1,'photo_2147239.html');
												thumbnails[3001956] = new thumbnail(3001956,'184907','','20081026_131012_thumb.jpg',130, 86,1,'photo_3001956.html');
												thumbnails[5381188] = new thumbnail(5381188,'303571','','sort_02_20090610_112351_thumb.jpg',130, 87,1,'photo_5381188.html');
												thumbnails[1824530] = new thumbnail(1824530,'205666','Women concentrate on their bingo cards as the numbers are called at Mecca Bingo in Wandsworth, south London','bingo_03A_1_thumb.jpg',130, 87,1,'photo_1824530.html');
												thumbnails[2147242] = new thumbnail(2147242,'121514','','20080501_024649_tube1_thumb.jpg',130, 87,1,'photo_2147242.html');
												thumbnails[3001957] = new thumbnail(3001957,'184907','','20081026_131807A_thumb.jpg',130, 87,1,'photo_3001957.html');
												thumbnails[5381189] = new thumbnail(5381189,'303571','','sort_03_20090610_112735_thumb.jpg',130, 87,1,'photo_5381189.html');
												thumbnails[2147241] = new thumbnail(2147241,'121514','','tube_engineers_01_thumb.jpg',130, 87,1,'photo_2147241.html');
												thumbnails[2614999] = new thumbnail(2614999,'205666','A woman waits for the next bingo call','bingo_05A_1_thumb.jpg',130, 87,1,'photo_2614999.html');
												thumbnails[3001958] = new thumbnail(3001958,'184907','','486_natural_bodybuilders_02_1_thumb.jpg',130, 88,1,'photo_3001958.html');
												thumbnails[5465993] = new thumbnail(5465993,'184907','','20081026_135936_1_thumb.jpg',130, 87,1,'photo_5465993.html');
												thumbnails[1824531] = new thumbnail(1824531,'205666','Women concentrate on their bingo cards as the numbers are called at Gala Bingo Feltham, west London','20071016-152153B_1_thumb.jpg',130, 87,1,'photo_1824531.html');
												thumbnails[2147243] = new thumbnail(2147243,'121514','','tube_engineers_13_thumb.jpg',130, 87,1,'photo_2147243.html');
												thumbnails[3001959] = new thumbnail(3001959,'184907','','20081026_133415_thumb.jpg',130, 87,1,'photo_3001959.html');
												thumbnails[5381192] = new thumbnail(5381192,'303571','','sort_05_20090610_113025_thumb.jpg',130, 87,1,'photo_5381192.html');
												thumbnails[1824529] = new thumbnail(1824529,'205666','A couple enjoy a meal of chips and curry sauce during a game at Mecca Bingo in Wandsworth, south London','bingo_02A_1_thumb.jpg',130, 87,1,'photo_1824529.html');
												thumbnails[2147244] = new thumbnail(2147244,'121514','','tube_engineers_04_thumb.jpg',130, 87,1,'photo_2147244.html');
												thumbnails[3001960] = new thumbnail(3001960,'184907','','20081026_133928_thumb.jpg',130, 87,1,'photo_3001960.html');
												thumbnails[5381206] = new thumbnail(5381206,'303571','','sort_06_20090610_135226_thumb.jpg',130, 87,1,'photo_5381206.html');
												thumbnails[3377558] = new thumbnail(3377558,'205666','A woman gambles on a fruit machine after leaving the bingo hall','20071016-152524A_1_thumb.jpg',130, 87,1,'photo_3377558.html');
												thumbnails[3576715] = new thumbnail(3576715,'184907','','486_natural_bodybuilders_03_1_thumb.jpg',130, 87,1,'photo_3576715.html');
												thumbnails[5381207] = new thumbnail(5381207,'303571','','sort_07_20090610_123312_thumb.jpg',130, 87,1,'photo_5381207.html');
												thumbnails[2147246] = new thumbnail(2147246,'121514','','tube_engineers_05_thumb.jpg',130, 87,1,'photo_2147246.html');
												thumbnails[2841958] = new thumbnail(2841958,'205666','After a few bingo games, an elderly woman tries her luck on a fruit machine','20071016-152915A_1_thumb.jpg',130, 87,1,'photo_2841958.html');
												thumbnails[1824533] = new thumbnail(1824533,'205666','After a few bingo games, an elderly woman tries her luck on a fruit machine','20071016-152945A_1_thumb.jpg',87, 130,1,'photo_1824533.html');
												thumbnails[2147247] = new thumbnail(2147247,'121514','','07_2_FK_METRONET_01bw_thumb.jpg',87, 130,1,'photo_2147247.html');
												thumbnails[3001973] = new thumbnail(3001973,'184907','','20081026_141952_thumb.jpg',87, 130,1,'photo_3001973.html');
												thumbnails[5381209] = new thumbnail(5381209,'303571','','sort_09_20090610_123903_thumb.jpg',130, 87,1,'photo_5381209.html');
												thumbnails[3001976] = new thumbnail(3001976,'184907','','20081026_153524_thumb.jpg',87, 130,1,'photo_3001976.html');
												thumbnails[2147248] = new thumbnail(2147248,'121514','','tube_engineers_07_thumb.jpg',87, 130,1,'photo_2147248.html');
												thumbnails[1824528] = new thumbnail(1824528,'205666','A bingo caller at work in Mecca Bingo, Wandsworth, south London ','bingo_01A_1_thumb.jpg',130, 87,1,'photo_1824528.html');
												thumbnails[2147249] = new thumbnail(2147249,'121514','','20080501_021023_tube1_thumb.jpg',130, 91,1,'photo_2147249.html');
												thumbnails[3001975] = new thumbnail(3001975,'184907','','486_natural_bodybuilders_06_1_thumb.jpg',130, 87,1,'photo_3001975.html');
												thumbnails[5381216] = new thumbnail(5381216,'303571','','20090610_134044A_thumb.jpg',130, 87,1,'photo_5381216.html');
												thumbnails[3001966] = new thumbnail(3001966,'184907','','20081026_135332_thumb.jpg',130, 87,1,'photo_3001966.html');
												thumbnails[5381217] = new thumbnail(5381217,'303571','','sort_12_20090610_122811_thumb.jpg',130, 87,1,'photo_5381217.html');
												thumbnails[2147251] = new thumbnail(2147251,'121514','','tube_engineers_16_thumb.jpg',130, 87,1,'photo_2147251.html');
												thumbnails[2147252] = new thumbnail(2147252,'121514','','tube_engineers_08A_thumb.jpg',130, 87,1,'photo_2147252.html');
												thumbnails[3001968] = new thumbnail(3001968,'184907','','20081026_135635_thumb.jpg',130, 87,1,'photo_3001968.html');
												thumbnails[5381228] = new thumbnail(5381228,'303571','','sort_14_20090610_124841_thumb.jpg',130, 87,1,'photo_5381228.html');
												thumbnails[2147253] = new thumbnail(2147253,'121514','','tube_engineers_09A_thumb.jpg',130, 87,1,'photo_2147253.html');
												thumbnails[5381231] = new thumbnail(5381231,'303571','','sort_15_20090610_125942_thumb.jpg',130, 87,1,'photo_5381231.html');
												thumbnails[2147254] = new thumbnail(2147254,'121514','','tube_engineers_10_thumb.jpg',130, 87,1,'photo_2147254.html');
												thumbnails[3001970] = new thumbnail(3001970,'184907','','20081026_135735_thumb.jpg',130, 87,1,'photo_3001970.html');
												thumbnails[3001971] = new thumbnail(3001971,'184907','','20081026_141158_thumb.jpg',92, 130,1,'photo_3001971.html');
												thumbnails[5381240] = new thumbnail(5381240,'303571','','sort_17_20090610_132352_thumb.jpg',130, 87,1,'photo_5381240.html');
												thumbnails[3001972] = new thumbnail(3001972,'184907','','486_natural_bodybuilders_08_1_thumb.jpg',130, 87,1,'photo_3001972.html');
												thumbnails[5381241] = new thumbnail(5381241,'303571','','sort_18_20090618_163434_thumb.jpg',130, 87,1,'photo_5381241.html');
												thumbnails[5465995] = new thumbnail(5465995,'184907','','20081026_144834AA_1_thumb.jpg',130, 87,1,'photo_5465995.html');
												thumbnails[5382587] = new thumbnail(5382587,'303571','','sort_19_20090618_164430A_thumb.jpg',130, 87,1,'photo_5382587.html');
												thumbnails[5382588] = new thumbnail(5382588,'303571','','sort_20_20090618_164318_thumb.jpg',130, 87,1,'photo_5382588.html');
												thumbnails[5382612] = new thumbnail(5382612,'303571','','sort_22_20090618_170320_thumb.jpg',130, 87,1,'photo_5382612.html');
												thumbnails[5382617] = new thumbnail(5382617,'303571','','sort_24_20090618_163736_thumb.jpg',130, 87,1,'photo_5382617.html');
												thumbnails[5466904] = new thumbnail(5466904,'382645','','sort_01_20070718-100214_old_bailey_protest_copy_thumb.jpg',130, 87,1,'photo_5466904.html');
												thumbnails[7748931] = new thumbnail(7748931,'382645','','20100815_115016_1_thumb.jpg',130, 87,1,'photo_7748931.html');
												thumbnails[5466906] = new thumbnail(5466906,'382645','','sort_02_banksy_street_10_copy_thumb.jpg',130, 87,1,'photo_5466906.html');
												thumbnails[5466922] = new thumbnail(5466922,'382645','','sort_03_20090830_141753_copyD_thumb.jpg',130, 87,1,'photo_5466922.html');
												thumbnails[5466172] = new thumbnail(5466172,'382645','','sort_14_20090518_160726A_copy_thumb.jpg',130, 87,1,'photo_5466172.html');
												thumbnails[5466930] = new thumbnail(5466930,'382645','','sort_04_F_K_8085_copy_thumb.jpg',130, 87,1,'photo_5466930.html');
												thumbnails[5466934] = new thumbnail(5466934,'382645','','20110321_160650_thumb.jpg',130, 89,1,'photo_5466934.html');
												thumbnails[5466169] = new thumbnail(5466169,'382645','','sort_13_bush_protest_07A_thumb.jpg',130, 86,1,'photo_5466169.html');
												thumbnails[5466940] = new thumbnail(5466940,'382645','','sort_06_B1121_nottinghill_12_copyA_thumb.jpg',130, 88,1,'photo_5466940.html');
												thumbnails[5466941] = new thumbnail(5466941,'382645','','sort_07_nottinghill2_02_copy_thumb.jpg',130, 86,1,'photo_5466941.html');
												thumbnails[5466944] = new thumbnail(5466944,'382645','','sort_08_bankofengland_09_copy_thumb.jpg',130, 96,1,'photo_5466944.html');
												thumbnails[5466946] = new thumbnail(5466946,'382645','','sort_09_eastcoastnatexp_13_copy_thumb.jpg',130, 90,1,'photo_5466946.html');
												thumbnails[5466949] = new thumbnail(5466949,'382645','','sort_11_festival_hall_fountain_02_thumb.jpg',85, 130,1,'photo_5466949.html');
												thumbnails[5466952] = new thumbnail(5466952,'382645','','sort_12_FK0157-E_copy_thumb.jpg',130, 87,1,'photo_5466952.html');
												thumbnails[5466955] = new thumbnail(5466955,'382645','','sort_13_LE3974-FK804-11_copy_thumb.jpg',130, 87,1,'photo_5466955.html');
												thumbnails[5466959] = new thumbnail(5466959,'382645','','sort_14_486_DT4_copyB_thumb.jpg',130, 87,1,'photo_5466959.html');
												thumbnails[5466960] = new thumbnail(5466960,'382645','','sort_15_gaypride_13_copy_thumb.jpg',130, 87,1,'photo_5466960.html');
												thumbnails[5466962] = new thumbnail(5466962,'382645','','sort_16_gaypride_140_copyA_thumb.jpg',87, 130,1,'photo_5466962.html');
												thumbnails[5466177] = new thumbnail(5466177,'382645','','sort_17_20090626_191048A_copyB_thumb.jpg',130, 87,1,'photo_5466177.html');
												thumbnails[5466964] = new thumbnail(5466964,'382645','','sort_17_MO3G2377_copy_thumb.jpg',130, 87,1,'photo_5466964.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[382644] = new gallery(382644,'5076247','PORTRAITS','portraits',[5076177,7705044,7420767,5076197,5076258,5262413,5470967,5076199,7566781,7246487,5076247,5076246,5262412,5076243,7098392,5076205,5076206,5076190,5076204,5076200,5076180,5143621,5076255,5076249],0, 1, '', 'portraits.html',0,1);
				  					galleries[382645] = new gallery(382645,'7748931,5466964,5466962,5466960,5466959,5466955,5466952,5466949,5466946,5466944','SINGLES','othersingles',[5466904,7748931,5466906,5466922,5466172,5466930,5466934,5466169,5466940,5466941,5466944,5466946,5466949,5466952,5466955,5466959,5466960,5466962,5466177,5466964],0, 1, '', 'othersingles.html',0,1);
				  					galleries[121514] = new gallery(121514,'2147244,2147243','UNDERGROUND','doc',[2147250,2147239,2147242,2147241,2147243,2147244,2147246,2147247,2147248,2147249,2147251,2147252,2147253,2147254],0, 1, '', 'doc_121514.html',0,0);
				  					galleries[303571] = new gallery(303571,'5381240,5381192','TOWN CRIER','doc',[5381188,5381189,5381192,5381206,5381207,5381209,5381216,5381217,5381228,5381231,5381240,5381241,5382587,5382588,5382612,5382617],0, 1, '', 'doc_303571.html',0,0);
				  					galleries[205666] = new gallery(205666,'1824527','BINGO','doc',[1897710,1824527,1824530,2614999,1824531,1824529,3377558,2841958,1824533,1824528],0, 1, '', 'doc_205666.html',0,0);
				  					galleries[184907] = new gallery(184907,'3001959','BODYBUILDING','doc',[3001955,5465992,3001956,3001957,3001958,5465993,3001959,3001960,3576715,3001973,3001976,3001975,3001966,3001968,3001970,3001971,3001972,5465995],0, 1, '', 'doc_184907.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '7748931,7705044,7246487,7098392,5470967,5381240,5381231,5381216,5262413,5262412,5143621,5076258,5076249,5076246,5076206,5076205,5076199,5076197,5076180,5076177,3001976,3001973,3001972,3001959,3001955,2147250,2147246,2147241,1897710';
imageSets[2] = '5381240,5381192,5076247,3001959,2147244,2147243,1824527';
imageSets[3] = '5466964';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/fkphotographer/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/fkphotographer/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/fkphotographer/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/fkphotographer/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/fkphotographer/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/fkphotographer/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/fkphotographer/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/fkphotographer/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/fkphotographer/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/fkphotographer/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/fkphotographer/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/fkphotographer/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/fkphotographer/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/fkphotographer/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/fkphotographer/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/fkphotographer/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/fkphotographer/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/fkphotographer/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/fkphotographer/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/fkphotographer/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/fkphotographer/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/fkphotographer/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 += 'portraits.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 && 'portraits' != '') {
					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 = 'Frantzesco Kangaris - Photographer';
			    }
        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.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;
	}
}

			

