window.thumbnails = new Object();
												thumbnails[1939343] = new thumbnail(1939343,'','','P1050854_thumb.JPG',130, 87,1,'#');
												thumbnails[2468619] = new thumbnail(2468619,'','','P1040091[1]_thumb.jpg',130, 195,1,'#');
												thumbnails[1939025] = new thumbnail(1939025,'129825','','Panorama eden1_thumb.JPG',130, 51,1,'photo_1939025.html');
												thumbnails[1939026] = new thumbnail(1939026,'129825','','Panorama1_thumb.JPG',130, 67,1,'photo_1939026.html');
												thumbnails[1939027] = new thumbnail(1939027,'129825','','Copy of Panorama boconnoc2_thumb.JPG',130, 43,1,'photo_1939027.html');
												thumbnails[1939028] = new thumbnail(1939028,'129825','','Copy (2) of Panorama polruan2_thumb.JPG',130, 47,1,'photo_1939028.html');
												thumbnails[1939029] = new thumbnail(1939029,'129825','','Copy (2) of panarama par2_thumb.JPG',130, 32,1,'photo_1939029.html');
												thumbnails[1939155] = new thumbnail(1939155,'71716','','P1040948_thumb.JPG',130, 87,1,'photo_1939155.html');
												thumbnails[1939158] = new thumbnail(1939158,'71716','','P1040969_thumb.JPG',130, 87,1,'photo_1939158.html');
												thumbnails[1939160] = new thumbnail(1939160,'70593','','P1040967_thumb.JPG',130, 195,1,'photo_1939160.html');
												thumbnails[1939169] = new thumbnail(1939169,'70597','','P10507891_thumb.JPG',130, 87,1,'photo_1939169.html');
												thumbnails[1939170] = new thumbnail(1939170,'70593','','P1050719_thumb.JPG',130, 87,1,'photo_1939170.html');
												thumbnails[1939186] = new thumbnail(1939186,'102616','','P1050878_thumb.JPG',130, 87,1,'photo_1939186.html');
												thumbnails[1939187] = new thumbnail(1939187,'102616','','P1050984_thumb.JPG',130, 87,1,'photo_1939187.html');
												thumbnails[2470625] = new thumbnail(2470625,'70597','','Copy of DSCF0027_thumb.JPG',130, 87,1,'photo_2470625.html');
												thumbnails[2470626] = new thumbnail(2470626,'70597','','Copy of DSCF0036_thumb.JPG',130, 87,1,'photo_2470626.html');
												thumbnails[2470628] = new thumbnail(2470628,'70597','','Copy of DSCF0045_thumb.JPG',130, 87,1,'photo_2470628.html');
												thumbnails[2470630] = new thumbnail(2470630,'70597','','Copy of DSCF00371_thumb.JPG',130, 87,1,'photo_2470630.html');
												thumbnails[2470643] = new thumbnail(2470643,'70597','','P1050520_thumb.JPG',130, 87,1,'photo_2470643.html');
												thumbnails[2470651] = new thumbnail(2470651,'70597','','P1050539_thumb.JPG',130, 87,1,'photo_2470651.html');
												thumbnails[2470653] = new thumbnail(2470653,'70597','','P1050564_thumb.JPG',130, 87,1,'photo_2470653.html');
												thumbnails[2470660] = new thumbnail(2470660,'71716','','P1050662_thumb.JPG',130, 87,1,'photo_2470660.html');
												thumbnails[2470666] = new thumbnail(2470666,'71716','','P1060067_thumb.JPG',130, 87,1,'photo_2470666.html');
												thumbnails[2470667] = new thumbnail(2470667,'71716','','P1060071_thumb.JPG',130, 87,1,'photo_2470667.html');
												thumbnails[2470675] = new thumbnail(2470675,'70593','','Copy of P1020525_thumb.JPG',130, 87,1,'photo_2470675.html');
												thumbnails[2470679] = new thumbnail(2470679,'70593','','P1020400_thumb.JPG',130, 87,1,'photo_2470679.html');
												thumbnails[2470680] = new thumbnail(2470680,'70593','','P1020480_thumb.JPG',130, 87,1,'photo_2470680.html');
												thumbnails[2470681] = new thumbnail(2470681,'70593','','P1020588_thumb.JPG',130, 87,1,'photo_2470681.html');
												thumbnails[2470683] = new thumbnail(2470683,'70593','','P1030107_thumb.JPG',130, 104,1,'photo_2470683.html');
												thumbnails[2470700] = new thumbnail(2470700,'102616','','P1020175_thumb.JPG',130, 87,1,'photo_2470700.html');
												thumbnails[2470702] = new thumbnail(2470702,'102616','','P1020745_thumb.JPG',130, 87,1,'photo_2470702.html');
												thumbnails[2470703] = new thumbnail(2470703,'102616','','P1020987_thumb.JPG',130, 87,1,'photo_2470703.html');
												thumbnails[2470734] = new thumbnail(2470734,'102616','','P1040244_thumb.JPG',130, 87,1,'photo_2470734.html');
												thumbnails[2470735] = new thumbnail(2470735,'102616','','P1040324_thumb.JPG',130, 87,1,'photo_2470735.html');
												thumbnails[2470736] = new thumbnail(2470736,'102616','','P1040328_thumb.JPG',130, 113,1,'photo_2470736.html');
												thumbnails[2470737] = new thumbnail(2470737,'102616','','P1040331_thumb.JPG',130, 87,1,'photo_2470737.html');
												thumbnails[2470744] = new thumbnail(2470744,'102616','','P1040434_thumb.JPG',130, 195,1,'photo_2470744.html');
												thumbnails[2470745] = new thumbnail(2470745,'102616','','P1040700_thumb.JPG',130, 87,1,'photo_2470745.html');
												thumbnails[2470746] = new thumbnail(2470746,'102616','','P1040708_thumb.JPG',130, 165,1,'photo_2470746.html');
												thumbnails[2470748] = new thumbnail(2470748,'102616','','P10503551_thumb.JPG',130, 87,1,'photo_2470748.html');
												thumbnails[2470749] = new thumbnail(2470749,'102616','','P1050511_thumb.JPG',130, 87,1,'photo_2470749.html');
												thumbnails[2470750] = new thumbnail(2470750,'102616','','P1050732_thumb.JPG',130, 87,1,'photo_2470750.html');
												thumbnails[2470751] = new thumbnail(2470751,'102616','','P1050829_thumb.JPG',130, 87,1,'photo_2470751.html');
												thumbnails[2470752] = new thumbnail(2470752,'102616','','P1050831_thumb.JPG',130, 107,1,'photo_2470752.html');
												thumbnails[2470754] = new thumbnail(2470754,'102616','','P1050877_thumb.JPG',130, 87,1,'photo_2470754.html');
												thumbnails[2470755] = new thumbnail(2470755,'102616','','P1050886_thumb.JPG',130, 87,1,'photo_2470755.html');
												thumbnails[2470757] = new thumbnail(2470757,'102616','','P1050894_thumb.JPG',130, 87,1,'photo_2470757.html');
												thumbnails[2470760] = new thumbnail(2470760,'102616','','P1050958_thumb.JPG',130, 103,1,'photo_2470760.html');
												thumbnails[2470761] = new thumbnail(2470761,'102616','','P1050988_thumb.JPG',130, 87,1,'photo_2470761.html');
												thumbnails[2523920] = new thumbnail(2523920,'102616','','Copy of P1070183_thumb.JPG',130, 98,1,'photo_2523920.html');
												thumbnails[2523923] = new thumbnail(2523923,'102616','','Copy of P1070194_thumb.JPG',130, 114,1,'photo_2523923.html');
												thumbnails[2964657] = new thumbnail(2964657,'102616','','P1070513_thumb.JPG',130, 123,1,'photo_2964657.html');
												thumbnails[2964662] = new thumbnail(2964662,'102616','','P1070515_thumb.JPG',130, 123,1,'photo_2964662.html');
												thumbnails[2964666] = new thumbnail(2964666,'102616','','P1070545_thumb.JPG',130, 85,1,'photo_2964666.html');
												thumbnails[2964669] = new thumbnail(2964669,'102616','','P1070560_thumb.JPG',130, 64,1,'photo_2964669.html');
												thumbnails[2964672] = new thumbnail(2964672,'102616','','P1070579_thumb.JPG',130, 108,1,'photo_2964672.html');
												thumbnails[2964673] = new thumbnail(2964673,'102616','','P1070643_thumb.JPG',130, 77,1,'photo_2964673.html');
												thumbnails[2964678] = new thumbnail(2964678,'102616','','P1070782_thumb.JPG',130, 111,1,'photo_2964678.html');
												thumbnails[2964681] = new thumbnail(2964681,'102616','','P1070795_thumb.JPG',130, 85,1,'photo_2964681.html');
												thumbnails[2964683] = new thumbnail(2964683,'102616','','P1070860_thumb.JPG',130, 109,1,'photo_2964683.html');
												thumbnails[2964686] = new thumbnail(2964686,'70597','','P1070908_thumb.JPG',130, 98,1,'photo_2964686.html');
												thumbnails[2964688] = new thumbnail(2964688,'70593','','P1070956_thumb.JPG',130, 94,1,'photo_2964688.html');
												thumbnails[6009285] = new thumbnail(6009285,'248469','','DSCF1493_thumb.JPG',130, 98,1,'photo_6009285.html');
												thumbnails[6009297] = new thumbnail(6009297,'248469','','DSCF1497_thumb.JPG',130, 98,1,'photo_6009297.html');
												thumbnails[6009299] = new thumbnail(6009299,'248469','','DSCF1728_thumb.JPG',130, 98,1,'photo_6009299.html');
												thumbnails[6009303] = new thumbnail(6009303,'248469','','DSCF1784_thumb.JPG',130, 98,1,'photo_6009303.html');
												thumbnails[6009305] = new thumbnail(6009305,'248469','','DSCF1812_thumb.JPG',130, 98,1,'photo_6009305.html');
												thumbnails[6009308] = new thumbnail(6009308,'248469','','DSCF1818_thumb.JPG',130, 98,1,'photo_6009308.html');
												thumbnails[6009309] = new thumbnail(6009309,'248469','','DSCF1822_thumb.JPG',130, 59,1,'photo_6009309.html');
												thumbnails[6009314] = new thumbnail(6009314,'248469','','DSCF1831_thumb.JPG',130, 173,1,'photo_6009314.html');
												thumbnails[6009324] = new thumbnail(6009324,'248469','','DSCF1835EDIT2_thumb.jpg',130, 98,1,'photo_6009324.html');
												thumbnails[6009328] = new thumbnail(6009328,'248469','','DSCF1841_thumb.JPG',130, 98,1,'photo_6009328.html');
												thumbnails[6009332] = new thumbnail(6009332,'248469','','DSCF2062_thumb.JPG',130, 98,1,'photo_6009332.html');
												thumbnails[6009335] = new thumbnail(6009335,'248469','','DSCF2077_thumb.JPG',130, 98,1,'photo_6009335.html');
												thumbnails[6009339] = new thumbnail(6009339,'248469','','DSCF2100_thumb.JPG',130, 98,1,'photo_6009339.html');
												thumbnails[6009342] = new thumbnail(6009342,'248469','','DSCF2167_thumb.JPG',130, 98,1,'photo_6009342.html');
												thumbnails[6009356] = new thumbnail(6009356,'248469','','DSCF2257_thumb.JPG',130, 98,1,'photo_6009356.html');
												thumbnails[6009360] = new thumbnail(6009360,'248469','','DSCF2297_thumb.JPG',130, 98,1,'photo_6009360.html');
												thumbnails[6009363] = new thumbnail(6009363,'248469','','DSCF2326_thumb.JPG',130, 98,1,'photo_6009363.html');
												thumbnails[6009366] = new thumbnail(6009366,'248469','','DSCF2327_thumb.JPG',130, 98,1,'photo_6009366.html');
												thumbnails[6009369] = new thumbnail(6009369,'248469','','DSCF2332_thumb.JPG',130, 98,1,'photo_6009369.html');
												thumbnails[6009371] = new thumbnail(6009371,'248469','','DSCF2336_thumb.JPG',130, 75,1,'photo_6009371.html');
												thumbnails[6009375] = new thumbnail(6009375,'248469','','DSCF2380_thumb.JPG',130, 98,1,'photo_6009375.html');
												thumbnails[6009376] = new thumbnail(6009376,'248469','','DSCF2492_thumb.JPG',130, 98,1,'photo_6009376.html');
												thumbnails[6009383] = new thumbnail(6009383,'248469','','DSCF2556_thumb.JPG',130, 98,1,'photo_6009383.html');
												thumbnails[6009384] = new thumbnail(6009384,'248469','','DSCF2563_thumb.JPG',130, 98,1,'photo_6009384.html');
												thumbnails[6009386] = new thumbnail(6009386,'248469','','DSCF2566_thumb.JPG',130, 98,1,'photo_6009386.html');
												thumbnails[6009389] = new thumbnail(6009389,'248469','','DSCF2570_thumb.JPG',130, 98,1,'photo_6009389.html');
												thumbnails[6009392] = new thumbnail(6009392,'248469','','DSCF2578_thumb.JPG',130, 98,1,'photo_6009392.html');
												thumbnails[6009396] = new thumbnail(6009396,'248469','','DSCF2603_thumb.JPG',130, 173,1,'photo_6009396.html');
												thumbnails[7653385] = new thumbnail(7653385,'70593','','DSCF3229_thumb.JPG',130, 98,1,'photo_7653385.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[102616] = new gallery(102616,'2964683,2964681,2964678,2964673,2964672,2964669,2964666,2964662,2964657,2523923','Animals','gallery',[1939186,1939187,2470700,2470702,2470703,2470734,2470735,2470736,2470737,2470744,2470745,2470746,2470748,2470749,2470750,2470751,2470752,2470754,2470755,2470757,2470760,2470761,2523920,2523923,2964657,2964662,2964666,2964669,2964672,2964673,2964678,2964681,2964683],0, 0, '', 'gallery_102616.html',0,0);
				  					galleries[70593] = new gallery(70593,'7653385,2964688,2470683,2470681,2470680,2470679,2470675,1939170,1939160','Flowers','gallery',[1939160,1939170,2470675,2470679,2470680,2470681,2470683,2964688,7653385],0, 0, '', 'gallery_70593.html',0,0);
				  					galleries[71716] = new gallery(71716,'2470667,2470666,2470660,1939158,1939155','Landscape','gallery',[1939155,1939158,2470660,2470666,2470667],0, 0, '', 'gallery_71716.html',0,0);
				  					galleries[129825] = new gallery(129825,'1939029,1939028,1939027,1939026,1939025','Panoramic','gallery',[1939025,1939026,1939027,1939028,1939029],0, 0, '', 'gallery_129825.html',0,0);
				  					galleries[248469] = new gallery(248469,'6009396,6009392,6009389,6009386,6009384,6009383,6009376,6009375,6009371,6009369','Scotland','gallery',[6009285,6009297,6009299,6009303,6009305,6009308,6009309,6009314,6009324,6009328,6009332,6009335,6009339,6009342,6009356,6009360,6009363,6009366,6009369,6009371,6009375,6009376,6009383,6009384,6009386,6009389,6009392,6009396],0, 0, '', 'gallery_248469.html',0,0);
				  					galleries[70597] = new gallery(70597,'1939169','Seaside','gallery',[1939169,2470625,2470626,2470628,2470630,2470643,2470651,2470653,2964686],0, 0, '', 'gallery_70597.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '6009392,6009335';
imageSets[2] = '1939169';
imageSets[3] = '7653385,6009396,6009392,6009389,6009386,6009384,6009383,6009376,6009375,6009371,6009369,6009366,6009363,6009360,6009356,6009342,6009339,6009335,6009332,6009328,6009324,6009314,6009309,6009308,6009305,6009303,6009299,6009297,6009285,2964688,2964686,2964683,2964681,2964678,2964673,2964672,2964669,2964666,2964662,2964657,2523923,2523920,2470761,2470760,2470757,2470755,2470754,2470752,2470751,2470750';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/johnandnikki/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/johnandnikki/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/johnandnikki/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/johnandnikki/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/johnandnikki/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/johnandnikki/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/johnandnikki/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/johnandnikki/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/johnandnikki/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/johnandnikki/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/johnandnikki/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/johnandnikki/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/johnandnikki/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/johnandnikki/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/johnandnikki/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/johnandnikki/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/johnandnikki/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/johnandnikki/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/johnandnikki/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/johnandnikki/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/johnandnikki/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/johnandnikki/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 = 'johnandnikki.co.uk: ' + photoCaption;
			    }
        if (op.$detail.length > 0) {
      temp = op.nextPhoto.fnGetImageDetails();
	    op.$detail.fadeGalleryDetails(temp, op.speed, function(){
	    var options = {photoinfominwidth:200};	    		options.photoinfoadjacent = true;			      	      resizePhotoInfo(options);
        if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
  	      toggleAddToCartConfirm(backgrounds);
  	    } else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
  	      toggleAddToCartConfirm(photos);
  	    }
	    });
    }
        if (!op.speed) {      clik.doColumnResize(false, op.$photo.add(op.$detail).add(op.$title));      $('body').trigger('clikUpdate');    }        
    return html;			}
	else {
				
		window.location = 'photo_' + nextPhoto.id + '.html';
	}
		
}

/***************************************************************************
* Toggle add to cart confirmation element and set up the click event for   *
* the 'Add to cart' button.                                                *
***************************************************************************/
function toggleAddToCartConfirm(array){
  if (typeof(array) !== 'object') {
    array = photos;
  }
	if($('#paymentConfirm').length > 0){
		$('#paymentConfirm').hide();
		$('#paymentAddButton')
		.unbind()
		.click(function(){
						form = document.getElementById('paymentForm');
			option_id = 0;
			if(form.item_option.value){
				option_id = form.item_option.value;
			}
			if(addItemToBasket(form.item_number.value,array,form.site.value,parseInt(form.quantity.value, 10),option_id)){
				if($.browser.msie){$('#paymentConfirm').text('Item added to cart').show();}
				else{
					$('#paymentConfirm').text('Item added to cart').fadeIn();
					dspOrderDetails(form.site.value);
				}
			}
			else{
				$('#paymentConfirm').text('Item not added - check cookies are enabled in your browser.').fadeIn();
			}
		});
	}
}
/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
photo.prototype.fnGetImageDetails = function(){
	var temp = '';
	if (this.description != '') {
		temp = temp +  '<p id="imageDescription">' + this.description + '</p>';
	}
		if (this.photo_ref != '') {
		temp = temp + '<p class="imageinfo" id="imageRef"><strong>Ref: </strong>' + this.photo_ref + '</p>';
	}
		if (this.takendate != '') {
				
		temp = temp + '<p class="imageinfo" id="imageDate"><strong>Date: </strong>' + this.takendate + '</p>';
	}
	
	if (this.location != '') {
				
		temp = temp + '<p class="imageinfo" id="imageLocation"><strong>Location: </strong>' +  this.location + '</p>';
	}
	
	if (this.photographer != '') {
				
		temp = temp + '<p class="imageinfo" id="imagePhotographer"><strong>Photographer: </strong>' + this.photographer + '</p>';
	}
					
				if (temp != '') {
		temp = temp + '<div class="spacer"></div>';
	}
	return temp;
};

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
photo.prototype.fnGetPaymentInfo = function(){
	var temp = '';
	if (this.item_price !== '') {
				temp = temp + '<p>Order this print:</p>';
				temp = temp + '<p class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> ' + (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;
	}
}

			

