window.thumbnails = new Object();
												thumbnails[5376726] = new thumbnail(5376726,'302690','Circles from the bridge','_DSC2865_copy001_thumb.jpg',130, 116,5,'							photo_5376726.html');
												thumbnails[5496791] = new thumbnail(5496791,'305849','Reflections of a scultpure','_DSC0782_copy1001_thumb.jpg',130, 89,5,'							photo_5496791.html');
												thumbnails[5496795] = new thumbnail(5496795,'305849','Sea of flowers','_DSC0785_copy002_thumb.jpg',130, 68,5,'							photo_5496795.html');
												thumbnails[5496798] = new thumbnail(5496798,'305849','Metro','_DSC0798_copy1003_thumb.jpg',130, 78,5,'							photo_5496798.html');
												thumbnails[5496809] = new thumbnail(5496809,'305849','Pappy Dance','_DSC0835_copy1005_thumb.jpg',130, 101,5,'							photo_5496809.html');
												thumbnails[5496812] = new thumbnail(5496812,'305849','People under the tower','_DSC0883_copy006_thumb.jpg',130, 89,5,'							photo_5496812.html');
												thumbnails[5496827] = new thumbnail(5496827,'305849','Brass player','_DSC0898_copy1007_thumb.jpg',130, 97,5,'							photo_5496827.html');
												thumbnails[5496828] = new thumbnail(5496828,'305849','Efifel Tower legs','_DSC0900_copy008_thumb.jpg',130, 82,5,'							photo_5496828.html');
												thumbnails[5496829] = new thumbnail(5496829,'305849','Parisian side street','_DSC0956_copy1009_thumb.jpg',130, 83,5,'							photo_5496829.html');
												thumbnails[5496835] = new thumbnail(5496835,'305849','In Memory','_DSC0970_copy1010_thumb.jpg',130, 82,5,'							photo_5496835.html');
												thumbnails[5496805] = new thumbnail(5496805,'305849','Shadow wall','_DSC0823_copy1004_thumb.jpg',130, 194,5,'							photo_5496805.html');
												thumbnails[5376734] = new thumbnail(5376734,'302690','Welsh Wave','_DSC3405_copy002_thumb.jpg',130, 79,5,'							photo_5376734.html');
												thumbnails[5914048] = new thumbnail(5914048,'305914','Toy in yard','_DSC4506-copy_thumb.jpg',130, 87,5,'							photo_5914048.html');
												thumbnails[5914050] = new thumbnail(5914050,'305914','Park','_DSC4766-copy_thumb.jpg',130, 85,5,'							photo_5914050.html');
												thumbnails[5914070] = new thumbnail(5914070,'305914','People on ice','_DSC5779-copy_thumb.jpg',130, 49,5,'							photo_5914070.html');
												thumbnails[5914059] = new thumbnail(5914059,'305914','Charlottenborg','_DSC5151-copy_thumb.jpg',130, 71,5,'							photo_5914059.html');
												thumbnails[5914054] = new thumbnail(5914054,'305914','Rosenborg Castle','_DSC4930-copy_thumb.jpg',130, 182,5,'							photo_5914054.html');
												thumbnails[5914056] = new thumbnail(5914056,'305914','Posters on structure','_DSC4934-copy_thumb.jpg',130, 226,5,'							photo_5914056.html');
												thumbnails[5914067] = new thumbnail(5914067,'305914','Copenhagen wheel','_dsc5739-copy_thumb.jpg',130, 208,5,'							photo_5914067.html');
												thumbnails[5914052] = new thumbnail(5914052,'305914','Frederiks Kirke/Marble Church','_DSC4910-copy_thumb.jpg',130, 175,5,'							photo_5914052.html');
												thumbnails[5914066] = new thumbnail(5914066,'305914','Copenhagen street','_dsc5728-copy_thumb.jpg',130, 86,5,'							photo_5914066.html');
												thumbnails[5914061] = new thumbnail(5914061,'305914','Wind farm','_DSC5215-copy_thumb.jpg',130, 42,5,'							photo_5914061.html');
												thumbnails[5376746] = new thumbnail(5376746,'302690','Welsh Valley','_DSC3427_copy003_thumb.jpg',130, 161,5,'							photo_5376746.html');
												thumbnails[6676507] = new thumbnail(6676507,'305650','Rose','Flora-1_thumb.jpg',130, 87,5,'							photo_6676507.html');
												thumbnails[6676513] = new thumbnail(6676513,'305650','Tulips','Flora-2_thumb.jpg',130, 92,5,'							photo_6676513.html');
												thumbnails[6676518] = new thumbnail(6676518,'305650','Sunflower petals','Flora-3_thumb.jpg',130, 89,5,'							photo_6676518.html');
												thumbnails[6676522] = new thumbnail(6676522,'305650','Lily','Flora-5_thumb.jpg',130, 104,5,'							photo_6676522.html');
												thumbnails[6676527] = new thumbnail(6676527,'305650','Petal','Flora-6_thumb.jpg',130, 75,5,'							photo_6676527.html');
												thumbnails[6676531] = new thumbnail(6676531,'305650','Rose','Flora-7_thumb.jpg',130, 100,5,'							photo_6676531.html');
												thumbnails[6676532] = new thumbnail(6676532,'305650','Tulips','Flora-8_thumb.jpg',130, 92,5,'							photo_6676532.html');
												thumbnails[6676534] = new thumbnail(6676534,'305650','Daisy','Flora-9_thumb.jpg',130, 119,5,'							photo_6676534.html');
												thumbnails[6676536] = new thumbnail(6676536,'305650','Tulip','Flora-10_thumb.jpg',130, 198,5,'							photo_6676536.html');
												thumbnails[6676520] = new thumbnail(6676520,'305650','Tulip','Flora-4_thumb.jpg',130, 214,5,'							photo_6676520.html');
												thumbnails[5376751] = new thumbnail(5376751,'302690','Mast on Hill','_DSC3444_copy004_thumb.jpg',130, 75,5,'							photo_5376751.html');
												thumbnails[5376752] = new thumbnail(5376752,'302690','School in the hills','_DSC3455_copy005_thumb.jpg',130, 77,5,'							photo_5376752.html');
												thumbnails[7216630] = new thumbnail(7216630,'302691','Barcelona','Barca_thumb.jpg',130, 64,5,'							photo_7216630.html');
												thumbnails[7216631] = new thumbnail(7216631,'302691','Barcelona cyclist','Barca2_thumb.jpg',130, 103,5,'							photo_7216631.html');
												thumbnails[7216632] = new thumbnail(7216632,'302691','Copenhagen crossing','CPH_thumb.jpg',130, 86,5,'							photo_7216632.html');
												thumbnails[7216638] = new thumbnail(7216638,'302691','Walking on ice','Ice_thumb.jpg',130, 46,5,'							photo_7216638.html');
												thumbnails[7216639] = new thumbnail(7216639,'302691','Lunch','London_thumb.jpg',130, 84,5,'							photo_7216639.html');
												thumbnails[7216641] = new thumbnail(7216641,'302691','Waiting','london-2_thumb.jpg',130, 93,5,'							photo_7216641.html');
												thumbnails[7216644] = new thumbnail(7216644,'302691','Papa Dance','Papa-dance_thumb.jpg',130, 136,5,'							photo_7216644.html');
												thumbnails[7216648] = new thumbnail(7216648,'302691','Asleep','Paris-sleep_thumb.jpg',130, 94,5,'							photo_7216648.html');
												thumbnails[7216645] = new thumbnail(7216645,'302691','Eating an apple','Paris-apple_thumb.jpg',130, 154,5,'							photo_7216645.html');
												thumbnails[7216637] = new thumbnail(7216637,'302691','Copenhagen election','CPH2_thumb.jpg',130, 226,5,'							photo_7216637.html');
												thumbnails[5376754] = new thumbnail(5376754,'302690','Cows in a Field','_DSC3656_copy006_thumb.jpg',130, 70,5,'							photo_5376754.html');
												thumbnails[5376756] = new thumbnail(5376756,'302690','Rock pattern','_DSC3716_copy007_thumb.jpg',130, 89,5,'							photo_5376756.html');
												thumbnails[5376758] = new thumbnail(5376758,'302690','Waiting for the Tide','_DSC3730_copy008_thumb.jpg',130, 79,5,'							photo_5376758.html');
												thumbnails[5376762] = new thumbnail(5376762,'302690','Beached','_DSC3747_copy009_thumb.jpg',130, 75,5,'							photo_5376762.html');
												thumbnails[6476489] = new thumbnail(6476489,'302711','The Black Diamond / Det Kongelige Bibliotek','_DSC6043_copy009_thumb.jpg',130, 87,5,'							photo_6476489.html');
												thumbnails[6476496] = new thumbnail(6476496,'302711','Spinnaker Tower, Portsmouth','_DSC1257_copy1002_thumb.jpg',130, 220,5,'							photo_6476496.html');
												thumbnails[6476507] = new thumbnail(6476507,'302711','Skylight','_dsc5622_copy007_thumb.jpg',130, 167,5,'							photo_6476507.html');
												thumbnails[6476508] = new thumbnail(6476508,'302711','Rings','_DSC6111_copy012_thumb.jpg',130, 194,5,'							photo_6476508.html');
												thumbnails[6476511] = new thumbnail(6476511,'302711','Rows upon rows','_DSC2312_copy003_thumb.jpg',130, 92,5,'							photo_6476511.html');
												thumbnails[6476567] = new thumbnail(6476567,'302711','Downstairs','_DSC4566_copy005_thumb.jpg',130, 152,5,'							photo_6476567.html');
												thumbnails[6476518] = new thumbnail(6476518,'302711','Flats','_DSC6073_copy011_thumb.jpg',130, 185,5,'							photo_6476518.html');
												thumbnails[6476520] = new thumbnail(6476520,'302711','Turning Torso','_DSC5851_copy008_thumb.jpg',130, 215,5,'							photo_6476520.html');
												thumbnails[6476554] = new thumbnail(6476554,'302711','Curves','_DSC0567_copy1001_thumb.jpg',130, 199,5,'							photo_6476554.html');
												thumbnails[6476560] = new thumbnail(6476560,'302711','Reflection','_DSC4543_copy004_thumb.jpg',130, 168,5,'							photo_6476560.html');
												thumbnails[6476563] = new thumbnail(6476563,'302711','Black Diamond reflection','_DSC6072_copy010_thumb.jpg',130, 90,5,'							photo_6476563.html');
												thumbnails[6476565] = new thumbnail(6476565,'302711','Left outside','_DSC5514_copy006_thumb.jpg',130, 95,5,'							photo_6476565.html');
												thumbnails[5376768] = new thumbnail(5376768,'302690','Closed Market','_DSC3768_copy010_thumb.jpg',130, 212,5,'							photo_5376768.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[305847] = new gallery(305847,'5914070,5914067,5914066,5914061,5914059,5914056,5914054,5914052,5914050,5914048','Places','gallery',[],0, 1, '', '																																																																																																							gallery_305847.html',0,0);
				  					galleries[302690] = new gallery(302690,'5376768,5376762,5376758,5376756,5376754,5376752,5376751,5376746,5376734,5376726','Wales','gallery',[5376726,5376734,5376746,5376751,5376752,5376754,5376756,5376758,5376762,5376768],0, 1, '305847', '																																																																																																							gallery_302690.html',0,0);
				  					galleries[305848] = new gallery(305848,'','London','gallery',[],0, 1, '305847', '																																																																																																							gallery_305848.html',0,0);
				  					galleries[305849] = new gallery(305849,'5496835,5496829,5496828,5496827,5496812,5496809,5496805,5496798,5496795,5496791','Paris','gallery',[5496791,5496795,5496798,5496809,5496812,5496827,5496828,5496829,5496835,5496805],0, 1, '305847', '																																																																																																							gallery_305849.html',0,0);
				  					galleries[305914] = new gallery(305914,'5914070,5914067,5914066,5914061,5914059,5914056,5914054,5914052,5914050,5914048','København','gallery',[5914048,5914050,5914070,5914059,5914054,5914056,5914067,5914052,5914066,5914061],0, 1, '305847', '																																																																																																							gallery_305914.html',0,0);
				  					galleries[302691] = new gallery(302691,'7216648,7216645,7216644,7216641,7216639,7216638,7216637,7216632,7216631,7216630','Street Photography','gallery',[7216630,7216631,7216632,7216638,7216639,7216641,7216644,7216648,7216645,7216637],0, 1, '', '																																																																																																							gallery_302691.html',0,0);
				  					galleries[302711] = new gallery(302711,'6476563,6476520,6476496,6476489','Architecture','gallery',[6476489,6476496,6476507,6476508,6476511,6476567,6476518,6476520,6476554,6476560,6476563,6476565],0, 1, '', '																																																																																																							gallery_302711.html',0,0);
				  					galleries[305650] = new gallery(305650,'6676536,6676534,6676532,6676531,6676527,6676522,6676520,6676518,6676513,6676507','Flora','gallery',[6676507,6676513,6676518,6676522,6676527,6676531,6676532,6676534,6676536,6676520],0, 1, '', '																																																																																																							gallery_305650.html',0,0);
				  					galleries[305916] = new gallery(305916,'','Projects','gallery',[],0, 1, '', '																																																																																																							gallery_305916.html',0,0);
				  					galleries[305917] = new gallery(305917,'','No Parking','gallery',[],0, 1, '305916', '																																																																																																							gallery_305917.html',0,0);
				  					galleries[305918] = new gallery(305918,'','Old Signs','gallery',[],0, 1, '305916', '																																																																																																							gallery_305918.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '6476563,6476520,6476496,6476489';
imageSets[2] = '6476563,6476520,6476496,6476489';
imageSets[3] = '7216648,7216645,7216644,7216641,7216639,7216638,7216637,7216632,7216631,7216630,6676536,6676534,6676532,6676531,6676527,6676522,6676520,6676518,6676513,6676507,6476567,6476565,6476563,6476560,6476554,6476520,6476518,6476511,6476508,6476507,6476496,6476489,5914070,5914067,5914066,5914061,5914059,5914056,5914054,5914052,5914050,5914048,5496835,5496829,5496828,5496827,5496812,5496809,5496805,5496798';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/maceyk/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/maceyk/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/maceyk/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/maceyk/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://www.clikchurch.com/maceyk/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/maceyk/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/maceyk/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/maceyk/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/maceyk/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/maceyk/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/maceyk/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/maceyk/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/maceyk/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/maceyk/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/maceyk/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/maceyk/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/maceyk/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/maceyk/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/maceyk/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/maceyk/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/maceyk/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));		}, 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 = 'KAREN MACEY 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));    }        
    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;
	}
}

			

