window.thumbnails = {};
															thumbnails[2202948] = clik.newPhoto({"id":2202948,"src":"a4-mousehole-from-air-1_thumb.jpg","galleries_id":145620,"server_id":32,"link":"photo_2202948.html","width":130,"caption":"Photos of Cornwall - Mousehole Harbour","height":92});
															thumbnails[2202958] = clik.newPhoto({"id":2202958,"src":"a4-hayle-from-air_thumb.jpg","galleries_id":145620,"server_id":32,"link":"photo_2202958.html","width":130,"caption":"Photos of Cornwall - Hayle Estuary","height":92});
															thumbnails[2202967] = clik.newPhoto({"id":2202967,"src":"a4-newlyn-from-air_thumb.jpg","galleries_id":145620,"server_id":32,"link":"photo_2202967.html","width":130,"caption":"Photos of Cornwall - Newlyn Harbour","height":92});
															thumbnails[2202971] = clik.newPhoto({"id":2202971,"src":"porthgwarra-from-air_thumb.jpg","galleries_id":145620,"server_id":32,"link":"photo_2202971.html","width":130,"caption":"Photos of Cornwall - Porthgwarra Cove","height":87});
															thumbnails[2202982] = clik.newPhoto({"id":2202982,"src":"a4-sennen-lifeboatstation_thumb.jpg","galleries_id":145620,"server_id":32,"link":"photo_2202982.html","width":130,"caption":"Photos of Cornwall - Sennen Cove Lifeboat Station","height":92});
															thumbnails[2203007] = clik.newPhoto({"id":2203007,"src":"a4-st-ives-from-air-2_thumb.jpg","galleries_id":145620,"server_id":32,"link":"photo_2203007.html","width":130,"caption":"Photos of Cornwall - St Ives","height":92});
															thumbnails[2203011] = clik.newPhoto({"id":2203011,"src":"A4-st-ives-from-air-3_thumb.jpg","galleries_id":145620,"server_id":32,"link":"photo_2203011.html","width":130,"caption":"Photos of Cornwall - St Ives","height":92});
															thumbnails[2203022] = clik.newPhoto({"id":2203022,"src":"a4-smm-from-air-21_thumb.jpg","galleries_id":145620,"server_id":32,"link":"photo_2203022.html","width":130,"caption":"Photos of Cornwall - St Michaels Mount","height":76});
															thumbnails[2204328] = clik.newPhoto({"id":2204328,"src":"a4-godrevy-1_thumb.jpg","galleries_id":145673,"server_id":32,"link":"photo_2204328.html","width":130,"caption":"Photos of Cornwall - Godrevy Lighthouse","height":92});
															thumbnails[2204351] = clik.newPhoto({"id":2204351,"src":"a4-godrevy-from-mexico_thumb.jpg","galleries_id":145673,"server_id":32,"link":"photo_2204351.html","width":130,"caption":"Photos of Cornwall - Godrevy Lighthouse from Mexico Towans","height":92});
															thumbnails[2204378] = clik.newPhoto({"id":2204378,"src":"st-ives-6_thumb.jpg","galleries_id":145673,"server_id":32,"link":"photo_2204378.html","width":130,"caption":"Photos of Cornwall - Smeaton's Pier, St Ives","height":86});
															thumbnails[2204410] = clik.newPhoto({"id":2204410,"src":"st-michaels-mount_048FE0C0-1D09-001F-99C229E7A4013914_thumb.jpg","galleries_id":145673,"server_id":32,"link":"photo_2204410.html","width":130,"caption":"Photos of Cornwall - St Michaels Mount","height":92});
															thumbnails[2204534] = clik.newPhoto({"id":2204534,"src":"a4-misty-morning-1_thumb.jpg","galleries_id":145690,"server_id":32,"link":"photo_2204534.html","width":130,"caption":"Photos of Cornwall - Misty Morning at Lanner","height":92});
															thumbnails[2204541] = clik.newPhoto({"id":2204541,"src":"a4-misty-morning-2_thumb.jpg","galleries_id":145690,"server_id":32,"link":"photo_2204541.html","width":130,"caption":"Photos of Cornwall - Misty Morning at Lanner","height":92});
															thumbnails[2204620] = clik.newPhoto({"id":2204620,"src":"steam-with-engine-house_thumb.jpg","galleries_id":145693,"server_id":32,"link":"photo_2204620.html","width":130,"caption":"Photos of Cornwall - Double Header at Scorrier","height":83});
															thumbnails[2204629] = clik.newPhoto({"id":2204629,"src":"steam-train-pz_thumb.jpg","galleries_id":145693,"server_id":32,"link":"photo_2204629.html","width":130,"caption":"Photos of Cornwall - Double Header in Penzance Station","height":78});
															thumbnails[2206425] = clik.newPhoto({"id":2206425,"src":"a4-wave_thumb.jpg","galleries_id":145673,"server_id":32,"link":"photo_2206425.html","width":130,"caption":"Photos of Cornwall - Porthcurno Wave - Logan Rock","height":92});
															thumbnails[2232372] = clik.newPhoto({"id":2232372,"src":"St-Michaels-Mount_thumb.jpg","galleries_id":145620,"server_id":32,"link":"photo_2232372.html","width":130,"caption":"Photos of Cornwall - St Michaels Mount","height":92});
															thumbnails[5330760] = clik.newPhoto({"id":5330760,"src":"smm-from-air_thumb.jpg","galleries_id":145620,"server_id":32,"link":"photo_5330760.html","width":130,"caption":"Photos of Cornwall-St Michaels Mount","height":92});
															thumbnails[5331657] = clik.newPhoto({"id":5331657,"src":"a4-lanyon-quoit_thumb.jpg","galleries_id":145752,"server_id":32,"link":"photo_5331657.html","width":130,"caption":"Photos of Cornwall-Lanyon Quoit","height":92});
															thumbnails[5331769] = clik.newPhoto({"id":5331769,"src":"a4-men-an-tol_thumb.jpg","galleries_id":145752,"server_id":32,"link":"photo_5331769.html","width":130,"caption":"Photos of Cornwall-Men an Tol","height":92});
															thumbnails[5332251] = clik.newPhoto({"id":5332251,"src":"st-ives_thumb.jpg","galleries_id":145673,"server_id":32,"link":"photo_5332251.html","width":130,"caption":"Photos of Cornwall-St Ives","height":92});
															thumbnails[5333069] = clik.newPhoto({"id":5333069,"src":"King-Edward-I-Hayle_thumb.jpg","galleries_id":145693,"server_id":32,"link":"photo_5333069.html","width":130,"caption":"Photos of Cornwall-King Edward I over Hayle Viaduct-Painted Effect","height":92});
															thumbnails[5524577] = clik.newPhoto({"id":5524577,"src":"a3-porthcurno-wave-1_thumb.jpg","galleries_id":145673,"server_id":32,"link":"photo_5524577.html","width":130,"caption":"Photos of Cornwall-Porthcurno Wave-Cornwall","height":92});
															thumbnails[5849197] = clik.newPhoto({"id":5849197,"src":"O-Cromwell-Black-5-Web_thumb.jpg","galleries_id":145693,"server_id":32,"link":"photo_5849197.html","width":130,"caption":"Photos of Steam Trains...Oliver Cromwell over Hayle Viaduct","height":92});
															thumbnails[6692350] = clik.newPhoto({"id":6692350,"src":"wild-flowers_thumb.jpg","galleries_id":442082,"server_id":32,"link":"photo_6692350.html","width":130,"caption":"Wild Flowers","height":92});
															thumbnails[8304110] = clik.newPhoto({"id":8304110,"src":"13-x-13-inches-square-passion-flower-and-bee_thumb.jpg","galleries_id":442082,"server_id":32,"link":"photo_8304110.html","width":160,"caption":"Bee on a Passion Flower","height":160});
															thumbnails[8583017] = clik.newPhoto({"id":8583017,"src":"a4-primroses-and-buttercups-blur-and-lighten_thumb.jpg","galleries_id":442082,"server_id":32,"link":"photo_8583017.html","width":160,"caption":"Primroses and Buttercups, Pictures of Cornwall","height":113});
															thumbnails[8583110] = clik.newPhoto({"id":8583110,"src":"a4-boats-at-lelant_thumb.jpg","galleries_id":145673,"server_id":32,"link":"photo_8583110.html","width":160,"caption":"Boats at Lelant, Pictures of Cornwall","height":113});
															thumbnails[2204525] = clik.newPhoto({"id":2204525,"src":"a4-misty-morning_thumb.jpg","galleries_id":145690,"server_id":32,"link":"photo_2204525.html","width":130,"caption":"Photos of Cornwall - Misty Morning at Lanner","height":184});
															thumbnails[5331780] = clik.newPhoto({"id":5331780,"src":"a4-wheal-coates-1_thumb.jpg","galleries_id":145752,"server_id":32,"link":"photo_5331780.html","width":130,"caption":"Photos of Cornwall-Wheal Coates-St Agnes","height":184});
															thumbnails[2206039] = clik.newPhoto({"id":2206039,"src":"Spirits-of-the-Past_thumb.jpg","galleries_id":145752,"server_id":32,"link":"photo_2206039.html","width":130,"caption":"Photos of Cornwall - Spirits of the Past - Wheal Uny - Redruth.  How many ghosts can you see?","height":184});
															thumbnails[2204312] = clik.newPhoto({"id":2204312,"src":"af-godrevy_thumb.jpg","galleries_id":145673,"server_id":32,"link":"photo_2204312.html","width":130,"caption":"Photos of Cornwall - Godrevy Lighthouse","height":92});
															thumbnails[2204413] = clik.newPhoto({"id":2204413,"src":"smm-red-1-a4_thumb.jpg","galleries_id":145673,"server_id":32,"link":"photo_2204413.html","width":130,"caption":"Photos of Cornwall - St Michaels Mount Sunset","height":92});
															thumbnails[8463320] = clik.newPhoto({"id":8463320,"src":"a4-restronguet-sepia_thumb.jpg","galleries_id":145673,"server_id":32,"link":"photo_8463320.html","width":160,"caption":"Photos of Cornwall-Restronguet Creek","height":226});
															thumbnails[8463386] = clik.newPhoto({"id":8463386,"src":"restronguet-creek--pale-blue36-x-24-inches_thumb.jpg","galleries_id":145673,"server_id":32,"link":"photo_8463386.html","width":160,"caption":"Photos of Cornwall-Restronguet Creek","height":226});
															thumbnails[2204373] = clik.newPhoto({"id":2204373,"src":"a4-restronguet-blue_thumb.jpg","galleries_id":145673,"server_id":32,"link":"photo_2204373.html","width":130,"caption":"Photos of Cornwall - Restronguet Creek","height":184});
															thumbnails[2206246] = clik.newPhoto({"id":2206246,"src":"a4-impressions_thumb.jpg","galleries_id":145673,"server_id":32,"link":"photo_2206246.html","width":130,"caption":"Photos of Cornwall - Impressions","height":184});
															thumbnails[2204306] = clik.newPhoto({"id":2204306,"src":"a4-bluebells_thumb.jpg","galleries_id":145673,"server_id":32,"link":"photo_2204306.html","width":130,"caption":"Photos of Cornwall - Bluebells in Tehidy Woods","height":184});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[442082] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Miscellaneous","link":"gallery_442082.html","maxRecords":0.0,"photoIDs":[6692350.0,8304110.0,8583017.0],"skipIndex":0,"section_code":"gallery","featured_images":"8583017,8304110,6692350","id":442082,"singleSection":false});				  						galleries[145620] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Aerial Photographs","link":"gallery_145620.html","maxRecords":0.0,"photoIDs":[2202948.0,2202958.0,2202967.0,2202971.0,2202982.0,2203007.0,2203011.0,2203022.0,2232372.0,5330760.0],"skipIndex":0,"section_code":"gallery","featured_images":"5330760,2232372,2203022,2203011,2203007,2202982,2202971,2202967,2202958,2202948","id":145620,"singleSection":false});				  						galleries[145752] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Cornish Heritage Photographs","link":"gallery_145752.html","maxRecords":0.0,"photoIDs":[5331657.0,5331769.0,5331780.0,2206039.0],"skipIndex":0,"section_code":"gallery","featured_images":"5331780,5331769,5331657,2206039","id":145752,"singleSection":false});				  						galleries[145673] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Landscape and Seascape Photographs","link":"gallery_145673.html","maxRecords":0.0,"photoIDs":[2204328.0,2204351.0,2204378.0,2204410.0,2206425.0,5332251.0,5524577.0,8583110.0,2204312.0,2204413.0,8463320.0,8463386.0,2204373.0,2206246.0,2204306.0],"skipIndex":0,"section_code":"gallery","featured_images":"8583110,8463386,8463320,5524577,5332251,2206425,2206246,2204413,2204410,2204378","id":145673,"singleSection":false});				  						galleries[145693] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Steam Train Photographs","link":"gallery_145693.html","maxRecords":0.0,"photoIDs":[2204620.0,2204629.0,5333069.0,5849197.0],"skipIndex":0,"section_code":"gallery","featured_images":"5849197,5333069,2204629,2204620","id":145693,"singleSection":false});				  						galleries[145690] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Tree Photographs","link":"gallery_145690.html","maxRecords":0.0,"photoIDs":[2204534.0,2204541.0,2204525.0],"skipIndex":0,"section_code":"gallery","featured_images":"2204541,2204534,2204525","id":145690,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '2206425,2204620,2204541,2204378,2204351,2204328,2203022,2203011,2202958,2204312,2204413';
imageSets[3] = '8583110,8583017,8463386,8463320,8304110,6692350,5849197,5524577,5333069,5332251,5331780,5331769,5331657,5330760,2232372,2206425,2206246,2206039,2204629,2204620,2204541,2204534,2204525,2204413,2204410,2204378,2204373,2204351,2204328,2204312,2204306,2203022,2203011,2203007,2202982,2202971,2202967,2202958,2202948';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/cornishconcepts/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/cornishconcepts/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/cornishconcepts/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/cornishconcepts/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/cornishconcepts/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/cornishconcepts/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/cornishconcepts/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/cornishconcepts/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/cornishconcepts/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/cornishconcepts/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/cornishconcepts/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/cornishconcepts/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/cornishconcepts/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/cornishconcepts/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/cornishconcepts/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/cornishconcepts/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/cornishconcepts/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/cornishconcepts/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/cornishconcepts/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/cornishconcepts/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/cornishconcepts/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/cornishconcepts/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/cornishconcepts/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/cornishconcepts/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/cornishconcepts/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/cornishconcepts/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/cornishconcepts/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 = 'Cornish Concepts: ' + 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</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="ken_townend@hotmail.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="ken_townend@hotmail.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;
	}
}

			

