window.thumbnails = {};
															thumbnails[756355] = clik.newPhoto({"id":756355,"src":"tendril_thumb.jpg","galleries_id":58462,"server_id":18,"link":"photo_756355.html","width":130,"caption":"Tendril","height":125});
															thumbnails[756362] = clik.newPhoto({"id":756362,"src":"stoneelephant_thumb.jpg","galleries_id":58462,"server_id":18,"link":"photo_756362.html","width":130,"caption":"Stone Elephant","height":93});
															thumbnails[756363] = clik.newPhoto({"id":756363,"src":"skarawall_thumb.jpg","galleries_id":58462,"server_id":18,"link":"photo_756363.html","width":130,"caption":"Skara Brae Wall","height":88});
															thumbnails[756366] = clik.newPhoto({"id":756366,"src":"LaceScarf_thumb.jpg","galleries_id":58462,"server_id":18,"link":"photo_756366.html","width":130,"caption":"Toned Cyanotype Scarf","height":90});
															thumbnails[756368] = clik.newPhoto({"id":756368,"src":"CyanoScarves_thumb.jpg","galleries_id":58462,"server_id":18,"link":"photo_756368.html","width":130,"caption":"Collection of cyanotype scarves","height":87});
															thumbnails[756370] = clik.newPhoto({"id":756370,"src":"bacchus_thumb.jpg","galleries_id":58462,"server_id":18,"link":"photo_756370.html","width":130,"caption":"Bacchus","height":198});
															thumbnails[756372] = clik.newPhoto({"id":756372,"src":"YoungFern_thumb.jpg","galleries_id":58462,"server_id":18,"link":"photo_756372.html","width":130,"caption":"Young Fern","height":129});
															thumbnails[756376] = clik.newPhoto({"id":756376,"src":"pollenation1_thumb.jpg","galleries_id":58462,"server_id":18,"link":"photo_756376.html","width":130,"caption":"Pollenation","height":130});
															thumbnails[756377] = clik.newPhoto({"id":756377,"src":"narcisuss_thumb.jpg","galleries_id":58462,"server_id":18,"link":"photo_756377.html","width":130,"caption":"Narcissus","height":130});
															thumbnails[756379] = clik.newPhoto({"id":756379,"src":"drip_thumb.jpg","galleries_id":58462,"server_id":18,"link":"photo_756379.html","width":130,"caption":"Drip","height":86});
															thumbnails[756380] = clik.newPhoto({"id":756380,"src":"crocus_thumb.jpg","galleries_id":58462,"server_id":18,"link":"photo_756380.html","width":130,"caption":"Crocus","height":86});
															thumbnails[756387] = clik.newPhoto({"id":756387,"src":"CalifornianPoppy_thumb.jpg","galleries_id":58462,"server_id":18,"link":"photo_756387.html","width":130,"caption":"Californian Poppy","height":86});
															thumbnails[1227364] = clik.newPhoto({"id":1227364,"src":"turtledove_thumb.jpg","galleries_id":88531,"server_id":18,"link":"photo_1227364.html","width":130,"caption":"Harry Turtledove <br>\r\n","height":130});
															thumbnails[1227366] = clik.newPhoto({"id":1227366,"src":"moon_thumb.jpg","galleries_id":88531,"server_id":18,"link":"photo_1227366.html","width":130,"caption":"Elizabeth Moon","height":142});
															thumbnails[1227369] = clik.newPhoto({"id":1227369,"src":"miller_thumb.jpg","galleries_id":88531,"server_id":18,"link":"photo_1227369.html","width":130,"caption":"Deborah J Miller","height":162});
															thumbnails[1227376] = clik.newPhoto({"id":1227376,"src":"Macleod_thumb.jpg","galleries_id":88531,"server_id":18,"link":"photo_1227376.html","width":130,"caption":"Ken Macleod","height":205});
															thumbnails[1227378] = clik.newPhoto({"id":1227378,"src":"butlin_thumb.jpg","galleries_id":88531,"server_id":18,"link":"photo_1227378.html","width":130,"caption":"Ron Butlin","height":167});
															thumbnails[1227381] = clik.newPhoto({"id":1227381,"src":"banks_thumb1.jpg","galleries_id":88531,"server_id":18,"link":"photo_1227381.html","width":130,"caption":"Iain M Banks","height":134});
															thumbnails[1574320] = clik.newPhoto({"id":1574320,"src":"maple_thumb.jpg","galleries_id":58462,"server_id":18,"link":"photo_1574320.html","width":130,"caption":"Maple tree in Branklyn Garden Perth","height":87});
															thumbnails[1574321] = clik.newPhoto({"id":1574321,"src":"pufballs_thumb.jpg","galleries_id":58462,"server_id":18,"link":"photo_1574321.html","width":130,"caption":"Puffball fungus in the Hermitage of Dunkeld","height":87});
															thumbnails[1574323] = clik.newPhoto({"id":1574323,"src":"beech_thumb.jpg","galleries_id":58462,"server_id":18,"link":"photo_1574323.html","width":130,"caption":"Beech tree in the Hermitage of Dunkeld","height":87});
															thumbnails[4363980] = clik.newPhoto({"id":4363980,"src":"aaa_book_cover_thumb.jpg","galleries_id":256468,"server_id":18,"link":"photo_4363980.html","width":130,"caption":"Alba ad Astra booklet","height":186});
															thumbnails[2557449] = clik.newPhoto({"id":2557449,"src":"nonstop_ponics_2_thumb.jpg","galleries_id":163354,"server_id":18,"link":"photo_2557449.html","width":130,"caption":"Non-stop ponics [digital print 2008, edition of 1]","height":182});
															thumbnails[2557457] = clik.newPhoto({"id":2557457,"src":"greenchildskin4_thumb.jpg","galleries_id":163354,"server_id":18,"link":"photo_2557457.html","width":130,"caption":"Siloën’s arm <br>\r\n[digital print 2008, edition of 1]<br>\r\n","height":182});
															thumbnails[4497183] = clik.newPhoto({"id":4497183,"src":"plate_1a_thumb.jpg","galleries_id":256468,"server_id":18,"link":"photo_4497183.html","width":130,"caption":"Plate No 1","height":93});
															thumbnails[2557459] = clik.newPhoto({"id":2557459,"src":"eyeballthing3_thumb.jpg","galleries_id":163354,"server_id":18,"link":"photo_2557459.html","width":130,"caption":"A terrible, indescribable thing <br>\r\n[digital print 2008, edition of 1]<br>\r\n","height":173});
															thumbnails[4497186] = clik.newPhoto({"id":4497186,"src":"plate_2_thumb.jpg","galleries_id":256468,"server_id":18,"link":"photo_4497186.html","width":130,"caption":"Plate No 2","height":93});
															thumbnails[1573684] = clik.newPhoto({"id":1573684,"src":"finished_thumb.jpg","galleries_id":58574,"server_id":18,"link":"photo_1573684.html","width":130,"caption":"Nuno scarves in autumn colours","height":52});
															thumbnails[2557452] = clik.newPhoto({"id":2557452,"src":"abandoned-manhattan_thumb.jpg","galleries_id":163354,"server_id":18,"link":"photo_2557452.html","width":130,"caption":"Abandoned Manhattan  [digital print 2008, edition of 1]","height":182});
															thumbnails[4497189] = clik.newPhoto({"id":4497189,"src":"plate_3_thumb.jpg","galleries_id":256468,"server_id":18,"link":"photo_4497189.html","width":130,"caption":"Plate No 3","height":93});
															thumbnails[1573688] = clik.newPhoto({"id":1573688,"src":"detail_orange_thumb.jpg","galleries_id":58574,"server_id":18,"link":"photo_1573688.html","width":130,"caption":"Detail of sunset scarf","height":173});
															thumbnails[2557447] = clik.newPhoto({"id":2557447,"src":"Bhelsheved_paving-_thumb.jpg","galleries_id":163354,"server_id":18,"link":"photo_2557447.html","width":130,"caption":"Bhelsheved paving <br>\r\n[digital print 2008, edition of 1]","height":182});
															thumbnails[4497308] = clik.newPhoto({"id":4497308,"src":"plate_4_thumb.jpg","galleries_id":256468,"server_id":18,"link":"photo_4497308.html","width":130,"caption":"Plate No 4","height":182});
															thumbnails[1573695] = clik.newPhoto({"id":1573695,"src":"detail_dark_green_thumb.jpg","galleries_id":58574,"server_id":18,"link":"photo_1573695.html","width":130,"caption":"Detail of forest floor scarf","height":92});
															thumbnails[2557548] = clik.newPhoto({"id":2557548,"src":"inverted_world_thumb.jpg","galleries_id":163354,"server_id":18,"link":"photo_2557548.html","width":130,"caption":"Helward’s world [hand-knitted wool, 2008]<br>\r\n","height":173});
															thumbnails[4497315] = clik.newPhoto({"id":4497315,"src":"plate_5_thumb.jpg","galleries_id":256468,"server_id":18,"link":"photo_4497315.html","width":130,"caption":"Plate No 5","height":87});
															thumbnails[1455255] = clik.newPhoto({"id":1455255,"src":"creamnuno_thumb.jpg","galleries_id":58574,"server_id":18,"link":"photo_1455255.html","width":130,"caption":"Cream nuno felt scarf","height":151});
															thumbnails[2557517] = clik.newPhoto({"id":2557517,"src":"paperskin_scan_thumb.jpg","galleries_id":163354,"server_id":18,"link":"photo_2557517.html","width":130,"caption":"Paper skin <br>\r\n[solvent transfer monoprint 2008]<br>\r\n","height":96});
															thumbnails[4497318] = clik.newPhoto({"id":4497318,"src":"plate_6_thumb.jpg","galleries_id":256468,"server_id":18,"link":"photo_4497318.html","width":130,"caption":"Plate No 6","height":87});
															thumbnails[623461] = clik.newPhoto({"id":623461,"src":"cream_bowl_thumb.jpg","galleries_id":58574,"server_id":18,"link":"photo_623461.html","width":130,"caption":"Orkney bowl","height":88});
															thumbnails[2557521] = clik.newPhoto({"id":2557521,"src":"martian_lichen4_thumb.jpg","galleries_id":163354,"server_id":18,"link":"photo_2557521.html","width":130,"caption":"Martian lichen [digital print 2008, edition of 1]","height":93});
															thumbnails[4497321] = clik.newPhoto({"id":4497321,"src":"plate_7_thumb.jpg","galleries_id":256468,"server_id":18,"link":"photo_4497321.html","width":130,"caption":"Plate No 7","height":195});
															thumbnails[623462] = clik.newPhoto({"id":623462,"src":"cream_pot_thumb.jpg","galleries_id":58574,"server_id":18,"link":"photo_623462.html","width":130,"caption":"Cream pot","height":91});
															thumbnails[2557526] = clik.newPhoto({"id":2557526,"src":"moondust2_thumb.jpg","galleries_id":163354,"server_id":18,"link":"photo_2557526.html","width":130,"caption":"Moon dust <br>\r\n[digital print 2008, edition of 1]<br>\r\n","height":93});
															thumbnails[4497324] = clik.newPhoto({"id":4497324,"src":"plate_8_thumb.jpg","galleries_id":256468,"server_id":18,"link":"photo_4497324.html","width":130,"caption":"Plate No 8","height":182});
															thumbnails[756346] = clik.newPhoto({"id":756346,"src":"BarkCoast_thumb.jpg","galleries_id":58462,"server_id":18,"link":"photo_756346.html","width":130,"caption":"Bark Coast","height":95});
															thumbnails[1455249] = clik.newPhoto({"id":1455249,"src":"bluenuno_thumb.jpg","galleries_id":58574,"server_id":18,"link":"photo_1455249.html","width":130,"caption":"Marine blue nuno felt scarf","height":139});
															thumbnails[2557529] = clik.newPhoto({"id":2557529,"src":"solaris6_thumb.jpg","galleries_id":163354,"server_id":18,"link":"photo_2557529.html","width":130,"caption":"Mimoid hyperproduction [digital print 2008, edition of 1]","height":93});
															thumbnails[4497335] = clik.newPhoto({"id":4497335,"src":"plate_9_thumb.jpg","galleries_id":256468,"server_id":18,"link":"photo_4497335.html","width":130,"caption":"Plate No 9","height":181});
															thumbnails[623464] = clik.newPhoto({"id":623464,"src":"marine_blues_bowl_thumb.jpg","galleries_id":58574,"server_id":18,"link":"photo_623464.html","width":130,"caption":"Marine bowl","height":78});
															thumbnails[756343] = clik.newPhoto({"id":756343,"src":"DarkLand_thumb.jpg","galleries_id":58462,"server_id":18,"link":"photo_756343.html","width":130,"caption":"Dark Land","height":95});
															thumbnails[2557532] = clik.newPhoto({"id":2557532,"src":"metal_salt_marsh_2_thumb.jpg","galleries_id":163354,"server_id":18,"link":"photo_2557532.html","width":130,"caption":"Metal salt marshes  [digital print 2008, edition of 1]","height":93});
															thumbnails[4497327] = clik.newPhoto({"id":4497327,"src":"plate_10_thumb.jpg","galleries_id":256468,"server_id":18,"link":"photo_4497327.html","width":130,"caption":"Plate No 10","height":195});
															thumbnails[623466] = clik.newPhoto({"id":623466,"src":"marine_blues_pot_thumb.jpg","galleries_id":58574,"server_id":18,"link":"photo_623466.html","width":130,"caption":"Marine Vase","height":149});
															thumbnails[756337] = clik.newPhoto({"id":756337,"src":"PastelKaleidoscope_thumb.jpg","galleries_id":58462,"server_id":18,"link":"photo_756337.html","width":130,"caption":"Pastel Kaleidoscope I","height":94});
															thumbnails[2557442] = clik.newPhoto({"id":2557442,"src":"blue_world_scan2_thumb.jpg","galleries_id":163354,"server_id":18,"link":"photo_2557442.html","width":130,"caption":"The blue world from space  [cyanotype and watercolour 2008]","height":130});
															thumbnails[4497345] = clik.newPhoto({"id":4497345,"src":"plate_11_thumb.jpg","galleries_id":256468,"server_id":18,"link":"photo_4497345.html","width":130,"caption":"Plate No 11","height":195});
															thumbnails[1455258] = clik.newPhoto({"id":1455258,"src":"pink-nuno_thumb.jpg","galleries_id":58574,"server_id":18,"link":"photo_1455258.html","width":130,"caption":"nuno felt scarf in pinks and purples","height":136});
															thumbnails[4497366] = clik.newPhoto({"id":4497366,"src":"plate_12_thumb.jpg","galleries_id":256468,"server_id":18,"link":"photo_4497366.html","width":130,"caption":"Plate No 12","height":183});
															thumbnails[1455340] = clik.newPhoto({"id":1455340,"src":"pinkmobius_thumb.jpg","galleries_id":58574,"server_id":18,"link":"photo_1455340.html","width":130,"caption":"Pink mobius basket","height":110});
															thumbnails[4497377] = clik.newPhoto({"id":4497377,"src":"plate_13_thumb.jpg","galleries_id":256468,"server_id":18,"link":"photo_4497377.html","width":130,"caption":"Plate No 13","height":93});
															thumbnails[1455342] = clik.newPhoto({"id":1455342,"src":"cellbrooch_thumb.jpg","galleries_id":58574,"server_id":18,"link":"photo_1455342.html","width":130,"caption":"Cell Brooch","height":130});
															thumbnails[4497383] = clik.newPhoto({"id":4497383,"src":"plate_14_thumb.jpg","galleries_id":256468,"server_id":18,"link":"photo_4497383.html","width":130,"caption":"Plate No 14","height":93});
															thumbnails[756342] = clik.newPhoto({"id":756342,"src":"NeoBenaiki_thumb.jpg","galleries_id":58462,"server_id":18,"link":"photo_756342.html","width":130,"caption":"Benaiki Gallery Athens","height":103});
															thumbnails[756338] = clik.newPhoto({"id":756338,"src":"OlivesAtSunset_thumb.jpg","galleries_id":58462,"server_id":18,"link":"photo_756338.html","width":130,"caption":"Olives at Sunset","height":105});
															thumbnails[757607] = clik.newPhoto({"id":757607,"src":"BlueDoor_thumb.jpg","galleries_id":58462,"server_id":18,"link":"photo_757607.html","width":130,"caption":"Blue Door, Athens","height":98});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[256468] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Alba ad Astra","link":"gallery_256468.html","maxRecords":0.0,"photoIDs":[4363980.0,4497183.0,4497186.0,4497189.0,4497308.0,4497315.0,4497318.0,4497321.0,4497324.0,4497335.0,4497327.0,4497345.0,4497366.0,4497377.0,4497383.0],"skipIndex":0,"section_code":"gallery","featured_images":"4497189,4363980","id":256468,"singleSection":false});				  						galleries[163354] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Alien Surfaces","link":"gallery_163354.html","maxRecords":0.0,"photoIDs":[2557449.0,2557457.0,2557459.0,2557452.0,2557447.0,2557548.0,2557517.0,2557521.0,2557526.0,2557529.0,2557532.0,2557442.0],"skipIndex":0,"section_code":"gallery","featured_images":"2557548,2557532,2557529,2557526,2557521,2557517,2557459,2557457,2557452,2557449","id":163354,"singleSection":false});				  						galleries[58574] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Felt work","link":"gallery_58574.html","maxRecords":0.0,"photoIDs":[1573684.0,1573688.0,1573695.0,1455255.0,623461.0,623462.0,1455249.0,623464.0,623466.0,1455258.0,1455340.0,1455342.0],"skipIndex":0,"section_code":"gallery","featured_images":"623466,623461","id":58574,"singleSection":false});				  						galleries[58462] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"General images","link":"gallery_58462.html","maxRecords":0.0,"photoIDs":[756355.0,756362.0,756363.0,756366.0,756368.0,756370.0,756372.0,756376.0,756377.0,756379.0,756380.0,756387.0,1574320.0,1574321.0,1574323.0,756346.0,756343.0,756337.0,756342.0,756338.0,757607.0],"skipIndex":0,"section_code":"gallery","featured_images":"756379,756342","id":58462,"singleSection":false});				  						galleries[88531] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Bestiary of Authors - Solvent Transfers","link":"gallery_88531.html","maxRecords":0.0,"photoIDs":[1227364.0,1227366.0,1227369.0,1227376.0,1227378.0,1227381.0],"skipIndex":0,"section_code":"gallery","featured_images":1227381.0,"id":88531,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '756380,756366,4497189,2557452,1573688,2557442';
imageSets[2] = '1227381,756379,4363980,4497189,623461,623466,756342';
imageSets[3] = '2557521,2557532,623464,2557442,1455340';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/madeleineshepherd/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/madeleineshepherd/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/madeleineshepherd/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/madeleineshepherd/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/madeleineshepherd/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/madeleineshepherd/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/madeleineshepherd/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/madeleineshepherd/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/madeleineshepherd/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/madeleineshepherd/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/madeleineshepherd/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/madeleineshepherd/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/madeleineshepherd/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/madeleineshepherd/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/madeleineshepherd/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/madeleineshepherd/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/madeleineshepherd/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/madeleineshepherd/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/madeleineshepherd/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/madeleineshepherd/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/madeleineshepherd/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/madeleineshepherd/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/madeleineshepherd/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/madeleineshepherd/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/madeleineshepherd/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/madeleineshepherd/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/madeleineshepherd/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 = 'Plum & Pepper Studio: ' + 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>';
	}
				
	temp += this.fnGetPaymentInfo();
				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>Buy now using PayPal:</p>';
				temp += '<div class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> &pound;' + (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.payment_groups_id !== '') {
		temp += '<p>Buy this print online:</p>';
				temp += '<form id="paymentOptions" style="margin:0px;border:0px;" name="paymentOptions">';
		 									temp += '<select class="paymentlink" name="payment_options_id" onchange="updateCartValue($(this.form).next(\'#paymentForm\')[0],this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value); if(divShowing(\'paymentConfirm\')){fadeOut(\'paymentConfirm\', 3)};">';
		
		temp += getPaymentOptions(this.payment_groups_id);
		temp += '</select>';
		temp += '</form>';
				var item_option  = paymentGroups[this.payment_groups_id].options[0];
		if(paymentOptions[item_option]){
			var item_name  = paymentOptions[item_option].payment_option;
			var amount =  paymentOptions[item_option].price;
		}
			}
		else {
		
	}
	if (this.item_price !== '' || this.payment_groups_id !== '') {
											temp += '<form id="paymentForm" style="margin:0px;border:0px;" name="paymentForm">';
			temp += '	<input type="hidden" name="item_option" value="' + item_option + '">';
			temp += '	<input type="hidden" name="site" value="MADELEINESHEPHERD">';
			temp += '	<input type="hidden" name="item_number" value="'+ this.id +'">';
			temp += '	<input type="hidden" name="quantity" value="1">';
						temp += '	<input value="Add to cart" id="paymentAddButton" class="button" onmouseover="this.className=\'buttonHi\'\;" onmouseout="this.className=\'button\'\;" type="Button">';
							temp += '	<input value="View cart" id="paymentViewButton" class="button" onmouseover="this.className=\'buttonHi\';" onmouseout="this.className=\'button\';" type="Button" onclick="javascript:window.location=\'cart.html\'">';
			temp += '</form>';
						temp += '<div class="clearing">&nbsp;</div>';
			temp += '<div id="confirmContainer">';
			temp += '<div id="paymentConfirm">Item added to cart</div>';
			temp += '</div>';
			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;
	}
}

			

