window.thumbnails = {};
															thumbnails[8448558] = clik.newPhoto({"id":8448558,"src":"Hawnbywebframed_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":160,"caption":"","height":188});
															thumbnails[8776399] = clik.newPhoto({"id":8776399,"src":"arncliffe-panorama2_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":160,"caption":"","height":93});
															thumbnails[8776437] = clik.newPhoto({"id":8776437,"src":"catbellsviewwebframe_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":160,"caption":"","height":113});
															thumbnails[8776500] = clik.newPhoto({"id":8776500,"src":"gowbarrowwebframe_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":160,"caption":"","height":189});
															thumbnails[8776535] = clik.newPhoto({"id":8776535,"src":"manestybirchwebframe_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":160,"caption":"","height":187});
															thumbnails[8776570] = clik.newPhoto({"id":8776570,"src":"gallenyfallswebframe_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":160,"caption":"","height":138});
															thumbnails[8776618] = clik.newPhoto({"id":8776618,"src":"loughriggfellwebframe_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":160,"caption":"","height":105});
															thumbnails[5076358] = clik.newPhoto({"id":5076358,"src":"AchnahairdBayweb_thumb.jpg","galleries_id":95233,"server_id":18,"link":"photo_5076358.html","width":160,"caption":"Achnahaird Bay","height":200});
															thumbnails[5076402] = clik.newPhoto({"id":5076402,"src":"Hawnbylayersweb_thumb.jpg","galleries_id":321500,"server_id":18,"link":"photo_5076402.html","width":160,"caption":"Hawnby, North York Moors.","height":200});
															thumbnails[5115520] = clik.newPhoto({"id":5115520,"src":"RoulstonScarweb_thumb.jpg","galleries_id":321500,"server_id":18,"link":"photo_5115520.html","width":160,"caption":"Roulston Scar, Sutton Bank","height":200});
															thumbnails[5121128] = clik.newPhoto({"id":5121128,"src":"CulBeagweb_thumb.jpg","galleries_id":95233,"server_id":18,"link":"photo_5121128.html","width":160,"caption":"Cul Beag","height":200});
															thumbnails[5121135] = clik.newPhoto({"id":5121135,"src":"langdalepikesweb_thumb.jpg","galleries_id":171615,"server_id":18,"link":"photo_5121135.html","width":160,"caption":"Langdale Pikes from Hodge Close","height":200});
															thumbnails[5121138] = clik.newPhoto({"id":5121138,"src":"LindisfarneBoatshedweb_thumb.jpg","galleries_id":289723,"server_id":18,"link":"photo_5121138.html","width":160,"caption":"Lindisfarne Boatshed","height":200});
															thumbnails[5121144] = clik.newPhoto({"id":5121144,"src":"SeilebostDuskweb_thumb.jpg","galleries_id":147132,"server_id":18,"link":"photo_5121144.html","width":160,"caption":"Seilebost Dusk","height":200});
															thumbnails[5126383] = clik.newPhoto({"id":5126383,"src":"piratescovepebbles_thumb.jpg","galleries_id":147132,"server_id":18,"link":"photo_5126383.html","width":160,"caption":"Pirates Cove pebbles - Isle of Arran","height":200});
															thumbnails[5126397] = clik.newPhoto({"id":5126397,"src":"piratescoveridgesweb_thumb.jpg","galleries_id":147132,"server_id":18,"link":"photo_5126397.html","width":160,"caption":"Pirates Cove ridges - Isle of Arran","height":200});
															thumbnails[5126408] = clik.newPhoto({"id":5126408,"src":"RiverEtiveweb_thumb.jpg","galleries_id":95233,"server_id":18,"link":"photo_5126408.html","width":160,"caption":"River Etive","height":200});
															thumbnails[5126410] = clik.newPhoto({"id":5126410,"src":"SaltwickBayweb_thumb.jpg","galleries_id":321501,"server_id":18,"link":"photo_5126410.html","width":160,"caption":"Saltwick Nab, Saltwick Bay","height":200});
															thumbnails[5354475] = clik.newPhoto({"id":5354475,"src":"easedaleweb_thumb.jpg","galleries_id":147132,"server_id":18,"link":"photo_5354475.html","width":160,"caption":"Easedale - First light on Scarba","height":200});
															thumbnails[5473988] = clik.newPhoto({"id":5473988,"src":"thornwickbayweb_thumb.jpg","galleries_id":321501,"server_id":18,"link":"photo_5473988.html","width":160,"caption":"Thornwick Bay - Late Summer Evening","height":200});
															thumbnails[6336283] = clik.newPhoto({"id":6336283,"src":"BenLoyalweb_thumb.jpg","galleries_id":95233,"server_id":18,"link":"photo_6336283.html","width":160,"caption":"Ben Loyal and Lochan Hakel","height":200});
															thumbnails[6378177] = clik.newPhoto({"id":6378177,"src":"steeperpointweb_thumb.jpg","galleries_id":352919,"server_id":18,"link":"photo_6378177.html","width":160,"caption":"Stepper Point","height":200});
															thumbnails[6378308] = clik.newPhoto({"id":6378308,"src":"trevoneweb_thumb.jpg","galleries_id":352919,"server_id":18,"link":"photo_6378308.html","width":160,"caption":"Gunver Head, Near Trevone","height":200});
															thumbnails[6701758] = clik.newPhoto({"id":6701758,"src":"Rosedaleweb_thumb.jpg","galleries_id":321500,"server_id":18,"link":"photo_6701758.html","width":160,"caption":"Evening light, Above Rosedale.","height":200});
															thumbnails[6701821] = clik.newPhoto({"id":6701821,"src":"dunstanburghweb_thumb.jpg","galleries_id":289723,"server_id":18,"link":"photo_6701821.html","width":160,"caption":"Dunstanburgh from Embleton Bay, Quiet Light at Dusk.","height":200});
															thumbnails[6701825] = clik.newPhoto({"id":6701825,"src":"budletideweb_thumb.jpg","galleries_id":289723,"server_id":18,"link":"photo_6701825.html","width":160,"caption":"Clearing Storm, Budle Bay. ","height":200});
															thumbnails[7155221] = clik.newPhoto({"id":7155221,"src":"RedScreesweb_thumb.jpg","galleries_id":171615,"server_id":18,"link":"photo_7155221.html","width":160,"caption":"Red Screes ","height":200});
															thumbnails[7158675] = clik.newPhoto({"id":7158675,"src":"horcumweb_thumb.jpg","galleries_id":321500,"server_id":18,"link":"photo_7158675.html","width":160,"caption":"Hole of Horcum","height":200});
															thumbnails[7158678] = clik.newPhoto({"id":7158678,"src":"hopemanweb_thumb.jpg","galleries_id":147132,"server_id":18,"link":"photo_7158678.html","width":160,"caption":"Hopeman Cove, Moray.","height":200});
															thumbnails[7536917] = clik.newPhoto({"id":7536917,"src":"Cornwallslatewallweb_thumb.jpg","galleries_id":352919,"server_id":18,"link":"photo_7536917.html","width":160,"caption":"Leaning Slate","height":200});
															thumbnails[7537060] = clik.newPhoto({"id":7537060,"src":"Borrowdalequarryweb_thumb.jpg","galleries_id":171615,"server_id":18,"link":"photo_7537060.html","width":160,"caption":"Dalt Wood Quarry","height":200});
															thumbnails[7537067] = clik.newPhoto({"id":7537067,"src":"BorrowdaleLarchweb_thumb.jpg","galleries_id":171615,"server_id":18,"link":"photo_7537067.html","width":160,"caption":"Majestic Larch","height":200});
															thumbnails[7537072] = clik.newPhoto({"id":7537072,"src":"SwirlHowweb_thumb.jpg","galleries_id":171615,"server_id":18,"link":"photo_7537072.html","width":160,"caption":"Swirl How","height":200});
															thumbnails[7537659] = clik.newPhoto({"id":7537659,"src":"AchnahairdGrassesweb_thumb.jpg","galleries_id":95233,"server_id":18,"link":"photo_7537659.html","width":160,"caption":"Achnahaird","height":200});
															thumbnails[7537661] = clik.newPhoto({"id":7537661,"src":"AchnahairdStormweb_thumb.jpg","galleries_id":95233,"server_id":18,"link":"photo_7537661.html","width":160,"caption":"Achnahaird Storm","height":200});
															thumbnails[7990781] = clik.newPhoto({"id":7990781,"src":"Grasmere-Woods-web_thumb.jpg","galleries_id":171615,"server_id":18,"link":"photo_7990781.html","width":160,"caption":"Wood near Grasmere","height":200});
															thumbnails[8448546] = clik.newPhoto({"id":8448546,"src":"Hawnby-Web_thumb.jpg","galleries_id":321500,"server_id":18,"link":"photo_8448546.html","width":160,"caption":"Hawnby Hill","height":203});
															thumbnails[8776498] = clik.newPhoto({"id":8776498,"src":"gowbarrowweb_thumb.jpg","galleries_id":171615,"server_id":18,"link":"photo_8776498.html","width":160,"caption":"Ullswater and St.Sunday Crag","height":204});
															thumbnails[8776533] = clik.newPhoto({"id":8776533,"src":"manestybirchweb_thumb.jpg","galleries_id":171615,"server_id":18,"link":"photo_8776533.html","width":160,"caption":"Birch Tree, Manesty Park.","height":203});
															thumbnails[8776569] = clik.newPhoto({"id":8776569,"src":"gallenyfallsweb_thumb.jpg","galleries_id":171615,"server_id":18,"link":"photo_8776569.html","width":160,"caption":"Galleny Falls","height":128});
															thumbnails[9035374] = clik.newPhoto({"id":9035374,"src":"brimham-web_thumb.jpg","galleries_id":476045,"server_id":18,"link":"photo_9035374.html","width":160,"caption":"Cold Winter Dawn at Brimham","height":128});
															thumbnails[9035378] = clik.newPhoto({"id":9035378,"src":"cowcalf-web_thumb.jpg","galleries_id":476045,"server_id":18,"link":"photo_9035378.html","width":160,"caption":"Cow and Calf Rocks","height":200});
															thumbnails[5098137] = clik.newPhoto({"id":5098137,"src":"Oxnopweb_thumb.jpg","galleries_id":132795,"server_id":18,"link":"photo_5098137.html","width":160,"caption":"Swaledale","height":200});
															thumbnails[5142803] = clik.newPhoto({"id":5142803,"src":"Southerscalesweb_thumb.jpg","galleries_id":132795,"server_id":18,"link":"photo_5142803.html","width":160,"caption":"Souther Scales, Yorkshire Dales.","height":200});
															thumbnails[7536930] = clik.newPhoto({"id":7536930,"src":"Conistoneweb_thumb.jpg","galleries_id":132795,"server_id":18,"link":"photo_7536930.html","width":160,"caption":"Above Conistone","height":200});
															thumbnails[5121125] = clik.newPhoto({"id":5121125,"src":"BudleBayweb_thumb.jpg","galleries_id":289723,"server_id":18,"link":"photo_5121125.html","width":160,"caption":"Budle Bay","height":128});
															thumbnails[5354461] = clik.newPhoto({"id":5354461,"src":"Malhambeckweb_thumb.jpg","galleries_id":132795,"server_id":18,"link":"photo_5354461.html","width":160,"caption":"Malham Beck - paths in the snow","height":200});
															thumbnails[8886980] = clik.newPhoto({"id":8886980,"src":"boltonabbeybeechesweb_thumb.jpg","galleries_id":132795,"server_id":18,"link":"photo_8886980.html","width":160,"caption":"Beech Trees, Strid Woods","height":203});
															thumbnails[5076370] = clik.newPhoto({"id":5076370,"src":"Burnsallweb_thumb.jpg","galleries_id":132795,"server_id":18,"link":"photo_5076370.html","width":160,"caption":"Burnsall, Yorkshire Dales.","height":128});
															thumbnails[5121140] = clik.newPhoto({"id":5121140,"src":"LochClarMorweb_thumb.jpg","galleries_id":95233,"server_id":18,"link":"photo_5121140.html","width":160,"caption":"Loch Clar Mor","height":128});
															thumbnails[7125271] = clik.newPhoto({"id":7125271,"src":"SprinklingTarnweb_thumb.jpg","galleries_id":171615,"server_id":18,"link":"photo_7125271.html","width":160,"caption":"Great Gable","height":128});
															thumbnails[7991059] = clik.newPhoto({"id":7991059,"src":"burnsall-june-web_thumb.jpg","galleries_id":132795,"server_id":18,"link":"photo_7991059.html","width":160,"caption":"Wharfedale from Burnsall","height":126});
															thumbnails[6378162] = clik.newPhoto({"id":6378162,"src":"StacPollaidhweb_thumb.jpg","galleries_id":95233,"server_id":18,"link":"photo_6378162.html","width":160,"caption":"Stac Pollaidh","height":128});
															thumbnails[8886972] = clik.newPhoto({"id":8886972,"src":"middletonwoodsweb_thumb.jpg","galleries_id":476045,"server_id":18,"link":"photo_8886972.html","width":160,"caption":"Oaks and Bluebells, Middleton Woods","height":101});
															thumbnails[5600334] = clik.newPhoto({"id":5600334,"src":"lochseilweb_thumb.jpg","galleries_id":95233,"server_id":18,"link":"photo_5600334.html","width":160,"caption":"Loch Seil","height":128});
															thumbnails[8887046] = clik.newPhoto({"id":8887046,"src":"stridwoodswharfeweb_thumb.jpg","galleries_id":132795,"server_id":18,"link":"photo_8887046.html","width":160,"caption":"Flowing by, River Wharfe","height":101});
															thumbnails[7537662] = clik.newPhoto({"id":7537662,"src":"LochLurgainnweb_thumb.jpg","galleries_id":95233,"server_id":18,"link":"photo_7537662.html","width":160,"caption":"Loch Lurgainn","height":81});
															thumbnails[8776416] = clik.newPhoto({"id":8776416,"src":"arncliffepanorama_thumb.jpg","galleries_id":132795,"server_id":18,"link":"photo_8776416.html","width":160,"caption":"Misty Dawn, Arncliffe","height":76});
															thumbnails[8886989] = clik.newPhoto({"id":8886989,"src":"stridviewweb_D65EACF9-1EC9-D45B-1CF561DB26F15698_thumb.jpg","galleries_id":132795,"server_id":18,"link":"photo_8886989.html","width":160,"caption":"Strid View, Bolton Abbey","height":80});
															thumbnails[6378409] = clik.newPhoto({"id":6378409,"src":"boltonabbey_thumb.jpg","galleries_id":132795,"server_id":18,"link":"photo_6378409.html","width":160,"caption":"Bolton Abbey and Barden Fell, Wharfedale","height":80});
															thumbnails[8776435] = clik.newPhoto({"id":8776435,"src":"catbellsviewweb_thumb.jpg","galleries_id":171615,"server_id":18,"link":"photo_8776435.html","width":160,"caption":"Catbells Ridge from Manesty","height":101});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[476045] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"yorkshire ","link":"gallery_476045.html","maxRecords":0.0,"photoIDs":[9035374.0,9035378.0,8886972.0],"skipIndex":0,"section_code":"gallery","featured_images":9035374.0,"id":476045,"singleSection":false});				  						galleries[132795] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"yorkshire dales","link":"gallery_132795.html","maxRecords":0.0,"photoIDs":[5098137.0,5142803.0,7536930.0,5354461.0,8886980.0,5076370.0,7991059.0,8887046.0,8776416.0,8886989.0,6378409.0],"skipIndex":0,"section_code":"gallery","featured_images":5098137.0,"id":132795,"singleSection":false});				  						galleries[321500] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"north york moors","link":"gallery_321500.html","maxRecords":0.0,"photoIDs":[5076402.0,5115520.0,6701758.0,7158675.0,8448546.0],"skipIndex":0,"section_code":"gallery","featured_images":"7158675,6701758,5115520,5076402","id":321500,"singleSection":false});				  						galleries[321501] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"yorkshire coast","link":"gallery_321501.html","maxRecords":0.0,"photoIDs":[5126410.0,5473988.0],"skipIndex":0,"section_code":"gallery","featured_images":5126410.0,"id":321501,"singleSection":false});				  						galleries[171615] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"lake district","link":"gallery_171615.html","maxRecords":0.0,"photoIDs":[5121135.0,7155221.0,7537060.0,7537067.0,7537072.0,7990781.0,8776498.0,8776533.0,8776569.0,7125271.0,8776435.0],"skipIndex":0,"section_code":"gallery","featured_images":"7990781,5121135","id":171615,"singleSection":false});				  						galleries[289723] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"northern england","link":"gallery_289723.html","maxRecords":0.0,"photoIDs":[5121138.0,6701821.0,6701825.0,5121125.0],"skipIndex":0,"section_code":"gallery","featured_images":5121138.0,"id":289723,"singleSection":false});				  						galleries[147132] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"scotland's coast","link":"gallery_147132.html","maxRecords":0.0,"photoIDs":[5121144.0,5126383.0,5126397.0,5354475.0,7158678.0],"skipIndex":0,"section_code":"gallery","featured_images":"5354475,5126383","id":147132,"singleSection":false});				  						galleries[95233] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"scottish highlands","link":"gallery_95233.html","maxRecords":0.0,"photoIDs":[5076358.0,5121128.0,5126408.0,6336283.0,7537659.0,7537661.0,5121140.0,6378162.0,5600334.0,7537662.0],"skipIndex":0,"section_code":"gallery","featured_images":"6336283,5121128,5076358","id":95233,"singleSection":false});				  						galleries[352919] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"cornwall","link":"gallery_352919.html","maxRecords":0.0,"photoIDs":[6378177.0,6378308.0,7536917.0],"skipIndex":0,"section_code":"gallery","featured_images":"7536917,6378308,6378177","id":352919,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '8448558';
imageSets[2] = '9035374,7990781,7158675,6701758,6336283,5354475,5126410,5126383,5121138,5121135,5121128,5115520,5076402,5076358,5098137';
imageSets[3] = '6336283,5126410,5126408,5126397,5126383,5121144,5121138,5121135,5121128,5076402,5076358,5098137,5121125,5076370,7125271,5121140';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/RossBrown/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/RossBrown/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/RossBrown/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/RossBrown/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/RossBrown/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/RossBrown/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/RossBrown/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/RossBrown/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/RossBrown/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/RossBrown/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/RossBrown/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/RossBrown/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/RossBrown/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/RossBrown/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/RossBrown/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/RossBrown/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/RossBrown/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/RossBrown/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/RossBrown/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/RossBrown/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/RossBrown/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/RossBrown/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/RossBrown/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/RossBrown/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/RossBrown/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/RossBrown/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/RossBrown/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 = 'Ross Brown Landscape Photographer: ' + 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.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;
	}
}

			

