window.thumbnails = {};
thumbnails[8830843] = clik.newPhoto({"link":"#","caption":"","height":120,"id":8830843,"server_id":21,"src":"042_C_thumb.JPG","galleries_id":"","width":160});
thumbnails[8830925] = clik.newPhoto({"link":"#","caption":"lisbon tram","height":190,"id":8830925,"server_id":21,"src":"L1000710_thumb.JPG","galleries_id":"","width":190});
thumbnails[8830877] = clik.newPhoto({"link":"photo_8830877.html","caption":"lisbon","height":190,"id":8830877,"server_id":21,"src":"L1010066_thumb.JPG","galleries_id":464346,"width":190});
thumbnails[8830907] = clik.newPhoto({"link":"photo_8830907.html","caption":"london to exeter","height":190,"id":8830907,"server_id":21,"src":"007_thumb.JPG","galleries_id":464604,"width":190});
thumbnails[8830914] = clik.newPhoto({"link":"photo_8830914.html","caption":"paris","height":190,"id":8830914,"server_id":21,"src":"L1010140_thumb.JPG","galleries_id":464347,"width":190});
thumbnails[8830917] = clik.newPhoto({"link":"photo_8830917.html","caption":"paris","height":190,"id":8830917,"server_id":21,"src":"L1010375_thumb.JPG","galleries_id":464604,"width":190});
thumbnails[8830920] = clik.newPhoto({"link":"photo_8830920.html","caption":"paris","height":190,"id":8830920,"server_id":21,"src":"164_thumb.JPG","galleries_id":464347,"width":190});
thumbnails[8840005] = clik.newPhoto({"link":"photo_8840005.html","caption":"berlin","height":190,"id":8840005,"server_id":21,"src":"berlin_etc_298_C6B46F3B-1EC9-DFB6-0900BA197CAA23BC_thumb.JPG","galleries_id":464604,"width":190});
thumbnails[8859119] = clik.newPhoto({"link":"photo_8859119.html","caption":"","height":190,"id":8859119,"server_id":21,"src":"lkr_lj001_thumb.JPG","galleries_id":464646,"width":190});
thumbnails[8859127] = clik.newPhoto({"link":"photo_8859127.html","caption":"","height":190,"id":8859127,"server_id":21,"src":"lkr_lj004_thumb.jpg","galleries_id":464646,"width":190});
thumbnails[8859131] = clik.newPhoto({"link":"photo_8859131.html","caption":"","height":190,"id":8859131,"server_id":21,"src":"lkr_lj005_thumb.jpg","galleries_id":464646,"width":190});
thumbnails[8859132] = clik.newPhoto({"link":"photo_8859132.html","caption":"","height":190,"id":8859132,"server_id":21,"src":"lkr_lj006_thumb.jpg","galleries_id":464646,"width":190});
thumbnails[8859134] = clik.newPhoto({"link":"photo_8859134.html","caption":"","height":190,"id":8859134,"server_id":21,"src":"lkr_lj007_thumb.JPG","galleries_id":464646,"width":190});
thumbnails[8859144] = clik.newPhoto({"link":"photo_8859144.html","caption":"berkeley square, london","height":190,"id":8859144,"server_id":21,"src":"L1000650_thumb.JPG","galleries_id":464347,"width":190});
thumbnails[8859156] = clik.newPhoto({"link":"photo_8859156.html","caption":"cascais, portugal","height":190,"id":8859156,"server_id":21,"src":"L1000823_thumb.JPG","galleries_id":464347,"width":190});
thumbnails[8859163] = clik.newPhoto({"link":"photo_8859163.html","caption":"lisbon","height":190,"id":8859163,"server_id":21,"src":"L1010051_thumb_062A5C74-1EC9-DFB6-09BB47CF27A4304B.JPG","galleries_id":464347,"width":190});
thumbnails[8859178] = clik.newPhoto({"link":"photo_8859178.html","caption":"paris","height":190,"id":8859178,"server_id":21,"src":"L1010335_thumb.JPG","galleries_id":464347,"width":190});
thumbnails[8859219] = clik.newPhoto({"link":"photo_8859219.html","caption":"paris","height":190,"id":8859219,"server_id":21,"src":"L1010343_thumb.JPG","galleries_id":464346,"width":190});
thumbnails[8859224] = clik.newPhoto({"link":"photo_8859224.html","caption":"lisbon","height":190,"id":8859224,"server_id":21,"src":"L1000967_thumb.JPG","galleries_id":464346,"width":190});
thumbnails[8859228] = clik.newPhoto({"link":"photo_8859228.html","caption":"paris isle st'louis","height":190,"id":8859228,"server_id":21,"src":"L1010256_thumb.JPG","galleries_id":464347,"width":190});
thumbnails[8859247] = clik.newPhoto({"link":"photo_8859247.html","caption":"paris metro","height":190,"id":8859247,"server_id":21,"src":"113_thumb.JPG","galleries_id":464346,"width":190});
thumbnails[8859297] = clik.newPhoto({"link":"photo_8859297.html","caption":"paris la'defense","height":190,"id":8859297,"server_id":21,"src":"128_thumb.JPG","galleries_id":465865,"width":190});
thumbnails[8859304] = clik.newPhoto({"link":"photo_8859304.html","caption":"paris isle st'louis","height":190,"id":8859304,"server_id":21,"src":"window_pic_thumb.JPG","galleries_id":465865,"width":190});
thumbnails[8859308] = clik.newPhoto({"link":"photo_8859308.html","caption":"museum madrid","height":189,"id":8859308,"server_id":21,"src":"127_thumb.JPG","galleries_id":465865,"width":190});
thumbnails[8859315] = clik.newPhoto({"link":"photo_8859315.html","caption":"lisbon","height":190,"id":8859315,"server_id":21,"src":"L1010090_thumb.JPG","galleries_id":464604,"width":190});
thumbnails[8859329] = clik.newPhoto({"link":"photo_8859329.html","caption":"paris marais","height":190,"id":8859329,"server_id":21,"src":"L1010167_thumb.JPG","galleries_id":465865,"width":190});
thumbnails[8975685] = clik.newPhoto({"link":"photo_8975685.html","caption":"charing x road","height":190,"id":8975685,"server_id":21,"src":"CIMG0725v2_thumb_FB12EB3A-24E8-5EC4-4FDA4BF198B07FDC.jpg","galleries_id":464346,"width":190});
thumbnails[9002505] = clik.newPhoto({"link":"photo_9002505.html","caption":"paris graffiti","height":190,"id":9002505,"server_id":21,"src":"L1010400_thumb_31BCB0E5-24E8-5EC4-4FD2A6A0E162FFF1.JPG","galleries_id":464346,"width":190});
thumbnails[9044303] = clik.newPhoto({"link":"photo_9044303.html","caption":"","height":190,"id":9044303,"server_id":21,"src":"L1010491_thumb_3E67A233-1EC9-D45B-1C19DD39EC45EA7C.JPG","galleries_id":464646,"width":190});
thumbnails[9044361] = clik.newPhoto({"link":"photo_9044361.html","caption":"paris","height":190,"id":9044361,"server_id":21,"src":"L1010304_thumb_3EABCE65-1EC9-D45B-1CCC273ADB76ECA9.JPG","galleries_id":464347,"width":190});
thumbnails[9044385] = clik.newPhoto({"link":"photo_9044385.html","caption":"paris","height":190,"id":9044385,"server_id":21,"src":"L1010322_thumb_3EB8BB73-1EC9-D45B-1C36ED8A25D90146.JPG","galleries_id":464347,"width":190});
thumbnails[9044392] = clik.newPhoto({"link":"photo_9044392.html","caption":"national gallery - london","height":190,"id":9044392,"server_id":21,"src":"CIMG0807_thumb_3EC519E8-1EC9-D45B-1C0969BF87D3EF0C.JPG","galleries_id":465865,"width":190});
thumbnails[9044398] = clik.newPhoto({"link":"photo_9044398.html","caption":"chelsea","height":190,"id":9044398,"server_id":21,"src":"L1010461bw_thumb_3ED096DD-1EC9-D45B-1CD6BF869D0DB820.jpg","galleries_id":465865,"width":190});
thumbnails[9044405] = clik.newPhoto({"link":"photo_9044405.html","caption":"lisbon","height":189,"id":9044405,"server_id":21,"src":"L1000988_thumb_3EE34225-1EC9-D45B-1CB9946B9EDFFB38.JPG","galleries_id":464604,"width":190});
thumbnails[9044413] = clik.newPhoto({"link":"photo_9044413.html","caption":"paris","height":190,"id":9044413,"server_id":21,"src":"250_thumb_3EF3B7D9-1EC9-D45B-1C716C0D2C671CE3.JPG","galleries_id":464604,"width":190});
thumbnails[9044435] = clik.newPhoto({"link":"photo_9044435.html","caption":"lisbon","height":190,"id":9044435,"server_id":21,"src":"L1000994crop_BW_thumb_3F18D363-1EC9-D45B-1CBE373D33DEB8E1.jpg","galleries_id":464346,"width":190});
thumbnails[9044437] = clik.newPhoto({"link":"photo_9044437.html","caption":"tate london","height":190,"id":9044437,"server_id":21,"src":"CIMG0788_thumb_404D2F40-24E8-5EC4-4F14FA5E85CC6D50.JPG","galleries_id":464346,"width":190});
thumbnails[9076205] = clik.newPhoto({"link":"photo_9076205.html","caption":"posh frock","height":190,"id":9076205,"server_id":21,"src":"jan_thumb_D74EA9B4-1EC9-D45B-1C0E6BBFA7E6FB9D.jpg","galleries_id":478696,"width":190});
thumbnails[9076207] = clik.newPhoto({"link":"photo_9076207.html","caption":"goin' down - lisbon","height":190,"id":9076207,"server_id":21,"src":"L1000887_thumb_D75DE491-1EC9-D45B-1CB857D8EB2D350A.JPG","galleries_id":478696,"width":190});
thumbnails[9076212] = clik.newPhoto({"link":"photo_9076212.html","caption":"little orson","height":190,"id":9076212,"server_id":21,"src":"100_0278_00_thumb_D7687712-1EC9-D45B-1CA01FAECE8A0C28.jpg","galleries_id":478696,"width":190});
thumbnails[9076908] = clik.newPhoto({"link":"photo_9076908.html","caption":"local graffiti","height":190,"id":9076908,"server_id":21,"src":"lee_green_jan_2012_thumb_DA001BA2-24E8-5EC4-4F17AAC9B1F46750.jpg","galleries_id":464346,"width":190});
thumbnails[9077515] = clik.newPhoto({"link":"photo_9077515.html","caption":"muse reflected","height":190,"id":9077515,"server_id":21,"src":"L1000894_thumb_DE7D4299-1EC9-DFB6-098CFB44CDC34B15.JPG","galleries_id":478696,"width":190});
thumbnails[9077519] = clik.newPhoto({"link":"photo_9077519.html","caption":"himself","height":190,"id":9077519,"server_id":21,"src":"L1000990_thumb_DE8E4A91-1EC9-DFB6-0937FDA83A569666.JPG","galleries_id":478696,"width":190});
thumbnails[9077531] = clik.newPhoto({"link":"photo_9077531.html","caption":"couple in madrid gallery","height":190,"id":9077531,"server_id":21,"src":"183_thumb_DECD3CE6-1EC9-DFB6-0953B2EED26D63F6.JPG","galleries_id":478696,"width":190});
thumbnails[9102293] = clik.newPhoto({"link":"photo_9102293.html","caption":"ferrier snow","height":190,"id":9102293,"server_id":21,"src":"CIMG0851_1_thumb1_1.JPG","galleries_id":464346,"width":190});
thumbnails[9102312] = clik.newPhoto({"link":"photo_9102312.html","caption":"lighthouse - portugal (yes I still like 'em)","height":190,"id":9102312,"server_id":21,"src":"L1000790_1_thumb1_1.JPG","galleries_id":464346,"width":190});
thumbnails[9102338] = clik.newPhoto({"link":"photo_9102338.html","caption":"bailiffs court - january ","height":190,"id":9102338,"server_id":21,"src":"CIMG0774_1_thumb1_1.JPG","galleries_id":464346,"width":190});
thumbnails[9111970] = clik.newPhoto({"link":"photo_9111970.html","caption":"from the elephant","height":190,"id":9111970,"server_id":21,"src":"CIMG0052_1_thumb1_1.JPG","galleries_id":465865,"width":190});
thumbnails[9111981] = clik.newPhoto({"link":"photo_9111981.html","caption":"paris sleeper","height":189,"id":9111981,"server_id":21,"src":"244_1_thumb1_1.JPG","galleries_id":478696,"width":190});
thumbnails[9111986] = clik.newPhoto({"link":"photo_9111986.html","caption":"tokyo gallery","height":190,"id":9111986,"server_id":21,"src":"100_1660_1_thumb1_1.jpg","galleries_id":478696,"width":190});
thumbnails[9112000] = clik.newPhoto({"link":"photo_9112000.html","caption":"muse, portugal","height":190,"id":9112000,"server_id":21,"src":"L1000778_1_thumb1_1.JPG","galleries_id":478696,"width":190});
thumbnails[9112313] = clik.newPhoto({"link":"photo_9112313.html","caption":"photography gallery - saul leiter in paris","height":190,"id":9112313,"server_id":21,"src":"L1010599-1_1_thumb1_1.JPG","galleries_id":465865,"width":190});
thumbnails[9112320] = clik.newPhoto({"link":"photo_9112320.html","caption":"lisbon shop & tram","height":190,"id":9112320,"server_id":21,"src":"L1000708_1_thumb1_1.JPG","galleries_id":465865,"width":190});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
galleries[464604] = clik.newGallery({"photoIDs":[8830907,8830917,8840005,8859315,9044405,9044413],"link":"gallery_464604.html","skipIndex":0,"section_code":"gallery","id":464604,"parentGallery":"","featured_images":"9044413,9044405,8859315,8840005,8830917,8830907","maxRecords":0,"usePopups":false,"singleSection":false,"title":"coffee"});galleries[464646] = clik.newGallery({"photoIDs":[8859119,8859127,8859131,8859132,8859134,9044303],"link":"gallery_464646.html","skipIndex":0,"section_code":"gallery","id":464646,"parentGallery":"","featured_images":"9044303,8859134,8859132,8859131,8859127,8859119","maxRecords":0,"usePopups":false,"singleSection":false,"title":"little jimmy"});galleries[478696] = clik.newGallery({"photoIDs":[9076205,9076207,9076212,9077515,9077519,9077531,9111981,9111986,9112000],"link":"gallery_478696.html","skipIndex":0,"section_code":"gallery","id":478696,"parentGallery":"","featured_images":"9112000,9111986,9111981,9077531,9077519,9077515,9076212,9076207,9076205","maxRecords":0,"usePopups":false,"singleSection":false,"title":"people & portraits"});galleries[465865] = clik.newGallery({"photoIDs":[8859297,8859304,8859308,8859329,9044392,9044398,9111970,9112313,9112320],"link":"gallery_465865.html","skipIndex":0,"section_code":"gallery","id":465865,"parentGallery":"","featured_images":"9112320,9112313,9111970,9044398,9044392,8859329,8859308,8859304,8859297","maxRecords":0,"usePopups":false,"singleSection":false,"title":"reflection"});galleries[464346] = clik.newGallery({"photoIDs":[8830877,8859219,8859224,8859247,8975685,9002505,9044435,9044437,9076908,9102293,9102312,9102338],"link":"gallery_464346.html","skipIndex":0,"section_code":"gallery","id":464346,"parentGallery":"","featured_images":"9102338,9102312,9102293,9076908,9044437,9044435,9002505,8975685,8859247,8859224","maxRecords":0,"usePopups":false,"singleSection":false,"title":"recent photos"});galleries[464347] = clik.newGallery({"photoIDs":[8830914,8830920,8859144,8859156,8859163,8859178,8859228,9044361,9044385],"link":"gallery_464347.html","skipIndex":0,"section_code":"gallery","id":464347,"parentGallery":"","featured_images":"9044385,9044361,8859228,8859178,8859163,8859156,8859144,8830920,8830914","maxRecords":0,"usePopups":false,"singleSection":false,"title":"on reading"});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[3] = '9112320,9112313,9112000,9111986,9111981,9111970,9102338,9102312,9102293,9077531,9077519,9077515,9076908,9076212,9076207,9076205,9044437,9044435,9044413,9044405,9044398,9044392,9044385,9044361,9044303,9002505,8975685,8859329,8859315,8859308,8859304,8859297,8859247,8859228,8859224,8859219,8859178,8859163,8859156,8859144,8859134,8859132,8859131,8859127,8859119,8840005,8830925,8830920,8830917,8830914';
imageSets[1] = '8830843';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/lkrobinson/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/lkrobinson/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/lkrobinson/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/lkrobinson/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/lkrobinson/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/lkrobinson/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/lkrobinson/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/lkrobinson/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/lkrobinson/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/lkrobinson/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/lkrobinson/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/lkrobinson/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/lkrobinson/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/lkrobinson/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/lkrobinson/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/lkrobinson/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/lkrobinson/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/lkrobinson/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/lkrobinson/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/lkrobinson/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/lkrobinson/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/lkrobinson/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/lkrobinson/images';
		break;
	}
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/lkrobinson/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/lkrobinson/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/lkrobinson/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/lkrobinson/images';
		break;
	}
		return val;
}

/***************************************************************************
* img = reference to image object in which to show image                   *
***************************************************************************/
function showHomeImage(img) {
	imageID = randomListVal('');
	if (!basic) {
		img.src = photos[imageID].src;
		img.width = photos[imageID].width;
		img.height = photos[imageID].height;
		img.parentNode.title = img.alt = photos[imageID].caption;
	} else {
		newImage = new Image(photos[imageID].width,photos[imageID].height);
		newImage.src = photos[imageID].src;
		document.images[img.name] = newImage;
		
	}
}

function getHomeImageLink(imageID) {
  	var href='', photo = (backgrounds || photos || {})[imageID];
	if(photo){
		if (photo && photo.galleries_id != '') {
  			href = photo.fnGalleryLink();
  		}
  		  		else {
  				href += 'gallery.html';
  	  		}
	}
    return href;
}

/***************************************************************************
* Show a random image on home page from featured images                    *
***************************************************************************/
function showHomeImageInline(el, image_sets_id, href) {
	
	var css = {}, imageID,
	    imageSetsId = 1;
	if(image_sets_id){
		imageSetsId = image_sets_id;
	}
	imageID = randomListVal(imageSets[imageSetsId]);
	if (href == null && 'gallery' != '') {
					href = getHomeImageLink(imageID);
	}
	
	updateImage({nextPhoto: backgrounds[imageID], img:el.find('img')[0],
                $photo:el, $title:$('#homeimageTitleContainer'), $detail:$('#homeimageDetailsContainer'),                speed:0, href:href, css:css, onAfter: function(){                  this.closest('.contentsection').doManualAlign({				    inner: 'img',				    crop: 'a'				  });                }              });
}

/***************************************************************************
* Set 'img' to be a new image given its photo() object                     *
***************************************************************************/
function updateImage (options) {
	var defaults = {nextPhoto:'',field:'',img:'',$photo:'',$title:'',$detail:'',$detailContainer:'',
                    updateDocumentTitle:false,speed:0,href:false,css:false,updateHash:false,onAfter:null,onBefore:null},
		op = $.extend({},defaults,options),
		html = '', temp = '',
		photoId = op.nextPhoto.id,
		photoCaption = ''+op.nextPhoto.caption,
		photoSrc = op.nextPhoto.src;
	
	if (op.updateHash && clik.getIDInUrl(location.href,'photo') != op.nextPhoto.id) {
		clik.changeHash('photos_id=' + op.nextPhoto.id, true);
	}
		
	    if (op.$title.length > 0) {
  		op.$title.fadeGalleryDetails(photoCaption, op.speed);
    }
        if (op.updateDocumentTitle) {
				  document.title = 'l k robinson   photography: ' + photoCaption;
			    }
        if (op.$detail.length > 0) {
      	temp = op.nextPhoto.fnGetImageDetails();
	    op.$detail.fadeGalleryDetails(temp, op.speed, function(){
			if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
				toggleAddToCartConfirm(backgrounds, op.$detail);
			} else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
				toggleAddToCartConfirm(photos, op.$detail);
			}
			$('body').trigger('clikUpdate.popup');
	    });
    }
        $(op.$detailContainer).find('.replaceable[class*=replaceable_photo-]').each(function(){
    	var field = clik.getPrefixedClass(this.className, 'replaceable_photo-');
    	if (field in op.nextPhoto) {
    		$(this).fadeGalleryDetails(op.nextPhoto[field], op.speed);
    	}
    }).end().find('.replaceable.photoPayment').fadeGalleryDetails(op.nextPhoto.fnGetPaymentInfo(), op.speed, function(){
		if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
			toggleAddToCartConfirm(backgrounds, op.$detailContainer);
		} else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
			toggleAddToCartConfirm(photos, op.$detailContainer);
		}
		$('body').trigger('clikUpdate.popup');
	});
		if (op.$photo.length > 0) {
		html = $('<img/>',{
			'class': 'mainphoto photo',
			src: photoSrc,
			id: 'mainPic',
			name: 'mainPic',
			width: op.nextPhoto.width,
			height: op.nextPhoto.height,
			alt: photoCaption,
			css: op.css || {}
		});
		if (op.href) {
			if (op.href.match(/<a/)) {
				html = $(op.href).append(html);
			} else {
				html = $('<a/>', {
					href: op.href,
					title: photoCaption
				}).append(html);
			}
		} else {
			html = $('<a/>', {
				title: photoCaption
			}).append(html);
		}
		if (op.speed == 0) {			op.$photo.html(html);			if (op.onBefore) {			  	op.onBefore.apply(op.$photo);			}			if (op.onAfter) {			  	op.onAfter.apply(op.$photo);			}		} else {			op.$photo.stop(true,true).fadeReplaceWith(html,op.speed,'',function(){  				if (op.onAfter) {				  	op.onAfter.apply(this);				}				clik.doColumnResize(false, $(this).add(op.$detail).add(op.$title));			}, op.onBefore);
		}	}
    if (op.field) {
		op.field.value = photoId;
	} else {
		op.$photo.data('image_id', photoId);
    }
        if (!op.speed) {
      	clik.doColumnResize(false, op.$photo.add(op.$detail).add(op.$title));
    }
        
    return html;
	}

/***************************************************************************
* Toggle add to cart confirmation element and set up the click event for   *
* the 'Add to cart' button.                                                *
***************************************************************************/
function toggleAddToCartConfirm(array, root){
	if (typeof(array) !== 'object' || array === null) {
	  	array = photos;
	}
	if (!$(root).length) {		root = $('body');	}	if($('#paymentConfirm', root).length > 0){
		$('#paymentConfirm', root).hide();
		$('#paymentAddButton', root)
		.unbind()
		.click(function(){
						form = $('#paymentForm', root)[0];
			option_id = 0;
			if(form.item_option.value){
				option_id = form.item_option.value;
			}
			if(addItemToBasket(form.item_number.value,array,form.site.value,parseInt(form.quantity.value, 10),option_id)){
				if($.browser.msie){$('#paymentConfirm', root).text('Item added to cart').show();}
				else{
					$('#paymentConfirm', root).text('Item added to cart').fadeIn();
					dspOrderDetails(form.site.value);
				}
			}
			else{
				$('#paymentConfirm', root).text('Item not added - check cookies are enabled in your browser.').fadeIn();
			}
		});
	}
}

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
clik.photo.fnGetImageDetails = function(){
	var temp = '';
	if (this.description != '') {
		temp +=  '<div id="imageDescription">' + this.description + '</div>';
	}
		if (this.photo_ref != '') {
		temp += '<div class="imageinfo" id="imageRef"><strong>Ref: </strong>' + this.photo_ref + '</div>';
	}
		if (this.takendate != '') {
		
		temp += '<div class="imageinfo" id="imageDate"><strong>Date: </strong>' + this.takendate + '</div>';
	}
	
	if (this.location != '') {
		
		temp += '<div class="imageinfo" id="imageLocation"><strong>Location: </strong>' +  this.location + '</div>';
	}
	
	if (this.photographer != '') {
		
		temp += '<div class="imageinfo" id="imagePhotographer"><strong>Photographer: </strong>' + this.photographer + '</div>';
	}
			
				if (temp != '') {
		temp += '<div class="spacer"></div>';
	}
	return temp;
};

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
clik.photo.fnGetPaymentInfo = function(){
	var temp = '';
	if (this.item_price !== '') {
				temp += '<p>Order this print:</p>';
				temp += '<div class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> ' + (this.item_price).toFixed(2) + '</div>';
		var item_name  = this.purchase_instruction;
		var amount = (this.item_price).toFixed(2);
		var item_option  = 0;
	}
		else {
		
	}
	if (this.item_price !== '') {
			temp += '<div class="clearing">&nbsp;</div>';
	}
	return temp;};

/***************************************************************************
* Pick a photo at random from the featured images of a gallery.            *
* Gallery_id = id of gallery to choose,                                    *
* img = reference to html image in                                         *
* which to show image                                                      *
***************************************************************************/
function showGalleryImage(gallery_id, img, updateLink) {
	
	if(img){
		if (location.hash.match('galleries_id=' + gallery_id) && (imageID = location.hash.match('.*photos_id=(.+)$'))) {
		  	imageID = imageID[1];
		} else {
		  	imageID = randomListVal(galleries[gallery_id].featured_images);
		}
		
		if (imageID != 0) {
			img.src = thumbnails[imageID].src;
			img.width = thumbnails[imageID].width;
			img.height = thumbnails[imageID].height;
			img.alt = galleries[gallery_id].title;
			if (updateLink) {
				$(img).parent().attr({					title: galleries[gallery_id].title				}).filter(function(){return this.href;}).attr({					href: thumbnails[imageID].fnGalleryLink(gallery_id)				});
			}
		}
	}
}

/***************************************************************************
* If we have dynamic HTML, replace the galleries link with a list that     *
* doesn't include thecurrent gallery                                       *
***************************************************************************/
function showGalleries(gallery_id) {
		
	
	if (!basic) {
		temp = '';
		for (i = 0; i < galleries.length; i++) {
						
			
			if (galleries[i].id != gallery_id) {
								
				if (temp != '') {
					temp += ' | ';
				}
								temp += '<a href="' + galleries[i].section_code + '_' + galleries[i].id + '.html">' + galleries[i].title + '</a>';
							}
		}
		document.all.galleryLinks.innerHTML = 'Other galleries: ' + temp;
	}
}

		

