window.thumbnails = new Object();
												thumbnails[3055276] = new thumbnail(3055276,'','','About-me-photo-for-web1_thumb.jpg',130, 211,32,'#');
												thumbnails[6073275] = new thumbnail(6073275,'','','unknown-fly_thumb.jpg',130, 81,32,'#');
												thumbnails[7657644] = new thumbnail(7657644,'179166','','Dandelion-close-up_thumb.jpg',130, 195,32,'photo_7657644.html');
												thumbnails[7657616] = new thumbnail(7657616,'182441','Goldfinch','Goldfinch_thumb.jpg',130, 115,32,'photo_7657616.html');
												thumbnails[6644764] = new thumbnail(6644764,'265473','Female Wasp Spider','orb-web-spider_thumb.jpg',130, 195,32,'photo_6644764.html');
												thumbnails[6045643] = new thumbnail(6045643,'265466','Pair of male Scarce Chaser Dragonflies.','Scarce-Chaser-x-2-males_thumb.jpg',130, 87,32,'photo_6045643.html');
												thumbnails[6045664] = new thumbnail(6045664,'265466','Female Scarce Chaser Dragonfly.','scarce-chaser-female_thumb.jpg',130, 87,32,'photo_6045664.html');
												thumbnails[5862667] = new thumbnail(5862667,'177231','','Grey-squirrel-re-size_thumb.jpg',130, 248,32,'photo_5862667.html');
												thumbnails[5605997] = new thumbnail(5605997,'179173','','Male-adder-close-up-tongue-_thumb.jpg',130, 86,32,'photo_5605997.html');
												thumbnails[5370905] = new thumbnail(5370905,'182441','Barn Owl ','Welney-Barn-Owl_thumb.jpg',130, 139,32,'photo_5370905.html');
												thumbnails[4686916] = new thumbnail(4686916,'265466','Ruddy Darter Dragonfly ','Ruddy-Darter-on-bark_thumb.jpg',130, 89,32,'photo_4686916.html');
												thumbnails[4582293] = new thumbnail(4582293,'265466','Black Darter Dragonfly.','Black-Darter-6-website-shot_thumb.jpg',130, 119,32,'photo_4582293.html');
												thumbnails[4582306] = new thumbnail(4582306,'265466','Black Darter Dragonfly .','Black-Darter-mating-7-websi_thumb.jpg',130, 78,32,'photo_4582306.html');
												thumbnails[4582362] = new thumbnail(4582362,'265466','Migrant Hawker Dragonfly.','Migrant-Hawker_thumb.jpg',130, 195,32,'photo_4582362.html');
												thumbnails[4582589] = new thumbnail(4582589,'179166','Sundew .','Sundew_thumb.jpg',130, 103,32,'photo_4582589.html');
												thumbnails[4592796] = new thumbnail(4592796,'265466','Brown Hawker Dragonfly.','Brown-Hawker-no-4_thumb.jpg',130, 197,32,'photo_4592796.html');
												thumbnails[4592812] = new thumbnail(4592812,'179167','Roydon Common sunrise.','roydon-sunrise_thumb.jpg',130, 97,32,'photo_4592812.html');
												thumbnails[4522315] = new thumbnail(4522315,'182662','Monochrome mushroom','monochrome-toadstool_thumb.jpg',130, 195,32,'photo_4522315.html');
												thumbnails[4522298] = new thumbnail(4522298,'177230','Minotaur Beetle.','minotaur-beetle_thumb.jpg',130, 109,32,'photo_4522298.html');
												thumbnails[4386547] = new thumbnail(4386547,'265466','Common Blue Damselfly.','common-blue-damselfly_thumb.jpg',130, 170,32,'photo_4386547.html');
												thumbnails[4385335] = new thumbnail(4385335,'177231','Stoat at Wicken Fen ,Cambridgeshire.','Stoat_thumb.jpg',130, 72,32,'photo_4385335.html');
												thumbnails[4386536] = new thumbnail(4386536,'179168','Fen Bog Oak.','Fen-bog-oak_thumb.jpg',130, 87,32,'photo_4386536.html');
												thumbnails[4373224] = new thumbnail(4373224,'177230','Common Green Grassshopper','Common-green-grasshopper_thumb.jpg',130, 122,32,'photo_4373224.html');
												thumbnails[4386525] = new thumbnail(4386525,'177230','Hoverfly,West Norfolk.','hoverfly_thumb.jpg',130, 64,32,'photo_4386525.html');
												thumbnails[4386541] = new thumbnail(4386541,'177230','Six Spot Burnet Moth.','six-spot-burnet-moth_thumb.jpg',130, 87,32,'photo_4386541.html');
												thumbnails[4385351] = new thumbnail(4385351,'265466','Emerald Damselfly','Scarce-emerald-damselfly_thumb.jpg',130, 172,32,'photo_4385351.html');
												thumbnails[4290696] = new thumbnail(4290696,'265473','Fen Raft Spider','Fen-Raft-Spider-on-Bladderw_thumb.jpg',130, 104,32,'photo_4290696.html');
												thumbnails[4290713] = new thumbnail(4290713,'265473','Fen Raft spider.','Fen-Raft-no-1_thumb.jpg',130, 130,32,'photo_4290713.html');
												thumbnails[4290802] = new thumbnail(4290802,'265466','Southern Hawker Dragonfly.','Lopham-Southern-Hawker_thumb.jpg',130, 195,32,'photo_4290802.html');
												thumbnails[4212404] = new thumbnail(4212404,'179167','Lakenheath Heath Fen Sunset','Lakenheath-Fen-sunset-no-2_thumb.jpg',130, 195,32,'photo_4212404.html');
												thumbnails[4107114] = new thumbnail(4107114,'177230','Small Tortoiseshell Butterfly','Small-tortoiseshell-best-sh_thumb.jpg',130, 90,32,'photo_4107114.html');
												thumbnails[4107120] = new thumbnail(4107120,'177230','Speckled Bush Cricket','Speckled-bush-cricket_thumb.jpg',130, 121,32,'photo_4107120.html');
												thumbnails[4070919] = new thumbnail(4070919,'177230','Swallowtail Butterfly ','Swallowtail-no-2_thumb.jpg',130, 97,32,'photo_4070919.html');
												thumbnails[4070958] = new thumbnail(4070958,'177230','Swallowtail Butterfly','Swallowtail-no-3_thumb.jpg',130, 93,32,'photo_4070958.html');
												thumbnails[4070967] = new thumbnail(4070967,'265466','Norfolk Hawker Dragonfly','Norfolk-Hawker-no-3-best-sh_thumb.jpg',130, 95,32,'photo_4070967.html');
												thumbnails[3870462] = new thumbnail(3870462,'177230','Comma Butterfly','Comma-butterfly_thumb.jpg',130, 87,32,'photo_3870462.html');
												thumbnails[3870472] = new thumbnail(3870472,'182441','Swallow.','Swallow-at-Cley_thumb.jpg',130, 87,32,'photo_3870472.html');
												thumbnails[3870546] = new thumbnail(3870546,'265468','Common Toad.','Common-Toad_thumb.jpg',130, 87,32,'photo_3870546.html');
												thumbnails[3783725] = new thumbnail(3783725,'177230','Brimstone Butterfly','Brimstone_thumb.jpg',130, 123,32,'photo_3783725.html');
												thumbnails[3817671] = new thumbnail(3817671,'182441','Male Pheasant','Pheasant_thumb.jpg',130, 123,32,'photo_3817671.html');
												thumbnails[3547312] = new thumbnail(3547312,'179173','Male Adder at Roydon Common','Male-adder-Roydon_thumb.jpg',130, 96,32,'photo_3547312.html');
												thumbnails[3547328] = new thumbnail(3547328,'179173','Female Adder , Roydon common ,West Norfolk','Female-adder-Roydon_thumb.jpg',130, 111,32,'photo_3547328.html');
												thumbnails[3547453] = new thumbnail(3547453,'179173','Female Adders at Roydon Common , West Norfolk.','Female-adders-nest_thumb.jpg',130, 117,32,'photo_3547453.html');
												thumbnails[3508847] = new thumbnail(3508847,'179173','Slow worm ','Slow-worm_thumb.jpg',130, 70,32,'photo_3508847.html');
												thumbnails[2951048] = new thumbnail(2951048,'177231','Young Red Deer','Young-red-deer_thumb.jpg',130, 105,32,'photo_2951048.html');
												thumbnails[2946413] = new thumbnail(2946413,'177231','Fallow deer','fALLOW-DEER - Copy_thumb.jpg',130, 195,32,'photo_2946413.html');
												thumbnails[2998942] = new thumbnail(2998942,'177231','Fallow Deer rut','Fallow-bucks_thumb.jpg',130, 62,32,'photo_2998942.html');
												thumbnails[2882374] = new thumbnail(2882374,'177230','Male Roesel\'s bush cricket','Roesel\'s bush cricket_edited-1_thumb.jpg',130, 104,32,'photo_2882374.html');
												thumbnails[2888651] = new thumbnail(2888651,'179173','Coiled female adder','coiled-female-adder_thumb.jpg',130, 91,32,'photo_2888651.html');
												thumbnails[2888683] = new thumbnail(2888683,'179173','Female adder','Female-adder1_thumb.jpg',130, 145,32,'photo_2888683.html');
												thumbnails[2946134] = new thumbnail(2946134,'177230','Flesh  fly on thistle','Flesh-fly_thumb.jpg',130, 114,32,'photo_2946134.html');
												thumbnails[2946322] = new thumbnail(2946322,'265466','Southern Hawker Dragonfly','Southern-Hawker-Aeshna-cyan_thumb.jpg',130, 195,32,'photo_2946322.html');
												thumbnails[2952173] = new thumbnail(2952173,'177230','22 Spot Ladybird','22-spot-ladybird_thumb.jpg',130, 122,32,'photo_2952173.html');
												thumbnails[2952254] = new thumbnail(2952254,'179168','Fallen autumn poplar leaves.','Autumn-leaves_thumb.jpg',130, 87,32,'photo_2952254.html');
												thumbnails[2952256] = new thumbnail(2952256,'179166','Red autumnal leaves','Red-autumn-leaves_thumb.jpg',130, 195,32,'photo_2952256.html');
												thumbnails[2952424] = new thumbnail(2952424,'182441','Common tern, Blakeney, Norfolk','Common-tern_thumb.jpg',130, 78,32,'photo_2952424.html');
												thumbnails[2952427] = new thumbnail(2952427,'179173','Male adder.','Coiled-male-adder_thumb.jpg',130, 81,32,'photo_2952427.html');
												thumbnails[2952432] = new thumbnail(2952432,'177231','Common seal-Blakeney, Norfolk','Common-seal-b+w_thumb.jpg',130, 164,32,'photo_2952432.html');
												thumbnails[2952571] = new thumbnail(2952571,'182441','Female Mallard','Female-Mallard_thumb.jpg',130, 87,32,'photo_2952571.html');
												thumbnails[2952574] = new thumbnail(2952574,'179173','Grass snake playing dead, West Norfolk','Grass-snake-playing-dead-no_thumb.jpg',130, 98,32,'photo_2952574.html');
												thumbnails[2952585] = new thumbnail(2952585,'179173','Grass snake playing dead , West Norfolk','Grass-snake-playing-dead_thumb.jpg',130, 98,32,'photo_2952585.html');
												thumbnails[2952591] = new thumbnail(2952591,'179167','Lakenheath sunset','Lakenheath-Fen-sunset_thumb.jpg',130, 195,32,'photo_2952591.html');
												thumbnails[2952596] = new thumbnail(2952596,'179166','Flower macro','flower-macro_thumb.jpg',130, 195,32,'photo_2952596.html');
												thumbnails[2952609] = new thumbnail(2952609,'177230','Orange-tip ','Orange-tip-butterfly_thumb.jpg',130, 98,32,'photo_2952609.html');
												thumbnails[2952615] = new thumbnail(2952615,'179167','Sunset over Denver, Norfolk','Denver-(Norfolk)-sunset_thumb.jpg',130, 195,32,'photo_2952615.html');
												thumbnails[2952618] = new thumbnail(2952618,'179168','Dandelion close-up','Dandelion-close-up-b+w_thumb.jpg',130, 86,32,'photo_2952618.html');
												thumbnails[2954642] = new thumbnail(2954642,'177231','Common Seal','Common-seal-Blakeney_thumb.jpg-sl.jpg',130, 88,32,'photo_2954642.html');
												thumbnails[2954644] = new thumbnail(2954644,'177231','Common Seal ','Common-seal-Blakeney_thumb.jpg',130, 74,32,'photo_2954644.html');
												thumbnails[2954770] = new thumbnail(2954770,'182441','Kingfisher','Kingfisher_thumb.jpg',130, 122,32,'photo_2954770.html');
												thumbnails[2954905] = new thumbnail(2954905,'179166','Monochrome reedbed','Monochrome-Reedbed_thumb.jpg',130, 100,32,'photo_2954905.html');
												thumbnails[2955616] = new thumbnail(2955616,'182441','Little Stint at Titchwell RSPB nature reserve','34474449d5e29cc6d089736bf38e1cce5ebef9a41efeb0ee746ca23379387e1b6d838b1f[1]_thumb.jpg',130, 145,32,'photo_2955616.html');
												thumbnails[2955620] = new thumbnail(2955620,'177231','Muntjac deer ','124639838a40bf9b4219bec3b8b69ef557db56ca1a9eb9dbab7532371409ffec6ce48400[1]_thumb.jpg',130, 140,32,'photo_2955620.html');
												thumbnails[2955621] = new thumbnail(2955621,'182441','Little owl','435350710d2f06cac33a1442c5c09d638ce96c046d8a262fcfc32b02[1]_thumb.jpg',130, 159,32,'photo_2955621.html');
												thumbnails[2955622] = new thumbnail(2955622,'182441','Little Grebe','904578349b6178d5a7ca34d55e48f559a147594c022881b024e55e5592f0dbdb8a79cf53[1]_thumb.jpg',130, 79,32,'photo_2955622.html');
												thumbnails[2955627] = new thumbnail(2955627,'182441','Red Legged Partridge','2041008910e2a16b6a77533ea2cfcb9f8ba0a70f816439679368981ceede4537b1d17d3c[1]_thumb.jpg',130, 117,32,'photo_2955627.html');
												thumbnails[2955630] = new thumbnail(2955630,'177230','Hummingbird Hawkmoth','4519352499f1339af32e7d970eb52449859abdbc96b211aae282a7ee5ca8ae21f0548fbe[1]_thumb.jpg',130, 155,32,'photo_2955630.html');
												thumbnails[2955633] = new thumbnail(2955633,'177230','Speckled Bush Cricket','8057132914cddb70656e28c9645f64ec96310faa5e7ddc224e8528f8[1]_thumb.jpg',130, 98,32,'photo_2955633.html');
												thumbnails[2955635] = new thumbnail(2955635,'182441','Turnstone','53232702423dd0904dde5c721843fcc8cc8f420970c9960a8262fcc96c9e4c316a1340fa[1]_thumb.jpg',130, 98,32,'photo_2955635.html');
												thumbnails[2998912] = new thumbnail(2998912,'177231','Red Deer stag','Red-deer-stag-for-website_thumb.jpg',130, 138,32,'photo_2998912.html');
												thumbnails[2999032] = new thumbnail(2999032,'177230','Green veined white close up.','Green-veined-white-macro-he_thumb.jpg',130, 125,32,'photo_2999032.html');
												thumbnails[2999040] = new thumbnail(2999040,'177230','Red Admiral','Red-admiral_thumb.jpg',130, 89,32,'photo_2999040.html');
												thumbnails[2999054] = new thumbnail(2999054,'177230','Small Tortoiseshell','Small-tortoiseshell_thumb.jpg',130, 89,32,'photo_2999054.html');
												thumbnails[2999095] = new thumbnail(2999095,'179168','Silver birch close up','Silver-birch-close-up-abstr_thumb.jpg',130, 87,32,'photo_2999095.html');
												thumbnails[2999103] = new thumbnail(2999103,'179168','Peacock Butterfly wing macro','Peacock-close-up1_thumb.jpg',130, 141,32,'photo_2999103.html');
												thumbnails[3055376] = new thumbnail(3055376,'182662','Amethyst Deceiver.','Amethyst-Deceiver_thumb.jpg',130, 195,32,'photo_3055376.html');
												thumbnails[3405962] = new thumbnail(3405962,'177231','Female otter with cub -mid Wales','Female-otter-and-cub-mid-wa_thumb.jpg',130, 81,32,'photo_3405962.html');
												thumbnails[3405979] = new thumbnail(3405979,'177231','Female otter  -mid Wales','Otter-no-3_thumb.jpg',130, 67,32,'photo_3405979.html');
												thumbnails[4597927] = new thumbnail(4597927,'265466','Common Darter.','common-darter_thumb.jpg',130, 73,32,'photo_4597927.html');
												thumbnails[5311196] = new thumbnail(5311196,'179167','','Norfolk-windmill_thumb.jpg',130, 86,32,'photo_5311196.html');
												thumbnails[6035350] = new thumbnail(6035350,'265466','Scarce Chaser Dragonfly.','Scarce-chaser-2010-no-2_thumb.jpg',130, 195,32,'photo_6035350.html');
												thumbnails[7658924] = new thumbnail(7658924,'179168','','Pine-cone-bw-close-up_thumb.jpg',130, 89,32,'photo_7658924.html');
												thumbnails[2955636] = new thumbnail(2955636,'182441','Mallard Drake','69478521815849bd3435fd10262e0a6bbe1cd3f975abff24c9f14fe106fcfd3ebec98b9c[1]_thumb.jpg',130, 87,32,'photo_2955636.html');
												thumbnails[2952600] = new thumbnail(2952600,'182441','Little Tern in flight, Blakeney, Norfolk','Little-tern_thumb.jpg',130, 175,32,'photo_2952600.html');
												thumbnails[2955619] = new thumbnail(2955619,'182441','Blue tit','047902276ebfb9ad25c755c989d7036cd7a4d91a75d24348596c5710a3b21c9699147a49[1]_thumb.jpg',130, 202,32,'photo_2955619.html');
												thumbnails[2952249] = new thumbnail(2952249,'182441','Redshank, Titchwell nature reserve','Redshank_thumb.jpg',130, 119,32,'photo_2952249.html');
												thumbnails[2952608] = new thumbnail(2952608,'182441','Mute Swan close-up , Welney ,Cambridgeshire','Mute-swan-at-Welney_thumb.jpg',130, 338,32,'photo_2952608.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[265466] = new gallery(265466,'2946322','Dragonflies/ Damselflies','gallery',[6045643,6045664,4686916,4582293,4582306,4582362,4592796,4386547,4385351,4290802,4070967,2946322,4597927,6035350],0, 0, '', 'gallery_265466.html',0,0);
				  						galleries[179166] = new gallery(179166,'2952596','Flora','gallery',[7657644,4582589,2952256,2952596,2954905],0, 0, '', 'gallery_179166.html',0,0);
				  						galleries[179167] = new gallery(179167,'2952591','Landscape','gallery',[4592812,4212404,2952591,2952615,5311196],0, 0, '', 'gallery_179167.html',0,0);
				  						galleries[182441] = new gallery(182441,'5370905','Birds','gallery',[7657616,5370905,3870472,3817671,2952424,2952571,2954770,2955616,2955621,2955622,2955627,2955635,2955636,2952600,2955619,2952249,2952608],0, 0, '', 'gallery_182441.html',0,0);
				  						galleries[177230] = new gallery(177230,'4522298,4386541,4386525,4373224,4107120,4107114,4070958,4070919,3870462,3783725','Insects','gallery',[4522298,4373224,4386525,4386541,4107114,4107120,4070919,4070958,3870462,3783725,2882374,2946134,2952173,2952609,2955630,2955633,2999032,2999040,2999054],0, 0, '', 'gallery_177230.html',0,0);
				  						galleries[177231] = new gallery(177231,'2954642','Mammals','gallery',[5862667,4385335,2951048,2946413,2998942,2952432,2954642,2954644,2955620,2998912,3405962,3405979],0, 0, '', 'gallery_177231.html',0,0);
				  						galleries[265473] = new gallery(265473,'4290696','Spiders','gallery',[6644764,4290696,4290713],0, 0, '', 'gallery_265473.html',0,0);
				  						galleries[179168] = new gallery(179168,'2952618','Abstract','gallery',[4386536,2952254,2952618,2999095,2999103,7658924],0, 0, '', 'gallery_179168.html',0,0);
				  						galleries[179173] = new gallery(179173,'2952427','Reptiles','gallery',[5605997,3547312,3547328,3547453,3508847,2888651,2888683,2952427,2952574,2952585],0, 0, '', 'gallery_179173.html',0,0);
				  						galleries[265468] = new gallery(265468,'3870546','Amphibians','gallery',[3870546],0, 0, '', 'gallery_265468.html',0,0);
				  						galleries[182662] = new gallery(182662,'4522315','Fungi','gallery',[4522315,3055376],0, 0, '', 'gallery_182662.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '7657616';
imageSets[2] = '5370905,4522315,4290696,2954642,2952618,2952596,2952591,2952427,2946322';
imageSets[3] = '7658924,7657644,7657616,6644764,6073275,6045664,6045643,6035350,5862667,5605997,5370905,5311196,4686916,4597927,4592812,4592796,4582589,4582362,4582306,4582293,4522315,4522298,4386547,4386541,4386536,4386525,4385351,4385335,4373224,4290802,4290713,4290696,4212404,4107120,4107114,4070967,4070958,4070919,3870546,3870472,3870462,3817671,3783725,3547453,3547328,3547312,3508847,3405979,3405962,3055376';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/speedbox/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/speedbox/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/speedbox/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/speedbox/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/speedbox/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/speedbox/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/speedbox/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/speedbox/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/speedbox/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/speedbox/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/speedbox/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/speedbox/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/speedbox/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/speedbox/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/speedbox/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/speedbox/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/speedbox/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/speedbox/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/speedbox/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/speedbox/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/speedbox/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/speedbox/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 += 'section226549.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 && 'section226549' != '') {
					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 = 'Williams Wildlife: ' + photoCaption;
			    }
        if (op.$detail.length > 0) {
      temp = op.nextPhoto.fnGetImageDetails();
	    op.$detail.fadeGalleryDetails(temp, op.speed, function(){
	    var options = {photoinfominwidth:200};	    		options.photoinfoadjacent = true;			      	      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>';
	}
					
				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>Order this print:</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="alison5121@hotmail.co.uk">';
	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="alison5121@hotmail.co.uk">';
	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;
	}
}

			

