window.thumbnails = {};
															thumbnails[3890465] = clik.newPhoto({"id":3890465,"src":"DSC_2274_thumb.jpg","galleries_id":192201,"server_id":32,"link":"photo_3890465.html","width":130,"caption":"Two Rivers Folk Festival 2008","height":88});
															thumbnails[3890476] = clik.newPhoto({"id":3890476,"src":"izzy_looking_away_thumb.jpg","galleries_id":192201,"server_id":32,"link":"photo_3890476.html","width":76,"caption":"Izzy","height":130});
															thumbnails[3890485] = clik.newPhoto({"id":3890485,"src":"lemur_2_thumb.jpg","galleries_id":192202,"server_id":32,"link":"photo_3890485.html","width":130,"caption":"Lemur","height":88});
															thumbnails[4325934] = clik.newPhoto({"id":4325934,"src":"SethLakeman_thumb.jpg","galleries_id":192201,"server_id":32,"link":"photo_4325934.html","width":130,"caption":"Two Rivers Folk Festival 2009 ","height":87});
															thumbnails[4338849] = clik.newPhoto({"id":4338849,"src":"final-1_thumb.jpg","galleries_id":192202,"server_id":32,"link":"photo_4338849.html","width":87,"caption":"Izzy","height":130});
															thumbnails[4604593] = clik.newPhoto({"id":4604593,"src":"DSC_2712_thumb.jpg","galleries_id":192201,"server_id":32,"link":"photo_4604593.html","width":130,"caption":"Monmouthshire Show 2009","height":87});
															thumbnails[4604635] = clik.newPhoto({"id":4604635,"src":"DSC_9557_thumb.jpg","galleries_id":192201,"server_id":32,"link":"photo_4604635.html","width":87,"caption":"The Pigeon Detectives ","height":130});
															thumbnails[4803492] = clik.newPhoto({"id":4803492,"src":"EC_Sun_117_thumb.jpg","galleries_id":192201,"server_id":32,"link":"photo_4803492.html","width":86,"caption":"Eurocup 2009","height":130});
															thumbnails[4804036] = clik.newPhoto({"id":4804036,"src":"DSC_5123_thumb.jpg","galleries_id":192201,"server_id":32,"link":"photo_4804036.html","width":130,"caption":"Family portrait ","height":87});
															thumbnails[5407963] = clik.newPhoto({"id":5407963,"src":"light-theough-the-trees-dark_thumb.jpg","galleries_id":305491,"server_id":32,"link":"photo_5407963.html","width":130,"caption":"","height":87});
															thumbnails[5407964] = clik.newPhoto({"id":5407964,"src":"Trees-King-Arthur-Caves_thumb.jpg","galleries_id":305491,"server_id":32,"link":"photo_5407964.html","width":87,"caption":"","height":130});
															thumbnails[5407967] = clik.newPhoto({"id":5407967,"src":"woodland-velvia-50_thumb.jpg","galleries_id":305491,"server_id":32,"link":"photo_5407967.html","width":104,"caption":"","height":130});
															thumbnails[5413089] = clik.newPhoto({"id":5413089,"src":"woodland-3_thumb.jpg","galleries_id":305491,"server_id":32,"link":"photo_5413089.html","width":130,"caption":"","height":106});
															thumbnails[5413091] = clik.newPhoto({"id":5413091,"src":"woodland-4_thumb.jpg","galleries_id":305491,"server_id":32,"link":"photo_5413091.html","width":103,"caption":"","height":130});
															thumbnails[5413093] = clik.newPhoto({"id":5413093,"src":"woodland_thumb.jpg","galleries_id":305491,"server_id":32,"link":"photo_5413093.html","width":130,"caption":"","height":105});
															thumbnails[5413097] = clik.newPhoto({"id":5413097,"src":"woodland2_thumb.jpg","galleries_id":305491,"server_id":32,"link":"photo_5413097.html","width":104,"caption":"","height":130});
															thumbnails[5744911] = clik.newPhoto({"id":5744911,"src":"Hay-20-film-5_0071_thumb.jpg","galleries_id":192201,"server_id":32,"link":"photo_5744911.html","width":130,"caption":"Hay-on-Wye","height":105});
															thumbnails[5744914] = clik.newPhoto({"id":5744914,"src":"Hay-20-film-3_005_thumb.jpg","galleries_id":192201,"server_id":32,"link":"photo_5744914.html","width":130,"caption":"Hay-on-Wye","height":106});
															thumbnails[5744917] = clik.newPhoto({"id":5744917,"src":"Hay-20-film-1_009_thumb.jpg","galleries_id":192201,"server_id":32,"link":"photo_5744917.html","width":130,"caption":"Hay-on-Wye","height":104});
															thumbnails[6367035] = clik.newPhoto({"id":6367035,"src":"chrsit-2_thumb.jpg","galleries_id":192201,"server_id":32,"link":"photo_6367035.html","width":130,"caption":"Christening ","height":87});
															thumbnails[6367088] = clik.newPhoto({"id":6367088,"src":"bottle-1_thumb.jpg","galleries_id":192201,"server_id":32,"link":"photo_6367088.html","width":86,"caption":"Still life","height":130});
															thumbnails[6367089] = clik.newPhoto({"id":6367089,"src":"bottle-2_thumb.jpg","galleries_id":192201,"server_id":32,"link":"photo_6367089.html","width":130,"caption":"Still life","height":86});
															thumbnails[6367099] = clik.newPhoto({"id":6367099,"src":"baby-1_thumb.jpg","galleries_id":192202,"server_id":32,"link":"photo_6367099.html","width":86,"caption":"","height":130});
															thumbnails[6367100] = clik.newPhoto({"id":6367100,"src":"baby-2_thumb.jpg","galleries_id":192202,"server_id":32,"link":"photo_6367100.html","width":86,"caption":"","height":130});
															thumbnails[6367105] = clik.newPhoto({"id":6367105,"src":"doward-_thumb.jpg","galleries_id":192202,"server_id":32,"link":"photo_6367105.html","width":130,"caption":"The Doward","height":86});
															thumbnails[6771459] = clik.newPhoto({"id":6771459,"src":"Charlotte-dancing-1_thumb.jpg","galleries_id":368576,"server_id":32,"link":"photo_6771459.html","width":87,"caption":"Charlotte","height":130});
															thumbnails[6771460] = clik.newPhoto({"id":6771460,"src":"Charlotte-dancing-5_thumb.jpg","galleries_id":368576,"server_id":32,"link":"photo_6771460.html","width":130,"caption":"Charlotte","height":87});
															thumbnails[6771461] = clik.newPhoto({"id":6771461,"src":"Charlotte-dancing-8_thumb.jpg","galleries_id":368576,"server_id":32,"link":"photo_6771461.html","width":87,"caption":"Charlotte","height":130});
															thumbnails[6771463] = clik.newPhoto({"id":6771463,"src":"Charlotte-dancing-9_thumb.jpg","galleries_id":368576,"server_id":32,"link":"photo_6771463.html","width":130,"caption":"Charlotte","height":87});
															thumbnails[6848071] = clik.newPhoto({"id":6848071,"src":"DSC_1138_thumb.jpg","galleries_id":192201,"server_id":32,"link":"photo_6848071.html","width":87,"caption":"Wedding","height":130});
															thumbnails[6848073] = clik.newPhoto({"id":6848073,"src":"DSC_1196_thumb.jpg","galleries_id":192201,"server_id":32,"link":"photo_6848073.html","width":87,"caption":"Wedding","height":130});
															thumbnails[7152202] = clik.newPhoto({"id":7152202,"src":"DSC_1341_B1FED456-24E8-5EC4-4F1FB43AB2BD0E02_thumb.jpg","galleries_id":192201,"server_id":32,"link":"photo_7152202.html","width":86,"caption":"Wedding","height":130});
															thumbnails[7152203] = clik.newPhoto({"id":7152203,"src":"DSC_1392_thumb.jpg","galleries_id":192201,"server_id":32,"link":"photo_7152203.html","width":130,"caption":"Wedding","height":87});
															thumbnails[7247181] = clik.newPhoto({"id":7247181,"src":"DSC_2343_thumb.jpg","galleries_id":192201,"server_id":32,"link":"photo_7247181.html","width":86,"caption":"Clothes Show Live 2010","height":130});
															thumbnails[7247182] = clik.newPhoto({"id":7247182,"src":"DSC_2300_thumb.jpg","galleries_id":192201,"server_id":32,"link":"photo_7247182.html","width":87,"caption":"Clothes Show Live 2010","height":130});
															thumbnails[7542040] = clik.newPhoto({"id":7542040,"src":"DSC_3668_thumb.jpg","galleries_id":192202,"server_id":32,"link":"photo_7542040.html","width":130,"caption":"Kington 2011","height":86});
															thumbnails[7542042] = clik.newPhoto({"id":7542042,"src":"DSC_3688_thumb.jpg","galleries_id":192202,"server_id":32,"link":"photo_7542042.html","width":130,"caption":"Kington 2011","height":86});
															thumbnails[7542044] = clik.newPhoto({"id":7542044,"src":"DSC_3694_thumb.jpg","galleries_id":192202,"server_id":32,"link":"photo_7542044.html","width":130,"caption":"Kington 2011","height":86});
															thumbnails[7542045] = clik.newPhoto({"id":7542045,"src":"DSC_3699_thumb.jpg","galleries_id":192202,"server_id":32,"link":"photo_7542045.html","width":130,"caption":"Kington 2011","height":86});
															thumbnails[7542046] = clik.newPhoto({"id":7542046,"src":"DSC_3705_thumb.jpg","galleries_id":192202,"server_id":32,"link":"photo_7542046.html","width":130,"caption":"Kington 2011","height":86});
															thumbnails[7977685] = clik.newPhoto({"id":7977685,"src":"DSC_4628_thumb.jpg","galleries_id":192201,"server_id":32,"link":"photo_7977685.html","width":130,"caption":"Wedding","height":86});
															thumbnails[8132402] = clik.newPhoto({"id":8132402,"src":"DSC_1901_thumb.jpg","galleries_id":434939,"server_id":32,"link":"photo_8132402.html","width":130,"caption":"","height":86});
															thumbnails[8132403] = clik.newPhoto({"id":8132403,"src":"DSC_5791_thumb.jpg","galleries_id":434939,"server_id":32,"link":"photo_8132403.html","width":130,"caption":"","height":87});
															thumbnails[8132404] = clik.newPhoto({"id":8132404,"src":"DSC_5814_thumb.jpg","galleries_id":434939,"server_id":32,"link":"photo_8132404.html","width":130,"caption":"","height":87});
															thumbnails[8132407] = clik.newPhoto({"id":8132407,"src":"DSC_1894_thumb.jpg","galleries_id":434939,"server_id":32,"link":"photo_8132407.html","width":130,"caption":"","height":86});
															thumbnails[8132413] = clik.newPhoto({"id":8132413,"src":"DSC_1834_thumb.jpg","galleries_id":434939,"server_id":32,"link":"photo_8132413.html","width":130,"caption":"","height":86});
															thumbnails[8132414] = clik.newPhoto({"id":8132414,"src":"DSC_2645_thumb.jpg","galleries_id":434939,"server_id":32,"link":"photo_8132414.html","width":130,"caption":"","height":86});
															thumbnails[8514281] = clik.newPhoto({"id":8514281,"src":"DSC_5746_thumb.jpg","galleries_id":192201,"server_id":32,"link":"photo_8514281.html","width":130,"caption":"Family Portraits","height":86});
															thumbnails[8684438] = clik.newPhoto({"id":8684438,"src":"DSC_5757_thumb.jpg","galleries_id":192201,"server_id":32,"link":"photo_8684438.html","width":130,"caption":"Family portraits","height":106});
															thumbnails[8684440] = clik.newPhoto({"id":8684440,"src":"DSC_6065_thumb.jpg","galleries_id":192201,"server_id":32,"link":"photo_8684440.html","width":130,"caption":"Family portraits","height":86});
															thumbnails[5407960] = clik.newPhoto({"id":5407960,"src":"Light-in-the-trees_thumb.jpg","galleries_id":305491,"server_id":32,"link":"photo_5407960.html","width":130,"caption":"","height":87});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[434939] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Graduate Exibition 2011","link":"gallery_434939.html","maxRecords":0.0,"photoIDs":[8132402.0,8132403.0,8132404.0,8132407.0,8132413.0,8132414.0],"skipIndex":0,"section_code":"gallery","featured_images":"8132414,8132413,8132407,8132404,8132403,8132402","id":434939,"singleSection":false});				  						galleries[192201] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Commercial ","link":"gallery_192201.html","maxRecords":0.0,"photoIDs":[3890465.0,3890476.0,4325934.0,4604593.0,4604635.0,4803492.0,4804036.0,5744911.0,5744914.0,5744917.0,6367035.0,6367088.0,6367089.0,6848071.0,6848073.0,7152202.0,7152203.0,7247181.0,7247182.0,7977685.0,8514281.0,8684438.0,8684440.0],"skipIndex":0,"section_code":"gallery","featured_images":"8684440,8684438,8514281,7977685,7247182,7247181,7152203,7152202,6848073,6848071","id":192201,"singleSection":false});				  						galleries[192202] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Personal","link":"gallery_192202.html","maxRecords":0.0,"photoIDs":[3890485.0,4338849.0,6367099.0,6367100.0,6367105.0,7542040.0,7542042.0,7542044.0,7542045.0,7542046.0],"skipIndex":0,"section_code":"gallery","featured_images":"7542046,7542045,7542044,7542042,7542040,6367105,6367100,6367099,4338849,3890485","id":192202,"singleSection":false});				  						galleries[305491] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Woodland project","link":"gallery_305491.html","maxRecords":0.0,"photoIDs":[5407963.0,5407964.0,5407967.0,5413089.0,5413091.0,5413093.0,5413097.0,5407960.0],"skipIndex":0,"section_code":"gallery","featured_images":"5413097,5413093,5413091,5413089,5407967,5407964,5407963,5407960","id":305491,"singleSection":false});				  						galleries[368576] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Dance","link":"gallery_368576.html","maxRecords":0.0,"photoIDs":[6771459.0,6771460.0,6771461.0,6771463.0],"skipIndex":0,"section_code":"gallery","featured_images":"6771463,6771461,6771460,6771459","id":368576,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '4804036,4803492,4604635,4604593,4338849,4325934,3890485,3890476';
imageSets[3] = '4804036,4803492,4604635,4604593,4338849,4325934,3890485,3890476';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'www12.clikpic.com/tddphoto/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/tddphoto/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/tddphoto/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/tddphoto/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/tddphoto/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/tddphoto/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/tddphoto/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/tddphoto/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/tddphoto/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/tddphoto/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/tddphoto/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/tddphoto/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/tddphoto/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/tddphoto/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/tddphoto/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/tddphoto/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/tddphoto/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/tddphoto/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/tddphoto/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/tddphoto/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/tddphoto/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/tddphoto/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/tddphoto/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/tddphoto/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/tddphoto/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 = 'TDD Photography: ' + 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="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 += '<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="tddphoto@live.co.uk">';
					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="tddphoto@live.co.uk">';
				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;
	}
}

			

