window.thumbnails = {};
															thumbnails[2579222] = clik.newPhoto({"id":2579222,"src":"roger_thumb.slade.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"","height":105});
															thumbnails[2580651] = clik.newPhoto({"id":2580651,"src":"1751_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"","height":81});
															thumbnails[3106901] = clik.newPhoto({"id":3106901,"src":"insidescan0001f_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"","height":109});
															thumbnails[3106902] = clik.newPhoto({"id":3106902,"src":"insidescan0002f_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"","height":109});
															thumbnails[3543144] = clik.newPhoto({"id":3543144,"src":"web1_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"","height":58});
															thumbnails[3543270] = clik.newPhoto({"id":3543270,"src":"web2_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"","height":87});
															thumbnails[3543282] = clik.newPhoto({"id":3543282,"src":"web3_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"","height":87});
															thumbnails[3543313] = clik.newPhoto({"id":3543313,"src":"web4_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"","height":87});
															thumbnails[3543325] = clik.newPhoto({"id":3543325,"src":"web5_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"","height":87});
															thumbnails[3543356] = clik.newPhoto({"id":3543356,"src":"web6_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"","height":87});
															thumbnails[3543542] = clik.newPhoto({"id":3543542,"src":"web7_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"","height":195});
															thumbnails[2520571] = clik.newPhoto({"id":2520571,"src":"2037_thumb.jpg","galleries_id":161509,"server_id":5,"link":"photo_2520571.html","width":130,"caption":"Iceberg arch and Zodiac","height":87});
															thumbnails[2520634] = clik.newPhoto({"id":2520634,"src":"013971_thumb.jpg","galleries_id":161509,"server_id":5,"link":"photo_2520634.html","width":130,"caption":"Shag colony - I","height":87});
															thumbnails[2522764] = clik.newPhoto({"id":2522764,"src":"X7_thumb.jpg","galleries_id":161509,"server_id":5,"link":"photo_2522764.html","width":130,"caption":"Penguins, Zodiac, ship","height":87});
															thumbnails[2522811] = clik.newPhoto({"id":2522811,"src":"016791_thumb.jpg","galleries_id":161509,"server_id":5,"link":"photo_2522811.html","width":130,"caption":"Penguin chick in guano","height":166});
															thumbnails[2522868] = clik.newPhoto({"id":2522868,"src":"0739_thumb.jpg","galleries_id":161509,"server_id":5,"link":"photo_2522868.html","width":130,"caption":"Penguins'reflection","height":87});
															thumbnails[2522901] = clik.newPhoto({"id":2522901,"src":"12971_thumb.jpg","galleries_id":161509,"server_id":5,"link":"photo_2522901.html","width":130,"caption":"Penguins and rainbow","height":195});
															thumbnails[2523346] = clik.newPhoto({"id":2523346,"src":"6103_thumb.jpg","galleries_id":161509,"server_id":5,"link":"photo_2523346.html","width":130,"caption":"Mountain light III","height":87});
															thumbnails[2523347] = clik.newPhoto({"id":2523347,"src":"6081_thumb.jpg","galleries_id":161509,"server_id":5,"link":"photo_2523347.html","width":130,"caption":"Mountain light II","height":87});
															thumbnails[2523358] = clik.newPhoto({"id":2523358,"src":"0445_thumb.jpg","galleries_id":161509,"server_id":5,"link":"photo_2523358.html","width":130,"caption":"Iceberg and dark sky","height":87});
															thumbnails[2523374] = clik.newPhoto({"id":2523374,"src":"0946_thumb.jpg","galleries_id":161509,"server_id":5,"link":"photo_2523374.html","width":130,"caption":"Mushroom bergs","height":90});
															thumbnails[2523381] = clik.newPhoto({"id":2523381,"src":"0975_thumb.jpg","galleries_id":161509,"server_id":5,"link":"photo_2523381.html","width":130,"caption":"Elephant seal II","height":87});
															thumbnails[2523650] = clik.newPhoto({"id":2523650,"src":"2026_thumb.jpg","galleries_id":161510,"server_id":5,"link":"photo_2523650.html","width":130,"caption":"Turret iceberg and Zodiac","height":195});
															thumbnails[2523921] = clik.newPhoto({"id":2523921,"src":"1219_thumb.jpg","galleries_id":161510,"server_id":5,"link":"photo_2523921.html","width":130,"caption":"Gentoo and chick on nest","height":87});
															thumbnails[2527381] = clik.newPhoto({"id":2527381,"src":"01696_thumb.jpg","galleries_id":161510,"server_id":5,"link":"photo_2527381.html","width":130,"caption":"Penguins and blue icebergs","height":87});
															thumbnails[2527385] = clik.newPhoto({"id":2527385,"src":"2109_thumb.jpg","galleries_id":161509,"server_id":5,"link":"photo_2527385.html","width":130,"caption":"Bergs at sunset","height":87});
															thumbnails[2527391] = clik.newPhoto({"id":2527391,"src":"5424_thumb.jpg","galleries_id":161510,"server_id":5,"link":"photo_2527391.html","width":130,"caption":"Flying Black Browed Albatross II","height":85});
															thumbnails[2527435] = clik.newPhoto({"id":2527435,"src":"2270_thumb.jpg","galleries_id":161509,"server_id":5,"link":"photo_2527435.html","width":130,"caption":"Mountain light I","height":87});
															thumbnails[2527445] = clik.newPhoto({"id":2527445,"src":"6163_thumb.jpg","galleries_id":161509,"server_id":5,"link":"photo_2527445.html","width":130,"caption":"Mountain light IV","height":87});
															thumbnails[2527462] = clik.newPhoto({"id":2527462,"src":"1312_thumb.jpg","galleries_id":161509,"server_id":5,"link":"photo_2527462.html","width":130,"caption":"Penguin colony","height":87});
															thumbnails[2527798] = clik.newPhoto({"id":2527798,"src":"2378_thumb.jpg","galleries_id":161510,"server_id":5,"link":"photo_2527798.html","width":130,"caption":"Ice landscape","height":87});
															thumbnails[2527813] = clik.newPhoto({"id":2527813,"src":"1861_thumb.jpg","galleries_id":161509,"server_id":5,"link":"photo_2527813.html","width":130,"caption":"Snow - \"Sarpik\" deck","height":195});
															thumbnails[2527880] = clik.newPhoto({"id":2527880,"src":"1109_thumb.jpg","galleries_id":161509,"server_id":5,"link":"photo_2527880.html","width":130,"caption":"Young Fur Seal","height":87});
															thumbnails[2527914] = clik.newPhoto({"id":2527914,"src":"2138_thumb.jpg","galleries_id":161509,"server_id":5,"link":"photo_2527914.html","width":130,"caption":"Sunset - Lemaire Channel","height":85});
															thumbnails[2527983] = clik.newPhoto({"id":2527983,"src":"5421_thumb.jpg","galleries_id":161510,"server_id":5,"link":"photo_2527983.html","width":130,"caption":"Flying Black Browed Albatross I","height":84});
															thumbnails[2532552] = clik.newPhoto({"id":2532552,"src":"1468_thumb.jpg","galleries_id":161509,"server_id":5,"link":"photo_2532552.html","width":130,"caption":"Icebergs at sunset","height":83});
															thumbnails[2532563] = clik.newPhoto({"id":2532563,"src":"6190_thumb.jpg","galleries_id":161509,"server_id":5,"link":"photo_2532563.html","width":130,"caption":"Mountain light V","height":87});
															thumbnails[2532588] = clik.newPhoto({"id":2532588,"src":"5975_thumb.jpg","galleries_id":161510,"server_id":5,"link":"photo_2532588.html","width":130,"caption":"Chin Strap Penguin","height":195});
															thumbnails[2533026] = clik.newPhoto({"id":2533026,"src":"2126_thumb.jpg","galleries_id":161510,"server_id":5,"link":"photo_2533026.html","width":130,"caption":"Abandoned huts","height":87});
															thumbnails[2533038] = clik.newPhoto({"id":2533038,"src":"6667_thumb.jpg","galleries_id":161509,"server_id":5,"link":"photo_2533038.html","width":130,"caption":"Lemaire Channel","height":87});
															thumbnails[2533046] = clik.newPhoto({"id":2533046,"src":"01438_thumb.jpg","galleries_id":161509,"server_id":5,"link":"photo_2533046.html","width":130,"caption":"Shag colony II","height":87});
															thumbnails[2533054] = clik.newPhoto({"id":2533054,"src":"01691_thumb.jpg","galleries_id":161509,"server_id":5,"link":"photo_2533054.html","width":130,"caption":"Penguin chick and snow","height":87});
															thumbnails[2533061] = clik.newPhoto({"id":2533061,"src":"01535_thumb.jpg","galleries_id":161509,"server_id":5,"link":"photo_2533061.html","width":130,"caption":"Fur Seal and \"Orlova\"","height":195});
															thumbnails[2533071] = clik.newPhoto({"id":2533071,"src":"8989_thumb.jpg","galleries_id":161509,"server_id":5,"link":"photo_2533071.html","width":130,"caption":"Tilted iceberg","height":195});
															thumbnails[2533111] = clik.newPhoto({"id":2533111,"src":"2024_thumb.jpg","galleries_id":161509,"server_id":5,"link":"photo_2533111.html","width":130,"caption":"Large iceberg","height":195});
															thumbnails[2533366] = clik.newPhoto({"id":2533366,"src":"5514_thumb.jpg","galleries_id":161509,"server_id":5,"link":"photo_2533366.html","width":130,"caption":"King Penguin chick","height":88});
															thumbnails[2533379] = clik.newPhoto({"id":2533379,"src":"8234_thumb.jpg","galleries_id":161510,"server_id":5,"link":"photo_2533379.html","width":130,"caption":"Icebergs","height":195});
															thumbnails[2533431] = clik.newPhoto({"id":2533431,"src":"1993_thumb.jpg","galleries_id":161509,"server_id":5,"link":"photo_2533431.html","width":130,"caption":"Iceberg and \"Sarpik\"","height":87});
															thumbnails[2533600] = clik.newPhoto({"id":2533600,"src":"9276_thumb.jpg","galleries_id":161509,"server_id":5,"link":"photo_2533600.html","width":130,"caption":"Chick on Port Lockroy boot scraper","height":182});
															thumbnails[2533606] = clik.newPhoto({"id":2533606,"src":"0940_thumb.jpg","galleries_id":161510,"server_id":5,"link":"photo_2533606.html","width":130,"caption":"Mushroom ice","height":87});
															thumbnails[2533615] = clik.newPhoto({"id":2533615,"src":"56701_thumb.jpg","galleries_id":161509,"server_id":5,"link":"photo_2533615.html","width":130,"caption":"Elephant Seal I","height":190});
															thumbnails[2542794] = clik.newPhoto({"id":2542794,"src":"0775_thumb.jpg","galleries_id":161510,"server_id":5,"link":"photo_2542794.html","width":130,"caption":"Rock Hopper","height":97});
															thumbnails[2542894] = clik.newPhoto({"id":2542894,"src":"0991_thumb.jpg","galleries_id":161510,"server_id":5,"link":"photo_2542894.html","width":130,"caption":"Penguin and chicks","height":195});
															thumbnails[2542954] = clik.newPhoto({"id":2542954,"src":"1761_thumb.jpg","galleries_id":161510,"server_id":5,"link":"photo_2542954.html","width":130,"caption":"Penguins going into sea","height":87});
															thumbnails[2542975] = clik.newPhoto({"id":2542975,"src":"2430_thumb.jpg","galleries_id":161510,"server_id":5,"link":"photo_2542975.html","width":130,"caption":"Zodiac","height":64});
															thumbnails[2542984] = clik.newPhoto({"id":2542984,"src":"2441_thumb.jpg","galleries_id":161510,"server_id":5,"link":"photo_2542984.html","width":130,"caption":"Crevasses","height":87});
															thumbnails[2543793] = clik.newPhoto({"id":2543793,"src":"5385_thumb.jpg","galleries_id":161510,"server_id":5,"link":"photo_2543793.html","width":130,"caption":"Black Browed Albatross and nest","height":195});
															thumbnails[2543851] = clik.newPhoto({"id":2543851,"src":"0715_thumb.jpg","galleries_id":161510,"server_id":5,"link":"photo_2543851.html","width":130,"caption":"\"Orlova\", Neko Harbour","height":86});
															thumbnails[2543938] = clik.newPhoto({"id":2543938,"src":"4644_thumb.jpg","galleries_id":161510,"server_id":5,"link":"photo_2543938.html","width":130,"caption":"Penguin and camera","height":95});
															thumbnails[2544751] = clik.newPhoto({"id":2544751,"src":"08491_thumb.jpg","galleries_id":161510,"server_id":5,"link":"photo_2544751.html","width":130,"caption":"\"Sarpik\"","height":90});
															thumbnails[2545105] = clik.newPhoto({"id":2545105,"src":"0757_thumb.jpg","galleries_id":161510,"server_id":5,"link":"photo_2545105.html","width":130,"caption":"Deception steam","height":73});
															thumbnails[2545168] = clik.newPhoto({"id":2545168,"src":"0914_thumb.jpg","galleries_id":161510,"server_id":5,"link":"photo_2545168.html","width":130,"caption":"Ice","height":173});
															thumbnails[2553922] = clik.newPhoto({"id":2553922,"src":"1932_thumb.jpg","galleries_id":161510,"server_id":5,"link":"photo_2553922.html","width":130,"caption":"Penguin and chicks on nest","height":171});
															thumbnails[2553980] = clik.newPhoto({"id":2553980,"src":"2094_thumb.jpg","galleries_id":161510,"server_id":5,"link":"photo_2553980.html","width":130,"caption":"Penguin coming ashore","height":180});
															thumbnails[2556011] = clik.newPhoto({"id":2556011,"src":"1253_thumb.jpg","galleries_id":161510,"server_id":5,"link":"photo_2556011.html","width":130,"caption":"Seal pup","height":88});
															thumbnails[2556042] = clik.newPhoto({"id":2556042,"src":"1463_thumb.jpg","galleries_id":161510,"server_id":5,"link":"photo_2556042.html","width":130,"caption":"Adelies at sunset","height":87});
															thumbnails[2556079] = clik.newPhoto({"id":2556079,"src":"2172_thumb.jpg","galleries_id":161510,"server_id":5,"link":"photo_2556079.html","width":130,"caption":"Zodiac iceberg cruise","height":87});
															thumbnails[2556139] = clik.newPhoto({"id":2556139,"src":"2410_thumb.jpg","galleries_id":161510,"server_id":5,"link":"photo_2556139.html","width":130,"caption":"\"Orlova\" and bergy bits","height":198});
															thumbnails[2556278] = clik.newPhoto({"id":2556278,"src":"1470_thumb.jpg","galleries_id":161510,"server_id":5,"link":"photo_2556278.html","width":130,"caption":"Sunset","height":74});
															thumbnails[2556302] = clik.newPhoto({"id":2556302,"src":"2037a_thumb.jpg","galleries_id":161510,"server_id":5,"link":"photo_2556302.html","width":130,"caption":"Chin Strap head","height":101});
															thumbnails[2556349] = clik.newPhoto({"id":2556349,"src":"2284_thumb.jpg","galleries_id":161510,"server_id":5,"link":"photo_2556349.html","width":130,"caption":"Glacier pattern","height":87});
															thumbnails[2579747] = clik.newPhoto({"id":2579747,"src":"1230_thumb.jpg","galleries_id":161509,"server_id":5,"link":"photo_2579747.html","width":130,"caption":"Gentoo and two chicks","height":103});
															thumbnails[2579749] = clik.newPhoto({"id":2579749,"src":"2225_thumb.jpg","galleries_id":161510,"server_id":5,"link":"photo_2579749.html","width":130,"caption":"\"Orlova\" at sunrise","height":87});
															thumbnails[2579755] = clik.newPhoto({"id":2579755,"src":"2107_thumb.jpg","galleries_id":161509,"server_id":5,"link":"photo_2579755.html","width":130,"caption":"Backlit iceberg","height":87});
															thumbnails[3103430] = clik.newPhoto({"id":3103430,"src":"coverscan0001f_thumb.jpg","galleries_id":191051,"server_id":5,"link":"photo_3103430.html","width":130,"caption":"","height":110});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[161509] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Antarctica Miscellany - Gallery 1","link":"gallery_161509.html","maxRecords":0.0,"photoIDs":[2520571.0,2520634.0,2522764.0,2522811.0,2522868.0,2522901.0,2523346.0,2523347.0,2523358.0,2523374.0,2523381.0,2527385.0,2527435.0,2527445.0,2527462.0,2527813.0,2527880.0,2527914.0,2532552.0,2532563.0,2533038.0,2533046.0,2533054.0,2533061.0,2533071.0,2533111.0,2533366.0,2533431.0,2533600.0,2533615.0,2579747.0,2579755.0],"skipIndex":0,"section_code":"gallery","featured_images":2520571.0,"id":161509,"singleSection":false});				  						galleries[161510] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Antarctica Miscellany - Gallery 2","link":"gallery_161510.html","maxRecords":0.0,"photoIDs":[2523650.0,2523921.0,2527381.0,2527391.0,2527798.0,2527983.0,2532588.0,2533026.0,2533379.0,2533606.0,2542794.0,2542894.0,2542954.0,2542975.0,2542984.0,2543793.0,2543851.0,2543938.0,2544751.0,2545105.0,2545168.0,2553922.0,2553980.0,2556011.0,2556042.0,2556079.0,2556139.0,2556278.0,2556302.0,2556349.0,2579749.0],"skipIndex":0,"section_code":"gallery","featured_images":2523921.0,"id":161510,"singleSection":false});				  						galleries[191051] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"My book \"Antarctica\"","link":"gallery_191051.html","maxRecords":0.0,"photoIDs":[3103430.0],"skipIndex":0,"section_code":"gallery","featured_images":3103430.0,"id":191051,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '2520571';
imageSets[2] = '3103430,2523921,2520571';
imageSets[3] = '3543542,3543356,3543325,3543313,3543282,3543270,3543144,3106902,3106901,3103430,2580651,2579755,2579749,2579747,2579222,2556349,2556302,2556278,2556139,2556079,2556042,2556011,2553980,2553922,2545168,2545105,2544751,2543938,2543851,2543793,2542984,2542975,2542954,2542894,2542794,2533615,2533606,2533600,2533431,2533379,2533366,2533111,2533071,2533061,2533054,2533046,2533038,2533026,2532588,2532563';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'www12.clikpic.com/rogslade/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'www.clikpic.com/rogslade/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/rogslade/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/rogslade/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/rogslade/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/rogslade/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/rogslade/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/rogslade/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/rogslade/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/rogslade/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/rogslade/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/rogslade/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/rogslade/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/rogslade/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/rogslade/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/rogslade/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/rogslade/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/rogslade/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/rogslade/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/rogslade/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/rogslade/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/rogslade/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/rogslade/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/rogslade/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/rogslade/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 = 'Roger Slade Photo: ' + 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>';
	}
				
	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 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="rogslade@hotmail.com">';
					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="rogslade@hotmail.com">';
				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;
	}
}

			

