window.thumbnails = {};
															thumbnails[9082648] = clik.newPhoto({"id":9082648,"src":"back-flip-arran-powley_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"Back Flip Arran Powley","height":173});
															thumbnails[9082654] = clik.newPhoto({"id":9082654,"src":"cliff-hanger-dan-whitby_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"Cliff Hanger Dan Whitby","height":173});
															thumbnails[9082666] = clik.newPhoto({"id":9082666,"src":"cliff-hanger-dan-whitby-2_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"Cliff Hanger Dan Whitby","height":173});
															thumbnails[9082670] = clik.newPhoto({"id":9082670,"src":"cordova-arran-powley_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"Cordova Arran Powley","height":98});
															thumbnails[9082673] = clik.newPhoto({"id":9082673,"src":"double-can-arran-powley_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"Double Can Arran Powley","height":173});
															thumbnails[9082676] = clik.newPhoto({"id":9082676,"src":"double-grab-samson-eaton_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"Double Grab Samson Eaton","height":98});
															thumbnails[9082682] = clik.newPhoto({"id":9082682,"src":"hart-attack-arran-powley_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"Hart Attack Arran Powley","height":173});
															thumbnails[9082695] = clik.newPhoto({"id":9082695,"src":"heal-clicker-arran-powley_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"Heal Clicker Arran Powley","height":173});
															thumbnails[9082699] = clik.newPhoto({"id":9082699,"src":"indian-air-samson-eaton_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"Indian Air Samson Eaton","height":98});
															thumbnails[9082700] = clik.newPhoto({"id":9082700,"src":"kiss-of-death-samson-eaton_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"Kiss of Death Samson Eaton","height":173});
															thumbnails[9082705] = clik.newPhoto({"id":9082705,"src":"kiss-of-death-samson-eaton-2_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"Kiss of Death Samson Eaton","height":173});
															thumbnails[9082720] = clik.newPhoto({"id":9082720,"src":"lazy-boy-samson-eaton_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"Lazy Boy Samson Eaton","height":98});
															thumbnails[9082762] = clik.newPhoto({"id":9082762,"src":"lazy-boy-samson-eaton-2_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"Lazy Boy Samson Eaton","height":98});
															thumbnails[9082765] = clik.newPhoto({"id":9082765,"src":"nac-nac-arran-powley_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"Nac Nac Arran Powley","height":98});
															thumbnails[9082770] = clik.newPhoto({"id":9082770,"src":"no-footer-arran-powley_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"No Footer Arran Powley","height":98});
															thumbnails[9082774] = clik.newPhoto({"id":9082774,"src":"one-handed-hart-attack-dan-whitby_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"One Handed Hart Attack Dan Whitby","height":173});
															thumbnails[9082776] = clik.newPhoto({"id":9082776,"src":"one-handed-hart-attack-dan-whitby-2_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"One Handed Hart Attack Dan Whitby","height":173});
															thumbnails[9082783] = clik.newPhoto({"id":9082783,"src":"rock-solid-dan-whitby_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"Rock Solid Dan Whitby","height":98});
															thumbnails[9082789] = clik.newPhoto({"id":9082789,"src":"seat-grab-indian-air-dan-whitby_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"Seat Grab Indian Air Dan Whitby","height":173});
															thumbnails[9082791] = clik.newPhoto({"id":9082791,"src":"shaolin-arran-powley_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"Shaolin Dan Whitby","height":173});
															thumbnails[9082796] = clik.newPhoto({"id":9082796,"src":"stale-fish-arran-powley_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"Stale Fish Arran Powley","height":173});
															thumbnails[9082802] = clik.newPhoto({"id":9082802,"src":"stripper-arran-powley_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"Stripper Arran Powley","height":98});
															thumbnails[9082812] = clik.newPhoto({"id":9082812,"src":"switch-blade-samson-eaton_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"Switch Blade Samson Eaton","height":173});
															thumbnails[9082822] = clik.newPhoto({"id":9082822,"src":"switch-blade-samson-eaton-2_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"Switch Blade Samson Eaton","height":173});
															thumbnails[9082838] = clik.newPhoto({"id":9082838,"src":"tsunami-dan-whitby_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"Tsunami Dan Whitby","height":195});
															thumbnails[9082852] = clik.newPhoto({"id":9082852,"src":"whip-dan-whitby_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"Whip Dan Whitby","height":98});
															thumbnails[9082868] = clik.newPhoto({"id":9082868,"src":"whip-samson-eaton_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"Whip Samson Eaton","height":173});
															thumbnails[9005242] = clik.newPhoto({"id":9005242,"src":"paul_hanks_thumb.jpg","galleries_id":471566,"server_id":15,"link":"photo_9005242.html","width":130,"caption":"","height":98});
															thumbnails[8650549] = clik.newPhoto({"id":8650549,"src":"Beetle_web_thumb.jpg","galleries_id":471566,"server_id":15,"link":"photo_8650549.html","width":130,"caption":"","height":98});
															thumbnails[8961856] = clik.newPhoto({"id":8961856,"src":"IMG_5798_thumb.jpg","galleries_id":471566,"server_id":15,"link":"photo_8961856.html","width":130,"caption":"","height":98});
															thumbnails[8716228] = clik.newPhoto({"id":8716228,"src":"danwhitby_thumb.jpg","galleries_id":471566,"server_id":15,"link":"photo_8716228.html","width":130,"caption":"","height":173});
															thumbnails[9005241] = clik.newPhoto({"id":9005241,"src":"fmx_thumb.jpg","galleries_id":471566,"server_id":15,"link":"photo_9005241.html","width":130,"caption":"","height":98});
															thumbnails[8961890] = clik.newPhoto({"id":8961890,"src":"Penny_thumb.jpg","galleries_id":471566,"server_id":15,"link":"photo_8961890.html","width":130,"caption":"","height":98});
															thumbnails[8650563] = clik.newPhoto({"id":8650563,"src":"white_GTRweb_thumb.jpg","galleries_id":471566,"server_id":15,"link":"photo_8650563.html","width":130,"caption":"","height":98});
															thumbnails[8650558] = clik.newPhoto({"id":8650558,"src":"RR_S1000_2_web_thumb.jpg","galleries_id":471566,"server_id":15,"link":"photo_8650558.html","width":130,"caption":"","height":98});
															thumbnails[8960166] = clik.newPhoto({"id":8960166,"src":"Hut_web_thumb.jpg","galleries_id":471566,"server_id":15,"link":"photo_8960166.html","width":130,"caption":"","height":98});
															thumbnails[8650546] = clik.newPhoto({"id":8650546,"src":"BMW_web_thumb.jpg","galleries_id":471566,"server_id":15,"link":"photo_8650546.html","width":130,"caption":"","height":98});
															thumbnails[9006071] = clik.newPhoto({"id":9006071,"src":"Samson_Eaton_2_thumb.jpg","galleries_id":471566,"server_id":15,"link":"photo_9006071.html","width":130,"caption":"","height":173});
															thumbnails[8650551] = clik.newPhoto({"id":8650551,"src":"CRF450_web_thumb.jpg","galleries_id":471566,"server_id":15,"link":"photo_8650551.html","width":130,"caption":"","height":98});
															thumbnails[8961801] = clik.newPhoto({"id":8961801,"src":"IMG_0574_thumb.jpg","galleries_id":471566,"server_id":15,"link":"photo_8961801.html","width":130,"caption":"","height":173});
															thumbnails[8961788] = clik.newPhoto({"id":8961788,"src":"harley_641ECD0D-24E8-5EC4-4F1AA16D07A34C53_thumb.jpg","galleries_id":471566,"server_id":15,"link":"photo_8961788.html","width":130,"caption":"","height":98});
															thumbnails[8960133] = clik.newPhoto({"id":8960133,"src":"Hangar_1_web_thumb.jpg","galleries_id":471566,"server_id":15,"link":"photo_8960133.html","width":130,"caption":"","height":98});
															thumbnails[8650794] = clik.newPhoto({"id":8650794,"src":"Hanks_4_web_thumb.jpg","galleries_id":471566,"server_id":15,"link":"photo_8650794.html","width":130,"caption":"","height":98});
															thumbnails[9005248] = clik.newPhoto({"id":9005248,"src":"Fastec_4_web_thumb.jpg","galleries_id":471566,"server_id":15,"link":"photo_9005248.html","width":130,"caption":"","height":98});
															thumbnails[8960116] = clik.newPhoto({"id":8960116,"src":"Samson_web1_thumb.jpg","galleries_id":471566,"server_id":15,"link":"photo_8960116.html","width":130,"caption":"","height":173});
															thumbnails[8650562] = clik.newPhoto({"id":8650562,"src":"TR3_web_thumb.jpg","galleries_id":471566,"server_id":15,"link":"photo_8650562.html","width":130,"caption":"","height":98});
															thumbnails[9005250] = clik.newPhoto({"id":9005250,"src":"IMG_4464_thumb.jpg","galleries_id":471566,"server_id":15,"link":"photo_9005250.html","width":130,"caption":"","height":98});
															thumbnails[8650557] = clik.newPhoto({"id":8650557,"src":"jeep_web_thumb.jpg","galleries_id":471566,"server_id":15,"link":"photo_8650557.html","width":130,"caption":"","height":98});
															thumbnails[8961836] = clik.newPhoto({"id":8961836,"src":"IMG_1021_thumb.jpg","galleries_id":471566,"server_id":15,"link":"photo_8961836.html","width":130,"caption":"","height":98});
															thumbnails[8962113] = clik.newPhoto({"id":8962113,"src":"Hanks_2_web1_thumb.jpg","galleries_id":471566,"server_id":15,"link":"photo_8962113.html","width":130,"caption":"","height":98});
															thumbnails[8960183] = clik.newPhoto({"id":8960183,"src":"Tractor_web_thumb.jpg","galleries_id":471566,"server_id":15,"link":"photo_8960183.html","width":130,"caption":"","height":98});
															thumbnails[8650544] = clik.newPhoto({"id":8650544,"src":"GSXR_web_thumb.jpg","galleries_id":471566,"server_id":15,"link":"photo_8650544.html","width":130,"caption":"","height":98});
															thumbnails[9005253] = clik.newPhoto({"id":9005253,"src":"7_thumb.jpg","galleries_id":471566,"server_id":15,"link":"photo_9005253.html","width":130,"caption":"","height":98});
															thumbnails[8650555] = clik.newPhoto({"id":8650555,"src":"Hanks_3_web_thumb.jpg","galleries_id":471566,"server_id":15,"link":"photo_8650555.html","width":130,"caption":"","height":98});
															thumbnails[8960164] = clik.newPhoto({"id":8960164,"src":"Warren_web_thumb.jpg","galleries_id":471566,"server_id":15,"link":"photo_8960164.html","width":130,"caption":"","height":98});
															thumbnails[9005262] = clik.newPhoto({"id":9005262,"src":"penny_60EF9391-1EC9-DFB6-09D262190AAE5C6B_thumb.jpg","galleries_id":471566,"server_id":15,"link":"photo_9005262.html","width":130,"caption":"","height":98});
															thumbnails[9005266] = clik.newPhoto({"id":9005266,"src":"Untitled-1_thumb.jpg","galleries_id":471566,"server_id":15,"link":"photo_9005266.html","width":130,"caption":"","height":173});
															thumbnails[8960118] = clik.newPhoto({"id":8960118,"src":"IMG_0863_thumb.jpg","galleries_id":472752,"server_id":15,"link":"photo_8960118.html","width":130,"caption":"","height":173});
															thumbnails[8960122] = clik.newPhoto({"id":8960122,"src":"Fastec_1_web_thumb.jpg","galleries_id":472752,"server_id":15,"link":"photo_8960122.html","width":130,"caption":"","height":98});
															thumbnails[8960246] = clik.newPhoto({"id":8960246,"src":"_MG_3220_thumb.jpg","galleries_id":472752,"server_id":15,"link":"photo_8960246.html","width":130,"caption":"","height":87});
															thumbnails[8961235] = clik.newPhoto({"id":8961235,"src":"chris_birch_thumb.jpg","galleries_id":472752,"server_id":15,"link":"photo_8961235.html","width":130,"caption":"","height":173});
															thumbnails[8962011] = clik.newPhoto({"id":8962011,"src":"IMG_8731_thumb.jpg","galleries_id":472752,"server_id":15,"link":"photo_8962011.html","width":130,"caption":"","height":173});
															thumbnails[9005937] = clik.newPhoto({"id":9005937,"src":"IMG_5733_thumb.jpg","galleries_id":472752,"server_id":15,"link":"photo_9005937.html","width":130,"caption":"","height":98});
															thumbnails[9006017] = clik.newPhoto({"id":9006017,"src":"IMG_2690_thumb.jpg","galleries_id":472752,"server_id":15,"link":"photo_9006017.html","width":130,"caption":"","height":98});
															thumbnails[9006102] = clik.newPhoto({"id":9006102,"src":"jenner_thumb.jpg","galleries_id":472752,"server_id":15,"link":"photo_9006102.html","width":130,"caption":"","height":98});
															thumbnails[9006116] = clik.newPhoto({"id":9006116,"src":"IMG_5767_2_thumb.jpg","galleries_id":472752,"server_id":15,"link":"photo_9006116.html","width":130,"caption":"","height":98});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[472752] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"carousel images (all)","link":"Images.html","maxRecords":0.0,"photoIDs":[8960118.0,8960122.0,8960246.0,8961235.0,8962011.0,9005937.0,9006017.0,9006102.0,9006116.0],"skipIndex":0,"section_code":"Images","featured_images":"9006116,9006102,9006017,9005937,8962011,8961235,8960246,8960122,8960118","id":472752,"singleSection":true});				  						galleries[471566] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"portfolio","link":"Portfolio.html","maxRecords":0.0,"photoIDs":[9005242.0,8650549.0,8961856.0,8716228.0,9005241.0,8961890.0,8650563.0,8650558.0,8960166.0,8650546.0,9006071.0,8650551.0,8961801.0,8961788.0,8960133.0,8650794.0,9005248.0,8960116.0,8650562.0,9005250.0,8650557.0,8961836.0,8962113.0,8960183.0,8650544.0,9005253.0,8650555.0,8960164.0,9005262.0,9005266.0],"skipIndex":0,"section_code":"Portfolio","featured_images":"9006071,9005266,9005262,9005253,9005250,9005248,9005242,9005241,8962113,8961890","id":471566,"singleSection":true});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[247010] = '9006116,9006102,9006017,9005937,8960246,8961856';
imageSets[246960] = '8960122,8650549,8961890,8650551,8650557,8960183';
imageSets[1] = '9005937,8650549,8961856,8650563,8650558,8650551,8961788,8650557,8650555';
imageSets[3] = '9082868,9082852,9082838,9082822,9082812,9082802,9082796,9082791,9082789,9082783,9082776,9082774,9082770,9082765,9082762,9082720,9082705,9082700,9082699,9082695,9082682,9082676,9082673,9082670,9082666,9082654,9082648,9006116,9006102,9006071,9006017,9005937,9005266,9005262,9005253,9005250,9005248,9005242,9005241,8962113,8962011,8961890,8961856,8961836,8961801,8961788,8961235,8960246,8960183,8960166';
imageSets[247577] = '9082868,9082852,9082838,9082822,9082812,9082802,9082796,9082791,9082789,9082783,9082776,9082774,9082770,9082765,9082762,9082720,9082705,9082700,9082699,9082695,9082682,9082676,9082673,9082670,9082666,9082654,9082648';
imageSets[246920] = '8962011,8961235,8960118,8716228,9006071,8960116';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/jules73/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/jules73/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/jules73/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/jules73/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/jules73/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/jules73/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/jules73/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/jules73/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/jules73/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/jules73/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/jules73/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/jules73/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/jules73/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/jules73/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/jules73/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/jules73/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/jules73/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/jules73/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/jules73/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/jules73/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/jules73/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/jules73/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/jules73/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/jules73/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/jules73/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/jules73/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/jules73/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 += 'Portfolio.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 && 'Portfolio' != '') {
					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 = 'Julian Dann 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="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="JULES73">';
			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;
	}
}

			

