window.thumbnails = {};
															thumbnails[4508142] = clik.newPhoto({"id":4508142,"src":"BRONZECAST001_Web_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"","height":98});
															thumbnails[4508143] = clik.newPhoto({"id":4508143,"src":"BRONZECAST002_Web_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"","height":153});
															thumbnails[4508144] = clik.newPhoto({"id":4508144,"src":"BRONZECAST003_Web_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"","height":128});
															thumbnails[4312541] = clik.newPhoto({"id":4312541,"src":"IanMiddleton-12_thumb.jpg","galleries_id":254180,"server_id":15,"link":"photo_4312541.html","width":130,"caption":"'Expectation'","height":88});
															thumbnails[4781810] = clik.newPhoto({"id":4781810,"src":"IM_TownMill-1_thumb.jpg","galleries_id":254180,"server_id":15,"link":"photo_4781810.html","width":130,"caption":"'Collision Course'","height":183});
															thumbnails[4781818] = clik.newPhoto({"id":4781818,"src":"IM_TownMill-2_thumb.jpg","galleries_id":254135,"server_id":15,"link":"photo_4781818.html","width":130,"caption":"'Still Life with Corporate Building' 'Daisy Chains'","height":183});
															thumbnails[4781819] = clik.newPhoto({"id":4781819,"src":"IM_TownMill-3_thumb.jpg","galleries_id":254135,"server_id":15,"link":"photo_4781819.html","width":130,"caption":"'Still Life with Corporate Building' 'Daisy Chains'","height":195});
															thumbnails[4781821] = clik.newPhoto({"id":4781821,"src":"IM_TownMill-4_thumb.jpg","galleries_id":254179,"server_id":15,"link":"photo_4781821.html","width":130,"caption":"'Who's a Pretty Boy Then?'","height":195});
															thumbnails[4781822] = clik.newPhoto({"id":4781822,"src":"IM_TownMill-5_thumb.jpg","galleries_id":254179,"server_id":15,"link":"photo_4781822.html","width":130,"caption":"'Who's a Pretty Boy Then' ","height":205});
															thumbnails[4781825] = clik.newPhoto({"id":4781825,"src":"IM_TownMill-6_thumb.jpg","galleries_id":254180,"server_id":15,"link":"photo_4781825.html","width":130,"caption":"'Come in No.27 Your Time is Up' ","height":130});
															thumbnails[4781829] = clik.newPhoto({"id":4781829,"src":"IM_TownMill-8_thumb.jpg","galleries_id":254135,"server_id":15,"link":"photo_4781829.html","width":130,"caption":"'Sleeper'","height":168});
															thumbnails[4781831] = clik.newPhoto({"id":4781831,"src":"IM_TownMill-9_thumb.jpg","galleries_id":254135,"server_id":15,"link":"photo_4781831.html","width":130,"caption":"'Dawn Chorus' detail. ","height":92});
															thumbnails[4781834] = clik.newPhoto({"id":4781834,"src":"IM_TownMill-11_thumb.jpg","galleries_id":254180,"server_id":15,"link":"photo_4781834.html","width":130,"caption":"'Pot Luck'","height":126});
															thumbnails[4781836] = clik.newPhoto({"id":4781836,"src":"IM_TownMill-13_thumb.jpg","galleries_id":254180,"server_id":15,"link":"photo_4781836.html","width":130,"caption":"'Second Coming'","height":183});
															thumbnails[4781847] = clik.newPhoto({"id":4781847,"src":"IM_TownMill-14_thumb.jpg","galleries_id":254180,"server_id":15,"link":"photo_4781847.html","width":130,"caption":"'Genesis'","height":92});
															thumbnails[4781848] = clik.newPhoto({"id":4781848,"src":"IM_TownMill-15_thumb.jpg","galleries_id":254180,"server_id":15,"link":"photo_4781848.html","width":130,"caption":"'Genesis'","height":92});
															thumbnails[4781849] = clik.newPhoto({"id":4781849,"src":"IM_TownMill-16_thumb.jpg","galleries_id":254180,"server_id":15,"link":"photo_4781849.html","width":130,"caption":"'Collision Course'","height":183});
															thumbnails[4781850] = clik.newPhoto({"id":4781850,"src":"IM_TownMill-17_thumb.jpg","galleries_id":254135,"server_id":15,"link":"photo_4781850.html","width":130,"caption":"'Dawn Chorus'","height":183});
															thumbnails[4312560] = clik.newPhoto({"id":4312560,"src":"IanMiddleton-23_thumb.jpg","galleries_id":254179,"server_id":15,"link":"photo_4312560.html","width":130,"caption":"'Come in Number 27 Your Time is Up'","height":88});
															thumbnails[4312525] = clik.newPhoto({"id":4312525,"src":"IanMiddleton-4_thumb.jpg","galleries_id":254135,"server_id":15,"link":"photo_4312525.html","width":130,"caption":"'Once Upon a Time'","height":176});
															thumbnails[4312537] = clik.newPhoto({"id":4312537,"src":"IanMiddleton-10_thumb.jpg","galleries_id":254179,"server_id":15,"link":"photo_4312537.html","width":130,"caption":"'Tower'","height":196});
															thumbnails[4312561] = clik.newPhoto({"id":4312561,"src":"IanMiddleton-24_thumb.jpg","galleries_id":254179,"server_id":15,"link":"photo_4312561.html","width":130,"caption":"'Logistics'","height":93});
															thumbnails[4781826] = clik.newPhoto({"id":4781826,"src":"IM_TownMill-7_thumb.jpg","galleries_id":254180,"server_id":15,"link":"photo_4781826.html","width":130,"caption":"'Come in No.27 Your Time is Up'","height":87});
															thumbnails[4312553] = clik.newPhoto({"id":4312553,"src":"IanMiddleton-19_thumb.jpg","galleries_id":254179,"server_id":15,"link":"photo_4312553.html","width":130,"caption":"'After Midnight'","height":88});
															thumbnails[4312554] = clik.newPhoto({"id":4312554,"src":"IanMiddleton-28_thumb.jpg","galleries_id":254179,"server_id":15,"link":"photo_4312554.html","width":130,"caption":"'Mission Statement'","height":220});
															thumbnails[4312564] = clik.newPhoto({"id":4312564,"src":"IanMiddleton-26_thumb.jpg","galleries_id":254135,"server_id":15,"link":"photo_4312564.html","width":130,"caption":"'Seat for a Princess'","height":200});
															thumbnails[4312513] = clik.newPhoto({"id":4312513,"src":"IanMiddleton-1_thumb.jpg","galleries_id":254135,"server_id":15,"link":"photo_4312513.html","width":130,"caption":"'Mission Statement 2'","height":192});
															thumbnails[4312534] = clik.newPhoto({"id":4312534,"src":"IanMiddleton-7_thumb.jpg","galleries_id":254179,"server_id":15,"link":"photo_4312534.html","width":130,"caption":"'Distant Memories and Sherbet Lemons'","height":192});
															thumbnails[4312535] = clik.newPhoto({"id":4312535,"src":"IanMiddleton-8_thumb.jpg","galleries_id":254180,"server_id":15,"link":"photo_4312535.html","width":130,"caption":"'Facing South'","height":192});
															thumbnails[4781833] = clik.newPhoto({"id":4781833,"src":"IM_TownMill-10_thumb.jpg","galleries_id":254180,"server_id":15,"link":"photo_4781833.html","width":130,"caption":"'Pot Luck'","height":183});
															thumbnails[4312522] = clik.newPhoto({"id":4312522,"src":"IanMiddleton-2_thumb.jpg","galleries_id":254135,"server_id":15,"link":"photo_4312522.html","width":130,"caption":"'Consequences'","height":192});
															thumbnails[4312536] = clik.newPhoto({"id":4312536,"src":"IanMiddleton-171_thumb.jpg","galleries_id":254180,"server_id":15,"link":"photo_4312536.html","width":130,"caption":"'Expectation'","height":192});
															thumbnails[4312547] = clik.newPhoto({"id":4312547,"src":"IanMiddleton-15_thumb.jpg","galleries_id":254179,"server_id":15,"link":"photo_4312547.html","width":130,"caption":"'The Politician's Final Word'","height":168});
															thumbnails[4312549] = clik.newPhoto({"id":4312549,"src":"IanMiddleton-241_thumb.jpg","galleries_id":254179,"server_id":15,"link":"photo_4312549.html","width":130,"caption":"'Bewildered Bystander'","height":192});
															thumbnails[4312562] = clik.newPhoto({"id":4312562,"src":"IanMiddleton-25_thumb.jpg","galleries_id":254135,"server_id":15,"link":"photo_4312562.html","width":130,"caption":"'Stepping Out'","height":94});
															thumbnails[4781835] = clik.newPhoto({"id":4781835,"src":"IM_TownMill-12_thumb.jpg","galleries_id":254180,"server_id":15,"link":"photo_4781835.html","width":130,"caption":"'Second Coming'","height":183});
															thumbnails[4312548] = clik.newPhoto({"id":4312548,"src":"IanMiddleton-16_thumb.jpg","galleries_id":254135,"server_id":15,"link":"photo_4312548.html","width":130,"caption":"'Silent Passage'","height":88});
															thumbnails[4312551] = clik.newPhoto({"id":4312551,"src":"IanMiddleton-18_thumb.jpg","galleries_id":254179,"server_id":15,"link":"photo_4312551.html","width":130,"caption":"'Good Citizen Smith'","height":135});
															thumbnails[4312567] = clik.newPhoto({"id":4312567,"src":"IanMiddleton-29_thumb.jpg","galleries_id":254135,"server_id":15,"link":"photo_4312567.html","width":130,"caption":"'Silent Passage' ","height":88});
															thumbnails[6085109] = clik.newPhoto({"id":6085109,"src":"remainsfinal_thumb.jpg","galleries_id":333725,"server_id":15,"link":"photo_6085109.html","width":130,"caption":"","height":172});
															thumbnails[5913718] = clik.newPhoto({"id":5913718,"src":"britishengineerum_thumb.jpg","galleries_id":333725,"server_id":15,"link":"photo_5913718.html","width":130,"caption":"","height":185});
															thumbnails[5913732] = clik.newPhoto({"id":5913732,"src":"toyamurasmall_thumb.jpeg","galleries_id":333725,"server_id":15,"link":"photo_5913732.html","width":130,"caption":"","height":171});
															thumbnails[5913730] = clik.newPhoto({"id":5913730,"src":"TimeProcessSmall_thumb.jpg","galleries_id":333725,"server_id":15,"link":"photo_5913730.html","width":130,"caption":"","height":185});
															thumbnails[5913726] = clik.newPhoto({"id":5913726,"src":"millfield98_thumb.jpg","galleries_id":333725,"server_id":15,"link":"photo_5913726.html","width":130,"caption":"","height":191});
															thumbnails[5913725] = clik.newPhoto({"id":5913725,"src":"millfield92_thumb.jpg","galleries_id":333725,"server_id":15,"link":"photo_5913725.html","width":130,"caption":"","height":91});
															thumbnails[5913721] = clik.newPhoto({"id":5913721,"src":"hampshire_thumb.jpg","galleries_id":333725,"server_id":15,"link":"photo_5913721.html","width":130,"caption":"","height":52});
															thumbnails[5913729] = clik.newPhoto({"id":5913729,"src":"spectator_small_thumb.jpg","galleries_id":333725,"server_id":15,"link":"photo_5913729.html","width":130,"caption":"","height":231});
															thumbnails[5913728] = clik.newPhoto({"id":5913728,"src":"pleasure_thumb.jpg","galleries_id":333725,"server_id":15,"link":"photo_5913728.html","width":130,"caption":"","height":374});
															thumbnails[6300587] = clik.newPhoto({"id":6300587,"src":"JaneHedges-1_thumb.jpg","galleries_id":349500,"server_id":15,"link":"photo_6300587.html","width":130,"caption":"Medina Marrakech<br>\r\nAcrylic on Canvas<br>\r\n120x120cms","height":130});
															thumbnails[6300594] = clik.newPhoto({"id":6300594,"src":"JaneHedges-2_thumb.jpg","galleries_id":349500,"server_id":15,"link":"photo_6300594.html","width":130,"caption":"Summer Shower<br>\r\nAcrylic on Canvas<br>\r\n122x91cms","height":177});
															thumbnails[6300610] = clik.newPhoto({"id":6300610,"src":"JaneHedges-3_thumb.jpg","galleries_id":349500,"server_id":15,"link":"photo_6300610.html","width":130,"caption":"Evening Durweston<br>\r\nAcrylic on Canvas<br>\r\n77x77cms","height":130});
															thumbnails[6300614] = clik.newPhoto({"id":6300614,"src":"JaneHedges-4_thumb.jpg","galleries_id":349500,"server_id":15,"link":"photo_6300614.html","width":130,"caption":"Summer Garden.<br>\r\nAcrylic on Canvas<br>\r\n87x77cms","height":147});
															thumbnails[6300657] = clik.newPhoto({"id":6300657,"src":"JaneHedges-5_thumb.jpg","galleries_id":349500,"server_id":15,"link":"photo_6300657.html","width":130,"caption":"Valley Mist<br>\r\nAcrylic on Canvas<br>\r\n70x90cms","height":101});
															thumbnails[6300665] = clik.newPhoto({"id":6300665,"src":"JaneHedges-6_thumb.jpg","galleries_id":349500,"server_id":15,"link":"photo_6300665.html","width":130,"caption":"Saadi Madrasa<br>\r\nAcrylic on Canvas<br>\r\n30x30cms","height":129});
															thumbnails[6300667] = clik.newPhoto({"id":6300667,"src":"JaneHedges-7_thumb.jpg","galleries_id":349500,"server_id":15,"link":"photo_6300667.html","width":130,"caption":"Little Goyle Winter<br>\r\nAcrylic on Canvas<br>\r\n90x70cms","height":169});
															thumbnails[6300677] = clik.newPhoto({"id":6300677,"src":"JaneHedges-8_thumb.jpg","galleries_id":349500,"server_id":15,"link":"photo_6300677.html","width":130,"caption":"Towards Penn Farm<br>\r\nAcrylic on Canvas<br>\r\n90x70cms","height":170});
															thumbnails[6300682] = clik.newPhoto({"id":6300682,"src":"JaneHedges-9_thumb.jpg","galleries_id":349500,"server_id":15,"link":"photo_6300682.html","width":130,"caption":"Dabachi Marrakech<br>\r\nAcrylic on Canvas<br>\r\n30x30cms","height":131});
															thumbnails[6300684] = clik.newPhoto({"id":6300684,"src":"JaneHedges-10_thumb.jpg","galleries_id":349500,"server_id":15,"link":"photo_6300684.html","width":130,"caption":"Marrakech Palace<br>\r\nAcrylic on Canvas<br>\r\n30x30cms","height":129});
															thumbnails[6300687] = clik.newPhoto({"id":6300687,"src":"JaneHedges-11_thumb.jpg","galleries_id":349500,"server_id":15,"link":"photo_6300687.html","width":130,"caption":"Dabachi Marrakech","height":130});
															thumbnails[6300688] = clik.newPhoto({"id":6300688,"src":"JaneHedges-12_thumb.jpg","galleries_id":349500,"server_id":15,"link":"photo_6300688.html","width":130,"caption":"Marrakech Palace","height":132});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[333725] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Archive","link":"section399709.html","maxRecords":0.0,"photoIDs":[6085109.0,5913718.0,5913732.0,5913730.0,5913726.0,5913725.0,5913721.0,5913729.0,5913728.0],"skipIndex":0,"section_code":"section399709","featured_images":"6085109,5913732,5913730,5913729,5913728,5913726,5913725,5913721,5913718","id":333725,"singleSection":true});				  						galleries[349500] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Jane Hedges Paintings","link":"section417211.html","maxRecords":0.0,"photoIDs":[6300587.0,6300594.0,6300610.0,6300614.0,6300657.0,6300665.0,6300667.0,6300677.0,6300682.0,6300684.0,6300687.0,6300688.0],"skipIndex":0,"section_code":"section417211","featured_images":"6300688,6300687,6300684,6300682,6300677,6300667,6300665,6300657,6300614,6300610","id":349500,"singleSection":true});				  						galleries[254135] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Large Cast Sculptures","link":"gallery_254135.html","maxRecords":0.0,"photoIDs":[4781818.0,4781819.0,4781829.0,4781831.0,4781850.0,4312525.0,4312564.0,4312513.0,4312522.0,4312562.0,4312548.0,4312567.0],"skipIndex":0,"section_code":"gallery","featured_images":"4781850,4781831,4781829,4781819,4781818,4312567,4312564,4312562,4312548,4312525","id":254135,"singleSection":false});				  						galleries[254180] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Bronze","link":"gallery_254180.html","maxRecords":0.0,"photoIDs":[4312541.0,4781810.0,4781825.0,4781834.0,4781836.0,4781847.0,4781848.0,4781849.0,4781826.0,4312535.0,4781833.0,4312536.0,4781835.0],"skipIndex":0,"section_code":"gallery","featured_images":"4781849,4781848,4781847,4781836,4781835,4781834,4781833,4781826,4781825,4781810","id":254180,"singleSection":false});				  						galleries[254179] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Mixed Media","link":"gallery_254179.html","maxRecords":0.0,"photoIDs":[4781821.0,4781822.0,4312560.0,4312537.0,4312561.0,4312553.0,4312554.0,4312534.0,4312547.0,4312549.0,4312551.0],"skipIndex":0,"section_code":"gallery","featured_images":"4781822,4781821,4312561,4312560,4312554,4312553,4312551,4312549,4312547,4312537","id":254179,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[236432] = '6300688,6300687,6300684,6300682,6300677,6300667,6300665,6300657,6300614,6300610,6300594,6300587';
imageSets[1] = '4508142,4781826,4508143,4781833,4508144,4781835';
imageSets[3] = '4312541,4312535,4312536';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/ianmiddleton/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/ianmiddleton/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/ianmiddleton/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/ianmiddleton/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/ianmiddleton/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/ianmiddleton/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/ianmiddleton/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/ianmiddleton/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/ianmiddleton/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/ianmiddleton/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/ianmiddleton/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/ianmiddleton/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/ianmiddleton/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/ianmiddleton/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/ianmiddleton/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/ianmiddleton/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/ianmiddleton/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/ianmiddleton/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/ianmiddleton/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/ianmiddleton/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/ianmiddleton/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/ianmiddleton/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/ianmiddleton/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/ianmiddleton/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/ianmiddleton/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/ianmiddleton/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/ianmiddleton/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 = 'Ian Middleton :: Sculpture: ' + 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 !== '' || 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;
	}
}

			

