window.thumbnails = new Object();
												thumbnails[3442063] = new thumbnail(3442063,'210561','Raindrops','Raindrops1_thumb.jpg',130, 194,15,'																			photo_3442063.html');
												thumbnails[3442074] = new thumbnail(3442074,'210561','Concrete Pipes','Concrete pipes_thumb.jpg',130, 87,15,'																			photo_3442074.html');
												thumbnails[3442075] = new thumbnail(3442075,'214848','Kitchen Nightmare','Dark & Light_thumb.jpg',130, 184,15,'																			photo_3442075.html');
												thumbnails[3442078] = new thumbnail(3442078,'210561','Yellow Gerbera','Yellow Gerbera_thumb.jpg',130, 87,15,'																			photo_3442078.html');
												thumbnails[3442084] = new thumbnail(3442084,'210561','Juxtoposed','Juxtoposed_thumb.jpg',130, 86,15,'																			photo_3442084.html');
												thumbnails[3442097] = new thumbnail(3442097,'210561','Winter logs','Winter logs_thumb.jpg',130, 87,15,'																			photo_3442097.html');
												thumbnails[3442099] = new thumbnail(3442099,'210561','Ostentatious 1','Ostentatious 1_thumb.jpg',130, 196,15,'																			photo_3442099.html');
												thumbnails[3442102] = new thumbnail(3442102,'210561','Ostentatious 2','Ostentatious 2_thumb.jpg',130, 196,15,'																			photo_3442102.html');
												thumbnails[3442103] = new thumbnail(3442103,'210561','Rusty water','Rusty water_thumb.jpg',130, 99,15,'																			photo_3442103.html');
												thumbnails[3442109] = new thumbnail(3442109,'210561','Screw You','Screw You_thumb.jpg',130, 130,15,'																			photo_3442109.html');
												thumbnails[3442115] = new thumbnail(3442115,'210561','Spoilt','Spoilt_thumb.jpg',130, 130,15,'																			photo_3442115.html');
												thumbnails[3446013] = new thumbnail(3446013,'214848','Cyborg (Self Portrait)','Cyborg_thumb.jpg',130, 177,15,'																			photo_3446013.html');
												thumbnails[3446026] = new thumbnail(3446026,'210828','Alderly Edge','Alderly Edge_thumb.jpg',130, 194,15,'																			photo_3446026.html');
												thumbnails[3446027] = new thumbnail(3446027,'210828','Keswick','Keswick_thumb.jpg',130, 194,15,'																			photo_3446027.html');
												thumbnails[3446042] = new thumbnail(3446042,'210561','Graff','Graff_thumb.jpg',130, 194,15,'																			photo_3446042.html');
												thumbnails[3446054] = new thumbnail(3446054,'211865','Imperial War Museum','Imperial War Museum_thumb.jpg',130, 204,15,'																			photo_3446054.html');
												thumbnails[3446108] = new thumbnail(3446108,'210828','Stock Gyhll Force','Stock Ghyll force_thumb.jpg',130, 208,15,'																			photo_3446108.html');
												thumbnails[3446111] = new thumbnail(3446111,'210828','Whitby Pier','Whitby Pier_thumb.jpg',130, 194,15,'																			photo_3446111.html');
												thumbnails[3446115] = new thumbnail(3446115,'210561','The Seed','The Seed_thumb..jpg',130, 196,15,'																			photo_3446115.html');
												thumbnails[3446151] = new thumbnail(3446151,'210561','Bloody Baby','Bloody Baby_thumb.jpg',130, 194,15,'																			photo_3446151.html');
												thumbnails[3446178] = new thumbnail(3446178,'210839','Baby Barbary macaque','Baby Barbary macaque_thumb..jpg',130, 195,15,'																			photo_3446178.html');
												thumbnails[3446185] = new thumbnail(3446185,'210839','Hare','Hare_thumb.jpg',130, 182,15,'																			photo_3446185.html');
												thumbnails[3446191] = new thumbnail(3446191,'210839','Lioness<br>\r\n','Lioness_thumb.jpg',130, 194,15,'																			photo_3446191.html');
												thumbnails[3446265] = new thumbnail(3446265,'210852','Christina','Christina_thumb.jpg',130, 194,15,'																			photo_3446265.html');
												thumbnails[3446276] = new thumbnail(3446276,'210852','Jamie.','Jamie_thumb.jpg',130, 195,15,'																			photo_3446276.html');
												thumbnails[3446284] = new thumbnail(3446284,'210852','Joe','Joe_thumb.jpg',130, 90,15,'																			photo_3446284.html');
												thumbnails[3446328] = new thumbnail(3446328,'210852','Maria.','Maria_thumb.jpg',130, 194,15,'																			photo_3446328.html');
												thumbnails[3455169] = new thumbnail(3455169,'210828','Solomans Temple','Solomans Temple_thumb.jpg',130, 199,15,'																			photo_3455169.html');
												thumbnails[3455301] = new thumbnail(3455301,'210852','Photographer','Photographer_thumb.jpg',130, 87,15,'																			photo_3455301.html');
												thumbnails[3456786] = new thumbnail(3456786,'210839','Ostrich','Ostrich_thumb.jpg',130, 86,15,'																			photo_3456786.html');
												thumbnails[3456803] = new thumbnail(3456803,'210839','Sandhill Crane','Sandhill Crane_thumb.jpg',130, 86,15,'																			photo_3456803.html');
												thumbnails[3456921] = new thumbnail(3456921,'211865','Millenium Bridge','Millenium Bridge_thumb.jpg',130, 196,15,'																			photo_3456921.html');
												thumbnails[3456959] = new thumbnail(3456959,'211865','The Lowry centre','The Lowry centre_thumb.jpg',130, 196,15,'																			photo_3456959.html');
												thumbnails[3462916] = new thumbnail(3462916,'210561','Glow Stick pattern.','Glow Stick pattern_thumb..jpg',130, 196,15,'																			photo_3462916.html');
												thumbnails[3462920] = new thumbnail(3462920,'211651','Hen Cloud','Hen Cloud_thumb..jpg',130, 87,15,'																			photo_3462920.html');
												thumbnails[3462933] = new thumbnail(3462933,'211651','Spectators','Spectators_thumb.jpg',130, 87,15,'																			photo_3462933.html');
												thumbnails[3462935] = new thumbnail(3462935,'210828','The Mermaid Inn','The Mermaid Inn_thumb.jpg',130, 86,15,'																			photo_3462935.html');
												thumbnails[3462943] = new thumbnail(3462943,'210561','Cord spiral','Cord spiral_thumb..jpg',130, 87,15,'																			photo_3462943.html');
												thumbnails[3462944] = new thumbnail(3462944,'210852','Christina','Christina 2_thumb.jpg',130, 194,15,'																			photo_3462944.html');
												thumbnails[3464846] = new thumbnail(3464846,'211651','The Mermaid Inn','The Mermaid 2_thumb.jpg',130, 196,15,'																			photo_3464846.html');
												thumbnails[3464858] = new thumbnail(3464858,'211651','Cheeese','Cheeeese_thumb.jpg',130, 86,15,'																			photo_3464858.html');
												thumbnails[3464877] = new thumbnail(3464877,'211651','Tired','Tired_thumb.jpg',130, 87,15,'																			photo_3464877.html');
												thumbnails[3512479] = new thumbnail(3512479,'211651','HenCloud','Hencloud_thumb.jpg',130, 196,15,'																			photo_3512479.html');
												thumbnails[3512516] = new thumbnail(3512516,'210852','Lookout','Lookout _thumb.jpg',130, 86,15,'																			photo_3512516.html');
												thumbnails[3512713] = new thumbnail(3512713,'214848','Big Yella','Digger_thumb.jpg',130, 196,15,'																			photo_3512713.html');
												thumbnails[3512728] = new thumbnail(3512728,'214848','Broken heart','Loveheart_thumb.jpg',130, 196,15,'																			photo_3512728.html');
												thumbnails[3643476] = new thumbnail(3643476,'226526','The Running Man.','Dave_2_thumb.jpg',130, 196,15,'																			photo_3643476.html');
												thumbnails[3643477] = new thumbnail(3643477,'226526','Hard Work.','Dave_12_thumb.jpg',130, 196,15,'																			photo_3643477.html');
												thumbnails[3708016] = new thumbnail(3708016,'230547','Blackpool Marathon 2009','M1_thumb.jpg',130, 196,15,'																			photo_3708016.html');
												thumbnails[3708029] = new thumbnail(3708029,'230547','Blackpool Marathon 2009','M2_thumb.jpg',130, 196,15,'																			photo_3708029.html');
												thumbnails[3708033] = new thumbnail(3708033,'230547','Blackpool Marathon 2009','M3_thumb.jpg',130, 196,15,'																			photo_3708033.html');
												thumbnails[3708039] = new thumbnail(3708039,'230547','Proud as Punch','M4_thumb.jpg',130, 196,15,'																			photo_3708039.html');
												thumbnails[3781591] = new thumbnail(3781591,'210852','Laurie & Kieran','Laurie__Kieran_thumb.jpg',130, 196,15,'																			photo_3781591.html');
												thumbnails[3781611] = new thumbnail(3781611,'210852','Kieran','Kieren_thumb.jpg',130, 196,15,'																			photo_3781611.html');
												thumbnails[3781633] = new thumbnail(3781633,'210852','Laurie','Laurie_thumb.jpg',130, 86,15,'																			photo_3781633.html');
												thumbnails[3864224] = new thumbnail(3864224,'226526','4 Weeks to go....','Lee__Donna_Apr_09_000_thumb.jpg',130, 196,15,'																			photo_3864224.html');
												thumbnails[3864228] = new thumbnail(3864228,'226526','Bump','Lee__Donna_Apr_09_236_thumb.jpg',130, 86,15,'																			photo_3864228.html');
												thumbnails[4077876] = new thumbnail(4077876,'226526','KG ','KG_thumb.jpg',130, 196,15,'																			photo_4077876.html');
												thumbnails[4077898] = new thumbnail(4077898,'226526','Laurie','Laurie_Close_thumb.jpg',130, 196,15,'																			photo_4077898.html');
												thumbnails[4077905] = new thumbnail(4077905,'226526','KG Rollin','KG_Car_thumb.jpg',130, 86,15,'																			photo_4077905.html');
												thumbnails[4077913] = new thumbnail(4077913,'226526','Laurie on swing','Laurie_Swing_thumb.jpg',130, 196,15,'																			photo_4077913.html');
												thumbnails[4754598] = new thumbnail(4754598,'230547','FMX at Heaton.','Heaton_House_Aug_09_0471_thumb.jpg',130, 196,15,'																			photo_4754598.html');
												thumbnails[4754606] = new thumbnail(4754606,'230547','FMX at Heaton.','Heaton_House_Aug_09_043_thumb.jpg',130, 86,15,'																			photo_4754606.html');
												thumbnails[4754609] = new thumbnail(4754609,'230547','FMX at Heaton.','Heaton_House_Aug_09_049_thumb.jpg',130, 86,15,'																			photo_4754609.html');
												thumbnails[4754613] = new thumbnail(4754613,'230547','FMX at Heaton.','Heaton_House_Aug_09_042_thumb.jpg',130, 196,15,'																			photo_4754613.html');
												thumbnails[4754641] = new thumbnail(4754641,'230547','FMX at Heaton.','Heaton_House_Aug_09_051_thumb.jpg',130, 86,15,'																			photo_4754641.html');
												thumbnails[5501746] = new thumbnail(5501746,'214821','Hanging Around 1.','Hang_3_thumb.jpg',130, 196,15,'																			photo_5501746.html');
												thumbnails[5501748] = new thumbnail(5501748,'214821','Hanging around 2.','Hang_11_thumb.jpg',130, 194,15,'																			photo_5501748.html');
												thumbnails[5501750] = new thumbnail(5501750,'214821','Hanging around 3.','Hang_4_thumb.jpg',130, 196,15,'																			photo_5501750.html');
												thumbnails[5501752] = new thumbnail(5501752,'214821','Hanging around 4.','Hang_2_thumb.jpg',130, 196,15,'																			photo_5501752.html');
												thumbnails[5501754] = new thumbnail(5501754,'214821','Hanging around 5.','Hang_5_thumb.jpg',130, 196,15,'																			photo_5501754.html');
												thumbnails[5501773] = new thumbnail(5501773,'210839','Lemur.','Lemur_thumb.jpg',130, 196,15,'																			photo_5501773.html');
												thumbnails[5501777] = new thumbnail(5501777,'210839','Gorilla.','Gorilla_thumb.jpg',130, 196,15,'																			photo_5501777.html');
												thumbnails[5501784] = new thumbnail(5501784,'230547','Xmas Cracker 25th Anniversary.','Xmas_Cracker_09_002_thumb.jpg',130, 86,15,'																			photo_5501784.html');
												thumbnails[5501785] = new thumbnail(5501785,'230547','Xmas Cracker 09.','Xmas_Cracker_09_008_thumb.JPG',130, 86,15,'																			photo_5501785.html');
												thumbnails[5501787] = new thumbnail(5501787,'230547','Weary but Happy.','Xmas_Cracker_09_132_thumb.JPG',130, 86,15,'																			photo_5501787.html');
												thumbnails[5501788] = new thumbnail(5501788,'230547','You must be MAD!!!','Xmas_Cracker_09_134_thumb.jpg',130, 86,15,'																			photo_5501788.html');
												thumbnails[5501790] = new thumbnail(5501790,'230547','Errrrm Right!!!','Xmas_Cracker_09_136_thumb.jpg',130, 86,15,'																			photo_5501790.html');
												thumbnails[5501796] = new thumbnail(5501796,'230547','The Sweepers.','Xmas_Cracker_09_162_thumb.jpg',130, 196,15,'																			photo_5501796.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[211865] = new gallery(211865,'3456921','Architecture','gallery',[3446054,3456921,3456959],0, 0, '', '																																																																																																							gallery_211865.html',0,0);
				  					galleries[211651] = new gallery(211651,'3512479','B & W','gallery',[3462920,3462933,3464846,3464858,3464877,3512479],0, 0, '', '																																																																																																							gallery_211651.html',0,0);
				  					galleries[226526] = new gallery(226526,'4077876,3864224,3643477','Commisions & Work','gallery',[3643476,3643477,3864224,3864228,4077876,4077898,4077905,4077913],0, 0, '', '																																																																																																							gallery_226526.html',0,0);
				  					galleries[214848] = new gallery(214848,'3446013','Digital Art','gallery',[3442075,3446013,3512713,3512728],0, 0, '', '																																																																																																							gallery_214848.html',0,0);
				  					galleries[210828] = new gallery(210828,'3446108','Landscape','gallery',[3446026,3446027,3446108,3446111,3455169,3462935],0, 0, '', '																																																																																																							gallery_210828.html',0,0);
				  					galleries[210852] = new gallery(210852,'3462944','Lifestyle & Portraits','gallery',[3446265,3446276,3446284,3446328,3455301,3462944,3512516,3781591,3781611,3781633],0, 0, '', '																																																																																																							gallery_210852.html',0,0);
				  					galleries[210561] = new gallery(210561,'3442099','Macro & Abstract','gallery',[3442063,3442074,3442078,3442084,3442097,3442099,3442102,3442103,3442109,3442115,3446042,3446115,3446151,3462916,3462943],0, 0, '', '																																																																																																							gallery_210561.html',0,0);
				  					galleries[210839] = new gallery(210839,'3446191','Nature & Wildlife','gallery',[3446178,3446185,3446191,3456786,3456803,5501773,5501777],0, 0, '', '																																																																																																							gallery_210839.html',0,0);
				  					galleries[214821] = new gallery(214821,'5501754,5501752,5501750,5501748,5501746','New','gallery',[5501746,5501748,5501750,5501752,5501754],0, 0, '', '																																																																																																							gallery_214821.html',0,0);
				  					galleries[230547] = new gallery(230547,'4754598,3708039','Sports & Events','gallery',[3708016,3708029,3708033,3708039,4754598,4754606,4754609,4754613,4754641,5501784,5501785,5501787,5501788,5501790,5501796],0, 0, '', '																																																																																																							gallery_230547.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '4754598,3864224,3781591,3512479,3462944,3446185,3446054,3446042,3442063';
imageSets[2] = '4754598,4077876,3864224,3708039,3643477,3512479,3462944,3456921,3446191,3446108,3446013,3442099';
imageSets[3] = '5501796,5501790,5501788,5501787,5501785,5501784,5501777,5501773,5501754,5501752,5501750,5501748,5501746,4754641,4754613,4754609,4754606,4754598,4077913,4077905,4077898,4077876,3864228,3864224,3781633,3781611,3781591,3708039,3708033,3708029,3708016,3643477,3643476,3512728,3512713,3512516,3512479,3464877,3464858,3464846,3462944,3462943,3462935,3462933,3462920,3462916,3456959,3456921,3456803,3456786';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/mello/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/mello/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/mello/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/mello/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/mello/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/mello/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/mello/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/mello/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/mello/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/mello/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/mello/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/mello/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/mello/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/mello/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/mello/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/mello/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/mello/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/mello/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/mello/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/mello/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/mello/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/mello/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 = 'Mellophotos: ' + photoCaption;
			    }
        if (op.$detail.length > 0) {
      temp = op.nextPhoto.fnGetImageDetails();
	    op.$detail.fadeGalleryDetails(temp, op.speed, function(){
	    var options = {};	    	      	      resizePhotoInfo(options);
        if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
  	      toggleAddToCartConfirm(backgrounds);
  	    } else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
  	      toggleAddToCartConfirm(photos);
  	    }
	    });
    }
        if (!op.speed) {      clik.doColumnResize(false, op.$photo.add(op.$detail).add(op.$title));    }        
    return html;			}
	else {
				
		window.location = 'photo_' + nextPhoto.id + '.html';
	}
		
}

/***************************************************************************
* Toggle add to cart confirmation element and set up the click event for   *
* the 'Add to cart' button.                                                *
***************************************************************************/
function toggleAddToCartConfirm(array){
  if (typeof(array) !== 'object') {
    array = photos;
  }
	if($('#paymentConfirm').length > 0){
		$('#paymentConfirm').hide();
		$('#paymentAddButton')
		.unbind()
		.click(function(){
						form = document.getElementById('paymentForm');
			option_id = 0;
			if(form.item_option.value){
				option_id = form.item_option.value;
			}
			if(addItemToBasket(form.item_number.value,array,form.site.value,parseInt(form.quantity.value, 10),option_id)){
				if($.browser.msie){$('#paymentConfirm').text('Item added to cart').show();}
				else{
					$('#paymentConfirm').text('Item added to cart').fadeIn();
					dspOrderDetails(form.site.value);
				}
			}
			else{
				$('#paymentConfirm').text('Item not added - check cookies are enabled in your browser.').fadeIn();
			}
		});
	}
}
/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
photo.prototype.fnGetImageDetails = function(){
	var temp = '';
	if (this.description != '') {
		temp = temp +  '<p id="imageDescription">' + this.description + '</p>';
	}
		if (this.photo_ref != '') {
		temp = temp + '<p class="imageinfo" id="imageRef"><strong>Ref: </strong>' + this.photo_ref + '</p>';
	}
		if (this.takendate != '') {
				
		temp = temp + '<p class="imageinfo" id="imageDate"><strong>Date: </strong>' + this.takendate + '</p>';
	}
	
	if (this.location != '') {
				
		temp = temp + '<p class="imageinfo" id="imageLocation"><strong>Location: </strong>' +  this.location + '</p>';
	}
	
	if (this.photographer != '') {
				
		temp = temp + '<p class="imageinfo" id="imagePhotographer"><strong>Photographer: </strong>' + this.photographer + '</p>';
	}
					
				if (temp != '') {
		temp = temp + '<div class="spacer"></div>';
	}
	return temp;
};

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
photo.prototype.fnGetPaymentInfo = function(){
	var temp = '';
	if (this.item_price !== '') {
				temp = temp + '<p>Order this print:</p>';
				temp = temp + '<p class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> 				&pound;' + (this.item_price).toFixed(2) + '</p>';
		var item_name  = this.purchase_instruction;
		var amount = (this.item_price).toFixed(2);
		var item_option  = 0;
	}
	else if (this.payment_groups_id !== '') {
		temp = temp + '<p>Buy this print online:</p>';
				temp = temp + '<form id="paymentOptions" style="margin:0px;border:0px;" name="paymentOptions">';
											temp = temp + '<select class="paymentlink" name="payment_options_id" onchange="updateItemValues(document.forms.paymentForm,this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value);">';
				
		temp = temp + getPaymentOptions(this.payment_groups_id);
		temp = temp + '</select>';
		temp = temp + '</form>';
				var item_option  = paymentGroups[this.payment_groups_id].options[0];
		if(paymentOptions[item_option]){
			var item_name  = paymentOptions[item_option].payment_option;
			var amount =  paymentOptions[item_option].price;
		}
			}
	else {
				
	}
	if (this.item_price !== '' || this.payment_groups_id !== '') {
																				temp = temp + '<form id="paymentForm" style="margin:0px;border:0px;" name="paymentForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
	temp = temp + '<input type="hidden" name="item_name" value="'+item_name+'">';
								ref = '';
				if(this.photo_ref != ''){
					ref = this.photo_ref+' - '+this.caption;
				}
				else{
					ref = this.id+' - '+this.caption;
				}
				price = amount;					temp = temp + '<input type="hidden" name="cmd" value="_cart">';
	temp = temp + '<input type="hidden" name="business" value="">';
	temp = temp + '<input type="hidden" name="currency_code" value="GBP">';
	temp = temp + '<input type="hidden" name="add" value="1">';
					temp = temp + '<input type="hidden" name="amount" value="'+amount+'">';
	temp = temp + '<input type="hidden" name="item_number" value="'+ref+'">';
					temp = temp + '<input type=\"Submit\" value=\"Add to cart\" id=\"paymentAddButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
									temp = temp + '</form>';
								temp = temp + '<form id="paymentCartForm" style="margin:0px;" name="paymentCartForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
	temp = temp + '<input type="hidden" name="cmd" value="_cart">';
	temp = temp + '<input type="hidden" name="business" value="">';
	temp = temp + '<input type="hidden" name="display" value="1">';
	temp = temp + '<input type=\"Submit\" value=\"View cart\" id=\"paymentViewButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
	temp = temp + '</form>';
							temp = temp + '<div class="clearing">&nbsp;</div>';
	}
	return temp;};

/***************************************************************************
* Pick a photo at random from the featured images of a gallery.            *
* Gallery_id = id of gallery to choose,                                    *
* img = reference to html image in                                         *
* which to show image                                                      *
***************************************************************************/
function showGalleryImage(gallery_id, img, updateLink) {
		
	if(img){
	      if (location.hash.match('galleries_id=' + gallery_id) && (imageID = location.hash.match('.*photos_id=(.+)$'))) {
        imageID = imageID[1];
      } else {
			  imageID = randomListVal(galleries[gallery_id].featured_images);
      }
							
			if (imageID != 0) {
				img.src = thumbnails[imageID].src;
				img.width = thumbnails[imageID].width;
				img.height = thumbnails[imageID].height;
				img.alt = galleries[gallery_id].title;
        if (updateLink) {
          $(img).parent().attr({            href: thumbnails[imageID].fnGalleryLink(gallery_id),            title: galleries[gallery_id].title          });
        }
							}
										}
}

/***************************************************************************
* If we have dynamic HTML, replace the galleries link with a list that     *
* doesn't include thecurrent gallery                                       *
***************************************************************************/
function showGalleries(gallery_id) {
		
	
	if (!basic) {
		temp = '';
		for (i = 0; i < galleries.length; i++) {
						
			
			if (galleries[i].id != gallery_id) {
								
				if (temp != '') {
					temp = temp + ' | ';
				}
				temp = temp + '<a href="' + galleries[i].section_code + '_' + galleries[i].id + '.html">' + galleries[i].title + '</a>';
			}
		}
		document.all.galleryLinks.innerHTML = 'Other galleries: ' + temp;
	}
}

			

