window.thumbnails = new Object();
												thumbnails[3276889] = new thumbnail(3276889,'199548','Bluebell Woods','_SUP3058_thumb.jpg',130, 87,15,'photo_3276889.html');
												thumbnails[3276893] = new thumbnail(3276893,'199548','Buttermere','_SUP8582_thumb.jpg',130, 87,15,'photo_3276893.html');
												thumbnails[3276911] = new thumbnail(3276911,'199548','Poppy Field','_SUP9475_thumb.jpg',130, 87,15,'photo_3276911.html');
												thumbnails[3276915] = new thumbnail(3276915,'199548','Castle Rigg','cumbria_1249_thumb.jpg',130, 87,15,'photo_3276915.html');
												thumbnails[3276917] = new thumbnail(3276917,'199548','Spurn Head Lighthouse','spurn-head_209_thumb.jpg',130, 87,15,'photo_3276917.html');
												thumbnails[3276918] = new thumbnail(3276918,'199548','Sheffield Bluebells','SUP_3856_thumb.jpg',130, 87,15,'photo_3276918.html');
												thumbnails[5313891] = new thumbnail(5313891,'199548','Fistral Beach in Winter','newquay_132-2__tonemapped_thumb.jpg',130, 87,15,'photo_5313891.html');
												thumbnails[5313892] = new thumbnail(5313892,'199548','Millstone Edge 2009','peaksnow_242_thumb.jpg',130, 87,15,'photo_5313892.html');
												thumbnails[5313894] = new thumbnail(5313894,'199548','Millstone Edge Morning','peaksnow_302a_thumb.jpg',130, 87,15,'photo_5313894.html');
												thumbnails[5313897] = new thumbnail(5313897,'199549','Natasha Hamilton','hamilton_thumb.jpg',130, 86,15,'photo_5313897.html');
												thumbnails[5313898] = new thumbnail(5313898,'199549','Status Quo','quodonny_0204_thumb.jpg',130, 87,15,'photo_5313898.html');
												thumbnails[5313899] = new thumbnail(5313899,'199549','Rick Parfitt Status Quo','quodonny_0323_thumb.jpg',130, 133,15,'photo_5313899.html');
												thumbnails[5313900] = new thumbnail(5313900,'199549','Ronan Keating','ronan_thumb.jpg',130, 86,15,'photo_5313900.html');
												thumbnails[5313901] = new thumbnail(5313901,'199549','Seth Bennett','sheff-gig_266_thumb.jpg',130, 121,15,'photo_5313901.html');
												thumbnails[5313903] = new thumbnail(5313903,'199549','BBC Sheffield','sheff-gig_0868_thumb.jpg',130, 87,15,'photo_5313903.html');
												thumbnails[5313905] = new thumbnail(5313905,'199549','Sine FM Launch Gig','sinefm_183_thumb.jpg',130, 87,15,'photo_5313905.html');
												thumbnails[5313934] = new thumbnail(5313934,'199550','New Kit Shirt Modelling','tracey_24_thumb.jpg',130, 195,15,'photo_5313934.html');
												thumbnails[5313937] = new thumbnail(5313937,'199306','Belle Vue 2006','belle-vue-sunset_thumb.jpg',130, 92,15,'photo_5313937.html');
												thumbnails[5313940] = new thumbnail(5313940,'199306','Crystal Palace vs Doncaster','cp2_thumb.jpg',130, 116,15,'photo_5313940.html');
												thumbnails[5313941] = new thumbnail(5313941,'199306','Going Up','cp7_thumb.jpg',130, 95,15,'photo_5313941.html');
												thumbnails[5313944] = new thumbnail(5313944,'199306','Sharp Action','nufcaway_617_thumb.jpg',130, 87,15,'photo_5313944.html');
												thumbnails[5313945] = new thumbnail(5313945,'199306','Airfield Balls','raf1_14_thumb.jpg',130, 87,15,'photo_5313945.html');
												thumbnails[5313946] = new thumbnail(5313946,'199306','Keepmoat Stadium','saturday_thumb.jpg',130, 87,15,'photo_5313946.html');
												thumbnails[5313949] = new thumbnail(5313949,'199306','Keepmoat at Night','SUM_0214_thumb.jpg',130, 85,15,'photo_5313949.html');
												thumbnails[5313950] = new thumbnail(5313950,'199306','John Ryan','wembley_0044_thumb.jpg',130, 87,15,'photo_5313950.html');
												thumbnails[5313951] = new thumbnail(5313951,'199306','Celebration','wembley_303_thumb.jpg',130, 87,15,'photo_5313951.html');
												thumbnails[5313954] = new thumbnail(5313954,'199305','','_SUP9807_thumb.jpg',130, 87,15,'photo_5313954.html');
												thumbnails[5313955] = new thumbnail(5313955,'199305','','_SUP9825_thumb.jpg',130, 87,15,'photo_5313955.html');
												thumbnails[5313956] = new thumbnail(5313956,'199305','','DSC_5317_thumb.jpg',130, 86,15,'photo_5313956.html');
												thumbnails[5313957] = new thumbnail(5313957,'199305','','DSC_8814_thumb.jpg',130, 86,15,'photo_5313957.html');
												thumbnails[5313958] = new thumbnail(5313958,'199305','','DSC_8861_thumb.jpg',130, 94,15,'photo_5313958.html');
												thumbnails[5313959] = new thumbnail(5313959,'199305','','IMG07247_thumb.jpg',130, 87,15,'photo_5313959.html');
												thumbnails[5313960] = new thumbnail(5313960,'199305','','salgeorge_635m_thumb.jpg',130, 94,15,'photo_5313960.html');
												thumbnails[5313961] = new thumbnail(5313961,'199305','','SUP_0037_thumb.jpg',130, 87,15,'photo_5313961.html');
												thumbnails[5313963] = new thumbnail(5313963,'199305','','SUP_0336_thumb.jpg',130, 98,15,'photo_5313963.html');
												thumbnails[5313965] = new thumbnail(5313965,'199305','','SUP_8421_thumb.jpg',130, 95,15,'photo_5313965.html');
												thumbnails[5313967] = new thumbnail(5313967,'199305','','SUP_8571_thumb.jpg',130, 194,15,'photo_5313967.html');
												thumbnails[5318163] = new thumbnail(5318163,'299336','Alan Shearer','_SUP0192_thumb.jpg',130, 194,15,'photo_5318163.html');
												thumbnails[5318177] = new thumbnail(5318177,'299336','Elachi Restaurant','_SUP1531_thumb.jpg',130, 87,15,'photo_5318177.html');
												thumbnails[5318263] = new thumbnail(5318263,'299336','Sean O\'Driscoll and Chuckle Brother launch new Car','_SUP9980_thumb.jpg',130, 87,15,'photo_5318263.html');
												thumbnails[5318269] = new thumbnail(5318269,'299336','British Conservation HQ','btcv_108_thumb.jpg',130, 87,15,'photo_5318269.html');
												thumbnails[5318292] = new thumbnail(5318292,'199549','Detroit Social Club','detroitsocialclub_thumb.jpg',130, 87,15,'photo_5318292.html');
												thumbnails[5318309] = new thumbnail(5318309,'299336','Keepmoat Fitness Centre','fitness-suite07_038_thumb.jpg',130, 87,15,'photo_5318309.html');
												thumbnails[5318319] = new thumbnail(5318319,'299336','Jamie Oliver at Bluebell Wood','joliver_73_thumb.jpg',130, 87,15,'photo_5318319.html');
												thumbnails[5318334] = new thumbnail(5318334,'299336','Mecsafe','mecsafe_37_thumb.jpg',130, 87,15,'photo_5318334.html');
												thumbnails[5318351] = new thumbnail(5318351,'299336','Contracts','mecsafe09_82_thumb.jpg',130, 123,15,'photo_5318351.html');
												thumbnails[5318354] = new thumbnail(5318354,'299336','Testing','mecsafe09_104_thumb.jpg',130, 100,15,'photo_5318354.html');
												thumbnails[5318359] = new thumbnail(5318359,'299336','Ariel Photography','rosscolliery_thumb.jpg',130, 92,15,'photo_5318359.html');
												thumbnails[5318360] = new thumbnail(5318360,'299336','Business with Smith Craven','smithcraven_53_thumb.jpg',130, 87,15,'photo_5318360.html');
												thumbnails[5318362] = new thumbnail(5318362,'299336','Elachi','SUM_0015_thumb.jpg',130, 96,15,'photo_5318362.html');
												thumbnails[5318363] = new thumbnail(5318363,'299336','Weather Lottery','weather_1321_thumb.jpg',130, 87,15,'photo_5318363.html');
												thumbnails[5318373] = new thumbnail(5318373,'199549','Bryan Adams','adamsrain1_thumb.jpg',130, 87,15,'photo_5318373.html');
												thumbnails[5318383] = new thumbnail(5318383,'199548','Paphos Lighthouse','cyprus_0108_thumb.jpg',130, 195,15,'photo_5318383.html');
												thumbnails[5318390] = new thumbnail(5318390,'199548','Doncaster','don_48_thumb.jpg',130, 89,15,'photo_5318390.html');
												thumbnails[5318395] = new thumbnail(5318395,'199549','John Parr','johnparr1_thumb.jpg',130, 87,15,'photo_5318395.html');
												thumbnails[5318396] = new thumbnail(5318396,'199549','John Parr Band','johnparr2_thumb.jpg',130, 87,15,'photo_5318396.html');
												thumbnails[5318398] = new thumbnail(5318398,'199548','Magpie Mine','peak_115_thumb.jpg',130, 87,15,'photo_5318398.html');
												thumbnails[5318402] = new thumbnail(5318402,'199548','Mattersey Priory','SUD_8900_thumb.jpg',130, 93,15,'photo_5318402.html');
												thumbnails[5318407] = new thumbnail(5318407,'199548','Whitby','SUM_0058_thumb.jpg',130, 84,15,'photo_5318407.html');
												thumbnails[5318410] = new thumbnail(5318410,'199548','Barnburgh','SUM_0103_thumb.jpg',130, 87,15,'photo_5318410.html');
												thumbnails[5318413] = new thumbnail(5318413,'199548','Venice','venice07_053_thumb.jpg',130, 194,15,'photo_5318413.html');
												thumbnails[5318415] = new thumbnail(5318415,'199548','Venice','venice07_147_thumb.jpg',130, 87,15,'photo_5318415.html');
												thumbnails[5318417] = new thumbnail(5318417,'199549','Bryan Adams','adams2_thumb.jpg',130, 87,15,'photo_5318417.html');
												thumbnails[5318418] = new thumbnail(5318418,'199549','Bryan Adams Band','adams3_thumb.jpg',130, 86,15,'photo_5318418.html');
												thumbnails[5318422] = new thumbnail(5318422,'199549','The Priory Live','priory_596_thumb.jpg',130, 87,15,'photo_5318422.html');
												thumbnails[5318431] = new thumbnail(5318431,'199549','Raw Talent 2009','raw-talent_434_thumb.jpg',130, 87,15,'photo_5318431.html');
												thumbnails[5318436] = new thumbnail(5318436,'199549','Raw Talent 2009','raw-talent_892_thumb.jpg',130, 87,15,'photo_5318436.html');
												thumbnails[5318437] = new thumbnail(5318437,'199549','Raw Talent 2009','raw-talent_934_thumb.jpg',130, 87,15,'photo_5318437.html');
												thumbnails[5318441] = new thumbnail(5318441,'199549','Silverfall','Silverfallbbc200707_045_thumb.jpg',130, 111,15,'photo_5318441.html');
												thumbnails[5318442] = new thumbnail(5318442,'199549','Silverfall','Silverfallbbc200707_058_thumb.jpg',130, 104,15,'photo_5318442.html');
												thumbnails[5318447] = new thumbnail(5318447,'199549','Silverfall','Silverfallbbc200707_133_thumb.jpg',130, 87,15,'photo_5318447.html');
												thumbnails[5318449] = new thumbnail(5318449,'199550','Bekki','_SUP1755_thumb.jpg',130, 182,15,'photo_5318449.html');
												thumbnails[5318453] = new thumbnail(5318453,'199550','Bekki','_SUP1779_thumb.jpg',130, 163,15,'photo_5318453.html');
												thumbnails[5318456] = new thumbnail(5318456,'199550','Bekki','bekki2008_0011_thumb.jpg',130, 87,15,'photo_5318456.html');
												thumbnails[5318458] = new thumbnail(5318458,'199550','Bekki','bekki2008_0053_thumb.jpg',130, 87,15,'photo_5318458.html');
												thumbnails[5318461] = new thumbnail(5318461,'199550','Bekki','bekki2008_0073_thumb.jpg',130, 192,15,'photo_5318461.html');
												thumbnails[5318463] = new thumbnail(5318463,'199550','Bekki','bekki2008_0099_thumb.jpg',130, 112,15,'photo_5318463.html');
												thumbnails[5318465] = new thumbnail(5318465,'199550','Dons','_SUP8201_thumb.jpg',130, 194,15,'photo_5318465.html');
												thumbnails[5318466] = new thumbnail(5318466,'199550','Miss Doncaster','miss-donny_178_thumb.jpg',130, 106,15,'photo_5318466.html');
												thumbnails[5318469] = new thumbnail(5318469,'199550','Nicola','nicola-3_thumb.jpg',130, 182,15,'photo_5318469.html');
												thumbnails[5318475] = new thumbnail(5318475,'199548','Venice','venice07_004_thumb.jpg',130, 87,15,'photo_5318475.html');
												thumbnails[5318478] = new thumbnail(5318478,'199306','Lewis Guy','derbyaway_651_thumb.jpg',130, 87,15,'photo_5318478.html');
												thumbnails[5318481] = new thumbnail(5318481,'199306','England U21','england_29_thumb.jpg',130, 100,15,'photo_5318481.html');
												thumbnails[5318487] = new thumbnail(5318487,'199306','England Women','england-women-5_thumb.jpg',130, 113,15,'photo_5318487.html');
												thumbnails[5318499] = new thumbnail(5318499,'199306','Futsal Referees','futsal2008_12881_thumb.jpg',130, 87,15,'photo_5318499.html');
												thumbnails[6506275] = new thumbnail(6506275,'199550','Clare Hannah Carlin','clare_6_thumb.jpg',130, 184,15,'photo_6506275.html');
												thumbnails[6506278] = new thumbnail(6506278,'199550','Clare Hannah Carlin','clare_191_thumb.jpg',130, 219,15,'photo_6506278.html');
												thumbnails[6506280] = new thumbnail(6506280,'199550','Clare Hannah Carlin','clare_207_thumb.jpg',130, 185,15,'photo_6506280.html');
												thumbnails[6506281] = new thumbnail(6506281,'199550','Clare Hannah Carlin','clare_299_thumb.jpg',130, 195,15,'photo_6506281.html');
												thumbnails[6506283] = new thumbnail(6506283,'199550','Clare Hannah Carlin<br>\r\n','clare_350-2_thumb.jpg',130, 115,15,'photo_6506283.html');
												thumbnails[6506287] = new thumbnail(6506287,'199548','Carl Wark from Millstone Edge','edgetoedge_206_thumb.jpg',130, 68,15,'photo_6506287.html');
												thumbnails[6506290] = new thumbnail(6506290,'199548','Flixton Poppies','flam_1349_thumb.jpg',130, 87,15,'photo_6506290.html');
												thumbnails[6506296] = new thumbnail(6506296,'199548','Yorkshire Dales','yorks-dales_thumb.jpg',130, 87,15,'photo_6506296.html');
												thumbnails[3276913] = new thumbnail(3276913,'199548','Over Ullswater','cumbria_572_thumb.jpg',130, 87,15,'photo_3276913.html');
												thumbnails[5313932] = new thumbnail(5313932,'199550','Kate at Camden','DSCF5808_thumb.jpg',130, 97,15,'photo_5313932.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[299336] = new gallery(299336,'5318363,5318362,5318360,5318359,5318354,5318351,5318334,5318319,5318309,5318269','Commercial','gallery',[5318163,5318177,5318263,5318269,5318309,5318319,5318334,5318351,5318354,5318359,5318360,5318362,5318363],0, 0, '', 'gallery_299336.html',0,0);
				  					galleries[199305] = new gallery(199305,'5313967,5313965,5313963,5313961,5313960,5313959,5313958,5313957,5313956,5313955','Weddings','gallery',[5313954,5313955,5313956,5313957,5313958,5313959,5313960,5313961,5313963,5313965,5313967],0, 0, '', 'gallery_199305.html',0,0);
				  					galleries[199306] = new gallery(199306,'5318499,5318487,5318481,5318478,5313951,5313950,5313949,5313946,5313945,5313944','Sport','gallery',[5313937,5313940,5313941,5313944,5313945,5313946,5313949,5313950,5313951,5318478,5318481,5318487,5318499],0, 0, '', 'gallery_199306.html',0,0);
				  					galleries[199548] = new gallery(199548,'6506296,6506290,6506287,5318475,5318415,5318413,5318410,5318407,5318402,5318398','Landscapes','gallery',[3276889,3276893,3276911,3276915,3276917,3276918,5313891,5313892,5313894,5318383,5318390,5318398,5318402,5318407,5318410,5318413,5318415,5318475,6506287,6506290,6506296,3276913],0, 0, '', 'gallery_199548.html',0,0);
				  					galleries[199549] = new gallery(199549,'5318447,5318442,5318441,5318437,5318436,5318431,5318422,5318418,5318417,5318396','Music','gallery',[5313897,5313898,5313899,5313900,5313901,5313903,5313905,5318292,5318373,5318395,5318396,5318417,5318418,5318422,5318431,5318436,5318437,5318441,5318442,5318447],0, 0, '', 'gallery_199549.html',0,0);
				  					galleries[199550] = new gallery(199550,'6506283,6506281,6506280,6506278,6506275,5318469,5318466,5318465,5318463,5318461','Portfolios','gallery',[5313934,5318449,5318453,5318456,5318458,5318461,5318463,5318465,5318466,5318469,6506275,6506278,6506280,6506281,6506283,5313932],0, 0, '', 'gallery_199550.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '6506287,6506278,6506275,5318410,5318319,5318177,5313960,5313944,5313898,3276917';
imageSets[3] = '6506296,6506290,6506287,6506283,6506281,6506280,6506278,6506275,5318499,5318487,5318481,5318478,5318475,5318469,5318466,5318465,5318463,5318461,5318458,5318456,5318453,5318449,5318447,5318442,5318441,5318437,5318436,5318431,5318422,5318418,5318417,5318415,5318413,5318410,5318407,5318402,5318398,5318396,5318395,5318390,5318383,5318373,5318363,5318362,5318360,5318359,5318354,5318351,5318334,5318319';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/steveu/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/steveu/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/steveu/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/steveu/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/steveu/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/steveu/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/steveu/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/steveu/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/steveu/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/steveu/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/steveu/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/steveu/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/steveu/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/steveu/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/steveu/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/steveu/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/steveu/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/steveu/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/steveu/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/steveu/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/steveu/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/steveu/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 = 'Steve Uttley 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 == undefined) {
    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.photo_ref != '') {
		temp = temp + '<p class="imageinfo" id="imageRef"><strong>Ref: </strong>' + this.photo_ref + '</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>';
	}
					
	temp = temp + this.fnGetPaymentInfo();
				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>Buy now using PayPal:</p>';
				temp = temp + '<p class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> &pound;' + (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="updateCartValue(document.forms.paymentForm,this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value); if(divShowing(\'paymentConfirm\')){fadeOut(\'paymentConfirm\', 3)};">';
				
		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 + '<form id="paymentForm" style="margin:0px;border:0px;" name="paymentForm">';
	temp = temp + '	<input type="hidden" name="item_option" value="' + item_option + '">';
	temp = temp + '	<input type="hidden" name="site" value="STEVEU">';
		temp = temp + '	<input type="hidden" name="item_number" value="'+ this.id +'">';
			temp = temp + '	<input type="hidden" name="quantity" value="1">';
								temp = temp + '	<input value="Add to cart" id="paymentAddButton" class="button" onmouseover="this.className=\'buttonHi\'\;" onmouseout="this.className=\'button\'\;" type="Button">';
			temp = temp + '	<input value="View cart" id="paymentViewButton" class="button" onmouseover="this.className=\'buttonHi\';" onmouseout="this.className=\'button\';" type="Button" onclick="javascript:window.location=\'cart.html\'">';
	temp = temp + '</form>';
		temp = temp + '<div class="clearing">&nbsp;</div>';
	temp = temp + '<div id="confirmContainer">';
	temp = temp + '<div id="paymentConfirm">Item added to cart</div>';
	temp = temp + '</div>';
			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;
	}
}

			

