window.thumbnails = new Object();
												thumbnails[1933506] = new thumbnail(1933506,'','Matfen Hall, Northumberland','cp4_thumb.jpg',130, 195,18,'															#');
												thumbnails[2467610] = new thumbnail(2467610,'','','cp14_thumb.jpg',130, 98,18,'															#');
												thumbnails[3584382] = new thumbnail(3584382,'','Close up detail photograph','DSC_6470_copy_thumb.jpg',130, 98,18,'															#');
												thumbnails[6562638] = new thumbnail(6562638,'129493','The coast line from North Shields to Whitley bay offers great photo opportunities for post ceremony photographs of the Bride and Groom','click_pic_thumb.jpg',130, 87,18,'																			photo_6562638.html');
												thumbnails[1931014] = new thumbnail(1931014,'129493','whitley bay Light House','clickpic2_thumb.jpg',130, 130,18,'																			photo_1931014.html');
												thumbnails[1931253] = new thumbnail(1931253,'129493','whitley bay Light House','clip_thumb.jpg',130, 87,18,'																			photo_1931253.html');
												thumbnails[1931296] = new thumbnail(1931296,'129493','Whitley bay light house','cp7_thumb.jpg',130, 130,18,'																			photo_1931296.html');
												thumbnails[1931313] = new thumbnail(1931313,'129493','The bride and groom set off from the church for wedding photographs at whitley bay light house.','cp9_thumb.jpg',130, 130,18,'																			photo_1931313.html');
												thumbnails[1931341] = new thumbnail(1931341,'129493','St Marys church wallsend','cp13_thumb.jpg',130, 173,18,'																			photo_1931341.html');
												thumbnails[1931345] = new thumbnail(1931345,'129493','Wedding photography at whitley bay light house','cp27_thumb.jpg',130, 98,18,'																			photo_1931345.html');
												thumbnails[1931348] = new thumbnail(1931348,'129493','','cp16_thumb.jpg',130, 130,18,'																			photo_1931348.html');
												thumbnails[1933524] = new thumbnail(1933524,'129493','Matfen hall Northumberland','cp6_thumb.jpg',130, 87,18,'																			photo_1933524.html');
												thumbnails[1933534] = new thumbnail(1933534,'129493','','cp2_thumb.jpg',130, 130,18,'																			photo_1933534.html');
												thumbnails[1933536] = new thumbnail(1933536,'129493','','cp71_thumb.jpg',130, 87,18,'																			photo_1933536.html');
												thumbnails[1933718] = new thumbnail(1933718,'129493','capturing the excitement','ccp9_thumb.jpg',130, 87,18,'																			photo_1933718.html');
												thumbnails[1933843] = new thumbnail(1933843,'129493','Bride and Groom Maften Hall','cp22_thumb.jpg',130, 195,18,'																			photo_1933843.html');
												thumbnails[1936906] = new thumbnail(1936906,'129493','Langley Castle Northumberland','cp155_thumb.jpg',130, 195,18,'																			photo_1936906.html');
												thumbnails[1939673] = new thumbnail(1939673,'129493','Linden Hall Northumberland ','clickpic1_thumb.jpg',130, 87,18,'																			photo_1939673.html');
												thumbnails[1939681] = new thumbnail(1939681,'129493','Linden Hall Northumberland','cp42_thumb.jpg',130, 130,18,'																			photo_1939681.html');
												thumbnails[1939684] = new thumbnail(1939684,'129493','','clikpic21_thumb.jpg',130, 87,18,'																			photo_1939684.html');
												thumbnails[1939685] = new thumbnail(1939685,'129493','','cp5_thumb.jpg',130, 130,18,'																			photo_1939685.html');
												thumbnails[1939710] = new thumbnail(1939710,'129493','Langley Castle','clipic_thumb.jpg',130, 130,18,'																			photo_1939710.html');
												thumbnails[1939741] = new thumbnail(1939741,'129493','','cp61_thumb.jpg',130, 130,18,'																			photo_1939741.html');
												thumbnails[1939761] = new thumbnail(1939761,'129493','','cp92_thumb.jpg',130, 87,18,'																			photo_1939761.html');
												thumbnails[2013202] = new thumbnail(2013202,'129493','Otterburn Towers Northumberland','clicpic_thumb.jpg',130, 195,18,'																			photo_2013202.html');
												thumbnails[2034392] = new thumbnail(2034392,'129493','Dissington Hall, Northumberland','disington hall 335 copy copy_thumb.jpg',130, 130,18,'																			photo_2034392.html');
												thumbnails[2034606] = new thumbnail(2034606,'129493','','disington hall 209 copy1_thumb.jpg',130, 87,18,'																			photo_2034606.html');
												thumbnails[2034695] = new thumbnail(2034695,'129493','Dissington Hall Northumberland','disington hall 770 copy_thumb.jpg',130, 194,18,'																			photo_2034695.html');
												thumbnails[2467638] = new thumbnail(2467638,'129493','','clic_thumb.jpg',130, 98,18,'																			photo_2467638.html');
												thumbnails[2467640] = new thumbnail(2467640,'129493','','cp15_thumb.jpg',130, 98,18,'																			photo_2467640.html');
												thumbnails[3289184] = new thumbnail(3289184,'129493','Autum Wedding at Otterburn Hall Northumberland','cick pic_thumb.jpg',130, 130,18,'																			photo_3289184.html');
												thumbnails[3462443] = new thumbnail(3462443,'129493','Langley Castle','21 copy copy_thumb.jpg',130, 130,18,'																			photo_3462443.html');
												thumbnails[3462783] = new thumbnail(3462783,'129493','Formal portrait of the Bride taken and Langley Castle','bride_thumb.jpg',130, 182,18,'																			photo_3462783.html');
												thumbnails[3462795] = new thumbnail(3462795,'129493','Langley Castle','test print 2 copy_thumb.jpg',130, 130,18,'																			photo_3462795.html');
												thumbnails[3462810] = new thumbnail(3462810,'129493','Groom and bestman relaxed out door Portrait','test print 8 copy copy_thumb.jpg',130, 130,18,'																			photo_3462810.html');
												thumbnails[3462820] = new thumbnail(3462820,'129493','Winter wedding Langley Castle','111c10x10 copy_thumb.jpg',130, 130,18,'																			photo_3462820.html');
												thumbnails[3462840] = new thumbnail(3462840,'129493','Winter Wedding Langley Castle',' copy1_thumb.jpg',130, 93,2,'																			photo_3462840.html');
												thumbnails[3462848] = new thumbnail(3462848,'129493','Autum wedding otterburn hall Northumberland','un6 copy_thumb.jpg',130, 115,18,'																			photo_3462848.html');
												thumbnails[3462853] = new thumbnail(3462853,'129493','capture the day as it happens','bw1 copy_thumb.jpg',130, 93,18,'																			photo_3462853.html');
												thumbnails[3493315] = new thumbnail(3493315,'213603','','Album A 0001_thumb.jpg',130, 130,18,'																			photo_3493315.html');
												thumbnails[3493322] = new thumbnail(3493322,'213603','','Album A 0002_thumb.jpg',130, 65,18,'																			photo_3493322.html');
												thumbnails[3493330] = new thumbnail(3493330,'213603','','Album A 0003_thumb.jpg',130, 65,18,'																			photo_3493330.html');
												thumbnails[3493332] = new thumbnail(3493332,'213603','','Album A 0004_thumb.jpg',130, 65,18,'																			photo_3493332.html');
												thumbnails[3493333] = new thumbnail(3493333,'213603','','Album A 0005_thumb.jpg',130, 65,18,'																			photo_3493333.html');
												thumbnails[3493338] = new thumbnail(3493338,'213603','','Album A 0006_thumb.jpg',130, 65,18,'																			photo_3493338.html');
												thumbnails[3493341] = new thumbnail(3493341,'213603','','Album A 0007_thumb.jpg',130, 65,18,'																			photo_3493341.html');
												thumbnails[3493343] = new thumbnail(3493343,'213603','','Album A 0008_thumb.jpg',130, 65,18,'																			photo_3493343.html');
												thumbnails[3493346] = new thumbnail(3493346,'213603','','Album A 0009_thumb.jpg',130, 65,18,'																			photo_3493346.html');
												thumbnails[3493348] = new thumbnail(3493348,'213603','','Album A 0010_thumb.jpg',130, 65,18,'																			photo_3493348.html');
												thumbnails[3493354] = new thumbnail(3493354,'213603','','Album A 0011_thumb.jpg',130, 65,18,'																			photo_3493354.html');
												thumbnails[3493362] = new thumbnail(3493362,'213603','','Album A 0012_thumb.jpg',130, 65,18,'																			photo_3493362.html');
												thumbnails[3493364] = new thumbnail(3493364,'213603','','Album A 0013_thumb.jpg',130, 65,18,'																			photo_3493364.html');
												thumbnails[3493432] = new thumbnail(3493432,'213603','','Album A 0015_thumb.jpg',130, 65,18,'																			photo_3493432.html');
												thumbnails[3493439] = new thumbnail(3493439,'213603','','Album A 0016_thumb.jpg',130, 65,18,'																			photo_3493439.html');
												thumbnails[3493442] = new thumbnail(3493442,'213603','','Album A 0017_thumb.jpg',130, 65,18,'																			photo_3493442.html');
												thumbnails[3493444] = new thumbnail(3493444,'213603','','Album A 0018_thumb.jpg',130, 65,18,'																			photo_3493444.html');
												thumbnails[3493448] = new thumbnail(3493448,'213603','','Album A 0019_thumb.jpg',130, 65,18,'																			photo_3493448.html');
												thumbnails[3493603] = new thumbnail(3493603,'129493','black and white reportage.','click pic_thumb.jpg',130, 98,18,'																			photo_3493603.html');
												thumbnails[3494391] = new thumbnail(3494391,'129493','Reportage style photography','disington hall 219 copy2_thumb.jpg',130, 87,18,'																			photo_3494391.html');
												thumbnails[3494753] = new thumbnail(3494753,'213603','Close up detail photographs','Item_0027_thumb.jpg',130, 130,18,'																			photo_3494753.html');
												thumbnails[3505642] = new thumbnail(3505642,'129493','Reportage Black and White','click pic2_thumb.jpg',130, 98,18,'																			photo_3505642.html');
												thumbnails[3540095] = new thumbnail(3540095,'129493','Black and white full lenght wedding portrait of the bride shot at Langley castle','click_pic31_thumb.jpg',130, 173,18,'																			photo_3540095.html');
												thumbnails[3540358] = new thumbnail(3540358,'129493','Civil ceremony at North Shields registry office','cick_pic1_thumb.jpg',130, 173,18,'																			photo_3540358.html');
												thumbnails[3540366] = new thumbnail(3540366,'129493','Sharon and Mark post wedding ceremony photography Northumberland park.','cp_thumb.jpg',130, 130,18,'																			photo_3540366.html');
												thumbnails[3545380] = new thumbnail(3545380,'129493','Wedding photography Langley Castle.','click_pic312_thumb.jpg',130, 130,18,'																			photo_3545380.html');
												thumbnails[3557526] = new thumbnail(3557526,'129493','Classic wedding photography','web_page_thumb.jpg',130, 98,18,'																			photo_3557526.html');
												thumbnails[3829955] = new thumbnail(3829955,'129493','Bride at Linden Hall','cl_pic_thumb.jpg',130, 182,18,'																			photo_3829955.html');
												thumbnails[3841561] = new thumbnail(3841561,'129493','Bride and Groom taken at Linden Hall','cl4_thumb.jpg',130, 228,18,'																			photo_3841561.html');
												thumbnails[3841616] = new thumbnail(3841616,'129493','Bride and Groom Linden Hall','ccc_thumb.jpg',130, 130,18,'																			photo_3841616.html');
												thumbnails[4825812] = new thumbnail(4825812,'275596','Album cover, Tradtional posed wedding portrait of the bride and groom with langley castle making the perfect back drop','Front_Cover_thumb.jpg',130, 210,18,'																			photo_4825812.html');
												thumbnails[4825880] = new thumbnail(4825880,'275596','My wedding photography usually starts with the bride and her parents before the wedding ceremoney','001_thumb.jpg',130, 98,18,'																			photo_4825880.html');
												thumbnails[4825888] = new thumbnail(4825888,'275596','After photographing the bride and parents its a quick dash  to catch the groom and the lads','003_thumb.jpg',130, 98,18,'																			photo_4825888.html');
												thumbnails[4825891] = new thumbnail(4825891,'275596','','005_thumb.jpg',130, 98,18,'																			photo_4825891.html');
												thumbnails[4825892] = new thumbnail(4825892,'275596','','007_thumb.jpg',130, 98,18,'																			photo_4825892.html');
												thumbnails[4825894] = new thumbnail(4825894,'275596','','009_thumb.jpg',130, 98,18,'																			photo_4825894.html');
												thumbnails[4825902] = new thumbnail(4825902,'275596','','011_thumb.jpg',130, 98,18,'																			photo_4825902.html');
												thumbnails[4825905] = new thumbnail(4825905,'275596','The bride and her brides maids photographed at langey castle,','013_thumb.jpg',130, 98,18,'																			photo_4825905.html');
												thumbnails[4825920] = new thumbnail(4825920,'275596','','015_thumb.jpg',130, 98,18,'																			photo_4825920.html');
												thumbnails[4825926] = new thumbnail(4825926,'275596','','017_thumb.jpg',130, 98,18,'																			photo_4825926.html');
												thumbnails[4825928] = new thumbnail(4825928,'275596','','019_thumb.jpg',130, 98,18,'																			photo_4825928.html');
												thumbnails[4825929] = new thumbnail(4825929,'275596','','021_thumb.jpg',130, 98,18,'																			photo_4825929.html');
												thumbnails[4825931] = new thumbnail(4825931,'275596','','023_thumb.jpg',130, 98,18,'																			photo_4825931.html');
												thumbnails[4826047] = new thumbnail(4826047,'275596','','027_thumb.jpg',130, 98,18,'																			photo_4826047.html');
												thumbnails[4826052] = new thumbnail(4826052,'275596','','0251_thumb.jpg',130, 98,18,'																			photo_4826052.html');
												thumbnails[4826056] = new thumbnail(4826056,'275596','','0291_thumb.jpg',130, 98,18,'																			photo_4826056.html');
												thumbnails[4826057] = new thumbnail(4826057,'275596','','0311_thumb.jpg',130, 98,18,'																			photo_4826057.html');
												thumbnails[4826070] = new thumbnail(4826070,'275596','The first dance','Back_Cover1_thumb.jpg',130, 210,18,'																			photo_4826070.html');
												thumbnails[4826159] = new thumbnail(4826159,'129493','The Bride and her sister ','DSCF1484_copy_copy1_thumb.jpg',130, 130,18,'																			photo_4826159.html');
												thumbnails[4826246] = new thumbnail(4826246,'129493','The bride and her bridesmaids langley castle','DSCF1472_copy1_thumb.jpg',130, 130,18,'																			photo_4826246.html');
												thumbnails[4826283] = new thumbnail(4826283,'129493',' langley castle  wedding photographs','center-1_thumb.JPG',130, 98,18,'																			photo_4826283.html');
												thumbnails[4829487] = new thumbnail(4829487,'129493','Tradtitional Wedding photography is by far better than snap shots','DSCF1499_copy_copy_thumb.jpg',130, 130,18,'																			photo_4829487.html');
												thumbnails[5263312] = new thumbnail(5263312,'129493','casual photo the couple chatting as they walked back to their reception.','DSC_3488_copy-11_thumb.jpg',130, 81,18,'																			photo_5263312.html');
												thumbnails[5268393] = new thumbnail(5268393,'129493','Wedding photography Whitley Bay Light House','wedding_photography_whitley_bay_light_house_thumb.jpg',130, 98,18,'																			photo_5268393.html');
												thumbnails[5268880] = new thumbnail(5268880,'129493','wedding photography whitley bay light house','weddiing_photo_whitley_bay_light_house_thumb.jpg',130, 130,18,'																			photo_5268880.html');
												thumbnails[5268918] = new thumbnail(5268918,'129493','Wedding photography Christ Church North Shields','photographer_north_shields_thumb.jpg',130, 104,18,'																			photo_5268918.html');
												thumbnails[4108632] = new thumbnail(4108632,'129493','Wedding photography North shields, Northumberland park.','wedding_photograher_north_shields_north_east_top_wedding_photograher_thumb.jpg',130, 130,18,'																			photo_4108632.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[275596] = new gallery(275596,'4826070,4826057,4826056,4826052,4826047,4825931,4825929,4825928,4825926,4825920','Langley castle storey book album','gallery',[4825812,4825880,4825888,4825891,4825892,4825894,4825902,4825905,4825920,4825926,4825928,4825929,4825931,4826047,4826052,4826056,4826057,4826070],0, 0, '', '																																																																																																							gallery_275596.html',0,0);
				  					galleries[129493] = new gallery(129493,'3494391',' Weddings','gallery',[6562638,1931014,1931253,1931296,1931313,1931341,1931345,1931348,1933524,1933534,1933536,1933718,1933843,1936906,1939673,1939681,1939684,1939685,1939710,1939741,1939761,2013202,2034392,2034606,2034695,2467638,2467640,3289184,3462443,3462783,3462795,3462810,3462820,3462840,3462848,3462853,3493603,3494391,3505642,3540095,3540358,3540366,3545380,3557526,3829955,3841561,3841616,4826159,4826246,4826283,4829487,5263312,5268393,5268880,5268918,4108632],0, 0, '', '																																																																																																							gallery_129493.html',0,0);
				  					galleries[213603] = new gallery(213603,'3494753,3493448,3493444,3493442,3493439,3493432,3493364,3493362,3493354,3493348','Contemporary wedding album.','gallery',[3493315,3493322,3493330,3493332,3493333,3493338,3493341,3493343,3493346,3493348,3493354,3493362,3493364,3493432,3493439,3493442,3493444,3493448,3494753],0, 0, '', '																																																																																																							gallery_213603.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '1933718,1933506';
imageSets[2] = '3494391';
imageSets[3] = '6562638,5268918,5268880,5268393,5263312,4829487,4826283,4826246,4826159,4826070,4826057,4826056,4826052,4826047,4825931,4825929,4825928,4825926,4825920,4825905,4825902,4825894,4825892,4825891,4825888,4825880,4825812,4108632,3841616,3841561,3829955,3584382,3557526,3545380,3540366,3540358,3540095,3505642,3494753,3494391,3493603,3493448,3493444,3493442,3493439,3493432,3493364,3493362,3493354,3493348';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/ericwilliamson/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/ericwilliamson/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/ericwilliamson/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/ericwilliamson/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/ericwilliamson/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/ericwilliamson/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/ericwilliamson/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/ericwilliamson/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/ericwilliamson/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/ericwilliamson/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/ericwilliamson/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/ericwilliamson/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/ericwilliamson/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/ericwilliamson/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/ericwilliamson/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/ericwilliamson/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/ericwilliamson/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/ericwilliamson/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/ericwilliamson/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/ericwilliamson/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/ericwilliamson/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/ericwilliamson/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));		}, 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 = 'ericwilliamson wedding 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));    }        
    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>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> 				&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="ericwilliamson@talktalk.net">';
	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="ericwilliamson@talktalk.net">';
	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;
	}
}

			

