window.thumbnails = {};
															thumbnails[7436269] = clik.newPhoto({"id":7436269,"src":"Dancing_acrobat_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Dancing Acrobat","height":194});
															thumbnails[623425] = clik.newPhoto({"id":623425,"src":"aldeburgh 001 final_thumb.jpg","galleries_id":47566,"server_id":1,"link":"photo_623425.html","width":130,"caption":"Aldeburgh","height":149});
															thumbnails[623432] = clik.newPhoto({"id":623432,"src":"bristol_harbour_thumb.jpg","galleries_id":47566,"server_id":1,"link":"photo_623432.html","width":130,"caption":"Bristol Harbour","height":163});
															thumbnails[623439] = clik.newPhoto({"id":623439,"src":"piccadilly circus 003 final_thumb.jpg","galleries_id":47566,"server_id":1,"link":"photo_623439.html","width":130,"caption":"Piccadilly Circus","height":104});
															thumbnails[623447] = clik.newPhoto({"id":623447,"src":"tate modern 001 lith_thumb.jpg","galleries_id":47566,"server_id":1,"link":"photo_623447.html","width":130,"caption":"Tate Modern","height":98});
															thumbnails[623450] = clik.newPhoto({"id":623450,"src":"v&a_museum001_thumb.jpg","galleries_id":47566,"server_id":1,"link":"photo_623450.html","width":130,"caption":"V&A Museum ","height":158});
															thumbnails[623455] = clik.newPhoto({"id":623455,"src":"windsor great park 004 final_thumb.jpg","galleries_id":47566,"server_id":1,"link":"photo_623455.html","width":130,"caption":"Windsor Great Park","height":189});
															thumbnails[634132] = clik.newPhoto({"id":634132,"src":"Whitewood_thumb.jpeg.jpg","galleries_id":48371,"server_id":1,"link":"photo_634132.html","width":130,"caption":"WhiteWood","height":94});
															thumbnails[634276] = clik.newPhoto({"id":634276,"src":"Reflection - Venice_thumb.jpg","galleries_id":48390,"server_id":1,"link":"photo_634276.html","width":130,"caption":"Reflection Venice","height":189});
															thumbnails[634279] = clik.newPhoto({"id":634279,"src":"Venice01_thumb.jpg","galleries_id":48390,"server_id":1,"link":"photo_634279.html","width":130,"caption":"Venice 01","height":189});
															thumbnails[634280] = clik.newPhoto({"id":634280,"src":"Venice02_thumb.jpg","galleries_id":48390,"server_id":1,"link":"photo_634280.html","width":130,"caption":"Venice 02","height":189});
															thumbnails[634281] = clik.newPhoto({"id":634281,"src":"Venice03_thumb.jpg","galleries_id":48390,"server_id":1,"link":"photo_634281.html","width":130,"caption":"Venice 03","height":89});
															thumbnails[634282] = clik.newPhoto({"id":634282,"src":"Venice04_thumb.jpg","galleries_id":48390,"server_id":1,"link":"photo_634282.html","width":130,"caption":"Venice 04","height":189});
															thumbnails[634283] = clik.newPhoto({"id":634283,"src":"Venice05_thumb.jpg","galleries_id":48390,"server_id":1,"link":"photo_634283.html","width":130,"caption":"Venice 05","height":181});
															thumbnails[639140] = clik.newPhoto({"id":639140,"src":"Angel of the North_thumb. 01.jpg","galleries_id":48371,"server_id":1,"link":"photo_639140.html","width":130,"caption":"Angel of the North","height":91});
															thumbnails[639141] = clik.newPhoto({"id":639141,"src":"Lakeland Barn_thumb.jpeg","galleries_id":48371,"server_id":1,"link":"photo_639141.html","width":130,"caption":"Lakeland Barn","height":167});
															thumbnails[639148] = clik.newPhoto({"id":639148,"src":"among the bluebells_thumb.jpeg","galleries_id":48371,"server_id":1,"link":"photo_639148.html","width":130,"caption":"Among the Bluebells","height":88});
															thumbnails[661728] = clik.newPhoto({"id":661728,"src":"Winter sunlight_thumb.jpeg","galleries_id":48371,"server_id":1,"link":"photo_661728.html","width":130,"caption":"Winter Sunlight","height":172});
															thumbnails[1942416] = clik.newPhoto({"id":1942416,"src":"The Taj, India_thumb.jpg","galleries_id":48390,"server_id":1,"link":"photo_1942416.html","width":130,"caption":"TAJ MAHAL","height":89});
															thumbnails[1942417] = clik.newPhoto({"id":1942417,"src":"Sunset Valley  Goa_thumb.jpg","galleries_id":48390,"server_id":1,"link":"photo_1942417.html","width":130,"caption":"SUNSET VALLY","height":76});
															thumbnails[1942418] = clik.newPhoto({"id":1942418,"src":"Rajastan Landscape_thumb.jpg","galleries_id":48390,"server_id":1,"link":"photo_1942418.html","width":130,"caption":"RAJASTAN LANDSCAPE","height":79});
															thumbnails[1953340] = clik.newPhoto({"id":1953340,"src":"london zoo 001 otter_thumb.jpg","galleries_id":47566,"server_id":1,"link":"photo_1953340.html","width":130,"caption":"Otter ","height":99});
															thumbnails[1953352] = clik.newPhoto({"id":1953352,"src":"nantlle 004_thumb.jpg","galleries_id":47566,"server_id":1,"link":"photo_1953352.html","width":130,"caption":"Nantlle","height":86});
															thumbnails[1953419] = clik.newPhoto({"id":1953419,"src":"waltham abbey rgm 003_thumb.jpg","galleries_id":47566,"server_id":1,"link":"photo_1953419.html","width":130,"caption":"Wigwam","height":180});
															thumbnails[1953430] = clik.newPhoto({"id":1953430,"src":"waltham abbey rgm 018_thumb.jpg","galleries_id":47566,"server_id":1,"link":"photo_1953430.html","width":130,"caption":"In Battle","height":93});
															thumbnails[1953440] = clik.newPhoto({"id":1953440,"src":"portmeirion 001_thumb.jpg","galleries_id":47566,"server_id":1,"link":"photo_1953440.html","width":130,"caption":"Portmeirion","height":196});
															thumbnails[1953557] = clik.newPhoto({"id":1953557,"src":"festiniog 001_thumb.jpg","galleries_id":47566,"server_id":1,"link":"photo_1953557.html","width":130,"caption":"Festiniog","height":130});
															thumbnails[1976984] = clik.newPhoto({"id":1976984,"src":"Website alps men on ridge 06_thumb.jpg","galleries_id":132840,"server_id":1,"link":"photo_1976984.html","width":130,"caption":" Alps men on ridge","height":195});
															thumbnails[1976995] = clik.newPhoto({"id":1976995,"src":"website cley mill_thumb.jpg","galleries_id":132840,"server_id":1,"link":"photo_1976995.html","width":130,"caption":" Cley Mill","height":87});
															thumbnails[1977009] = clik.newPhoto({"id":1977009,"src":"website deer silhouete_thumb.jpg","galleries_id":132840,"server_id":1,"link":"photo_1977009.html","width":130,"caption":"Deer in silhouete","height":106});
															thumbnails[1977100] = clik.newPhoto({"id":1977100,"src":"Website laycock cloister_thumb.jpg","galleries_id":132840,"server_id":1,"link":"photo_1977100.html","width":130,"caption":"Laycock cloister","height":195});
															thumbnails[1977103] = clik.newPhoto({"id":1977103,"src":"Website Mull light_thumb.jpg","galleries_id":132840,"server_id":1,"link":"photo_1977103.html","width":130,"caption":" Mull Light","height":92});
															thumbnails[1977130] = clik.newPhoto({"id":1977130,"src":"Website tenerife lizard_thumb.jpg","galleries_id":132840,"server_id":1,"link":"photo_1977130.html","width":130,"caption":"Tenerife Lizard","height":80});
															thumbnails[1983652] = clik.newPhoto({"id":1983652,"src":"ASCENSION DAY - BRUGE_thumb.JPG","galleries_id":133253,"server_id":1,"link":"photo_1983652.html","width":130,"caption":"Ascension Day","height":87});
															thumbnails[1983658] = clik.newPhoto({"id":1983658,"src":"CAR NEXT DOOR_thumb.JPG","galleries_id":133253,"server_id":1,"link":"photo_1983658.html","width":130,"caption":"The Car Next Door","height":87});
															thumbnails[1983669] = clik.newPhoto({"id":1983669,"src":"MARSHMALLOWS- HOT CHOC_thumb.JPG","galleries_id":133253,"server_id":1,"link":"photo_1983669.html","width":130,"caption":"Marshmallows & Hot Chocolate","height":98});
															thumbnails[1983684] = clik.newPhoto({"id":1983684,"src":"SOUTHEND - BOXING DAY_thumb.jpg","galleries_id":133253,"server_id":1,"link":"photo_1983684.html","width":130,"caption":"Boxing Day","height":98});
															thumbnails[1983693] = clik.newPhoto({"id":1983693,"src":"TORONTO SHOPPING_thumb.JPG","galleries_id":133253,"server_id":1,"link":"photo_1983693.html","width":130,"caption":"Toronto ","height":173});
															thumbnails[1988139] = clik.newPhoto({"id":1988139,"src":"Church_thumb.jpg","galleries_id":133494,"server_id":1,"link":"photo_1988139.html","width":130,"caption":"Church","height":189});
															thumbnails[1988151] = clik.newPhoto({"id":1988151,"src":"Wheels_thumb.jpg","galleries_id":133494,"server_id":1,"link":"photo_1988151.html","width":130,"caption":"Wheel","height":160});
															thumbnails[1991216] = clik.newPhoto({"id":1991216,"src":"Vegetable  seller_thumb.JPEG","galleries_id":48371,"server_id":1,"link":"photo_1991216.html","width":130,"caption":"Vegetable Seller","height":73});
															thumbnails[1992166] = clik.newPhoto({"id":1992166,"src":"Artist_thumb.jpg","galleries_id":133494,"server_id":1,"link":"photo_1992166.html","width":130,"caption":"Artist","height":185});
															thumbnails[1992167] = clik.newPhoto({"id":1992167,"src":"Discs_thumb.jpg","galleries_id":133494,"server_id":1,"link":"photo_1992167.html","width":130,"caption":"Red Discs","height":203});
															thumbnails[1992183] = clik.newPhoto({"id":1992183,"src":"Untitled-1 copy1_thumb.jpg","galleries_id":133494,"server_id":1,"link":"photo_1992183.html","width":130,"caption":"Nude in Mono","height":179});
															thumbnails[1992185] = clik.newPhoto({"id":1992185,"src":"Rope_thumb.jpg","galleries_id":133494,"server_id":1,"link":"photo_1992185.html","width":130,"caption":"Rope","height":176});
															thumbnails[2054610] = clik.newPhoto({"id":2054610,"src":"aerial_view_over_iran_thumb.jpg","galleries_id":137285,"server_id":1,"link":"photo_2054610.html","width":130,"caption":"Aerial view over Iran","height":98});
															thumbnails[2054623] = clik.newPhoto({"id":2054623,"src":"boat_jetty_thumb.jpg","galleries_id":137285,"server_id":1,"link":"photo_2054623.html","width":130,"caption":"Boat Jetty","height":98});
															thumbnails[2054626] = clik.newPhoto({"id":2054626,"src":"fishing_boat_thumb.jpg","galleries_id":137285,"server_id":1,"link":"photo_2054626.html","width":130,"caption":"Fishing Boat","height":98});
															thumbnails[2054627] = clik.newPhoto({"id":2054627,"src":"palace_archway_thumb.jpg","galleries_id":137285,"server_id":1,"link":"photo_2054627.html","width":130,"caption":"Palace Archway","height":173});
															thumbnails[2054630] = clik.newPhoto({"id":2054630,"src":"peanut_seller_thumb.jpg","galleries_id":137285,"server_id":1,"link":"photo_2054630.html","width":130,"caption":"Peanut Seller","height":173});
															thumbnails[2054638] = clik.newPhoto({"id":2054638,"src":"sky_from_airplane_thumb.jpg","galleries_id":137285,"server_id":1,"link":"photo_2054638.html","width":130,"caption":"Sky from Airplane","height":98});
															thumbnails[2064071] = clik.newPhoto({"id":2064071,"src":"Street seller_thumb.jpg","galleries_id":48371,"server_id":1,"link":"photo_2064071.html","width":130,"caption":"Street Seller","height":90});
															thumbnails[3092062] = clik.newPhoto({"id":3092062,"src":"LIGHT-HOUSE SHIP_thumb.JPG","galleries_id":133253,"server_id":1,"link":"photo_3092062.html","width":130,"caption":"Light-House Ship","height":87});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[137285] = clik.newGallery({"parentGallery":"","usePopups":false,"title":" Shyla Prasannan","link":"gallery_137285.html","maxRecords":0.0,"photoIDs":[2054610.0,2054623.0,2054626.0,2054627.0,2054630.0,2054638.0],"skipIndex":0,"section_code":"gallery","featured_images":"2054638,2054630,2054627,2054626,2054623,2054610","id":137285,"singleSection":false});				  						galleries[47566] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Alan Simpson","link":"gallery_47566.html","maxRecords":0.0,"photoIDs":[623425.0,623432.0,623439.0,623447.0,623450.0,623455.0,1953340.0,1953352.0,1953419.0,1953430.0,1953440.0,1953557.0],"skipIndex":0,"section_code":"gallery","featured_images":"1953557,1953440,1953430,1953419,1953352,1953340,623455,623450,623447,623439","id":47566,"singleSection":false});				  						galleries[48371] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Gill Hutchinson","link":"gallery_48371.html","maxRecords":0.0,"photoIDs":[634132.0,639140.0,639141.0,639148.0,661728.0,1991216.0,2064071.0],"skipIndex":0,"section_code":"gallery","featured_images":"2064071,1991216,661728,639148,639141,639140,634132","id":48371,"singleSection":false});				  						galleries[48390] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Joe Travasso","link":"gallery_48390.html","maxRecords":0.0,"photoIDs":[634276.0,634279.0,634280.0,634281.0,634282.0,634283.0,1942416.0,1942417.0,1942418.0],"skipIndex":0,"section_code":"gallery","featured_images":"1942418,1942417,1942416,634283,634282,634281,634280,634279,634276","id":48390,"singleSection":false});				  						galleries[132840] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"John Northover","link":"gallery_132840.html","maxRecords":0.0,"photoIDs":[1976984.0,1976995.0,1977009.0,1977100.0,1977103.0,1977130.0],"skipIndex":0,"section_code":"gallery","featured_images":"1977130,1977103,1977100,1977009,1976995,1976984","id":132840,"singleSection":false});				  						galleries[133494] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Norman Olley","link":"gallery_133494.html","maxRecords":0.0,"photoIDs":[1988139.0,1988151.0,1992166.0,1992167.0,1992183.0,1992185.0],"skipIndex":0,"section_code":"gallery","featured_images":"1992185,1992183,1992167,1992166,1988151,1988139","id":133494,"singleSection":false});				  						galleries[133253] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Ray Benn","link":"gallery_133253.html","maxRecords":0.0,"photoIDs":[1983652.0,1983658.0,1983669.0,1983684.0,1983693.0,3092062.0],"skipIndex":0,"section_code":"gallery","featured_images":"3092062,1983693,1983684,1983669,1983658,1983652","id":133253,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '2054638,2054627,2054626,2054623,2054610,1992185,1992183,1992167,1992166,1991216,1988151,1988139,1983693,1983684,1983669,1983658,1983652,1977130,1977103,1977100,1977009,1976984,1953557,1953430,1953352,1953340';
imageSets[3] = '7436269,3092062,2064071,2054638,2054630,2054627,2054626,2054623,2054610,1992185,1992183,1992167,1992166,1991216,1988151,1988139,1983693,1983684,1983669,1983658,1983652,1977130,1977103,1977100,1977009,1976995,1976984,1953557,1953440,1953430,1953419,1953352,1953340,1942418,1942417,1942416,661728,639148,639141,639140,634283,634282,634281,634280,634279,634276,634132,623455,623450,623447';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/mleech/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/mleech/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/mleech/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/mleech/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/mleech/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/mleech/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/mleech/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/mleech/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/mleech/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/mleech/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/mleech/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/mleech/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/mleech/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/mleech/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/mleech/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/mleech/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/mleech/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/mleech/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/mleech/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/mleech/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/mleech/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/mleech/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/mleech/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/mleech/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/mleech/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/mleech/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/mleech/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 = 'Woodford and Wanstead Camera Club: ' + 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.item_price !== '') {
			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;
	}
}

			

