window.thumbnails = {};
															thumbnails[7088242] = clik.newPhoto({"id":7088242,"src":"GatewayBattleAbbey1_thumb.jpg","galleries_id":382749,"server_id":32,"link":"photo_7088242.html","width":160,"caption":"Gateway to Battle Abbey","height":107});
															thumbnails[7071547] = clik.newPhoto({"id":7071547,"src":"FishermansLitter_thumb.jpg","galleries_id":382749,"server_id":32,"link":"photo_7071547.html","width":160,"caption":"Fisherman's Litter","height":239});
															thumbnails[7071551] = clik.newPhoto({"id":7071551,"src":"RustedOilCan_thumb.jpg","galleries_id":382749,"server_id":32,"link":"photo_7071551.html","width":160,"caption":"Rusted Oil Can","height":107});
															thumbnails[7071554] = clik.newPhoto({"id":7071554,"src":"Summerseveningreflections_thumb.jpg","galleries_id":382749,"server_id":32,"link":"photo_7071554.html","width":160,"caption":"Summer's Evening Reflections","height":200});
															thumbnails[7071559] = clik.newPhoto({"id":7071559,"src":"TulipinEveningLight_thumb.jpg","galleries_id":382749,"server_id":32,"link":"photo_7071559.html","width":160,"caption":"Tulip in Evening Light","height":213});
															thumbnails[7071577] = clik.newPhoto({"id":7071577,"src":"GnomeFishing_thumb.jpg","galleries_id":382749,"server_id":32,"link":"photo_7071577.html","width":160,"caption":"Gnome Fishing","height":120});
															thumbnails[7071580] = clik.newPhoto({"id":7071580,"src":"Goingupgoingdown_thumb.jpg","galleries_id":382749,"server_id":32,"link":"photo_7071580.html","width":160,"caption":"Going Up, Going Down","height":213});
															thumbnails[7071675] = clik.newPhoto({"id":7071675,"src":"MorocccanCraftsman_thumb.jpg","galleries_id":382749,"server_id":32,"link":"photo_7071675.html","width":160,"caption":"Moroccan Craftsman","height":113});
															thumbnails[7071718] = clik.newPhoto({"id":7071718,"src":"MarineCourt_thumb.jpg","galleries_id":382749,"server_id":32,"link":"photo_7071718.html","width":160,"caption":"Marine Court","height":109});
															thumbnails[7071697] = clik.newPhoto({"id":7071697,"src":"RoofTewkesburyAbbey_thumb.jpg","galleries_id":382749,"server_id":32,"link":"photo_7071697.html","width":160,"caption":"Roof Entrance Detail, Tewkesbury Abbey","height":120});
															thumbnails[7071736] = clik.newPhoto({"id":7071736,"src":"AQUILEGIA_thumb.jpg","galleries_id":382749,"server_id":32,"link":"photo_7071736.html","width":160,"caption":"Aquilegia and Thistledown","height":187});
															thumbnails[7072274] = clik.newPhoto({"id":7072274,"src":"Grasssnake4_thumb.jpg","galleries_id":382749,"server_id":32,"link":"photo_7072274.html","width":160,"caption":"Grass Snake","height":107});
															thumbnails[7141745] = clik.newPhoto({"id":7141745,"src":"GatheringSail_thumb.jpg","galleries_id":382749,"server_id":32,"link":"photo_7141745.html","width":160,"caption":"Gathering Sail","height":118});
															thumbnails[7334738] = clik.newPhoto({"id":7334738,"src":"A_Dusting_of_Snow_thumb.jpg","galleries_id":396902,"server_id":32,"link":"photo_7334738.html","width":160,"caption":"A Dusting of Snow","height":107});
															thumbnails[7334740] = clik.newPhoto({"id":7334740,"src":"Foul_weather_ahead_thumb.jpg","galleries_id":396902,"server_id":32,"link":"photo_7334740.html","width":160,"caption":"Foul Weather Ahead","height":105});
															thumbnails[7334742] = clik.newPhoto({"id":7334742,"src":"My_Future_Could_Be_Out_There_thumb.jpg","galleries_id":396902,"server_id":32,"link":"photo_7334742.html","width":160,"caption":"My Future Could Be Out There","height":85});
															thumbnails[7334757] = clik.newPhoto({"id":7334757,"src":"Steps_up_from_the_beach_thumb.jpg","galleries_id":396902,"server_id":32,"link":"photo_7334757.html","width":160,"caption":"Steps Up From The Beach","height":134});
															thumbnails[7334768] = clik.newPhoto({"id":7334768,"src":"Street_Light_-_Marrakech_thumb.jpg","galleries_id":396902,"server_id":32,"link":"photo_7334768.html","width":160,"caption":"Street Light - Marrakech","height":160});
															thumbnails[7334782] = clik.newPhoto({"id":7334782,"src":"Whitby_Pier_thumb.jpg","galleries_id":396902,"server_id":32,"link":"photo_7334782.html","width":160,"caption":"Whitby Pier","height":120});
															thumbnails[7334793] = clik.newPhoto({"id":7334793,"src":"Whizzkid_thumb.jpg","galleries_id":396902,"server_id":32,"link":"photo_7334793.html","width":160,"caption":"Whizkid","height":114});
															thumbnails[7334813] = clik.newPhoto({"id":7334813,"src":"The_Watchful_Eye_thumb.jpg","galleries_id":396902,"server_id":32,"link":"photo_7334813.html","width":160,"caption":"The Watchful Eye","height":160});
															thumbnails[7334735] = clik.newPhoto({"id":7334735,"src":"Bumblebee_Bombus_Terrestris_collecting_pollen_thumb.jpg","galleries_id":396902,"server_id":32,"link":"photo_7334735.html","width":160,"caption":"Bumble Bee Gathering Pollen","height":154});
															thumbnails[7334746] = clik.newPhoto({"id":7334746,"src":"Reining_Quarter_Horse_Western_style_thumb.jpg","galleries_id":396902,"server_id":32,"link":"photo_7334746.html","width":160,"caption":"Reining Quarter Horse Western Style","height":177});
															thumbnails[8890691] = clik.newPhoto({"id":8890691,"src":"01_-_Blue_Morpho_Butterfly_-_Morpho_peleides_thumb.jpg","galleries_id":382749,"server_id":32,"link":"photo_8890691.html","width":160,"caption":"Blue Morpho Butterfly - Morpho peleides","height":160});
															thumbnails[8890697] = clik.newPhoto({"id":8890697,"src":"01__Lilies_under_the_lamp_thumb.jpg","galleries_id":382749,"server_id":32,"link":"photo_8890697.html","width":160,"caption":"Lilies under the lamp","height":120});
															thumbnails[8890754] = clik.newPhoto({"id":8890754,"src":"01_A_SPRAY_OF_SEAWEED_thumb.jpg","galleries_id":382749,"server_id":32,"link":"photo_8890754.html","width":160,"caption":"A Spray of Seaweed","height":209});
															thumbnails[8891716] = clik.newPhoto({"id":8891716,"src":"01_St.Helens_OratoryCape_Cornwall_thumb.jpg","galleries_id":382749,"server_id":32,"link":"photo_8891716.html","width":160,"caption":"St.Helens Oratory,Cape Cornwall","height":109});
															thumbnails[8890968] = clik.newPhoto({"id":8890968,"src":"01_A_Touch_of_Monet_thumb.jpg","galleries_id":382749,"server_id":32,"link":"photo_8890968.html","width":160,"caption":"A Touch of Monet","height":85});
															thumbnails[8891039] = clik.newPhoto({"id":8891039,"src":"01_AFRICAN_SCULPTURE_AT_HERSTMONCEAX_CASTLE_thumb.jpg","galleries_id":382749,"server_id":32,"link":"photo_8891039.html","width":160,"caption":"African Sculpture at Herstmonceaux Castle","height":237});
															thumbnails[8891362] = clik.newPhoto({"id":8891362,"src":"01_After_the_marine_boring_beetle_thumb.jpg","galleries_id":382749,"server_id":32,"link":"photo_8891362.html","width":160,"caption":"After the marine boring beetle","height":242});
															thumbnails[8891365] = clik.newPhoto({"id":8891365,"src":"01_Beachcomber_thumb.jpg","galleries_id":382749,"server_id":32,"link":"photo_8891365.html","width":160,"caption":"Beachcomber","height":120});
															thumbnails[8891424] = clik.newPhoto({"id":8891424,"src":"01_Beggars_on_Indian_Railway_thumb.jpg","galleries_id":382749,"server_id":32,"link":"photo_8891424.html","width":160,"caption":"Beggars on Indian Railway","height":76});
															thumbnails[8891426] = clik.newPhoto({"id":8891426,"src":"01_BRACKET_FUNGI_thumb.jpg","galleries_id":382749,"server_id":32,"link":"photo_8891426.html","width":160,"caption":"Bracket Funghi","height":125});
															thumbnails[8891447] = clik.newPhoto({"id":8891447,"src":"01_Bug_and_Bloom_thumb.jpg","galleries_id":382749,"server_id":32,"link":"photo_8891447.html","width":160,"caption":"Bug and Bloom","height":160});
															thumbnails[8891451] = clik.newPhoto({"id":8891451,"src":"01_Busy_Bee_thumb.jpg","galleries_id":382749,"server_id":32,"link":"photo_8891451.html","width":160,"caption":"Busy Bee","height":239});
															thumbnails[8891477] = clik.newPhoto({"id":8891477,"src":"01_Canisp_thumb.jpg","galleries_id":382749,"server_id":32,"link":"photo_8891477.html","width":160,"caption":"Canisp","height":127});
															thumbnails[8891482] = clik.newPhoto({"id":8891482,"src":"01_Cricososmia_Lucifer_thumb.jpg","galleries_id":382749,"server_id":32,"link":"photo_8891482.html","width":160,"caption":"Cricososmia 'Lucifer'","height":213});
															thumbnails[8891534] = clik.newPhoto({"id":8891534,"src":"01_FAIRFIELD_CHURCH_thumb.jpg","galleries_id":382749,"server_id":32,"link":"photo_8891534.html","width":160,"caption":"Fairfield Church","height":103});
															thumbnails[8891565] = clik.newPhoto({"id":8891565,"src":"01_Fishing_thumb.jpg","galleries_id":382749,"server_id":32,"link":"photo_8891565.html","width":160,"caption":"Fishing","height":107});
															thumbnails[8891595] = clik.newPhoto({"id":8891595,"src":"01_Flint_and_Winkles_thumb.jpg","galleries_id":382749,"server_id":32,"link":"photo_8891595.html","width":160,"caption":"Flint and Winkles","height":107});
															thumbnails[8891643] = clik.newPhoto({"id":8891643,"src":"01_Gorillas_Hand_thumb.jpg","galleries_id":382749,"server_id":32,"link":"photo_8891643.html","width":160,"caption":"Gorilla's Hand","height":120});
															thumbnails[8891653] = clik.newPhoto({"id":8891653,"src":"01_Hurrying_Home_thumb.jpg","galleries_id":382749,"server_id":32,"link":"photo_8891653.html","width":160,"caption":"Hurrying Home","height":120});
															thumbnails[8891655] = clik.newPhoto({"id":8891655,"src":"01_Knots_thumb.jpg","galleries_id":382749,"server_id":32,"link":"photo_8891655.html","width":160,"caption":"Knots","height":120});
															thumbnails[8891656] = clik.newPhoto({"id":8891656,"src":"01_Lone_Cyclist_thumb.jpg","galleries_id":382749,"server_id":32,"link":"photo_8891656.html","width":160,"caption":"Lone Cyclist","height":107});
															thumbnails[8891660] = clik.newPhoto({"id":8891660,"src":"01_Looking_out_thumb.jpg","galleries_id":382749,"server_id":32,"link":"photo_8891660.html","width":160,"caption":"Looking Out","height":266});
															thumbnails[8891690] = clik.newPhoto({"id":8891690,"src":"01_Lusterous_Attraction_thumb.jpg","galleries_id":382749,"server_id":32,"link":"photo_8891690.html","width":160,"caption":"Lustreous Attraction","height":107});
															thumbnails[8891693] = clik.newPhoto({"id":8891693,"src":"01_MAGNOLIA_STELLATA_thumb.jpg","galleries_id":382749,"server_id":32,"link":"photo_8891693.html","width":160,"caption":"Magnolia Stellata","height":120});
															thumbnails[8891699] = clik.newPhoto({"id":8891699,"src":"01_Marble_inlay_detail_thumb.jpg","galleries_id":382749,"server_id":32,"link":"photo_8891699.html","width":160,"caption":"Marble Inlay Detail","height":203});
															thumbnails[8891703] = clik.newPhoto({"id":8891703,"src":"01_Mister_Frog_thumb.jpg","galleries_id":382749,"server_id":32,"link":"photo_8891703.html","width":160,"caption":"Mister Frog","height":120});
															thumbnails[8891706] = clik.newPhoto({"id":8891706,"src":"01_Split_Rock_thumb.jpg","galleries_id":382749,"server_id":32,"link":"photo_8891706.html","width":160,"caption":"Split Rock","height":101});
															thumbnails[8891720] = clik.newPhoto({"id":8891720,"src":"01_Stonecrop_in_the_Rockface_thumb.jpg","galleries_id":382749,"server_id":32,"link":"photo_8891720.html","width":160,"caption":"Stonecrop in the Rockface","height":242});
															thumbnails[8892221] = clik.newPhoto({"id":8892221,"src":"01_Sunlight_and_Shadow_thumb.jpg","galleries_id":382749,"server_id":32,"link":"photo_8892221.html","width":160,"caption":"Sunlight and Shadow","height":111});
															thumbnails[8892225] = clik.newPhoto({"id":8892225,"src":"01_Taking_a_Peek_thumb.jpg","galleries_id":382749,"server_id":32,"link":"photo_8892225.html","width":160,"caption":"Taking a Peek","height":160});
															thumbnails[8892238] = clik.newPhoto({"id":8892238,"src":"01_TANGLED_ROPE_thumb.jpg","galleries_id":382749,"server_id":32,"link":"photo_8892238.html","width":160,"caption":"Tangled Rope","height":139});
															thumbnails[8892268] = clik.newPhoto({"id":8892268,"src":"01_Three_of_a_kind-Greylag_Geese_near_Castle_Water_Rye_Harbour_Nature_reserve.jpg_thumb.jpg","galleries_id":382749,"server_id":32,"link":"photo_8892268.html","width":160,"caption":"Three of a kind-Greylag Geese near Castle Water Rye Harbour Nature reserve","height":120});
															thumbnails[8892308] = clik.newPhoto({"id":8892308,"src":"01_Vibrant_Attration_Mexican_Sunflower_Tithonia_Torch_thumb.jpg","galleries_id":382749,"server_id":32,"link":"photo_8892308.html","width":160,"caption":"Vibrant Attraction (Mexican Sunflower) Tithonia Torch","height":138});
															thumbnails[8892309] = clik.newPhoto({"id":8892309,"src":"01_Wall_sculptureTewkesbury_Abbey_thumb.jpg","galleries_id":382749,"server_id":32,"link":"photo_8892309.html","width":160,"caption":"Wall sculpture, Tewkesbury Abbey","height":110});
															thumbnails[8892310] = clik.newPhoto({"id":8892310,"src":"01_We_have_lift-off_Heron_underway._thumb.jpg","galleries_id":382749,"server_id":32,"link":"photo_8892310.html","width":160,"caption":"We have lift-off! Heron underway","height":107});
															thumbnails[8892319] = clik.newPhoto({"id":8892319,"src":"02__OLD_BOAT_thumb.jpg","galleries_id":382749,"server_id":32,"link":"photo_8892319.html","width":160,"caption":"Old Boat","height":176});
															thumbnails[8892333] = clik.newPhoto({"id":8892333,"src":"02__One_of_Bexhills_ornate_attractions_thumb.jpg","galleries_id":382749,"server_id":32,"link":"photo_8892333.html","width":160,"caption":"One of Bexhill's ornate attractions","height":127});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[382749] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Members Gallery","link":"gallery_382749.html","maxRecords":0.0,"photoIDs":[7088242.0,7071547.0,7071551.0,7071554.0,7071559.0,7071577.0,7071580.0,7071675.0,7071718.0,7071697.0,7071736.0,7072274.0,7141745.0,8890691.0,8890697.0,8890754.0,8891716.0,8890968.0,8891039.0,8891362.0,8891365.0,8891424.0,8891426.0,8891447.0,8891451.0,8891477.0,8891482.0,8891534.0,8891565.0,8891595.0,8891643.0,8891653.0,8891655.0,8891656.0,8891660.0,8891690.0,8891693.0,8891699.0,8891703.0,8891706.0,8891720.0,8892221.0,8892225.0,8892238.0,8892268.0,8892308.0,8892309.0,8892310.0,8892319.0,8892333.0],"skipIndex":0,"section_code":"gallery","featured_images":"8892333,8892319,8892310,8892309,8892308,8892268,8892238,8892225,8892221,8891720","id":382749,"singleSection":false});				  						galleries[396902] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Winning Entries","link":"gallery_396902.html","maxRecords":0.0,"photoIDs":[7334738.0,7334740.0,7334742.0,7334757.0,7334768.0,7334782.0,7334793.0,7334813.0,7334735.0,7334746.0],"skipIndex":0,"section_code":"gallery","featured_images":"7334813,7334793,7334782,7334768,7334757,7334746,7334742,7334740,7334738,7334735","id":396902,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '7088242';
imageSets[3] = '7071547,7071551,7071554,7071559,7071577,7071580,7071675,7071718,7071697,7071736,7072274,7141745';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/battlecc/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/battlecc/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/battlecc/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/battlecc/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/battlecc/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/battlecc/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/battlecc/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/battlecc/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/battlecc/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/battlecc/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/battlecc/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/battlecc/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/battlecc/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/battlecc/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/battlecc/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/battlecc/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/battlecc/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/battlecc/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/battlecc/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/battlecc/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/battlecc/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/battlecc/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/battlecc/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/battlecc/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/battlecc/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/battlecc/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/battlecc/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 = 'Battle Camera Club: ' + 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;
	}
}

			

