window.thumbnails = new Object();
												thumbnails[4072632] = new thumbnail(4072632,'244875','All at sea','All_at_sea_thumb.jpg',130, 130,15,'photo_4072632.html');
												thumbnails[4072638] = new thumbnail(4072638,'244878','Charlie\'s Mate','Charlies_Mate_thumb.jpg',130, 130,15,'photo_4072638.html');
												thumbnails[4072640] = new thumbnail(4072640,'244874','China Dolls','China_Dolls_thumb.jpg',130, 130,15,'photo_4072640.html');
												thumbnails[4072642] = new thumbnail(4072642,'244874','New Dawn','New_dawn_thumb.jpg',130, 130,15,'photo_4072642.html');
												thumbnails[4072643] = new thumbnail(4072643,'244874','Passage','Passage_thumb.jpg',130, 130,15,'photo_4072643.html');
												thumbnails[4072652] = new thumbnail(4072652,'244858','','JG2_thumb.jpg',130, 130,15,'photo_4072652.html');
												thumbnails[4072653] = new thumbnail(4072653,'244858','','Love_Is_thumb.jpg',130, 130,15,'photo_4072653.html');
												thumbnails[4072669] = new thumbnail(4072669,'244876','','Wee_Meg_Thumb.jpg',130, 130,15,'photo_4072669.html');
												thumbnails[4092863] = new thumbnail(4092863,'245705','Passing Storm','Lighthouse_thumb.jpg',130, 130,15,'photo_4092863.html');
												thumbnails[4092866] = new thumbnail(4092866,'244871','Lake Tarawera','_MG_8016_thumb.jpg',130, 130,15,'photo_4092866.html');
												thumbnails[4093050] = new thumbnail(4093050,'244871','','Earths_fury_thumb.jpg',130, 130,15,'photo_4093050.html');
												thumbnails[4093138] = new thumbnail(4093138,'244871','Fire Mountain','Fire_Mountain_thumb.jpg',130, 130,15,'photo_4093138.html');
												thumbnails[4093422] = new thumbnail(4093422,'244871','Rainbow trout','Rainbow_Trout_2_thumb.jpg',130, 130,15,'photo_4093422.html');
												thumbnails[4093423] = new thumbnail(4093423,'244871','Rainbow\'s end','Rainbows_end_Natrue_9_thumb.jpg',130, 130,15,'photo_4093423.html');
												thumbnails[4093425] = new thumbnail(4093425,'244871','Bush walk to Tarawera Falls','Tarawera_Falls_walk_thumb.jpg',130, 130,15,'photo_4093425.html');
												thumbnails[4093426] = new thumbnail(4093426,'244871','Tarawera River','Tarawera_River_-_A3_thumb.jpg',130, 130,15,'photo_4093426.html');
												thumbnails[4093706] = new thumbnail(4093706,'244872','Coastline at Waihi','0708_Ritchies_001-Edit_thumb.jpg',130, 130,15,'photo_4093706.html');
												thumbnails[4094245] = new thumbnail(4094245,'244872','Autumn\'s last breathe','Autumns_last_breathe_thumb.jpg',130, 130,15,'photo_4094245.html');
												thumbnails[4094249] = new thumbnail(4094249,'244872','Boiling Mud','Boiling_mud_Kuirau_Park_thumb.jpg',130, 130,15,'photo_4094249.html');
												thumbnails[4094255] = new thumbnail(4094255,'244872','Akaroa, Christchurch','CRW_2197Akaroa-Edit_thumb.jpg',130, 130,15,'photo_4094255.html');
												thumbnails[4094257] = new thumbnail(4094257,'244872','','Fern_fromdadjIMG_0410_thumb.jpg',130, 130,15,'photo_4094257.html');
												thumbnails[4094260] = new thumbnail(4094260,'244872','Fisherman, Lake Hawea','Fisherman_Lake_Hawea_NZ_thumb.jpg',130, 130,15,'photo_4094260.html');
												thumbnails[4094268] = new thumbnail(4094268,'244872','Lake Wanaka','Fisherman_Lake_Wanaka_NZ_thumb.jpg',130, 130,15,'photo_4094268.html');
												thumbnails[4094272] = new thumbnail(4094272,'244872','Riverton, South Island','Fishing_boat_Riverton_thumb.jpg',130, 130,15,'photo_4094272.html');
												thumbnails[4094277] = new thumbnail(4094277,'244872','Cabbage Tree Country','IMG_6894_BW_unsized_thumb.jpg',130, 130,15,'photo_4094277.html');
												thumbnails[4094290] = new thumbnail(4094290,'244872','Limestone Downs','Limestone_Downs_thumb.jpg',130, 130,15,'photo_4094290.html');
												thumbnails[4094292] = new thumbnail(4094292,'244872','Margrain Sunset','Margrain_Sunset_thumb.jpg',130, 130,15,'photo_4094292.html');
												thumbnails[4094298] = new thumbnail(4094298,'244872','Dairy Herd, Central North Island','New_Zealand_Dairy_herd_thumb.jpg',130, 130,15,'photo_4094298.html');
												thumbnails[4094302] = new thumbnail(4094302,'244872','Palliser Sunrise','Palliser_sunrise_thumb.jpg',130, 130,15,'photo_4094302.html');
												thumbnails[4094307] = new thumbnail(4094307,'244872','Taranaki Coastline','Taranaki_Coastline_thumb.jpg',130, 130,15,'photo_4094307.html');
												thumbnails[4094455] = new thumbnail(4094455,'244872','Te Puia','Te_Puia_Night_9_thumb.jpg',130, 130,15,'photo_4094455.html');
												thumbnails[4094463] = new thumbnail(4094463,'244872','The Church','The_church_thumb.jpg',130, 130,15,'photo_4094463.html');
												thumbnails[4094470] = new thumbnail(4094470,'244872','Tolaga Tunnel','Tolaga_tunnel_thumb.jpg',130, 130,15,'photo_4094470.html');
												thumbnails[4094475] = new thumbnail(4094475,'244872','Turnbull River','Turnbull_River_West_Coasst_NZ_thumb.jpg',130, 130,15,'photo_4094475.html');
												thumbnails[4099823] = new thumbnail(4099823,'244874','Pearl River, Guanzhou','Pearl_River_Romance_Night_Photo_9_thumb.jpg',130, 130,15,'photo_4099823.html');
												thumbnails[4100217] = new thumbnail(4100217,'244878','','_MG_7800_thumb.jpg',130, 130,15,'photo_4100217.html');
												thumbnails[4100219] = new thumbnail(4100219,'244878','','Ching_colour_feb07_copy_thumb.jpg',130, 130,15,'photo_4100219.html');
												thumbnails[4100225] = new thumbnail(4100225,'244878','','Classic_resized_thumb.jpg',130, 130,15,'photo_4100225.html');
												thumbnails[4100228] = new thumbnail(4100228,'244878','','Rainbow_trout_1_thumb.jpg',130, 130,15,'photo_4100228.html');
												thumbnails[4100239] = new thumbnail(4100239,'244876','','Copy_of__MG_0063_thumb.jpg',130, 130,15,'photo_4100239.html');
												thumbnails[4100241] = new thumbnail(4100241,'244876','','Copy_of_IMG_0262_thumb.jpg',130, 130,15,'photo_4100241.html');
												thumbnails[4100243] = new thumbnail(4100243,'244876','','Copy_of__MG_8772_thumb.jpg',130, 130,15,'photo_4100243.html');
												thumbnails[4102127] = new thumbnail(4102127,'245706','The autumn gardener','_MG_0409_thumb.jpg',130, 130,15,'photo_4102127.html');
												thumbnails[4102128] = new thumbnail(4102128,'245706','New Zealand native falcon','_MG_7200_copy_thumb.jpg',130, 130,15,'photo_4102128.html');
												thumbnails[4102130] = new thumbnail(4102130,'245706','Industrial decay','Industrial_Decay_thumb.jpg',130, 130,15,'photo_4102130.html');
												thumbnails[4102132] = new thumbnail(4102132,'245706','The walk','The_Walk_thumb.jpg',130, 130,15,'photo_4102132.html');
												thumbnails[4102133] = new thumbnail(4102133,'245706','Warped','Warped_thumb.jpg',130, 130,15,'photo_4102133.html');
												thumbnails[4102134] = new thumbnail(4102134,'244878','Rose','Rose_in_progress_15_copy_thumb.jpg',130, 130,15,'photo_4102134.html');
												thumbnails[4102136] = new thumbnail(4102136,'244858','','_MG_4647-2_thumb.jpg',130, 130,15,'photo_4102136.html');
												thumbnails[4102140] = new thumbnail(4102140,'244858','','195IMG_5794_thumb.jpg',130, 130,15,'photo_4102140.html');
												thumbnails[4102143] = new thumbnail(4102143,'244858','','Carried_Away_thumb.jpg',130, 130,15,'photo_4102143.html');
												thumbnails[4102144] = new thumbnail(4102144,'244858','','IMG_2547_thumb.jpg',130, 130,15,'photo_4102144.html');
												thumbnails[4102146] = new thumbnail(4102146,'244858','','IMG_2980_thumb.jpg',130, 130,15,'photo_4102146.html');
												thumbnails[4102148] = new thumbnail(4102148,'244858','','IMG_3070BW_thumb.jpg',130, 130,15,'photo_4102148.html');
												thumbnails[4102149] = new thumbnail(4102149,'244858','','IMG_9969The_Congregation_thumb.jpg',130, 130,15,'photo_4102149.html');
												thumbnails[4102151] = new thumbnail(4102151,'244858','','Waiting_thumb.jpg',130, 130,15,'photo_4102151.html');
												thumbnails[5632011] = new thumbnail(5632011,'244858','','KN03_thumb.jpg',130, 130,15,'photo_5632011.html');
												thumbnails[5632016] = new thumbnail(5632016,'244858','','KN05_thumb.jpg',130, 130,15,'photo_5632016.html');
												thumbnails[7609469] = new thumbnail(7609469,'244858','','DH3924_thumb.jpg',130, 130,15,'photo_7609469.html');
												thumbnails[7609470] = new thumbnail(7609470,'244858','','DH4512_thumb.jpg',130, 130,15,'photo_7609470.html');
												thumbnails[7609471] = new thumbnail(7609471,'244858','','DH4557_thumb.jpg',130, 130,15,'photo_7609471.html');
												thumbnails[7609472] = new thumbnail(7609472,'244858','','DH4589_Thumb.jpg',130, 130,15,'photo_7609472.html');
												thumbnails[7609475] = new thumbnail(7609475,'244858','','IMG_2167Text_thumb.jpg',130, 130,15,'photo_7609475.html');
												thumbnails[7609476] = new thumbnail(7609476,'244858','','146_thumb.jpg',130, 130,15,'photo_7609476.html');
												thumbnails[7609477] = new thumbnail(7609477,'244858','','252_thumb.jpg',130, 130,15,'photo_7609477.html');
												thumbnails[7609478] = new thumbnail(7609478,'244858','','317_thumb.jpg',130, 130,15,'photo_7609478.html');
												thumbnails[7609482] = new thumbnail(7609482,'244858','','MK0324_thumb.jpg',130, 130,15,'photo_7609482.html');
												thumbnails[7609485] = new thumbnail(7609485,'244858','','KC0230BW_thumb.jpg',130, 130,15,'photo_7609485.html');
												thumbnails[7609487] = new thumbnail(7609487,'244858','','KC0794_thumb.jpg',130, 130,15,'photo_7609487.html');
												thumbnails[7609488] = new thumbnail(7609488,'244858','','277_MG_6339BW_thumb.jpg',130, 130,15,'photo_7609488.html');
												thumbnails[7609489] = new thumbnail(7609489,'244858','','VR1263_thumb.jpg',130, 130,15,'photo_7609489.html');
												thumbnails[7609490] = new thumbnail(7609490,'244858','','KC0778_thumb.jpg',130, 130,15,'photo_7609490.html');
												thumbnails[7609491] = new thumbnail(7609491,'244858','','MK0632_thumb.jpg',130, 130,15,'photo_7609491.html');
												thumbnails[7609357] = new thumbnail(7609357,'244875','Icy Hills, Alaksa','Icy-Hills_thumb.jpg',130, 130,15,'photo_7609357.html');
												thumbnails[4072673] = new thumbnail(4072673,'244878','Robert','Robert_thumb.jpg',130, 130,15,'photo_4072673.html');
												thumbnails[4100281] = new thumbnail(4100281,'245706','Shadows by design','Shadows_by_design_thumb.jpg',130, 130,15,'photo_4100281.html');
												thumbnails[5635551] = new thumbnail(5635551,'244878','','Vaun_thumb.jpg',130, 130,15,'photo_5635551.html');
												thumbnails[4094305] = new thumbnail(4094305,'244872','School bus route','School_bus_route_thumb.jpg',130, 130,15,'photo_4094305.html');
												thumbnails[4100312] = new thumbnail(4100312,'245706','Enchanted Walk','Enchanted_walk_8x12_thumb.jpg',130, 130,15,'photo_4100312.html');
												thumbnails[4093424] = new thumbnail(4093424,'244871','Snowfall','Snowy_Mount_Tarawera_thumb.jpg',130, 130,15,'photo_4093424.html');
												thumbnails[4072670] = new thumbnail(4072670,'244878','Go Girl','Go_girl_thumb.jpg',130, 130,15,'photo_4072670.html');
												thumbnails[4072663] = new thumbnail(4072663,'244878','Warrior with Pukaea','Warrior_with_Pukaea_thumb.jpg',130, 130,15,'photo_4072663.html');
												thumbnails[4072641] = new thumbnail(4072641,'244874','Misfit','Misfit_thumb.jpg',130, 130,15,'photo_4072641.html');
												thumbnails[4094467] = new thumbnail(4094467,'244872','Thermal Mud','Thermal_mud_thumb.jpg',130, 130,15,'photo_4094467.html');
												thumbnails[4100296] = new thumbnail(4100296,'245706','On a painted ocean','On_a_painted_ocean_Black_and_White_9_thumb.jpg',130, 130,15,'photo_4100296.html');
												thumbnails[4100299] = new thumbnail(4100299,'245706','Shearers hands','Shearers_hands_thumb.jpg',130, 130,15,'photo_4100299.html');
												thumbnails[4094287] = new thumbnail(4094287,'244872','Lake Rotora','Lake_Rotoroa_thumb.jpg',130, 130,15,'photo_4094287.html');
												thumbnails[4072634] = new thumbnail(4072634,'244875','Manitoulin Afternoon','Manatoulin_Afternoon_thumb.jpg',130, 130,15,'photo_4072634.html');
												thumbnails[4100314] = new thumbnail(4100314,'245706','Done and dusted','Done_and_dusted_colour_thumb.jpg',130, 130,15,'photo_4100314.html');
												thumbnails[5632009] = new thumbnail(5632009,'244858','','KN02_thumb.jpg',130, 130,15,'photo_5632009.html');
												thumbnails[7609480] = new thumbnail(7609480,'244858','','381_thumb.jpg',130, 130,15,'photo_7609480.html');
												thumbnails[7609484] = new thumbnail(7609484,'244858','','IMG_2167Text1_thumb.jpg',130, 130,15,'photo_7609484.html');
												thumbnails[4072633] = new thumbnail(4072633,'244875','Michigan Magic','Magic_on_Michigan_thumb.jpg',130, 130,15,'photo_4072633.html');
												thumbnails[4072644] = new thumbnail(4072644,'244874','Two\'s Company','Two_is_company_thumb.jpg',130, 130,15,'photo_4072644.html');
												thumbnails[4072668] = new thumbnail(4072668,'244876','','My_Daughter_thumb.jpg',130, 130,15,'photo_4072668.html');
												thumbnails[4072671] = new thumbnail(4072671,'244878','','Grumpy_thumb.jpg',130, 130,15,'photo_4072671.html');
												thumbnails[4093419] = new thumbnail(4093419,'244871','Mount Tarawera','Mt_Tarawera_-_1_A3_thumb.jpg',130, 130,15,'photo_4093419.html');
												thumbnails[4093421] = new thumbnail(4093421,'244871','Summer rainbow','Rainbow_over_Tarawera_thumb.jpg',130, 130,15,'photo_4093421.html');
												thumbnails[5632006] = new thumbnail(5632006,'244858','','KN01_thumb.jpg',130, 130,15,'photo_5632006.html');
												thumbnails[7609481] = new thumbnail(7609481,'244858','','3671_thumb.jpg',130, 130,15,'photo_7609481.html');
												thumbnails[7609483] = new thumbnail(7609483,'244858','','VR0566_thumb.jpg',130, 130,15,'photo_7609483.html');
												thumbnails[4102147] = new thumbnail(4102147,'244858','','IMG_2983-BW_thumb.jpg',93, 130,15,'photo_4102147.html');
												thumbnails[4072645] = new thumbnail(4072645,'244878','Watching','Watching_thumb.jpg',130, 130,15,'photo_4072645.html');
												thumbnails[4072649] = new thumbnail(4072649,'244858','','JC4_thumb.jpg',130, 130,15,'photo_4072649.html');
												thumbnails[4094281] = new thumbnail(4094281,'244872','Jerusalem Morning','Jerusalem_Morning_thumb.jpg',130, 130,15,'photo_4094281.html');
												thumbnails[4094293] = new thumbnail(4094293,'244872','Mokau Morning','Mokau_morning_thumb.jpg',130, 130,15,'photo_4094293.html');
												thumbnails[4094295] = new thumbnail(4094295,'244872','Morning Mist','Morning_Mist_thumb.jpg',130, 130,15,'photo_4094295.html');
												thumbnails[4099817] = new thumbnail(4099817,'245706','The Pretty Witches','the_pretty_witches_thumb.jpg',130, 130,15,'photo_4099817.html');
												thumbnails[4072651] = new thumbnail(4072651,'244858','','JG1_thumb.jpg',130, 130,15,'photo_4072651.html');
												thumbnails[4072659] = new thumbnail(4072659,'244858','','TA8_thumb.jpg',130, 130,15,'photo_4072659.html');
												thumbnails[4094140] = new thumbnail(4094140,'244872','A dot on the Landscape - Omarama Ranges','A_dot_on_the_landscape_2_thumb.jpg',130, 130,15,'photo_4094140.html');
												thumbnails[4072662] = new thumbnail(4072662,'244872','Waiotapu Stilts','Waiotapu_stilts_thumb.jpg',130, 130,15,'photo_4072662.html');
												thumbnails[4072658] = new thumbnail(4072658,'244858','','TA6_thumb.jpg',130, 130,15,'photo_4072658.html');
												thumbnails[4072650] = new thumbnail(4072650,'244858','','JC5_thumb.jpg',130, 130,15,'photo_4072650.html');
												thumbnails[4072654] = new thumbnail(4072654,'244858','','TA1_thumb.jpg',130, 130,15,'photo_4072654.html');
												thumbnails[4102137] = new thumbnail(4102137,'244858','','_MG_4697_thumb.jpg',130, 130,15,'photo_4102137.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[245705] = new gallery(245705,'4092863','Canada','gallery',[4092863],0, 0, '244873', 'gallery_245705.html',0,0);
				  					galleries[244874] = new gallery(244874,'4072644','China','gallery',[4072640,4072642,4072643,4099823,4072641,4072644],0, 0, '244873', 'gallery_244874.html',0,0);
				  					galleries[244871] = new gallery(244871,'4093426,4093425,4093424,4093423,4093422,4093421,4093419,4093138,4093050,4092866','Lake Tarawera','gallery',[4092866,4093050,4093138,4093422,4093423,4093425,4093426,4093424,4093419,4093421],0, 0, '244859', 'gallery_244871.html',0,0);
				  					galleries[244872] = new gallery(244872,'4094305','Our country','gallery',[4093706,4094245,4094249,4094255,4094257,4094260,4094268,4094272,4094277,4094290,4094292,4094298,4094302,4094307,4094455,4094463,4094470,4094475,4094305,4094467,4094287,4094281,4094293,4094295,4094140,4072662],0, 0, '244859', 'gallery_244872.html',0,0);
				  					galleries[244875] = new gallery(244875,'4072634','USA','gallery',[4072632,7609357,4072634,4072633],0, 0, '244873', 'gallery_244875.html',0,0);
				  					galleries[244858] = new gallery(244858,'4072653','Weddings','gallery',[4072652,4072653,4102136,4102140,4102143,4102144,4102146,4102148,4102149,4102151,5632011,5632016,7609469,7609470,7609471,7609472,7609475,7609476,7609477,7609478,7609482,7609485,7609487,7609488,7609489,7609490,7609491,5632009,7609480,7609484,5632006,7609481,7609483,4102147,4072649,4072651,4072659,4072658,4072650,4072654,4102137],0, 0, '', 'gallery_244858.html',0,0);
				  					galleries[244876] = new gallery(244876,'4100243,4100241,4100239,4072669,4072668','Little ones','gallery',[4072669,4100239,4100241,4100243,4072668],0, 0, '', 'gallery_244876.html',0,0);
				  					galleries[244878] = new gallery(244878,'4072673','People','gallery',[4072638,4100217,4100219,4100225,4100228,4102134,4072673,5635551,4072670,4072663,4072671,4072645],0, 0, '', 'gallery_244878.html',0,0);
				  					galleries[244859] = new gallery(244859,'4094305','New Zealand','gallery',[],0, 0, '', 'gallery_244859.html',0,0);
				  					galleries[244873] = new gallery(244873,'4072644,4072634','Travel','gallery',[],0, 0, '', 'gallery_244873.html',0,0);
				  					galleries[245706] = new gallery(245706,'4100281,4099817','Plus...','gallery',[4102127,4102128,4102130,4102132,4102133,4100281,4100312,4100296,4100299,4100314,4099817],0, 0, '', 'gallery_245706.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '7609357,5635551,4102147,4099817,4094467,4094305,4094295,4094293,4094287,4094281,4094140,4093424,4093421,4093419,4072673,4072671,4072670,4072668,4072663,4072662,4072659,4072658,4072651,4072649,4072645,4072644,4072641,4072634,4072633';
imageSets[2] = '4100281,4099817,4094305,4072673,4072653,4072644,4072634';
imageSets[3] = '7609491,7609490,7609489,7609488,7609487,7609485,7609484,7609483,7609482,7609481,7609480,7609478,7609477,7609476,7609475,7609472,7609471,7609470,7609469,7609357,5635551,5632016,5632011,5632009,5632006,4102151,4102149,4102148,4102147,4102146,4102144,4102143,4102140,4102137,4102136,4102134,4102133,4102132,4102130,4102128,4102127,4100314,4100312,4100299,4100296,4100281,4100243,4100241,4100239,4100228';
imageSets[223571] = '7609491,7609490,7609489,7609487,7609484,7609483,7609482,7609481,7609480,7609478,7609477,7609476,7609475,7609472,7609471,7609470,7609469,7609357';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/matahaia/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/matahaia/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/matahaia/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/matahaia/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/matahaia/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/matahaia/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/matahaia/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/matahaia/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/matahaia/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/matahaia/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/matahaia/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/matahaia/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/matahaia/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/matahaia/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/matahaia/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/matahaia/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/matahaia/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/matahaia/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/matahaia/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/matahaia/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/matahaia/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/matahaia/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 = 'Meg Lipscombe Photography: ' + photoCaption;
			    }
        if (op.$detail.length > 0) {
      temp = op.nextPhoto.fnGetImageDetails();
	    op.$detail.fadeGalleryDetails(temp, op.speed, function(){
	    var options = {};	    	      	      resizePhotoInfo(options);
        if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
  	      toggleAddToCartConfirm(backgrounds);
  	    } else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
  	      toggleAddToCartConfirm(photos);
  	    }
	    });
    }
        if (!op.speed) {      clik.doColumnResize(false, op.$photo.add(op.$detail).add(op.$title));      $('body').trigger('clikUpdate');    }        
    return html;			}
	else {
				
		window.location = 'photo_' + nextPhoto.id + '.html';
	}
		
}

/***************************************************************************
* Toggle add to cart confirmation element and set up the click event for   *
* the 'Add to cart' button.                                                *
***************************************************************************/
function toggleAddToCartConfirm(array){
  if (typeof(array) !== 'object') {
    array = photos;
  }
	if($('#paymentConfirm').length > 0){
		$('#paymentConfirm').hide();
		$('#paymentAddButton')
		.unbind()
		.click(function(){
						form = document.getElementById('paymentForm');
			option_id = 0;
			if(form.item_option.value){
				option_id = form.item_option.value;
			}
			if(addItemToBasket(form.item_number.value,array,form.site.value,parseInt(form.quantity.value, 10),option_id)){
				if($.browser.msie){$('#paymentConfirm').text('Item added to cart').show();}
				else{
					$('#paymentConfirm').text('Item added to cart').fadeIn();
					dspOrderDetails(form.site.value);
				}
			}
			else{
				$('#paymentConfirm').text('Item not added - check cookies are enabled in your browser.').fadeIn();
			}
		});
	}
}
/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
photo.prototype.fnGetImageDetails = function(){
	var temp = '';
	if (this.description != '') {
		temp = temp +  '<p id="imageDescription">' + this.description + '</p>';
	}
		if (this.photo_ref != '') {
		temp = temp + '<p class="imageinfo" id="imageRef"><strong>Ref: </strong>' + this.photo_ref + '</p>';
	}
		if (this.takendate != '') {
				
		temp = temp + '<p class="imageinfo" id="imageDate"><strong>Date: </strong>' + this.takendate + '</p>';
	}
	
	if (this.location != '') {
				
		temp = temp + '<p class="imageinfo" id="imageLocation"><strong>Location: </strong>' +  this.location + '</p>';
	}
	
	if (this.photographer != '') {
				
		temp = temp + '<p class="imageinfo" id="imagePhotographer"><strong>Photographer: </strong>' + this.photographer + '</p>';
	}
					
				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;
	}
}

			

