window.thumbnails = {};
															thumbnails[6809312] = clik.newPhoto({"id":6809312,"src":"photographer_on_location_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"","height":108});
															thumbnails[5509032] = clik.newPhoto({"id":5509032,"src":"BasingstokeRegistryOffice_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"","height":92});
															thumbnails[5508764] = clik.newPhoto({"id":5508764,"src":"Highfield_Church_Southampton_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"","height":186});
															thumbnails[5447573] = clik.newPhoto({"id":5447573,"src":"Deer_newforest_thumb.jpg","galleries_id":298246,"server_id":5,"link":"photo_5447573.html","width":130,"caption":"","height":90});
															thumbnails[5523216] = clik.newPhoto({"id":5523216,"src":"vf_alpina_thumb.jpg","galleries_id":312796,"server_id":5,"link":"photo_5523216.html","width":130,"caption":"","height":92});
															thumbnails[5523218] = clik.newPhoto({"id":5523218,"src":"vf_bmw_thumb.jpg","galleries_id":312796,"server_id":5,"link":"photo_5523218.html","width":130,"caption":"","height":92});
															thumbnails[5523222] = clik.newPhoto({"id":5523222,"src":"vf_ghibli_thumb.jpg","galleries_id":312796,"server_id":5,"link":"photo_5523222.html","width":130,"caption":"","height":92});
															thumbnails[5523224] = clik.newPhoto({"id":5523224,"src":"vf_maserati_thumb.jpg","galleries_id":312796,"server_id":5,"link":"photo_5523224.html","width":130,"caption":"","height":92});
															thumbnails[5743909] = clik.newPhoto({"id":5743909,"src":"maserati-rockingham_thumb.jpg","galleries_id":325367,"server_id":5,"link":"photo_5743909.html","width":130,"caption":"","height":87});
															thumbnails[5743911] = clik.newPhoto({"id":5743911,"src":"rockingham-wet-day_thumb.jpg","galleries_id":325367,"server_id":5,"link":"photo_5743911.html","width":130,"caption":"","height":87});
															thumbnails[5743913] = clik.newPhoto({"id":5743913,"src":"wet-day-at-rockingham_thumb.jpg","galleries_id":325367,"server_id":5,"link":"photo_5743913.html","width":130,"caption":"","height":87});
															thumbnails[6879243] = clik.newPhoto({"id":6879243,"src":"wedding_fawley_church_thumb.jpg","galleries_id":286435,"server_id":5,"link":"photo_6879243.html","width":130,"caption":"","height":190});
															thumbnails[5302348] = clik.newPhoto({"id":5302348,"src":"two-sisters-fun-studio-portrait_thumb.jpg","galleries_id":286436,"server_id":5,"link":"photo_5302348.html","width":130,"caption":"","height":94});
															thumbnails[5302374] = clik.newPhoto({"id":5302374,"src":"bluebells-in-the-trees_thumb.jpg","galleries_id":298246,"server_id":5,"link":"photo_5302374.html","width":130,"caption":"","height":90});
															thumbnails[5302387] = clik.newPhoto({"id":5302387,"src":"weather-front-advancing-over-solent_thumb.jpg","galleries_id":301281,"server_id":5,"link":"photo_5302387.html","width":130,"caption":"","height":90});
															thumbnails[5302397] = clik.newPhoto({"id":5302397,"src":"St_Vaast_La_Hougue-Manche_thumb.jpg","galleries_id":298247,"server_id":5,"link":"photo_5302397.html","width":130,"caption":"","height":186});
															thumbnails[6860532] = clik.newPhoto({"id":6860532,"src":"DSC_4788_thumb.jpg","galleries_id":372474,"server_id":5,"link":"photo_6860532.html","width":130,"caption":"","height":192});
															thumbnails[5302347] = clik.newPhoto({"id":5302347,"src":"two-little-boys-fun-studio-setup-photograph_thumb.jpg","galleries_id":286436,"server_id":5,"link":"photo_5302347.html","width":130,"caption":"","height":94});
															thumbnails[5302363] = clik.newPhoto({"id":5302363,"src":"bluebells-carpet_thumb.jpg","galleries_id":298246,"server_id":5,"link":"photo_5302363.html","width":130,"caption":"","height":95});
															thumbnails[5302393] = clik.newPhoto({"id":5302393,"src":"children-sailing-school-st_vaast_thumb.jpg","galleries_id":298247,"server_id":5,"link":"photo_5302393.html","width":130,"caption":"","height":186});
															thumbnails[5302452] = clik.newPhoto({"id":5302452,"src":"Lymington-sunrise_thumb.jpg","galleries_id":301281,"server_id":5,"link":"photo_5302452.html","width":130,"caption":"","height":90});
															thumbnails[6860534] = clik.newPhoto({"id":6860534,"src":"DSC_4790_thumb.jpg","galleries_id":372474,"server_id":5,"link":"photo_6860534.html","width":130,"caption":"","height":191});
															thumbnails[5302343] = clik.newPhoto({"id":5302343,"src":"teenagers-studio-portraits_thumb.jpg","galleries_id":286436,"server_id":5,"link":"photo_5302343.html","width":130,"caption":"","height":94});
															thumbnails[5302384] = clik.newPhoto({"id":5302384,"src":"Morning-has-broken-lymington1_thumb.jpg","galleries_id":301281,"server_id":5,"link":"photo_5302384.html","width":130,"caption":"","height":90});
															thumbnails[5302425] = clik.newPhoto({"id":5302425,"src":"the-marina-at-st-vaast-le-hougue-manche-normandy_thumb.jpg","galleries_id":298247,"server_id":5,"link":"photo_5302425.html","width":130,"caption":"","height":90});
															thumbnails[6860535] = clik.newPhoto({"id":6860535,"src":"DSC_4806_thumb.jpg","galleries_id":372474,"server_id":5,"link":"photo_6860535.html","width":130,"caption":"","height":191});
															thumbnails[5302339] = clik.newPhoto({"id":5302339,"src":"teenager-girls-pose-studio-portrait_thumb.jpg","galleries_id":286436,"server_id":5,"link":"photo_5302339.html","width":130,"caption":"","height":94});
															thumbnails[5302400] = clik.newPhoto({"id":5302400,"src":"st-vaast-marina_thumb.jpg","galleries_id":298247,"server_id":5,"link":"photo_5302400.html","width":130,"caption":"","height":90});
															thumbnails[6860536] = clik.newPhoto({"id":6860536,"src":"DSC_4844_thumb.jpg","galleries_id":372474,"server_id":5,"link":"photo_6860536.html","width":130,"caption":"","height":202});
															thumbnails[5302334] = clik.newPhoto({"id":5302334,"src":"little-girl-with-balloon-portrait-studio-lights_thumb.jpg","galleries_id":286436,"server_id":5,"link":"photo_5302334.html","width":130,"caption":"","height":94});
															thumbnails[6860539] = clik.newPhoto({"id":6860539,"src":"DSC_4905_thumb.jpg","galleries_id":372474,"server_id":5,"link":"photo_6860539.html","width":130,"caption":"","height":195});
															thumbnails[5302328] = clik.newPhoto({"id":5302328,"src":"dad-baby-son-portrait_thumb.jpg","galleries_id":286436,"server_id":5,"link":"photo_5302328.html","width":130,"caption":"","height":106});
															thumbnails[6860537] = clik.newPhoto({"id":6860537,"src":"DSC_4893_thumb.jpg","galleries_id":372474,"server_id":5,"link":"photo_6860537.html","width":130,"caption":"","height":93});
															thumbnails[5302297] = clik.newPhoto({"id":5302297,"src":"cheeky-girl-studio-portrait_thumb.jpg","galleries_id":286436,"server_id":5,"link":"photo_5302297.html","width":130,"caption":"","height":177});
															thumbnails[5302295] = clik.newPhoto({"id":5302295,"src":"blonde-curly-hair-boy_thumb.jpg","galleries_id":286436,"server_id":5,"link":"photo_5302295.html","width":130,"caption":"","height":177});
															thumbnails[5302337] = clik.newPhoto({"id":5302337,"src":"performers-at-milford-arts-festival_thumb.jpg","galleries_id":286436,"server_id":5,"link":"photo_5302337.html","width":130,"caption":"","height":159});
															thumbnails[5302338] = clik.newPhoto({"id":5302338,"src":"studio-lights-white-background-portrait-boy_thumb.jpg","galleries_id":286436,"server_id":5,"link":"photo_5302338.html","width":130,"caption":"","height":177});
															thumbnails[6677611] = clik.newPhoto({"id":6677611,"src":"Bride_groom_copy1_thumb.jpg","galleries_id":286435,"server_id":5,"link":"photo_6677611.html","width":130,"caption":"","height":181});
															thumbnails[5720136] = clik.newPhoto({"id":5720136,"src":"rhinefield-wedding1_thumb.jpg","galleries_id":286435,"server_id":5,"link":"photo_5720136.html","width":130,"caption":"","height":186});
															thumbnails[5720132] = clik.newPhoto({"id":5720132,"src":"bride-and-groom1_thumb.jpg","galleries_id":286435,"server_id":5,"link":"photo_5720132.html","width":130,"caption":"","height":189});
															thumbnails[5743997] = clik.newPhoto({"id":5743997,"src":"lillibrooke-manor-wedding_thumb.jpg","galleries_id":286435,"server_id":5,"link":"photo_5743997.html","width":130,"caption":"","height":188});
															thumbnails[5302242] = clik.newPhoto({"id":5302242,"src":"bride-groom-romance-by-river-romsey_thumb.jpg","galleries_id":286435,"server_id":5,"link":"photo_5302242.html","width":130,"caption":"","height":186});
															thumbnails[5302252] = clik.newPhoto({"id":5302252,"src":"Dad-bride-outside-church-southampton_thumb.jpg","galleries_id":286435,"server_id":5,"link":"photo_5302252.html","width":130,"caption":"","height":186});
															thumbnails[5302222] = clik.newPhoto({"id":5302222,"src":"bride-with-proud-dad_thumb.jpg","galleries_id":286435,"server_id":5,"link":"photo_5302222.html","width":130,"caption":"","height":186});
															thumbnails[5302230] = clik.newPhoto({"id":5302230,"src":"bride-groom-on-bridge-by-river-Romsey_thumb.jpg","galleries_id":286435,"server_id":5,"link":"photo_5302230.html","width":130,"caption":"","height":186});
															thumbnails[5302480] = clik.newPhoto({"id":5302480,"src":"cute-little-boy-grin_thumb.jpg","galleries_id":286435,"server_id":5,"link":"photo_5302480.html","width":130,"caption":"","height":186});
															thumbnails[6827267] = clik.newPhoto({"id":6827267,"src":"Hole-BG-492_thumb.jpg","galleries_id":286435,"server_id":5,"link":"photo_6827267.html","width":130,"caption":"","height":87});
															thumbnails[5302272] = clik.newPhoto({"id":5302272,"src":"wedding-at-ringwood-registry-office_thumb.jpg","galleries_id":286435,"server_id":5,"link":"photo_5302272.html","width":130,"caption":"","height":90});
															thumbnails[5302198] = clik.newPhoto({"id":5302198,"src":"bride-groom-ceremony-basingstoke-registry-office_thumb.jpg","galleries_id":286435,"server_id":5,"link":"photo_5302198.html","width":130,"caption":"","height":101});
															thumbnails[5302205] = clik.newPhoto({"id":5302205,"src":"Bride-groom-confetti-throwing-basingstoke-registry-office_thumb.jpg","galleries_id":286435,"server_id":5,"link":"photo_5302205.html","width":130,"caption":"","height":90});
															thumbnails[6827240] = clik.newPhoto({"id":6827240,"src":"Hole-BG-464_thumb.jpg","galleries_id":286435,"server_id":5,"link":"photo_6827240.html","width":130,"caption":"","height":92});
															thumbnails[7199578] = clik.newPhoto({"id":7199578,"src":"Careys_Manor_Hotel_thumb.jpg","galleries_id":388997,"server_id":5,"link":"photo_7199578.html","width":130,"caption":"","height":86});
															thumbnails[6879238] = clik.newPhoto({"id":6879238,"src":"Wedding_Elmers_Court_thumb.jpg","galleries_id":388990,"server_id":5,"link":"photo_6879238.html","width":130,"caption":"Elmers_Court_Hotel_Lymington","height":89});
															thumbnails[5514000] = clik.newPhoto({"id":5514000,"src":"montaguearms_thumb.jpg","galleries_id":389036,"server_id":5,"link":"photo_5514000.html","width":130,"caption":"","height":91});
															thumbnails[5446519] = clik.newPhoto({"id":5446519,"src":"rhinefield_house_thumb.jpg","galleries_id":388992,"server_id":5,"link":"photo_5446519.html","width":130,"caption":"","height":79});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[388997] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Careys Manor Hotel","link":"section462391_388997.html","maxRecords":0.0,"photoIDs":[7199578.0],"skipIndex":0,"section_code":"section462391","featured_images":7199578.0,"id":388997,"singleSection":false});				  						galleries[388990] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Elmers Court Hotel Lymington","link":"section462391_388990.html","maxRecords":0.0,"photoIDs":[6879238.0],"skipIndex":0,"section_code":"section462391","featured_images":6879238.0,"id":388990,"singleSection":false});				  						galleries[312796] = clik.newGallery({"parentGallery":325362,"usePopups":true,"title":"Goodwood Track Day","link":"gallery_312796.html","maxRecords":0.0,"photoIDs":[5523216.0,5523218.0,5523222.0,5523224.0],"skipIndex":0,"section_code":"gallery","featured_images":5523216.0,"id":312796,"singleSection":false});				  						galleries[389036] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Montagu Arms Hotel","link":"section462391_389036.html","maxRecords":0.0,"photoIDs":[5514000.0],"skipIndex":0,"section_code":"section462391","featured_images":5514000.0,"id":389036,"singleSection":false});				  						galleries[372474] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"New Forest Portrait Studio","link":"gallery_372474.html","maxRecords":0.0,"photoIDs":[6860532.0,6860534.0,6860535.0,6860536.0,6860539.0,6860537.0],"skipIndex":0,"section_code":"gallery","featured_images":6860536.0,"id":372474,"singleSection":false});				  						galleries[388992] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Rhinefield House Hotel","link":"section462391_388992.html","maxRecords":0.0,"photoIDs":[5446519.0],"skipIndex":0,"section_code":"section462391","featured_images":5446519.0,"id":388992,"singleSection":false});				  						galleries[325367] = clik.newGallery({"parentGallery":325362,"usePopups":true,"title":"Rockingham ","link":"gallery_325367.html","maxRecords":0.0,"photoIDs":[5743909.0,5743911.0,5743913.0],"skipIndex":0,"section_code":"gallery","featured_images":"5743913,5743911,5743909","id":325367,"singleSection":false});				  						galleries[301281] = clik.newGallery({"parentGallery":301280,"usePopups":true,"title":"Sunsets and Sunrise","link":"gallery_301281.html","maxRecords":0.0,"photoIDs":[5302387.0,5302452.0,5302384.0],"skipIndex":0,"section_code":"gallery","featured_images":"5302452,5302387,5302384","id":301281,"singleSection":false});				  						galleries[311924] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Wedding Photographers Hampshire","link":"gallery_311924.html","maxRecords":0.0,"photoIDs":[],"skipIndex":0,"section_code":"gallery","featured_images":5720136.0,"id":311924,"singleSection":false});				  						galleries[286435] = clik.newGallery({"parentGallery":311924,"usePopups":true,"title":"Wedding Photography","link":"gallery_286435.html","maxRecords":0.0,"photoIDs":[6879243.0,6677611.0,5720136.0,5720132.0,5743997.0,5302242.0,5302252.0,5302222.0,5302230.0,5302480.0,6827267.0,5302272.0,5302198.0,5302205.0,6827240.0],"skipIndex":0,"section_code":"gallery","featured_images":5720136.0,"id":286435,"singleSection":false});				  						galleries[286436] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Studio Portraits","link":"gallery_286436.html","maxRecords":0.0,"photoIDs":[5302348.0,5302347.0,5302343.0,5302339.0,5302334.0,5302328.0,5302297.0,5302295.0,5302337.0,5302338.0],"skipIndex":0,"section_code":"gallery","featured_images":5302295.0,"id":286436,"singleSection":false});				  						galleries[301280] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Distractions","link":"gallery_301280.html","maxRecords":0.0,"photoIDs":[],"skipIndex":0,"section_code":"gallery","featured_images":"5447573,5302452,5302425,5302400,5302397,5302393,5302387,5302384,5302374,5302363","id":301280,"singleSection":false});				  						galleries[298247] = clik.newGallery({"parentGallery":301280,"usePopups":true,"title":"Seascapes","link":"gallery_298247.html","maxRecords":0.0,"photoIDs":[5302397.0,5302393.0,5302425.0,5302400.0],"skipIndex":0,"section_code":"gallery","featured_images":"5302425,5302400,5302397,5302393","id":298247,"singleSection":false});				  						galleries[298246] = clik.newGallery({"parentGallery":301280,"usePopups":true,"title":"Landscape Photography","link":"gallery_298246.html","maxRecords":0.0,"photoIDs":[5447573.0,5302374.0,5302363.0],"skipIndex":0,"section_code":"gallery","featured_images":"5447573,5302374,5302363","id":298246,"singleSection":false});				  						galleries[325362] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Track Days","link":"gallery_325362.html","maxRecords":0.0,"photoIDs":[],"skipIndex":0,"section_code":"gallery","featured_images":5523216.0,"id":325362,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '6879243,5302374,5302348,5302363,5302347,5302343,5302339,5302334,6879238,5514000,5446519,6827267,5302272,5302198,5302205,6827240';
imageSets[2] = '5523216,6860536,5302295,5720136,5446519';
imageSets[3] = '5302348,5302297,5302295';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/malcolmh/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/malcolmh/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/malcolmh/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/malcolmh/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/malcolmh/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/malcolmh/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/malcolmh/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/malcolmh/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/malcolmh/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/malcolmh/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/malcolmh/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/malcolmh/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/malcolmh/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/malcolmh/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/malcolmh/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/malcolmh/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/malcolmh/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/malcolmh/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/malcolmh/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/malcolmh/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/malcolmh/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/malcolmh/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/malcolmh/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/malcolmh/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/malcolmh/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/malcolmh/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/malcolmh/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 = 'Hampshire Wedding and Portrait Photographer: ' + 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;
	}
}

			

