window.thumbnails = {};
															thumbnails[260050] = clik.newPhoto({"id":260050,"src":"Lucy, Garlic & Ivy shoot 130 copy_thumb.jpg","galleries_id":21892,"server_id":18,"link":"photo_260050.html","width":130,"caption":"<p>Lucy in Wild Garlic <p?>","height":200});
															thumbnails[260059] = clik.newPhoto({"id":260059,"src":"Lucy, Garlic & Ivy shoot 144 copy_thumb.jpg","galleries_id":21892,"server_id":18,"link":"photo_260059.html","width":130,"caption":"<p>Lucy in Wild Garlic <p?>","height":200});
															thumbnails[260060] = clik.newPhoto({"id":260060,"src":"Lucy, Garlic & Ivy shoot 145 copy_thumb.jpg","galleries_id":21892,"server_id":18,"link":"photo_260060.html","width":130,"caption":"<p>Lucy in Wild Garlic <p?>","height":200});
															thumbnails[260062] = clik.newPhoto({"id":260062,"src":"Lucy, Garlic & Ivy shoot 164 mono copy_thumb.jpg","galleries_id":21891,"server_id":18,"link":"photo_260062.html","width":130,"caption":"<p>Lucy in Wild Garlic <p?>","height":200});
															thumbnails[260068] = clik.newPhoto({"id":260068,"src":"Lucy, Garlic & Ivy shoot 242 copy_thumb.jpg","galleries_id":21892,"server_id":18,"link":"photo_260068.html","width":130,"caption":"Garlic & Ivy shoot","height":200});
															thumbnails[260071] = clik.newPhoto({"id":260071,"src":"Lucy, Garlic & Ivy shoot 264 copy_thumb.jpg","galleries_id":438058,"server_id":18,"link":"photo_260071.html","width":130,"caption":"Lucy in Ivy ","height":200});
															thumbnails[260085] = clik.newPhoto({"id":260085,"src":"Lucy, Garlic & Ivy shoot 287 copy_thumb.jpg","galleries_id":438058,"server_id":18,"link":"photo_260085.html","width":130,"caption":"Lucy in Ivy ","height":200});
															thumbnails[260093] = clik.newPhoto({"id":260093,"src":"Lucy, Garlic & Ivy shoot 295 copy_thumb.jpg","galleries_id":438058,"server_id":18,"link":"photo_260093.html","width":130,"caption":"<p>Lucy in the fireplace <p\/>","height":200});
															thumbnails[260100] = clik.newPhoto({"id":260100,"src":"Lucy, Garlic & Ivy shoot 313 copy_thumb.jpg","galleries_id":438058,"server_id":18,"link":"photo_260100.html","width":130,"caption":"<p>Lucy in the fireplace <p\/>","height":200});
															thumbnails[443467] = clik.newPhoto({"id":443467,"src":"Lucy, schoologirl shoot 151 copy1_thumb.jpg","galleries_id":21892,"server_id":18,"link":"photo_443467.html","width":130,"caption":"Lucy, schoolgirl shoot","height":194});
															thumbnails[443472] = clik.newPhoto({"id":443472,"src":"Lucy, schoologirl shoot 358 copy attitude copy 21_thumb.jpg","galleries_id":21892,"server_id":18,"link":"photo_443472.html","width":130,"caption":"Lucy, schoolgirl shoot","height":194});
															thumbnails[443496] = clik.newPhoto({"id":443496,"src":"Lucy, schoologirl shoot 358 copy attitude copy mono copy1_thumb.jpg","galleries_id":21891,"server_id":18,"link":"photo_443496.html","width":130,"caption":"Lucy, schoolgirl shoot","height":194});
															thumbnails[443507] = clik.newPhoto({"id":443507,"src":"Lucy, schoologirl shoot 380 copy sad look copy1_thumb.jpg","galleries_id":21892,"server_id":18,"link":"photo_443507.html","width":130,"caption":"Lucy, schoolgirl shoot","height":194});
															thumbnails[443518] = clik.newPhoto({"id":443518,"src":"Lucy, schoologirl shoot 473 copy1_thumb.jpg","galleries_id":21892,"server_id":18,"link":"photo_443518.html","width":130,"caption":"Lucy, schoolgirl shoot","height":194});
															thumbnails[443551] = clik.newPhoto({"id":443551,"src":"Lucy, schoologirl shoot 583 copy selective colour copy1_thumb.jpg","galleries_id":438058,"server_id":18,"link":"photo_443551.html","width":130,"caption":"Lucy, schoolgirl shoot","height":194});
															thumbnails[443552] = clik.newPhoto({"id":443552,"src":"Lucy, schoologirl shoot 588 copy selective colour copy1_thumb.jpg","galleries_id":438058,"server_id":18,"link":"photo_443552.html","width":130,"caption":"Lucy, schoolgirl shoot","height":194});
															thumbnails[496133] = clik.newPhoto({"id":496133,"src":"lucy gun & red shoes shoot 350 copy_thumb.jpg","galleries_id":438058,"server_id":18,"link":"photo_496133.html","width":130,"caption":"guns and red shoes shoot","height":194});
															thumbnails[496135] = clik.newPhoto({"id":496135,"src":"lucy gun & red shoes shoot 366 copy_thumb.jpg","galleries_id":438058,"server_id":18,"link":"photo_496135.html","width":130,"caption":"guns and red shoes shoot","height":194});
															thumbnails[496229] = clik.newPhoto({"id":496229,"src":"lucy gun & red shoes shoot 471 copy_thumb.jpg","galleries_id":21892,"server_id":18,"link":"photo_496229.html","width":130,"caption":"guns and red shoes shoot","height":194});
															thumbnails[496334] = clik.newPhoto({"id":496334,"src":"lucy gun & red shoes shoot 541 copy_thumb.jpg","galleries_id":21892,"server_id":18,"link":"photo_496334.html","width":130,"caption":"guns and red shoes shoot","height":194});
															thumbnails[496336] = clik.newPhoto({"id":496336,"src":"lucy gun & red shoes shoot 558 copy_thumb.jpg","galleries_id":21892,"server_id":18,"link":"photo_496336.html","width":130,"caption":"guns and red shoes shoot","height":139});
															thumbnails[496350] = clik.newPhoto({"id":496350,"src":"lucy gun & red shoes shoot 633 copy_thumb.jpg","galleries_id":21892,"server_id":18,"link":"photo_496350.html","width":130,"caption":"guns and red shoes shoot","height":194});
															thumbnails[2144037] = clik.newPhoto({"id":2144037,"src":" gema in ivy copy_thumb.jpg","galleries_id":142311,"server_id":2,"link":"photo_2144037.html","width":130,"caption":"Gemma in ivy","height":194});
															thumbnails[2144047] = clik.newPhoto({"id":2144047,"src":"0057 mono wall 3 copy_thumb.jpg","galleries_id":21891,"server_id":18,"link":"photo_2144047.html","width":130,"caption":"Gemma sat on wall","height":87});
															thumbnails[2144057] = clik.newPhoto({"id":2144057,"src":"DSC_0004 mono copy_thumb.jpg","galleries_id":21891,"server_id":18,"link":"photo_2144057.html","width":130,"caption":"Gemma and blackthorn mono","height":194});
															thumbnails[2144063] = clik.newPhoto({"id":2144063,"src":"DSC_0014 copy 3_thumb.jpg","galleries_id":21891,"server_id":18,"link":"photo_2144063.html","width":130,"caption":"Gemma & spring woodland, selective colour","height":194});
															thumbnails[2376837] = clik.newPhoto({"id":2376837,"src":"DSC_0050 distressed 1 web copy_thumb.jpg","galleries_id":142311,"server_id":18,"link":"photo_2376837.html","width":130,"caption":"Gemma in red veil","height":194});
															thumbnails[2376843] = clik.newPhoto({"id":2376843,"src":"0008 sat wall distressed 2 web copy_thumb.jpg","galleries_id":142311,"server_id":18,"link":"photo_2376843.html","width":130,"caption":"Gemma against wall","height":194});
															thumbnails[8153135] = clik.newPhoto({"id":8153135,"src":"009_0001_web_copy_thumb.jpg","galleries_id":21891,"server_id":18,"link":"photo_8153135.html","width":130,"caption":"The fly fisherman","height":87});
															thumbnails[8153142] = clik.newPhoto({"id":8153142,"src":"009_0026_mono_web_copy_thumb.jpg","galleries_id":21891,"server_id":18,"link":"photo_8153142.html","width":130,"caption":"Mattress in cobbled ally","height":87});
															thumbnails[8153298] = clik.newPhoto({"id":8153298,"src":"009_0005_infa_web1_thumb.jpg","galleries_id":21891,"server_id":18,"link":"photo_8153298.html","width":130,"caption":"Marske beach","height":84});
															thumbnails[8162496] = clik.newPhoto({"id":8162496,"src":"129_selective_on_sepia_web_copy_thumb.jpg","galleries_id":21891,"server_id":18,"link":"photo_8162496.html","width":130,"caption":"","height":87});
															thumbnails[8162508] = clik.newPhoto({"id":8162508,"src":"009_0020_web_copy_thumb.jpg","galleries_id":21891,"server_id":18,"link":"photo_8162508.html","width":130,"caption":"","height":195});
															thumbnails[8162769] = clik.newPhoto({"id":8162769,"src":"DSC_0013_copy_thumb.jpg","galleries_id":438058,"server_id":18,"link":"photo_8162769.html","width":130,"caption":"","height":200});
															thumbnails[8162801] = clik.newPhoto({"id":8162801,"src":"erotika_142_copy_sphere_copy_thumb.jpg","galleries_id":3876,"server_id":18,"link":"photo_8162801.html","width":130,"caption":"","height":194});
															thumbnails[8162807] = clik.newPhoto({"id":8162807,"src":"erotika_337_copy_bloe_duo_copy_thumb.jpg","galleries_id":438058,"server_id":18,"link":"photo_8162807.html","width":130,"caption":"","height":194});
															thumbnails[8162821] = clik.newPhoto({"id":8162821,"src":"erotika_362_copy_mono_copy_thumb.jpg","galleries_id":438058,"server_id":18,"link":"photo_8162821.html","width":130,"caption":"","height":194});
															thumbnails[8162834] = clik.newPhoto({"id":8162834,"src":"spider-gloves-through-bubbl_thumb.jpg","galleries_id":438058,"server_id":18,"link":"photo_8162834.html","width":130,"caption":"","height":200});
															thumbnails[8162847] = clik.newPhoto({"id":8162847,"src":"johnny_at_talpoe_026_CMKY_thumb.jpg","galleries_id":3876,"server_id":18,"link":"photo_8162847.html","width":130,"caption":"","height":123});
															thumbnails[8162907] = clik.newPhoto({"id":8162907,"src":"Sam_Upleatham_church_shoot_433_web_copy_no_logo_thumb.jpg","galleries_id":3876,"server_id":18,"link":"photo_8162907.html","width":130,"caption":"","height":200});
															thumbnails[8162945] = clik.newPhoto({"id":8162945,"src":"lucy_snow_flakes__cross_mounted_copy_thumb.jpg","galleries_id":438058,"server_id":18,"link":"photo_8162945.html","width":130,"caption":"","height":188});
															thumbnails[8162950] = clik.newPhoto({"id":8162950,"src":"lucy__bowler_hat_flowery_brush_2_mounted_copy_thumb.jpg","galleries_id":3876,"server_id":18,"link":"photo_8162950.html","width":130,"caption":"","height":189});
															thumbnails[8162956] = clik.newPhoto({"id":8162956,"src":"johnny_hob_hole_spray_mounted_thumb.jpg","galleries_id":3876,"server_id":18,"link":"photo_8162956.html","width":130,"caption":"","height":189});
															thumbnails[8164771] = clik.newPhoto({"id":8164771,"src":"spider-gloves-on-bannister_thumb.jpg","galleries_id":438058,"server_id":18,"link":"photo_8164771.html","width":130,"caption":"","height":85});
															thumbnails[8177924] = clik.newPhoto({"id":8177924,"src":"lynsey_273_copy_mono__red_blood__lips_thumb.jpg","galleries_id":438058,"server_id":18,"link":"photo_8177924.html","width":130,"caption":"","height":195});
															thumbnails[8177953] = clik.newPhoto({"id":8177953,"src":"lynsey_534_distressed_thumb.jpg","galleries_id":3876,"server_id":18,"link":"photo_8177953.html","width":130,"caption":"","height":195});
															thumbnails[8204844] = clik.newPhoto({"id":8204844,"src":"hartlepool_harbur_DSC_0972_3_4_5_6_tonemapped_web_copy_2_thumb.jpg","galleries_id":3876,"server_id":18,"link":"photo_8204844.html","width":130,"caption":"","height":88});
															thumbnails[8204845] = clik.newPhoto({"id":8204845,"src":"transporter_bridge_at_night_web_copy_2_thumb.jpg","galleries_id":3876,"server_id":18,"link":"photo_8204845.html","width":130,"caption":"","height":195});
															thumbnails[8204847] = clik.newPhoto({"id":8204847,"src":"transporter_bridge_de_sat_web_copy_thumb.jpg","galleries_id":3876,"server_id":18,"link":"photo_8204847.html","width":130,"caption":"","height":194});
															thumbnails[8208847] = clik.newPhoto({"id":8208847,"src":"009_0009_mono_copy_thumb.jpg","galleries_id":21891,"server_id":18,"link":"photo_8208847.html","width":130,"caption":"","height":87});
															thumbnails[8208848] = clik.newPhoto({"id":8208848,"src":"009_0012_mono_thumb.jpg","galleries_id":21891,"server_id":18,"link":"photo_8208848.html","width":130,"caption":"","height":87});
															thumbnails[8208849] = clik.newPhoto({"id":8208849,"src":"009_0016_mono_copy_thumb.jpg","galleries_id":21891,"server_id":18,"link":"photo_8208849.html","width":130,"caption":"","height":195});
															thumbnails[8208850] = clik.newPhoto({"id":8208850,"src":"009_0063_mono_thumb.jpg","galleries_id":21891,"server_id":18,"link":"photo_8208850.html","width":130,"caption":"","height":195});
															thumbnails[8208851] = clik.newPhoto({"id":8208851,"src":"DSC_3952_monocolour_copy_thumb.jpg","galleries_id":438058,"server_id":18,"link":"photo_8208851.html","width":130,"caption":"","height":195});
															thumbnails[8213809] = clik.newPhoto({"id":8213809,"src":"Arty_prague_panorama_thumb.jpg","galleries_id":3876,"server_id":18,"link":"photo_8213809.html","width":130,"caption":"Artistic panorama of Prague","height":47});
															thumbnails[8411485] = clik.newPhoto({"id":8411485,"src":"009_8665_web_copy_thumb.jpg","galleries_id":3876,"server_id":18,"link":"photo_8411485.html","width":130,"caption":"","height":87});
															thumbnails[8411500] = clik.newPhoto({"id":8411500,"src":"009_5345_web_copy_thumb.jpg","galleries_id":21891,"server_id":18,"link":"photo_8411500.html","width":130,"caption":"","height":197});
															thumbnails[2376834] = clik.newPhoto({"id":2376834,"src":"DSC_0050 distressed 2 2 web copy_thumb.jpg","galleries_id":142311,"server_id":18,"link":"photo_2376834.html","width":130,"caption":"DSC 0050 distressed 2 2 web copy","height":194});
															thumbnails[2685321] = clik.newPhoto({"id":2685321,"src":"DSC_1975 web copy 2_thumb.jpg","galleries_id":142311,"server_id":18,"link":"photo_2685321.html","width":130,"caption":"Gemma from the punk & bunker shoot","height":194});
															thumbnails[2685328] = clik.newPhoto({"id":2685328,"src":"DSC_2009 web copy_thumb.jpg","galleries_id":438058,"server_id":18,"link":"photo_2685328.html","width":130,"caption":"Gemma from the punk & bunker shoot","height":194});
															thumbnails[2685331] = clik.newPhoto({"id":2685331,"src":"DSC_2039 web copy_thumb.jpg","galleries_id":438058,"server_id":18,"link":"photo_2685331.html","width":130,"caption":"Gemma from the punk & bunker shoot","height":194});
															thumbnails[2685332] = clik.newPhoto({"id":2685332,"src":"DSC_2064 web copy 2_thumb.jpg","galleries_id":438058,"server_id":18,"link":"photo_2685332.html","width":130,"caption":"Gemma from the punk & bunker shoot","height":194});
															thumbnails[2144019] = clik.newPhoto({"id":2144019,"src":"DSC_0018 mono copy_thumb.jpg","galleries_id":21891,"server_id":18,"link":"photo_2144019.html","width":130,"caption":"Gemma mono ","height":194});
															thumbnails[2144020] = clik.newPhoto({"id":2144020,"src":"DSC_0036 copy_thumb.jpg","galleries_id":142311,"server_id":18,"link":"photo_2144020.html","width":130,"caption":"Gemma","height":194});
															thumbnails[2144021] = clik.newPhoto({"id":2144021,"src":"DSC_0049 copy copy_thumb.jpg","galleries_id":142311,"server_id":18,"link":"photo_2144021.html","width":130,"caption":"Gemma dreams","height":87});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[21891] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Black & White","link":"gallery_21891.html","maxRecords":0.0,"photoIDs":[260062.0,443496.0,2144047.0,2144057.0,2144063.0,8153135.0,8153142.0,8153298.0,8162496.0,8162508.0,8208847.0,8208848.0,8208849.0,8208850.0,8411500.0,2144019.0],"skipIndex":0,"section_code":"gallery","featured_images":443496.0,"id":21891,"singleSection":false});				  						galleries[142311] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Gemma","link":"gallery_142311.html","maxRecords":0.0,"photoIDs":[2144037.0,2376837.0,2376843.0,2376834.0,2685321.0,2144020.0,2144021.0],"skipIndex":0,"section_code":"gallery","featured_images":"2376843,2376837,2144037","id":142311,"singleSection":false});				  						galleries[21892] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Lucy","link":"gallery_21892.html","maxRecords":0.0,"photoIDs":[260050.0,260059.0,260060.0,260068.0,443467.0,443472.0,443507.0,443518.0,496229.0,496334.0,496336.0,496350.0],"skipIndex":0,"section_code":"gallery","featured_images":"496350,496336,496334,496229,443518,443507,443472","id":21892,"singleSection":false});				  						galleries[438058] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Photographica Erotiqe","link":"gallery_438058.html","maxRecords":0.0,"photoIDs":[260071.0,260085.0,260093.0,260100.0,443551.0,443552.0,496133.0,496135.0,8162769.0,8162807.0,8162821.0,8162834.0,8162945.0,8164771.0,8177924.0,8208851.0,2685328.0,2685331.0,2685332.0],"skipIndex":0,"section_code":"gallery","featured_images":"443552,443551","id":438058,"singleSection":false});				  						galleries[3876] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"assorted images","link":"gallery_3876.html","maxRecords":0.0,"photoIDs":[8162801.0,8162847.0,8162907.0,8162950.0,8162956.0,8177953.0,8204844.0,8204845.0,8204847.0,8213809.0,8411485.0],"skipIndex":0,"section_code":"gallery","featured_images":"8411485,8213809,8204847,8204845,8204844,8177953,8162956,8162950,8162907,8162847","id":3876,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '2376843,2376837,496350,496336,496334,496229,443552,443551,443518,443507,443496';
imageSets[2] = '2376843,2376837,2144037,496350,496336,496334,496229,443552,443551,443518,443507,443496,443472';
imageSets[3] = '8162834,8162821,8162807';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/burntmoon/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/burntmoon/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/burntmoon/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/burntmoon/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/burntmoon/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/burntmoon/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/burntmoon/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/burntmoon/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/burntmoon/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/burntmoon/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/burntmoon/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/burntmoon/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/burntmoon/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/burntmoon/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/burntmoon/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/burntmoon/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/burntmoon/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/burntmoon/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/burntmoon/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/burntmoon/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/burntmoon/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/burntmoon/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/burntmoon/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/burntmoon/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/burntmoon/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/burntmoon/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/burntmoon/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 = 'Burntmoon 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>';
	}
				
	temp += this.fnGetPaymentInfo();
				if (temp != '') {
		temp += '<div class="spacer"></div>';
	}
	return temp;
};

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
clik.photo.fnGetPaymentInfo = function(){
	var temp = '';
	if (this.item_price !== '') {
																		temp += '<p>Buy now using PayPal:</p>';
				temp += '<div class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> &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.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 += '<form id="paymentForm" style="margin:0px;border:0px;" name="paymentForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
			temp += '<input type="hidden" name="item_name" value="'+item_name+'">';
			ref = '';
			if(this.photo_ref != ''){
				ref = this.photo_ref+' - '+this.caption;
			}
			else{
				ref = this.id+' - '+this.caption;
			}
			price = amount;								temp += '<input type="hidden" name="cmd" value="_cart">';
					temp += '<input type="hidden" name="business" value="burntmoon_uk@yahoo.co.uk">';
					temp += '<input type="hidden" name="currency_code" value="GBP">';
					temp += '<input type="hidden" name="add" value="1">';
													temp += '<input type="hidden" name="amount" value="'+amount+'">';
					temp += '<input type="hidden" name="item_number" value="'+ref+'">';
													temp += '<input type=\"Submit\" value=\"Add to cart\" id=\"paymentAddButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
										temp += '</form>';
										temp += '<form id="paymentCartForm" style="margin:0px;" name="paymentCartForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
				temp += '<input type="hidden" name="cmd" value="_cart">';
				temp += '<input type="hidden" name="business" value="burntmoon_uk@yahoo.co.uk">';
				temp += '<input type="hidden" name="display" value="1">';
				temp += '<input type=\"Submit\" value=\"View cart\" id=\"paymentViewButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
				temp += '</form>';
						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;
	}
}

			

