window.thumbnails = {};
															thumbnails[4582599] = clik.newPhoto({"id":4582599,"src":"pond_life_thumb.jpg","galleries_id":265664,"server_id":18,"link":"photo_4582599.html","width":130,"caption":"Small bridge at Bentley Wildfowl Trust","height":87});
															thumbnails[4582080] = clik.newPhoto({"id":4582080,"src":"b-w_rose_thumb.jpg","galleries_id":265664,"server_id":18,"link":"photo_4582080.html","width":130,"caption":"Peony, black and white.","height":92});
															thumbnails[4582110] = clik.newPhoto({"id":4582110,"src":"little_apples_thumb.jpg","galleries_id":265664,"server_id":18,"link":"photo_4582110.html","width":130,"caption":"Little apples","height":87});
															thumbnails[4582154] = clik.newPhoto({"id":4582154,"src":"peony_thumb.jpg","galleries_id":265664,"server_id":18,"link":"photo_4582154.html","width":130,"caption":"Peony","height":87});
															thumbnails[4582173] = clik.newPhoto({"id":4582173,"src":"Peony_wet_thumb.jpg","galleries_id":265664,"server_id":18,"link":"photo_4582173.html","width":130,"caption":"Wet Peony","height":87});
															thumbnails[4581887] = clik.newPhoto({"id":4581887,"src":"liquified_wood_thumb.jpg","galleries_id":265664,"server_id":18,"link":"photo_4581887.html","width":130,"caption":"Liquified wood","height":87});
															thumbnails[4583888] = clik.newPhoto({"id":4583888,"src":"chris_portprof_pp_thumb.jpg","galleries_id":94056,"server_id":18,"link":"photo_4583888.html","width":130,"caption":"Friend or foe","height":94});
															thumbnails[4583881] = clik.newPhoto({"id":4583881,"src":"Chris_B_thumb.jpg","galleries_id":94056,"server_id":18,"link":"photo_4583881.html","width":130,"caption":"Friend in fur","height":194});
															thumbnails[8251189] = clik.newPhoto({"id":8251189,"src":"01_thumb.jpg","galleries_id":260127,"server_id":35,"link":"photo_8251189.html","width":140,"caption":"Blue-see","height":93});
															thumbnails[8251184] = clik.newPhoto({"id":8251184,"src":"00_thumb.jpg","galleries_id":260127,"server_id":35,"link":"photo_8251184.html","width":140,"caption":"super silver dream","height":93});
															thumbnails[4582331] = clik.newPhoto({"id":4582331,"src":"camber_boat_thumb.jpg","galleries_id":265664,"server_id":18,"link":"photo_4582331.html","width":130,"caption":"Beached Boat at Camber","height":88});
															thumbnails[4582585] = clik.newPhoto({"id":4582585,"src":"land_ahoy_thumb.jpg","galleries_id":265664,"server_id":18,"link":"photo_4582585.html","width":130,"caption":"Land Ahoy!","height":89});
															thumbnails[4582251] = clik.newPhoto({"id":4582251,"src":"wisteria_thumb.jpg","galleries_id":265664,"server_id":18,"link":"photo_4582251.html","width":130,"caption":"Wisteria","height":194});
															thumbnails[4582325] = clik.newPhoto({"id":4582325,"src":"brown_boat_thumb.jpg","galleries_id":265664,"server_id":18,"link":"photo_4582325.html","width":130,"caption":"Brown boat","height":87});
															thumbnails[4581680] = clik.newPhoto({"id":4581680,"src":"leaf_vein_09_thumb.jpg","galleries_id":265664,"server_id":18,"link":"photo_4581680.html","width":130,"caption":"Leaf vein with water","height":87});
															thumbnails[4581905] = clik.newPhoto({"id":4581905,"src":"Peony_wet_colour_saturated_thumb.jpg","galleries_id":265664,"server_id":18,"link":"photo_4581905.html","width":130,"caption":"Peony, my favourite flower. So full and shapely, yet so delicate.","height":185});
															thumbnails[4581915] = clik.newPhoto({"id":4581915,"src":"pink_rose_liquify_0_thumb.jpg","galleries_id":265664,"server_id":18,"link":"photo_4581915.html","width":130,"caption":"Liquid Rose - a variation on a theme. ","height":93});
															thumbnails[4583899] = clik.newPhoto({"id":4583899,"src":"Danielle_07_A4_pp_close_thumb.jpg","galleries_id":94056,"server_id":18,"link":"photo_4583899.html","width":130,"caption":"beautiful soft contours","height":184});
															thumbnails[4582138] = clik.newPhoto({"id":4582138,"src":"orange_bells_thumb.jpg","galleries_id":265664,"server_id":18,"link":"photo_4582138.html","width":130,"caption":"Orange Winter Bells","height":193});
															thumbnails[8251190] = clik.newPhoto({"id":8251190,"src":"02_thumb.jpg","galleries_id":260127,"server_id":35,"link":"photo_8251190.html","width":140,"caption":"reflections","height":93});
															thumbnails[8251198] = clik.newPhoto({"id":8251198,"src":"03_thumb.jpg","galleries_id":260127,"server_id":35,"link":"photo_8251198.html","width":140,"caption":"Nice Line-up","height":93});
															thumbnails[8251199] = clik.newPhoto({"id":8251199,"src":"04_thumb.jpg","galleries_id":260127,"server_id":35,"link":"photo_8251199.html","width":140,"caption":"Beautiful C-Type","height":127});
															thumbnails[4582344] = clik.newPhoto({"id":4582344,"src":"DSC_1368_thumb.jpg","galleries_id":265664,"server_id":18,"link":"photo_4582344.html","width":130,"caption":"Ramsgate Harbour","height":87});
															thumbnails[4582355] = clik.newPhoto({"id":4582355,"src":"eastbourne_thumb.jpg","galleries_id":265664,"server_id":18,"link":"photo_4582355.html","width":130,"caption":"Eastbourne Pier","height":79});
															thumbnails[4582389] = clik.newPhoto({"id":4582389,"src":"boat_silhouette_00_thumb.jpg","galleries_id":265664,"server_id":18,"link":"photo_4582389.html","width":130,"caption":"Silhouette of sailing boat","height":87});
															thumbnails[4582336] = clik.newPhoto({"id":4582336,"src":"Devon_boat_thumb.jpg","galleries_id":265664,"server_id":18,"link":"photo_4582336.html","width":130,"caption":"Devon Boat","height":87});
															thumbnails[4449184] = clik.newPhoto({"id":4449184,"src":"EE_Jag_thumb.jpg","galleries_id":260127,"server_id":18,"link":"photo_4449184.html","width":130,"caption":"New Jaguar","height":87});
															thumbnails[4449205] = clik.newPhoto({"id":4449205,"src":"jag_00_thumb.jpg","galleries_id":260127,"server_id":18,"link":"photo_4449205.html","width":130,"caption":"Jaguar","height":87});
															thumbnails[4449283] = clik.newPhoto({"id":4449283,"src":"jag_01_thumb.jpg","galleries_id":260127,"server_id":18,"link":"photo_4449283.html","width":130,"caption":"Jaguar","height":87});
															thumbnails[4449289] = clik.newPhoto({"id":4449289,"src":"jag_02_thumb.jpg","galleries_id":260127,"server_id":18,"link":"photo_4449289.html","width":130,"caption":"Jaguar","height":87});
															thumbnails[4449302] = clik.newPhoto({"id":4449302,"src":"jag_04_thumb.jpg","galleries_id":260127,"server_id":18,"link":"photo_4449302.html","width":130,"caption":"Jaguar","height":172});
															thumbnails[4582621] = clik.newPhoto({"id":4582621,"src":"westward_riding_00_thumb.jpg","galleries_id":265664,"server_id":18,"link":"photo_4582621.html","width":130,"caption":"Westward Ho! Riding on the beach.","height":87});
															thumbnails[4582295] = clik.newPhoto({"id":4582295,"src":"daisy_field_thumb.jpg","galleries_id":265664,"server_id":18,"link":"photo_4582295.html","width":130,"caption":"Daisy Field","height":87});
															thumbnails[4582233] = clik.newPhoto({"id":4582233,"src":"unknown_seed_heads_thumb.jpg","galleries_id":265664,"server_id":18,"link":"photo_4582233.html","width":130,"caption":"Seed Heads","height":87});
															thumbnails[4582209] = clik.newPhoto({"id":4582209,"src":"Tulips-coloured-layered_thumb.jpg","galleries_id":265664,"server_id":18,"link":"photo_4582209.html","width":130,"caption":"Tulips","height":87});
															thumbnails[4583912] = clik.newPhoto({"id":4583912,"src":"fifi_close_pp_thumb.jpg","galleries_id":94056,"server_id":18,"link":"photo_4583912.html","width":130,"caption":"The eyes have it!!","height":98});
															thumbnails[4583905] = clik.newPhoto({"id":4583905,"src":"Fifi_thumb.jpg","galleries_id":94056,"server_id":18,"link":"photo_4583905.html","width":130,"caption":"Mysterious woman in black","height":194});
															thumbnails[7073378] = clik.newPhoto({"id":7073378,"src":"DSC_2784_thumb.jpg","galleries_id":260127,"server_id":18,"link":"photo_7073378.html","width":130,"caption":"shiny cobra","height":87});
															thumbnails[7073388] = clik.newPhoto({"id":7073388,"src":"DSC_2796_thumb.jpg","galleries_id":260127,"server_id":18,"link":"photo_7073388.html","width":130,"caption":"aluminium cobra reflections ","height":195});
															thumbnails[7073397] = clik.newPhoto({"id":7073397,"src":"DSC_2798_thumb.jpg","galleries_id":260127,"server_id":18,"link":"photo_7073397.html","width":130,"caption":"aluminium cobra reflections ","height":96});
															thumbnails[7073401] = clik.newPhoto({"id":7073401,"src":"DSC_2799_thumb.jpg","galleries_id":260127,"server_id":18,"link":"photo_7073401.html","width":130,"caption":"aluminium cobra reflections ","height":195});
															thumbnails[7073433] = clik.newPhoto({"id":7073433,"src":"DSC_2802_thumb.jpg","galleries_id":260127,"server_id":18,"link":"photo_7073433.html","width":130,"caption":"aluminium cobra reflections ","height":87});
															thumbnails[7073438] = clik.newPhoto({"id":7073438,"src":"DSC_2807_thumb.jpg","galleries_id":260127,"server_id":18,"link":"photo_7073438.html","width":130,"caption":"aluminium cobra reflections ","height":87});
															thumbnails[8251201] = clik.newPhoto({"id":8251201,"src":"05_thumb.jpg","galleries_id":260127,"server_id":35,"link":"photo_8251201.html","width":140,"caption":"50th anniversary E-Type","height":92});
															thumbnails[8251203] = clik.newPhoto({"id":8251203,"src":"06_thumb.jpg","galleries_id":260127,"server_id":35,"link":"photo_8251203.html","width":140,"caption":"","height":93});
															thumbnails[8251205] = clik.newPhoto({"id":8251205,"src":"07_thumb.jpg","galleries_id":260127,"server_id":35,"link":"photo_8251205.html","width":140,"caption":"","height":93});
															thumbnails[7074518] = clik.newPhoto({"id":7074518,"src":"DSC_6819_thumb.JPG","galleries_id":260127,"server_id":18,"link":"photo_7074518.html","width":130,"caption":"Hawk cars","height":87});
															thumbnails[7074510] = clik.newPhoto({"id":7074510,"src":"DSC_6138_thumb.JPG","galleries_id":260127,"server_id":18,"link":"photo_7074510.html","width":130,"caption":"Group 4 Stratos","height":87});
															thumbnails[7074512] = clik.newPhoto({"id":7074512,"src":"DSC_6213_thumb.JPG","galleries_id":260127,"server_id":18,"link":"photo_7074512.html","width":130,"caption":"Lotus Eleven","height":87});
															thumbnails[7074514] = clik.newPhoto({"id":7074514,"src":"DSC_6223_thumb.JPG","galleries_id":260127,"server_id":18,"link":"photo_7074514.html","width":130,"caption":"Oracle Cars","height":87});
															thumbnails[7074431] = clik.newPhoto({"id":7074431,"src":"DSC_4491_thumb.JPG","galleries_id":260127,"server_id":18,"link":"photo_7074431.html","width":130,"caption":"Le mans","height":87});
															thumbnails[4582376] = clik.newPhoto({"id":4582376,"src":"boat_thumb.jpg","galleries_id":265664,"server_id":18,"link":"photo_4582376.html","width":130,"caption":"Boat, Whitstable, Kent","height":87});
															thumbnails[4582386] = clik.newPhoto({"id":4582386,"src":"boat_00_thumb.jpg","galleries_id":265664,"server_id":18,"link":"photo_4582386.html","width":130,"caption":"Beached old Whitstable Boat","height":87});
															thumbnails[4582241] = clik.newPhoto({"id":4582241,"src":"winter_white_thumb.jpg","galleries_id":265664,"server_id":18,"link":"photo_4582241.html","width":130,"caption":"Winter white","height":87});
															thumbnails[7074434] = clik.newPhoto({"id":7074434,"src":"DSC_4609_thumb.JPG","galleries_id":260127,"server_id":18,"link":"photo_7074434.html","width":130,"caption":"Le Mans","height":87});
															thumbnails[8251208] = clik.newPhoto({"id":8251208,"src":"10_thumb.jpg","galleries_id":260127,"server_id":35,"link":"photo_8251208.html","width":140,"caption":"","height":210});
															thumbnails[8251214] = clik.newPhoto({"id":8251214,"src":"08_thumb.jpg","galleries_id":260127,"server_id":35,"link":"photo_8251214.html","width":140,"caption":"","height":93});
															thumbnails[4583940] = clik.newPhoto({"id":4583940,"src":"Miss_Nigeria_00_thumb.jpg","galleries_id":94056,"server_id":18,"link":"photo_4583940.html","width":130,"caption":"Miss Nigeria","height":194});
															thumbnails[4583937] = clik.newPhoto({"id":4583937,"src":"Miss_Nigeria_thumb.jpg","galleries_id":94056,"server_id":18,"link":"photo_4583937.html","width":130,"caption":"Miss Nigeria","height":146});
															thumbnails[4583924] = clik.newPhoto({"id":4583924,"src":"Holly_pplevels_thumb.jpg","galleries_id":94056,"server_id":18,"link":"photo_4583924.html","width":130,"caption":"Faraway dreams","height":184});
															thumbnails[4592941] = clik.newPhoto({"id":4592941,"src":"Tulips-coloured-layered1_thumb.jpg","galleries_id":265664,"server_id":18,"link":"photo_4592941.html","width":130,"caption":"","height":104});
															thumbnails[4449148] = clik.newPhoto({"id":4449148,"src":"289_air_filter_thumb.jpg","galleries_id":260127,"server_id":18,"link":"photo_4449148.html","width":130,"caption":"Cobra 289 air filter","height":87});
															thumbnails[4449236] = clik.newPhoto({"id":4449236,"src":"wheel_spokes_thumb.jpg","galleries_id":260127,"server_id":18,"link":"photo_4449236.html","width":130,"caption":"Spokes","height":87});
															thumbnails[4449553] = clik.newPhoto({"id":4449553,"src":"cobra_curves_thumb.jpg","galleries_id":260127,"server_id":18,"link":"photo_4449553.html","width":130,"caption":"Cobra curves","height":87});
															thumbnails[4449571] = clik.newPhoto({"id":4449571,"src":"cobra_engine_thumb.jpg","galleries_id":260127,"server_id":18,"link":"photo_4449571.html","width":130,"caption":"Cobra engine","height":87});
															thumbnails[4449594] = clik.newPhoto({"id":4449594,"src":"Jag_c-type_thumb.jpg","galleries_id":260127,"server_id":18,"link":"photo_4449594.html","width":130,"caption":"Jaguar C-Type","height":87});
															thumbnails[4449611] = clik.newPhoto({"id":4449611,"src":"mirror_close-up_thumb.jpg","galleries_id":260127,"server_id":18,"link":"photo_4449611.html","width":130,"caption":"Cobra 289 mirror","height":87});
															thumbnails[4449631] = clik.newPhoto({"id":4449631,"src":"spokes_thumb.jpg","galleries_id":260127,"server_id":18,"link":"photo_4449631.html","width":130,"caption":"Spokes, blue","height":125});
															thumbnails[4583921] = clik.newPhoto({"id":4583921,"src":"Holly_ppgradient_tool_thumb.jpg","galleries_id":94056,"server_id":18,"link":"photo_4583921.html","width":130,"caption":"Bright student","height":190});
															thumbnails[4834437] = clik.newPhoto({"id":4834437,"src":"000_thumb.jpg","galleries_id":260127,"server_id":18,"link":"photo_4834437.html","width":130,"caption":"","height":87});
															thumbnails[4583944] = clik.newPhoto({"id":4583944,"src":"model_pp-gradient_tool_thumb.jpg","galleries_id":94056,"server_id":18,"link":"photo_4583944.html","width":130,"caption":"Model view","height":190});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[94056] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Portraits","link":"gallery_94056.html","maxRecords":0.0,"photoIDs":[4583888.0,4583881.0,4583899.0,4583912.0,4583905.0,4583940.0,4583937.0,4583924.0,4583921.0,4583944.0],"skipIndex":0,"section_code":"gallery","featured_images":"4583899,4583881","id":94056,"singleSection":false});				  						galleries[265664] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Man and Nature","link":"gallery_265664.html","maxRecords":0.0,"photoIDs":[4582599.0,4582080.0,4582110.0,4582154.0,4582173.0,4581887.0,4582331.0,4582585.0,4582251.0,4582325.0,4581680.0,4581905.0,4581915.0,4582138.0,4582344.0,4582355.0,4582389.0,4582336.0,4582621.0,4582295.0,4582233.0,4582209.0,4582376.0,4582386.0,4582241.0,4592941.0],"skipIndex":0,"section_code":"gallery","featured_images":"4582344,4581905","id":265664,"singleSection":false});				  						galleries[260127] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Cars - Replica, Classic & Kit","link":"gallery_260127.html","maxRecords":0.0,"photoIDs":[8251189.0,8251184.0,8251190.0,8251198.0,8251199.0,4449184.0,4449205.0,4449283.0,4449289.0,4449302.0,7073378.0,7073388.0,7073397.0,7073401.0,7073433.0,7073438.0,8251201.0,8251203.0,8251205.0,7074518.0,7074510.0,7074512.0,7074514.0,7074431.0,7074434.0,8251208.0,8251214.0,4449148.0,4449236.0,4449553.0,4449571.0,4449594.0,4449611.0,4449631.0,4834437.0],"skipIndex":0,"section_code":"gallery","featured_images":"4449553,4449302","id":260127,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '4582251';
imageSets[2] = '4583899,4583881,4582344,4581905,4449553,4449302';
imageSets[3] = '8251214,8251208,8251205,8251203,8251201,8251199,8251198,8251190,8251189,8251184,7074518,7074514,7074512,7074510,7074434,7074431,7073438,7073433,7073401,7073397,7073388,7073378,4834437,4592941,4583944,4583940,4583937,4583924,4583921,4583912,4583905,4583899,4583888,4583881,4582621,4582599,4582585,4582389,4582386,4582376,4582355,4582344,4582336,4582331,4582325,4582295,4582251,4582241,4582233,4582209';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/alicobb/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/alicobb/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/alicobb/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/alicobb/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/alicobb/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/alicobb/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/alicobb/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/alicobb/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/alicobb/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/alicobb/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/alicobb/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/alicobb/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/alicobb/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/alicobb/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/alicobb/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/alicobb/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/alicobb/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/alicobb/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/alicobb/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/alicobb/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/alicobb/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/alicobb/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/alicobb/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/alicobb/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:'',$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 = 'Rose Yard 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>Ref: </strong>' + this.photo_ref + '</div>';
	}
		if (this.takendate != '') {
		
		temp += '<div class="imageinfo" id="imageDate"><strong>Date: </strong>' + this.takendate + '</div>';
	}
	
	if (this.location != '') {
		
		temp += '<div class="imageinfo" id="imageLocation"><strong>Location: </strong>' +  this.location + '</div>';
	}
	
	if (this.photographer != '') {
		
		temp += '<div class="imageinfo" id="imagePhotographer"><strong>Photographer: </strong>' + this.photographer + '</div>';
	}
				
				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> ' + (this.item_price).toFixed(2) + '</div>';
		var item_name  = this.purchase_instruction;
		var amount = (this.item_price).toFixed(2);
		var item_option  = 0;
	}
	else if (this.payment_groups_id !== '') {
		temp += '<p>Buy this print online:</p>';
				temp += '<form id="paymentOptions" style="margin:0px;border:0px;" name="paymentOptions">';
											temp += '<select class="paymentlink" name="payment_options_id" onchange="updateItemValues($(this.form).next(\'#paymentForm\')[0],this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value);">';
		
		temp += getPaymentOptions(this.payment_groups_id);
		temp += '</select>';
		temp += '</form>';
				var item_option  = paymentGroups[this.payment_groups_id].options[0];
		if(paymentOptions[item_option]){
			var item_name  = paymentOptions[item_option].payment_option;
			var amount =  paymentOptions[item_option].price;
		}
			}
	else {
		
	}
	if (this.item_price !== '' || this.payment_groups_id !== '') {
			temp += '<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 += '<a href="' + galleries[i].section_code + '_' + galleries[i].id + '.html">' + galleries[i].title + '</a>';
							}
		}
		document.all.galleryLinks.innerHTML = 'Other galleries: ' + temp;
	}
}

		

