window.thumbnails = new Object();
												thumbnails[1034325] = new thumbnail(1034325,'76911','Foxgloves at Dreghorn','Foxglovesdreghorn_thumb.jpg',130, 87,18,'photo_1034325.html');
												thumbnails[1788751] = new thumbnail(1788751,'76905','Pentland Hills above mist from Allermuir Hill','HillsabovemistfromAllermuir_thumb.jpg',130, 86,18,'photo_1788751.html');
												thumbnails[4452969] = new thumbnail(4452969,'76910','Lambs','Lambs_thumb.jpg',130, 87,18,'photo_4452969.html');
												thumbnails[4458655] = new thumbnail(4458655,'76906','Harlaw Reservoir Dam','HarlawReservoirDam_thumb.jpg',130, 88,18,'photo_4458655.html');
												thumbnails[4458726] = new thumbnail(4458726,'76909','West Water Reservoir','Westwater_thumb.jpg',130, 87,18,'photo_4458726.html');
												thumbnails[4458777] = new thumbnail(4458777,'120403','A Winters Morning, Penicuik','Wintermorningpenicuik_thumb.jpg',130, 87,18,'photo_4458777.html');
												thumbnails[4535704] = new thumbnail(4535704,'260527','The Forth Road and Rail Bridges from Allermuir Hill','BridgesfromAllermuir_thumb.jpg',130, 87,18,'photo_4535704.html');
												thumbnails[7543152] = new thumbnail(7543152,'408268','Evening on Glencorse Reservoir','EveningonGlencorse_Reservoir_thumb.jpg',130, 87,18,'photo_7543152.html');
												thumbnails[1030765] = new thumbnail(1030765,'76906','Threipmuir Reservoir sunset','Threipmuirsunset_thumb.jpg',130, 87,18,'photo_1030765.html');
												thumbnails[1034263] = new thumbnail(1034263,'76910','Mallard ducks','Pairofmallards_thumb.jpg',130, 87,18,'photo_1034263.html');
												thumbnails[1034351] = new thumbnail(1034351,'76911','Gean (flowering cherry)','floweringgean_thumb.jpg',130, 87,18,'photo_1034351.html');
												thumbnails[4458641] = new thumbnail(4458641,'76906','Red Moss Nature Reserve','Cottongrassredmoss_thumb.jpg',130, 87,18,'photo_4458641.html');
												thumbnails[4458688] = new thumbnail(4458688,'76905','Sunset on Clubbiedean Reservoir','Sunsetclubbiedean_thumb.jpg',130, 88,18,'photo_4458688.html');
												thumbnails[4458714] = new thumbnail(4458714,'76909','West Linton Golf Course','Westlintongolfcourse_thumb.jpg',130, 87,18,'photo_4458714.html');
												thumbnails[4458732] = new thumbnail(4458732,'120403','The Pentland Hills from Gorebridge','PentlandHillsfromGowkshill_thumb.jpg',130, 86,18,'photo_4458732.html');
												thumbnails[4535716] = new thumbnail(4535716,'260527','Quarrel Burn Reservoir from South Black Hill','QuarrelburnReservoir_thumb.jpg',130, 87,18,'photo_4535716.html');
												thumbnails[7543156] = new thumbnail(7543156,'408268','Heather and Loganlea Reservoir','HeatherLoganleareservoir_thumb.jpg',130, 87,18,'photo_7543156.html');
												thumbnails[1030779] = new thumbnail(1030779,'76906','Bavelaw Marsh','Bavelawmarsh_thumb.jpg',130, 87,18,'photo_1030779.html');
												thumbnails[1582434] = new thumbnail(1582434,'76909','Kitchen Moss','KitchenMoss_thumb.jpg',130, 87,18,'photo_1582434.html');
												thumbnails[1030771] = new thumbnail(1030771,'76906','Beech Avenue','Beechavenue_thumb.jpg',130, 87,18,'photo_1030771.html');
												thumbnails[1033217] = new thumbnail(1033217,'76909','Heather, Old Kirk Road','Heatherkirkroad_thumb.jpg',130, 87,18,'photo_1033217.html');
												thumbnails[1034264] = new thumbnail(1034264,'76910','Peacock butterfly','Peacockbutterfly_thumb.jpg',130, 89,18,'photo_1034264.html');
												thumbnails[1034346] = new thumbnail(1034346,'76911','Bonnet Mycena (Mycena galericulata)','Bonnetmycena_thumb.jpg',130, 87,18,'photo_1034346.html');
												thumbnails[1582014] = new thumbnail(1582014,'120403','Penicuik and The Pentland Hills from the air','Penicuik from Balloon reduced_thumb.jpg',130, 87,18,'photo_1582014.html');
												thumbnails[4458548] = new thumbnail(4458548,'76907','Castlelaw Hill reflected in Glencorse Reservoir','Castlelawreflected_thumb.jpg',130, 87,18,'photo_4458548.html');
												thumbnails[4458691] = new thumbnail(4458691,'76905','Frost on the boardwalk Torduff Reservoir','Tordufftowerbridge_thumb.jpg',130, 88,18,'photo_4458691.html');
												thumbnails[4535734] = new thumbnail(4535734,'260527','Pot of gold in Gilmerton','Rainbowgilmerton_thumb.jpg',130, 87,18,'photo_4535734.html');
												thumbnails[7543164] = new thumbnail(7543164,'408268',' A Snow covered Castlelaw Hill from near Roslin','Snowycastlelawfromkirkkettle_thumb.jpg',130, 93,18,'photo_7543164.html');
												thumbnails[1031133] = new thumbnail(1031133,'120403','Pentland Hills sunset','Pentlandridgesunset_thumb.jpg',130, 49,18,'photo_1031133.html');
												thumbnails[1033231] = new thumbnail(1033231,'76909','West Kip, Scald Law and South Black Hill<br>\r\n','WestkipandScaldlaw_thumb.jpg',130, 87,18,'photo_1033231.html');
												thumbnails[1034349] = new thumbnail(1034349,'76911','Snow on gorse flowers','snowongorse_thumb.jpg',130, 195,18,'photo_1034349.html');
												thumbnails[4452991] = new thumbnail(4452991,'76910','Stoat and rabbit','Stoatandrabbit_thumb.jpg',130, 79,18,'photo_4452991.html');
												thumbnails[4458574] = new thumbnail(4458574,'76907','Snow topped Carnethy and Turnhouse Hills','SnowtoppedCarnethyandTurnhouse_thumb.jpg',130, 87,18,'photo_4458574.html');
												thumbnails[4458649] = new thumbnail(4458649,'76906','An Autumnal Harlaw Reservoir','Harlawreservoirbay_thumb.jpg',130, 87,18,'photo_4458649.html');
												thumbnails[4458695] = new thumbnail(4458695,'76905','The upper reaches of Boghall Glen','upperBoghallGlen_thumb.jpg',130, 87,18,'photo_4458695.html');
												thumbnails[4535748] = new thumbnail(4535748,'260527','Rainbow and Woodhouselee Hill','Rainbowwoodhouselee_thumb.jpg',130, 87,18,'photo_4535748.html');
												thumbnails[7543169] = new thumbnail(7543169,'408268','Red Sky at Red Moss','Redskyatnightredmoss_thumb.jpg',130, 82,18,'photo_7543169.html');
												thumbnails[1114823] = new thumbnail(1114823,'120403','Pentland Hills Sunset from Cauldhall Moor','sunsetfromcauldhallmoor_thumb.jpg',130, 34,18,'photo_1114823.html');
												thumbnails[1030759] = new thumbnail(1030759,'76905','Torduff Waterfall<br>\r\n','Torduffwaterfall_thumb.jpg',130, 87,18,'photo_1030759.html');
												thumbnails[1030782] = new thumbnail(1030782,'76906','Geese and West Kip','Geeseandwestkip_thumb.jpg',130, 87,18,'photo_1030782.html');
												thumbnails[1034267] = new thumbnail(1034267,'76910','Pair of mating toads','Pairoftoads_thumb.jpg',130, 87,18,'photo_1034267.html');
												thumbnails[1034327] = new thumbnail(1034327,'76911','Cuckoo Flower','Cuckooflower_thumb.jpg',130, 195,18,'photo_1034327.html');
												thumbnails[1767852] = new thumbnail(1767852,'260527','Sunrise from Turnhouse Hill','Turnhouse Hill sunrise_thumb.jpg',130, 87,18,'photo_1767852.html');
												thumbnails[4458579] = new thumbnail(4458579,'76907','Logan Burn and a snowy Castlelaw Hill','snowycastlelaw_thumb.jpg',130, 87,18,'photo_4458579.html');
												thumbnails[4458746] = new thumbnail(4458746,'120403','Snow covered Pentland Hills from Howgate','Snowyridgefromhowgate_thumb.jpg',130, 55,18,'photo_4458746.html');
												thumbnails[7543292] = new thumbnail(7543292,'408268','Snowy Glencorse Burn','snowyglencorseburn_thumb.jpg',130, 87,18,'photo_7543292.html');
												thumbnails[1030761] = new thumbnail(1030761,'76905','Hillend Country Park','Hillendwoodland_thumb.jpg',130, 87,18,'photo_1030761.html');
												thumbnails[1034269] = new thumbnail(1034269,'76910','Green-veined White butterfly','Greenveinedwhitebutterfly_thumb.jpg',130, 87,18,'photo_1034269.html');
												thumbnails[1034356] = new thumbnail(1034356,'76911','Common Spotted Orchid<br>\r\n','Commonspottedorchid_thumb.jpg',130, 195,18,'photo_1034356.html');
												thumbnails[4458681] = new thumbnail(4458681,'76906','The Kips reflected in Threipmuir Reservoir','Threipmuirreservoirtower_thumb.jpg',130, 87,18,'photo_4458681.html');
												thumbnails[4458812] = new thumbnail(4458812,'120403','Winter Sunrise','Wintersunrise_thumb.jpg',130, 87,18,'photo_4458812.html');
												thumbnails[7543182] = new thumbnail(7543182,'408268','Snowdrops at Boghall Farm','snowdropsboghall_thumb.jpg',130, 87,18,'photo_7543182.html');
												thumbnails[1030774] = new thumbnail(1030774,'76906','Harvest time at Harlaw','Harvesttimeharlaw_thumb.jpg',130, 87,18,'photo_1030774.html');
												thumbnails[1030793] = new thumbnail(1030793,'76906','Black Springs','Blacksprings_thumb.jpg',130, 87,18,'photo_1030793.html');
												thumbnails[1030813] = new thumbnail(1030813,'120403','Turnhouse Hill and Black Hill','SnowyTurnhousefromCastlelaw_thumb.jpg',130, 45,18,'photo_1030813.html');
												thumbnails[1034276] = new thumbnail(1034276,'76910','Large Red Damselfly','Largereddamselflfiesmating_thumb.jpg',130, 87,18,'photo_1034276.html');
												thumbnails[1034358] = new thumbnail(1034358,'76911','Dandelion (seed head)','Dandilionseedhead_thumb.jpg',130, 87,18,'photo_1034358.html');
												thumbnails[1582111] = new thumbnail(1582111,'76905','Laverockdale','Laverockdale_thumb.jpg',130, 96,18,'photo_1582111.html');
												thumbnails[4453030] = new thumbnail(4453030,'76907','Carnethy and Turnhouse Hills','Carnethyandturnhouse_thumb.jpg',130, 87,18,'photo_4453030.html');
												thumbnails[1030801] = new thumbnail(1030801,'76906','Threipmuir Reservoir from Redford Bridge','Viewfromredfordbridge_thumb.jpg',130, 87,18,'photo_1030801.html');
												thumbnails[1031155] = new thumbnail(1031155,'76907','Carnethy Hill','Carnethyhill_thumb.jpg',130, 87,18,'photo_1031155.html');
												thumbnails[1034290] = new thumbnail(1034290,'76910','Golden Plover','Goldenplover_thumb.jpg',130, 87,18,'photo_1034290.html');
												thumbnails[1034361] = new thumbnail(1034361,'76911','Trees in the mist','treesinmist_thumb.jpg',130, 87,18,'photo_1034361.html');
												thumbnails[1030807] = new thumbnail(1030807,'76906','Field of oil seed rape and Black Hill','Blackhillandrape_thumb.jpg',130, 87,18,'photo_1030807.html');
												thumbnails[1034295] = new thumbnail(1034295,'76910','Wood mouse','Woodmouse_thumb.jpg',130, 87,18,'photo_1034295.html');
												thumbnails[1767854] = new thumbnail(1767854,'76905','Clubbiedean Reservoir','Clubbiedean Reservoir_thumb.jpg',130, 85,18,'photo_1767854.html');
												thumbnails[7543194] = new thumbnail(7543194,'408268','East Cairn Hill and Cairns Castle','Eastcairnhillandcairns_thumb.jpg',130, 87,18,'photo_7543194.html');
												thumbnails[1030745] = new thumbnail(1030745,'76905','Boghall Burn','Boghallburn copy_thumb.jpg',130, 87,18,'photo_1030745.html');
												thumbnails[1034265] = new thumbnail(1034265,'76910','Tufted duck','Tuftedduck_thumb.jpg',130, 87,18,'photo_1034265.html');
												thumbnails[1497410] = new thumbnail(1497410,'76907','Bells Hill reflected in Glencorse Reservoir','Bells Hill reflected in Glencorse copy_thumb.jpg',130, 86,18,'photo_1497410.html');
												thumbnails[1497491] = new thumbnail(1497491,'76906','Harbour Hill from Harlaw in the snow','Harbour Hill from Harlaw in snow copy_thumb.jpg',130, 85,18,'photo_1497491.html');
												thumbnails[7543207] = new thumbnail(7543207,'408268','Highland Cow and Calf','Highland_cow_and_calf_thumb.jpg',130, 87,18,'photo_7543207.html');
												thumbnails[1030751] = new thumbnail(1030751,'76905','Gorse in Boghall Glen','Boghallglen_thumb.jpg',130, 87,18,'photo_1030751.html');
												thumbnails[1582365] = new thumbnail(1582365,'76907','Glencorse Burn in Autumn','Autumn Glencorse Burn_thumb.jpg',130, 87,18,'photo_1582365.html');
												thumbnails[1582487] = new thumbnail(1582487,'76910','\"Give us a kiss\"','Give us a kiss copy_thumb.jpg',130, 190,18,'photo_1582487.html');
												thumbnails[1615198] = new thumbnail(1615198,'76906','Sunset over East Cairn Hill and Threipmuir Reservoir','ThreipmuirReservoirSunset_thumb.jpg',130, 87,18,'photo_1615198.html');
												thumbnails[7543212] = new thumbnail(7543212,'408268','Reflections on Harlaw Reservoir','reflectionsonharlawreservoir_thumb.jpg',130, 87,18,'photo_7543212.html');
												thumbnails[1033244] = new thumbnail(1033244,'76910','Highland calf','Highlandcalf_thumb.jpg',130, 87,18,'photo_1033244.html');
												thumbnails[1582134] = new thumbnail(1582134,'76907','Beech Trees and Carnethy Hill','Beech Trees and Carnethy Hill_thumb.jpg',130, 88,18,'photo_1582134.html');
												thumbnails[1582145] = new thumbnail(1582145,'76905','Inside \'T\' Wood','Inside T Wood_thumb.jpg',130, 89,18,'photo_1582145.html');
												thumbnails[1767868] = new thumbnail(1767868,'76906','Frosty Trees','Frosty Trees_thumb.jpg',130, 87,18,'photo_1767868.html');
												thumbnails[7543225] = new thumbnail(7543225,'408268','Mist over Midlothian','mistovermidlothian_thumb.jpg',130, 87,18,'photo_7543225.html');
												thumbnails[1030753] = new thumbnail(1030753,'76905','Bonaly Reservoir','Bonalyreservoir_thumb.jpg',130, 87,18,'photo_1030753.html');
												thumbnails[1030785] = new thumbnail(1030785,'76906','Harlaw Reservoir','Harlawreservoir_thumb.jpg',130, 87,18,'photo_1030785.html');
												thumbnails[1031145] = new thumbnail(1031145,'76907','Snowy view from Castlelaw Hill','Viewfromasnowycastlelawhill_thumb.jpg',130, 87,18,'photo_1031145.html');
												thumbnails[7543234] = new thumbnail(7543234,'408268','Turnhouse Hill','Snowyturnhousefromdaisydell_thumb.jpg',130, 87,18,'photo_7543234.html');
												thumbnails[1030756] = new thumbnail(1030756,'76905','Whitehill Wood, Bonaly Country Park','Whitehillwood_thumb.jpg',130, 91,18,'photo_1030756.html');
												thumbnails[1034266] = new thumbnail(1034266,'76910','Lamb','Lamb_thumb.jpg',130, 87,18,'photo_1034266.html');
												thumbnails[1582033] = new thumbnail(1582033,'76907','Loganlea Reservoir and Castlelaw Hill','Loganlea from the Howe_thumb.jpg',130, 87,18,'photo_1582033.html');
												thumbnails[7543241] = new thumbnail(7543241,'408268','Life on a Daisy','lifeonadaisy_thumb.jpg',130, 82,18,'photo_7543241.html');
												thumbnails[1030815] = new thumbnail(1030815,'76907','Glencorse Burn in Spring','Glencorseburn_thumb.jpg',130, 87,18,'photo_1030815.html');
												thumbnails[1031117] = new thumbnail(1031117,'76907','Snowy Glencorse Reservoir','Snowyglencorse_thumb.jpg',130, 87,18,'photo_1031117.html');
												thumbnails[1497476] = new thumbnail(1497476,'76907','A Wintery Turnhouse Hill','Snowy Turnhouse copy_thumb.jpg',130, 85,18,'photo_1497476.html');
												thumbnails[1031110] = new thumbnail(1031110,'76907','Carnethy Hill, Scald Law and the Kips','RidgefromFalaKnoweimp_thumb.jpg',130, 87,18,'photo_1031110.html');
												thumbnails[4458686] = new thumbnail(4458686,'76905','Hawthorn in bloom near Swanston','HawthornnearSwanston_thumb.jpg',130, 87,18,'photo_4458686.html');
												thumbnails[4458553] = new thumbnail(4458553,'76907','Harbour Hill','Harbourhill_thumb.jpg',130, 87,18,'photo_4458553.html');
												thumbnails[1031160] = new thumbnail(1031160,'76907','Turnhouse Hill and Castlelaw Iron Age Fort','Turnhouseandironagefort_thumb.jpg',130, 87,18,'photo_1031160.html');
												thumbnails[4458699] = new thumbnail(4458699,'76905','View from Allermuir Hill','ViewfromAllermuir_thumb.jpg',130, 87,18,'photo_4458699.html');
												thumbnails[4458684] = new thumbnail(4458684,'76905','Evening Light on Caerketton Hill','CaerkettonHillfromSeafieldTrackred_thumb.jpg',130, 64,18,'photo_4458684.html');
												thumbnails[4458589] = new thumbnail(4458589,'76907','Snowy Pentland Hills from The Howe','Snowyloganvalley_thumb.jpg',130, 87,18,'photo_4458589.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[408268] = new gallery(408268,'7543156','New photos','gallery',[7543152,7543156,7543164,7543169,7543292,7543182,7543194,7543207,7543212,7543225,7543234,7543241],0, 1, '', 'gallery_408268.html',0,0);
				  					galleries[76905] = new gallery(76905,'4458688','Northern Hills','gallery',[1788751,4458688,4458691,4458695,1030759,1030761,1582111,1767854,1030745,1030751,1582145,1030753,1030756,4458686,4458699,4458684],0, 1, '', 'gallery_76905.html',0,0);
				  					galleries[76906] = new gallery(76906,'4458655','Harlaw and Threipmuir','gallery',[4458655,1030765,4458641,1030779,1030771,4458649,1030782,4458681,1030774,1030793,1030801,1030807,1497491,1615198,1767868,1030785],0, 1, '', 'gallery_76906.html',0,0);
				  					galleries[76907] = new gallery(76907,'4458589,4458579,4458574,4458553,4458548,4453030,1582365,1582134,1582033,1497476','Flotterstone Area','gallery',[4458548,4458574,4458579,4453030,1031155,1497410,1582365,1582134,1031145,1582033,1030815,1031117,1497476,1031110,4458553,1031160,4458589],0, 1, '', 'gallery_76907.html',0,0);
				  					galleries[76909] = new gallery(76909,'4458726','Southern Area','gallery',[4458726,4458714,1582434,1033217,1033231],0, 1, '', 'gallery_76909.html',0,0);
				  					galleries[120403] = new gallery(120403,'1030813','Views of the Pentland Hills','gallery',[4458777,4458732,1582014,1031133,1114823,4458746,4458812,1030813],0, 1, '', 'gallery_120403.html',0,0);
				  					galleries[260527] = new gallery(260527,'4535704','Views from the Pentland Hills','gallery',[4535704,4535716,4535734,4535748,1767852],0, 1, '', 'gallery_260527.html',0,0);
				  					galleries[76910] = new gallery(76910,'4452969,1033244','Animals','gallery',[4452969,1034263,1034264,4452991,1034267,1034269,1034276,1034290,1034295,1034265,1582487,1033244,1034266],0, 1, '', 'gallery_76910.html',0,0);
				  					galleries[76911] = new gallery(76911,'1034325','Plants','gallery',[1034325,1034351,1034346,1034349,1034327,1034356,1034358,1034361],0, 1, '', 'gallery_76911.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '4535704,4458655,4452969,1788751,1767854,1582111,1582033';
imageSets[2] = '7543156,4535704,4458726,4458688,4458655,4452969,1034325,1033244,1030813';
imageSets[3] = '7543292,7543241,7543234,7543225,7543212,7543207,7543194,7543182,7543169,7543164,7543156,7543152,4535748,4535734,4535716,4535704,4458812,4458777,4458746,4458732,4458726,4458714,4458699,4458695,4458691,4458688,4458686,4458684,4458681,4458655,4458649,4458641,4458589,4458579,4458574,4458553,4458548,4453030,4452991,4452969,1788751,1767868,1767854,1767852,1615198,1582487,1582434,1582365,1582145,1582134';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/pentlandphotos/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/pentlandphotos/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/pentlandphotos/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/pentlandphotos/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/pentlandphotos/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/pentlandphotos/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/pentlandphotos/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/pentlandphotos/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/pentlandphotos/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/pentlandphotos/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/pentlandphotos/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/pentlandphotos/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/pentlandphotos/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/pentlandphotos/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/pentlandphotos/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/pentlandphotos/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/pentlandphotos/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/pentlandphotos/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/pentlandphotos/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/pentlandphotos/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/pentlandphotos/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/pentlandphotos/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 = 'Pentland Hills Photos: ' + 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>';
	}
					
	temp = temp + this.fnGetPaymentInfo();
				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>Buy now using PayPal:</p>';
				temp = temp + '<p class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> &pound;' + (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 + '<form id="paymentForm" style="margin:0px;border:0px;" name="paymentForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
	temp = 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 = temp + '<input type="hidden" name="cmd" value="_cart">';
	temp = temp + '<input type="hidden" name="business" value="pentlandhillsphotos@yahoo.com">';
	temp = temp + '<input type="hidden" name="currency_code" value="GBP">';
	temp = temp + '<input type="hidden" name="add" value="1">';
					temp = temp + '<input type="hidden" name="amount" value="'+amount+'">';
	temp = temp + '<input type="hidden" name="item_number" value="'+ref+'">';
					temp = temp + '<input type=\"Submit\" value=\"Add to cart\" id=\"paymentAddButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
									temp = temp + '</form>';
								temp = temp + '<form id="paymentCartForm" style="margin:0px;" name="paymentCartForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
	temp = temp + '<input type="hidden" name="cmd" value="_cart">';
	temp = temp + '<input type="hidden" name="business" value="pentlandhillsphotos@yahoo.com">';
	temp = temp + '<input type="hidden" name="display" value="1">';
	temp = temp + '<input type=\"Submit\" value=\"View cart\" id=\"paymentViewButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
	temp = temp + '</form>';
							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;
	}
}

			

