window.thumbnails = new Object();
												thumbnails[4851971] = new thumbnail(4851971,'9118','Allium','Allium_thumb.jpg',130, 194,18,'photo_4851971.html');
												thumbnails[4856601] = new thumbnail(4856601,'267669','Image for dress designer','DSC_00202_thumb.jpg',130, 252,18,'photo_4856601.html');
												thumbnails[7334044] = new thumbnail(7334044,'62470','Family portrait taken at clients home','31_thumb.jpg',130, 87,18,'photo_7334044.html');
												thumbnails[7334094] = new thumbnail(7334094,'94225','Bride in doorway','22_bw1_thumb.jpg',130, 284,18,'photo_7334094.html');
												thumbnails[7334154] = new thumbnail(7334154,'190146','Corporate headshot for a firm\'s website','Rachael_A_thumb.jpg',130, 183,18,'photo_7334154.html');
												thumbnails[4852543] = new thumbnail(4852543,'9118','Darmera peltata','darmera_peltata_thumb.jpg',130, 194,18,'photo_4852543.html');
												thumbnails[4856661] = new thumbnail(4856661,'267669','Model with acer for designers portfolio','DSC_03422_thumb.jpg',130, 194,18,'photo_4856661.html');
												thumbnails[7334047] = new thumbnail(7334047,'62470','Photograph of mother and son taken at home','06_thumb.jpg',130, 87,18,'photo_7334047.html');
												thumbnails[7334098] = new thumbnail(7334098,'94225','Wedding guest with background converted to black and white','27_thumb.jpg',130, 191,18,'photo_7334098.html');
												thumbnails[7334112] = new thumbnail(7334112,'190146','View back to building plot to be used for marketing literature','from_below_3_thumb.jpg',130, 194,18,'photo_7334112.html');
												thumbnails[4852544] = new thumbnail(4852544,'9118','Deep Pink Tulip','deep_pink_tulip_thumb.jpg',130, 194,18,'photo_4852544.html');
												thumbnails[4856662] = new thumbnail(4856662,'267669','Fashion model photographed for a portfolio','DSC_03682_thumb.jpg',130, 194,18,'photo_4856662.html');
												thumbnails[7334055] = new thumbnail(7334055,'94225','Wedding kiss - a photograph taken from over the shoulders of the wedding guests','18_thumb.jpg',130, 87,18,'photo_7334055.html');
												thumbnails[7334060] = new thumbnail(7334060,'62470','Photograph of two sisters on a white backdrop','26_thumb.jpg',130, 87,18,'photo_7334060.html');
												thumbnails[7334095] = new thumbnail(7334095,'190146','Livestock on organic farm for farm website','26_11_thumb.jpg',130, 194,18,'photo_7334095.html');
												thumbnails[4852546] = new thumbnail(4852546,'9118','Deep pink Geranium','DeepPinkGeranium_thumb.jpg',130, 194,18,'photo_4852546.html');
												thumbnails[4856663] = new thumbnail(4856663,'267669','Photograph used for a fashion designers portfolio','DSC_03763_thumb.jpg',130, 194,18,'photo_4856663.html');
												thumbnails[4856686] = new thumbnail(4856686,'190146','On location portrait of a civil engineer for her website','boring1_thumb.jpg',130, 177,18,'photo_4856686.html');
												thumbnails[7334057] = new thumbnail(7334057,'94225','A photograph of a wedding guest with the background converted to monochrome','26_1_thumb.jpg',130, 87,18,'photo_7334057.html');
												thumbnails[7334073] = new thumbnail(7334073,'62470','A comical moment during a portrait session as the client\'s hammock collapses','76_thumb.jpg',130, 95,18,'photo_7334073.html');
												thumbnails[4852535] = new thumbnail(4852535,'9118','Blue Cornflower','centaurea_montana_thumb.jpg',130, 194,18,'photo_4852535.html');
												thumbnails[4856660] = new thumbnail(4856660,'267669','Image for designers portfolio','DSC_03152_thumb.jpg',130, 236,18,'photo_4856660.html');
												thumbnails[4856694] = new thumbnail(4856694,'190146','Building interiors for a civil engineering website','chandeliers21_thumb.jpg',130, 254,18,'photo_4856694.html');
												thumbnails[7334065] = new thumbnail(7334065,'94225','The bride chatting to guests at her wedding','50bw_thumb.jpg',130, 87,18,'photo_7334065.html');
												thumbnails[7334069] = new thumbnail(7334069,'62470','Portrait of a girl on a trampoline','59_1_thumb.jpg',130, 87,18,'photo_7334069.html');
												thumbnails[4851997] = new thumbnail(4851997,'9118','Angelica head','Angelica_thumb.jpg',130, 87,18,'photo_4851997.html');
												thumbnails[4856670] = new thumbnail(4856670,'267669','Image used for a fashion portfolio','DSC_03852_thumb.jpg',130, 194,18,'photo_4856670.html');
												thumbnails[7334077] = new thumbnail(7334077,'190146','Panoramic view from building plot for marketing literature','looking_out_3_thumb.jpg',130, 87,18,'photo_7334077.html');
												thumbnails[7334101] = new thumbnail(7334101,'94225','The bride enjoying the wedding reception','45_thumb.jpg',130, 137,18,'photo_7334101.html');
												thumbnails[7334103] = new thumbnail(7334103,'62470','Portrait image taken at a clients home','71_BW_thumb.jpg',130, 194,18,'photo_7334103.html');
												thumbnails[4852521] = new thumbnail(4852521,'9118','Cardoon Seed Head','cardoon_thumb.jpg',130, 86,18,'photo_4852521.html');
												thumbnails[4856654] = new thumbnail(4856654,'267669','Photograph of a model for a designer','DSC_01592_thumb.jpg',130, 194,18,'photo_4856654.html');
												thumbnails[4856699] = new thumbnail(4856699,'62470','Young girl taken at a pre-school photo shoot','ellen_21_thumb.jpg',130, 163,18,'photo_4856699.html');
												thumbnails[4856706] = new thumbnail(4856706,'190146','Photograph of site works for a civil engineer','richmond_lane_landscape1_thumb.jpg',130, 87,18,'photo_4856706.html');
												thumbnails[4856714] = new thumbnail(4856714,'94225','The bride and groom chatting to guests','Sara_and_Tom_os_church_41_thumb.jpg',130, 129,18,'photo_4856714.html');
												thumbnails[4852533] = new thumbnail(4852533,'9118','Cornflower','Centaurea2_thumb.jpg',130, 86,18,'photo_4852533.html');
												thumbnails[4856653] = new thumbnail(4856653,'267669','Image for a portfolio','DSC_01462_thumb.jpg',130, 143,18,'photo_4856653.html');
												thumbnails[4856744] = new thumbnail(4856744,'62470','Photograph of a young girl on location','Sep_05_09211_thumb.jpg',130, 145,18,'photo_4856744.html');
												thumbnails[4856746] = new thumbnail(4856746,'94225','The groom outside the church','Tom_os_church1_thumb.jpg',130, 119,18,'photo_4856746.html');
												thumbnails[7334050] = new thumbnail(7334050,'190146','Livestock on organic farm used for company website','14_thumb.jpg',130, 79,18,'photo_7334050.html');
												thumbnails[4852542] = new thumbnail(4852542,'9118','Clematis','clematis_thumb.jpg',130, 86,18,'photo_4852542.html');
												thumbnails[4856655] = new thumbnail(4856655,'267669','Detailed photograph for a designer','DSC_01752_thumb.jpg',130, 194,18,'photo_4856655.html');
												thumbnails[4856703] = new thumbnail(4856703,'62470','Image of child on location','olivia1_thumb.jpg',130, 163,18,'photo_4856703.html');
												thumbnails[4856710] = new thumbnail(4856710,'94225','Photograph of the bride and her father arriving at the church','sara_and_dad_car_31_thumb.jpg',130, 73,18,'photo_4856710.html');
												thumbnails[4852632] = new thumbnail(4852632,'9118','Epimedium x rubrum','epimedium_x_rubrum_thumb.jpg',130, 87,18,'photo_4852632.html');
												thumbnails[4856652] = new thumbnail(4856652,'267669','Photograph of a model contrasting with the gate','DSC_00832_thumb.jpg',130, 230,18,'photo_4856652.html');
												thumbnails[4856689] = new thumbnail(4856689,'94225','The bridal party arrive at the church','bridal_party_31_thumb.jpg',130, 229,18,'photo_4856689.html');
												thumbnails[7334105] = new thumbnail(7334105,'62470','Portrait taken on location at clients home','113_BW_thumb.jpg',130, 194,18,'photo_7334105.html');
												thumbnails[4852547] = new thumbnail(4852547,'9118','Dryopteris and Allium ursinum','Dryopteris__Allium_ursinum_thumb.jpg',130, 194,18,'photo_4852547.html');
												thumbnails[4856657] = new thumbnail(4856657,'267669','Detailed photo for a designer','DSC_01922_thumb.jpg',130, 87,18,'photo_4856657.html');
												thumbnails[4856687] = new thumbnail(4856687,'62470','Siblings enjoying a photo shoot','bric061_thumb.jpg',130, 163,18,'photo_4856687.html');
												thumbnails[4856712] = new thumbnail(4856712,'94225','A traditional wedding photograph of the bride and groom','Sara_and_Tom_Doorway_11_thumb.jpg',130, 195,18,'photo_4856712.html');
												thumbnails[4852608] = new thumbnail(4852608,'9118','Echinacea','echinacea_thumb.jpg',130, 196,18,'photo_4852608.html');
												thumbnails[4856671] = new thumbnail(4856671,'267669','Photograph of a model on grand staircase','DSC_04202_thumb.jpg',130, 194,18,'photo_4856671.html');
												thumbnails[4856688] = new thumbnail(4856688,'62470','Photograph from a pre-school photo session','bric20_bw1_thumb.jpg',130, 104,18,'photo_4856688.html');
												thumbnails[4856693] = new thumbnail(4856693,'94225','The bride and groom have a champagne moment','Champagne_41_thumb.jpg',130, 162,18,'photo_4856693.html');
												thumbnails[4852623] = new thumbnail(4852623,'9118','Poppy flower emerging','EmergingPoppy_thumb.jpg',130, 194,18,'photo_4852623.html');
												thumbnails[4856673] = new thumbnail(4856673,'267669','Striking model photographed in a windowsill','DSC_04402_thumb.jpg',130, 194,18,'photo_4856673.html');
												thumbnails[4856708] = new thumbnail(4856708,'62470','Photograph of a young virtuoso taken at client\'s home','sahana_violin311_thumb.jpg',130, 197,18,'photo_4856708.html');
												thumbnails[4856717] = new thumbnail(4856717,'94225','the bride and groom leave the church','Sara_and_Tom_os_church_61_thumb.jpg',130, 87,18,'photo_4856717.html');
												thumbnails[4852637] = new thumbnail(4852637,'9118','Euphorbia characias subsp. Wulfenii','Euphorbia_characias_subsp_wulfeniijpg1_thumb.jpg',130, 195,18,'photo_4852637.html');
												thumbnails[4856675] = new thumbnail(4856675,'267669','Photograph of a thoughtful model lit by the window','DSC_04462_thumb.jpg',130, 194,18,'photo_4856675.html');
												thumbnails[4856692] = new thumbnail(4856692,'94225','Bride and groom photographed as the cork flies off','Champagne_21_thumb.jpg',130, 87,18,'photo_4856692.html');
												thumbnails[4856700] = new thumbnail(4856700,'62470','Mother and baby portrait','erin_bw_31_thumb.jpg',130, 104,18,'photo_4856700.html');
												thumbnails[4852638] = new thumbnail(4852638,'9118','Hellebore','hellebore_1_thumb.jpg',130, 194,18,'photo_4852638.html');
												thumbnails[4856672] = new thumbnail(4856672,'267669','Photograph of a model walking towards the camera','DSC_04312_thumb.jpg',130, 274,18,'photo_4856672.html');
												thumbnails[4856705] = new thumbnail(4856705,'94225','Photograph of the bride in the receiving line','Receiving_line_31_thumb.jpg',130, 148,18,'photo_4856705.html');
												thumbnails[7334100] = new thumbnail(7334100,'62470','Young girl photographed playing with bubbles at home','43_thumb.jpg',130, 194,18,'photo_7334100.html');
												thumbnails[4852807] = new thumbnail(4852807,'9118','Emerging poppy flower','OpeningPoppyHeadOverhead_thumb.jpg',130, 87,18,'photo_4852807.html');
												thumbnails[4856659] = new thumbnail(4856659,'267669','Fashion model photographed in doorway of bothy','DSC_02742_thumb.jpg',130, 241,18,'photo_4856659.html');
												thumbnails[4856690] = new thumbnail(4856690,'94225','The bridal party on the way to the reception','Bridal_party_91_thumb.jpg',130, 60,18,'photo_4856690.html');
												thumbnails[7334102] = new thumbnail(7334102,'62470','Portrait taken at client\'s home','69_thumb.jpg',130, 185,18,'photo_7334102.html');
												thumbnails[4852811] = new thumbnail(4852811,'9118','Pennisetum heads in the wind','Pennisetum_thumb.jpg',130, 86,18,'photo_4852811.html');
												thumbnails[4856658] = new thumbnail(4856658,'267669','Fashion model photographed in doorway ','DSC_02592_thumb.jpg',130, 196,18,'photo_4856658.html');
												thumbnails[7334064] = new thumbnail(7334064,'62470','Siblings photographed with their clarinet and saxophone','41_thumb.jpg',130, 87,18,'photo_7334064.html');
												thumbnails[4852810] = new thumbnail(4852810,'9118','Orange tulip','orange__yellow_tulip_thumb.jpg',130, 87,18,'photo_4852810.html');
												thumbnails[7334066] = new thumbnail(7334066,'62470','Photo of parents with baby','51_thumb.jpg',130, 75,18,'photo_7334066.html');
												thumbnails[4852829] = new thumbnail(4852829,'9118','Cream rose centre','PICT0022-01_thumb.jpg',130, 87,18,'photo_4852829.html');
												thumbnails[7334072] = new thumbnail(7334072,'62470','Photo of young girl at home','63_thumb.jpg',130, 104,18,'photo_7334072.html');
												thumbnails[4852832] = new thumbnail(4852832,'9118','Vivid Pink Dahlia','PICT0029-01_thumb.jpg',130, 87,18,'photo_4852832.html');
												thumbnails[7334104] = new thumbnail(7334104,'62470','Photo of child playing at home','71_thumb.jpg',130, 194,18,'photo_7334104.html');
												thumbnails[4852661] = new thumbnail(4852661,'9118','Hemerocallis','hemerocalis_thumb.jpg',130, 194,18,'photo_4852661.html');
												thumbnails[7334096] = new thumbnail(7334096,'62470','Family portrait taken at home','261_thumb.jpg',130, 139,18,'photo_7334096.html');
												thumbnails[4852697] = new thumbnail(4852697,'9118','Iris','Iris_thumb.jpg',130, 194,18,'photo_4852697.html');
												thumbnails[7334071] = new thumbnail(7334071,'62470','Image of father and son bonding','59_thumb.jpg',130, 104,18,'photo_7334071.html');
												thumbnails[4852788] = new thumbnail(4852788,'9118','Deep pink and white tulip','maroon_white_tulip_thumb.jpg',130, 194,18,'photo_4852788.html');
												thumbnails[4852819] = new thumbnail(4852819,'9118','Orange & Yellow Dahlia I','PICT0017-01_thumb.jpg',130, 195,18,'photo_4852819.html');
												thumbnails[4852826] = new thumbnail(4852826,'9118','Orange & Yellow Dahlia II','PICT0019-01_thumb.jpg',130, 195,18,'photo_4852826.html');
												thumbnails[4852644] = new thumbnail(4852644,'9118','Helleborus foetidus','helleborus_foetidus2_thumb.jpg',130, 156,18,'photo_4852644.html');
												thumbnails[4852859] = new thumbnail(4852859,'9118','Oriental Poppy','RedPoppies_thumb.jpg',130, 87,18,'photo_4852859.html');
												thumbnails[4852903] = new thumbnail(4852903,'9118','Sedum head with raindrops','sedum_raindrops_thumb.jpg',130, 87,18,'photo_4852903.html');
												thumbnails[7334076] = new thumbnail(7334076,'9118','Dandelion heads','Dandelions_thumb.jpg',130, 87,18,'photo_7334076.html');
												thumbnails[7334078] = new thumbnail(7334078,'9118','Thalictrum','Thalictrum_thumb.jpg',130, 87,18,'photo_7334078.html');
												thumbnails[4852837] = new thumbnail(4852837,'9118','Plum tulips','pink_tulips_thumb.jpg',130, 194,18,'photo_4852837.html');
												thumbnails[4852846] = new thumbnail(4852846,'9118','Pink rose bud','PinkRoseBud_thumb.jpg',130, 194,18,'photo_4852846.html');
												thumbnails[4852848] = new thumbnail(4852848,'9118','Primula vialli','PrimulaVialli_thumb.jpg',130, 194,18,'photo_4852848.html');
												thumbnails[4852912] = new thumbnail(4852912,'9118','Anemone \'Honorine joubert\'','Sep_05_166_thumb.jpg',130, 196,18,'photo_4852912.html');
												thumbnails[4852777] = new thumbnail(4852777,'9118','Lilium Stargazer','Lilium_Stargazer_centrejpg_thumb.jpg',130, 146,18,'photo_4852777.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[94225] = new gallery(94225,'7334098','Weddings','gallery',[7334094,7334098,7334055,7334057,7334065,7334101,4856714,4856746,4856710,4856689,4856712,4856693,4856717,4856692,4856705,4856690],0, 0, '', 'gallery_94225.html',0,0);
				  					galleries[267669] = new gallery(267669,'4856670','Portraits - Fashion','gallery',[4856601,4856661,4856662,4856663,4856660,4856670,4856654,4856653,4856655,4856652,4856657,4856671,4856673,4856675,4856672,4856659,4856658],0, 0, '', 'gallery_267669.html',0,0);
				  					galleries[62470] = new gallery(62470,'7334096','Portraits - Families','gallery',[7334044,7334047,7334060,7334073,7334069,7334103,4856699,4856744,4856703,7334105,4856687,4856688,4856708,4856700,7334100,7334102,7334064,7334066,7334072,7334104,7334096,7334071],0, 0, '', 'gallery_62470.html',0,0);
				  					galleries[9118] = new gallery(9118,'4851971','Flowers','gallery',[4851971,4852543,4852544,4852546,4852535,4851997,4852521,4852533,4852542,4852632,4852547,4852608,4852623,4852637,4852638,4852807,4852811,4852810,4852829,4852832,4852661,4852697,4852788,4852819,4852826,4852644,4852859,4852903,7334076,7334078,4852837,4852846,4852848,4852912,4852777],0, 0, '', 'gallery_9118.html',0,0);
				  					galleries[190146] = new gallery(190146,'7334154','Commercial','gallery',[7334154,7334112,7334095,4856686,4856694,7334077,4856706,7334050],0, 0, '', 'gallery_190146.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[239062] = '7334103,7334066,4856663';
imageSets[239061] = '7334101,7334098,7334065,7334055';
imageSets[1] = '7334101,7334095,7334065,7334064,7334055,4856714,4856688,4856675,4856663';
imageSets[2] = '7334154,7334098,7334096,4856670,4851971';
imageSets[3] = '7334154';
imageSets[239053] = '7334154,7334096';
imageSets[239063] = '7334154,7334095';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/steveb/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/steveb/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/steveb/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/steveb/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/steveb/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/steveb/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/steveb/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/steveb/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/steveb/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/steveb/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/steveb/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/steveb/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/steveb/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/steveb/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/steveb/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/steveb/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/steveb/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/steveb/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/steveb/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/steveb/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/steveb/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/steveb/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 = 'Wedding,Portrait & Commercial Photography in Bath: ' + photoCaption;
			    }
        if (op.$detail.length > 0) {
      temp = op.nextPhoto.fnGetImageDetails();
	    op.$detail.fadeGalleryDetails(temp, op.speed, function(){
	    var options = {};	    	      	      resizePhotoInfo(options);
        if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
  	      toggleAddToCartConfirm(backgrounds);
  	    } else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
  	      toggleAddToCartConfirm(photos);
  	    }
	    });
    }
        if (!op.speed) {      clik.doColumnResize(false, op.$photo.add(op.$detail).add(op.$title));      $('body').trigger('clikUpdate');    }        
    return html;			}
	else {
				
		window.location = 'photo_' + nextPhoto.id + '.html';
	}
		
}

/***************************************************************************
* Toggle add to cart confirmation element and set up the click event for   *
* the 'Add to cart' button.                                                *
***************************************************************************/
function toggleAddToCartConfirm(array){
  if (typeof(array) !== 'object') {
    array = photos;
  }
	if($('#paymentConfirm').length > 0){
		$('#paymentConfirm').hide();
		$('#paymentAddButton')
		.unbind()
		.click(function(){
						form = document.getElementById('paymentForm');
			option_id = 0;
			if(form.item_option.value){
				option_id = form.item_option.value;
			}
			if(addItemToBasket(form.item_number.value,array,form.site.value,parseInt(form.quantity.value, 10),option_id)){
				if($.browser.msie){$('#paymentConfirm').text('Item added to cart').show();}
				else{
					$('#paymentConfirm').text('Item added to cart').fadeIn();
					dspOrderDetails(form.site.value);
				}
			}
			else{
				$('#paymentConfirm').text('Item not added - check cookies are enabled in your browser.').fadeIn();
			}
		});
	}
}
/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
photo.prototype.fnGetImageDetails = function(){
	var temp = '';
	if (this.description != '') {
		temp = temp +  '<p id="imageDescription">' + this.description + '</p>';
	}
		if (this.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="sjbphotos@btinternet.com">';
	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="sjbphotos@btinternet.com">';
	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;
	}
}

			

