window.thumbnails = {};
															thumbnails[5633982] = clik.newPhoto({"id":5633982,"src":"sitw02_thumb.JPG","galleries_id":319428,"server_id":5,"link":"photo_5633982.html","width":130,"caption":"Memories of Scilly (SOLD)","height":96});
															thumbnails[7048133] = clik.newPhoto({"id":7048133,"src":"sparkling-sea_thumb.gif","galleries_id":319428,"server_id":5,"link":"photo_7048133.html","width":130,"caption":"Sparkling sea","height":98});
															thumbnails[8318598] = clik.newPhoto({"id":8318598,"src":"castle_lodge_garden-web_thumb.jpg","galleries_id":346806,"server_id":5,"link":"photo_8318598.html","width":130,"caption":"CASTLE LODGE GARDEN ","height":176});
															thumbnails[9175999] = clik.newPhoto({"id":9175999,"src":"when_the_snow_lay_all_about2_1_thumb.jpg","galleries_id":469116,"server_id":5,"link":"photo_9175999.html","width":130,"caption":"When the snow lay all about","height":63});
															thumbnails[6258599] = clik.newPhoto({"id":6258599,"src":"downland-pathweb_thumb.jpg","galleries_id":469116,"server_id":5,"link":"photo_6258599.html","width":130,"caption":"DOWNLAND PATH","height":175});
															thumbnails[8365074] = clik.newPhoto({"id":8365074,"src":"view-from-racecourse-web_thumb.gif","galleries_id":381602,"server_id":5,"link":"photo_8365074.html","width":130,"caption":"LIGHT OVER DOWNS (sold)","height":96});
															thumbnails[5634689] = clik.newPhoto({"id":5634689,"src":"openspace04_thumb.JPG","galleries_id":319428,"server_id":5,"link":"photo_5634689.html","width":130,"caption":"Snowscape - South Downs (SOLD)","height":98});
															thumbnails[8318613] = clik.newPhoto({"id":8318613,"src":"castle_lodge_roses1-web_thumb.jpg","galleries_id":346806,"server_id":5,"link":"photo_8318613.html","width":130,"caption":"Summer in Castle Lodge garden","height":177});
															thumbnails[5632721] = clik.newPhoto({"id":5632721,"src":"bosham-web_thumb.jpg","galleries_id":319427,"server_id":5,"link":"photo_5632721.html","width":130,"caption":"Sunlight at low tide - Bosham harbour.","height":98});
															thumbnails[6258591] = clik.newPhoto({"id":6258591,"src":"railway-land-web_thumb.jpg","galleries_id":469116,"server_id":5,"link":"photo_6258591.html","width":130,"caption":"PATH IN RAILWAY LAND (sold)","height":173});
															thumbnails[7048118] = clik.newPhoto({"id":7048118,"src":"waterlilies_thumb.gif","galleries_id":319427,"server_id":5,"link":"photo_7048118.html","width":130,"caption":"Waterlilies","height":93});
															thumbnails[8738249] = clik.newPhoto({"id":8738249,"src":"autumn_on_the_downs_thumb.jpg","galleries_id":469116,"server_id":5,"link":"photo_8738249.html","width":130,"caption":"PATH TO LANDPORT BOTTOM","height":175});
															thumbnails[7048130] = clik.newPhoto({"id":7048130,"src":"misty-dawn_thumb.gif","galleries_id":319428,"server_id":5,"link":"photo_7048130.html","width":130,"caption":"Misty dawn on gallops","height":170});
															thumbnails[8321597] = clik.newPhoto({"id":8321597,"src":"path_with_cow_parley_and_shade-web_thumb.jpg","galleries_id":469116,"server_id":5,"link":"photo_8321597.html","width":130,"caption":"SHADY PATH (sold)","height":101});
															thumbnails[8321603] = clik.newPhoto({"id":8321603,"src":"delphiniums-web_thumb.jpg","galleries_id":346806,"server_id":5,"link":"photo_8321603.html","width":130,"caption":"Delphiniums","height":173});
															thumbnails[5778652] = clik.newPhoto({"id":5778652,"src":"website_bosham_harbour_thumb.JPG","galleries_id":319427,"server_id":5,"link":"photo_5778652.html","width":130,"caption":"Bosham harbour at low tide","height":101});
															thumbnails[6320531] = clik.newPhoto({"id":6320531,"src":"misty-morning_thumb.jpg","galleries_id":469116,"server_id":5,"link":"photo_6320531.html","width":130,"caption":"MISTY MORNING (sold)","height":86});
															thumbnails[6412161] = clik.newPhoto({"id":6412161,"src":"view-from-landport-bottom-w_thumb.jpg","galleries_id":381602,"server_id":5,"link":"photo_6412161.html","width":130,"caption":"CLOUDS OVER WEALD (sold)","height":173});
															thumbnails[8321886] = clik.newPhoto({"id":8321886,"src":"september_meadow-web_thumb.jpg","galleries_id":381604,"server_id":5,"link":"photo_8321886.html","width":130,"caption":"SEPTEMBER MEADOW (sold)","height":201});
															thumbnails[8738254] = clik.newPhoto({"id":8738254,"src":"nightime_in_railway_lands_thumb.jpg","galleries_id":381597,"server_id":5,"link":"photo_8738254.html","width":130,"caption":"NIGHT-TIME IN RAILWAY LANDS","height":176});
															thumbnails[5633953] = clik.newPhoto({"id":5633953,"src":"openspace02_thumb.JPG","galleries_id":381604,"server_id":5,"link":"photo_5633953.html","width":130,"caption":"SUMMER SUNSET OVER DOWNS (sold)","height":177});
															thumbnails[7456413] = clik.newPhoto({"id":7456413,"src":"website_tree_in_snow_thumb.jpg","galleries_id":381602,"server_id":5,"link":"photo_7456413.html","width":130,"caption":"SNOW ON SOUTH DOWNS ","height":92});
															thumbnails[8321608] = clik.newPhoto({"id":8321608,"src":"rrailway_land_flowers4-web_thumb.jpg","galleries_id":381597,"server_id":5,"link":"photo_8321608.html","width":130,"caption":"Railway Land Flowers","height":175});
															thumbnails[8738267] = clik.newPhoto({"id":8738267,"src":"path_through_cow_parsley_thumb.jpg","galleries_id":346806,"server_id":5,"link":"photo_8738267.html","width":130,"caption":"Path through cow parsley.","height":96});
															thumbnails[5632718] = clik.newPhoto({"id":5632718,"src":"sheffield_park_thumb.JPG","galleries_id":319427,"server_id":5,"link":"photo_5632718.html","width":130,"caption":"Autumn reflections. (SOLD)","height":111});
															thumbnails[5633830] = clik.newPhoto({"id":5633830,"src":"openspace01_thumb.JPG","galleries_id":319428,"server_id":5,"link":"photo_5633830.html","width":130,"caption":"Soaring cumulus clouds over the Downs.","height":173});
															thumbnails[8318618] = clik.newPhoto({"id":8318618,"src":"winter_at_Houndean_Bottom_thumb.jpg","galleries_id":469116,"server_id":5,"link":"photo_8318618.html","width":130,"caption":"WINTER AT HOUNDEAN BOTTOM (sold)","height":119});
															thumbnails[8322056] = clik.newPhoto({"id":8322056,"src":"rainbow3-web1_thumb.jpg","galleries_id":381604,"server_id":5,"link":"photo_8322056.html","width":130,"caption":"RAINBOW OVER DOWNS","height":180});
															thumbnails[5633973] = clik.newPhoto({"id":5633973,"src":"openspace03_thumb.JPG","galleries_id":319428,"server_id":5,"link":"photo_5633973.html","width":130,"caption":"Clouds from airplane window.","height":152});
															thumbnails[6258605] = clik.newPhoto({"id":6258605,"src":"shady-pathweb_thumb.jpg","galleries_id":469116,"server_id":5,"link":"photo_6258605.html","width":130,"caption":"SHADY PATH (sold)","height":97});
															thumbnails[8738270] = clik.newPhoto({"id":8738270,"src":"sunset_reflections_thumb.jpg","galleries_id":381604,"server_id":5,"link":"photo_8738270.html","width":130,"caption":"SUNSET OVER LAKE","height":96});
															thumbnails[7048223] = clik.newPhoto({"id":7048223,"src":"peacock-butterfly-in-railwa_thumb.gif","galleries_id":381597,"server_id":5,"link":"photo_7048223.html","width":130,"caption":"Peacock butterfly (SOLD)","height":122});
															thumbnails[7048187] = clik.newPhoto({"id":7048187,"src":"monarch-butterfly-in-railwa1_thumb.gif","galleries_id":381597,"server_id":5,"link":"photo_7048187.html","width":130,"caption":"Red Admiral butterfly (SOLD)","height":129});
															thumbnails[5632727] = clik.newPhoto({"id":5632727,"src":"stillwaters03_thumb.JPG","galleries_id":319427,"server_id":5,"link":"photo_5632727.html","width":130,"caption":"Frosty and still morning","height":96});
															thumbnails[8318607] = clik.newPhoto({"id":8318607,"src":"trees_in_autumn-web_thumb.jpg","galleries_id":346806,"server_id":5,"link":"photo_8318607.html","width":130,"caption":"Autumn in Nymans Woods","height":173});
															thumbnails[7048095] = clik.newPhoto({"id":7048095,"src":"railway-land-pond-with-flow_thumb.gif","galleries_id":381597,"server_id":5,"link":"photo_7048095.html","width":130,"caption":"Railway land pond","height":98});
															thumbnails[5777435] = clik.newPhoto({"id":5777435,"src":"website_open_space_meadow_thumb.JPG","galleries_id":381604,"server_id":5,"link":"photo_5777435.html","width":130,"caption":"SUNLIT MEADOW (sold)","height":98});
															thumbnails[5778624] = clik.newPhoto({"id":5778624,"src":"website_open_space_sunset_thumb.JPG","galleries_id":381604,"server_id":5,"link":"photo_5778624.html","width":130,"caption":"SUMMER SUNSET (sold)","height":101});
															thumbnails[5778684] = clik.newPhoto({"id":5778684,"src":"website_tropical_beach_thumb.JPG","galleries_id":319428,"server_id":5,"link":"photo_5778684.html","width":130,"caption":"Tropical beach","height":96});
															thumbnails[6258610] = clik.newPhoto({"id":6258610,"src":"bluebell-wood-web_thumb.jpg","galleries_id":346806,"server_id":5,"link":"photo_6258610.html","width":130,"caption":"Bluebell wood.","height":127});
															thumbnails[6320538] = clik.newPhoto({"id":6320538,"src":"flowers-in-water_thumb.jpg","galleries_id":381597,"server_id":5,"link":"photo_6320538.html","width":130,"caption":"Floating flowers.","height":129});
															thumbnails[5634694] = clik.newPhoto({"id":5634694,"src":"stillwaters04_thumb.JPG","galleries_id":319427,"server_id":5,"link":"photo_5634694.html","width":130,"caption":"Still waters. (SOLD)","height":184});
															thumbnails[5777459] = clik.newPhoto({"id":5777459,"src":"website_empty_beach_thumb.jpg","galleries_id":319428,"server_id":5,"link":"photo_5777459.html","width":130,"caption":"Empty beach","height":99});
															thumbnails[5778632] = clik.newPhoto({"id":5778632,"src":"windswept-beach1_thumb.jpg","galleries_id":319428,"server_id":5,"link":"photo_5778632.html","width":130,"caption":"Study - windswept beach. ","height":130});
															thumbnails[5778715] = clik.newPhoto({"id":5778715,"src":"website_turquoise_sea_thumb.JPG","galleries_id":319428,"server_id":5,"link":"photo_5778715.html","width":130,"caption":"Calm turquoise sea.","height":173});
															thumbnails[8321708] = clik.newPhoto({"id":8321708,"src":"flax_on_downs-web_thumb.jpg","galleries_id":381602,"server_id":5,"link":"photo_8321708.html","width":130,"caption":"FLAX ON SOUTH DOWNS","height":130});
															thumbnails[5777443] = clik.newPhoto({"id":5777443,"src":"website_large_still_water_cockshut_thumb.JPG","galleries_id":319427,"server_id":5,"link":"photo_5777443.html","width":130,"caption":"Frosty winter morning and still deep blue water.","height":91});
															thumbnails[5778704] = clik.newPhoto({"id":5778704,"src":"website_still_waters_green_thumb.JPG","galleries_id":319427,"server_id":5,"link":"photo_5778704.html","width":130,"caption":"Still waters - height of summer","height":129});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[346806] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Sussex parks, gardens and woodland","link":"gallery_346806.html","maxRecords":0.0,"photoIDs":[8318598.0,8318613.0,8321603.0,8738267.0,8318607.0,6258610.0],"skipIndex":0,"section_code":"gallery","featured_images":"8738267,8318613,8318598","id":346806,"singleSection":false});				  						galleries[381604] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Sunset and sunrise","link":"gallery_381604.html","maxRecords":0.0,"photoIDs":[8321886.0,5633953.0,8322056.0,8738270.0,5777435.0,5778624.0],"skipIndex":0,"section_code":"gallery","featured_images":"8738270,8322056","id":381604,"singleSection":false});				  						galleries[469116] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Downland Paths","link":"gallery_469116.html","maxRecords":0.0,"photoIDs":[9175999.0,6258599.0,6258591.0,8738249.0,8321597.0,6320531.0,8318618.0,6258605.0],"skipIndex":0,"section_code":"gallery","featured_images":"9175999,8738249,8321597,6320531,6258605,6258599,6258591","id":469116,"singleSection":false});				  						galleries[381602] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"South Downs around Lewes","link":"gallery_381602.html","maxRecords":0.0,"photoIDs":[8365074.0,6412161.0,7456413.0,8321708.0],"skipIndex":0,"section_code":"gallery","featured_images":"7456413,6412161","id":381602,"singleSection":false});				  						galleries[381597] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Lewes Railway Land","link":"gallery_381597.html","maxRecords":0.0,"photoIDs":[8738254.0,8321608.0,7048223.0,7048187.0,7048095.0,6320538.0],"skipIndex":0,"section_code":"gallery","featured_images":"8738254,7048223,7048187,7048095","id":381597,"singleSection":false});				  						galleries[319427] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Still waters","link":"gallery_319427.html","maxRecords":0.0,"photoIDs":[5632721.0,7048118.0,5778652.0,5632718.0,5632727.0,5634694.0,5777443.0,5778704.0],"skipIndex":0,"section_code":"gallery","featured_images":"7048118,5778704,5632718","id":319427,"singleSection":false});				  						galleries[319428] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Seascapes and cloudscapes","link":"gallery_319428.html","maxRecords":0.0,"photoIDs":[5633982.0,7048133.0,5634689.0,7048130.0,5633830.0,5633973.0,5778684.0,5777459.0,5778632.0,5778715.0],"skipIndex":0,"section_code":"gallery","featured_images":"7048133,7048130,5634689,5633982,5633973,5633830","id":319428,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '9175999,6258599,8738249,7048118,5632721,8321597,8738254,7456413,8738267,8322056,8738270';
imageSets[2] = '5633982,8318598,7048133,9175999,6258599,8318613,5634689,8738249,7048118,6258591,8321597,7048130,6412161,6320531,8738254,7456413,8738267,5633830,5632718,8322056,8738270,6258605,5633973,7048223,7048187,7048095,5778704';
imageSets[3] = '9175999,8738270,8738267,8738254,8738249,8365074,8322056,8321886,8321708,8321608,8321603,8321597,8318618,8318613,8318607,8318598,7456413,7048223,7048187,7048133,7048130,7048118,7048095,6412161,6320538,6320531,6258610,6258605,6258599,6258591,5778715,5778704,5778684,5778652,5778632,5778624,5777459,5777443,5777435,5634694,5634689,5633982,5633973,5633953,5633830,5632727,5632721,5632718';
imageSets[241399] = '8318598,9175999,6258599,8318613,8738249,5632721,8738254,8738267,8738270';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/adelegibson/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/adelegibson/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/adelegibson/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/adelegibson/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/adelegibson/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/adelegibson/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/adelegibson/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/adelegibson/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/adelegibson/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/adelegibson/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/adelegibson/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/adelegibson/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/adelegibson/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/adelegibson/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/adelegibson/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/adelegibson/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/adelegibson/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/adelegibson/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/adelegibson/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/adelegibson/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/adelegibson/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/adelegibson/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/adelegibson/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/adelegibson/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/adelegibson/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/adelegibson/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/adelegibson/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 = 'Adele Gibson Fine Art: ' + 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;
	}
}

			

