window.thumbnails = new Object();
												thumbnails[3853706] = new thumbnail(3853706,'141','','IMG_3658_thumb.jpg',130, 190,1,'photo_3853706.html');
												thumbnails[3853707] = new thumbnail(3853707,'143','','IMG_6254_thumb.jpg',130, 195,1,'photo_3853707.html');
												thumbnails[3853710] = new thumbnail(3853710,'143','','IMG_6352fs1_thumb.jpg',130, 190,1,'photo_3853710.html');
												thumbnails[4184071] = new thumbnail(4184071,'249169','','IMG_6880_thumb.jpg',130, 93,1,'photo_4184071.html');
												thumbnails[4184072] = new thumbnail(4184072,'249169','','IMG_6710_thumb.jpg',130, 182,1,'photo_4184072.html');
												thumbnails[4184074] = new thumbnail(4184074,'249169','','IMG_6781_thumb.jpg',130, 182,1,'photo_4184074.html');
												thumbnails[4184078] = new thumbnail(4184078,'249169','','IMG_6894_thumb.jpg',130, 182,1,'photo_4184078.html');
												thumbnails[4184085] = new thumbnail(4184085,'249169','','IMG_6761_thumb.jpg',130, 182,1,'photo_4184085.html');
												thumbnails[4360589] = new thumbnail(4360589,'143','','IMG_7618_thumb.jpg',130, 195,1,'photo_4360589.html');
												thumbnails[4360624] = new thumbnail(4360624,'143','','IMG_7363-airbrushed_thumb.jpg',130, 195,1,'photo_4360624.html');
												thumbnails[4575665] = new thumbnail(4575665,'143','','jess064_thumb.jpg',130, 87,1,'photo_4575665.html');
												thumbnails[4575666] = new thumbnail(4575666,'143','','jess069_thumb.jpg',130, 87,1,'photo_4575666.html');
												thumbnails[4575673] = new thumbnail(4575673,'143','','jess035_thumb.jpg',130, 195,1,'photo_4575673.html');
												thumbnails[4575891] = new thumbnail(4575891,'143','','IMG_7517a_thumb.jpg',130, 195,1,'photo_4575891.html');
												thumbnails[4577324] = new thumbnail(4577324,'142','','IMG_7926_thumb.jpg',130, 87,1,'photo_4577324.html');
												thumbnails[4577440] = new thumbnail(4577440,'142','','IMG_7931_thumb.jpg',130, 87,1,'photo_4577440.html');
												thumbnails[4577505] = new thumbnail(4577505,'142','','IMG_7934_thumb.jpg',130, 87,1,'photo_4577505.html');
												thumbnails[5161487] = new thumbnail(5161487,'143','','IMG_8687tIMG_8687CR21_thumb.jpg',130, 87,1,'photo_5161487.html');
												thumbnails[5161499] = new thumbnail(5161499,'143','','IMG_8732-1tIMG_8732-1CR2_thumb.jpg',130, 195,1,'photo_5161499.html');
												thumbnails[5161501] = new thumbnail(5161501,'143','','IMG_8802tIMG_8802CR21_thumb.jpg',130, 87,1,'photo_5161501.html');
												thumbnails[5161507] = new thumbnail(5161507,'143','','IMG_9540_thumb.jpg',130, 195,1,'photo_5161507.html');
												thumbnails[5161510] = new thumbnail(5161510,'143','','IMG_9599_thumb.jpg',130, 87,1,'photo_5161510.html');
												thumbnails[5333176] = new thumbnail(5333176,'142','','IMG_0146_thumb.jpg',130, 195,1,'photo_5333176.html');
												thumbnails[5333338] = new thumbnail(5333338,'142','','IMG_9972a_thumb.jpg',130, 87,1,'photo_5333338.html');
												thumbnails[5333346] = new thumbnail(5333346,'142','','IMG_9971_thumb.jpg',130, 87,1,'photo_5333346.html');
												thumbnails[5333350] = new thumbnail(5333350,'142','','IMG_0121_thumb.jpg',130, 87,1,'photo_5333350.html');
												thumbnails[5662146] = new thumbnail(5662146,'143','','IMG_0485a_thumb.jpg',130, 195,1,'photo_5662146.html');
												thumbnails[5662147] = new thumbnail(5662147,'143','','IMG_0439_thumb.jpg',130, 195,1,'photo_5662147.html');
												thumbnails[6256391] = new thumbnail(6256391,'143','','IMG_1164_thumb.jpg',130, 195,1,'photo_6256391.html');
												thumbnails[3145240] = new thumbnail(3145240,'141','','IMG_3637_thumb.jpg',130, 195,1,'photo_3145240.html');
												thumbnails[3145401] = new thumbnail(3145401,'142','','IMG_4254_thumb.jpg',130, 87,1,'photo_3145401.html');
												thumbnails[3145212] = new thumbnail(3145212,'141','','IMG_3662_thumb.jpg',130, 195,1,'photo_3145212.html');
												thumbnails[3145268] = new thumbnail(3145268,'143','','IMG_4437s_thumb.jpg',130, 87,1,'photo_3145268.html');
												thumbnails[4360581] = new thumbnail(4360581,'143','','IMG_7751_thumb.jpg',130, 87,1,'photo_4360581.html');
												thumbnails[3853723] = new thumbnail(3853723,'143','','IMG_9703resize_thumb.jpg',130, 87,1,'photo_3853723.html');
												thumbnails[725736] = new thumbnail(725736,'143','','IMG_0091p_thumb.jpg',130, 104,1,'photo_725736.html');
												thumbnails[725727] = new thumbnail(725727,'141','','IMG_9588p_thumb.jpg',130, 195,1,'photo_725727.html');
												thumbnails[3145426] = new thumbnail(3145426,'142','','IMG_3104_thumb.jpg',130, 87,1,'photo_3145426.html');
												thumbnails[3510712] = new thumbnail(3510712,'143','','IMG_6298mpf_thumb.jpg',130, 87,1,'photo_3510712.html');
												thumbnails[3510751] = new thumbnail(3510751,'143','','IMG_6385fs_thumb.jpg',130, 195,1,'photo_3510751.html');
												thumbnails[3510756] = new thumbnail(3510756,'143','','IMG_5991_thumb.jpg',130, 195,1,'photo_3510756.html');
												thumbnails[63526] = new thumbnail(63526,'143','','CRW_7683web_thumb.jpg',130, 86,1,'photo_63526.html');
												thumbnails[3145256] = new thumbnail(3145256,'141','','040708_0488g_thumb.jpg',130, 87,1,'photo_3145256.html');
												thumbnails[3145264] = new thumbnail(3145264,'249169','','dom-mag-cover_thumb.jpg',130, 184,1,'photo_3145264.html');
												thumbnails[772] = new thumbnail(772,'142','','114_1407web_thumb.jpg',130, 195,1,'photo_772.html');
												thumbnails[63505] = new thumbnail(63505,'141','','CRW_7545web_thumb.jpg',130, 86,1,'photo_63505.html');
												thumbnails[3510653] = new thumbnail(3510653,'143','','IMG_6321oo_thumb.jpg',130, 87,1,'photo_3510653.html');
												thumbnails[725733] = new thumbnail(725733,'143','','IMG_9917p_thumb.jpg',130, 182,1,'photo_725733.html');
												thumbnails[129476] = new thumbnail(129476,'143','','CRW_8421clweb_thumb.jpg',130, 87,1,'photo_129476.html');
												thumbnails[87809] = new thumbnail(87809,'143','','CRW_7879web_thumb.jpg',130, 87,1,'photo_87809.html');
												thumbnails[3510764] = new thumbnail(3510764,'143','','IMG_6025_thumb.jpg',130, 87,1,'photo_3510764.html');
												thumbnails[580232] = new thumbnail(580232,'143','','IMG_9453web_thumb.jpg',130, 87,1,'photo_580232.html');
												thumbnails[3510738] = new thumbnail(3510738,'143','','IMG_6433hc_thumb.jpg',130, 195,1,'photo_3510738.html');
												thumbnails[29287] = new thumbnail(29287,'141','','03439_RT8-bw_thumb.jpg',130, 87,1,'photo_29287.html');
												thumbnails[3145220] = new thumbnail(3145220,'141','','IMG_3644_thumb.jpg',130, 87,1,'photo_3145220.html');
												thumbnails[725755] = new thumbnail(725755,'143','','IMG_0717p_thumb.jpg',130, 87,1,'photo_725755.html');
												thumbnails[776] = new thumbnail(776,'142','','Dscn1084aweb_thumb.jpg',130, 109,1,'photo_776.html');
												thumbnails[63513] = new thumbnail(63513,'141','','IMG_7219web_thumb.jpg',130, 86,1,'photo_63513.html');
												thumbnails[580230] = new thumbnail(580230,'143','','IMG_9431-web_thumb.jpg',130, 195,1,'photo_580230.html');
												thumbnails[580227] = new thumbnail(580227,'143','','IMG_9430f-web_thumb.jpg',130, 87,1,'photo_580227.html');
												thumbnails[1340] = new thumbnail(1340,'143','','sam_thumb.jpg',130, 195,1,'photo_1340.html');
												thumbnails[20188] = new thumbnail(20188,'141','','01500019web_thumb.jpg',130, 184,1,'photo_20188.html');
												thumbnails[735] = new thumbnail(735,'142','','cricket1web_thumb.jpg',130, 163,1,'photo_735.html');
												thumbnails[3145278] = new thumbnail(3145278,'143','','IMG_4341s_thumb.jpg',130, 87,1,'photo_3145278.html');
												thumbnails[918] = new thumbnail(918,'142','','123_2361aweb_thumb.jpg',130, 182,1,'photo_918.html');
												thumbnails[29285] = new thumbnail(29285,'143','','854_5438_RJ_thumb.jpg',130, 195,1,'photo_29285.html');
												thumbnails[87810] = new thumbnail(87810,'143','','CRW_7923web_thumb.jpg',130, 86,1,'photo_87810.html');
												thumbnails[29281] = new thumbnail(29281,'143','','863_6334_thumb.JPG',130, 148,1,'photo_29281.html');
												thumbnails[1341] = new thumbnail(1341,'143','','sam-a_thumb.jpg',130, 195,1,'photo_1341.html');
												thumbnails[3836] = new thumbnail(3836,'143','','6_thumb.jpg',130, 178,1,'photo_3836.html');
												thumbnails[29280] = new thumbnail(29280,'143','','861_6133_thumb.JPG',130, 184,1,'photo_29280.html');
												thumbnails[3145275] = new thumbnail(3145275,'143','','IMG_4382s_thumb.jpg',130, 87,1,'photo_3145275.html');
												thumbnails[129480] = new thumbnail(129480,'143','','CRW_8506web_thumb.jpg',130, 195,1,'photo_129480.html');
												thumbnails[1463839] = new thumbnail(1463839,'143','','IMG_9723sweb_thumb.jpg',130, 87,1,'photo_1463839.html');
												thumbnails[29289] = new thumbnail(29289,'141','','03540_RT8_thumb.jpg',130, 87,1,'photo_29289.html');
												thumbnails[129472] = new thumbnail(129472,'141','','CRW_7625web1_thumb.jpg',130, 195,1,'photo_129472.html');
												thumbnails[580264] = new thumbnail(580264,'141','','IMG_0933web_thumb.jpg',130, 87,1,'photo_580264.html');
												thumbnails[786] = new thumbnail(786,'141','','steve-&-michaelweb_thumb.jpg',130, 91,1,'photo_786.html');
												thumbnails[792] = new thumbnail(792,'141','','Dominic2_thumb.jpg',130, 163,1,'photo_792.html');
												thumbnails[20191] = new thumbnail(20191,'141','','01500037web_thumb.jpg',130, 134,1,'photo_20191.html');
												thumbnails[63510] = new thumbnail(63510,'141','','bwIMG_7168web_thumb.jpg',130, 86,1,'photo_63510.html');
												thumbnails[790] = new thumbnail(790,'141','','rach-&-Jas3web_thumb.jpg',130, 219,1,'photo_790.html');
												thumbnails[580260] = new thumbnail(580260,'141','','IMG_0881web_thumb.jpg',130, 87,1,'photo_580260.html');
												thumbnails[20180] = new thumbnail(20180,'141','','01510005web_thumb.jpg',130, 207,1,'photo_20180.html');
												thumbnails[175269] = new thumbnail(175269,'141','Cake by Three Tiers - 0870 444 6818','IMG_9343_thumb.jpg',130, 195,1,'photo_175269.html');
												thumbnails[175275] = new thumbnail(175275,'141','Cake by Three Tiers - 0870 444 6818','IMG_9285_thumb.jpg',130, 87,1,'photo_175275.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[249169] = new gallery(249169,'4184085,4184078,4184074,4184072,4184071,3145264','Sport','gallery',[4184071,4184072,4184074,4184078,4184085,3145264],0, 0, '', 'gallery_249169.html',0,0);
				  					galleries[141] = new gallery(141,'20180','Weddings','gallery',[3853706,3145240,3145212,725727,3145256,63505,29287,3145220,63513,20188,29289,129472,580264,786,792,20191,63510,790,580260,20180,175269,175275],0, 0, '', 'gallery_141.html',0,0);
				  					galleries[143] = new gallery(143,'5161487,63526','Portraits','gallery',[3853707,3853710,4360589,4360624,4575665,4575666,4575673,4575891,5161487,5161499,5161501,5161507,5161510,5662146,5662147,6256391,3145268,4360581,3853723,725736,3510712,3510751,3510756,63526,3510653,725733,129476,87809,3510764,580232,3510738,725755,580230,580227,1340,3145278,29285,87810,29281,1341,3836,29280,3145275,129480,1463839],0, 0, '', 'gallery_143.html',0,0);
				  					galleries[142] = new gallery(142,'5333350,5333346,5333338,5333176,4577505,4577440,4577324,3145426,3145401,918','Stock','gallery',[4577324,4577440,4577505,5333176,5333338,5333346,5333350,3145401,3145426,772,776,735,918],0, 0, '', 'gallery_142.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '3853723';
imageSets[2] = '5161487,63526,20180';
imageSets[3] = '6256391,5662147,5662146,5333350,5333346,5333338,5333176,5161510,5161507,5161501,5161499,5161487,4577505,4577440,4577324,4575891,4575673,4575666,4575665,4360624,4360589,4360581,4184085,4184078,4184074,4184072,4184071,3853723,3853710,3853707,3853706,3510764,3510756,3510751,3510738,3510712,3510653,3145426,3145401,3145278,3145275,3145268,3145264,3145256,3145240,3145220,3145212,1463839,725755,725736';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/tyreebourne/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/tyreebourne/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/tyreebourne/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/tyreebourne/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/tyreebourne/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/tyreebourne/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/tyreebourne/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/tyreebourne/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/tyreebourne/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/tyreebourne/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/tyreebourne/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/tyreebourne/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/tyreebourne/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/tyreebourne/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/tyreebourne/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/tyreebourne/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/tyreebourne/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/tyreebourne/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/tyreebourne/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/tyreebourne/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/tyreebourne/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/tyreebourne/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 = 'Tyree Bourne 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 == 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>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="tyreebourne@ntlworld.com">';
	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="tyreebourne@ntlworld.com">';
	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;
	}
}

			

