window.thumbnails = {};
															thumbnails[2329891] = clik.newPhoto({"id":2329891,"src":"ChurchHouseEdenbridge_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"Church House Edenbridge Kent","height":104});
															thumbnails[4701042] = clik.newPhoto({"id":4701042,"src":"UCL-Cancercare-Interior-Detail_thumb.jpg","galleries_id":151960,"server_id":32,"link":"photo_4701042.html","width":130,"caption":"UCL Cancer Institute","height":195});
															thumbnails[4701052] = clik.newPhoto({"id":4701052,"src":"UCL-Cancercare-Lab-Doors_thumb.jpg","galleries_id":151960,"server_id":32,"link":"photo_4701052.html","width":130,"caption":"UCL Cancer Institute","height":195});
															thumbnails[4701071] = clik.newPhoto({"id":4701071,"src":"UCL-Cancercare-Lift1_thumb.jpg","galleries_id":151960,"server_id":32,"link":"photo_4701071.html","width":130,"caption":"UCL Cancer Institute","height":87});
															thumbnails[4701072] = clik.newPhoto({"id":4701072,"src":"UCL-Cancercare-Office-4_thumb.jpg","galleries_id":151960,"server_id":32,"link":"photo_4701072.html","width":130,"caption":"UCL Cancer Institute","height":87});
															thumbnails[4701082] = clik.newPhoto({"id":4701082,"src":"UCL-Cancercare-Office1_thumb.jpg","galleries_id":151960,"server_id":32,"link":"photo_4701082.html","width":130,"caption":"UCL Cancer Institute","height":87});
															thumbnails[4701090] = clik.newPhoto({"id":4701090,"src":"UCL-Cancercare-Office2_thumb.jpg","galleries_id":151960,"server_id":32,"link":"photo_4701090.html","width":130,"caption":"UCL Cancer Institute","height":195});
															thumbnails[4701101] = clik.newPhoto({"id":4701101,"src":"UCL-Cancercare-Staircase1_thumb.jpg","galleries_id":151960,"server_id":32,"link":"photo_4701101.html","width":130,"caption":"UCL Cancer Institute","height":195});
															thumbnails[4701113] = clik.newPhoto({"id":4701113,"src":"UCL-Cancercare-Staircase4_thumb.jpg","galleries_id":151960,"server_id":32,"link":"photo_4701113.html","width":130,"caption":"UCL Cancer Institute","height":195});
															thumbnails[4701143] = clik.newPhoto({"id":4701143,"src":"UCL-Cancercare-Terracotta-Blades1_thumb.jpg","galleries_id":151960,"server_id":32,"link":"photo_4701143.html","width":130,"caption":"UCL Cancer Institute","height":195});
															thumbnails[4701154] = clik.newPhoto({"id":4701154,"src":"UCL-Cancercare-Terracotta-Blades2_thumb.jpg","galleries_id":151960,"server_id":32,"link":"photo_4701154.html","width":130,"caption":"UCL Cancer Institute","height":195});
															thumbnails[2329776] = clik.newPhoto({"id":2329776,"src":"CanaryWharfundergroundstation11_thumb.jpg","galleries_id":151959,"server_id":32,"link":"photo_2329776.html","width":130,"caption":"Canary Wharf Underground Station London<br>\r\nFoster and Partners Architects","height":104});
															thumbnails[4700967] = clik.newPhoto({"id":4700967,"src":"UCL-Cancercare-Facade-Detail_thumb.jpg","galleries_id":151960,"server_id":32,"link":"photo_4700967.html","width":130,"caption":"UCL Cancer Institute","height":87});
															thumbnails[4701138] = clik.newPhoto({"id":4701138,"src":"UCL-Cancercare-Terracotta-Blades-3_thumb.jpg","galleries_id":151960,"server_id":32,"link":"photo_4701138.html","width":130,"caption":"UCL Cancer Institute","height":195});
															thumbnails[2329870] = clik.newPhoto({"id":2329870,"src":"CanaryWharfundergroundstation2_thumb.jpg","galleries_id":151959,"server_id":32,"link":"photo_2329870.html","width":130,"caption":"Canary Wharf Underground Station London<br>\r\nFoster and Partners Architects","height":104});
															thumbnails[2329971] = clik.newPhoto({"id":2329971,"src":"PeabodyTrusthousing_thumb.jpg","galleries_id":151958,"server_id":32,"link":"photo_2329971.html","width":130,"caption":"Peabody Trust Housing Silvertown London<br>\r\nNiall McLaughlin Architects","height":163});
															thumbnails[2597418] = clik.newPhoto({"id":2597418,"src":"Serpentine-Pavilion-22-Interior_thumb.jpg","galleries_id":150850,"server_id":32,"link":"photo_2597418.html","width":130,"caption":"Serpentine Gallery Pavilion 2008<br>\r\nGehry Partners Architects","height":87});
															thumbnails[2597500] = clik.newPhoto({"id":2597500,"src":"Serpentine-Pavilion-Interior--sunset2_thumb.jpg","galleries_id":150850,"server_id":32,"link":"photo_2597500.html","width":130,"caption":"Serpentine Gallery Pavilion 2008 Gehry Partners Architects","height":195});
															thumbnails[4701011] = clik.newPhoto({"id":4701011,"src":"UCL-Cancercare-Facade_thumb.jpg","galleries_id":151960,"server_id":32,"link":"photo_4701011.html","width":130,"caption":"UCL Cancer Institute","height":87});
															thumbnails[2329884] = clik.newPhoto({"id":2329884,"src":"CanaryWharfundergroundstation3_thumb.jpg","galleries_id":151959,"server_id":32,"link":"photo_2329884.html","width":130,"caption":"Canary Wharf Underground Station London Foster and Partners Architects","height":163});
															thumbnails[2597428] = clik.newPhoto({"id":2597428,"src":"Serpentine-Pavilon-side-view_thumb.jpg","galleries_id":150850,"server_id":32,"link":"photo_2597428.html","width":130,"caption":"Serpentine Gallery Pavilion 2008<br>\r\nGehry Partners Architects","height":87});
															thumbnails[4701000] = clik.newPhoto({"id":4701000,"src":"UCL-Cancercare-Cafe_thumb.jpg","galleries_id":151960,"server_id":32,"link":"photo_4701000.html","width":130,"caption":"UCL Cancer Institute ","height":87});
															thumbnails[2329896] = clik.newPhoto({"id":2329896,"src":"FTPrintworks_thumb.jpg","galleries_id":151959,"server_id":32,"link":"photo_2329896.html","width":130,"caption":"Financial Times Print works London<br>\r\nGrimshaw Architects","height":163});
															thumbnails[2329978] = clik.newPhoto({"id":2329978,"src":"PeabodyTrusthousing1_thumb.jpg","galleries_id":151958,"server_id":32,"link":"photo_2329978.html","width":130,"caption":"Peabody Trust Housing Silvertown London Niall McLaughlin Architects","height":163});
															thumbnails[2329988] = clik.newPhoto({"id":2329988,"src":"PeabodyTrusthousing3_thumb.jpg","galleries_id":151958,"server_id":32,"link":"photo_2329988.html","width":130,"caption":"Peabody Trust Housing Silvertown London<br>\r\nNiall McLaughlin Architects","height":163});
															thumbnails[4701029] = clik.newPhoto({"id":4701029,"src":"UCL-Cancercare-foyer-1_thumb.jpg","galleries_id":151960,"server_id":32,"link":"photo_4701029.html","width":130,"caption":"UCL Cancer Institute","height":87});
															thumbnails[2329901] = clik.newPhoto({"id":2329901,"src":"FTprintworksdetail_thumb.jpg","galleries_id":151959,"server_id":32,"link":"photo_2329901.html","width":130,"caption":"Financial Times Print Works London Grimshaw Architects","height":163});
															thumbnails[2597488] = clik.newPhoto({"id":2597488,"src":"Serpentine-Pavilion-Sunset-side&rear1_thumb.jpg","galleries_id":150850,"server_id":32,"link":"photo_2597488.html","width":130,"caption":"Serpentine Gallery Pavilion 2008","height":195});
															thumbnails[2597513] = clik.newPhoto({"id":2597513,"src":"Serpentine-Pavilion-2_thumb.jpg","galleries_id":150850,"server_id":32,"link":"photo_2597513.html","width":130,"caption":"Serpentine Gallery Pavilion 2008<br>\r\nGehry Partners Architects","height":195});
															thumbnails[2597396] = clik.newPhoto({"id":2597396,"src":"Serpentine-Pavilion-20-08-Front1_thumb.jpg","galleries_id":150850,"server_id":32,"link":"photo_2597396.html","width":130,"caption":"Serpentine Gallery Pavilion 2008 Gehry Partners Architects","height":87});
															thumbnails[2597521] = clik.newPhoto({"id":2597521,"src":"Serpentine-Pavilion-20_thumb.jpg","galleries_id":150850,"server_id":32,"link":"photo_2597521.html","width":130,"caption":"Serpentine Gallery Pavilion 2008 Gehry Partners Architects","height":195});
															thumbnails[2597531] = clik.newPhoto({"id":2597531,"src":"Serpentine-Pavilion-23-Interior_thumb.jpg","galleries_id":150850,"server_id":32,"link":"photo_2597531.html","width":130,"caption":"Serpentine Gallery Pavilion 2008<br>\r\nGehry Partners Architects","height":195});
															thumbnails[2597686] = clik.newPhoto({"id":2597686,"src":"Serpentine-Pavilion-9_thumb.jpg","galleries_id":150850,"server_id":32,"link":"photo_2597686.html","width":130,"caption":"Serpentine Gallery Pavilion 2008<br>\r\nGehry Partners Architects","height":195});
															thumbnails[4701129] = clik.newPhoto({"id":4701129,"src":"UCL-Cancercare-Stairs-Detail1_thumb.jpg","galleries_id":151960,"server_id":32,"link":"photo_4701129.html","width":130,"caption":"UCL Cancer Institute","height":195});
															thumbnails[2597915] = clik.newPhoto({"id":2597915,"src":"Serpentine-Pavilion-10_thumb.jpg","galleries_id":150850,"server_id":32,"link":"photo_2597915.html","width":130,"caption":"Serpentine Gallery Pavilion 2008<br>\r\nGehry Partners Architects","height":195});
															thumbnails[4701064] = clik.newPhoto({"id":4701064,"src":"UCL-Cancercare-Lab_thumb.jpg","galleries_id":151960,"server_id":32,"link":"photo_4701064.html","width":130,"caption":"UCL Cancer Institute","height":87});
															thumbnails[2329940] = clik.newPhoto({"id":2329940,"src":"GuggenheimBilbaoMuseumfront_thumb.jpg","galleries_id":150850,"server_id":32,"link":"photo_2329940.html","width":130,"caption":"Guggenheim Museum Bilbao Spain Frank Gehry Associates Architects","height":163});
															thumbnails[2331086] = clik.newPhoto({"id":2331086,"src":"SSEES-roof_thumb.jpg","galleries_id":151960,"server_id":32,"link":"photo_2331086.html","width":130,"caption":"University College London School of Slavonic and East European Studies  Short and Associates Architects","height":104});
															thumbnails[2329947] = clik.newPhoto({"id":2329947,"src":"GuggenheimBilboa1_thumb.jpg","galleries_id":150850,"server_id":32,"link":"photo_2329947.html","width":130,"caption":"Guggenheim Museum Bilbao Spain<br>\r\nFrank Gehry Associates Architects","height":163});
															thumbnails[2331106] = clik.newPhoto({"id":2331106,"src":"SSEES-1_thumb.jpg","galleries_id":151960,"server_id":32,"link":"photo_2331106.html","width":130,"caption":"University College London School of Slavonic and East European Studies Short and Associates Architects","height":163});
															thumbnails[2329927] = clik.newPhoto({"id":2329927,"src":"GuggenheimBilbao5_thumb.jpg","galleries_id":150850,"server_id":32,"link":"photo_2329927.html","width":130,"caption":"Guggenheim Museum Bilbao Spain<br>\r\nFrank Gehry Associates Architects","height":163});
															thumbnails[2329919] = clik.newPhoto({"id":2329919,"src":"GuggenheimBilbao4_thumb.jpg","galleries_id":150850,"server_id":32,"link":"photo_2329919.html","width":130,"caption":"Guggenheim Museum Bilbao Spain<br>\r\nFrank Gehry Associates Architects","height":163});
															thumbnails[2329934] = clik.newPhoto({"id":2329934,"src":"GuggenheimBilbao6_thumb.jpg","galleries_id":150850,"server_id":32,"link":"photo_2329934.html","width":130,"caption":"Guggenheim Museum Bilbao Spain<br>\r\nFrank Gehry Associates Architects","height":163});
															thumbnails[2330014] = clik.newPhoto({"id":2330014,"src":"SerpentinePavilion2007_thumb.jpg","galleries_id":150850,"server_id":32,"link":"photo_2330014.html","width":130,"caption":"Serpentine Gallery Pavilion London 2007 Olafur Eliasson & Kjetil Thorsen Snohetta Architects","height":104});
															thumbnails[2330038] = clik.newPhoto({"id":2330038,"src":"SerpentinepavilionInteriorDetail_thumb.jpg","galleries_id":150850,"server_id":32,"link":"photo_2330038.html","width":130,"caption":"Serpentine Gallery Pavilion London 2007 Olafur Eliasson & Kjetil Thorsen Snohetta Architects","height":163});
															thumbnails[2331119] = clik.newPhoto({"id":2331119,"src":"SSEES5_thumb.jpg","galleries_id":151960,"server_id":32,"link":"photo_2331119.html","width":130,"caption":"University College London<br>\r\nSchool of Slavonic and East European Studies<br>\r\nShort and Associates Architects","height":104});
															thumbnails[2331142] = clik.newPhoto({"id":2331142,"src":"SSEES2_thumb.jpg","galleries_id":151960,"server_id":32,"link":"photo_2331142.html","width":130,"caption":"University College London<br>\r\nSchool of Slavonic and East European Studies<br>\r\nShort and Associates Architects","height":163});
															thumbnails[2330020] = clik.newPhoto({"id":2330020,"src":"SerpentinePavilionDome_thumb.jpg","galleries_id":150850,"server_id":32,"link":"photo_2330020.html","width":130,"caption":"Serpentine Gallery London 2007<br>\r\nOlafur Eliasson & Kjetil Thorsen<br>\r\nSnohetta Architects","height":163});
															thumbnails[2331158] = clik.newPhoto({"id":2331158,"src":"SSES-4_thumb.jpg","galleries_id":151960,"server_id":32,"link":"photo_2331158.html","width":130,"caption":"University College London<br>\r\nSchool of Slavonic and East European Studies<br>\r\nShort and Associates Architects","height":163});
															thumbnails[2330026] = clik.newPhoto({"id":2330026,"src":"SerpentinePavilionInterior_thumb.jpg","galleries_id":150850,"server_id":32,"link":"photo_2330026.html","width":130,"caption":"Serpentine Gallery Pavilion London 2007<br>\r\nOlafur Eliasson & Kjetil Thorsen<br>\r\nSnohetta Architects","height":104});
															thumbnails[2331159] = clik.newPhoto({"id":2331159,"src":"SSESS3_thumb.jpg","galleries_id":151960,"server_id":32,"link":"photo_2331159.html","width":130,"caption":"University College London<br>\r\nSchool of Slavonic and East European Studies<br>\r\nShort and Associates Architects","height":163});
															thumbnails[2330003] = clik.newPhoto({"id":2330003,"src":"SerpentinePavilion_thumb.jpg","galleries_id":150850,"server_id":32,"link":"photo_2330003.html","width":130,"caption":"Serpentine Gallery Pavilion London 2007<br>\r\nOlafur Eliasson & Kjetil Thorsen <br>\r\nSnohetta Architects","height":104});
															thumbnails[2330047] = clik.newPhoto({"id":2330047,"src":"SerpentinePavilionViewingplatformentrance_thumb.jpg","galleries_id":150850,"server_id":32,"link":"photo_2330047.html","width":130,"caption":"Serpentine gallery Pavilion London 2007<br>\r\nOlafur Eliasson & Kjetil Thorsen<br>\r\nSnohetta Architects","height":104});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[150850] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Arts","link":"gallery_150850.html","maxRecords":0.0,"photoIDs":[2597418.0,2597500.0,2597428.0,2597488.0,2597513.0,2597396.0,2597521.0,2597531.0,2597686.0,2597915.0,2329940.0,2329947.0,2329927.0,2329919.0,2329934.0,2330014.0,2330038.0,2330020.0,2330026.0,2330003.0,2330047.0],"skipIndex":0,"section_code":"gallery","featured_images":2597488.0,"id":150850,"singleSection":false});				  						galleries[151958] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Residential","link":"gallery_151958.html","maxRecords":0.0,"photoIDs":[2329971.0,2329978.0,2329988.0],"skipIndex":0,"section_code":"gallery","featured_images":2329978.0,"id":151958,"singleSection":false});				  						galleries[151959] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Commercial","link":"gallery_151959.html","maxRecords":0.0,"photoIDs":[2329776.0,2329870.0,2329884.0,2329896.0,2329901.0],"skipIndex":0,"section_code":"gallery","featured_images":"2329901,2329896,2329884,2329870,2329776","id":151959,"singleSection":false});				  						galleries[151960] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Education and Science","link":"gallery_151960.html","maxRecords":0.0,"photoIDs":[4701042.0,4701052.0,4701071.0,4701072.0,4701082.0,4701090.0,4701101.0,4701113.0,4701143.0,4701154.0,4700967.0,4701138.0,4701011.0,4701000.0,4701029.0,4701129.0,4701064.0,2331086.0,2331106.0,2331119.0,2331142.0,2331158.0,2331159.0],"skipIndex":0,"section_code":"gallery","featured_images":2331086.0,"id":151960,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '4701082,4701072,4701138,2597500,2329978,2329901,2597488,2597396,2597521,4701129,4701064,2331086,2329940,2331106,2330014,2330038';
imageSets[2] = '2329891,2329978,2597488,2331086';
imageSets[3] = '4701138,2597500,2329978,2329901,2597488,2597396,2597521,4701129,4701064,2331086,2329940,2331106,2330014,2330038';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/nigelcarr/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/nigelcarr/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/nigelcarr/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/nigelcarr/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/nigelcarr/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/nigelcarr/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/nigelcarr/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/nigelcarr/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/nigelcarr/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/nigelcarr/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/nigelcarr/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/nigelcarr/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/nigelcarr/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/nigelcarr/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/nigelcarr/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/nigelcarr/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/nigelcarr/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/nigelcarr/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/nigelcarr/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/nigelcarr/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/nigelcarr/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/nigelcarr/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/nigelcarr/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/nigelcarr/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/nigelcarr/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/nigelcarr/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/nigelcarr/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 = 'Nigel Carr Architectural & Interiors 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.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;
	}
}

			

