window.thumbnails = {};
															thumbnails[6371647] = clik.newPhoto({"id":6371647,"src":"COL_0012_3426bw_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":87});
															thumbnails[2888985] = clik.newPhoto({"id":2888985,"src":"bw_thumb.jpg","galleries_id":179283,"server_id":1,"link":"photo_2888985.html","width":129,"caption":"","height":86});
															thumbnails[2888988] = clik.newPhoto({"id":2888988,"src":"claire b&w3_thumb.jpg","galleries_id":179283,"server_id":1,"link":"photo_2888988.html","width":130,"caption":"","height":86});
															thumbnails[2889008] = clik.newPhoto({"id":2889008,"src":"DSC_0090_0304_thumb.jpg","galleries_id":179283,"server_id":1,"link":"photo_2889008.html","width":130,"caption":"","height":195});
															thumbnails[4758068] = clik.newPhoto({"id":4758068,"src":"Copy_of_DSC_3753_copy_thumb.jpg","galleries_id":179283,"server_id":1,"link":"photo_4758068.html","width":130,"caption":"","height":125});
															thumbnails[4758089] = clik.newPhoto({"id":4758089,"src":"DSC_3754_copy_thumb.jpg","galleries_id":179283,"server_id":1,"link":"photo_4758089.html","width":130,"caption":"","height":87});
															thumbnails[4758152] = clik.newPhoto({"id":4758152,"src":"DSC_6179_thumb.jpg","galleries_id":233123,"server_id":1,"link":"photo_4758152.html","width":130,"caption":"","height":87});
															thumbnails[4846514] = clik.newPhoto({"id":4846514,"src":"Copy_of_DSC_2602_edited-1_2536_thumb.JPG","galleries_id":179283,"server_id":1,"link":"photo_4846514.html","width":130,"caption":"","height":87});
															thumbnails[4846518] = clik.newPhoto({"id":4846518,"src":"DSC_0006_copy_2539_thumb.jpg","galleries_id":179283,"server_id":1,"link":"photo_4846518.html","width":130,"caption":"","height":166});
															thumbnails[4846701] = clik.newPhoto({"id":4846701,"src":"DSC_0271_copy_2522_thumb.jpg","galleries_id":179283,"server_id":1,"link":"photo_4846701.html","width":130,"caption":"","height":75});
															thumbnails[4846703] = clik.newPhoto({"id":4846703,"src":"DSC_0132_copy_2524_thumb.jpg","galleries_id":179283,"server_id":1,"link":"photo_4846703.html","width":130,"caption":"","height":63});
															thumbnails[4846739] = clik.newPhoto({"id":4846739,"src":"DSC_0367_2530_thumb.JPG","galleries_id":179283,"server_id":1,"link":"photo_4846739.html","width":130,"caption":"","height":158});
															thumbnails[4846746] = clik.newPhoto({"id":4846746,"src":"DSC_0309a_copy_2523_thumb.jpg","galleries_id":179283,"server_id":1,"link":"photo_4846746.html","width":130,"caption":"","height":181});
															thumbnails[4846749] = clik.newPhoto({"id":4846749,"src":"DSC_4364_copy_2535_thumb.jpg","galleries_id":179283,"server_id":1,"link":"photo_4846749.html","width":130,"caption":"","height":46});
															thumbnails[5517053] = clik.newPhoto({"id":5517053,"src":"mail_thumb.jpg","galleries_id":179283,"server_id":1,"link":"photo_5517053.html","width":130,"caption":"","height":174});
															thumbnails[6147213] = clik.newPhoto({"id":6147213,"src":"NH0072_thumb.jpg","galleries_id":233123,"server_id":1,"link":"photo_6147213.html","width":130,"caption":"","height":195});
															thumbnails[6147215] = clik.newPhoto({"id":6147215,"src":"NH0096_thumb.jpg","galleries_id":233123,"server_id":1,"link":"photo_6147215.html","width":130,"caption":"","height":87});
															thumbnails[6147218] = clik.newPhoto({"id":6147218,"src":"NH0105_thumb.jpg","galleries_id":233123,"server_id":1,"link":"photo_6147218.html","width":130,"caption":"","height":195});
															thumbnails[6147221] = clik.newPhoto({"id":6147221,"src":"NH0164_thumb.jpg","galleries_id":233123,"server_id":1,"link":"photo_6147221.html","width":130,"caption":"","height":87});
															thumbnails[6817908] = clik.newPhoto({"id":6817908,"src":"CraigHelen_51_thumb.jpg","galleries_id":233123,"server_id":1,"link":"photo_6817908.html","width":130,"caption":"","height":173});
															thumbnails[6818707] = clik.newPhoto({"id":6818707,"src":"CraigHelen_1_thumb.jpg","galleries_id":233123,"server_id":1,"link":"photo_6818707.html","width":130,"caption":"","height":98});
															thumbnails[6818708] = clik.newPhoto({"id":6818708,"src":"CraigHelen_2_thumb.jpg","galleries_id":233123,"server_id":1,"link":"photo_6818708.html","width":130,"caption":"","height":173});
															thumbnails[6818709] = clik.newPhoto({"id":6818709,"src":"CraigHelen_3_thumb.jpg","galleries_id":233123,"server_id":1,"link":"photo_6818709.html","width":130,"caption":"","height":173});
															thumbnails[6818711] = clik.newPhoto({"id":6818711,"src":"CraigHelen_4_thumb.jpg","galleries_id":233123,"server_id":1,"link":"photo_6818711.html","width":130,"caption":"","height":173});
															thumbnails[6882387] = clik.newPhoto({"id":6882387,"src":"resized_DSC_3540_thumb.jpg","galleries_id":233123,"server_id":1,"link":"photo_6882387.html","width":130,"caption":"","height":87});
															thumbnails[6882388] = clik.newPhoto({"id":6882388,"src":"resized_NH1_3843_thumb.jpg","galleries_id":233123,"server_id":1,"link":"photo_6882388.html","width":130,"caption":"","height":173});
															thumbnails[6882389] = clik.newPhoto({"id":6882389,"src":"resized_NH1_3850_thumb.jpg","galleries_id":233123,"server_id":1,"link":"photo_6882389.html","width":130,"caption":"","height":194});
															thumbnails[6882391] = clik.newPhoto({"id":6882391,"src":"resized_NH1_3857_thumb.jpg","galleries_id":233123,"server_id":1,"link":"photo_6882391.html","width":130,"caption":"","height":98});
															thumbnails[6882392] = clik.newPhoto({"id":6882392,"src":"resized_NH1_3883_thumb.jpg","galleries_id":233123,"server_id":1,"link":"photo_6882392.html","width":130,"caption":"","height":98});
															thumbnails[6882393] = clik.newPhoto({"id":6882393,"src":"resized_NH1_3889_thumb.jpg","galleries_id":233123,"server_id":1,"link":"photo_6882393.html","width":130,"caption":"","height":98});
															thumbnails[6882395] = clik.newPhoto({"id":6882395,"src":"resized_NH1_3933_thumb.jpg","galleries_id":233123,"server_id":1,"link":"photo_6882395.html","width":130,"caption":"","height":87});
															thumbnails[6882396] = clik.newPhoto({"id":6882396,"src":"resized_NH1_3999_thumb.jpg","galleries_id":233123,"server_id":1,"link":"photo_6882396.html","width":130,"caption":"","height":194});
															thumbnails[6882397] = clik.newPhoto({"id":6882397,"src":"resized_NH1_4002_thumb.jpg","galleries_id":233123,"server_id":1,"link":"photo_6882397.html","width":130,"caption":"","height":98});
															thumbnails[6882400] = clik.newPhoto({"id":6882400,"src":"resized_NH1_4013_thumb.jpg","galleries_id":233123,"server_id":1,"link":"photo_6882400.html","width":130,"caption":"","height":98});
															thumbnails[6882401] = clik.newPhoto({"id":6882401,"src":"resized_NH1_4042_thumb.jpg","galleries_id":233123,"server_id":1,"link":"photo_6882401.html","width":130,"caption":"","height":87});
															thumbnails[6882402] = clik.newPhoto({"id":6882402,"src":"resized_NH1_4209_thumb.jpg","galleries_id":233123,"server_id":1,"link":"photo_6882402.html","width":130,"caption":"","height":87});
															thumbnails[6882403] = clik.newPhoto({"id":6882403,"src":"resized_NH2_3796_thumb.jpg","galleries_id":233123,"server_id":1,"link":"photo_6882403.html","width":130,"caption":"","height":173});
															thumbnails[6882404] = clik.newPhoto({"id":6882404,"src":"resized_NH2_3807_thumb.jpg","galleries_id":233123,"server_id":1,"link":"photo_6882404.html","width":130,"caption":"","height":87});
															thumbnails[7155204] = clik.newPhoto({"id":7155204,"src":"Blue_Hawk_Photography_15_thumb.jpg","galleries_id":233123,"server_id":1,"link":"photo_7155204.html","width":130,"caption":"","height":87});
															thumbnails[7405321] = clik.newPhoto({"id":7405321,"src":"Unicolor-footer_thumb.jpg","galleries_id":233123,"server_id":1,"link":"photo_7405321.html","width":130,"caption":"","height":69});
															thumbnails[7405367] = clik.newPhoto({"id":7405367,"src":"resized_NH1_1152_thumb.jpg","galleries_id":233123,"server_id":1,"link":"photo_7405367.html","width":130,"caption":"","height":173});
															thumbnails[7492485] = clik.newPhoto({"id":7492485,"src":"Blue_Hawk_Photography_thumb.jpg","galleries_id":233123,"server_id":1,"link":"photo_7492485.html","width":130,"caption":"","height":173});
															thumbnails[7773043] = clik.newPhoto({"id":7773043,"src":"resized_Blue_Hawk_Photography_13_thumb.jpg","galleries_id":233123,"server_id":1,"link":"photo_7773043.html","width":130,"caption":"","height":194});
															thumbnails[7773044] = clik.newPhoto({"id":7773044,"src":"resized_Blue_Hawk_Photography_12_thumb.jpg","galleries_id":233123,"server_id":1,"link":"photo_7773044.html","width":130,"caption":"","height":173});
															thumbnails[7773046] = clik.newPhoto({"id":7773046,"src":"resized_Blue_Hawk_Photography_11_thumb.jpg","galleries_id":233123,"server_id":1,"link":"photo_7773046.html","width":130,"caption":"","height":62});
															thumbnails[7773047] = clik.newPhoto({"id":7773047,"src":"resized_Blue_Hawk_Photography_9_thumb.jpg","galleries_id":233123,"server_id":1,"link":"photo_7773047.html","width":130,"caption":"","height":98});
															thumbnails[7773049] = clik.newPhoto({"id":7773049,"src":"resized_Blue_Hawk_Photography_8_thumb.jpg","galleries_id":233123,"server_id":1,"link":"photo_7773049.html","width":130,"caption":"","height":173});
															thumbnails[7773050] = clik.newPhoto({"id":7773050,"src":"resized_Blue_Hawk_Photography_7_thumb.jpg","galleries_id":233123,"server_id":1,"link":"photo_7773050.html","width":130,"caption":"","height":173});
															thumbnails[7773051] = clik.newPhoto({"id":7773051,"src":"resized_Blue_Hawk_Photography_6_thumb.jpg","galleries_id":233123,"server_id":1,"link":"photo_7773051.html","width":130,"caption":"","height":173});
															thumbnails[7773052] = clik.newPhoto({"id":7773052,"src":"resized_Blue_Hawk_Photography_5_thumb.jpg","galleries_id":233123,"server_id":1,"link":"photo_7773052.html","width":130,"caption":"","height":87});
															thumbnails[7773054] = clik.newPhoto({"id":7773054,"src":"resized_Blue_Hawk_Photography_4_thumb.jpg","galleries_id":233123,"server_id":1,"link":"photo_7773054.html","width":130,"caption":"","height":194});
															thumbnails[7773055] = clik.newPhoto({"id":7773055,"src":"resized_Blue_Hawk_Photography_3_1_thumb.jpg","galleries_id":233123,"server_id":1,"link":"photo_7773055.html","width":130,"caption":"","height":87});
															thumbnails[7773056] = clik.newPhoto({"id":7773056,"src":"resized_Blue_Hawk_Photography_1_thumb.jpg","galleries_id":233123,"server_id":1,"link":"photo_7773056.html","width":130,"caption":"","height":194});
															thumbnails[7773066] = clik.newPhoto({"id":7773066,"src":"resized_March_comp_4_thumb.jpg","galleries_id":179283,"server_id":1,"link":"photo_7773066.html","width":130,"caption":"","height":65});
															thumbnails[7773071] = clik.newPhoto({"id":7773071,"src":"resized_March_comp_2_thumb.jpg","galleries_id":179283,"server_id":1,"link":"photo_7773071.html","width":130,"caption":"","height":194});
															thumbnails[7773103] = clik.newPhoto({"id":7773103,"src":"resized_DSC_0001a_3_thumb.JPG","galleries_id":179283,"server_id":1,"link":"photo_7773103.html","width":130,"caption":"","height":166});
															thumbnails[7773130] = clik.newPhoto({"id":7773130,"src":"resized_Bronze_Jan_3_thumb.JPG","galleries_id":179283,"server_id":1,"link":"photo_7773130.html","width":130,"caption":"","height":98});
															thumbnails[8333081] = clik.newPhoto({"id":8333081,"src":"resized_Blue_Hawk_Photo_97_thumb.jpg","galleries_id":233123,"server_id":1,"link":"photo_8333081.html","width":130,"caption":"","height":194});
															thumbnails[8333084] = clik.newPhoto({"id":8333084,"src":"Blue_Hawk_Photo_low-res_10_thumb.jpg","galleries_id":233123,"server_id":1,"link":"photo_8333084.html","width":130,"caption":"","height":87});
															thumbnails[8333086] = clik.newPhoto({"id":8333086,"src":"Blue_Hawk_Photo_low-res_8_thumb.jpg","galleries_id":233123,"server_id":1,"link":"photo_8333086.html","width":130,"caption":"","height":194});
															thumbnails[8333089] = clik.newPhoto({"id":8333089,"src":"Blue_Hawk_Photo_low-res_7_thumb.jpg","galleries_id":233123,"server_id":1,"link":"photo_8333089.html","width":130,"caption":"","height":173});
															thumbnails[8333092] = clik.newPhoto({"id":8333092,"src":"Blue_Hawk_Photo_low-res_5_thumb.jpg","galleries_id":233123,"server_id":1,"link":"photo_8333092.html","width":130,"caption":"","height":97});
															thumbnails[8333093] = clik.newPhoto({"id":8333093,"src":"Blue_Hawk_Photo_low-res_4_thumb.jpg","galleries_id":233123,"server_id":1,"link":"photo_8333093.html","width":130,"caption":"","height":173});
															thumbnails[8625281] = clik.newPhoto({"id":8625281,"src":"resized_Blue_Hawk_Photo_86_thumb.jpg","galleries_id":233123,"server_id":1,"link":"photo_8625281.html","width":130,"caption":"","height":173});
															thumbnails[9057461] = clik.newPhoto({"id":9057461,"src":"1_5_D63090EC-1EC9-DFB6-09C80C2AF08C23D5_thumb.JPG","galleries_id":179283,"server_id":1,"link":"photo_9057461.html","width":130,"caption":"1 (5)","height":195});
															thumbnails[9057462] = clik.newPhoto({"id":9057462,"src":"1_6_D630BE12-1EC9-DFB6-097F434AC4292BB2_thumb.jpg","galleries_id":179283,"server_id":1,"link":"photo_9057462.html","width":130,"caption":"1 (6)","height":174});
															thumbnails[9057469] = clik.newPhoto({"id":9057469,"src":"1_1_D6423FCC-1EC9-DFB6-09E1935D0F69B699_thumb.JPG","galleries_id":233123,"server_id":1,"link":"photo_9057469.html","width":130,"caption":"1 (1)","height":87});
															thumbnails[9057470] = clik.newPhoto({"id":9057470,"src":"1_2_D64279D0-1EC9-DFB6-09D07CAB38CC3617_thumb.JPG","galleries_id":233123,"server_id":1,"link":"photo_9057470.html","width":130,"caption":"1 (2)","height":195});
															thumbnails[9057471] = clik.newPhoto({"id":9057471,"src":"1_3_D642B01D-1EC9-DFB6-090B51AAEBFFAA77_thumb.JPG","galleries_id":233123,"server_id":1,"link":"photo_9057471.html","width":130,"caption":"1 (3)","height":195});
															thumbnails[9057472] = clik.newPhoto({"id":9057472,"src":"1_4_D642EC4C-1EC9-DFB6-095572C4BAD3E8B1_thumb.JPG","galleries_id":233123,"server_id":1,"link":"photo_9057472.html","width":130,"caption":"1 (4)","height":87});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[179283] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Portraits","link":"gallery_179283.html","maxRecords":0.0,"photoIDs":[2888985.0,2888988.0,2889008.0,4758068.0,4758089.0,4846514.0,4846518.0,4846701.0,4846703.0,4846739.0,4846746.0,4846749.0,5517053.0,7773066.0,7773071.0,7773103.0,7773130.0,9057461.0,9057462.0],"skipIndex":0,"section_code":"gallery","featured_images":4846703.0,"id":179283,"singleSection":false});				  						galleries[233123] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Wedding Photography","link":"gallery_233123.html","maxRecords":0.0,"photoIDs":[4758152.0,6147213.0,6147215.0,6147218.0,6147221.0,6817908.0,6818707.0,6818708.0,6818709.0,6818711.0,6882387.0,6882388.0,6882389.0,6882391.0,6882392.0,6882393.0,6882395.0,6882396.0,6882397.0,6882400.0,6882401.0,6882402.0,6882403.0,6882404.0,7155204.0,7405321.0,7405367.0,7492485.0,7773043.0,7773044.0,7773046.0,7773047.0,7773049.0,7773050.0,7773051.0,7773052.0,7773054.0,7773055.0,7773056.0,8333081.0,8333084.0,8333086.0,8333089.0,8333092.0,8333093.0,8625281.0,9057469.0,9057470.0,9057471.0,9057472.0],"skipIndex":0,"section_code":"gallery","featured_images":"8625281,7492485,6882396","id":233123,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '8625281,7492485,7155204';
imageSets[2] = '8625281,7492485,6882396,4846703';
imageSets[3] = '8625281,7492485';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/chawkins/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/chawkins/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/chawkins/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/chawkins/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/chawkins/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/chawkins/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/chawkins/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/chawkins/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/chawkins/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/chawkins/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/chawkins/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/chawkins/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/chawkins/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/chawkins/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/chawkins/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/chawkins/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/chawkins/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/chawkins/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/chawkins/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/chawkins/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/chawkins/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/chawkins/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/chawkins/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/chawkins/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/chawkins/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/chawkins/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/chawkins/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 += '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 = ' Blue Hawk 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>';
	}
				
				if (temp != '') {
		temp += '<div class="spacer"></div>';
	}
	return temp;
};

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
clik.photo.fnGetPaymentInfo = function(){
	var temp = '';
	if (this.item_price !== '') {
				temp += '<p>Order this print:</p>';
				temp += '<div class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> &pound;' + (this.item_price).toFixed(2) + '</div>';
		var item_name  = this.purchase_instruction;
		var amount = (this.item_price).toFixed(2);
		var item_option  = 0;
	}
		else {
		
	}
	if (this.item_price !== '') {
																		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="colin@evalu8ms.co.uk">';
					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="colin@evalu8ms.co.uk">';
				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;
	}
}

			

