window.thumbnails = {};
															thumbnails[959277] = clik.newPhoto({"id":959277,"src":"Craw Stone 72_thumb.jpg","galleries_id":72258,"server_id":1,"link":"photo_959277.html","width":130,"caption":"Craw Stone, Rhynie","height":130});
															thumbnails[959283] = clik.newPhoto({"id":959283,"src":"Aquorthies 72_thumb.jpg","galleries_id":72258,"server_id":1,"link":"photo_959283.html","width":130,"caption":"Easter Aquhorthies","height":130});
															thumbnails[959288] = clik.newPhoto({"id":959288,"src":"Brandsbutt 72_thumb.jpg","galleries_id":72258,"server_id":1,"link":"photo_959288.html","width":130,"caption":"Brandsbutt, Inverurie","height":98});
															thumbnails[959290] = clik.newPhoto({"id":959290,"src":"Cothiemuir 72_thumb.jpg","galleries_id":72258,"server_id":1,"link":"photo_959290.html","width":130,"caption":"Cothiemuir Stone Circle","height":173});
															thumbnails[959292] = clik.newPhoto({"id":959292,"src":"Crichie 72_thumb.jpg","galleries_id":72258,"server_id":1,"link":"photo_959292.html","width":130,"caption":"Broomend of Crichie, Inverurie","height":130});
															thumbnails[959306] = clik.newPhoto({"id":959306,"src":"Stories1 72_thumb.jpg","galleries_id":72415,"server_id":1,"link":"photo_959306.html","width":130,"caption":"Stories Ma Grunny Telt Ma","height":94});
															thumbnails[961108] = clik.newPhoto({"id":961108,"src":"Fyvie 72_thumb.jpg","galleries_id":72542,"server_id":1,"link":"photo_961108.html","width":130,"caption":"Fyvie Castle, Aberdeenshire","height":88});
															thumbnails[961115] = clik.newPhoto({"id":961115,"src":"Picking flowers 72_thumb.jpg","galleries_id":72351,"server_id":1,"link":"photo_961115.html","width":130,"caption":"Picking Flowers","height":98});
															thumbnails[961116] = clik.newPhoto({"id":961116,"src":"Tongan Umbrella 72_thumb.jpg","galleries_id":72350,"server_id":1,"link":"photo_961116.html","width":130,"caption":"Tongan Umbrella","height":84});
															thumbnails[961132] = clik.newPhoto({"id":961132,"src":"Crathes 72_thumb.jpg","galleries_id":72542,"server_id":1,"link":"photo_961132.html","width":130,"caption":"Crathes Castle, Aberdeenshire","height":94});
															thumbnails[961134] = clik.newPhoto({"id":961134,"src":"Craigivar 72_thumb.jpg","galleries_id":72542,"server_id":1,"link":"photo_961134.html","width":130,"caption":"Craigivar Castle, Aberdeenshire","height":98});
															thumbnails[961185] = clik.newPhoto({"id":961185,"src":"Chess 72_thumb.jpg","galleries_id":72350,"server_id":1,"link":"photo_961185.html","width":130,"caption":"Chess","height":86});
															thumbnails[972772] = clik.newPhoto({"id":972772,"src":"12thNight1 72_thumb.jpg","galleries_id":72415,"server_id":1,"link":"photo_972772.html","width":130,"caption":"Twelfth Night","height":139});
															thumbnails[972773] = clik.newPhoto({"id":972773,"src":"12thNight118 72_thumb.jpg","galleries_id":72415,"server_id":1,"link":"photo_972773.html","width":130,"caption":"Twelfth Night","height":115});
															thumbnails[972775] = clik.newPhoto({"id":972775,"src":"12thNight229 72_thumb.jpg","galleries_id":72415,"server_id":1,"link":"photo_972775.html","width":130,"caption":"Twelfth Night","height":172});
															thumbnails[972797] = clik.newPhoto({"id":972797,"src":"hamlet337 72_thumb.jpg","galleries_id":72415,"server_id":1,"link":"photo_972797.html","width":130,"caption":"Hamlet","height":80});
															thumbnails[972798] = clik.newPhoto({"id":972798,"src":"hamlet256 72_thumb.jpg","galleries_id":72415,"server_id":1,"link":"photo_972798.html","width":130,"caption":"Hamlet","height":201});
															thumbnails[972806] = clik.newPhoto({"id":972806,"src":"12thAIYF 72_thumb.jpg","galleries_id":72415,"server_id":1,"link":"photo_972806.html","width":130,"caption":"Twelfth Night AIYF","height":131});
															thumbnails[972833] = clik.newPhoto({"id":972833,"src":"12thAIYF3 72_thumb.jpg","galleries_id":72415,"server_id":1,"link":"photo_972833.html","width":130,"caption":"Twelfth Night AIYF","height":164});
															thumbnails[972837] = clik.newPhoto({"id":972837,"src":"12thAIYF2 72_thumb.jpg","galleries_id":72415,"server_id":1,"link":"photo_972837.html","width":130,"caption":"Twelfth Night AIYF","height":89});
															thumbnails[972900] = clik.newPhoto({"id":972900,"src":"Stories25 72_thumb.jpg","galleries_id":72415,"server_id":1,"link":"photo_972900.html","width":130,"caption":"Stories Ma Grunny Telt Ma","height":157});
															thumbnails[972922] = clik.newPhoto({"id":972922,"src":"Stories61 72_thumb.jpg","galleries_id":72415,"server_id":1,"link":"photo_972922.html","width":130,"caption":"Stories Ma Grunny Telt Ma","height":93});
															thumbnails[991353] = clik.newPhoto({"id":991353,"src":"Lassie 44 72_thumb.jpg","galleries_id":72415,"server_id":1,"link":"photo_991353.html","width":130,"caption":"I Only Want<br>\r\nTo Help You Lassie","height":132});
															thumbnails[1021353] = clik.newPhoto({"id":1021353,"src":"Broomend of Crichie 72_thumb.jpg","galleries_id":76294,"server_id":1,"link":"photo_1021353.html","width":130,"caption":"Broomend of Crichie, Inverurie","height":61});
															thumbnails[1021357] = clik.newPhoto({"id":1021357,"src":"Easter Aquorthies3 72_thumb.jpg","galleries_id":76294,"server_id":1,"link":"photo_1021357.html","width":130,"caption":"Easter Aquhorthies","height":61});
															thumbnails[1021358] = clik.newPhoto({"id":1021358,"src":"Mither Tap 72_thumb.jpg","galleries_id":76294,"server_id":1,"link":"photo_1021358.html","width":130,"caption":"Mither Tap from Monymusk","height":61});
															thumbnails[1021380] = clik.newPhoto({"id":1021380,"src":"Craw 721_thumb.jpg","galleries_id":76294,"server_id":1,"link":"photo_1021380.html","width":130,"caption":"Craw Stone and Tap o'Noth","height":61});
															thumbnails[1025258] = clik.newPhoto({"id":1025258,"src":"Approaching Storm_thumb.jpg","galleries_id":76577,"server_id":1,"link":"photo_1025258.html","width":130,"caption":"Approaching Storm","height":87});
															thumbnails[1081413] = clik.newPhoto({"id":1081413,"src":"Maiden Stone 723_thumb.jpg","galleries_id":76294,"server_id":1,"link":"photo_1081413.html","width":130,"caption":"The Maiden Stone","height":275});
															thumbnails[1170240] = clik.newPhoto({"id":1170240,"src":"Castle Fraser_72_thumb.jpg","galleries_id":72542,"server_id":1,"link":"photo_1170240.html","width":130,"caption":"Castle Fraser, Aberdeenshire","height":85});
															thumbnails[3154082] = clik.newPhoto({"id":3154082,"src":"Frost 005 72_thumb.jpg","galleries_id":76577,"server_id":1,"link":"photo_3154082.html","width":130,"caption":"Icicle 1","height":87});
															thumbnails[3154111] = clik.newPhoto({"id":3154111,"src":"Frost 006 72_thumb.jpg","galleries_id":76577,"server_id":1,"link":"photo_3154111.html","width":130,"caption":"Icicle 2","height":195});
															thumbnails[3154113] = clik.newPhoto({"id":3154113,"src":"Frost 009 72_thumb.jpg","galleries_id":76577,"server_id":1,"link":"photo_3154113.html","width":130,"caption":"Ice & Water","height":87});
															thumbnails[3154173] = clik.newPhoto({"id":3154173,"src":"Chain 005 72_thumb.jpg","galleries_id":76577,"server_id":1,"link":"photo_3154173.html","width":130,"caption":"Frosty Chain","height":98});
															thumbnails[3154176] = clik.newPhoto({"id":3154176,"src":"Frozen Wing_thumb.jpg","galleries_id":76577,"server_id":1,"link":"photo_3154176.html","width":130,"caption":"Frozen Wing","height":80});
															thumbnails[3154179] = clik.newPhoto({"id":3154179,"src":"Derelict 1_thumb.jpg","galleries_id":76577,"server_id":1,"link":"photo_3154179.html","width":130,"caption":"Derelict","height":98});
															thumbnails[3154180] = clik.newPhoto({"id":3154180,"src":"Frost 025 72_thumb.jpg","galleries_id":76577,"server_id":1,"link":"photo_3154180.html","width":130,"caption":"Icicle 3","height":98});
															thumbnails[3154182] = clik.newPhoto({"id":3154182,"src":"Lottie 155 72_thumb.jpg","galleries_id":72415,"server_id":1,"link":"photo_3154182.html","width":130,"caption":"Lottie","height":87});
															thumbnails[3154184] = clik.newPhoto({"id":3154184,"src":"Lottie 169 72_thumb.jpg","galleries_id":72415,"server_id":1,"link":"photo_3154184.html","width":130,"caption":"Lottie","height":87});
															thumbnails[3154196] = clik.newPhoto({"id":3154196,"src":"Lottie 17 72_thumb.jpg","galleries_id":72351,"server_id":1,"link":"photo_3154196.html","width":130,"caption":"Rosalind as Lottie","height":87});
															thumbnails[5523949] = clik.newPhoto({"id":5523949,"src":"Lubitel_001_thumb.jpg","galleries_id":312855,"server_id":1,"link":"photo_5523949.html","width":130,"caption":"Duthie Park - Autumn","height":131});
															thumbnails[5523962] = clik.newPhoto({"id":5523962,"src":"Lubitel_004_thumb.jpg","galleries_id":312855,"server_id":1,"link":"photo_5523962.html","width":130,"caption":"Girdleness Lighthouse","height":131});
															thumbnails[5523964] = clik.newPhoto({"id":5523964,"src":"Lubitel_005_thumb.jpg","galleries_id":312855,"server_id":1,"link":"photo_5523964.html","width":130,"caption":"The Foghorn at Girdleness","height":129});
															thumbnails[5523968] = clik.newPhoto({"id":5523968,"src":"Lubitel_008_thumb.jpg","galleries_id":312855,"server_id":1,"link":"photo_5523968.html","width":130,"caption":"The Farm 1","height":131});
															thumbnails[5523969] = clik.newPhoto({"id":5523969,"src":"Lubitel_011_thumb.jpg","galleries_id":312855,"server_id":1,"link":"photo_5523969.html","width":130,"caption":"The Plough","height":131});
															thumbnails[5523970] = clik.newPhoto({"id":5523970,"src":"Lubitel_012_thumb.jpg","galleries_id":312855,"server_id":1,"link":"photo_5523970.html","width":130,"caption":"Topper","height":122});
															thumbnails[5524114] = clik.newPhoto({"id":5524114,"src":"Paradise_96_thumb.jpg","galleries_id":76577,"server_id":1,"link":"photo_5524114.html","width":130,"caption":"Paradise Wood","height":92});
															thumbnails[5524118] = clik.newPhoto({"id":5524118,"src":"02012009_031_thumb.jpg","galleries_id":76577,"server_id":1,"link":"photo_5524118.html","width":130,"caption":"Morning Mist","height":98});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[72415] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Drama","link":"gallery_72415.html","maxRecords":0.0,"photoIDs":[959306.0,972772.0,972773.0,972775.0,972797.0,972798.0,972806.0,972833.0,972837.0,972900.0,972922.0,991353.0,3154182.0,3154184.0],"skipIndex":0,"section_code":"gallery","featured_images":"3154184,3154182,991353,972922,972900,972837,972833,972806,972798,972797","id":72415,"singleSection":false});				  						galleries[72350] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"International","link":"gallery_72350.html","maxRecords":0.0,"photoIDs":[961116.0,961185.0],"skipIndex":0,"section_code":"gallery","featured_images":"961185,961116","id":72350,"singleSection":false});				  						galleries[312855] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Lubitel","link":"gallery_312855.html","maxRecords":0.0,"photoIDs":[5523949.0,5523962.0,5523964.0,5523968.0,5523969.0,5523970.0],"skipIndex":0,"section_code":"gallery","featured_images":"5523970,5523969,5523968,5523964,5523962,5523949","id":312855,"singleSection":false});				  						galleries[76577] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Nature","link":"gallery_76577.html","maxRecords":0.0,"photoIDs":[1025258.0,3154082.0,3154111.0,3154113.0,3154173.0,3154176.0,3154179.0,3154180.0,5524114.0,5524118.0],"skipIndex":0,"section_code":"gallery","featured_images":"5524118,5524114,3154180,3154179,3154176,3154173,3154113,3154111,3154082,1025258","id":76577,"singleSection":false});				  						galleries[72351] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Portraits","link":"gallery_72351.html","maxRecords":0.0,"photoIDs":[961115.0,3154196.0],"skipIndex":0,"section_code":"gallery","featured_images":"3154196,961115","id":72351,"singleSection":false});				  						galleries[76294] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Postcards","link":"gallery_76294.html","maxRecords":0.0,"photoIDs":[1021353.0,1021357.0,1021358.0,1021380.0,1081413.0],"skipIndex":0,"section_code":"gallery","featured_images":"1081413,1021380,1021358,1021357,1021353","id":76294,"singleSection":false});				  						galleries[72542] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Scottish Castles","link":"gallery_72542.html","maxRecords":0.0,"photoIDs":[961108.0,961132.0,961134.0,1170240.0],"skipIndex":0,"section_code":"gallery","featured_images":"1170240,961134,961132,961108","id":72542,"singleSection":false});				  						galleries[72258] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Standing Stones","link":"gallery_72258.html","maxRecords":0.0,"photoIDs":[959277.0,959283.0,959288.0,959290.0,959292.0],"skipIndex":0,"section_code":"gallery","featured_images":"959292,959290,959288,959283,959277","id":72258,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '5523964,3154182,3154113,959277';
imageSets[3] = '5524118,5524114,5523970,5523969,5523968,5523964,5523962,5523949,3154196,3154184,3154182,3154180,3154179,3154176,3154173,3154113,3154111,3154082,1170240,1081413,1025258,1021380,1021358,1021357,1021353,991353,972922,972900,972837,972833,972806,972798,972797,972775,972773,972772,961185,961134,961132,961116,961115,961108,959306,959292,959290,959288,959283,959277';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'www12.clikpic.com/michaelwatteu/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/michaelwatteu/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/michaelwatteu/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/michaelwatteu/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/michaelwatteu/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/michaelwatteu/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/michaelwatteu/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/michaelwatteu/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/michaelwatteu/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/michaelwatteu/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/michaelwatteu/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/michaelwatteu/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/michaelwatteu/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/michaelwatteu/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/michaelwatteu/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/michaelwatteu/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/michaelwatteu/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/michaelwatteu/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/michaelwatteu/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/michaelwatteu/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/michaelwatteu/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/michaelwatteu/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/michaelwatteu/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/michaelwatteu/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:'',$detailContainer:'',
                    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 (op.updateHash && clik.getIDInUrl(location.href,'photo') != op.nextPhoto.id) {
		clik.changeHash('photos_id=' + op.nextPhoto.id, true);
	}
		
	    if (op.$title.length > 0) {
  		op.$title.fadeGalleryDetails(photoCaption, op.speed);
    }
        if (op.updateDocumentTitle) {
						  document.title = 'Michael Watt Photography: ' + photoCaption;
			    }
        if (op.$detail.length > 0) {
      	temp = op.nextPhoto.fnGetImageDetails();
	    op.$detail.fadeGalleryDetails(temp, op.speed, function(){
			if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
				toggleAddToCartConfirm(backgrounds, op.$detail);
			} else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
				toggleAddToCartConfirm(photos, op.$detail);
			}
			$('body').trigger('clikUpdate.popup');
	    });
    }
        $(op.$detailContainer).find('.replaceable[class*=replaceable_photo-]').each(function(){
    	var field = clik.getPrefixedClass(this.className, 'replaceable_photo-');
    	if (field in op.nextPhoto) {
    		$(this).fadeGalleryDetails(op.nextPhoto[field], op.speed);
    	}
    }).end().find('.replaceable.photoPayment').fadeGalleryDetails(op.nextPhoto.fnGetPaymentInfo(), op.speed, function(){
		if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
			toggleAddToCartConfirm(backgrounds, op.$detailContainer);
		} else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
			toggleAddToCartConfirm(photos, op.$detailContainer);
		}
		$('body').trigger('clikUpdate.popup');
	});
		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.speed) {
      	clik.doColumnResize(false, op.$photo.add(op.$detail).add(op.$title));
    }
        
    return html;
	}

/***************************************************************************
* Toggle add to cart confirmation element and set up the click event for   *
* the 'Add to cart' button.                                                *
***************************************************************************/
function toggleAddToCartConfirm(array, root){
	if (typeof(array) !== 'object' || array === null) {
	  	array = photos;
	}
	if (!$(root).length) {		root = $('body');	}	if($('#paymentConfirm', root).length > 0){
		$('#paymentConfirm', root).hide();
		$('#paymentAddButton', root)
		.unbind()
		.click(function(){
						form = $('#paymentForm', root)[0];
			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', root).text('Item added to cart').show();}
				else{
					$('#paymentConfirm', root).text('Item added to cart').fadeIn();
					dspOrderDetails(form.site.value);
				}
			}
			else{
				$('#paymentConfirm', root).text('Item not added - check cookies are enabled in your browser.').fadeIn();
			}
		});
	}
}

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
clik.photo.fnGetImageDetails = function(){
	var temp = '';
	if (this.description != '') {
		temp +=  '<div id="imageDescription">' + this.description + '</div>';
	}
		if (this.photo_ref != '') {
		temp += '<div class="imageinfo" id="imageRef"><strong>Ref: </strong>' + this.photo_ref + '</div>';
	}
		if (this.takendate != '') {
		
		temp += '<div class="imageinfo" id="imageDate"><strong>Date: </strong>' + this.takendate + '</div>';
	}
	
	if (this.location != '') {
		
		temp += '<div class="imageinfo" id="imageLocation"><strong>Location: </strong>' +  this.location + '</div>';
	}
	
	if (this.photographer != '') {
		
		temp += '<div class="imageinfo" id="imagePhotographer"><strong>Photographer: </strong>' + this.photographer + '</div>';
	}
				
				if (temp != '') {
		temp += '<div class="spacer"></div>';
	}
	return temp;
};

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
clik.photo.fnGetPaymentInfo = function(){
	var temp = '';
	if (this.item_price !== '') {
				temp += '<p>Order this print:</p>';
				temp += '<div class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> ' + (this.item_price).toFixed(2) + '</div>';
		var item_name  = this.purchase_instruction;
		var amount = (this.item_price).toFixed(2);
		var item_option  = 0;
	}
	else if (this.payment_groups_id !== '') {
		temp += '<p>Buy this print online:</p>';
				temp += '<form id="paymentOptions" style="margin:0px;border:0px;" name="paymentOptions">';
											temp += '<select class="paymentlink" name="payment_options_id" onchange="updateItemValues($(this.form).next(\'#paymentForm\')[0],this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value);">';
		
		temp += getPaymentOptions(this.payment_groups_id);
		temp += '</select>';
		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 += '<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({					title: galleries[gallery_id].title				}).filter(function(){return this.href;}).attr({					href: thumbnails[imageID].fnGalleryLink(gallery_id)				});
			}
		}
	}
}

/***************************************************************************
* 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 += '<a href="' + galleries[i].section_code + '_' + galleries[i].id + '.html">' + galleries[i].title + '</a>';
							}
		}
		document.all.galleryLinks.innerHTML = 'Other galleries: ' + temp;
	}
}

			

