window.thumbnails = {};
															thumbnails[7098995] = clik.newPhoto({"id":7098995,"src":"StMarys2_filtered_thumb.jpg","galleries_id":152152,"server_id":32,"link":"photo_7098995.html","width":130,"caption":"St. Marys New Ross","height":182});
															thumbnails[5325819] = clik.newPhoto({"id":5325819,"src":"Lunar_Eclipse_09_thumb.jpg","galleries_id":152152,"server_id":32,"link":"photo_5325819.html","width":130,"caption":"Lunar Eclipse New Years Eve 2009","height":87});
															thumbnails[2347927] = clik.newPhoto({"id":2347927,"src":"Dnndelion_thumb.jpg","galleries_id":152149,"server_id":32,"link":"photo_2347927.html","width":130,"caption":"Dandelion Seed Head","height":88});
															thumbnails[2347995] = clik.newPhoto({"id":2347995,"src":"GreatSaltee_thumb.jpg","galleries_id":152152,"server_id":32,"link":"photo_2347995.html","width":130,"caption":"Great Saltee Island","height":82});
															thumbnails[2357206] = clik.newPhoto({"id":2357206,"src":"Ganet_Nesting_thumb.jpg","galleries_id":152133,"server_id":32,"link":"photo_2357206.html","width":130,"caption":"Gannet Nesting","height":87});
															thumbnails[2357304] = clik.newPhoto({"id":2357304,"src":"swan_thumb.jpg","galleries_id":152133,"server_id":32,"link":"photo_2357304.html","width":130,"caption":"Swan Family","height":91});
															thumbnails[2361422] = clik.newPhoto({"id":2361422,"src":"swallow_curragh_thumb.JPG","galleries_id":152133,"server_id":32,"link":"photo_2361422.html","width":130,"caption":"Feed Me!","height":86});
															thumbnails[2404920] = clik.newPhoto({"id":2404920,"src":"seal2_thumb.jpg","galleries_id":152148,"server_id":32,"link":"photo_2404920.html","width":130,"caption":"Grey Seal","height":93});
															thumbnails[2404926] = clik.newPhoto({"id":2404926,"src":"seal1_thumb.JPG","galleries_id":152148,"server_id":32,"link":"photo_2404926.html","width":130,"caption":"Young Seal","height":93});
															thumbnails[3121206] = clik.newPhoto({"id":3121206,"src":"gtest_thumb.jpg","galleries_id":152133,"server_id":32,"link":"photo_3121206.html","width":130,"caption":"Gannet in Flight","height":83});
															thumbnails[3296381] = clik.newPhoto({"id":3296381,"src":"_MG_2845_thumb.jpg","galleries_id":152133,"server_id":32,"link":"photo_3296381.html","width":130,"caption":"Natures' Acrobat","height":173});
															thumbnails[3296390] = clik.newPhoto({"id":3296390,"src":"goldy1_thumb.jpg","galleries_id":152133,"server_id":32,"link":"photo_3296390.html","width":130,"caption":"Goldfinch On Teasel","height":174});
															thumbnails[3296421] = clik.newPhoto({"id":3296421,"src":"fledglings1_thumb.jpg","galleries_id":152133,"server_id":32,"link":"photo_3296421.html","width":130,"caption":"Swallow Fledglings","height":85});
															thumbnails[3296422] = clik.newPhoto({"id":3296422,"src":"greenfinch female_thumb.jpg","galleries_id":152133,"server_id":32,"link":"photo_3296422.html","width":130,"caption":"Female Greenfinch","height":166});
															thumbnails[3296429] = clik.newPhoto({"id":3296429,"src":"GUILLEMOT1_thumb.jpg","galleries_id":152133,"server_id":32,"link":"photo_3296429.html","width":130,"caption":"Guillemot","height":195});
															thumbnails[3296434] = clik.newPhoto({"id":3296434,"src":"Robin1_thumb.jpg","galleries_id":152133,"server_id":32,"link":"photo_3296434.html","width":130,"caption":"Robin","height":195});
															thumbnails[3296448] = clik.newPhoto({"id":3296448,"src":"swallow082_thumb.jpg","galleries_id":152133,"server_id":32,"link":"photo_3296448.html","width":130,"caption":"Swallow Feeding Chicks","height":90});
															thumbnails[3306043] = clik.newPhoto({"id":3306043,"src":"CoalTit08_1_thumb.jpg","galleries_id":152133,"server_id":32,"link":"photo_3306043.html","width":130,"caption":"Autumn Coal Tit","height":153});
															thumbnails[3316061] = clik.newPhoto({"id":3316061,"src":"curlew_thumb.jpg","galleries_id":152133,"server_id":32,"link":"photo_3316061.html","width":130,"caption":"Curlew","height":90});
															thumbnails[3316068] = clik.newPhoto({"id":3316068,"src":"Heron-Flight_thumb.jpg","galleries_id":152133,"server_id":32,"link":"photo_3316068.html","width":130,"caption":"Grey Heron","height":70});
															thumbnails[3316092] = clik.newPhoto({"id":3316092,"src":"snail3_thumb.jpg","galleries_id":152150,"server_id":32,"link":"photo_3316092.html","width":130,"caption":"Brown Lipped Snail","height":83});
															thumbnails[3320504] = clik.newPhoto({"id":3320504,"src":"IMG_0175_thumb.jpg","galleries_id":152152,"server_id":32,"link":"photo_3320504.html","width":130,"caption":"Hook Head Twilight","height":82});
															thumbnails[3320505] = clik.newPhoto({"id":3320505,"src":"IMG_1277_thumb.jpg","galleries_id":152152,"server_id":32,"link":"photo_3320505.html","width":130,"caption":"Conor Pass View","height":87});
															thumbnails[3320512] = clik.newPhoto({"id":3320512,"src":"wildgarlic1_thumb.jpg","galleries_id":152152,"server_id":32,"link":"photo_3320512.html","width":130,"caption":"Wild Garlic","height":87});
															thumbnails[3320516] = clik.newPhoto({"id":3320516,"src":"Barrow_thumb.jpg","galleries_id":152152,"server_id":32,"link":"photo_3320516.html","width":130,"caption":"Barrow Towpath February Morning","height":87});
															thumbnails[3603489] = clik.newPhoto({"id":3603489,"src":"BHG_2_thumb.jpg","galleries_id":152133,"server_id":32,"link":"photo_3603489.html","width":130,"caption":"In Flight","height":87});
															thumbnails[3603496] = clik.newPhoto({"id":3603496,"src":"chaff_thumb.jpg","galleries_id":152133,"server_id":32,"link":"photo_3603496.html","width":130,"caption":"Chaffinch","height":171});
															thumbnails[3809889] = clik.newPhoto({"id":3809889,"src":"_MG_4152_thumb.jpg","galleries_id":152133,"server_id":32,"link":"photo_3809889.html","width":130,"caption":"Mute Swan","height":82});
															thumbnails[3818289] = clik.newPhoto({"id":3818289,"src":"BOroVale_HDR_2_thumb.jpg","galleries_id":152152,"server_id":32,"link":"photo_3818289.html","width":130,"caption":"","height":87});
															thumbnails[3828987] = clik.newPhoto({"id":3828987,"src":"moon_rise_thumb.jpg","galleries_id":152152,"server_id":32,"link":"photo_3828987.html","width":130,"caption":"Moon Rise ","height":87});
															thumbnails[3852038] = clik.newPhoto({"id":3852038,"src":"PLADY_thumb.jpg","galleries_id":152150,"server_id":32,"link":"photo_3852038.html","width":130,"caption":"Painted Lady","height":87});
															thumbnails[4262034] = clik.newPhoto({"id":4262034,"src":"earlypurpleorchid2_thumb.jpg","galleries_id":152149,"server_id":32,"link":"photo_4262034.html","width":130,"caption":"Pyramidal Orchid","height":183});
															thumbnails[4357682] = clik.newPhoto({"id":4357682,"src":"PSEDIT2_edited-1_filtered_thumb.jpg","galleries_id":152148,"server_id":32,"link":"photo_4357682.html","width":130,"caption":"Badger Cub","height":104});
															thumbnails[4579862] = clik.newPhoto({"id":4579862,"src":"Badger2_1st_thumb.jpg","galleries_id":152148,"server_id":32,"link":"photo_4579862.html","width":130,"caption":"Badger","height":128});
															thumbnails[4579882] = clik.newPhoto({"id":4579882,"src":"Badger3_filtered_thumb.jpg","galleries_id":152148,"server_id":32,"link":"photo_4579882.html","width":130,"caption":"Badger","height":184});
															thumbnails[4750577] = clik.newPhoto({"id":4750577,"src":"Bee21_thumb.jpg","galleries_id":152150,"server_id":32,"link":"photo_4750577.html","width":130,"caption":"Bee & Balsam","height":92});
															thumbnails[4860482] = clik.newPhoto({"id":4860482,"src":"Clash_thumb.jpg","galleries_id":152152,"server_id":32,"link":"photo_4860482.html","width":130,"caption":"Clashganny Lock View","height":195});
															thumbnails[5779823] = clik.newPhoto({"id":5779823,"src":"Badger2010_thumb.jpg","galleries_id":152148,"server_id":32,"link":"photo_5779823.html","width":130,"caption":"Adult Badger","height":87});
															thumbnails[6138630] = clik.newPhoto({"id":6138630,"src":"Fly_thumb.jpg","galleries_id":152150,"server_id":32,"link":"photo_6138630.html","width":130,"caption":"Fly Close Up","height":92});
															thumbnails[6553234] = clik.newPhoto({"id":6553234,"src":"Carlow-harvest_filteredA4_thumb.jpg","galleries_id":152152,"server_id":32,"link":"photo_6553234.html","width":130,"caption":"Carlow Harvest","height":92});
															thumbnails[6553271] = clik.newPhoto({"id":6553271,"src":"GraiguenamanaghBridge_thumb.jpg","galleries_id":152152,"server_id":32,"link":"photo_6553271.html","width":130,"caption":"Graiguenamanagh Bridge","height":184});
															thumbnails[6558482] = clik.newPhoto({"id":6558482,"src":"Emerging_filtered_thumb.jpg","galleries_id":152148,"server_id":32,"link":"photo_6558482.html","width":130,"caption":"Badger Emerging","height":92});
															thumbnails[6563363] = clik.newPhoto({"id":6563363,"src":"_MG_7071_edited-3_thumb.jpg","galleries_id":152133,"server_id":32,"link":"photo_6563363.html","width":130,"caption":"Goldfinch On Gorse","height":184});
															thumbnails[6563364] = clik.newPhoto({"id":6563364,"src":"_MG_8873_thumb.jpg","galleries_id":152133,"server_id":32,"link":"photo_6563364.html","width":130,"caption":"Turnstone","height":87});
															thumbnails[6563366] = clik.newPhoto({"id":6563366,"src":"_MG_8906_thumb.jpg","galleries_id":152133,"server_id":32,"link":"photo_6563366.html","width":130,"caption":"Dunlin","height":87});
															thumbnails[6563370] = clik.newPhoto({"id":6563370,"src":"_MG_9025_edited-1_thumb.jpg","galleries_id":152150,"server_id":32,"link":"photo_6563370.html","width":130,"caption":"Lost in Ragworth","height":195});
															thumbnails[6563372] = clik.newPhoto({"id":6563372,"src":"CockCrow3_filteredA4_thumb.jpg","galleries_id":152133,"server_id":32,"link":"photo_6563372.html","width":130,"caption":"Pheasant Crowing","height":92});
															thumbnails[6563376] = clik.newPhoto({"id":6563376,"src":"Insect_reflection_thumb.jpg","galleries_id":152150,"server_id":32,"link":"photo_6563376.html","width":130,"caption":"Sawfly Reflection","height":92});
															thumbnails[6563379] = clik.newPhoto({"id":6563379,"src":"Insect_reflection2_thumb.jpg","galleries_id":152150,"server_id":32,"link":"photo_6563379.html","width":130,"caption":"Sawfly","height":92});
															thumbnails[6563380] = clik.newPhoto({"id":6563380,"src":"Newt_thumb.jpg","galleries_id":152150,"server_id":32,"link":"photo_6563380.html","width":130,"caption":"Smooth Newt","height":184});
															thumbnails[6563383] = clik.newPhoto({"id":6563383,"src":"_MG_1891_thumb.jpg","galleries_id":152133,"server_id":32,"link":"photo_6563383.html","width":130,"caption":"Atlantic Puffin","height":89});
															thumbnails[6563388] = clik.newPhoto({"id":6563388,"src":"_MG_8705_filtered_thumb.jpg","galleries_id":152133,"server_id":32,"link":"photo_6563388.html","width":130,"caption":"Herring Gull","height":87});
															thumbnails[6563391] = clik.newPhoto({"id":6563391,"src":"commonfrog_thumb.jpg","galleries_id":152150,"server_id":32,"link":"photo_6563391.html","width":130,"caption":"Frog & Buttercup","height":84});
															thumbnails[6563392] = clik.newPhoto({"id":6563392,"src":"dungfly_86BD6FAA-24E8-5EC4-4F21C2A86C2D6182_thumb.jpg","galleries_id":152150,"server_id":32,"link":"photo_6563392.html","width":130,"caption":"Dung Fly","height":94});
															thumbnails[6563395] = clik.newPhoto({"id":6563395,"src":"Fallow_86BE113A-24E8-5EC4-4F4E6500A039B94A_thumb.jpg","galleries_id":152148,"server_id":32,"link":"photo_6563395.html","width":130,"caption":"Fallow Deer","height":87});
															thumbnails[6563397] = clik.newPhoto({"id":6563397,"src":"Fulmar_edited-1_thumb.jpg","galleries_id":152133,"server_id":32,"link":"photo_6563397.html","width":130,"caption":"Fulmar","height":195});
															thumbnails[6563398] = clik.newPhoto({"id":6563398,"src":"Jackdaw_thumb.jpg","galleries_id":152133,"server_id":32,"link":"photo_6563398.html","width":130,"caption":"Jackdaw","height":87});
															thumbnails[6563406] = clik.newPhoto({"id":6563406,"src":"_MG_7491_edited-31_thumb.jpg","galleries_id":152133,"server_id":32,"link":"photo_6563406.html","width":130,"caption":"Eagle Owl (Captive)","height":92});
															thumbnails[6574947] = clik.newPhoto({"id":6574947,"src":"QueenWasp2_thumb.jpg","galleries_id":152150,"server_id":32,"link":"photo_6574947.html","width":130,"caption":"Queen Wasp","height":86});
															thumbnails[6574949] = clik.newPhoto({"id":6574949,"src":"rabbit08_filtered_thumb.jpg","galleries_id":152148,"server_id":32,"link":"photo_6574949.html","width":130,"caption":"Wild Rabbit","height":87});
															thumbnails[6574952] = clik.newPhoto({"id":6574952,"src":"rabbit-trio2_filtered_thumb.jpg","galleries_id":152148,"server_id":32,"link":"photo_6574952.html","width":130,"caption":"Rabbit Trio","height":90});
															thumbnails[6574955] = clik.newPhoto({"id":6574955,"src":"rabbit09_thumb.jpg","galleries_id":152148,"server_id":32,"link":"photo_6574955.html","width":130,"caption":"Under the Furze","height":184});
															thumbnails[6574956] = clik.newPhoto({"id":6574956,"src":"select-sharp-copy_filtered_thumb.jpg","galleries_id":152133,"server_id":32,"link":"photo_6574956.html","width":130,"caption":"Redpoll","height":87});
															thumbnails[6574961] = clik.newPhoto({"id":6574961,"src":"YRabbits-test_thumb.jpg","galleries_id":152148,"server_id":32,"link":"photo_6574961.html","width":130,"caption":"Young Rabbits","height":85});
															thumbnails[6727281] = clik.newPhoto({"id":6727281,"src":"Grasshopper_thumb.jpg","galleries_id":152150,"server_id":32,"link":"photo_6727281.html","width":130,"caption":"Grasshopper","height":130});
															thumbnails[6727324] = clik.newPhoto({"id":6727324,"src":"Froglet_filtered_thumb.jpg","galleries_id":152150,"server_id":32,"link":"photo_6727324.html","width":130,"caption":"Froglet","height":87});
															thumbnails[6727359] = clik.newPhoto({"id":6727359,"src":"_MG_9679_filtered_thumb.jpg","galleries_id":152150,"server_id":32,"link":"photo_6727359.html","width":130,"caption":"Ichneumon Wasp","height":87});
															thumbnails[6780414] = clik.newPhoto({"id":6780414,"src":"_MG_9826_thumb.jpg","galleries_id":152149,"server_id":32,"link":"photo_6780414.html","width":130,"caption":"Fungi","height":195});
															thumbnails[6892998] = clik.newPhoto({"id":6892998,"src":"_MG_9894_filtered_web_thumb.jpg","galleries_id":152133,"server_id":32,"link":"photo_6892998.html","width":130,"caption":"Take Off","height":83});
															thumbnails[6893003] = clik.newPhoto({"id":6893003,"src":"IMG_9940_filtered_web_thumb.jpg","galleries_id":152133,"server_id":32,"link":"photo_6893003.html","width":130,"caption":"Water Off A Ducks Back","height":81});
															thumbnails[7663781] = clik.newPhoto({"id":7663781,"src":"5628009018_038e91cd98_b_thumb.jpg","galleries_id":152148,"server_id":32,"link":"photo_7663781.html","width":130,"caption":"Badger Leaving Sett","height":87});
															thumbnails[7898569] = clik.newPhoto({"id":7898569,"src":"_MG_1426_edited-1_thumb.jpg","galleries_id":152148,"server_id":32,"link":"photo_7898569.html","width":130,"caption":"Brown Rat","height":87});
															thumbnails[6587587] = clik.newPhoto({"id":6587587,"src":"Spider_thumb.jpg","galleries_id":152150,"server_id":32,"link":"photo_6587587.html","width":130,"caption":"House Spider","height":68});
															thumbnails[7154573] = clik.newPhoto({"id":7154573,"src":"ROBIN-_pse_thumb.jpg","galleries_id":200533,"server_id":32,"link":"photo_7154573.html","width":130,"caption":"Winter Robin","height":195});
															thumbnails[7154577] = clik.newPhoto({"id":7154577,"src":"BTIT_PSE_thumb.jpg","galleries_id":200533,"server_id":32,"link":"photo_7154577.html","width":130,"caption":"","height":195});
															thumbnails[7902606] = clik.newPhoto({"id":7902606,"src":"Rabbit_2011_filtered_thumb.jpg","galleries_id":200533,"server_id":32,"link":"photo_7902606.html","width":130,"caption":"Grazer","height":87});
															thumbnails[7975011] = clik.newPhoto({"id":7975011,"src":"Standing_Guard_filtered_thumb.jpg","galleries_id":200533,"server_id":32,"link":"photo_7975011.html","width":130,"caption":"Standing Guard","height":87});
															thumbnails[7975020] = clik.newPhoto({"id":7975020,"src":"_MG_1713_filtered_thumb.jpg","galleries_id":200533,"server_id":32,"link":"photo_7975020.html","width":130,"caption":"Puffin","height":87});
															thumbnails[7975054] = clik.newPhoto({"id":7975054,"src":"StampingRabbit_filtered_thumb.jpg","galleries_id":200533,"server_id":32,"link":"photo_7975054.html","width":130,"caption":"Young Rabbit","height":87});
															thumbnails[8075358] = clik.newPhoto({"id":8075358,"src":"Long-eared-owl_filtered_thumb.jpg","galleries_id":200533,"server_id":32,"link":"photo_8075358.html","width":130,"caption":"Long Eared Owl","height":92});
															thumbnails[8649998] = clik.newPhoto({"id":8649998,"src":"Website_thumb.jpg","galleries_id":200533,"server_id":32,"link":"photo_8649998.html","width":130,"caption":"Grey Squirrel","height":87});
															thumbnails[8650193] = clik.newPhoto({"id":8650193,"src":"HR_thumb.jpg","galleries_id":200533,"server_id":32,"link":"photo_8650193.html","width":130,"caption":"Puffin & Sandeels","height":95});
															thumbnails[8650197] = clik.newPhoto({"id":8650197,"src":"Meles-meles_filtered_270ABE7E-1EC9-D45B-1C715E6AC44D1761_thumb.jpg","galleries_id":200533,"server_id":32,"link":"photo_8650197.html","width":130,"caption":"Coming Out","height":92});
															thumbnails[8927330] = clik.newPhoto({"id":8927330,"src":"BlueTit_Web_thumb_5D9C587E-1EC9-D45B-1C258782F3125475.gif","galleries_id":200533,"server_id":32,"link":"photo_8927330.html","width":130,"caption":"Blue Tit","height":87});
															thumbnails[8927331] = clik.newPhoto({"id":8927331,"src":"Goldfinch_Dec2011_edited-1_thumb.jpg","galleries_id":200533,"server_id":32,"link":"photo_8927331.html","width":130,"caption":"Goldfinch","height":87});
															thumbnails[9037280] = clik.newPhoto({"id":9037280,"src":"Coal-TitFinal-_2011_filtere_thumb.jpg","galleries_id":200533,"server_id":32,"link":"photo_9037280.html","width":130,"caption":"Coal Tit","height":87});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[200533] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"RECENT Photos","link":"section235950.html","maxRecords":0.0,"photoIDs":[7154573.0,7154577.0,7902606.0,7975011.0,7975020.0,7975054.0,8075358.0,8649998.0,8650193.0,8650197.0,8927330.0,8927331.0,9037280.0],"skipIndex":0,"section_code":"section235950","featured_images":"9037280,8927331,8927330,8650197,8650193,8649998,8075358,7975054,7975020,7975011","id":200533,"singleSection":true});				  						galleries[152133] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"BIRDS","link":"gallery_152133.html","maxRecords":0.0,"photoIDs":[2357206.0,2357304.0,2361422.0,3121206.0,3296381.0,3296390.0,3296421.0,3296422.0,3296429.0,3296434.0,3296448.0,3306043.0,3316061.0,3316068.0,3603489.0,3603496.0,3809889.0,6563363.0,6563364.0,6563366.0,6563372.0,6563383.0,6563388.0,6563397.0,6563398.0,6563406.0,6574956.0,6892998.0,6893003.0],"skipIndex":0,"section_code":"gallery","featured_images":"6893003,6892998,6574956,6563406,6563398,6563397,6563388,6563383,6563372,6563366","id":152133,"singleSection":false});				  						galleries[152148] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"MAMMALS","link":"gallery_152148.html","maxRecords":0.0,"photoIDs":[2404920.0,2404926.0,4357682.0,4579862.0,4579882.0,5779823.0,6558482.0,6563395.0,6574949.0,6574952.0,6574955.0,6574961.0,7663781.0,7898569.0],"skipIndex":0,"section_code":"gallery","featured_images":"7898569,7663781,6574961,6574955,6574952,6574949,6563395,6558482,5779823,4579882","id":152148,"singleSection":false});				  						galleries[152149] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"FLORA","link":"gallery_152149.html","maxRecords":0.0,"photoIDs":[2347927.0,4262034.0,6780414.0],"skipIndex":0,"section_code":"gallery","featured_images":"6780414,4262034,2347927","id":152149,"singleSection":false});				  						galleries[152150] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"MACRO & CLOSE UP","link":"gallery_152150.html","maxRecords":0.0,"photoIDs":[3316092.0,3852038.0,4750577.0,6138630.0,6563370.0,6563376.0,6563379.0,6563380.0,6563391.0,6563392.0,6574947.0,6727281.0,6727324.0,6727359.0,6587587.0],"skipIndex":0,"section_code":"gallery","featured_images":3852038.0,"id":152150,"singleSection":false});				  						galleries[152152] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"LANDSCAPES","link":"gallery_152152.html","maxRecords":0.0,"photoIDs":[7098995.0,5325819.0,2347995.0,3320504.0,3320505.0,3320512.0,3320516.0,3818289.0,3828987.0,4860482.0,6553234.0,6553271.0],"skipIndex":0,"section_code":"gallery","featured_images":3818289.0,"id":152152,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '9037280,8927331,8650197,8650193,8649998,7975054,6558482';
imageSets[2] = '3852038,3818289';
imageSets[3] = '8650197,8650193,8649998,8075358,7975054,7975020,7154577,7154573,6727281,6563398,6563380,6563372,6558482';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/Padraig/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/Padraig/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/Padraig/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/Padraig/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/Padraig/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/Padraig/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/Padraig/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/Padraig/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/Padraig/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/Padraig/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/Padraig/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/Padraig/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/Padraig/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/Padraig/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/Padraig/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/Padraig/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/Padraig/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/Padraig/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/Padraig/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/Padraig/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/Padraig/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/Padraig/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/Padraig/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/Padraig/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/Padraig/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/Padraig/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/Padraig/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 = 'Padraig Kavanagh WILDSHOTS: ' + 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 using PayPal:</p>';
				temp += '<div class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> &euro;' + (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="kavanagh.padraig@gmail.com">';
					temp += '<input type="hidden" name="currency_code" value="EUR">';
					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=\"Add to cart\" 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="kavanagh.padraig@gmail.com">';
				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;
	}
}

			

