window.thumbnails = {};
															thumbnails[2125888] = clik.newPhoto({"id":2125888,"src":"new_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"The backstage crew prepare the set","height":98});
															thumbnails[2125889] = clik.newPhoto({"id":2125889,"src":"new2_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Painting the set","height":98});
															thumbnails[3666338] = clik.newPhoto({"id":3666338,"src":"240px-Knowle_highstreet_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Knowle High Street","height":98});
															thumbnails[8294339] = clik.newPhoto({"id":8294339,"src":"Oscar_Wilde_portrait_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":139});
															thumbnails[8294430] = clik.newPhoto({"id":8294430,"src":"witw_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":98});
															thumbnails[8848638] = clik.newPhoto({"id":8848638,"src":"Wind-in-the-Willows-Site_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"The Wind in the Willows","height":112});
															thumbnails[8969996] = clik.newPhoto({"id":8969996,"src":"Website-New-Poster_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":112});
															thumbnails[5538382] = clik.newPhoto({"id":5538382,"src":"Wizard_of_Oz_1_thumb.jpg","galleries_id":313842,"server_id":1,"link":"photo_5538382.html","width":130,"caption":"The Wizard of Oz January 2010","height":83});
															thumbnails[5538386] = clik.newPhoto({"id":5538386,"src":"Wizard_of_Oz2_thumb.jpg","galleries_id":313842,"server_id":1,"link":"photo_5538386.html","width":130,"caption":"Wizard of Oz January 2010","height":98});
															thumbnails[3691306] = clik.newPhoto({"id":3691306,"src":"Sleeping_Beauty_Archive_1_thumb.jpg","galleries_id":225471,"server_id":1,"link":"photo_3691306.html","width":130,"caption":"The whole cast of Sleeping Beauty 2009","height":75});
															thumbnails[3691323] = clik.newPhoto({"id":3691323,"src":"Sleeping_Beauty_Archive_2_thumb.jpg","galleries_id":225471,"server_id":1,"link":"photo_3691323.html","width":130,"caption":"We're riding along on the crest of a wave...","height":93});
															thumbnails[2189600] = clik.newPhoto({"id":2189600,"src":"PICT0069a_thumb.jpg","galleries_id":144927,"server_id":1,"link":"photo_2189600.html","width":130,"caption":"One baddie gets killed by another!","height":98});
															thumbnails[2189606] = clik.newPhoto({"id":2189606,"src":"PICT0109_thumb.jpg","galleries_id":144927,"server_id":1,"link":"photo_2189606.html","width":130,"caption":"Stella and Robert are threatened","height":98});
															thumbnails[2189607] = clik.newPhoto({"id":2189607,"src":"PICT0114_thumb.jpg","galleries_id":144927,"server_id":1,"link":"photo_2189607.html","width":130,"caption":"The cast of House Guest","height":79});
															thumbnails[1994741] = clik.newPhoto({"id":1994741,"src":"LW&W-2008-078_thumb.jpg","galleries_id":133883,"server_id":1,"link":"photo_1994741.html","width":130,"caption":"The Lion, The Witch & the Wardrobe","height":98});
															thumbnails[2013999] = clik.newPhoto({"id":2013999,"src":"LW&W1_thumb.jpg","galleries_id":133883,"server_id":1,"link":"photo_2013999.html","width":130,"caption":"Mr Tumnus's house","height":98});
															thumbnails[2014005] = clik.newPhoto({"id":2014005,"src":"LW&W2_thumb.jpg","galleries_id":133883,"server_id":1,"link":"photo_2014005.html","width":130,"caption":"The White Witch and her Dwarf threaten Edward","height":98});
															thumbnails[2014008] = clik.newPhoto({"id":2014008,"src":"LW&W3_thumb.jpg","galleries_id":133883,"server_id":1,"link":"photo_2014008.html","width":130,"caption":"The cast","height":76});
															thumbnails[1823146] = clik.newPhoto({"id":1823146,"src":"Whenwearemarrried009_thumb.jpg","galleries_id":122469,"server_id":1,"link":"photo_1823146.html","width":130,"caption":"Ruby (Helen Roberts)","height":173});
															thumbnails[1823148] = clik.newPhoto({"id":1823148,"src":"Whenwearemarrried025_thumb.jpg","galleries_id":122469,"server_id":1,"link":"photo_1823148.html","width":130,"caption":"Group Shot","height":91});
															thumbnails[1823150] = clik.newPhoto({"id":1823150,"src":"Whenwearemarrried087_thumb.jpg","galleries_id":122469,"server_id":1,"link":"photo_1823150.html","width":130,"caption":"Drunk scene","height":98});
															thumbnails[2013991] = clik.newPhoto({"id":2013991,"src":"present2_thumb.jpg","galleries_id":134995,"server_id":1,"link":"photo_2013991.html","width":130,"caption":"The cast","height":69});
															thumbnails[2008832] = clik.newPhoto({"id":2008832,"src":"roumors1_thumb.jpg","galleries_id":133887,"server_id":1,"link":"photo_2008832.html","width":130,"caption":"Rumours","height":73});
															thumbnails[2008839] = clik.newPhoto({"id":2008839,"src":"rumour2_thumb.jpg","galleries_id":133887,"server_id":1,"link":"photo_2008839.html","width":130,"caption":"A nasty injury!","height":98});
															thumbnails[1823097] = clik.newPhoto({"id":1823097,"src":"Housebythelake005_thumb.jpg","galleries_id":122464,"server_id":1,"link":"photo_1823097.html","width":130,"caption":"House by the Lake","height":98});
															thumbnails[1823100] = clik.newPhoto({"id":1823100,"src":"Housebythelake031_thumb.jpg","galleries_id":122464,"server_id":1,"link":"photo_1823100.html","width":130,"caption":"House by the Lake","height":70});
															thumbnails[2014033] = clik.newPhoto({"id":2014033,"src":"hbtl_thumb.jpg","galleries_id":122464,"server_id":1,"link":"photo_2014033.html","width":130,"caption":"A tense moment","height":98});
															thumbnails[2014035] = clik.newPhoto({"id":2014035,"src":"housebythelake_thumb.jpg","galleries_id":122464,"server_id":1,"link":"photo_2014035.html","width":130,"caption":"The police come knocking","height":98});
															thumbnails[2071293] = clik.newPhoto({"id":2071293,"src":"Jack-with-Giant_thumb.jpg","galleries_id":138374,"server_id":1,"link":"photo_2071293.html","width":130,"caption":"Jack facing the evil giant!","height":98});
															thumbnails[2071294] = clik.newPhoto({"id":2071294,"src":"JandB_thumb.jpg","galleries_id":138374,"server_id":1,"link":"photo_2071294.html","width":130,"caption":"The dame with some of the giant's evil crew","height":98});
															thumbnails[2071295] = clik.newPhoto({"id":2071295,"src":"Whole-group_thumb.jpg","galleries_id":138374,"server_id":1,"link":"photo_2071295.html","width":130,"caption":"The cast","height":98});
															thumbnails[2014038] = clik.newPhoto({"id":2014038,"src":"Line-with-cat_thumb.jpg","galleries_id":135002,"server_id":1,"link":"photo_2014038.html","width":130,"caption":"The 'cast' rehearse before their big night","height":98});
															thumbnails[1823352] = clik.newPhoto({"id":1823352,"src":"rob3_sm_thumb.jpg","galleries_id":122502,"server_id":1,"link":"photo_1823352.html","width":130,"caption":"The chorus","height":104});
															thumbnails[1926890] = clik.newPhoto({"id":1926890,"src":"hop1_thumb.jpg","galleries_id":133893,"server_id":1,"link":"photo_1926890.html","width":130,"caption":"Caught on the Hop","height":104});
															thumbnails[1823341] = clik.newPhoto({"id":1823341,"src":"rob1_sm_thumb.jpg","galleries_id":122502,"server_id":1,"link":"photo_1823341.html","width":130,"caption":"Ma Crusoe and her clan","height":104});
															thumbnails[1823348] = clik.newPhoto({"id":1823348,"src":"rob2_sm_thumb.jpg","galleries_id":122502,"server_id":1,"link":"photo_1823348.html","width":130,"caption":"Robinson and his gal","height":104});
															thumbnails[1823354] = clik.newPhoto({"id":1823354,"src":"rob4_sm_thumb.jpg","galleries_id":122502,"server_id":1,"link":"photo_1823354.html","width":130,"caption":"On the island","height":104});
															thumbnails[2089350] = clik.newPhoto({"id":2089350,"src":"katie1_thumb.jpg","galleries_id":139460,"server_id":1,"link":"photo_2089350.html","width":130,"caption":"Lucille explaining herself to Mum & Dad!","height":104});
															thumbnails[2089353] = clik.newPhoto({"id":2089353,"src":"katie2_thumb.jpg","galleries_id":139460,"server_id":1,"link":"photo_2089353.html","width":130,"caption":"Alphonse surprises Janis","height":104});
															thumbnails[2089355] = clik.newPhoto({"id":2089355,"src":"katie4_thumb.jpg","galleries_id":139460,"server_id":1,"link":"photo_2089355.html","width":130,"caption":"The cast","height":89});
															thumbnails[2089359] = clik.newPhoto({"id":2089359,"src":"browning1_thumb.jpg","galleries_id":139461,"server_id":1,"link":"photo_2089359.html","width":130,"caption":"Andrew Crocker Harris with his pupil Taplow","height":104});
															thumbnails[2089363] = clik.newPhoto({"id":2089363,"src":"browning2_thumb.jpg","galleries_id":139461,"server_id":1,"link":"photo_2089363.html","width":130,"caption":"Millie Crocker Harris with Frank Hunter","height":104});
															thumbnails[2089365] = clik.newPhoto({"id":2089365,"src":"browning4_thumb.jpg","galleries_id":139461,"server_id":1,"link":"photo_2089365.html","width":130,"caption":"Millie with Mr & Mrs Gilbert","height":104});
															thumbnails[2089371] = clik.newPhoto({"id":2089371,"src":"hop5_thumb.jpg","galleries_id":133893,"server_id":1,"link":"photo_2089371.html","width":130,"caption":"Caught on the Hop","height":104});
															thumbnails[2189597] = clik.newPhoto({"id":2189597,"src":"PICT0049_thumb.jpg","galleries_id":144927,"server_id":1,"link":"photo_2189597.html","width":130,"caption":"The fake Poilcemen show their true colours","height":88});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[133892] = clik.newGallery({"parentGallery":"","usePopups":false,"title":2005.0,"link":"gallery_133892.html","maxRecords":0.0,"photoIDs":[],"skipIndex":0,"section_code":"gallery","featured_images":2014038.0,"id":133892,"singleSection":false});				  						galleries[133890] = clik.newGallery({"parentGallery":"","usePopups":false,"title":2006.0,"link":"gallery_133890.html","maxRecords":0.0,"photoIDs":[],"skipIndex":0,"section_code":"gallery","featured_images":"2014033,1823148","id":133890,"singleSection":false});				  						galleries[133889] = clik.newGallery({"parentGallery":"","usePopups":false,"title":2007.0,"link":"gallery_133889.html","maxRecords":0.0,"photoIDs":[],"skipIndex":0,"section_code":"gallery","featured_images":"2013991,2008839,2008832","id":133889,"singleSection":false});				  						galleries[133888] = clik.newGallery({"parentGallery":"","usePopups":false,"title":2008.0,"link":"gallery_133888.html","maxRecords":0.0,"photoIDs":[],"skipIndex":0,"section_code":"gallery","featured_images":2189606.0,"id":133888,"singleSection":false});				  						galleries[225470] = clik.newGallery({"parentGallery":"","usePopups":false,"title":2009.0,"link":"gallery_225470.html","maxRecords":0.0,"photoIDs":[],"skipIndex":0,"section_code":"gallery","featured_images":"3691323,3691306","id":225470,"singleSection":false});				  						galleries[313841] = clik.newGallery({"parentGallery":"","usePopups":false,"title":2010.0,"link":"gallery_313841.html","maxRecords":0.0,"photoIDs":[],"skipIndex":0,"section_code":"gallery","featured_images":"5538386,5538382","id":313841,"singleSection":false});				  						galleries[442689] = clik.newGallery({"parentGallery":"","usePopups":false,"title":2011.0,"link":"gallery_442689.html","maxRecords":0.0,"photoIDs":[],"skipIndex":0,"section_code":"gallery","featured_images":"","id":442689,"singleSection":false});				  						galleries[133893] = clik.newGallery({"parentGallery":133891,"usePopups":false,"title":"Caught on the Hop - May 2004","link":"gallery_133893.html","maxRecords":0.0,"photoIDs":[1926890.0,2089371.0],"skipIndex":0,"section_code":"gallery","featured_images":1926890.0,"id":133893,"singleSection":false});				  						galleries[144927] = clik.newGallery({"parentGallery":133888,"usePopups":false,"title":"House Guest - May 2008","link":"gallery_144927.html","maxRecords":0.0,"photoIDs":[2189600.0,2189606.0,2189607.0,2189597.0],"skipIndex":0,"section_code":"gallery","featured_images":2189606.0,"id":144927,"singleSection":false});				  						galleries[138374] = clik.newGallery({"parentGallery":133890,"usePopups":false,"title":"Jack & the Beanstalk - Jan 2006","link":"gallery_138374.html","maxRecords":0.0,"photoIDs":[2071293.0,2071294.0,2071295.0],"skipIndex":0,"section_code":"gallery","featured_images":"2071295,2071294,2071293","id":138374,"singleSection":false});				  						galleries[135002] = clik.newGallery({"parentGallery":133892,"usePopups":false,"title":"Out of Focus - Oct 2005","link":"gallery_135002.html","maxRecords":0.0,"photoIDs":[2014038.0],"skipIndex":0,"section_code":"gallery","featured_images":2014038.0,"id":135002,"singleSection":false});				  						galleries[134995] = clik.newGallery({"parentGallery":133889,"usePopups":false,"title":"Present Laughter - Oct 2007","link":"gallery_134995.html","maxRecords":0.0,"photoIDs":[2013991.0],"skipIndex":0,"section_code":"gallery","featured_images":2013991.0,"id":134995,"singleSection":false});				  						galleries[133891] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Previous Years","link":"gallery_133891.html","maxRecords":0.0,"photoIDs":[],"skipIndex":0,"section_code":"gallery","featured_images":"2089359,2089353,1926890","id":133891,"singleSection":false});				  						galleries[122502] = clik.newGallery({"parentGallery":133891,"usePopups":false,"title":"Robinson Crusoe - Jan 2003","link":"gallery_122502.html","maxRecords":0.0,"photoIDs":[1823352.0,1823341.0,1823348.0,1823354.0],"skipIndex":0,"section_code":"gallery","featured_images":"1823354,1823352,1823348,1823341","id":122502,"singleSection":false});				  						galleries[133887] = clik.newGallery({"parentGallery":133889,"usePopups":false,"title":"Rumours - May 2007","link":"gallery_133887.html","maxRecords":0.0,"photoIDs":[2008832.0,2008839.0],"skipIndex":0,"section_code":"gallery","featured_images":"2008839,2008832","id":133887,"singleSection":false});				  						galleries[225471] = clik.newGallery({"parentGallery":225470,"usePopups":false,"title":"Sleeping Beauty - Jan 2009","link":"gallery_225471.html","maxRecords":0.0,"photoIDs":[3691306.0,3691323.0],"skipIndex":0,"section_code":"gallery","featured_images":"3691323,3691306","id":225471,"singleSection":false});				  						galleries[139461] = clik.newGallery({"parentGallery":133891,"usePopups":false,"title":"The Browning Version - Oct 2003","link":"gallery_139461.html","maxRecords":0.0,"photoIDs":[2089359.0,2089363.0,2089365.0],"skipIndex":0,"section_code":"gallery","featured_images":2089359.0,"id":139461,"singleSection":false});				  						galleries[139460] = clik.newGallery({"parentGallery":133891,"usePopups":false,"title":"The Disappearance of Katie - May 2003","link":"gallery_139460.html","maxRecords":0.0,"photoIDs":[2089350.0,2089353.0,2089355.0],"skipIndex":0,"section_code":"gallery","featured_images":2089353.0,"id":139460,"singleSection":false});				  						galleries[133883] = clik.newGallery({"parentGallery":133888,"usePopups":false,"title":"The Lion the Witch & The Wardrobe - Jan 2008","link":"gallery_133883.html","maxRecords":0.0,"photoIDs":[1994741.0,2013999.0,2014005.0,2014008.0],"skipIndex":0,"section_code":"gallery","featured_images":"2014008,2014005,2013999,1994741","id":133883,"singleSection":false});				  						galleries[122469] = clik.newGallery({"parentGallery":133890,"usePopups":false,"title":"When we are Married - Oct 2006","link":"gallery_122469.html","maxRecords":0.0,"photoIDs":[1823146.0,1823148.0,1823150.0],"skipIndex":0,"section_code":"gallery","featured_images":1823148.0,"id":122469,"singleSection":false});				  						galleries[313842] = clik.newGallery({"parentGallery":313841,"usePopups":false,"title":"Wizard of Oz - January 2010","link":"gallery_313842.html","maxRecords":0.0,"photoIDs":[5538382.0,5538386.0],"skipIndex":0,"section_code":"gallery","featured_images":"5538386,5538382","id":313842,"singleSection":false});				  						galleries[122464] = clik.newGallery({"parentGallery":133890,"usePopups":false,"title":"House by the Lake - May 2006","link":"gallery_122464.html","maxRecords":0.0,"photoIDs":[1823097.0,1823100.0,2014033.0,2014035.0],"skipIndex":0,"section_code":"gallery","featured_images":2014033.0,"id":122464,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '8969996';
imageSets[2] = '5538386,5538382,2189606,2089359,2089353,2014038,2014033,1926890,1823148';
imageSets[3] = '3691323';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/revels/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/revels/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/revels/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/revels/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/revels/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/revels/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/revels/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/revels/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/revels/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/revels/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/revels/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/revels/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/revels/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/revels/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/revels/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/revels/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/revels/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/revels/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/revels/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/revels/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/revels/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/revels/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/revels/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/revels/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/revels/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/revels/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/revels/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 = 'Revels Drama Group: ' + 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;
	}
}

			

