window.thumbnails = {};
thumbnails[8915374] = clik.newPhoto({"link":"#","caption":"Belize Banded Shrimp","height":199,"id":8915374,"server_id":31,"src":"Banded_Shrimp_3_thumb.jpg","galleries_id":"","width":160});
thumbnails[8922015] = clik.newPhoto({"link":"#","caption":"Whale Shark Djibouti","height":120,"id":8922015,"server_id":31,"src":"121_whale_shark_copy_thumb.jpg","galleries_id":"","width":160});
thumbnails[8922060] = clik.newPhoto({"link":"#","caption":"Damsel Fish , Belize","height":120,"id":8922060,"server_id":31,"src":"BELIZE082120081_4_copy_thumb.jpg","galleries_id":"","width":160});
thumbnails[8922070] = clik.newPhoto({"link":"#","caption":"Carolyn, Belize","height":120,"id":8922070,"server_id":31,"src":"BELIZE082120081_7_copy_thumb.jpg","galleries_id":"","width":160});
thumbnails[9169913] = clik.newPhoto({"link":"photo_9169913.html","caption":"Brine Shrimp","height":148,"id":9169913,"server_id":31,"src":"Loch_Fyne_Feb_2012_360_copy_1_thumb.jpg","galleries_id":484332,"width":160});
thumbnails[9169946] = clik.newPhoto({"link":"photo_9169946.html","caption":"Diver JS ","height":120,"id":9169946,"server_id":31,"src":"Loch_Fyne_Feb_2012_368_copy_1_thumb.jpg","galleries_id":484332,"width":160});
thumbnails[9169956] = clik.newPhoto({"link":"photo_9169956.html","caption":"Velvet Swimming Crab","height":120,"id":9169956,"server_id":31,"src":"Loch_Fyne_Feb_2012_369_copy_1_thumb.jpg","galleries_id":484332,"width":160});
thumbnails[9169966] = clik.newPhoto({"link":"photo_9169966.html","caption":"Shore Crab","height":105,"id":9169966,"server_id":31,"src":"Loch_Fyne_Feb_2012_375_copy_1_thumb.jpg","galleries_id":484332,"width":160});
thumbnails[9169978] = clik.newPhoto({"link":"photo_9169978.html","caption":"Scorpion Fish and Eggs","height":145,"id":9169978,"server_id":31,"src":"Loch_Fyne_Feb_2012_383_copy_1_thumb.jpg","galleries_id":484332,"width":160});
thumbnails[9169985] = clik.newPhoto({"link":"photo_9169985.html","caption":"Scorpion Fish guards Eggs","height":161,"id":9169985,"server_id":31,"src":"Loch_Fyne_Feb_2012_384_copy_1_thumb_1.jpg","galleries_id":484332,"width":160});
thumbnails[9170027] = clik.newPhoto({"link":"photo_9170027.html","caption":"Loch Fyne Anenome","height":103,"id":9170027,"server_id":31,"src":"Loch_Fyne_Feb_2012_385_copy_1_thumb.jpg","galleries_id":484332,"width":160});
thumbnails[9170081] = clik.newPhoto({"link":"photo_9170081.html","caption":"Scorpion Fish","height":139,"id":9170081,"server_id":31,"src":"Loch_Fyne_Feb_2012_384_copy_copy_1_thumb.jpg","galleries_id":484332,"width":160});
thumbnails[9174603] = clik.newPhoto({"link":"photo_9174603.html","caption":"Scorpionfish with eggs","height":115,"id":9174603,"server_id":31,"src":"Loch_Fyne_Feb_2012_382_copy_1_thumb.jpg","galleries_id":484332,"width":160});
thumbnails[9169928] = clik.newPhoto({"link":"photo_9169928.html","caption":"Hermit Crab","height":119,"id":9169928,"server_id":31,"src":"Loch_Fyne_Feb_2012_363_copy_1_thumb.jpg","galleries_id":484332,"width":160});
thumbnails[9089762] = clik.newPhoto({"link":"photo_9089762.html","caption":"Safety Stop","height":213,"id":9089762,"server_id":31,"src":"Thailand_2012_172_thumb.JPG","galleries_id":477923,"width":160});
thumbnails[9089764] = clik.newPhoto({"link":"photo_9089764.html","caption":"Safety Stop Queue","height":213,"id":9089764,"server_id":31,"src":"Thailand_2012_171_thumb.JPG","galleries_id":477923,"width":160});
thumbnails[9089765] = clik.newPhoto({"link":"photo_9089765.html","caption":"Skunk Anenome Fish ","height":120,"id":9089765,"server_id":31,"src":"Thailand_2012_146_thumb.JPG","galleries_id":477923,"width":160});
thumbnails[9089766] = clik.newPhoto({"link":"photo_9089766.html","caption":"Flat Worm, Similin Islands, Thailand","height":120,"id":9089766,"server_id":31,"src":"Thailand_2012_163_thumb.JPG","galleries_id":477923,"width":160});
thumbnails[9089767] = clik.newPhoto({"link":"photo_9089767.html","caption":"Leaf Fish, Richeleiu Rock Thailand","height":120,"id":9089767,"server_id":31,"src":"Thailand_2012_115_thumb.JPG","galleries_id":477923,"width":160});
thumbnails[9132578] = clik.newPhoto({"link":"photo_9132578.html","caption":"","height":120,"id":9132578,"server_id":31,"src":"Anenome_Fish1_3_thumb.jpg","galleries_id":477923,"width":160});
thumbnails[8832484] = clik.newPhoto({"link":"photo_8832484.html","caption":"Congratulations Janet - Club Diver","height":120,"id":8832484,"server_id":31,"src":"Neil__Janet_club_diver_640x480_thumb.jpg","galleries_id":464663,"width":160});
thumbnails[8871618] = clik.newPhoto({"link":"photo_8871618.html","caption":"Loch Melfort","height":120,"id":8871618,"server_id":31,"src":"P3221122_copy1_thumb.jpg","galleries_id":464663,"width":160});
thumbnails[8871770] = clik.newPhoto({"link":"photo_8871770.html","caption":"Forth Bridge Sunset","height":107,"id":8871770,"server_id":31,"src":"DSC_0132_copy1_thumb.jpg","galleries_id":464663,"width":160});
thumbnails[8871786] = clik.newPhoto({"link":"photo_8871786.html","caption":"Ringed Octopus ","height":120,"id":8871786,"server_id":31,"src":"PA181475_copy_thumb.jpg","galleries_id":464664,"width":160});
thumbnails[8871799] = clik.newPhoto({"link":"photo_8871799.html","caption":"Cuttlefish","height":120,"id":8871799,"server_id":31,"src":"PA181479_crop_copy_thumb.jpg","galleries_id":464664,"width":160});
thumbnails[8871811] = clik.newPhoto({"link":"photo_8871811.html","caption":"Fire Clam","height":120,"id":8871811,"server_id":31,"src":"PA181484_copy_thumb.jpg","galleries_id":464664,"width":160});
thumbnails[8871827] = clik.newPhoto({"link":"photo_8871827.html","caption":"Nudibranch","height":112,"id":8871827,"server_id":31,"src":"PA181490_crop_thumb.jpg","galleries_id":464664,"width":160});
thumbnails[8871838] = clik.newPhoto({"link":"photo_8871838.html","caption":"Jacks","height":120,"id":8871838,"server_id":31,"src":"PA181502_copy_thumb.jpg","galleries_id":464664,"width":160});
thumbnails[8871852] = clik.newPhoto({"link":"photo_8871852.html","caption":"Cushion Star","height":106,"id":8871852,"server_id":31,"src":"PA181518Crop_thumb.jpg","galleries_id":464664,"width":160});
thumbnails[8898123] = clik.newPhoto({"link":"photo_8898123.html","caption":"Skunk Anenome Fish and Glass Shrimp","height":122,"id":8898123,"server_id":31,"src":"PA191529_copy_thumb.jpg","galleries_id":464664,"width":160});
thumbnails[8898129] = clik.newPhoto({"link":"photo_8898129.html","caption":"Cuttle Fish and Coral Polyps","height":129,"id":8898129,"server_id":31,"src":"PA181479_crop_copy1_thumb.jpg","galleries_id":464664,"width":160});
thumbnails[8898135] = clik.newPhoto({"link":"photo_8898135.html","caption":"Indonesian Nudibranch","height":114,"id":8898135,"server_id":31,"src":"PA191537_copy_thumb.jpg","galleries_id":464664,"width":160});
thumbnails[8898352] = clik.newPhoto({"link":"photo_8898352.html","caption":"Harlequin Ghost Pipefish","height":102,"id":8898352,"server_id":31,"src":"PA191543_copy_thumb.jpg","galleries_id":464664,"width":160});
thumbnails[8898384] = clik.newPhoto({"link":"photo_8898384.html","caption":"Harlequin Shrimp","height":112,"id":8898384,"server_id":31,"src":"PA201553_copy_thumb.jpg","galleries_id":464664,"width":160});
thumbnails[8898436] = clik.newPhoto({"link":"photo_8898436.html","caption":"Mantis Shrimp","height":120,"id":8898436,"server_id":31,"src":"PA201565_copy_thumb.jpg","galleries_id":464664,"width":160});
thumbnails[8898630] = clik.newPhoto({"link":"photo_8898630.html","caption":"Loch Fyne","height":120,"id":8898630,"server_id":31,"src":"P8200158_copy_thumb.jpg","galleries_id":464663,"width":160});
thumbnails[8898846] = clik.newPhoto({"link":"photo_8898846.html","caption":"Ardnamuchan Light, Sound of Mull","height":120,"id":8898846,"server_id":31,"src":"DSC00074_copy_thumb.jpg","galleries_id":464663,"width":160});
thumbnails[8899324] = clik.newPhoto({"link":"photo_8899324.html","caption":"Isle of May","height":120,"id":8899324,"server_id":31,"src":"kelpies_ashore_copy_thumb.jpg","galleries_id":464663,"width":160});
thumbnails[8899354] = clik.newPhoto({"link":"photo_8899354.html","caption":"White Mouthed Moray","height":120,"id":8899354,"server_id":31,"src":"Grabbed_Frame_13_copy_thumb.jpg","galleries_id":464664,"width":160});
thumbnails[8899620] = clik.newPhoto({"link":"photo_8899620.html","caption":"Lion Fish","height":240,"id":8899620,"server_id":31,"src":"038_38_copy_thumb.jpg","galleries_id":464664,"width":160});
thumbnails[8899630] = clik.newPhoto({"link":"photo_8899630.html","caption":"Manta Rays","height":120,"id":8899630,"server_id":31,"src":"018_18_copy_thumb.jpg","galleries_id":468070,"width":160});
thumbnails[8903216] = clik.newPhoto({"link":"photo_8903216.html","caption":"Indian Ocean Manta Ray","height":120,"id":8903216,"server_id":31,"src":"023_23_copy_thumb.jpg","galleries_id":468070,"width":160});
thumbnails[8903222] = clik.newPhoto({"link":"photo_8903222.html","caption":"Table Coral","height":120,"id":8903222,"server_id":31,"src":"007_7_copy_thumb.jpg","galleries_id":468070,"width":160});
thumbnails[8903225] = clik.newPhoto({"link":"photo_8903225.html","caption":"Lion Fish","height":107,"id":8903225,"server_id":31,"src":"048_48_copy_thumb.jpg","galleries_id":468070,"width":160});
thumbnails[8903272] = clik.newPhoto({"link":"photo_8903272.html","caption":"Dhoni","height":120,"id":8903272,"server_id":31,"src":"064_64_copy_thumb.jpg","galleries_id":468070,"width":160});
thumbnails[8914977] = clik.newPhoto({"link":"photo_8914977.html","caption":"Cushion Star","height":113,"id":8914977,"server_id":31,"src":"Cushion_Star_copy_thumb.jpg","galleries_id":468974,"width":160});
thumbnails[8914984] = clik.newPhoto({"link":"photo_8914984.html","caption":"Crab & Prawn ","height":114,"id":8914984,"server_id":31,"src":"Crab__Prawn_thumb.JPG","galleries_id":468974,"width":160});
thumbnails[8914986] = clik.newPhoto({"link":"photo_8914986.html","caption":"Dhalia Anenome","height":208,"id":8914986,"server_id":31,"src":"Dhalia_St_Kilda_copy_thumb.jpg","galleries_id":468974,"width":160});
thumbnails[8914988] = clik.newPhoto({"link":"photo_8914988.html","caption":"Dive Boat St Kilda","height":100,"id":8914988,"server_id":31,"src":"Dive_Boat_copy_thumb.jpg","galleries_id":468974,"width":160});
thumbnails[8914989] = clik.newPhoto({"link":"photo_8914989.html","caption":"Jewel Anenome 2, St Kilda","height":114,"id":8914989,"server_id":31,"src":"JEWEL_ANENOME_St_Kilda_2_copy_thumb.jpg","galleries_id":468974,"width":160});
thumbnails[8915002] = clik.newPhoto({"link":"photo_8915002.html","caption":"Jewel Anenome, St Kilda","height":112,"id":8915002,"server_id":31,"src":"Jewel_Anenome_St_Kilda_copy_thumb.jpg","galleries_id":468974,"width":160});
thumbnails[8915003] = clik.newPhoto({"link":"photo_8915003.html","caption":"Plaice , St Kilda","height":110,"id":8915003,"server_id":31,"src":"Plaice_copy_thumb.jpg","galleries_id":468974,"width":160});
thumbnails[8915006] = clik.newPhoto({"link":"photo_8915006.html","caption":"Plumose Anenome, St Kilda","height":224,"id":8915006,"server_id":31,"src":"Plumose_Aenome_copy_thumb.jpg","galleries_id":468974,"width":160});
thumbnails[8915010] = clik.newPhoto({"link":"photo_8915010.html","caption":"Plumose Anenome2, St Kilda","height":113,"id":8915010,"server_id":31,"src":"Plumose_Anenomies_copy_thumb.jpg","galleries_id":468974,"width":160});
thumbnails[8915012] = clik.newPhoto({"link":"photo_8915012.html","caption":"Scorpion Fish Night Dive, St Kilda","height":106,"id":8915012,"server_id":31,"src":"Scorpion_Fish_and_Sand_Eel_copy_thumb.jpg","galleries_id":468974,"width":160});
thumbnails[8915013] = clik.newPhoto({"link":"photo_8915013.html","caption":"Spiney Starfish St Kilda","height":113,"id":8915013,"server_id":31,"src":"Spiney_Star_Fish_copy_thumb.jpg","galleries_id":468974,"width":160});
thumbnails[8915014] = clik.newPhoto({"link":"photo_8915014.html","caption":"Saw Cut, St Kilda ","height":224,"id":8915014,"server_id":31,"src":"Saw_Cut_St_Kilda_copy_thumb.jpg","galleries_id":468974,"width":160});
thumbnails[8915016] = clik.newPhoto({"link":"photo_8915016.html","caption":"St Kilda, Scotland","height":114,"id":8915016,"server_id":31,"src":"St_Kilda_copy_thumb.jpg","galleries_id":468974,"width":160});
thumbnails[8921980] = clik.newPhoto({"link":"photo_8921980.html","caption":"Carolyn & Viper Oban","height":120,"id":8921980,"server_id":31,"src":"DSCF0059_edited-1_copy_thumb.jpg","galleries_id":464663,"width":160});
thumbnails[8921983] = clik.newPhoto({"link":"photo_8921983.html","caption":"Viper at Oban heading for the mooring ","height":103,"id":8921983,"server_id":31,"src":"Viper_Easter_09_2_copy_thumb.jpg","galleries_id":464663,"width":160});
thumbnails[8921986] = clik.newPhoto({"link":"photo_8921986.html","caption":"Fresh Water Clean following recovery","height":120,"id":8921986,"server_id":31,"src":"DSCF0069_copy_thumb.jpg","galleries_id":464663,"width":160});
thumbnails[8921992] = clik.newPhoto({"link":"photo_8921992.html","caption":"Viper at Slip","height":253,"id":8921992,"server_id":31,"src":"Viper_Oban_easter_1_copy_thumb.jpg","galleries_id":464663,"width":160});
thumbnails[8922010] = clik.newPhoto({"link":"photo_8922010.html","caption":"Caye Calker Belize","height":239,"id":8922010,"server_id":31,"src":"Cayye_Caulker1_copy_thumb.jpg","galleries_id":469247,"width":160});
thumbnails[8922017] = clik.newPhoto({"link":"photo_8922017.html","caption":"Painted Lobster, Belize Blue Hole","height":120,"id":8922017,"server_id":31,"src":"BELIZE082120080_4_copy_thumb.jpg","galleries_id":469247,"width":160});
thumbnails[8922072] = clik.newPhoto({"link":"photo_8922072.html","caption":"Snake Eels, Belieze","height":120,"id":8922072,"server_id":31,"src":"BELIZE082120081_8_copy_thumb.jpg","galleries_id":469247,"width":160});
thumbnails[8922074] = clik.newPhoto({"link":"photo_8922074.html","caption":"Arrow Head Spider Crab, Belieze","height":120,"id":8922074,"server_id":31,"src":"BELIZE082120082_3_copy_thumb.jpg","galleries_id":469247,"width":160});
thumbnails[8922075] = clik.newPhoto({"link":"photo_8922075.html","caption":"Diver, Belieze","height":120,"id":8922075,"server_id":31,"src":"BELIZE082120086_10_copy_thumb.jpg","galleries_id":469247,"width":160});
thumbnails[8922112] = clik.newPhoto({"link":"photo_8922112.html","caption":"Caye Calker","height":236,"id":8922112,"server_id":31,"src":"Caye_Calker_house_2_copy_thumb.jpg","galleries_id":469247,"width":160});
thumbnails[8922164] = clik.newPhoto({"link":"photo_8922164.html","caption":"Davie","height":120,"id":8922164,"server_id":31,"src":"P5111153_thumb.JPG","galleries_id":464663,"width":160});
thumbnails[9132565] = clik.newPhoto({"link":"photo_9132565.html","caption":"","height":108,"id":9132565,"server_id":31,"src":"Anenome_FIsh_4_thumb.jpg","galleries_id":477923,"width":160});
thumbnails[9132570] = clik.newPhoto({"link":"photo_9132570.html","caption":"","height":108,"id":9132570,"server_id":31,"src":"Anenome_FIsh_5_thumb.jpg","galleries_id":477923,"width":160});
thumbnails[9132659] = clik.newPhoto({"link":"photo_9132659.html","caption":"","height":213,"id":9132659,"server_id":31,"src":"Diver_2_thumb.jpg","galleries_id":477923,"width":160});
thumbnails[9132759] = clik.newPhoto({"link":"photo_9132759.html","caption":"","height":212,"id":9132759,"server_id":31,"src":"Gae_1_thumb.jpg","galleries_id":477923,"width":160});
thumbnails[9132767] = clik.newPhoto({"link":"photo_9132767.html","caption":"","height":106,"id":9132767,"server_id":31,"src":"Khau_Lak_Beach_1_thumb.jpg","galleries_id":477923,"width":160});
thumbnails[9132773] = clik.newPhoto({"link":"photo_9132773.html","caption":"","height":120,"id":9132773,"server_id":31,"src":"Leaf_fish_1_copy_1_thumb.jpg","galleries_id":477923,"width":160});
thumbnails[9132774] = clik.newPhoto({"link":"photo_9132774.html","caption":"","height":229,"id":9132774,"server_id":31,"src":"Leopart_Moray_1_thumb.jpg","galleries_id":477923,"width":160});
thumbnails[9132779] = clik.newPhoto({"link":"photo_9132779.html","caption":"","height":120,"id":9132779,"server_id":31,"src":"Nudibramch_2_thumb.JPG","galleries_id":477923,"width":160});
thumbnails[9132781] = clik.newPhoto({"link":"photo_9132781.html","caption":"","height":119,"id":9132781,"server_id":31,"src":"Nudibranch_4_thumb.jpg","galleries_id":477923,"width":160});
thumbnails[9132792] = clik.newPhoto({"link":"photo_9132792.html","caption":"Sleeping Puffer Fish","height":122,"id":9132792,"server_id":31,"src":"Puffer_2_thumb.jpg","galleries_id":477923,"width":160});
thumbnails[9142984] = clik.newPhoto({"link":"photo_9142984.html","caption":"","height":120,"id":9142984,"server_id":31,"src":"White_Mouth_Moray_1_thumb.jpg","galleries_id":468070,"width":160});
thumbnails[9143017] = clik.newPhoto({"link":"photo_9143017.html","caption":"","height":107,"id":9143017,"server_id":31,"src":"Anenome_Fish_2_thumb.jpg","galleries_id":468070,"width":160});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
galleries[484332] = clik.newGallery({"photoIDs":[9169913,9169946,9169956,9169966,9169978,9169985,9170027,9170081,9174603,9169928],"link":"gallery_484332.html","skipIndex":0,"section_code":"gallery","id":484332,"parentGallery":"","featured_images":"9170081,9169985","maxRecords":0,"usePopups":false,"singleSection":false,"title":"Loch Fyne"});galleries[464663] = clik.newGallery({"photoIDs":[8832484,8871618,8871770,8898630,8898846,8899324,8921980,8921983,8921986,8921992,8922164],"link":"gallery_464663.html","skipIndex":0,"section_code":"gallery","id":464663,"parentGallery":"","featured_images":"8922164,8921992,8921986,8921983,8921980,8899324,8898846,8898630,8871770,8871618","maxRecords":0,"usePopups":false,"singleSection":false,"title":"Scottish Scuba Diving"});galleries[464664] = clik.newGallery({"photoIDs":[8871786,8871799,8871811,8871827,8871838,8871852,8898123,8898129,8898135,8898352,8898384,8898436,8899354,8899620],"link":"gallery_464664.html","skipIndex":0,"section_code":"gallery","id":464664,"parentGallery":"","featured_images":"8899620,8899354,8898436,8898384,8898352,8898135,8898129,8898123,8871827,8871811,8871799,8871786","maxRecords":0,"usePopups":false,"singleSection":false,"title":"Indonesia"});galleries[468070] = clik.newGallery({"photoIDs":[8899630,8903216,8903222,8903225,8903272,9142984,9143017],"link":"gallery_468070.html","skipIndex":0,"section_code":"gallery","id":468070,"parentGallery":"","featured_images":8903216,"maxRecords":0,"usePopups":false,"singleSection":false,"title":"Maldives"});galleries[469247] = clik.newGallery({"photoIDs":[8922010,8922017,8922072,8922074,8922075,8922112],"link":"gallery_469247.html","skipIndex":0,"section_code":"gallery","id":469247,"parentGallery":"","featured_images":"8922112,8922075,8922074,8922072,8922017,8922010","maxRecords":0,"usePopups":false,"singleSection":false,"title":"Belize"});galleries[468974] = clik.newGallery({"photoIDs":[8914977,8914984,8914986,8914988,8914989,8915002,8915003,8915006,8915010,8915012,8915013,8915014,8915016],"link":"gallery_468974.html","skipIndex":0,"section_code":"gallery","id":468974,"parentGallery":"","featured_images":"8915016,8915014,8915013,8915012,8915010,8915006,8915003,8915002,8914989,8914988,8914986,8914984,8914977","maxRecords":0,"usePopups":false,"singleSection":false,"title":"St Kilda, Scotland"});galleries[477923] = clik.newGallery({"photoIDs":[9089762,9089764,9089765,9089766,9089767,9132578,9132565,9132570,9132659,9132759,9132767,9132773,9132774,9132779,9132781,9132792],"link":"gallery_477923.html","skipIndex":0,"section_code":"gallery","id":477923,"parentGallery":"","featured_images":"9132578,9089767,9089766,9089765,9089764,9089762","maxRecords":0,"usePopups":false,"singleSection":false,"title":"Thailand "});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[3] = '9170027,9169978,9089764,9089762,8914986,8903222,8899630,8871852,8871838';
imageSets[2] = '9170081,9169985,9132578,9089767,9089766,9089765,9089764,9089762,8922164,8922112,8922075,8922074,8922072,8922060,8922017,8922015,8922010,8921992,8921986,8921983,8921980,8915016,8915014,8915013,8915012,8915010,8915006,8915003,8915002,8914989,8914988,8914986,8914984,8914977,8903272,8903225,8903222,8903216,8899620,8899354,8899324,8898846,8898630,8898436,8898384,8898352,8898135,8898129,8898123,8871827,8871811,8871799,8871786,8871770,8871618';
imageSets[1] = '9174603,9170081,9132578,9089764,9089762,8922075,8921992,8915374,8914986,8903225,8899630,8871838,8832484';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/fifekelpies/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/fifekelpies/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/fifekelpies/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/fifekelpies/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/fifekelpies/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/fifekelpies/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/fifekelpies/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/fifekelpies/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/fifekelpies/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/fifekelpies/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/fifekelpies/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/fifekelpies/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/fifekelpies/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/fifekelpies/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/fifekelpies/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/fifekelpies/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/fifekelpies/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/fifekelpies/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/fifekelpies/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/fifekelpies/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/fifekelpies/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/fifekelpies/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/fifekelpies/images';
		break;
	}
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/fifekelpies/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/fifekelpies/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/fifekelpies/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/fifekelpies/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 || photos || {})[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:'',$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 = 'Fife Kelpies Scuba Diving: ' + 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>';
	}
			
				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>Order this print:</p>';
				temp += '<div class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> ' + (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.item_price !== '') {
			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;
	}
}

		

