window.thumbnails = {};
															thumbnails[3109767] = clik.newPhoto({"id":3109767,"src":"810383-40-funeralTWM_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"The funeral of Lance-Corporal Ricky Baldwin from 5th Battalion The Rifles (5 Rifles) held at St Marys Church, Lydney. Picture by Anna Lythgoe","height":97});
															thumbnails[3109861] = clik.newPhoto({"id":3109861,"src":"TWM_FERRARI_081108_014_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Tim Thurston reviews the Ferrari F430 for Cotswold Life magazine. Picture by Shaun Thompson","height":87});
															thumbnails[3109769] = clik.newPhoto({"id":3109769,"src":"TWM_RECLAMATION_201108_120_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Maggie Walton at the Cotswold Reclamation Co. Ltd. Picture by Anna Lythgoe","height":86});
															thumbnails[3110582] = clik.newPhoto({"id":3110582,"src":"TWM_FLOODS_040908_0191_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Flash floods hit Lydney in Gloucestershire, Thursday September 4th 2008. Residents in Lakeside Avenue suffered damage as flood waters penetrated their homes in some cases for the third time. Carol Pritchard is comforted by her daughter Denise Fox on the stairs of her home which was flooded for the third time. Picture by Shaun Thompson","height":71});
															thumbnails[3109800] = clik.newPhoto({"id":3109800,"src":"TWM_220508_alpacas_001_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Nick and Sue Atkins of Atkins Alpacas, Minchinhampton. Picture by Anna Lythgoe","height":80});
															thumbnails[3110588] = clik.newPhoto({"id":3110588,"src":"TWM_GLAMROCK_PIGLETS_220908_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"They're the 'glam rockers' of the pig world - a litter of piglets all born in startlingly different colours! One's black, another's white, a third is ginger and the others are all eye-catchingly turned out in a mixture of colourful hues and spots. Owners Simon and Sarah Righton of Old Farm, Dorn, nr Moreton in Marsh, Glos, reckon the piglets are a world first. Picture by Shaun Thompson","height":52});
															thumbnails[3109807] = clik.newPhoto({"id":3109807,"src":"TWM_020608_pam_056_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Pam Weaver of Yew Tree Farm, Moreton Valance, Nr Gloucester. She handles animals and acts in film productions such as Robin Hood Prince of Thieves and BBC dramas Lark Rise to Candleford and Tess of the d'Urbervilles. Picture by Anna Lythgoe","height":86});
															thumbnails[3110590] = clik.newPhoto({"id":3110590,"src":"810639-29-Newcastle-TWM_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Gloucester Rugby v Newcastle Falcons in the Guinness Premiership clash at Kingsholm. Mike Tindall tackled by Rory Clegg. Picture by Shaun Thompson","height":85});
															thumbnails[3109815] = clik.newPhoto({"id":3109815,"src":"820314-5-JillyTWM_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Jilly Cooper at the Cheltenham Literature Festival 2008. Picture by Anna Lythgoe","height":195});
															thumbnails[3110591] = clik.newPhoto({"id":3110591,"src":"TWM_GORILLA_190908_014_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Bristol Zoo Gardens has taken in a young orphan gorilla from a specialist ape nursery in Germany. The youngster, called Kera pictured here with keeper Emily Pugh, has moved to Bristol Zoo from Wilhelma Zoo in Stuttgart, where she had been hand-reared while living alongside other young gorillas. Picture by Shaun Thompson","height":201});
															thumbnails[3109818] = clik.newPhoto({"id":3109818,"src":"TWM_050508_may_013_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Elena Bush, 8 attends to May Queen Jennifer Bellis, 8 at Iron Acton May Day Celebrations. Picture by Anna Lythgoe","height":209});
															thumbnails[3110594] = clik.newPhoto({"id":3110594,"src":"CTFC0809_V_BRFC_062_TWM_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Cheltenham Town Football Club v Bristol Rovers in Coca-Cola league 1 at Whaddon Road. Robins Manager Martin Allen argues with the fourth official during second half injury time. Picture by Shaun Thompson","height":201});
															thumbnails[3109820] = clik.newPhoto({"id":3109820,"src":"810616-5-roastTWM_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Marcus Welch, 4 and Bailey Grindle, 5 at Littledean Church of England Primary School helping to prepare a roast dinner by digging potatoes and cleaning them ready for cooking. Picture by Anna Lythgoe","height":195});
															thumbnails[3110596] = clik.newPhoto({"id":3110596,"src":"TWM_MAYOR_060908_009_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"The mayor making ceremony for the mock Mayor of Barton St Mary. Sword carrier Julian Chapman leads the procession. Picture by Shaun Thompson","height":195});
															thumbnails[3109822] = clik.newPhoto({"id":3109822,"src":"TWM-020708-qehtheatre-009_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Matthew Burton, 11 performs in the new QEH Junior School production of the Rocky Monster Show. Picture by Anna Lythgoe","height":197});
															thumbnails[3110597] = clik.newPhoto({"id":3110597,"src":"TWM_LINDA_021008_003_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Patient Linda in the art studio at Cotswold Care Hospice. Picture by Shaun Thompson","height":197});
															thumbnails[3109827] = clik.newPhoto({"id":3109827,"src":"830918-001-rugbyTWM_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"James Pettigrew battles towards the try line for Old Pats V Coney Hill at Everest Road, Cheltenham. Picture by Anna Lythgoe","height":86});
															thumbnails[3110600] = clik.newPhoto({"id":3110600,"src":"TWM_KINGSHOLM_121008_010_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Kingsholm Stadium the home of Gloucester Rugby Club. Picture by Shaun Thompson","height":86});
															thumbnails[3109835] = clik.newPhoto({"id":3109835,"src":"TWM-260808-football-020_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Cheltenham Town V Stoke City in the Carling Cup at Whaddon Road. Ashley Vincent is brought down. Picture by Anna Lythgoe","height":87});
															thumbnails[3110633] = clik.newPhoto({"id":3110633,"src":"TWM_MOP_FAIR_091008_007_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Tewkesbury town crier Mike Kean-Price at the town's mop fair. Picture by Shaun Thompson","height":87});
															thumbnails[3109843] = clik.newPhoto({"id":3109843,"src":"TWM-140708-brecons-066alt_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Members of 1 Rifles during training in the Brecon Beacons prior to their deployment in Afghanistan. Picture by Anna Lythgoe","height":91});
															thumbnails[3110634] = clik.newPhoto({"id":3110634,"src":"810669-4-Chatterton-TWM_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"A COUPLE have described the pain of knowing their toddler will never have children of his own. Gorgeous 16-month-old William Chatterton looks like he doesn't have a care in the world. But William, from Robinswood Hill, was born with an extra X chromosome and has Klinefelter's syndrome which means he's infertile. William is pictured at home in Robinswood. Picture by Shaun Thompson","height":87});
															thumbnails[3109848] = clik.newPhoto({"id":3109848,"src":"TWM_100608_greenhouse_011_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Brother and sister Phoebe, 9 and Tom Ind, 11 in the gardening club at St Mary's Primary School, Focus DIY have donated a greenhouse to pupils. Picture by Anna Lythgoe<br>\r\n<br>\r\n","height":87});
															thumbnails[3110638] = clik.newPhoto({"id":3110638,"src":"810639-18-Newcastle-TWM_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Gloucester Rugby v Newcastle Falcons in the Guinness Premiership clash at Kingsholm. Jonny Wilkinson leaves the field injured. Picture by Shaun Thompson","height":94});
															thumbnails[3109853] = clik.newPhoto({"id":3109853,"src":"wedding-0202-alt_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Wedding photography. Picture by Anna Lythgoe","height":195});
															thumbnails[3110646] = clik.newPhoto({"id":3110646,"src":"CTFC0809_V_OLDHAM_TWM_018_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Oldham Athletic v Cheltenham Town in the FA Cup 1st round replay at Boundary Park. Cheltenham's match winner Lewis Montrose celebrates at the final whistle with Josh Payne. Picture by Shaun Thompson","height":196});
															thumbnails[3109855] = clik.newPhoto({"id":3109855,"src":"TWM_piglet_290408_014_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Jacky Roeleveld, 7 visiting from Moreton in Marsh with three week old rare New Zealand Kune-Kune piglets at the Cotswold Farm Park, Gloucestershire. Picture by Anna Lythgoe","height":196});
															thumbnails[3110647] = clik.newPhoto({"id":3110647,"src":"TWM_CONSERVATION_301008_039_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"The launch of the Bristol Conservation and Science Foundation at Bristol Zoo Gardens. Picture shows a Livingstone's fruit bat in the enclosure at Bristol Zoo Gardens. Picture by Shaun Thompson","height":195});
															thumbnails[3109856] = clik.newPhoto({"id":3109856,"src":"820173-16-artist_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Textile artist Corinne Hockley who has a studio at the Artspace in John Street, Stroud.<br>\r\nPicture by Anna Lythgoe","height":195});
															thumbnails[3110649] = clik.newPhoto({"id":3110649,"src":"TWM_RECLAMATION_201108_045_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"A red telephone box at Ronsons Reclamation, Sandhurst near Gloucester. Picture by Shaun Thompson","height":195});
															thumbnails[3109858] = clik.newPhoto({"id":3109858,"src":"830915-25-diverTWM_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Olympic diver Nick Robinson-Baker visits Leisure@ in Cheltenham to offer free swimming lessons with the ASA. Picture by Anna Lythgoe","height":195});
															thumbnails[3110650] = clik.newPhoto({"id":3110650,"src":"TWM_DUNNE_090908_007_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Sir Thomas Dunne, KG, KCVO. Picture by Shaun Thompson","height":195});
															thumbnails[3110654] = clik.newPhoto({"id":3110654,"src":"TWM_AST_Web221008_2_thumb.jpg","galleries_id":145917,"server_id":1,"link":"photo_3110654.html","width":130,"caption":"Dean Close Prep School pupils on stage. Picture by Antony Thompson","height":82});
															thumbnails[3110655] = clik.newPhoto({"id":3110655,"src":"TWM_AST_Web221008_10_thumb.jpg","galleries_id":145917,"server_id":1,"link":"photo_3110655.html","width":130,"caption":"Westons Ice Cider launch Ha Ha Bar, Bath. Picture by Antony Thompson","height":85});
															thumbnails[3110663] = clik.newPhoto({"id":3110663,"src":"TWM_NHS60GlosPCT_050708_621_thumb.jpg","galleries_id":145917,"server_id":1,"link":"photo_3110663.html","width":130,"caption":"NHS staff celebrate the organisation's 60th anniversary. Picture by Antony Thompson","height":77});
															thumbnails[3110667] = clik.newPhoto({"id":3110667,"src":"TWM_AST_Web221008_3_thumb.jpg","galleries_id":145917,"server_id":1,"link":"photo_3110667.html","width":130,"caption":"Sovereign Housing Group residents enjoy a cup of tea in their recently revamped kitchen. Picture by Antony Thompson ","height":91});
															thumbnails[3110674] = clik.newPhoto({"id":3110674,"src":"TWM_AST_Web221008_15_thumb.jpg","galleries_id":145917,"server_id":1,"link":"photo_3110674.html","width":130,"caption":"Gloucestershire PCT Case Study - Dawn Roberts Ward Manager. Picture by Antony Thompson","height":196});
															thumbnails[3110679] = clik.newPhoto({"id":3110679,"src":"TWM_AST_Web221008_18_thumb.jpg","galleries_id":145917,"server_id":1,"link":"photo_3110679.html","width":130,"caption":"Brighton & Hove Albion FC v Cheltenham Town FC at The Withdean Stadium - Scott Murray celebrates his opening goal during the 3-3 draw. Picture by Antony Thompson","height":196});
															thumbnails[3110683] = clik.newPhoto({"id":3110683,"src":"TWM_AST_Web221008_13_thumb.jpg","galleries_id":145917,"server_id":1,"link":"photo_3110683.html","width":130,"caption":"Dean Close Prep School Pupils enjoy a birthday ice-cream. Picture by Antony Thompson","height":195});
															thumbnails[3110687] = clik.newPhoto({"id":3110687,"src":"TWM_AST_Web221008_14_thumb.jpg","galleries_id":145917,"server_id":1,"link":"photo_3110687.html","width":130,"caption":"Capoeira performers at Leisure@Cheltenham fun day and launch of 2012 Cultural Olympiad. Picture by Antony Thompson ","height":195});
															thumbnails[3110691] = clik.newPhoto({"id":3110691,"src":"TWM_AST_Web221008_11_thumb.jpg","galleries_id":145917,"server_id":1,"link":"photo_3110691.html","width":130,"caption":"Everyman Theatre 2008-2009 Christmas Panto Aladin Cast Photocall. Picture by Antony Thompson","height":86});
															thumbnails[3110692] = clik.newPhoto({"id":3110692,"src":"TWM_AST_Web221008_5_thumb.jpg","galleries_id":145917,"server_id":1,"link":"photo_3110692.html","width":130,"caption":"Babyshambles drummer Adam Ficek performs an acoustic set in Cheltenham's RISE record store. Picture by Antony Thompson","height":87});
															thumbnails[3110694] = clik.newPhoto({"id":3110694,"src":"TWM_AST_Web221008_4_thumb.jpg","galleries_id":145917,"server_id":1,"link":"photo_3110694.html","width":130,"caption":"Bristol University Senior Executive Team Registrar Derek Pretty, Vice-Chancellor Prof Eric Thomas and Deputy Vice-Chancellor Prof David Clarke. Picture by Antony Thompson","height":86});
															thumbnails[3110698] = clik.newPhoto({"id":3110698,"src":"TWM_AST_Web221008_8_thumb.jpg","galleries_id":145917,"server_id":1,"link":"photo_3110698.html","width":130,"caption":"Chinese Vegetable Springs Rolls photographed for Budgens Supermarket. Picture by Antony Thompson","height":86});
															thumbnails[3110700] = clik.newPhoto({"id":3110700,"src":"TWM_AST_Web221008_19_thumb.jpg","galleries_id":145917,"server_id":1,"link":"photo_3110700.html","width":130,"caption":"Product Photography for EMS Medical Ltd. Picture by Antony Thompson","height":196});
															thumbnails[3110703] = clik.newPhoto({"id":3110703,"src":"TWM_AST_Web221008_16_thumb.jpg","galleries_id":145917,"server_id":1,"link":"photo_3110703.html","width":130,"caption":"The Red Arrows perform over the fire damaged Weston Pier. Picture by Antony Thompson","height":193});
															thumbnails[3110705] = clik.newPhoto({"id":3110705,"src":"TWM_AST_Web221008_17_thumb.jpg","galleries_id":145917,"server_id":1,"link":"photo_3110705.html","width":130,"caption":"Westons Ice Cider launch Ha Ha Bar, Bath. Picture by Antony Thompson","height":196});
															thumbnails[3110706] = clik.newPhoto({"id":3110706,"src":"TWM_AST_Web221008_12_thumb.jpg","galleries_id":145917,"server_id":1,"link":"photo_3110706.html","width":130,"caption":"Autumn Food Feature - Winter Fruit Knicker-boca-glory. Picture by Antony Thompson","height":195});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[145917] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Antony","link":"gallery.html","maxRecords":0.0,"photoIDs":[3110654.0,3110655.0,3110663.0,3110667.0,3110674.0,3110679.0,3110683.0,3110687.0,3110691.0,3110692.0,3110694.0,3110698.0,3110700.0,3110703.0,3110705.0,3110706.0],"skipIndex":0,"section_code":"gallery","featured_images":3110654.0,"id":145917,"singleSection":true});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '3110654';
imageSets[2] = '3110654,3109767,3110633';
imageSets[3] = '3110706,3110705,3110703,3110700,3110698,3110694,3110692,3110691,3110687,3110683,3110679,3110674,3110667,3110663,3110655,3110654,3110650,3110649,3110647,3110646,3110638,3110634,3110633,3110600,3110597,3110596,3110594,3110591,3110590,3110588,3110582,3109861,3109858,3109856,3109855,3109853,3109848,3109843,3109835,3109827,3109822,3109820,3109818,3109815,3109807,3109800,3109769,3109767';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'www12.clikpic.com/shaunthompson/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/shaunthompson/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/shaunthompson/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/shaunthompson/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/shaunthompson/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/shaunthompson/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/shaunthompson/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/shaunthompson/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/shaunthompson/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/shaunthompson/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/shaunthompson/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/shaunthompson/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/shaunthompson/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/shaunthompson/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/shaunthompson/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/shaunthompson/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/shaunthompson/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/shaunthompson/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/shaunthompson/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/shaunthompson/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/shaunthompson/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/shaunthompson/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/shaunthompson/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/shaunthompson/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 && backgrounds[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 = 'Thousand Word Media Ltd: ' + 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> &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.payment_groups_id !== '') {
		temp += '<p>Buy this print online:</p>';
				temp += '<form id="paymentOptions" style="margin:0px;border:0px;" name="paymentOptions">';
											temp += '<select class="paymentlink" name="payment_options_id" onchange="updateItemValues($(this.form).next(\'#paymentForm\')[0],this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value);">';
		
		temp += getPaymentOptions(this.payment_groups_id);
		temp += '</select>';
		temp += '</form>';
				var item_option  = paymentGroups[this.payment_groups_id].options[0];
		if(paymentOptions[item_option]){
			var item_name  = paymentOptions[item_option].payment_option;
			var amount =  paymentOptions[item_option].price;
		}
			}
	else {
		
	}
	if (this.item_price !== '' || this.payment_groups_id !== '') {
																		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;
	}
}

			

