window.thumbnails = {};
															thumbnails[1738700] = clik.newPhoto({"id":1738700,"src":"2010_10_30_WHITBY_GOTH_WEEKEND_30-10-2010_1995_edited-2_thumb.jpg","galleries_id":116771,"server_id":18,"link":"photo_1738700.html","width":130,"caption":"","height":196});
															thumbnails[1738733] = clik.newPhoto({"id":1738733,"src":"11_edited-1_thumb.jpg","galleries_id":116771,"server_id":18,"link":"photo_1738733.html","width":130,"caption":"","height":82});
															thumbnails[1738740] = clik.newPhoto({"id":1738740,"src":"22_thumb.jpg","galleries_id":116771,"server_id":18,"link":"photo_1738740.html","width":130,"caption":"","height":87});
															thumbnails[1738742] = clik.newPhoto({"id":1738742,"src":"2011_10_30_CADWELL_PARK_OCT2011_4541_edited-1_thumb.jpg","galleries_id":116771,"server_id":18,"link":"photo_1738742.html","width":130,"caption":"","height":87});
															thumbnails[1738751] = clik.newPhoto({"id":1738751,"src":"iow2_thumb.jpg","galleries_id":116771,"server_id":18,"link":"photo_1738751.html","width":130,"caption":"","height":192});
															thumbnails[1738756] = clik.newPhoto({"id":1738756,"src":"iow1_thumb.jpg","galleries_id":116771,"server_id":18,"link":"photo_1738756.html","width":130,"caption":"","height":192});
															thumbnails[1738766] = clik.newPhoto({"id":1738766,"src":"web_4_thumb.jpg","galleries_id":116771,"server_id":18,"link":"photo_1738766.html","width":130,"caption":"","height":194});
															thumbnails[1738831] = clik.newPhoto({"id":1738831,"src":"2010_10_30_WHITBY_GOTH_WEEKEND_30-10-2010_2024_edited-1_thumb.jpg","galleries_id":116771,"server_id":18,"link":"photo_1738831.html","width":130,"caption":"","height":196});
															thumbnails[1741682] = clik.newPhoto({"id":1741682,"src":"MAKING_THE_CORNER-_shaun_barnard_-digital_aggregate_1_thumb.jpg","galleries_id":116771,"server_id":18,"link":"photo_1741682.html","width":130,"caption":"","height":98});
															thumbnails[1741694] = clik.newPhoto({"id":1741694,"src":"2010_06_17_PEMBROKESHIRE_2010_1293_edited-2_thumb.jpg","galleries_id":116771,"server_id":18,"link":"photo_1741694.html","width":130,"caption":"","height":87});
															thumbnails[1738679] = clik.newPhoto({"id":1738679,"src":"km5_thumb.jpg","galleries_id":116820,"server_id":18,"link":"photo_1738679.html","width":130,"caption":"","height":88});
															thumbnails[1738694] = clik.newPhoto({"id":1738694,"src":"5_thumb.jpg","galleries_id":116820,"server_id":18,"link":"photo_1738694.html","width":130,"caption":"","height":87});
															thumbnails[1738697] = clik.newPhoto({"id":1738697,"src":"W2_thumb.jpg","galleries_id":116820,"server_id":18,"link":"photo_1738697.html","width":130,"caption":"","height":87});
															thumbnails[1738702] = clik.newPhoto({"id":1738702,"src":"27_3FECA0EB-24E8-5EC4-4F3963CA5C959A35_thumb.jpg","galleries_id":116820,"server_id":18,"link":"photo_1738702.html","width":130,"caption":"","height":87});
															thumbnails[1738721] = clik.newPhoto({"id":1738721,"src":"1_thumb.jpg","galleries_id":116820,"server_id":18,"link":"photo_1738721.html","width":130,"caption":"","height":195});
															thumbnails[1738730] = clik.newPhoto({"id":1738730,"src":"7_thumb.jpg","galleries_id":116820,"server_id":18,"link":"photo_1738730.html","width":130,"caption":"","height":87});
															thumbnails[1738734] = clik.newPhoto({"id":1738734,"src":"8_thumb.jpg","galleries_id":116820,"server_id":18,"link":"photo_1738734.html","width":130,"caption":"","height":87});
															thumbnails[1738736] = clik.newPhoto({"id":1738736,"src":"1ab_thumb.jpg","galleries_id":116820,"server_id":18,"link":"photo_1738736.html","width":130,"caption":"","height":194});
															thumbnails[1738737] = clik.newPhoto({"id":1738737,"src":"pt3_thumb.jpg","galleries_id":116820,"server_id":18,"link":"photo_1738737.html","width":130,"caption":"","height":69});
															thumbnails[1738739] = clik.newPhoto({"id":1738739,"src":"14_thumb.jpg","galleries_id":116820,"server_id":18,"link":"photo_1738739.html","width":130,"caption":"","height":87});
															thumbnails[1738745] = clik.newPhoto({"id":1738745,"src":"7ab_thumb.jpg","galleries_id":116820,"server_id":18,"link":"photo_1738745.html","width":130,"caption":"","height":195});
															thumbnails[1738747] = clik.newPhoto({"id":1738747,"src":"12_thumb.jpg","galleries_id":116820,"server_id":18,"link":"photo_1738747.html","width":130,"caption":"","height":87});
															thumbnails[1738748] = clik.newPhoto({"id":1738748,"src":"13_thumb.jpg","galleries_id":116820,"server_id":18,"link":"photo_1738748.html","width":130,"caption":"","height":195});
															thumbnails[1738749] = clik.newPhoto({"id":1738749,"src":"gl2_thumb.jpg","galleries_id":116820,"server_id":18,"link":"photo_1738749.html","width":130,"caption":"","height":192});
															thumbnails[1738759] = clik.newPhoto({"id":1738759,"src":"5ab_thumb.jpg","galleries_id":116820,"server_id":18,"link":"photo_1738759.html","width":130,"caption":"","height":194});
															thumbnails[1738761] = clik.newPhoto({"id":1738761,"src":"15_thumb.jpg","galleries_id":116820,"server_id":18,"link":"photo_1738761.html","width":130,"caption":"","height":194});
															thumbnails[1738765] = clik.newPhoto({"id":1738765,"src":"16_thumb.jpg","galleries_id":116820,"server_id":18,"link":"photo_1738765.html","width":130,"caption":"","height":194});
															thumbnails[1738767] = clik.newPhoto({"id":1738767,"src":"km3_thumb.jpg","galleries_id":116820,"server_id":18,"link":"photo_1738767.html","width":130,"caption":"","height":88});
															thumbnails[1738803] = clik.newPhoto({"id":1738803,"src":"gl3_thumb.jpg","galleries_id":116820,"server_id":18,"link":"photo_1738803.html","width":130,"caption":"","height":192});
															thumbnails[1738806] = clik.newPhoto({"id":1738806,"src":"6ab_thumb.jpg","galleries_id":116820,"server_id":18,"link":"photo_1738806.html","width":130,"caption":"","height":87});
															thumbnails[1738808] = clik.newPhoto({"id":1738808,"src":"gl1_thumb.jpg","galleries_id":116820,"server_id":18,"link":"photo_1738808.html","width":130,"caption":"","height":88});
															thumbnails[1738821] = clik.newPhoto({"id":1738821,"src":"28_thumb.jpg","galleries_id":116820,"server_id":18,"link":"photo_1738821.html","width":130,"caption":"","height":195});
															thumbnails[1738834] = clik.newPhoto({"id":1738834,"src":"17_thumb.jpg","galleries_id":116820,"server_id":18,"link":"photo_1738834.html","width":130,"caption":"","height":194});
															thumbnails[1741678] = clik.newPhoto({"id":1741678,"src":"18_thumb.jpg","galleries_id":116820,"server_id":18,"link":"photo_1741678.html","width":130,"caption":"","height":87});
															thumbnails[1741680] = clik.newPhoto({"id":1741680,"src":"gl4_thumb.jpg","galleries_id":116820,"server_id":18,"link":"photo_1741680.html","width":130,"caption":"","height":192});
															thumbnails[1741683] = clik.newPhoto({"id":1741683,"src":"gl5_thumb.jpg","galleries_id":116820,"server_id":18,"link":"photo_1741683.html","width":130,"caption":"","height":192});
															thumbnails[1741684] = clik.newPhoto({"id":1741684,"src":"29_thumb.jpg","galleries_id":116820,"server_id":18,"link":"photo_1741684.html","width":130,"caption":"","height":87});
															thumbnails[1741686] = clik.newPhoto({"id":1741686,"src":"km1_thumb.jpg","galleries_id":116820,"server_id":18,"link":"photo_1741686.html","width":130,"caption":"","height":88});
															thumbnails[1741690] = clik.newPhoto({"id":1741690,"src":"19_C3DAC512-1D09-001F-99CD5B965EA71BBF_thumb.jpg","galleries_id":116820,"server_id":18,"link":"photo_1741690.html","width":130,"caption":"","height":194});
															thumbnails[1741691] = clik.newPhoto({"id":1741691,"src":"PAUL__SOPHIE_BIG_DAY__09-09-2006_146_thumb.jpg","galleries_id":116820,"server_id":18,"link":"photo_1741691.html","width":130,"caption":"","height":96});
															thumbnails[1738677] = clik.newPhoto({"id":1738677,"src":"2011_11_02_PHOTO_SHOOT_NOV_2011_4574_edited-1_thumb.jpg","galleries_id":116822,"server_id":18,"link":"photo_1738677.html","width":130,"caption":"","height":194});
															thumbnails[1738693] = clik.newPhoto({"id":1738693,"src":"10_thumb.jpg","galleries_id":116822,"server_id":18,"link":"photo_1738693.html","width":130,"caption":"","height":195});
															thumbnails[1738699] = clik.newPhoto({"id":1738699,"src":"22_oct_060_edited-1_thumb.jpg","galleries_id":116822,"server_id":18,"link":"photo_1738699.html","width":130,"caption":"","height":195});
															thumbnails[1738701] = clik.newPhoto({"id":1738701,"src":"web page 1_thumb.jpg","galleries_id":116822,"server_id":18,"link":"photo_1738701.html","width":130,"caption":"","height":88});
															thumbnails[1738719] = clik.newPhoto({"id":1738719,"src":"22_oct_048_thumb.jpg","galleries_id":116822,"server_id":18,"link":"photo_1738719.html","width":130,"caption":"","height":195});
															thumbnails[1738731] = clik.newPhoto({"id":1738731,"src":"cs4_thumb.jpg","galleries_id":116822,"server_id":18,"link":"photo_1738731.html","width":130,"caption":"","height":88});
															thumbnails[1738744] = clik.newPhoto({"id":1738744,"src":"cs1_thumb.jpg","galleries_id":116822,"server_id":18,"link":"photo_1738744.html","width":130,"caption":"","height":191});
															thumbnails[1738799] = clik.newPhoto({"id":1738799,"src":"web2_edited-1_thumb.jpg","galleries_id":116822,"server_id":18,"link":"photo_1738799.html","width":130,"caption":"","height":196});
															thumbnails[1738809] = clik.newPhoto({"id":1738809,"src":"8__BW_thumb.jpg","galleries_id":116822,"server_id":18,"link":"photo_1738809.html","width":130,"caption":"","height":195});
															thumbnails[1741675] = clik.newPhoto({"id":1741675,"src":"PRINT_1_thumb.jpg","galleries_id":116822,"server_id":18,"link":"photo_1741675.html","width":130,"caption":"","height":194});
															thumbnails[1741676] = clik.newPhoto({"id":1741676,"src":"19_thumb.JPG","galleries_id":116822,"server_id":18,"link":"photo_1741676.html","width":130,"caption":"","height":87});
															thumbnails[1741679] = clik.newPhoto({"id":1741679,"src":"PORTRAITS_12-12-2010__2010_077_edited-1_thumb.jpg","galleries_id":116822,"server_id":18,"link":"photo_1741679.html","width":130,"caption":"","height":195});
															thumbnails[1741681] = clik.newPhoto({"id":1741681,"src":"t3_edited-3_thumb.jpg","galleries_id":116822,"server_id":18,"link":"photo_1741681.html","width":130,"caption":"","height":87});
															thumbnails[1741685] = clik.newPhoto({"id":1741685,"src":"w8_thumb.jpg","galleries_id":116822,"server_id":18,"link":"photo_1741685.html","width":130,"caption":"","height":181});
															thumbnails[1741764] = clik.newPhoto({"id":1741764,"src":"22_oct_064_edited-1_thumb.jpg","galleries_id":116822,"server_id":18,"link":"photo_1741764.html","width":130,"caption":"","height":87});
															thumbnails[1741766] = clik.newPhoto({"id":1741766,"src":"1b1_thumb.jpg","galleries_id":116822,"server_id":18,"link":"photo_1741766.html","width":130,"caption":"","height":178});
															thumbnails[1741767] = clik.newPhoto({"id":1741767,"src":"cs2_thumb.jpg","galleries_id":116822,"server_id":18,"link":"photo_1741767.html","width":130,"caption":"","height":191});
															thumbnails[1741769] = clik.newPhoto({"id":1741769,"src":"22_oct_051_thumb.jpg","galleries_id":116822,"server_id":18,"link":"photo_1741769.html","width":130,"caption":"","height":194});
															thumbnails[1741773] = clik.newPhoto({"id":1741773,"src":"2011_11_02_PHOTO_SHOOT_NOV_2011_4552_edited-1_thumb.jpg","galleries_id":116822,"server_id":18,"link":"photo_1741773.html","width":130,"caption":"","height":195});
															thumbnails[1741817] = clik.newPhoto({"id":1741817,"src":"16_411AE80D-1E4F-37DC-71E8C502AE92B7B8_thumb.jpg","galleries_id":116822,"server_id":18,"link":"photo_1741817.html","width":130,"caption":"","height":199});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[116820] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Gallery 1","link":"section152722.html","maxRecords":0.0,"photoIDs":[1738679.0,1738694.0,1738697.0,1738702.0,1738721.0,1738730.0,1738734.0,1738736.0,1738737.0,1738739.0,1738745.0,1738747.0,1738748.0,1738749.0,1738759.0,1738761.0,1738765.0,1738767.0,1738803.0,1738806.0,1738808.0,1738821.0,1738834.0,1741678.0,1741680.0,1741683.0,1741684.0,1741686.0,1741690.0,1741691.0],"skipIndex":0,"section_code":"section152722","featured_images":1738808.0,"id":116820,"singleSection":true});				  						galleries[116822] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Gallery 2","link":"section152724.html","maxRecords":0.0,"photoIDs":[1738677.0,1738693.0,1738699.0,1738701.0,1738719.0,1738731.0,1738744.0,1738799.0,1738809.0,1741675.0,1741676.0,1741679.0,1741681.0,1741685.0,1741764.0,1741766.0,1741767.0,1741769.0,1741773.0,1741817.0],"skipIndex":0,"section_code":"section152724","featured_images":"1741817,1741773,1741769,1741767,1741766,1741764,1741685,1741681,1741679,1741676","id":116822,"singleSection":true});				  						galleries[116771] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Gallery 3","link":"gallery.html","maxRecords":0.0,"photoIDs":[1738700.0,1738733.0,1738740.0,1738742.0,1738751.0,1738756.0,1738766.0,1738831.0,1741682.0,1741694.0],"skipIndex":0,"section_code":"gallery","featured_images":"1741694,1741682,1738831,1738766,1738756,1738751,1738742,1738740,1738733,1738700","id":116771,"singleSection":true});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '1741690,1741678,1738808,1738803,1738765,1738749,1738699,1738694';
imageSets[2] = '1738808';
imageSets[3] = '1738808';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/shatra/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/shatra/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/shatra/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/shatra/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/shatra/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/shatra/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/shatra/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/shatra/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/shatra/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/shatra/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/shatra/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/shatra/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/shatra/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/shatra/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/shatra/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/shatra/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/shatra/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/shatra/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/shatra/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/shatra/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/shatra/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/shatra/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/shatra/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/shatra/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/shatra/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/shatra/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/shatra/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 || photos || {})[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 = 'shaun barnard 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.item_price !== '') {
			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;
	}
}

			

