window.thumbnails = {};
															thumbnails[8559652] = clik.newPhoto({"id":8559652,"src":"Sandend-1_thumb.jpg","galleries_id":132121,"server_id":1,"link":"photo_8559652.html","width":130,"caption":"Sandend, Moray Firth","height":86});
															thumbnails[8559658] = clik.newPhoto({"id":8559658,"src":"sandend_thumb.jpg","galleries_id":132121,"server_id":1,"link":"photo_8559658.html","width":130,"caption":"Sandend, Moray Firth","height":86});
															thumbnails[8559682] = clik.newPhoto({"id":8559682,"src":"Banff_thumb.jpg","galleries_id":132121,"server_id":1,"link":"photo_8559682.html","width":130,"caption":"Banff beach Christmas Day 2010","height":86});
															thumbnails[6317863] = clik.newPhoto({"id":6317863,"src":"Bauchaille_Etive_Mor_thumb.jpg","galleries_id":132121,"server_id":1,"link":"photo_6317863.html","width":130,"caption":"Bauchaille Etive Mor, Glencoe","height":87});
															thumbnails[6317857] = clik.newPhoto({"id":6317857,"src":"Loch_Lomond_thumb.jpg","galleries_id":132121,"server_id":1,"link":"photo_6317857.html","width":130,"caption":"Ben Lomond","height":85});
															thumbnails[5511866] = clik.newPhoto({"id":5511866,"src":"knack-1_thumb.jpg","galleries_id":87288,"server_id":1,"link":"photo_5511866.html","width":130,"caption":"The Knack","height":90});
															thumbnails[5511876] = clik.newPhoto({"id":5511876,"src":"culbin_2_thumb.jpg","galleries_id":262416,"server_id":1,"link":"photo_5511876.html","width":130,"caption":"Husky","height":144});
															thumbnails[5328032] = clik.newPhoto({"id":5328032,"src":"Forgue_thumb.jpg","galleries_id":132121,"server_id":1,"link":"photo_5328032.html","width":130,"caption":"Snow in Aberdeenshire","height":87});
															thumbnails[5328037] = clik.newPhoto({"id":5328037,"src":"snow_sky_thumb.jpg","galleries_id":132121,"server_id":1,"link":"photo_5328037.html","width":130,"caption":"Snow in Aberdeenshire","height":87});
															thumbnails[5328046] = clik.newPhoto({"id":5328046,"src":"snowy_tree_thumb.jpg","galleries_id":132121,"server_id":1,"link":"photo_5328046.html","width":130,"caption":"Tree in the snow","height":87});
															thumbnails[5200279] = clik.newPhoto({"id":5200279,"src":"cub_attack_thumb.jpg","galleries_id":262416,"server_id":1,"link":"photo_5200279.html","width":130,"caption":"mum under attack","height":61});
															thumbnails[4510381] = clik.newPhoto({"id":4510381,"src":"tiger3_thumb.jpg","galleries_id":262416,"server_id":1,"link":"photo_4510381.html","width":130,"caption":"Tiger","height":91});
															thumbnails[4510359] = clik.newPhoto({"id":4510359,"src":"tiger2_thumb.jpg","galleries_id":262416,"server_id":1,"link":"photo_4510359.html","width":130,"caption":"Tiger","height":114});
															thumbnails[4510386] = clik.newPhoto({"id":4510386,"src":"tiger4_thumb.jpg","galleries_id":262416,"server_id":1,"link":"photo_4510386.html","width":130,"caption":"Tiger","height":97});
															thumbnails[4510390] = clik.newPhoto({"id":4510390,"src":"tiger5_thumb.jpg","galleries_id":262416,"server_id":1,"link":"photo_4510390.html","width":130,"caption":"Tiger","height":98});
															thumbnails[4510394] = clik.newPhoto({"id":4510394,"src":"tigercub-1_thumb.jpg","galleries_id":262416,"server_id":1,"link":"photo_4510394.html","width":130,"caption":"Tiger cub","height":106});
															thumbnails[4510395] = clik.newPhoto({"id":4510395,"src":"tigercub-2_thumb.jpg","galleries_id":262416,"server_id":1,"link":"photo_4510395.html","width":130,"caption":"Tiger Cub","height":68});
															thumbnails[4510398] = clik.newPhoto({"id":4510398,"src":"tigers1_thumb.jpg","galleries_id":262416,"server_id":1,"link":"photo_4510398.html","width":130,"caption":"Tigers","height":109});
															thumbnails[8559620] = clik.newPhoto({"id":8559620,"src":"crovie_thumb.jpg","galleries_id":132121,"server_id":1,"link":"photo_8559620.html","width":130,"caption":"Crovie, Moray Firth","height":87});
															thumbnails[1218913] = clik.newPhoto({"id":1218913,"src":"infrared leaves blue_thumb.jpg","galleries_id":87282,"server_id":1,"link":"photo_1218913.html","width":130,"caption":"Infrared leaves","height":98});
															thumbnails[2694774] = clik.newPhoto({"id":2694774,"src":"ozzy-cropped_thumb.jpg","galleries_id":87288,"server_id":1,"link":"photo_2694774.html","width":130,"caption":"Ozzie Osbourne","height":106});
															thumbnails[2694775] = clik.newPhoto({"id":2694775,"src":"rory-2-rgb_thumb.jpg","galleries_id":87288,"server_id":1,"link":"photo_2694775.html","width":130,"caption":"Rory Galllagher","height":160});
															thumbnails[4288563] = clik.newPhoto({"id":4288563,"src":"boat1_thumb.jpg","galleries_id":87282,"server_id":1,"link":"photo_4288563.html","width":130,"caption":"fishing boat","height":87});
															thumbnails[4288568] = clik.newPhoto({"id":4288568,"src":"boat2_thumb.jpg","galleries_id":87282,"server_id":1,"link":"photo_4288568.html","width":130,"caption":"fishing boat","height":87});
															thumbnails[4288569] = clik.newPhoto({"id":4288569,"src":"chain1_thumb.jpg","galleries_id":87282,"server_id":1,"link":"photo_4288569.html","width":130,"caption":"Rusty Chain","height":98});
															thumbnails[4288572] = clik.newPhoto({"id":4288572,"src":"gannet1_thumb.jpg","galleries_id":87282,"server_id":1,"link":"photo_4288572.html","width":130,"caption":"Gannet in flight","height":68});
															thumbnails[4288621] = clik.newPhoto({"id":4288621,"src":"sunset_trees_thumb.jpg","galleries_id":132121,"server_id":1,"link":"photo_4288621.html","width":130,"caption":"Sunset Trees","height":79});
															thumbnails[4328704] = clik.newPhoto({"id":4328704,"src":"bow_fiddle_thumb.jpg","galleries_id":132121,"server_id":1,"link":"photo_4328704.html","width":130,"caption":"Bow Fiddle","height":98});
															thumbnails[4328706] = clik.newPhoto({"id":4328706,"src":"Hascosay-wave-1a_thumb.jpg","galleries_id":132121,"server_id":1,"link":"photo_4328706.html","width":130,"caption":"At Sea","height":80});
															thumbnails[4328708] = clik.newPhoto({"id":4328708,"src":"pennan_storm_thumb.jpg","galleries_id":132121,"server_id":1,"link":"photo_4328708.html","width":130,"caption":"Stormy Pennan","height":91});
															thumbnails[4328712] = clik.newPhoto({"id":4328712,"src":"sky1_thumb.jpg","galleries_id":132121,"server_id":1,"link":"photo_4328712.html","width":130,"caption":"Evening Sky","height":87});
															thumbnails[4328713] = clik.newPhoto({"id":4328713,"src":"sunset_findhorn_thumb.jpg","galleries_id":132121,"server_id":1,"link":"photo_4328713.html","width":130,"caption":"Sunset over Findhorn","height":69});
															thumbnails[4328749] = clik.newPhoto({"id":4328749,"src":"beach_hut_thumb.jpg","galleries_id":87282,"server_id":1,"link":"photo_4328749.html","width":130,"caption":"Beach hut at Hopeman","height":98});
															thumbnails[4381422] = clik.newPhoto({"id":4381422,"src":"angusflat_thumb.jpg","galleries_id":87288,"server_id":1,"link":"photo_4381422.html","width":130,"caption":"AC\/DC","height":178});
															thumbnails[4381424] = clik.newPhoto({"id":4381424,"src":"coverdale_thumb.jpg","galleries_id":87288,"server_id":1,"link":"photo_4381424.html","width":130,"caption":"David Coverdale","height":163});
															thumbnails[4381425] = clik.newPhoto({"id":4381425,"src":"micky-moody-rgb_thumb.jpg","galleries_id":87288,"server_id":1,"link":"photo_4381425.html","width":130,"caption":"Micky Moody","height":173});
															thumbnails[4381427] = clik.newPhoto({"id":4381427,"src":"police-copeland_thumb.jpg","galleries_id":87288,"server_id":1,"link":"photo_4381427.html","width":130,"caption":"Stuart Copeland - The Police","height":106});
															thumbnails[5200281] = clik.newPhoto({"id":5200281,"src":"cub_thumb.jpg","galleries_id":262416,"server_id":1,"link":"photo_5200281.html","width":130,"caption":"Tiger cub","height":130});
															thumbnails[5200283] = clik.newPhoto({"id":5200283,"src":"feeding_time_thumb.jpg","galleries_id":262416,"server_id":1,"link":"photo_5200283.html","width":130,"caption":"Feeding time for the cubs","height":87});
															thumbnails[5200285] = clik.newPhoto({"id":5200285,"src":"mum_and_cub_1_thumb.jpg","galleries_id":262416,"server_id":1,"link":"photo_5200285.html","width":130,"caption":"mum and cub","height":112});
															thumbnails[5328022] = clik.newPhoto({"id":5328022,"src":"magnum-Edinburgh_thumb.jpg","galleries_id":87288,"server_id":1,"link":"photo_5328022.html","width":130,"caption":"Magnum  ","height":95});
															thumbnails[8559693] = clik.newPhoto({"id":8559693,"src":"cullen_1_thumb.jpg","galleries_id":132121,"server_id":1,"link":"photo_8559693.html","width":130,"caption":"Cullen beach","height":81});
															thumbnails[8559786] = clik.newPhoto({"id":8559786,"src":"linx_cropped_thumb.jpg","galleries_id":262416,"server_id":1,"link":"photo_8559786.html","width":130,"caption":"Lynx","height":127});
															thumbnails[8559793] = clik.newPhoto({"id":8559793,"src":"pallas_cat_3_thumb.jpg","galleries_id":262416,"server_id":1,"link":"photo_8559793.html","width":130,"caption":"Pallas cat","height":86});
															thumbnails[8559794] = clik.newPhoto({"id":8559794,"src":"pallas_cat_cropped2_thumb.jpg","galleries_id":262416,"server_id":1,"link":"photo_8559794.html","width":130,"caption":"Pallas cat","height":116});
															thumbnails[8559799] = clik.newPhoto({"id":8559799,"src":"walker_1_thumb.jpg","galleries_id":262416,"server_id":1,"link":"photo_8559799.html","width":130,"caption":"Walker the polar bear","height":86});
															thumbnails[8559803] = clik.newPhoto({"id":8559803,"src":"kitten_mono2_thumb.jpg","galleries_id":262416,"server_id":1,"link":"photo_8559803.html","width":130,"caption":"Wildcat kitten","height":93});
															thumbnails[8595438] = clik.newPhoto({"id":8595438,"src":"cat_thumb.jpg","galleries_id":454222,"server_id":1,"link":"photo_8595438.html","width":130,"caption":"stalking cat","height":104});
															thumbnails[8595442] = clik.newPhoto({"id":8595442,"src":"seaweed_painting_thumb.jpg","galleries_id":454222,"server_id":1,"link":"photo_8595442.html","width":130,"caption":"Seaweed","height":175});
															thumbnails[8595512] = clik.newPhoto({"id":8595512,"src":"3_Kings_cullen_thumb.jpg","galleries_id":454222,"server_id":1,"link":"photo_8595512.html","width":130,"caption":"Three Kings, Cullen","height":78});
															thumbnails[8595517] = clik.newPhoto({"id":8595517,"src":"loch_thumb.jpg","galleries_id":454222,"server_id":1,"link":"photo_8595517.html","width":130,"caption":"Loch","height":89});
															thumbnails[5441665] = clik.newPhoto({"id":5441665,"src":"husky_4_thumb.jpg","galleries_id":262416,"server_id":1,"link":"photo_5441665.html","width":130,"caption":"Husky","height":124});
															thumbnails[1577859] = clik.newPhoto({"id":1577859,"src":"seareflections_thumb.jpg","galleries_id":87282,"server_id":1,"link":"photo_1577859.html","width":130,"caption":"Sea Reflections","height":84});
															thumbnails[1577870] = clik.newPhoto({"id":1577870,"src":"ladder_thumb.jpg","galleries_id":87282,"server_id":1,"link":"photo_1577870.html","width":130,"caption":"Ladder","height":49});
															thumbnails[1577895] = clik.newPhoto({"id":1577895,"src":"rush1_thumb.jpg","galleries_id":87288,"server_id":1,"link":"photo_1577895.html","width":130,"caption":"Rush","height":160});
															thumbnails[1577874] = clik.newPhoto({"id":1577874,"src":"door chain _thumb.jpg","galleries_id":87282,"server_id":1,"link":"photo_1577874.html","width":130,"caption":"Door Chain","height":94});
															thumbnails[1577899] = clik.newPhoto({"id":1577899,"src":"rory_thumb.jpg","galleries_id":87288,"server_id":1,"link":"photo_1577899.html","width":130,"caption":"Rory Gallagher","height":157});
															thumbnails[1218898] = clik.newPhoto({"id":1218898,"src":"AliceCooper_thumb.jpg","galleries_id":87288,"server_id":1,"link":"photo_1218898.html","width":130,"caption":"Alice Cooper","height":130});
															thumbnails[1218906] = clik.newPhoto({"id":1218906,"src":"EddieVan Halen_thumb.jpg","galleries_id":87288,"server_id":1,"link":"photo_1218906.html","width":130,"caption":"Eddie Van Halen","height":160});
															thumbnails[1218910] = clik.newPhoto({"id":1218910,"src":"dahlia_thumb.jpg","galleries_id":87282,"server_id":1,"link":"photo_1218910.html","width":130,"caption":"Dahlia","height":100});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[262416] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Animals","link":"gallery_262416.html","maxRecords":0.0,"photoIDs":[5511876.0,5200279.0,4510381.0,4510359.0,4510386.0,4510390.0,4510394.0,4510395.0,4510398.0,5200281.0,5200283.0,5200285.0,8559786.0,8559793.0,8559794.0,8559799.0,8559803.0,5441665.0],"skipIndex":0,"section_code":"gallery","featured_images":"8559803,8559799,8559794,8559793,8559786,5511876,5441665,5200285,5200283,5200281","id":262416,"singleSection":false});				  						galleries[87288] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Rockbands","link":"gallery_87288.html","maxRecords":0.0,"photoIDs":[5511866.0,2694774.0,2694775.0,4381422.0,4381424.0,4381425.0,4381427.0,5328022.0,1577895.0,1577899.0,1218898.0,1218906.0],"skipIndex":0,"section_code":"gallery","featured_images":"1577899,1577895,1218906,1218898","id":87288,"singleSection":false});				  						galleries[87282] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Abstract","link":"gallery_87282.html","maxRecords":0.0,"photoIDs":[1218913.0,4288563.0,4288568.0,4288569.0,4288572.0,4328749.0,1577859.0,1577870.0,1577874.0,1218910.0],"skipIndex":0,"section_code":"gallery","featured_images":"1577874,1577870,1577859,1218913,1218910","id":87282,"singleSection":false});				  						galleries[132121] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Scottish Landscapes","link":"gallery_132121.html","maxRecords":0.0,"photoIDs":[8559652.0,8559658.0,8559682.0,6317863.0,6317857.0,5328032.0,5328037.0,5328046.0,8559620.0,4288621.0,4328704.0,4328706.0,4328708.0,4328712.0,4328713.0,8559693.0],"skipIndex":0,"section_code":"gallery","featured_images":"8559693,8559682,8559658,8559652,8559620,6317863,6317857,5328046,5328037,5328032","id":132121,"singleSection":false});				  						galleries[454222] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Artwork","link":"gallery_454222.html","maxRecords":0.0,"photoIDs":[8595438.0,8595442.0,8595512.0,8595517.0],"skipIndex":0,"section_code":"gallery","featured_images":"8595517,8595512,8595442,8595438","id":454222,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '8595517,8595512,8595442,8595438,8559803,8559799,8559794,8559793,8559786,8559693,8559682,8559658,8559652,8559620,6317863,6317857,5511876,5511866,4510395,4510394,4510381,4288572,2694775,2694774,1218913,5441665,1577859,1577895,1577870,1577899,1577874,1218898,1218906,1218910';
imageSets[2] = '1218913,1577859,1577895,1577870,1577899,1577874,1218898,1218906,1218910';
imageSets[3] = '5511876,5441665';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/suearber/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/suearber/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/suearber/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/suearber/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/suearber/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/suearber/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/suearber/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/suearber/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/suearber/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/suearber/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/suearber/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/suearber/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/suearber/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/suearber/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/suearber/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/suearber/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/suearber/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/suearber/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/suearber/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/suearber/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/suearber/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/suearber/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/suearber/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/suearber/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/suearber/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/suearber/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/suearber/images';
		break;
	}
		return val;
}

/***************************************************************************
* img = reference to image object in which to show image                   *
***************************************************************************/
function showHomeImage(img) {
	imageID = randomListVal('');
	if (!basic) {
		img.src = photos[imageID].src;
		img.width = photos[imageID].width;
		img.height = photos[imageID].height;
		img.parentNode.title = img.alt = photos[imageID].caption;
	} else {
		newImage = new Image(photos[imageID].width,photos[imageID].height);
		newImage.src = photos[imageID].src;
		document.images[img.name] = newImage;
		
	}
}

function getHomeImageLink(imageID) {
  	var href='', photo = (backgrounds || photos || {})[imageID];
	if(photo){
		if (photo && photo.galleries_id != '') {
  			href = photo.fnGalleryLink();
  		}
  		  		else {
  				href += 'gallery.html';
  	  		}
	}
    return href;
}

/***************************************************************************
* Show a random image on home page from featured images                    *
***************************************************************************/
function showHomeImageInline(el, image_sets_id, href) {
	
	var css = {}, imageID,
	    imageSetsId = 1;
	if(image_sets_id){
		imageSetsId = image_sets_id;
	}
	imageID = randomListVal(imageSets[imageSetsId]);
	if (href == null && 'gallery' != '') {
					href = getHomeImageLink(imageID);
	}
	
	updateImage({nextPhoto: backgrounds[imageID], img:el.find('img')[0],
                $photo:el, $title:$('#homeimageTitleContainer'), $detail:$('#homeimageDetailsContainer'),                speed:0, href:href, css:css, onAfter: function(){                  this.closest('.contentsection').doManualAlign({				    inner: 'img',				    crop: 'a'				  });                }              });
}

/***************************************************************************
* Set 'img' to be a new image given its photo() object                     *
***************************************************************************/
function updateImage (options) {
	var defaults = {nextPhoto:'',field:'',img:'',$photo:'',$title:'',$detail:'',$detailContainer:'',
                    updateDocumentTitle:false,speed:0,href:false,css:false,updateHash:false,onAfter:null,onBefore:null},
		op = $.extend({},defaults,options),
		html = '', temp = '',
		photoId = op.nextPhoto.id,
		photoCaption = ''+op.nextPhoto.caption,
		photoSrc = op.nextPhoto.src;
	
	if (op.updateHash && clik.getIDInUrl(location.href,'photo') != op.nextPhoto.id) {
		clik.changeHash('photos_id=' + op.nextPhoto.id, true);
	}
		
	    if (op.$title.length > 0) {
  		op.$title.fadeGalleryDetails(photoCaption, op.speed);
    }
        if (op.updateDocumentTitle) {
						  document.title = ' : ' + 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="tigsue82@googlemail.com">';
					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="tigsue82@googlemail.com">';
				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;
	}
}

			

