window.thumbnails = {};
															thumbnails[1894708] = clik.newPhoto({"id":1894708,"src":"Lewis William Bryce 2 600x_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Lewis William Bryce. Born 23rd February 2008, at 18.25pm","height":93});
															thumbnails[5636103] = clik.newPhoto({"id":5636103,"src":"IMG_4004_edit_thumb.jpg","galleries_id":79598,"server_id":1,"link":"photo_5636103.html","width":130,"caption":"Ashness Bridge","height":87});
															thumbnails[5541167] = clik.newPhoto({"id":5541167,"src":"mill_bridge_open_3306_thumb.jpg","galleries_id":299299,"server_id":1,"link":"photo_5541167.html","width":130,"caption":"Gateshead Millenium open at night","height":87});
															thumbnails[5541169] = clik.newPhoto({"id":5541169,"src":"quayside_edit_2_IMG_3207_thumb.jpg","galleries_id":299299,"server_id":1,"link":"photo_5541169.html","width":130,"caption":"TheTyne Bridges at sunset","height":87});
															thumbnails[5541173] = clik.newPhoto({"id":5541173,"src":"quayside_edit__2_IMG_3276_thumb.jpg","galleries_id":299299,"server_id":1,"link":"photo_5541173.html","width":130,"caption":"The Tyne Bridges after sunset","height":87});
															thumbnails[5541175] = clik.newPhoto({"id":5541175,"src":"quayside_edit_IMG_3285_thumb.jpg","galleries_id":299299,"server_id":1,"link":"photo_5541175.html","width":130,"caption":"The Tyne Bridges at night","height":87});
															thumbnails[5541182] = clik.newPhoto({"id":5541182,"src":"St_Marys_Blyth_IMG_edit_3025_thumb.jpg","galleries_id":299297,"server_id":1,"link":"photo_5541182.html","width":130,"caption":"Blyth Coast (long exposure)","height":89});
															thumbnails[5541187] = clik.newPhoto({"id":5541187,"src":"St_Marys_Blyth_IMG_2957_thumb.jpg","galleries_id":299297,"server_id":1,"link":"photo_5541187.html","width":130,"caption":"St Mary's Lighthouse at Dawn.","height":87});
															thumbnails[5541191] = clik.newPhoto({"id":5541191,"src":"St_Marys_Blyth_IMG_2970_thumb.jpg","galleries_id":299297,"server_id":1,"link":"photo_5541191.html","width":130,"caption":"St Mary's Lighthouse from the beach.","height":87});
															thumbnails[5330231] = clik.newPhoto({"id":5330231,"src":"Blyth_Groynes_clarify_edit_IMG_0597_thumb.jpg","galleries_id":299297,"server_id":1,"link":"photo_5330231.html","width":130,"caption":"Blyth Groynes","height":87});
															thumbnails[5330238] = clik.newPhoto({"id":5330238,"src":"St_Marys_IMG_edit_0622_thumb.jpg","galleries_id":299297,"server_id":1,"link":"photo_5330238.html","width":130,"caption":"St Mary's Lighthouse","height":87});
															thumbnails[5333488] = clik.newPhoto({"id":5333488,"src":"St_Marys_IMG_bw_0628_thumb.jpg","galleries_id":299297,"server_id":1,"link":"photo_5333488.html","width":130,"caption":"St Mary's Lighthouse B&W","height":83});
															thumbnails[5304358] = clik.newPhoto({"id":5304358,"src":"blyth_30_12_09_rgb__008_600x_edit_thumb.jpg","galleries_id":299297,"server_id":1,"link":"photo_5304358.html","width":130,"caption":"Blyth South Pier","height":86});
															thumbnails[5304365] = clik.newPhoto({"id":5304365,"src":"blyth_30_12_09_srgb__005_edit_clarify__crop_600x_thumb.jpg","galleries_id":299297,"server_id":1,"link":"photo_5304365.html","width":130,"caption":"Blyth Beach","height":86});
															thumbnails[5304485] = clik.newPhoto({"id":5304485,"src":"blyth_30_12_09_srgb__006_edit_600x1_thumb.jpg","galleries_id":299297,"server_id":1,"link":"photo_5304485.html","width":130,"caption":"Under Blyth South Pier","height":82});
															thumbnails[5333524] = clik.newPhoto({"id":5333524,"src":"10_stop__IMG_0089_edit_1_thumb.jpg","galleries_id":299297,"server_id":1,"link":"photo_5333524.html","width":130,"caption":"Marsden Bay","height":88});
															thumbnails[1502349] = clik.newPhoto({"id":1502349,"src":"IR8T4842-01 edit 2 800x_thumb.jpg","galleries_id":299297,"server_id":1,"link":"photo_1502349.html","width":130,"caption":"Roker Pier at Sunrise.","height":87});
															thumbnails[1458751] = clik.newPhoto({"id":1458751,"src":"IR8T4391-01_thumb.jpg","galleries_id":79617,"server_id":1,"link":"photo_1458751.html","width":130,"caption":"Trackrod Rally Yorkshire 2007","height":87});
															thumbnails[1075890] = clik.newPhoto({"id":1075890,"src":"Blyth Beach1_thumb.jpg","galleries_id":299297,"server_id":1,"link":"photo_1075890.html","width":130,"caption":"Blyth Beach","height":89});
															thumbnails[1075913] = clik.newPhoto({"id":1075913,"src":"Gateshead Millenium Bridge_thumb.jpg","galleries_id":299299,"server_id":1,"link":"photo_1075913.html","width":130,"caption":"Gateshead Millenium Bridge","height":87});
															thumbnails[1075914] = clik.newPhoto({"id":1075914,"src":"Gateshead Millenium Bridge 2_thumb.jpg","galleries_id":299299,"server_id":1,"link":"photo_1075914.html","width":130,"caption":"Gateshead Millenium Bridge 2","height":87});
															thumbnails[1075917] = clik.newPhoto({"id":1075917,"src":"Penshaw Monument_thumb.jpg","galleries_id":299299,"server_id":1,"link":"photo_1075917.html","width":130,"caption":"Penshaw Monument","height":89});
															thumbnails[1076140] = clik.newPhoto({"id":1076140,"src":"Roker Pier Sunrise 2_thumb.jpg","galleries_id":299297,"server_id":1,"link":"photo_1076140.html","width":130,"caption":"Roker Pier at Sunrise.","height":87});
															thumbnails[1076141] = clik.newPhoto({"id":1076141,"src":"Roker Pier, Sunrise_thumb.jpg","galleries_id":299297,"server_id":1,"link":"photo_1076141.html","width":130,"caption":"Roker Pier at sunrise 2","height":84});
															thumbnails[1076143] = clik.newPhoto({"id":1076143,"src":"Souter Lighthouse_thumb.jpg","galleries_id":299297,"server_id":1,"link":"photo_1076143.html","width":130,"caption":"Souter Lighthouse","height":195});
															thumbnails[1076150] = clik.newPhoto({"id":1076150,"src":"Weasel_thumb.jpg","galleries_id":79511,"server_id":1,"link":"photo_1076150.html","width":130,"caption":"Weasel","height":87});
															thumbnails[1076152] = clik.newPhoto({"id":1076152,"src":"Kingfisher_thumb.jpg","galleries_id":79511,"server_id":1,"link":"photo_1076152.html","width":130,"caption":"Kingfisher","height":87});
															thumbnails[1079759] = clik.newPhoto({"id":1079759,"src":"Kingfisher 2_thumb.jpg","galleries_id":79511,"server_id":1,"link":"photo_1079759.html","width":130,"caption":" \tKingfisher","height":87});
															thumbnails[1079777] = clik.newPhoto({"id":1079777,"src":"Escort vs Healy1_thumb.jpg","galleries_id":79617,"server_id":1,"link":"photo_1079777.html","width":130,"caption":"Mk1 Escort RS Vs Austin Healy","height":75});
															thumbnails[1117390] = clik.newPhoto({"id":1117390,"src":"Kingfisher 500x_thumb.jpg","galleries_id":79511,"server_id":1,"link":"photo_1117390.html","width":130,"caption":"Kingfisher (male juvenile)","height":87});
															thumbnails[1141925] = clik.newPhoto({"id":1141925,"src":"Hakkinen for clik_thumb.jpg","galleries_id":79617,"server_id":1,"link":"photo_1141925.html","width":130,"caption":"Mika Hakkinen DTM","height":87});
															thumbnails[1347659] = clik.newPhoto({"id":1347659,"src":"British Superbikes_thumb.jpg","galleries_id":79617,"server_id":1,"link":"photo_1347659.html","width":130,"caption":"British Superbikes","height":87});
															thumbnails[1453753] = clik.newPhoto({"id":1453753,"src":"Cleadon Mill_thumb.jpg","galleries_id":79598,"server_id":1,"link":"photo_1453753.html","width":130,"caption":"Cleadon Mill","height":87});
															thumbnails[1453866] = clik.newPhoto({"id":1453866,"src":"Fullwell Mill_thumb.jpg","galleries_id":299299,"server_id":1,"link":"photo_1453866.html","width":130,"caption":"Fulwell Mill","height":194});
															thumbnails[1807226] = clik.newPhoto({"id":1807226,"src":"Woodpecker_thumb.jpg","galleries_id":79511,"server_id":1,"link":"photo_1807226.html","width":130,"caption":"Greater Spotted Woodpecker","height":87});
															thumbnails[3121014] = clik.newPhoto({"id":3121014,"src":"6V1F3499 edit black border 800x1_thumb.jpg","galleries_id":79598,"server_id":1,"link":"photo_3121014.html","width":130,"caption":"Derwentwater, Keswick","height":90});
															thumbnails[4979456] = clik.newPhoto({"id":4979456,"src":"Cat_Bells-Keswick_thumb.jpg","galleries_id":79598,"server_id":1,"link":"photo_4979456.html","width":130,"caption":"Cat Bells from Friars Rigg (Keswick)","height":87});
															thumbnails[5237496] = clik.newPhoto({"id":5237496,"src":"south_shields_IMG_0145_edit_600x_thumb.jpg","galleries_id":299297,"server_id":1,"link":"photo_5237496.html","width":130,"caption":"Souter Lighthouse","height":87});
															thumbnails[5237536] = clik.newPhoto({"id":5237536,"src":"IMG_0065_600x_thumb.jpg","galleries_id":299299,"server_id":1,"link":"photo_5237536.html","width":130,"caption":"BALTIC Centre for Contemporary Art","height":87});
															thumbnails[5276551] = clik.newPhoto({"id":5276551,"src":"south_shields_IMG_0227_1024_edit_600x_thumb.jpg","galleries_id":299297,"server_id":1,"link":"photo_5276551.html","width":130,"caption":"St Mary's Lighthouse, Whitley Bay","height":93});
															thumbnails[5300500] = clik.newPhoto({"id":5300500,"src":"marsden_4_stop_nd_27_12_09__005_600x_thumb.jpg","galleries_id":299297,"server_id":1,"link":"photo_5300500.html","width":130,"caption":"Marsden Bay 2","height":194});
															thumbnails[5300502] = clik.newPhoto({"id":5300502,"src":"IMG_0225_600x1_thumb.jpg","galleries_id":299297,"server_id":1,"link":"photo_5300502.html","width":130,"caption":"Marsden Bay 1","height":195});
															thumbnails[5300503] = clik.newPhoto({"id":5300503,"src":"marsden_4x_nd_27_12_09__002_600x_thumb.jpg","galleries_id":79598,"server_id":1,"link":"photo_5300503.html","width":130,"caption":"Marsden Bay 3","height":86});
															thumbnails[5313371] = clik.newPhoto({"id":5313371,"src":"blyth__002_thumb.jpg","galleries_id":299297,"server_id":1,"link":"photo_5313371.html","width":130,"caption":"Blyth South Pier","height":82});
															thumbnails[5313382] = clik.newPhoto({"id":5313382,"src":"blyth__001__edit_thumb.jpg","galleries_id":299297,"server_id":1,"link":"photo_5313382.html","width":130,"caption":"Blyth South Pier","height":82});
															thumbnails[5315205] = clik.newPhoto({"id":5315205,"src":"dunst_castle__003_thumb.jpg","galleries_id":299297,"server_id":1,"link":"photo_5315205.html","width":130,"caption":"Dunstanburgh Castle","height":87});
															thumbnails[5315505] = clik.newPhoto({"id":5315505,"src":"DURHAM_CATHEDRAL_new_attempt_thumb.jpg","galleries_id":79598,"server_id":1,"link":"photo_5315505.html","width":130,"caption":"Durham Cathedral","height":87});
															thumbnails[5315507] = clik.newPhoto({"id":5315507,"src":"penshaw_1_1_2010__010_thumb.jpg","galleries_id":79598,"server_id":1,"link":"photo_5315507.html","width":130,"caption":"Penshaw Monument","height":82});
															thumbnails[5315509] = clik.newPhoto({"id":5315509,"src":"south_shields_IMG_0090_edit_ps_pro_thumb.jpg","galleries_id":299297,"server_id":1,"link":"photo_5315509.html","width":130,"caption":"The Groyne, South Shields","height":83});
															thumbnails[5315516] = clik.newPhoto({"id":5315516,"src":"duns_castle_edit_thumb.jpg","galleries_id":299297,"server_id":1,"link":"photo_5315516.html","width":130,"caption":"Dunstanburgh Castle","height":87});
															thumbnails[5353229] = clik.newPhoto({"id":5353229,"src":"St_Marys_IMG_topaz_colour_jump_edit_0628_thumb.jpg","galleries_id":299297,"server_id":1,"link":"photo_5353229.html","width":130,"caption":"St Mary's Lighthouse","height":87});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[299297] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Coastal Shots","link":"gallery_299297.html","maxRecords":0.0,"photoIDs":[5541182.0,5541187.0,5541191.0,5330231.0,5330238.0,5333488.0,5304358.0,5304365.0,5304485.0,5333524.0,1502349.0,1075890.0,1076140.0,1076141.0,1076143.0,5237496.0,5276551.0,5300500.0,5300502.0,5313371.0,5313382.0,5315205.0,5315509.0,5315516.0,5353229.0],"skipIndex":0,"section_code":"gallery","featured_images":"5541191,5541187,5541182,5353229,5333524,5333488,5330238,5330231,5315516,5315509","id":299297,"singleSection":false});				  						galleries[299299] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Landmarks","link":"gallery_299299.html","maxRecords":0.0,"photoIDs":[5541167.0,5541169.0,5541173.0,5541175.0,1075913.0,1075914.0,1075917.0,1453866.0,5237536.0],"skipIndex":0,"section_code":"gallery","featured_images":"5541175,5541173,5541169,5541167,5237536,1453866,1075917,1075914,1075913","id":299299,"singleSection":false});				  						galleries[79617] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Motorsport","link":"gallery_79617.html","maxRecords":0.0,"photoIDs":[1458751.0,1079777.0,1141925.0,1347659.0],"skipIndex":0,"section_code":"gallery","featured_images":"1458751,1347659,1141925,1079777","id":79617,"singleSection":false});				  						galleries[79511] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Wildlife","link":"gallery_79511.html","maxRecords":0.0,"photoIDs":[1076150.0,1076152.0,1079759.0,1117390.0,1807226.0],"skipIndex":0,"section_code":"gallery","featured_images":"1807226,1117390,1079759,1076152,1076150","id":79511,"singleSection":false});				  						galleries[79598] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Landscape","link":"gallery_79598.html","maxRecords":0.0,"photoIDs":[5636103.0,1453753.0,3121014.0,4979456.0,5300503.0,5315505.0,5315507.0],"skipIndex":0,"section_code":"gallery","featured_images":"5636103,5315507,5315505,5300503,4979456,3121014,1453753","id":79598,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '5636103,5541191,5541187,5541182,5541175,5541173,5541169,5541167,5353229,5333524,5333488,5330238,5330231,5315516,5315509,5315507,5315505,5315205,5313382,5313371,5304485,5304365,5304358,5300503,5300502,5300500,5276551,5237536,5237496,4979456,3121014,1894708,1807226,1502349,1458751,1453866,1453753,1347659,1141925,1117390,1079777,1079759,1076152,1076150,1076143,1076141,1076140,1075917,1075914,1075913';
imageSets[2] = '1894708';
imageSets[3] = '5636103,5541191,5541187,5541182,5541175,5541173,5541169,5541167,5353229,5333524,5333488,5330238,5330231,5315516,5315509,5315507,5315505,5315205,5313382,5313371,5304485,5304365,5304358,5300503,5300502,5300500,5276551,5237536,5237496,4979456,3121014,1894708,1807226,1502349,1458751,1453866,1453753,1347659,1141925,1117390,1079777,1079759,1076152,1076150,1076143,1076141,1076140,1075917,1075914,1075913';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'www12.clikpic.com/KevB/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/KevB/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/KevB/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/KevB/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/KevB/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/KevB/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/KevB/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/KevB/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/KevB/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/KevB/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/KevB/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/KevB/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/KevB/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/KevB/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/KevB/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/KevB/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/KevB/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/KevB/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/KevB/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/KevB/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/KevB/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/KevB/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/KevB/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/KevB/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 = 'Kevin Bryce 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>Kevin Bryce </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.payment_groups_id !== '') {
		temp += '<p>Buy this print online:</p>';
				temp += '<form id="paymentOptions" style="margin:0px;border:0px;" name="paymentOptions">';
											temp += '<select class="paymentlink" name="payment_options_id" onchange="updateItemValues($(this.form).next(\'#paymentForm\')[0],this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value);">';
		
		temp += getPaymentOptions(this.payment_groups_id);
		temp += '</select>';
		temp += '</form>';
				var item_option  = paymentGroups[this.payment_groups_id].options[0];
		if(paymentOptions[item_option]){
			var item_name  = paymentOptions[item_option].payment_option;
			var amount =  paymentOptions[item_option].price;
		}
			}
	else {
		
	}
	if (this.item_price !== '' || this.payment_groups_id !== '') {
																		temp += '<form id="paymentForm" style="margin:0px;border:0px;" name="paymentForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
			temp += '<input type="hidden" name="item_name" value="'+item_name+'">';
			ref = '';
			if(this.photo_ref != ''){
				ref = this.photo_ref+' - '+this.caption;
			}
			else{
				ref = this.id+' - '+this.caption;
			}
			price = amount;								temp += '<input type="hidden" name="cmd" value="_cart">';
					temp += '<input type="hidden" name="business" value="kevb759@msn.com">';
					temp += '<input type="hidden" name="currency_code" value="GBP">';
					temp += '<input type="hidden" name="add" value="1">';
													temp += '<input type="hidden" name="amount" value="'+amount+'">';
					temp += '<input type="hidden" name="item_number" value="'+ref+'">';
													temp += '<input type=\"Submit\" value=\"Add to cart\" id=\"paymentAddButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
										temp += '</form>';
										temp += '<form id="paymentCartForm" style="margin:0px;" name="paymentCartForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
				temp += '<input type="hidden" name="cmd" value="_cart">';
				temp += '<input type="hidden" name="business" value="kevb759@msn.com">';
				temp += '<input type="hidden" name="display" value="1">';
				temp += '<input type=\"Submit\" value=\"View cart\" id=\"paymentViewButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
				temp += '</form>';
						temp += '<div class="clearing">&nbsp;</div>';
	}
	return temp;};

/***************************************************************************
* Pick a photo at random from the featured images of a gallery.            *
* Gallery_id = id of gallery to choose,                                    *
* img = reference to html image in                                         *
* which to show image                                                      *
***************************************************************************/
function showGalleryImage(gallery_id, img, updateLink) {
	
	if(img){
		if (location.hash.match('galleries_id=' + gallery_id) && (imageID = location.hash.match('.*photos_id=(.+)$'))) {
		  	imageID = imageID[1];
		} else {
		  	imageID = randomListVal(galleries[gallery_id].featured_images);
		}
		
		if (imageID != 0) {
			img.src = thumbnails[imageID].src;
			img.width = thumbnails[imageID].width;
			img.height = thumbnails[imageID].height;
			img.alt = galleries[gallery_id].title;
			if (updateLink) {
				$(img).parent().attr({					title: galleries[gallery_id].title				}).filter(function(){return this.href;}).attr({					href: thumbnails[imageID].fnGalleryLink(gallery_id)				});
			}
		}
	}
}

/***************************************************************************
* If we have dynamic HTML, replace the galleries link with a list that     *
* doesn't include thecurrent gallery                                       *
***************************************************************************/
function showGalleries(gallery_id) {
		
	
	if (!basic) {
		temp = '';
		for (i = 0; i < galleries.length; i++) {
						
			
			if (galleries[i].id != gallery_id) {
								
				if (temp != '') {
					temp += ' | ';
				}
								temp += '<a href="' + galleries[i].section_code + '_' + galleries[i].id + '.html">' + galleries[i].title + '</a>';
							}
		}
		document.all.galleryLinks.innerHTML = 'Other galleries: ' + temp;
	}
}

		

