window.thumbnails = {};
															thumbnails[6736417] = clik.newPhoto({"id":6736417,"src":"NH_Birds500_thumb.jpg","galleries_id":435391,"server_id":5,"link":"photo_6736417.html","width":130,"caption":"","height":118});
															thumbnails[8133160] = clik.newPhoto({"id":8133160,"src":"Red-flowers_thumb.jpg","galleries_id":435390,"server_id":5,"link":"photo_8133160.html","width":130,"caption":"","height":119});
															thumbnails[8158297] = clik.newPhoto({"id":8158297,"src":"Ocean-Bouy_thumb.jpg","galleries_id":435390,"server_id":5,"link":"photo_8158297.html","width":130,"caption":"","height":119});
															thumbnails[8964536] = clik.newPhoto({"id":8964536,"src":"Bathing-Huts_thumb.jpg","galleries_id":435383,"server_id":5,"link":"photo_8964536.html","width":130,"caption":"","height":189});
															thumbnails[9084508] = clik.newPhoto({"id":9084508,"src":"Winter-woodland_1_thumb.jpg","galleries_id":435390,"server_id":5,"link":"photo_9084508.html","width":130,"caption":"","height":151});
															thumbnails[9084512] = clik.newPhoto({"id":9084512,"src":"Umbrellas_1_thumb.jpg","galleries_id":435390,"server_id":5,"link":"photo_9084512.html","width":130,"caption":"","height":108});
															thumbnails[9084529] = clik.newPhoto({"id":9084529,"src":"Pattern-tree_1_thumb.jpg","galleries_id":435390,"server_id":5,"link":"photo_9084529.html","width":130,"caption":"","height":163});
															thumbnails[7327049] = clik.newPhoto({"id":7327049,"src":"Bottles_thumb.jpg","galleries_id":435383,"server_id":5,"link":"photo_7327049.html","width":130,"caption":"","height":107});
															thumbnails[7304329] = clik.newPhoto({"id":7304329,"src":"Into_the_sunshine_thumb.jpg","galleries_id":435388,"server_id":5,"link":"photo_7304329.html","width":130,"caption":"INTO THE SUNSHINE","height":111});
															thumbnails[8005610] = clik.newPhoto({"id":8005610,"src":"Pencils_thumb.jpg","galleries_id":435388,"server_id":5,"link":"photo_8005610.html","width":130,"caption":"PENCILS","height":140});
															thumbnails[7311363] = clik.newPhoto({"id":7311363,"src":"Kaleidoscope_flowers_thumb.jpg","galleries_id":435388,"server_id":5,"link":"photo_7311363.html","width":130,"caption":"KALEIDOSCOPE FLOWERS","height":184});
															thumbnails[8004504] = clik.newPhoto({"id":8004504,"src":"Lino-Blossom-Tree_thumb.jpg","galleries_id":435388,"server_id":5,"link":"photo_8004504.html","width":130,"caption":"BLOSSOM","height":130});
															thumbnails[8005559] = clik.newPhoto({"id":8005559,"src":"Tulips_thumb.jpg","galleries_id":435388,"server_id":5,"link":"photo_8005559.html","width":130,"caption":"TULIPS","height":133});
															thumbnails[8128944] = clik.newPhoto({"id":8128944,"src":"Lino-Forest-Colour_thumb.jpg","galleries_id":435388,"server_id":5,"link":"photo_8128944.html","width":130,"caption":"LINO FOREST","height":130});
															thumbnails[7862403] = clik.newPhoto({"id":7862403,"src":"Lanterns_thumb.jpg","galleries_id":435388,"server_id":5,"link":"photo_7862403.html","width":130,"caption":"LANTERNS","height":181});
															thumbnails[7862405] = clik.newPhoto({"id":7862405,"src":"Sweetie_thumb.jpg","galleries_id":435388,"server_id":5,"link":"photo_7862405.html","width":130,"caption":"SWEETIE Postcard","height":181});
															thumbnails[7544398] = clik.newPhoto({"id":7544398,"src":"Parasol-Linocut1_thumb.jpg","galleries_id":435388,"server_id":5,"link":"photo_7544398.html","width":130,"caption":"PARASOL","height":90});
															thumbnails[7307893] = clik.newPhoto({"id":7307893,"src":"Dove_Christmas_thumb.jpg","galleries_id":435388,"server_id":5,"link":"photo_7307893.html","width":130,"caption":"GIFT OF LOVE","height":130});
															thumbnails[7544397] = clik.newPhoto({"id":7544397,"src":"Lino-flower830_thumb.jpg","galleries_id":435388,"server_id":5,"link":"photo_7544397.html","width":130,"caption":"LINO DECO FLOWER","height":122});
															thumbnails[7311364] = clik.newPhoto({"id":7311364,"src":"Rainbow_thumb.jpg","galleries_id":435388,"server_id":5,"link":"photo_7311364.html","width":130,"caption":"RAINBOW","height":183});
															thumbnails[7333914] = clik.newPhoto({"id":7333914,"src":"Garden_thumb.jpg","galleries_id":435388,"server_id":5,"link":"photo_7333914.html","width":130,"caption":"","height":99});
															thumbnails[6737490] = clik.newPhoto({"id":6737490,"src":"Lino_trees2_thumb.jpg","galleries_id":435388,"server_id":5,"link":"photo_6737490.html","width":130,"caption":"","height":130});
															thumbnails[7333926] = clik.newPhoto({"id":7333926,"src":"Bunting_thumb.jpg","galleries_id":435388,"server_id":5,"link":"photo_7333926.html","width":130,"caption":"PARTY","height":187});
															thumbnails[7307895] = clik.newPhoto({"id":7307895,"src":"Cheery_flowers1_thumb.jpg","galleries_id":435388,"server_id":5,"link":"photo_7307895.html","width":130,"caption":"","height":130});
															thumbnails[6847622] = clik.newPhoto({"id":6847622,"src":"Den_in_the_pines1_thumb.jpg","galleries_id":435391,"server_id":5,"link":"photo_6847622.html","width":130,"caption":"DEN IN THE PINES","height":120});
															thumbnails[7786619] = clik.newPhoto({"id":7786619,"src":"Lino_anem_patt_thumb.jpg","galleries_id":435388,"server_id":5,"link":"photo_7786619.html","width":130,"caption":"","height":130});
															thumbnails[7333915] = clik.newPhoto({"id":7333915,"src":"Butterfly_lines_thumb.jpg","galleries_id":435388,"server_id":5,"link":"photo_7333915.html","width":130,"caption":"","height":92});
															thumbnails[6816016] = clik.newPhoto({"id":6816016,"src":"Horses500_thumb.jpg","galleries_id":435383,"server_id":5,"link":"photo_6816016.html","width":130,"caption":"TOY HORSE","height":125});
															thumbnails[8129750] = clik.newPhoto({"id":8129750,"src":"Toy-horse_thumb.jpg","galleries_id":435390,"server_id":5,"link":"photo_8129750.html","width":130,"caption":"","height":120});
															thumbnails[8012735] = clik.newPhoto({"id":8012735,"src":"At-sea_thumb.jpg","galleries_id":435383,"server_id":5,"link":"photo_8012735.html","width":130,"caption":"AT SEA","height":131});
															thumbnails[8012737] = clik.newPhoto({"id":8012737,"src":"Sea-bathing_thumb.jpg","galleries_id":435383,"server_id":5,"link":"photo_8012737.html","width":130,"caption":"SEA BATHING AT SOUTHBOURNE","height":99});
															thumbnails[8133040] = clik.newPhoto({"id":8133040,"src":"Olive-Oil_thumb.jpg","galleries_id":435383,"server_id":5,"link":"photo_8133040.html","width":130,"caption":"","height":170});
															thumbnails[8133096] = clik.newPhoto({"id":8133096,"src":"Town_thumb.jpg","galleries_id":435390,"server_id":5,"link":"photo_8133096.html","width":130,"caption":"","height":150});
															thumbnails[9089932] = clik.newPhoto({"id":9089932,"src":"Pin-cushion2_1_thumb.jpg","galleries_id":435390,"server_id":5,"link":"photo_9089932.html","width":130,"caption":"","height":121});
															thumbnails[8133098] = clik.newPhoto({"id":8133098,"src":"Sunflowers_thumb.jpg","galleries_id":435390,"server_id":5,"link":"photo_8133098.html","width":130,"caption":"SUNFLOWERS","height":133});
															thumbnails[8133262] = clik.newPhoto({"id":8133262,"src":"Tulip-circle_thumb.jpg","galleries_id":435390,"server_id":5,"link":"photo_8133262.html","width":130,"caption":"","height":128});
															thumbnails[8133099] = clik.newPhoto({"id":8133099,"src":"Nightingale-Forest_thumb.jpg","galleries_id":435390,"server_id":5,"link":"photo_8133099.html","width":130,"caption":"NIGHTINGALE","height":105});
															thumbnails[6736620] = clik.newPhoto({"id":6736620,"src":"3Birds_in_a_wood1_thumb.jpg","galleries_id":435391,"server_id":5,"link":"photo_6736620.html","width":130,"caption":"","height":112});
															thumbnails[6736382] = clik.newPhoto({"id":6736382,"src":"Decorated_branch_thumb.jpg","galleries_id":435391,"server_id":5,"link":"photo_6736382.html","width":130,"caption":"","height":151});
															thumbnails[6815089] = clik.newPhoto({"id":6815089,"src":"Doodle_mouse500_thumb.jpg","galleries_id":435391,"server_id":5,"link":"photo_6815089.html","width":130,"caption":"DOODLE'S TREEHOUSE","height":184});
															thumbnails[6736392] = clik.newPhoto({"id":6736392,"src":"Folky_circles_print_thumb.jpg","galleries_id":435391,"server_id":5,"link":"photo_6736392.html","width":130,"caption":"","height":169});
															thumbnails[6729951] = clik.newPhoto({"id":6729951,"src":"NH_Elephants500_thumb.jpg","galleries_id":435391,"server_id":5,"link":"photo_6729951.html","width":130,"caption":"","height":133});
															thumbnails[6736557] = clik.newPhoto({"id":6736557,"src":"Birds_and_tree_thumb.jpg","galleries_id":435391,"server_id":5,"link":"photo_6736557.html","width":130,"caption":"","height":132});
															thumbnails[6736452] = clik.newPhoto({"id":6736452,"src":"Waterfall_thumb.jpg","galleries_id":435391,"server_id":5,"link":"photo_6736452.html","width":130,"caption":"","height":164});
															thumbnails[6737483] = clik.newPhoto({"id":6737483,"src":"Hanging_pattern_thumb.jpg","galleries_id":435391,"server_id":5,"link":"photo_6737483.html","width":130,"caption":"","height":162});
															thumbnails[6737164] = clik.newPhoto({"id":6737164,"src":"Doodle-towers-clr_thumb.jpg","galleries_id":435391,"server_id":5,"link":"photo_6737164.html","width":130,"caption":"TOWERS OF THE WORLD","height":126});
															thumbnails[6736630] = clik.newPhoto({"id":6736630,"src":"Det_flwrs_thumb.jpg","galleries_id":435391,"server_id":5,"link":"photo_6736630.html","width":130,"caption":"","height":123});
															thumbnails[6736498] = clik.newPhoto({"id":6736498,"src":"Cotton_reels_print_thumb.jpg","galleries_id":435383,"server_id":5,"link":"photo_6736498.html","width":130,"caption":"","height":132});
															thumbnails[6729999] = clik.newPhoto({"id":6729999,"src":"Seashells500_thumb.jpg","galleries_id":435383,"server_id":5,"link":"photo_6729999.html","width":130,"caption":"SEASHELLS","height":111});
															thumbnails[6815069] = clik.newPhoto({"id":6815069,"src":"NHTea-Party-Macaroons_thumb.jpg","galleries_id":435383,"server_id":5,"link":"photo_6815069.html","width":130,"caption":"MACAROONS","height":131});
															thumbnails[6736426] = clik.newPhoto({"id":6736426,"src":"Ink-and-flower_thumb.jpg","galleries_id":435390,"server_id":5,"link":"photo_6736426.html","width":130,"caption":"","height":175});
															thumbnails[8092951] = clik.newPhoto({"id":8092951,"src":"Pastel-gouache-flwr_thumb.jpg","galleries_id":435390,"server_id":5,"link":"photo_8092951.html","width":130,"caption":"","height":138});
															thumbnails[8092956] = clik.newPhoto({"id":8092956,"src":"Peach-blossom_thumb.jpg","galleries_id":435390,"server_id":5,"link":"photo_8092956.html","width":130,"caption":"PEACH BLOSSOM","height":128});
															thumbnails[9136451] = clik.newPhoto({"id":9136451,"src":"NH-postcard-mug_1_thumb.jpg","galleries_id":435383,"server_id":5,"link":"photo_9136451.html","width":130,"caption":"","height":188});
															thumbnails[7853784] = clik.newPhoto({"id":7853784,"src":"Lino-butterflies-small_thumb.jpg","galleries_id":435383,"server_id":5,"link":"photo_7853784.html","width":130,"caption":"","height":183});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[435383] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"BUTTON TIN","link":"gallery_435383.html","maxRecords":0.0,"photoIDs":[8964536.0,7327049.0,6816016.0,8012735.0,8012737.0,8133040.0,6736498.0,6729999.0,6815069.0,9136451.0,7853784.0],"skipIndex":0,"section_code":"gallery","featured_images":"9136451,8964536,8133040,8012737,8012735,7853784,7327049,6816016,6815069,6736498","id":435383,"singleSection":false});				  						galleries[435391] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"DOODLE LAND","link":"gallery_435391.html","maxRecords":0.0,"photoIDs":[6736417.0,6847622.0,6736620.0,6736382.0,6815089.0,6736392.0,6729951.0,6736557.0,6736452.0,6737483.0,6737164.0,6736630.0],"skipIndex":0,"section_code":"gallery","featured_images":"6847622,6815089,6737483,6737164,6736630,6736620,6736557,6736452,6736417,6736392","id":435391,"singleSection":false});				  						galleries[435388] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"KALEIDOSCOPE","link":"gallery_435388.html","maxRecords":0.0,"photoIDs":[7304329.0,8005610.0,7311363.0,8004504.0,8005559.0,8128944.0,7862403.0,7862405.0,7544398.0,7307893.0,7544397.0,7311364.0,7333914.0,6737490.0,7333926.0,7307895.0,7786619.0,7333915.0],"skipIndex":0,"section_code":"gallery","featured_images":"8128944,8005610,8005559,8004504,7862405,7862403,7786619,7544398,7544397,7333926","id":435388,"singleSection":false});				  						galleries[435390] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"PAINTBOX","link":"gallery_435390.html","maxRecords":0.0,"photoIDs":[8133160.0,8158297.0,9084508.0,9084512.0,9084529.0,8129750.0,8133096.0,9089932.0,8133098.0,8133262.0,8133099.0,6736426.0,8092951.0,8092956.0],"skipIndex":0,"section_code":"gallery","featured_images":"9089932,9084529,9084512,9084508,8158297,8133262,8133160,8133099,8133098,8133096","id":435390,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '9136451,9089932,9084529,9084512,9084508,8964536,8158297,8133262,8133160,8133099,8133098,8133096,8133040,8129750,8128944,8092956,8092951,8012737,8012735,8005610,8005559,8004504,7862405,7862403,7853784,7786619,7544398,7544397,7333926,7333915,7333914,7327049,7311364,7311363,7307895,7307893,7304329,6847622,6816016,6815089,6815069,6737490,6737483,6737164,6736630,6736620,6736557,6736498,6736452,6736426';
imageSets[3] = '9136451,9089932,9084529,9084512,9084508,8964536,8158297,8133262,8133160,8133099,8133098,8133096,8133040,8129750,8128944,8092956,8092951,8012737,8012735,8005610,8005559,8004504,7862405,7862403,7853784,7786619,7544398,7544397,7333926,7333915,7333914,7327049,7311364,7311363,7307895,7307893,7304329,6847622,6816016,6815089,6815069,6737490,6737483,6737164,6736630,6736620,6736557,6736498,6736452,6736426';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/NinaHutton/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/NinaHutton/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/NinaHutton/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/NinaHutton/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/NinaHutton/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/NinaHutton/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/NinaHutton/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/NinaHutton/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/NinaHutton/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/NinaHutton/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/NinaHutton/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/NinaHutton/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/NinaHutton/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/NinaHutton/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/NinaHutton/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/NinaHutton/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/NinaHutton/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/NinaHutton/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/NinaHutton/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/NinaHutton/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/NinaHutton/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/NinaHutton/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/NinaHutton/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/NinaHutton/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/NinaHutton/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/NinaHutton/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/NinaHutton/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 = 'Nina Hutton: ' + 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;
	}
}

			

