window.thumbnails = {};
thumbnails[8186395] = clik.newPhoto({"link":"#","caption":"House and Garden","height":192,"id":8186395,"server_id":31,"src":"houseandgardens_thumb.jpg","galleries_id":"","width":130});
thumbnails[8186398] = clik.newPhoto({"link":"#","caption":"Embroidery Magazine - Article","height":192,"id":8186398,"server_id":31,"src":"embroiderymag_thumb.jpg","galleries_id":"","width":130});
thumbnails[8186400] = clik.newPhoto({"link":"#","caption":"Sunday Express S Magazine","height":192,"id":8186400,"server_id":31,"src":"Smagazine_thumb.jpg","galleries_id":"","width":130});
thumbnails[8186401] = clik.newPhoto({"link":"#","caption":"Telegraph Travel Section","height":192,"id":8186401,"server_id":31,"src":"telegraph_thumb.jpg","galleries_id":"","width":130});
thumbnails[8186412] = clik.newPhoto({"link":"#","caption":"Wedding Magazine","height":192,"id":8186412,"server_id":31,"src":"weddingmag_thumb.jpg","galleries_id":"","width":130});
thumbnails[8186413] = clik.newPhoto({"link":"#","caption":"Sunday Express S Magazine","height":88,"id":8186413,"server_id":31,"src":"Smagazine2_thumb.jpg","galleries_id":"","width":130});
thumbnails[8186443] = clik.newPhoto({"link":"#","caption":"Gift Box ","height":95,"id":8186443,"server_id":31,"src":"passportbox1_thumb.jpg","galleries_id":"","width":130});
thumbnails[7246860] = clik.newPhoto({"link":"photo_7246860.html","caption":"The Lamppost £112","height":130,"id":7246860,"server_id":31,"src":"the_lampost_thumb.JPG","galleries_id":391832,"width":130});
thumbnails[7246866] = clik.newPhoto({"link":"photo_7246866.html","caption":"Entrance Gates £110","height":131,"id":7246866,"server_id":31,"src":"entrance_gates2600_thumb.jpg","galleries_id":391832,"width":130});
thumbnails[7246867] = clik.newPhoto({"link":"photo_7246867.html","caption":"Parisian Garden £115","height":130,"id":7246867,"server_id":31,"src":"parisian_garden2_600_thumb.jpg","galleries_id":391832,"width":130});
thumbnails[7246871] = clik.newPhoto({"link":"photo_7246871.html","caption":"Railings £79","height":130,"id":7246871,"server_id":31,"src":"railings_2600_thumb.jpg","galleries_id":391832,"width":130});
thumbnails[7246872] = clik.newPhoto({"link":"photo_7246872.html","caption":"Park Bench £110","height":131,"id":7246872,"server_id":31,"src":"park_bench_thumb.JPG","galleries_id":391832,"width":130});
thumbnails[7246874] = clik.newPhoto({"link":"photo_7246874.html","caption":"Little Gate £99","height":129,"id":7246874,"server_id":31,"src":"small_gate_600_thumb.JPG","galleries_id":391832,"width":130});
thumbnails[7246876] = clik.newPhoto({"link":"photo_7246876.html","caption":"Railings on Cross £85","height":129,"id":7246876,"server_id":31,"src":"railings_on_cross_thumb.JPG","galleries_id":391832,"width":130});
thumbnails[7246887] = clik.newPhoto({"link":"photo_7246887.html","caption":"Hot Air Balloon £24.50","height":99,"id":7246887,"server_id":31,"src":"passport_balloon_thumb.JPG","galleries_id":440675,"width":130});
thumbnails[7246888] = clik.newPhoto({"link":"photo_7246888.html","caption":"Train £24.50","height":103,"id":7246888,"server_id":31,"src":"passport_train_thumb.JPG","galleries_id":440675,"width":130});
thumbnails[7246890] = clik.newPhoto({"link":"photo_7246890.html","caption":"Home Sweet Home £24.50","height":102,"id":7246890,"server_id":31,"src":"passport_house_thumb.JPG","galleries_id":440675,"width":130});
thumbnails[7249629] = clik.newPhoto({"link":"photo_7249629.html","caption":"Engagement £2.00","height":130,"id":7249629,"server_id":31,"src":"engagementcard_thumb.jpg","galleries_id":391828,"width":130});
thumbnails[7249637] = clik.newPhoto({"link":"photo_7249637.html","caption":"Gorgeous £2.00","height":130,"id":7249637,"server_id":31,"src":"gorgeouscard_thumb.jpg","galleries_id":391828,"width":130});
thumbnails[7773922] = clik.newPhoto({"link":"photo_7773922.html","caption":"Patisserie £2.00","height":130,"id":7773922,"server_id":31,"src":"patisseriecard_thumb.jpg","galleries_id":391828,"width":130});
thumbnails[7773957] = clik.newPhoto({"link":"photo_7773957.html","caption":"Baby Girl £2.00","height":130,"id":7773957,"server_id":31,"src":"babygirlcard_thumb.jpg","galleries_id":391828,"width":130});
thumbnails[7246882] = clik.newPhoto({"link":"photo_7246882.html","caption":"Time For Tea £62","height":131,"id":7246882,"server_id":31,"src":"cosytimeforteafront600_thumb.jpg","galleries_id":391829,"width":130});
thumbnails[7554450] = clik.newPhoto({"link":"photo_7554450.html","caption":"Tea Time £62","height":127,"id":7554450,"server_id":31,"src":"cosy_teatime600_thumb.jpg","galleries_id":391829,"width":130});
thumbnails[7554407] = clik.newPhoto({"link":"photo_7554407.html","caption":"Valentine Cosy £62","height":132,"id":7554407,"server_id":31,"src":"valentines_cosywhite600_thumb.jpg","galleries_id":391829,"width":130});
thumbnails[7246883] = clik.newPhoto({"link":"photo_7246883.html","caption":"Earl Grey £59","height":129,"id":7246883,"server_id":31,"src":"earlgreyfront600_thumb.jpg","galleries_id":391829,"width":130});
thumbnails[7555349] = clik.newPhoto({"link":"photo_7555349.html","caption":"Taupe Tea £62","height":136,"id":7555349,"server_id":31,"src":"tea_cosy_thumb.jpg","galleries_id":391829,"width":130});
thumbnails[7554403] = clik.newPhoto({"link":"photo_7554403.html","caption":"Pots of Coffee £62","height":199,"id":7554403,"server_id":31,"src":"coffee_blue600long_thumb.jpg","galleries_id":391829,"width":130});
thumbnails[7554401] = clik.newPhoto({"link":"photo_7554401.html","caption":"All about Coffee £53","height":187,"id":7554401,"server_id":31,"src":"all_about_coffee_white600_long_thumb.jpg","galleries_id":391829,"width":130});
thumbnails[7246889] = clik.newPhoto({"link":"photo_7246889.html","caption":"Ship £24.50","height":99,"id":7246889,"server_id":31,"src":"passport_ship_thumb.JPG","galleries_id":440675,"width":130});
thumbnails[8162780] = clik.newPhoto({"link":"photo_8162780.html","caption":"Happy Birthday £2.00","height":130,"id":8162780,"server_id":31,"src":"happybirthdaydresscard_thumb.jpg","galleries_id":391828,"width":130});
thumbnails[8278858] = clik.newPhoto({"link":"photo_8278858.html","caption":"Ruby Shoe £29.50","height":130,"id":8278858,"server_id":31,"src":"ruby_shoepp_thumb.jpg","galleries_id":440676,"width":130});
thumbnails[8162777] = clik.newPhoto({"link":"photo_8162777.html","caption":"Mr. and Mrs. £2.00","height":130,"id":8162777,"server_id":31,"src":"mrandmrscard_thumb.jpg","galleries_id":391828,"width":130});
thumbnails[8171441] = clik.newPhoto({"link":"photo_8171441.html","caption":"Personalised Jewellery Roll £35","height":130,"id":8171441,"server_id":31,"src":"jewelleryroll1_thumb.jpg","galleries_id":436447,"width":130});
thumbnails[8278954] = clik.newPhoto({"link":"photo_8278954.html","caption":"Union Jack £29.50","height":130,"id":8278954,"server_id":31,"src":"unionjackpp_thumb.jpg","galleries_id":440676,"width":130});
thumbnails[8381427] = clik.newPhoto({"link":"photo_8381427.html","caption":"Inside Jewellery Roll","height":126,"id":8381427,"server_id":31,"src":"inside_jewellery_roll_thumb.jpg","galleries_id":436447,"width":130});
thumbnails[8162791] = clik.newPhoto({"link":"photo_8162791.html","caption":"New Home £2.00","height":130,"id":8162791,"server_id":31,"src":"newhomecard_thumb.jpg","galleries_id":391828,"width":130});
thumbnails[8171513] = clik.newPhoto({"link":"photo_8171513.html","caption":"Personalissed Laundry Bag £39","height":130,"id":8171513,"server_id":31,"src":"delicates_thumb.jpg","galleries_id":436454,"width":130});
thumbnails[8279144] = clik.newPhoto({"link":"photo_8279144.html","caption":"Postcard £29.50","height":130,"id":8279144,"server_id":31,"src":"postcardpp_thumb.jpg","galleries_id":440676,"width":130});
thumbnails[8162802] = clik.newPhoto({"link":"photo_8162802.html","caption":"Wedding Day Dress £2.00","height":130,"id":8162802,"server_id":31,"src":"weddingdaycard_thumb.jpg","galleries_id":391828,"width":130});
thumbnails[8162804] = clik.newPhoto({"link":"photo_8162804.html","caption":"Happy Birthday Cakes £2.00","height":130,"id":8162804,"server_id":31,"src":"happybirthdaycards_thumb.jpg","galleries_id":391828,"width":130});
thumbnails[8279222] = clik.newPhoto({"link":"photo_8279222.html","caption":"Back of of passport sleeves","height":130,"id":8279222,"server_id":31,"src":"backpp_edited-1_thumb.jpg","galleries_id":440676,"width":130});
thumbnails[7249613] = clik.newPhoto({"link":"photo_7249613.html","caption":"Wedding Cake £2.00","height":130,"id":7249613,"server_id":31,"src":"weddingdaycakecard_thumb.jpg","galleries_id":391828,"width":130});
thumbnails[8279255] = clik.newPhoto({"link":"photo_8279255.html","caption":"Inside holders","height":130,"id":8279255,"server_id":31,"src":"insidepp_thumb.jpg","galleries_id":440676,"width":130});
thumbnails[8162816] = clik.newPhoto({"link":"photo_8162816.html","caption":"Fabulous                £2.00","height":130,"id":8162816,"server_id":31,"src":"fabulouscard_thumb.jpg","galleries_id":391828,"width":130});
thumbnails[8162822] = clik.newPhoto({"link":"photo_8162822.html","caption":"Baby Boy £2.00","height":130,"id":8162822,"server_id":31,"src":"babyboy_thumb.jpg","galleries_id":391828,"width":130});
thumbnails[8186533] = clik.newPhoto({"link":"photo_8186533.html","caption":"Gift Box for Jewellery Roll","height":95,"id":8186533,"server_id":31,"src":"jewellerybox_thumb.jpg","galleries_id":436447,"width":130});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
galleries[440676] = clik.newGallery({"photoIDs":[8278858,8278954,8279144,8279222,8279255],"link":"gallery_440676.html","skipIndex":0,"section_code":"gallery","id":440676,"parentGallery":391841,"featured_images":"8279255,8279222,8279144,8278954,8278858","maxRecords":0,"usePopups":true,"singleSection":false,"title":"Open Passport Sleeves"});galleries[391832] = clik.newGallery({"photoIDs":[7246860,7246866,7246867,7246871,7246872,7246874,7246876],"link":"gallery_391832.html","skipIndex":0,"section_code":"gallery","id":391832,"parentGallery":391812,"featured_images":7246860,"maxRecords":0,"usePopups":true,"singleSection":false,"title":"A Stroll in the Park"});galleries[391841] = clik.newGallery({"photoIDs":[],"link":"gallery_391841.html","skipIndex":0,"section_code":"gallery","id":391841,"parentGallery":"","featured_images":"7246889,7246887","maxRecords":0,"usePopups":true,"singleSection":false,"title":"Passport Holders"});galleries[440675] = clik.newGallery({"photoIDs":[7246887,7246888,7246890,7246889],"link":"gallery_440675.html","skipIndex":0,"section_code":"gallery","id":440675,"parentGallery":391841,"featured_images":"7246889,7246887","maxRecords":0,"usePopups":true,"singleSection":false,"title":"Passport Pockets"});galleries[437054] = clik.newGallery({"photoIDs":[],"link":"gallery_437054.html","skipIndex":0,"section_code":"gallery","id":437054,"parentGallery":391812,"featured_images":"","maxRecords":0,"usePopups":true,"singleSection":false,"title":"Home Sweet Home"});galleries[436447] = clik.newGallery({"photoIDs":[8171441,8381427,8186533],"link":"gallery_436447.html","skipIndex":0,"section_code":"gallery","id":436447,"parentGallery":"","featured_images":8171441,"maxRecords":0,"usePopups":true,"singleSection":false,"title":"Jewellery Rolls"});galleries[436454] = clik.newGallery({"photoIDs":[8171513],"link":"gallery_436454.html","skipIndex":0,"section_code":"gallery","id":436454,"parentGallery":"","featured_images":8171513,"maxRecords":0,"usePopups":true,"singleSection":false,"title":"Laundry Bags"});galleries[391829] = clik.newGallery({"photoIDs":[7246882,7554450,7554407,7246883,7555349,7554403,7554401],"link":"gallery_391829.html","skipIndex":0,"section_code":"gallery","id":391829,"parentGallery":"","featured_images":7246883,"maxRecords":0,"usePopups":true,"singleSection":false,"title":"Tea Cosies"});galleries[391812] = clik.newGallery({"photoIDs":[],"link":"gallery_391812.html","skipIndex":0,"section_code":"gallery","id":391812,"parentGallery":"","featured_images":7246860,"maxRecords":0,"usePopups":true,"singleSection":false,"title":"Cushions"});galleries[391828] = clik.newGallery({"photoIDs":[7249629,7249637,7773922,7773957,8162780,8162777,8162791,8162802,8162804,7249613,8162816,8162822],"link":"gallery_391828.html","skipIndex":0,"section_code":"gallery","id":391828,"parentGallery":"","featured_images":"8162816,8162780,7773922,7249629","maxRecords":0,"usePopups":true,"singleSection":false,"title":"Greetings Cards"});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[3] = '8381427,8279255,8279222,8279144,8278954,8278858,8186533,8186443,8186413,8186412,8186401,8186400,8186398,8186395,8171513,8171441,8162822,8162816,8162804,8162802,8162791,8162780,8162777,7773957,7773922,7555349,7554450,7554407,7554403,7554401,7249637,7249629,7249613,7246890,7246889,7246888,7246887,7246883,7246882,7246876,7246874,7246872,7246871,7246867,7246866,7246860';
imageSets[2] = '7773922,7249629,7246887,7246860,7246883,8162780,7246889,8171441,8171513,8162816';
imageSets[1] = '7773922,7246883,8278858';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/bridgetjdavies/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/bridgetjdavies/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/bridgetjdavies/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/bridgetjdavies/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/bridgetjdavies/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/bridgetjdavies/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/bridgetjdavies/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/bridgetjdavies/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/bridgetjdavies/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/bridgetjdavies/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/bridgetjdavies/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/bridgetjdavies/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/bridgetjdavies/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/bridgetjdavies/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/bridgetjdavies/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/bridgetjdavies/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/bridgetjdavies/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/bridgetjdavies/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/bridgetjdavies/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/bridgetjdavies/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/bridgetjdavies/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/bridgetjdavies/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/bridgetjdavies/images';
		break;
	}
		switch (server_id) {
		case 51:
		val = 'www12.clikpic.com/bridgetjdavies/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/bridgetjdavies/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 = 'Bridget Davies Embroidered Textiles: ' + 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.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;
	}
}

		

