window.thumbnails = {};
															thumbnails[69951] = clik.newPhoto({"id":69951,"src":"Shannon_0154_thumb.jpg","galleries_id":54721,"server_id":18,"link":"photo_69951.html","width":130,"caption":"","height":195});
															thumbnails[69952] = clik.newPhoto({"id":69952,"src":"Shannon_0159_thumb.jpg","galleries_id":54721,"server_id":18,"link":"photo_69952.html","width":130,"caption":"","height":195});
															thumbnails[69954] = clik.newPhoto({"id":69954,"src":"Shannon_0179_thumb.jpg","galleries_id":54721,"server_id":18,"link":"photo_69954.html","width":130,"caption":"","height":195});
															thumbnails[69955] = clik.newPhoto({"id":69955,"src":"Shannon_0189_thumb.jpg","galleries_id":54721,"server_id":18,"link":"photo_69955.html","width":130,"caption":"","height":195});
															thumbnails[4071] = clik.newPhoto({"id":4071,"src":"IMG_0108JPG_thumb.jpg","galleries_id":788,"server_id":18,"link":"photo_4071.html","width":130,"caption":"Clothes Show Live","height":195});
															thumbnails[4073] = clik.newPhoto({"id":4073,"src":"IMG_0130JPG_thumb.jpg","galleries_id":788,"server_id":18,"link":"photo_4073.html","width":130,"caption":"Clothes Show Live","height":195});
															thumbnails[4074] = clik.newPhoto({"id":4074,"src":"IMG_0137JPG_thumb.jpg","galleries_id":788,"server_id":18,"link":"photo_4074.html","width":130,"caption":"Clothes Show Live","height":195});
															thumbnails[4075] = clik.newPhoto({"id":4075,"src":"IMG_0157JPG_thumb.jpg","galleries_id":788,"server_id":18,"link":"photo_4075.html","width":130,"caption":"Clothes Show Live","height":195});
															thumbnails[4083] = clik.newPhoto({"id":4083,"src":"2003_0920Image0001JPG_thumb.jpg","galleries_id":787,"server_id":18,"link":"photo_4083.html","width":130,"caption":"","height":173});
															thumbnails[4297] = clik.newPhoto({"id":4297,"src":"IMG_0116JPG_thumb.jpg","galleries_id":788,"server_id":18,"link":"photo_4297.html","width":130,"caption":"Clothes Show Live","height":195});
															thumbnails[4299] = clik.newPhoto({"id":4299,"src":"IMG_0117JPG_thumb.jpg","galleries_id":788,"server_id":18,"link":"photo_4299.html","width":130,"caption":"Clothes Show Live","height":195});
															thumbnails[4301] = clik.newPhoto({"id":4301,"src":"IMG_0141JPG_thumb.jpg","galleries_id":788,"server_id":18,"link":"photo_4301.html","width":130,"caption":"Clothes Show Live","height":195});
															thumbnails[4303] = clik.newPhoto({"id":4303,"src":"IMG_0143JPG_thumb.jpg","galleries_id":788,"server_id":18,"link":"photo_4303.html","width":130,"caption":"Clothes Show Live","height":195});
															thumbnails[4304] = clik.newPhoto({"id":4304,"src":"IMG_0161JPG_thumb.jpg","galleries_id":787,"server_id":18,"link":"photo_4304.html","width":130,"caption":"","height":179});
															thumbnails[4308] = clik.newPhoto({"id":4308,"src":"IMG_0170JPG_thumb.jpg","galleries_id":788,"server_id":18,"link":"photo_4308.html","width":130,"caption":"H&M Spring Collection 2005","height":165});
															thumbnails[4309] = clik.newPhoto({"id":4309,"src":"IMG_0171JPG_thumb.jpg","galleries_id":788,"server_id":18,"link":"photo_4309.html","width":130,"caption":"H&M Spring Collection 2005","height":195});
															thumbnails[712230] = clik.newPhoto({"id":712230,"src":"W0045_thumb.jpg","galleries_id":54721,"server_id":18,"link":"photo_712230.html","width":130,"caption":"","height":195});
															thumbnails[712260] = clik.newPhoto({"id":712260,"src":"W0071_thumb.jpg","galleries_id":54721,"server_id":18,"link":"photo_712260.html","width":130,"caption":"","height":195});
															thumbnails[712262] = clik.newPhoto({"id":712262,"src":"W0098_thumb.jpg","galleries_id":54721,"server_id":18,"link":"photo_712262.html","width":130,"caption":"","height":195});
															thumbnails[712264] = clik.newPhoto({"id":712264,"src":"W0168_thumb.jpg","galleries_id":54721,"server_id":18,"link":"photo_712264.html","width":130,"caption":"","height":195});
															thumbnails[712266] = clik.newPhoto({"id":712266,"src":"W0188_thumb.jpg","galleries_id":54721,"server_id":18,"link":"photo_712266.html","width":130,"caption":"","height":83});
															thumbnails[712295] = clik.newPhoto({"id":712295,"src":"W1010_thumb.jpg","galleries_id":787,"server_id":18,"link":"photo_712295.html","width":130,"caption":"","height":195});
															thumbnails[712298] = clik.newPhoto({"id":712298,"src":"W1006_thumb.jpg","galleries_id":787,"server_id":18,"link":"photo_712298.html","width":130,"caption":"","height":174});
															thumbnails[712301] = clik.newPhoto({"id":712301,"src":"W1004_thumb.jpg","galleries_id":787,"server_id":18,"link":"photo_712301.html","width":130,"caption":"","height":179});
															thumbnails[1004415] = clik.newPhoto({"id":1004415,"src":"IMG_0172-Edit_cnv_400x6002_thumb.jpg","galleries_id":780,"server_id":18,"link":"photo_1004415.html","width":130,"caption":"Kerry & Daniel","height":195});
															thumbnails[1004418] = clik.newPhoto({"id":1004418,"src":"IMG_0175-Edit_cnv_400x6001_thumb.jpg","galleries_id":780,"server_id":18,"link":"photo_1004418.html","width":130,"caption":"Kerry & Daniel","height":195});
															thumbnails[1004421] = clik.newPhoto({"id":1004421,"src":"IMG_0187-Edit_cnv_400x6001_thumb.jpg","galleries_id":780,"server_id":18,"link":"photo_1004421.html","width":130,"caption":"Kerry & Daniel","height":195});
															thumbnails[1004424] = clik.newPhoto({"id":1004424,"src":"IMG_0192-Edit_cnv_400x6001_thumb.jpg","galleries_id":780,"server_id":18,"link":"photo_1004424.html","width":130,"caption":"Kerry & Daniel","height":195});
															thumbnails[1004426] = clik.newPhoto({"id":1004426,"src":"IMG_0202-Edit_cnv_400x6001_thumb.jpg","galleries_id":780,"server_id":18,"link":"photo_1004426.html","width":130,"caption":"Kerry & Daniel","height":195});
															thumbnails[1004429] = clik.newPhoto({"id":1004429,"src":"IMG_0209-Edit_cnv_400x6002_thumb.jpg","galleries_id":780,"server_id":18,"link":"photo_1004429.html","width":130,"caption":"Kerry","height":195});
															thumbnails[1004430] = clik.newPhoto({"id":1004430,"src":"IMG_0223-Edit_cnv_400x6001_thumb.jpg","galleries_id":780,"server_id":18,"link":"photo_1004430.html","width":130,"caption":"Kerry & Daniel","height":195});
															thumbnails[1008559] = clik.newPhoto({"id":1008559,"src":"Button_-1_cnv_400x600_thumb.jpg","galleries_id":780,"server_id":18,"link":"photo_1008559.html","width":130,"caption":"Tara & Martin","height":195});
															thumbnails[1008562] = clik.newPhoto({"id":1008562,"src":"Button_-2_cnv_400x600_thumb.jpg","galleries_id":780,"server_id":18,"link":"photo_1008562.html","width":130,"caption":"Tara & Martin","height":195});
															thumbnails[1008571] = clik.newPhoto({"id":1008571,"src":"Button_-4_cnv_400x600_thumb.jpg","galleries_id":780,"server_id":18,"link":"photo_1008571.html","width":130,"caption":"Tara & Martin","height":195});
															thumbnails[1008575] = clik.newPhoto({"id":1008575,"src":"Button_-5_cnv_400x600_thumb.jpg","galleries_id":780,"server_id":18,"link":"photo_1008575.html","width":130,"caption":"Tara & Martin","height":195});
															thumbnails[6725] = clik.newPhoto({"id":6725,"src":"Transport0010 copyJPG_thumb.jpg","galleries_id":1048,"server_id":18,"link":"photo_6725.html","width":130,"caption":"Honda","height":86});
															thumbnails[4085] = clik.newPhoto({"id":4085,"src":"IMG_0057JPG_thumb.jpg","galleries_id":790,"server_id":18,"link":"photo_4085.html","width":130,"caption":"St Fagans (1)","height":195});
															thumbnails[70200] = clik.newPhoto({"id":70200,"src":"Mark_260305_IMG_0321_thumb.JPG","galleries_id":780,"server_id":18,"link":"photo_70200.html","width":130,"caption":"Mark & Anne","height":195});
															thumbnails[6730] = clik.newPhoto({"id":6730,"src":"IMG_0032JPG1_thumb.jpg","galleries_id":1048,"server_id":18,"link":"photo_6730.html","width":130,"caption":"Fishing Boat","height":87});
															thumbnails[6726] = clik.newPhoto({"id":6726,"src":"Transport0014 copyJPG_thumb.jpg","galleries_id":1048,"server_id":18,"link":"photo_6726.html","width":130,"caption":"London Boat Show 2005","height":87});
															thumbnails[4088] = clik.newPhoto({"id":4088,"src":"IMG_0053JPG_thumb.jpg","galleries_id":790,"server_id":18,"link":"photo_4088.html","width":130,"caption":"St Fagans (2)","height":195});
															thumbnails[70202] = clik.newPhoto({"id":70202,"src":"Mark_260305_IMG_0322_thumb.JPG","galleries_id":780,"server_id":18,"link":"photo_70202.html","width":130,"caption":"Mark & Anne","height":195});
															thumbnails[6722] = clik.newPhoto({"id":6722,"src":"LandSeascape0004 copyJPG_thumb.jpg","galleries_id":790,"server_id":18,"link":"photo_6722.html","width":130,"caption":"London Docklands Wharf","height":195});
															thumbnails[6729] = clik.newPhoto({"id":6729,"src":"Transport0021 copyJPG_thumb.jpg","galleries_id":1048,"server_id":18,"link":"photo_6729.html","width":130,"caption":"London Boat Show 2005","height":85});
															thumbnails[70203] = clik.newPhoto({"id":70203,"src":"IMG_0138_thumb.JPG","galleries_id":780,"server_id":18,"link":"photo_70203.html","width":130,"caption":"Claire & Barrie","height":195});
															thumbnails[6719] = clik.newPhoto({"id":6719,"src":"LandSeascape0001 copyJPG_thumb.jpg","galleries_id":790,"server_id":18,"link":"photo_6719.html","width":130,"caption":"London Docklands Crane","height":195});
															thumbnails[6721] = clik.newPhoto({"id":6721,"src":"Transport0003 copyJPG_thumb.jpg","galleries_id":1048,"server_id":18,"link":"photo_6721.html","width":130,"caption":"London Boat Show 2005","height":87});
															thumbnails[70205] = clik.newPhoto({"id":70205,"src":"IMG_0209_thumb.JPG","galleries_id":780,"server_id":18,"link":"photo_70205.html","width":130,"caption":"Claire & Barrie","height":195});
															thumbnails[6720] = clik.newPhoto({"id":6720,"src":"LandSeascape0002 copyJPG_thumb.jpg","galleries_id":790,"server_id":18,"link":"photo_6720.html","width":130,"caption":"London Docklands","height":87});
															thumbnails[69961] = clik.newPhoto({"id":69961,"src":"Landscape_0028_thumb.JPG","galleries_id":790,"server_id":18,"link":"photo_69961.html","width":130,"caption":"Post Office - St Fagans","height":87});
															thumbnails[6727] = clik.newPhoto({"id":6727,"src":"Transport0017 copyJPG_thumb.jpg","galleries_id":1048,"server_id":18,"link":"photo_6727.html","width":130,"caption":"Steam Tugs London Docklands","height":87});
															thumbnails[69956] = clik.newPhoto({"id":69956,"src":"Bridge_0005_thumb.JPG","galleries_id":790,"server_id":18,"link":"photo_69956.html","width":130,"caption":"Transporter Bridge - Newport","height":87});
															thumbnails[69957] = clik.newPhoto({"id":69957,"src":"Landscape_0010_thumb.JPG","galleries_id":790,"server_id":18,"link":"photo_69957.html","width":130,"caption":"Rape Seed Field","height":87});
															thumbnails[69958] = clik.newPhoto({"id":69958,"src":"Landscape_0016_thumb.JPG","galleries_id":790,"server_id":18,"link":"photo_69958.html","width":130,"caption":"Penarth Pier","height":87});
															thumbnails[6728] = clik.newPhoto({"id":6728,"src":"Transport0020 copyJPG_thumb.jpg","galleries_id":1048,"server_id":18,"link":"photo_6728.html","width":130,"caption":"HMS Sutherland London","height":82});
															thumbnails[6724] = clik.newPhoto({"id":6724,"src":"Transport0008 copyJPG_thumb.jpg","galleries_id":1048,"server_id":18,"link":"photo_6724.html","width":130,"caption":"London Boat Show 2005","height":196});
															thumbnails[69986] = clik.newPhoto({"id":69986,"src":"Balloons_00061_thumb.jpg","galleries_id":1048,"server_id":18,"link":"photo_69986.html","width":130,"caption":"Hot Air Balloon - Blackwood","height":195});
															thumbnails[69987] = clik.newPhoto({"id":69987,"src":"Balloons_0016_thumb.jpg","galleries_id":1048,"server_id":18,"link":"photo_69987.html","width":130,"caption":"Hot Air Balloon - Blackwood","height":195});
															thumbnails[69949] = clik.newPhoto({"id":69949,"src":"Balloons_0002_thumb.JPG","galleries_id":1048,"server_id":18,"link":"photo_69949.html","width":130,"caption":"Hot Air Balloon - Blackwood","height":87});
															thumbnails[4307] = clik.newPhoto({"id":4307,"src":"IMG_0168JPG_thumb.jpg","galleries_id":788,"server_id":18,"link":"photo_4307.html","width":130,"caption":"H&M Spring Collection 2005","height":254});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[788] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Fashion","link":"gallery_788.html","maxRecords":0.0,"photoIDs":[4071.0,4073.0,4074.0,4075.0,4297.0,4299.0,4301.0,4303.0,4308.0,4309.0,4307.0],"skipIndex":0,"section_code":"gallery","featured_images":"4301,4074","id":788,"singleSection":false});				  						galleries[780] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Wedding","link":"gallery_780.html","maxRecords":0.0,"photoIDs":[1004415.0,1004418.0,1004421.0,1004424.0,1004426.0,1004429.0,1004430.0,1008559.0,1008562.0,1008571.0,1008575.0,70200.0,70202.0,70203.0,70205.0],"skipIndex":0,"section_code":"gallery","featured_images":1004415.0,"id":780,"singleSection":false});				  						galleries[787] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Portraits","link":"gallery_787.html","maxRecords":0.0,"photoIDs":[4083.0,4304.0,712295.0,712298.0,712301.0],"skipIndex":0,"section_code":"gallery","featured_images":"712298,4304","id":787,"singleSection":false});				  						galleries[54721] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Nurseries","link":"gallery_54721.html","maxRecords":0.0,"photoIDs":[69951.0,69952.0,69954.0,69955.0,712230.0,712260.0,712262.0,712264.0,712266.0],"skipIndex":0,"section_code":"gallery","featured_images":"712266,712264,712262,712260,712230,69955,69954,69952,69951","id":54721,"singleSection":false});				  						galleries[790] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Landscapes","link":"gallery_790.html","maxRecords":0.0,"photoIDs":[4085.0,4088.0,6722.0,6719.0,6720.0,69961.0,69956.0,69957.0,69958.0],"skipIndex":0,"section_code":"gallery","featured_images":6722.0,"id":790,"singleSection":false});				  						galleries[1048] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Commercial","link":"gallery_1048.html","maxRecords":0.0,"photoIDs":[6725.0,6730.0,6726.0,6729.0,6721.0,6727.0,6728.0,6724.0,69986.0,69987.0,69949.0],"skipIndex":0,"section_code":"gallery","featured_images":"6730,6726,6725","id":1048,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '1008562,1008559,1004429,1004418,1004415,69955,69954,69952,4303,4301,4299,4075,4074,4071,70202,6722,69986,69987';
imageSets[2] = '1004415,712298,4304,4301,4074,6725,6730,6726,6722';
imageSets[3] = '1008575,1008571,1008562,1008559,1004430,1004429,1004426,1004424,1004421,1004418,1004415,712301,712298,712295,712266,712264,712262,712260,712230,70205,70203,70202,70200,69987,69986,69961,69958,69957,69956,69955,69954,69952,69951,69949,6730,6729,6728,6727,6726,6725,6724,6722,6721,6720,6719,4309,4308,4307,4304,4303';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/rogerkeyse/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/rogerkeyse/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/rogerkeyse/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/rogerkeyse/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/rogerkeyse/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/rogerkeyse/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/rogerkeyse/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/rogerkeyse/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/rogerkeyse/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/rogerkeyse/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/rogerkeyse/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/rogerkeyse/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/rogerkeyse/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/rogerkeyse/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/rogerkeyse/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/rogerkeyse/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/rogerkeyse/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/rogerkeyse/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/rogerkeyse/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/rogerkeyse/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/rogerkeyse/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/rogerkeyse/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/rogerkeyse/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/rogerkeyse/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/rogerkeyse/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/rogerkeyse/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/rogerkeyse/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 || photos || {})[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:'',$detailContainer:'',
                    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 (op.updateHash && clik.getIDInUrl(location.href,'photo') != op.nextPhoto.id) {
		clik.changeHash('photos_id=' + op.nextPhoto.id, true);
	}
		
	    if (op.$title.length > 0) {
  		op.$title.fadeGalleryDetails(photoCaption, op.speed);
    }
        if (op.updateDocumentTitle) {
						  document.title = 'Roger Keyse Photography: ' + photoCaption;
			    }
        if (op.$detail.length > 0) {
      	temp = op.nextPhoto.fnGetImageDetails();
	    op.$detail.fadeGalleryDetails(temp, op.speed, function(){
			if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
				toggleAddToCartConfirm(backgrounds, op.$detail);
			} else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
				toggleAddToCartConfirm(photos, op.$detail);
			}
			$('body').trigger('clikUpdate.popup');
	    });
    }
        $(op.$detailContainer).find('.replaceable[class*=replaceable_photo-]').each(function(){
    	var field = clik.getPrefixedClass(this.className, 'replaceable_photo-');
    	if (field in op.nextPhoto) {
    		$(this).fadeGalleryDetails(op.nextPhoto[field], op.speed);
    	}
    }).end().find('.replaceable.photoPayment').fadeGalleryDetails(op.nextPhoto.fnGetPaymentInfo(), op.speed, function(){
		if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
			toggleAddToCartConfirm(backgrounds, op.$detailContainer);
		} else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
			toggleAddToCartConfirm(photos, op.$detailContainer);
		}
		$('body').trigger('clikUpdate.popup');
	});
		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.speed) {
      	clik.doColumnResize(false, op.$photo.add(op.$detail).add(op.$title));
    }
        
    return html;
	}

/***************************************************************************
* Toggle add to cart confirmation element and set up the click event for   *
* the 'Add to cart' button.                                                *
***************************************************************************/
function toggleAddToCartConfirm(array, root){
	if (typeof(array) !== 'object' || array === null) {
	  	array = photos;
	}
	if (!$(root).length) {		root = $('body');	}	if($('#paymentConfirm', root).length > 0){
		$('#paymentConfirm', root).hide();
		$('#paymentAddButton', root)
		.unbind()
		.click(function(){
						form = $('#paymentForm', root)[0];
			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', root).text('Item added to cart').show();}
				else{
					$('#paymentConfirm', root).text('Item added to cart').fadeIn();
					dspOrderDetails(form.site.value);
				}
			}
			else{
				$('#paymentConfirm', root).text('Item not added - check cookies are enabled in your browser.').fadeIn();
			}
		});
	}
}

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
clik.photo.fnGetImageDetails = function(){
	var temp = '';
	if (this.description != '') {
		temp +=  '<div id="imageDescription">' + this.description + '</div>';
	}
		if (this.photo_ref != '') {
		temp += '<div class="imageinfo" id="imageRef"><strong>Ref: </strong>' + this.photo_ref + '</div>';
	}
		if (this.takendate != '') {
		
		temp += '<div class="imageinfo" id="imageDate"><strong>Date: </strong>' + this.takendate + '</div>';
	}
	
	if (this.location != '') {
		
		temp += '<div class="imageinfo" id="imageLocation"><strong>Location: </strong>' +  this.location + '</div>';
	}
	
	if (this.photographer != '') {
		
		temp += '<div class="imageinfo" id="imagePhotographer"><strong>Photographer: </strong>' + this.photographer + '</div>';
	}
				
				if (temp != '') {
		temp += '<div class="spacer"></div>';
	}
	return temp;
};

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
clik.photo.fnGetPaymentInfo = function(){
	var temp = '';
	if (this.item_price !== '') {
				temp += '<p>Order this print:</p>';
				temp += '<div class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> ' + (this.item_price).toFixed(2) + '</div>';
		var item_name  = this.purchase_instruction;
		var amount = (this.item_price).toFixed(2);
		var item_option  = 0;
	}
		else {
		
	}
	if (this.item_price !== '') {
			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({					title: galleries[gallery_id].title				}).filter(function(){return this.href;}).attr({					href: thumbnails[imageID].fnGalleryLink(gallery_id)				});
			}
		}
	}
}

/***************************************************************************
* 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 += '<a href="' + galleries[i].section_code + '_' + galleries[i].id + '.html">' + galleries[i].title + '</a>';
							}
		}
		document.all.galleryLinks.innerHTML = 'Other galleries: ' + temp;
	}
}

			

