window.thumbnails = {};
															thumbnails[6741847] = clik.newPhoto({"id":6741847,"src":"Freshy_10th_Jan_2010_080_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"Freshy 10th Jan 2010 080","height":195});
															thumbnails[6741848] = clik.newPhoto({"id":6741848,"src":"Freshy_10th_Jan_2010_171_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"Freshy 10th Jan 2010 171","height":173});
															thumbnails[6741851] = clik.newPhoto({"id":6741851,"src":"Hannah_19_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"Hannah 19","height":163});
															thumbnails[6741855] = clik.newPhoto({"id":6741855,"src":"IMG_0081_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"IMG 0081","height":104});
															thumbnails[6741874] = clik.newPhoto({"id":6741874,"src":"IMG_0981_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"IMG 0981","height":163});
															thumbnails[6741876] = clik.newPhoto({"id":6741876,"src":"IMG_1010_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"IMG 1010","height":195});
															thumbnails[6741884] = clik.newPhoto({"id":6741884,"src":"IMG_1105_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"IMG 1105","height":87});
															thumbnails[6741899] = clik.newPhoto({"id":6741899,"src":"IMG_2329_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"IMG 2329","height":104});
															thumbnails[6741905] = clik.newPhoto({"id":6741905,"src":"IMG_2626_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"IMG 2626","height":195});
															thumbnails[6741909] = clik.newPhoto({"id":6741909,"src":"IMG_2711_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"IMG 2711","height":162});
															thumbnails[6741920] = clik.newPhoto({"id":6741920,"src":"IMG_4558_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"IMG 4558","height":163});
															thumbnails[6741950] = clik.newPhoto({"id":6741950,"src":"IMG_9036_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"IMG 9036","height":87});
															thumbnails[6741956] = clik.newPhoto({"id":6741956,"src":"IMG_9688_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"IMG 9688","height":195});
															thumbnails[6741960] = clik.newPhoto({"id":6741960,"src":"Joshua_008_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"Joshua 008","height":195});
															thumbnails[6741961] = clik.newPhoto({"id":6741961,"src":"Keith_June_10_16_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"Keith June 10 16","height":104});
															thumbnails[6741962] = clik.newPhoto({"id":6741962,"src":"mersea_pan_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"mersea pan","height":34});
															thumbnails[6741963] = clik.newPhoto({"id":6741963,"src":"mollies_08_038_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"mollies 08 038","height":104});
															thumbnails[6741966] = clik.newPhoto({"id":6741966,"src":"Picture11_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"Picture11","height":173});
															thumbnails[6741976] = clik.newPhoto({"id":6741976,"src":"Sian__Grace_Edwards_21st_Nov_09_088_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"Sian & Grace Edwards 21st Nov 09 088","height":163});
															thumbnails[6741978] = clik.newPhoto({"id":6741978,"src":"Sian__Grace_Edwards_21st_Nov_09_090_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"Sian & Grace Edwards 21st Nov 09 090","height":104});
															thumbnails[6741980] = clik.newPhoto({"id":6741980,"src":"town_report_carole_008_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"town report carole 008","height":180});
															thumbnails[7233733] = clik.newPhoto({"id":7233733,"src":"Unborn-001KWP_thumb.jpg","galleries_id":390905,"server_id":5,"link":"photo_7233733.html","width":130,"caption":"","height":195});
															thumbnails[7233737] = clik.newPhoto({"id":7233737,"src":"Unborn-010KWP_thumb.jpg","galleries_id":390905,"server_id":5,"link":"photo_7233737.html","width":130,"caption":"","height":195});
															thumbnails[7315231] = clik.newPhoto({"id":7315231,"src":"swpp_thumb.gif","galleries_id":370220,"server_id":5,"link":"photo_7315231.html","width":130,"caption":"","height":59});
															thumbnails[7627901] = clik.newPhoto({"id":7627901,"src":"20110328_Jodie_0924_thumb.jpg","galleries_id":332683,"server_id":5,"link":"photo_7627901.html","width":130,"caption":"","height":163});
															thumbnails[8044904] = clik.newPhoto({"id":8044904,"src":"Childrens_Portraits-KWP-010_thumb.JPG","galleries_id":431575,"server_id":5,"link":"photo_8044904.html","width":130,"caption":"","height":182});
															thumbnails[8044906] = clik.newPhoto({"id":8044906,"src":"Childrens_Portraits-KWP-018_thumb.JPG","galleries_id":431575,"server_id":5,"link":"photo_8044906.html","width":130,"caption":"","height":130});
															thumbnails[8044913] = clik.newPhoto({"id":8044913,"src":"Childrens_Portraits-KWP-035_thumb.JPG","galleries_id":431575,"server_id":5,"link":"photo_8044913.html","width":130,"caption":"","height":173});
															thumbnails[8045121] = clik.newPhoto({"id":8045121,"src":"EmmaKWP020_thumb.jpg","galleries_id":390905,"server_id":5,"link":"photo_8045121.html","width":160,"caption":"","height":240});
															thumbnails[8045123] = clik.newPhoto({"id":8045123,"src":"EmmaKWP032_thumb.jpg","galleries_id":390905,"server_id":5,"link":"photo_8045123.html","width":160,"caption":"","height":330});
															thumbnails[8045125] = clik.newPhoto({"id":8045125,"src":"EmmaKWP036_thumb.jpg","galleries_id":390905,"server_id":5,"link":"photo_8045125.html","width":160,"caption":"","height":240});
															thumbnails[8045127] = clik.newPhoto({"id":8045127,"src":"EmmaKWP042_thumb.jpg","galleries_id":390905,"server_id":5,"link":"photo_8045127.html","width":160,"caption":"","height":240});
															thumbnails[8045130] = clik.newPhoto({"id":8045130,"src":"EmmaKWP045_thumb.jpg","galleries_id":390905,"server_id":5,"link":"photo_8045130.html","width":160,"caption":"","height":148});
															thumbnails[8045131] = clik.newPhoto({"id":8045131,"src":"EmmaKWP056_thumb.jpg","galleries_id":390905,"server_id":5,"link":"photo_8045131.html","width":160,"caption":"","height":240});
															thumbnails[8521754] = clik.newPhoto({"id":8521754,"src":"IMG_9530a_thumb.jpg","galleries_id":332684,"server_id":5,"link":"photo_8521754.html","width":160,"caption":"","height":107});
															thumbnails[8521756] = clik.newPhoto({"id":8521756,"src":"IMG_9530a1_thumb.jpg","galleries_id":332684,"server_id":5,"link":"photo_8521756.html","width":160,"caption":"","height":107});
															thumbnails[6741823] = clik.newPhoto({"id":6741823,"src":"002_thumb.jpg","galleries_id":332683,"server_id":5,"link":"photo_6741823.html","width":130,"caption":2.0,"height":182});
															thumbnails[8052437] = clik.newPhoto({"id":8052437,"src":"20100924_Sam_7768_thumb.jpg","galleries_id":431575,"server_id":5,"link":"photo_8052437.html","width":160,"caption":"","height":240});
															thumbnails[6741824] = clik.newPhoto({"id":6741824,"src":"19_thumb.jpg","galleries_id":370220,"server_id":5,"link":"photo_6741824.html","width":130,"caption":19.0,"height":195});
															thumbnails[7627773] = clik.newPhoto({"id":7627773,"src":"Jodie022KWP_thumb.jpg","galleries_id":332683,"server_id":5,"link":"photo_7627773.html","width":130,"caption":"Jodie022KWP","height":195});
															thumbnails[8052440] = clik.newPhoto({"id":8052440,"src":"20100924_Sam_77781_thumb.JPG","galleries_id":431575,"server_id":5,"link":"photo_8052440.html","width":160,"caption":"","height":107});
															thumbnails[6741825] = clik.newPhoto({"id":6741825,"src":"20100613_Isaak_June_10_0362_thumb.jpg","galleries_id":332684,"server_id":5,"link":"photo_6741825.html","width":130,"caption":"20100613 Isaak June 10 0362","height":195});
															thumbnails[8052441] = clik.newPhoto({"id":8052441,"src":"Childrens_Portraits-KWP-001_thumb.JPG","galleries_id":431575,"server_id":5,"link":"photo_8052441.html","width":160,"caption":"","height":240});
															thumbnails[6741826] = clik.newPhoto({"id":6741826,"src":"20100613_Isaak_0158_thumb.jpg","galleries_id":332684,"server_id":5,"link":"photo_6741826.html","width":130,"caption":"20100613 Isaak 0158","height":104});
															thumbnails[6741827] = clik.newPhoto({"id":6741827,"src":"20100619_Gwyneth_0596_thumb.jpg","galleries_id":370220,"server_id":5,"link":"photo_6741827.html","width":130,"caption":"20100619 Gwyneth 0596","height":104});
															thumbnails[6741830] = clik.newPhoto({"id":6741830,"src":"20100827_Bethany_6529_thumb.jpg","galleries_id":332683,"server_id":5,"link":"photo_6741830.html","width":130,"caption":"20100827 Bethany 6529","height":195});
															thumbnails[6741831] = clik.newPhoto({"id":6741831,"src":"6_thumb.jpg","galleries_id":370220,"server_id":5,"link":"photo_6741831.html","width":130,"caption":6.0,"height":195});
															thumbnails[7627784] = clik.newPhoto({"id":7627784,"src":"Jodie051KWP_thumb.jpg","galleries_id":332683,"server_id":5,"link":"photo_7627784.html","width":130,"caption":"Jodie051KWP","height":195});
															thumbnails[6741842] = clik.newPhoto({"id":6741842,"src":"c2h_69_thumb.jpg","galleries_id":370220,"server_id":5,"link":"photo_6741842.html","width":130,"caption":"c2h 69","height":104});
															thumbnails[6741850] = clik.newPhoto({"id":6741850,"src":"Hannah_10_pp_thumb.jpg","galleries_id":332683,"server_id":5,"link":"photo_6741850.html","width":130,"caption":"Hannah 10 pp","height":163});
															thumbnails[8052443] = clik.newPhoto({"id":8052443,"src":"Sams_Birthday09242010_1001_DB545345-1EC9-D45B-1CED5C516FBFA486_thumb.JPG","galleries_id":431575,"server_id":5,"link":"photo_8052443.html","width":160,"caption":"","height":200});
															thumbnails[6741862] = clik.newPhoto({"id":6741862,"src":"IMG_0559_pp_thumb.jpg","galleries_id":332684,"server_id":5,"link":"photo_6741862.html","width":130,"caption":"IMG 0559 pp","height":87});
															thumbnails[6741865] = clik.newPhoto({"id":6741865,"src":"IMG_0685_thumb.jpg","galleries_id":332684,"server_id":5,"link":"photo_6741865.html","width":130,"caption":"IMG 0685","height":87});
															thumbnails[6741873] = clik.newPhoto({"id":6741873,"src":"IMG_0954_thumb.jpg","galleries_id":431575,"server_id":5,"link":"photo_6741873.html","width":130,"caption":"IMG 0954","height":163});
															thumbnails[6741906] = clik.newPhoto({"id":6741906,"src":"IMG_2651_thumb.jpg","galleries_id":332683,"server_id":5,"link":"photo_6741906.html","width":130,"caption":"IMG 2651","height":195});
															thumbnails[6741908] = clik.newPhoto({"id":6741908,"src":"IMG_2684_thumb.jpg","galleries_id":332680,"server_id":5,"link":"photo_6741908.html","width":130,"caption":"IMG 2684","height":83});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[431575] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Children's Portraits","link":"section398606_431575.html","maxRecords":0.0,"photoIDs":[8044904.0,8044906.0,8044913.0,8052437.0,8052440.0,8052441.0,8052443.0,6741873.0],"skipIndex":0,"section_code":"section398606","featured_images":"8052437,8044913,8044906","id":431575,"singleSection":false});				  						galleries[332680] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Commercial","link":"section398606_332680.html","maxRecords":0.0,"photoIDs":[6741908.0],"skipIndex":0,"section_code":"section398606","featured_images":6741908.0,"id":332680,"singleSection":false});				  						galleries[332684] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Live Events & Music","link":"section398606_332684.html","maxRecords":0.0,"photoIDs":[8521754.0,8521756.0,6741825.0,6741826.0,6741862.0,6741865.0],"skipIndex":0,"section_code":"section398606","featured_images":"8521756,8521754,6741865,6741862,6741826,6741825","id":332684,"singleSection":false});				  						galleries[390905] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Modelling","link":"section398606_390905.html","maxRecords":0.0,"photoIDs":[7233733.0,7233737.0,8045121.0,8045123.0,8045125.0,8045127.0,8045130.0,8045131.0],"skipIndex":0,"section_code":"section398606","featured_images":"8045130,8045127,8045125,8045123","id":390905,"singleSection":false});				  						galleries[332683] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Portraits","link":"section398606_332683.html","maxRecords":0.0,"photoIDs":[7627901.0,6741823.0,7627773.0,6741830.0,7627784.0,6741850.0,6741906.0],"skipIndex":0,"section_code":"section398606","featured_images":"7627901,7627784,7627773,6741906,6741850,6741830,6741823","id":332683,"singleSection":false});				  						galleries[370220] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Weddings","link":"section398606_370220.html","maxRecords":0.0,"photoIDs":[7315231.0,6741824.0,6741827.0,6741831.0,6741842.0],"skipIndex":0,"section_code":"section398606","featured_images":"7315231,6741842,6741831,6741827,6741824","id":370220,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[243268] = '8045127,8045123,8044913,7233733,8052441,6741978';
imageSets[1] = '8045130,8045125,8045121,8044913,8044904,8052437,7627773,8052441,6741825,6741830,7627784,8052443,6741865,6741874,6741876,6741884,6741905,6741906';
imageSets[2] = '8045130,8045127,8045125,8045123,8044913,8044906,8052437';
imageSets[3] = '8045130,7627901';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/keithwilliams/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/keithwilliams/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/keithwilliams/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/keithwilliams/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/keithwilliams/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/keithwilliams/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/keithwilliams/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/keithwilliams/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/keithwilliams/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/keithwilliams/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/keithwilliams/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/keithwilliams/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/keithwilliams/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/keithwilliams/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/keithwilliams/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/keithwilliams/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/keithwilliams/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/keithwilliams/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/keithwilliams/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/keithwilliams/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/keithwilliams/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/keithwilliams/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/keithwilliams/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/keithwilliams/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/keithwilliams/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/keithwilliams/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/keithwilliams/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 += 'section398606.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 && 'section398606' != '') {
					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 = 'Keith Williams Photography: ' + photoCaption;
			    }
        if (op.$detail.length > 0) {
      	temp = op.nextPhoto.fnGetImageDetails();
	    op.$detail.fadeGalleryDetails(temp, op.speed, function(){
			if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
				toggleAddToCartConfirm(backgrounds, op.$detail);
			} else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
				toggleAddToCartConfirm(photos, op.$detail);
			}
			$('body').trigger('clikUpdate.popup');
	    });
    }
        $(op.$detailContainer).find('.replaceable[class*=replaceable_photo-]').each(function(){
    	var field = clik.getPrefixedClass(this.className, 'replaceable_photo-');
    	if (field in op.nextPhoto) {
    		$(this).fadeGalleryDetails(op.nextPhoto[field], op.speed);
    	}
    }).end().find('.replaceable.photoPayment').fadeGalleryDetails(op.nextPhoto.fnGetPaymentInfo(), op.speed, function(){
		if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
			toggleAddToCartConfirm(backgrounds, op.$detailContainer);
		} else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
			toggleAddToCartConfirm(photos, op.$detailContainer);
		}
		$('body').trigger('clikUpdate.popup');
	});
		if (op.$photo.length > 0) {
		html = $('<img/>',{
			'class': 'mainphoto photo',
			src: photoSrc,
			id: 'mainPic',
			name: 'mainPic',
			width: op.nextPhoto.width,
			height: op.nextPhoto.height,
			alt: photoCaption,
			css: op.css || {}
		});
		if (op.href) {
			if (op.href.match(/<a/)) {
				html = $(op.href).append(html);
			} else {
				html = $('<a/>', {
					href: op.href,
					title: photoCaption
				}).append(html);
			}
		} else {
			html = $('<a/>', {
				title: photoCaption
			}).append(html);
		}
		if (op.speed == 0) {			op.$photo.html(html);			if (op.onBefore) {			  	op.onBefore.apply(op.$photo);			}			if (op.onAfter) {			  	op.onAfter.apply(op.$photo);			}		} else {			op.$photo.stop(true,true).fadeReplaceWith(html,op.speed,'',function(){  				if (op.onAfter) {				  	op.onAfter.apply(this);				}				clik.doColumnResize(false, $(this).add(op.$detail).add(op.$title));			}, op.onBefore);
		}	}
    if (op.field) {
		op.field.value = photoId;
	} else {
		op.$photo.data('image_id', photoId);
    }
        if (!op.speed) {
      	clik.doColumnResize(false, op.$photo.add(op.$detail).add(op.$title));
    }
        
    return html;
	}

/***************************************************************************
* Toggle add to cart confirmation element and set up the click event for   *
* the 'Add to cart' button.                                                *
***************************************************************************/
function toggleAddToCartConfirm(array, root){
	if (typeof(array) !== 'object' || array === null) {
	  	array = photos;
	}
	if (!$(root).length) {		root = $('body');	}	if($('#paymentConfirm', root).length > 0){
		$('#paymentConfirm', root).hide();
		$('#paymentAddButton', root)
		.unbind()
		.click(function(){
						form = $('#paymentForm', root)[0];
			option_id = 0;
			if(form.item_option.value){
				option_id = form.item_option.value;
			}
			if(addItemToBasket(form.item_number.value,array,form.site.value,parseInt(form.quantity.value, 10),option_id)){
				if($.browser.msie){$('#paymentConfirm', root).text('Item added to cart').show();}
				else{
					$('#paymentConfirm', root).text('Item added to cart').fadeIn();
					dspOrderDetails(form.site.value);
				}
			}
			else{
				$('#paymentConfirm', root).text('Item not added - check cookies are enabled in your browser.').fadeIn();
			}
		});
	}
}

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
clik.photo.fnGetImageDetails = function(){
	var temp = '';
	if (this.description != '') {
		temp +=  '<div id="imageDescription">' + this.description + '</div>';
	}
		if (this.photo_ref != '') {
		temp += '<div class="imageinfo" id="imageRef"><strong>Ref: </strong>' + this.photo_ref + '</div>';
	}
		if (this.takendate != '') {
		
		temp += '<div class="imageinfo" id="imageDate"><strong>Date: </strong>' + this.takendate + '</div>';
	}
	
	if (this.location != '') {
		
		temp += '<div class="imageinfo" id="imageLocation"><strong>Location: </strong>' +  this.location + '</div>';
	}
	
	if (this.photographer != '') {
		
		temp += '<div class="imageinfo" id="imagePhotographer"><strong>Photographer: </strong>' + this.photographer + '</div>';
	}
				
	temp += this.fnGetPaymentInfo();
				if (temp != '') {
		temp += '<div class="spacer"></div>';
	}
	return temp;
};

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
clik.photo.fnGetPaymentInfo = function(){
	var temp = '';
	if (this.item_price !== '') {
																		temp += '<p>Buy now using PayPal:</p>';
				temp += '<div class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> &pound;' + (this.item_price).toFixed(2) + '</div>';
		var item_name  = this.purchase_instruction;
		var amount = (this.item_price).toFixed(2);
		var item_option  = 0;
	}
		else if (this.payment_groups_id !== '') {
		temp += '<p>Buy this print online:</p>';
				temp += '<form id="paymentOptions" style="margin:0px;border:0px;" name="paymentOptions">';
		 									temp += '<select class="paymentlink" name="payment_options_id" onchange="updateCartValue($(this.form).next(\'#paymentForm\')[0],this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value); if(divShowing(\'paymentConfirm\')){fadeOut(\'paymentConfirm\', 3)};">';
		
		temp += getPaymentOptions(this.payment_groups_id);
		temp += '</select>';
		temp += '</form>';
				var item_option  = paymentGroups[this.payment_groups_id].options[0];
		if(paymentOptions[item_option]){
			var item_name  = paymentOptions[item_option].payment_option;
			var amount =  paymentOptions[item_option].price;
		}
			}
		else {
		
	}
	if (this.item_price !== '' || this.payment_groups_id !== '') {
											temp += '<form id="paymentForm" style="margin:0px;border:0px;" name="paymentForm">';
			temp += '	<input type="hidden" name="item_option" value="' + item_option + '">';
			temp += '	<input type="hidden" name="site" value="KEITHWILLIAMS">';
			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;
	}
}

			

