window.thumbnails = new Object();
												thumbnails[1547328] = new thumbnail(1547328,'91124','Dun Chnocan','0021_thumb.jpg',130, 83,15,'photo_1547328.html');
												thumbnails[1559119] = new thumbnail(1559119,'91124','Hillside Walk','0212-ClikPic_thumb.jpg',130, 90,15,'photo_1559119.html');
												thumbnails[1559125] = new thumbnail(1559125,'91124','Open Space','0221-ClikPic_thumb.jpg',130, 87,15,'photo_1559125.html');
												thumbnails[1559191] = new thumbnail(1559191,'91124','Birch Trees 1','0328-ClikPic_thumb.jpg',130, 195,15,'photo_1559191.html');
												thumbnails[1559201] = new thumbnail(1559201,'91124','Birch Trees 2','0329-ClikPic_thumb.jpg',130, 195,15,'photo_1559201.html');
												thumbnails[1559205] = new thumbnail(1559205,'91124','Birch Trees 3','0332-ClikPic1_thumb.jpg',130, 202,15,'photo_1559205.html');
												thumbnails[1559208] = new thumbnail(1559208,'91124','Birch Trees 4','0338-ClikPic_thumb.jpg',130, 182,15,'photo_1559208.html');
												thumbnails[1559311] = new thumbnail(1559311,'91124','Boarhills Church','0961-ClikPic_thumb.jpg',130, 73,15,'photo_1559311.html');
												thumbnails[1559584] = new thumbnail(1559584,'91124','Cloud Trails','1593-ClikPic_thumb.jpg',130, 87,15,'photo_1559584.html');
												thumbnails[1559587] = new thumbnail(1559587,'91124','Scottish Summer I','ScottishSummerI-1911_thumb.jpg',130, 195,15,'photo_1559587.html');
												thumbnails[2372799] = new thumbnail(2372799,'91125','Red','Layers-Red_thumb.jpg',130, 98,15,'photo_2372799.html');
												thumbnails[2408457] = new thumbnail(2408457,'228278','Dirleton Kirk, East Lothian','3547-3554-HDR-QTR-600x467_thumb.jpg',130, 101,15,'photo_2408457.html');
												thumbnails[2408487] = new thumbnail(2408487,'228278','View of North Berwick from harbour','3533-mono_thumb.jpg',130, 99,15,'photo_2408487.html');
												thumbnails[3740319] = new thumbnail(3740319,'228278','Yellowcraigs','1910-Web-400x600_thumb.jpg',130, 195,15,'photo_3740319.html');
												thumbnails[3748032] = new thumbnail(3748032,'228278','Fidra','1916-Fidra_thumb.jpg',130, 83,15,'photo_3748032.html');
												thumbnails[3748229] = new thumbnail(3748229,'228278','Bass Gannets','3237-Bass-Gannets_thumb.jpg',130, 87,15,'photo_3748229.html');
												thumbnails[3758383] = new thumbnail(3758383,'228278','Tantallon Castle','3272-Tantallon_thumb.jpg',130, 54,15,'photo_3758383.html');
												thumbnails[3758391] = new thumbnail(3758391,'228278','Rooms with Views','3584-Rooms-with-Views_thumb.jpg',130, 87,15,'photo_3758391.html');
												thumbnails[3758403] = new thumbnail(3758403,'228278','Aberlady Bay','3650-Aberlady-Bay_thumb.jpg',130, 87,15,'photo_3758403.html');
												thumbnails[3765060] = new thumbnail(3765060,'228278','Bass Rock','3742-Bass-Rock_thumb.jpg',130, 130,15,'photo_3765060.html');
												thumbnails[3765148] = new thumbnail(3765148,'228278','Nautical Jumble','3881-Nautical-Jumble_thumb.jpg',130, 130,15,'photo_3765148.html');
												thumbnails[3765222] = new thumbnail(3765222,'228278','East Bay Sunset','3946-East-Bay-Sunset_thumb.jpg',130, 104,15,'photo_3765222.html');
												thumbnails[3765258] = new thumbnail(3765258,'228278','Gannet','4307-Gannet_thumb.jpg',130, 130,15,'photo_3765258.html');
												thumbnails[3765275] = new thumbnail(3765275,'228278','Harvest Tide','4366-Harvest-Tide_thumb.jpg',130, 104,15,'photo_3765275.html');
												thumbnails[5130368] = new thumbnail(5130368,'237520','\"Typical Paths of Tropical Storms\"','Typical_Paths_thumb.jpg',130, 100,15,'photo_5130368.html');
												thumbnails[5130372] = new thumbnail(5130372,'237520','\"OB406\"','OB406_thumb.jpg',130, 127,15,'photo_5130372.html');
												thumbnails[5130375] = new thumbnail(5130375,'237520','\"One Mile Out\"','One_Mile_Out_thumb.jpg',130, 175,15,'photo_5130375.html');
												thumbnails[5406001] = new thumbnail(5406001,'237520','Compass works','Compass_Works_thumb.jpg',130, 132,15,'photo_5406001.html');
												thumbnails[5406018] = new thumbnail(5406018,'237520','Boat Yard','Boat_Yard1_thumb.jpg',130, 170,15,'photo_5406018.html');
												thumbnails[5406020] = new thumbnail(5406020,'237520','Discovery','Discovery_thumb.jpg',130, 183,15,'photo_5406020.html');
												thumbnails[5406021] = new thumbnail(5406021,'237520','Fraserburgh','Fraserburgh_thumb.jpg',130, 102,15,'photo_5406021.html');
												thumbnails[5406056] = new thumbnail(5406056,'237520','HDML','HDML_thumb.jpg',130, 88,15,'photo_5406056.html');
												thumbnails[5406077] = new thumbnail(5406077,'237520','I Saw Three Ships','I_Saw_Three_Ships_thumb.jpg',130, 131,15,'photo_5406077.html');
												thumbnails[5406079] = new thumbnail(5406079,'237520','Lighthouse','Lighthouse_thumb.jpg',130, 131,15,'photo_5406079.html');
												thumbnails[1283401] = new thumbnail(1283401,'91128','Opening night','OpeningNight2210_thumb.jpg',130, 133,15,'photo_1283401.html');
												thumbnails[1282934] = new thumbnail(1282934,'91124','Carn a\' Bhealaich Mhoir','2011-v3-ClicPic_thumb.jpg',130, 104,15,'photo_1282934.html');
												thumbnails[1294767] = new thumbnail(1294767,'91671','Michael Schumacher\'s Benneton B193','SchumiSteeringwheel_thumb.jpg',130, 172,15,'photo_1294767.html');
												thumbnails[1581797] = new thumbnail(1581797,'91125','Red','Red-ClikPic_thumb.jpg',130, 89,15,'photo_1581797.html');
												thumbnails[2372235] = new thumbnail(2372235,'88012','Opening night.','2800-C_thumb.jpg',130, 87,15,'photo_2372235.html');
												thumbnails[2372803] = new thumbnail(2372803,'228278','Tantallon Castle from Seacliff harbour, East Lothian.','3269&3276-B&W_thumb.jpg',130, 92,15,'photo_2372803.html');
												thumbnails[1283412] = new thumbnail(1283412,'91128','Harbour Exhibition','HarbourExhibition2264_thumb.jpg',130, 88,15,'photo_1283412.html');
												thumbnails[1299053] = new thumbnail(1299053,'91125','Piptoporus betulinus, Birch Polypore.','0298-ClikPic-2_thumb.jpg',130, 131,15,'photo_1299053.html');
												thumbnails[1283444] = new thumbnail(1283444,'91124','Old Man of Storr, Skye','OldManofStorr-2002_thumb.jpg',130, 87,15,'photo_1283444.html');
												thumbnails[1295142] = new thumbnail(1295142,'91671','Michael Schumacher\'s Benneton B193','B193-1993-silverstone-GP-11_thumb.jpg',130, 82,15,'photo_1295142.html');
												thumbnails[2372258] = new thumbnail(2372258,'88012','Opening night','2854-mono_thumb.jpg',130, 195,15,'photo_2372258.html');
												thumbnails[2372468] = new thumbnail(2372468,'228278','Fidra, East Lothian.','1916-B&W-for-QTR-800x600_thumb.jpg',130, 100,15,'photo_2372468.html');
												thumbnails[1391178] = new thumbnail(1391178,'91124','Morning walk.','Morning-Walk_thumb.jpg',130, 87,15,'photo_1391178.html');
												thumbnails[1297406] = new thumbnail(1297406,'91671','Senna\'s rear wing.','SennaWing_thumb.jpg',130, 87,15,'photo_1297406.html');
												thumbnails[1491546] = new thumbnail(1491546,'91125','Misty Morning','Misty Morning 1112-ClikPic_thumb.jpg',130, 195,15,'photo_1491546.html');
												thumbnails[2372242] = new thumbnail(2372242,'88012','Opening night','2803-mono_thumb.jpg',130, 195,15,'photo_2372242.html');
												thumbnails[2372572] = new thumbnail(2372572,'228278','Berwick Law, East Lothian.','3377-3385-HDR-v2-for-QTR_thumb.jpg',130, 100,15,'photo_2372572.html');
												thumbnails[1291197] = new thumbnail(1291197,'91671','David Coulthards engine cowling','Coulthard-Cowling_thumb.jpg',130, 90,15,'photo_1291197.html');
												thumbnails[1559158] = new thumbnail(1559158,'91125','Cold Start','0310-ClikPic_thumb.jpg',130, 75,15,'photo_1559158.html');
												thumbnails[2372275] = new thumbnail(2372275,'88012','Opening night','2967-C_thumb.jpg',130, 87,15,'photo_2372275.html');
												thumbnails[1292784] = new thumbnail(1292784,'91671','No.8 Nose','No8-Nose_thumb.jpg',130, 103,15,'photo_1292784.html');
												thumbnails[1559185] = new thumbnail(1559185,'91125','Deep Freeze','0314-ClikPic_thumb.jpg',130, 87,15,'photo_1559185.html');
												thumbnails[2372278] = new thumbnail(2372278,'88012','Exhibition','2989-C_thumb.jpg',130, 195,15,'photo_2372278.html');
												thumbnails[1559589] = new thumbnail(1559589,'91125','Auld Ropes','2034-ClikPic_thumb.jpg',130, 87,15,'photo_1559589.html');
												thumbnails[2372284] = new thumbnail(2372284,'88012','Symposium','2918-C_thumb.jpg',130, 87,15,'photo_2372284.html');
												thumbnails[1561631] = new thumbnail(1561631,'91125','Rudder','2038-ClikPic_thumb.jpg',130, 87,15,'photo_1561631.html');
												thumbnails[2372269] = new thumbnail(2372269,'88012','Symposium','2899-C_thumb.jpg',130, 87,15,'photo_2372269.html');
												thumbnails[1561685] = new thumbnail(1561685,'91125','Holding Strong','2039-ClikPic_thumb.jpg',130, 87,15,'photo_1561685.html');
												thumbnails[1559216] = new thumbnail(1559216,'91125','Are we nearly there yet?','0468-ClikPic_thumb.jpg',130, 87,15,'photo_1559216.html');
												thumbnails[1283364] = new thumbnail(1283364,'91128','Shoreline at Pittenweem','Promenade2307_thumb.jpg',130, 201,15,'photo_1283364.html');
												thumbnails[1283242] = new thumbnail(1283242,'91128','It\'s time to go home','Time-to-go-home2320_thumb.jpg',130, 181,15,'photo_1283242.html');
												thumbnails[1559865] = new thumbnail(1559865,'91125','Stargazer 8','2466-ClikPic_thumb.jpg',130, 167,15,'photo_1559865.html');
												thumbnails[1283201] = new thumbnail(1283201,'91125','Autumn morning.','Misty-winter\'s-morning1116_thumb.jpg',130, 87,15,'photo_1283201.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[228278] = new gallery(228278,'3765275,3765258,3765222,3765148,3765060,3758403,3758391,3758383,3748229,3748032','East Lothian','gallery',[2408457,2408487,3740319,3748032,3748229,3758383,3758391,3758403,3765060,3765148,3765222,3765258,3765275,2372803,2372468,2372572],0, 0, '', 'gallery_228278.html',0,0);
				  					galleries[237520] = new gallery(237520,'5406079,5406077,5406056,5406021,5406020,5406018,5406001,5130375,5130372,5130368','Sam Bain Art','gallery',[5130368,5130372,5130375,5406001,5406018,5406020,5406021,5406056,5406077,5406079],0, 0, '', 'gallery_237520.html',0,0);
				  					galleries[88012] = new gallery(88012,'2372284,2372278,2372275,2372269,2372258,2372242,2372235','Paul Harrison','gallery',[2372235,2372258,2372242,2372275,2372278,2372284,2372269],0, 0, '91127', 'gallery_88012.html',0,0);
				  					galleries[91124] = new gallery(91124,'1391178','Scottish Landscapes','gallery',[1547328,1559119,1559125,1559191,1559201,1559205,1559208,1559311,1559584,1559587,1282934,1283444,1391178],0, 0, '', 'gallery_91124.html',0,0);
				  					galleries[91125] = new gallery(91125,'2372799,1581797,1561685,1561631,1559865,1559589,1559216,1559185,1559158,1491546','Nature','gallery',[2372799,1581797,1299053,1491546,1559158,1559185,1559589,1561631,1561685,1559216,1559865,1283201],0, 0, '', 'gallery_91125.html',0,0);
				  					galleries[91128] = new gallery(91128,'1283412,1283401,1283364,1283242','Pittenweem Arts Festival','gallery',[1283401,1283412,1283364,1283242],0, 0, '91127', 'gallery_91128.html',0,0);
				  					galleries[91126] = new gallery(91126,'1294767','Motorsport','gallery',[],0, 0, '', 'gallery_91126.html',0,0);
				  					galleries[91127] = new gallery(91127,'2372284,2372278,2372275,2372269,2372258,2372242,2372235,1283412,1283401,1283364','Scottish Events','gallery',[],0, 0, '', 'gallery_91127.html',0,0);
				  					galleries[91671] = new gallery(91671,'1294767','Formula 1','gallery',[1294767,1295142,1297406,1291197,1292784],0, 0, '91126', 'gallery_91671.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '2372803,2372799,2372468,2372275,1561685,1283364,1282934';
imageSets[2] = '1391178,1294767';
imageSets[3] = '2408487,2408457,2372803,2372572,2372468,1559584';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/Vintage67/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/Vintage67/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/Vintage67/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/Vintage67/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/Vintage67/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/Vintage67/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/Vintage67/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/Vintage67/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/Vintage67/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/Vintage67/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/Vintage67/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/Vintage67/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/Vintage67/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/Vintage67/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/Vintage67/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/Vintage67/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/Vintage67/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/Vintage67/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/Vintage67/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/Vintage67/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/Vintage67/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/Vintage67/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 = 'Bain Photographic: ' + 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="bain845@btinternet.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="bain845@btinternet.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;
	}
}

			

