window.thumbnails = {};
															thumbnails[2544589] = clik.newPhoto({"id":2544589,"src":"lion333_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":173});
															thumbnails[2594304] = clik.newPhoto({"id":2594304,"src":"amir khan 2_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":86});
															thumbnails[2594305] = clik.newPhoto({"id":2594305,"src":"amir khan 4_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":185});
															thumbnails[2594307] = clik.newPhoto({"id":2594307,"src":"amir khan 5_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":101});
															thumbnails[2594309] = clik.newPhoto({"id":2594309,"src":"amir khan 6_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":86});
															thumbnails[2594310] = clik.newPhoto({"id":2594310,"src":"amir khan 7_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":192});
															thumbnails[2751906] = clik.newPhoto({"id":2751906,"src":"coleen rooney 1232_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":180});
															thumbnails[2539065] = clik.newPhoto({"id":2539065,"src":"clik12_thumb.jpg","galleries_id":161226,"server_id":35,"link":"photo_2539065.html","width":130,"caption":"","height":196});
															thumbnails[2539076] = clik.newPhoto({"id":2539076,"src":"clik11_thumb.jpg","galleries_id":161226,"server_id":35,"link":"photo_2539076.html","width":130,"caption":"","height":196});
															thumbnails[2539128] = clik.newPhoto({"id":2539128,"src":"dodson 2345_thumb.jpg","galleries_id":161226,"server_id":32,"link":"photo_2539128.html","width":130,"caption":"","height":166});
															thumbnails[2539135] = clik.newPhoto({"id":2539135,"src":"Copy of laura 8_thumb.jpg","galleries_id":161226,"server_id":32,"link":"photo_2539135.html","width":130,"caption":"","height":196});
															thumbnails[2539140] = clik.newPhoto({"id":2539140,"src":"clik10_thumb.jpg","galleries_id":161226,"server_id":35,"link":"photo_2539140.html","width":130,"caption":"","height":125});
															thumbnails[2539144] = clik.newPhoto({"id":2539144,"src":"clik9_thumb.jpg","galleries_id":161226,"server_id":35,"link":"photo_2539144.html","width":130,"caption":"","height":155});
															thumbnails[2543937] = clik.newPhoto({"id":2543937,"src":"small monkey_thumb.jpg","galleries_id":162671,"server_id":32,"link":"photo_2543937.html","width":130,"caption":"","height":143});
															thumbnails[2543975] = clik.newPhoto({"id":2543975,"src":"planemoon123_thumb.jpg","galleries_id":162672,"server_id":32,"link":"photo_2543975.html","width":130,"caption":"","height":132});
															thumbnails[2544399] = clik.newPhoto({"id":2544399,"src":"tigerwebsite_thumb.jpg","galleries_id":162671,"server_id":32,"link":"photo_2544399.html","width":130,"caption":"","height":93});
															thumbnails[2544408] = clik.newPhoto({"id":2544408,"src":"walking tiger_thumb.jpg","galleries_id":162671,"server_id":32,"link":"photo_2544408.html","width":130,"caption":"","height":134});
															thumbnails[2544444] = clik.newPhoto({"id":2544444,"src":"lighthouse_thumb.jpg","galleries_id":162672,"server_id":32,"link":"photo_2544444.html","width":130,"caption":"","height":86});
															thumbnails[2544448] = clik.newPhoto({"id":2544448,"src":"pier_thumb.jpg","galleries_id":162672,"server_id":32,"link":"photo_2544448.html","width":130,"caption":"","height":70});
															thumbnails[2544456] = clik.newPhoto({"id":2544456,"src":"lift_thumb.jpg","galleries_id":162672,"server_id":32,"link":"photo_2544456.html","width":130,"caption":"","height":196});
															thumbnails[2544463] = clik.newPhoto({"id":2544463,"src":"underpier_thumb.jpg","galleries_id":162672,"server_id":32,"link":"photo_2544463.html","width":130,"caption":"","height":195});
															thumbnails[2544484] = clik.newPhoto({"id":2544484,"src":"under lep_thumb.jpg","galleries_id":162671,"server_id":32,"link":"photo_2544484.html","width":130,"caption":"","height":163});
															thumbnails[2544709] = clik.newPhoto({"id":2544709,"src":"clik1_thumb.jpg","galleries_id":162670,"server_id":35,"link":"photo_2544709.html","width":130,"caption":"","height":210});
															thumbnails[2544713] = clik.newPhoto({"id":2544713,"src":"clik2_thumb.jpg","galleries_id":162670,"server_id":35,"link":"photo_2544713.html","width":130,"caption":"","height":106});
															thumbnails[2544727] = clik.newPhoto({"id":2544727,"src":"clik3_thumb.jpg","galleries_id":162670,"server_id":35,"link":"photo_2544727.html","width":130,"caption":"","height":208});
															thumbnails[2544728] = clik.newPhoto({"id":2544728,"src":"clik4_thumb.jpg","galleries_id":162670,"server_id":35,"link":"photo_2544728.html","width":130,"caption":"","height":125});
															thumbnails[2544729] = clik.newPhoto({"id":2544729,"src":"clik6_thumb.jpg","galleries_id":162670,"server_id":35,"link":"photo_2544729.html","width":130,"caption":"","height":134});
															thumbnails[2544731] = clik.newPhoto({"id":2544731,"src":"clik7_thumb.jpg","galleries_id":162670,"server_id":35,"link":"photo_2544731.html","width":130,"caption":"","height":163});
															thumbnails[2544989] = clik.newPhoto({"id":2544989,"src":"pmat_thumb.jpg","galleries_id":162672,"server_id":32,"link":"photo_2544989.html","width":130,"caption":"","height":87});
															thumbnails[2544990] = clik.newPhoto({"id":2544990,"src":"boats_thumb.jpg","galleries_id":162672,"server_id":32,"link":"photo_2544990.html","width":130,"caption":"","height":86});
															thumbnails[2545003] = clik.newPhoto({"id":2545003,"src":"seaside3_thumb.jpg","galleries_id":162672,"server_id":32,"link":"photo_2545003.html","width":130,"caption":"","height":86});
															thumbnails[2548341] = clik.newPhoto({"id":2548341,"src":"bobby_thumb.jpg","galleries_id":162887,"server_id":32,"link":"photo_2548341.html","width":130,"caption":"","height":170});
															thumbnails[2548345] = clik.newPhoto({"id":2548345,"src":"fred_thumb.jpg","galleries_id":162887,"server_id":32,"link":"photo_2548345.html","width":130,"caption":"","height":171});
															thumbnails[2548353] = clik.newPhoto({"id":2548353,"src":"141_thumb.jpg","galleries_id":162671,"server_id":32,"link":"photo_2548353.html","width":130,"caption":"","height":96});
															thumbnails[2548355] = clik.newPhoto({"id":2548355,"src":"19_thumb.jpg","galleries_id":162671,"server_id":32,"link":"photo_2548355.html","width":130,"caption":"","height":145});
															thumbnails[2552978] = clik.newPhoto({"id":2552978,"src":"charge_thumb.jpg","galleries_id":161227,"server_id":32,"link":"photo_2552978.html","width":130,"caption":"","height":173});
															thumbnails[2552981] = clik.newPhoto({"id":2552981,"src":"charge 2_thumb.jpg","galleries_id":161227,"server_id":32,"link":"photo_2552981.html","width":130,"caption":"","height":122});
															thumbnails[2552991] = clik.newPhoto({"id":2552991,"src":"charge6_thumb.jpg","galleries_id":161227,"server_id":32,"link":"photo_2552991.html","width":130,"caption":"","height":139});
															thumbnails[2553000] = clik.newPhoto({"id":2553000,"src":"charge3_thumb.jpg","galleries_id":161227,"server_id":32,"link":"photo_2553000.html","width":130,"caption":"","height":157});
															thumbnails[2553005] = clik.newPhoto({"id":2553005,"src":"charge 5_thumb.jpg","galleries_id":161227,"server_id":32,"link":"photo_2553005.html","width":130,"caption":"","height":98});
															thumbnails[2553014] = clik.newPhoto({"id":2553014,"src":"charge41_thumb.jpg","galleries_id":161227,"server_id":32,"link":"photo_2553014.html","width":130,"caption":"","height":98});
															thumbnails[2594300] = clik.newPhoto({"id":2594300,"src":"amir khan 3_thumb.jpg","galleries_id":165221,"server_id":32,"link":"photo_2594300.html","width":130,"caption":"","height":202});
															thumbnails[2594312] = clik.newPhoto({"id":2594312,"src":"amir khan 8_thumb.jpg","galleries_id":165221,"server_id":32,"link":"photo_2594312.html","width":130,"caption":"","height":171});
															thumbnails[2594313] = clik.newPhoto({"id":2594313,"src":"amir khan and trainer Jorge Rubio_thumb.jpg","galleries_id":165221,"server_id":32,"link":"photo_2594313.html","width":130,"caption":"Jorge Rubioand Amir Khan","height":93});
															thumbnails[2667834] = clik.newPhoto({"id":2667834,"src":"fottball1_thumb.jpg","galleries_id":168830,"server_id":32,"link":"photo_2667834.html","width":130,"caption":"","height":168});
															thumbnails[2667837] = clik.newPhoto({"id":2667837,"src":"football2_thumb.jpg","galleries_id":168830,"server_id":32,"link":"photo_2667837.html","width":130,"caption":"","height":106});
															thumbnails[2667838] = clik.newPhoto({"id":2667838,"src":"football3_thumb.jpg","galleries_id":168830,"server_id":32,"link":"photo_2667838.html","width":130,"caption":"","height":228});
															thumbnails[2667840] = clik.newPhoto({"id":2667840,"src":"football5_thumb.jpg","galleries_id":168830,"server_id":32,"link":"photo_2667840.html","width":130,"caption":"","height":100});
															thumbnails[2667841] = clik.newPhoto({"id":2667841,"src":"football4_thumb.jpg","galleries_id":168830,"server_id":32,"link":"photo_2667841.html","width":130,"caption":"","height":196});
															thumbnails[2672977] = clik.newPhoto({"id":2672977,"src":"man utd 29_thumb.jpg","galleries_id":161227,"server_id":32,"link":"photo_2672977.html","width":130,"caption":"","height":80});
															thumbnails[2691312] = clik.newPhoto({"id":2691312,"src":"khan 1_thumb.jpg","galleries_id":165221,"server_id":32,"link":"photo_2691312.html","width":130,"caption":"","height":101});
															thumbnails[2691314] = clik.newPhoto({"id":2691314,"src":"khan3_thumb.jpg","galleries_id":165221,"server_id":32,"link":"photo_2691314.html","width":130,"caption":"","height":89});
															thumbnails[2721846] = clik.newPhoto({"id":2721846,"src":"vic 19watermark_thumb.jpg","galleries_id":162887,"server_id":32,"link":"photo_2721846.html","width":130,"caption":"","height":188});
															thumbnails[2750987] = clik.newPhoto({"id":2750987,"src":"toolan 1234_thumb.jpg","galleries_id":162887,"server_id":32,"link":"photo_2750987.html","width":130,"caption":"","height":143});
															thumbnails[2750992] = clik.newPhoto({"id":2750992,"src":"coleen rooney 1231_thumb.jpg","galleries_id":162887,"server_id":32,"link":"photo_2750992.html","width":130,"caption":"","height":180});
															thumbnails[2751913] = clik.newPhoto({"id":2751913,"src":"cliff 1234_thumb.jpg","galleries_id":162887,"server_id":32,"link":"photo_2751913.html","width":130,"caption":"","height":181});
															thumbnails[2751942] = clik.newPhoto({"id":2751942,"src":"peter andre  123_thumb.jpg","galleries_id":162887,"server_id":32,"link":"photo_2751942.html","width":130,"caption":"","height":164});
															thumbnails[2751946] = clik.newPhoto({"id":2751946,"src":"david gust_thumb.jpg","galleries_id":162887,"server_id":32,"link":"photo_2751946.html","width":130,"caption":"","height":165});
															thumbnails[2984552] = clik.newPhoto({"id":2984552,"src":"alan-carr-1-copy_thumb.jpg","galleries_id":162887,"server_id":32,"link":"photo_2984552.html","width":130,"caption":"","height":104});
															thumbnails[7329035] = clik.newPhoto({"id":7329035,"src":"wetimagesize_thumb.jpg","galleries_id":161226,"server_id":32,"link":"photo_7329035.html","width":130,"caption":"","height":147});
															thumbnails[7612091] = clik.newPhoto({"id":7612091,"src":"click1_thumb.jpg","galleries_id":161226,"server_id":32,"link":"photo_7612091.html","width":130,"caption":"","height":207});
															thumbnails[7612301] = clik.newPhoto({"id":7612301,"src":"click2_thumb.jpg","galleries_id":161226,"server_id":32,"link":"photo_7612301.html","width":130,"caption":"","height":242});
															thumbnails[7612309] = clik.newPhoto({"id":7612309,"src":"click3_thumb.jpg","galleries_id":161226,"server_id":32,"link":"photo_7612309.html","width":130,"caption":"","height":203});
															thumbnails[7612797] = clik.newPhoto({"id":7612797,"src":"click4_thumb.jpg","galleries_id":162672,"server_id":32,"link":"photo_7612797.html","width":130,"caption":"","height":86});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[165221] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Amir Khan","link":"gallery_165221.html","maxRecords":0.0,"photoIDs":[2594300.0,2594312.0,2594313.0,2691312.0,2691314.0],"skipIndex":0,"section_code":"gallery","featured_images":"2594313,2594312","id":165221,"singleSection":false});				  						galleries[162671] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"animals","link":"gallery_162671.html","maxRecords":0.0,"photoIDs":[2543937.0,2544399.0,2544408.0,2544484.0,2548353.0,2548355.0],"skipIndex":0,"section_code":"gallery","featured_images":"2548355,2548353,2544484,2544408,2544399,2543937","id":162671,"singleSection":false});				  						galleries[162887] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Famous People ","link":"gallery_162887.html","maxRecords":0.0,"photoIDs":[2548341.0,2548345.0,2721846.0,2750987.0,2750992.0,2751913.0,2751942.0,2751946.0,2984552.0],"skipIndex":0,"section_code":"gallery","featured_images":"2984552,2751942,2751913,2750992","id":162887,"singleSection":false});				  						galleries[162672] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"landmarks","link":"gallery_162672.html","maxRecords":0.0,"photoIDs":[2543975.0,2544444.0,2544448.0,2544456.0,2544463.0,2544989.0,2544990.0,2545003.0,7612797.0],"skipIndex":0,"section_code":"gallery","featured_images":"7612797,2545003,2544990,2544989,2544463,2544456,2544448,2544444,2543975","id":162672,"singleSection":false});				  						galleries[168830] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Manchester United","link":"gallery_168830.html","maxRecords":0.0,"photoIDs":[2667834.0,2667837.0,2667838.0,2667840.0,2667841.0],"skipIndex":0,"section_code":"gallery","featured_images":"2667841,2667840,2667838,2667837,2667834","id":168830,"singleSection":false});				  						galleries[162670] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"studio","link":"gallery_162670.html","maxRecords":0.0,"photoIDs":[2544709.0,2544713.0,2544727.0,2544728.0,2544729.0,2544731.0],"skipIndex":0,"section_code":"gallery","featured_images":"2544731,2544729,2544728,2544727,2544713,2544709","id":162670,"singleSection":false});				  						galleries[161226] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Girls","link":"gallery_161226.html","maxRecords":0.0,"photoIDs":[2539065.0,2539076.0,2539128.0,2539135.0,2539140.0,2539144.0,7329035.0,7612091.0,7612301.0,7612309.0],"skipIndex":0,"section_code":"gallery","featured_images":2539128.0,"id":161226,"singleSection":false});				  						galleries[161227] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"around Manchester","link":"gallery_161227.html","maxRecords":0.0,"photoIDs":[2552978.0,2552981.0,2552991.0,2553000.0,2553005.0,2553014.0,2672977.0],"skipIndex":0,"section_code":"gallery","featured_images":"2672977,2553014,2553005,2553000,2552991,2552981,2552978","id":161227,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '2984552,2751942,2751913,2751906,2750992,2721846,2667841,2594313,2594312,2594310,2594309,2594307,2594305,2594304,2594300,2539135,2539128';
imageSets[2] = '2984552,2751942,2751913,2751906,2750992,2594313,2594312,2594305,2539128';
imageSets[3] = '7612797,7612309,7612301,7612091,7329035,2984552,2751946,2751942,2751913,2751906,2750992,2750987,2721846,2691314,2691312,2672977,2667841,2667840,2667838,2667837,2667834,2594313,2594312,2594310,2594309,2594307,2594305,2594304,2594300,2553014,2553005,2553000,2552991,2552981,2552978,2548355,2548353,2548345,2548341,2545003,2544990,2544989,2544731,2544729,2544728,2544727,2544713,2544709,2544589,2544484';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/rayhaslam/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/rayhaslam/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/rayhaslam/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/rayhaslam/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/rayhaslam/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/rayhaslam/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/rayhaslam/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/rayhaslam/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/rayhaslam/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/rayhaslam/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/rayhaslam/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/rayhaslam/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/rayhaslam/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/rayhaslam/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/rayhaslam/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/rayhaslam/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/rayhaslam/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/rayhaslam/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/rayhaslam/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/rayhaslam/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/rayhaslam/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/rayhaslam/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/rayhaslam/images';
		break;
	}
		return val;
}

/***************************************************************************
* img = reference to image object in which to show image                   *
***************************************************************************/
function showHomeImage(img) {
	imageID = randomListVal('');
	if (!basic) {
		img.src = photos[imageID].src;
		img.width = photos[imageID].width;
		img.height = photos[imageID].height;
		img.parentNode.title = img.alt = photos[imageID].caption;
	} else {
		newImage = new Image(photos[imageID].width,photos[imageID].height);
		newImage.src = photos[imageID].src;
		document.images[img.name] = newImage;
		
	}
}

function getHomeImageLink(imageID) {
  	var href='', photo = backgrounds && backgrounds[imageID];
	if(photo){
		if (photo && photo.galleries_id != '') {
  			href = photo.fnGalleryLink();
  		}
  		  		else {
  				href += 'gallery.html';
  	  		}
	}
    return href;
}

/***************************************************************************
* Show a random image on home page from featured images                    *
***************************************************************************/
function showHomeImageInline(el, image_sets_id, href) {
	
	var css = {}, imageID,
	    imageSetsId = 1;
	if(image_sets_id){
		imageSetsId = image_sets_id;
	}
	imageID = randomListVal(imageSets[imageSetsId]);
	if (href == null && 'gallery' != '') {
					href = getHomeImageLink(imageID);
	}
	
	updateImage({nextPhoto: backgrounds[imageID], img:el.find('img')[0],
                $photo:el, $title:$('#homeimageTitleContainer'), $detail:$('#homeimageDetailsContainer'),                speed:0, href:href, css:css, onAfter: function(){                  this.closest('.contentsection').doManualAlign({				    inner: 'img',				    crop: 'a'				  });                }              });
}

/***************************************************************************
* Set 'img' to be a new image given its photo() object                     *
***************************************************************************/
function updateImage (options) {
	var defaults = {nextPhoto:'',field:'',img:'',$photo:'',$title:'',$detail:'',$detailContainer:'',
                    updateDocumentTitle:false,speed:0,href:false,css:false,updateHash:false,onAfter:null,onBefore:null},
		op = $.extend({},defaults,options),
		html = '', temp = '',
		photoId = op.nextPhoto.id,
		photoCaption = ''+op.nextPhoto.caption,
		photoSrc = op.nextPhoto.src;
	
	if (op.updateHash && clik.getIDInUrl(location.href,'photo') != op.nextPhoto.id) {
		clik.changeHash('photos_id=' + op.nextPhoto.id, true);
	}
		
	    if (op.$title.length > 0) {
  		op.$title.fadeGalleryDetails(photoCaption, op.speed);
    }
        if (op.updateDocumentTitle) {
						  document.title = 'ray haslam 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> ' + (this.item_price).toFixed(2) + '</div>';
		var item_name  = this.purchase_instruction;
		var amount = (this.item_price).toFixed(2);
		var item_option  = 0;
	}
	else if (this.payment_groups_id !== '') {
		temp += '<p>Buy this print online:</p>';
				temp += '<form id="paymentOptions" style="margin:0px;border:0px;" name="paymentOptions">';
											temp += '<select class="paymentlink" name="payment_options_id" onchange="updateItemValues($(this.form).next(\'#paymentForm\')[0],this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value);">';
		
		temp += getPaymentOptions(this.payment_groups_id);
		temp += '</select>';
		temp += '</form>';
				var item_option  = paymentGroups[this.payment_groups_id].options[0];
		if(paymentOptions[item_option]){
			var item_name  = paymentOptions[item_option].payment_option;
			var amount =  paymentOptions[item_option].price;
		}
			}
	else {
		
	}
	if (this.item_price !== '' || this.payment_groups_id !== '') {
			temp += '<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({					href: thumbnails[imageID].fnGalleryLink(gallery_id),					title: galleries[gallery_id].title				});
			}
		}
	}
}

/***************************************************************************
* 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;
	}
}

			

