window.thumbnails = {};
															thumbnails[2042681] = clik.newPhoto({"id":2042681,"src":"Caitlin_Oct_03_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":94});
															thumbnails[2042689] = clik.newPhoto({"id":2042689,"src":"Caitlin_Oct_03_copy_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":94});
															thumbnails[2052884] = clik.newPhoto({"id":2052884,"src":"bathroom_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"Bathroom, Clachtoll Holidays","height":173});
															thumbnails[2052898] = clik.newPhoto({"id":2052898,"src":"caravan_park_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"Clachtoll Caravan Park, Clachtoll Holidays","height":38});
															thumbnails[2053147] = clik.newPhoto({"id":2053147,"src":"fishing_by_bank_or_boat_thumb.jpeg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"Loch Assynt","height":98});
															thumbnails[2053650] = clik.newPhoto({"id":2053650,"src":"Loch_Awe_Assynt_2_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"Loch Awe","height":88});
															thumbnails[2053676] = clik.newPhoto({"id":2053676,"src":"Shot_putt_A_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"Shot Putt at Assynt Highland Games","height":195});
															thumbnails[2053678] = clik.newPhoto({"id":2053678,"src":"Steven_Gillies_A_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"All abilities footpath","height":86});
															thumbnails[2053963] = clik.newPhoto({"id":2053963,"src":"5_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"Surf at Clachtoll","height":261});
															thumbnails[2055602] = clik.newPhoto({"id":2055602,"src":"NTlogo_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"Northern Times","height":15});
															thumbnails[2055604] = clik.newPhoto({"id":2055604,"src":"villagehall_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"Lochinver Village Hall","height":25});
															thumbnails[2055607] = clik.newPhoto({"id":2055607,"src":"highlandstoneware_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":86});
															thumbnails[2055817] = clik.newPhoto({"id":2055817,"src":"alclogo_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"Assynt Leisure Centre","height":89});
															thumbnails[2055820] = clik.newPhoto({"id":2055820,"src":"aplogo_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"Assynt Photographics","height":87});
															thumbnails[2055824] = clik.newPhoto({"id":2055824,"src":"caberfeidh_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":88});
															thumbnails[2056488] = clik.newPhoto({"id":2056488,"src":"albannach_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"The Albannach Hotel","height":196});
															thumbnails[2056495] = clik.newPhoto({"id":2056495,"src":"ccwlogo_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"The Culag Community Woodland Trust","height":111});
															thumbnails[2056500] = clik.newPhoto({"id":2056500,"src":"discoverassynt_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":81});
															thumbnails[2056504] = clik.newPhoto({"id":2056504,"src":"drumbeghotel_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"Drumbeg Hotel","height":130});
															thumbnails[2056508] = clik.newPhoto({"id":2056508,"src":"drumbegstores_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"Drumbeg Stores","height":195});
															thumbnails[2056512] = clik.newPhoto({"id":2056512,"src":"holidaylettings_thumb.JPG","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"holidaylettings","height":31});
															thumbnails[2059213] = clik.newPhoto({"id":2059213,"src":"john_macpherson_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"John Macpherson Photography","height":105});
															thumbnails[2085769] = clik.newPhoto({"id":2085769,"src":"Clachtoll_Surf_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":62});
															thumbnails[2086679] = clik.newPhoto({"id":2086679,"src":"collage with beach _thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":188});
															thumbnails[2041332] = clik.newPhoto({"id":2041332,"src":"dolphin_jumping_thumb.jpg","galleries_id":136055,"server_id":32,"link":"photo_2041332.html","width":130,"caption":"White-sided Dolphin","height":93});
															thumbnails[2042924] = clik.newPhoto({"id":2042924,"src":"Sunset_over_Clachtoll_thumb.jpg","galleries_id":136055,"server_id":32,"link":"photo_2042924.html","width":130,"caption":"Summer sunset over Clachtoll","height":85});
															thumbnails[2044537] = clik.newPhoto({"id":2044537,"src":"road_to_Clachtoll_thumb.jpg","galleries_id":136055,"server_id":32,"link":"photo_2044537.html","width":130,"caption":"The Road to Clachtoll","height":98});
															thumbnails[2052878] = clik.newPhoto({"id":2052878,"src":"alter_eagle_thumb.jpg","galleries_id":136055,"server_id":32,"link":"photo_2052878.html","width":130,"caption":"Golden Eagle","height":55});
															thumbnails[2052901] = clik.newPhoto({"id":2052901,"src":"Clachtoll_Beach_thumb.jpg","galleries_id":136055,"server_id":32,"link":"photo_2052901.html","width":130,"caption":"Clachtoll Beach","height":199});
															thumbnails[2053145] = clik.newPhoto({"id":2053145,"src":"dolphin_swimming_thumb.jpg","galleries_id":136055,"server_id":32,"link":"photo_2053145.html","width":130,"caption":"Dolphin","height":87});
															thumbnails[2053158] = clik.newPhoto({"id":2053158,"src":"Loch_Assynt_Pine_trees_thumb.jpg","galleries_id":136055,"server_id":32,"link":"photo_2053158.html","width":130,"caption":"Pine trees, Loch Assynt","height":77});
															thumbnails[2053160] = clik.newPhoto({"id":2053160,"src":"Lochinver_Bay_at_dusk_thumb.jpg","galleries_id":136055,"server_id":32,"link":"photo_2053160.html","width":130,"caption":"Lochinver bay at Dusk","height":76});
															thumbnails[2053169] = clik.newPhoto({"id":2053169,"src":"Quinag_thumb.jpg","galleries_id":136055,"server_id":32,"link":"photo_2053169.html","width":130,"caption":"Quinag","height":88});
															thumbnails[2053173] = clik.newPhoto({"id":2053173,"src":"Sea_Pink_thumb.jpg","galleries_id":136055,"server_id":32,"link":"photo_2053173.html","width":130,"caption":"Sea Pink","height":90});
															thumbnails[2053177] = clik.newPhoto({"id":2053177,"src":"Split_rock_people_thumb.jpg","galleries_id":136055,"server_id":32,"link":"photo_2053177.html","width":130,"caption":"The Split Rock","height":86});
															thumbnails[2053184] = clik.newPhoto({"id":2053184,"src":"The_Road_to_Stoer_thumb.jpg","galleries_id":136055,"server_id":32,"link":"photo_2053184.html","width":130,"caption":"Loch an Ordain","height":82});
															thumbnails[2053193] = clik.newPhoto({"id":2053193,"src":"Through_the_marram_grass_thumb.jpg","galleries_id":136055,"server_id":32,"link":"photo_2053193.html","width":130,"caption":"Marram grass, Clachtoll Beach","height":86});
															thumbnails[2054693] = clik.newPhoto({"id":2054693,"src":"white_clover_thumb.jpg","galleries_id":136055,"server_id":32,"link":"photo_2054693.html","width":130,"caption":"White Clover","height":132});
															thumbnails[2054707] = clik.newPhoto({"id":2054707,"src":"Ardvreck_Burn_Assynt_1_thumb.jpg","galleries_id":136055,"server_id":32,"link":"photo_2054707.html","width":130,"caption":"Adrvreck Burn","height":195});
															thumbnails[2054730] = clik.newPhoto({"id":2054730,"src":"Ardvreck_Castle_and_Loch_Assynt_thumb.jpg","galleries_id":136055,"server_id":32,"link":"photo_2054730.html","width":130,"caption":"Ardvreck Castle","height":68});
															thumbnails[2054735] = clik.newPhoto({"id":2054735,"src":"Clachtoll_Assynt_thumb.jpg","galleries_id":136055,"server_id":32,"link":"photo_2054735.html","width":130,"caption":"Clachtoll at dusk","height":85});
															thumbnails[2054765] = clik.newPhoto({"id":2054765,"src":"Clachtoll_Beach1_thumb.jpg","galleries_id":136055,"server_id":32,"link":"photo_2054765.html","width":130,"caption":"Clachtoll Surf","height":194});
															thumbnails[2054771] = clik.newPhoto({"id":2054771,"src":"Loch_Awe_Assynt_1_thumb.jpg","galleries_id":136055,"server_id":32,"link":"photo_2054771.html","width":130,"caption":"Loch Awe","height":88});
															thumbnails[2055386] = clik.newPhoto({"id":2055386,"src":"Old_Salmon_Bothy_Clachtoll_Stoer_thumb.jpg","galleries_id":136055,"server_id":32,"link":"photo_2055386.html","width":130,"caption":"Old Salmon Bothy","height":200});
															thumbnails[2055389] = clik.newPhoto({"id":2055389,"src":"Suilven_Assynt_1991_thumb.jpg","galleries_id":136055,"server_id":32,"link":"photo_2055389.html","width":130,"caption":"Suilven","height":82});
															thumbnails[2055392] = clik.newPhoto({"id":2055392,"src":"Quinag_and_Assynt_from_Suilven_thumb.jpg","galleries_id":136055,"server_id":32,"link":"photo_2055392.html","width":130,"caption":"Assynt and Quinag","height":86});
															thumbnails[2055396] = clik.newPhoto({"id":2055396,"src":"wheatear_thumb.jpg","galleries_id":136055,"server_id":32,"link":"photo_2055396.html","width":130,"caption":"Wheatear","height":90});
															thumbnails[2055401] = clik.newPhoto({"id":2055401,"src":"Oystercatchers_thumb.jpg","galleries_id":136055,"server_id":32,"link":"photo_2055401.html","width":130,"caption":"Oystercatchers","height":94});
															thumbnails[2055486] = clik.newPhoto({"id":2055486,"src":"Quinag_from_Loch_Assynt_thumb.jpg","galleries_id":136055,"server_id":32,"link":"photo_2055486.html","width":130,"caption":"Quinag and Loch Assynt","height":82});
															thumbnails[2055487] = clik.newPhoto({"id":2055487,"src":"Split_rock_valley_thumb.jpg","galleries_id":136055,"server_id":32,"link":"photo_2055487.html","width":130,"caption":"Split Rock","height":87});
															thumbnails[2055488] = clik.newPhoto({"id":2055488,"src":"Stac_Pollaidh_and_tree_mirror_reflection_thumb.jpg","galleries_id":136055,"server_id":32,"link":"photo_2055488.html","width":130,"caption":"Stac Pollaidh","height":82});
															thumbnails[2055489] = clik.newPhoto({"id":2055489,"src":"Stormy_sea_at_Split_Rock_thumb.jpg","galleries_id":136055,"server_id":32,"link":"photo_2055489.html","width":130,"caption":"Split Rock in a Winter gale","height":98});
															thumbnails[2055495] = clik.newPhoto({"id":2055495,"src":"water_lily_loch_thumb.jpg","galleries_id":136055,"server_id":32,"link":"photo_2055495.html","width":130,"caption":"Water Lilies","height":98});
															thumbnails[5555608] = clik.newPhoto({"id":5555608,"src":"Traffic_Jam_in_clachtoll_thumb.jpg","galleries_id":136055,"server_id":32,"link":"photo_5555608.html","width":130,"caption":"A traffic jam in clachtoll","height":70});
															thumbnails[6915289] = clik.newPhoto({"id":6915289,"src":"April_Sunset_from_mobile-phone_hot-spot_thumb.jpg","galleries_id":136055,"server_id":32,"link":"photo_6915289.html","width":130,"caption":"April sunset at the mobile phone hotspot","height":86});
															thumbnails[6915298] = clik.newPhoto({"id":6915298,"src":"Ariel_view_of_Assynt_mountains_thumb.jpg","galleries_id":136055,"server_id":32,"link":"photo_6915298.html","width":130,"caption":"Aerial view of Clachtoll caravan park and surrounding Assynt mountains","height":87});
															thumbnails[6915331] = clik.newPhoto({"id":6915331,"src":"Ariel_view_of_Stoer_and_Clachtoll_beach_thumb.jpg","galleries_id":136055,"server_id":32,"link":"photo_6915331.html","width":130,"caption":"Aerial view of Stoer and Clachtoll beaches.","height":87});
															thumbnails[6915337] = clik.newPhoto({"id":6915337,"src":"Villa_thumb.JPG","galleries_id":136055,"server_id":32,"link":"photo_6915337.html","width":130,"caption":"Caravan to rent","height":86});
															thumbnails[6915342] = clik.newPhoto({"id":6915342,"src":"Westmorland_thumb.JPG","galleries_id":136055,"server_id":32,"link":"photo_6915342.html","width":130,"caption":"Caravan to let","height":86});
															thumbnails[6915346] = clik.newPhoto({"id":6915346,"src":"Jellyfish_thumb.JPG","galleries_id":136055,"server_id":32,"link":"photo_6915346.html","width":130,"caption":"Jellyfish","height":86});
															thumbnails[6915348] = clik.newPhoto({"id":6915348,"src":"winter_sunset_from_a_caravan_thumb.jpg","galleries_id":136055,"server_id":32,"link":"photo_6915348.html","width":130,"caption":"Winter sunset from a caravan","height":141});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[136055] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"<h4>Picture Gallery<\/h4>","link":"section176033.html","maxRecords":0.0,"photoIDs":[2041332.0,2042924.0,2044537.0,2052878.0,2052901.0,2053145.0,2053158.0,2053160.0,2053169.0,2053173.0,2053177.0,2053184.0,2053193.0,2054693.0,2054707.0,2054730.0,2054735.0,2054765.0,2054771.0,2055386.0,2055389.0,2055392.0,2055396.0,2055401.0,2055486.0,2055487.0,2055488.0,2055489.0,2055495.0,5555608.0,6915289.0,6915298.0,6915331.0,6915337.0,6915342.0,6915346.0,6915348.0],"skipIndex":0,"section_code":"section176033","featured_images":2041332.0,"id":136055,"singleSection":true});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '2055495,2055489,2055488,2055487,2055486,2055401,2055396,2055392,2055389,2055386,2054771,2054765,2054735,2054730,2054707,2054693,2053193,2053184,2053177,2053173,2053169,2053160,2053158,2053145,2052901,2052878,2044537,2042924,2042681,2041332';
imageSets[2] = '2041332';
imageSets[3] = '2086679,2085769,2059213,2056512,2056508,2056504,2056500,2056495,2056488,2055824,2055820,2055817,2055607,2055604,2055602,2055495,2055489,2055488,2055487,2055486,2055401,2055396,2055392,2055389,2055386,2054771,2054765,2054735,2054730,2054707,2054693,2053963,2053678,2053676,2053650,2053193,2053184,2053177,2053173,2053169,2053160,2053158,2053147,2053145,2052901,2052898,2052884,2052878,2044537';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'www12.clikpic.com/clachtollholidays/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/clachtollholidays/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/clachtollholidays/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/clachtollholidays/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/clachtollholidays/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/clachtollholidays/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/clachtollholidays/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/clachtollholidays/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/clachtollholidays/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/clachtollholidays/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/clachtollholidays/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/clachtollholidays/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/clachtollholidays/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/clachtollholidays/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/clachtollholidays/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/clachtollholidays/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/clachtollholidays/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/clachtollholidays/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/clachtollholidays/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/clachtollholidays/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/clachtollholidays/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/clachtollholidays/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/clachtollholidays/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/clachtollholidays/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/clachtollholidays/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 += 'section176033.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 && 'section176033' != '') {
					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 = 'Clachtoll Holidays: ' + 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> ' + (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 !== '' || this.payment_groups_id !== '') {
			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;
	}
}

			

