window.thumbnails = {};
															thumbnails[8880259] = clik.newPhoto({"id":8880259,"src":"034_opt_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"A typical garden stone created by Ruth Wilkinson","height":98});
															thumbnails[2121481] = clik.newPhoto({"id":2121481,"src":"61_thumb.jpg","galleries_id":141120,"server_id":32,"link":"photo_2121481.html","width":130,"caption":"Ravenna","height":107});
															thumbnails[2121537] = clik.newPhoto({"id":2121537,"src":"8_thumb.jpg","galleries_id":141119,"server_id":32,"link":"photo_2121537.html","width":130,"caption":"Kairl","height":195});
															thumbnails[5652772] = clik.newPhoto({"id":5652772,"src":"IMG_6224_thumb.jpg","galleries_id":141119,"server_id":32,"link":"photo_5652772.html","width":130,"caption":"Anjuna","height":130});
															thumbnails[5652783] = clik.newPhoto({"id":5652783,"src":"IMG_6226_thumb.jpg","galleries_id":141119,"server_id":32,"link":"photo_5652783.html","width":130,"caption":"Indian cussion","height":130});
															thumbnails[5652817] = clik.newPhoto({"id":5652817,"src":"IMG_6946_thumb.jpg","galleries_id":141119,"server_id":32,"link":"photo_5652817.html","width":130,"caption":"Indian wedding dress","height":195});
															thumbnails[5652821] = clik.newPhoto({"id":5652821,"src":"IMG_6228_thumb.jpg","galleries_id":141119,"server_id":32,"link":"photo_5652821.html","width":130,"caption":"Carpet design","height":208});
															thumbnails[5652828] = clik.newPhoto({"id":5652828,"src":"_earth_and_wind_thumb.jpg","galleries_id":320235,"server_id":32,"link":"photo_5652828.html","width":130,"caption":"The Four Elements","height":130});
															thumbnails[5652837] = clik.newPhoto({"id":5652837,"src":"IMG_6230_thumb.jpg","galleries_id":320229,"server_id":32,"link":"photo_5652837.html","width":130,"caption":"","height":130});
															thumbnails[5652839] = clik.newPhoto({"id":5652839,"src":"IMG_6232_thumb.jpg","galleries_id":320229,"server_id":32,"link":"photo_5652839.html","width":130,"caption":"","height":130});
															thumbnails[5652846] = clik.newPhoto({"id":5652846,"src":"IMG_6234_thumb.jpg","galleries_id":320229,"server_id":32,"link":"photo_5652846.html","width":130,"caption":"","height":130});
															thumbnails[5762965] = clik.newPhoto({"id":5762965,"src":"IMG_8598_thumb.jpg","galleries_id":141118,"server_id":32,"link":"photo_5762965.html","width":130,"caption":"","height":182});
															thumbnails[5762968] = clik.newPhoto({"id":5762968,"src":"IMG_8600_thumb.jpg","galleries_id":141121,"server_id":32,"link":"photo_5762968.html","width":130,"caption":"Peacock","height":182});
															thumbnails[5762970] = clik.newPhoto({"id":5762970,"src":"IMG_8602_thumb.jpg","galleries_id":141121,"server_id":32,"link":"photo_5762970.html","width":130,"caption":"Peacock feather","height":182});
															thumbnails[5762973] = clik.newPhoto({"id":5762973,"src":"IMG_8604_thumb.jpg","galleries_id":141119,"server_id":32,"link":"photo_5762973.html","width":130,"caption":"Yellow material","height":182});
															thumbnails[6705015] = clik.newPhoto({"id":6705015,"src":"mosaic1_thumb.jpg","galleries_id":141118,"server_id":32,"link":"photo_6705015.html","width":130,"caption":"Marble Inlay","height":76});
															thumbnails[6705115] = clik.newPhoto({"id":6705115,"src":"mosaic3_thumb.jpg","galleries_id":141118,"server_id":32,"link":"photo_6705115.html","width":130,"caption":"Taj Mahal ","height":208});
															thumbnails[6705307] = clik.newPhoto({"id":6705307,"src":"mosaics_thumb.jpg","galleries_id":141119,"server_id":32,"link":"photo_6705307.html","width":130,"caption":"Blue Material","height":130});
															thumbnails[9120483] = clik.newPhoto({"id":9120483,"src":"033_2_thumb.JPG","galleries_id":320229,"server_id":32,"link":"photo_9120483.html","width":130,"caption":"A Roman mosaic designed for a commission","height":98});
															thumbnails[9120513] = clik.newPhoto({"id":9120513,"src":"028_1_thumb.JPG","galleries_id":320229,"server_id":32,"link":"photo_9120513.html","width":130,"caption":"close-up of finished piece","height":98});
															thumbnails[9120526] = clik.newPhoto({"id":9120526,"src":"027_1_thumb.JPG","galleries_id":320229,"server_id":32,"link":"photo_9120526.html","width":130,"caption":"close-up of finished piece","height":98});
															thumbnails[9120634] = clik.newPhoto({"id":9120634,"src":"mirror_1_thumb.jpg","galleries_id":481302,"server_id":32,"link":"photo_9120634.html","width":130,"caption":"Indian style mirror","height":125});
															thumbnails[2099213] = clik.newPhoto({"id":2099213,"src":"weba_thumb.jpg","galleries_id":141121,"server_id":32,"link":"photo_2099213.html","width":130,"caption":"Peacock","height":195});
															thumbnails[2099226] = clik.newPhoto({"id":2099226,"src":"web10_thumb.jpg","galleries_id":141119,"server_id":32,"link":"photo_2099226.html","width":130,"caption":"Anjuna 2","height":130});
															thumbnails[2121180] = clik.newPhoto({"id":2121180,"src":"1_thumb.jpg","galleries_id":141118,"server_id":32,"link":"photo_2121180.html","width":130,"caption":"Dragon","height":130});
															thumbnails[2121195] = clik.newPhoto({"id":2121195,"src":"2_thumb.jpg","galleries_id":141118,"server_id":32,"link":"photo_2121195.html","width":130,"caption":"Phoenix","height":130});
															thumbnails[2398124] = clik.newPhoto({"id":2398124,"src":"Ruth Mosaic 1_thumb.jpg","galleries_id":141121,"server_id":32,"link":"photo_2398124.html","width":130,"caption":"Peacock feathers","height":121});
															thumbnails[2099216] = clik.newPhoto({"id":2099216,"src":"web19_thumb.jpg","galleries_id":141121,"server_id":32,"link":"photo_2099216.html","width":130,"caption":"Peacock","height":150});
															thumbnails[2099228] = clik.newPhoto({"id":2099228,"src":"web8_thumb.jpg","galleries_id":141118,"server_id":32,"link":"photo_2099228.html","width":130,"caption":"Cordoba","height":195});
															thumbnails[2121473] = clik.newPhoto({"id":2121473,"src":"3_thumb.jpg","galleries_id":141118,"server_id":32,"link":"photo_2121473.html","width":130,"caption":"Gold Tile","height":130});
															thumbnails[2121474] = clik.newPhoto({"id":2121474,"src":"4_thumb.jpg","galleries_id":141118,"server_id":32,"link":"photo_2121474.html","width":130,"caption":"Blue Tile","height":130});
															thumbnails[2121477] = clik.newPhoto({"id":2121477,"src":"5_thumb.jpg","galleries_id":141118,"server_id":32,"link":"photo_2121477.html","width":130,"caption":"Green Tile","height":130});
															thumbnails[2130293] = clik.newPhoto({"id":2130293,"src":"IMG_5851_thumb.jpg","galleries_id":141118,"server_id":32,"link":"photo_2130293.html","width":130,"caption":"Facade","height":358});
															thumbnails[9120507] = clik.newPhoto({"id":9120507,"src":"021_2_thumb.JPG","galleries_id":320229,"server_id":32,"link":"photo_9120507.html","width":130,"caption":"close-up of the finished piece","height":173});
															thumbnails[9120582] = clik.newPhoto({"id":9120582,"src":"030_1_thumb.JPG","galleries_id":320229,"server_id":32,"link":"photo_9120582.html","width":130,"caption":"close-up of finished piece","height":98});
															thumbnails[9120603] = clik.newPhoto({"id":9120603,"src":"031_1_thumb.JPG","galleries_id":320229,"server_id":32,"link":"photo_9120603.html","width":130,"caption":"close-up of the finished piece","height":98});
															thumbnails[9120630] = clik.newPhoto({"id":9120630,"src":"mosaic5_1_thumb.jpg","galleries_id":141119,"server_id":32,"link":"photo_9120630.html","width":130,"caption":"Green material","height":260});
															thumbnails[9120635] = clik.newPhoto({"id":9120635,"src":"mosaic4_1_thumb.jpg","galleries_id":141118,"server_id":32,"link":"photo_9120635.html","width":130,"caption":"Marble inlay design","height":338});
															thumbnails[5659854] = clik.newPhoto({"id":5659854,"src":"1_6C2320D1-1D09-001F-99075862AD28C643_thumb.jpg","galleries_id":320594,"server_id":32,"link":"photo_5659854.html","width":130,"caption":"Victorian Floor","height":81});
															thumbnails[5762975] = clik.newPhoto({"id":5762975,"src":"IMG_8611_thumb.jpg","galleries_id":320597,"server_id":32,"link":"photo_5762975.html","width":130,"caption":"Decorative stone","height":182});
															thumbnails[5762998] = clik.newPhoto({"id":5762998,"src":"IMG_4360_thumb.jpg","galleries_id":320597,"server_id":32,"link":"photo_5762998.html","width":130,"caption":"Decorative stone","height":195});
															thumbnails[5762999] = clik.newPhoto({"id":5762999,"src":"IMG_4344_thumb.jpg","galleries_id":320594,"server_id":32,"link":"photo_5762999.html","width":130,"caption":" Doorstop","height":195});
															thumbnails[5763048] = clik.newPhoto({"id":5763048,"src":"IMG_4346_thumb.jpg","galleries_id":320594,"server_id":32,"link":"photo_5763048.html","width":130,"caption":"Doorstop","height":87});
															thumbnails[5763101] = clik.newPhoto({"id":5763101,"src":"IMG_4347_thumb.jpg","galleries_id":320594,"server_id":32,"link":"photo_5763101.html","width":130,"caption":"Doorstop","height":195});
															thumbnails[6152045] = clik.newPhoto({"id":6152045,"src":"Cooker_splashback_in_situ_thumb.jpg","galleries_id":320594,"server_id":32,"link":"photo_6152045.html","width":130,"caption":"Splashback","height":76});
															thumbnails[6152046] = clik.newPhoto({"id":6152046,"src":"Cooker_Splash_Back_thumb.jpg","galleries_id":320594,"server_id":32,"link":"photo_6152046.html","width":130,"caption":"Splash back","height":87});
															thumbnails[6153025] = clik.newPhoto({"id":6153025,"src":"1_36784B12-1D09-001F-99B27C04272CAC6B_thumb.jpg","galleries_id":320594,"server_id":32,"link":"photo_6153025.html","width":130,"caption":"","height":130});
															thumbnails[6153028] = clik.newPhoto({"id":6153028,"src":"2_3678BEF9-1D09-001F-99C40179F78E6AA8_thumb.jpg","galleries_id":320594,"server_id":32,"link":"photo_6153028.html","width":130,"caption":"","height":130});
															thumbnails[6153029] = clik.newPhoto({"id":6153029,"src":"3_36792BFC-1D09-001F-998893BD0F9FE8CD_thumb.jpg","galleries_id":320594,"server_id":32,"link":"photo_6153029.html","width":130,"caption":"","height":130});
															thumbnails[6153031] = clik.newPhoto({"id":6153031,"src":"4_3679A189-1D09-001F-999EAE22EF3D677F_thumb.jpg","galleries_id":320594,"server_id":32,"link":"photo_6153031.html","width":130,"caption":"","height":130});
															thumbnails[6153033] = clik.newPhoto({"id":6153033,"src":"5_367A08CF-1D09-001F-99F56683C47A8859_thumb.jpg","galleries_id":320594,"server_id":32,"link":"photo_6153033.html","width":130,"caption":"","height":130});
															thumbnails[6705023] = clik.newPhoto({"id":6705023,"src":"mirror_thumb.jpg","galleries_id":320594,"server_id":32,"link":"photo_6705023.html","width":130,"caption":"Mirror","height":125});
															thumbnails[2398110] = clik.newPhoto({"id":2398110,"src":"Castle Mosaic 1b Final lo res_thumb.jpg","galleries_id":155460,"server_id":32,"link":"photo_2398110.html","width":130,"caption":"","height":130});
															thumbnails[2398112] = clik.newPhoto({"id":2398112,"src":"ruth2_thumb.jpg","galleries_id":155460,"server_id":32,"link":"photo_2398112.html","width":130,"caption":"","height":98});
															thumbnails[2398114] = clik.newPhoto({"id":2398114,"src":"ruth1_thumb.jpg","galleries_id":155460,"server_id":32,"link":"photo_2398114.html","width":130,"caption":"","height":163});
															thumbnails[2398116] = clik.newPhoto({"id":2398116,"src":"Overton Sheep Launch 6 - Media_thumb.jpg","galleries_id":155462,"server_id":32,"link":"photo_2398116.html","width":130,"caption":"","height":130});
															thumbnails[2398118] = clik.newPhoto({"id":2398118,"src":"PICT0068_thumb.jpg","galleries_id":155462,"server_id":32,"link":"photo_2398118.html","width":130,"caption":"","height":196});
															thumbnails[2398119] = clik.newPhoto({"id":2398119,"src":"PICT0201_thumb.jpg","galleries_id":155462,"server_id":32,"link":"photo_2398119.html","width":130,"caption":"","height":104});
															thumbnails[2398122] = clik.newPhoto({"id":2398122,"src":"PICT0025_thumb.jpg","galleries_id":155460,"server_id":32,"link":"photo_2398122.html","width":130,"caption":"","height":87});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[320235] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Abstract ","link":"gallery_320235.html","maxRecords":0.0,"photoIDs":[5652828.0],"skipIndex":0,"section_code":"gallery","featured_images":5652828.0,"id":320235,"singleSection":false});				  						galleries[141119] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Asian Textile","link":"gallery_141119.html","maxRecords":0.0,"photoIDs":[2121537.0,5652772.0,5652783.0,5652817.0,5652821.0,5762973.0,6705307.0,2099226.0,9120630.0],"skipIndex":0,"section_code":"gallery","featured_images":"6705307,5652817,5652772,2121537,2099226","id":141119,"singleSection":false});				  						galleries[141120] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Byzantine","link":"gallery_141120.html","maxRecords":0.0,"photoIDs":[2121481.0],"skipIndex":0,"section_code":"gallery","featured_images":2121481.0,"id":141120,"singleSection":false});				  						galleries[320597] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Exteriors","link":"section383961_320597.html","maxRecords":0.0,"photoIDs":[5762975.0,5762998.0],"skipIndex":0,"section_code":"section383961","featured_images":"5762998,5762975","id":320597,"singleSection":false});				  						galleries[320594] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Interiors","link":"section383961_320594.html","maxRecords":0.0,"photoIDs":[5659854.0,5762999.0,5763048.0,5763101.0,6152045.0,6152046.0,6153025.0,6153028.0,6153029.0,6153031.0,6153033.0,6705023.0],"skipIndex":0,"section_code":"section383961","featured_images":"6705023,6152046,5659854","id":320594,"singleSection":false});				  						galleries[141118] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Islamic","link":"gallery_141118.html","maxRecords":0.0,"photoIDs":[5762965.0,6705015.0,6705115.0,2121180.0,2121195.0,2099228.0,2121473.0,2121474.0,2121477.0,2130293.0,9120635.0],"skipIndex":0,"section_code":"gallery","featured_images":"6705115,6705015,5762965,2099228","id":141118,"singleSection":false});				  						galleries[155460] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Knaresborough Castle","link":"section182641_155460.html","maxRecords":0.0,"photoIDs":[2398110.0,2398112.0,2398114.0,2398122.0],"skipIndex":0,"section_code":"section182641","featured_images":"2398122,2398114,2398112,2398110","id":155460,"singleSection":false});				  						galleries[155462] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Overton Sheep Project","link":"section182641_155462.html","maxRecords":0.0,"photoIDs":[2398116.0,2398118.0,2398119.0],"skipIndex":0,"section_code":"section182641","featured_images":"2398119,2398118,2398116","id":155462,"singleSection":false});				  						galleries[141121] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Peacock","link":"gallery_141121.html","maxRecords":0.0,"photoIDs":[5762968.0,5762970.0,2099213.0,2398124.0,2099216.0],"skipIndex":0,"section_code":"gallery","featured_images":"5762970,5762968,2398124,2099216,2099213","id":141121,"singleSection":false});				  						galleries[320229] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Roman Style","link":"gallery_320229.html","maxRecords":0.0,"photoIDs":[5652837.0,5652839.0,5652846.0,9120483.0,9120513.0,9120526.0,9120507.0,9120582.0,9120603.0],"skipIndex":0,"section_code":"gallery","featured_images":"9120603,9120582,9120526,9120513,9120507,9120483,5652846,5652839,5652837","id":320229,"singleSection":false});				  						galleries[481302] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Mirrors","link":"gallery_481302.html","maxRecords":0.0,"photoIDs":[9120634.0],"skipIndex":0,"section_code":"gallery","featured_images":9120634.0,"id":481302,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '6705307,6705115,6705015,6152046,5762973,5762970,5762968,5762965,5659854,5652828,5652817,5652783,5652772,2121537,2121481,2099226,2099213,2398124,2099228,2099216';
imageSets[2] = '6705307,6705115,6705023,6705015,6152046,5762970,5762968,5762965,5659854,5652828,5652817,5652772,2121537,2121481,2099226,2099213,2398124,2099228,2099216';
imageSets[3] = '6153033,6153031,6153029,6153028,6153025,6152045,5763101,5763048,5762999,5762998,5762975,5659854,5652846,5652839,5652837,5652821,2398122,2398119,2398118,2398116,2398114,2398112,2398110,2121473,2121474,2121477,2130293';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/Ruthwilkinson1/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/Ruthwilkinson1/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/Ruthwilkinson1/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/Ruthwilkinson1/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/Ruthwilkinson1/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/Ruthwilkinson1/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/Ruthwilkinson1/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/Ruthwilkinson1/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/Ruthwilkinson1/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/Ruthwilkinson1/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/Ruthwilkinson1/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/Ruthwilkinson1/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/Ruthwilkinson1/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/Ruthwilkinson1/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/Ruthwilkinson1/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/Ruthwilkinson1/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/Ruthwilkinson1/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/Ruthwilkinson1/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/Ruthwilkinson1/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/Ruthwilkinson1/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/Ruthwilkinson1/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/Ruthwilkinson1/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/Ruthwilkinson1/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/Ruthwilkinson1/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/Ruthwilkinson1/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/Ruthwilkinson1/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/Ruthwilkinson1/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 = 'Ruth Wilkinson Mosaics: ' + 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;
	}
}

			

