window.thumbnails = {};
															thumbnails[95652] = clik.newPhoto({"id":95652,"src":"101_thumb.jpg","galleries_id":8767,"server_id":18,"link":"photo_95652.html","width":130,"caption":"","height":195});
															thumbnails[97047] = clik.newPhoto({"id":97047,"src":"jennifer 1_thumb.jpg","galleries_id":8772,"server_id":18,"link":"photo_97047.html","width":130,"caption":"Jennifer","height":87});
															thumbnails[102961] = clik.newPhoto({"id":102961,"src":"8_thumb.jpg","galleries_id":8772,"server_id":18,"link":"photo_102961.html","width":130,"caption":"Jennifer","height":298});
															thumbnails[1653458] = clik.newPhoto({"id":1653458,"src":"2_thumb.jpg","galleries_id":8767,"server_id":18,"link":"photo_1653458.html","width":130,"caption":"","height":195});
															thumbnails[1653463] = clik.newPhoto({"id":1653463,"src":"3_thumb.jpg","galleries_id":8767,"server_id":18,"link":"photo_1653463.html","width":130,"caption":"","height":195});
															thumbnails[1653467] = clik.newPhoto({"id":1653467,"src":"7_thumb.jpg","galleries_id":8767,"server_id":18,"link":"photo_1653467.html","width":130,"caption":"","height":130});
															thumbnails[1968275] = clik.newPhoto({"id":1968275,"src":"_MG_25701_thumb.jpg","galleries_id":8771,"server_id":18,"link":"photo_1968275.html","width":130,"caption":"Ethan","height":195});
															thumbnails[1968278] = clik.newPhoto({"id":1968278,"src":"_MG_2587_thumb.jpg","galleries_id":8771,"server_id":18,"link":"photo_1968278.html","width":130,"caption":"Ethan","height":130});
															thumbnails[2641226] = clik.newPhoto({"id":2641226,"src":"034_thumb.jpg","galleries_id":8772,"server_id":18,"link":"photo_2641226.html","width":130,"caption":"Rachel","height":87});
															thumbnails[2641605] = clik.newPhoto({"id":2641605,"src":"0131_thumb.jpg","galleries_id":8767,"server_id":18,"link":"photo_2641605.html","width":130,"caption":"Sam & Gemma","height":130});
															thumbnails[2641703] = clik.newPhoto({"id":2641703,"src":"0012_thumb.jpg","galleries_id":8767,"server_id":18,"link":"photo_2641703.html","width":130,"caption":"Tom & Su","height":87});
															thumbnails[2641705] = clik.newPhoto({"id":2641705,"src":"002_thumb.jpg","galleries_id":8767,"server_id":18,"link":"photo_2641705.html","width":130,"caption":"Tom & Sue","height":195});
															thumbnails[2641709] = clik.newPhoto({"id":2641709,"src":"003_thumb.jpg","galleries_id":8771,"server_id":18,"link":"photo_2641709.html","width":130,"caption":"","height":195});
															thumbnails[3259208] = clik.newPhoto({"id":3259208,"src":"Rachel_Jane_570285_thumb.jpg","galleries_id":8772,"server_id":18,"link":"photo_3259208.html","width":130,"caption":"","height":85});
															thumbnails[3269542] = clik.newPhoto({"id":3269542,"src":"site1_thumb.jpg","galleries_id":8772,"server_id":18,"link":"photo_3269542.html","width":130,"caption":"","height":87});
															thumbnails[3269742] = clik.newPhoto({"id":3269742,"src":"41_1_thumb.jpg","galleries_id":8767,"server_id":18,"link":"photo_3269742.html","width":130,"caption":"","height":195});
															thumbnails[3269745] = clik.newPhoto({"id":3269745,"src":"52_thumb.jpg","galleries_id":8767,"server_id":18,"link":"photo_3269745.html","width":130,"caption":"","height":195});
															thumbnails[3491250] = clik.newPhoto({"id":3491250,"src":"0031_thumb.jpg","galleries_id":8771,"server_id":18,"link":"photo_3491250.html","width":130,"caption":"","height":195});
															thumbnails[3626938] = clik.newPhoto({"id":3626938,"src":"_MG_8350_pp_thumb.jpg","galleries_id":8772,"server_id":18,"link":"photo_3626938.html","width":130,"caption":"Micky","height":195});
															thumbnails[3626942] = clik.newPhoto({"id":3626942,"src":"_MG_8352_pp_thumb.jpg","galleries_id":8772,"server_id":18,"link":"photo_3626942.html","width":130,"caption":"Micky","height":195});
															thumbnails[3631620] = clik.newPhoto({"id":3631620,"src":"CRW_3769b-Edit_pp_thumb.jpg","galleries_id":8772,"server_id":18,"link":"photo_3631620.html","width":130,"caption":"Micky","height":195});
															thumbnails[4903014] = clik.newPhoto({"id":4903014,"src":"021_thumb.jpg","galleries_id":8767,"server_id":18,"link":"photo_4903014.html","width":130,"caption":"","height":195});
															thumbnails[4903102] = clik.newPhoto({"id":4903102,"src":"_MG_3937_thumb.jpg","galleries_id":8767,"server_id":18,"link":"photo_4903102.html","width":130,"caption":"Adrian & Claire","height":87});
															thumbnails[4903103] = clik.newPhoto({"id":4903103,"src":"_MG_4099_thumb.jpg","galleries_id":8767,"server_id":18,"link":"photo_4903103.html","width":130,"caption":"Adrian & Claire","height":87});
															thumbnails[4903111] = clik.newPhoto({"id":4903111,"src":"22_thumb.jpg","galleries_id":8771,"server_id":18,"link":"photo_4903111.html","width":130,"caption":"","height":214});
															thumbnails[4903112] = clik.newPhoto({"id":4903112,"src":"037_thumb.jpg","galleries_id":8767,"server_id":18,"link":"photo_4903112.html","width":130,"caption":"Natalie","height":195});
															thumbnails[4903113] = clik.newPhoto({"id":4903113,"src":"052_thumb.jpg","galleries_id":8767,"server_id":18,"link":"photo_4903113.html","width":130,"caption":"Alan & Natalie","height":87});
															thumbnails[4903116] = clik.newPhoto({"id":4903116,"src":"056_thumb.jpg","galleries_id":8767,"server_id":18,"link":"photo_4903116.html","width":130,"caption":"Alan & Natalie","height":87});
															thumbnails[4903118] = clik.newPhoto({"id":4903118,"src":"087_thumb.jpg","galleries_id":8767,"server_id":18,"link":"photo_4903118.html","width":130,"caption":"Alan & Natalie","height":87});
															thumbnails[4903121] = clik.newPhoto({"id":4903121,"src":"IMG_49772_thumb.jpg","galleries_id":8772,"server_id":18,"link":"photo_4903121.html","width":130,"caption":"Rachel","height":195});
															thumbnails[4903122] = clik.newPhoto({"id":4903122,"src":"IMG_49822_thumb.jpg","galleries_id":8772,"server_id":18,"link":"photo_4903122.html","width":130,"caption":"Rachel","height":195});
															thumbnails[4903124] = clik.newPhoto({"id":4903124,"src":"IMG_5270_thumb.jpg","galleries_id":8767,"server_id":18,"link":"photo_4903124.html","width":130,"caption":"","height":195});
															thumbnails[4903137] = clik.newPhoto({"id":4903137,"src":"IMG_6490_thumb.jpg","galleries_id":8767,"server_id":18,"link":"photo_4903137.html","width":130,"caption":"Maryan","height":195});
															thumbnails[4903138] = clik.newPhoto({"id":4903138,"src":"IMG_6618_thumb.jpg","galleries_id":8767,"server_id":18,"link":"photo_4903138.html","width":130,"caption":"","height":195});
															thumbnails[4903139] = clik.newPhoto({"id":4903139,"src":"IMG_7898_thumb.jpg","galleries_id":8771,"server_id":18,"link":"photo_4903139.html","width":130,"caption":"","height":195});
															thumbnails[4903141] = clik.newPhoto({"id":4903141,"src":"IMG_8971_thumb.jpg","galleries_id":8767,"server_id":18,"link":"photo_4903141.html","width":130,"caption":"Alan & Natalie","height":195});
															thumbnails[4903222] = clik.newPhoto({"id":4903222,"src":"_MG_8392-Edit_thumb.jpg","galleries_id":8771,"server_id":18,"link":"photo_4903222.html","width":130,"caption":"Micky","height":195});
															thumbnails[5629818] = clik.newPhoto({"id":5629818,"src":"3_529855AC-1D09-001F-990361753E9A3B7F_thumb.jpg","galleries_id":8771,"server_id":18,"link":"photo_5629818.html","width":130,"caption":"Chloe","height":87});
															thumbnails[5629826] = clik.newPhoto({"id":5629826,"src":"12_529C5829-1D09-001F-99DD554F2D440F1F_thumb.jpg","galleries_id":8771,"server_id":18,"link":"photo_5629826.html","width":130,"caption":"Chloe and Madison","height":87});
															thumbnails[5629829] = clik.newPhoto({"id":5629829,"src":"4_thumb.jpg","galleries_id":8771,"server_id":18,"link":"photo_5629829.html","width":130,"caption":"Chloe","height":87});
															thumbnails[8498859] = clik.newPhoto({"id":8498859,"src":"IMG_0368a_thumb.jpg","galleries_id":8771,"server_id":18,"link":"photo_8498859.html","width":130,"caption":"","height":161});
															thumbnails[8498862] = clik.newPhoto({"id":8498862,"src":"IMG_5780_thumb.jpg","galleries_id":8771,"server_id":18,"link":"photo_8498862.html","width":130,"caption":"","height":195});
															thumbnails[8498864] = clik.newPhoto({"id":8498864,"src":"IMG_5733_thumb.jpg","galleries_id":8771,"server_id":18,"link":"photo_8498864.html","width":130,"caption":"","height":195});
															thumbnails[8498878] = clik.newPhoto({"id":8498878,"src":"IMG_5665a_thumb.jpg","galleries_id":8771,"server_id":18,"link":"photo_8498878.html","width":130,"caption":"","height":195});
															thumbnails[8498880] = clik.newPhoto({"id":8498880,"src":"IMG_0356_thumb.jpg","galleries_id":8771,"server_id":18,"link":"photo_8498880.html","width":130,"caption":"","height":87});
															thumbnails[4903106] = clik.newPhoto({"id":4903106,"src":"_MG_8773_thumb.jpg","galleries_id":8771,"server_id":18,"link":"photo_4903106.html","width":130,"caption":"","height":87});
															thumbnails[1104217] = clik.newPhoto({"id":1104217,"src":"_MG_2381_thumb.jpg","galleries_id":8771,"server_id":18,"link":"photo_1104217.html","width":130,"caption":"","height":87});
															thumbnails[380466] = clik.newPhoto({"id":380466,"src":"41_thumb.jpg","galleries_id":8771,"server_id":18,"link":"photo_380466.html","width":130,"caption":"Kelly Holmes","height":195});
															thumbnails[157274] = clik.newPhoto({"id":157274,"src":"6a_thumb.jpg","galleries_id":8771,"server_id":18,"link":"photo_157274.html","width":130,"caption":"Erin","height":170});
															thumbnails[2021077] = clik.newPhoto({"id":2021077,"src":"51_thumb.jpg","galleries_id":21665,"server_id":18,"link":"photo_2021077.html","width":130,"caption":"Francesca","height":195});
															thumbnails[2021110] = clik.newPhoto({"id":2021110,"src":"8_1_thumb.jpg","galleries_id":21665,"server_id":18,"link":"photo_2021110.html","width":130,"caption":"Francesca","height":195});
															thumbnails[2021112] = clik.newPhoto({"id":2021112,"src":"12_thumb.jpg","galleries_id":21665,"server_id":18,"link":"photo_2021112.html","width":130,"caption":"Francesca","height":195});
															thumbnails[2021116] = clik.newPhoto({"id":2021116,"src":"34_thumb.jpg","galleries_id":21665,"server_id":18,"link":"photo_2021116.html","width":130,"caption":"Francesca","height":195});
															thumbnails[4903100] = clik.newPhoto({"id":4903100,"src":"_MG_2859_thumb.jpg","galleries_id":21665,"server_id":18,"link":"photo_4903100.html","width":130,"caption":"Hastings Beach","height":135});
															thumbnails[4903107] = clik.newPhoto({"id":4903107,"src":"4a_thumb.jpg","galleries_id":21665,"server_id":18,"link":"photo_4903107.html","width":130,"caption":"","height":130});
															thumbnails[4903108] = clik.newPhoto({"id":4903108,"src":"7_1_thumb.jpg","galleries_id":21665,"server_id":18,"link":"photo_4903108.html","width":130,"caption":"","height":130});
															thumbnails[4903109] = clik.newPhoto({"id":4903109,"src":"8a_thumb.jpg","galleries_id":21665,"server_id":18,"link":"photo_4903109.html","width":130,"caption":"","height":130});
															thumbnails[4903120] = clik.newPhoto({"id":4903120,"src":"Eastbourne2_thumb.jpg","galleries_id":21665,"server_id":18,"link":"photo_4903120.html","width":130,"caption":"Eastbourne Roofscape","height":21});
															thumbnails[4903224] = clik.newPhoto({"id":4903224,"src":"IMG_7342_thumb.jpg","galleries_id":21665,"server_id":18,"link":"photo_4903224.html","width":130,"caption":"","height":195});
															thumbnails[4903225] = clik.newPhoto({"id":4903225,"src":"IMG_7336_thumb.jpg","galleries_id":21665,"server_id":18,"link":"photo_4903225.html","width":130,"caption":"","height":195});
															thumbnails[4903243] = clik.newPhoto({"id":4903243,"src":"Untitled-1_thumb.jpg","galleries_id":21665,"server_id":18,"link":"photo_4903243.html","width":130,"caption":"","height":156});
															thumbnails[4903245] = clik.newPhoto({"id":4903245,"src":"Untitled-2_thumb.jpg","galleries_id":21665,"server_id":18,"link":"photo_4903245.html","width":130,"caption":"","height":156});
															thumbnails[4903246] = clik.newPhoto({"id":4903246,"src":"Untitled-14_thumb.jpg","galleries_id":21665,"server_id":18,"link":"photo_4903246.html","width":130,"caption":"","height":156});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[8772] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Model Portfolios","link":"gallery_8772.html","maxRecords":0.0,"photoIDs":[97047.0,102961.0,2641226.0,3259208.0,3269542.0,3626938.0,3626942.0,3631620.0,4903121.0,4903122.0],"skipIndex":0,"section_code":"gallery","featured_images":"3626938,2641226","id":8772,"singleSection":false});				  						galleries[21665] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"My Personal Work","link":"section38093.html","maxRecords":0.0,"photoIDs":[2021077.0,2021110.0,2021112.0,2021116.0,4903100.0,4903107.0,4903108.0,4903109.0,4903120.0,4903224.0,4903225.0,4903243.0,4903245.0,4903246.0],"skipIndex":0,"section_code":"section38093","featured_images":2021112.0,"id":21665,"singleSection":true});				  						galleries[8771] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Portraiture","link":"gallery_8771.html","maxRecords":0.0,"photoIDs":[1968275.0,1968278.0,2641709.0,3491250.0,4903111.0,4903139.0,4903222.0,5629818.0,5629826.0,5629829.0,8498859.0,8498862.0,8498864.0,8498878.0,8498880.0,4903106.0,1104217.0,380466.0,157274.0],"skipIndex":0,"section_code":"gallery","featured_images":"3491250,1968275","id":8771,"singleSection":false});				  						galleries[8767] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Weddings","link":"gallery_8767.html","maxRecords":0.0,"photoIDs":[95652.0,1653458.0,1653463.0,1653467.0,2641605.0,2641703.0,2641705.0,3269742.0,3269745.0,4903014.0,4903102.0,4903103.0,4903112.0,4903113.0,4903116.0,4903118.0,4903124.0,4903137.0,4903138.0,4903141.0],"skipIndex":0,"section_code":"gallery","featured_images":"4903141,4903138,4903137,4903124,4903118,4903116,4903113,4903112,4903103,4903102","id":8767,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '4903222,4903103,3631620,3626942,3626938,2641703,2641605,2021116,2021112,2021077,1968275,1653467,1653458,4903106,1104217,380466,157274';
imageSets[2] = '3626938,3491250,2641226,2021112,1968275';
imageSets[3] = '8498880,8498878,8498864,8498862,8498859,5629829,5629826,5629818,4903246,4903245,4903243,4903225,4903224,4903222,4903141,4903139,4903138,4903137,4903124,4903122,4903121,4903120,4903118,4903116,4903113,4903112,4903111,4903109,4903108,4903107,4903106,4903103,4903102,4903100,4903014,3631620,3626942,3626938,3491250,3269745,3269742,3269542,3259208,2641709,2641705,2641703,2641605,2641226,2021116,2021112';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'www12.clikpic.com/PaulBratby/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/PaulBratby/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/PaulBratby/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/PaulBratby/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/PaulBratby/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/PaulBratby/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/PaulBratby/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/PaulBratby/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/PaulBratby/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/PaulBratby/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/PaulBratby/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/PaulBratby/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/PaulBratby/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/PaulBratby/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/PaulBratby/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/PaulBratby/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/PaulBratby/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/PaulBratby/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/PaulBratby/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/PaulBratby/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/PaulBratby/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/PaulBratby/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/PaulBratby/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/PaulBratby/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/PaulBratby/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 && backgrounds[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 = 'Paul Bratby 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>Paul Bratby ARPS </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> &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.item_price !== '' || this.payment_groups_id !== '') {
																		temp += '<form id="paymentForm" style="margin:0px;border:0px;" name="paymentForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
			temp += '<input type="hidden" name="item_name" value="'+item_name+'">';
			ref = '';
			if(this.photo_ref != ''){
				ref = this.photo_ref+' - '+this.caption;
			}
			else{
				ref = this.id+' - '+this.caption;
			}
			price = amount;								temp += '<input type="hidden" name="cmd" value="_cart">';
					temp += '<input type="hidden" name="business" value="">';
					temp += '<input type="hidden" name="currency_code" value="GBP">';
					temp += '<input type="hidden" name="add" value="1">';
													temp += '<input type="hidden" name="amount" value="'+amount+'">';
					temp += '<input type="hidden" name="item_number" value="'+ref+'">';
													temp += '<input type=\"Submit\" value=\"Add to cart\" id=\"paymentAddButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
										temp += '</form>';
										temp += '<form id="paymentCartForm" style="margin:0px;" name="paymentCartForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
				temp += '<input type="hidden" name="cmd" value="_cart">';
				temp += '<input type="hidden" name="business" value="">';
				temp += '<input type="hidden" name="display" value="1">';
				temp += '<input type=\"Submit\" value=\"View cart\" id=\"paymentViewButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
				temp += '</form>';
						temp += '<div class="clearing">&nbsp;</div>';
	}
	return temp;};

/***************************************************************************
* Pick a photo at random from the featured images of a gallery.            *
* Gallery_id = id of gallery to choose,                                    *
* img = reference to html image in                                         *
* which to show image                                                      *
***************************************************************************/
function showGalleryImage(gallery_id, img, updateLink) {
	
	if(img){
		if (location.hash.match('galleries_id=' + gallery_id) && (imageID = location.hash.match('.*photos_id=(.+)$'))) {
		  	imageID = imageID[1];
		} else {
		  	imageID = randomListVal(galleries[gallery_id].featured_images);
		}
		
		if (imageID != 0) {
			img.src = thumbnails[imageID].src;
			img.width = thumbnails[imageID].width;
			img.height = thumbnails[imageID].height;
			img.alt = galleries[gallery_id].title;
			if (updateLink) {
				$(img).parent().attr({					title: galleries[gallery_id].title				}).filter(function(){return this.href;}).attr({					href: thumbnails[imageID].fnGalleryLink(gallery_id)				});
			}
		}
	}
}

/***************************************************************************
* If we have dynamic HTML, replace the galleries link with a list that     *
* doesn't include thecurrent gallery                                       *
***************************************************************************/
function showGalleries(gallery_id) {
		
	
	if (!basic) {
		temp = '';
		for (i = 0; i < galleries.length; i++) {
						
			
			if (galleries[i].id != gallery_id) {
								
				if (temp != '') {
					temp += ' | ';
				}
								temp += '<a href="' + galleries[i].section_code + '_' + galleries[i].id + '.html">' + galleries[i].title + '</a>';
							}
		}
		document.all.galleryLinks.innerHTML = 'Other galleries: ' + temp;
	}
}

			

