window.thumbnails = {};
															thumbnails[8374392] = clik.newPhoto({"id":8374392,"src":"__Cnv0238_thumb.jpg","galleries_id":289745,"server_id":5,"link":"photo_8374392.html","width":130,"caption":"Burlington House","height":52});
															thumbnails[8806791] = clik.newPhoto({"id":8806791,"src":"__Cnv0250_thumb.jpg","galleries_id":389243,"server_id":5,"link":"photo_8806791.html","width":130,"caption":"Puff Puff Outside Paddington Station","height":103});
															thumbnails[5137607] = clik.newPhoto({"id":5137607,"src":"__Cnv0137_thumb.jpg","galleries_id":289758,"server_id":5,"link":"photo_5137607.html","width":130,"caption":"Moorhens","height":80});
															thumbnails[5139303] = clik.newPhoto({"id":5139303,"src":"__Cnv0108_thumb.jpg","galleries_id":289754,"server_id":5,"link":"photo_5139303.html","width":130,"caption":"The City","height":91});
															thumbnails[5557315] = clik.newPhoto({"id":5557315,"src":"__Cnv0205_thumb.jpg","galleries_id":289745,"server_id":5,"link":"photo_5557315.html","width":130,"caption":"Leys School Headmaster's House (South)","height":70});
															thumbnails[5137612] = clik.newPhoto({"id":5137612,"src":"__Cnv0138_thumb.jpg","galleries_id":289758,"server_id":5,"link":"photo_5137612.html","width":130,"caption":"The crow, hare, car, and man and his dog","height":97});
															thumbnails[5139285] = clik.newPhoto({"id":5139285,"src":"__Cnv0206_thumb.jpg","galleries_id":289745,"server_id":5,"link":"photo_5139285.html","width":130,"caption":"Leys School Headmaster's House (East)","height":71});
															thumbnails[5146209] = clik.newPhoto({"id":5146209,"src":"__Cnv0104_thumb.jpg","galleries_id":289754,"server_id":5,"link":"photo_5146209.html","width":130,"caption":"Kings Parade, Cambridge","height":92});
															thumbnails[7202645] = clik.newPhoto({"id":7202645,"src":"__Cnv0214_thumb.jpg","galleries_id":389243,"server_id":5,"link":"photo_7202645.html","width":130,"caption":"Mr and Mrs H","height":140});
															thumbnails[5137604] = clik.newPhoto({"id":5137604,"src":"__Cnv0095_thumb.jpg","galleries_id":289758,"server_id":5,"link":"photo_5137604.html","width":130,"caption":"4 Dogs","height":93});
															thumbnails[7202648] = clik.newPhoto({"id":7202648,"src":"__Cnv0215_thumb.jpg","galleries_id":389243,"server_id":5,"link":"photo_7202648.html","width":130,"caption":"The Rampages","height":110});
															thumbnails[7431001] = clik.newPhoto({"id":7431001,"src":"__Cnv0230_thumb.jpg","galleries_id":289754,"server_id":5,"link":"photo_7431001.html","width":130,"caption":"Boatyard Venice","height":88});
															thumbnails[5139311] = clik.newPhoto({"id":5139311,"src":"__Cnv0116_thumb.jpg","galleries_id":289745,"server_id":5,"link":"photo_5139311.html","width":130,"caption":"The Gherkin","height":201});
															thumbnails[5139418] = clik.newPhoto({"id":5139418,"src":"__Cnv00861_thumb.jpg","galleries_id":289754,"server_id":5,"link":"photo_5139418.html","width":130,"caption":"7 Sisters","height":100});
															thumbnails[5141386] = clik.newPhoto({"id":5141386,"src":"__Cnv0097_1CB5E515-1D09-001F-99B03A7721AD75B0_thumb.jpg","galleries_id":289758,"server_id":5,"link":"photo_5141386.html","width":130,"caption":"4 Pigs","height":88});
															thumbnails[7203054] = clik.newPhoto({"id":7203054,"src":"__Cnv0220_thumb.jpg","galleries_id":389243,"server_id":5,"link":"photo_7203054.html","width":130,"caption":"I have nothing to wear","height":169});
															thumbnails[5139436] = clik.newPhoto({"id":5139436,"src":"__Cnv02061_thumb.jpg","galleries_id":289754,"server_id":5,"link":"photo_5139436.html","width":130,"caption":"Cambridge Backs towards Trinity Hall","height":90});
															thumbnails[5146207] = clik.newPhoto({"id":5146207,"src":"__Cnv0103_20A9AEFC-2219-B5B5-4CAB9D857E48FAA2_thumb.jpg","galleries_id":289758,"server_id":5,"link":"photo_5146207.html","width":130,"caption":"The Auld Broon Coo","height":91});
															thumbnails[5146381] = clik.newPhoto({"id":5146381,"src":"__Cnv0105_thumb.jpg","galleries_id":289745,"server_id":5,"link":"photo_5146381.html","width":130,"caption":"Jesus College","height":134});
															thumbnails[7314027] = clik.newPhoto({"id":7314027,"src":"__Cnv0225_thumb.jpg","galleries_id":389243,"server_id":5,"link":"photo_7314027.html","width":130,"caption":"Sarah","height":191});
															thumbnails[5137600] = clik.newPhoto({"id":5137600,"src":"__Cnv0094_thumb.jpg","galleries_id":289758,"server_id":5,"link":"photo_5137600.html","width":130,"caption":"3 Choughs","height":102});
															thumbnails[5139281] = clik.newPhoto({"id":5139281,"src":"__Cnv0088_thumb.jpg","galleries_id":289745,"server_id":5,"link":"photo_5139281.html","width":130,"caption":"Gonville and Caius","height":173});
															thumbnails[5139442] = clik.newPhoto({"id":5139442,"src":"__Cnv0207_thumb.jpg","galleries_id":289754,"server_id":5,"link":"photo_5139442.html","width":130,"caption":"Cambridge Jesus Green towards lock","height":91});
															thumbnails[7839115] = clik.newPhoto({"id":7839115,"src":"__Cnv0231_thumb.jpg","galleries_id":389243,"server_id":5,"link":"photo_7839115.html","width":130,"caption":"Madam","height":168});
															thumbnails[5137598] = clik.newPhoto({"id":5137598,"src":"__Cnv0093_thumb.jpg","galleries_id":289758,"server_id":5,"link":"photo_5137598.html","width":130,"caption":"Jackdaws","height":100});
															thumbnails[5139289] = clik.newPhoto({"id":5139289,"src":"__Cnv0090_thumb.jpg","galleries_id":289745,"server_id":5,"link":"photo_5139289.html","width":130,"caption":"Gate of Honour Gonville and Caius","height":195});
															thumbnails[5139425] = clik.newPhoto({"id":5139425,"src":"__Cnv00901_thumb.jpg","galleries_id":289754,"server_id":5,"link":"photo_5139425.html","width":130,"caption":"Waterloo Place London","height":192});
															thumbnails[7839127] = clik.newPhoto({"id":7839127,"src":"__Cnv0232_thumb.jpg","galleries_id":389243,"server_id":5,"link":"photo_7839127.html","width":130,"caption":"The Choir","height":178});
															thumbnails[5137605] = clik.newPhoto({"id":5137605,"src":"__Cnv0096_thumb.jpg","galleries_id":289758,"server_id":5,"link":"photo_5137605.html","width":130,"caption":"2 Ravens","height":103});
															thumbnails[5139309] = clik.newPhoto({"id":5139309,"src":"__Cnv0109_thumb.jpg","galleries_id":289745,"server_id":5,"link":"photo_5139309.html","width":130,"caption":"St. Botolph's","height":237});
															thumbnails[5139487] = clik.newPhoto({"id":5139487,"src":"__Cnv0209_thumb.jpg","galleries_id":289754,"server_id":5,"link":"photo_5139487.html","width":130,"caption":"Wells-Next-The-Sea Beach Huts","height":87});
															thumbnails[5137590] = clik.newPhoto({"id":5137590,"src":"__Cnv0085_thumb.jpg","galleries_id":289758,"server_id":5,"link":"photo_5137590.html","width":130,"caption":"4 Craws","height":130});
															thumbnails[5139310] = clik.newPhoto({"id":5139310,"src":"__Cnv0110_thumb.jpg","galleries_id":289745,"server_id":5,"link":"photo_5139310.html","width":130,"caption":"Saffron Walden","height":183});
															thumbnails[5139420] = clik.newPhoto({"id":5139420,"src":"__Cnv00881_thumb.jpg","galleries_id":289754,"server_id":5,"link":"photo_5139420.html","width":130,"caption":"Quadriga","height":182});
															thumbnails[5137506] = clik.newPhoto({"id":5137506,"src":"__Cnv0203_thumb.jpg","galleries_id":289758,"server_id":5,"link":"photo_5137506.html","width":130,"caption":"8 Cows","height":88});
															thumbnails[5139276] = clik.newPhoto({"id":5139276,"src":"__Cnv0086_thumb.jpg","galleries_id":289745,"server_id":5,"link":"photo_5139276.html","width":130,"caption":"Corpus Christi","height":55});
															thumbnails[8183122] = clik.newPhoto({"id":8183122,"src":"__Cnv0111_thumb.jpg","galleries_id":289754,"server_id":5,"link":"photo_8183122.html","width":130,"caption":"Visiting Cambridge","height":62});
															thumbnails[5137588] = clik.newPhoto({"id":5137588,"src":"__Cnv02071_thumb.jpg","galleries_id":289758,"server_id":5,"link":"photo_5137588.html","width":130,"caption":"Reflective Puppy","height":146});
															thumbnails[5141413] = clik.newPhoto({"id":5141413,"src":"__Cnv0204_thumb.jpg","galleries_id":289758,"server_id":5,"link":"photo_5141413.html","width":130,"caption":"Kit-Kat","height":93});
															thumbnails[7839154] = clik.newPhoto({"id":7839154,"src":"__Cnv0229_thumb.jpg","galleries_id":289758,"server_id":5,"link":"photo_7839154.html","width":130,"caption":"Miss Tibbs","height":178});
															thumbnails[8183091] = clik.newPhoto({"id":8183091,"src":"__Cnv0235_thumb.jpg","galleries_id":289758,"server_id":5,"link":"photo_8183091.html","width":130,"caption":"Bears in the wood","height":202});
															thumbnails[8183083] = clik.newPhoto({"id":8183083,"src":"__Cnv0088_35CF5B70-1EC9-DFB6-09D81CA785BEE90F_thumb.jpg","galleries_id":289758,"server_id":5,"link":"photo_8183083.html","width":130,"caption":"10 Green bottles","height":91});
															thumbnails[7839142] = clik.newPhoto({"id":7839142,"src":"__Cnv0224_thumb.jpg","galleries_id":289758,"server_id":5,"link":"photo_7839142.html","width":130,"caption":"Chicken Run","height":93});
															thumbnails[8374417] = clik.newPhoto({"id":8374417,"src":"__Cnv0240_thumb.jpg","galleries_id":289758,"server_id":5,"link":"photo_8374417.html","width":130,"caption":"Robin and 2 Tits","height":102});
															thumbnails[8374423] = clik.newPhoto({"id":8374423,"src":"__Cnv0241_thumb.jpg","galleries_id":289758,"server_id":5,"link":"photo_8374423.html","width":130,"caption":"Time to go home","height":57});
															thumbnails[8374436] = clik.newPhoto({"id":8374436,"src":"__Cnv0239_thumb.jpg","galleries_id":289758,"server_id":5,"link":"photo_8374436.html","width":130,"caption":"7 Cows","height":45});
															thumbnails[8374442] = clik.newPhoto({"id":8374442,"src":"__Cnv0236_thumb.jpg","galleries_id":289758,"server_id":5,"link":"photo_8374442.html","width":130,"caption":"Arsest at Work","height":74});
															thumbnails[8802166] = clik.newPhoto({"id":8802166,"src":"__Cnv0247_thumb.jpg","galleries_id":289758,"server_id":5,"link":"photo_8802166.html","width":130,"caption":"Orangutan Family","height":104});
															thumbnails[8802176] = clik.newPhoto({"id":8802176,"src":"__Cnv0248_thumb.jpg","galleries_id":289758,"server_id":5,"link":"photo_8802176.html","width":130,"caption":"2 Owls","height":182});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[289745] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Buildings","link":"gallery_289745.html","maxRecords":0.0,"photoIDs":[8374392.0,5557315.0,5139285.0,5139311.0,5146381.0,5139281.0,5139289.0,5139309.0,5139310.0,5139276.0],"skipIndex":0,"section_code":"gallery","featured_images":8374392.0,"id":289745,"singleSection":false});				  						galleries[389243] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Humans","link":"gallery_389243.html","maxRecords":0.0,"photoIDs":[8806791.0,7202645.0,7202648.0,7203054.0,7314027.0,7839115.0,7839127.0],"skipIndex":0,"section_code":"gallery","featured_images":"8806791,7839127,7839115,7314027,7203054,7202648,7202645","id":389243,"singleSection":false});				  						galleries[289754] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Townscape\/Landscape","link":"gallery_289754.html","maxRecords":0.0,"photoIDs":[5139303.0,5146209.0,7431001.0,5139418.0,5139436.0,5139442.0,5139425.0,5139487.0,5139420.0,8183122.0],"skipIndex":0,"section_code":"gallery","featured_images":"8183122,7431001","id":289754,"singleSection":false});				  						galleries[289758] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Wildlife","link":"gallery_289758.html","maxRecords":0.0,"photoIDs":[5137607.0,5137612.0,5137604.0,5141386.0,5146207.0,5137600.0,5137598.0,5137605.0,5137590.0,5137506.0,5137588.0,5141413.0,7839154.0,8183091.0,8183083.0,7839142.0,8374417.0,8374423.0,8374436.0,8374442.0,8802166.0,8802176.0],"skipIndex":0,"section_code":"gallery","featured_images":"8802176,8802166,8374442,8374436,8374423,8374417,8183091,8183083,7839154,7839142","id":289758,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '8806791,8374392,5139303,5137607,7202645,5146209,5139285,5137612,7431001,7202648,5137604,7203054,5141386,5139418,5139311,7314027,5146381,5139436,7839115,5139442,5137600,5137598,5139487,5137605,5137590,8183122,5139276,5141413,7839154,8183091,8183083,7839142,8374417,8374423,8374436,8374442,8802166,8802176';
imageSets[2] = '8806791,8374392,7202645,7431001,7202648,7203054,7314027,7839115,7839127,8183122,7839154,8183091,8183083,7839142,8374417,8374423,8374436,8374442,8802166,8802176';
imageSets[3] = '8806791,8374392,5139303,5137607,7202645,5146209,5139285,5137612,7431001,7202648,5137604,7203054,5141386,5139418,5139311,7314027,5146381,5146207,5139436,7839115,5139442,5139281,5137600,7839127,5139425,5139289,5137598,5139487,5139309,5137605,5139420,5139310,5137590,8183122,5139276,5137506,5137588,5141413,7839154,8183091,8183083,7839142,8374442,8802166,8802176';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'www12.clikpic.com/gavinclark/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/gavinclark/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/gavinclark/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/gavinclark/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/gavinclark/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/gavinclark/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/gavinclark/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/gavinclark/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/gavinclark/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/gavinclark/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/gavinclark/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/gavinclark/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/gavinclark/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/gavinclark/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/gavinclark/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/gavinclark/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/gavinclark/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/gavinclark/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/gavinclark/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/gavinclark/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/gavinclark/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/gavinclark/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/gavinclark/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/gavinclark/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/gavinclark/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 = 'gavinclarkart: ' + 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>';
	}
				
	temp += this.fnGetPaymentInfo();
				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>Buy now using PayPal:</p>';
				temp += '<div class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> &pound;' + (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.item_price !== '' || this.payment_groups_id !== '') {
																		temp += '<form id="paymentForm" style="margin:0px;border:0px;" name="paymentForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
			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 += '<input type="hidden" name="cmd" value="_cart">';
					temp += '<input type="hidden" name="business" value="monnierclark@waitrose.com">';
					temp += '<input type="hidden" name="currency_code" value="GBP">';
					temp += '<input type="hidden" name="add" value="1">';
													temp += '<input type="hidden" name="amount" value="'+amount+'">';
					temp += '<input type="hidden" name="item_number" value="'+ref+'">';
													temp += '<input type=\"Submit\" value=\"Add to cart\" id=\"paymentAddButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
										temp += '</form>';
										temp += '<form id="paymentCartForm" style="margin:0px;" name="paymentCartForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
				temp += '<input type="hidden" name="cmd" value="_cart">';
				temp += '<input type="hidden" name="business" value="monnierclark@waitrose.com">';
				temp += '<input type="hidden" name="display" value="1">';
				temp += '<input type=\"Submit\" value=\"View cart\" id=\"paymentViewButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
				temp += '</form>';
						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;
	}
}

			

