window.thumbnails = {};
															thumbnails[1775949] = clik.newPhoto({"id":1775949,"src":"Grasshopper3_thumb.jpg","galleries_id":394756,"server_id":18,"link":"photo_1775949.html","width":130,"caption":"","height":85});
															thumbnails[1775953] = clik.newPhoto({"id":1775953,"src":"Horses_thumb.jpg","galleries_id":119418,"server_id":18,"link":"photo_1775953.html","width":130,"caption":"","height":86});
															thumbnails[1775956] = clik.newPhoto({"id":1775956,"src":"Kingfisher_thumb.jpg","galleries_id":235217,"server_id":18,"link":"photo_1775956.html","width":130,"caption":"","height":85});
															thumbnails[1775961] = clik.newPhoto({"id":1775961,"src":"Swallows Feeding_thumb.jpg","galleries_id":121677,"server_id":18,"link":"photo_1775961.html","width":130,"caption":"","height":83});
															thumbnails[2767808] = clik.newPhoto({"id":2767808,"src":"Wild Geese_thumb.jpg","galleries_id":394755,"server_id":18,"link":"photo_2767808.html","width":130,"caption":"","height":88});
															thumbnails[3869739] = clik.newPhoto({"id":3869739,"src":"Otter_thumb.jpg","galleries_id":235241,"server_id":18,"link":"photo_3869739.html","width":130,"caption":"","height":80});
															thumbnails[3892709] = clik.newPhoto({"id":3892709,"src":"Rabbit_thumb.jpg","galleries_id":119418,"server_id":18,"link":"photo_3892709.html","width":130,"caption":"","height":89});
															thumbnails[7295671] = clik.newPhoto({"id":7295671,"src":"_DSC0667_thumb.jpg","galleries_id":134262,"server_id":18,"link":"photo_7295671.html","width":130,"caption":"","height":86});
															thumbnails[7295673] = clik.newPhoto({"id":7295673,"src":"_DSC0624_thumb.jpg","galleries_id":134262,"server_id":18,"link":"photo_7295673.html","width":130,"caption":"","height":86});
															thumbnails[7295674] = clik.newPhoto({"id":7295674,"src":"_DSC0816_thumb.jpg","galleries_id":134262,"server_id":18,"link":"photo_7295674.html","width":130,"caption":"","height":86});
															thumbnails[7295675] = clik.newPhoto({"id":7295675,"src":"_DSC0819_thumb.jpg","galleries_id":134262,"server_id":18,"link":"photo_7295675.html","width":130,"caption":"","height":87});
															thumbnails[7295676] = clik.newPhoto({"id":7295676,"src":"_DSC1548_thumb.jpg","galleries_id":235217,"server_id":18,"link":"photo_7295676.html","width":130,"caption":"","height":87});
															thumbnails[7295677] = clik.newPhoto({"id":7295677,"src":"_DSC5956_thumb.jpg","galleries_id":121677,"server_id":18,"link":"photo_7295677.html","width":130,"caption":"","height":96});
															thumbnails[7295680] = clik.newPhoto({"id":7295680,"src":"_DSC6577_thumb.jpg","galleries_id":235217,"server_id":18,"link":"photo_7295680.html","width":130,"caption":"","height":86});
															thumbnails[7296398] = clik.newPhoto({"id":7296398,"src":"_DSC6613_thumb.jpg","galleries_id":235217,"server_id":18,"link":"photo_7296398.html","width":130,"caption":"","height":87});
															thumbnails[7296400] = clik.newPhoto({"id":7296400,"src":"Red_Squirell1_thumb.jpg","galleries_id":134262,"server_id":18,"link":"photo_7296400.html","width":130,"caption":"","height":83});
															thumbnails[7296446] = clik.newPhoto({"id":7296446,"src":"Red_Squirrel_thumb.jpg","galleries_id":134262,"server_id":18,"link":"photo_7296446.html","width":130,"caption":"","height":87});
															thumbnails[7296449] = clik.newPhoto({"id":7296449,"src":"_DSC7261_thumb.jpg","galleries_id":235217,"server_id":18,"link":"photo_7296449.html","width":130,"caption":"","height":87});
															thumbnails[7296452] = clik.newPhoto({"id":7296452,"src":"_DSC7304_thumb.jpg","galleries_id":235217,"server_id":18,"link":"photo_7296452.html","width":130,"caption":"","height":87});
															thumbnails[7296455] = clik.newPhoto({"id":7296455,"src":"Swan_lift_off_thumb.jpg","galleries_id":235217,"server_id":18,"link":"photo_7296455.html","width":130,"caption":"","height":80});
															thumbnails[7296457] = clik.newPhoto({"id":7296457,"src":"_DSC6146_8BD689E1-1EC9-D45B-1CF897C393F26B4C_thumb.jpg","galleries_id":235217,"server_id":18,"link":"photo_7296457.html","width":130,"caption":"","height":87});
															thumbnails[7296460] = clik.newPhoto({"id":7296460,"src":"_DSC6235_thumb.jpg","galleries_id":235217,"server_id":18,"link":"photo_7296460.html","width":130,"caption":"","height":86});
															thumbnails[7296463] = clik.newPhoto({"id":7296463,"src":"_DSC6474_thumb.jpg","galleries_id":235217,"server_id":18,"link":"photo_7296463.html","width":130,"caption":"","height":87});
															thumbnails[7296466] = clik.newPhoto({"id":7296466,"src":"_DSC6422_thumb.jpg","galleries_id":121677,"server_id":18,"link":"photo_7296466.html","width":130,"caption":"","height":86});
															thumbnails[7296468] = clik.newPhoto({"id":7296468,"src":"_DSC6806_thumb.jpg","galleries_id":121677,"server_id":18,"link":"photo_7296468.html","width":130,"caption":"","height":86});
															thumbnails[7296471] = clik.newPhoto({"id":7296471,"src":"_DSC6968_thumb.jpg","galleries_id":394756,"server_id":18,"link":"photo_7296471.html","width":130,"caption":"","height":87});
															thumbnails[7296472] = clik.newPhoto({"id":7296472,"src":"_DSC6997nx_thumb.jpg","galleries_id":394756,"server_id":18,"link":"photo_7296472.html","width":130,"caption":"","height":87});
															thumbnails[7296474] = clik.newPhoto({"id":7296474,"src":"_DSC7080_thumb.jpg","galleries_id":394755,"server_id":18,"link":"photo_7296474.html","width":130,"caption":"","height":92});
															thumbnails[7296476] = clik.newPhoto({"id":7296476,"src":"_DSC79441_thumb.jpg","galleries_id":394755,"server_id":18,"link":"photo_7296476.html","width":130,"caption":"","height":92});
															thumbnails[7296503] = clik.newPhoto({"id":7296503,"src":"_DSC8684_thumb.jpg","galleries_id":394756,"server_id":18,"link":"photo_7296503.html","width":130,"caption":"","height":86});
															thumbnails[7296506] = clik.newPhoto({"id":7296506,"src":"_DSC8696_thumb.jpg","galleries_id":394756,"server_id":18,"link":"photo_7296506.html","width":130,"caption":"","height":86});
															thumbnails[7296507] = clik.newPhoto({"id":7296507,"src":"_DSC9874_nx_thumb.jpg","galleries_id":235241,"server_id":18,"link":"photo_7296507.html","width":130,"caption":"","height":86});
															thumbnails[7296510] = clik.newPhoto({"id":7296510,"src":"_DSC6354_thumb.jpg","galleries_id":235217,"server_id":18,"link":"photo_7296510.html","width":130,"caption":"","height":87});
															thumbnails[7296511] = clik.newPhoto({"id":7296511,"src":"_DSC6577_8BEED8AE-1EC9-D45B-1C0DA61C333A1FE7_thumb.jpg","galleries_id":235217,"server_id":18,"link":"photo_7296511.html","width":130,"caption":"","height":86});
															thumbnails[7296513] = clik.newPhoto({"id":7296513,"src":"_DSC6652_thumb.jpg","galleries_id":235217,"server_id":18,"link":"photo_7296513.html","width":130,"caption":"","height":87});
															thumbnails[7296518] = clik.newPhoto({"id":7296518,"src":"_DSC6692_thumb.jpg","galleries_id":235217,"server_id":18,"link":"photo_7296518.html","width":130,"caption":"","height":86});
															thumbnails[7297486] = clik.newPhoto({"id":7297486,"src":"_DSC7111_thumb.jpg","galleries_id":394755,"server_id":18,"link":"photo_7297486.html","width":130,"caption":"","height":87});
															thumbnails[7297487] = clik.newPhoto({"id":7297487,"src":"_DSC7131_thumb.jpg","galleries_id":235214,"server_id":18,"link":"photo_7297487.html","width":130,"caption":"","height":87});
															thumbnails[7297489] = clik.newPhoto({"id":7297489,"src":"_DSC7182_thumb.jpg","galleries_id":394755,"server_id":18,"link":"photo_7297489.html","width":130,"caption":"","height":92});
															thumbnails[7297490] = clik.newPhoto({"id":7297490,"src":"_DSC7656_thumb.jpg","galleries_id":394755,"server_id":18,"link":"photo_7297490.html","width":130,"caption":"","height":87});
															thumbnails[7297491] = clik.newPhoto({"id":7297491,"src":"_DSC7763_thumb.jpg","galleries_id":394755,"server_id":18,"link":"photo_7297491.html","width":130,"caption":"","height":92});
															thumbnails[7297494] = clik.newPhoto({"id":7297494,"src":"_DSC7964_thumb.jpg","galleries_id":394755,"server_id":18,"link":"photo_7297494.html","width":130,"caption":"","height":92});
															thumbnails[7297496] = clik.newPhoto({"id":7297496,"src":"_DSC8162_thumb.jpg","galleries_id":121677,"server_id":18,"link":"photo_7297496.html","width":130,"caption":"","height":86});
															thumbnails[7297497] = clik.newPhoto({"id":7297497,"src":"_DSC8561_thumb.jpg","galleries_id":119418,"server_id":18,"link":"photo_7297497.html","width":130,"caption":"","height":87});
															thumbnails[7297500] = clik.newPhoto({"id":7297500,"src":"_MB02258_thumb.jpg","galleries_id":119418,"server_id":18,"link":"photo_7297500.html","width":130,"caption":"","height":100});
															thumbnails[7297502] = clik.newPhoto({"id":7297502,"src":"Feeder2_thumb.jpg","galleries_id":121677,"server_id":18,"link":"photo_7297502.html","width":130,"caption":"","height":87});
															thumbnails[7297503] = clik.newPhoto({"id":7297503,"src":"Fox_cub_thumb.jpg","galleries_id":235214,"server_id":18,"link":"photo_7297503.html","width":130,"caption":"","height":56});
															thumbnails[7297505] = clik.newPhoto({"id":7297505,"src":"Grey_Squirrel_15x10_thumb.jpg","galleries_id":134262,"server_id":18,"link":"photo_7297505.html","width":130,"caption":"","height":87});
															thumbnails[7297513] = clik.newPhoto({"id":7297513,"src":"Puffin_thumb.jpg","galleries_id":394755,"server_id":18,"link":"photo_7297513.html","width":130,"caption":"","height":92});
															thumbnails[7318578] = clik.newPhoto({"id":7318578,"src":"_ACT6256_thumb.jpg","galleries_id":254015,"server_id":18,"link":"photo_7318578.html","width":130,"caption":"","height":184});
															thumbnails[7318579] = clik.newPhoto({"id":7318579,"src":"_ACT6273_thumb.jpg","galleries_id":254015,"server_id":18,"link":"photo_7318579.html","width":130,"caption":"","height":194});
															thumbnails[7318582] = clik.newPhoto({"id":7318582,"src":"Deer11_thumb.jpg","galleries_id":254015,"server_id":18,"link":"photo_7318582.html","width":130,"caption":"","height":87});
															thumbnails[7318583] = clik.newPhoto({"id":7318583,"src":"Deer12_thumb.jpg","galleries_id":254015,"server_id":18,"link":"photo_7318583.html","width":130,"caption":"","height":86});
															thumbnails[7318586] = clik.newPhoto({"id":7318586,"src":"_DSC7086_thumb.jpg","galleries_id":394755,"server_id":18,"link":"photo_7318586.html","width":130,"caption":"","height":86});
															thumbnails[7318588] = clik.newPhoto({"id":7318588,"src":"_DSC7652_thumb.jpg","galleries_id":394755,"server_id":18,"link":"photo_7318588.html","width":130,"caption":"","height":92});
															thumbnails[7318589] = clik.newPhoto({"id":7318589,"src":"_DSC7870_thumb.jpg","galleries_id":121677,"server_id":18,"link":"photo_7318589.html","width":130,"caption":"","height":92});
															thumbnails[7318590] = clik.newPhoto({"id":7318590,"src":"_DSC8188_thumb.jpg","galleries_id":121677,"server_id":18,"link":"photo_7318590.html","width":130,"caption":"","height":92});
															thumbnails[7318592] = clik.newPhoto({"id":7318592,"src":"_DSC8687_thumb.jpg","galleries_id":119418,"server_id":18,"link":"photo_7318592.html","width":130,"caption":"","height":92});
															thumbnails[7318593] = clik.newPhoto({"id":7318593,"src":"Ducks_in_flight_15x8_thumb.jpg","galleries_id":235217,"server_id":18,"link":"photo_7318593.html","width":130,"caption":"","height":92});
															thumbnails[7318594] = clik.newPhoto({"id":7318594,"src":"Goose_thumb.jpg","galleries_id":235217,"server_id":18,"link":"photo_7318594.html","width":130,"caption":"","height":86});
															thumbnails[7318595] = clik.newPhoto({"id":7318595,"src":"Hare_thumb.jpg","galleries_id":119418,"server_id":18,"link":"photo_7318595.html","width":130,"caption":"","height":87});
															thumbnails[7318596] = clik.newPhoto({"id":7318596,"src":"_DSC5332_thumb.jpg","galleries_id":235217,"server_id":18,"link":"photo_7318596.html","width":130,"caption":"","height":195});
															thumbnails[7318656] = clik.newPhoto({"id":7318656,"src":"_DSC5307_thumb.jpg","galleries_id":235214,"server_id":18,"link":"photo_7318656.html","width":130,"caption":"","height":92});
															thumbnails[7318658] = clik.newPhoto({"id":7318658,"src":"_DSC7102_thumb.jpg","galleries_id":235214,"server_id":18,"link":"photo_7318658.html","width":130,"caption":"","height":92});
															thumbnails[7318659] = clik.newPhoto({"id":7318659,"src":"_DSC7145_thumb.jpg","galleries_id":235214,"server_id":18,"link":"photo_7318659.html","width":130,"caption":"","height":92});
															thumbnails[7318662] = clik.newPhoto({"id":7318662,"src":"_PAS9256_thumb.jpg","galleries_id":235214,"server_id":18,"link":"photo_7318662.html","width":130,"caption":"","height":92});
															thumbnails[7864569] = clik.newPhoto({"id":7864569,"src":"Badger_thumb.jpg","galleries_id":119418,"server_id":18,"link":"photo_7864569.html","width":130,"caption":"","height":98});
															thumbnails[7919072] = clik.newPhoto({"id":7919072,"src":"Dipper_thumb.jpg","galleries_id":235217,"server_id":18,"link":"photo_7919072.html","width":130,"caption":"","height":90});
															thumbnails[7919073] = clik.newPhoto({"id":7919073,"src":"Kingfisher_662F06AD-1E4F-37DC-71812C76DD74BA31_thumb.jpg","galleries_id":235217,"server_id":18,"link":"photo_7919073.html","width":130,"caption":"","height":95});
															thumbnails[8055282] = clik.newPhoto({"id":8055282,"src":"Last_supper_thumb.jpg","galleries_id":235217,"server_id":18,"link":"photo_8055282.html","width":130,"caption":"","height":92});
															thumbnails[8106715] = clik.newPhoto({"id":8106715,"src":"Owls_thumb.jpg","galleries_id":119418,"server_id":18,"link":"photo_8106715.html","width":130,"caption":"","height":86});
															thumbnails[9057765] = clik.newPhoto({"id":9057765,"src":"Clonmelcc_mbolger_03_thumb_D98BA29C-1EC9-DFB6-098849EAE289B83A.jpg","galleries_id":394756,"server_id":18,"link":"photo_9057765.html","width":130,"caption":"Snail","height":95});
															thumbnails[7297512] = clik.newPhoto({"id":7297512,"src":"Kingfisher_8EB3E55D-1EC9-D45B-1C926B213EFC7015_thumb.jpg","galleries_id":235217,"server_id":18,"link":"photo_7297512.html","width":130,"caption":"","height":92});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[119418] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Wildlife","link":"gallery_119418.html","maxRecords":0.0,"photoIDs":[1775953.0,3892709.0,7297497.0,7297500.0,7318592.0,7318595.0,7864569.0,8106715.0],"skipIndex":0,"section_code":"gallery","featured_images":"8106715,7864569,7318595,7318592,7297500,7297497,3892709,1775953","id":119418,"singleSection":false});				  						galleries[121677] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Garden Birds","link":"gallery_121677.html","maxRecords":0.0,"photoIDs":[1775961.0,7295677.0,7296466.0,7296468.0,7297496.0,7297502.0,7318589.0,7318590.0],"skipIndex":0,"section_code":"gallery","featured_images":"7318590,7318589,7297502,7297496,7296468,7296466,7295677,1775961","id":121677,"singleSection":false});				  						galleries[235217] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"River Birds","link":"gallery_235217.html","maxRecords":0.0,"photoIDs":[1775956.0,7295676.0,7295680.0,7296398.0,7296449.0,7296452.0,7296455.0,7296457.0,7296460.0,7296463.0,7296510.0,7296511.0,7296513.0,7296518.0,7318593.0,7318594.0,7318596.0,7919072.0,7919073.0,8055282.0,7297512.0],"skipIndex":0,"section_code":"gallery","featured_images":"8055282,7919073,7919072,7318596,7318594,7318593,7297512,7296518,7296513,7296511","id":235217,"singleSection":false});				  						galleries[134262] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Squirells","link":"gallery_134262.html","maxRecords":0.0,"photoIDs":[7295671.0,7295673.0,7295674.0,7295675.0,7296400.0,7296446.0,7297505.0],"skipIndex":0,"section_code":"gallery","featured_images":"7297505,7296446,7296400,7295675,7295674,7295673,7295671","id":134262,"singleSection":false});				  						galleries[254015] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Deer","link":"gallery_254015.html","maxRecords":0.0,"photoIDs":[7318578.0,7318579.0,7318582.0,7318583.0],"skipIndex":0,"section_code":"gallery","featured_images":"7318583,7318582,7318579,7318578","id":254015,"singleSection":false});				  						galleries[235241] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Otters","link":"gallery_235241.html","maxRecords":0.0,"photoIDs":[3869739.0,7296507.0],"skipIndex":0,"section_code":"gallery","featured_images":"7296507,3869739","id":235241,"singleSection":false});				  						galleries[235214] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Foxes","link":"gallery_235214.html","maxRecords":0.0,"photoIDs":[7297487.0,7297503.0,7318656.0,7318658.0,7318659.0,7318662.0],"skipIndex":0,"section_code":"gallery","featured_images":"7318662,7318659,7318658,7318656,7297503,7297487","id":235214,"singleSection":false});				  						galleries[394755] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Coastal Birds","link":"gallery_394755.html","maxRecords":0.0,"photoIDs":[2767808.0,7296474.0,7296476.0,7297486.0,7297489.0,7297490.0,7297491.0,7297494.0,7297513.0,7318586.0,7318588.0],"skipIndex":0,"section_code":"gallery","featured_images":"7318588,7318586,7297513,7297494,7297491,7297490,7297489,7297486,7296476,7296474","id":394755,"singleSection":false});				  						galleries[394756] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Insects","link":"gallery_394756.html","maxRecords":0.0,"photoIDs":[1775949.0,7296471.0,7296472.0,7296503.0,7296506.0,9057765.0],"skipIndex":0,"section_code":"gallery","featured_images":"9057765,7296506,7296503,7296472,7296471,1775949","id":394756,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '9057765,8055282,7919073,7919072,7864569,7297503,7296463,1775953,7297512';
imageSets[3] = '9057765,8106715,8055282,7919073,7919072,7864569,7318662,7318659,7318658,7318656,7318596,7318595,7318594,7318593,7318592,7318590,7318589,7318588,7318586,7318583,7318582,7318579,7318578,7297513,7297512,7297505,7297503,7297502,7297500,7297497,7297496,7297494,7297491,7297490,7297489,7297487,7297486,7296518,7296513,7296511,7296510,7296507,7296506,7296503,7296476,7296474,7296472,7296471,7296468,7296466';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/bolgerm/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/bolgerm/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/bolgerm/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/bolgerm/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/bolgerm/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/bolgerm/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/bolgerm/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/bolgerm/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/bolgerm/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/bolgerm/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/bolgerm/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/bolgerm/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/bolgerm/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/bolgerm/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/bolgerm/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/bolgerm/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/bolgerm/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/bolgerm/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/bolgerm/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/bolgerm/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/bolgerm/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/bolgerm/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/bolgerm/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/bolgerm/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/bolgerm/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/bolgerm/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/bolgerm/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 = photoCaption + ': bolgerphoto.com';
			    }
        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.takendate != '') {
		
		temp += '<div class="imageinfo" id="imageDate"><strong>Date: </strong>' + this.takendate + '</div>';
	}
	
	if (this.location != '') {
		
		temp += '<div class="imageinfo" id="imageLocation"><strong> </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="updateCartValue($(this.form).next(\'#paymentForm\')[0],this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value); if(divShowing(\'paymentConfirm\')){fadeOut(\'paymentConfirm\', 3)};">';
		
		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">';
			temp += '	<input type="hidden" name="item_option" value="' + item_option + '">';
			temp += '	<input type="hidden" name="site" value="BOLGERM">';
			temp += '	<input type="hidden" name="item_number" value="'+ this.id +'">';
			temp += '	<input type="hidden" name="quantity" value="1">';
						temp += '	<input value="Add to cart" id="paymentAddButton" class="button" onmouseover="this.className=\'buttonHi\'\;" onmouseout="this.className=\'button\'\;" type="Button">';
							temp += '	<input value="View cart" id="paymentViewButton" class="button" onmouseover="this.className=\'buttonHi\';" onmouseout="this.className=\'button\';" type="Button" onclick="javascript:window.location=\'cart.html\'">';
			temp += '</form>';
						temp += '<div class="clearing">&nbsp;</div>';
			temp += '<div id="confirmContainer">';
			temp += '<div id="paymentConfirm">Item added to cart</div>';
			temp += '</div>';
			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;
	}
}

			

