window.thumbnails = {};
															thumbnails[2901018] = clik.newPhoto({"id":2901018,"src":"alnmouth_thumb.jpg","galleries_id":179792,"server_id":1,"link":"photo_2901018.html","width":129,"caption":"Alnmouth","height":92});
															thumbnails[2901029] = clik.newPhoto({"id":2901029,"src":"Alnwick lion_thumb.jpg","galleries_id":179792,"server_id":1,"link":"photo_2901029.html","width":129,"caption":"Alnwick Lion","height":92});
															thumbnails[2901051] = clik.newPhoto({"id":2901051,"src":"alnwick s set_thumb.jpg","galleries_id":179792,"server_id":1,"link":"photo_2901051.html","width":129,"caption":"Alnwick Sunset","height":92});
															thumbnails[2901057] = clik.newPhoto({"id":2901057,"src":"alnwick tree_thumb.jpg","galleries_id":179792,"server_id":1,"link":"photo_2901057.html","width":129,"caption":"Alnwick Tree","height":92});
															thumbnails[2901064] = clik.newPhoto({"id":2901064,"src":"bamb_thumb.jpg","galleries_id":179792,"server_id":1,"link":"photo_2901064.html","width":129,"caption":"Bamburgh Castle","height":92});
															thumbnails[2901074] = clik.newPhoto({"id":2901074,"src":"angel_thumb.jpg","galleries_id":179793,"server_id":1,"link":"photo_2901074.html","width":129,"caption":"Angel","height":92});
															thumbnails[2901119] = clik.newPhoto({"id":2901119,"src":"castlerig_thumb.jpg","galleries_id":179804,"server_id":1,"link":"photo_2901119.html","width":129,"caption":"Castlerigg stone circle","height":92});
															thumbnails[2901130] = clik.newPhoto({"id":2901130,"src":"d water mist_thumb.jpg","galleries_id":179804,"server_id":1,"link":"photo_2901130.html","width":129,"caption":"Derwent water mist","height":92});
															thumbnails[2901415] = clik.newPhoto({"id":2901415,"src":"scafell_thumb.jpg","galleries_id":179804,"server_id":1,"link":"photo_2901415.html","width":129,"caption":"Scafell Pike","height":92});
															thumbnails[2901439] = clik.newPhoto({"id":2901439,"src":"sep refl_thumb.jpg","galleries_id":179793,"server_id":1,"link":"photo_2901439.html","width":129,"caption":"Tyne Reflection","height":181});
															thumbnails[2906814] = clik.newPhoto({"id":2906814,"src":"baltic_thumb.jpg","galleries_id":179793,"server_id":1,"link":"photo_2906814.html","width":130,"caption":"Baltic","height":93});
															thumbnails[2906960] = clik.newPhoto({"id":2906960,"src":"Baltic port_thumb.jpg","galleries_id":179793,"server_id":1,"link":"photo_2906960.html","width":130,"caption":"Baltic","height":182});
															thumbnails[2906973] = clik.newPhoto({"id":2906973,"src":"bamb blue_thumb.jpg","galleries_id":179792,"server_id":1,"link":"photo_2906973.html","width":130,"caption":"Bamburgh Castle","height":92});
															thumbnails[2906984] = clik.newPhoto({"id":2906984,"src":"bamb day_thumb.jpg","galleries_id":179792,"server_id":1,"link":"photo_2906984.html","width":130,"caption":"Bamburgh castle","height":92});
															thumbnails[2906997] = clik.newPhoto({"id":2906997,"src":"bamb red_thumb.jpg","galleries_id":179792,"server_id":1,"link":"photo_2906997.html","width":130,"caption":"Bamburgh castle","height":92});
															thumbnails[2906999] = clik.newPhoto({"id":2906999,"src":"blencathra_thumb.jpg","galleries_id":179804,"server_id":1,"link":"photo_2906999.html","width":130,"caption":"Blencathra","height":92});
															thumbnails[2907002] = clik.newPhoto({"id":2907002,"src":"blue angel_thumb.jpg","galleries_id":179793,"server_id":1,"link":"photo_2907002.html","width":130,"caption":"Blue Angel","height":92});
															thumbnails[2910688] = clik.newPhoto({"id":2910688,"src":"colour purple_thumb.jpg","galleries_id":179793,"server_id":1,"link":"photo_2910688.html","width":130,"caption":"Colour purple","height":92});
															thumbnails[2910698] = clik.newPhoto({"id":2910698,"src":"h wall_thumb.jpg","galleries_id":179792,"server_id":1,"link":"photo_2910698.html","width":130,"caption":"Hadrians wall","height":92});
															thumbnails[2911262] = clik.newPhoto({"id":2911262,"src":"durham colour_thumb.jpg","galleries_id":179793,"server_id":1,"link":"photo_2911262.html","width":130,"caption":"Durham","height":92});
															thumbnails[2911303] = clik.newPhoto({"id":2911303,"src":"st James park 72_thumb.jpg","galleries_id":179793,"server_id":1,"link":"photo_2911303.html","width":130,"caption":"St James park","height":92});
															thumbnails[2911344] = clik.newPhoto({"id":2911344,"src":"syc gap 72_thumb.jpg","galleries_id":179792,"server_id":1,"link":"photo_2911344.html","width":130,"caption":"Sycamore gap","height":92});
															thumbnails[2911735] = clik.newPhoto({"id":2911735,"src":"blue st marys 72_thumb.jpg","galleries_id":179792,"server_id":1,"link":"photo_2911735.html","width":130,"caption":"St Marys Lighthouse","height":182});
															thumbnails[2911744] = clik.newPhoto({"id":2911744,"src":"cheviot 1_thumb.jpg","galleries_id":179792,"server_id":1,"link":"photo_2911744.html","width":130,"caption":"Cheviot","height":182});
															thumbnails[2911832] = clik.newPhoto({"id":2911832,"src":"colour kielder 72_thumb.jpg","galleries_id":179792,"server_id":1,"link":"photo_2911832.html","width":130,"caption":"Kielder sunset","height":92});
															thumbnails[2929713] = clik.newPhoto({"id":2929713,"src":"crag lough 72_thumb.jpg","galleries_id":179792,"server_id":1,"link":"photo_2929713.html","width":130,"caption":"Crag Lough","height":92});
															thumbnails[2929866] = clik.newPhoto({"id":2929866,"src":"day dunst 72_thumb.jpg","galleries_id":179792,"server_id":1,"link":"photo_2929866.html","width":130,"caption":"Dunstaburgh castle","height":92});
															thumbnails[2929894] = clik.newPhoto({"id":2929894,"src":"durham bridge 72_thumb.jpg","galleries_id":179793,"server_id":1,"link":"photo_2929894.html","width":130,"caption":"Durham City","height":92});
															thumbnails[2929931] = clik.newPhoto({"id":2929931,"src":"elfkirk 7_thumb.jpg","galleries_id":179792,"server_id":1,"link":"photo_2929931.html","width":130,"caption":"Kielder Elfkirk","height":92});
															thumbnails[2929936] = clik.newPhoto({"id":2929936,"src":"faskally 7_thumb.jpg","galleries_id":179792,"server_id":1,"link":"photo_2929936.html","width":130,"caption":"Loch Faskally, Scotland","height":92});
															thumbnails[2929951] = clik.newPhoto({"id":2929951,"src":"gold angel 7_thumb.jpg","galleries_id":179793,"server_id":1,"link":"photo_2929951.html","width":130,"caption":"Angel of the North","height":92});
															thumbnails[2929957] = clik.newPhoto({"id":2929957,"src":"gold jetty 7_thumb.jpg","galleries_id":179792,"server_id":1,"link":"photo_2929957.html","width":130,"caption":"Kielder Water","height":92});
															thumbnails[2929966] = clik.newPhoto({"id":2929966,"src":"gold st mary 7_thumb.jpg","galleries_id":179792,"server_id":1,"link":"photo_2929966.html","width":130,"caption":"St Mary's Island","height":92});
															thumbnails[2929983] = clik.newPhoto({"id":2929983,"src":"golden eye 7_thumb.jpg","galleries_id":179793,"server_id":1,"link":"photo_2929983.html","width":130,"caption":"Golden Eye","height":92});
															thumbnails[2930004] = clik.newPhoto({"id":2930004,"src":"Groyne_thumb.jpg","galleries_id":179793,"server_id":1,"link":"photo_2930004.html","width":130,"caption":"The Groyne","height":92});
															thumbnails[2930453] = clik.newPhoto({"id":2930453,"src":"k dawn 72_thumb.jpg","galleries_id":179792,"server_id":1,"link":"photo_2930453.html","width":130,"caption":"Kielder Dawn","height":92});
															thumbnails[2930519] = clik.newPhoto({"id":2930519,"src":"k trees 7_thumb.jpg","galleries_id":179792,"server_id":1,"link":"photo_2930519.html","width":130,"caption":"Kielder tree's","height":92});
															thumbnails[2930789] = clik.newPhoto({"id":2930789,"src":"red arrows 7_thumb.jpg","galleries_id":179793,"server_id":1,"link":"photo_2930789.html","width":130,"caption":"Red Arrows","height":182});
															thumbnails[2930827] = clik.newPhoto({"id":2930827,"src":"red eye7_thumb.jpg","galleries_id":179793,"server_id":1,"link":"photo_2930827.html","width":130,"caption":"Red Eye","height":93});
															thumbnails[2930836] = clik.newPhoto({"id":2930836,"src":"Sage7_thumb.jpg","galleries_id":179793,"server_id":1,"link":"photo_2930836.html","width":130,"caption":"Sage,","height":92});
															thumbnails[2930840] = clik.newPhoto({"id":2930840,"src":"t mouth dawn7_thumb.jpg","galleries_id":179792,"server_id":1,"link":"photo_2930840.html","width":130,"caption":"Tynemouth","height":92});
															thumbnails[2930842] = clik.newPhoto({"id":2930842,"src":"warkworth castle7_thumb.jpg","galleries_id":179792,"server_id":1,"link":"photo_2930842.html","width":130,"caption":"Warkworth Castle","height":182});
															thumbnails[2947327] = clik.newPhoto({"id":2947327,"src":"Durham Cathederal 72_thumb.jpg","galleries_id":179793,"server_id":1,"link":"photo_2947327.html","width":130,"caption":"Durham Cathedral","height":91});
															thumbnails[2947334] = clik.newPhoto({"id":2947334,"src":"d water trees 72_thumb.jpg","galleries_id":179804,"server_id":1,"link":"photo_2947334.html","width":130,"caption":"Derwent water trees","height":92});
															thumbnails[2947337] = clik.newPhoto({"id":2947337,"src":"friars crag 72_thumb.jpg","galleries_id":179804,"server_id":1,"link":"photo_2947337.html","width":130,"caption":"Friars Crag","height":92});
															thumbnails[2947346] = clik.newPhoto({"id":2947346,"src":"langdales 72_thumb.jpg","galleries_id":179804,"server_id":1,"link":"photo_2947346.html","width":130,"caption":"Langdales","height":91});
															thumbnails[2947351] = clik.newPhoto({"id":2947351,"src":"mountain mist 72_thumb.jpg","galleries_id":179804,"server_id":1,"link":"photo_2947351.html","width":130,"caption":"Mountain mist","height":92});
															thumbnails[2947354] = clik.newPhoto({"id":2947354,"src":"skiddaw 72_thumb.jpg","galleries_id":179804,"server_id":1,"link":"photo_2947354.html","width":130,"caption":"Skiddaw","height":92});
															thumbnails[2947357] = clik.newPhoto({"id":2947357,"src":"ullswater 72_thumb.jpg","galleries_id":179804,"server_id":1,"link":"photo_2947357.html","width":130,"caption":"Ullswater","height":92});
															thumbnails[2980314] = clik.newPhoto({"id":2980314,"src":"Dunstaburgh dawn 72_thumb.jpg","galleries_id":179792,"server_id":1,"link":"photo_2980314.html","width":130,"caption":"Dunstanburgh Dawn","height":93});
															thumbnails[3030692] = clik.newPhoto({"id":3030692,"src":"Bamburgh_storm_web_thumb.jpg","galleries_id":179792,"server_id":1,"link":"photo_3030692.html","width":130,"caption":"Bamburgh Storm","height":93});
															thumbnails[3746168] = clik.newPhoto({"id":3746168,"src":"gibside2_thumb.jpg","galleries_id":179793,"server_id":1,"link":"photo_3746168.html","width":130,"caption":"Gibside","height":88});
															thumbnails[4058252] = clik.newPhoto({"id":4058252,"src":"corbrdge_bridge_web_thumb.jpg","galleries_id":179792,"server_id":1,"link":"photo_4058252.html","width":130,"caption":"Corbridge","height":93});
															thumbnails[4113358] = clik.newPhoto({"id":4113358,"src":"DFDS_Ferry_2_72_thumb.jpg","galleries_id":179793,"server_id":1,"link":"photo_4113358.html","width":130,"caption":"DFDS Ferry","height":91});
															thumbnails[4155953] = clik.newPhoto({"id":4155953,"src":"Milecastle_37_721_thumb.jpg","galleries_id":179792,"server_id":1,"link":"photo_4155953.html","width":130,"caption":"Milecastle 37","height":91});
															thumbnails[4155955] = clik.newPhoto({"id":4155955,"src":"Milecastle_37_sunset_72_thumb.jpg","galleries_id":179792,"server_id":1,"link":"photo_4155955.html","width":130,"caption":"Milecastle 37 Sunset","height":91});
															thumbnails[4155960] = clik.newPhoto({"id":4155960,"src":"Sycamore_mist_72_thumb.jpg","galleries_id":179792,"server_id":1,"link":"photo_4155960.html","width":130,"caption":"Sycamore mist","height":91});
															thumbnails[4156066] = clik.newPhoto({"id":4156066,"src":"Warkworth_72_thumb.jpg","galleries_id":179792,"server_id":1,"link":"photo_4156066.html","width":130,"caption":"Warkworth ","height":186});
															thumbnails[4156202] = clik.newPhoto({"id":4156202,"src":"St_Marys_18_3x2_72_thumb.jpg","galleries_id":179793,"server_id":1,"link":"photo_4156202.html","width":130,"caption":"Cardinal Hume","height":192});
															thumbnails[4156212] = clik.newPhoto({"id":4156212,"src":"blue_bridge_72_thumb.jpg","galleries_id":179793,"server_id":1,"link":"photo_4156212.html","width":130,"caption":"Blue Bridge","height":94});
															thumbnails[4301846] = clik.newPhoto({"id":4301846,"src":"big_boat_72_thumb.jpg","galleries_id":179792,"server_id":1,"link":"photo_4301846.html","width":130,"caption":"Holy Island","height":93});
															thumbnails[4301856] = clik.newPhoto({"id":4301856,"src":"Blue_holy_72_thumb.jpg","galleries_id":179792,"server_id":1,"link":"photo_4301856.html","width":130,"caption":"Holy island","height":93});
															thumbnails[4549041] = clik.newPhoto({"id":4549041,"src":"Hexham_Abbey_72_thumb.jpg","galleries_id":179792,"server_id":1,"link":"photo_4549041.html","width":130,"caption":"Hexham Abbey","height":93});
															thumbnails[5806209] = clik.newPhoto({"id":5806209,"src":"sep_durham_72_thumb.jpg","galleries_id":179793,"server_id":1,"link":"photo_5806209.html","width":130,"caption":"Sepia Durham","height":192});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[179792] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Northumberland","link":"gallery_179792.html","maxRecords":0.0,"photoIDs":[2901018.0,2901029.0,2901051.0,2901057.0,2901064.0,2906973.0,2906984.0,2906997.0,2910698.0,2911344.0,2911735.0,2911744.0,2911832.0,2929713.0,2929866.0,2929931.0,2929936.0,2929957.0,2929966.0,2930453.0,2930519.0,2930840.0,2930842.0,2980314.0,3030692.0,4058252.0,4155953.0,4155955.0,4155960.0,4156066.0,4301846.0,4301856.0,4549041.0],"skipIndex":0,"section_code":"gallery","featured_images":"4549041,4301856,4301846,4156066,4155960,4155955,4155953,4058252,3030692,2980314","id":179792,"singleSection":false});				  						galleries[179793] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"North East","link":"gallery_179793.html","maxRecords":0.0,"photoIDs":[2901074.0,2901439.0,2906814.0,2906960.0,2907002.0,2910688.0,2911262.0,2911303.0,2929894.0,2929951.0,2929983.0,2930004.0,2930789.0,2930827.0,2930836.0,2947327.0,3746168.0,4113358.0,4156202.0,4156212.0,5806209.0],"skipIndex":0,"section_code":"gallery","featured_images":"5806209,4156212,4156202,4113358,3746168,2947327,2930836,2930827,2930789,2930004","id":179793,"singleSection":false});				  						galleries[179804] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Lake District","link":"gallery_179804.html","maxRecords":0.0,"photoIDs":[2901119.0,2901130.0,2901415.0,2906999.0,2947334.0,2947337.0,2947346.0,2947351.0,2947354.0,2947357.0],"skipIndex":0,"section_code":"gallery","featured_images":"2947357,2947354,2947351,2947346,2947337,2947334,2906999,2901415,2901130,2901119","id":179804,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '2901064';
imageSets[3] = '5806209,4549041,4301856,4301846,4156212,4156202,4156066,4155960,4155955,4155953,4113358,4058252,3746168,3030692,2980314,2947357,2947354,2947351,2947346,2947337,2947334,2947327,2930842,2930840,2930836,2930827,2930789,2930519,2930453,2930004,2929983,2929966,2929957,2929951,2929936,2929931,2929894,2929866,2929713,2911832,2911744,2911735,2911344,2911303,2911262,2910698,2910688,2907002,2906999,2906997';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'www12.clikpic.com/duncanscott/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/duncanscott/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/duncanscott/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/duncanscott/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/duncanscott/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/duncanscott/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/duncanscott/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/duncanscott/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/duncanscott/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/duncanscott/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/duncanscott/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/duncanscott/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/duncanscott/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/duncanscott/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/duncanscott/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/duncanscott/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/duncanscott/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/duncanscott/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/duncanscott/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/duncanscott/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/duncanscott/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/duncanscott/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/duncanscott/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/duncanscott/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 = 'Big River 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({					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;
	}
}

			

