window.thumbnails = {};
															thumbnails[7512649] = clik.newPhoto({"id":7512649,"src":"Street-Protesters--1400-x-1050_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":87});
															thumbnails[7512650] = clik.newPhoto({"id":7512650,"src":"The-Inspection-cropped_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":87});
															thumbnails[7512653] = clik.newPhoto({"id":7512653,"src":"The-White-Balloon_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":87});
															thumbnails[7512666] = clik.newPhoto({"id":7512666,"src":"The-Mischiefmakers_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":87});
															thumbnails[8679421] = clik.newPhoto({"id":8679421,"src":"The-Entertainers.jpg_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":194});
															thumbnails[7512642] = clik.newPhoto({"id":7512642,"src":"Maggie_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":194});
															thumbnails[7512660] = clik.newPhoto({"id":7512660,"src":"Samurai_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":194});
															thumbnails[7512646] = clik.newPhoto({"id":7512646,"src":"In-the-Back-Pocket_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":194});
															thumbnails[8680861] = clik.newPhoto({"id":8680861,"src":"Helianthus-Monarch-in-the-Barn-Garden_thumb.jpg","galleries_id":346880,"server_id":32,"link":"photo_8680861.html","width":130,"caption":"","height":87});
															thumbnails[8681712] = clik.newPhoto({"id":8681712,"src":"1-Schefflera-aff.myriocarpa-BSWJ11828_thumb.jpg","galleries_id":346025,"server_id":32,"link":"photo_8681712.html","width":130,"caption":"","height":87});
															thumbnails[8681836] = clik.newPhoto({"id":8681836,"src":"1-Agastache-Blue-Fortune-with-Anaphalis-181_thumb.jpg","galleries_id":346026,"server_id":32,"link":"photo_8681836.html","width":130,"caption":"","height":87});
															thumbnails[8726341] = clik.newPhoto({"id":8726341,"src":"30_Corgarff_Castle_thumb.jpg","galleries_id":459915,"server_id":32,"link":"photo_8726341.html","width":130,"caption":"Corgarff Castle","height":87});
															thumbnails[8680987] = clik.newPhoto({"id":8680987,"src":"2-High-Garden-with-path_thumb.jpg","galleries_id":346880,"server_id":32,"link":"photo_8680987.html","width":130,"caption":"","height":87});
															thumbnails[8681716] = clik.newPhoto({"id":8681716,"src":"2-Achillea-Red-Velvet-182_thumb.jpg","galleries_id":346025,"server_id":32,"link":"photo_8681716.html","width":130,"caption":"","height":87});
															thumbnails[8681840] = clik.newPhoto({"id":8681840,"src":"3-Larkspur-with-Verbascums-and-Ammi-in-the-Long-Border_thumb.jpg","galleries_id":346026,"server_id":32,"link":"photo_8681840.html","width":130,"caption":"","height":87});
															thumbnails[8726337] = clik.newPhoto({"id":8726337,"src":"10_Bleak_Mid-Winter_thumb.jpg","galleries_id":459915,"server_id":32,"link":"photo_8726337.html","width":130,"caption":"Bleak Mid-Winter","height":87});
															thumbnails[8680902] = clik.newPhoto({"id":8680902,"src":"Orchard-path-at-sunrise1_thumb.jpg","galleries_id":346880,"server_id":32,"link":"photo_8680902.html","width":130,"caption":"","height":87});
															thumbnails[8681718] = clik.newPhoto({"id":8681718,"src":"3-Tragopogon-porrifolius-179_thumb.jpg","galleries_id":346025,"server_id":32,"link":"photo_8681718.html","width":130,"caption":"","height":87});
															thumbnails[8681967] = clik.newPhoto({"id":8681967,"src":"5-Echinacea-and-Lilium-lancifolium-in-Peacock-Gdn_thumb.jpg","galleries_id":346026,"server_id":32,"link":"photo_8681967.html","width":130,"caption":"","height":87});
															thumbnails[8726377] = clik.newPhoto({"id":8726377,"src":"120_Struggle_for_Survival_thumb.jpg","galleries_id":459915,"server_id":32,"link":"photo_8726377.html","width":130,"caption":"Struggle for Survival","height":87});
															thumbnails[8680868] = clik.newPhoto({"id":8680868,"src":"Grasses-outside-the-Hovel_thumb.jpg","galleries_id":346880,"server_id":32,"link":"photo_8680868.html","width":130,"caption":"","height":87});
															thumbnails[8681720] = clik.newPhoto({"id":8681720,"src":"4-Fascicularia-bicolor-bloom-183_thumb.jpg","galleries_id":346025,"server_id":32,"link":"photo_8681720.html","width":130,"caption":"","height":87});
															thumbnails[8682111] = clik.newPhoto({"id":8682111,"src":"4-Santolina-pinnata-neapolitana--182_thumb.jpg","galleries_id":346026,"server_id":32,"link":"photo_8682111.html","width":130,"caption":"","height":87});
															thumbnails[8726351] = clik.newPhoto({"id":8726351,"src":"70_First_Snowfall_of_Winter_CROPPED_thumb.jpg","galleries_id":459915,"server_id":32,"link":"photo_8726351.html","width":130,"caption":"First Snowfall of Winter","height":87});
															thumbnails[8681564] = clik.newPhoto({"id":8681564,"src":"5-Hovel-in-July-181_thumb.jpg","galleries_id":346880,"server_id":32,"link":"photo_8681564.html","width":130,"caption":"","height":87});
															thumbnails[8681736] = clik.newPhoto({"id":8681736,"src":"5-Ricinus-communis-leaf_thumb.jpg","galleries_id":346025,"server_id":32,"link":"photo_8681736.html","width":130,"caption":"","height":87});
															thumbnails[8681964] = clik.newPhoto({"id":8681964,"src":"6-Alliums-in-the-High-Garden-170_thumb.jpg","galleries_id":346026,"server_id":32,"link":"photo_8681964.html","width":130,"caption":"","height":87});
															thumbnails[8726340] = clik.newPhoto({"id":8726340,"src":"20_Welsh_Valley_thumb.jpg","galleries_id":459915,"server_id":32,"link":"photo_8726340.html","width":130,"caption":"Welsh Valley","height":87});
															thumbnails[8681571] = clik.newPhoto({"id":8681571,"src":"6-Centaurea-montana-in-the-Barn-Garden-170_thumb.jpg","galleries_id":346880,"server_id":32,"link":"photo_8681571.html","width":130,"caption":"","height":87});
															thumbnails[8681976] = clik.newPhoto({"id":8681976,"src":"7-Larkspur-and-Allium-head-in-the-LB_thumb.jpg","galleries_id":346026,"server_id":32,"link":"photo_8681976.html","width":130,"caption":"","height":87});
															thumbnails[8682039] = clik.newPhoto({"id":8682039,"src":"6-Aster-frikartii-Monch-189_thumb.jpg","galleries_id":346025,"server_id":32,"link":"photo_8682039.html","width":130,"caption":"","height":87});
															thumbnails[8726342] = clik.newPhoto({"id":8726342,"src":"40_Sea_Mist_Coming_In_thumb.jpg","galleries_id":459915,"server_id":32,"link":"photo_8726342.html","width":130,"caption":"Sea Mist Coming In","height":87});
															thumbnails[8681579] = clik.newPhoto({"id":8681579,"src":"Narcissus-in-the-Mist-SPS_thumb.jpg","galleries_id":346880,"server_id":32,"link":"photo_8681579.html","width":130,"caption":"","height":87});
															thumbnails[8681788] = clik.newPhoto({"id":8681788,"src":"10-Dahlia-Summer-Night-in-HG-PC3_thumb.jpg","galleries_id":346025,"server_id":32,"link":"photo_8681788.html","width":130,"caption":"","height":87});
															thumbnails[8681957] = clik.newPhoto({"id":8681957,"src":"8-Salvia-Lady-in-Red-with-Ballota-pseudodictamnus_thumb.jpg","galleries_id":346026,"server_id":32,"link":"photo_8681957.html","width":130,"caption":"","height":87});
															thumbnails[8726354] = clik.newPhoto({"id":8726354,"src":"80_Lovers_in_the_Mist_thumb.jpg","galleries_id":459915,"server_id":32,"link":"photo_8726354.html","width":130,"caption":"Lovers in the Mist","height":87});
															thumbnails[8681593] = clik.newPhoto({"id":8681593,"src":"8-September-morning_thumb.jpg","galleries_id":346880,"server_id":32,"link":"photo_8681593.html","width":130,"caption":"","height":87});
															thumbnails[8681893] = clik.newPhoto({"id":8681893,"src":"9-Exotic-Garden-with-Dahlia-Wittermans-Superba_thumb.jpg","galleries_id":346026,"server_id":32,"link":"photo_8681893.html","width":130,"caption":"","height":87});
															thumbnails[8682042] = clik.newPhoto({"id":8682042,"src":"7-Rudbeckia-Prairie-Sun-flower_thumb.jpg","galleries_id":346025,"server_id":32,"link":"photo_8682042.html","width":130,"caption":"","height":87});
															thumbnails[8726374] = clik.newPhoto({"id":8726374,"src":"110_Shadow_of_the_Volcano_thumb.jpg","galleries_id":459915,"server_id":32,"link":"photo_8726374.html","width":130,"caption":"Shadow of the Volcano","height":87});
															thumbnails[8681654] = clik.newPhoto({"id":8681654,"src":"9-Peacock-Garden-misty-morning-September_thumb.jpg","galleries_id":346880,"server_id":32,"link":"photo_8681654.html","width":130,"caption":"","height":87});
															thumbnails[8681743] = clik.newPhoto({"id":8681743,"src":"8-Helenium-Rauchtopas-130_thumb.jpg","galleries_id":346025,"server_id":32,"link":"photo_8681743.html","width":130,"caption":"","height":87});
															thumbnails[8682113] = clik.newPhoto({"id":8682113,"src":"9-Colocasia-esculenta-Fontanesii-leaves-misty-morning_thumb.jpg","galleries_id":346026,"server_id":32,"link":"photo_8682113.html","width":130,"caption":"","height":87});
															thumbnails[8726344] = clik.newPhoto({"id":8726344,"src":"50_Highland_View_thumb.jpg","galleries_id":459915,"server_id":32,"link":"photo_8726344.html","width":130,"caption":"Highland View","height":87});
															thumbnails[8681659] = clik.newPhoto({"id":8681659,"src":"10-Horse-Pond-evening-light-169_thumb.jpg","galleries_id":346880,"server_id":32,"link":"photo_8681659.html","width":130,"caption":"","height":87});
															thumbnails[8681740] = clik.newPhoto({"id":8681740,"src":"7-Eryngium-x-zabelii-Donald-Variety-2--174_thumb.jpg","galleries_id":346025,"server_id":32,"link":"photo_8681740.html","width":130,"caption":"","height":87});
															thumbnails[8681891] = clik.newPhoto({"id":8681891,"src":"10-Plants-used-in-the-Pots-in-the-Mosaic-Garden-175_thumb.jpg","galleries_id":346026,"server_id":32,"link":"photo_8681891.html","width":130,"caption":"","height":87});
															thumbnails[8726362] = clik.newPhoto({"id":8726362,"src":"100_Rainbow_over_Worthing_thumb.jpg","galleries_id":459915,"server_id":32,"link":"photo_8726362.html","width":130,"caption":"Rainbow over Worthing Pier","height":87});
															thumbnails[8681669] = clik.newPhoto({"id":8681669,"src":"11-Path-to-the-Hovel-180_thumb.jpg","galleries_id":346880,"server_id":32,"link":"photo_8681669.html","width":130,"caption":"","height":87});
															thumbnails[8681739] = clik.newPhoto({"id":8681739,"src":"6-Rosa-rugosa-185_thumb.jpg","galleries_id":346025,"server_id":32,"link":"photo_8681739.html","width":130,"caption":"","height":87});
															thumbnails[8681889] = clik.newPhoto({"id":8681889,"src":"11-Lychnis-coronaria-with-Allium-cristophii-178_thumb.jpg","galleries_id":346026,"server_id":32,"link":"photo_8681889.html","width":130,"caption":"","height":87});
															thumbnails[8726348] = clik.newPhoto({"id":8726348,"src":"60_The_Isolated_Cottage_with_crop1_thumb.jpg","galleries_id":459915,"server_id":32,"link":"photo_8726348.html","width":130,"caption":"The Isolated Cottage","height":87});
															thumbnails[8681675] = clik.newPhoto({"id":8681675,"src":"12-Porch-pots-rhs-in-September_thumb.jpg","galleries_id":346880,"server_id":32,"link":"photo_8681675.html","width":130,"caption":"","height":87});
															thumbnails[8681800] = clik.newPhoto({"id":8681800,"src":"12-Neoregelia-concentrica_thumb.jpg","galleries_id":346025,"server_id":32,"link":"photo_8681800.html","width":130,"caption":"","height":87});
															thumbnails[8681886] = clik.newPhoto({"id":8681886,"src":"12-Leucanthemum-vulgare-with-Foeniculum-vulgare-Purpureum_thumb.jpg","galleries_id":346026,"server_id":32,"link":"photo_8681886.html","width":130,"caption":"","height":87});
															thumbnails[8726357] = clik.newPhoto({"id":8726357,"src":"90_Winter_Begins_thumb.jpg","galleries_id":459915,"server_id":32,"link":"photo_8726357.html","width":130,"caption":"Winter Begins","height":87});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[459915] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Views","link":"gallery_459915.html","maxRecords":0.0,"photoIDs":[8726341.0,8726337.0,8726377.0,8726351.0,8726340.0,8726342.0,8726354.0,8726374.0,8726344.0,8726362.0,8726348.0,8726357.0],"skipIndex":0,"section_code":"gallery","featured_images":"8726377,8726374,8726362,8726357,8726354,8726351,8726348,8726344,8726342,8726341","id":459915,"singleSection":false});				  						galleries[346880] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Great Dixter, Northiam.","link":"gallery_346880.html","maxRecords":0.0,"photoIDs":[8680861.0,8680987.0,8680902.0,8680868.0,8681564.0,8681571.0,8681579.0,8681593.0,8681654.0,8681659.0,8681669.0,8681675.0],"skipIndex":0,"section_code":"gallery","featured_images":"8681675,8681669,8681659,8681654,8681593,8681579,8681571,8681564,8680987,8680902","id":346880,"singleSection":false});				  						galleries[346025] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Plant Portraits","link":"gallery_346025.html","maxRecords":0.0,"photoIDs":[8681712.0,8681716.0,8681718.0,8681720.0,8681736.0,8682039.0,8681788.0,8682042.0,8681743.0,8681740.0,8681739.0,8681800.0],"skipIndex":0,"section_code":"gallery","featured_images":"8682042,8682039,8681800,8681788,8681743,8681740,8681739,8681736,8681720,8681718","id":346025,"singleSection":false});				  						galleries[346026] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Planting Partners at Gt Dixter","link":"gallery_346026.html","maxRecords":0.0,"photoIDs":[8681836.0,8681840.0,8681967.0,8682111.0,8681964.0,8681976.0,8681957.0,8681893.0,8682113.0,8681891.0,8681889.0,8681886.0],"skipIndex":0,"section_code":"gallery","featured_images":"8682113,8682111,8681976,8681967,8681964,8681957,8681893,8681891,8681889,8681886","id":346026,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '7512666';
imageSets[2] = '7512666';
imageSets[3] = '8726377,8726374,8726362,8726357,8726354,8726351,8726348,8726344,8726342,8726341,8726340,8726337,8682113,8682111,8682042,8682039,8681976,8681967,8681964,8681957,8681893,8681891,8681889,8681886,8681840,8681836,8681800,8681788,8681743,8681740,8681739,8681736,8681720,8681718,8681716,8681712,8681675,8681669,8681659,8681654,8681593,8681579,8681571,8681564,8680987,8680902,8680868,8680861,8679421,7512666';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/Carolc/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/Carolc/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/Carolc/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/Carolc/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/Carolc/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/Carolc/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/Carolc/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/Carolc/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/Carolc/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/Carolc/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/Carolc/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/Carolc/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/Carolc/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/Carolc/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/Carolc/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/Carolc/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/Carolc/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/Carolc/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/Carolc/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/Carolc/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/Carolc/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/Carolc/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/Carolc/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/Carolc/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/Carolc/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/Carolc/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/Carolc/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 = 'Carol Casselden: ' + 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.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;
	}
}

			

