window.thumbnails = {};
															thumbnails[9042841] = clik.newPhoto({"id":9042841,"src":"Wast_Water650_thumb.jpg","galleries_id":302828,"server_id":5,"link":"photo_9042841.html","width":130,"caption":"Wast Water","height":86});
															thumbnails[9042849] = clik.newPhoto({"id":9042849,"src":"Bassenthwaite_Lake650_thumb.jpg","galleries_id":302828,"server_id":5,"link":"photo_9042849.html","width":130,"caption":"Bassenthwaite Lake","height":87});
															thumbnails[8556962] = clik.newPhoto({"id":8556962,"src":"Morning_Tide650_thumb.jpg","galleries_id":302829,"server_id":5,"link":"photo_8556962.html","width":130,"caption":"Morning Tide","height":86});
															thumbnails[8556932] = clik.newPhoto({"id":8556932,"src":"Robin_Hoods_Bay_sunrise650_thumb.jpg","galleries_id":302829,"server_id":5,"link":"photo_8556932.html","width":130,"caption":"Robin Hoods Bay sunrise","height":86});
															thumbnails[8556964] = clik.newPhoto({"id":8556964,"src":"Morning_Glory650_thumb.jpg","galleries_id":302829,"server_id":5,"link":"photo_8556964.html","width":130,"caption":"Morning Glory","height":86});
															thumbnails[8556968] = clik.newPhoto({"id":8556968,"src":"In_a_Dream650_thumb.jpg","galleries_id":302829,"server_id":5,"link":"photo_8556968.html","width":130,"caption":"In a dream","height":85});
															thumbnails[7829706] = clik.newPhoto({"id":7829706,"src":"sparrow_hawk_pano_Sepia2_thumb.jpg","galleries_id":421656,"server_id":5,"link":"photo_7829706.html","width":130,"caption":"Sparrow Hawk","height":46});
															thumbnails[7972763] = clik.newPhoto({"id":7972763,"src":"Clematis600_thumb.jpg","galleries_id":411038,"server_id":5,"link":"photo_7972763.html","width":130,"caption":"Clematis","height":86});
															thumbnails[7941821] = clik.newPhoto({"id":7941821,"src":"Porthmeor_Beach600_thumb.jpg","galleries_id":302829,"server_id":5,"link":"photo_7941821.html","width":130,"caption":"Porthmeor Beach","height":87});
															thumbnails[7945021] = clik.newPhoto({"id":7945021,"src":"The_15th_century_Chapel_of_St_Nicholas_600_thumb.jpg","galleries_id":302828,"server_id":5,"link":"photo_7945021.html","width":130,"caption":"St Nicholas Chapel","height":86});
															thumbnails[7839866] = clik.newPhoto({"id":7839866,"src":"Poppie_Head600_thumb.jpg","galleries_id":411038,"server_id":5,"link":"photo_7839866.html","width":130,"caption":"Poppy Head","height":86});
															thumbnails[7802434] = clik.newPhoto({"id":7802434,"src":"Sunset_over_Windgather_Blue_Rocks600_thumb.jpg","galleries_id":302828,"server_id":5,"link":"photo_7802434.html","width":130,"caption":"Sunset over Windgather Rocks","height":86});
															thumbnails[7812691] = clik.newPhoto({"id":7812691,"src":"Carl_Wark_at_dawn650_thumb.jpg","galleries_id":302828,"server_id":5,"link":"photo_7812691.html","width":130,"caption":"Carl Wark at Dawn","height":86});
															thumbnails[7746150] = clik.newPhoto({"id":7746150,"src":"Aquilegia_Grannies_Bonnet_650_thumb.jpg","galleries_id":411038,"server_id":5,"link":"photo_7746150.html","width":130,"caption":"Aquilegia ( Grannies Bonnet )","height":86});
															thumbnails[7746132] = clik.newPhoto({"id":7746132,"src":"Snowden_from_Llynnau_Mymbyr_Lake_print_ready600_thumb.jpg","galleries_id":302828,"server_id":5,"link":"photo_7746132.html","width":130,"caption":"Snowden from Llynnau Mymbyr","height":86});
															thumbnails[7577063] = clik.newPhoto({"id":7577063,"src":"Anenomie2_in_reverse500_thumb.jpg","galleries_id":411038,"server_id":5,"link":"photo_7577063.html","width":130,"caption":"Anemonies","height":195});
															thumbnails[7577074] = clik.newPhoto({"id":7577074,"src":"tulips2_thumb.jpg","galleries_id":411038,"server_id":5,"link":"photo_7577074.html","width":130,"caption":"Tulips","height":87});
															thumbnails[7577095] = clik.newPhoto({"id":7577095,"src":"sunflowerin_seedsquare500_thumb.jpg","galleries_id":411038,"server_id":5,"link":"photo_7577095.html","width":130,"caption":"Sunflower in Seed","height":133});
															thumbnails[7577105] = clik.newPhoto({"id":7577105,"src":"daffs650_thumb.jpg","galleries_id":411038,"server_id":5,"link":"photo_7577105.html","width":130,"caption":"Daffs","height":87});
															thumbnails[7577108] = clik.newPhoto({"id":7577108,"src":"leafinwinterfrostwithout_noise650_thumb.jpg","galleries_id":411038,"server_id":5,"link":"photo_7577108.html","width":130,"caption":"Leaf in Winter Garden","height":90});
															thumbnails[7577126] = clik.newPhoto({"id":7577126,"src":"chrysanthimumsBW500_thumb.jpg","galleries_id":411038,"server_id":5,"link":"photo_7577126.html","width":130,"caption":"Chrysanthemums","height":86});
															thumbnails[7577127] = clik.newPhoto({"id":7577127,"src":"Anemone_with_black_stamen650_thumb.jpg","galleries_id":411038,"server_id":5,"link":"photo_7577127.html","width":130,"caption":"Anemone with Black Stamen","height":86});
															thumbnails[7577167] = clik.newPhoto({"id":7577167,"src":"Lillies_650_thumb.jpg","galleries_id":411038,"server_id":5,"link":"photo_7577167.html","width":130,"caption":"Lillies","height":87});
															thumbnails[7577170] = clik.newPhoto({"id":7577170,"src":"peppers2_650_thumb.jpg","galleries_id":411038,"server_id":5,"link":"photo_7577170.html","width":130,"caption":"Red Pepper","height":90});
															thumbnails[7445318] = clik.newPhoto({"id":7445318,"src":"dusk_on_Arthog_lake_600_thumb.jpg","galleries_id":302828,"server_id":5,"link":"photo_7445318.html","width":130,"caption":"Llynnau Gregennen Lakes","height":87});
															thumbnails[7810010] = clik.newPhoto({"id":7810010,"src":"Arthog_Panorama1080_thumb.jpg","galleries_id":421656,"server_id":5,"link":"photo_7810010.html","width":130,"caption":"","height":54});
															thumbnails[7343274] = clik.newPhoto({"id":7343274,"src":"Higger_Tor_sunrise_darker_sky_600_thumb.jpg","galleries_id":302828,"server_id":5,"link":"photo_7343274.html","width":130,"caption":"Higger Tor Sunrise","height":86});
															thumbnails[7343279] = clik.newPhoto({"id":7343279,"src":"Higger_Tor_with_Carl_Wark_in_View_warmer600_thumb.jpg","galleries_id":302828,"server_id":5,"link":"photo_7343279.html","width":130,"caption":"Higger Tor with Carl Wark in View","height":87});
															thumbnails[7353728] = clik.newPhoto({"id":7353728,"src":"Sunlight_on_Hathersage_Moor_towards_Stanage_Edge600_thumb.jpg","galleries_id":302828,"server_id":5,"link":"photo_7353728.html","width":130,"caption":"Sunlight on Hathersage Moor","height":87});
															thumbnails[7288187] = clik.newPhoto({"id":7288187,"src":"Owler_tor_with_Heather600_thumb.jpg","galleries_id":302828,"server_id":5,"link":"photo_7288187.html","width":130,"caption":"Owler Tor","height":86});
															thumbnails[7288191] = clik.newPhoto({"id":7288191,"src":"Owler_tor_2_6001_thumb.jpg","galleries_id":302828,"server_id":5,"link":"photo_7288191.html","width":130,"caption":"Owler Tor Sunset","height":86});
															thumbnails[7311305] = clik.newPhoto({"id":7311305,"src":"Hathesage_moor_at_sunset600_thumb.jpg","galleries_id":302828,"server_id":5,"link":"photo_7311305.html","width":130,"caption":"Hathersage Moor Sunset","height":85});
															thumbnails[7200123] = clik.newPhoto({"id":7200123,"src":"White_Edge_Lodgesmall_thumb.jpg","galleries_id":302828,"server_id":5,"link":"photo_7200123.html","width":130,"caption":"White Edge Lodge","height":86});
															thumbnails[6744355] = clik.newPhoto({"id":6744355,"src":"GuernseyDSC_1769_thumb.jpg","galleries_id":302829,"server_id":5,"link":"photo_6744355.html","width":130,"caption":"Alone","height":86});
															thumbnails[6744401] = clik.newPhoto({"id":6744401,"src":"vazon_small_1_thumb.jpg","galleries_id":302829,"server_id":5,"link":"photo_6744401.html","width":130,"caption":"Bay Rocks","height":86});
															thumbnails[6846261] = clik.newPhoto({"id":6846261,"src":"Sunset_rocks1_thumb.jpg","galleries_id":302829,"server_id":5,"link":"photo_6846261.html","width":130,"caption":"Last Light of the Day","height":84});
															thumbnails[7199333] = clik.newPhoto({"id":7199333,"src":"Guernsey_Bay_Beachsmall_thumb.jpg","galleries_id":302829,"server_id":5,"link":"photo_7199333.html","width":130,"caption":"Vazon Bay","height":86});
															thumbnails[7202210] = clik.newPhoto({"id":7202210,"src":"Vazon_Bay_with_Sunlightsmall_1_thumb.jpg","galleries_id":302829,"server_id":5,"link":"photo_7202210.html","width":130,"caption":"Vazon Bay in subdued light","height":86});
															thumbnails[7254200] = clik.newPhoto({"id":7254200,"src":"Eccles_Pike_Horizontal600_thumb.jpg","galleries_id":302828,"server_id":5,"link":"photo_7254200.html","width":130,"caption":"Eccles Pike Sunset","height":86});
															thumbnails[6133759] = clik.newPhoto({"id":6133759,"src":"Padstow_Baysmall_thumb.jpg","galleries_id":302829,"server_id":5,"link":"photo_6133759.html","width":130,"caption":"Trevone Sunset 2","height":86});
															thumbnails[5945773] = clik.newPhoto({"id":5945773,"src":"Penmon_Beachsmall_thumb.jpg","galleries_id":302829,"server_id":5,"link":"photo_5945773.html","width":130,"caption":"Penmon Lighthouse","height":86});
															thumbnails[5765156] = clik.newPhoto({"id":5765156,"src":"Church_Bay_small_thumb.jpg","galleries_id":302829,"server_id":5,"link":"photo_5765156.html","width":130,"caption":"","height":86});
															thumbnails[5633029] = clik.newPhoto({"id":5633029,"src":"The_Roaches600small_thumb.jpg","galleries_id":302828,"server_id":5,"link":"photo_5633029.html","width":130,"caption":"Roaches and Moorland","height":86});
															thumbnails[5532552] = clik.newPhoto({"id":5532552,"src":"Higger_Tor_snow_scene_1_650_thumb.jpg","galleries_id":302828,"server_id":5,"link":"photo_5532552.html","width":130,"caption":"Higger Tor Sunrise","height":86});
															thumbnails[7224170] = clik.newPhoto({"id":7224170,"src":"Blea_Tarn600_thumb.jpg","galleries_id":302828,"server_id":5,"link":"photo_7224170.html","width":130,"caption":"Blea Tarn","height":86});
															thumbnails[5379348] = clik.newPhoto({"id":5379348,"src":"Silverdale_small_thumb.jpg","galleries_id":302829,"server_id":5,"link":"photo_5379348.html","width":130,"caption":"Silverdale Beach","height":86});
															thumbnails[5371312] = clik.newPhoto({"id":5371312,"src":"Saundersfoot_Beachsmall_thumb.jpg","galleries_id":302829,"server_id":5,"link":"photo_5371312.html","width":130,"caption":"Saundersfoot Beach","height":83});
															thumbnails[5371327] = clik.newPhoto({"id":5371327,"src":"nbsmall_thumb.jpg","galleries_id":302829,"server_id":5,"link":"photo_5371327.html","width":130,"caption":"Perch Rock Lighthouse","height":86});
															thumbnails[7200248] = clik.newPhoto({"id":7200248,"src":"lakesideyes600_thumb.jpg","galleries_id":302828,"server_id":5,"link":"photo_7200248.html","width":130,"caption":"Keswick Sunset","height":87});
															thumbnails[7200312] = clik.newPhoto({"id":7200312,"src":"Keswick3Horizontal600_thumb.jpg","galleries_id":302828,"server_id":5,"link":"photo_7200312.html","width":130,"caption":"Bassenthwaite Lake","height":87});
															thumbnails[7199166] = clik.newPhoto({"id":7199166,"src":"EcclesPiketreesmall_thumb.jpg","galleries_id":302828,"server_id":5,"link":"photo_7199166.html","width":130,"caption":"Small Tree on Eccles Pike","height":86});
															thumbnails[7199939] = clik.newPhoto({"id":7199939,"src":"Higger_Tor_snow_scene_2_small_thumb.jpg","galleries_id":302828,"server_id":5,"link":"photo_7199939.html","width":130,"caption":"Higger Tor Sunrise2","height":85});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[411038] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Macro","link":"gallery_411038.html","maxRecords":0.0,"photoIDs":[7972763.0,7839866.0,7746150.0,7577063.0,7577074.0,7577095.0,7577105.0,7577108.0,7577126.0,7577127.0,7577167.0,7577170.0],"skipIndex":0,"section_code":"gallery","featured_images":"7972763,7839866,7746150,7577170,7577167,7577127,7577126,7577108,7577105,7577095","id":411038,"singleSection":false});				  						galleries[421656] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Panorama","link":"gallery_421656.html","maxRecords":0.0,"photoIDs":[7829706.0,7810010.0],"skipIndex":0,"section_code":"gallery","featured_images":"7829706,7810010","id":421656,"singleSection":false});				  						galleries[302828] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Landscapes","link":"gallery_302828.html","maxRecords":0.0,"photoIDs":[9042841.0,9042849.0,7945021.0,7802434.0,7812691.0,7746132.0,7445318.0,7343274.0,7343279.0,7353728.0,7288187.0,7288191.0,7311305.0,7200123.0,7254200.0,5633029.0,5532552.0,7224170.0,7200248.0,7200312.0,7199166.0,7199939.0],"skipIndex":0,"section_code":"gallery","featured_images":"9042849,9042841,7945021,7812691,7802434,7746132,7445318,7353728,7343279,7343274","id":302828,"singleSection":false});				  						galleries[302829] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Seascapes","link":"gallery_302829.html","maxRecords":0.0,"photoIDs":[8556962.0,8556932.0,8556964.0,8556968.0,7941821.0,6744355.0,6744401.0,6846261.0,7199333.0,7202210.0,6133759.0,5945773.0,5765156.0,5379348.0,5371312.0,5371327.0],"skipIndex":0,"section_code":"gallery","featured_images":"8556968,8556964,8556962,8556932,7941821,7202210,7199333,6846261,6744401,6744355","id":302829,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '9042849,9042841,8556968,8556964,8556962,8556932,7945021,7941821,7746132,7445318,7311305,7288191,7288187,7254200,7199939,7199333,7199166,6744401,6744355,6133759,5945773,5765156,5633029,5532552,5379348,5371327,5371312';
imageSets[3] = '9042849,9042841,8556968,8556964,8556962,8556932,7945021,7941821,7746132,7445318,7311305,7288191,7288187,7254200,7199939,7199333,7199166,6744401,6744355,6133759,5945773,5765156,5633029,5532552,5379348,5371327,5371312';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/DaveShandley/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/DaveShandley/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/DaveShandley/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/DaveShandley/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/DaveShandley/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/DaveShandley/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/DaveShandley/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/DaveShandley/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/DaveShandley/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/DaveShandley/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/DaveShandley/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/DaveShandley/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/DaveShandley/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/DaveShandley/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/DaveShandley/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/DaveShandley/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/DaveShandley/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/DaveShandley/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/DaveShandley/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/DaveShandley/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/DaveShandley/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/DaveShandley/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/DaveShandley/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/DaveShandley/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/DaveShandley/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/DaveShandley/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/DaveShandley/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 = 'Dave Shandley 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>Dave Shandley </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> &pound;' + (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 += '<form id="paymentForm" style="margin:0px;border:0px;" name="paymentForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
			temp += '<input type="hidden" name="item_name" value="'+item_name+'">';
			ref = '';
			if(this.photo_ref != ''){
				ref = this.photo_ref+' - '+this.caption;
			}
			else{
				ref = this.id+' - '+this.caption;
			}
			price = amount;								temp += '<input type="hidden" name="cmd" value="_cart">';
					temp += '<input type="hidden" name="business" value="">';
					temp += '<input type="hidden" name="currency_code" value="GBP">';
					temp += '<input type="hidden" name="add" value="1">';
													temp += '<input type="hidden" name="amount" value="'+amount+'">';
					temp += '<input type="hidden" name="item_number" value="'+ref+'">';
													temp += '<input type=\"Submit\" value=\"Add to cart\" id=\"paymentAddButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
										temp += '</form>';
										temp += '<form id="paymentCartForm" style="margin:0px;" name="paymentCartForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
				temp += '<input type="hidden" name="cmd" value="_cart">';
				temp += '<input type="hidden" name="business" value="">';
				temp += '<input type="hidden" name="display" value="1">';
				temp += '<input type=\"Submit\" value=\"View cart\" id=\"paymentViewButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
				temp += '</form>';
						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;
	}
}

			

