window.thumbnails = new Object();
												thumbnails[596514] = new thumbnail(596514,'45850','','DSC_0157_thumb.jpg',130, 87,18,'photo_596514.html');
												thumbnails[596577] = new thumbnail(596577,'45850','','DSC_0039-01rw_thumb.jpg',130, 86,18,'photo_596577.html');
												thumbnails[596578] = new thumbnail(596578,'45850','','DSC_0112-copy_thumb.jpg',130, 87,18,'photo_596578.html');
												thumbnails[896632] = new thumbnail(896632,'95676','','alii & derick_DSC_0087083DSC_0087-01_thumb.jpg',86, 130,18,'photo_896632.html');
												thumbnails[896634] = new thumbnail(896634,'95676','','alii & derick_DSC_0049047DSC_0049-01_thumb.jpg',86, 130,18,'photo_896634.html');
												thumbnails[896635] = new thumbnail(896635,'45608','','DSC_0019rt001_thumb.jpg',130, 86,18,'photo_896635.html');
												thumbnails[896637] = new thumbnail(896637,'45850','','Newcastle 1_DSC_0132-02_thumb.jpg',130, 87,18,'photo_896637.html');
												thumbnails[997647] = new thumbnail(997647,'45849','','DSC_00180006001_thumb.jpg',130, 86,18,'photo_997647.html');
												thumbnails[997651] = new thumbnail(997651,'45849','','DSC_0014rt_thumb.jpg',96, 130,18,'photo_997651.html');
												thumbnails[997659] = new thumbnail(997659,'45850','','DSC_0057055DSC_0057-01_thumb.jpg',86, 130,18,'photo_997659.html');
												thumbnails[1050769] = new thumbnail(1050769,'45849','','DSC_0011-2t_thumb.jpg',86, 130,18,'photo_1050769.html');
												thumbnails[1050777] = new thumbnail(1050777,'45849','','DSC_0013-2_thumb.jpg',87, 130,18,'photo_1050777.html');
												thumbnails[1050780] = new thumbnail(1050780,'45849','','DSC_0005-copy_thumb.jpg',130, 96,18,'photo_1050780.html');
												thumbnails[1052046] = new thumbnail(1052046,'45608','','mia1-colcurv1_thumb.jpg',130, 87,18,'photo_1052046.html');
												thumbnails[1052049] = new thumbnail(1052049,'45850','','Resize-Wizard-1crop5-copy_thumb.jpg',87, 130,18,'photo_1052049.html');
												thumbnails[1052054] = new thumbnail(1052054,'45608','','61_thumb.jpg',104, 130,18,'photo_1052054.html');
												thumbnails[1052056] = new thumbnail(1052056,'45850','','12-copy_thumb.jpg',130, 93,18,'photo_1052056.html');
												thumbnails[1052058] = new thumbnail(1052058,'78166','','DSC_0071-01_thumb.jpg',87, 130,18,'photo_1052058.html');
												thumbnails[1052828] = new thumbnail(1052828,'45849','','DSC_0044-copysf_thumb.jpg',130, 65,18,'photo_1052828.html');
												thumbnails[1079073] = new thumbnail(1079073,'45849','','DSC_0026_thumb.jpg',86, 130,18,'photo_1079073.html');
												thumbnails[1120692] = new thumbnail(1120692,'81945','','hinton 1 (58)_thumb.jpg',130, 91,18,'photo_1120692.html');
												thumbnails[1120696] = new thumbnail(1120696,'81945','','hinton 1 (60)_thumb.jpg',91, 130,18,'photo_1120696.html');
												thumbnails[1135409] = new thumbnail(1135409,'81945','','001-19_thumb.jpg',130, 93,18,'photo_1135409.html');
												thumbnails[1135411] = new thumbnail(1135411,'45608','','preview-book-25rw1_thumb.jpg',130, 87,18,'photo_1135411.html');
												thumbnails[1196012] = new thumbnail(1196012,'45608','','studipo-and-fill-in-111_thumb.jpg',87, 130,18,'photo_1196012.html');
												thumbnails[1220717] = new thumbnail(1220717,'45608','','Chrissy_-18bw-copy_thumb.jpg',110, 130,18,'photo_1220717.html');
												thumbnails[1288984] = new thumbnail(1288984,'45608','','Chrissy_-241_thumb.jpg',96, 130,18,'photo_1288984.html');
												thumbnails[1288986] = new thumbnail(1288986,'81945','','hinton-1-(73)_thumb.jpg',130, 91,18,'photo_1288986.html');
												thumbnails[1288987] = new thumbnail(1288987,'78166','','Gatcombe-2007-111_thumb.jpg',96, 130,18,'photo_1288987.html');
												thumbnails[1288988] = new thumbnail(1288988,'45612','','puppies-39rw_thumb.jpg',110, 130,18,'photo_1288988.html');
												thumbnails[1288989] = new thumbnail(1288989,'78166','','Gatcombe-2007-62_thumb.jpg',96, 130,18,'photo_1288989.html');
												thumbnails[1288990] = new thumbnail(1288990,'78166','','Cowes-2007-360_thumb.jpg',86, 130,18,'photo_1288990.html');
												thumbnails[1288991] = new thumbnail(1288991,'45612','','Sparkie-8ntail_thumb.jpg',96, 130,18,'photo_1288991.html');
												thumbnails[1350904] = new thumbnail(1350904,'45608','','wedding-jpgs-181_thumb.jpg',98, 130,18,'photo_1350904.html');
												thumbnails[1450438] = new thumbnail(1450438,'78166','','bishops-lydeard-283_thumb.jpg',96, 130,18,'photo_1450438.html');
												thumbnails[1508837] = new thumbnail(1508837,'78166','','copenhagen3_cp3_thumb.jpg',88, 130,18,'photo_1508837.html');
												thumbnails[1508838] = new thumbnail(1508838,'78166','','DSC_00131_thumb.jpg',87, 130,18,'photo_1508838.html');
												thumbnails[1508973] = new thumbnail(1508973,'45849','','studipo-and-fill-in-26-copy_thumb.jpg',96, 130,18,'photo_1508973.html');
												thumbnails[2099849] = new thumbnail(2099849,'45612','','2008_0212pigs00076x4rw_thumb.jpg',130, 87,18,'photo_2099849.html');
												thumbnails[2099851] = new thumbnail(2099851,'45612','','pets-34-1_thumb.jpg',87, 130,18,'photo_2099851.html');
												thumbnails[2099898] = new thumbnail(2099898,'45612','','mia-86-1rw_thumb.jpg',104, 130,18,'photo_2099898.html');
												thumbnails[2099901] = new thumbnail(2099901,'45608','','2008_0125mia20054vp_thumb.jpg',130, 87,18,'photo_2099901.html');
												thumbnails[2099903] = new thumbnail(2099903,'45612','','DSC_0136art_thumb.jpg',104, 130,18,'photo_2099903.html');
												thumbnails[2239711] = new thumbnail(2239711,'45608','','16-x-20-mia-dress-1-26-1-2_thumb.jpg',104, 130,18,'photo_2239711.html');
												thumbnails[2239713] = new thumbnail(2239713,'45608','','lox-16x20-dtonemisha_thumb.jpg',104, 130,18,'photo_2239713.html');
												thumbnails[2266938] = new thumbnail(2266938,'45608','','2008_060108juneflowers0074-1_thumb.jpg',130, 87,18,'photo_2266938.html');
												thumbnails[2292779] = new thumbnail(2292779,'45849','','2008_060108juneflowers0040-1-2_thumb.jpg',87, 130,18,'photo_2292779.html');
												thumbnails[2292782] = new thumbnail(2292782,'45849','','2008_0602macrojune0013-1_thumb.jpg',130, 87,18,'photo_2292782.html');
												thumbnails[3576855] = new thumbnail(3576855,'45608','','2009_0220mishafeb090079rw_thumb.jpg',87, 130,18,'photo_3576855.html');
												thumbnails[3577055] = new thumbnail(3577055,'95676','','2008_06204JOwedding0122-1-copy_thumb.jpg',130, 130,18,'photo_3577055.html');
												thumbnails[3577056] = new thumbnail(3577056,'45608','','2009_0220mishafeb090131rw1_thumb.jpg',100, 130,18,'photo_3577056.html');
												thumbnails[3577058] = new thumbnail(3577058,'45608','','2008_060808junejasmine0041_thumb.jpg',93, 130,18,'photo_3577058.html');
												thumbnails[3577059] = new thumbnail(3577059,'95676','','File_042_thumb.jpg',87, 130,18,'photo_3577059.html');
												thumbnails[3577060] = new thumbnail(3577060,'45608','','2009_02133feb090053_thumb.jpg',104, 130,18,'photo_3577060.html');
												thumbnails[3577062] = new thumbnail(3577062,'45608','','2008_060808junejasmine0065_thumb.jpg',100, 130,18,'photo_3577062.html');
												thumbnails[3577063] = new thumbnail(3577063,'45849','','cst-0109-1_thumb.jpg',130, 130,18,'photo_3577063.html');
												thumbnails[3577085] = new thumbnail(3577085,'45612','','2008_1010oct30014_thumb.jpg',110, 130,18,'photo_3577085.html');
												thumbnails[3577116] = new thumbnail(3577116,'45850','','2009_0109langportfrost10092bw_thumb.jpg',87, 130,18,'photo_3577116.html');
												thumbnails[3577143] = new thumbnail(3577143,'45608','','2009_0220mishafeb090147bw-copy_thumb.jpg',87, 130,18,'photo_3577143.html');
												thumbnails[4454409] = new thumbnail(4454409,'45612','','2009_0711barrydogsjuly0900312009_0711barrydogsjuly090031_thumb.jpg',87, 130,18,'photo_4454409.html');
												thumbnails[4454415] = new thumbnail(4454415,'45612','','2009_0711barrydogsjuly0900162009_0711barrydogsjuly090016_thumb.jpg',130, 130,18,'photo_4454415.html');
												thumbnails[4609630] = new thumbnail(4609630,'81945','','Maddy_108x12col_thumb.jpg',87, 130,18,'photo_4609630.html');
												thumbnails[4609642] = new thumbnail(4609642,'81945','','AnnabelEmily-518x12_thumb.jpg',130, 87,18,'photo_4609642.html');
												thumbnails[4609645] = new thumbnail(4609645,'81945','','boy-318x12col_thumb.jpg',87, 130,18,'photo_4609645.html');
												thumbnails[4610524] = new thumbnail(4610524,'45608','','2009_0515maymia20022_thumb.jpg',87, 130,18,'photo_4610524.html');
												thumbnails[4610597] = new thumbnail(4610597,'81945','','AnnabelEmily-1_thumb.jpg',87, 130,18,'photo_4610597.html');
												thumbnails[4610611] = new thumbnail(4610611,'95676','','sep-and-on-oneOwedding0032-1_thumb.jpg',130, 98,18,'photo_4610611.html');
												thumbnails[4650443] = new thumbnail(4650443,'45608','','2009_0524apikeww10117_thumb.jpg',130, 87,18,'photo_4650443.html');
												thumbnails[5414034] = new thumbnail(5414034,'45849','','2010_0115isotesthigh0001-copy_thumb.jpg',87, 130,18,'photo_5414034.html');
												thumbnails[5414038] = new thumbnail(5414038,'45612','','2010_0115isotesthigh0022_thumb.jpg',87, 130,18,'photo_5414038.html');
												thumbnails[5414040] = new thumbnail(5414040,'45612','','2010_0115isotesthigh0045-copy_thumb.jpg',87, 130,18,'photo_5414040.html');
												thumbnails[5414199] = new thumbnail(5414199,'45849','','2010_0115isotesthigh00151_thumb.jpg',130, 130,18,'photo_5414199.html');
												thumbnails[5414200] = new thumbnail(5414200,'45849','','2010_0115isotesthigh00201_thumb.jpg',130, 130,18,'photo_5414200.html');
												thumbnails[5414286] = new thumbnail(5414286,'45850','','12-x-8-0138_thumb.jpg',87, 130,18,'photo_5414286.html');
												thumbnails[5414305] = new thumbnail(5414305,'45612','','12-x-10-snow00331_thumb.jpg',130, 108,18,'photo_5414305.html');
												thumbnails[5414308] = new thumbnail(5414308,'45612','','12-x-10-00091_thumb.jpg',108, 130,18,'photo_5414308.html');
												thumbnails[5414339] = new thumbnail(5414339,'45850','','12-x-8-snow00262_thumb.jpg',130, 87,18,'photo_5414339.html');
												thumbnails[5414343] = new thumbnail(5414343,'45612','','2009_1129kitten0037_thumb.jpg',130, 130,18,'photo_5414343.html');
												thumbnails[6027513] = new thumbnail(6027513,'45608','Hurrell Style','websiteHS0056bwrw_thumb.jpg',87, 130,18,'photo_6027513.html');
												thumbnails[6027566] = new thumbnail(6027566,'45608','','web061bw_thumb.jpg',87, 130,18,'photo_6027566.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[78166] = new gallery(78166,'1508838,1508837,1450438,1288990,1288989,1288987,1052058','commercial','gallery',[1052058,1288987,1288989,1288990,1450438,1508837,1508838],0, 0, '', 'gallery_78166.html',0,0);
				  					galleries[45850] = new gallery(45850,'5414339,5414286,3577116,1052056,1052049,997659,896637,596578,596577,596514','Landscape','gallery',[596514,596577,596578,896637,997659,1052049,1052056,3577116,5414286,5414339],0, 0, '', 'gallery_45850.html',0,0);
				  					galleries[45849] = new gallery(45849,'5414200,5414199,5414034,3577063,2292782,2292779,1508973,1079073,1052828,1050780','Natural History','gallery',[997647,997651,1050769,1050777,1050780,1052828,1079073,1508973,2292779,2292782,3577063,5414034,5414199,5414200],0, 0, '', 'gallery_45849.html',0,0);
				  					galleries[45612] = new gallery(45612,'5414343,5414308,5414305,5414040,5414038,4454415,4454409,3577085,2099903,2099898','Pets','gallery',[1288988,1288991,2099849,2099851,2099898,2099903,3577085,4454409,4454415,5414038,5414040,5414305,5414308,5414343],0, 0, '', 'gallery_45612.html',0,0);
				  					galleries[45608] = new gallery(45608,'6027566,6027513,4650443,4610524,3577143,3577062,3577060,3577058,3577056,3576855','Portraits','gallery',[896635,1052046,1052054,1135411,1196012,1220717,1288984,1350904,2099901,2239711,2239713,2266938,3576855,3577056,3577058,3577060,3577062,3577143,4610524,4650443,6027513,6027566],0, 0, '', 'gallery_45608.html',0,0);
				  					galleries[81945] = new gallery(81945,'4610597,4609645,4609642,4609630,1288986,1135409,1120696,1120692','Pre-School Portraits','gallery',[1120692,1120696,1135409,1288986,4609630,4609642,4609645,4610597],0, 0, '', 'gallery_81945.html',0,0);
				  					galleries[95676] = new gallery(95676,'4610611,3577059,3577055,896634,896632','wedding','gallery',[896632,896634,3577055,3577059,4610611],0, 0, '', 'gallery_95676.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '6027566,6027513,5414343,5414339,5414308,5414305,5414286,5414200,5414199,5414040,5414038,5414034,4650443,4610611,4610597,4610524,4609645,4609642,4609630,4454415,4454409,3577143,3577116,3577085,3577063,3577062,3577060,3577059,3577058,3577056,3577055,3576855,2292782,2292779,2266938,2239713,2239711,2099903,2099901,2099898,2099851,2099849,1508973,1508838,1508837,1450438,1350904,1288991,1288990,1288989';
imageSets[3] = '6027566,6027513,5414343,5414339,5414308,5414305,5414286,5414200,5414199,5414040,5414038,5414034,4650443,4610611,4610597,4610524,4609645,4609642,4609630,4454415,4454409,3577143,3577116,3577085,3577063,3577062,3577060,3577059,3577058,3577056,3577055,3576855,2292782,2292779,2266938,2239713,2239711,2099903,2099901,2099898,2099851,2099849,1508973,1508838,1508837,1450438,1350904,1288991,1288990,1288989';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/keithpadden/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/keithpadden/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/keithpadden/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/keithpadden/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/keithpadden/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/keithpadden/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/keithpadden/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/keithpadden/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/keithpadden/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/keithpadden/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/keithpadden/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/keithpadden/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/keithpadden/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/keithpadden/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/keithpadden/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/keithpadden/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/keithpadden/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/keithpadden/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/keithpadden/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/keithpadden/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/keithpadden/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/keithpadden/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 = 'Keith Padden 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));      $('body').trigger('clikUpdate');    }        
    return html;			}
	else {
				
		window.location = 'photo_' + nextPhoto.id + '.html';
	}
		
}

/***************************************************************************
* Toggle add to cart confirmation element and set up the click event for   *
* the 'Add to cart' button.                                                *
***************************************************************************/
function toggleAddToCartConfirm(array){
  if (typeof(array) !== 'object' || array == undefined) {
    array = photos;
  }
	if($('#paymentConfirm').length > 0){
		$('#paymentConfirm').hide();
		$('#paymentAddButton')
		.unbind()
		.click(function(){
						form = document.getElementById('paymentForm');
			option_id = 0;
			if(form.item_option.value){
				option_id = form.item_option.value;
			}
			if(addItemToBasket(form.item_number.value,array,form.site.value,parseInt(form.quantity.value, 10),option_id)){
				if($.browser.msie){$('#paymentConfirm').text('Item added to cart').show();}
				else{
					$('#paymentConfirm').text('Item added to cart').fadeIn();
					dspOrderDetails(form.site.value);
				}
			}
			else{
				$('#paymentConfirm').text('Item not added - check cookies are enabled in your browser.').fadeIn();
			}
		});
	}
}
/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
photo.prototype.fnGetImageDetails = function(){
	var temp = '';
	if (this.description != '') {
		temp = temp +  '<p id="imageDescription">' + this.description + '</p>';
	}
		if (this.photo_ref != '') {
		temp = temp + '<p class="imageinfo" id="imageRef"><strong>Ref: </strong>' + this.photo_ref + '</p>';
	}
		if (this.takendate != '') {
				
		temp = temp + '<p class="imageinfo" id="imageDate"><strong>Date: </strong>' + this.takendate + '</p>';
	}
	
	if (this.location != '') {
				
		temp = temp + '<p class="imageinfo" id="imageLocation"><strong>Location: </strong>' +  this.location + '</p>';
	}
	
	if (this.photographer != '') {
				
		temp = temp + '<p class="imageinfo" id="imagePhotographer"><strong>Keith Padden LRPS </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="keith.padden@virgin.net">';
	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="keith.padden@virgin.net">';
	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;
	}
}

		

