window.thumbnails = {};
															thumbnails[969527] = clik.newPhoto({"id":969527,"src":"michael-pinfold-follow-me_thumb.jpg","galleries_id":72860,"server_id":18,"link":"photo_969527.html","width":130,"caption":"Follow Me","height":65});
															thumbnails[1520597] = clik.newPhoto({"id":1520597,"src":"michael-pinfold-drawn-to-the-sea_thumb.jpg","galleries_id":72860,"server_id":18,"link":"photo_1520597.html","width":130,"caption":"Drawn to the Sea","height":65});
															thumbnails[4576426] = clik.newPhoto({"id":4576426,"src":"michael-pinfold-atlantic-view_thumb.jpg","galleries_id":72860,"server_id":18,"link":"photo_4576426.html","width":130,"caption":"Atlantic View","height":43});
															thumbnails[4576448] = clik.newPhoto({"id":4576448,"src":"michael-pinfold-wheal-vista_thumb.jpg","galleries_id":72860,"server_id":18,"link":"photo_4576448.html","width":130,"caption":"Wheal Vista","height":43});
															thumbnails[969552] = clik.newPhoto({"id":969552,"src":"michael-pinfold-peering-out_thumb.jpg","galleries_id":72860,"server_id":18,"link":"photo_969552.html","width":130,"caption":"Peering Out","height":65});
															thumbnails[3129799] = clik.newPhoto({"id":3129799,"src":"michael-pinfold-golden-memories_thumb.jpg","galleries_id":72860,"server_id":18,"link":"photo_3129799.html","width":130,"caption":"Golden Memories","height":87});
															thumbnails[4576435] = clik.newPhoto({"id":4576435,"src":"michael-pinfold-bawden-rocks-sunset_thumb.jpg","galleries_id":72860,"server_id":18,"link":"photo_4576435.html","width":130,"caption":"Bawden Rocks Sunset","height":87});
															thumbnails[4576433] = clik.newPhoto({"id":4576433,"src":"michael-pinfold-bawden-rocks_thumb.jpg","galleries_id":72860,"server_id":18,"link":"photo_4576433.html","width":130,"caption":"Bawden Rocks","height":87});
															thumbnails[6511592] = clik.newPhoto({"id":6511592,"src":"michael-pinfold-p-perusing-paris_thumb.jpg","galleries_id":358257,"server_id":18,"link":"photo_6511592.html","width":130,"caption":"P","height":87});
															thumbnails[4666212] = clik.newPhoto({"id":4666212,"src":"michael-pinfold-werljuisstr_thumb.jpg","galleries_id":358258,"server_id":18,"link":"photo_4666212.html","width":87,"caption":"Werljuisstr","height":130});
															thumbnails[1520467] = clik.newPhoto({"id":1520467,"src":"michael-pinfold-gonamena_thumb.jpg","galleries_id":104375,"server_id":18,"link":"photo_1520467.html","width":130,"caption":"Gonamena","height":87});
															thumbnails[969569] = clik.newPhoto({"id":969569,"src":"michael-pinfold-twins_thumb.jpg","galleries_id":72860,"server_id":18,"link":"photo_969569.html","width":130,"caption":"Twins","height":87});
															thumbnails[1095427] = clik.newPhoto({"id":1095427,"src":"michael-pinfold-winters-morning_thumb.jpg","galleries_id":80703,"server_id":18,"link":"photo_1095427.html","width":130,"caption":"Winter's Morning","height":87});
															thumbnails[6511598] = clik.newPhoto({"id":6511598,"src":"michael-pinfold-a-perusing-paris_thumb.jpg","galleries_id":358257,"server_id":18,"link":"photo_6511598.html","width":130,"caption":"A","height":87});
															thumbnails[4666129] = clik.newPhoto({"id":4666129,"src":"michael-pinfold-bonne-chieremolen_thumb.jpg","galleries_id":358258,"server_id":18,"link":"photo_4666129.html","width":87,"caption":"Bonne Chieremolen","height":130});
															thumbnails[1520459] = clik.newPhoto({"id":1520459,"src":"michael-pinfold-scarred-landscape_thumb.jpg","galleries_id":104375,"server_id":18,"link":"photo_1520459.html","width":130,"caption":"Scarred Landscape","height":87});
															thumbnails[1095429] = clik.newPhoto({"id":1095429,"src":"michael-pinfold-mylor-creek_thumb.jpg","galleries_id":80703,"server_id":18,"link":"photo_1095429.html","width":130,"caption":"Mylor Creek","height":87});
															thumbnails[973823] = clik.newPhoto({"id":973823,"src":"michael-pinfold-crossing-paths_thumb.jpg","galleries_id":73185,"server_id":18,"link":"photo_973823.html","width":130,"caption":"Crossing Paths","height":87});
															thumbnails[1039425] = clik.newPhoto({"id":1039425,"src":"michael-pinfold-two-islands_thumb.jpg","galleries_id":72860,"server_id":18,"link":"photo_1039425.html","width":130,"caption":"Two Islands","height":87});
															thumbnails[5513029] = clik.newPhoto({"id":5513029,"src":"michael-pinfold-winter-solitude_thumb.jpg","galleries_id":73185,"server_id":18,"link":"photo_5513029.html","width":130,"caption":"Winter Solitude","height":87});
															thumbnails[973830] = clik.newPhoto({"id":973830,"src":"michael-pinfold-reflections_thumb.jpg","galleries_id":72860,"server_id":18,"link":"photo_973830.html","width":130,"caption":"Reflections","height":87});
															thumbnails[7531110] = clik.newPhoto({"id":7531110,"src":"michael-pinfold-pateavy-at-dusk_thumb.jpg","galleries_id":73185,"server_id":18,"link":"photo_7531110.html","width":130,"caption":"Patreavy at Dusk","height":87});
															thumbnails[1095512] = clik.newPhoto({"id":1095512,"src":"michael-pinfold-kynance-crash_thumb.jpg","galleries_id":72860,"server_id":18,"link":"photo_1095512.html","width":130,"caption":"Kynance Crash","height":87});
															thumbnails[4576437] = clik.newPhoto({"id":4576437,"src":"michael-pinfold-wheal-cotes_thumb.jpg","galleries_id":72860,"server_id":18,"link":"photo_4576437.html","width":130,"caption":"Wheal Coates","height":87});
															thumbnails[6511603] = clik.newPhoto({"id":6511603,"src":"michael-pinfold-r-perusing-paris_thumb.jpg","galleries_id":358257,"server_id":18,"link":"photo_6511603.html","width":130,"caption":"R","height":87});
															thumbnails[4666281] = clik.newPhoto({"id":4666281,"src":"michael-pinfold-langerei_thumb.jpg","galleries_id":358258,"server_id":18,"link":"photo_4666281.html","width":130,"caption":"Langerei","height":87});
															thumbnails[1520475] = clik.newPhoto({"id":1520475,"src":"michael-pinfold-hidden-face_thumb.jpg","galleries_id":104375,"server_id":18,"link":"photo_1520475.html","width":130,"caption":"Hidden Face","height":87});
															thumbnails[973826] = clik.newPhoto({"id":973826,"src":"michael-pinfold-surviving_thumb.jpg","galleries_id":73185,"server_id":18,"link":"photo_973826.html","width":130,"caption":"Surviving","height":87});
															thumbnails[1237984] = clik.newPhoto({"id":1237984,"src":"michael-pinfold-journeys-end_thumb.jpg","galleries_id":80703,"server_id":18,"link":"photo_1237984.html","width":130,"caption":"Journey's End","height":87});
															thumbnails[969524] = clik.newPhoto({"id":969524,"src":"michael-pinfold-lonely-evening_thumb.jpg","galleries_id":72860,"server_id":18,"link":"photo_969524.html","width":130,"caption":"Lonely Evening","height":87});
															thumbnails[6511605] = clik.newPhoto({"id":6511605,"src":"michael-pinfold-i-perusing-paris_thumb.jpg","galleries_id":358257,"server_id":18,"link":"photo_6511605.html","width":130,"caption":"I","height":87});
															thumbnails[4666219] = clik.newPhoto({"id":4666219,"src":"in_brugge_07-01-09_thumb.jpg","galleries_id":358258,"server_id":18,"link":"photo_4666219.html","width":130,"caption":"In Bruges","height":87});
															thumbnails[1520434] = clik.newPhoto({"id":1520434,"src":"michael-pinfold-derelict_thumb.jpg","galleries_id":104375,"server_id":18,"link":"photo_1520434.html","width":130,"caption":"Derelict","height":87});
															thumbnails[973828] = clik.newPhoto({"id":973828,"src":"michael-pinfold-growing-up_thumb.jpg","galleries_id":73185,"server_id":18,"link":"photo_973828.html","width":130,"caption":"Growing Up","height":87});
															thumbnails[1039424] = clik.newPhoto({"id":1039424,"src":"michael-pinfold-lazy-day_thumb.jpg","galleries_id":80703,"server_id":18,"link":"photo_1039424.html","width":130,"caption":"Lazy Day","height":43});
															thumbnails[969523] = clik.newPhoto({"id":969523,"src":"michael-pinfold-evening-glow_thumb.jpg","galleries_id":72860,"server_id":18,"link":"photo_969523.html","width":130,"caption":"Evening Glow","height":87});
															thumbnails[6511610] = clik.newPhoto({"id":6511610,"src":"michael-pinfold-s-perusing-paris_thumb.jpg","galleries_id":358257,"server_id":18,"link":"photo_6511610.html","width":130,"caption":"S","height":87});
															thumbnails[4666254] = clik.newPhoto({"id":4666254,"src":"michael-pinfold-minnewater_thumb.jpg","galleries_id":358258,"server_id":18,"link":"photo_4666254.html","width":130,"caption":"Minnewater","height":43});
															thumbnails[1520426] = clik.newPhoto({"id":1520426,"src":"michael-pinfold-natures-sculpture_thumb.jpg","galleries_id":104375,"server_id":18,"link":"photo_1520426.html","width":130,"caption":"Natures Sculpture","height":87});
															thumbnails[999929] = clik.newPhoto({"id":999929,"src":"michael-pinfold-porcupine-dunes_thumb.jpg","galleries_id":73185,"server_id":18,"link":"photo_999929.html","width":130,"caption":"Porcupine Dunes","height":87});
															thumbnails[969521] = clik.newPhoto({"id":969521,"src":"michael-pinfold-cot-valley_thumb.jpg","galleries_id":72860,"server_id":18,"link":"photo_969521.html","width":130,"caption":"Cot Valley","height":87});
															thumbnails[6508330] = clik.newPhoto({"id":6508330,"src":"michael-pinfold-fly-by-night_thumb.jpg","galleries_id":80703,"server_id":18,"link":"photo_6508330.html","width":87,"caption":"Fly By Night","height":130});
															thumbnails[1520433] = clik.newPhoto({"id":1520433,"src":"michael-pinfold-ancient-pride1_thumb.jpg","galleries_id":104375,"server_id":18,"link":"photo_1520433.html","width":87,"caption":"Ancient Pride","height":130});
															thumbnails[969525] = clik.newPhoto({"id":969525,"src":"michael-pinfold-kynance-cove_thumb.jpg","galleries_id":72860,"server_id":18,"link":"photo_969525.html","width":130,"caption":"Kynance Cove","height":87});
															thumbnails[5512806] = clik.newPhoto({"id":5512806,"src":"michael-pinfold-last-light_thumb.jpg","galleries_id":80703,"server_id":18,"link":"photo_5512806.html","width":87,"caption":"Last Light","height":130});
															thumbnails[1520464] = clik.newPhoto({"id":1520464,"src":"gonamena_3_25-08-07_thumb.jpg","galleries_id":104375,"server_id":18,"link":"photo_1520464.html","width":87,"caption":"Abandoned","height":130});
															thumbnails[1095565] = clik.newPhoto({"id":1095565,"src":"michael-pinfold-tall-grass_thumb.jpg","galleries_id":73185,"server_id":18,"link":"photo_1095565.html","width":87,"caption":"Tall Grass","height":130});
															thumbnails[969536] = clik.newPhoto({"id":969536,"src":"michael-pinfold-stepping-stones_thumb.jpg","galleries_id":72860,"server_id":18,"link":"photo_969536.html","width":130,"caption":"Stepping Stones","height":87});
															thumbnails[4576421] = clik.newPhoto({"id":4576421,"src":"michael-pinfold-atlantic-sunset1_thumb.jpg","galleries_id":73185,"server_id":18,"link":"photo_4576421.html","width":87,"caption":"Atlantic Sunset","height":130});
															thumbnails[1039411] = clik.newPhoto({"id":1039411,"src":"michael-pinfold-coverack_0143985B-1EC9-D45B-1C1285C8D48184F7_thumb.jpg","galleries_id":72860,"server_id":18,"link":"photo_1039411.html","width":130,"caption":"Coverack","height":87});
															thumbnails[1520481] = clik.newPhoto({"id":1520481,"src":"michael-pinfold-head-and-shoulders_thumb.jpg","galleries_id":104375,"server_id":18,"link":"photo_1520481.html","width":87,"caption":"Head and Shoulders","height":130});
															thumbnails[1520473] = clik.newPhoto({"id":1520473,"src":"michael-pinfold-perfect-evening_thumb.jpg","galleries_id":73185,"server_id":18,"link":"photo_1520473.html","width":130,"caption":"Perfect Evening","height":43});
															thumbnails[969531] = clik.newPhoto({"id":969531,"src":"michael-pinfold-deserted_thumb.jpg","galleries_id":72860,"server_id":18,"link":"photo_969531.html","width":130,"caption":"Deserted","height":87});
															thumbnails[5512593] = clik.newPhoto({"id":5512593,"src":"michael-pinfold-uprising_thumb.jpg","galleries_id":104375,"server_id":18,"link":"photo_5512593.html","width":130,"caption":"Uprising","height":70});
															thumbnails[1520656] = clik.newPhoto({"id":1520656,"src":"michael-pinfold-dusky-moor_thumb.jpg","galleries_id":104375,"server_id":18,"link":"photo_1520656.html","width":130,"caption":"Dusky Moor","height":43});
															thumbnails[969535] = clik.newPhoto({"id":969535,"src":"michael-pinfold-porthcurnick_thumb.jpg","galleries_id":72860,"server_id":18,"link":"photo_969535.html","width":130,"caption":"Porthcurnick","height":87});
															thumbnails[1520527] = clik.newPhoto({"id":1520527,"src":"michael-pinfold-cornish-paradise_thumb.jpg","galleries_id":72860,"server_id":18,"link":"photo_1520527.html","width":130,"caption":"Cornish Paradise","height":87});
															thumbnails[969519] = clik.newPhoto({"id":969519,"src":"michael-pinfold-giant-pebbles1_thumb.jpg","galleries_id":72860,"server_id":18,"link":"photo_969519.html","width":86,"caption":"Giant Pebbles","height":130});
															thumbnails[1520471] = clik.newPhoto({"id":1520471,"src":"michael-pinfold-rolling-in_thumb.jpg","galleries_id":72860,"server_id":18,"link":"photo_1520471.html","width":87,"caption":"Rolling In","height":130});
															thumbnails[1520472] = clik.newPhoto({"id":1520472,"src":"michael-pinfold-sun-star_thumb.jpg","galleries_id":72860,"server_id":18,"link":"photo_1520472.html","width":87,"caption":"Sun Star","height":130});
															thumbnails[5471939] = clik.newPhoto({"id":5471939,"src":"michael-pinfold-atlantic-sunset_thumb.jpg","galleries_id":478924,"server_id":18,"link":"photo_5471939.html","width":87,"caption":"Atlantic Sunset","height":130});
															thumbnails[5471946] = clik.newPhoto({"id":5471946,"src":"michael-pinfold-giant-pebbles_thumb.jpg","galleries_id":478924,"server_id":18,"link":"photo_5471946.html","width":86,"caption":"Giant Pebbles","height":130});
															thumbnails[5471949] = clik.newPhoto({"id":5471949,"src":"michael-pinfold-ancient-pride_thumb.jpg","galleries_id":478924,"server_id":18,"link":"photo_5471949.html","width":87,"caption":"Ancient Pride","height":130});
															thumbnails[5471944] = clik.newPhoto({"id":5471944,"src":"bonne_chieremolen_06-01-09_A9347CD6-1D09-001F-99E69A1186666192_thumb.jpg","galleries_id":478924,"server_id":18,"link":"photo_5471944.html","width":87,"caption":"Bonne Chieremolen","height":130});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[478924] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Digital Images","link":"section583389.html","maxRecords":0.0,"photoIDs":[5471939.0,5471946.0,5471949.0,5471944.0],"skipIndex":0,"section_code":"section583389","featured_images":"5471949,5471946,5471944,5471939","id":478924,"singleSection":true});				  						galleries[358258] = clik.newGallery({"parentGallery":269034,"usePopups":false,"title":"Bruges","link":"gallery_358258.html","maxRecords":0.0,"photoIDs":[4666212.0,4666129.0,4666281.0,4666219.0,4666254.0],"skipIndex":0,"section_code":"gallery","featured_images":"4666281,4666254,4666219","id":358258,"singleSection":false});				  						galleries[72860] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Seascapes","link":"gallery_72860.html","maxRecords":0.0,"photoIDs":[969527.0,1520597.0,4576426.0,4576448.0,969552.0,3129799.0,4576435.0,4576433.0,969569.0,1039425.0,973830.0,1095512.0,4576437.0,969524.0,969523.0,969521.0,969525.0,969536.0,1039411.0,969531.0,969535.0,1520527.0,969519.0,1520471.0,1520472.0],"skipIndex":0,"section_code":"gallery","featured_images":"4576437,4576433,4576426,969569,969523,969521","id":72860,"singleSection":false});				  						galleries[358257] = clik.newGallery({"parentGallery":269034,"usePopups":false,"title":"Paris","link":"gallery_358257.html","maxRecords":0.0,"photoIDs":[6511592.0,6511598.0,6511603.0,6511605.0,6511610.0],"skipIndex":0,"section_code":"gallery","featured_images":"6511610,6511605,6511603,6511598,6511592","id":358257,"singleSection":false});				  						galleries[80703] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Rivers","link":"gallery_80703.html","maxRecords":0.0,"photoIDs":[1095427.0,1095429.0,1237984.0,1039424.0,6508330.0,5512806.0],"skipIndex":0,"section_code":"gallery","featured_images":1095427.0,"id":80703,"singleSection":false});				  						galleries[104375] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"The Moors","link":"gallery_104375.html","maxRecords":0.0,"photoIDs":[1520467.0,1520459.0,1520475.0,1520434.0,1520426.0,1520433.0,1520464.0,1520481.0,5512593.0,1520656.0],"skipIndex":0,"section_code":"gallery","featured_images":1520426.0,"id":104375,"singleSection":false});				  						galleries[73185] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Other","link":"gallery_73185.html","maxRecords":0.0,"photoIDs":[973823.0,5513029.0,7531110.0,973826.0,973828.0,999929.0,1095565.0,4576421.0,1520473.0],"skipIndex":0,"section_code":"gallery","featured_images":"4576421,973826,973823","id":73185,"singleSection":false});				  						galleries[269034] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Continental Europe","link":"gallery_269034.html","maxRecords":0.0,"photoIDs":[],"skipIndex":0,"section_code":"gallery","featured_images":"4666281,4666254,4666219","id":269034,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '969527,1520597,4576426,969552,3129799,4576433,1095427,969569,973823,5513029,973830,7531110,4576437,4666281,4666219,969523,4666254,999929,969521,1520473,1520656,969535';
imageSets[2] = '4576426,4576433,1095427,969569,973823,4576437,4666281,973826,4666219,969523,4666254,1520426,969521,4576421';
imageSets[3] = '5471939,5471946,1520597,5471949,4576426,5471944,4576448,969552,3129799,4576435,4576433,4666212,1520467,1095427,969569,4666129,1520459,1095429,973823,1039425,5513029,973830,1095512,4576437,4666281,1520475,1237984,973826,4666219,1520434,1039424,973828,4666254,1520426,999929,1520433,5512806,1520464,1095565,969536,4576421,1039411,1520481,1520473,5512593,1520656,969535,1520527,1520471,1520472';
imageSets[238436] = '5513029';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/michaelpinfoldphotography/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/michaelpinfoldphotography/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/michaelpinfoldphotography/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/michaelpinfoldphotography/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/michaelpinfoldphotography/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/michaelpinfoldphotography/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/michaelpinfoldphotography/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/michaelpinfoldphotography/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/michaelpinfoldphotography/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/michaelpinfoldphotography/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/michaelpinfoldphotography/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/michaelpinfoldphotography/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/michaelpinfoldphotography/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/michaelpinfoldphotography/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/michaelpinfoldphotography/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/michaelpinfoldphotography/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/michaelpinfoldphotography/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/michaelpinfoldphotography/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/michaelpinfoldphotography/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/michaelpinfoldphotography/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/michaelpinfoldphotography/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/michaelpinfoldphotography/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/michaelpinfoldphotography/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/michaelpinfoldphotography/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/michaelpinfoldphotography/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/michaelpinfoldphotography/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/michaelpinfoldphotography/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 = 'Michael Pinfold Photography: ' + photoCaption;
			    }
        if (op.$detail.length > 0) {
      	temp = op.nextPhoto.fnGetImageDetails();
	    op.$detail.fadeGalleryDetails(temp, op.speed, function(){
			if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
				toggleAddToCartConfirm(backgrounds, op.$detail);
			} else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
				toggleAddToCartConfirm(photos, op.$detail);
			}
			$('body').trigger('clikUpdate.popup');
	    });
    }
        $(op.$detailContainer).find('.replaceable[class*=replaceable_photo-]').each(function(){
    	var field = clik.getPrefixedClass(this.className, 'replaceable_photo-');
    	if (field in op.nextPhoto) {
    		$(this).fadeGalleryDetails(op.nextPhoto[field], op.speed);
    	}
    }).end().find('.replaceable.photoPayment').fadeGalleryDetails(op.nextPhoto.fnGetPaymentInfo(), op.speed, function(){
		if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
			toggleAddToCartConfirm(backgrounds, op.$detailContainer);
		} else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
			toggleAddToCartConfirm(photos, op.$detailContainer);
		}
		$('body').trigger('clikUpdate.popup');
	});
		if (op.$photo.length > 0) {
		html = $('<img/>',{
			'class': 'mainphoto photo',
			src: photoSrc,
			id: 'mainPic',
			name: 'mainPic',
			width: op.nextPhoto.width,
			height: op.nextPhoto.height,
			alt: photoCaption,
			css: op.css || {}
		});
		if (op.href) {
			if (op.href.match(/<a/)) {
				html = $(op.href).append(html);
			} else {
				html = $('<a/>', {
					href: op.href,
					title: photoCaption
				}).append(html);
			}
		} else {
			html = $('<a/>', {
				title: photoCaption
			}).append(html);
		}
		if (op.speed == 0) {			op.$photo.html(html);			if (op.onBefore) {			  	op.onBefore.apply(op.$photo);			}			if (op.onAfter) {			  	op.onAfter.apply(op.$photo);			}		} else {			op.$photo.stop(true,true).fadeReplaceWith(html,op.speed,'',function(){  				if (op.onAfter) {				  	op.onAfter.apply(this);				}				clik.doColumnResize(false, $(this).add(op.$detail).add(op.$title));			}, op.onBefore);
		}	}
    if (op.field) {
		op.field.value = photoId;
	} else {
		op.$photo.data('image_id', photoId);
    }
        if (!op.speed) {
      	clik.doColumnResize(false, op.$photo.add(op.$detail).add(op.$title));
    }
        
    return html;
	}

/***************************************************************************
* Toggle add to cart confirmation element and set up the click event for   *
* the 'Add to cart' button.                                                *
***************************************************************************/
function toggleAddToCartConfirm(array, root){
	if (typeof(array) !== 'object' || array === null) {
	  	array = photos;
	}
	if (!$(root).length) {		root = $('body');	}	if($('#paymentConfirm', root).length > 0){
		$('#paymentConfirm', root).hide();
		$('#paymentAddButton', root)
		.unbind()
		.click(function(){
						form = $('#paymentForm', root)[0];
			option_id = 0;
			if(form.item_option.value){
				option_id = form.item_option.value;
			}
			if(addItemToBasket(form.item_number.value,array,form.site.value,parseInt(form.quantity.value, 10),option_id)){
				if($.browser.msie){$('#paymentConfirm', root).text('Item added to cart').show();}
				else{
					$('#paymentConfirm', root).text('Item added to cart').fadeIn();
					dspOrderDetails(form.site.value);
				}
			}
			else{
				$('#paymentConfirm', root).text('Item not added - check cookies are enabled in your browser.').fadeIn();
			}
		});
	}
}

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
clik.photo.fnGetImageDetails = function(){
	var temp = '';
	if (this.description != '') {
		temp +=  '<div id="imageDescription">' + this.description + '</div>';
	}
		if (this.photo_ref != '') {
		temp += '<div class="imageinfo" id="imageRef"><strong>Image File Size: </strong>' + this.photo_ref + '</div>';
	}
		if (this.takendate != '') {
		
		temp += '<div class="imageinfo" id="imageDate"><strong>Date: </strong>' + this.takendate + '</div>';
	}
	
	if (this.location != '') {
		
		temp += '<div class="imageinfo" id="imageLocation"><strong>Location: </strong>' +  this.location + '</div>';
	}
	
	if (this.photographer != '') {
		
		temp += '<div class="imageinfo" id="imagePhotographer"><strong>Photographer: </strong>' + this.photographer + '</div>';
	}
				
				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>Order this print:</p>';
				temp += '<div class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> &pound;' + (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.item_price !== '') {
			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;
	}
}

			

