window.thumbnails = {};
															thumbnails[8872822] = clik.newPhoto({"id":8872822,"src":"snowpt_256D15A9-1EC9-DFB6-090C6AD74C2640EE_thumb.jpg","galleries_id":287882,"server_id":15,"link":"photo_8872822.html","width":130,"caption":"Sir Peter Scott Lighthouse","height":84});
															thumbnails[8872829] = clik.newPhoto({"id":8872829,"src":"sutbrsmall_thumb.jpg","galleries_id":245054,"server_id":15,"link":"photo_8872829.html","width":130,"caption":"Crosskeys Bridge, Sutton Bridge","height":87});
															thumbnails[8854782] = clik.newPhoto({"id":8854782,"src":"east_bank_lighthouse_sm_thumb.jpg","galleries_id":287882,"server_id":15,"link":"photo_8854782.html","width":130,"caption":"Sunset on the East bank","height":87});
															thumbnails[8854878] = clik.newPhoto({"id":8854878,"src":"moulton2_thumb.jpg","galleries_id":287882,"server_id":15,"link":"photo_8854878.html","width":130,"caption":"Moulton windmill silhouette","height":77});
															thumbnails[7182651] = clik.newPhoto({"id":7182651,"src":"snowpt_thumb.jpg","galleries_id":245054,"server_id":15,"link":"photo_7182651.html","width":130,"caption":"Sir Peter Scott Light House East bank Sutton Bridge","height":84});
															thumbnails[7182637] = clik.newPhoto({"id":7182637,"src":"well_fishing_boat_thumb.jpg","galleries_id":245053,"server_id":15,"link":"photo_7182637.html","width":130,"caption":"Wells Next The Sea - Salford","height":92});
															thumbnails[6665545] = clik.newPhoto({"id":6665545,"src":"brancastersep_thumb.jpg","galleries_id":245053,"server_id":15,"link":"photo_6665545.html","width":130,"caption":"Pollywiggle, Brancaster Staithe","height":92});
															thumbnails[5597100] = clik.newPhoto({"id":5597100,"src":"cromerpier3_thumb.jpg","galleries_id":246005,"server_id":15,"link":"photo_5597100.html","width":130,"caption":"Cromer Pier, Norfolk Coast","height":97});
															thumbnails[5597104] = clik.newPhoto({"id":5597104,"src":"cromer_pier_norfolk_thumb.jpg","galleries_id":245053,"server_id":15,"link":"photo_5597104.html","width":130,"caption":"Cromer Pier Norfolk Coast Seaside Town","height":87});
															thumbnails[5311877] = clik.newPhoto({"id":5311877,"src":"thurneposter_thumb.jpg","galleries_id":246005,"server_id":15,"link":"photo_5311877.html","width":130,"caption":"Thurne Drainage Mill","height":97});
															thumbnails[5311881] = clik.newPhoto({"id":5311881,"src":"thurne-drainage-mill_thumb.jpg","galleries_id":245053,"server_id":15,"link":"photo_5311881.html","width":130,"caption":"Thurne Drainage Mill, Norfolk Broads","height":86});
															thumbnails[5092443] = clik.newPhoto({"id":5092443,"src":"pier_thumb.jpg","galleries_id":245053,"server_id":15,"link":"photo_5092443.html","width":130,"caption":"Southwold Pier, Suffolk Coast","height":85});
															thumbnails[5185629] = clik.newPhoto({"id":5185629,"src":"sunnyhunnylexp_thumb.jpg","galleries_id":245053,"server_id":15,"link":"photo_5185629.html","width":130,"caption":"Hunstanton on a nice cool Autumn\/Winter afternoon.","height":89});
															thumbnails[5091556] = clik.newPhoto({"id":5091556,"src":"yellow_poster_thumb.jpg","galleries_id":246005,"server_id":15,"link":"photo_5091556.html","width":130,"caption":"Yellow Flowers","height":97});
															thumbnails[5091573] = clik.newPhoto({"id":5091573,"src":"yellowfl_thumb.jpg","galleries_id":245562,"server_id":15,"link":"photo_5091573.html","width":130,"caption":"Yellow Flowers","height":87});
															thumbnails[5091965] = clik.newPhoto({"id":5091965,"src":"cowmore_thumb.jpg","galleries_id":245054,"server_id":15,"link":"photo_5091965.html","width":130,"caption":"Comical Cow on the River Bank","height":96});
															thumbnails[5092030] = clik.newPhoto({"id":5092030,"src":"smallfry_thumb.jpg","galleries_id":245053,"server_id":15,"link":"photo_5092030.html","width":130,"caption":"Smal Fry - Wells Next The Sea","height":88});
															thumbnails[5092341] = clik.newPhoto({"id":5092341,"src":"fishing_thumb.jpg","galleries_id":245053,"server_id":15,"link":"photo_5092341.html","width":130,"caption":"Just Fishing","height":87});
															thumbnails[4483913] = clik.newPhoto({"id":4483913,"src":"hunstanton_starfish_thumb.jpg","galleries_id":246005,"server_id":15,"link":"photo_4483913.html","width":130,"caption":"Hunstanton Starfish","height":97});
															thumbnails[4483923] = clik.newPhoto({"id":4483923,"src":"hunstanton_starfish_photograph_thumb.jpg","galleries_id":245053,"server_id":15,"link":"photo_4483923.html","width":130,"caption":"Hunstanton Sunset - Starfish<br>\r\n<br>\r\n","height":87});
															thumbnails[4353262] = clik.newPhoto({"id":4353262,"src":"east_bank_thumb.jpg","galleries_id":245054,"server_id":15,"link":"photo_4353262.html","width":130,"caption":"Sir Peter Scotts Lighthouse, East Bank River Nene. ","height":85});
															thumbnails[4294810] = clik.newPhoto({"id":4294810,"src":"river_nene2_thumb.jpg","galleries_id":245054,"server_id":15,"link":"photo_4294810.html","width":130,"caption":"River Nene at dusk, East Bank, Sutton Bridge.<br>\r\n","height":87});
															thumbnails[4308026] = clik.newPhoto({"id":4308026,"src":"wellssmal_thumb.jpg","galleries_id":245053,"server_id":15,"link":"photo_4308026.html","width":130,"caption":"Wells Next To The Sea","height":85});
															thumbnails[4287845] = clik.newPhoto({"id":4287845,"src":"customs_hssmall_thumb.jpg","galleries_id":245053,"server_id":15,"link":"photo_4287845.html","width":130,"caption":"Cutsoms House, Kings Lynn.","height":87});
															thumbnails[4283674] = clik.newPhoto({"id":4283674,"src":"snettisham_boat_thumb.jpg","galleries_id":245053,"server_id":15,"link":"photo_4283674.html","width":130,"caption":"Snettisham Sunset","height":86});
															thumbnails[4228733] = clik.newPhoto({"id":4228733,"src":"snettisham_sunset_thumb.jpg","galleries_id":246005,"server_id":15,"link":"photo_4228733.html","width":130,"caption":"Snettisham Sunset, Roma Too.<br>\r\nNorfolk Coast.","height":97});
															thumbnails[4228739] = clik.newPhoto({"id":4228739,"src":"roma2smll_thumb.jpg","galleries_id":245053,"server_id":15,"link":"photo_4228739.html","width":130,"caption":"Snettisham sunset on the East Coast. Small boat Roma Too.","height":87});
															thumbnails[4215027] = clik.newPhoto({"id":4215027,"src":"clumber-park_thumb.jpg","galleries_id":246005,"server_id":15,"link":"photo_4215027.html","width":130,"caption":"Clumber Park","height":97});
															thumbnails[4215029] = clik.newPhoto({"id":4215029,"src":"clumberparksmll_thumb.jpg","galleries_id":250105,"server_id":15,"link":"photo_4215029.html","width":130,"caption":"Clumber Park","height":87});
															thumbnails[4121134] = clik.newPhoto({"id":4121134,"src":"Main5_thumb.jpg","galleries_id":246005,"server_id":15,"link":"photo_4121134.html","width":130,"caption":"Thornham Marsh","height":97});
															thumbnails[4121186] = clik.newPhoto({"id":4121186,"src":"thornham_thumb.jpg","galleries_id":245053,"server_id":15,"link":"photo_4121186.html","width":130,"caption":"Thornham Marsh, Norfolk Coast.","height":87});
															thumbnails[4109160] = clik.newPhoto({"id":4109160,"src":"Main4_thumb.jpg","galleries_id":246005,"server_id":15,"link":"photo_4109160.html","width":130,"caption":"Silhouette","height":97});
															thumbnails[4102094] = clik.newPhoto({"id":4102094,"src":"rose_thumb.jpg","galleries_id":245562,"server_id":15,"link":"photo_4102094.html","width":130,"caption":"Roses are red, but this one is pink","height":91});
															thumbnails[4085290] = clik.newPhoto({"id":4085290,"src":"ladybird_thumb.jpg","galleries_id":245134,"server_id":15,"link":"photo_4085290.html","width":130,"caption":"Ladybird","height":94});
															thumbnails[4092048] = clik.newPhoto({"id":4092048,"src":"happisburghselect_thumb.jpg","galleries_id":245053,"server_id":15,"link":"photo_4092048.html","width":130,"caption":"Happisburgh","height":86});
															thumbnails[4092450] = clik.newPhoto({"id":4092450,"src":"hunstantonboy_thumb.jpg","galleries_id":245053,"server_id":15,"link":"photo_4092450.html","width":130,"caption":"Hunstanton","height":90});
															thumbnails[4088641] = clik.newPhoto({"id":4088641,"src":"teddy_thumb.jpg","galleries_id":245562,"server_id":15,"link":"photo_4088641.html","width":130,"caption":"Antique Teddy","height":175});
															thumbnails[4088669] = clik.newPhoto({"id":4088669,"src":"flower_thumb.jpg","galleries_id":245562,"server_id":15,"link":"photo_4088669.html","width":130,"caption":"Gerbera flower","height":155});
															thumbnails[4088929] = clik.newPhoto({"id":4088929,"src":"brograve_thumb.jpg","galleries_id":245053,"server_id":15,"link":"photo_4088929.html","width":130,"caption":"Brograve Drainage Mill, Norfolk Broads.","height":87});
															thumbnails[4092379] = clik.newPhoto({"id":4092379,"src":"brogravebw_thumb.jpg","galleries_id":245053,"server_id":15,"link":"photo_4092379.html","width":130,"caption":"Brograve B&W","height":87});
															thumbnails[4075915] = clik.newPhoto({"id":4075915,"src":"starfish_thumb.jpg","galleries_id":245053,"server_id":15,"link":"photo_4075915.html","width":130,"caption":"Starfish","height":87});
															thumbnails[4075965] = clik.newPhoto({"id":4075965,"src":"crab_thumb.jpg","galleries_id":245134,"server_id":15,"link":"photo_4075965.html","width":130,"caption":"Crabbing Around","height":89});
															thumbnails[4075968] = clik.newPhoto({"id":4075968,"src":"cromerpier_thumb.jpg","galleries_id":245053,"server_id":15,"link":"photo_4075968.html","width":130,"caption":"Cromer Pier","height":81});
															thumbnails[4076013] = clik.newPhoto({"id":4076013,"src":"snettisham_thumb.jpg","galleries_id":245053,"server_id":15,"link":"photo_4076013.html","width":130,"caption":"Snettisham","height":85});
															thumbnails[4076980] = clik.newPhoto({"id":4076980,"src":"lighthouse_thumb.jpg","galleries_id":245053,"server_id":15,"link":"photo_4076980.html","width":130,"caption":"Happisburgh Lighthouse","height":87});
															thumbnails[4077025] = clik.newPhoto({"id":4077025,"src":"sheep_thumb.jpg","galleries_id":245134,"server_id":15,"link":"photo_4077025.html","width":130,"caption":"Sheep","height":100});
															thumbnails[4077081] = clik.newPhoto({"id":4077081,"src":"hunstantonsunset_thumb.jpg","galleries_id":245053,"server_id":15,"link":"photo_4077081.html","width":130,"caption":"Hunstanton Sunset","height":87});
															thumbnails[4077128] = clik.newPhoto({"id":4077128,"src":"meadowpipit_thumb.jpg","galleries_id":245134,"server_id":15,"link":"photo_4077128.html","width":130,"caption":"Meadow Pipit","height":92});
															thumbnails[4077177] = clik.newPhoto({"id":4077177,"src":"cromerpier2_thumb.jpg","galleries_id":245053,"server_id":15,"link":"photo_4077177.html","width":130,"caption":"Cromer Pier","height":85});
															thumbnails[4077408] = clik.newPhoto({"id":4077408,"src":"sheraton_thumb.jpg","galleries_id":245053,"server_id":15,"link":"photo_4077408.html","width":130,"caption":"Sheraton Shipwreck, Hunstanton","height":87});
															thumbnails[4077429] = clik.newPhoto({"id":4077429,"src":"thornhamboat_thumb.jpg","galleries_id":245053,"server_id":15,"link":"photo_4077429.html","width":130,"caption":"Thornham Marsh Boat","height":87});
															thumbnails[4078277] = clik.newPhoto({"id":4078277,"src":"Oxburgh_thumb.jpg","galleries_id":245053,"server_id":15,"link":"photo_4078277.html","width":130,"caption":"Oxburgh Hall","height":87});
															thumbnails[4075905] = clik.newPhoto({"id":4075905,"src":"HunstantonGroins_thumb.jpg","galleries_id":245053,"server_id":15,"link":"photo_4075905.html","width":130,"caption":"Groynes - Hunstanton","height":88});
															thumbnails[4099300] = clik.newPhoto({"id":4099300,"src":"main_thumb.jpg","galleries_id":246005,"server_id":15,"link":"photo_4099300.html","width":130,"caption":"Hunstanton Sunset","height":97});
															thumbnails[4100181] = clik.newPhoto({"id":4100181,"src":"Groynes_thumb.jpg","galleries_id":246005,"server_id":15,"link":"photo_4100181.html","width":130,"caption":"Hunstanton Groynes","height":97});
															thumbnails[4101723] = clik.newPhoto({"id":4101723,"src":"main21_thumb.jpg","galleries_id":246005,"server_id":15,"link":"photo_4101723.html","width":130,"caption":"Happisburgh Lighthouse","height":97});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[287882] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"New Photos","link":"gallery_287882.html","maxRecords":0.0,"photoIDs":[8872822.0,8854782.0,8854878.0],"skipIndex":0,"section_code":"gallery","featured_images":8854782.0,"id":287882,"singleSection":false});				  						galleries[246005] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Posters","link":"gallery_246005.html","maxRecords":0.0,"photoIDs":[5597100.0,5311877.0,5091556.0,4483913.0,4228733.0,4215027.0,4121134.0,4109160.0,4099300.0,4100181.0,4101723.0],"skipIndex":0,"section_code":"gallery","featured_images":4483913.0,"id":246005,"singleSection":false});				  						galleries[245562] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Still Life\/Flowers","link":"gallery_245562.html","maxRecords":0.0,"photoIDs":[5091573.0,4102094.0,4088641.0,4088669.0],"skipIndex":0,"section_code":"gallery","featured_images":"5091573,4102094","id":245562,"singleSection":false});				  						galleries[250105] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Trees","link":"gallery_250105.html","maxRecords":0.0,"photoIDs":[4215029.0],"skipIndex":0,"section_code":"gallery","featured_images":4215029.0,"id":250105,"singleSection":false});				  						galleries[245053] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Norfolk","link":"gallery_245053.html","maxRecords":0.0,"photoIDs":[7182637.0,6665545.0,5597104.0,5311881.0,5092443.0,5185629.0,5092030.0,5092341.0,4483923.0,4308026.0,4287845.0,4283674.0,4228739.0,4121186.0,4092048.0,4092450.0,4088929.0,4092379.0,4075915.0,4075968.0,4076013.0,4076980.0,4077081.0,4077177.0,4077408.0,4077429.0,4078277.0,4075905.0],"skipIndex":0,"section_code":"gallery","featured_images":"4483923,4076980","id":245053,"singleSection":false});				  						galleries[245054] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Sutton Bridge","link":"gallery_245054.html","maxRecords":0.0,"photoIDs":[8872829.0,7182651.0,5091965.0,4353262.0,4294810.0],"skipIndex":0,"section_code":"gallery","featured_images":"8872829,7182651,5091965,4353262,4294810","id":245054,"singleSection":false});				  						galleries[245134] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Animals\/Wildlife","link":"gallery_245134.html","maxRecords":0.0,"photoIDs":[4085290.0,4075965.0,4077025.0,4077128.0],"skipIndex":0,"section_code":"gallery","featured_images":4075965.0,"id":245134,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '5597100,5311877,5091556,4483913,4228733,4215027,4101723,4100181,4099300';
imageSets[2] = '8854782,5091573,4483923,4483913,4102094,4076980,4075965';
imageSets[3] = '8872829,8872822,8854878,8854782,7182651,7182637,6665545,5597104,5597100,5311881,5311877,5185629,5092443,5092341,5092030,5091965,5091573,5091556,4483923,4483913,4353262,4308026,4294810,4287845,4283674,4228739,4228733,4215029,4215027,4121186,4121134,4109160,4102094,4101723,4100181,4099300,4092450,4092379,4092048,4088929,4088669,4088641,4085290,4078277,4077429,4077408,4077177,4077128,4077081,4077025';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/grezmel/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/grezmel/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/grezmel/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/grezmel/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/grezmel/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/grezmel/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/grezmel/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/grezmel/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/grezmel/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/grezmel/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/grezmel/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/grezmel/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/grezmel/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/grezmel/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/grezmel/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/grezmel/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/grezmel/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/grezmel/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/grezmel/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/grezmel/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/grezmel/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/grezmel/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/grezmel/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/grezmel/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/grezmel/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/grezmel/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/grezmel/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 = 'Graham Melbourne Photography - Norfolk Coast: ' + 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="updateCartValue($(this.form).next(\'#paymentForm\')[0],this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value); if(divShowing(\'paymentConfirm\')){fadeOut(\'paymentConfirm\', 3)};">';
		
		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">';
			temp += '	<input type="hidden" name="item_option" value="' + item_option + '">';
			temp += '	<input type="hidden" name="site" value="GREZMEL">';
			temp += '	<input type="hidden" name="item_number" value="'+ this.id +'">';
			temp += '	<input type="hidden" name="quantity" value="1">';
						temp += '	<input value="Add to cart" id="paymentAddButton" class="button" onmouseover="this.className=\'buttonHi\'\;" onmouseout="this.className=\'button\'\;" type="Button">';
							temp += '	<input value="View cart" id="paymentViewButton" class="button" onmouseover="this.className=\'buttonHi\';" onmouseout="this.className=\'button\';" type="Button" onclick="javascript:window.location=\'cart.html\'">';
			temp += '</form>';
						temp += '<div class="clearing">&nbsp;</div>';
			temp += '<div id="confirmContainer">';
			temp += '<div id="paymentConfirm">Item added to cart</div>';
			temp += '</div>';
			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;
	}
}

			

