window.thumbnails = new Object();
												thumbnails[5094710] = new thumbnail(5094710,'286061','','msp-postcard600_thumb.jpg',130, 87,5,'photo_5094710.html');
												thumbnails[5048348] = new thumbnail(5048348,'286056','Canada Square, Canary Wharf, London','1CanadaSquare_thumb.jpg',130, 130,5,'photo_5048348.html');
												thumbnails[5210725] = new thumbnail(5210725,'286059','mikestubbsphotography.com','katie0023wm_thumb.jpg',130, 130,5,'photo_5210725.html');
												thumbnails[5056832] = new thumbnail(5056832,'285650','Lake Tahoe, California ~ Nevada border, USA','1TahoeLakeUSA_thumb.jpg',130, 130,5,'photo_5056832.html');
												thumbnails[5057108] = new thumbnail(5057108,'286058','Big Ben','BigBen_thumb.jpg',130, 130,5,'photo_5057108.html');
												thumbnails[5057155] = new thumbnail(5057155,'285647','Chinese New Year Girls','ChineseNewYearGirls_thumb.jpg',130, 130,5,'photo_5057155.html');
												thumbnails[5553318] = new thumbnail(5553318,'314789','mikestubbsphotography.com','Sport1_thumb.jpg',130, 130,5,'photo_5553318.html');
												thumbnails[7045015] = new thumbnail(7045015,'286059','mikestubbsphotography.com','StudioOne020b_thumb.jpg',130, 170,5,'photo_7045015.html');
												thumbnails[5056692] = new thumbnail(5056692,'286056','Brunswick Square, Brighton','BrunswickSqBrighton_thumb.jpg',130, 130,5,'photo_5056692.html');
												thumbnails[5056834] = new thumbnail(5056834,'285650','West Pier, Brighton, Sussex','2WestPierBrighton_thumb.jpg',130, 130,5,'photo_5056834.html');
												thumbnails[5057059] = new thumbnail(5057059,'286058','Brighton Pavilion','BrightonPavillion_thumb.jpg',130, 130,5,'photo_5057059.html');
												thumbnails[5057161] = new thumbnail(5057161,'285647','Samoan Fire Starter','FireStarterHawaii_thumb.jpg',130, 130,5,'photo_5057161.html');
												thumbnails[5094713] = new thumbnail(5094713,'285641','Routemaster','routemaster_thumb.jpg',130, 130,5,'photo_5094713.html');
												thumbnails[5520266] = new thumbnail(5520266,'286059','mikestubbsphotography.com','katie0021wm_thumb.jpg',130, 130,5,'photo_5520266.html');
												thumbnails[5950141] = new thumbnail(5950141,'314789','mikestubbsphotography.com','sport2r_thumb.jpg',130, 130,5,'photo_5950141.html');
												thumbnails[7035803] = new thumbnail(7035803,'335752','mikestubbsphotography.com','Studio21_thumb.jpg',130, 130,5,'photo_7035803.html');
												thumbnails[7035832] = new thumbnail(7035832,'314789','mikestubbsphotography.com','Sport20_thumb.jpg',130, 130,5,'photo_7035832.html');
												thumbnails[7035836] = new thumbnail(7035836,'285641','mikestubbsphotography.com','Sport201_thumb.jpg',130, 130,5,'photo_7035836.html');
												thumbnails[5056722] = new thumbnail(5056722,'286056','Cambridge University','CambridgeUniversity_thumb.jpg',130, 130,5,'photo_5056722.html');
												thumbnails[5056782] = new thumbnail(5056782,'285641','Lagonda Vintage Cars','Lagonda_thumb.jpg',130, 130,5,'photo_5056782.html');
												thumbnails[5056958] = new thumbnail(5056958,'285650','Bodie (ghost mining town), Sierra Nevada Mountains, USA','3BodieUSA_thumb.jpg',130, 130,5,'photo_5056958.html');
												thumbnails[5060076] = new thumbnail(5060076,'286056','Lowry, Manchester','LowryManchester_thumb.jpg',130, 130,5,'photo_5060076.html');
												thumbnails[5149482] = new thumbnail(5149482,'286058','Eastbourne Pier (first sunlight)','EastbournePier_thumb.jpg',130, 130,5,'photo_5149482.html');
												thumbnails[5950142] = new thumbnail(5950142,'314789','mikestubbsphotography.com','Sport3_thumb.jpg',130, 130,5,'photo_5950142.html');
												thumbnails[7035765] = new thumbnail(7035765,'286059','mikestubbsphotography.com','Studio14a_thumb.jpg',130, 195,5,'photo_7035765.html');
												thumbnails[7035770] = new thumbnail(7035770,'286059','mikestubbsphotography.com','Studio14b_thumb.jpg',130, 195,5,'photo_7035770.html');
												thumbnails[7035840] = new thumbnail(7035840,'314789','mikestubbsphotography.com','Sport21_thumb.jpg',130, 130,5,'photo_7035840.html');
												thumbnails[7043744] = new thumbnail(7043744,'314789','mikestubbsphotography.com','Sports24_thumb.jpg',130, 130,5,'photo_7043744.html');
												thumbnails[5950145] = new thumbnail(5950145,'314789','mikestubbsphotography.com','Sport41_thumb.jpg',130, 130,5,'photo_5950145.html');
												thumbnails[5056705] = new thumbnail(5056705,'286056','Great Court, British Museum, London','GreatCourt_thumb.jpg',130, 130,5,'photo_5056705.html');
												thumbnails[5056730] = new thumbnail(5056730,'286056','Bank Facade Image','Com5nw1_thumb.jpg',130, 130,5,'photo_5056730.html');
												thumbnails[5057005] = new thumbnail(5057005,'285650','Clinker Fishing Boat, Dungeness','Loc4_thumb.jpg',130, 130,5,'photo_5057005.html');
												thumbnails[5057055] = new thumbnail(5057055,'286058','Eastbourne Bandstand Deck Chairs','EastbourneDeckChairs_thumb.jpg',130, 130,5,'photo_5057055.html');
												thumbnails[6035043] = new thumbnail(6035043,'285641','','Com4nw_thumb.jpg',130, 130,5,'photo_6035043.html');
												thumbnails[5055793] = new thumbnail(5055793,'286056','Canary Wharf','CanaryWharf03_thumb.jpg',130, 130,5,'photo_5055793.html');
												thumbnails[5057050] = new thumbnail(5057050,'285650','Goudhurst, Kent','Goudhurst_thumb.jpg',130, 130,5,'photo_5057050.html');
												thumbnails[5057053] = new thumbnail(5057053,'286058','Brighton Pier Deck Chairs','BrightonDeckChairs_thumb.jpg',130, 130,5,'photo_5057053.html');
												thumbnails[5520223] = new thumbnail(5520223,'286061','mikestubbsphotography.com','kodakwm_thumb.jpg',130, 130,5,'photo_5520223.html');
												thumbnails[5553340] = new thumbnail(5553340,'335752','mikestubbsphotography.com','Studio5_thumb.jpg',130, 130,5,'photo_5553340.html');
												thumbnails[5950153] = new thumbnail(5950153,'314789','mikestubbsphotography.com','Sport51_thumb.jpg',130, 130,5,'photo_5950153.html');
												thumbnails[6035041] = new thumbnail(6035041,'285641','','Com5nw_thumb.jpg',130, 130,5,'photo_6035041.html');
												thumbnails[7035811] = new thumbnail(7035811,'285650','Venice','Loc8_thumb.jpg',130, 130,5,'photo_7035811.html');
												thumbnails[7043436] = new thumbnail(7043436,'285650','mikestubbsphotography.com','Loc9_thumb.jpg',130, 130,5,'photo_7043436.html');
												thumbnails[7046532] = new thumbnail(7046532,'286059','mikestubbsphotography.com','StudioOne054b1_thumb.jpg',130, 108,5,'photo_7046532.html');
												thumbnails[5055798] = new thumbnail(5055798,'286056','Canary Wharf','CanaryWharfAbstract_thumb.jpg',130, 130,5,'photo_5055798.html');
												thumbnails[5057568] = new thumbnail(5057568,'286061','Stalactities','ColorodoStalactities_thumb.jpg',130, 130,5,'photo_5057568.html');
												thumbnails[5950160] = new thumbnail(5950160,'314789','mikestubbsphotography.com','Sport61_thumb.jpg',130, 130,5,'photo_5950160.html');
												thumbnails[5056735] = new thumbnail(5056735,'286056','Guildhall, York','GuildhallYork_thumb.jpg',130, 130,5,'photo_5056735.html');
												thumbnails[5057019] = new thumbnail(5057019,'285650','Frosty Lane','FrostyYorkshireLane_thumb.jpg',130, 130,5,'photo_5057019.html');
												thumbnails[5057116] = new thumbnail(5057116,'286058','Guardsmans Sword','Tour7R_thumb.jpg',130, 130,5,'photo_5057116.html');
												thumbnails[5060081] = new thumbnail(5060081,'286061','Giraffe','giraffe_thumb.jpg',130, 130,5,'photo_5060081.html');
												thumbnails[5553349] = new thumbnail(5553349,'335752','mikestubbsphotography.com','Studio7_thumb.jpg',130, 130,5,'photo_5553349.html');
												thumbnails[5950163] = new thumbnail(5950163,'314789','mikestubbsphotography.com','Sport71_thumb.jpg',130, 130,5,'photo_5950163.html');
												thumbnails[5056742] = new thumbnail(5056742,'286056','Treasurers House, York','Treasurers_York_thumb.jpg',130, 130,5,'photo_5056742.html');
												thumbnails[5056768] = new thumbnail(5056768,'285641','Chinese Medicine Shop','ChineseMedicine_thumb.jpg',130, 130,5,'photo_5056768.html');
												thumbnails[5056790] = new thumbnail(5056790,'285641','Stephanie','Stephanie_thumb.jpg',130, 130,5,'photo_5056790.html');
												thumbnails[5057074] = new thumbnail(5057074,'286058','Sussex Daisies','SussexDaisies_thumb.jpg',130, 130,5,'photo_5057074.html');
												thumbnails[5057183] = new thumbnail(5057183,'286061','Doc Martin Boots','DocMartinBoots_thumb.jpg',130, 130,5,'photo_5057183.html');
												thumbnails[5057557] = new thumbnail(5057557,'285650','Clinker Fishing Boat Monochrome','BoatDungeness_thumb.jpg',130, 130,5,'photo_5057557.html');
												thumbnails[5553354] = new thumbnail(5553354,'335752','mikestubbsphotography.com','Studio8_thumb.jpg',130, 130,5,'photo_5553354.html');
												thumbnails[5951264] = new thumbnail(5951264,'314789','mikestubbsphotography.com','Sport8_thumb.jpg',130, 130,5,'photo_5951264.html');
												thumbnails[7035771] = new thumbnail(7035771,'286059','mikestubbsphotography.com','Studio14t_thumb.jpg',130, 179,5,'photo_7035771.html');
												thumbnails[5057094] = new thumbnail(5057094,'286058','Kent Poppies','KentPoppies_thumb.jpg',130, 130,5,'photo_5057094.html');
												thumbnails[5950168] = new thumbnail(5950168,'314789','mikestubbsphotography.com','Sport9_thumb.jpg',130, 130,5,'photo_5950168.html');
												thumbnails[7035780] = new thumbnail(7035780,'286059','mikestubbsphotography.com','Studio15j_thumb.jpg',130, 130,5,'photo_7035780.html');
												thumbnails[5056803] = new thumbnail(5056803,'285641','Maldives Beaches','MaldivesBeaches_thumb.jpg',130, 130,5,'photo_5056803.html');
												thumbnails[5554214] = new thumbnail(5554214,'286058','mikestubbsphotography.com','Tour10_thumb.jpg',130, 130,5,'photo_5554214.html');
												thumbnails[7035783] = new thumbnail(7035783,'286059','mikestubbsphotography.com','StudioOne070b_thumb.jpg',130, 130,5,'photo_7035783.html');
												thumbnails[7035786] = new thumbnail(7035786,'286059','mikestubbsphotography.com','Studio15q_thumb.jpg',130, 130,5,'photo_7035786.html');
												thumbnails[7035807] = new thumbnail(7035807,'335752','mikestubbsphotography.com','Studio29_thumb.jpg',130, 130,5,'photo_7035807.html');
												thumbnails[7035842] = new thumbnail(7035842,'314789','mikestubbsphotography.com','Sports22_thumb.jpg',130, 130,5,'photo_7035842.html');
												thumbnails[7035846] = new thumbnail(7035846,'314789','mikestubbsphotography.com','BSB5755_thumb.jpg',130, 130,5,'photo_7035846.html');
												thumbnails[7035848] = new thumbnail(7035848,'285641','mikestubbsphotography.com','Com13_thumb.jpg',130, 130,5,'photo_7035848.html');
												thumbnails[7035851] = new thumbnail(7035851,'285641','mikestubbsphotography.com','Com21_thumb.jpg',130, 130,5,'photo_7035851.html');
												thumbnails[7035856] = new thumbnail(7035856,'285641','mikestubbsphotography.com','Com22_thumb.jpg',130, 130,5,'photo_7035856.html');
												thumbnails[7035927] = new thumbnail(7035927,'286061','mikestubbsphotography.com','Stock3_thumb.jpg',130, 130,5,'photo_7035927.html');
												thumbnails[5056765] = new thumbnail(5056765,'285641','Cambridge & Brighton proofs','CambridgeBrighton_thumb.jpg',130, 130,5,'photo_5056765.html');
												thumbnails[5951095] = new thumbnail(5951095,'314789','mikestubbsphotography.com','Sport131_thumb.jpg',130, 130,5,'photo_5951095.html');
												thumbnails[5951120] = new thumbnail(5951120,'314789','mikestubbsphotography.com','sport14_thumb.jpg',130, 130,5,'photo_5951120.html');
												thumbnails[5950176] = new thumbnail(5950176,'285647','mikestubbsphotography.com','Tear41_thumb.jpg',130, 130,5,'photo_5950176.html');
												thumbnails[5950182] = new thumbnail(5950182,'285647','mikestubbsphotography.com','Tear32_thumb.jpg',130, 130,5,'photo_5950182.html');
												thumbnails[5950184] = new thumbnail(5950184,'285647','mikestubbsphotography.com','Tear26_thumb.jpg',130, 130,5,'photo_5950184.html');
												thumbnails[5950186] = new thumbnail(5950186,'285647','mikestubbsphotography.com','Tear22_thumb.jpg',130, 130,5,'photo_5950186.html');
												thumbnails[5950187] = new thumbnail(5950187,'285647','mikestubbsphotography.com','Tear16_thumb.jpg',130, 130,5,'photo_5950187.html');
												thumbnails[5923053] = new thumbnail(5923053,'334296','','Mike_Stubbs_Clikpic12_thumb.jpg',130, 130,5,'photo_5923053.html');
												thumbnails[5950503] = new thumbnail(5950503,'334296','mikestubbsphotography.com','SWPP400_thumb.jpg',130, 130,5,'photo_5950503.html');
												thumbnails[5950506] = new thumbnail(5950506,'334296','mikestubbsphotography.com','SIMPP400_thumb.jpg',130, 130,5,'photo_5950506.html');
												thumbnails[5950509] = new thumbnail(5950509,'334296','mikestubbsphotography.com','SISLP400_thumb.jpg',130, 130,5,'photo_5950509.html');
												thumbnails[5950510] = new thumbnail(5950510,'334296','mikestubbsphotography.com','Nikon_thumb.jpg',130, 130,5,'photo_5950510.html');
												thumbnails[5950624] = new thumbnail(5950624,'334296','Business Cards','busnscards_thumb.jpg',130, 130,5,'photo_5950624.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[286059] = new gallery(286059,'7046532,7045015,7035786,7035783,7035780,7035771,7035770,7035765,5520266,5210725','Studio~People 1','gallery',[5210725,7045015,5520266,7035765,7035770,7046532,7035771,7035780,7035783,7035786],0, 0, '', 'gallery_286059.html',0,0);
				  					galleries[335752] = new gallery(335752,'7035807,7035803,5553354,5553349,5553340','Studio~People 2','gallery',[7035803,5553340,5553349,5553354,7035807],0, 0, '', 'gallery_335752.html',0,0);
				  					galleries[285650] = new gallery(285650,'7043436,7035811,5057557,5057050,5057019,5057005,5056958,5056834,5056832','Locations','gallery',[5056832,5056834,5056958,5057005,5057050,7035811,7043436,5057019,5057557],0, 0, '', 'gallery_285650.html',0,0);
				  					galleries[314789] = new gallery(314789,'7043744,7035846,7035842,7035840,7035832,5951264,5951120,5951095,5950168,5950163','Sports','gallery',[5553318,5950141,7035832,5950142,7035840,7043744,5950145,5950153,5950160,5950163,5951264,5950168,7035842,7035846,5951095,5951120],0, 0, '', 'gallery_314789.html',0,0);
				  					galleries[286056] = new gallery(286056,'5060076,5056742,5056735,5056730,5056722,5056705,5056692,5055798,5055793,5048348','Architectural','gallery',[5048348,5056692,5056722,5060076,5056705,5056730,5055793,5055798,5056735,5056742],0, 0, '', 'gallery_286056.html',0,0);
				  					galleries[285641] = new gallery(285641,'7035856,7035851,7035848,7035836,6035043,6035041,5094713,5056803,5056790,5056782','Commercial','gallery',[5094713,7035836,5056782,6035043,6035041,5056768,5056790,5056803,7035848,7035851,7035856,5056765],0, 0, '', 'gallery_285641.html',0,0);
				  					galleries[286058] = new gallery(286058,'5554214,5149482,5057116,5057108,5057094,5057074,5057059,5057055,5057053','Tourism','gallery',[5057108,5057059,5149482,5057055,5057053,5057116,5057074,5057094,5554214],0, 0, '', 'gallery_286058.html',0,0);
				  					galleries[285647] = new gallery(285647,'5950187,5950186,5950184,5950182,5950176,5057161,5057155','Media','gallery',[5057155,5057161,5950176,5950182,5950184,5950186,5950187],0, 0, '', 'gallery_285647.html',0,0);
				  					galleries[286061] = new gallery(286061,'7035927,5520223,5094710,5060081,5057568,5057183','Stock','gallery',[5094710,5520223,5057568,5060081,5057183,7035927],0, 0, '', 'gallery_286061.html',0,0);
				  					galleries[334296] = new gallery(334296,'5950624,5950510,5950509,5950506,5950503,5923053','About Mike Stubbs','section400402',[5923053,5950503,5950506,5950509,5950510,5950624],0, 0, '', 'section400402.html',0,1);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '7043744,7035846,7035765,5553318,5210725,5094710,5057161,5057155,5056834,5056832,5056692';
imageSets[3] = '7046532,7045015,7043744,7043436,7035927,7035856,7035851,7035848,7035846,7035842,7035840,7035836,7035832,7035811,7035807,7035803,7035786,7035783,7035780,7035771,7035770,7035765,6035043,6035041,5951264,5951120,5951095,5950624,5950510,5950509,5950506,5950503,5950187,5950186,5950184,5950182,5950176,5950168,5950163,5950160,5950153,5950145,5950142,5950141,5923053,5554214,5553354,5553349,5553340,5553318';
imageSets[235756] = '5923053';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/mikeacer007/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/mikeacer007/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/mikeacer007/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/mikeacer007/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/mikeacer007/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/mikeacer007/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/mikeacer007/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/mikeacer007/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/mikeacer007/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/mikeacer007/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/mikeacer007/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/mikeacer007/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/mikeacer007/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/mikeacer007/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/mikeacer007/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/mikeacer007/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/mikeacer007/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/mikeacer007/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/mikeacer007/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/mikeacer007/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/mikeacer007/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/mikeacer007/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:'',
                    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 (!basic) {
    if (op.updateHash && clik.getIDInUrl(location.href,'photo') != op.nextPhoto.id) {
		clik.changeHash('photos_id=' + op.nextPhoto.id, true);
    }
				
    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));		  $('body').trigger('clikUpdate');		}, op.onBefore);
      }    }
    	if (op.field) {
		op.field.value = photoId;
	} else {
		op.$photo.data('image_id', photoId);
    }
	    if (op.$title.length > 0) {
  		op.$title.fadeGalleryDetails(photoCaption, op.speed);
    }
        if (op.updateDocumentTitle) {
						  document.title = 'Mike Stubbs Photography: ' + photoCaption;
			    }
        if (op.$detail.length > 0) {
      temp = op.nextPhoto.fnGetImageDetails();
	    op.$detail.fadeGalleryDetails(temp, op.speed, function(){
	    var options = {};	    	      	      resizePhotoInfo(options);
        if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
  	      toggleAddToCartConfirm(backgrounds);
  	    } else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
  	      toggleAddToCartConfirm(photos);
  	    }
	    });
    }
        if (!op.speed) {      clik.doColumnResize(false, op.$photo.add(op.$detail).add(op.$title));      $('body').trigger('clikUpdate');    }        
    return html;			}
	else {
				
		window.location = 'photo_' + nextPhoto.id + '.html';
	}
		
}

/***************************************************************************
* Toggle add to cart confirmation element and set up the click event for   *
* the 'Add to cart' button.                                                *
***************************************************************************/
function toggleAddToCartConfirm(array){
  if (typeof(array) !== 'object') {
    array = photos;
  }
	if($('#paymentConfirm').length > 0){
		$('#paymentConfirm').hide();
		$('#paymentAddButton')
		.unbind()
		.click(function(){
						form = document.getElementById('paymentForm');
			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').text('Item added to cart').show();}
				else{
					$('#paymentConfirm').text('Item added to cart').fadeIn();
					dspOrderDetails(form.site.value);
				}
			}
			else{
				$('#paymentConfirm').text('Item not added - check cookies are enabled in your browser.').fadeIn();
			}
		});
	}
}
/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
photo.prototype.fnGetImageDetails = function(){
	var temp = '';
	if (this.description != '') {
		temp = temp +  '<p id="imageDescription">' + this.description + '</p>';
	}
		if (this.takendate != '') {
				
		temp = temp + '<p class="imageinfo" id="imageDate"><strong>Date: </strong>' + this.takendate + '</p>';
	}
	
	if (this.location != '') {
				
		temp = temp + '<p class="imageinfo" id="imageLocation"><strong>Location: </strong>' +  this.location + '</p>';
	}
	
	if (this.photographer != '') {
				
		temp = temp + '<p class="imageinfo" id="imagePhotographer"><strong>Photographer: </strong>' + this.photographer + '</p>';
	}
					
				if (temp != '') {
		temp = temp + '<div class="spacer"></div>';
	}
	return temp;
};

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
photo.prototype.fnGetPaymentInfo = function(){
	var temp = '';
	if (this.item_price !== '') {
				temp = temp + '<p>Order this print:</p>';
				temp = temp + '<p class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> ' + (this.item_price).toFixed(2) + '</p>';
		var item_name  = this.purchase_instruction;
		var amount = (this.item_price).toFixed(2);
		var item_option  = 0;
	}
	else if (this.payment_groups_id !== '') {
		temp = temp + '<p>Buy this print online:</p>';
				temp = temp + '<form id="paymentOptions" style="margin:0px;border:0px;" name="paymentOptions">';
											temp = temp + '<select class="paymentlink" name="payment_options_id" onchange="updateItemValues(document.forms.paymentForm,this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value);">';
				
		temp = temp + getPaymentOptions(this.payment_groups_id);
		temp = temp + '</select>';
		temp = 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 = 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({            href: thumbnails[imageID].fnGalleryLink(gallery_id),            title: galleries[gallery_id].title          });
        }
							}
										}
}

/***************************************************************************
* 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 + ' | ';
				}
				temp = temp + '<a href="' + galleries[i].section_code + '_' + galleries[i].id + '.html">' + galleries[i].title + '</a>';
			}
		}
		document.all.galleryLinks.innerHTML = 'Other galleries: ' + temp;
	}
}

			

