window.thumbnails = new Object();
												thumbnails[2739165] = new thumbnail(2739165,'','','IMG_4419site_thumb.jpg',130, 68,1,'															#');
												thumbnails[2739170] = new thumbnail(2739170,'','','IMG_4422site_thumb.jpg',130, 101,1,'															#');
												thumbnails[2739518] = new thumbnail(2739518,'','','IMG_4405newsite_thumb.jpg',130, 138,1,'															#');
												thumbnails[2739523] = new thumbnail(2739523,'','','IMG_4417newsite_thumb.jpg',130, 81,1,'															#');
												thumbnails[2739528] = new thumbnail(2739528,'','','IMG_4425newsite_thumb.jpg',130, 205,1,'															#');
												thumbnails[2411051] = new thumbnail(2411051,'150591','Sammy and Amy','samamyupload_thumb.jpg',130, 192,1,'																			photo_2411051.html');
												thumbnails[2302346] = new thumbnail(2302346,'150591','Daniel Regan Hodges','daniel eyes new e2_thumb.jpg',130, 87,1,'																			photo_2302346.html');
												thumbnails[2015281] = new thumbnail(2015281,'120538','Dunraven','Rocksiie2_thumb.jpg',130, 189,1,'																			photo_2015281.html');
												thumbnails[2099889] = new thumbnail(2099889,'135784','Burst','Burst E2_thumb.jpg',130, 168,1,'																			photo_2099889.html');
												thumbnails[2099892] = new thumbnail(2099892,'135784','Shades','Shades E2_thumb.jpg',130, 163,1,'																			photo_2099892.html');
												thumbnails[2099895] = new thumbnail(2099895,'135784','Thoughts','Thoughts E2_thumb.jpg',130, 194,1,'																			photo_2099895.html');
												thumbnails[2099897] = new thumbnail(2099897,'135784','Shadows','Shadows E2_thumb.jpg',130, 111,1,'																			photo_2099897.html');
												thumbnails[2099902] = new thumbnail(2099902,'135784','Weed','Weed_thumb.jpg',130, 101,1,'																			photo_2099902.html');
												thumbnails[2099905] = new thumbnail(2099905,'120538','Golden Sands','Golden Sands_thumb.jpg',130, 90,1,'																			photo_2099905.html');
												thumbnails[2099914] = new thumbnail(2099914,'135785','Golden Light','Golden light e2_thumb.jpg',130, 92,1,'																			photo_2099914.html');
												thumbnails[2302348] = new thumbnail(2302348,'150591','That boy again','daniel eyes bw e2_thumb.jpg',130, 91,1,'																			photo_2302348.html');
												thumbnails[2302355] = new thumbnail(2302355,'150591','Becky Evans','Becky 8e2v2_thumb.jpg',130, 214,1,'																			photo_2302355.html');
												thumbnails[2302357] = new thumbnail(2302357,'150591','Beck Evans','Becky 9_thumb.jpg',130, 199,1,'																			photo_2302357.html');
												thumbnails[2302360] = new thumbnail(2302360,'150591','Becky Evans','Becky 9e2mono_thumb.jpg',130, 203,1,'																			photo_2302360.html');
												thumbnails[2302372] = new thumbnail(2302372,'150591','Becky Evans','Becky 10e2_thumb.jpg',130, 190,1,'																			photo_2302372.html');
												thumbnails[2302374] = new thumbnail(2302374,'150591','Callum','Callumandjene2_thumb.jpg',130, 98,1,'																			photo_2302374.html');
												thumbnails[2302387] = new thumbnail(2302387,'150591','Daniel again','DRH5e2_thumb.jpg',130, 93,1,'																			photo_2302387.html');
												thumbnails[2302388] = new thumbnail(2302388,'150591','Daniel Regan','DRH9monoe2_thumb.jpg',130, 120,1,'																			photo_2302388.html');
												thumbnails[2447173] = new thumbnail(2447173,'150591','Sam and Amy selective','samamynewcoloure23_thumb.jpg',130, 53,1,'																			photo_2447173.html');
												thumbnails[2681746] = new thumbnail(2681746,'169400','Gioacchino','Gioacchino click_thumb.jpg',130, 91,1,'																			photo_2681746.html');
												thumbnails[2681774] = new thumbnail(2681774,'169400','Gioacchino Head','Gioacchino head click_thumb.jpg',130, 89,1,'																			photo_2681774.html');
												thumbnails[2682596] = new thumbnail(2682596,'169400','Gioacchino again','GIO-5-heade2new_thumb.jpg',130, 90,1,'																			photo_2682596.html');
												thumbnails[2709074] = new thumbnail(2709074,'135784','','dandelione2_thumb.jpg',130, 163,1,'																			photo_2709074.html');
												thumbnails[2744383] = new thumbnail(2744383,'135785','','LLandegveth over the side 2 e2_thumb.jpg',130, 168,1,'																			photo_2744383.html');
												thumbnails[2744446] = new thumbnail(2744446,'135785','','Llandegveth new e2_thumb.jpg',130, 90,1,'																			photo_2744446.html');
												thumbnails[2744457] = new thumbnail(2744457,'135785','','Fallene2_thumb.jpg',130, 90,1,'																			photo_2744457.html');
												thumbnails[2744462] = new thumbnail(2744462,'135785','','Fallene21_thumb.jpg',130, 90,1,'																			photo_2744462.html');
												thumbnails[2744463] = new thumbnail(2744463,'135785','','Fallen 2 e2_thumb.jpg',130, 91,1,'																			photo_2744463.html');
												thumbnails[2998194] = new thumbnail(2998194,'150591','Time on her side','Time on her side_thumb.jpg',130, 133,1,'																			photo_2998194.html');
												thumbnails[3027451] = new thumbnail(3027451,'120538','','tHAISUNSET_thumb.jpg',130, 87,1,'																			photo_3027451.html');
												thumbnails[3027452] = new thumbnail(3027452,'120538','','tHAISUNSET32_thumb.jpg',130, 83,1,'																			photo_3027452.html');
												thumbnails[3027453] = new thumbnail(3027453,'120538','','Thaisunset5_thumb.jpg',130, 89,1,'																			photo_3027453.html');
												thumbnails[3027454] = new thumbnail(3027454,'120538','','tHAISUNSET4_thumb.jpg',130, 184,1,'																			photo_3027454.html');
												thumbnails[3136013] = new thumbnail(3136013,'192327','','Grand-central-e2_thumb.jpg',130, 181,1,'																			photo_3136013.html');
												thumbnails[3136048] = new thumbnail(3136048,'192327','','CNNclick2_thumb.jpg',130, 93,1,'																			photo_3136048.html');
												thumbnails[3136059] = new thumbnail(3136059,'192327','','IMG_4933newE2_thumb.jpg',130, 96,1,'																			photo_3136059.html');
												thumbnails[3215602] = new thumbnail(3215602,'196418','','House1_thumb.jpg',130, 87,1,'																			photo_3215602.html');
												thumbnails[3215604] = new thumbnail(3215604,'196418','','House10_thumb.jpg',130, 87,1,'																			photo_3215604.html');
												thumbnails[3215605] = new thumbnail(3215605,'196418','','House11_thumb.jpg',130, 94,1,'																			photo_3215605.html');
												thumbnails[3215606] = new thumbnail(3215606,'196418','','House18_thumb.jpg',130, 89,1,'																			photo_3215606.html');
												thumbnails[3215607] = new thumbnail(3215607,'196418','','House15_thumb.jpg',130, 87,1,'																			photo_3215607.html');
												thumbnails[3215608] = new thumbnail(3215608,'196418','','lansbury1_thumb.jpg',130, 86,1,'																			photo_3215608.html');
												thumbnails[3215609] = new thumbnail(3215609,'196418','','lansbury3_thumb.jpg',130, 87,1,'																			photo_3215609.html');
												thumbnails[3215610] = new thumbnail(3215610,'196418','','lansbury2_thumb.jpg',130, 201,1,'																			photo_3215610.html');
												thumbnails[3215611] = new thumbnail(3215611,'196418','','Heritage4clic_thumb.jpg',130, 87,1,'																			photo_3215611.html');
												thumbnails[3239388] = new thumbnail(3239388,'150591','Annie and Callum','AnnieandCallumbwclic1_thumb.jpg',130, 188,1,'																			photo_3239388.html');
												thumbnails[3239400] = new thumbnail(3239400,'150591','','AnnieandCallum1clic_thumb.jpg',130, 188,1,'																			photo_3239400.html');
												thumbnails[3285074] = new thumbnail(3285074,'135785','','Severn Bridge new _thumb.jpg',130, 89,1,'																			photo_3285074.html');
												thumbnails[3285083] = new thumbnail(3285083,'135785','','Severn again e2_thumb.jpg',130, 95,1,'																			photo_3285083.html');
												thumbnails[3638739] = new thumbnail(3638739,'150591','Daniel Hodges','passport2pp6_pp_thumb.jpg',130, 165,1,'																			photo_3638739.html');
												thumbnails[3638748] = new thumbnail(3638748,'150591','Daniel Hodges','danhighkeyclick_thumb.jpg',130, 94,1,'																			photo_3638748.html');
												thumbnails[3638777] = new thumbnail(3638777,'196418','Nevill Hall Hospital','clickOld-house2monoe2_thumb.jpg',130, 84,1,'																			photo_3638777.html');
												thumbnails[3849202] = new thumbnail(3849202,'150591','','Ellie_2_click1_thumb.jpg',130, 110,1,'																			photo_3849202.html');
												thumbnails[3849205] = new thumbnail(3849205,'150591','','ellie_click_thumb.jpg',130, 90,1,'																			photo_3849205.html');
												thumbnails[3849212] = new thumbnail(3849212,'135785','','New-brookclick_thumb.jpg',130, 175,1,'																			photo_3849212.html');
												thumbnails[3849356] = new thumbnail(3849356,'135784','','Destructionclick_thumb.jpg',130, 90,1,'																			photo_3849356.html');
												thumbnails[5134557] = new thumbnail(5134557,'150591','','danparkclick_thumb.jpg',130, 88,1,'																			photo_5134557.html');
												thumbnails[5134714] = new thumbnail(5134714,'120538','','Amari_beach_thumb.jpg',130, 85,1,'																			photo_5134714.html');
												thumbnails[6754206] = new thumbnail(6754206,'367896','','IMG_0122_thumb.jpg',130, 88,1,'																			photo_6754206.html');
												thumbnails[6754209] = new thumbnail(6754209,'367896','','IMG_0317_thumb.jpg',130, 88,1,'																			photo_6754209.html');
												thumbnails[6754228] = new thumbnail(6754228,'367896','','IMG_0325_thumb.jpg',130, 88,1,'																			photo_6754228.html');
												thumbnails[6754229] = new thumbnail(6754229,'367896','','IMG_0340_thumb.jpg',130, 72,1,'																			photo_6754229.html');
												thumbnails[6754235] = new thumbnail(6754235,'367896','','IMG_0330_thumb.jpg',130, 88,1,'																			photo_6754235.html');
												thumbnails[6754237] = new thumbnail(6754237,'367896','','IMG_0349_thumb.jpg',130, 89,1,'																			photo_6754237.html');
												thumbnails[6754242] = new thumbnail(6754242,'367896','','IMG_0350_thumb.jpg',130, 88,1,'																			photo_6754242.html');
												thumbnails[6754244] = new thumbnail(6754244,'367896','','IMG_0357_thumb.jpg',130, 88,1,'																			photo_6754244.html');
												thumbnails[6754245] = new thumbnail(6754245,'367896','','IMG_0361_thumb.jpg',130, 89,1,'																			photo_6754245.html');
												thumbnails[6754247] = new thumbnail(6754247,'367896','','IMG_03611_thumb.jpg',130, 89,1,'																			photo_6754247.html');
												thumbnails[6754248] = new thumbnail(6754248,'367896','','IMG_0383_thumb.jpg',130, 88,1,'																			photo_6754248.html');
												thumbnails[6754249] = new thumbnail(6754249,'367896','','IMG_0384_thumb.jpg',130, 89,1,'																			photo_6754249.html');
												thumbnails[6754251] = new thumbnail(6754251,'367896','','IMG_0386_thumb.jpg',130, 50,1,'																			photo_6754251.html');
												thumbnails[6754253] = new thumbnail(6754253,'367896','','IMG_0394_thumb.jpg',130, 88,1,'																			photo_6754253.html');
												thumbnails[6754256] = new thumbnail(6754256,'367896','','IMG_0395_thumb.jpg',130, 87,1,'																			photo_6754256.html');
												thumbnails[6754259] = new thumbnail(6754259,'367896','','IMG_03273_thumb.jpg',130, 88,1,'																			photo_6754259.html');
												thumbnails[3136058] = new thumbnail(3136058,'192327','','Taxistandoutclick1_thumb.jpg',130, 204,1,'																			photo_3136058.html');
												thumbnails[3221966] = new thumbnail(3221966,'150591','Callum','callum3colourclic3_thumb.jpg',130, 123,1,'																			photo_3221966.html');
												thumbnails[3285084] = new thumbnail(3285084,'135785','','Rugby post2_thumb.jpg',130, 198,1,'																			photo_3285084.html');
												thumbnails[3221972] = new thumbnail(3221972,'150591','Callum','callum21_thumb.jpg',130, 85,1,'																			photo_3221972.html');
												thumbnails[3221969] = new thumbnail(3221969,'150591','Callum','callimclicbw_thumb.jpg',130, 104,1,'																			photo_3221969.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[135784] = new gallery(135784,'2099895','Flowers','gallery',[2099889,2099892,2099895,2099897,2099902,2709074,3849356],0, 0, '', '																																																																																																							gallery_135784.html',0,0);
				  					galleries[192327] = new gallery(192327,'3136058','New York','gallery',[3136013,3136048,3136059,3136058],0, 0, '', '																																																																																																							gallery_192327.html',0,0);
				  					galleries[120538] = new gallery(120538,'2015281','Seascapes','gallery',[2015281,2099905,3027451,3027452,3027453,3027454,5134714],0, 0, '', '																																																																																																							gallery_120538.html',0,0);
				  					galleries[135785] = new gallery(135785,'3849212','Landscapes','gallery',[2099914,2744383,2744446,2744457,2744462,2744463,3285074,3285083,3849212,3285084],0, 0, '', '																																																																																																							gallery_135785.html',0,0);
				  					galleries[150591] = new gallery(150591,'3849202,3638748,2302346','Potraits','gallery',[2411051,2302346,2302348,2302355,2302357,2302360,2302372,2302374,2302387,2302388,2447173,2998194,3239388,3239400,3638739,3638748,3849202,3849205,5134557,3221966,3221972,3221969],0, 0, '', '																																																																																																							gallery_150591.html',0,0);
				  					galleries[169400] = new gallery(169400,'2682596,2681774,2681746','Ron Harris Stables','gallery',[2681746,2681774,2682596],0, 0, '', '																																																																																																							gallery_169400.html',0,0);
				  					galleries[196418] = new gallery(196418,'3638777,3215611,3215608','National Heritage Awards','gallery',[3215602,3215604,3215605,3215606,3215607,3215608,3215609,3215610,3215611,3638777],0, 0, '', '																																																																																																							gallery_196418.html',0,0);
				  					galleries[367896] = new gallery(367896,'6754259,6754256,6754253,6754251,6754249,6754248,6754247,6754245,6754244,6754242','Greenmeadow Golf Club','gallery',[6754206,6754209,6754228,6754229,6754235,6754237,6754242,6754244,6754245,6754247,6754248,6754249,6754251,6754253,6754256,6754259],0, 0, '', '																																																																																																							gallery_367896.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '3136058';
imageSets[2] = '3849212,3849202,3638777,3638748,3215611,3215608,3136058,2302346,2099895,2015281';
imageSets[3] = '6754259,6754256,6754253,6754251,6754249,6754248,6754247,6754245,6754244,6754242,6754237,6754235,6754229,6754228,6754209,6754206,5134714,5134557,3849356,3849212,3849205,3849202,3638777,3638748,3638739,3285084,3285083,3285074,3239400,3239388,3221972,3221969,3221966,3215611,3215610,3215609,3215608,3215607,3215606,3215605,3215604,3215602,3136059,3136058,3136048,3136013,3027454,3027453,3027452,3027451';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/bodiewil/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/bodiewil/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/bodiewil/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/bodiewil/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/bodiewil/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/bodiewil/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/bodiewil/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/bodiewil/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/bodiewil/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/bodiewil/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/bodiewil/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/bodiewil/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/bodiewil/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/bodiewil/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/bodiewil/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/bodiewil/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/bodiewil/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/bodiewil/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/bodiewil/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/bodiewil/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/bodiewil/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/bodiewil/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 = '                     Bodiephoto.co.uk : ' + 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> 							' + (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 + '<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;
	}
}

			

