window.thumbnails = new Object();
												thumbnails[3319662] = new thumbnail(3319662,'','','Home_21_thumb.jpg',85, 67,15,'#');
												thumbnails[7288242] = new thumbnail(7288242,'','44 Hunstanton','0044_thumb.jpg',85, 57,15,'#');
												thumbnails[3343152] = new thumbnail(3343152,'201128','','PB224931--4564_thumb.jpg',85, 57,15,'photo_3343152.html');
												thumbnails[3343156] = new thumbnail(3343156,'201128','','P9203556-4546_thumb.jpg',85, 57,15,'photo_3343156.html');
												thumbnails[3343403] = new thumbnail(3343403,'201128','','PB084538-4558-copy_thumb.jpg',85, 57,15,'photo_3343403.html');
												thumbnails[7292544] = new thumbnail(7292544,'201128','','IMG_0190_thumb.jpg',85, 57,15,'photo_7292544.html');
												thumbnails[3329487] = new thumbnail(3329487,'201128','','IMG_0741-47681_thumb.jpg',85, 57,15,'photo_3329487.html');
												thumbnails[3329477] = new thumbnail(3329477,'201128','','IMG_0723-copy_thumb.jpg',85, 57,15,'photo_3329477.html');
												thumbnails[7292450] = new thumbnail(7292450,'201128','','IMG_0025_thumb.jpg',85, 57,15,'photo_7292450.html');
												thumbnails[7292596] = new thumbnail(7292596,'201128','','IMG_0144_thumb.jpg',85, 57,15,'photo_7292596.html');
												thumbnails[3329432] = new thumbnail(3329432,'201128','','IMG_0128-5042_thumb.jpg',85, 128,15,'photo_3329432.html');
												thumbnails[3329539] = new thumbnail(3329539,'201128','','IMG_0109-5028-_thumb.jpg',85, 128,15,'photo_3329539.html');
												thumbnails[7292453] = new thumbnail(7292453,'201128','','IMG_0104_thumb.jpg',85, 128,15,'photo_7292453.html');
												thumbnails[3330460] = new thumbnail(3330460,'201128','','IMG_0009-5027Hand-copy1_thumb.jpg',85, 128,15,'photo_3330460.html');
												thumbnails[3329973] = new thumbnail(3329973,'201128','','IMG_0126-4926-copy_thumb.jpg',85, 128,15,'photo_3329973.html');
												thumbnails[3343242] = new thumbnail(3343242,'201128','','PB224913-4564_thumb.jpg',85, 128,15,'photo_3343242.html');
												thumbnails[7292615] = new thumbnail(7292615,'201128','','IMG_0015-4980Hand-copy_thumb.jpg',85, 128,15,'photo_7292615.html');
												thumbnails[7292551] = new thumbnail(7292551,'201128','','IMG_0217Motionjpg_thumb.jpg',85, 128,15,'photo_7292551.html');
												thumbnails[3330387] = new thumbnail(3330387,'201128','','IMG_0049-4761_thumb.jpg',85, 57,15,'photo_3330387.html');
												thumbnails[3330418] = new thumbnail(3330418,'201128','','IMG_0050-5018BW_thumb.jpg',85, 57,15,'photo_3330418.html');
												thumbnails[3330450] = new thumbnail(3330450,'201128','','IMG_9959_thumb.jpg',85, 57,15,'photo_3330450.html');
												thumbnails[3330488] = new thumbnail(3330488,'201128','','IMG_0179-50462_thumb.jpg',85, 57,15,'photo_3330488.html');
												thumbnails[7292457] = new thumbnail(7292457,'201128','','IMG_0184_thumb.jpg',85, 57,15,'photo_7292457.html');
												thumbnails[3342820] = new thumbnail(3342820,'201128','','IMG_0386_thumb.jpg',85, 57,15,'photo_3342820.html');
												thumbnails[7292451] = new thumbnail(7292451,'201128','','IMG_0093_thumb.jpg',85, 57,15,'photo_7292451.html');
												thumbnails[3342828] = new thumbnail(3342828,'201128','','IMG_0164-4999-copy_thumb.jpg',85, 57,15,'photo_3342828.html');
												thumbnails[3330407] = new thumbnail(3330407,'201128','','IMG_0106-4834_thumb.jpg',85, 128,15,'photo_3330407.html');
												thumbnails[3330434] = new thumbnail(3330434,'201128','','IMG_0101-5042_thumb.jpg',85, 128,15,'photo_3330434.html');
												thumbnails[3329913] = new thumbnail(3329913,'201128','','IMG_9244-4810_thumb.jpg',85, 128,15,'photo_3329913.html');
												thumbnails[3330492] = new thumbnail(3330492,'201128','','IMG_0146-4826_thumb.jpg',85, 128,15,'photo_3330492.html');
												thumbnails[7292480] = new thumbnail(7292480,'201128','','IMG_0197BW_thumb.jpg',85, 128,15,'photo_7292480.html');
												thumbnails[3342855] = new thumbnail(3342855,'201128','','IMG_0119-4941-copy_thumb.jpg',85, 128,15,'photo_3342855.html');
												thumbnails[3342943] = new thumbnail(3342943,'201128','','IMG_00501_thumb.jpg',85, 128,15,'photo_3342943.html');
												thumbnails[3343096] = new thumbnail(3343096,'201128','','IMG_0118-5010_thumb.jpg',85, 128,15,'photo_3343096.html');
												thumbnails[3334260] = new thumbnail(3334260,'203297','','129_thumb.jpg',85, 57,15,'photo_3334260.html');
												thumbnails[3334440] = new thumbnail(3334440,'203297','','3742_thumb.jpg',85, 57,15,'photo_3334440.html');
												thumbnails[3334269] = new thumbnail(3334269,'203297','','IMG_0002_thumb.jpg',85, 57,15,'photo_3334269.html');
												thumbnails[3334273] = new thumbnail(3334273,'203297','','IMG_00041_thumb.jpg',85, 57,15,'photo_3334273.html');
												thumbnails[3334278] = new thumbnail(3334278,'203297','','IMG_0006-C-copy_thumb.jpg',85, 57,15,'photo_3334278.html');
												thumbnails[3334282] = new thumbnail(3334282,'203297','','IMG_00131_thumb.jpg',85, 57,15,'photo_3334282.html');
												thumbnails[3334287] = new thumbnail(3334287,'203297','','IMG_00171_thumb.jpg',85, 57,15,'photo_3334287.html');
												thumbnails[3334289] = new thumbnail(3334289,'203297','','IMG_0022_thumb.jpg',85, 57,15,'photo_3334289.html');
												thumbnails[3334294] = new thumbnail(3334294,'203297','','32_thumb.jpg',85, 128,15,'photo_3334294.html');
												thumbnails[3334298] = new thumbnail(3334298,'203297','','IMG_0003-copy_thumb.jpg',85, 128,15,'photo_3334298.html');
												thumbnails[3334305] = new thumbnail(3334305,'203297','','IMG_0007_thumb.jpg',85, 128,15,'photo_3334305.html');
												thumbnails[3334448] = new thumbnail(3334448,'203297','','P31_thumb.jpg',85, 128,15,'photo_3334448.html');
												thumbnails[3334450] = new thumbnail(3334450,'203297','','IMG_14861_thumb.jpg',85, 128,15,'photo_3334450.html');
												thumbnails[3334369] = new thumbnail(3334369,'203297','','IMG_0037BW_thumb.jpg',85, 128,15,'photo_3334369.html');
												thumbnails[3334370] = new thumbnail(3334370,'203297','','IMG_0038_thumb.jpg',85, 128,15,'photo_3334370.html');
												thumbnails[3334373] = new thumbnail(3334373,'203297','','IMG_0092-copy_thumb.jpg',85, 128,15,'photo_3334373.html');
												thumbnails[3334381] = new thumbnail(3334381,'203297','','IMG_0024-copy_thumb.jpg',85, 57,15,'photo_3334381.html');
												thumbnails[3334383] = new thumbnail(3334383,'203297','','IMG_0028_thumb.jpg',85, 57,15,'photo_3334383.html');
												thumbnails[3334385] = new thumbnail(3334385,'203297','','IMG_0050_thumb.jpg',85, 57,15,'photo_3334385.html');
												thumbnails[3334389] = new thumbnail(3334389,'203297','','IMG_0175-copy_thumb.jpg',85, 57,15,'photo_3334389.html');
												thumbnails[3334392] = new thumbnail(3334392,'203297','','IMG_0201-copy_thumb.jpg',85, 57,15,'photo_3334392.html');
												thumbnails[3334442] = new thumbnail(3334442,'203297','','IMG_14731_thumb.jpg',85, 57,15,'photo_3334442.html');
												thumbnails[3334445] = new thumbnail(3334445,'203297','','IMG_15331_thumb.jpg',85, 57,15,'photo_3334445.html');
												thumbnails[3334447] = new thumbnail(3334447,'203297','','Pyne-3988_99-55_thumb.jpg',85, 57,15,'photo_3334447.html');
												thumbnails[3334416] = new thumbnail(3334416,'203297','','Mum-&Child-FL_thumb.jpg',85, 128,15,'photo_3334416.html');
												thumbnails[3334403] = new thumbnail(3334403,'203297','','IMG_0131Red_thumb.jpg',85, 128,15,'photo_3334403.html');
												thumbnails[3334407] = new thumbnail(3334407,'203297','','IMG_0184-4743_thumb.jpg',85, 128,15,'photo_3334407.html');
												thumbnails[3334409] = new thumbnail(3334409,'203297','','IMG_0187-copy_thumb.jpg',85, 128,15,'photo_3334409.html');
												thumbnails[3334319] = new thumbnail(3334319,'203297','','IMG_0028-copy1_thumb.jpg',85, 128,15,'photo_3334319.html');
												thumbnails[3334477] = new thumbnail(3334477,'203297','','Issaccs-3997_99-B54_cbs_thumb.jpg',85, 128,15,'photo_3334477.html');
												thumbnails[3334398] = new thumbnail(3334398,'203297','','IMG_0097-copy_thumb.jpg',85, 128,15,'photo_3334398.html');
												thumbnails[3334308] = new thumbnail(3334308,'203297','','IMG_0013A1_thumb.jpg',85, 128,15,'photo_3334308.html');
												thumbnails[7288816] = new thumbnail(7288816,'203056','41 Ely Tea Rooms','IMG_00411_thumb.jpg',85, 57,15,'photo_7288816.html');
												thumbnails[7288215] = new thumbnail(7288215,'203056','15 Ely Cherry Park','0015_copy_thumb.jpg',85, 57,15,'photo_7288215.html');
												thumbnails[7288234] = new thumbnail(7288234,'203056','34 Hunstanton Beach','0034_thumb.jpg',85, 57,15,'photo_7288234.html');
												thumbnails[7288247] = new thumbnail(7288247,'203056','46 Brancaster','0046_thumb.jpg',85, 57,15,'photo_7288247.html');
												thumbnails[7291000] = new thumbnail(7291000,'203056','1679 Gondolas','IMG_1679ALT_thumb.jpg',85, 57,15,'photo_7291000.html');
												thumbnails[7288279] = new thumbnail(7288279,'203056','4201478 Dorset','42014781_thumb.jpg',85, 57,15,'photo_7288279.html');
												thumbnails[7288296] = new thumbnail(7288296,'203056','01 Ely Snow on the Green','IMG_0001_thumb.jpg',85, 57,15,'photo_7288296.html');
												thumbnails[7288300] = new thumbnail(7288300,'203056','06 Ely Arches','IMG_0006_thumb.jpg',85, 57,15,'photo_7288300.html');
												thumbnails[7288323] = new thumbnail(7288323,'203056','11 Beach Huts','IMG_0011_thumb.jpg',85, 57,15,'photo_7288323.html');
												thumbnails[7288318] = new thumbnail(7288318,'203056','09 Ely Snowscene','IMG_0009_thumb.jpg',85, 57,15,'photo_7288318.html');
												thumbnails[7288317] = new thumbnail(7288317,'203056','07 Ely Lantern','IMG_0007_18AC09F7-1EC9-DFB6-091BB148DDC06891_thumb.jpg',85, 57,15,'photo_7288317.html');
												thumbnails[7288329] = new thumbnail(7288329,'203056','24 Sunset','IMG_0024-copy-1_thumb.jpg',85, 57,15,'photo_7288329.html');
												thumbnails[7288332] = new thumbnail(7288332,'203056','21 Ely Cutter in the snow','IMG_0021_thumb.jpg',85, 57,15,'photo_7288332.html');
												thumbnails[7288336] = new thumbnail(7288336,'203056','33 Ely Grazing in the park','IMG_0033_thumb.jpg',85, 57,15,'photo_7288336.html');
												thumbnails[7288339] = new thumbnail(7288339,'203056','35 Hastings','IMG_0035_thumb.jpg',85, 57,15,'photo_7288339.html');
												thumbnails[7288352] = new thumbnail(7288352,'203056','43 Ely River and Rail','IMG_0043_thumb.jpg',85, 57,15,'photo_7288352.html');
												thumbnails[7288355] = new thumbnail(7288355,'203056','48 Ely Longboat by Cutter','IMG_0048_thumb.jpg',85, 57,15,'photo_7288355.html');
												thumbnails[7288356] = new thumbnail(7288356,'203056','57 Ely Cathedral in the Mist','IMG_0057_thumb.jpg',85, 57,15,'photo_7288356.html');
												thumbnails[7288499] = new thumbnail(7288499,'203056','1837 Low Cloud Sunset','IMG_1837_thumb.jpg',85, 57,15,'photo_7288499.html');
												thumbnails[7288359] = new thumbnail(7288359,'203056','108 Stuntney Hill Ely','IMG_0108-Oct_thumb.jpg',85, 57,15,'photo_7288359.html');
												thumbnails[7288378] = new thumbnail(7288378,'203056','121 Ely Palace Green','IMG_0121_thumb.jpg',85, 57,15,'photo_7288378.html');
												thumbnails[7288398] = new thumbnail(7288398,'203056','185 Ely Sunset in the Snow','IMG_0185_thumb.jpg',85, 57,15,'photo_7288398.html');
												thumbnails[7288422] = new thumbnail(7288422,'203056','217 Barton Square Ely','IMG_0217_thumb.jpg',85, 57,15,'photo_7288422.html');
												thumbnails[7288431] = new thumbnail(7288431,'203056','456 Ely Roswell Reeds','IMG_0456_thumb.jpg',85, 57,15,'photo_7288431.html');
												thumbnails[7288856] = new thumbnail(7288856,'203056','1972 Sail in the Sunset','IMG_1972_thumb.jpg',85, 128,15,'photo_7288856.html');
												thumbnails[7288435] = new thumbnail(7288435,'203056','1747 Ely Roswell Daisies','IMG_1747_thumb.jpg',85, 57,15,'photo_7288435.html');
												thumbnails[7288864] = new thumbnail(7288864,'203056','1688 Ely Minster Tavern','IMG_1688_thumb.jpg',85, 128,15,'photo_7288864.html');
												thumbnails[7288519] = new thumbnail(7288519,'203056','3825 Ely Roswell Sunset','IMG_3825Lake-Sunset-View_thumb.jpg',85, 57,15,'photo_7288519.html');
												thumbnails[7288871] = new thumbnail(7288871,'203056','1977 Windmill Sunset','IMG_1977Sun_thumb.jpg',85, 128,15,'photo_7288871.html');
												thumbnails[7288530] = new thumbnail(7288530,'203056','3846 Pennine Way','IMG_3846-copy_thumb.jpg',85, 57,15,'photo_7288530.html');
												thumbnails[7288876] = new thumbnail(7288876,'203056','1707 Ely River Colours','IMG_1707_thumb.jpg',85, 128,15,'photo_7288876.html');
												thumbnails[7288541] = new thumbnail(7288541,'203056','3310 Oliver Cromwell in Ely','Oliver-Cromwell-13-3-2010_thumb.jpg',85, 57,15,'photo_7288541.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[201128] = new gallery(201128,'7292615,7292596,7292551,7292544,7292480,7292457,7292453,7292451,7292450,3343403','Wedding Gallery ','gallery',[3343152,3343156,3343403,7292544,3329487,3329477,7292450,7292596,3329432,3329539,7292453,3330460,3329973,3343242,7292615,7292551,3330387,3330418,3330450,3330488,7292457,3342820,7292451,3342828,3330407,3330434,3329913,3330492,7292480,3342855,3342943,3343096],0, 0, '', 'gallery.html',0,1);
				  					galleries[203056] = new gallery(203056,'7291000,7288876,7288871,7288864,7288856,7288816,7288541,7288530,7288519,7288499','Pictures make lovely Presents','section249928',[7288816,7288215,7288234,7288247,7291000,7288279,7288296,7288300,7288323,7288318,7288317,7288329,7288332,7288336,7288339,7288352,7288355,7288356,7288499,7288359,7288378,7288398,7288422,7288431,7288856,7288435,7288864,7288519,7288871,7288530,7288876,7288541],0, 0, '', 'section249928.html',0,1);
				  					galleries[203297] = new gallery(203297,'3334477,3334450,3334448,3334447,3334445,3334442,3334440,3334416,3334409,3334407','Portrait Gallery','section249077',[3334260,3334440,3334269,3334273,3334278,3334282,3334287,3334289,3334294,3334298,3334305,3334448,3334450,3334369,3334370,3334373,3334381,3334383,3334385,3334389,3334392,3334442,3334445,3334447,3334416,3334403,3334407,3334409,3334319,3334477,3334398,3334308],0, 0, '', 'section249077.html',0,1);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '3319662';
imageSets[3] = '7292615,7292596,7292551,7292544,7292480,7292457,7292453,7292451,7292450,7291000,7288876,7288871,7288864,7288856,7288816,7288541,7288530,7288519,7288499,7288435,7288431,7288422,7288398,7288378,7288359,7288356,7288355,7288352,7288339,7288336,7288332,7288329,7288323,7288318,7288317,7288300,7288296,7288279,7288247,7288242,7288234,7288215,3343403,3343242,3343156,3343152,3343096,3342943,3342855,3342828';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/andrewwmartin/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/andrewwmartin/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/andrewwmartin/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/andrewwmartin/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/andrewwmartin/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/andrewwmartin/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/andrewwmartin/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/andrewwmartin/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/andrewwmartin/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/andrewwmartin/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/andrewwmartin/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/andrewwmartin/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/andrewwmartin/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/andrewwmartin/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/andrewwmartin/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/andrewwmartin/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/andrewwmartin/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/andrewwmartin/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/andrewwmartin/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/andrewwmartin/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/andrewwmartin/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/andrewwmartin/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 = 'Andrew Martin Photography';
			    }
        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 = 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>Andrew Martin </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>Order this print:</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="ANDREWWMARTIN">';
		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;
	}
}

			

