window.thumbnails = {};
															thumbnails[2014017] = clik.newPhoto({"id":2014017,"src":"Object V by Lorenzo Belenguer_thumb.jpg","galleries_id":134993,"server_id":5,"link":"photo_2014017.html","width":130,"caption":"Object V, rusted metal and oils, £1,500","height":174});
															thumbnails[4595721] = clik.newPhoto({"id":4595721,"src":"_7002768_thumb.jpg","galleries_id":134993,"server_id":5,"link":"photo_4595721.html","width":130,"caption":"Broken Heart, Rusty metal, plaster and oils, £400","height":87});
															thumbnails[2013899] = clik.newPhoto({"id":2013899,"src":"An orderly chaos (close up) by Lorenzo Belenguer_thumb.jpg","galleries_id":134993,"server_id":5,"link":"photo_2013899.html","width":130,"caption":"Orderly Chaos (detail), Rusted Metal and Oils","height":98});
															thumbnails[2013904] = clik.newPhoto({"id":2013904,"src":"An orderly chaos by Lorenzo Belenguer_thumb.jpg","galleries_id":134993,"server_id":5,"link":"photo_2013904.html","width":130,"caption":"Orderly Chaos, Rusted Metal and Oils","height":84});
															thumbnails[2013945] = clik.newPhoto({"id":2013945,"src":"Homage to Pollock I (close up) by Lorenzo Belenguer_thumb.jpg","galleries_id":134993,"server_id":5,"link":"photo_2013945.html","width":130,"caption":"Homage to Pollock II (detail), Rusted Metal and Oils","height":98});
															thumbnails[2013947] = clik.newPhoto({"id":2013947,"src":"Homage-to-Pollock-by-Lorenzo-Belenguer-02_thumb.jpg","galleries_id":134993,"server_id":5,"link":"photo_2013947.html","width":130,"caption":"Homage to Pollock II, Rusted Metal and Oils, £3,000","height":98});
															thumbnails[2013966] = clik.newPhoto({"id":2013966,"src":"Made in England by Lorenzo Belenguer_thumb.jpg","galleries_id":134993,"server_id":5,"link":"photo_2013966.html","width":130,"caption":"Made in England, Rusted Metal and Oils, £2000","height":85});
															thumbnails[2014000] = clik.newPhoto({"id":2014000,"src":"Buildings-that-might-fall01_thumb.jpg","galleries_id":134993,"server_id":5,"link":"photo_2014000.html","width":130,"caption":"Buildings that might fall, rusted metal and oils, £1200","height":245});
															thumbnails[2014002] = clik.newPhoto({"id":2014002,"src":"Buildings-that-might-fall02_thumb.jpg","galleries_id":134993,"server_id":5,"link":"photo_2014002.html","width":130,"caption":"Buildings that might fall, rusted metal and oils","height":235});
															thumbnails[2014011] = clik.newPhoto({"id":2014011,"src":"Shovel by Lorenzo Belenguer_thumb.jpg","galleries_id":134993,"server_id":5,"link":"photo_2014011.html","width":130,"caption":"Shovel, rusted metal and oils, £250","height":96});
															thumbnails[2013912] = clik.newPhoto({"id":2013912,"src":"Grid V by Lorenzo Belenguer_thumb.jpg","galleries_id":134993,"server_id":5,"link":"photo_2013912.html","width":130,"caption":"Grid V, Rusted Metal and Oils in Acrylic box, £350","height":137});
															thumbnails[3214340] = clik.newPhoto({"id":3214340,"src":"Mini-Jetsam by Lorenzo Belenguer_thumb.jpg","galleries_id":134992,"server_id":5,"link":"photo_3214340.html","width":130,"caption":"Mini-Jetsam XXI, rusted metal and oils in white cement, SOLD","height":98});
															thumbnails[3214343] = clik.newPhoto({"id":3214343,"src":"_7002753_thumb.jpg","galleries_id":134992,"server_id":5,"link":"photo_3214343.html","width":130,"caption":"Mini-Object XXII, rusted metal and oils in plaster, £250","height":87});
															thumbnails[3214344] = clik.newPhoto({"id":3214344,"src":"_7002773_thumb.jpg","galleries_id":134992,"server_id":5,"link":"photo_3214344.html","width":130,"caption":"Mini-Object XX, Rusty metal and oils on acrylic paint, £150","height":87});
															thumbnails[3214345] = clik.newPhoto({"id":3214345,"src":"_7002744_thumb.jpg","galleries_id":134992,"server_id":5,"link":"photo_3214345.html","width":130,"caption":"Mini-Object XXI, Rusty metal, oils and pva, £150","height":87});
															thumbnails[4581955] = clik.newPhoto({"id":4581955,"src":"_7002760_thumb.jpg","galleries_id":134992,"server_id":5,"link":"photo_4581955.html","width":130,"caption":"Food For The Homeless, Bread, rusty metal and Oils, £400","height":87});
															thumbnails[5246336] = clik.newPhoto({"id":5246336,"src":"_7002626_thumb.jpg","galleries_id":134992,"server_id":5,"link":"photo_5246336.html","width":130,"caption":"Mini-Object XXVI, rusted metal and oils in plaster, £250","height":87});
															thumbnails[5246337] = clik.newPhoto({"id":5246337,"src":"_7002628_thumb.jpg","galleries_id":134992,"server_id":5,"link":"photo_5246337.html","width":130,"caption":"Mini-Object XXVII, rusted metal and oils in white cement, £150","height":87});
															thumbnails[5246338] = clik.newPhoto({"id":5246338,"src":"_7002633_thumb.jpg","galleries_id":134992,"server_id":5,"link":"photo_5246338.html","width":130,"caption":"Mini-Object XXVIII, rusted metal and oils in white cement, £150","height":87});
															thumbnails[5246340] = clik.newPhoto({"id":5246340,"src":"_7002637_thumb.jpg","galleries_id":134992,"server_id":5,"link":"photo_5246340.html","width":130,"caption":"Mini-Object XIX, rusted metal and oils in white cement, £150","height":87});
															thumbnails[5246342] = clik.newPhoto({"id":5246342,"src":"_7002642_thumb.jpg","galleries_id":134992,"server_id":5,"link":"photo_5246342.html","width":130,"caption":"Mini-Object XXX, , rusted metal and oils in plaster, £150","height":87});
															thumbnails[6908205] = clik.newPhoto({"id":6908205,"src":"Box_3_by_Lorenzo_Belenguer_thumb.jpg","galleries_id":134992,"server_id":5,"link":"photo_6908205.html","width":130,"caption":"Box 3, rusted metal and oils in an acrylic box, several, £150 each","height":132});
															thumbnails[2013974] = clik.newPhoto({"id":2013974,"src":"Mini-Object-IX-by-Lorenzo-B_thumb.jpg","galleries_id":134992,"server_id":5,"link":"photo_2013974.html","width":130,"caption":"Mini-Object IX, Rusted metal and oils, sold","height":89});
															thumbnails[2013975] = clik.newPhoto({"id":2013975,"src":"MiniObject05 by Lorenzo Belenguer_thumb.jpg","galleries_id":134992,"server_id":5,"link":"photo_2013975.html","width":130,"caption":"Mini-Object V, Rusted metal and oils, £150","height":87});
															thumbnails[2013976] = clik.newPhoto({"id":2013976,"src":"_7002769_thumb.jpg","galleries_id":134992,"server_id":5,"link":"photo_2013976.html","width":130,"caption":"Mini-Object 40, Rusted metal and oils, £150","height":87});
															thumbnails[2013980] = clik.newPhoto({"id":2013980,"src":"_7002770_thumb.jpg","galleries_id":134992,"server_id":5,"link":"photo_2013980.html","width":130,"caption":"Mini-Object 50, Rusted Metal and oils, £150","height":87});
															thumbnails[4822545] = clik.newPhoto({"id":4822545,"src":"Constable-1-by-Lorenzo-Bel_thumb.jpg","galleries_id":265368,"server_id":5,"link":"photo_4822545.html","width":130,"caption":"Constable #1, metal and oils on printed paper, £450","height":168});
															thumbnails[6907719] = clik.newPhoto({"id":6907719,"src":"Aerial_View_of_Two_Group_of_People_close_up_by_Lorenzo_Belenguer_thumb.jpg","galleries_id":134991,"server_id":5,"link":"photo_6907719.html","width":130,"caption":"Aerial View of Two Group of People (close up)","height":98});
															thumbnails[6907721] = clik.newPhoto({"id":6907721,"src":"Aerial_View_of_Two_Group_of_People_by_Lorenzo_Belenguer_thumb.jpg","galleries_id":134991,"server_id":5,"link":"photo_6907721.html","width":130,"caption":"Aerial View of Two Group of People","height":142});
															thumbnails[6970352] = clik.newPhoto({"id":6970352,"src":"Group_of_People_by_Lorenzo_Belenguerclose-up_thumb.jpg","galleries_id":134991,"server_id":5,"link":"photo_6970352.html","width":130,"caption":"Aerial View of Groups of People (close up). Rusty screws installation on the wall.","height":98});
															thumbnails[2013955] = clik.newPhoto({"id":2013955,"src":"Installation by Lorenzo BelenguerII_thumb.jpg","galleries_id":134991,"server_id":5,"link":"photo_2013955.html","width":130,"caption":"126 Drawing for every innocent woman put in Jail, Mixed Media Installation","height":182});
															thumbnails[2013959] = clik.newPhoto({"id":2013959,"src":"Installation by Lorenzo Belenguer_thumb.jpg","galleries_id":134991,"server_id":5,"link":"photo_2013959.html","width":130,"caption":"126 Drawings for every innocent woman put in jail, Mixed Media Installation","height":125});
															thumbnails[2013962] = clik.newPhoto({"id":2013962,"src":"InstallationCloseUp-by-Lore_thumb.jpg","galleries_id":134991,"server_id":5,"link":"photo_2013962.html","width":130,"caption":"126 Drawings for every innocent woman put in Jail (detail), Mixed Media Installation","height":98});
															thumbnails[6073190] = clik.newPhoto({"id":6073190,"src":"Drawing_II_by_Lorenzo_Belenguer_thumb.jpg","galleries_id":341048,"server_id":5,"link":"photo_6073190.html","width":130,"caption":"Drawing 2, original painting, oil on primed paper, SOLD","height":185});
															thumbnails[8419575] = clik.newPhoto({"id":8419575,"src":"Drawing_50_by_Lorenzo_Belenguer_thumb.jpg","galleries_id":341048,"server_id":5,"link":"photo_8419575.html","width":130,"caption":"Drawing 50, original painting, oil on primed paper, £150","height":184});
															thumbnails[8419607] = clik.newPhoto({"id":8419607,"src":"Drawing_51_by_Lorenzo_Belenguer_thumb.jpg","galleries_id":341048,"server_id":5,"link":"photo_8419607.html","width":130,"caption":"Drawing 51, original painting, oil on primed paper, £150","height":184});
															thumbnails[8419657] = clik.newPhoto({"id":8419657,"src":"Drawing_52_by_Lorenzo_Belenguer_thumb.jpg","galleries_id":341048,"server_id":5,"link":"photo_8419657.html","width":130,"caption":"Drawing 52, original painting, oil on primed paper, £150","height":184});
															thumbnails[8419658] = clik.newPhoto({"id":8419658,"src":"Drawing_53_by_Lorenzo_Belenguer_thumb.jpg","galleries_id":341048,"server_id":5,"link":"photo_8419658.html","width":130,"caption":"Drawing 53, original painting, oil on primed paper, £150","height":184});
															thumbnails[8419659] = clik.newPhoto({"id":8419659,"src":"Drawing_54_by_Lorenzo_Belenguer_thumb.jpg","galleries_id":341048,"server_id":5,"link":"photo_8419659.html","width":130,"caption":"Drawing 54, original painting, oil on primed paper, £150","height":184});
															thumbnails[8419660] = clik.newPhoto({"id":8419660,"src":"Drawing_55_by_Lorenzo_Belenguer_thumb.jpg","galleries_id":341048,"server_id":5,"link":"photo_8419660.html","width":130,"caption":"Drawing 55, original painting, oil on primed paper, £150","height":184});
															thumbnails[8419661] = clik.newPhoto({"id":8419661,"src":"Drawing_56_by_Lorenzo_Belenguer_thumb.jpg","galleries_id":341048,"server_id":5,"link":"photo_8419661.html","width":130,"caption":"Drawing 56, original painting, oil on primed paper, £150","height":184});
															thumbnails[6073206] = clik.newPhoto({"id":6073206,"src":"Drawing_III_by_Lorenzo_Belenguer_thumb.jpg","galleries_id":341048,"server_id":5,"link":"photo_6073206.html","width":130,"caption":"Drawing 3, original painting, oil on primed paper, SOLD","height":188});
															thumbnails[6073210] = clik.newPhoto({"id":6073210,"src":"Drawing_V_by_Lorenzo_Belenguer_thumb.jpg","galleries_id":341048,"server_id":5,"link":"photo_6073210.html","width":130,"caption":"Drawing 50, original painting, oil on primed paper, £150","height":134});
															thumbnails[6073223] = clik.newPhoto({"id":6073223,"src":"Drawing_XIII_by_Lorenzo_Belenguer_thumb.jpg","galleries_id":341048,"server_id":5,"link":"photo_6073223.html","width":130,"caption":"Drawing 13, original painting, oil on primed paper, SOLD","height":163});
															thumbnails[6073253] = clik.newPhoto({"id":6073253,"src":"Drawing_XXIV_by_Lorenzo_Belenguer_thumb.jpg","galleries_id":341048,"server_id":5,"link":"photo_6073253.html","width":130,"caption":"Drawing 14, original painting, oil on primed paper, SOLD","height":163});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[341048] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Drawings","link":"section407839.html","maxRecords":0.0,"photoIDs":[6073190.0,8419575.0,8419607.0,8419657.0,8419658.0,8419659.0,8419660.0,8419661.0,6073206.0,6073210.0,6073223.0,6073253.0],"skipIndex":0,"section_code":"section407839","featured_images":"8419661,8419660,8419659,8419658,8419657,8419607,8419575,6073253,6073223,6073210","id":341048,"singleSection":true});				  						galleries[134991] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Installation Art","link":"section174775.html","maxRecords":0.0,"photoIDs":[6907719.0,6907721.0,6970352.0,2013955.0,2013959.0,2013962.0],"skipIndex":0,"section_code":"section174775","featured_images":2013962.0,"id":134991,"singleSection":true});				  						galleries[134992] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Mini-Objects","link":"section174774.html","maxRecords":0.0,"photoIDs":[3214340.0,3214343.0,3214344.0,3214345.0,4581955.0,5246336.0,5246337.0,5246338.0,5246340.0,5246342.0,6908205.0,2013974.0,2013975.0,2013976.0,2013980.0],"skipIndex":0,"section_code":"section174774","featured_images":2013974.0,"id":134992,"singleSection":true});				  						galleries[134993] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Objects","link":"section174773.html","maxRecords":0.0,"photoIDs":[2014017.0,4595721.0,2013899.0,2013904.0,2013945.0,2013947.0,2013966.0,2014000.0,2014002.0,2014011.0,2013912.0],"skipIndex":0,"section_code":"section174773","featured_images":"2013945,2013899","id":134993,"singleSection":true});				  						galleries[265368] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Objects Ad","link":"section319639.html","maxRecords":0.0,"photoIDs":[4822545.0],"skipIndex":0,"section_code":"section319639","featured_images":4822545.0,"id":265368,"singleSection":true});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '8419661,6970352,6907719,4595721,4581955,3214345,3214344,3214340,2014017,2013974,2013899,2013962,2013945,2013966,2014011,2013912';
imageSets[2] = '2013974,2013899,2013962,2013945';
imageSets[3] = '8419661,8419660,8419659,8419658,8419657,8419607,8419575,6970352,6908205,6907721,6907719,6073253,6073223,6073210,6073206,6073190,5246342,5246340,5246338,5246337,5246336,4822545,4595721,4581955,3214345,3214344,3214343,3214340,2014017,2014011,2014002,2014000,2013980,2013976,2013975,2013974,2013966,2013962,2013959,2013955,2013947,2013945,2013912,2013904,2013899';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/lbelenguer/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/lbelenguer/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/lbelenguer/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/lbelenguer/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/lbelenguer/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/lbelenguer/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/lbelenguer/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/lbelenguer/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/lbelenguer/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/lbelenguer/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/lbelenguer/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/lbelenguer/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/lbelenguer/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/lbelenguer/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/lbelenguer/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/lbelenguer/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/lbelenguer/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/lbelenguer/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/lbelenguer/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/lbelenguer/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/lbelenguer/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/lbelenguer/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/lbelenguer/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/lbelenguer/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/lbelenguer/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/lbelenguer/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/lbelenguer/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 += 'section174773.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 && 'section174773' != '') {
					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 = 'Lorenzo Belenguer\n\n\n\n\n\n\n: ' + 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> &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.item_price !== '') {
																		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="K4HWY8LFQTGUC">';
					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="K4HWY8LFQTGUC">';
				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;
	}
}

			

