window.thumbnails = {};
															thumbnails[16871] = clik.newPhoto({"id":16871,"src":"museum-composite-flat_thumb.jpg","galleries_id":85340,"server_id":18,"link":"photo_16871.html","width":130,"caption":"Museum of Scotland","height":102});
															thumbnails[16874] = clik.newPhoto({"id":16874,"src":"Knockhill-Super-bikes-003_thumb.jpg","galleries_id":2045,"server_id":18,"link":"photo_16874.html","width":130,"caption":"Legend","height":98});
															thumbnails[16876] = clik.newPhoto({"id":16876,"src":"Bently-2d_thumb.jpg","galleries_id":2045,"server_id":18,"link":"photo_16876.html","width":130,"caption":"Bentley","height":98});
															thumbnails[16878] = clik.newPhoto({"id":16878,"src":"Ferrari-F,I,S_thumb.jpg","galleries_id":2045,"server_id":18,"link":"photo_16878.html","width":130,"caption":"Ferrari","height":97});
															thumbnails[16879] = clik.newPhoto({"id":16879,"src":"Triumph_thumb.jpg","galleries_id":2045,"server_id":18,"link":"photo_16879.html","width":130,"caption":"Triumph","height":95});
															thumbnails[16882] = clik.newPhoto({"id":16882,"src":"Larbert-church-3-Flat_thumb.jpg","galleries_id":85338,"server_id":18,"link":"photo_16882.html","width":130,"caption":"Larbert church","height":171});
															thumbnails[16894] = clik.newPhoto({"id":16894,"src":"Tolbooth_thumb.jpg","galleries_id":85340,"server_id":18,"link":"photo_16894.html","width":130,"caption":"Tolbooth","height":135});
															thumbnails[16895] = clik.newPhoto({"id":16895,"src":"Blacknessflat_thumb.jpg","galleries_id":85338,"server_id":18,"link":"photo_16895.html","width":130,"caption":"Blackness","height":92});
															thumbnails[16896] = clik.newPhoto({"id":16896,"src":"Knox-flat-011231_thumb.jpg","galleries_id":85340,"server_id":18,"link":"photo_16896.html","width":130,"caption":"Knox","height":164});
															thumbnails[16897] = clik.newPhoto({"id":16897,"src":"Prospect-5-FIAS_thumb.jpg","galleries_id":2043,"server_id":18,"link":"photo_16897.html","width":130,"caption":"Prospect Housing","height":98});
															thumbnails[16899] = clik.newPhoto({"id":16899,"src":"Tollcross-2_thumb.jpg","galleries_id":2043,"server_id":18,"link":"photo_16899.html","width":130,"caption":"Tollcross","height":135});
															thumbnails[17060] = clik.newPhoto({"id":17060,"src":"Bedford1_thumb.jpg","galleries_id":85357,"server_id":18,"link":"photo_17060.html","width":130,"caption":"Leyland","height":116});
															thumbnails[17061] = clik.newPhoto({"id":17061,"src":"blackness-4-Pier-F,I,S_thumb.jpg","galleries_id":2070,"server_id":18,"link":"photo_17061.html","width":130,"caption":"Blackness pier","height":98});
															thumbnails[17062] = clik.newPhoto({"id":17062,"src":"lighter-project2_thumb.jpg","galleries_id":2056,"server_id":18,"link":"photo_17062.html","width":130,"caption":"Zippo","height":143});
															thumbnails[17063] = clik.newPhoto({"id":17063,"src":"Lagonda_thumb.jpg","galleries_id":2045,"server_id":18,"link":"photo_17063.html","width":130,"caption":"Lagonda","height":100});
															thumbnails[17065] = clik.newPhoto({"id":17065,"src":"church-flat_thumb.jpg","galleries_id":85338,"server_id":18,"link":"photo_17065.html","width":130,"caption":"London Rd. Church","height":194});
															thumbnails[17120] = clik.newPhoto({"id":17120,"src":"Corvette-600-pixels_thumb.jpg","galleries_id":2045,"server_id":18,"link":"photo_17120.html","width":130,"caption":"Corvette","height":89});
															thumbnails[17121] = clik.newPhoto({"id":17121,"src":"Livingston-020302_thumb.jpg","galleries_id":2043,"server_id":18,"link":"photo_17121.html","width":130,"caption":"Livingston Primary School","height":92});
															thumbnails[17122] = clik.newPhoto({"id":17122,"src":"Kirkliston-003_thumb.jpg","galleries_id":2043,"server_id":18,"link":"photo_17122.html","width":130,"caption":"Kirkliston Medical Centre","height":87});
															thumbnails[17332] = clik.newPhoto({"id":17332,"src":"Aberlady-church-2_thumb.jpg","galleries_id":85338,"server_id":18,"link":"photo_17332.html","width":130,"caption":"Aberlady Church","height":166});
															thumbnails[17333] = clik.newPhoto({"id":17333,"src":"Culross-2_thumb.jpg","galleries_id":85340,"server_id":18,"link":"photo_17333.html","width":130,"caption":"Culross Palace","height":104});
															thumbnails[17334] = clik.newPhoto({"id":17334,"src":"Grangemouth_thumb.jpg","galleries_id":2070,"server_id":18,"link":"photo_17334.html","width":130,"caption":"Grangemouth Refinary","height":84});
															thumbnails[17335] = clik.newPhoto({"id":17335,"src":"Lecropt-church-fs_thumb.jpg","galleries_id":85338,"server_id":18,"link":"photo_17335.html","width":130,"caption":"Lecropt Church","height":169});
															thumbnails[17336] = clik.newPhoto({"id":17336,"src":"Pocket-watch-project-3_2_thumb.jpg","galleries_id":2070,"server_id":18,"link":"photo_17336.html","width":130,"caption":"Fusee","height":98});
															thumbnails[17337] = clik.newPhoto({"id":17337,"src":"Scots-Measure-Violin_thumb.jpg","galleries_id":2056,"server_id":18,"link":"photo_17337.html","width":130,"caption":"Violin","height":173});
															thumbnails[18314] = clik.newPhoto({"id":18314,"src":"Bobby-redone_thumb.jpg","galleries_id":2056,"server_id":18,"link":"photo_18314.html","width":130,"caption":"Bobby","height":89});
															thumbnails[18315] = clik.newPhoto({"id":18315,"src":"Fa'side-Water-100101a_thumb.jpg","galleries_id":85338,"server_id":18,"link":"photo_18315.html","width":130,"caption":"Fa'side Castle","height":175});
															thumbnails[18319] = clik.newPhoto({"id":18319,"src":"Bruce140402_thumb.b.jpg","galleries_id":2070,"server_id":18,"link":"photo_18319.html","width":130,"caption":"Bruce","height":153});
															thumbnails[18321] = clik.newPhoto({"id":18321,"src":"nikon_thumb.jpg","galleries_id":2056,"server_id":18,"link":"photo_18321.html","width":130,"caption":"Nikon","height":98});
															thumbnails[18322] = clik.newPhoto({"id":18322,"src":"S_thumb.Queensferry.jpg","galleries_id":85340,"server_id":18,"link":"photo_18322.html","width":130,"caption":"South Queensferry Medical Centre","height":84});
															thumbnails[176819] = clik.newPhoto({"id":176819,"src":"Cottrell-Building_thumb.jpg","galleries_id":85340,"server_id":18,"link":"photo_176819.html","width":130,"caption":"Cottrell Building","height":95});
															thumbnails[176820] = clik.newPhoto({"id":176820,"src":"caledonia-68-b_thumb.jpg","galleries_id":85355,"server_id":18,"link":"photo_176820.html","width":130,"caption":"Caledonia 68","height":80});
															thumbnails[176822] = clik.newPhoto({"id":176822,"src":"lotus_thumb.jpg","galleries_id":2045,"server_id":18,"link":"photo_176822.html","width":130,"caption":"Lotus 24","height":87});
															thumbnails[176823] = clik.newPhoto({"id":176823,"src":"Tractor-2_thumb.jpg","galleries_id":85357,"server_id":18,"link":"photo_176823.html","width":130,"caption":"Case International","height":84});
															thumbnails[176824] = clik.newPhoto({"id":176824,"src":"Triumph-last-attempt_thumb.jpg","galleries_id":85355,"server_id":18,"link":"photo_176824.html","width":130,"caption":"Triumph Speed triple","height":100});
															thumbnails[358245] = clik.newPhoto({"id":358245,"src":"Mini_thumb.jpg","galleries_id":85355,"server_id":18,"link":"photo_358245.html","width":130,"caption":"Mini No 4","height":89});
															thumbnails[1187246] = clik.newPhoto({"id":1187246,"src":"Fordson-2_thumb.jpg","galleries_id":85357,"server_id":18,"link":"photo_1187246.html","width":130,"caption":"Fordson 2","height":174});
															thumbnails[1187247] = clik.newPhoto({"id":1187247,"src":"BMW-v-Mustang_thumb.jpg","galleries_id":85355,"server_id":18,"link":"photo_1187247.html","width":130,"caption":"BMW v Ford","height":68});
															thumbnails[1187248] = clik.newPhoto({"id":1187248,"src":"Clackmannan-tower-textured_thumb.jpg","galleries_id":85340,"server_id":18,"link":"photo_1187248.html","width":130,"caption":"Clackmannan Tower","height":91});
															thumbnails[1187249] = clik.newPhoto({"id":1187249,"src":"GT-350_thumb.jpg","galleries_id":85355,"server_id":18,"link":"photo_1187249.html","width":130,"caption":"Mustang 350 GT","height":79});
															thumbnails[1187250] = clik.newPhoto({"id":1187250,"src":"Jaguar-120_thumb.jpg","galleries_id":2045,"server_id":18,"link":"photo_1187250.html","width":130,"caption":"Jaguar 120","height":94});
															thumbnails[1187251] = clik.newPhoto({"id":1187251,"src":"Mechanic's-Choice_thumb.jpg","galleries_id":85355,"server_id":18,"link":"photo_1187251.html","width":130,"caption":"J Clark","height":62});
															thumbnails[1187252] = clik.newPhoto({"id":1187252,"src":"Morgans_thumb.jpg","galleries_id":2045,"server_id":18,"link":"photo_1187252.html","width":130,"caption":"Morgans","height":54});
															thumbnails[1187253] = clik.newPhoto({"id":1187253,"src":"Tyrrell-mechanic_thumb.jpg","galleries_id":85355,"server_id":18,"link":"photo_1187253.html","width":130,"caption":"Tyrrell Mechanic","height":166});
															thumbnails[1187456] = clik.newPhoto({"id":1187456,"src":"Jackie-Stewart_thumb.jpg","galleries_id":85355,"server_id":18,"link":"photo_1187456.html","width":130,"caption":"Jackie Stewart","height":60});
															thumbnails[1187498] = clik.newPhoto({"id":1187498,"src":"Culross-Palace_thumb.jpg","galleries_id":85338,"server_id":18,"link":"photo_1187498.html","width":130,"caption":"Culross Palace","height":68});
															thumbnails[1187524] = clik.newPhoto({"id":1187524,"src":"Old-Trucks-0181_thumb.jpg","galleries_id":85357,"server_id":18,"link":"photo_1187524.html","width":130,"caption":"","height":185});
															thumbnails[1187568] = clik.newPhoto({"id":1187568,"src":"Kirkcaldy-021_thumb.jpg","galleries_id":2043,"server_id":18,"link":"photo_1187568.html","width":130,"caption":"S. Queensferry Medical Centre","height":83});
															thumbnails[1187598] = clik.newPhoto({"id":1187598,"src":"Slateford-Rads-1_thumb.jpg","galleries_id":2043,"server_id":18,"link":"photo_1187598.html","width":130,"caption":"Slateford 1","height":94});
															thumbnails[1187601] = clik.newPhoto({"id":1187601,"src":"Slateford-Rads-6_thumb.jpg","galleries_id":2043,"server_id":18,"link":"photo_1187601.html","width":130,"caption":"Slateford 2","height":131});
															thumbnails[1187602] = clik.newPhoto({"id":1187602,"src":"Slateford-Rads-9_thumb.jpg","galleries_id":2043,"server_id":18,"link":"photo_1187602.html","width":130,"caption":"Slateford 3","height":92});
															thumbnails[1188081] = clik.newPhoto({"id":1188081,"src":"Glenap-interior_thumb.jpg","galleries_id":85338,"server_id":18,"link":"photo_1188081.html","width":130,"caption":"Glenap interior","height":96});
															thumbnails[1188083] = clik.newPhoto({"id":1188083,"src":"Scape-2_thumb.jpg","galleries_id":2056,"server_id":18,"link":"photo_1188083.html","width":130,"caption":"Scape 2","height":46});
															thumbnails[1188084] = clik.newPhoto({"id":1188084,"src":"Scape-5_thumb.jpg","galleries_id":2056,"server_id":18,"link":"photo_1188084.html","width":130,"caption":"Scape 5","height":71});
															thumbnails[1188088] = clik.newPhoto({"id":1188088,"src":"Universal2_thumb.jpg","galleries_id":2070,"server_id":18,"link":"photo_1188088.html","width":130,"caption":"Universal","height":92});
															thumbnails[1188089] = clik.newPhoto({"id":1188089,"src":"Fringe-Raider_thumb.jpg","galleries_id":2070,"server_id":18,"link":"photo_1188089.html","width":130,"caption":"Fringe Raider","height":173});
															thumbnails[1188090] = clik.newPhoto({"id":1188090,"src":"Blue-girl_thumb.jpg","galleries_id":2070,"server_id":18,"link":"photo_1188090.html","width":130,"caption":"Blue Girl","height":152});
															thumbnails[8622764] = clik.newPhoto({"id":8622764,"src":"Camera_Sensor_thumb.jpg","galleries_id":455708,"server_id":37,"link":"photo_8622764.html","width":130,"caption":"Camera sensor","height":98});
															thumbnails[8622767] = clik.newPhoto({"id":8622767,"src":"Earwig_thumb.jpg","galleries_id":455708,"server_id":37,"link":"photo_8622767.html","width":130,"caption":"Earwig","height":101});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[2043] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Architecture 1","link":"gallery_2043.html","maxRecords":0.0,"photoIDs":[16897.0,16899.0,17121.0,17122.0,1187568.0,1187598.0,1187601.0,1187602.0],"skipIndex":0,"section_code":"gallery","featured_images":17122.0,"id":2043,"singleSection":false});				  						galleries[85338] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Architecture 2","link":"gallery_85338.html","maxRecords":0.0,"photoIDs":[16882.0,16895.0,17065.0,17332.0,17335.0,18315.0,1187498.0,1188081.0],"skipIndex":0,"section_code":"gallery","featured_images":16895.0,"id":85338,"singleSection":false});				  						galleries[85340] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Architecture 3","link":"gallery_85340.html","maxRecords":0.0,"photoIDs":[16871.0,16894.0,16896.0,17333.0,18322.0,176819.0,1187248.0],"skipIndex":0,"section_code":"gallery","featured_images":"1187248,176819,18322,17333,16896,16894,16871","id":85340,"singleSection":false});				  						galleries[2045] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Automotive 1","link":"gallery_2045.html","maxRecords":0.0,"photoIDs":[16874.0,16876.0,16878.0,16879.0,17063.0,17120.0,176822.0,1187250.0,1187252.0],"skipIndex":0,"section_code":"gallery","featured_images":16874.0,"id":2045,"singleSection":false});				  						galleries[85355] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Automotive 2","link":"gallery_85355.html","maxRecords":0.0,"photoIDs":[176820.0,176824.0,358245.0,1187247.0,1187249.0,1187251.0,1187253.0,1187456.0],"skipIndex":0,"section_code":"gallery","featured_images":"1187456,1187253,1187251,1187249,1187247,358245,176824,176820","id":85355,"singleSection":false});				  						galleries[85357] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Automotive 3","link":"gallery_85357.html","maxRecords":0.0,"photoIDs":[17060.0,176823.0,1187246.0,1187524.0],"skipIndex":0,"section_code":"gallery","featured_images":17060.0,"id":85357,"singleSection":false});				  						galleries[2056] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Photo \/ Art","link":"gallery_2056.html","maxRecords":0.0,"photoIDs":[17062.0,17337.0,18314.0,18321.0,1188083.0,1188084.0],"skipIndex":0,"section_code":"gallery","featured_images":18321.0,"id":2056,"singleSection":false});				  						galleries[2070] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Miscellaneous","link":"gallery_2070.html","maxRecords":0.0,"photoIDs":[17061.0,17334.0,17336.0,18319.0,1188088.0,1188089.0,1188090.0],"skipIndex":0,"section_code":"gallery","featured_images":"1188090,1188089,1188088,18319,17336,17334,17061","id":2070,"singleSection":false});				  						galleries[455708] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Some Science","link":"gallery_455708.html","maxRecords":0.0,"photoIDs":[8622764.0,8622767.0],"skipIndex":0,"section_code":"gallery","featured_images":"8622767,8622764","id":455708,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '176819';
imageSets[2] = '18321,17122,17060,16895,16874';
imageSets[3] = '8622767,8622764,1188090,1188089,1188088,1188084,1188083,1188081,1187602,1187601,1187598,1187568,1187524,1187498,1187456,1187253,1187252,1187251,1187250,1187249,1187248,1187247,1187246,358245,176824,176823,176822,176820,176819,18322,18321,18319,18315,18314,17337,17336,17335,17334,17333,17332,17122,17121,17120,17065,17063,17062,17061,17060,16899,16897';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'www12.clikpic.com/tomforrest/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/tomforrest/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/tomforrest/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/tomforrest/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/tomforrest/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/tomforrest/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/tomforrest/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/tomforrest/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/tomforrest/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/tomforrest/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/tomforrest/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/tomforrest/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/tomforrest/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/tomforrest/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/tomforrest/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/tomforrest/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/tomforrest/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/tomforrest/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/tomforrest/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/tomforrest/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/tomforrest/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/tomforrest/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/tomforrest/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/tomforrest/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 = 'TOM FORREST   FBIPP ARPS: ' + 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.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 += '<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;
	}
}

			

