window.thumbnails = {};
															thumbnails[6551764] = clik.newPhoto({"id":6551764,"src":"greenwave_4x3_thumb.jpg","galleries_id":436603,"server_id":15,"link":"photo_6551764.html","width":130,"caption":"Green Water","height":98});
															thumbnails[6031256] = clik.newPhoto({"id":6031256,"src":"osteospermum01_thumb.jpg","galleries_id":273092,"server_id":15,"link":"photo_6031256.html","width":130,"caption":"Osteospermum 1","height":173});
															thumbnails[6031257] = clik.newPhoto({"id":6031257,"src":"osteospermum02_thumb.jpg","galleries_id":273092,"server_id":15,"link":"photo_6031257.html","width":130,"caption":"Osteospermum 2","height":98});
															thumbnails[6031258] = clik.newPhoto({"id":6031258,"src":"wmphoto-gerberapink_3x2_thumb.jpg","galleries_id":273092,"server_id":15,"link":"photo_6031258.html","width":130,"caption":"Gerbera","height":87});
															thumbnails[7090641] = clik.newPhoto({"id":7090641,"src":"wmphoto-Amy_03b_thumb.jpg","galleries_id":384013,"server_id":15,"link":"photo_7090641.html","width":130,"caption":"Amy","height":184});
															thumbnails[7090709] = clik.newPhoto({"id":7090709,"src":"Rachael_091_thumb.jpg","galleries_id":384013,"server_id":15,"link":"photo_7090709.html","width":130,"caption":"Rachael","height":184});
															thumbnails[7090725] = clik.newPhoto({"id":7090725,"src":"Emma_04_thumb.jpg","galleries_id":384013,"server_id":15,"link":"photo_7090725.html","width":130,"caption":"Emma","height":184});
															thumbnails[7090729] = clik.newPhoto({"id":7090729,"src":"Meghan_11_thumb.jpg","galleries_id":384013,"server_id":15,"link":"photo_7090729.html","width":130,"caption":"Meghan","height":184});
															thumbnails[7090749] = clik.newPhoto({"id":7090749,"src":"wmphoto-triphazard01_thumb.jpg","galleries_id":430701,"server_id":15,"link":"photo_7090749.html","width":130,"caption":"Trip Hazard","height":98});
															thumbnails[7090756] = clik.newPhoto({"id":7090756,"src":"drum01_adshot_7437326E-24E8-5EC4-4FD2A26FC74D3CA6_thumb.jpg","galleries_id":421526,"server_id":15,"link":"photo_7090756.html","width":130,"caption":"Drum","height":205});
															thumbnails[7091378] = clik.newPhoto({"id":7091378,"src":"bluecoatshop01_adshot_thumb.jpg","galleries_id":421526,"server_id":15,"link":"photo_7091378.html","width":130,"caption":"Bluecoat Art Shop","height":173});
															thumbnails[8013473] = clik.newPhoto({"id":8013473,"src":"wmphoto-wctv0511-jodixons02-orf_thumb.jpg","galleries_id":421521,"server_id":15,"link":"photo_8013473.html","width":130,"caption":"Dragonfly Brooch","height":121});
															thumbnails[8013475] = clik.newPhoto({"id":8013475,"src":"wmphoto-wctv0511-jodixons03-orf_thumb.jpg","galleries_id":421521,"server_id":15,"link":"photo_8013475.html","width":130,"caption":"Gold Leaf Necklace","height":98});
															thumbnails[8019204] = clik.newPhoto({"id":8019204,"src":"wmphoto-redtulips_3x4_thumb.jpg","galleries_id":273092,"server_id":15,"link":"photo_8019204.html","width":130,"caption":"","height":173});
															thumbnails[8019208] = clik.newPhoto({"id":8019208,"src":"wmphoto-wctv0511-jodixons06-orf_thumb.jpg","galleries_id":421521,"server_id":15,"link":"photo_8019208.html","width":130,"caption":"Amethyst Amulet","height":98});
															thumbnails[8019214] = clik.newPhoto({"id":8019214,"src":"wmphoto-Ogo_1_thumb.jpg","galleries_id":430701,"server_id":15,"link":"photo_8019214.html","width":130,"caption":"Ogo","height":98});
															thumbnails[8019233] = clik.newPhoto({"id":8019233,"src":"wmphoto-wctv0511-jodixons24_thumb.jpg","galleries_id":421526,"server_id":15,"link":"photo_8019233.html","width":130,"caption":"","height":226});
															thumbnails[8019234] = clik.newPhoto({"id":8019234,"src":"wmphoto-wctv0511-jodixons14-orf_thumb.jpg","galleries_id":421526,"server_id":15,"link":"photo_8019234.html","width":130,"caption":"","height":173});
															thumbnails[8019235] = clik.newPhoto({"id":8019235,"src":"wmphoto-wctv0511-jodixons12-orf_thumb.jpg","galleries_id":421526,"server_id":15,"link":"photo_8019235.html","width":130,"caption":"","height":173});
															thumbnails[8019236] = clik.newPhoto({"id":8019236,"src":"wmphoto-wctv0511-kershaws10-orf_thumb.jpg","galleries_id":421526,"server_id":15,"link":"photo_8019236.html","width":130,"caption":"","height":98});
															thumbnails[8457208] = clik.newPhoto({"id":8457208,"src":"chapelst_4x3_PROMOMARKED_thumb.jpg","galleries_id":447311,"server_id":15,"link":"photo_8457208.html","width":130,"caption":"Unity Buildings, Liverpool","height":98});
															thumbnails[8457210] = clik.newPhoto({"id":8457210,"src":"grapidswaterfront_4x3_PROMOMARKED_thumb.jpg","galleries_id":447311,"server_id":15,"link":"photo_8457210.html","width":130,"caption":"Grand Rapids Waterfront","height":98});
															thumbnails[8477038] = clik.newPhoto({"id":8477038,"src":"radiocitytower_3x4_PROMOMARKED_thumb.jpg","galleries_id":447311,"server_id":15,"link":"photo_8477038.html","width":130,"caption":"Radio City Tower, Liverpool","height":173});
															thumbnails[8477041] = clik.newPhoto({"id":8477041,"src":"cranes_4x3_PROMOMARKED_thumb.jpg","galleries_id":447311,"server_id":15,"link":"photo_8477041.html","width":130,"caption":"Cranes","height":98});
															thumbnails[8477063] = clik.newPhoto({"id":8477063,"src":"liverpooloneuc_4x3_PROMOMARKED_thumb.jpg","galleries_id":447311,"server_id":15,"link":"photo_8477063.html","width":130,"caption":"Liverpoool One, Under Construction","height":98});
															thumbnails[8537343] = clik.newPhoto({"id":8537343,"src":"itsadate01_PROMOMARKED_thumb.jpg","galleries_id":447316,"server_id":15,"link":"photo_8537343.html","width":130,"caption":"It's A Date","height":62});
															thumbnails[8537441] = clik.newPhoto({"id":8537441,"src":"mammon_3x2_PROMOMARKED_thumb.jpg","galleries_id":447316,"server_id":15,"link":"photo_8537441.html","width":130,"caption":"Christmas Shopping, Liverpool One","height":87});
															thumbnails[8537460] = clik.newPhoto({"id":8537460,"src":"biscotti01_4x3_PROMOMARKED_thumb.jpg","galleries_id":447312,"server_id":15,"link":"photo_8537460.html","width":130,"caption":"Home-made Almond and Raisin Biscotti","height":98});
															thumbnails[8537461] = clik.newPhoto({"id":8537461,"src":"chocolatetreats_PROMOMARKED_thumb.jpg","galleries_id":447312,"server_id":15,"link":"photo_8537461.html","width":130,"caption":"Chocolate Treats","height":87});
															thumbnails[8537463] = clik.newPhoto({"id":8537463,"src":"frenchfancies_PROMOMARKED_thumb.jpg","galleries_id":447312,"server_id":15,"link":"photo_8537463.html","width":130,"caption":"French Fancies","height":124});
															thumbnails[8537465] = clik.newPhoto({"id":8537465,"src":"tomatospinachsalad_PROMOMARKED_thumb.jpg","galleries_id":447312,"server_id":15,"link":"photo_8537465.html","width":130,"caption":"Home-made Tomato and Spinach Salad","height":82});
															thumbnails[8537509] = clik.newPhoto({"id":8537509,"src":"cocker01_4x3_bw_PROMOMARKED_thumb.jpg","galleries_id":436603,"server_id":15,"link":"photo_8537509.html","width":130,"caption":"Honest Lawyer and River Cocker","height":98});
															thumbnails[8537542] = clik.newPhoto({"id":8537542,"src":"rosebed_pano_PROMOMARKED_thumb.jpg","galleries_id":436603,"server_id":15,"link":"photo_8537542.html","width":130,"caption":"Rose Bed","height":57});
															thumbnails[8537543] = clik.newPhoto({"id":8537543,"src":"teddybearred_PROMOMARKED_thumb.jpg","galleries_id":436603,"server_id":15,"link":"photo_8537543.html","width":130,"caption":"Teddy","height":196});
															thumbnails[8019230] = clik.newPhoto({"id":8019230,"src":"wmphoto-wctv0511-cbch02-orf_thumb.jpg","galleries_id":430703,"server_id":15,"link":"photo_8019230.html","width":130,"caption":"Cumbria Bouncy Castle Hire 1","height":98});
															thumbnails[8019231] = clik.newPhoto({"id":8019231,"src":"wmphoto-wctv0511-cbch06-orf_thumb.jpg","galleries_id":430703,"server_id":15,"link":"photo_8019231.html","width":130,"caption":"Cumbria Bouncy Castle Hire 2","height":131});
															thumbnails[5387356] = clik.newPhoto({"id":5387356,"src":"havenfog01_thumb.jpg","galleries_id":436603,"server_id":15,"link":"photo_5387356.html","width":130,"caption":"Foggy Harbour","height":98});
															thumbnails[3686639] = clik.newPhoto({"id":3686639,"src":"firstimpressions_thumb.jpg","galleries_id":447311,"server_id":15,"link":"photo_3686639.html","width":130,"caption":"First Impressions of Liverpool","height":52});
															thumbnails[3691073] = clik.newPhoto({"id":3691073,"src":"shaftbw_thumb.jpg","galleries_id":447311,"server_id":15,"link":"photo_3691073.html","width":130,"caption":"Shaft!","height":173});
															thumbnails[3637780] = clik.newPhoto({"id":3637780,"src":"tulips01_thumb.jpg","galleries_id":273092,"server_id":15,"link":"photo_3637780.html","width":130,"caption":"Primary Colours - Tulips","height":173});
															thumbnails[3609418] = clik.newPhoto({"id":3609418,"src":"albertdock01_thumb.jpg","galleries_id":447311,"server_id":15,"link":"photo_3609418.html","width":130,"caption":"Albert Dock","height":98});
															thumbnails[3607794] = clik.newPhoto({"id":3607794,"src":"radiocity1_thumb.jpg","galleries_id":447311,"server_id":15,"link":"photo_3607794.html","width":130,"caption":"Radio City Tower","height":173});
															thumbnails[5212229] = clik.newPhoto({"id":5212229,"src":"leopard_thumb.jpg","galleries_id":430281,"server_id":15,"link":"photo_5212229.html","width":130,"caption":"The Leopard","height":173});
															thumbnails[5212342] = clik.newPhoto({"id":5212342,"src":"redelephant_thumb.jpg","galleries_id":430281,"server_id":15,"link":"photo_5212342.html","width":130,"caption":"Red Elephant of Kenya","height":173});
															thumbnails[5300883] = clik.newPhoto({"id":5300883,"src":"castlerigg_thumb.jpg","galleries_id":436603,"server_id":15,"link":"photo_5300883.html","width":130,"caption":"Lonely Stones","height":98});
															thumbnails[3521631] = clik.newPhoto({"id":3521631,"src":"downtownliverpool_thumb.jpg","galleries_id":436603,"server_id":15,"link":"photo_3521631.html","width":130,"caption":"Downtown Liverpool","height":52});
															thumbnails[3585676] = clik.newPhoto({"id":3585676,"src":"downtownliverpoolbw_thumb.jpg","galleries_id":436603,"server_id":15,"link":"photo_3585676.html","width":130,"caption":"Downtown Liverpool (black & white)","height":52});
															thumbnails[3677477] = clik.newPhoto({"id":3677477,"src":"mornington_thumb.jpg","galleries_id":447311,"server_id":15,"link":"photo_3677477.html","width":130,"caption":"Mornington Terrace","height":87});
															thumbnails[3493398] = clik.newPhoto({"id":3493398,"src":"strasbourg_thumb.jpg","galleries_id":430281,"server_id":15,"link":"photo_3493398.html","width":130,"caption":"Strasbourg","height":98});
															thumbnails[5233393] = clik.newPhoto({"id":5233393,"src":"backstreet_thumb.jpg","galleries_id":430281,"server_id":15,"link":"photo_5233393.html","width":130,"caption":"Back Canning Street","height":173});
															thumbnails[5233529] = clik.newPhoto({"id":5233529,"src":"tulips01bw_thumb.jpg","galleries_id":273092,"server_id":15,"link":"photo_5233529.html","width":130,"caption":"Tulips (colour popped)","height":173});
															thumbnails[5234287] = clik.newPhoto({"id":5234287,"src":"signsoflife_thumb.jpg","galleries_id":430281,"server_id":15,"link":"photo_5234287.html","width":130,"caption":"Signs of Life","height":98});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[447311] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Architecture & Construction","link":"photos_447311.html","maxRecords":0.0,"photoIDs":[8457208.0,8457210.0,8477038.0,8477041.0,8477063.0,3686639.0,3691073.0,3609418.0,3607794.0,3677477.0],"skipIndex":0,"section_code":"photos","featured_images":"8477063,8477041,8477038,8457210,8457208,3691073,3686639,3677477,3609418,3607794","id":447311,"singleSection":false});				  						galleries[430703] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Events","link":"photos_430703.html","maxRecords":0.0,"photoIDs":[8019230.0,8019231.0],"skipIndex":0,"section_code":"photos","featured_images":"8019231,8019230","id":430703,"singleSection":false});				  						galleries[447312] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Food & Drink","link":"photos_447312.html","maxRecords":0.0,"photoIDs":[8537460.0,8537461.0,8537463.0,8537465.0],"skipIndex":0,"section_code":"photos","featured_images":"8537465,8537463,8537461,8537460","id":447312,"singleSection":false});				  						galleries[447315] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Industry","link":"photos_447315.html","maxRecords":0.0,"photoIDs":[],"skipIndex":0,"section_code":"photos","featured_images":"","id":447315,"singleSection":false});				  						galleries[430701] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Musicians","link":"photos_430701.html","maxRecords":0.0,"photoIDs":[7090749.0,8019214.0],"skipIndex":0,"section_code":"photos","featured_images":"8019214,7090749","id":430701,"singleSection":false});				  						galleries[421521] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Product Shots","link":"photos_421521.html","maxRecords":0.0,"photoIDs":[8013473.0,8013475.0,8019208.0],"skipIndex":0,"section_code":"photos","featured_images":"8019208,8013475,8013473","id":421521,"singleSection":false});				  						galleries[421526] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Retail","link":"photos_421526.html","maxRecords":0.0,"photoIDs":[7090756.0,7091378.0,8019233.0,8019234.0,8019235.0,8019236.0],"skipIndex":0,"section_code":"photos","featured_images":"8019236,8019235,8019234,8019233,7091378,7090756","id":421526,"singleSection":false});				  						galleries[384013] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Fashion & Beauty","link":"photos_384013.html","maxRecords":0.0,"photoIDs":[7090641.0,7090709.0,7090725.0,7090729.0],"skipIndex":0,"section_code":"photos","featured_images":"7090729,7090725,7090709,7090641","id":384013,"singleSection":false});				  						galleries[436603] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Places & Tourism","link":"photos_436603.html","maxRecords":0.0,"photoIDs":[6551764.0,8537509.0,8537542.0,8537543.0,5387356.0,5300883.0,3521631.0,3585676.0],"skipIndex":0,"section_code":"photos","featured_images":"8537543,8537542,8537509,6551764,5387356,5300883","id":436603,"singleSection":false});				  						galleries[447316] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Commercial Art","link":"photos_447316.html","maxRecords":0.0,"photoIDs":[8537343.0,8537441.0],"skipIndex":0,"section_code":"photos","featured_images":"8537441,8537343","id":447316,"singleSection":false});				  						galleries[273092] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Fantastic Flowers","link":"photos_273092.html","maxRecords":0.0,"photoIDs":[6031256.0,6031257.0,6031258.0,8019204.0,3637780.0,5233529.0],"skipIndex":0,"section_code":"photos","featured_images":"8019204,6031258,6031257,6031256,5233529,3637780","id":273092,"singleSection":false});				  						galleries[430281] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Travel & Photojournalism","link":"photos_430281.html","maxRecords":0.0,"photoIDs":[5212229.0,5212342.0,3493398.0,5233393.0,5234287.0],"skipIndex":0,"section_code":"photos","featured_images":"5234287,5233393,5212342,5212229,3493398","id":430281,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '8537543,8537542,8537509,8537465,8537463,8537461,8537460,8537441,8537343,8477063,8477041,8477038,8457210,8457208,8019236,8019235,8019234,8019233,8019214,8019208,8019204,8013475,8013473,7091378,7090756,7090749,7090729,7090725,7090709,7090641,6551764,6031258,6031257,6031256,8019230,8019231,5233529,5212229,3691073,3686639,3609418,3607794';
imageSets[2] = '8537543,8537542,8537509,8537465,8537463,8537461,8537460,8537441,8537343,8477063,8477041,8477038,8457210,8457208,8019236,8019235,8019234,8019233,8019214,8019208,8019204,8013475,8013473,7091378,7090756,7090749,7090729,7090725,7090709,7090641,6551764,6031258,6031257,6031256,8019230,8019231,5387356,5300883,5234287,5233529,5233393,5212342,5212229,3691073,3686639,3677477,3637780,3609418,3607794,3493398';
imageSets[3] = '8019208';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/willmcallister/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/willmcallister/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/willmcallister/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/willmcallister/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/willmcallister/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/willmcallister/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/willmcallister/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/willmcallister/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/willmcallister/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/willmcallister/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/willmcallister/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/willmcallister/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/willmcallister/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/willmcallister/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/willmcallister/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/willmcallister/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/willmcallister/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/willmcallister/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/willmcallister/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/willmcallister/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/willmcallister/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/willmcallister/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/willmcallister/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/willmcallister/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/willmcallister/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/willmcallister/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/willmcallister/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 += 'photos.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 && 'photos' != '') {
					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 = 'www.wmphoto.co.uk - Will McAllister 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>Keywords: </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="WILLMCALLISTER">';
			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;
	}
}

			

