window.thumbnails = new Object();
												thumbnails[5923235] = new thumbnail(5923235,'334310','Proud','Proud_thumb.jpg',130, 148,32,'photo_5923235.html');
												thumbnails[5923288] = new thumbnail(5923288,'334310','','_DSC4016_thumb.jpg',130, 141,32,'photo_5923288.html');
												thumbnails[5923304] = new thumbnail(5923304,'91250','Sunrise at Amroth.','Amroth_thumb.jpg',130, 196,32,'photo_5923304.html');
												thumbnails[5923481] = new thumbnail(5923481,'91250','Barafundle Beach','BARAFUNDLE_thumb.jpg',130, 77,32,'photo_5923481.html');
												thumbnails[5923485] = new thumbnail(5923485,'91250','Carew Castle','_DSC5060_thumb.jpg',130, 76,32,'photo_5923485.html');
												thumbnails[5923489] = new thumbnail(5923489,'91250','Strumble Head ','Strumble-Head_thumb.jpg',130, 54,32,'photo_5923489.html');
												thumbnails[5923493] = new thumbnail(5923493,'91250','Freshwater West','SunsetFreshwater-West_thumb.jpg',130, 59,32,'photo_5923493.html');
												thumbnails[5923499] = new thumbnail(5923499,'334310','The Hunter','The-Hunter_thumb.jpg',130, 143,32,'photo_5923499.html');
												thumbnails[5923504] = new thumbnail(5923504,'334310','Little Auk','Little-Auk_thumb.jpg',130, 165,32,'photo_5923504.html');
												thumbnails[5923549] = new thumbnail(5923549,'91250','Manobier','_DSC5050_thumb.jpg',130, 197,32,'photo_5923549.html');
												thumbnails[5923550] = new thumbnail(5923550,'91250','Port Lion','PORT-LION-2_thumb.jpg',130, 79,32,'photo_5923550.html');
												thumbnails[5923553] = new thumbnail(5923553,'334310','Supper','BREAKFAST_thumb.jpg',130, 178,32,'photo_5923553.html');
												thumbnails[5924182] = new thumbnail(5924182,'334357','Freshwater West','_DSC5619_thumb.jpg',130, 57,32,'photo_5924182.html');
												thumbnails[5924187] = new thumbnail(5924187,'91250','Freshwater West','_DSC2884_thumb.jpg',130, 85,32,'photo_5924187.html');
												thumbnails[5924287] = new thumbnail(5924287,'334357','Bales','BALES_thumb.jpg',130, 72,32,'photo_5924287.html');
												thumbnails[5924290] = new thumbnail(5924290,'334357','Blown Out','Blown-Out_thumb.jpg',130, 181,32,'photo_5924290.html');
												thumbnails[5924292] = new thumbnail(5924292,'91250','Strumble Head Lighthouse','_DSC5127_thumb.jpg',130, 200,32,'photo_5924292.html');
												thumbnails[5925252] = new thumbnail(5925252,'334391','','BOZZY-042_thumb.jpg',130, 101,32,'photo_5925252.html');
												thumbnails[5925347] = new thumbnail(5925347,'334391','','BOZZY-057_thumb.jpg',130, 129,32,'photo_5925347.html');
												thumbnails[5925348] = new thumbnail(5925348,'334391','','BOZZY-093_thumb.jpg',130, 87,32,'photo_5925348.html');
												thumbnails[5925349] = new thumbnail(5925349,'334391','','Eye-Contact_thumb.jpg',130, 161,32,'photo_5925349.html');
												thumbnails[5925350] = new thumbnail(5925350,'334391','','OWL3_thumb.jpg',130, 87,32,'photo_5925350.html');
												thumbnails[5925351] = new thumbnail(5925351,'334391','','OWL5_thumb.jpg',130, 99,32,'photo_5925351.html');
												thumbnails[5925353] = new thumbnail(5925353,'334391','','OWL6_thumb.jpg',130, 118,32,'photo_5925353.html');
												thumbnails[5925500] = new thumbnail(5925500,'334310','','SKOMER3_thumb.jpg',130, 194,32,'photo_5925500.html');
												thumbnails[5925590] = new thumbnail(5925590,'334310','','SKOMER1_thumb.jpg',130, 212,32,'photo_5925590.html');
												thumbnails[5925609] = new thumbnail(5925609,'334310','The Lookout','On-Guard_thumb.jpg',130, 87,32,'photo_5925609.html');
												thumbnails[5925612] = new thumbnail(5925612,'334310','','Nest-Building-2_thumb.jpg',130, 80,32,'photo_5925612.html');
												thumbnails[5925618] = new thumbnail(5925618,'91250','Port Lion','PORT-LION-005_thumb.jpg',130, 41,32,'photo_5925618.html');
												thumbnails[5925645] = new thumbnail(5925645,'91250','Freshwater West','FRESH-a_thumb.jpg',130, 83,32,'photo_5925645.html');
												thumbnails[5926112] = new thumbnail(5926112,'334357','Pentre Ifan','DARK-AGES_thumb.jpg',130, 86,32,'photo_5926112.html');
												thumbnails[5926117] = new thumbnail(5926117,'334357','Corrans Bookshop','LAUGHARNE-022_thumb.jpg',130, 86,32,'photo_5926117.html');
												thumbnails[5926119] = new thumbnail(5926119,'334357','','_DSC5634_thumb.jpg',130, 84,32,'photo_5926119.html');
												thumbnails[5926121] = new thumbnail(5926121,'334357','','_DSC5472_thumb.jpg',130, 196,32,'photo_5926121.html');
												thumbnails[5926172] = new thumbnail(5926172,'334357','','STILL-LIFE1_thumb.jpg',130, 176,32,'photo_5926172.html');
												thumbnails[5926213] = new thumbnail(5926213,'334419','','ROBIN-2_thumb.jpg',130, 191,32,'photo_5926213.html');
												thumbnails[5926216] = new thumbnail(5926216,'334419','','_DSC1170_thumb.jpg',130, 196,32,'photo_5926216.html');
												thumbnails[5926217] = new thumbnail(5926217,'334419','','_DSC4797_thumb.jpg',130, 95,32,'photo_5926217.html');
												thumbnails[5926218] = new thumbnail(5926218,'334419','','_DSC1713_thumb.jpg',130, 86,32,'photo_5926218.html');
												thumbnails[5926236] = new thumbnail(5926236,'334420','','_DSC1000_thumb.jpg',130, 81,32,'photo_5926236.html');
												thumbnails[5926240] = new thumbnail(5926240,'334420','','_DSC4901_thumb.jpg',130, 101,32,'photo_5926240.html');
												thumbnails[5926244] = new thumbnail(5926244,'334420','','DAND-21_thumb.jpg',130, 99,32,'photo_5926244.html');
												thumbnails[5926247] = new thumbnail(5926247,'334420','','GERB1_thumb.jpg',130, 87,32,'photo_5926247.html');
												thumbnails[5926250] = new thumbnail(5926250,'334420','','MACRO2_thumb.jpg',130, 88,32,'photo_5926250.html');
												thumbnails[5926297] = new thumbnail(5926297,'334423','Eilean Donan Castle','_DSC3429_thumb.jpg',130, 66,32,'photo_5926297.html');
												thumbnails[5926304] = new thumbnail(5926304,'334423','Rannoch Moor','Glen-Lion_thumb.jpg',130, 176,32,'photo_5926304.html');
												thumbnails[5926307] = new thumbnail(5926307,'334423','Loch Leven','LOCH-LEVEN-2_thumb.jpg',130, 68,32,'photo_5926307.html');
												thumbnails[5926320] = new thumbnail(5926320,'334423','Loch Rannoch','LOCH-RANNOCH_thumb.jpg',130, 84,32,'photo_5926320.html');
												thumbnails[5926324] = new thumbnail(5926324,'334423','Rannoch Station','RS-1_thumb.jpg',130, 80,32,'photo_5926324.html');
												thumbnails[5926986] = new thumbnail(5926986,'334357','Tenby','TENBY-2-ort_thumb.jpg',130, 83,32,'photo_5926986.html');
												thumbnails[5926987] = new thumbnail(5926987,'334357','','_DSC5656_thumb.jpg',130, 76,32,'photo_5926987.html');
												thumbnails[5926989] = new thumbnail(5926989,'334357','','Out-Walking_thumb.jpg',130, 65,32,'photo_5926989.html');
												thumbnails[5926995] = new thumbnail(5926995,'334423','Loch Laidon','Loch-Laidon_thumb.jpg',130, 86,32,'photo_5926995.html');
												thumbnails[5926998] = new thumbnail(5926998,'334423','Eilean Donan Castle','Eilean-Donan-1_thumb.jpg',130, 87,32,'photo_5926998.html');
												thumbnails[5956169] = new thumbnail(5956169,'91250','Carew Castle','CAREW-CASTLE1_thumb.jpg',130, 194,32,'photo_5956169.html');
												thumbnails[5956177] = new thumbnail(5956177,'334420','Tempis Fugit','_DSC5208_thumb.jpg',130, 86,32,'photo_5956177.html');
												thumbnails[5956237] = new thumbnail(5956237,'91250','Barafundle Beach','_DSC5357_thumb.jpg',130, 80,32,'photo_5956237.html');
												thumbnails[5956246] = new thumbnail(5956246,'334423','Loch Tay','_DSC3349_thumb.jpg',130, 199,32,'photo_5956246.html');
												thumbnails[5956258] = new thumbnail(5956258,'91250','Celtic Cross','Celtic-Cross_thumb.jpg',130, 196,32,'photo_5956258.html');
												thumbnails[5956279] = new thumbnail(5956279,'334357','','Summer-colours_thumb.jpg',130, 196,32,'photo_5956279.html');
												thumbnails[5956297] = new thumbnail(5956297,'334419','','ROBIN-ST_thumb.jpg',130, 150,32,'photo_5956297.html');
												thumbnails[5956316] = new thumbnail(5956316,'334357','Alone','Alone-Orton_thumb.jpg',130, 101,32,'photo_5956316.html');
												thumbnails[5959974] = new thumbnail(5959974,'334423','Aberfeldy','Little-Falls_thumb.jpg',130, 175,32,'photo_5959974.html');
												thumbnails[5959976] = new thumbnail(5959976,'334423','Little Falls','_DSC3548_thumb.jpg',130, 73,32,'photo_5959976.html');
												thumbnails[5964438] = new thumbnail(5964438,'91250','Freshwater East','_DSC5247_thumb.jpg',130, 74,32,'photo_5964438.html');
												thumbnails[5964615] = new thumbnail(5964615,'91250','Church Rock','CHURCH-ROCK1_thumb.jpg',130, 61,32,'photo_5964615.html');
												thumbnails[5965385] = new thumbnail(5965385,'91250','Pembroke Castle','_DSC5420_thumb.jpg',130, 69,32,'photo_5965385.html');
												thumbnails[5978180] = new thumbnail(5978180,'91250','Coast Path','_DSC5142_thumb.jpg',130, 203,32,'photo_5978180.html');
												thumbnails[6001266] = new thumbnail(6001266,'334420','Gerbera','GERB-2_thumb.jpg',130, 194,32,'photo_6001266.html');
												thumbnails[6001296] = new thumbnail(6001296,'334420','Sunflower','SUN-_thumb.jpg',130, 196,32,'photo_6001296.html');
												thumbnails[6001306] = new thumbnail(6001306,'91250','The Bridge','_DSC5100_thumb.jpg',130, 196,32,'photo_6001306.html');
												thumbnails[6001358] = new thumbnail(6001358,'91250','Stack Rocks','EVENING-LIGHT_thumb.jpg',130, 198,32,'photo_6001358.html');
												thumbnails[6045134] = new thumbnail(6045134,'91250','Waldo\'s Stone','Waldos-Stone_thumb.jpg',130, 86,32,'photo_6045134.html');
												thumbnails[6115952] = new thumbnail(6115952,'91250','Stackpole Quay ','Untitled_Panorama1_thumb.jpg',130, 48,32,'photo_6115952.html');
												thumbnails[6159906] = new thumbnail(6159906,'91250','Along The Path','_OBP0447_thumb.jpg',130, 83,32,'photo_6159906.html');
												thumbnails[6160096] = new thumbnail(6160096,'91250','Barafundle Beach','23-March-07-011_thumb.jpg',130, 194,32,'photo_6160096.html');
												thumbnails[6200812] = new thumbnail(6200812,'91250','Bullslaughter Bay','_OBP0554_thumb.jpg',130, 195,32,'photo_6200812.html');
												thumbnails[6608507] = new thumbnail(6608507,'91250','Tidal Moods','_OBP1157_thumb.jpg',130, 83,32,'photo_6608507.html');
												thumbnails[7206537] = new thumbnail(7206537,'91250','Saundersfoot Harbour','_OBP1924_thumb.jpg',130, 83,32,'photo_7206537.html');
												thumbnails[7206555] = new thumbnail(7206555,'91250','Fading Light','_OBP1744_thumb.jpg',130, 70,32,'photo_7206555.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[91250] = new gallery(91250,'7206555,6608507,5964615,5964438,5956258,5956237,5925645,5925618,5924187,5923493,5923489,5923485,5923304','Pembrokeshire','gallery',[5923304,5923481,5923485,5923489,5923493,5923549,5923550,5924187,5924292,5925618,5925645,5956169,5956237,5956258,5964438,5964615,5965385,5978180,6001306,6001358,6045134,6115952,6159906,6160096,6200812,6608507,7206537,7206555],0, 0, '', 'gallery_91250.html',0,0);
				  					galleries[334310] = new gallery(334310,'5925612,5923504,5923499,5923235','Puffins','gallery',[5923235,5923288,5923499,5923504,5923553,5925500,5925590,5925609,5925612],0, 0, '', 'gallery_334310.html',0,0);
				  					galleries[334357] = new gallery(334357,'5956316,5926986,5926172,5926117,5926112,5924287,5924182','Black and White','gallery',[5924182,5924287,5924290,5926112,5926117,5926119,5926121,5926172,5926986,5926987,5926989,5956279,5956316],0, 0, '', 'gallery_334357.html',0,0);
				  					galleries[334391] = new gallery(334391,'5925349','Owls','gallery',[5925252,5925347,5925348,5925349,5925350,5925351,5925353],0, 0, '', 'gallery_334391.html',0,0);
				  					galleries[334419] = new gallery(334419,'5926218,5926216','Wildlife','gallery',[5926213,5926216,5926217,5926218,5956297],0, 0, '', 'gallery_334419.html',0,0);
				  					galleries[334420] = new gallery(334420,'5926250,5926247,5926244,5926240','Macro','gallery',[5926236,5926240,5926244,5926247,5926250,5956177,6001266,6001296],0, 0, '', 'gallery_334420.html',0,0);
				  					galleries[334423] = new gallery(334423,'5959976,5959974,5926998,5926320,5926307,5926297','Scotland','gallery',[5926297,5926304,5926307,5926320,5926324,5926995,5926998,5956246,5959974,5959976],0, 0, '', 'gallery_334423.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '7206555,7206537,6608507,6200812,6160096,6159906,6115952,6045134,6001306,6001296,6001266,5978180,5965385,5964615,5964438,5959976,5959974,5956316,5956237,5956177,5956169,5926998,5926986,5926320,5926307,5926297,5926250,5926247,5926244,5926240,5926218,5926216,5926172,5926117,5926112,5925645,5925618,5925612,5925609,5925349,5924287,5924187,5924182,5923550,5923549,5923504,5923499,5923493,5923489,5923485,5923481,5923304,5923235';
imageSets[2] = '7206555,6608507,5964615,5964438,5959976,5959974,5956316,5956258,5956237,5926998,5926986,5926320,5926307,5926297,5926250,5926247,5926244,5926240,5926218,5926216,5926172,5926117,5926112,5925645,5925618,5925612,5925349,5924287,5924187,5924182,5923504,5923499,5923493,5923489,5923485,5923304,5923235';
imageSets[3] = '7206555,6608507,6200812,5964615,5964438,5959976,5959974,5956316,5956297,5956279,5956237,5926998,5926986,5926320,5926307,5926297,5926250,5926247,5926244,5926240,5926218,5926216,5926172,5926117,5926112,5925645,5925612,5925349,5924287,5924187,5924182,5923504,5923499,5923493,5923489,5923485,5923304';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/robsonmarky/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/robsonmarky/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/robsonmarky/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/robsonmarky/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/robsonmarky/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/robsonmarky/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/robsonmarky/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/robsonmarky/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/robsonmarky/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/robsonmarky/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/robsonmarky/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/robsonmarky/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/robsonmarky/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/robsonmarky/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/robsonmarky/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/robsonmarky/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/robsonmarky/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/robsonmarky/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/robsonmarky/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/robsonmarky/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/robsonmarky/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/robsonmarky/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 = 'Ocean Breeze Photography: ' + 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 = 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>';
	}
					
				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>Order this print:</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>Buy this print online:</p>';
				temp = temp + '<form id="paymentOptions" style="margin:0px;border:0px;" name="paymentOptions">';
											temp = temp + '<select class="paymentlink" name="payment_options_id" onchange="updateItemValues(document.forms.paymentForm,this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value);">';
				
		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" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
	temp = 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 = temp + '<input type="hidden" name="cmd" value="_cart">';
	temp = temp + '<input type="hidden" name="business" value="">';
	temp = temp + '<input type="hidden" name="currency_code" value="GBP">';
	temp = temp + '<input type="hidden" name="add" value="1">';
					temp = temp + '<input type="hidden" name="amount" value="'+amount+'">';
	temp = temp + '<input type="hidden" name="item_number" value="'+ref+'">';
					temp = temp + '<input type=\"Submit\" value=\"Add to cart\" id=\"paymentAddButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
									temp = temp + '</form>';
								temp = temp + '<form id="paymentCartForm" style="margin:0px;" name="paymentCartForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
	temp = temp + '<input type="hidden" name="cmd" value="_cart">';
	temp = temp + '<input type="hidden" name="business" value="">';
	temp = temp + '<input type="hidden" name="display" value="1">';
	temp = temp + '<input type=\"Submit\" value=\"View cart\" id=\"paymentViewButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
	temp = temp + '</form>';
							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;
	}
}

			

