window.thumbnails = {};
															thumbnails[563976] = clik.newPhoto({"id":563976,"src":"Nick_1_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":159});
															thumbnails[457689] = clik.newPhoto({"id":457689,"src":"Queen_of_Scream_thumb.jpg","galleries_id":36201,"server_id":1,"link":"photo_457689.html","width":130,"caption":"Queen of Scream 62x62cm (2011)","height":129});
															thumbnails[457768] = clik.newPhoto({"id":457768,"src":"Barred_thumb.jpg","galleries_id":36201,"server_id":1,"link":"photo_457768.html","width":130,"caption":"Bewitched 80x126cm (2011)","height":202});
															thumbnails[457770] = clik.newPhoto({"id":457770,"src":"DSCF1211_thumb.jpg","galleries_id":36201,"server_id":1,"link":"photo_457770.html","width":130,"caption":"La Nuit Americaine 65x90cm (2011)","height":182});
															thumbnails[459852] = clik.newPhoto({"id":459852,"src":"Fancy_thumb.jpg","galleries_id":36201,"server_id":1,"link":"photo_459852.html","width":130,"caption":"Fancy 96x160cm (2011)","height":216});
															thumbnails[2803312] = clik.newPhoto({"id":2803312,"src":"Henderson_the_Rain_King1_thumb.jpg","galleries_id":36201,"server_id":1,"link":"photo_2803312.html","width":130,"caption":"Le Faiseur de Pluie 100x125cm (2011)","height":149});
															thumbnails[7470501] = clik.newPhoto({"id":7470501,"src":"Red_Five_thumb.jpg","galleries_id":36201,"server_id":1,"link":"photo_7470501.html","width":130,"caption":"Red Five 75x75cm (2011)","height":128});
															thumbnails[7470508] = clik.newPhoto({"id":7470508,"src":"The_Letter_thumb.jpg","galleries_id":36201,"server_id":1,"link":"photo_7470508.html","width":130,"caption":"The Letter 49x70cm (2011)","height":190});
															thumbnails[457687] = clik.newPhoto({"id":457687,"src":"Polonium_thumb.jpg","galleries_id":36201,"server_id":1,"link":"photo_457687.html","width":130,"caption":"Polonium 96x128cm (2010)","height":170});
															thumbnails[457698] = clik.newPhoto({"id":457698,"src":"Show_Business_thumb.jpg","galleries_id":36201,"server_id":1,"link":"photo_457698.html","width":130,"caption":"Show Business 78x78cm (2010)","height":132});
															thumbnails[457757] = clik.newPhoto({"id":457757,"src":"Half_and_Half_thumb.jpg","galleries_id":36201,"server_id":1,"link":"photo_457757.html","width":130,"caption":"Half and Half (2010) 100x110cm","height":145});
															thumbnails[916066] = clik.newPhoto({"id":916066,"src":"Isadore_Ducasse_thumb.jpg","galleries_id":36201,"server_id":1,"link":"photo_916066.html","width":130,"caption":"Isadore Ducasse 66x87cm (2010) ","height":168});
															thumbnails[2803314] = clik.newPhoto({"id":2803314,"src":"The_Blue_Afternoon_thumb.jpg","galleries_id":36201,"server_id":1,"link":"photo_2803314.html","width":130,"caption":"The Blue Afternoon 92x92cm (2010)","height":126});
															thumbnails[2803336] = clik.newPhoto({"id":2803336,"src":"Totem_1_thumb.jpg","galleries_id":36201,"server_id":1,"link":"photo_2803336.html","width":130,"caption":"Totem 94x160cm (2010)","height":221});
															thumbnails[5818608] = clik.newPhoto({"id":5818608,"src":"Drawing_From_Life_thumb.jpg","galleries_id":36201,"server_id":1,"link":"photo_5818608.html","width":130,"caption":"Drawing from Life 110x110cm (2010)","height":131});
															thumbnails[5818612] = clik.newPhoto({"id":5818612,"src":"Who_Killed_Cock_Robin_thumb.jpg","galleries_id":36201,"server_id":1,"link":"photo_5818612.html","width":130,"caption":"Who Killed Cock Robin? 95x125cm (2010)","height":170});
															thumbnails[457644] = clik.newPhoto({"id":457644,"src":"Blue_Poles_thumb.jpg","galleries_id":36201,"server_id":1,"link":"photo_457644.html","width":130,"caption":"Blue Poles 75x75cm (2009)","height":131});
															thumbnails[457748] = clik.newPhoto({"id":457748,"src":"Twelve_New_Songs_thumb.jpg","galleries_id":36201,"server_id":1,"link":"photo_457748.html","width":130,"caption":"Twelve New Songs 95x95cm (2009)","height":131});
															thumbnails[916061] = clik.newPhoto({"id":916061,"src":"Extra_Time_thumb.jpg","galleries_id":36201,"server_id":1,"link":"photo_916061.html","width":130,"caption":"Extra Time 157x157cm (2009)","height":132});
															thumbnails[2803322] = clik.newPhoto({"id":2803322,"src":"In_Bad_Company_thumb.jpg","galleries_id":36201,"server_id":1,"link":"photo_2803322.html","width":130,"caption":"In Bad Company 75x75cm (2009)","height":130});
															thumbnails[2803324] = clik.newPhoto({"id":2803324,"src":"The_Sorceress_of_Majipoor_thumb.jpg","galleries_id":36201,"server_id":1,"link":"photo_2803324.html","width":130,"caption":"The Sorceress of Majipoor 75x75cm (2009)","height":131});
															thumbnails[2803328] = clik.newPhoto({"id":2803328,"src":"Karaoke_thumb.jpg","galleries_id":36201,"server_id":1,"link":"photo_2803328.html","width":130,"caption":"Karaoke<br>\r\n92x124cm (2009)<br>\r\n<br>\r\n","height":173});
															thumbnails[5818604] = clik.newPhoto({"id":5818604,"src":"Seconds_thumb.jpg","galleries_id":36201,"server_id":1,"link":"photo_5818604.html","width":130,"caption":"Seconds<br>\r\n78x95cm (2009)","height":145});
															thumbnails[457769] = clik.newPhoto({"id":457769,"src":"Prosperos_Island_thumb.jpg","galleries_id":36201,"server_id":1,"link":"photo_457769.html","width":130,"caption":"Prospero's Island 92x92cm (2008) ","height":130});
															thumbnails[2803310] = clik.newPhoto({"id":2803310,"src":"Fountain_thumb.jpg","galleries_id":36201,"server_id":1,"link":"photo_2803310.html","width":130,"caption":"Fountain 90x117cm (2009)","height":168});
															thumbnails[2803311] = clik.newPhoto({"id":2803311,"src":"Mirrorball_thumb.jpg","galleries_id":36201,"server_id":1,"link":"photo_2803311.html","width":130,"caption":"Mirrorball<br>\r\n60x60cm (2008)","height":134});
															thumbnails[2803313] = clik.newPhoto({"id":2803313,"src":"Echo Chamber_thumb.jpg","galleries_id":36201,"server_id":1,"link":"photo_2803313.html","width":130,"caption":"Echo Chamber<br>\r\n152x152cm (2008)","height":131});
															thumbnails[2803325] = clik.newPhoto({"id":2803325,"src":"Treasure Island_thumb.jpg","galleries_id":36201,"server_id":1,"link":"photo_2803325.html","width":130,"caption":"Treasure Island<br>\r\n80x100cm (2008)","height":159});
															thumbnails[2803326] = clik.newPhoto({"id":2803326,"src":"Help Me Somebody5_thumb.jpg","galleries_id":36201,"server_id":1,"link":"photo_2803326.html","width":130,"caption":"Help Me Somebody 56x62cm (2008)","height":142});
															thumbnails[457758] = clik.newPhoto({"id":457758,"src":"Goldfish_thumb.jpg","galleries_id":36201,"server_id":1,"link":"photo_457758.html","width":130,"caption":"Goldfish<br>\r\n90x125cm (2008)","height":185});
															thumbnails[916037] = clik.newPhoto({"id":916037,"src":"Gardener's Alphabet (2)_thumb.jpg","galleries_id":36201,"server_id":1,"link":"photo_916037.html","width":130,"caption":"A Gardener's Alphabet (2) 50x55cm (2007)","height":145});
															thumbnails[457690] = clik.newPhoto({"id":457690,"src":"Study for Chimpanzee_thumb.jpg","galleries_id":36201,"server_id":1,"link":"photo_457690.html","width":130,"caption":"Study for Chimpanzee 52x58cm (2007)","height":146});
															thumbnails[457756] = clik.newPhoto({"id":457756,"src":"Straw Dog_thumb.jpg","galleries_id":36201,"server_id":1,"link":"photo_457756.html","width":130,"caption":"Straw Dog<br>\r\n95x95cm (2007)<br>\r\n","height":130});
															thumbnails[1315949] = clik.newPhoto({"id":1315949,"src":"Destroyed1_thumb.jpg","galleries_id":36201,"server_id":1,"link":"photo_1315949.html","width":130,"caption":"Destroyed 1979 105x125cm (2007)","height":158});
															thumbnails[1315957] = clik.newPhoto({"id":1315957,"src":"Berlin Horse_thumb.jpg","galleries_id":36201,"server_id":1,"link":"photo_1315957.html","width":130,"caption":"Berlin Horse 110x125cm (2007)","height":116});
															thumbnails[916078] = clik.newPhoto({"id":916078,"src":"The Day The Earth Stood Still_thumb.jpg","galleries_id":36201,"server_id":1,"link":"photo_916078.html","width":130,"caption":"The Day The Earth Stood Still<br>\r\n91x91cm (2007)","height":130});
															thumbnails[916082] = clik.newPhoto({"id":916082,"src":"Vox Pop1_thumb.jpg","galleries_id":36201,"server_id":1,"link":"photo_916082.html","width":130,"caption":"Vox Pop<br>\r\n92x123cm (2007)","height":174});
															thumbnails[457699] = clik.newPhoto({"id":457699,"src":"The Kitchenmaid_thumb.jpg","galleries_id":36201,"server_id":1,"link":"photo_457699.html","width":130,"caption":"The Kitchenmaid 96x125cm (2006)","height":169});
															thumbnails[916042] = clik.newPhoto({"id":916042,"src":"In A Gadda Da Vida_thumb.jpg","galleries_id":36201,"server_id":1,"link":"photo_916042.html","width":130,"caption":"In A Gadda Da Vida<br>\r\n75x75cm (2006)","height":133});
															thumbnails[457742] = clik.newPhoto({"id":457742,"src":"Girls_and_Boys_75x75cm_250_thumb.jpg","galleries_id":36201,"server_id":1,"link":"photo_457742.html","width":130,"caption":"Girls and Boys 75x75cm (2005)","height":130});
															thumbnails[457750] = clik.newPhoto({"id":457750,"src":"Comedies and Proverbs_thumb.jpg","galleries_id":36201,"server_id":1,"link":"photo_457750.html","width":130,"caption":"Comedies & Proverbs<br>\r\n110x125cm (2005)<br>\r\n","height":149});
															thumbnails[457754] = clik.newPhoto({"id":457754,"src":"Critical Interventions (Evil)_thumb.jpg","galleries_id":36201,"server_id":1,"link":"photo_457754.html","width":130,"caption":"Critical Interventions (Evil)<br>\r\n92x92cm (2005)","height":130});
															thumbnails[458173] = clik.newPhoto({"id":458173,"src":"Shangri-La_thumb.jpg","galleries_id":36201,"server_id":1,"link":"photo_458173.html","width":130,"caption":"Shangri-La 95x125cm (2005)","height":171});
															thumbnails[459844] = clik.newPhoto({"id":459844,"src":"Pod People_thumb.jpg","galleries_id":36201,"server_id":1,"link":"photo_459844.html","width":130,"caption":"Pod People 85x118cm (2005)","height":182});
															thumbnails[456918] = clik.newPhoto({"id":456918,"src":"Examining Pictures_thumb.jpg","galleries_id":36201,"server_id":1,"link":"photo_456918.html","width":130,"caption":"Examining Pictures  95x125cm (2004)","height":173});
															thumbnails[457646] = clik.newPhoto({"id":457646,"src":"Lost in Translation_thumb.jpg","galleries_id":36201,"server_id":1,"link":"photo_457646.html","width":130,"caption":"Lost in Translation 97x127cm (2004)","height":168});
															thumbnails[457740] = clik.newPhoto({"id":457740,"src":"Alreet_thumb.jpg","galleries_id":36201,"server_id":1,"link":"photo_457740.html","width":130,"caption":"Alreet<br>\r\n97x127cm (2004)","height":172});
															thumbnails[457760] = clik.newPhoto({"id":457760,"src":"Let's get away from it all_thumb.jpg","galleries_id":36201,"server_id":1,"link":"photo_457760.html","width":130,"caption":"Let's Get Away from it All 125x90cm (2004)","height":96});
															thumbnails[916087] = clik.newPhoto({"id":916087,"src":"In the Beginning_thumb.jpg","galleries_id":36201,"server_id":1,"link":"photo_916087.html","width":130,"caption":"In The Beginning<br>\r\n95x155cm (2003)","height":215});
															thumbnails[457771] = clik.newPhoto({"id":457771,"src":"Minotaur (1) _thumb.jpg","galleries_id":36201,"server_id":1,"link":"photo_457771.html","width":130,"caption":"Minotaur 90x120cm (2003)","height":170});
															thumbnails[456831] = clik.newPhoto({"id":456831,"src":"Abstraction_thumb.jpg","galleries_id":36201,"server_id":1,"link":"photo_456831.html","width":130,"caption":"Abstraction <br>\r\n95x125cm (2003)","height":174});
															thumbnails[2803331] = clik.newPhoto({"id":2803331,"src":"Hide__Seek_thumb.jpg","galleries_id":36224,"server_id":1,"link":"photo_2803331.html","width":130,"caption":"Hide and Seek 55x57cm (2009)","height":136});
															thumbnails[5818637] = clik.newPhoto({"id":5818637,"src":"Cheating_at_Canasta_thumb.jpg","galleries_id":36224,"server_id":1,"link":"photo_5818637.html","width":130,"caption":"Cheating at Canasta 46x88cm (2009)","height":232});
															thumbnails[5818651] = clik.newPhoto({"id":5818651,"src":"Man_and_Bpy_thumb.jpg","galleries_id":36224,"server_id":1,"link":"photo_5818651.html","width":130,"caption":"Comic Cuts 45x65cm (2009)","height":243});
															thumbnails[5818654] = clik.newPhoto({"id":5818654,"src":"Jordan_Belson_thumb.jpg","galleries_id":36224,"server_id":1,"link":"photo_5818654.html","width":130,"caption":"Jordan Belson 41x67cm (2009)","height":214});
															thumbnails[457631] = clik.newPhoto({"id":457631,"src":"Hitchcock's Curtain_thumb.jpg","galleries_id":36224,"server_id":1,"link":"photo_457631.html","width":130,"caption":"Hitchcock's Curtain 51x88cm (2007)","height":229});
															thumbnails[1315952] = clik.newPhoto({"id":1315952,"src":"I Fall in Love_thumb.jpg","galleries_id":36224,"server_id":1,"link":"photo_1315952.html","width":130,"caption":"I Fall In Love, 71x33cm (2007)","height":58});
															thumbnails[457949] = clik.newPhoto({"id":457949,"src":"Tribal Art (2)_thumb.jpg","galleries_id":36224,"server_id":1,"link":"photo_457949.html","width":130,"caption":"Tribal Art 2 42x90cm (2005)","height":316});
															thumbnails[457635] = clik.newPhoto({"id":457635,"src":"Up to Picasso_thumb.jpg","galleries_id":36224,"server_id":1,"link":"photo_457635.html","width":130,"caption":"Up to Picasso 46x120cm (2004)","height":336});
															thumbnails[457683] = clik.newPhoto({"id":457683,"src":"A3_thumb.jpg","galleries_id":36224,"server_id":1,"link":"photo_457683.html","width":130,"caption":"A3 30x42cm (2004)","height":155});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[36201] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Paintings","link":"gallery_36201.html","maxRecords":0.0,"photoIDs":[457689.0,457768.0,457770.0,459852.0,2803312.0,7470501.0,7470508.0,457687.0,457698.0,457757.0,916066.0,2803314.0,2803336.0,5818608.0,5818612.0,457644.0,457748.0,916061.0,2803322.0,2803324.0,2803328.0,5818604.0,457769.0,2803310.0,2803311.0,2803313.0,2803325.0,2803326.0,457758.0,916037.0,457690.0,457756.0,1315949.0,1315957.0,916078.0,916082.0,457699.0,916042.0,457742.0,457750.0,457754.0,458173.0,459844.0,456918.0,457646.0,457740.0,457760.0,916087.0,457771.0,456831.0],"skipIndex":0,"section_code":"gallery","featured_images":2803314.0,"id":36201,"singleSection":false});				  						galleries[36224] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Constructions","link":"gallery_36224.html","maxRecords":0.0,"photoIDs":[2803331.0,5818637.0,5818651.0,5818654.0,457631.0,1315952.0,457949.0,457635.0,457683.0],"skipIndex":0,"section_code":"gallery","featured_images":2803331.0,"id":36224,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '7470508';
imageSets[2] = '2803314,2803331';
imageSets[3] = '5818612,5818608,2803336,457757,5818604,2803322,916061,457748,457644,2803326,2803310,457769,5818651,5818637,457631,457683,457635';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'www12.clikpic.com/nickholmes/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/nickholmes/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/nickholmes/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/nickholmes/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/nickholmes/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/nickholmes/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/nickholmes/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/nickholmes/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/nickholmes/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/nickholmes/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/nickholmes/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/nickholmes/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/nickholmes/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/nickholmes/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/nickholmes/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/nickholmes/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/nickholmes/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/nickholmes/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/nickholmes/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/nickholmes/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/nickholmes/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/nickholmes/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/nickholmes/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/nickholmes/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/nickholmes/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 && backgrounds[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 = 'Nick Holmes Art: ' + 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="updateItemValues($(this.form).next(\'#paymentForm\')[0],this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value);">';
		
		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" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
			temp += '<input type="hidden" name="item_name" value="'+item_name+'">';
			ref = '';
			if(this.photo_ref != ''){
				ref = this.photo_ref+' - '+this.caption;
			}
			else{
				ref = this.id+' - '+this.caption;
			}
			price = amount;								temp += '<input type="hidden" name="cmd" value="_cart">';
					temp += '<input type="hidden" name="business" value="helen@helendholmes.demon.co.uk">';
					temp += '<input type="hidden" name="currency_code" value="GBP">';
					temp += '<input type="hidden" name="add" value="1">';
													temp += '<input type="hidden" name="amount" value="'+amount+'">';
					temp += '<input type="hidden" name="item_number" value="'+ref+'">';
													temp += '<input type=\"Submit\" value=\"Add to cart\" id=\"paymentAddButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
										temp += '</form>';
										temp += '<form id="paymentCartForm" style="margin:0px;" name="paymentCartForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
				temp += '<input type="hidden" name="cmd" value="_cart">';
				temp += '<input type="hidden" name="business" value="helen@helendholmes.demon.co.uk">';
				temp += '<input type="hidden" name="display" value="1">';
				temp += '<input type=\"Submit\" value=\"View cart\" id=\"paymentViewButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
				temp += '</form>';
						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;
	}
}

			

