window.thumbnails = {};
															thumbnails[3989853] = clik.newPhoto({"id":3989853,"src":"Cockenzie_112345_thumb.jpg","galleries_id":241358,"server_id":1,"link":"photo_3989853.html","width":87,"caption":"","height":130});
															thumbnails[3989856] = clik.newPhoto({"id":3989856,"src":"Cockenzie_21_thumb.jpg","galleries_id":241358,"server_id":1,"link":"photo_3989856.html","width":88,"caption":"","height":130});
															thumbnails[3989860] = clik.newPhoto({"id":3989860,"src":"Cockenzie_31_thumb.jpg","galleries_id":241358,"server_id":1,"link":"photo_3989860.html","width":130,"caption":"","height":88});
															thumbnails[3989863] = clik.newPhoto({"id":3989863,"src":"Cockenzie_41_thumb.jpg","galleries_id":241358,"server_id":1,"link":"photo_3989863.html","width":91,"caption":"","height":130});
															thumbnails[3989870] = clik.newPhoto({"id":3989870,"src":"Cockenzie_51_thumb.jpg","galleries_id":241358,"server_id":1,"link":"photo_3989870.html","width":130,"caption":"","height":87});
															thumbnails[3989873] = clik.newPhoto({"id":3989873,"src":"Cockenzie_61_thumb.jpg","galleries_id":241358,"server_id":1,"link":"photo_3989873.html","width":130,"caption":"","height":94});
															thumbnails[3989878] = clik.newPhoto({"id":3989878,"src":"Glen_Coe_11_thumb.jpg","galleries_id":241352,"server_id":1,"link":"photo_3989878.html","width":90,"caption":"","height":130});
															thumbnails[3989880] = clik.newPhoto({"id":3989880,"src":"Glen_Coe_21_thumb.jpg","galleries_id":241352,"server_id":1,"link":"photo_3989880.html","width":89,"caption":"","height":130});
															thumbnails[3989884] = clik.newPhoto({"id":3989884,"src":"Glen_Coe_31_thumb.jpg","galleries_id":241352,"server_id":1,"link":"photo_3989884.html","width":88,"caption":"","height":130});
															thumbnails[3989888] = clik.newPhoto({"id":3989888,"src":"Glen_Coe_41_thumb.jpg","galleries_id":241352,"server_id":1,"link":"photo_3989888.html","width":130,"caption":"","height":89});
															thumbnails[3989890] = clik.newPhoto({"id":3989890,"src":"Glen_Coe_51_thumb.jpg","galleries_id":241352,"server_id":1,"link":"photo_3989890.html","width":88,"caption":"","height":130});
															thumbnails[3989893] = clik.newPhoto({"id":3989893,"src":"GLen_Coe_61_thumb.jpg","galleries_id":241352,"server_id":1,"link":"photo_3989893.html","width":130,"caption":"","height":87});
															thumbnails[3989895] = clik.newPhoto({"id":3989895,"src":"Glen_Coe_7_thumb.jpg","galleries_id":241352,"server_id":1,"link":"photo_3989895.html","width":88,"caption":"","height":130});
															thumbnails[3989905] = clik.newPhoto({"id":3989905,"src":"Portobello_Beach_11_thumb.jpg","galleries_id":241353,"server_id":1,"link":"photo_3989905.html","width":87,"caption":"","height":130});
															thumbnails[3989906] = clik.newPhoto({"id":3989906,"src":"Portobello_Beach_2_thumb.jpg","galleries_id":241353,"server_id":1,"link":"photo_3989906.html","width":87,"caption":"","height":130});
															thumbnails[3989909] = clik.newPhoto({"id":3989909,"src":"Portobello_Beach_3_thumb.jpg","galleries_id":241353,"server_id":1,"link":"photo_3989909.html","width":130,"caption":"","height":88});
															thumbnails[3989910] = clik.newPhoto({"id":3989910,"src":"Portobello_Beach_4_thumb.jpg","galleries_id":241353,"server_id":1,"link":"photo_3989910.html","width":101,"caption":"","height":130});
															thumbnails[3989912] = clik.newPhoto({"id":3989912,"src":"Portobello_Beach_5_thumb.jpg","galleries_id":241353,"server_id":1,"link":"photo_3989912.html","width":130,"caption":"","height":87});
															thumbnails[3989914] = clik.newPhoto({"id":3989914,"src":"Portobello_Beach_6_thumb.jpg","galleries_id":241353,"server_id":1,"link":"photo_3989914.html","width":89,"caption":"","height":130});
															thumbnails[3989916] = clik.newPhoto({"id":3989916,"src":"Portobello_Beach_7_thumb.jpg","galleries_id":241353,"server_id":1,"link":"photo_3989916.html","width":88,"caption":"","height":130});
															thumbnails[3989922] = clik.newPhoto({"id":3989922,"src":"Portobello_Beach_81_thumb.jpg","galleries_id":241353,"server_id":1,"link":"photo_3989922.html","width":89,"caption":"","height":130});
															thumbnails[3989924] = clik.newPhoto({"id":3989924,"src":"Portobello_Beach_91_thumb.jpg","galleries_id":241353,"server_id":1,"link":"photo_3989924.html","width":130,"caption":"","height":45});
															thumbnails[3989927] = clik.newPhoto({"id":3989927,"src":"Portobello_Beach_101_thumb.jpg","galleries_id":241353,"server_id":1,"link":"photo_3989927.html","width":90,"caption":"","height":130});
															thumbnails[3989928] = clik.newPhoto({"id":3989928,"src":"Portobello_Beach_111_thumb.jpg","galleries_id":241353,"server_id":1,"link":"photo_3989928.html","width":130,"caption":"","height":124});
															thumbnails[3989929] = clik.newPhoto({"id":3989929,"src":"Portobello_Beach_121_thumb.jpg","galleries_id":241353,"server_id":1,"link":"photo_3989929.html","width":88,"caption":"","height":130});
															thumbnails[3989930] = clik.newPhoto({"id":3989930,"src":"Portobello_Beach_132_thumb.jpg","galleries_id":241353,"server_id":1,"link":"photo_3989930.html","width":112,"caption":"","height":130});
															thumbnails[3989931] = clik.newPhoto({"id":3989931,"src":"Portobello_Beach_141_thumb.jpg","galleries_id":241353,"server_id":1,"link":"photo_3989931.html","width":130,"caption":"","height":88});
															thumbnails[3989932] = clik.newPhoto({"id":3989932,"src":"Portobello_Beach_151_thumb.jpg","galleries_id":241353,"server_id":1,"link":"photo_3989932.html","width":130,"caption":"","height":123});
															thumbnails[3989934] = clik.newPhoto({"id":3989934,"src":"Pittenweem_Harbour_thumb.jpg","galleries_id":241354,"server_id":1,"link":"photo_3989934.html","width":92,"caption":"","height":130});
															thumbnails[3989939] = clik.newPhoto({"id":3989939,"src":"North_Berwick_1_thumb.jpg","galleries_id":241355,"server_id":1,"link":"photo_3989939.html","width":127,"caption":"","height":130});
															thumbnails[3989943] = clik.newPhoto({"id":3989943,"src":"North_Berwick_2_thumb.jpg","galleries_id":241355,"server_id":1,"link":"photo_3989943.html","width":88,"caption":"","height":130});
															thumbnails[3989948] = clik.newPhoto({"id":3989948,"src":"North_Berwick_3_thumb.jpg","galleries_id":241355,"server_id":1,"link":"photo_3989948.html","width":88,"caption":"","height":130});
															thumbnails[3989952] = clik.newPhoto({"id":3989952,"src":"North_Berwick_41_thumb.jpg","galleries_id":241355,"server_id":1,"link":"photo_3989952.html","width":91,"caption":"","height":130});
															thumbnails[3989956] = clik.newPhoto({"id":3989956,"src":"North_Berwick_51_thumb.jpg","galleries_id":241355,"server_id":1,"link":"photo_3989956.html","width":86,"caption":"","height":130});
															thumbnails[3989961] = clik.newPhoto({"id":3989961,"src":"North_Berwick_61_thumb.jpg","galleries_id":241355,"server_id":1,"link":"photo_3989961.html","width":95,"caption":"","height":130});
															thumbnails[3989967] = clik.newPhoto({"id":3989967,"src":"North_Berwick_71_thumb.jpg","galleries_id":241355,"server_id":1,"link":"photo_3989967.html","width":130,"caption":"","height":90});
															thumbnails[3989970] = clik.newPhoto({"id":3989970,"src":"North_Berwick_81_thumb.jpg","galleries_id":241355,"server_id":1,"link":"photo_3989970.html","width":88,"caption":"","height":130});
															thumbnails[3989973] = clik.newPhoto({"id":3989973,"src":"North_Berwick_101_thumb.jpg","galleries_id":241355,"server_id":1,"link":"photo_3989973.html","width":89,"caption":"","height":130});
															thumbnails[3989974] = clik.newPhoto({"id":3989974,"src":"North_Berwick_111_thumb.jpg","galleries_id":241355,"server_id":1,"link":"photo_3989974.html","width":89,"caption":"","height":130});
															thumbnails[3989978] = clik.newPhoto({"id":3989978,"src":"Port_Seaton_11_thumb.jpg","galleries_id":241356,"server_id":1,"link":"photo_3989978.html","width":87,"caption":"","height":130});
															thumbnails[3989979] = clik.newPhoto({"id":3989979,"src":"Port_Seaton_21_thumb.jpg","galleries_id":241356,"server_id":1,"link":"photo_3989979.html","width":130,"caption":"","height":88});
															thumbnails[3989980] = clik.newPhoto({"id":3989980,"src":"Port_Seaton_3_thumb.jpg","galleries_id":241356,"server_id":1,"link":"photo_3989980.html","width":89,"caption":"","height":130});
															thumbnails[3989983] = clik.newPhoto({"id":3989983,"src":"Longstone_Bents_11_thumb.jpg","galleries_id":241357,"server_id":1,"link":"photo_3989983.html","width":86,"caption":"","height":130});
															thumbnails[3989986] = clik.newPhoto({"id":3989986,"src":"Longstone_Bents_21_thumb.jpg","galleries_id":241357,"server_id":1,"link":"photo_3989986.html","width":89,"caption":"","height":130});
															thumbnails[3989989] = clik.newPhoto({"id":3989989,"src":"Longstone_Bents_31_thumb.jpg","galleries_id":241357,"server_id":1,"link":"photo_3989989.html","width":130,"caption":"","height":88});
															thumbnails[3989996] = clik.newPhoto({"id":3989996,"src":"Aberdour_Harbour_1_thumb.jpg","galleries_id":241377,"server_id":1,"link":"photo_3989996.html","width":89,"caption":"","height":130});
															thumbnails[3989999] = clik.newPhoto({"id":3989999,"src":"Aberdour_Harbour_2_thumb.jpg","galleries_id":241377,"server_id":1,"link":"photo_3989999.html","width":89,"caption":"","height":130});
															thumbnails[3990004] = clik.newPhoto({"id":3990004,"src":"Seaton_Sands_1_thumb.jpg","galleries_id":241378,"server_id":1,"link":"photo_3990004.html","width":121,"caption":"","height":130});
															thumbnails[3990025] = clik.newPhoto({"id":3990025,"src":"Bluebell_Wood_1_thumb.jpg","galleries_id":241379,"server_id":1,"link":"photo_3990025.html","width":103,"caption":"","height":130});
															thumbnails[3990028] = clik.newPhoto({"id":3990028,"src":"Loch_Linnie_11_thumb.jpg","galleries_id":241380,"server_id":1,"link":"photo_3990028.html","width":88,"caption":"","height":130});
															thumbnails[3990032] = clik.newPhoto({"id":3990032,"src":"Loch_Linnie_21_thumb.jpg","galleries_id":241380,"server_id":1,"link":"photo_3990032.html","width":88,"caption":"","height":130});
															thumbnails[3990033] = clik.newPhoto({"id":3990033,"src":"Loch_Linnie_31_thumb.jpg","galleries_id":241380,"server_id":1,"link":"photo_3990033.html","width":93,"caption":"","height":130});
															thumbnails[3990034] = clik.newPhoto({"id":3990034,"src":"Loch_Linnie_41_thumb.jpg","galleries_id":241380,"server_id":1,"link":"photo_3990034.html","width":89,"caption":"","height":130});
															thumbnails[4008786] = clik.newPhoto({"id":4008786,"src":"North_Berwick_9_thumb.jpg","galleries_id":241355,"server_id":1,"link":"photo_4008786.html","width":90,"caption":"","height":130});
															thumbnails[4770123] = clik.newPhoto({"id":4770123,"src":"Forth_Bridge_thumb.jpg","galleries_id":273143,"server_id":1,"link":"photo_4770123.html","width":89,"caption":"","height":130});
															thumbnails[4922886] = clik.newPhoto({"id":4922886,"src":"Hermitage_Autumn_11_thumb.jpg","galleries_id":280302,"server_id":1,"link":"photo_4922886.html","width":88,"caption":"","height":130});
															thumbnails[5104505] = clik.newPhoto({"id":5104505,"src":"Gullane_Bents_1_thumb.jpg","galleries_id":288530,"server_id":1,"link":"photo_5104505.html","width":89,"caption":"","height":130});
															thumbnails[5104509] = clik.newPhoto({"id":5104509,"src":"Gullane_Bents_3_thumb.jpg","galleries_id":288530,"server_id":1,"link":"photo_5104509.html","width":93,"caption":"","height":130});
															thumbnails[5104510] = clik.newPhoto({"id":5104510,"src":"Gullane_Bents_4_thumb.jpg","galleries_id":288530,"server_id":1,"link":"photo_5104510.html","width":89,"caption":"","height":130});
															thumbnails[5104511] = clik.newPhoto({"id":5104511,"src":"Gullane_Bents_5_thumb.jpg","galleries_id":288530,"server_id":1,"link":"photo_5104511.html","width":98,"caption":"","height":130});
															thumbnails[5104512] = clik.newPhoto({"id":5104512,"src":"Gullane_Bents_6_thumb.jpg","galleries_id":288530,"server_id":1,"link":"photo_5104512.html","width":88,"caption":"","height":130});
															thumbnails[5104513] = clik.newPhoto({"id":5104513,"src":"Gullane_Beach_1_thumb.jpg","galleries_id":288530,"server_id":1,"link":"photo_5104513.html","width":89,"caption":"","height":130});
															thumbnails[5320280] = clik.newPhoto({"id":5320280,"src":"Gullane_8_thumb.jpg","galleries_id":288530,"server_id":1,"link":"photo_5320280.html","width":89,"caption":"","height":130});
															thumbnails[5843061] = clik.newPhoto({"id":5843061,"src":"Gullane_9_thumb.jpg","galleries_id":288530,"server_id":1,"link":"photo_5843061.html","width":91,"caption":"","height":130});
															thumbnails[5843084] = clik.newPhoto({"id":5843084,"src":"Gullane_10_thumb.jpg","galleries_id":288530,"server_id":1,"link":"photo_5843084.html","width":91,"caption":"","height":130});
															thumbnails[4044508] = clik.newPhoto({"id":4044508,"src":"Edinburgh_Waverly_thumb.jpg","galleries_id":241363,"server_id":1,"link":"photo_4044508.html","width":94,"caption":"","height":130});
															thumbnails[4044526] = clik.newPhoto({"id":4044526,"src":"Princess_Street_thumb.jpg","galleries_id":241363,"server_id":1,"link":"photo_4044526.html","width":88,"caption":"","height":130});
															thumbnails[4044536] = clik.newPhoto({"id":4044536,"src":"Royal_Mile_Church_thumb.jpg","galleries_id":241363,"server_id":1,"link":"photo_4044536.html","width":130,"caption":"","height":111});
															thumbnails[4044611] = clik.newPhoto({"id":4044611,"src":"Royal_mile_sunset_thumb.jpg","galleries_id":241363,"server_id":1,"link":"photo_4044611.html","width":88,"caption":"","height":130});
															thumbnails[4044622] = clik.newPhoto({"id":4044622,"src":"Scottish_Parliament_thumb.jpg","galleries_id":241363,"server_id":1,"link":"photo_4044622.html","width":123,"caption":"","height":130});
															thumbnails[4044640] = clik.newPhoto({"id":4044640,"src":"Snow_1_thumb.jpg","galleries_id":241363,"server_id":1,"link":"photo_4044640.html","width":88,"caption":"","height":130});
															thumbnails[4044648] = clik.newPhoto({"id":4044648,"src":"Snow_2_thumb.jpg","galleries_id":241363,"server_id":1,"link":"photo_4044648.html","width":88,"caption":"","height":130});
															thumbnails[4044653] = clik.newPhoto({"id":4044653,"src":"Snow_3_thumb.jpg","galleries_id":241363,"server_id":1,"link":"photo_4044653.html","width":128,"caption":"","height":130});
															thumbnails[4044665] = clik.newPhoto({"id":4044665,"src":"Snow_5_thumb.jpg","galleries_id":241363,"server_id":1,"link":"photo_4044665.html","width":88,"caption":"","height":130});
															thumbnails[4044736] = clik.newPhoto({"id":4044736,"src":"Snow_6_thumb.jpg","galleries_id":241363,"server_id":1,"link":"photo_4044736.html","width":88,"caption":"","height":130});
															thumbnails[4044737] = clik.newPhoto({"id":4044737,"src":"Snow_7_thumb.jpg","galleries_id":241363,"server_id":1,"link":"photo_4044737.html","width":88,"caption":"","height":130});
															thumbnails[4044739] = clik.newPhoto({"id":4044739,"src":"Snow_8_thumb.jpg","galleries_id":241363,"server_id":1,"link":"photo_4044739.html","width":88,"caption":"","height":130});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[288530] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Gullane Bents","link":"section212688_288530.html","maxRecords":0.0,"photoIDs":[5104505.0,5104509.0,5104510.0,5104511.0,5104512.0,5104513.0,5320280.0,5843061.0,5843084.0],"skipIndex":0,"section_code":"section212688","featured_images":"5843084,5843061,5320280,5104513,5104512,5104511,5104510,5104509,5104505","id":288530,"singleSection":false});				  						galleries[330609] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Kilmartin","link":"section212688_330609.html","maxRecords":0.0,"photoIDs":[],"skipIndex":0,"section_code":"section212688","featured_images":"","id":330609,"singleSection":false});				  						galleries[280302] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Perthshire","link":"section212688_280302.html","maxRecords":0.0,"photoIDs":[4922886.0],"skipIndex":0,"section_code":"section212688","featured_images":4922886.0,"id":280302,"singleSection":false});				  						galleries[273143] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"South Queensferry","link":"section212688_273143.html","maxRecords":0.0,"photoIDs":[4770123.0],"skipIndex":0,"section_code":"section212688","featured_images":4770123.0,"id":273143,"singleSection":false});				  						galleries[241352] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Glencoe","link":"section212688_241352.html","maxRecords":0.0,"photoIDs":[3989878.0,3989880.0,3989884.0,3989888.0,3989890.0,3989893.0,3989895.0],"skipIndex":0,"section_code":"section212688","featured_images":"3989895,3989893,3989890,3989888,3989884,3989880,3989878","id":241352,"singleSection":false});				  						galleries[241353] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Portobello Beach","link":"section212688_241353.html","maxRecords":0.0,"photoIDs":[3989905.0,3989906.0,3989909.0,3989910.0,3989912.0,3989914.0,3989916.0,3989922.0,3989924.0,3989927.0,3989928.0,3989929.0,3989930.0,3989931.0,3989932.0],"skipIndex":0,"section_code":"section212688","featured_images":"3989932,3989931,3989930,3989929,3989928,3989927,3989924,3989922,3989916,3989914","id":241353,"singleSection":false});				  						galleries[241354] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Pittenweem","link":"section212688_241354.html","maxRecords":0.0,"photoIDs":[3989934.0],"skipIndex":0,"section_code":"section212688","featured_images":3989934.0,"id":241354,"singleSection":false});				  						galleries[241355] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"North Berwick","link":"section212688_241355.html","maxRecords":0.0,"photoIDs":[3989939.0,3989943.0,3989948.0,3989952.0,3989956.0,3989961.0,3989967.0,3989970.0,3989973.0,3989974.0,4008786.0],"skipIndex":0,"section_code":"section212688","featured_images":"4008786,3989974,3989973,3989970,3989967,3989961,3989956,3989952,3989948,3989943","id":241355,"singleSection":false});				  						galleries[241356] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Port Seaton","link":"section212688_241356.html","maxRecords":0.0,"photoIDs":[3989978.0,3989979.0,3989980.0],"skipIndex":0,"section_code":"section212688","featured_images":"3989980,3989979,3989978","id":241356,"singleSection":false});				  						galleries[241357] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Longstone Bents","link":"section212688_241357.html","maxRecords":0.0,"photoIDs":[3989983.0,3989986.0,3989989.0],"skipIndex":0,"section_code":"section212688","featured_images":"3989989,3989986,3989983","id":241357,"singleSection":false});				  						galleries[241358] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Cockenzie","link":"section212688_241358.html","maxRecords":0.0,"photoIDs":[3989853.0,3989856.0,3989860.0,3989863.0,3989870.0,3989873.0],"skipIndex":0,"section_code":"section212688","featured_images":"3989873,3989870,3989863,3989860,3989856,3989853","id":241358,"singleSection":false});				  						galleries[241377] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Aberdour","link":"section212688_241377.html","maxRecords":0.0,"photoIDs":[3989996.0,3989999.0],"skipIndex":0,"section_code":"section212688","featured_images":"3989999,3989996","id":241377,"singleSection":false});				  						galleries[241378] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Seaton Sands","link":"section212688_241378.html","maxRecords":0.0,"photoIDs":[3990004.0],"skipIndex":0,"section_code":"section212688","featured_images":3990004.0,"id":241378,"singleSection":false});				  						galleries[241379] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Bluebell Wood","link":"section212688_241379.html","maxRecords":0.0,"photoIDs":[3990025.0],"skipIndex":0,"section_code":"section212688","featured_images":3990025.0,"id":241379,"singleSection":false});				  						galleries[241363] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Edinburgh","link":"section239137.html","maxRecords":0.0,"photoIDs":[4044508.0,4044526.0,4044536.0,4044611.0,4044622.0,4044640.0,4044648.0,4044653.0,4044665.0,4044736.0,4044737.0,4044739.0],"skipIndex":0,"section_code":"section239137","featured_images":"4044739,4044737,4044736,4044665,4044653,4044648,4044640,4044622,4044611,4044536","id":241363,"singleSection":true});				  						galleries[241380] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Loch Linnie","link":"section212688_241380.html","maxRecords":0.0,"photoIDs":[3990028.0,3990032.0,3990033.0,3990034.0],"skipIndex":0,"section_code":"section212688","featured_images":"3990034,3990033,3990032,3990028","id":241380,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '4044739,4044737,4044736,4044665,4044653,4044648,4044640,4044622,4044611,4044536,4044526,4044508,4008786,3990034,3990033,3990032,3990028,3990025,3990004,3989999,3989996,3989989,3989986,3989983,3989980,3989979,3989978,3989974,3989973,3989970,3989967,3989961,3989956,3989952,3989948,3989943,3989939,3989934,3989932,3989931,3989930,3989929,3989928,3989927,3989924,3989922,3989916,3989914,3989912,3989910,3989909,3989906,3989905,3989895,3989893,3989890,3989888,3989884,3989880,3989878,3989873,3989870,3989863,3989860,3989856,3989853';
imageSets[3] = '4044739,4044737,4044736,4044665,4044653,4044648,4044640,4044622,4044611,4044536,4044526,4044508,4008786';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'www12.clikpic.com/bmx_bandit/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/bmx_bandit/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/bmx_bandit/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/bmx_bandit/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/bmx_bandit/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/bmx_bandit/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/bmx_bandit/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/bmx_bandit/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/bmx_bandit/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/bmx_bandit/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/bmx_bandit/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/bmx_bandit/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/bmx_bandit/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/bmx_bandit/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/bmx_bandit/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/bmx_bandit/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/bmx_bandit/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/bmx_bandit/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/bmx_bandit/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/bmx_bandit/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/bmx_bandit/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/bmx_bandit/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/bmx_bandit/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/bmx_bandit/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/bmx_bandit/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 += 'section212688.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 && 'section212688' != '') {
					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:'',$detailContainer:'',
                    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 (op.updateHash && clik.getIDInUrl(location.href,'photo') != op.nextPhoto.id) {
		clik.changeHash('photos_id=' + op.nextPhoto.id, true);
	}
		
	    if (op.$title.length > 0) {
  		op.$title.fadeGalleryDetails(photoCaption, op.speed);
    }
        if (op.updateDocumentTitle) {
						  document.title = 'simonlamondphoto: ' + photoCaption;
			    }
        if (op.$detail.length > 0) {
      	temp = op.nextPhoto.fnGetImageDetails();
	    op.$detail.fadeGalleryDetails(temp, op.speed, function(){
			if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
				toggleAddToCartConfirm(backgrounds, op.$detail);
			} else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
				toggleAddToCartConfirm(photos, op.$detail);
			}
			$('body').trigger('clikUpdate.popup');
	    });
    }
        $(op.$detailContainer).find('.replaceable[class*=replaceable_photo-]').each(function(){
    	var field = clik.getPrefixedClass(this.className, 'replaceable_photo-');
    	if (field in op.nextPhoto) {
    		$(this).fadeGalleryDetails(op.nextPhoto[field], op.speed);
    	}
    }).end().find('.replaceable.photoPayment').fadeGalleryDetails(op.nextPhoto.fnGetPaymentInfo(), op.speed, function(){
		if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
			toggleAddToCartConfirm(backgrounds, op.$detailContainer);
		} else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
			toggleAddToCartConfirm(photos, op.$detailContainer);
		}
		$('body').trigger('clikUpdate.popup');
	});
		if (op.$photo.length > 0) {
		html = $('<img/>',{
			'class': 'mainphoto photo',
			src: photoSrc,
			id: 'mainPic',
			name: 'mainPic',
			width: op.nextPhoto.width,
			height: op.nextPhoto.height,
			alt: photoCaption,
			css: op.css || {}
		});
		if (op.href) {
			if (op.href.match(/<a/)) {
				html = $(op.href).append(html);
			} else {
				html = $('<a/>', {
					href: op.href,
					title: photoCaption
				}).append(html);
			}
		} else {
			html = $('<a/>', {
				title: photoCaption
			}).append(html);
		}
		if (op.speed == 0) {			op.$photo.html(html);			if (op.onBefore) {			  	op.onBefore.apply(op.$photo);			}			if (op.onAfter) {			  	op.onAfter.apply(op.$photo);			}		} else {			op.$photo.stop(true,true).fadeReplaceWith(html,op.speed,'',function(){  				if (op.onAfter) {				  	op.onAfter.apply(this);				}				clik.doColumnResize(false, $(this).add(op.$detail).add(op.$title));			}, op.onBefore);
		}	}
    if (op.field) {
		op.field.value = photoId;
	} else {
		op.$photo.data('image_id', photoId);
    }
        if (!op.speed) {
      	clik.doColumnResize(false, op.$photo.add(op.$detail).add(op.$title));
    }
        
    return html;
	}

/***************************************************************************
* Toggle add to cart confirmation element and set up the click event for   *
* the 'Add to cart' button.                                                *
***************************************************************************/
function toggleAddToCartConfirm(array, root){
	if (typeof(array) !== 'object' || array === null) {
	  	array = photos;
	}
	if (!$(root).length) {		root = $('body');	}	if($('#paymentConfirm', root).length > 0){
		$('#paymentConfirm', root).hide();
		$('#paymentAddButton', root)
		.unbind()
		.click(function(){
						form = $('#paymentForm', root)[0];
			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', root).text('Item added to cart').show();}
				else{
					$('#paymentConfirm', root).text('Item added to cart').fadeIn();
					dspOrderDetails(form.site.value);
				}
			}
			else{
				$('#paymentConfirm', root).text('Item not added - check cookies are enabled in your browser.').fadeIn();
			}
		});
	}
}

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
clik.photo.fnGetImageDetails = function(){
	var temp = '';
	if (this.description != '') {
		temp +=  '<div id="imageDescription">' + this.description + '</div>';
	}
		if (this.photo_ref != '') {
		temp += '<div class="imageinfo" id="imageRef"><strong>Ref: </strong>' + this.photo_ref + '</div>';
	}
		if (this.takendate != '') {
		
		temp += '<div class="imageinfo" id="imageDate"><strong>Date: </strong>' + this.takendate + '</div>';
	}
	
	if (this.location != '') {
		
		temp += '<div class="imageinfo" id="imageLocation"><strong>Location: </strong>' +  this.location + '</div>';
	}
	
	if (this.photographer != '') {
		
		temp += '<div class="imageinfo" id="imagePhotographer"><strong>Photographer: </strong>' + this.photographer + '</div>';
	}
				
	temp += this.fnGetPaymentInfo();
				if (temp != '') {
		temp += '<div class="spacer"></div>';
	}
	return temp;
};

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
clik.photo.fnGetPaymentInfo = function(){
	var temp = '';
	if (this.item_price !== '') {
																		temp += '<p>Buy now</p>';
				temp += '<div class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> &pound;' + (this.item_price).toFixed(2) + '</div>';
		var item_name  = this.purchase_instruction;
		var amount = (this.item_price).toFixed(2);
		var item_option  = 0;
	}
		else if (this.payment_groups_id !== '') {
		temp += '<p>Buy this print online:</p>';
				temp += '<form id="paymentOptions" style="margin:0px;border:0px;" name="paymentOptions">';
											temp += '<select class="paymentlink" name="payment_options_id" onchange="updateItemValues($(this.form).next(\'#paymentForm\')[0],this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value);">';
		
		temp += getPaymentOptions(this.payment_groups_id);
		temp += '</select>';
		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 += '<form id="paymentForm" style="margin:0px;border:0px;" name="paymentForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
			temp += '<input type="hidden" name="item_name" value="'+item_name+'">';
			ref = '';
			if(this.photo_ref != ''){
				ref = this.photo_ref+' - '+this.caption;
			}
			else{
				ref = this.id+' - '+this.caption;
			}
			price = amount;								temp += '<input type="hidden" name="cmd" value="_cart">';
					temp += '<input type="hidden" name="business" value="simonlamondphoto@hotmail.co.uk">';
					temp += '<input type="hidden" name="currency_code" value="GBP">';
					temp += '<input type="hidden" name="add" value="1">';
													temp += '<input type="hidden" name="amount" value="'+amount+'">';
					temp += '<input type="hidden" name="item_number" value="'+ref+'">';
													temp += '<input type=\"Submit\" value=\"Buy now\" id=\"paymentAddButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
										temp += '</form>';
										temp += '<form id="paymentCartForm" style="margin:0px;" name="paymentCartForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
				temp += '<input type="hidden" name="cmd" value="_cart">';
				temp += '<input type="hidden" name="business" value="simonlamondphoto@hotmail.co.uk">';
				temp += '<input type="hidden" name="display" value="1">';
				temp += '<input type=\"Submit\" value=\"View cart\" id=\"paymentViewButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
				temp += '</form>';
						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({					title: galleries[gallery_id].title				}).filter(function(){return this.href;}).attr({					href: thumbnails[imageID].fnGalleryLink(gallery_id)				});
			}
		}
	}
}

/***************************************************************************
* 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 += '<a href="' + galleries[i].section_code + '_' + galleries[i].id + '.html">' + galleries[i].title + '</a>';
							}
		}
		document.all.galleryLinks.innerHTML = 'Other galleries: ' + temp;
	}
}

			

