window.thumbnails = new Object();
												thumbnails[7844022] = new thumbnail(7844022,'','Look and Sea Centre Exhibition, Littlehampton','Centre_Pieces_Pcard_thumb.jpg',130, 101,1,'#');
												thumbnails[621561] = new thumbnail(621561,'45858','Arun Swan','swan1_thumb.jpg',130, 194,1,'photo_621561.html');
												thumbnails[621578] = new thumbnail(621578,'47401','WOMAD Festival 1996','Womad_thumb.jpg',130, 78,1,'photo_621578.html');
												thumbnails[621579] = new thumbnail(621579,'47401','Shell ','shell pencil_thumb.jpg',130, 181,1,'photo_621579.html');
												thumbnails[634698] = new thumbnail(634698,'45858','Meteorite','Meteorite_thumb.jpg',130, 99,1,'photo_634698.html');
												thumbnails[640818] = new thumbnail(640818,'48425','Italian Restaurant','Farci mural_thumb.jpg',130, 99,1,'photo_640818.html');
												thumbnails[640821] = new thumbnail(640821,'48425','Private bathroom','Bathroom mural_thumb.jpg',130, 98,1,'photo_640821.html');
												thumbnails[640828] = new thumbnail(640828,'47401','Seated Figure','Charcoal figure_thumb.jpg',130, 89,1,'photo_640828.html');
												thumbnails[643411] = new thumbnail(643411,'48423','Carter\'s Fair','Carter\'s Fair_thumb.jpg',130, 98,1,'photo_643411.html');
												thumbnails[643418] = new thumbnail(643418,'48423','West Dean Grapes','West Dean Black Grapes_thumb.jpg',130, 97,1,'photo_643418.html');
												thumbnails[643441] = new thumbnail(643441,'48423','Flowers in Glass','Glass vase of flowers_thumb.jpg',130, 173,1,'photo_643441.html');
												thumbnails[643448] = new thumbnail(643448,'45858','Sunset','Sunset_thumb.jpg',130, 160,1,'photo_643448.html');
												thumbnails[643458] = new thumbnail(643458,'45858','Chard','chard_thumb.jpg',130, 135,1,'photo_643458.html');
												thumbnails[643473] = new thumbnail(643473,'45858','Physalis-single','single physalis_thumb.jpg',130, 157,1,'photo_643473.html');
												thumbnails[643506] = new thumbnail(643506,'45858','Mute Swan','Arun Swan 2_thumb.jpg',130, 132,1,'photo_643506.html');
												thumbnails[643514] = new thumbnail(643514,'45858','Millennium','Millennium_thumb.jpg',130, 69,1,'photo_643514.html');
												thumbnails[643518] = new thumbnail(643518,'45858','Sun','sun_thumb.jpg',130, 132,1,'photo_643518.html');
												thumbnails[643525] = new thumbnail(643525,'45858','Alchemy','small fair painting_thumb.jpg',130, 99,1,'photo_643525.html');
												thumbnails[643530] = new thumbnail(643530,'45858','Squash','Squash_thumb.jpg',130, 110,1,'photo_643530.html');
												thumbnails[643534] = new thumbnail(643534,'45858','Red Circle','red circle_thumb.jpg',130, 129,1,'photo_643534.html');
												thumbnails[643541] = new thumbnail(643541,'45858','Orange Circle on Blue','Orange circle_thumb.jpg',130, 128,1,'photo_643541.html');
												thumbnails[643600] = new thumbnail(643600,'48425','Kitchen mural, private commission','window view mural_thumb.jpg',130, 228,1,'photo_643600.html');
												thumbnails[644490] = new thumbnail(644490,'45858','Still Life with bread','Still Life with bread_thumb.jpg',130, 106,1,'photo_644490.html');
												thumbnails[648045] = new thumbnail(648045,'47401','Shell','Shell Chalk Drawing_thumb.jpg',130, 88,1,'photo_648045.html');
												thumbnails[648047] = new thumbnail(648047,'47401','Pepper','Pepper_thumb.jpg',130, 155,1,'photo_648047.html');
												thumbnails[649292] = new thumbnail(649292,'47401','Nineveh House','Nineveh House_thumb.jpg',130, 166,1,'photo_649292.html');
												thumbnails[649294] = new thumbnail(649294,'47401','mural design','window 1_thumb.jpg',130, 183,1,'photo_649294.html');
												thumbnails[649303] = new thumbnail(649303,'45858','Watering Can','watering can_thumb.jpg',130, 154,1,'photo_649303.html');
												thumbnails[655644] = new thumbnail(655644,'48423','Sloe Fair','meteorite1_thumb.jpg',130, 89,1,'photo_655644.html');
												thumbnails[655656] = new thumbnail(655656,'47559','Goodmayes Hospital','Goodmayes1_thumb.jpg',130, 189,1,'photo_655656.html');
												thumbnails[655659] = new thumbnail(655659,'47559','Graylingwell Hospital','Graylingwell_thumb.jpg',130, 158,1,'photo_655659.html');
												thumbnails[655661] = new thumbnail(655661,'47559','Graylingwell Hospital','Graylingwell 1_thumb.jpg',130, 92,1,'photo_655661.html');
												thumbnails[655671] = new thumbnail(655671,'47559','Graylingwell Hospital','Graylingwell 2_thumb.jpg',130, 105,1,'photo_655671.html');
												thumbnails[662154] = new thumbnail(662154,'45858','Abalone Shell','Abalone 2_thumb.jpg',130, 100,1,'photo_662154.html');
												thumbnails[662158] = new thumbnail(662158,'45858','Still Life ','Still life with melon_thumb.jpg',130, 97,1,'photo_662158.html');
												thumbnails[663367] = new thumbnail(663367,'45858','Physalis plant','Physalis plant_thumb.jpg',130, 339,1,'photo_663367.html');
												thumbnails[663368] = new thumbnail(663368,'47401','Snow Goose','Snow Goose1_thumb.jpg',130, 99,1,'photo_663368.html');
												thumbnails[663370] = new thumbnail(663370,'47401','Snow Goose','Snow Goose2_thumb.jpg',130, 186,1,'photo_663370.html');
												thumbnails[663541] = new thumbnail(663541,'48425','Italian restaurant','Niche_thumb.jpg',130, 114,1,'photo_663541.html');
												thumbnails[696072] = new thumbnail(696072,'47401','Pears','pears in basket_thumb.jpg',130, 88,1,'photo_696072.html');
												thumbnails[696074] = new thumbnail(696074,'47401','White Shell','Shell Chalk Drawing1_thumb.jpg',130, 85,1,'photo_696074.html');
												thumbnails[696076] = new thumbnail(696076,'47401','Blue Shell ','Blue shell 2_thumb.jpg',130, 91,1,'photo_696076.html');
												thumbnails[696078] = new thumbnail(696078,'45858','Vision of Shell 2007','Vision of a shell_thumb.jpg',130, 157,1,'photo_696078.html');
												thumbnails[968903] = new thumbnail(968903,'45858','Evening Swan','Evening swan_thumb.jpg',130, 166,1,'photo_968903.html');
												thumbnails[969141] = new thumbnail(969141,'45858','Fountain, 2007','fountain_thumb.jpg',130, 197,1,'photo_969141.html');
												thumbnails[1083140] = new thumbnail(1083140,'79985','Hexagon Stage Design','Hexagon stage_thumb.jpg',130, 173,1,'photo_1083140.html');
												thumbnails[1083142] = new thumbnail(1083142,'79985','Painted Screens','Painted screen_thumb.jpg',130, 90,1,'photo_1083142.html');
												thumbnails[1083145] = new thumbnail(1083145,'79985','Maze model','Maze model_thumb.jpg',130, 97,1,'photo_1083145.html');
												thumbnails[2736361] = new thumbnail(2736361,'45858','Lilly 1','Lilly1_thumb.jpg',130, 171,1,'photo_2736361.html');
												thumbnails[2736371] = new thumbnail(2736371,'45858','Lilly 3','Lilly3_thumb.jpg',130, 172,1,'photo_2736371.html');
												thumbnails[2736373] = new thumbnail(2736373,'45858','Lilly 2','Lilly2_thumb.jpg',130, 174,1,'photo_2736373.html');
												thumbnails[2736394] = new thumbnail(2736394,'45858','Arundel Garden','Garden_thumb.jpg',130, 124,1,'photo_2736394.html');
												thumbnails[3037616] = new thumbnail(3037616,'79985','Eco-Centre Design Drawing','eco-centre drawing_thumb.jpg',130, 92,1,'photo_3037616.html');
												thumbnails[3037624] = new thumbnail(3037624,'47401','Stage Light Drawing','Chair drawing_thumb.jpg',130, 90,1,'photo_3037624.html');
												thumbnails[3102550] = new thumbnail(3102550,'48425','Conservatory Mural','Weybridge Mural_thumb.jpg',130, 85,1,'photo_3102550.html');
												thumbnails[4850309] = new thumbnail(4850309,'45858','Tomato Sauce, 2009','Tomatoes_thumb.jpg',130, 94,1,'photo_4850309.html');
												thumbnails[5477263] = new thumbnail(5477263,'45858','Bristol Still Life','Graphic1_thumb.jpg',130, 155,1,'photo_5477263.html');
												thumbnails[6306109] = new thumbnail(6306109,'45858','Blue Squash','Blue_Squash_Painting_thumb.jpg',130, 98,1,'photo_6306109.html');
												thumbnails[6438129] = new thumbnail(6438129,'45858','Fan (detail)','Brittany2010_388_thumb.JPG',130, 175,1,'photo_6438129.html');
												thumbnails[7038211] = new thumbnail(7038211,'47401','J.L.S.','JLS_Drawing_thumb.jpg',130, 178,1,'photo_7038211.html');
												thumbnails[7038223] = new thumbnail(7038223,'48423','','Snow_Photo_2_thumb.jpg',130, 173,1,'photo_7038223.html');
												thumbnails[7038225] = new thumbnail(7038225,'48423','Arundel Park','Snow_Photo_4_thumb.jpg',130, 98,1,'photo_7038225.html');
												thumbnails[7038227] = new thumbnail(7038227,'79985','Great Arundel Picnic Poster','Arundel_Picnic_Poster_thumb.jpg',130, 186,1,'photo_7038227.html');
												thumbnails[7038229] = new thumbnail(7038229,'79985','Arundel Gardens Association logo','AGA_Logo_thumb.jpg',130, 66,1,'photo_7038229.html');
												thumbnails[7038236] = new thumbnail(7038236,'48425','Farci\'s Restaurant Mural','Restaurant_Mural_thumb.jpg',130, 88,1,'photo_7038236.html');
												thumbnails[7038239] = new thumbnail(7038239,'47401','Carbon Footprint','Carbon_Footprint_thumb.jpg',130, 97,1,'photo_7038239.html');
												thumbnails[7191658] = new thumbnail(7191658,'47559','Arundel Youth Club Art Project 2010','012_thumb.JPG',130, 98,1,'photo_7191658.html');
												thumbnails[7843263] = new thumbnail(7843263,'45858','The Empress, Littlehampton','phone_april_2011_018_thumb.jpg',130, 98,1,'photo_7843263.html');
												thumbnails[7843736] = new thumbnail(7843736,'47559','Arundel Youth Club Mural','july2010_003_thumb.JPG',130, 98,1,'photo_7843736.html');
												thumbnails[7843741] = new thumbnail(7843741,'47401','Leaf ','Dried_Leaf_Draw_thumb.jpg',130, 173,1,'photo_7843741.html');
												thumbnails[7843750] = new thumbnail(7843750,'79985','Centre Piece','009_thumb.JPG',130, 173,1,'photo_7843750.html');
												thumbnails[7843755] = new thumbnail(7843755,'45858','Green Chilli','Aug-sept_10_330_thumb.JPG',130, 98,1,'photo_7843755.html');
												thumbnails[7843758] = new thumbnail(7843758,'47401','mural designs','LA_Feb4th_028_thumb.JPG',130, 98,1,'photo_7843758.html');
												thumbnails[7843884] = new thumbnail(7843884,'47559','Look & Sea Centre Exhibition','Centre_Pieces_logo_thumb.jpg',130, 39,1,'photo_7843884.html');
												thumbnails[7843908] = new thumbnail(7843908,'45858','Paintings at The Empress, riverside, Littlehampton','Empress_thumb.jpg',130, 107,1,'photo_7843908.html');
												thumbnails[8037779] = new thumbnail(8037779,'45858','Centre Pieces (south)','Centre_Pieces_South_thumb.jpg',130, 98,1,'photo_8037779.html');
												thumbnails[8037786] = new thumbnail(8037786,'45858','Centre Pieces (north)','Centre_Pieces_North_thumb.jpg',130, 98,1,'photo_8037786.html');
												thumbnails[8037791] = new thumbnail(8037791,'45858','Centre Pieces (north left)','Centre_Pieces_North_-_left_thumb.jpg',130, 173,1,'photo_8037791.html');
												thumbnails[8037867] = new thumbnail(8037867,'47559','Centre Piece Sculpture and Hanging Horizon Piece','Centre_Pieces_Sculptures_thumb.jpg',130, 173,1,'photo_8037867.html');
												thumbnails[640791] = new thumbnail(640791,'48425','Al\'s Cafe','Al\'s Cafe mural1_thumb.jpg',130, 99,1,'photo_640791.html');
												thumbnails[640815] = new thumbnail(640815,'47559','Street mural - Littlehampton, West Sussex','one world street mural1_thumb.jpg',130, 99,1,'photo_640815.html');
												thumbnails[640806] = new thumbnail(640806,'48425','Venetian Mirror mural','Venice Mirror1_thumb.jpg',130, 113,1,'photo_640806.html');
												thumbnails[640752] = new thumbnail(640752,'48425','Conservatory','Selsey mural_thumb.jpg',130, 179,1,'photo_640752.html');
												thumbnails[619431] = new thumbnail(619431,'45858','Autumn Still Life','Autumn Still life_thumb.jpg',130, 98,1,'photo_619431.html');
												thumbnails[619456] = new thumbnail(619456,'45858','Courgette Flower','Courgette Flower_thumb.jpg',130, 153,1,'photo_619456.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[79985] = new gallery(79985,'3037616','Design work','gallery',[1083140,1083142,1083145,3037616,7038227,7038229,7843750],0, 0, '', 'gallery_79985.html',0,0);
				  					galleries[45858] = new gallery(45858,'6438129,6306109,696078,662158,662154,649303,644490,643530,643514,643506,634698,621561,619456','Paintings','gallery',[621561,634698,643448,643458,643473,643506,643514,643518,643525,643530,643534,643541,644490,649303,662154,662158,663367,696078,968903,969141,2736361,2736371,2736373,2736394,4850309,5477263,6306109,6438129,7843263,7843755,7843908,8037779,8037786,8037791,619431,619456],0, 0, '', 'gallery_45858.html',0,0);
				  					galleries[47401] = new gallery(47401,'3037624,696076,696074,696072,663370,663368,648047,648045','Drawings and illustration','gallery',[621578,621579,640828,648045,648047,649292,649294,663368,663370,696072,696074,696076,3037624,7038211,7038239,7843741,7843758],0, 0, '', 'gallery_47401.html',0,0);
				  					galleries[47559] = new gallery(47559,'7843884,7843736,655671,655661,655659,655656,640815','Public work','gallery',[655656,655659,655661,655671,7191658,7843736,7843884,8037867,640815],0, 0, '', 'gallery_47559.html',0,0);
				  					galleries[48423] = new gallery(48423,'655644,643411','Photography','gallery',[643411,643418,643441,655644,7038223,7038225],0, 0, '', 'gallery_48423.html',0,0);
				  					galleries[48425] = new gallery(48425,'3102550,643600,640818,640752','Murals','gallery',[640818,640821,643600,663541,3102550,7038236,640791,640806,640752],0, 0, '', 'gallery_48425.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '8037867,8037786,7844022,7843755,7843750,7843741,6438129,6306109,5477263,3102550,3037624,3037616,2736394,2736373,2736371,2736361,969141,968903,696078,696074,655644,644490,643506,643411,634698,621561';
imageSets[2] = '7843884,7843736,6438129,6306109,3102550,3037624,3037616,696078,696076,696074,696072,663370,663368,662158,662154,655671,655661,655659,655656,655644,649303,648047,648045,644490,643600,643530,643514,643506,643411,640818,640815,640752,634698,621561,619456';
imageSets[3] = '6438129,6306109';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/Adamswain/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/Adamswain/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/Adamswain/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/Adamswain/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/Adamswain/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/Adamswain/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/Adamswain/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/Adamswain/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/Adamswain/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/Adamswain/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/Adamswain/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/Adamswain/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/Adamswain/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/Adamswain/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/Adamswain/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/Adamswain/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/Adamswain/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/Adamswain/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/Adamswain/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/Adamswain/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/Adamswain/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/Adamswain/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 = 'Adam T. Swain B.A. Fine Art: ' + 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>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;
	}
}

			

