window.thumbnails = {};
															thumbnails[802497] = clik.newPhoto({"id":802497,"src":"lor-and-me_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":93});
															thumbnails[8902549] = clik.newPhoto({"id":8902549,"src":"Eon_Matthews_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":36});
															thumbnails[7231607] = clik.newPhoto({"id":7231607,"src":"brighton-pier_0081bw1_thumb.jpg","galleries_id":52931,"server_id":1,"link":"photo_7231607.html","width":130,"caption":"Brighton Pier","height":87});
															thumbnails[7231637] = clik.newPhoto({"id":7231637,"src":"deer_thumb.jpg","galleries_id":52940,"server_id":1,"link":"photo_7231637.html","width":130,"caption":"","height":123});
															thumbnails[7231649] = clik.newPhoto({"id":7231649,"src":"kristina-jan-28-6_9F8A0177-1EC9-DFB6-0906956F4F108E93_thumb.jpg","galleries_id":52930,"server_id":1,"link":"photo_7231649.html","width":130,"caption":"","height":195});
															thumbnails[7231674] = clik.newPhoto({"id":7231674,"src":"Red1_thumb.jpg","galleries_id":52847,"server_id":1,"link":"photo_7231674.html","width":130,"caption":"Poppy field","height":100});
															thumbnails[7231676] = clik.newPhoto({"id":7231676,"src":"poppypaint2_thumb.jpg","galleries_id":52847,"server_id":1,"link":"photo_7231676.html","width":130,"caption":"Remembering","height":130});
															thumbnails[7231699] = clik.newPhoto({"id":7231699,"src":"7sisters_thumb.jpg","galleries_id":52931,"server_id":1,"link":"photo_7231699.html","width":130,"caption":"Seven Sisters in the snow","height":87});
															thumbnails[7233406] = clik.newPhoto({"id":7233406,"src":"landscape-12_2D596771-24E8-5EC4-4F9D37D0D1D7847A_thumb.jpg","galleries_id":52931,"server_id":1,"link":"photo_7233406.html","width":130,"caption":"Seven Sisters at Night","height":77});
															thumbnails[7233409] = clik.newPhoto({"id":7233409,"src":"canada-2008_1799_thumb.jpg","galleries_id":52940,"server_id":1,"link":"photo_7233409.html","width":130,"caption":"","height":79});
															thumbnails[7233562] = clik.newPhoto({"id":7233562,"src":"canada-2008_1321_2_thumb.jpg","galleries_id":52931,"server_id":1,"link":"photo_7233562.html","width":130,"caption":"British Columbia Canada","height":89});
															thumbnails[7233564] = clik.newPhoto({"id":7233564,"src":"canada-2008_1324-2_thumb.jpg","galleries_id":52931,"server_id":1,"link":"photo_7233564.html","width":130,"caption":"Lilloett British Columbia Canada","height":87});
															thumbnails[7234049] = clik.newPhoto({"id":7234049,"src":"brighton-pier_0023_thumb.jpg","galleries_id":52931,"server_id":1,"link":"photo_7234049.html","width":130,"caption":"Starlings over Brighton","height":87});
															thumbnails[7234061] = clik.newPhoto({"id":7234061,"src":"IMG_0973_thumb.jpg","galleries_id":52940,"server_id":1,"link":"photo_7234061.html","width":130,"caption":"","height":195});
															thumbnails[7234067] = clik.newPhoto({"id":7234067,"src":"IMG_1062_thumb.jpg","galleries_id":52940,"server_id":1,"link":"photo_7234067.html","width":130,"caption":"","height":195});
															thumbnails[7234068] = clik.newPhoto({"id":7234068,"src":"IMG_1108_edited-1_thumb.jpg","galleries_id":52847,"server_id":1,"link":"photo_7234068.html","width":130,"caption":"","height":106});
															thumbnails[7234071] = clik.newPhoto({"id":7234071,"src":"IMG_4637_thumb.jpg","galleries_id":52940,"server_id":1,"link":"photo_7234071.html","width":130,"caption":"","height":195});
															thumbnails[7234099] = clik.newPhoto({"id":7234099,"src":"kristina-jan-28-117_thumb.jpg","galleries_id":52930,"server_id":1,"link":"photo_7234099.html","width":130,"caption":"","height":195});
															thumbnails[7234100] = clik.newPhoto({"id":7234100,"src":"kristina-jan-28-119_thumb.jpg","galleries_id":52930,"server_id":1,"link":"photo_7234100.html","width":130,"caption":"","height":195});
															thumbnails[7242838] = clik.newPhoto({"id":7242838,"src":"Sun-Sets-in-San-Carlos_thumb.jpg","galleries_id":52936,"server_id":1,"link":"photo_7242838.html","width":130,"caption":"San Carlos Falkland Islands 1982","height":86});
															thumbnails[7242839] = clik.newPhoto({"id":7242839,"src":"Pink-Sea_thumb.jpg","galleries_id":52936,"server_id":1,"link":"photo_7242839.html","width":130,"caption":"The guns are silent once more","height":86});
															thumbnails[7242841] = clik.newPhoto({"id":7242841,"src":"glam4-2_thumb.jpg","galleries_id":52936,"server_id":1,"link":"photo_7242841.html","width":130,"caption":"Excocet Damge Falkland islands 1982","height":87});
															thumbnails[7242843] = clik.newPhoto({"id":7242843,"src":"glam2-2_thumb.jpg","galleries_id":52936,"server_id":1,"link":"photo_7242843.html","width":130,"caption":"Excocet Damage Falkland Islands 1982","height":193});
															thumbnails[7242844] = clik.newPhoto({"id":7242844,"src":"2-parrots_thumb.jpg","galleries_id":52940,"server_id":1,"link":"photo_7242844.html","width":130,"caption":"Kiss Me!!","height":87});
															thumbnails[7242845] = clik.newPhoto({"id":7242845,"src":"dog-on-seaford-beach_thumb.jpg","galleries_id":52940,"server_id":1,"link":"photo_7242845.html","width":130,"caption":"Jake with Stone","height":121});
															thumbnails[7242846] = clik.newPhoto({"id":7242846,"src":"Card086_thumb.jpg","galleries_id":53167,"server_id":1,"link":"photo_7242846.html","width":130,"caption":"","height":98});
															thumbnails[7242847] = clik.newPhoto({"id":7242847,"src":"Card132_thumb.jpg","galleries_id":53167,"server_id":1,"link":"photo_7242847.html","width":130,"caption":"","height":173});
															thumbnails[7242850] = clik.newPhoto({"id":7242850,"src":"Card150_thumb.jpg","galleries_id":53167,"server_id":1,"link":"photo_7242850.html","width":130,"caption":"","height":173});
															thumbnails[7242851] = clik.newPhoto({"id":7242851,"src":"Card162_thumb.jpg","galleries_id":53167,"server_id":1,"link":"photo_7242851.html","width":130,"caption":"","height":98});
															thumbnails[7242853] = clik.newPhoto({"id":7242853,"src":"DSCN0290_thumb.jpg","galleries_id":53167,"server_id":1,"link":"photo_7242853.html","width":130,"caption":"","height":173});
															thumbnails[7242855] = clik.newPhoto({"id":7242855,"src":"DSCN0301_thumb.jpg","galleries_id":53167,"server_id":1,"link":"photo_7242855.html","width":130,"caption":"","height":98});
															thumbnails[7242857] = clik.newPhoto({"id":7242857,"src":"DSCN0387_thumb.jpg","galleries_id":53167,"server_id":1,"link":"photo_7242857.html","width":130,"caption":"","height":98});
															thumbnails[7242869] = clik.newPhoto({"id":7242869,"src":"work-20_thumb.jpg","galleries_id":244291,"server_id":1,"link":"photo_7242869.html","width":130,"caption":"Wet Landing","height":87});
															thumbnails[7243115] = clik.newPhoto({"id":7243115,"src":"IMG_2879_thumb.jpg","galleries_id":244291,"server_id":1,"link":"photo_7243115.html","width":130,"caption":"Between the arch","height":189});
															thumbnails[7243116] = clik.newPhoto({"id":7243116,"src":"IMG_2816_thumb.jpg","galleries_id":244291,"server_id":1,"link":"photo_7243116.html","width":130,"caption":"Nose on","height":188});
															thumbnails[7243119] = clik.newPhoto({"id":7243119,"src":"Looking-up-at-the-Eiffel-Tower_thumb.jpg","galleries_id":52931,"server_id":1,"link":"photo_7243119.html","width":130,"caption":"Eiffel Tower","height":173});
															thumbnails[7243143] = clik.newPhoto({"id":7243143,"src":"At-Sunset-we-Buried-our-Dead_thumb.jpg","galleries_id":52936,"server_id":1,"link":"photo_7243143.html","width":130,"caption":"Calm and Peace Falkland Islands 1982","height":86});
															thumbnails[7243144] = clik.newPhoto({"id":7243144,"src":"Port-William-North_thumb.jpg","galleries_id":52936,"server_id":1,"link":"photo_7243144.html","width":130,"caption":"Mt William Falkland Islands 1982","height":86});
															thumbnails[7243145] = clik.newPhoto({"id":7243145,"src":"wl-16_thumb.jpg","galleries_id":244291,"server_id":1,"link":"photo_7243145.html","width":130,"caption":"Splash","height":87});
															thumbnails[7243148] = clik.newPhoto({"id":7243148,"src":"IMG_5129_thumb.jpg","galleries_id":244291,"server_id":1,"link":"photo_7243148.html","width":130,"caption":"Snow fun!!!","height":87});
															thumbnails[7243152] = clik.newPhoto({"id":7243152,"src":"IMG_3162_thumb.jpg","galleries_id":244291,"server_id":1,"link":"photo_7243152.html","width":130,"caption":"BA 777 tails","height":195});
															thumbnails[7247073] = clik.newPhoto({"id":7247073,"src":"jensen_thumb.jpg","galleries_id":90342,"server_id":1,"link":"photo_7247073.html","width":130,"caption":"London Triathlon","height":150});
															thumbnails[7247074] = clik.newPhoto({"id":7247074,"src":"tri_thumb.jpg","galleries_id":90342,"server_id":1,"link":"photo_7247074.html","width":130,"caption":"London Triathlon","height":195});
															thumbnails[7247091] = clik.newPhoto({"id":7247091,"src":"londonbridge_thumb.jpg","galleries_id":52931,"server_id":1,"link":"photo_7247091.html","width":130,"caption":"Tower Bridge","height":87});
															thumbnails[7247147] = clik.newPhoto({"id":7247147,"src":"IMG_2560_thumb.jpg","galleries_id":52930,"server_id":1,"link":"photo_7247147.html","width":130,"caption":"","height":151});
															thumbnails[7247148] = clik.newPhoto({"id":7247148,"src":"IMG_7171_thumb.jpg","galleries_id":52930,"server_id":1,"link":"photo_7247148.html","width":130,"caption":"","height":195});
															thumbnails[7247149] = clik.newPhoto({"id":7247149,"src":"IMG_7201_thumb.jpg","galleries_id":52930,"server_id":1,"link":"photo_7247149.html","width":130,"caption":"","height":192});
															thumbnails[7247151] = clik.newPhoto({"id":7247151,"src":"IMG_7195_thumb.jpg","galleries_id":52930,"server_id":1,"link":"photo_7247151.html","width":130,"caption":"","height":192});
															thumbnails[7247153] = clik.newPhoto({"id":7247153,"src":"bw5_thumb.jpg","galleries_id":52930,"server_id":1,"link":"photo_7247153.html","width":130,"caption":"","height":195});
															thumbnails[7247154] = clik.newPhoto({"id":7247154,"src":"Image161_thumb.jpg","galleries_id":52936,"server_id":1,"link":"photo_7247154.html","width":130,"caption":"Rough Seas ","height":89});
															thumbnails[7858764] = clik.newPhoto({"id":7858764,"src":"5510611700_1e6801ca4e_o_thumb.jpg","galleries_id":424172,"server_id":1,"link":"photo_7858764.html","width":130,"caption":"","height":87});
															thumbnails[7858766] = clik.newPhoto({"id":7858766,"src":"5510014795_922d38e391_o_thumb.jpg","galleries_id":424172,"server_id":1,"link":"photo_7858766.html","width":130,"caption":"","height":87});
															thumbnails[7858768] = clik.newPhoto({"id":7858768,"src":"5510680872_6955dc70b5_o_thumb.jpg","galleries_id":424172,"server_id":1,"link":"photo_7858768.html","width":130,"caption":"","height":87});
															thumbnails[7858771] = clik.newPhoto({"id":7858771,"src":"5510715990_1b641f7448_o_thumb.jpg","galleries_id":424172,"server_id":1,"link":"photo_7858771.html","width":130,"caption":"","height":87});
															thumbnails[7858775] = clik.newPhoto({"id":7858775,"src":"5510719044_0df202a341_o_thumb.jpg","galleries_id":52940,"server_id":1,"link":"photo_7858775.html","width":130,"caption":"","height":195});
															thumbnails[7858782] = clik.newPhoto({"id":7858782,"src":"5510736684_496af293b4_o_thumb.jpg","galleries_id":52940,"server_id":1,"link":"photo_7858782.html","width":130,"caption":"","height":195});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[52936] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Falklands 1982 ","link":"gallery_52936.html","maxRecords":0.0,"photoIDs":[7242838.0,7242839.0,7242841.0,7242843.0,7243143.0,7243144.0,7247154.0],"skipIndex":0,"section_code":"gallery","featured_images":"7247154,7243144,7243143,7242839,7242838","id":52936,"singleSection":false});				  						galleries[424172] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Falklands 2011","link":"gallery_424172.html","maxRecords":0.0,"photoIDs":[7858764.0,7858766.0,7858768.0,7858771.0],"skipIndex":0,"section_code":"gallery","featured_images":"7858771,7858768,7858766,7858764","id":424172,"singleSection":false});				  						galleries[244291] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Others","link":"gallery_244291.html","maxRecords":0.0,"photoIDs":[7242869.0,7243115.0,7243116.0,7243145.0,7243148.0,7243152.0],"skipIndex":0,"section_code":"gallery","featured_images":"7243148,7243145,7243115,7242869","id":244291,"singleSection":false});				  						galleries[52940] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Animals","link":"gallery_52940.html","maxRecords":0.0,"photoIDs":[7231637.0,7233409.0,7234061.0,7234067.0,7234071.0,7242844.0,7242845.0,7858775.0,7858782.0],"skipIndex":0,"section_code":"gallery","featured_images":"7242845,7242844,7234067,7234061,7233409,7231637","id":52940,"singleSection":false});				  						galleries[52931] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Landscapes","link":"gallery_52931.html","maxRecords":0.0,"photoIDs":[7231607.0,7231699.0,7233406.0,7233562.0,7233564.0,7234049.0,7243119.0,7247091.0],"skipIndex":0,"section_code":"gallery","featured_images":"7247091,7243119,7234049,7233564,7233562,7233406,7231699,7231607","id":52931,"singleSection":false});				  						galleries[53167] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Cards","link":"gallery_53167.html","maxRecords":0.0,"photoIDs":[7242846.0,7242847.0,7242850.0,7242851.0,7242853.0,7242855.0,7242857.0],"skipIndex":0,"section_code":"gallery","featured_images":"7242857,7242855,7242853,7242851,7242850,7242847,7242846","id":53167,"singleSection":false});				  						galleries[52847] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Flowers","link":"gallery_52847.html","maxRecords":0.0,"photoIDs":[7231674.0,7231676.0,7234068.0],"skipIndex":0,"section_code":"gallery","featured_images":"7234068,7231676,7231674","id":52847,"singleSection":false});				  						galleries[90342] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Sport","link":"gallery_90342.html","maxRecords":0.0,"photoIDs":[7247073.0,7247074.0],"skipIndex":0,"section_code":"gallery","featured_images":"7247074,7247073","id":90342,"singleSection":false});				  						galleries[52930] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Portrait's","link":"gallery_52930.html","maxRecords":0.0,"photoIDs":[7231649.0,7234099.0,7234100.0,7247147.0,7247148.0,7247149.0,7247151.0,7247153.0],"skipIndex":0,"section_code":"gallery","featured_images":"7247153,7247151,7247149,7247147,7234100,7234099,7231649","id":52930,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '7247154,7247153,7247151,7247149,7247147,7247091,7243148,7243145,7243144,7243143,7243119,7243115,7242869,7242857,7242855,7242853,7242851,7242850,7242847,7242846,7242845,7242844,7242839,7242838,7234100,7234099,7234068,7234067,7234061,7234049,7233564,7233562,7233409,7233406,7231699,7231676,7231674,7231649,7231637,7231607';
imageSets[2] = '8902549,7247154,7247153,7247151,7247149,7247147,7247091,7243148,7243145,7243144,7243143,7243119,7243115,7242869,7242857,7242855,7242853,7242851,7242850,7242847,7242846,7242845,7242844,7242839,7242838,7234100,7234099,7234068,7234067,7234061,7234049,7233564,7233562,7233409,7233406,7231699,7231676,7231674,7231649,7231637,7231607';
imageSets[3] = '7247154,7247153,7247151,7247149,7247147,7247091,7243148,7243145,7243144,7243143,7243119,7243115,7242869,7242857,7242855,7242853,7242851,7242850,7242847,7242846,7242845,7242844,7242839,7242838,7234100,7234099,7234068,7234067,7234061,7234049,7233564,7233562,7233409,7233406,7231699,7231676,7231674,7231649,7231637,7231607';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/eonisuk/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/eonisuk/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/eonisuk/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/eonisuk/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/eonisuk/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/eonisuk/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/eonisuk/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/eonisuk/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/eonisuk/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/eonisuk/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/eonisuk/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/eonisuk/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/eonisuk/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/eonisuk/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/eonisuk/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/eonisuk/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/eonisuk/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/eonisuk/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/eonisuk/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/eonisuk/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/eonisuk/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/eonisuk/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/eonisuk/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/eonisuk/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/eonisuk/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/eonisuk/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/eonisuk/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 = 'Eon Matthews 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>';
	}
				
	temp += this.fnGetPaymentInfo();
				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>Buy now using PayPal:</p>';
				temp += '<div class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> &pound;' + (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.payment_groups_id !== '') {
		temp += '<p>Buy this print online:</p>';
				temp += '<form id="paymentOptions" style="margin:0px;border:0px;" name="paymentOptions">';
											temp += '<select class="paymentlink" name="payment_options_id" onchange="updateItemValues($(this.form).next(\'#paymentForm\')[0],this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value);">';
		
		temp += getPaymentOptions(this.payment_groups_id);
		temp += '</select>';
		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 += '<form id="paymentForm" style="margin:0px;border:0px;" name="paymentForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
			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 += '<input type="hidden" name="cmd" value="_cart">';
					temp += '<input type="hidden" name="business" value="eon.matthews@btinternet.com">';
					temp += '<input type="hidden" name="currency_code" value="GBP">';
					temp += '<input type="hidden" name="add" value="1">';
													temp += '<input type="hidden" name="amount" value="'+amount+'">';
					temp += '<input type="hidden" name="item_number" value="'+ref+'">';
													temp += '<input type=\"Submit\" value=\"Add to cart\" id=\"paymentAddButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
										temp += '</form>';
										temp += '<form id="paymentCartForm" style="margin:0px;" name="paymentCartForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
				temp += '<input type="hidden" name="cmd" value="_cart">';
				temp += '<input type="hidden" name="business" value="eon.matthews@btinternet.com">';
				temp += '<input type="hidden" name="display" value="1">';
				temp += '<input type=\"Submit\" value=\"View cart\" id=\"paymentViewButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
				temp += '</form>';
						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;
	}
}

			

