window.thumbnails = {};
															thumbnails[6946898] = clik.newPhoto({"id":6946898,"src":"101-04_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Bamborough Castle, Northumberland","height":86});
															thumbnails[6946917] = clik.newPhoto({"id":6946917,"src":"m103-13_16bit_16x_v2_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Corgarff Castle, Aberdeenshire 1","height":69});
															thumbnails[6946974] = clik.newPhoto({"id":6946974,"src":"NK1_4316_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":159});
															thumbnails[6946893] = clik.newPhoto({"id":6946893,"src":"37-12_thumb.jpg","galleries_id":191154,"server_id":1,"link":"photo_6946893.html","width":130,"caption":"Huntly Castle, Aberdeenshire","height":194});
															thumbnails[6946913] = clik.newPhoto({"id":6946913,"src":"m90-19_16bit_16x_ver_4_for_Big_Pete_thumb.jpg","galleries_id":191154,"server_id":1,"link":"photo_6946913.html","width":130,"caption":"Corgarff Castle, Aberdeenshire 2","height":92});
															thumbnails[6946927] = clik.newPhoto({"id":6946927,"src":"m119-6-16bit-x40000_thumb.jpg","galleries_id":191154,"server_id":1,"link":"photo_6946927.html","width":130,"caption":"Albert Dock, Liverpool","height":92});
															thumbnails[6946934] = clik.newPhoto({"id":6946934,"src":"NK1_1190_HDR_20091011_thumb.jpg","galleries_id":191154,"server_id":1,"link":"photo_6946934.html","width":130,"caption":"Brown's Place and the Vennel, Edinburgh","height":92});
															thumbnails[6946940] = clik.newPhoto({"id":6946940,"src":"NK1_1569_3_sized_filtered_thumb.jpg","galleries_id":191154,"server_id":1,"link":"photo_6946940.html","width":130,"caption":"Palm House, Sefton Park, Liverpool","height":129});
															thumbnails[6946961] = clik.newPhoto({"id":6946961,"src":"NK1_2751_thumb.jpg","galleries_id":191154,"server_id":1,"link":"photo_6946961.html","width":130,"caption":"Bow Street, Edinburgh","height":129});
															thumbnails[6946968] = clik.newPhoto({"id":6946968,"src":"NK1_3320_thumb.jpg","galleries_id":191154,"server_id":1,"link":"photo_6946968.html","width":130,"caption":"","height":98});
															thumbnails[6946996] = clik.newPhoto({"id":6946996,"src":"NK1_4441_thumb.jpg","galleries_id":191154,"server_id":1,"link":"photo_6946996.html","width":130,"caption":"Cluny Crichton Castle, Raemoir","height":130});
															thumbnails[6947008] = clik.newPhoto({"id":6947008,"src":"NK1_4795_thumb.jpg","galleries_id":191154,"server_id":1,"link":"photo_6947008.html","width":130,"caption":"Three Graces, Liverpool","height":62});
															thumbnails[6947012] = clik.newPhoto({"id":6947012,"src":"NK1_4808_thumb.jpg","galleries_id":191154,"server_id":1,"link":"photo_6947012.html","width":130,"caption":"Liver Buildings, Liverpool","height":203});
															thumbnails[6947020] = clik.newPhoto({"id":6947020,"src":"NK1_5462_thumb.jpg","galleries_id":191154,"server_id":1,"link":"photo_6947020.html","width":130,"caption":"Calanais, Lewis 2","height":87});
															thumbnails[6947024] = clik.newPhoto({"id":6947024,"src":"NK1_5467_thumb.jpg","galleries_id":191154,"server_id":1,"link":"photo_6947024.html","width":130,"caption":"Calanais, Lewis 1","height":130});
															thumbnails[6947031] = clik.newPhoto({"id":6947031,"src":"Ruined_cottage_panorama_composite_v2_thumb.jpg","galleries_id":191154,"server_id":1,"link":"photo_6947031.html","width":130,"caption":"Abandoned Cottage, Raemoir","height":130});
															thumbnails[6947047] = clik.newPhoto({"id":6947047,"src":"KnockCastleUntitled_Panorama2_thumb.jpg","galleries_id":191154,"server_id":1,"link":"photo_6947047.html","width":130,"caption":"Knock Castle","height":58});
															thumbnails[6947053] = clik.newPhoto({"id":6947053,"src":"NK1_4448_thumb.jpg","galleries_id":191154,"server_id":1,"link":"photo_6947053.html","width":130,"caption":"Shed, Stonehaven Harbour","height":130});
															thumbnails[6962596] = clik.newPhoto({"id":6962596,"src":"17-12_scan_20090102v2_filtered_thumb.jpg","galleries_id":376602,"server_id":1,"link":"photo_6962596.html","width":130,"caption":"Aberdeen Harbour, winter light","height":85});
															thumbnails[6962603] = clik.newPhoto({"id":6962603,"src":"25-21_thumb.jpg","galleries_id":376602,"server_id":1,"link":"photo_6962603.html","width":130,"caption":"Stonehaven Harbour","height":85});
															thumbnails[6962607] = clik.newPhoto({"id":6962607,"src":"89-280204ct1_v2_thumb.jpg","galleries_id":376602,"server_id":1,"link":"photo_6962607.html","width":130,"caption":"Brocklebank, Canning Dock","height":97});
															thumbnails[6962609] = clik.newPhoto({"id":6962609,"src":"110m-32a_thumb.jpg","galleries_id":376602,"server_id":1,"link":"photo_6962609.html","width":130,"caption":"Creels, Portlethen","height":91});
															thumbnails[6962612] = clik.newPhoto({"id":6962612,"src":"121m-20051124mp1-11_thumb.jpg","galleries_id":376602,"server_id":1,"link":"photo_6962612.html","width":130,"caption":"Mermaid, Catterline","height":105});
															thumbnails[6962614] = clik.newPhoto({"id":6962614,"src":"137-6-v2_thumb.jpg","galleries_id":376602,"server_id":1,"link":"photo_6962614.html","width":130,"caption":"Brocklebank and Wyncham","height":89});
															thumbnails[6962615] = clik.newPhoto({"id":6962615,"src":"IMG_1391_thumb.jpg","galleries_id":376602,"server_id":1,"link":"photo_6962615.html","width":130,"caption":"Three Circles, Albert Dock","height":310});
															thumbnails[6962620] = clik.newPhoto({"id":6962620,"src":"NK1_1719_straight_from_raw_filtered_green_channel_only_thumb.jpg","galleries_id":376602,"server_id":1,"link":"photo_6962620.html","width":130,"caption":"Macduff Lighthouse","height":130});
															thumbnails[6962624] = clik.newPhoto({"id":6962624,"src":"NK1_3454_thumb.jpg","galleries_id":376602,"server_id":1,"link":"photo_6962624.html","width":130,"caption":"Portsoy Harbour","height":130});
															thumbnails[6962627] = clik.newPhoto({"id":6962627,"src":"NK1_4683_thumb.jpg","galleries_id":376602,"server_id":1,"link":"photo_6962627.html","width":130,"caption":"Stonehaven Harbour 2","height":85});
															thumbnails[6962630] = clik.newPhoto({"id":6962630,"src":"NK1_4685_thumb.jpg","galleries_id":376602,"server_id":1,"link":"photo_6962630.html","width":130,"caption":"Stonehave Harbour 1","height":195});
															thumbnails[6962633] = clik.newPhoto({"id":6962633,"src":"NK1_4982_thumb.jpg","galleries_id":376602,"server_id":1,"link":"photo_6962633.html","width":130,"caption":"Sarsia, Birkenhead","height":182});
															thumbnails[6962634] = clik.newPhoto({"id":6962634,"src":"NK_1340_v2_thumb.jpg","galleries_id":376602,"server_id":1,"link":"photo_6962634.html","width":130,"caption":"Mersey Lightship, Canning Dock, Liverpool","height":188});
															thumbnails[6962640] = clik.newPhoto({"id":6962640,"src":"142-0035_thumb.jpg","galleries_id":376603,"server_id":1,"link":"photo_6962640.html","width":130,"caption":"Frozen couple","height":86});
															thumbnails[6962644] = clik.newPhoto({"id":6962644,"src":"Invercauld_Bridge_-_interpretation_2_10x10_thumb.jpg","galleries_id":376603,"server_id":1,"link":"photo_6962644.html","width":130,"caption":"Invercauld Bridge near Braemar","height":130});
															thumbnails[6962645] = clik.newPhoto({"id":6962645,"src":"m100-8_16bit_20091018__thumb.jpg","galleries_id":376603,"server_id":1,"link":"photo_6962645.html","width":130,"caption":"Loch Gairloch","height":194});
															thumbnails[6962648] = clik.newPhoto({"id":6962648,"src":"NK1_4585_thumb.jpg","galleries_id":376603,"server_id":1,"link":"photo_6962648.html","width":130,"caption":"Crathes Castle pond","height":130});
															thumbnails[7060256] = clik.newPhoto({"id":7060256,"src":"NK1_5962_thumb.jpg","galleries_id":191154,"server_id":1,"link":"photo_7060256.html","width":130,"caption":"Edinburgh skyline","height":182});
															thumbnails[7088509] = clik.newPhoto({"id":7088509,"src":"NK1_5958_thumb.jpg","galleries_id":191154,"server_id":1,"link":"photo_7088509.html","width":130,"caption":"Edinburgh skyline against the Pentland Hills","height":85});
															thumbnails[7233877] = clik.newPhoto({"id":7233877,"src":"NK1_5721_thumb.jpg","galleries_id":376602,"server_id":1,"link":"photo_7233877.html","width":130,"caption":"Wreck, Badachro harbour","height":87});
															thumbnails[7349468] = clik.newPhoto({"id":7349468,"src":"NK1_5315_thumb.jpg","galleries_id":376603,"server_id":1,"link":"photo_7349468.html","width":130,"caption":"Croft, Scalpay, Isle of Harris","height":196});
															thumbnails[8583946] = clik.newPhoto({"id":8583946,"src":"NK1_6224_thumb.jpg","galleries_id":376603,"server_id":38,"link":"photo_8583946.html","width":130,"caption":"Walking on water","height":194});
															thumbnails[8583964] = clik.newPhoto({"id":8583964,"src":"NK1_6676_thumb.jpg","galleries_id":191154,"server_id":38,"link":"photo_8583964.html","width":130,"caption":"Achindoun Castle","height":87});
															thumbnails[8583973] = clik.newPhoto({"id":8583973,"src":"NK1_6650_thumb.jpg","galleries_id":191154,"server_id":38,"link":"photo_8583973.html","width":130,"caption":"Bootle warehouses","height":86});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[191154] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"The built environment","link":"gallery_191154.html","maxRecords":0.0,"photoIDs":[6946893.0,6946913.0,6946927.0,6946934.0,6946940.0,6946961.0,6946968.0,6946996.0,6947008.0,6947012.0,6947020.0,6947024.0,6947031.0,6947047.0,6947053.0,7060256.0,7088509.0,8583964.0,8583973.0],"skipIndex":0,"section_code":"gallery","featured_images":"8583973,8583964,7088509,6947053,6947047,6947024,6947020,6947012,6947008,6946996,6946968,6946961,6946940,6946934,6946927,6946913","id":191154,"singleSection":false});				  						galleries[376602] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Ships and the sea","link":"gallery_376602.html","maxRecords":0.0,"photoIDs":[6962596.0,6962603.0,6962607.0,6962609.0,6962612.0,6962614.0,6962615.0,6962620.0,6962624.0,6962627.0,6962630.0,6962633.0,6962634.0,7233877.0],"skipIndex":0,"section_code":"gallery","featured_images":"7233877,6962634,6962633,6962624,6962620,6962614,6962612,6962607","id":376602,"singleSection":false});				  						galleries[376603] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"The landscape","link":"gallery_376603.html","maxRecords":0.0,"photoIDs":[6962640.0,6962644.0,6962645.0,6962648.0,7349468.0,8583946.0],"skipIndex":0,"section_code":"gallery","featured_images":"7349468,6962648,6962644","id":376603,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[237563] = '6962644,6962634,6962630,6962627,6962614,6962607,6962603,6962596,6947053,6947047,6947012,6947008,6946974,6946961,6946898,6946893';
imageSets[237564] = '8583973,8583964,8583946,7349468,7233877,7088509,7060256,6962648,6962645,6962640,6962633,6962624,6962620,6962615,6962612,6962609,6947031,6947024,6947020,6946996,6946968,6946940,6946934,6946927,6946917,6946913,6946898';
imageSets[237565] = '8583973,6962634,6962633,6962615,6962614,6962607,6947012,6947008,6946974,6946968,6946940,6946927';
imageSets[237566] = '8583964,7349468,7233877,7088509,7060256,6962648,6962645,6962644,6962640,6962630,6962627,6962624,6962620,6962612,6962609,6962603,6962596,6947053,6947047,6947031,6947024,6947020,6946996,6946961,6946934,6946917,6946913,6946893';
imageSets[237567] = '7349468,7060256,6962648,6962645,6962644,6962640';
imageSets[237568] = '7233877,6962634,6962633,6962630,6962627,6962624,6962620,6962615,6962614,6962612,6962609,6962607,6962603,6962596';
imageSets[237569] = '8583973,8583964,7088509,6947053,6947047,6947031,6947024,6947020,6947012,6947008,6946996,6946974,6946968,6946961,6946940,6946934,6946927,6946917,6946913,6946898,6946893';
imageSets[1] = '8583973,8583964,7349468,7233877,7088509,7060256,6962648,6962645,6962644,6962634,6962633,6962627,6962624,6962620,6962614,6962612,6962607,6962603,6947053,6947047,6947020,6947012,6947008,6946996,6946940,6946934,6946927,6946913';
imageSets[3] = '8583973,8583964,7349468,7233877,7088509,7060256,6962648,6962645,6962644,6962640,6962634,6962633,6962630,6962627,6962624,6962620,6962615,6962614,6962612,6962609,6962607,6962603,6962596,6947053,6947047,6947031,6947024,6947020,6947012,6947008,6946996,6946974,6946968,6946961,6946940,6946934,6946927,6946917,6946913,6946898,6946893';
imageSets[2] = '8583973,8583964,7349468,7233877,7088509,6962648,6962644,6962634,6962633,6962624,6962620,6962614,6962612,6962607,6947053,6947047,6947024,6947020,6947012,6947008,6946996,6946968,6946961,6946940,6946934,6946927,6946917,6946913,6946898';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'www12.clikpic.com/lightstory/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/lightstory/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/lightstory/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/lightstory/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/lightstory/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/lightstory/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/lightstory/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/lightstory/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/lightstory/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/lightstory/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/lightstory/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/lightstory/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/lightstory/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/lightstory/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/lightstory/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/lightstory/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/lightstory/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/lightstory/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/lightstory/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/lightstory/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/lightstory/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/lightstory/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/lightstory/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/lightstory/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 = 'Lightstory: ' + 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.payment_groups_id !== '') {
		temp += '<p>Buy this print online:</p>';
				temp += '<form id="paymentOptions" style="margin:0px;border:0px;" name="paymentOptions">';
											temp += '<select class="paymentlink" name="payment_options_id" onchange="updateItemValues($(this.form).next(\'#paymentForm\')[0],this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value);">';
		
		temp += getPaymentOptions(this.payment_groups_id);
		temp += '</select>';
		temp += '</form>';
				var item_option  = paymentGroups[this.payment_groups_id].options[0];
		if(paymentOptions[item_option]){
			var item_name  = paymentOptions[item_option].payment_option;
			var amount =  paymentOptions[item_option].price;
		}
			}
	else {
		
	}
	if (this.item_price !== '' || this.payment_groups_id !== '') {
			temp += '<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;
	}
}

			

