window.thumbnails = new Object();
												thumbnails[3571804] = new thumbnail(3571804,'','Oak leaf on Snow','P1020979_thumb.JPG',130, 98,15,'#');
												thumbnails[3572213] = new thumbnail(3572213,'','Dancing ladies','Fuchsia-1_thumb.JPG',130, 173,15,'#');
												thumbnails[3572261] = new thumbnail(3572261,'','White Amaryllis','P1010366-1_thumb.JPG',130, 173,15,'#');
												thumbnails[3572286] = new thumbnail(3572286,'','Nine Maidens, Two Rooks,  One Sunset','P1000812_thumb.JPG',130, 57,15,'#');
												thumbnails[3572364] = new thumbnail(3572364,'','White Amaryllis II','P1050560_thumb.JPG',130, 195,15,'#');
												thumbnails[3572380] = new thumbnail(3572380,'','Sunflower Heart','P1040240_thumb.JPG',130, 173,15,'#');
												thumbnails[3572494] = new thumbnail(3572494,'','Ashbury Church in summer','P1040165_thumb.JPG',130, 98,15,'#');
												thumbnails[3572913] = new thumbnail(3572913,'','Blue Ice','P1010606_thumb.JPG',130, 173,15,'#');
												thumbnails[3572929] = new thumbnail(3572929,'','Winter Frost','P1010593_thumb.JPG',130, 173,15,'#');
												thumbnails[3572978] = new thumbnail(3572978,'','Rush Hour over Ashbury','P1040642_thumb.JPG',130, 173,15,'#');
												thumbnails[3573006] = new thumbnail(3573006,'','Snow stream','P1030108_thumb.JPG',130, 173,15,'#');
												thumbnails[3573020] = new thumbnail(3573020,'','Winter Hogweed','P1030128_thumb.JPG',130, 98,15,'#');
												thumbnails[3573024] = new thumbnail(3573024,'','Mr. Pheasant','P1030193_thumb.JPG',130, 170,15,'#');
												thumbnails[3573030] = new thumbnail(3573030,'','Early Morning Moos','P1010219_thumb.JPG',130, 98,15,'#');
												thumbnails[3573056] = new thumbnail(3573056,'','Late summer sky','P1020608_NEW_thumb.jpg',130, 98,15,'#');
												thumbnails[3573151] = new thumbnail(3573151,'','Eyed hawk moth caterpillar','P1000941_thumb.JPG',130, 173,15,'#');
												thumbnails[3573217] = new thumbnail(3573217,'','White Amaryllis III','P1010402_thumb.JPG',130, 173,15,'#');
												thumbnails[3656548] = new thumbnail(3656548,'','Ashbury Church in the Winter','Ashbury_Church_03-02-2009_10-29-55_thumb.JPG',130, 173,15,'#');
												thumbnails[3685265] = new thumbnail(3685265,'','Ashbury Sunrise I','P1040434_thumb.JPG',130, 98,15,'#');
												thumbnails[3685273] = new thumbnail(3685273,'','Ashbury Sunrise II','P10409072_thumb.JPG',130, 98,15,'#');
												thumbnails[6366857] = new thumbnail(6366857,'','','P1080442-1_thumb.JPG',130, 98,15,'#');
												thumbnails[7318998] = new thumbnail(7318998,'','','Red_Amaryllis_thumb.JPG',130, 77,15,'#');
												thumbnails[7623086] = new thumbnail(7623086,'','','stable1_purple_logo-cropped-resized_30x129_thumb.jpg',130, 30,15,'#');
												thumbnails[7746096] = new thumbnail(7746096,'','','P11006631_thumb.JPG',130, 98,15,'#');
												thumbnails[3572168] = new thumbnail(3572168,'','Footprints in the snow','P1050999-1_thumb.JPG',130, 98,15,'#');
												thumbnails[3572595] = new thumbnail(3572595,'218369','Cow','P1000818_thumb.JPG',130, 91,15,'photo_3572595.html');
												thumbnails[3572793] = new thumbnail(3572793,'218424','Not quite my 15 minutes!','Screenshot_for_mum_thumb.jpg',130, 94,15,'photo_3572793.html');
												thumbnails[3599080] = new thumbnail(3599080,'216179','Birdies  (but I was only 7 years old!)','Birdies_v_III_thumb.jpg',130, 92,15,'photo_3599080.html');
												thumbnails[3599113] = new thumbnail(3599113,'216179','Blue Jug and Lunch','P10504391_thumb.JPG',130, 172,15,'photo_3599113.html');
												thumbnails[3599691] = new thumbnail(3599691,'216179','Bamboo Ducks and Lily','dux_and_lily_21_thumb.jpg',130, 173,15,'photo_3599691.html');
												thumbnails[3654823] = new thumbnail(3654823,'216179','Speckled Pear','P1060020-2_thumb.JPG',130, 173,15,'photo_3654823.html');
												thumbnails[3654887] = new thumbnail(3654887,'218369','Frosty Beech Leaves','P10203651_thumb.JPG',130, 98,15,'photo_3654887.html');
												thumbnails[3654939] = new thumbnail(3654939,'223363','Kansu','Kansuoktif-1_thumb.jpg',130, 90,15,'photo_3654939.html');
												thumbnails[3654942] = new thumbnail(3654942,'218369','Friesian Cow','P1010207_thumb.JPG',130, 93,15,'photo_3654942.html');
												thumbnails[3655411] = new thumbnail(3655411,'223363','Kansu Fei Yen','Cards1_004-1_thumb.jpg',130, 87,15,'photo_3655411.html');
												thumbnails[3685227] = new thumbnail(3685227,'218369','Going, going, gone','Pearsok_thumb.jpg',130, 84,15,'photo_3685227.html');
												thumbnails[3687221] = new thumbnail(3687221,'218369','Purple Anemone','IMG_07081_thumb.JPG',130, 173,15,'photo_3687221.html');
												thumbnails[3846460] = new thumbnail(3846460,'216179','Raybans Required','P1030838-1_thumb.JPG',130, 139,15,'photo_3846460.html');
												thumbnails[6107072] = new thumbnail(6107072,'216179','Winter Apple Tree','P1070113_thumb.JPG',130, 173,15,'photo_6107072.html');
												thumbnails[6301686] = new thumbnail(6301686,'223362','One in Blue','P1070361_thumb.JPG',130, 190,15,'photo_6301686.html');
												thumbnails[6301694] = new thumbnail(6301694,'223363','small wooden duck','P1070625_thumb.JPG',130, 98,15,'photo_6301694.html');
												thumbnails[6301699] = new thumbnail(6301699,'223362','Pipe','P1070630_thumb.JPG',130, 98,15,'photo_6301699.html');
												thumbnails[6301703] = new thumbnail(6301703,'223362','Stars','P1070645_thumb.JPG',130, 133,15,'photo_6301703.html');
												thumbnails[6301705] = new thumbnail(6301705,'223362','.....and Stripes','P1070633_thumb.JPG',130, 117,15,'photo_6301705.html');
												thumbnails[6301728] = new thumbnail(6301728,'216179','Red Jug and Lunch','Plum_Jug_with_two_pears_thumb.jpg',130, 173,15,'photo_6301728.html');
												thumbnails[6301744] = new thumbnail(6301744,'223362','Saunton Sands','P1040881_thumb.JPG',130, 173,15,'photo_6301744.html');
												thumbnails[6301766] = new thumbnail(6301766,'216179','Anemones','P1040896_thumb.JPG',130, 99,15,'photo_6301766.html');
												thumbnails[7362848] = new thumbnail(7362848,'216179','Red Amaryllis','Red_Amaryllis1_thumb.JPG',130, 77,15,'photo_7362848.html');
												thumbnails[7362852] = new thumbnail(7362852,'216179','','P1080442-1_E70729A0-1EC9-D45B-1C92686F753665E5_thumb.JPG',130, 98,15,'photo_7362852.html');
												thumbnails[7362881] = new thumbnail(7362881,'223363','Apples & Flagon','IMG_2393_thumb.JPG',130, 175,15,'photo_7362881.html');
												thumbnails[7362891] = new thumbnail(7362891,'223363','Chicken','The_Angry_Chicken_E716C42B-1EC9-D45B-1CF18DC0CAD0EC62_thumb.jpg',130, 184,15,'photo_7362891.html');
												thumbnails[7362896] = new thumbnail(7362896,'216179','Cherries I  ','Apples-1_thumb.JPG',130, 98,15,'photo_7362896.html');
												thumbnails[7362899] = new thumbnail(7362899,'223363','Charcoal Cow','COLOUR_COW_E71B0D63-1EC9-D45B-1C7F6399188A6DA1_thumb.JPG',130, 92,15,'photo_7362899.html');
												thumbnails[7362906] = new thumbnail(7362906,'223363','Bumbling Along','P1070083_E71D0B55-1EC9-D45B-1C30049C7D65D518_thumb.JPG',130, 98,15,'photo_7362906.html');
												thumbnails[7362910] = new thumbnail(7362910,'223363','Ashbury Sunrise','P1070560_thumb.JPG',130, 92,15,'photo_7362910.html');
												thumbnails[7362913] = new thumbnail(7362913,'223363','Wooden Duck','P1070624_E71F94AF-1EC9-D45B-1C077C011BD70E88_thumb.JPG',130, 98,15,'photo_7362913.html');
												thumbnails[7362915] = new thumbnail(7362915,'223362','Pipe','P1070630_E7208CE9-1EC9-D45B-1C32AB29665CD4E6_thumb.JPG',130, 98,15,'photo_7362915.html');
												thumbnails[7362917] = new thumbnail(7362917,'223362','Stars','P1070656_thumb.JPG',130, 98,15,'photo_7362917.html');
												thumbnails[7362995] = new thumbnail(7362995,'218424','inside of the studio ','P1040881_E73ED5D0-1EC9-D45B-1CFFF98B268116B1_thumb.JPG',130, 173,15,'photo_7362995.html');
												thumbnails[7363000] = new thumbnail(7363000,'223363','Wooden Duck small','P1070625_E73FEF8D-1EC9-D45B-1C9DE8CF0D9E5F61_thumb.JPG',130, 98,15,'photo_7363000.html');
												thumbnails[7363020] = new thumbnail(7363020,'223363','Detail from \"Simon\'s Cows\"','P1080783_thumb.JPG',130, 113,15,'photo_7363020.html');
												thumbnails[7484824] = new thumbnail(7484824,'218424','Coming soon!  Pete\'s wooden bowls.','P1100547_thumb.JPG',130, 124,15,'photo_7484824.html');
												thumbnails[7745983] = new thumbnail(7745983,'398429','\"Out of the Blue\" section','P1100642_thumb.JPG',130, 98,15,'photo_7745983.html');
												thumbnails[7745984] = new thumbnail(7745984,'398429','Lemon glass dish','P1100764_thumb.JPG',130, 73,15,'photo_7745984.html');
												thumbnails[7746010] = new thumbnail(7746010,'398429','','P1100663_thumb.JPG',130, 98,15,'photo_7746010.html');
												thumbnails[7746048] = new thumbnail(7746048,'418833','Tealight holder','P1100695_thumb.JPG',130, 98,15,'photo_7746048.html');
												thumbnails[7746040] = new thumbnail(7746040,'418833','','P1100668_thumb.JPG',130, 96,15,'photo_7746040.html');
												thumbnails[7746041] = new thumbnail(7746041,'418833','','P1100685_thumb.JPG',130, 98,15,'photo_7746041.html');
												thumbnails[7746039] = new thumbnail(7746039,'418833','','P1100666_thumb.JPG',130, 98,15,'photo_7746039.html');
												thumbnails[3654877] = new thumbnail(3654877,'218369','Cherries I','Apples2_thumb.JPG',130, 93,15,'photo_3654877.html');
												thumbnails[7362887] = new thumbnail(7362887,'398429','Art Glass triple mounted/box frame','fused_glass_boxframed_thumb.jpg',130, 130,15,'photo_7362887.html');
												thumbnails[7362894] = new thumbnail(7362894,'398429','Glass Gecko','P1090667_thumb.JPG',130, 109,15,'photo_7362894.html');
												thumbnails[7363352] = new thumbnail(7363352,'398429','','P1090633-1_thumb.JPG',130, 98,15,'photo_7363352.html');
												thumbnails[7363361] = new thumbnail(7363361,'398429','','P1060607_thumb.JPG',130, 98,15,'photo_7363361.html');
												thumbnails[7363356] = new thumbnail(7363356,'398429','','P1090625-1_thumb.JPG',130, 98,15,'photo_7363356.html');
												thumbnails[7363354] = new thumbnail(7363354,'398429','','P1090629-1_thumb.JPG',130, 111,15,'photo_7363354.html');
												thumbnails[7363345] = new thumbnail(7363345,'398429','Blue Star','P1090941_thumb.JPG',130, 98,15,'photo_7363345.html');
												thumbnails[3571758] = new thumbnail(3571758,'216178','Ostrich','ostrich_thumb.jpg',130, 108,15,'photo_3571758.html');
												thumbnails[3572670] = new thumbnail(3572670,'223362','Fistral II','Fistral_II_28-07-2008_09-39-17_thumb.JPG',130, 176,15,'photo_3572670.html');
												thumbnails[7363342] = new thumbnail(7363342,'398429','Clear Blue','P1090581_thumb.JPG',130, 173,15,'photo_7363342.html');
												thumbnails[3571763] = new thumbnail(3571763,'216178','Cow','cow_thumb.jpg',130, 96,15,'photo_3571763.html');
												thumbnails[3572555] = new thumbnail(3572555,'223362','Fistral III','Fistral_III_26-07-2008_09-46-50_thumb.JPG',130, 175,15,'photo_3572555.html');
												thumbnails[3572505] = new thumbnail(3572505,'216178','Duck','picasabackground_thumb.jpg',130, 104,15,'photo_3572505.html');
												thumbnails[3572684] = new thumbnail(3572684,'223362','Saunton II','Saunton_II_27-07-2008_19-31-27_thumb.JPG',130, 174,15,'photo_3572684.html');
												thumbnails[3572665] = new thumbnail(3572665,'223362','Wrecked Tangles','WreckedTangles_24-01-2007_13-35-30_thumb.JPG',130, 90,15,'photo_3572665.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[216179] = new gallery(216179,'7362896,7362852,7362848,6301766,6301728,6107072,3846460,3654823,3599691,3599113','Watercolours','gallery',[3599080,3599113,3599691,3654823,3846460,6107072,6301728,6301766,7362848,7362852,7362896],0, 0, '', 'gallery_216179.html',0,0);
				  					galleries[216178] = new gallery(216178,'3571758','The Farmyard Series','gallery',[3571758,3571763,3572505],0, 0, '', 'gallery_216178.html',0,0);
				  					galleries[223363] = new gallery(223363,'7363020,7363000,7362913,7362910,7362906,7362899,7362891,7362881,6301694,3655411','Pastels','gallery',[3654939,3655411,6301694,7362881,7362891,7362899,7362906,7362910,7362913,7363000,7363020],0, 0, '', 'gallery_223363.html',0,0);
				  					galleries[223362] = new gallery(223362,'6301744','Acrylics','gallery',[6301686,6301699,6301703,6301705,6301744,7362915,7362917,3572670,3572555,3572684,3572665],0, 0, '', 'gallery_223362.html',0,0);
				  					galleries[398429] = new gallery(398429,'7746010,7745984,7745983,7363361,7363356,7363354,7363352,7363345,7363342,7362894','Fused Glass','gallery',[7745983,7745984,7746010,7362887,7362894,7363352,7363361,7363356,7363354,7363345,7363342],0, 0, '', 'gallery_398429.html',0,0);
				  					galleries[218369] = new gallery(218369,'3654877','Sold paintings','gallery',[3572595,3654887,3654942,3685227,3687221,3654877],0, 0, '', 'gallery_218369.html',0,0);
				  					galleries[218424] = new gallery(218424,'7484824,7362995,3572793','Bits & Pieces','gallery',[3572793,7362995,7484824],0, 0, '', 'gallery_218424.html',0,0);
				  					galleries[418833] = new gallery(418833,'7746048,7746041,7746040,7746039','Pete\'s wooden bowls','gallery',[7746048,7746040,7746041,7746039],0, 0, '', 'gallery_418833.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '7318998,6301766,6301744,6301728,6301705,6301703,6301694,6107072,3846460,3687221,3685227,3655411,3654939,3654887,3654877,3654823,3599691,3599113,3599080,3572684,3572670,3572665,3572595,3572555,3572505,3571763,3571758';
imageSets[2] = '7746096,6301744,3654877,3572364,3571758';
imageSets[3] = '6301766,6301744,6301728,6301705,6301703,6301694,3654887,3654877';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/mrsmiggins/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/mrsmiggins/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/mrsmiggins/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/mrsmiggins/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/mrsmiggins/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/mrsmiggins/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/mrsmiggins/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/mrsmiggins/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/mrsmiggins/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/mrsmiggins/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/mrsmiggins/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/mrsmiggins/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/mrsmiggins/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/mrsmiggins/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/mrsmiggins/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/mrsmiggins/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/mrsmiggins/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/mrsmiggins/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/mrsmiggins/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/mrsmiggins/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/mrsmiggins/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/mrsmiggins/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 = 'stable1studios: ' + photoCaption;
			    }
        if (op.$detail.length > 0) {
      temp = op.nextPhoto.fnGetImageDetails();
	    op.$detail.fadeGalleryDetails(temp, op.speed, function(){
	    var options = {photoinfominwidth:220};	    	      	      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>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;
	}
}

			

