window.thumbnails = {};
															thumbnails[9065886] = clik.newPhoto({"id":9065886,"src":"BlueCircle_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":160,"caption":"","height":160});
															thumbnails[9095847] = clik.newPhoto({"id":9095847,"src":"greycircle_1_thumb.jpg","galleries_id":"","server_id":35,"link":"#","width":160,"caption":"","height":160});
															thumbnails[9095848] = clik.newPhoto({"id":9095848,"src":"pinkcircle_1_thumb.jpg","galleries_id":"","server_id":35,"link":"#","width":160,"caption":"","height":160});
															thumbnails[7639045] = clik.newPhoto({"id":7639045,"src":"1_thumb.jpg","galleries_id":319237,"server_id":5,"link":"photo_7639045.html","width":130,"caption":"","height":271});
															thumbnails[7639058] = clik.newPhoto({"id":7639058,"src":"2_thumb.jpg","galleries_id":319237,"server_id":5,"link":"photo_7639058.html","width":130,"caption":"","height":271});
															thumbnails[8208885] = clik.newPhoto({"id":8208885,"src":"small1_thumb.jpg","galleries_id":437908,"server_id":5,"link":"photo_8208885.html","width":160,"caption":"","height":120});
															thumbnails[8208897] = clik.newPhoto({"id":8208897,"src":"small2_thumb.jpg","galleries_id":437908,"server_id":5,"link":"photo_8208897.html","width":160,"caption":"","height":120});
															thumbnails[8208900] = clik.newPhoto({"id":8208900,"src":"small4_thumb.jpg","galleries_id":437908,"server_id":5,"link":"photo_8208900.html","width":160,"caption":"","height":120});
															thumbnails[8208901] = clik.newPhoto({"id":8208901,"src":"small7_thumb.jpg","galleries_id":437908,"server_id":5,"link":"photo_8208901.html","width":160,"caption":"","height":120});
															thumbnails[8208908] = clik.newPhoto({"id":8208908,"src":"small9_thumb.jpg","galleries_id":437908,"server_id":5,"link":"photo_8208908.html","width":160,"caption":"","height":120});
															thumbnails[8208909] = clik.newPhoto({"id":8208909,"src":"small10_thumb.jpg","galleries_id":437908,"server_id":5,"link":"photo_8208909.html","width":160,"caption":"","height":120});
															thumbnails[8208916] = clik.newPhoto({"id":8208916,"src":"small8_thumb.jpg","galleries_id":437908,"server_id":5,"link":"photo_8208916.html","width":120,"caption":"","height":160});
															thumbnails[8208918] = clik.newPhoto({"id":8208918,"src":"small6_thumb.jpg","galleries_id":437908,"server_id":5,"link":"photo_8208918.html","width":120,"caption":"","height":160});
															thumbnails[8208924] = clik.newPhoto({"id":8208924,"src":"small3_thumb.jpg","galleries_id":437908,"server_id":5,"link":"photo_8208924.html","width":120,"caption":"","height":160});
															thumbnails[8211532] = clik.newPhoto({"id":8211532,"src":"1_6CA8DE30-1EC9-D45B-1CD19ED4E95F7F06_thumb.jpg","galleries_id":438012,"server_id":5,"link":"photo_8211532.html","width":160,"caption":"","height":107});
															thumbnails[8211540] = clik.newPhoto({"id":8211540,"src":"2_6CAA1A97-1EC9-D45B-1C7A7065ABC51335_thumb.jpg","galleries_id":438012,"server_id":5,"link":"photo_8211540.html","width":107,"caption":"","height":160});
															thumbnails[8211547] = clik.newPhoto({"id":8211547,"src":"3_6CAB4924-1EC9-D45B-1CA0B675D7CD9269_thumb.jpg","galleries_id":438012,"server_id":5,"link":"photo_8211547.html","width":106,"caption":"","height":160});
															thumbnails[8211557] = clik.newPhoto({"id":8211557,"src":"4_thumb.jpg","galleries_id":438012,"server_id":5,"link":"photo_8211557.html","width":106,"caption":"","height":160});
															thumbnails[8211559] = clik.newPhoto({"id":8211559,"src":"5_6CAD7BE1-1EC9-D45B-1CDE30FE4BEAB072_thumb.jpg","galleries_id":438012,"server_id":5,"link":"photo_8211559.html","width":106,"caption":"","height":160});
															thumbnails[8211564] = clik.newPhoto({"id":8211564,"src":"6_thumb.jpg","galleries_id":438012,"server_id":5,"link":"photo_8211564.html","width":160,"caption":"","height":107});
															thumbnails[8872074] = clik.newPhoto({"id":8872074,"src":"card1_thumb.jpg","galleries_id":362075,"server_id":5,"link":"photo_8872074.html","width":115,"caption":"","height":160});
															thumbnails[8872076] = clik.newPhoto({"id":8872076,"src":"card2_thumb.jpg","galleries_id":362075,"server_id":5,"link":"photo_8872076.html","width":116,"caption":"","height":160});
															thumbnails[8951972] = clik.newPhoto({"id":8951972,"src":"OrangeGillSans_thumb.jpg","galleries_id":478166,"server_id":5,"link":"photo_8951972.html","width":147,"caption":"","height":160});
															thumbnails[6065122] = clik.newPhoto({"id":6065122,"src":"Large_Lamp_thumb.jpg","galleries_id":478168,"server_id":5,"link":"photo_6065122.html","width":130,"caption":"","height":196});
															thumbnails[8213237] = clik.newPhoto({"id":8213237,"src":"l1_thumb.jpg","galleries_id":478168,"server_id":5,"link":"photo_8213237.html","width":107,"caption":"","height":160});
															thumbnails[8790470] = clik.newPhoto({"id":8790470,"src":"Triptik_Logo_112_thumb.jpg","galleries_id":462707,"server_id":5,"link":"photo_8790470.html","width":160,"caption":"","height":146});
															thumbnails[9066727] = clik.newPhoto({"id":9066727,"src":"facebox_thumb.jpg","galleries_id":478167,"server_id":5,"link":"photo_9066727.html","width":131,"caption":"","height":160});
															thumbnails[6065251] = clik.newPhoto({"id":6065251,"src":"Hanging_lamp_thumb.jpg","galleries_id":478168,"server_id":5,"link":"photo_6065251.html","width":130,"caption":"","height":200});
															thumbnails[8208863] = clik.newPhoto({"id":8208863,"src":"album1_thumb.jpg","galleries_id":462707,"server_id":5,"link":"photo_8208863.html","width":160,"caption":"","height":160});
															thumbnails[8213241] = clik.newPhoto({"id":8213241,"src":"l2_thumb.jpg","galleries_id":478168,"server_id":5,"link":"photo_8213241.html","width":160,"caption":"","height":107});
															thumbnails[8859276] = clik.newPhoto({"id":8859276,"src":"Tightshirt1_thumb.jpg","galleries_id":478167,"server_id":5,"link":"photo_8859276.html","width":160,"caption":"","height":160});
															thumbnails[9066720] = clik.newPhoto({"id":9066720,"src":"GreenDarkGreyGillSans_thumb.jpg","galleries_id":478166,"server_id":5,"link":"photo_9066720.html","width":147,"caption":"","height":160});
															thumbnails[6062589] = clik.newPhoto({"id":6062589,"src":"Lamps_Original1_thumb.jpg","galleries_id":478168,"server_id":5,"link":"photo_6062589.html","width":130,"caption":"","height":184});
															thumbnails[7639063] = clik.newPhoto({"id":7639063,"src":"3_B6086E98-1EC9-DFB6-096014D37E9CAD96_thumb.jpg","galleries_id":319237,"server_id":5,"link":"photo_7639063.html","width":130,"caption":"","height":271});
															thumbnails[8208875] = clik.newPhoto({"id":8208875,"src":"album2_thumb.jpg","galleries_id":462707,"server_id":5,"link":"photo_8208875.html","width":160,"caption":"","height":160});
															thumbnails[6062583] = clik.newPhoto({"id":6062583,"src":"Lamps_Colours1_thumb.jpg","galleries_id":478168,"server_id":5,"link":"photo_6062583.html","width":130,"caption":"","height":184});
															thumbnails[8208874] = clik.newPhoto({"id":8208874,"src":"album4_thumb.jpg","galleries_id":462707,"server_id":5,"link":"photo_8208874.html","width":160,"caption":"","height":160});
															thumbnails[8757092] = clik.newPhoto({"id":8757092,"src":"Verso_thumb.jpg","galleries_id":462707,"server_id":5,"link":"photo_8757092.html","width":160,"caption":"","height":160});
															thumbnails[8951969] = clik.newPhoto({"id":8951969,"src":"MushMrBlazey_thumb.jpg","galleries_id":462707,"server_id":5,"link":"photo_8951969.html","width":160,"caption":"","height":160});
															thumbnails[6473628] = clik.newPhoto({"id":6473628,"src":"pennine_way_companion_thumb.jpg","galleries_id":465869,"server_id":5,"link":"photo_6473628.html","width":130,"caption":"","height":173});
															thumbnails[6473632] = clik.newPhoto({"id":6473632,"src":"southern_fells_thumb.jpg","galleries_id":465869,"server_id":5,"link":"photo_6473632.html","width":120,"caption":"","height":160});
															thumbnails[6473625] = clik.newPhoto({"id":6473625,"src":"nothern_fells_thumb.jpg","galleries_id":465869,"server_id":5,"link":"photo_6473625.html","width":130,"caption":"","height":173});
															thumbnails[6062450] = clik.newPhoto({"id":6062450,"src":"Towers_thumb.jpg","galleries_id":319237,"server_id":5,"link":"photo_6062450.html","width":130,"caption":"","height":180});
															thumbnails[6473634] = clik.newPhoto({"id":6473634,"src":"Series_thumb.jpg","galleries_id":465869,"server_id":5,"link":"photo_6473634.html","width":130,"caption":"","height":174});
															thumbnails[6062377] = clik.newPhoto({"id":6062377,"src":"Bubbles_thumb.jpg","galleries_id":319237,"server_id":5,"link":"photo_6062377.html","width":130,"caption":"","height":216});
															thumbnails[6062392] = clik.newPhoto({"id":6062392,"src":"Half_Egg_thumb.jpg","galleries_id":319237,"server_id":5,"link":"photo_6062392.html","width":130,"caption":"","height":174});
															thumbnails[6062390] = clik.newPhoto({"id":6062390,"src":"Orange_and_Black1_thumb.jpg","galleries_id":319237,"server_id":5,"link":"photo_6062390.html","width":130,"caption":"","height":94});
															thumbnails[6062375] = clik.newPhoto({"id":6062375,"src":"Black_Card_thumb.jpg","galleries_id":319237,"server_id":5,"link":"photo_6062375.html","width":130,"caption":"","height":89});
															thumbnails[6062376] = clik.newPhoto({"id":6062376,"src":"Black_Jellyfish_thumb.jpg","galleries_id":319237,"server_id":5,"link":"photo_6062376.html","width":130,"caption":"","height":359});
															thumbnails[6062567] = clik.newPhoto({"id":6062567,"src":"Wiggles_2_thumb.jpg","galleries_id":319237,"server_id":5,"link":"photo_6062567.html","width":130,"caption":"","height":184});
															thumbnails[6062576] = clik.newPhoto({"id":6062576,"src":"Wiggles_12_thumb.jpg","galleries_id":319237,"server_id":5,"link":"photo_6062576.html","width":130,"caption":"","height":184});
															thumbnails[6062398] = clik.newPhoto({"id":6062398,"src":"Triangle_Bunting_thumb.jpg","galleries_id":319237,"server_id":5,"link":"photo_6062398.html","width":130,"caption":"","height":218});
															thumbnails[6062391] = clik.newPhoto({"id":6062391,"src":"Inside_Diamonds_thumb.jpg","galleries_id":319237,"server_id":5,"link":"photo_6062391.html","width":130,"caption":"","height":306});
															thumbnails[6062389] = clik.newPhoto({"id":6062389,"src":"Diamond_Stripes_thumb.jpg","galleries_id":319237,"server_id":5,"link":"photo_6062389.html","width":130,"caption":"","height":313});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[437908] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"S G P . 2 0 1 1","link":"gallery_437908.html","maxRecords":0.0,"photoIDs":[8208885.0,8208897.0,8208900.0,8208901.0,8208908.0,8208909.0,8208916.0,8208918.0,8208924.0],"skipIndex":0,"section_code":"gallery","featured_images":8208900.0,"id":437908,"singleSection":false});				  						galleries[462707] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"T R I P T I K","link":"gallery_462707.html","maxRecords":0.0,"photoIDs":[8790470.0,8208863.0,8208875.0,8208874.0,8757092.0,8951969.0],"skipIndex":0,"section_code":"gallery","featured_images":"8951969,8757092,8208874,8208863","id":462707,"singleSection":false});				  						galleries[478166] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"N E B E E S","link":"gallery_478166.html","maxRecords":0.0,"photoIDs":[8951972.0,9066720.0],"skipIndex":0,"section_code":"gallery","featured_images":8951972.0,"id":478166,"singleSection":false});				  						galleries[478167] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"M E S R I N E . M U S I Q U E","link":"gallery_478167.html","maxRecords":0.0,"photoIDs":[9066727.0,8859276.0],"skipIndex":0,"section_code":"gallery","featured_images":8859276.0,"id":478167,"singleSection":false});				  						galleries[362075] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"M I S C","link":"gallery_362075.html","maxRecords":0.0,"photoIDs":[8872074.0,8872076.0],"skipIndex":0,"section_code":"gallery","featured_images":"8872076,8872074","id":362075,"singleSection":false});				  						galleries[438012] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"B O L I N G B R O K E . S T U D I O","link":"gallery_438012.html","maxRecords":0.0,"photoIDs":[8211532.0,8211540.0,8211547.0,8211557.0,8211559.0,8211564.0],"skipIndex":0,"section_code":"gallery","featured_images":8211559.0,"id":438012,"singleSection":false});				  						galleries[319237] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"P R I N T ","link":"gallery_319237.html","maxRecords":0.0,"photoIDs":[7639045.0,7639058.0,7639063.0,6062450.0,6062377.0,6062392.0,6062390.0,6062375.0,6062376.0,6062567.0,6062576.0,6062398.0,6062391.0,6062389.0],"skipIndex":0,"section_code":"gallery","featured_images":"6062390,6062376","id":319237,"singleSection":false});				  						galleries[465869] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"A . W A I N W R I G H T","link":"gallery_465869.html","maxRecords":0.0,"photoIDs":[6473628.0,6473632.0,6473625.0,6473634.0],"skipIndex":0,"section_code":"gallery","featured_images":"6473632,6473628","id":465869,"singleSection":false});				  						galleries[478168] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"L I G H T","link":"gallery_478168.html","maxRecords":0.0,"photoIDs":[6065122.0,8213237.0,6065251.0,8213241.0,6062589.0,6062583.0],"skipIndex":0,"section_code":"gallery","featured_images":"8213237,6065251","id":478168,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '9095848,9095847,9065886';
imageSets[2] = '8951972,8211559,8208900,8213237,8859276,8208863,6065251,8208874,8757092,8951969,6473628,6473632,6062390,6062376';
imageSets[3] = '9095848,9095847,9066727,9066720,9065886,8951972,8951969,8872076,8872074,8859276,8790470,8757092,8213241,8213237,8211564,8211559,8211557,8211547,8211540,8211532,8208924,8208918,8208916,8208909,8208908,8208901,8208900,8208897,8208885,8208875,8208874,8208863,7639063,7639058,7639045,6473634,6473632,6473628,6473625,6065251,6065122,6062589,6062583,6062576,6062567,6062450,6062398,6062392,6062391,6062390';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/madeleineritchie/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/madeleineritchie/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/madeleineritchie/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/madeleineritchie/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/madeleineritchie/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/madeleineritchie/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/madeleineritchie/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/madeleineritchie/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/madeleineritchie/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/madeleineritchie/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/madeleineritchie/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/madeleineritchie/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/madeleineritchie/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/madeleineritchie/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/madeleineritchie/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/madeleineritchie/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/madeleineritchie/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/madeleineritchie/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/madeleineritchie/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/madeleineritchie/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/madeleineritchie/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/madeleineritchie/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/madeleineritchie/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/madeleineritchie/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/madeleineritchie/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/madeleineritchie/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/madeleineritchie/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 = 'Madeleine Ritchie : ' + 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;
	}
}

			

