window.thumbnails = new Object();
												thumbnails[722783] = new thumbnail(722783,'56776','','web_thumb.jpg',130, 87,1,'							photo_722783.html');
												thumbnails[723026] = new thumbnail(723026,'56776','','Dcs_1974 new1_thumb.jpg',130, 55,1,'							photo_723026.html');
												thumbnails[734432] = new thumbnail(734432,'56811','','DSC_4277_thumb.jpg',130, 98,1,'							photo_734432.html');
												thumbnails[734434] = new thumbnail(734434,'56776','','_DSC2448 SP2_thumb.jpg',130, 76,1,'							photo_734434.html');
												thumbnails[735051] = new thumbnail(735051,'56776','','DSC_7646_thumb.jpg',130, 77,1,'							photo_735051.html');
												thumbnails[735908] = new thumbnail(735908,'56811','','DSC_4651_thumb.jpg',130, 86,1,'							photo_735908.html');
												thumbnails[735910] = new thumbnail(735910,'56811','','Lion_Keys_thumb.jpg',130, 65,1,'							photo_735910.html');
												thumbnails[735919] = new thumbnail(735919,'56811','','DSC_1911_thumb.jpg',130, 86,1,'							photo_735919.html');
												thumbnails[735923] = new thumbnail(735923,'56811','','DSC_2030_thumb.jpg',130, 86,1,'							photo_735923.html');
												thumbnails[736121] = new thumbnail(736121,'56776','','DSC_9750_thumb.jpg',130, 84,1,'							photo_736121.html');
												thumbnails[736122] = new thumbnail(736122,'71424','','DSC_3048 Web_thumb.jpg',130, 194,1,'							photo_736122.html');
												thumbnails[736141] = new thumbnail(736141,'56811','','Ruthin wall 8x12_thumb.jpg',130, 87,1,'							photo_736141.html');
												thumbnails[736215] = new thumbnail(736215,'56811','','R1_thumb.jpg',130, 95,1,'							photo_736215.html');
												thumbnails[736220] = new thumbnail(736220,'56811','','20x16 Karthen_thumb.jpg',130, 86,1,'							photo_736220.html');
												thumbnails[782523] = new thumbnail(782523,'56811','','DSC_6960_thumb.jpg',130, 104,1,'							photo_782523.html');
												thumbnails[782549] = new thumbnail(782549,'71424','','DSC_0465web_thumb.jpg',130, 191,1,'							photo_782549.html');
												thumbnails[782564] = new thumbnail(782564,'56811','','DSC_7710_New_Web_thumb.jpg',130, 77,1,'							photo_782564.html');
												thumbnails[782570] = new thumbnail(782570,'60689','','DSC_5600_thumb.jpg',130, 176,1,'							photo_782570.html');
												thumbnails[943409] = new thumbnail(943409,'71424','','dres_thumb.jpg',130, 190,1,'							photo_943409.html');
												thumbnails[943410] = new thumbnail(943410,'71424','','top_thumb.jpg',130, 186,1,'							photo_943410.html');
												thumbnails[943471] = new thumbnail(943471,'56776','','aled 917_thumb.jpg',130, 130,1,'							photo_943471.html');
												thumbnails[1198666] = new thumbnail(1198666,'','Aled Oldfield ','web_test_31_thumb.jpg',130, 88,1,'							photo_1198666.html');
												thumbnails[3568226] = new thumbnail(3568226,'71424','','DSC_0441_worked_on__Web_thumb.jpg',130, 226,1,'							photo_3568226.html');
												thumbnails[3602267] = new thumbnail(3602267,'71424','','web_1_thumb.jpg',130, 67,1,'							photo_3602267.html');
												thumbnails[3604683] = new thumbnail(3604683,'71424','','DSC_6472_worked_onBW_thumb.jpg',130, 247,1,'							photo_3604683.html');
												thumbnails[3604684] = new thumbnail(3604684,'71424','','DSC_6489_thumb.jpg',130, 195,1,'							photo_3604684.html');
												thumbnails[3669284] = new thumbnail(3669284,'71424','','DSC_6596_Blue_thumb.jpg',130, 291,1,'							photo_3669284.html');
												thumbnails[3874292] = new thumbnail(3874292,'71424','','Web_DSC_2551BL1_thumb.jpg',130, 255,1,'							photo_3874292.html');
												thumbnails[3874296] = new thumbnail(3874296,'71424','','Web_DSC_2568_thumb.jpg',130, 130,1,'							photo_3874296.html');
												thumbnails[3874298] = new thumbnail(3874298,'71424','','Web_DSC_2587_thumb.jpg',130, 86,1,'							photo_3874298.html');
												thumbnails[4418590] = new thumbnail(4418590,'56691','','Baby_Photograph_thumb.jpg',130, 101,1,'							photo_4418590.html');
												thumbnails[4435743] = new thumbnail(4435743,'56691','','Ruthin_Denbighshire_thumb.jpg',130, 99,1,'							photo_4435743.html');
												thumbnails[5294079] = new thumbnail(5294079,'56691','','For_Web_thumb.jpg',130, 163,1,'							photo_5294079.html');
												thumbnails[5396039] = new thumbnail(5396039,'56691','','DSC_4929_thumb.jpg',130, 104,1,'							photo_5396039.html');
												thumbnails[5624959] = new thumbnail(5624959,'60689','','DSC_5608_thumb.jpg',130, 176,1,'							photo_5624959.html');
												thumbnails[6969727] = new thumbnail(6969727,'56691','','DSC_4845_thumb.jpg',130, 199,1,'							photo_6969727.html');
												thumbnails[6973942] = new thumbnail(6973942,'56691','','Wedding_Corwen_thumb.jpg',130, 163,1,'							photo_6973942.html');
												thumbnails[7000706] = new thumbnail(7000706,'56691','','Studio_Rhuddlan_thumb.jpg',130, 105,1,'							photo_7000706.html');
												thumbnails[7005459] = new thumbnail(7005459,'56691','','Wedding_Flintshire_thumb.jpg',130, 175,1,'							photo_7005459.html');
												thumbnails[7005581] = new thumbnail(7005581,'56691','','Wedding_Denbighshire_thumb.jpg',130, 195,1,'							photo_7005581.html');
												thumbnails[7011196] = new thumbnail(7011196,'56691','','Ruthin_Wedding_thumb.jpg',130, 163,1,'							photo_7011196.html');
												thumbnails[7025717] = new thumbnail(7025717,'56691','','Denbighshire_Wedding_thumb.jpg',130, 195,1,'							photo_7025717.html');
												thumbnails[7039734] = new thumbnail(7039734,'56691','','Studio_of_boy_thumb.jpg',130, 97,1,'							photo_7039734.html');
												thumbnails[7075076] = new thumbnail(7075076,'56691','','Studio_At_Rhuddlan_thumb.jpg',130, 131,19,'							photo_7075076.html');
												thumbnails[7100367] = new thumbnail(7100367,'56691','','Aled_Denbighshire_thumb.jpg',130, 104,1,'							photo_7100367.html');
												thumbnails[1989103] = new thumbnail(1989103,'56811','','P3_thumb.jpg',130, 86,1,'							photo_1989103.html');
												thumbnails[782559] = new thumbnail(782559,'56811','','DSC_6449_thumb.jpg',130, 130,1,'							photo_782559.html');
												thumbnails[782560] = new thumbnail(782560,'71424','','DSC_0676_Make up for web_thumb.jpg',130, 130,1,'							photo_782560.html');
												thumbnails[943553] = new thumbnail(943553,'56776','','Rhuddlan_baby_thumb.jpg',130, 104,1,'							photo_943553.html');
												thumbnails[1988215] = new thumbnail(1988215,'56776','','Studio 13x20_thumb.jpg',130, 74,1,'							photo_1988215.html');
												thumbnails[1988219] = new thumbnail(1988219,'56776','','DSC_3608_thumb.jpg',130, 91,1,'							photo_1988219.html');
												thumbnails[1989582] = new thumbnail(1989582,'71424','','Marcher 2_thumb.jpg',130, 60,1,'							photo_1989582.html');
												thumbnails[782573] = new thumbnail(782573,'71424','','DSC_2262BW_thumb.jpg',130, 87,1,'							photo_782573.html');
												thumbnails[943408] = new thumbnail(943408,'56776','','Web Mother_thumb.jpg',130, 66,1,'							photo_943408.html');
												thumbnails[1988218] = new thumbnail(1988218,'56776','','DSC_3591_thumb.jpg',130, 73,1,'							photo_1988218.html');
												thumbnails[735905] = new thumbnail(735905,'56776','','Gril_thumb.jpg',130, 163,1,'							photo_735905.html');
												thumbnails[736126] = new thumbnail(736126,'56776','','aled portrait_thumb.jpg',130, 130,1,'							photo_736126.html');
												thumbnails[736134] = new thumbnail(736134,'56776','','DSC_9844_thumb.jpg',130, 259,1,'							photo_736134.html');
												thumbnails[3401649] = new thumbnail(3401649,'56811','','DSC_9402_thumb.jpg',130, 104,1,'							photo_3401649.html');
												thumbnails[3458499] = new thumbnail(3458499,'56811','','New DSC_7836_thumb.jpg',130, 130,1,'							photo_3458499.html');
												thumbnails[3401663] = new thumbnail(3401663,'56811','','DSC_5418_thumb.jpg',130, 70,1,'							photo_3401663.html');
												thumbnails[722774] = new thumbnail(722774,'56811','','Bride and groom photographic at st davids park flintshire_thumb.jpg',130, 152,1,'							photo_722774.html');
												thumbnails[738199] = new thumbnail(738199,'56811','','22x18  2_thumb.jpg',130, 196,1,'							photo_738199.html');
												thumbnails[752603] = new thumbnail(752603,'56811','','DSC_5067_thumb.BW.jpg',130, 163,1,'							photo_752603.html');
												thumbnails[752562] = new thumbnail(752562,'56811','','DSC_1790_thumb.jpg',130, 195,1,'							photo_752562.html');
												thumbnails[782577] = new thumbnail(782577,'56811','','DSC_6378SP_thumb.jpg',130, 212,1,'							photo_782577.html');
												thumbnails[6519796] = new thumbnail(6519796,'56811','','DSC_6421_thumb.jpg',130, 196,1,'							photo_6519796.html');
												thumbnails[4255701] = new thumbnail(4255701,'56811','','DSC_8051_thumb.jpg',130, 229,1,'							photo_4255701.html');
												thumbnails[735926] = new thumbnail(735926,'56811','','Bride_1_thumb.jpg',130, 196,1,'							photo_735926.html');
												thumbnails[3401647] = new thumbnail(3401647,'56811','','Bride_2_thumb.jpg',130, 195,1,'							photo_3401647.html');
												thumbnails[3401648] = new thumbnail(3401648,'56811','','DSC_9399_thumb.jpg',130, 186,1,'							photo_3401648.html');
												thumbnails[4183392] = new thumbnail(4183392,'11633','','Web_Wedding_thumb.jpg',130, 86,1,'							photo_4183392.html');
												thumbnails[4740393] = new thumbnail(4740393,'11633','','DSC_8351New_2_thumb.jpg',130, 86,1,'							photo_4740393.html');
												thumbnails[5112496] = new thumbnail(5112496,'11633','','DSC_6018_for_web_thumb.jpg',130, 104,1,'							photo_5112496.html');
												thumbnails[724866] = new thumbnail(724866,'11633','','DSC_8459_thumb.jpg',130, 86,1,'							photo_724866.html');
												thumbnails[738193] = new thumbnail(738193,'11633','','DSC_7814WBB_thumb.jpg',130, 86,1,'							photo_738193.html');
												thumbnails[738701] = new thumbnail(738701,'11633','','aled 1_thumb.jpg',130, 91,1,'							photo_738701.html');
												thumbnails[722777] = new thumbnail(722777,'11633','','For The Web Site_thumb.jpg',130, 130,1,'							photo_722777.html');
												thumbnails[723029] = new thumbnail(723029,'11633','','Untitled-1_thumb.jpg',130, 107,1,'							photo_723029.html');
												thumbnails[3458497] = new thumbnail(3458497,'11633','','DSC_5684_thumb.jpg',130, 88,1,'							photo_3458497.html');
												thumbnails[3458495] = new thumbnail(3458495,'11633','','New DSC_0261_thumb.jpg',130, 87,1,'							photo_3458495.html');
												thumbnails[752599] = new thumbnail(752599,'11633','','New 20x24_thumb.jpg',130, 195,1,'							photo_752599.html');
												thumbnails[738196] = new thumbnail(738196,'11633','','DSC_3685 For Web_thumb.jpg',130, 194,1,'							photo_738196.html');
												thumbnails[3458483] = new thumbnail(3458483,'11633','','DSC_6023_thumb.jpg',130, 216,1,'							photo_3458483.html');
												thumbnails[722770] = new thumbnail(722770,'11633','','DSC_8551_thumb.jpg',130, 204,1,'							photo_722770.html');
												thumbnails[734430] = new thumbnail(734430,'11633','','Groom_thumb.jpg',130, 196,1,'							photo_734430.html');
												thumbnails[4690396] = new thumbnail(4690396,'11633','','_DSC2138_Web_thumb.jpg',130, 174,1,'							photo_4690396.html');
												thumbnails[722778] = new thumbnail(722778,'11633','','DSC_8530_thumb.jpg',130, 195,1,'							photo_722778.html');
												thumbnails[722779] = new thumbnail(722779,'11633','','20x16 D_thumb.jpg',130, 199,1,'							photo_722779.html');
												thumbnails[686766] = new thumbnail(686766,'11633','','for the web_thumb.jpg',130, 194,1,'							photo_686766.html');
												thumbnails[4222881] = new thumbnail(4222881,'11633','','Wedding_1_thumb.jpg',130, 195,1,'							photo_4222881.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[56776] = new gallery(56776,'1988219,1988218,1988215,943553,943471,943408,736134,736126,736121,735905',' See More Family Portraits Click Here','section83033',[722783,723026,734434,735051,736121,943471,943553,1988215,1988219,943408,1988218,735905,736126,736134],0, 0, '', '																																																																																																							section83033_56776.html',0,0);
				  					galleries[378004] = new gallery(378004,'','Blog Photo','section77812',[],0, 0, '', '																																																																																																																																	section77812.html',0,0);
				  					galleries[60689] = new gallery(60689,'5624959,782570','School Proms and Black Tie','section88364',[782570,5624959],0, 0, '', '																																																																																																																																	section88364.html',0,0);
				  					galleries[71424] = new gallery(71424,'943409','See More Photographs','section83033',[736122,782549,943409,943410,3568226,3602267,3604683,3604684,3669284,3874292,3874296,3874298,782560,1989582,782573],0, 0, '', '																																																																																																							section83033_71424.html',0,0);
				  					galleries[56691] = new gallery(56691,'7100367,7075076,7039734,7025717,7011196,7005581,7005459,7000706,6973942,6969727','The Wedding Day ','section82948',[4418590,4435743,5294079,5396039,6969727,6973942,7000706,7005459,7005581,7011196,7025717,7039734,7075076,7100367],0, 0, '', '																																																																																																																																	section82948.html',0,0);
				  					galleries[56811] = new gallery(56811,'736220','Wedding Gallery 2','section83069',[734432,735908,735910,735919,735923,736141,736215,736220,782523,782564,1989103,782559,3401649,3458499,3401663,722774,738199,752603,752562,782577,6519796,4255701,735926,3401647,3401648],0, 0, '', '																																																																																																																																	section83069.html',0,0);
				  					galleries[11633] = new gallery(11633,'738193','Wedding Gallery 1','gallery',[4183392,4740393,5112496,724866,738193,738701,722777,723029,3458497,3458495,752599,738196,3458483,722770,734430,4690396,722778,722779,686766,4222881],0, 0, '', '																																																																																																																																	gallery.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '1198666';
imageSets[2] = '943409,738193,736220';
imageSets[3] = '7100367,7075076,7039734,7025717,7011196,7005581,7005459,7000706,6973942,6969727,6519796,5624959,5396039,5294079,5112496,4740393,4690396,4435743,4418590,4255701,4222881,4183392,3874298,3874296,3874292,3669284,3604684,3604683,3602267,3568226,3458499,3458497,3458495,3458483,3401663,3401649,3401648,3401647,1989582,1989103,1988219,1988218,1988215,1198666,943553,943471,943410,943409,943408,782577';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/aled/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/aled/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/aled/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/aled/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://www.clikchurch.com/aled/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/aled/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/aled/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/aled/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/aled/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/aled/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/aled/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/aled/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/aled/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/aled/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/aled/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/aled/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/aled/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/aled/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/aled/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/aled/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/aled/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 = 'Aled Oldfield 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> 							' + (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;
	}
}

		

