window.thumbnails = new Object();
												thumbnails[1853798] = new thumbnail(1853798,'','Sunburst','Sunburst_thumb.jpg',130, 98,18,'#');
												thumbnails[2445731] = new thumbnail(2445731,'','Armed and Dangerous','Armed-and-Dangerous-for-web_thumb.jpg',130, 101,18,'#');
												thumbnails[2288248] = new thumbnail(2288248,'150131','At The End of The Day','At the end of the Day_thumb.jpg',130, 87,18,'photo_2288248.html');
												thumbnails[2288256] = new thumbnail(2288256,'150131','\'Scruff\'','Scruff_thumb.jpg',130, 195,18,'photo_2288256.html');
												thumbnails[2437442] = new thumbnail(2437442,'121747','Excitement','Excitement_thumb.jpg',130, 130,18,'photo_2437442.html');
												thumbnails[2437756] = new thumbnail(2437756,'121747','Oriental','Oriental-for-web_thumb.jpg',130, 167,18,'photo_2437756.html');
												thumbnails[2437769] = new thumbnail(2437769,'121747','Warm Cirroco','Warm-Cirroco-for-web_thumb.jpg',130, 101,18,'photo_2437769.html');
												thumbnails[2438844] = new thumbnail(2438844,'121747','Bluebell Wood','bluebell-wood-for-web_thumb.jpg',130, 130,18,'photo_2438844.html');
												thumbnails[2438902] = new thumbnail(2438902,'121747','Opulence','Opulence-for-web_thumb.jpg',130, 130,18,'photo_2438902.html');
												thumbnails[2439288] = new thumbnail(2439288,'121747','Attention','Attention-for-web_thumb.jpg',130, 167,18,'photo_2439288.html');
												thumbnails[2439337] = new thumbnail(2439337,'150131','Too Much Turkey','Robin-for-web_thumb.jpg',130, 148,18,'photo_2439337.html');
												thumbnails[2454075] = new thumbnail(2454075,'121747','Wallpaper','Flower-power-for-web_thumb.jpg',130, 130,18,'photo_2454075.html');
												thumbnails[3104660] = new thumbnail(3104660,'121747','Humbug','IMG_0168a copy1_thumb.jpg',130, 153,18,'photo_3104660.html');
												thumbnails[3113237] = new thumbnail(3113237,'121747','Explosion','IMG_2947a-copy_thumb.jpg',130, 96,18,'photo_3113237.html');
												thumbnails[3246679] = new thumbnail(3246679,'197530','Undercover Rainbow','Rugs-11_thumb.jpg',130, 195,18,'photo_3246679.html');
												thumbnails[3276198] = new thumbnail(3276198,'150131','Here\'s Looking at You','Monkey_thumb.jpg',130, 164,18,'photo_3276198.html');
												thumbnails[4846709] = new thumbnail(4846709,'121747','Sweet Peas','Sweet_Peas_thumb.jpg',130, 87,18,'photo_4846709.html');
												thumbnails[4846832] = new thumbnail(4846832,'121747','Uplifting','Uplifting_thumb.jpg',130, 87,18,'photo_4846832.html');
												thumbnails[4847053] = new thumbnail(4847053,'121558','Refresh','Refresh_thumb.jpg',130, 195,18,'photo_4847053.html');
												thumbnails[4895271] = new thumbnail(4895271,'121559','Falls at the Dingle','IMG_0872b_copy_thumb.jpg',130, 94,18,'photo_4895271.html');
												thumbnails[4895320] = new thumbnail(4895320,'121747','Poppy Power','Poppy_6b_thumb.jpg',130, 94,18,'photo_4895320.html');
												thumbnails[4895584] = new thumbnail(4895584,'121747','Delicate','Delicate_copy1_thumb.jpg',130, 195,18,'photo_4895584.html');
												thumbnails[4895627] = new thumbnail(4895627,'121558','Grace','Tulip_2_thumb.jpg',130, 199,18,'photo_4895627.html');
												thumbnails[5333546] = new thumbnail(5333546,'121559','Lost Lake','Web-1_thumb.jpg',130, 86,18,'photo_5333546.html');
												thumbnails[5333563] = new thumbnail(5333563,'121559','Wonderous Place','web_2_thumb.jpg',130, 94,18,'photo_5333563.html');
												thumbnails[5333569] = new thumbnail(5333569,'121559','Upon Golden Pond','web3_thumb.jpg',130, 87,18,'photo_5333569.html');
												thumbnails[5410403] = new thumbnail(5410403,'121558','Lilly The Pink','Lilly_The_Pink_thumb.jpg',130, 189,18,'photo_5410403.html');
												thumbnails[5895502] = new thumbnail(5895502,'150131','Love is in the Air','IMG_0195C_thumb.jpg',130, 142,18,'photo_5895502.html');
												thumbnails[5987528] = new thumbnail(5987528,'121558','My Buddy','poppy5_web_thumb.jpg',130, 130,18,'photo_5987528.html');
												thumbnails[7324468] = new thumbnail(7324468,'121559','Barmouth View','web_barmouth_thumb.jpg',130, 68,18,'photo_7324468.html');
												thumbnails[7372878] = new thumbnail(7372878,'121559','Making Tracks','web_2_F6F3B830-24E8-5EC4-4FA5C435D3DDC700_thumb.jpg',130, 92,18,'photo_7372878.html');
												thumbnails[7372905] = new thumbnail(7372905,'121558','Raindrops on Rose','Raindrops_on_Rose_web_thumb.jpg',130, 189,18,'photo_7372905.html');
												thumbnails[7372942] = new thumbnail(7372942,'121559','Bridges','Bridges_web_thumb.jpg',130, 104,18,'photo_7372942.html');
												thumbnails[7372960] = new thumbnail(7372960,'150131','Chill','George_web_thumb.jpg',130, 90,18,'photo_7372960.html');
												thumbnails[7373002] = new thumbnail(7373002,'121559','Frozen Shadows','frozen_shadows_web_thumb.jpg',130, 68,18,'photo_7373002.html');
												thumbnails[7589690] = new thumbnail(7589690,'150131','Moody Blues','Web-Copy_thumb.jpg',130, 90,18,'photo_7589690.html');
												thumbnails[7847299] = new thumbnail(7847299,'121559','Banburgh Castle','castle_copy_web_thumb.jpg',130, 188,18,'photo_7847299.html');
												thumbnails[7847642] = new thumbnail(7847642,'121559','Snowdonia','web_copy_thumb.jpg',130, 90,18,'photo_7847642.html');
												thumbnails[7847663] = new thumbnail(7847663,'121559','Elevated Levels','web_copy1_thumb.jpg',130, 91,18,'photo_7847663.html');
												thumbnails[7847675] = new thumbnail(7847675,'121559','Powis Castle','web_copy12_thumb.jpg',130, 88,18,'photo_7847675.html');
												thumbnails[7847720] = new thumbnail(7847720,'121559','A Winters Tale ...','web_copy123_thumb.jpg',130, 191,18,'photo_7847720.html');
												thumbnails[7847730] = new thumbnail(7847730,'121559','Chatsworth House','web_copy1234_thumb.jpg',130, 88,18,'photo_7847730.html');
												thumbnails[7847734] = new thumbnail(7847734,'121558','Raindrops on Snowdrops','web_copy12345_thumb.jpg',130, 281,18,'photo_7847734.html');
												thumbnails[7859431] = new thumbnail(7859431,'121559','Banburgh Castle Sunset','castle_2_copy_copy_thumb.jpg',130, 81,18,'photo_7859431.html');
												thumbnails[7878035] = new thumbnail(7878035,'197530','Make Way!','landing_3_thumb.jpg',130, 117,18,'photo_7878035.html');
												thumbnails[7909731] = new thumbnail(7909731,'121747','Tulips from Northumberland','270b_copy_thumb.jpg',130, 189,18,'photo_7909731.html');
												thumbnails[7909808] = new thumbnail(7909808,'150131','Jason and Charlotte','web_copy123456_thumb.jpg',130, 190,18,'photo_7909808.html');
												thumbnails[7909998] = new thumbnail(7909998,'150131','Charlotte','web_2_607BD32B-1EC9-D45B-1CD64377BBFD3F6F_thumb.jpg',130, 130,18,'photo_7909998.html');
												thumbnails[2437502] = new thumbnail(2437502,'121558','Iris','Iris-for-Web_thumb.jpg',130, 130,18,'photo_2437502.html');
												thumbnails[2438948] = new thumbnail(2438948,'121559','Lakeside Boats','Lakeside-Boats-for-web_thumb.jpg',130, 61,18,'photo_2438948.html');
												thumbnails[2437618] = new thumbnail(2437618,'121558','Peace','Peace-for-web1_thumb.jpg',130, 130,18,'photo_2437618.html');
												thumbnails[2438995] = new thumbnail(2438995,'121559','Lake Vyrnwy','Lake-Vyrnwy-for-web_thumb.jpg',130, 167,18,'photo_2438995.html');
												thumbnails[3243044] = new thumbnail(3243044,'197530','Teracotta Pot','Terracotta-Pot-1_thumb.jpg',130, 195,18,'photo_3243044.html');
												thumbnails[2438973] = new thumbnail(2438973,'121559','On The Rocks','On-The-Rocks-for-web_thumb.jpg',130, 167,18,'photo_2438973.html');
												thumbnails[2439074] = new thumbnail(2439074,'121558','Lavender','Lavender-for-web_thumb.jpg',130, 130,18,'photo_2439074.html');
												thumbnails[3243051] = new thumbnail(3243051,'197530','Steps','Steps-copy_thumb.jpg',130, 195,18,'photo_3243051.html');
												thumbnails[2439090] = new thumbnail(2439090,'121559','Flame and Flight','Flame-and-Flight-for-web_thumb.jpg',130, 101,18,'photo_2439090.html');
												thumbnails[2454071] = new thumbnail(2454071,'121558','Centre of Attention','Rose-for-web_thumb.jpg',130, 130,18,'photo_2454071.html');
												thumbnails[3236903] = new thumbnail(3236903,'197530','Pillars','Pillars-14_thumb.jpg',130, 87,18,'photo_3236903.html');
												thumbnails[2437522] = new thumbnail(2437522,'121558','The Colour Purple','Purple-Tulip-for-web_thumb.jpg',130, 130,18,'photo_2437522.html');
												thumbnails[2930843] = new thumbnail(2930843,'121559','Above and Beyond','IMG_0183_thumb.jpg',130, 161,18,'photo_2930843.html');
												thumbnails[3242970] = new thumbnail(3242970,'197530','Michelangelo Statues','Statues-best_thumb.jpg',130, 60,18,'photo_3242970.html');
												thumbnails[2437657] = new thumbnail(2437657,'121558','A Burst of Sun','Sunflower-for-web_thumb.jpg',130, 130,18,'photo_2437657.html');
												thumbnails[2438965] = new thumbnail(2438965,'121559','Lone Rambler','Lone-Rambler-for-web_thumb.jpg',130, 167,18,'photo_2438965.html');
												thumbnails[3236906] = new thumbnail(3236906,'197530','The Colosseum','Coloss-23_thumb.jpg',130, 87,18,'photo_3236906.html');
												thumbnails[2437479] = new thumbnail(2437479,'121558','Botanical','Botanical_thumb.jpg',130, 130,18,'photo_2437479.html');
												thumbnails[2439068] = new thumbnail(2439068,'121559','Tree Among Rape','Tree-among-rape-for-web_thumb.jpg',130, 71,18,'photo_2439068.html');
												thumbnails[3243047] = new thumbnail(3243047,'197530','Please Release Me','IMG_0032_thumb.jpg',130, 195,18,'photo_3243047.html');
												thumbnails[2437719] = new thumbnail(2437719,'121558','Sneak Preview','Sneak-Preview-for-web_thumb.jpg',130, 101,18,'photo_2437719.html');
												thumbnails[2439256] = new thumbnail(2439256,'121559','Enchanted','Enchanted-for-web_thumb.jpg',130, 189,18,'photo_2439256.html');
												thumbnails[3243065] = new thumbnail(3243065,'197530','Tranquil','IMG_0240_thumb.jpg',130, 195,18,'photo_3243065.html');
												thumbnails[2438840] = new thumbnail(2438840,'121558','Spring','Spring-for-web_thumb.jpg',130, 130,18,'photo_2438840.html');
												thumbnails[2439303] = new thumbnail(2439303,'121559','Woodland Walk','Woodland-Walk-for-web_thumb.jpg',130, 189,18,'photo_2439303.html');
												thumbnails[3243146] = new thumbnail(3243146,'197530','Any Takers','IMG_0271_thumb.jpg',130, 195,18,'photo_3243146.html');
												thumbnails[2446021] = new thumbnail(2446021,'121559','York Bridge','York-Bridge-for-web_thumb.jpg',130, 101,18,'photo_2446021.html');
												thumbnails[3113164] = new thumbnail(3113164,'121558','Serene','IMG_0156a1_thumb.jpg',130, 96,18,'photo_3113164.html');
												thumbnails[3243156] = new thumbnail(3243156,'197530','Restless Afternoon','IMG_02242_thumb.jpg',130, 84,18,'photo_3243156.html');
												thumbnails[2445738] = new thumbnail(2445738,'121559','Dusk','Dusk-for-web_thumb.jpg',130, 167,18,'photo_2445738.html');
												thumbnails[3014094] = new thumbnail(3014094,'121558','Autumn Acer','Autumn_thumb.jpg',130, 90,18,'photo_3014094.html');
												thumbnails[3243108] = new thumbnail(3243108,'197530','Menorcan Sandals','IMG_0158_thumb.jpg',130, 87,18,'photo_3243108.html');
												thumbnails[1824236] = new thumbnail(1824236,'121559','Tree of Red','Tree of Red_thumb.jpg',130, 194,18,'photo_1824236.html');
												thumbnails[2454066] = new thumbnail(2454066,'121558','Cactus Twirl','Cactus-Twirl-for-web_thumb.jpg',130, 101,18,'photo_2454066.html');
												thumbnails[3243030] = new thumbnail(3243030,'197530','Night Light','IMG_0274_thumb.jpg',130, 95,18,'photo_3243030.html');
												thumbnails[2437727] = new thumbnail(2437727,'121558','Tulip and Droplets','Tulip-and-Droplets-for-web_thumb.jpg',130, 167,18,'photo_2437727.html');
												thumbnails[2438923] = new thumbnail(2438923,'121559','Menorca Sunset','Menorcan-sunset-for-web_thumb.jpg',130, 101,18,'photo_2438923.html');
												thumbnails[3243026] = new thumbnail(3243026,'197530','Parga Town, Greece','IMG_0082_thumb.jpg',130, 61,18,'photo_3243026.html');
												thumbnails[2437688] = new thumbnail(2437688,'121558','Tulip in Vase','Tulip-in-vase-for-web_thumb.jpg',130, 167,18,'photo_2437688.html');
												thumbnails[2445742] = new thumbnail(2445742,'121559','Fountains Abbey','Fountains-Abbey-for-web_thumb.jpg',130, 101,18,'photo_2445742.html');
												thumbnails[2931268] = new thumbnail(2931268,'121559','Calm Before the Storm','IMG_3137_thumb.jpg',130, 93,18,'photo_2931268.html');
												thumbnails[2001551] = new thumbnail(2001551,'121747','Swingboats','Swing Boats_thumb.jpg',130, 195,18,'photo_2001551.html');
												thumbnails[2038886] = new thumbnail(2038886,'150131','Beggar Lady','Grazie_thumb.jpg',130, 195,18,'photo_2038886.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[121558] = new gallery(121558,'7847734,7372905,5987528,5410403,4895627,4847053,3113164,3014094,2454071,2454066','Fine Art','gallery',[4847053,4895627,5410403,5987528,7372905,7847734,2437502,2437618,2439074,2454071,2437522,2437657,2437479,2437719,2438840,3113164,3014094,2454066,2437727,2437688],0, 1, '', 'gallery_121558.html',0,0);
				  					galleries[121559] = new gallery(121559,'7859431,7847730,7847720,7847675,7847663,7847642,7847299,7373002,7372942,7372878','Landscapes','gallery',[4895271,5333546,5333563,5333569,7324468,7372878,7372942,7373002,7847299,7847642,7847663,7847675,7847720,7847730,7859431,2438948,2438995,2438973,2439090,2930843,2438965,2439068,2439256,2439303,2446021,2445738,1824236,2438923,2445742,2931268],0, 1, '', 'gallery_121559.html',0,0);
				  					galleries[150131] = new gallery(150131,'7909998,7909808,7589690,7372960,5895502,3276198,2439337,2288256,2288248,2038886','Portraiture','gallery',[2288248,2288256,2439337,3276198,5895502,7372960,7589690,7909808,7909998,2038886],0, 1, '', 'gallery_150131.html',0,0);
				  					galleries[197530] = new gallery(197530,'7878035,3246679,3243156,3243146,3243108,3243065,3243051,3243047,3243044,3243030','Travel','gallery',[3246679,7878035,3243044,3243051,3236903,3242970,3236906,3243047,3243065,3243146,3243156,3243108,3243030,3243026],0, 1, '', 'gallery_197530.html',0,0);
				  					galleries[121747] = new gallery(121747,'7909731,4895584,4895320,4846832,4846709,3113237,3104660,2454075,2439288,2438902','Contemporary','gallery',[2437442,2437756,2437769,2438844,2438902,2439288,2454075,3104660,3113237,4846709,4846832,4895320,4895584,7909731,2001551],0, 1, '', 'gallery_121747.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '1853798';
imageSets[3] = '7909998,7909808,7909731,7878035,7859431,7847734,7847730,7847720,7847675,7847663,7847642,7847299,7589690,7373002,7372960,7372942,7372905,7372878,7324468,5987528,5895502,5410403,5333569,5333563,5333546,4895627,4895584,4895320,4895271,4847053,4846832,4846709,3276198,3246679,3243156,3243146,3243108,3243065,3243051,3243047,3243044,3243030,3243026,3242970,3236906,3236903,3113237,3113164,3104660,3014094';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/sdchatham/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/sdchatham/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/sdchatham/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/sdchatham/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/sdchatham/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/sdchatham/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/sdchatham/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/sdchatham/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/sdchatham/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/sdchatham/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/sdchatham/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/sdchatham/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/sdchatham/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/sdchatham/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/sdchatham/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/sdchatham/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/sdchatham/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/sdchatham/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/sdchatham/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/sdchatham/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/sdchatham/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/sdchatham/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 = 'Sue Chatham Photography: ' + photoCaption;
			    }
        if (op.$detail.length > 0) {
      temp = op.nextPhoto.fnGetImageDetails();
	    op.$detail.fadeGalleryDetails(temp, op.speed, function(){
	    var options = {photoinfominwidth:200};	    		options.photoinfoadjacent = true;			      	      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="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 + '<form id="paymentForm" style="margin:0px;border:0px;" name="paymentForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
	temp = 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 = temp + '<input type="hidden" name="cmd" value="_cart">';
	temp = temp + '<input type="hidden" name="business" value="schatham@blueyonder.co.uk">';
	temp = temp + '<input type="hidden" name="currency_code" value="GBP">';
	temp = temp + '<input type="hidden" name="add" value="1">';
					temp = temp + '<input type="hidden" name="amount" value="'+amount+'">';
	temp = temp + '<input type="hidden" name="item_number" value="'+ref+'">';
					temp = temp + '<input type=\"Submit\" value=\"Add to cart\" id=\"paymentAddButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
									temp = temp + '</form>';
								temp = temp + '<form id="paymentCartForm" style="margin:0px;" name="paymentCartForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
	temp = temp + '<input type="hidden" name="cmd" value="_cart">';
	temp = temp + '<input type="hidden" name="business" value="schatham@blueyonder.co.uk">';
	temp = temp + '<input type="hidden" name="display" value="1">';
	temp = temp + '<input type=\"Submit\" value=\"View cart\" id=\"paymentViewButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
	temp = temp + '</form>';
							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;
	}
}

			

