window.thumbnails = new Object();
												thumbnails[5385522] = new thumbnail(5385522,'303857','Early 18th Century','16th_Century_thumb.jpg',130, 89,5,'photo_5385522.html');
												thumbnails[5385563] = new thumbnail(5385563,'303857','Winter estate','Winter_Estate_thumb.jpg',130, 87,5,'photo_5385563.html');
												thumbnails[5385590] = new thumbnail(5385590,'303834','Winter downs','Winter_downs_thumb.jpg',130, 35,5,'photo_5385590.html');
												thumbnails[5385601] = new thumbnail(5385601,'303835','Honeysuckle','Honeysuckle_thumb.jpg',130, 87,5,'photo_5385601.html');
												thumbnails[5385862] = new thumbnail(5385862,'303834','Marshland','Marshland_thumb.jpg',130, 87,5,'photo_5385862.html');
												thumbnails[5385987] = new thumbnail(5385987,'303835','Passionflower','Passionflower_and_bee_thumb.jpg',130, 87,5,'photo_5385987.html');
												thumbnails[5390462] = new thumbnail(5390462,'303857','Dungerness','Dungerness_thumb.jpg',130, 53,5,'photo_5390462.html');
												thumbnails[5390494] = new thumbnail(5390494,'303857','Whitstable factory','Whitstable_Factory1_thumb.jpg',130, 173,5,'photo_5390494.html');
												thumbnails[5390498] = new thumbnail(5390498,'303835','Sambuca','Sambuca_thumb.jpg',130, 87,5,'photo_5390498.html');
												thumbnails[5403199] = new thumbnail(5403199,'303835','Pink poppy','Pink_poppy_thumb.jpg',130, 85,5,'photo_5403199.html');
												thumbnails[5403218] = new thumbnail(5403218,'303835','Red poppy','Red_poppy_thumb.jpg',130, 113,5,'photo_5403218.html');
												thumbnails[5403245] = new thumbnail(5403245,'303835','Wet rose','Wet_rose_thumb.jpg',130, 111,5,'photo_5403245.html');
												thumbnails[5403261] = new thumbnail(5403261,'303835','Sea Holly','Sea_Holly_thumb.jpg',130, 196,5,'photo_5403261.html');
												thumbnails[5403270] = new thumbnail(5403270,'303834','Water tower field','Water_tower_field_thumb.jpg',130, 87,5,'photo_5403270.html');
												thumbnails[5403278] = new thumbnail(5403278,'303834','Pool of life','Pool_of_life_thumb.jpg',130, 87,5,'photo_5403278.html');
												thumbnails[5403289] = new thumbnail(5403289,'303834','Marsh sheep','Marsh_sheep_thumb.jpg',130, 87,5,'photo_5403289.html');
												thumbnails[5424829] = new thumbnail(5424829,'303835','Seed head','Seed_head_thumb.jpg',130, 86,5,'photo_5424829.html');
												thumbnails[5424843] = new thumbnail(5424843,'303835','Maltese daisy','Maltese_daisy_thumb.jpg',130, 117,5,'photo_5424843.html');
												thumbnails[5487338] = new thumbnail(5487338,'303834','Allotments','Allotments_thumb.jpg',130, 87,5,'photo_5487338.html');
												thumbnails[5487344] = new thumbnail(5487344,'303834','Living stream','Living_Stream_thumb.jpg',130, 86,5,'photo_5487344.html');
												thumbnails[5487348] = new thumbnail(5487348,'303857','Grain stores','Stores_thumb.jpg',130, 107,5,'photo_5487348.html');
												thumbnails[5487358] = new thumbnail(5487358,'303857','War graves','War_graves_thumb.jpg',130, 87,5,'photo_5487358.html');
												thumbnails[5487576] = new thumbnail(5487576,'303857','Number 10','Number_10_thumb.jpg',130, 86,5,'photo_5487576.html');
												thumbnails[5488163] = new thumbnail(5488163,'303857','Huts','Huts_thumb.jpg',130, 89,5,'photo_5488163.html');
												thumbnails[5488168] = new thumbnail(5488168,'303834','Night pool','Night_Pool_thumb.jpg',130, 115,5,'photo_5488168.html');
												thumbnails[5544568] = new thumbnail(5544568,'303857','Church door','Church_door_thumb.jpg',130, 194,5,'photo_5544568.html');
												thumbnails[5544593] = new thumbnail(5544593,'303835','Snowdrops','Snowdrops_thumb.jpg',130, 87,5,'photo_5544593.html');
												thumbnails[5544594] = new thumbnail(5544594,'303834','Cloudscape','Cloudscape_thumb.jpg',130, 81,5,'photo_5544594.html');
												thumbnails[5753478] = new thumbnail(5753478,'303835','Teazles and Bee','Teazle_and_bee_thumb.jpg',130, 121,5,'photo_5753478.html');
												thumbnails[5966640] = new thumbnail(5966640,'336666','Entrance','Venice_Entrance_thumb.jpg',130, 93,5,'photo_5966640.html');
												thumbnails[5966646] = new thumbnail(5966646,'336666','Canal Panorama','Venice_Canal_Panorama_thumb.jpg',130, 36,5,'photo_5966646.html');
												thumbnails[5966655] = new thumbnail(5966655,'336666','Gondola Boatyard','Venice_Gondola_Boatyard_thumb.jpg',130, 87,5,'photo_5966655.html');
												thumbnails[5966691] = new thumbnail(5966691,'336666','Boy and Frog','Venice_Boy__Frog_thumb.jpg',130, 93,5,'photo_5966691.html');
												thumbnails[5966696] = new thumbnail(5966696,'336666','Lamb','Venice_Lamb_thumb.jpg',130, 130,5,'photo_5966696.html');
												thumbnails[5966710] = new thumbnail(5966710,'336666','Grand Canal','Venice_Grand_Canal_thumb.jpg',130, 93,5,'photo_5966710.html');
												thumbnails[5966740] = new thumbnail(5966740,'336666','Ceramica','Venice_Ceramica_thumb.jpg',130, 169,5,'photo_5966740.html');
												thumbnails[5966826] = new thumbnail(5966826,'336666','Metafisica','Venice_Metafisica_thumb.jpg',130, 191,5,'photo_5966826.html');
												thumbnails[5966889] = new thumbnail(5966889,'336666','Lagoon','Venice_Lagoon_thumb.jpg',130, 182,5,'photo_5966889.html');
												thumbnails[5966900] = new thumbnail(5966900,'336666','Washday','Venice_Washday_thumb.jpg',130, 179,5,'photo_5966900.html');
												thumbnails[5966913] = new thumbnail(5966913,'336666','Imposition','Venice_Imposition_thumb.jpg',130, 193,5,'photo_5966913.html');
												thumbnails[5966930] = new thumbnail(5966930,'336666','Votives','Venice_Votives_thumb.jpg',130, 194,5,'photo_5966930.html');
												thumbnails[5966946] = new thumbnail(5966946,'336666','Lobster Girl','Venice_Lobster_Girl_thumb.jpg',130, 103,5,'photo_5966946.html');
												thumbnails[5967015] = new thumbnail(5967015,'336666','La Fenice','Venice_La_Fenice_thumb.jpg',130, 87,5,'photo_5967015.html');
												thumbnails[5967031] = new thumbnail(5967031,'336666','Creature','Venice_Creature_thumb.jpg',130, 226,5,'photo_5967031.html');
												thumbnails[6606295] = new thumbnail(6606295,'362013','Barge mast','Mastweb_thumb.jpg',130, 194,5,'photo_6606295.html');
												thumbnails[6606303] = new thumbnail(6606303,'362013','Maunsell Forts','Distant_Fortsweb_thumb.jpg',130, 194,5,'photo_6606303.html');
												thumbnails[6606308] = new thumbnail(6606308,'362013','Wind Farm','Wind_Farm_1web_thumb.jpg',130, 194,5,'photo_6606308.html');
												thumbnails[6606315] = new thumbnail(6606315,'362013','Playful ship\'s dog','Chris_with_Dog_and_Ballweb_thumb.jpg',130, 124,5,'photo_6606315.html');
												thumbnails[6606329] = new thumbnail(6606329,'362013','Wind Farm Perspective','Wind_Farm_2web_thumb.jpg',130, 87,5,'photo_6606329.html');
												thumbnails[6606342] = new thumbnail(6606342,'362013','Dog relaxes onboard','Dog_on_Ropeweb_thumb.jpg',130, 89,5,'photo_6606342.html');
												thumbnails[6606346] = new thumbnail(6606346,'362013','Redsands forts','Forts_1web_thumb.jpg',130, 88,5,'photo_6606346.html');
												thumbnails[6606353] = new thumbnail(6606353,'362013','Forts and rigging','Forts_BandW_2web_thumb.jpg',130, 87,5,'photo_6606353.html');
												thumbnails[6606355] = new thumbnail(6606355,'362013','Redsands close-up','Forts_2web_thumb.jpg',130, 89,5,'photo_6606355.html');
												thumbnails[6606368] = new thumbnail(6606368,'362013','Close-up forts','Forts_BandW_1web_thumb.jpg',130, 194,5,'photo_6606368.html');
												thumbnails[6606371] = new thumbnail(6606371,'362013','Distant fire','Cloudscape_with_distant_Fireweb_thumb.jpg',130, 87,5,'photo_6606371.html');
												thumbnails[6606375] = new thumbnail(6606375,'362013','Yacht race','Yachtsweb_thumb.jpg',130, 194,5,'photo_6606375.html');
												thumbnails[6706412] = new thumbnail(6706412,'304009','Treescape','Treescape_thumb.jpg',130, 87,5,'photo_6706412.html');
												thumbnails[6706417] = new thumbnail(6706417,'304009','Cosmos','Cosmos_thumb.jpg',130, 87,5,'photo_6706417.html');
												thumbnails[6706426] = new thumbnail(6706426,'304009','Cedar','Cedar_thumb.jpg',130, 89,5,'photo_6706426.html');
												thumbnails[6750222] = new thumbnail(6750222,'303834','Estuary','Watchmans_hut_at_Oare_thumb.jpg',130, 194,5,'photo_6750222.html');
												thumbnails[6750251] = new thumbnail(6750251,'303834','English coast','Worthing_Seafront_thumb.jpg',130, 87,5,'photo_6750251.html');
												thumbnails[7901163] = new thumbnail(7901163,'426231','Terra & Agua','Terra_Agua_thumb.jpg',130, 101,5,'photo_7901163.html');
												thumbnails[5385064] = new thumbnail(5385064,'303834','Winter sunrise','East_Kent_winter_sunrise_thumb.jpg',130, 87,5,'photo_5385064.html');
												thumbnails[5385073] = new thumbnail(5385073,'303835','Peony bud','Peony_Bud_thumb.jpg',130, 87,5,'photo_5385073.html');
												thumbnails[5387804] = new thumbnail(5387804,'304009','Watching over us','Watching_over_us1_thumb.jpg',130, 194,5,'photo_5387804.html');
												thumbnails[5428782] = new thumbnail(5428782,'304008','Conch','Conch_thumb.jpg',130, 194,5,'photo_5428782.html');
												thumbnails[5814472] = new thumbnail(5814472,'303860','Dog leg','Rosie_leg_and_hand_April_2010_thumb.jpg',130, 194,5,'photo_5814472.html');
												thumbnails[7901187] = new thumbnail(7901187,'426231','Lisboa','Lisboa_thumb.jpg',130, 78,5,'photo_7901187.html');
												thumbnails[5390455] = new thumbnail(5390455,'304009','Greyhound as Whistlejacket','Whistlejacket_Greyhound_thumb.jpg',130, 157,5,'photo_5390455.html');
												thumbnails[5428791] = new thumbnail(5428791,'304008','Chrysanthemum','Crysanthium_thumb.jpg',130, 232,5,'photo_5428791.html');
												thumbnails[5424887] = new thumbnail(5424887,'304009','Kew Lion','Kew_Lion1_thumb.jpg',130, 164,5,'photo_5424887.html');
												thumbnails[5428800] = new thumbnail(5428800,'304008','Spider','Spider_thumb.jpg',130, 194,5,'photo_5428800.html');
												thumbnails[5390459] = new thumbnail(5390459,'304009','Morning Tree','Morning_tree_thumb.jpg',130, 178,5,'photo_5390459.html');
												thumbnails[5390509] = new thumbnail(5390509,'304009','Tree art','Tree_art_thumb.jpg',130, 173,5,'photo_5390509.html');
												thumbnails[5424708] = new thumbnail(5424708,'304009','Birch woodland','Birch_woodland_thumb.jpg',130, 194,5,'photo_5424708.html');
												thumbnails[7901193] = new thumbnail(7901193,'426231','Azulejo with Greyhound','Azujlo_with_Greyhound_thumb.jpg',130, 90,5,'photo_7901193.html');
												thumbnails[5390518] = new thumbnail(5390518,'304009','Country house','Country_house_thumb.jpg',130, 68,5,'photo_5390518.html');
												thumbnails[5424877] = new thumbnail(5424877,'304009','Kew sculpture','Kew_sculpture_thumb.jpg',130, 86,5,'photo_5424877.html');
												thumbnails[5424849] = new thumbnail(5424849,'304009','Maltese garden','Maltese_garden_thumb.jpg',130, 86,5,'photo_5424849.html');
												thumbnails[5385552] = new thumbnail(5385552,'303860','Pony Eye','Pony_Eye1_thumb.jpg',130, 194,5,'photo_5385552.html');
												thumbnails[5387798] = new thumbnail(5387798,'304008','Methane','Methane_thumb.jpg',130, 88,5,'photo_5387798.html');
												thumbnails[7901196] = new thumbnail(7901196,'426231','Basilica','Basilica_thumb.jpg',130, 247,5,'photo_7901196.html');
												thumbnails[5424793] = new thumbnail(5424793,'304008','Maltese nets','Maltese_nets_thumb.jpg',130, 85,5,'photo_5424793.html');
												thumbnails[5467250] = new thumbnail(5467250,'304008','Figs and Pomegranate','Figs_and_Pomegranate_thumb.jpg',130, 95,5,'photo_5467250.html');
												thumbnails[7901198] = new thumbnail(7901198,'426231','Escalada','Escalada_thumb.jpg',130, 239,5,'photo_7901198.html');
												thumbnails[5467298] = new thumbnail(5467298,'304008','Green Peppers','Green_peppers12_thumb.jpg',130, 140,5,'photo_5467298.html');
												thumbnails[5488186] = new thumbnail(5488186,'303860','Greyhound lines','Greyhound_lines_thumb.jpg',130, 196,5,'photo_5488186.html');
												thumbnails[7901201] = new thumbnail(7901201,'426231','Peacock','Peacock_in_Tree_thumb.jpg',130, 194,5,'photo_7901201.html');
												thumbnails[5467268] = new thumbnail(5467268,'304008','Red Peppers','Red_peppers_thumb.jpg',130, 91,5,'photo_5467268.html');
												thumbnails[5467270] = new thumbnail(5467270,'304008','Large green peppers','Large_green_peppers_thumb.jpg',130, 89,5,'photo_5467270.html');
												thumbnails[7901204] = new thumbnail(7901204,'426231','Torso','Torso_thumb.jpg',130, 162,5,'photo_7901204.html');
												thumbnails[5385996] = new thumbnail(5385996,'303860','Greyhound portrait','Greyhound_profile_thumb.jpg',130, 95,5,'photo_5385996.html');
												thumbnails[7901206] = new thumbnail(7901206,'426231','Plaque','Plaque_thumb.jpg',130, 127,5,'photo_7901206.html');
												thumbnails[7901209] = new thumbnail(7901209,'426231','Tilda','Tilda_thumb.jpg',130, 145,5,'photo_7901209.html');
												thumbnails[5390497] = new thumbnail(5390497,'303860','Winter walk','Winter_walk_thumb.jpg',130, 76,5,'photo_5390497.html');
												thumbnails[7901222] = new thumbnail(7901222,'426231','Horses','Horses_thumb.jpg',130, 87,5,'photo_7901222.html');
												thumbnails[7901224] = new thumbnail(7901224,'426231','Towards Alfama','Towards_Alfama_thumb.jpg',130, 34,5,'photo_7901224.html');
												thumbnails[5429497] = new thumbnail(5429497,'303860','Greyhound','Greyhound_thumb.jpg',130, 103,5,'photo_5429497.html');
												thumbnails[7901226] = new thumbnail(7901226,'426231','Ride','Ride_thumb.jpg',130, 124,5,'photo_7901226.html');
												thumbnails[7901228] = new thumbnail(7901228,'426231','Botanical','Botanical_1_thumb.jpg',130, 193,5,'photo_7901228.html');
												thumbnails[5403336] = new thumbnail(5403336,'303860','Resting Greyhound','Resting_Greyhound_thumb.jpg',130, 97,5,'photo_5403336.html');
												thumbnails[7901230] = new thumbnail(7901230,'426231','Tropical','Tropical_thumb.jpg',130, 87,5,'photo_7901230.html');
												thumbnails[7901232] = new thumbnail(7901232,'426231','Explorer','Explorer_thumb.jpg',130, 188,5,'photo_7901232.html');
												thumbnails[5403266] = new thumbnail(5403266,'303860','Robin','Robin_thumb.jpg',130, 74,5,'photo_5403266.html');
												thumbnails[5403362] = new thumbnail(5403362,'303860','Tired Greyhound','Tired_Greyhound_thumb.jpg',130, 111,5,'photo_5403362.html');
												thumbnails[5687380] = new thumbnail(5687380,'303860','Kent Frog','Kent_Frog_thumb.jpg',130, 87,5,'photo_5687380.html');
												thumbnails[5487341] = new thumbnail(5487341,'303860','Cattle','Cattle_thumb.jpg',130, 87,5,'photo_5487341.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[426231] = new gallery(426231,'7901232,7901230,7901228,7901226,7901224,7901222,7901209,7901206,7901204,7901201','Lisbon','gallery',[7901163,7901187,7901193,7901196,7901198,7901201,7901204,7901206,7901209,7901222,7901224,7901226,7901228,7901230,7901232],0, 0, '', 'gallery_426231.html',0,0);
				  					galleries[336666] = new gallery(336666,'5967031,5967015,5966946,5966930,5966913,5966900,5966889,5966826,5966740,5966710','Venice','gallery',[5966640,5966646,5966655,5966691,5966696,5966710,5966740,5966826,5966889,5966900,5966913,5966930,5966946,5967015,5967031],0, 0, '', 'gallery_336666.html',0,0);
				  					galleries[303834] = new gallery(303834,'6750251,6750222,5544594,5488168,5487344,5487338,5403289,5403278,5403270,5385862','Land','gallery',[5385590,5385862,5403270,5403278,5403289,5487338,5487344,5488168,5544594,6750222,6750251,5385064],0, 0, '', 'gallery_303834.html',0,0);
				  					galleries[362013] = new gallery(362013,'6606375,6606371,6606368,6606355,6606353,6606346,6606342,6606329,6606315,6606308','Sea','gallery',[6606295,6606303,6606308,6606315,6606329,6606342,6606346,6606353,6606355,6606368,6606371,6606375],0, 0, '', 'gallery_362013.html',0,0);
				  					galleries[303835] = new gallery(303835,'5753478,5544593,5424843,5424829,5403261,5403245,5403218,5403199,5390498,5385987','Grow','gallery',[5385601,5385987,5390498,5403199,5403218,5403245,5403261,5424829,5424843,5544593,5753478,5385073],0, 0, '', 'gallery_303835.html',0,0);
				  					galleries[303857] = new gallery(303857,'5544568,5488163,5487576,5487358,5487348,5390494,5390462,5385563,5385522','Build','gallery',[5385522,5385563,5390462,5390494,5487348,5487358,5487576,5488163,5544568],0, 0, '', 'gallery_303857.html',0,0);
				  					galleries[303860] = new gallery(303860,'5814472,5687380,5488186,5487341,5429497,5403362,5403336,5403266,5390497,5385996','Live','gallery',[5814472,5385552,5488186,5385996,5390497,5429497,5403336,5403266,5403362,5687380,5487341],0, 0, '', 'gallery_303860.html',0,0);
				  					galleries[304008] = new gallery(304008,'5467298,5467270,5467268,5467250,5428800,5428791,5428782,5424793,5387798','Still','gallery',[5428782,5428791,5428800,5387798,5424793,5467250,5467298,5467268,5467270],0, 0, '', 'gallery_304008.html',0,0);
				  					galleries[304009] = new gallery(304009,'6706426,6706417,6706412,5424887,5424877,5424849,5424708,5390518,5390509,5390459','Make','gallery',[6706412,6706417,6706426,5387804,5390455,5424887,5390459,5390509,5424708,5390518,5424877,5424849],0, 0, '', 'gallery_304009.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '7901232,7901230,7901228,7901226,7901224,7901222,7901209,7901206,7901204,7901201,7901198,7901196,7901193,7901187,7901163,6750251,6750222,6706426,6706417,6706412,6606375,6606371,6606368,6606355,6606353,6606346,6606342,6606329,6606315,6606308,6606303,6606295,5967031,5967015,5966946,5966930,5966913,5966900,5966889,5966826,5966740,5966710,5966696,5966691,5966655,5966646,5966640,5814472,5753478,5687380';
imageSets[3] = '7901232,7901230,7901228,7901226,7901224,7901222,7901209,7901206,7901204,7901201,7901198,7901196,7901193,7901187,7901163,6750251,6750222,6706426,6706417,6706412,6606375,6606371,6606368,6606355,6606353,6606346,6606342,6606329,6606315,6606308,6606303,6606295,5967031,5967015,5966946,5966930,5966913,5966900,5966889,5966826,5966740,5966710,5966696,5966691,5966655,5966646,5966640,5814472,5753478,5687380';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/philipsbull/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/philipsbull/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/philipsbull/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/philipsbull/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/philipsbull/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/philipsbull/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/philipsbull/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/philipsbull/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/philipsbull/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/philipsbull/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/philipsbull/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/philipsbull/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/philipsbull/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/philipsbull/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/philipsbull/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/philipsbull/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/philipsbull/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/philipsbull/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/philipsbull/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/philipsbull/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/philipsbull/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/philipsbull/images';
		break;
	}
		return val;
}

/***************************************************************************
* img = reference to image object in which to show image                   *
***************************************************************************/
function showHomeImage(img) {

	imageID = randomListVal('');
		if (!basic) {
	img.src = photos[imageID].src;
	img.width = photos[imageID].width;
	img.height = photos[imageID].height;
  img.parentNode.title = img.alt = photos[imageID].caption;
	}
	else {
		newImage = new Image(photos[imageID].width,photos[imageID].height);
		newImage.src = photos[imageID].src;
		document.images[img.name] = newImage;
				
	}
			}

function getHomeImageLink(imageID) {
  	var href='', photo = backgrounds && backgrounds[imageID];
	if(photo){
		if (photo && photo.galleries_id != '') {
  			href = photo.fnGalleryLink();
  		}
  		  		else {
  				href += 'gallery.html';
  	  		}
	}
    return href;
}
/***************************************************************************
* Show a random image on home page from featured images                    *
***************************************************************************/
function showHomeImageInline(el, image_sets_id, href) {
	
  var css = {}, imageID,
	    imageSetsId = 1;
	if(image_sets_id){
		imageSetsId = image_sets_id;
	}
	imageID = randomListVal(imageSets[imageSetsId]);
		if (href == null && 'gallery' != '') {
					href = getHomeImageLink(imageID);
	}
    
  updateImage({nextPhoto: backgrounds[imageID], img:el.find('img')[0],
                $photo:el, $title:$('#homeimageTitleContainer'), $detail:$('#homeimageDetailsContainer'),                speed:0, href:href, css:css, onAfter: function(){                  this.closest('.contentsection').doManualAlign({				    inner: 'img',				    crop: 'a'				  });                }              });
}

/***************************************************************************
* Set 'img' to be a new image given its photo() object                     *
***************************************************************************/
function updateImage (options) {
  var defaults = {nextPhoto:'',field:'',img:'',$photo:'',$title:'',$detail:'',
                    updateDocumentTitle:false,speed:0,href:false,css:false,updateHash:false,onAfter:null,onBefore:null},
      op = $.extend({},defaults,options),
      html = '', temp = '',
      photoId = op.nextPhoto.id,
      photoCaption = op.nextPhoto.caption,
      photoSrc = op.nextPhoto.src;
		
		if (!basic) {
    if (op.updateHash && clik.getIDInUrl(location.href,'photo') != op.nextPhoto.id) {
		clik.changeHash('photos_id=' + op.nextPhoto.id, true);
    }
				
    if (op.$photo.length > 0) {
      html = $('<img/>',{
        'class': 'mainphoto photo',
        src: photoSrc,
        id: 'mainPic',
        name: 'mainPic',
        width: op.nextPhoto.width,
        height: op.nextPhoto.height,
        alt: photoCaption,
        css: op.css || {}
      });
      if (op.href) {
      	if (op.href.match(/<a/)) {
      	  html = $(op.href).append(html);
      	} else {
		  html = $('<a/>', {
			href: op.href,
			title: photoCaption
		  }).append(html);
	    }
      } else {
      	html = $('<a/>', {
			title: photoCaption
		  }).append(html);
      }
      if (op.speed == 0) {        op.$photo.html(html);        if (op.onBefore) {          op.onBefore.apply(op.$photo);        }        if (op.onAfter) {          op.onAfter.apply(op.$photo);        }      } else {        op.$photo.stop(true,true).fadeReplaceWith(html,op.speed,'',function(){            if (op.onAfter) {		    op.onAfter.apply(this);          }		  clik.doColumnResize(false, $(this).add(op.$detail).add(op.$title));		  $('body').trigger('clikUpdate');		}, op.onBefore);
      }    }
    	if (op.field) {
		op.field.value = photoId;
	} else {
		op.$photo.data('image_id', photoId);
    }
	    if (op.$title.length > 0) {
  		op.$title.fadeGalleryDetails(photoCaption, op.speed);
    }
        if (op.updateDocumentTitle) {
						  document.title = 'BullsEyeView: ' + photoCaption;
			    }
        if (op.$detail.length > 0) {
      temp = op.nextPhoto.fnGetImageDetails();
	    op.$detail.fadeGalleryDetails(temp, op.speed, function(){
	    var options = {};	    	      	      resizePhotoInfo(options);
        if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
  	      toggleAddToCartConfirm(backgrounds);
  	    } else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
  	      toggleAddToCartConfirm(photos);
  	    }
	    });
    }
        if (!op.speed) {      clik.doColumnResize(false, op.$photo.add(op.$detail).add(op.$title));      $('body').trigger('clikUpdate');    }        
    return html;			}
	else {
				
		window.location = 'photo_' + nextPhoto.id + '.html';
	}
		
}

/***************************************************************************
* Toggle add to cart confirmation element and set up the click event for   *
* the 'Add to cart' button.                                                *
***************************************************************************/
function toggleAddToCartConfirm(array){
  if (typeof(array) !== 'object' || array == undefined) {
    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> ' + (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 + '<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;
	}
}

			

