window.thumbnails = {};
															thumbnails[542115] = clik.newPhoto({"id":542115,"src":"for sale copy_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":158});
															thumbnails[542121] = clik.newPhoto({"id":542121,"src":"for sale 2 copy_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":120});
															thumbnails[8861222] = clik.newPhoto({"id":8861222,"src":"Kia_rosette2_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Kia with rosette","height":136});
															thumbnails[8861225] = clik.newPhoto({"id":8861225,"src":"Kia_jumping_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Kia Jumping","height":138});
															thumbnails[575291] = clik.newPhoto({"id":575291,"src":"ashridge and the yard 085 copy_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":93});
															thumbnails[575293] = clik.newPhoto({"id":575293,"src":"ashridge and the yard 089 copy_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":147});
															thumbnails[6112398] = clik.newPhoto({"id":6112398,"src":"TomandJacob2_thumb.jpg","galleries_id":342547,"server_id":1,"link":"photo_6112398.html","width":130,"caption":"TOM AND JACOB WIN A HUGE CUP!","height":166});
															thumbnails[541162] = clik.newPhoto({"id":541162,"src":"big prince copy_thumb.jpg","galleries_id":42016,"server_id":1,"link":"photo_541162.html","width":130,"caption":"BIG PRINCE","height":166});
															thumbnails[541197] = clik.newPhoto({"id":541197,"src":"billy joe copy_thumb.jpg","galleries_id":42016,"server_id":1,"link":"photo_541197.html","width":130,"caption":"BILLY JOE","height":95});
															thumbnails[541201] = clik.newPhoto({"id":541201,"src":"billy joe 2 copy_thumb.jpg","galleries_id":42016,"server_id":1,"link":"photo_541201.html","width":130,"caption":"BILLY JOE","height":100});
															thumbnails[541206] = clik.newPhoto({"id":541206,"src":"conchi copy_thumb.jpg","galleries_id":42016,"server_id":1,"link":"photo_541206.html","width":130,"caption":"CONCHI","height":152});
															thumbnails[541221] = clik.newPhoto({"id":541221,"src":"sassy copy_thumb.jpg","galleries_id":42016,"server_id":1,"link":"photo_541221.html","width":130,"caption":"SASSY","height":160});
															thumbnails[541223] = clik.newPhoto({"id":541223,"src":"spritzer copy_thumb.jpg","galleries_id":42016,"server_id":1,"link":"photo_541223.html","width":130,"caption":"SPRITZER","height":103});
															thumbnails[541226] = clik.newPhoto({"id":541226,"src":"web stuff 127 copy_thumb.jpg","galleries_id":42016,"server_id":1,"link":"photo_541226.html","width":130,"caption":"LOLLY CHILLS OUT","height":162});
															thumbnails[541230] = clik.newPhoto({"id":541230,"src":"web stuff 134 copy_thumb.jpg","galleries_id":42016,"server_id":1,"link":"photo_541230.html","width":130,"caption":"LITTLE PRINCE, KATIE AND MIKEY","height":156});
															thumbnails[541232] = clik.newPhoto({"id":541232,"src":"web stuff 143 copy_thumb.jpg","galleries_id":42016,"server_id":1,"link":"photo_541232.html","width":130,"caption":"SMUDGE","height":101});
															thumbnails[541234] = clik.newPhoto({"id":541234,"src":"web stuff 156 copy_thumb.jpg","galleries_id":42016,"server_id":1,"link":"photo_541234.html","width":130,"caption":"MIKEY","height":157});
															thumbnails[541235] = clik.newPhoto({"id":541235,"src":"web stuff 157 copy_thumb.jpg","galleries_id":42016,"server_id":1,"link":"photo_541235.html","width":130,"caption":"LITTLE PRINCE & MIKEY","height":94});
															thumbnails[541238] = clik.newPhoto({"id":541238,"src":"web stuff 163 copy_thumb.jpg","galleries_id":42016,"server_id":1,"link":"photo_541238.html","width":130,"caption":"DIXIE","height":103});
															thumbnails[541671] = clik.newPhoto({"id":541671,"src":"hard work copy_thumb.jpg","galleries_id":42621,"server_id":1,"link":"photo_541671.html","width":130,"caption":"IT`S NOT ALL PLAY","height":163});
															thumbnails[541674] = clik.newPhoto({"id":541674,"src":"daily chores copy_thumb.jpg","galleries_id":42621,"server_id":1,"link":"photo_541674.html","width":130,"caption":"HORSES NEED FRESH WATER DAILY","height":176});
															thumbnails[541678] = clik.newPhoto({"id":541678,"src":"hiding from the farrier copy_thumb.jpg","galleries_id":42621,"server_id":1,"link":"photo_541678.html","width":130,"caption":"HIDING FROM THE VET!","height":161});
															thumbnails[541679] = clik.newPhoto({"id":541679,"src":"hot shoeing copy_thumb.jpg","galleries_id":42621,"server_id":1,"link":"photo_541679.html","width":130,"caption":"THE FARRIER","height":161});
															thumbnails[541682] = clik.newPhoto({"id":541682,"src":"picking feet copy_thumb.jpg","galleries_id":42621,"server_id":1,"link":"photo_541682.html","width":130,"caption":"PICKING OUT FEET","height":95});
															thumbnails[541971] = clik.newPhoto({"id":541971,"src":"ground work 1 copy_thumb.jpg","galleries_id":42621,"server_id":1,"link":"photo_541971.html","width":130,"caption":"GROUND WORK","height":162});
															thumbnails[7047705] = clik.newPhoto({"id":7047705,"src":"me4_thumb.JPG","galleries_id":42016,"server_id":1,"link":"photo_7047705.html","width":130,"caption":"OUR FRIENDLY STAFF","height":119});
															thumbnails[7057192] = clik.newPhoto({"id":7057192,"src":"685_thumb.JPG","galleries_id":342547,"server_id":1,"link":"photo_7057192.html","width":130,"caption":"Pop Girl filming at High Herts","height":173});
															thumbnails[7057195] = clik.newPhoto({"id":7057195,"src":"677_thumb.JPG","galleries_id":342547,"server_id":1,"link":"photo_7057195.html","width":130,"caption":"Pop Girl's Gemma enjoying High Herts","height":173});
															thumbnails[7512675] = clik.newPhoto({"id":7512675,"src":"HH_jumpers_thumb.jpg","galleries_id":42028,"server_id":1,"link":"photo_7512675.html","width":130,"caption":"Livery Services","height":98});
															thumbnails[8829849] = clik.newPhoto({"id":8829849,"src":"New_title_page_thumb.jpg","galleries_id":42016,"server_id":1,"link":"photo_8829849.html","width":130,"caption":"TEAM HIGH HERTS 2011!","height":79});
															thumbnails[541696] = clik.newPhoto({"id":541696,"src":"the office copy_thumb.jpg","galleries_id":42028,"server_id":1,"link":"photo_541696.html","width":130,"caption":"OUR FRIENDLY STAFF","height":94});
															thumbnails[541390] = clik.newPhoto({"id":541390,"src":"ashridge and the yard 167 copy_thumb.jpg","galleries_id":42028,"server_id":1,"link":"photo_541390.html","width":130,"caption":"IMPORTANT INFORMATION ABOUT THE CAR PARK","height":87});
															thumbnails[541976] = clik.newPhoto({"id":541976,"src":"out door school 2 copy_thumb.jpg","galleries_id":42044,"server_id":1,"link":"photo_541976.html","width":130,"caption":"GROUP LESSON","height":184});
															thumbnails[541825] = clik.newPhoto({"id":541825,"src":"ashridge and the yard 091 copy_thumb.jpg","galleries_id":42028,"server_id":1,"link":"photo_541825.html","width":130,"caption":"IMPORTANT NOTICE ABOUT DOGS","height":163});
															thumbnails[541985] = clik.newPhoto({"id":541985,"src":"out door school 4 copy_thumb.jpg","galleries_id":42044,"server_id":1,"link":"photo_541985.html","width":130,"caption":"GROUP LESSON","height":181});
															thumbnails[541864] = clik.newPhoto({"id":541864,"src":"rossettes copy1_thumb.jpg","galleries_id":42028,"server_id":1,"link":"photo_541864.html","width":130,"caption":"THE BRITISH HORSE SOCIETY AND THE PONY CLUB.","height":87});
															thumbnails[541981] = clik.newPhoto({"id":541981,"src":"out door school 3 copy_thumb.jpg","galleries_id":42044,"server_id":1,"link":"photo_541981.html","width":130,"caption":"GROUP LESSON","height":186});
															thumbnails[541974] = clik.newPhoto({"id":541974,"src":"out door school 1 copy_thumb.jpg","galleries_id":42044,"server_id":1,"link":"photo_541974.html","width":130,"caption":"GROUP LESSON","height":188});
															thumbnails[541943] = clik.newPhoto({"id":541943,"src":"jumping  lesson copy_thumb.jpg","galleries_id":42044,"server_id":1,"link":"photo_541943.html","width":130,"caption":" JUMPING LESSONS","height":100});
															thumbnails[541686] = clik.newPhoto({"id":541686,"src":"watch and learn copy_thumb.jpg","galleries_id":42028,"server_id":1,"link":"photo_541686.html","width":130,"caption":"LOOK AND LEARN","height":177});
															thumbnails[581420] = clik.newPhoto({"id":581420,"src":"yard and bethan bday 025_thumb.jpg","galleries_id":42044,"server_id":1,"link":"photo_581420.html","width":130,"caption":"STARTING YOUNG","height":173});
															thumbnails[1161432] = clik.newPhoto({"id":1161432,"src":"DREAM_thumb.jpg","galleries_id":42028,"server_id":1,"link":"photo_1161432.html","width":130,"caption":"DREAMS CAN COME TRUE","height":93});
															thumbnails[4372304] = clik.newPhoto({"id":4372304,"src":"_MG_9493-copy_thumb.jpg","galleries_id":42044,"server_id":1,"link":"photo_4372304.html","width":130,"caption":"INDOOR SCHOOL","height":195});
															thumbnails[542008] = clik.newPhoto({"id":542008,"src":"lolly tries it on copy_thumb.jpg","galleries_id":42028,"server_id":1,"link":"photo_542008.html","width":130,"caption":"LOLLY TRIES IT ON","height":99});
															thumbnails[581416] = clik.newPhoto({"id":581416,"src":"ashridge and the yard 007 copy_thumb.jpg","galleries_id":42028,"server_id":1,"link":"photo_581416.html","width":130,"caption":"WAITING FOR THE LESSON TO BEGIN","height":95});
															thumbnails[596138] = clik.newPhoto({"id":596138,"src":"yard and bethan bday 021_thumb.jpg","galleries_id":42028,"server_id":1,"link":"photo_596138.html","width":130,"caption":"WAITING FOR THE LESSON TO BEGIN","height":168});
															thumbnails[542053] = clik.newPhoto({"id":542053,"src":"land2 copy_thumb.jpg","galleries_id":42028,"server_id":1,"link":"photo_542053.html","width":130,"caption":"CROSS COUNTRY FENCE","height":81});
															thumbnails[541677] = clik.newPhoto({"id":541677,"src":"indoor scholl copy_thumb.jpg","galleries_id":42028,"server_id":1,"link":"photo_541677.html","width":130,"caption":"INDOOR SCHOOL","height":59});
															thumbnails[542049] = clik.newPhoto({"id":542049,"src":"land_thumb.jpg","galleries_id":42028,"server_id":1,"link":"photo_542049.html","width":130,"caption":"THE UPPER FIELD","height":52});
															thumbnails[542136] = clik.newPhoto({"id":542136,"src":"land 6 copy_thumb.jpg","galleries_id":42028,"server_id":1,"link":"photo_542136.html","width":130,"caption":"THE LOWER FIELD","height":172});
															thumbnails[4372215] = clik.newPhoto({"id":4372215,"src":"_DSC1483_copy_thumb.jpg","galleries_id":42028,"server_id":1,"link":"photo_4372215.html","width":130,"caption":"WAITING TO GO","height":195});
															thumbnails[4372267] = clik.newPhoto({"id":4372267,"src":"_MG_9409-copy_thumb.jpg","galleries_id":42028,"server_id":1,"link":"photo_4372267.html","width":130,"caption":"WHAT YER DOING ?","height":195});
															thumbnails[4372287] = clik.newPhoto({"id":4372287,"src":"_MG_9425-copy_thumb.jpg","galleries_id":42028,"server_id":1,"link":"photo_4372287.html","width":130,"caption":"NA NA N NAA NA.","height":195});
															thumbnails[4372311] = clik.newPhoto({"id":4372311,"src":"_DSC1667-copy_thumb.jpg","galleries_id":42028,"server_id":1,"link":"photo_4372311.html","width":130,"caption":"AND THE WINNER IS.....","height":196});
															thumbnails[541527] = clik.newPhoto({"id":541527,"src":"hack out 3 copy_thumb.jpg","galleries_id":42028,"server_id":1,"link":"photo_541527.html","width":130,"caption":"HACKING OUT","height":161});
															thumbnails[541422] = clik.newPhoto({"id":541422,"src":"city and guilds0018 copy_thumb.jpg","galleries_id":42028,"server_id":1,"link":"photo_541422.html","width":130,"caption":"HACKING OUT","height":107});
															thumbnails[581426] = clik.newPhoto({"id":581426,"src":"wills pics 095 copy_thumb.jpg","galleries_id":42028,"server_id":1,"link":"photo_581426.html","width":130,"caption":"HACKING OUT","height":75});
															thumbnails[581435] = clik.newPhoto({"id":581435,"src":"wills pics 100 copy_thumb.jpg","galleries_id":42028,"server_id":1,"link":"photo_581435.html","width":130,"caption":"HACKING OUT","height":92});
															thumbnails[4372363] = clik.newPhoto({"id":4372363,"src":"_DSC4567-copy_thumb.jpg","galleries_id":42028,"server_id":1,"link":"photo_4372363.html","width":130,"caption":"LAZY DAYS,SUNDAY AFTERNOONS.","height":87});
															thumbnails[581463] = clik.newPhoto({"id":581463,"src":"ashridge and the yard 124 copy_thumb.jpg","galleries_id":42028,"server_id":1,"link":"photo_581463.html","width":130,"caption":"WAITING TO GO","height":174});
															thumbnails[4372722] = clik.newPhoto({"id":4372722,"src":"_DSC1542-copy_thumb.jpg","galleries_id":42028,"server_id":1,"link":"photo_4372722.html","width":130,"caption":"HERE WE GOOOO.....","height":195});
															thumbnails[4372750] = clik.newPhoto({"id":4372750,"src":"_DSC1570-copy_thumb.jpg","galleries_id":42028,"server_id":1,"link":"photo_4372750.html","width":130,"caption":"SHOW JUMPING","height":195});
															thumbnails[4372775] = clik.newPhoto({"id":4372775,"src":"_DSC4556-copy_thumb.jpg","galleries_id":42028,"server_id":1,"link":"photo_4372775.html","width":130,"caption":"WAITING TO JUMP","height":195});
															thumbnails[4372808] = clik.newPhoto({"id":4372808,"src":"_DSC4558-copy_thumb.jpg","galleries_id":42028,"server_id":1,"link":"photo_4372808.html","width":130,"caption":"AM I ON NEXT?","height":195});
															thumbnails[4372822] = clik.newPhoto({"id":4372822,"src":"_DSC4559-copy_thumb.jpg","galleries_id":42028,"server_id":1,"link":"photo_4372822.html","width":130,"caption":" READY TO GO.","height":195});
															thumbnails[4372846] = clik.newPhoto({"id":4372846,"src":"_DSC4596-copy_thumb.jpg","galleries_id":42028,"server_id":1,"link":"photo_4372846.html","width":130,"caption":"AND WEARING THE RED FLY FRINGE.....","height":195});
															thumbnails[4372858] = clik.newPhoto({"id":4372858,"src":"_DSC4570-copy_thumb.jpg","galleries_id":42028,"server_id":1,"link":"photo_4372858.html","width":130,"caption":"SHOW JUMPING","height":195});
															thumbnails[4372875] = clik.newPhoto({"id":4372875,"src":"_DSC4613-copy-copy_thumb.jpg","galleries_id":42028,"server_id":1,"link":"photo_4372875.html","width":130,"caption":"LOOKING FOR THE NEXT FENCE","height":195});
															thumbnails[6037582] = clik.newPhoto({"id":6037582,"src":"PartyRoom_thumb.jpg","galleries_id":42028,"server_id":1,"link":"photo_6037582.html","width":130,"caption":"OUR PARTY ROOM","height":115});
															thumbnails[6037594] = clik.newPhoto({"id":6037594,"src":"PartyRoom2_thumb.jpg","galleries_id":42028,"server_id":1,"link":"photo_6037594.html","width":130,"caption":"ITS PARTY TIME!","height":173});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[42028] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"ABOUT THE YARD","link":"gallery_42028.html","maxRecords":0.0,"photoIDs":[7512675.0,541696.0,541390.0,541825.0,541864.0,541686.0,1161432.0,542008.0,581416.0,596138.0,542053.0,541677.0,542049.0,542136.0,4372215.0,4372267.0,4372287.0,4372311.0,541527.0,541422.0,581426.0,581435.0,4372363.0,581463.0,4372722.0,4372750.0,4372775.0,4372808.0,4372822.0,4372846.0,4372858.0,4372875.0,6037582.0,6037594.0],"skipIndex":0,"section_code":"gallery","featured_images":"541825,541696,541686","id":42028,"singleSection":false});				  						galleries[42044] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"LESSONS","link":"gallery_42044.html","maxRecords":0.0,"photoIDs":[541976.0,541985.0,541981.0,541974.0,541943.0,581420.0,4372304.0],"skipIndex":0,"section_code":"gallery","featured_images":541976.0,"id":42044,"singleSection":false});				  						galleries[42621] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"LIVERY","link":"gallery_42621.html","maxRecords":0.0,"photoIDs":[541671.0,541674.0,541678.0,541679.0,541682.0,541971.0],"skipIndex":0,"section_code":"gallery","featured_images":"541971,541682,541679,541678,541674,541671","id":42621,"singleSection":false});				  						galleries[42016] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"MEET THE STAFF","link":"gallery_42016.html","maxRecords":0.0,"photoIDs":[541162.0,541197.0,541201.0,541206.0,541221.0,541223.0,541226.0,541230.0,541232.0,541234.0,541235.0,541238.0,7047705.0,8829849.0],"skipIndex":0,"section_code":"gallery","featured_images":7047705.0,"id":42016,"singleSection":false});				  						galleries[342547] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"PHOTO NEWS","link":"gallery_342547.html","maxRecords":0.0,"photoIDs":[6112398.0,7057192.0,7057195.0],"skipIndex":0,"section_code":"gallery","featured_images":7057195.0,"id":342547,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '8829849,7512675,541864,541686,1161432';
imageSets[2] = '7057195,7047705,541976,541696,541825,541686';
imageSets[3] = '8861225,8861222,8829849,7512675,7057195,7057192,7047705,6112398,6037594,6037582,4372875,4372858,4372846,4372822,4372808,4372775,4372750,4372722,4372363,4372311,4372304,4372287,4372267,4372215,1161432,596138,581463,581435,581426,581420,581416,575293,575291,542136,542121,542115,542053,542049,542008,541985,541981,541976,541974,541971,541943,541864,541825,541696,541686,541682';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/RIDING/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/RIDING/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/RIDING/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/RIDING/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/RIDING/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/RIDING/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/RIDING/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/RIDING/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/RIDING/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/RIDING/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/RIDING/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/RIDING/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/RIDING/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/RIDING/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/RIDING/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/RIDING/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/RIDING/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/RIDING/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/RIDING/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/RIDING/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/RIDING/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/RIDING/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/RIDING/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/RIDING/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/RIDING/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/RIDING/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/RIDING/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 = 'HIGH HERTS EQUESTRIAN CENTRE: ' + 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;
	}
}

			

