window.thumbnails = {};
															thumbnails[1282317] = clik.newPhoto({"id":1282317,"src":"Studio_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"Studio","height":98});
															thumbnails[1056209] = clik.newPhoto({"id":1056209,"src":"DSCF0065_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"OPMAS Beech 18","height":98});
															thumbnails[1056217] = clik.newPhoto({"id":1056217,"src":"DSCF0053_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"OPMAS Beech 18 at Booker","height":98});
															thumbnails[3656127] = clik.newPhoto({"id":3656127,"src":"PV2_thumb.jpg","galleries_id":34892,"server_id":15,"link":"photo_3656127.html","width":130,"caption":"Pacific Harpoons","height":98});
															thumbnails[5283132] = clik.newPhoto({"id":5283132,"src":"400_thumb.JPG","galleries_id":34892,"server_id":15,"link":"photo_5283132.html","width":130,"caption":"","height":130});
															thumbnails[438087] = clik.newPhoto({"id":438087,"src":"spit_1_thumb.JPG","galleries_id":34882,"server_id":15,"link":"photo_438087.html","width":130,"caption":"'D-Day Rendezvous'","height":86});
															thumbnails[438095] = clik.newPhoto({"id":438095,"src":"DSCF3806_thumb.jpg","galleries_id":134282,"server_id":15,"link":"photo_438095.html","width":130,"caption":"Cold War Fitter ","height":81});
															thumbnails[438076] = clik.newPhoto({"id":438076,"src":"DSCF3561_thumb.jpg","galleries_id":34882,"server_id":15,"link":"photo_438076.html","width":130,"caption":"DH Dove at Wroughton","height":180});
															thumbnails[438158] = clik.newPhoto({"id":438158,"src":"DSCF3809_thumb.jpg","galleries_id":134282,"server_id":15,"link":"photo_438158.html","width":130,"caption":"Lissie at Hendon","height":125});
															thumbnails[438088] = clik.newPhoto({"id":438088,"src":"DSCF3567_thumb.jpg","galleries_id":34882,"server_id":15,"link":"photo_438088.html","width":130,"caption":"Mossie at London Colney","height":127});
															thumbnails[438094] = clik.newPhoto({"id":438094,"src":"DSCF3803_thumb.jpg","galleries_id":134282,"server_id":15,"link":"photo_438094.html","width":130,"caption":"David and the Camel","height":189});
															thumbnails[438156] = clik.newPhoto({"id":438156,"src":"DSCF38081_thumb.jpg","galleries_id":134282,"server_id":15,"link":"photo_438156.html","width":130,"caption":"A Red at Scampton","height":84});
															thumbnails[438085] = clik.newPhoto({"id":438085,"src":"DSCF3563_thumb.jpg","galleries_id":34882,"server_id":15,"link":"photo_438085.html","width":130,"caption":"Beech Restorations","height":174});
															thumbnails[2515470] = clik.newPhoto({"id":2515470,"src":"fury_thumb.JPG","galleries_id":34909,"server_id":15,"link":"photo_2515470.html","width":98,"caption":"Sea Fury G-CBEL","height":130});
															thumbnails[438390] = clik.newPhoto({"id":438390,"src":"DSCF3812_thumb.jpg","galleries_id":34909,"server_id":15,"link":"photo_438390.html","width":130,"caption":"F16 Display","height":79});
															thumbnails[438388] = clik.newPhoto({"id":438388,"src":"DSCF3810_thumb.jpg","galleries_id":34909,"server_id":15,"link":"photo_438388.html","width":130,"caption":"Hellcats over the Pacific","height":84});
															thumbnails[438091] = clik.newPhoto({"id":438091,"src":"DSCF3800_thumb.jpg","galleries_id":134282,"server_id":15,"link":"photo_438091.html","width":130,"caption":"SE5-A","height":96});
															thumbnails[438162] = clik.newPhoto({"id":438162,"src":"Grob Tutor_thumb.jpg","galleries_id":134282,"server_id":15,"link":"photo_438162.html","width":130,"caption":"Grob Tutor","height":86});
															thumbnails[3656035] = clik.newPhoto({"id":3656035,"src":"DSCF22231_thumb.JPG","galleries_id":223374,"server_id":15,"link":"photo_3656035.html","width":130,"caption":"Cold Start","height":98});
															thumbnails[3656092] = clik.newPhoto({"id":3656092,"src":"DSCF2228_thumb.JPG","galleries_id":223374,"server_id":15,"link":"photo_3656092.html","width":130,"caption":"Super Cub","height":52});
															thumbnails[3656105] = clik.newPhoto({"id":3656105,"src":"DSCF2229_thumb.JPG","galleries_id":223374,"server_id":15,"link":"photo_3656105.html","width":130,"caption":"Oily Fury","height":126});
															thumbnails[7929886] = clik.newPhoto({"id":7929886,"src":"PV2_PAIR1_thumb.jpg","galleries_id":34892,"server_id":15,"link":"photo_7929886.html","width":88,"caption":"PV2 Pair","height":130});
															thumbnails[492800] = clik.newPhoto({"id":492800,"src":"DSCF3822_thumb.JPG","galleries_id":134282,"server_id":15,"link":"photo_492800.html","width":130,"caption":"Big Beautiful Doll","height":83});
															thumbnails[1768001] = clik.newPhoto({"id":1768001,"src":"Staggerwing_thumb.JPG","galleries_id":134282,"server_id":15,"link":"photo_1768001.html","width":130,"caption":"Staggerwing at Popham","height":81});
															thumbnails[1117155] = clik.newPhoto({"id":1117155,"src":"OPMASBeech_thumb.jpg","galleries_id":134282,"server_id":15,"link":"photo_1117155.html","width":130,"caption":"Opmas Beech 18","height":89});
															thumbnails[2028720] = clik.newPhoto({"id":2028720,"src":"lamb_thumb.jpg","galleries_id":34892,"server_id":15,"link":"photo_2028720.html","width":95,"caption":"Lamb's Finish","height":130});
															thumbnails[459662] = clik.newPhoto({"id":459662,"src":"Ray_Hannahs_Spitfire_SMLL_thumb.jpg","galleries_id":34882,"server_id":15,"link":"photo_459662.html","width":130,"caption":"Breitling Spitfire","height":47});
															thumbnails[438074] = clik.newPhoto({"id":438074,"src":"Sleeping 50s_thumb.jpg","galleries_id":34892,"server_id":15,"link":"photo_438074.html","width":130,"caption":"Sleeping 50's","height":130});
															thumbnails[1684478] = clik.newPhoto({"id":1684478,"src":"Ursula_thumb.jpg","galleries_id":34882,"server_id":15,"link":"photo_1684478.html","width":130,"caption":"Ursula","height":96});
															thumbnails[1124870] = clik.newPhoto({"id":1124870,"src":"spit1_thumb.jpg","galleries_id":134282,"server_id":15,"link":"photo_1124870.html","width":130,"caption":"IWM Mk1 Spitfire","height":95});
															thumbnails[6033943] = clik.newPhoto({"id":6033943,"src":"Burmese_Thunder1_thumb.jpg","galleries_id":34882,"server_id":15,"link":"photo_6033943.html","width":130,"caption":"Burmese Thunder","height":88});
															thumbnails[2544703] = clik.newPhoto({"id":2544703,"src":"tiger_thumb.JPG","galleries_id":134296,"server_id":15,"link":"photo_2544703.html","width":130,"caption":"Compton's Moth","height":98});
															thumbnails[653154] = clik.newPhoto({"id":653154,"src":"Spit_thumb.JPG","galleries_id":134282,"server_id":15,"link":"photo_653154.html","width":130,"caption":"Science Museum Spitfire - Mk22","height":87});
															thumbnails[459811] = clik.newPhoto({"id":459811,"src":"Harrier1_thumb.jpg","galleries_id":134296,"server_id":15,"link":"photo_459811.html","width":130,"caption":"Yeovilton Harrier Sketch","height":93});
															thumbnails[438164] = clik.newPhoto({"id":438164,"src":"Harrier_thumb.jpg","galleries_id":34909,"server_id":15,"link":"photo_438164.html","width":130,"caption":"Harrier","height":109});
															thumbnails[1775074] = clik.newPhoto({"id":1775074,"src":"Prints_thumb.JPG","galleries_id":119334,"server_id":15,"link":"photo_1775074.html","width":130,"caption":"Prints","height":98});
															thumbnails[1772982] = clik.newPhoto({"id":1772982,"src":"KOLLSMAN 0-400_thumb.jpg","galleries_id":119057,"server_id":15,"link":"photo_1772982.html","width":130,"caption":"ASI","height":86});
															thumbnails[2309946] = clik.newPhoto({"id":2309946,"src":"DSCF20013_thumb.JPG","galleries_id":119057,"server_id":15,"link":"photo_2309946.html","width":130,"caption":"Clock","height":98});
															thumbnails[2309957] = clik.newPhoto({"id":2309957,"src":"DSCF2002_thumb.JPG","galleries_id":119057,"server_id":15,"link":"photo_2309957.html","width":130,"caption":"Radio Altimeter","height":98});
															thumbnails[2309964] = clik.newPhoto({"id":2309964,"src":"DSCF20032_thumb.JPG","galleries_id":119057,"server_id":15,"link":"photo_2309964.html","width":130,"caption":"AN-5760-1A","height":98});
															thumbnails[2309977] = clik.newPhoto({"id":2309977,"src":"DSCF2004_thumb.JPG","galleries_id":119057,"server_id":15,"link":"photo_2309977.html","width":130,"caption":"ASI","height":98});
															thumbnails[2309981] = clik.newPhoto({"id":2309981,"src":"DSCF2005_thumb.JPG","galleries_id":119057,"server_id":15,"link":"photo_2309981.html","width":130,"caption":14616.0,"height":98});
															thumbnails[2309986] = clik.newPhoto({"id":2309986,"src":"DSCF2006_thumb.JPG","galleries_id":119057,"server_id":15,"link":"photo_2309986.html","width":130,"caption":"R88-I-800-11","height":98});
															thumbnails[2309996] = clik.newPhoto({"id":2309996,"src":"DSCF2008_thumb.JPG","galleries_id":119057,"server_id":15,"link":"photo_2309996.html","width":130,"caption":"AN-5735-1A","height":98});
															thumbnails[2310006] = clik.newPhoto({"id":2310006,"src":"DSCF2009_thumb.JPG","galleries_id":119057,"server_id":15,"link":"photo_2310006.html","width":130,"caption":"AN-5820-1","height":98});
															thumbnails[2310016] = clik.newPhoto({"id":2310016,"src":"DSCF2010_thumb.JPG","galleries_id":119057,"server_id":15,"link":"photo_2310016.html","width":130,"caption":"AN-5736-1A","height":98});
															thumbnails[2310023] = clik.newPhoto({"id":2310023,"src":"DSCF2011_thumb.JPG","galleries_id":119057,"server_id":15,"link":"photo_2310023.html","width":130,"caption":"R-16-I-2240","height":98});
															thumbnails[2310025] = clik.newPhoto({"id":2310025,"src":"DSCF2012_thumb.JPG","galleries_id":119057,"server_id":15,"link":"photo_2310025.html","width":130,"caption":"AN-5530-2A-12","height":98});
															thumbnails[2310027] = clik.newPhoto({"id":2310027,"src":"DSCF2013_thumb.JPG","galleries_id":119057,"server_id":15,"link":"photo_2310027.html","width":130,"caption":"AN-5536-2A","height":98});
															thumbnails[2310035] = clik.newPhoto({"id":2310035,"src":"DSCF2014_thumb.JPG","galleries_id":119057,"server_id":15,"link":"photo_2310035.html","width":130,"caption":15463.0,"height":98});
															thumbnails[2310037] = clik.newPhoto({"id":2310037,"src":"DSCF2015_thumb.JPG","galleries_id":119057,"server_id":15,"link":"photo_2310037.html","width":130,"caption":"AN-5795-6","height":98});
															thumbnails[2310044] = clik.newPhoto({"id":2310044,"src":"DSCF2016_thumb.JPG","galleries_id":119057,"server_id":15,"link":"photo_2310044.html","width":130,"caption":"EA-102-AN10","height":98});
															thumbnails[2310051] = clik.newPhoto({"id":2310051,"src":"DSCF2017_thumb.JPG","galleries_id":119057,"server_id":15,"link":"photo_2310051.html","width":130,"caption":"AN-5760-1A","height":98});
															thumbnails[2310059] = clik.newPhoto({"id":2310059,"src":"DSCF2018_thumb.JPG","galleries_id":119057,"server_id":15,"link":"photo_2310059.html","width":130,"caption":"AN-5820-1","height":98});
															thumbnails[2310062] = clik.newPhoto({"id":2310062,"src":"DSCF2019_thumb.JPG","galleries_id":119057,"server_id":15,"link":"photo_2310062.html","width":130,"caption":"AN\/ARN-7 ","height":98});
															thumbnails[2310082] = clik.newPhoto({"id":2310082,"src":"DSCF2020_thumb.JPG","galleries_id":119057,"server_id":15,"link":"photo_2310082.html","width":130,"caption":"Wet Compass","height":98});
															thumbnails[1544847] = clik.newPhoto({"id":1544847,"src":"1951SNB-5_thumb.jpg","galleries_id":98466,"server_id":15,"link":"photo_1544847.html","width":130,"caption":"SNB-5 1951 All Weather Parts","height":56});
															thumbnails[1544863] = clik.newPhoto({"id":1544863,"src":"FullPanel_thumb.jpg","galleries_id":98466,"server_id":15,"link":"photo_1544863.html","width":130,"caption":"My panel as received","height":98});
															thumbnails[1544909] = clik.newPhoto({"id":1544909,"src":"fuel1_thumb.jpg","galleries_id":98466,"server_id":15,"link":"photo_1544909.html","width":130,"caption":"Fuel Selector Switch","height":98});
															thumbnails[1544871] = clik.newPhoto({"id":1544871,"src":"DSCF0045_thumb.JPG","galleries_id":98466,"server_id":15,"link":"photo_1544871.html","width":130,"caption":"Some Instruments","height":98});
															thumbnails[1544869] = clik.newPhoto({"id":1544869,"src":"light dimmers_thumb.jpg","galleries_id":98466,"server_id":15,"link":"photo_1544869.html","width":130,"caption":"Close up of Screen-printing","height":98});
															thumbnails[1544896] = clik.newPhoto({"id":1544896,"src":"302d_1_thumb.jpg","galleries_id":119057,"server_id":15,"link":"photo_1544896.html","width":130,"caption":"Suction Gauge","height":173});
															thumbnails[1712602] = clik.newPhoto({"id":1712602,"src":"instdec07_thumb.jpg","galleries_id":98466,"server_id":15,"link":"photo_1712602.html","width":130,"caption":"Painted and populated; so far","height":76});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[98466] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"1951 All-Weather Instrument Panel","link":"section132202_98466.html","maxRecords":0.0,"photoIDs":[1544847.0,1544863.0,1544909.0,1544871.0,1544869.0,1712602.0],"skipIndex":0,"section_code":"section132202","featured_images":1712602.0,"id":98466,"singleSection":false});				  						galleries[134283] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Drawings","link":"gallery_134283.html","maxRecords":0.0,"photoIDs":[],"skipIndex":0,"section_code":"gallery","featured_images":1768001.0,"id":134283,"singleSection":false});				  						galleries[119334] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Prints","link":"section156090.html","maxRecords":0.0,"photoIDs":[1775074.0],"skipIndex":0,"section_code":"section156090","featured_images":1775074.0,"id":119334,"singleSection":true});				  						galleries[34882] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Oil Paintings","link":"gallery_34882.html","maxRecords":0.0,"photoIDs":[438087.0,438076.0,438088.0,438085.0,459662.0,1684478.0,6033943.0],"skipIndex":0,"section_code":"gallery","featured_images":"6033943,438087","id":34882,"singleSection":false});				  						galleries[34892] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"acrylic paintings","link":"gallery_34892.html","maxRecords":0.0,"photoIDs":[3656127.0,5283132.0,7929886.0,2028720.0,438074.0],"skipIndex":0,"section_code":"gallery","featured_images":"7929886,5283132,3656127,2028720,438074","id":34892,"singleSection":false});				  						galleries[119057] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"SNB Instruments","link":"section132202_119057.html","maxRecords":0.0,"photoIDs":[1772982.0,2309946.0,2309957.0,2309964.0,2309977.0,2309981.0,2309986.0,2309996.0,2310006.0,2310016.0,2310023.0,2310025.0,2310027.0,2310035.0,2310037.0,2310044.0,2310051.0,2310059.0,2310062.0,2310082.0,1544896.0],"skipIndex":0,"section_code":"section132202","featured_images":"2310082,2310062,2310059,2310051,2310044,2310037,2310035,2310027,2310025,2310023","id":119057,"singleSection":false});				  						galleries[223374] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Work in Progress","link":"gallery_223374.html","maxRecords":0.0,"photoIDs":[3656035.0,3656092.0,3656105.0],"skipIndex":0,"section_code":"gallery","featured_images":"3656105,3656092,3656035","id":223374,"singleSection":false});				  						galleries[134282] = clik.newGallery({"parentGallery":134283,"usePopups":false,"title":"Fine Liner drawings","link":"gallery_134282.html","maxRecords":0.0,"photoIDs":[438095.0,438158.0,438094.0,438156.0,438091.0,438162.0,492800.0,1768001.0,1117155.0,1124870.0,653154.0],"skipIndex":0,"section_code":"gallery","featured_images":1768001.0,"id":134282,"singleSection":false});				  						galleries[34909] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"other media","link":"gallery_34909.html","maxRecords":0.0,"photoIDs":[2515470.0,438390.0,438388.0,438164.0],"skipIndex":0,"section_code":"gallery","featured_images":"2515470,438390,438388,438164","id":34909,"singleSection":false});				  						galleries[134296] = clik.newGallery({"parentGallery":134283,"usePopups":false,"title":"Pencil drawings","link":"gallery_134296.html","maxRecords":0.0,"photoIDs":[2544703.0,459811.0],"skipIndex":0,"section_code":"gallery","featured_images":"2544703,459811","id":134296,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '7929886';
imageSets[2] = '438087,1056209,1768001,1712602,6033943';
imageSets[3] = '5283132,3656127,3656105,3656092,3656035,2515470,2310082,2310062,2310059,2310051,2310044,2310037,2310035,2310027,2310025,2310023,2310016,2310006,2309996,2309986,2309981,2309977,2309964,2309957,2309946,1775074,1772982,1282317,438390,1544847,1056209,492800,1768001,1544863,1117155,1056217,2028720,1544909';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'www12.clikpic.com/dominicberry/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/dominicberry/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/dominicberry/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/dominicberry/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/dominicberry/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/dominicberry/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/dominicberry/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/dominicberry/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/dominicberry/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/dominicberry/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/dominicberry/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/dominicberry/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/dominicberry/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/dominicberry/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/dominicberry/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/dominicberry/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/dominicberry/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/dominicberry/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/dominicberry/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/dominicberry/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/dominicberry/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/dominicberry/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/dominicberry/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/dominicberry/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/dominicberry/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 = 'Oil, Props and Paint    -    Aviation Art: ' + photoCaption;
			    }
        if (op.$detail.length > 0) {
      	temp = op.nextPhoto.fnGetImageDetails();
	    op.$detail.fadeGalleryDetails(temp, op.speed, function(){
			if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
				toggleAddToCartConfirm(backgrounds, op.$detail);
			} else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
				toggleAddToCartConfirm(photos, op.$detail);
			}
			$('body').trigger('clikUpdate.popup');
	    });
    }
        $(op.$detailContainer).find('.replaceable[class*=replaceable_photo-]').each(function(){
    	var field = clik.getPrefixedClass(this.className, 'replaceable_photo-');
    	if (field in op.nextPhoto) {
    		$(this).fadeGalleryDetails(op.nextPhoto[field], op.speed);
    	}
    }).end().find('.replaceable.photoPayment').fadeGalleryDetails(op.nextPhoto.fnGetPaymentInfo(), op.speed, function(){
		if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
			toggleAddToCartConfirm(backgrounds, op.$detailContainer);
		} else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
			toggleAddToCartConfirm(photos, op.$detailContainer);
		}
		$('body').trigger('clikUpdate.popup');
	});
		if (op.$photo.length > 0) {
		html = $('<img/>',{
			'class': 'mainphoto photo',
			src: photoSrc,
			id: 'mainPic',
			name: 'mainPic',
			width: op.nextPhoto.width,
			height: op.nextPhoto.height,
			alt: photoCaption,
			css: op.css || {}
		});
		if (op.href) {
			if (op.href.match(/<a/)) {
				html = $(op.href).append(html);
			} else {
				html = $('<a/>', {
					href: op.href,
					title: photoCaption
				}).append(html);
			}
		} else {
			html = $('<a/>', {
				title: photoCaption
			}).append(html);
		}
		if (op.speed == 0) {			op.$photo.html(html);			if (op.onBefore) {			  	op.onBefore.apply(op.$photo);			}			if (op.onAfter) {			  	op.onAfter.apply(op.$photo);			}		} else {			op.$photo.stop(true,true).fadeReplaceWith(html,op.speed,'',function(){  				if (op.onAfter) {				  	op.onAfter.apply(this);				}				clik.doColumnResize(false, $(this).add(op.$detail).add(op.$title));			}, op.onBefore);
		}	}
    if (op.field) {
		op.field.value = photoId;
	} else {
		op.$photo.data('image_id', photoId);
    }
        if (!op.speed) {
      	clik.doColumnResize(false, op.$photo.add(op.$detail).add(op.$title));
    }
        
    return html;
	}

/***************************************************************************
* Toggle add to cart confirmation element and set up the click event for   *
* the 'Add to cart' button.                                                *
***************************************************************************/
function toggleAddToCartConfirm(array, root){
	if (typeof(array) !== 'object' || array === null) {
	  	array = photos;
	}
	if (!$(root).length) {		root = $('body');	}	if($('#paymentConfirm', root).length > 0){
		$('#paymentConfirm', root).hide();
		$('#paymentAddButton', root)
		.unbind()
		.click(function(){
						form = $('#paymentForm', root)[0];
			option_id = 0;
			if(form.item_option.value){
				option_id = form.item_option.value;
			}
			if(addItemToBasket(form.item_number.value,array,form.site.value,parseInt(form.quantity.value, 10),option_id)){
				if($.browser.msie){$('#paymentConfirm', root).text('Item added to cart').show();}
				else{
					$('#paymentConfirm', root).text('Item added to cart').fadeIn();
					dspOrderDetails(form.site.value);
				}
			}
			else{
				$('#paymentConfirm', root).text('Item not added - check cookies are enabled in your browser.').fadeIn();
			}
		});
	}
}

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
clik.photo.fnGetImageDetails = function(){
	var temp = '';
	if (this.description != '') {
		temp +=  '<div id="imageDescription">' + this.description + '</div>';
	}
		if (this.takendate != '') {
		
		temp += '<div class="imageinfo" id="imageDate"><strong>Date: </strong>' + this.takendate + '</div>';
	}
	
	if (this.location != '') {
		
		temp += '<div class="imageinfo" id="imageLocation"><strong>medium:  </strong>' +  this.location + '</div>';
	}
	
	if (this.photographer != '') {
		
		temp += '<div class="imageinfo" id="imagePhotographer"><strong>price for original:  </strong>' + this.photographer + '</div>';
	}
				
	temp += this.fnGetPaymentInfo();
				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>Buy now using Paypal:</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  original 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="dberry@thomas-hardye.dorset.sch.uk">';
					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="dberry@thomas-hardye.dorset.sch.uk">';
				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;
	}
}

			

