window.thumbnails = new Object();
												thumbnails[3718517] = new thumbnail(3718517,'','','trebarwith_strand___1_thumb.jpg',130, 61,15,'#');
												thumbnails[3800920] = new thumbnail(3800920,'','','Trebarwith_Strand8_thumb.jpg',130, 63,15,'#');
												thumbnails[3819296] = new thumbnail(3819296,'','','TINTAGEL_2_thumb.jpg',130, 81,15,'#');
												thumbnails[3819297] = new thumbnail(3819297,'','','TINTAGEL_3_thumb.jpg',130, 81,15,'#');
												thumbnails[3819413] = new thumbnail(3819413,'','','trebarwith_thumb.jpg',130, 68,15,'#');
												thumbnails[5392301] = new thumbnail(5392301,'','','photo_canvas__copy_thumb.jpg',130, 57,15,'#');
												thumbnails[5392302] = new thumbnail(5392302,'','','canvas_photo_beach_thumb.jpg',130, 68,15,'#');
												thumbnails[5392303] = new thumbnail(5392303,'','','canvas_picture_thumb.jpg',130, 109,15,'#');
												thumbnails[5392304] = new thumbnail(5392304,'','','canvas_2_thumb.jpg',130, 42,15,'#');
												thumbnails[5392305] = new thumbnail(5392305,'','','photo_canvas___thumb.jpg',130, 277,15,'#');
												thumbnails[6138160] = new thumbnail(6138160,'','','cornwall_photos_thumb.gif',130, 28,15,'#');
												thumbnails[6138219] = new thumbnail(6138219,'','','BLACK_FINISHED_boscastle_thumb.jpg',130, 93,15,'#');
												thumbnails[6138220] = new thumbnail(6138220,'','','WHITE_FINISHED_SMALL1_thumb.jpg',130, 93,15,'#');
												thumbnails[6138229] = new thumbnail(6138229,'','','trebarwith_strand_666958C4-24E8-5EC4-4FD845792BE752D1_thumb.jpg',130, 169,15,'#');
												thumbnails[6138230] = new thumbnail(6138230,'','','footsteps_121B5418-24E8-5EC4-4F538E97D24EFE6A_thumb.jpg',130, 169,15,'#');
												thumbnails[3718158] = new thumbnail(3718158,'226609','The Strand - Trebarwith Strand, Cornwall','trebarwith_strand1_thumb.jpg',130, 86,15,'photo_3718158.html');
												thumbnails[5392256] = new thumbnail(5392256,'304300','','image07961_thumb.jpg',130, 87,15,'photo_5392256.html');
												thumbnails[3717838] = new thumbnail(3717838,'226609','Trebarwith Gold - Trebarwith Strand, Cornwall','trebarwith_strand__1_thumb.jpg',130, 87,15,'photo_3717838.html');
												thumbnails[6138664] = new thumbnail(6138664,'226609','Trebarwith Strand at sunset - Cornwall ','Trebarwith_Strand_at_sunset_north_Cornwall_3_9CA8662F-24E8-5EC4-4F58E5664275A981_thumb.jpg',130, 88,15,'photo_6138664.html');
												thumbnails[3718239] = new thumbnail(3718239,'226609','Gull Rock - Trebarwith Strand, Cornwall','trebarwith_strand____thumb.jpg',130, 87,15,'photo_3718239.html');
												thumbnails[3718336] = new thumbnail(3718336,'304299','','Rumps_point_thumb.jpg',130, 87,15,'photo_3718336.html');
												thumbnails[3800616] = new thumbnail(3800616,'304299','','porthcurno__thumb.jpg',130, 87,15,'photo_3800616.html');
												thumbnails[3800617] = new thumbnail(3800617,'304299','','_porth__nanven_thumb.jpg',130, 86,15,'photo_3800617.html');
												thumbnails[3718340] = new thumbnail(3718340,'304299','','lands-end_thumb.jpg',130, 87,15,'photo_3718340.html');
												thumbnails[3800633] = new thumbnail(3800633,'304299','','Trevose_lighthouse_thumb.jpg',130, 86,15,'photo_3800633.html');
												thumbnails[3800637] = new thumbnail(3800637,'304299','','mullion_thumb.jpg',130, 87,15,'photo_3800637.html');
												thumbnails[3800619] = new thumbnail(3800619,'304299','','marazion_thumb.jpg',130, 87,15,'photo_3800619.html');
												thumbnails[6138670] = new thumbnail(6138670,'226609','Slate Stacks - Trebarwith Strand, Cornwall','trebarwith_strand_slate_thumb.jpg',130, 87,15,'photo_6138670.html');
												thumbnails[3800626] = new thumbnail(3800626,'304299','','gunwalloe--_thumb.jpg',130, 85,15,'photo_3800626.html');
												thumbnails[6138672] = new thumbnail(6138672,'226609','Above The Port William - Trebarwith Strand, Cornwall','trebarwith_strand_above_thumb.jpg',130, 87,15,'photo_6138672.html');
												thumbnails[6138674] = new thumbnail(6138674,'226609','Sunny Days - Trebarwith Strand, Cornwall','trebarwith_strand_2CCA8EF2-24E8-5EC4-4F314DB02C5DA998_thumb.jpg',130, 87,15,'photo_6138674.html');
												thumbnails[6138677] = new thumbnail(6138677,'226609','Low Tide - Trebarwith Strand, Cornwall','trebarwith_strand_beach_thumb.jpg',130, 87,15,'photo_6138677.html');
												thumbnails[6138682] = new thumbnail(6138682,'226609','Trebarwith Strand at Low Tide, Cornwall','Trebarwith_Strand_at_Low_Tide_thumb.jpg',130, 87,15,'photo_6138682.html');
												thumbnails[6138688] = new thumbnail(6138688,'226609','Rocks at Trebarwith Strand - Cornwall','Rocks_at_Trebarwith_Strand_90A5A79B-1EC9-D45B-1C246D9B35355214_thumb.jpg',130, 87,15,'photo_6138688.html');
												thumbnails[6138697] = new thumbnail(6138697,'226609','Gorse at Trebarwith - Cornwall','Gorse_at_Trebarwith_90A5A5B6-1EC9-D45B-1C9CE83DFC2E00D51_thumb.jpg',130, 87,15,'photo_6138697.html');
												thumbnails[6138717] = new thumbnail(6138717,'226609','Low Tide at Trebarwith Strand - Cornwall','Low_Tide_at_Trebarwith_Strand_thumb.jpg',130, 87,15,'photo_6138717.html');
												thumbnails[3717709] = new thumbnail(3717709,'226609','Follow The Flow - Trebarwith Strand, Cornwall','trebarwith_strand_2831A859-2219-B5B5-4C35B648A00794EC_thumb.jpg',130, 195,15,'photo_3717709.html');
												thumbnails[3800554] = new thumbnail(3800554,'226609','A Circle In Stone - Trebarwith Strand, Cornwall','trebarwith_strand_____thumb.jpg',130, 195,15,'photo_3800554.html');
												thumbnails[3800573] = new thumbnail(3800573,'226609','Misty Waters - Trebarwith Strand, Cornwall','trebarwith_strand______thumb.jpg',130, 195,15,'photo_3800573.html');
												thumbnails[3800567] = new thumbnail(3800567,'226609','Incoming Tide - Trebarwith Strand, Cornwall','trebarwith_strand_________thumb.jpg',130, 195,15,'photo_3800567.html');
												thumbnails[3800564] = new thumbnail(3800564,'226609','Evening Sun - Trebarwith Strand, Cornwall','trebarwith_strand__________thumb.jpg',130, 195,15,'photo_3800564.html');
												thumbnails[8204263] = new thumbnail(8204263,'226609','Stormy Evening Light - Trebarwith Strand, Cornwall','Trebarwith_strand_stormy_evening_light_north_Cornwall_D0ABFF15-2219-B5B5-4CC3CE22CEA4C6D6_thumb.jpg',130, 195,15,'photo_8204263.html');
												thumbnails[8204203] = new thumbnail(8204203,'226609','Evening Glow - Trebarwith Strand, Cornwall','Trebarwith_Strand_Cornwall_thumb.jpg',130, 195,15,'photo_8204203.html');
												thumbnails[8204198] = new thumbnail(8204198,'226609','Trebarwith Strand at sunset I - Cornwall','Trebarwith_Strand_at_sunset_north_Cornwall_D0A65505-2219-B5B5-4C87B23A2220C3F9_thumb.jpg',130, 195,15,'photo_8204198.html');
												thumbnails[8204158] = new thumbnail(8204158,'226609','Trebarwith Strand at sunset III -  Cornwall','Trebarwith_strand_at_sunset_Cornwall_D0A27099-2219-B5B5-4C6D2DB3EBC70740_thumb.jpg',130, 195,15,'photo_8204158.html');
												thumbnails[3800589] = new thumbnail(3800589,'226609','Final Glow - Trebarwith Strand, Cornwall','trebarwith_strand___________thumb.jpg',130, 195,15,'photo_3800589.html');
												thumbnails[3800575] = new thumbnail(3800575,'226609','Channelled Through Time - Trebarwith Strand, Cornwall','trebarwith_strand2_thumb.jpg',130, 195,15,'photo_3800575.html');
												thumbnails[8204335] = new thumbnail(8204335,'226609','Trebarwith Strand B&W - Cornwall','Trebarwith_gull_rock_thumb.jpg',130, 195,15,'photo_8204335.html');
												thumbnails[3819433] = new thumbnail(3819433,'232773','Trebarwith Gold - Trebarwith Strand, Cornwall','The_Strand_TRIP_thumb.jpg',130, 85,15,'photo_3819433.html');
												thumbnails[3819511] = new thumbnail(3819511,'232773','The Rumps - Polzeath, Cornwall','Rumps_point_TRIP_thumb.jpg',130, 85,15,'photo_3819511.html');
												thumbnails[3819520] = new thumbnail(3819520,'232773','Greeb Zawn Bay - Land\'s End, Cornwall','lands-end_TRIP_thumb.jpg',130, 85,15,'photo_3819520.html');
												thumbnails[6138549] = new thumbnail(6138549,'232773','Gull Rock - Trebarwith Strand, Cornwall','trebarwith_strand_triptych_copy1_thumb.jpg',130, 85,15,'photo_6138549.html');
												thumbnails[6138572] = new thumbnail(6138572,'232773','Summer In The Dunes - Crantock, Cornwall','Summer_In_The_Dunes_Crantock_Cornwall_0BD3783F-24E8-5EC4-4FBC0707A6D97664_thumb.jpg',130, 85,15,'photo_6138572.html');
												thumbnails[6138594] = new thumbnail(6138594,'232773','Sunlight Reflecting - Godrevy Lighthouse, Cornwall','Sunlight_reflecting_off_the_lighthouse_triptych_thumb.jpg',130, 85,15,'photo_6138594.html');
												thumbnails[6138615] = new thumbnail(6138615,'232773','Bathed In Golden Light - Porth Nanven, Cornwall','Bathed_in_golden_light_Porth_Nanven_1496C4CA-24E8-5EC4-4F233719D30A6995_thumb.jpg',130, 85,15,'photo_6138615.html');
												thumbnails[6138637] = new thumbnail(6138637,'232773','A Little Sand Between Your Toes - Gwithian Towans, Cornwall','upton_towans_triptychs_thumb.jpg',130, 85,15,'photo_6138637.html');
												thumbnails[3819570] = new thumbnail(3819570,'232773','Returning Tide - St Michael\'s Mount, Cornwall','st_michaels_MountTRIP_thumb.jpg',130, 85,15,'photo_3819570.html');
												thumbnails[3819566] = new thumbnail(3819566,'232773','Turbulent Seas - Trevose Lighthouse, Cornwall','Trevose_lighthouse_TRIP_thumb.jpg',130, 85,15,'photo_3819566.html');
												thumbnails[3819505] = new thumbnail(3819505,'232773','Boulder Beach - Porth Nanven, Cornwall','_porth__nanven_TRIP_thumb.jpg',130, 85,15,'photo_3819505.html');
												thumbnails[3819567] = new thumbnail(3819567,'232773','Circle In The Sand - St Michael\'s Mount, Cornwall','marazion_TRIP_thumb.jpg',130, 85,15,'photo_3819567.html');
												thumbnails[3819571] = new thumbnail(3819571,'232773','Bluebell Woodland - Micheldever, Hampshire','Bluebell_Woodland_TRIP_thumb.jpg',130, 85,15,'photo_3819571.html');
												thumbnails[3819572] = new thumbnail(3819572,'232773','Morning Rays - Surrey','Sun_Rays_TRIP_thumb.jpg',130, 85,15,'photo_3819572.html');
												thumbnails[6138506] = new thumbnail(6138506,'232773','Misty Sunburst - Surrey','autumn_rays_TRIP_copy_thumb.jpg',130, 85,15,'photo_6138506.html');
												thumbnails[6138493] = new thumbnail(6138493,'232773','Standing Together - Exmoor','Exmoor_Dawn_TRIP_copy1_thumb.jpg',130, 85,15,'photo_6138493.html');
												thumbnails[6138467] = new thumbnail(6138467,'232773','Poppies','POPPIES_TRIPTYCH_thumb.jpg',130, 85,15,'photo_6138467.html');
												thumbnails[6138462] = new thumbnail(6138462,'232773','Foxgloves','foxgloves_triptych_thumb.jpg',130, 85,15,'photo_6138462.html');
												thumbnails[6138456] = new thumbnail(6138456,'232773','Sunflowers','SUNFLOWERS_TRIPTYCH_thumb.jpg',130, 85,15,'photo_6138456.html');
												thumbnails[6138323] = new thumbnail(6138323,'232773','Crocuses','FLOWERS_TRIPTYCH1_thumb.jpg',130, 85,15,'photo_6138323.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[232773] = new gallery(232773,'6138637,6138615,6138594,6138572,6138549,6138506,6138493,6138467,6138462,6138456','TRIPTYCH\'S','section284174',[3819433,3819511,3819520,6138549,6138572,6138594,6138615,6138637,3819570,3819566,3819505,3819567,3819571,3819572,6138506,6138493,6138467,6138462,6138456,6138323],0, 0, '', 'section284174.html',0,1);
				  					galleries[226609] = new gallery(226609,'8204335,8204263,8204203,8204198,8204158,6138717,6138697,6138688,6138682,6138677','TREBARWITH STRAND I','gallery',[3718158,3717838,6138664,3718239,6138670,6138672,6138674,6138677,6138682,6138688,6138697,6138717,3717709,3800554,3800573,3800567,3800564,8204263,8204203,8204198,8204158,3800589,3800575,8204335],0, 0, '', 'gallery_226609.html',0,0);
				  					galleries[304300] = new gallery(304300,'5392256','TINTAGEL','gallery',[5392256],0, 0, '', 'gallery_304300.html',0,0);
				  					galleries[304299] = new gallery(304299,'3800637,3800633,3800626,3800619,3800617,3800616,3718340,3718336','CORNWALL','gallery',[3718336,3800616,3800617,3718340,3800633,3800637,3800619,3800626],0, 0, '', 'gallery_304299.html',0,0);
				  					galleries[304301] = new gallery(304301,'','BOSCASTLE','gallery',[],0, 0, '', 'gallery_304301.html',0,0);
				  					galleries[226610] = new gallery(226610,'','TREBARWITH STRAND II','gallery',[],0, 0, '', 'gallery_226610.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '3718340,3718239,3718158,3717838';
imageSets[3] = '3819572,3819571,3819570,3819567,3819566,3819520,3819511,3819505,3819433,3819413,3819297,3819296,3800920,3800637,3800633,3800619,3800617,3800589,3800575,3800573,3800567,3800564,3800554,3718517,3718340,3718239,3718158,3717838,3717709';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/trebarwith/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/trebarwith/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/trebarwith/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/trebarwith/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/trebarwith/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/trebarwith/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/trebarwith/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/trebarwith/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/trebarwith/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/trebarwith/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/trebarwith/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/trebarwith/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/trebarwith/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/trebarwith/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/trebarwith/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/trebarwith/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/trebarwith/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/trebarwith/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/trebarwith/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/trebarwith/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/trebarwith/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/trebarwith/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:'',
                    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 (!basic) {
    if (op.updateHash && clik.getIDInUrl(location.href,'photo') != op.nextPhoto.id) {
		clik.changeHash('photos_id=' + op.nextPhoto.id, true);
    }
				
    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));		  $('body').trigger('clikUpdate');		}, op.onBefore);
      }    }
    	if (op.field) {
		op.field.value = photoId;
	} else {
		op.$photo.data('image_id', photoId);
    }
	    if (op.$title.length > 0) {
  		op.$title.fadeGalleryDetails(photoCaption, op.speed);
    }
        if (op.updateDocumentTitle) {
						  document.title = 'Trebarwith Strand: ' + photoCaption;
			    }
        if (op.$detail.length > 0) {
      temp = op.nextPhoto.fnGetImageDetails();
	    op.$detail.fadeGalleryDetails(temp, op.speed, function(){
	    var options = {};	    	      	      resizePhotoInfo(options);
        if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
  	      toggleAddToCartConfirm(backgrounds);
  	    } else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
  	      toggleAddToCartConfirm(photos);
  	    }
	    });
    }
        if (!op.speed) {      clik.doColumnResize(false, op.$photo.add(op.$detail).add(op.$title));      $('body').trigger('clikUpdate');    }        
    return html;			}
	else {
				
		window.location = 'photo_' + nextPhoto.id + '.html';
	}
		
}

/***************************************************************************
* Toggle add to cart confirmation element and set up the click event for   *
* the 'Add to cart' button.                                                *
***************************************************************************/
function toggleAddToCartConfirm(array){
  if (typeof(array) !== 'object' || array == undefined) {
    array = photos;
  }
	if($('#paymentConfirm').length > 0){
		$('#paymentConfirm').hide();
		$('#paymentAddButton')
		.unbind()
		.click(function(){
						form = document.getElementById('paymentForm');
			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').text('Item added to cart').show();}
				else{
					$('#paymentConfirm').text('Item added to cart').fadeIn();
					dspOrderDetails(form.site.value);
				}
			}
			else{
				$('#paymentConfirm').text('Item not added - check cookies are enabled in your browser.').fadeIn();
			}
		});
	}
}
/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
photo.prototype.fnGetImageDetails = function(){
	var temp = '';
	if (this.description != '') {
		temp = temp +  '<p id="imageDescription">' + this.description + '</p>';
	}
		if (this.photo_ref != '') {
		temp = temp + '<p class="imageinfo" id="imageRef"><strong>Ref: </strong>' + this.photo_ref + '</p>';
	}
		if (this.takendate != '') {
				
		temp = temp + '<p class="imageinfo" id="imageDate"><strong>Date: </strong>' + this.takendate + '</p>';
	}
	
	if (this.location != '') {
				
		temp = temp + '<p class="imageinfo" id="imageLocation"><strong>Location: </strong>' +  this.location + '</p>';
	}
	
	if (this.photographer != '') {
				
		temp = temp + '<p class="imageinfo" id="imagePhotographer"><strong>Photographer: </strong>' + this.photographer + '</p>';
	}
					
	temp = temp + this.fnGetPaymentInfo();
				if (temp != '') {
		temp = temp + '<div class="spacer"></div>';
	}
	return temp;
};

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
photo.prototype.fnGetPaymentInfo = function(){
	var temp = '';
	if (this.item_price !== '') {
																		temp = temp + '<p>Buy now using PayPal:</p>';
				temp = temp + '<p class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> &pound;' + (this.item_price).toFixed(2) + '</p>';
		var item_name  = this.purchase_instruction;
		var amount = (this.item_price).toFixed(2);
		var item_option  = 0;
	}
	else if (this.payment_groups_id !== '') {
		temp = temp + '<p><font color=#950049><B>BUY THIS ITEM ONLINE</B></font color=#950049></p>';
				temp = temp + '<form id="paymentOptions" style="margin:0px;border:0px;" name="paymentOptions">';
		 									temp = temp + '<select class="paymentlink" name="payment_options_id" onchange="updateCartValue(document.forms.paymentForm,this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value); if(divShowing(\'paymentConfirm\')){fadeOut(\'paymentConfirm\', 3)};">';
				
		temp = temp + getPaymentOptions(this.payment_groups_id);
		temp = temp + '</select>';
		temp = 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 = temp + '<form id="paymentForm" style="margin:0px;border:0px;" name="paymentForm">';
	temp = temp + '	<input type="hidden" name="item_option" value="' + item_option + '">';
	temp = temp + '	<input type="hidden" name="site" value="TREBARWITH">';
		temp = temp + '	<input type="hidden" name="item_number" value="'+ this.id +'">';
			temp = temp + '	<input type="hidden" name="quantity" value="1">';
								temp = temp + '	<input value="Add to cart" id="paymentAddButton" class="button" onmouseover="this.className=\'buttonHi\'\;" onmouseout="this.className=\'button\'\;" type="Button">';
			temp = temp + '	<input value="View cart" id="paymentViewButton" class="button" onmouseover="this.className=\'buttonHi\';" onmouseout="this.className=\'button\';" type="Button" onclick="javascript:window.location=\'cart.html\'">';
	temp = temp + '</form>';
		temp = temp + '<div class="clearing">&nbsp;</div>';
	temp = temp + '<div id="confirmContainer">';
	temp = temp + '<div id="paymentConfirm">Item added to cart</div>';
	temp = temp + '</div>';
			temp = 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({            href: thumbnails[imageID].fnGalleryLink(gallery_id),            title: galleries[gallery_id].title          });
        }
							}
										}
}

/***************************************************************************
* 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 + ' | ';
				}
				temp = temp + '<a href="' + galleries[i].section_code + '_' + galleries[i].id + '.html">' + galleries[i].title + '</a>';
			}
		}
		document.all.galleryLinks.innerHTML = 'Other galleries: ' + temp;
	}
}

			

