window.thumbnails = {};
															thumbnails[5335494] = clik.newPhoto({"id":5335494,"src":"beechplatterweb_thumb.jpg","galleries_id":299603,"server_id":5,"link":"photo_5335494.html","width":130,"caption":"beech platter","height":108});
															thumbnails[5335499] = clik.newPhoto({"id":5335499,"src":"chunkybeechweb_thumb.jpg","galleries_id":299603,"server_id":5,"link":"photo_5335499.html","width":130,"caption":"beech bowl","height":99});
															thumbnails[5335503] = clik.newPhoto({"id":5335503,"src":"spaltedbeechweb_thumb.jpg","galleries_id":299603,"server_id":5,"link":"photo_5335503.html","width":130,"caption":"spalted beech","height":76});
															thumbnails[5335640] = clik.newPhoto({"id":5335640,"src":"spaltedhollyweb_thumb.jpg","galleries_id":299603,"server_id":5,"link":"photo_5335640.html","width":130,"caption":"spalted holly bowl","height":104});
															thumbnails[5335655] = clik.newPhoto({"id":5335655,"src":"sycamorebigweb_thumb.jpg","galleries_id":299603,"server_id":5,"link":"photo_5335655.html","width":130,"caption":"sycamore","height":129});
															thumbnails[5335657] = clik.newPhoto({"id":5335657,"src":"darkburrelmweb2_thumb.jpg","galleries_id":299603,"server_id":5,"link":"photo_5335657.html","width":130,"caption":"burr elm","height":134});
															thumbnails[5335663] = clik.newPhoto({"id":5335663,"src":"darkburrelmweb_thumb.jpg","galleries_id":299603,"server_id":5,"link":"photo_5335663.html","width":130,"caption":"burr elm 2","height":128});
															thumbnails[5388944] = clik.newPhoto({"id":5388944,"src":"gallery2009_thumb.jpg","galleries_id":299603,"server_id":5,"link":"photo_5388944.html","width":130,"caption":"gallery view 2009","height":137});
															thumbnails[6052947] = clik.newPhoto({"id":6052947,"src":"smallcherryweb_thumb.jpg","galleries_id":299603,"server_id":5,"link":"photo_6052947.html","width":130,"caption":"cherry","height":97});
															thumbnails[6404976] = clik.newPhoto({"id":6404976,"src":"sycamore_thumb.jpg","galleries_id":299603,"server_id":5,"link":"photo_6404976.html","width":130,"caption":"large sycamore bowl","height":89});
															thumbnails[6404986] = clik.newPhoto({"id":6404986,"src":"sycamorewire_thumb.jpg","galleries_id":299603,"server_id":5,"link":"photo_6404986.html","width":130,"caption":"sycamore bowl","height":86});
															thumbnails[6404987] = clik.newPhoto({"id":6404987,"src":"sycamorebark_thumb.jpg","galleries_id":299603,"server_id":5,"link":"photo_6404987.html","width":130,"caption":"sycamore","height":105});
															thumbnails[6404988] = clik.newPhoto({"id":6404988,"src":"sycamore4_thumb.jpg","galleries_id":299603,"server_id":5,"link":"photo_6404988.html","width":130,"caption":"selection of smaller sycamore bowls","height":74});
															thumbnails[6508502] = clik.newPhoto({"id":6508502,"src":"spalted_sycamore_thumb.jpg","galleries_id":299603,"server_id":5,"link":"photo_6508502.html","width":130,"caption":"spalted sycamore","height":112});
															thumbnails[6508517] = clik.newPhoto({"id":6508517,"src":"squaresycamore_thumb.jpg","galleries_id":299603,"server_id":5,"link":"photo_6508517.html","width":130,"caption":"spalted sycamore upright","height":106});
															thumbnails[8182444] = clik.newPhoto({"id":8182444,"src":"capewrath2011_thumb.jpg","galleries_id":424844,"server_id":5,"link":"photo_8182444.html","width":130,"caption":"Cape Wrath","height":130});
															thumbnails[5332937] = clik.newPhoto({"id":5332937,"src":"hillsideweb_thumb.jpg","galleries_id":299602,"server_id":5,"link":"photo_5332937.html","width":130,"caption":"Hillside Cape Wrath","height":129});
															thumbnails[5382994] = clik.newPhoto({"id":5382994,"src":"stilllifeoil_thumb.jpg","galleries_id":303693,"server_id":5,"link":"photo_5382994.html","width":130,"caption":"Still Life 1988","height":155});
															thumbnails[5390287] = clik.newPhoto({"id":5390287,"src":"Arkle08_thumb.jpg","galleries_id":304177,"server_id":5,"link":"photo_5390287.html","width":130,"caption":"Arkle 2008","height":94});
															thumbnails[7870694] = clik.newPhoto({"id":7870694,"src":"kyledurness_thumb.jpg","galleries_id":424844,"server_id":5,"link":"photo_7870694.html","width":130,"caption":"Over the Kyle to Cape Wrath","height":133});
															thumbnails[5332872] = clik.newPhoto({"id":5332872,"src":"arklefromklbweb1_thumb.jpg","galleries_id":299602,"server_id":5,"link":"photo_5332872.html","width":130,"caption":"Arkle from Kinlochbervie","height":175});
															thumbnails[5383003] = clik.newPhoto({"id":5383003,"src":"contewoman_thumb.jpg","galleries_id":303693,"server_id":5,"link":"photo_5383003.html","width":130,"caption":"portrait 1990","height":158});
															thumbnails[5390299] = clik.newPhoto({"id":5390299,"src":"stormlocheriboll07_thumb.jpg","galleries_id":304177,"server_id":5,"link":"photo_5390299.html","width":130,"caption":"Storm on Loch Eriboll 2007","height":95});
															thumbnails[7870706] = clik.newPhoto({"id":7870706,"src":"northern_lights12.jpg300.jpgweb_thumb.jpg","galleries_id":424844,"server_id":5,"link":"photo_7870706.html","width":130,"caption":"Northern Lights","height":102});
															thumbnails[5332922] = clik.newPhoto({"id":5332922,"src":"foinavenweb_thumb.jpg","galleries_id":299602,"server_id":5,"link":"photo_5332922.html","width":130,"caption":"Foinaven","height":133});
															thumbnails[5383715] = clik.newPhoto({"id":5383715,"src":"drapery_thumb.jpg","galleries_id":303693,"server_id":5,"link":"photo_5383715.html","width":130,"caption":"drapery 1987","height":154});
															thumbnails[5390302] = clik.newPhoto({"id":5390302,"src":"kempiesbay07_thumb.jpg","galleries_id":304177,"server_id":5,"link":"photo_5390302.html","width":130,"caption":"Kempie's bay 2007","height":96});
															thumbnails[7870710] = clik.newPhoto({"id":7870710,"src":"oldshoremore2.jpgweb_thumb.jpg","galleries_id":424844,"server_id":5,"link":"photo_7870710.html","width":130,"caption":"Oldshoremore 2","height":95});
															thumbnails[5332915] = clik.newPhoto({"id":5332915,"src":"balnakeilbayweb_thumb.jpg","galleries_id":299602,"server_id":5,"link":"photo_5332915.html","width":130,"caption":"Balnakeil bay","height":98});
															thumbnails[5383863] = clik.newPhoto({"id":5383863,"src":"oilblondman_thumb.jpg","galleries_id":303693,"server_id":5,"link":"photo_5383863.html","width":130,"caption":"oil portrait 1.1987","height":150});
															thumbnails[5390312] = clik.newPhoto({"id":5390312,"src":"kinlochberviecrofts08_thumb.jpg","galleries_id":304177,"server_id":5,"link":"photo_5390312.html","width":130,"caption":"Kinlochbervie Crofts 2008","height":131});
															thumbnails[7870712] = clik.newPhoto({"id":7870712,"src":"she2.jpgweb_thumb.jpg","galleries_id":424844,"server_id":5,"link":"photo_7870712.html","width":130,"caption":"She ","height":119});
															thumbnails[8674309] = clik.newPhoto({"id":8674309,"src":"capewrathnight.pdfweb_thumb.jpg","galleries_id":424844,"server_id":35,"link":"photo_8674309.html","width":130,"caption":"capewrathnight","height":132});
															thumbnails[5332894] = clik.newPhoto({"id":5332894,"src":"arkleweb1_thumb.jpg","galleries_id":299602,"server_id":5,"link":"photo_5332894.html","width":130,"caption":"Arkle","height":53});
															thumbnails[5383800] = clik.newPhoto({"id":5383800,"src":"conteman_thumb.jpg","galleries_id":303693,"server_id":5,"link":"photo_5383800.html","width":130,"caption":"pastel portrait 1987","height":185});
															thumbnails[5390320] = clik.newPhoto({"id":5390320,"src":"eriboll08_thumb.jpg","galleries_id":304177,"server_id":5,"link":"photo_5390320.html","width":130,"caption":"Eriboll 2008","height":132});
															thumbnails[8674325] = clik.newPhoto({"id":8674325,"src":"wave_thumb.jpg","galleries_id":424844,"server_id":35,"link":"photo_8674325.html","width":130,"caption":"wave","height":378});
															thumbnails[5332942] = clik.newPhoto({"id":5332942,"src":"oldshoremoreweb_thumb.jpg","galleries_id":299602,"server_id":5,"link":"photo_5332942.html","width":130,"caption":"Oldshoremore","height":93});
															thumbnails[5383867] = clik.newPhoto({"id":5383867,"src":"oilman_thumb.jpg","galleries_id":303693,"server_id":5,"link":"photo_5383867.html","width":130,"caption":"oil portrait 2. 1987","height":134});
															thumbnails[5390328] = clik.newPhoto({"id":5390328,"src":"hillside08_thumb.jpg","galleries_id":304177,"server_id":5,"link":"photo_5390328.html","width":130,"caption":"Hillside 2008","height":133});
															thumbnails[5332948] = clik.newPhoto({"id":5332948,"src":"riverbankweb_thumb.jpg","galleries_id":299602,"server_id":5,"link":"photo_5332948.html","width":130,"caption":"Riverbank Achfary","height":130});
															thumbnails[5383871] = clik.newPhoto({"id":5383871,"src":"stilllifecup_thumb.jpg","galleries_id":303693,"server_id":5,"link":"photo_5383871.html","width":130,"caption":"still life with cup 1992","height":87});
															thumbnails[5390342] = clik.newPhoto({"id":5390342,"src":"arklefromkinlochbervie06_thumb.jpg","galleries_id":304177,"server_id":5,"link":"photo_5390342.html","width":130,"caption":"Arkle from Kinlochbervie 2006","height":334});
															thumbnails[5332953] = clik.newPhoto({"id":5332953,"src":"silverbirchweb_thumb.jpg","galleries_id":299602,"server_id":5,"link":"photo_5332953.html","width":130,"caption":"Silver birch","height":54});
															thumbnails[5384474] = clik.newPhoto({"id":5384474,"src":"stilllifejug_thumb.jpg","galleries_id":303693,"server_id":5,"link":"photo_5384474.html","width":130,"caption":"still life with jug 1992","height":84});
															thumbnails[5390350] = clik.newPhoto({"id":5390350,"src":"balnakeil08_thumb.jpg","galleries_id":304177,"server_id":5,"link":"photo_5390350.html","width":130,"caption":"Balnakeil 2008","height":326});
															thumbnails[5383865] = clik.newPhoto({"id":5383865,"src":"crucifiction_thumb.jpg","galleries_id":303693,"server_id":5,"link":"photo_5383865.html","width":130,"caption":"crucifiction 1987","height":81});
															thumbnails[5390356] = clik.newPhoto({"id":5390356,"src":"balnakeilbay08_thumb.jpg","galleries_id":304177,"server_id":5,"link":"photo_5390356.html","width":130,"caption":"Balnakeil Bay 2008","height":396});
															thumbnails[8182449] = clik.newPhoto({"id":8182449,"src":"galleryweb_thumb.jpg","galleries_id":424844,"server_id":5,"link":"photo_8182449.html","width":130,"caption":"The Wee gallery","height":98});
															thumbnails[5384498] = clik.newPhoto({"id":5384498,"src":"simon_thumb.jpg","galleries_id":303693,"server_id":5,"link":"photo_5384498.html","width":130,"caption":"simon 1988","height":159});
															thumbnails[5390379] = clik.newPhoto({"id":5390379,"src":"balnakeilbay07_thumb.jpg","galleries_id":304177,"server_id":5,"link":"photo_5390379.html","width":130,"caption":"Balnakeil Bay 2007","height":131});
															thumbnails[5582693] = clik.newPhoto({"id":5582693,"src":"stilllifecalamondon_thumb.jpg","galleries_id":299602,"server_id":5,"link":"photo_5582693.html","width":130,"caption":"Still life with calamondon","height":97});
															thumbnails[5390386] = clik.newPhoto({"id":5390386,"src":"crofthouserhiconnich08_thumb.jpg","galleries_id":304177,"server_id":5,"link":"photo_5390386.html","width":130,"caption":"Crofthouse Rhiconnich 2008","height":287});
															thumbnails[5924962] = clik.newPhoto({"id":5924962,"src":"mountainlochweb_thumb.jpg","galleries_id":299602,"server_id":5,"link":"photo_5924962.html","width":130,"caption":"mountain loch","height":128});
															thumbnails[5390389] = clik.newPhoto({"id":5390389,"src":"hillside07_thumb.jpg","galleries_id":304177,"server_id":5,"link":"photo_5390389.html","width":130,"caption":"Hillside 2007","height":131});
															thumbnails[6404965] = clik.newPhoto({"id":6404965,"src":"lochinchardweb_thumb.jpg","galleries_id":299602,"server_id":5,"link":"photo_6404965.html","width":130,"caption":"Crofthouse Loch Inchard [Kinlochbervie]","height":129});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[424844] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Nicola Poole 2011","link":"gallery_424844.html","maxRecords":0.0,"photoIDs":[8182444.0,7870694.0,7870706.0,7870710.0,7870712.0,8674309.0,8674325.0,8182449.0],"skipIndex":0,"section_code":"gallery","featured_images":7870706.0,"id":424844,"singleSection":false});				  						galleries[299602] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Nicola Poole 2009\/2010","link":"gallery_299602.html","maxRecords":0.0,"photoIDs":[5332937.0,5332872.0,5332922.0,5332915.0,5332894.0,5332942.0,5332948.0,5332953.0,5582693.0,5924962.0,6404965.0],"skipIndex":0,"section_code":"gallery","featured_images":"6404965,5924962,5332937","id":299602,"singleSection":false});				  						galleries[304177] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Nicola Poole-2005-2008","link":"gallery_304177.html","maxRecords":0.0,"photoIDs":[5390287.0,5390299.0,5390302.0,5390312.0,5390320.0,5390328.0,5390342.0,5390350.0,5390356.0,5390379.0,5390386.0,5390389.0],"skipIndex":0,"section_code":"gallery","featured_images":5390320.0,"id":304177,"singleSection":false});				  						galleries[303693] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Nicola Poole - 1980's 1990's","link":"gallery_303693.html","maxRecords":0.0,"photoIDs":[5382994.0,5383003.0,5383715.0,5383863.0,5383800.0,5383867.0,5383871.0,5384474.0,5383865.0,5384498.0],"skipIndex":0,"section_code":"gallery","featured_images":5383871.0,"id":303693,"singleSection":false});				  						galleries[299603] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Ludo Van Muysen","link":"gallery_299603.html","maxRecords":0.0,"photoIDs":[5335494.0,5335499.0,5335503.0,5335640.0,5335655.0,5335657.0,5335663.0,5388944.0,6052947.0,6404976.0,6404986.0,6404987.0,6404988.0,6508502.0,6508517.0],"skipIndex":0,"section_code":"gallery","featured_images":"5335640,5335503","id":299603,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '8182449';
imageSets[2] = '5335640,5335503,5332937,7870706,5390320,5383871,5924962,6404965';
imageSets[3] = '8674325,8674309,8182449,8182444,7870712,7870710,7870706,7870694,6508517,6508502,6404988,6404987,6404986,6404976,6404965,6052947,5924962,5582693,5390389,5390386,5390379,5390356,5390350,5390342,5390328,5390320,5390312,5390302,5390299,5390287,5388944,5384498,5384474,5383871,5383867,5383865,5383863,5383800,5383715,5383003,5382994,5335663,5335657,5335655,5335640,5335503,5335499,5335494,5332953,5332948';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'www12.clikpic.com/balnakeil/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/balnakeil/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/balnakeil/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/balnakeil/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/balnakeil/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/balnakeil/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/balnakeil/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/balnakeil/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/balnakeil/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/balnakeil/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/balnakeil/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/balnakeil/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/balnakeil/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/balnakeil/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/balnakeil/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/balnakeil/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/balnakeil/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/balnakeil/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/balnakeil/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/balnakeil/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/balnakeil/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/balnakeil/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/balnakeil/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/balnakeil/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/balnakeil/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 = 'The Wee Gallery: ' + 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="BALNAKEIL">';
			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;
	}
}

			

