window.thumbnails = {};
															thumbnails[3339023] = clik.newPhoto({"id":3339023,"src":"Snatch-detail_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"Snatch","height":174});
															thumbnails[3335645] = clik.newPhoto({"id":3335645,"src":"Brendan_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"Brendan","height":168});
															thumbnails[2295487] = clik.newPhoto({"id":2295487,"src":"Bust_thumb.gif","galleries_id":"","server_id":5,"link":"#","width":121,"caption":"SL Darby.","height":121});
															thumbnails[2821463] = clik.newPhoto({"id":2821463,"src":"sea1_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"Making \"only humans....\"","height":160});
															thumbnails[8643544] = clik.newPhoto({"id":8643544,"src":"DV2-_thumb.jpg","galleries_id":149425,"server_id":35,"link":"photo_8643544.html","width":121,"caption":"Devotion & violence #2","height":121});
															thumbnails[6915603] = clik.newPhoto({"id":6915603,"src":"Nailcross-shadow490_thumb.jpg","galleries_id":149425,"server_id":35,"link":"photo_6915603.html","width":121,"caption":"Devotion & Violence 2010","height":121});
															thumbnails[6915628] = clik.newPhoto({"id":6915628,"src":"Smith490_thumb.jpg","galleries_id":149425,"server_id":35,"link":"photo_6915628.html","width":121,"caption":"Untitled","height":121});
															thumbnails[6915650] = clik.newPhoto({"id":6915650,"src":"Kundalini490_thumb.jpg","galleries_id":149425,"server_id":5,"link":"photo_6915650.html","width":121,"caption":"Kundalini 2009","height":121});
															thumbnails[5998300] = clik.newPhoto({"id":5998300,"src":"Monkey490_thumb.jpg","galleries_id":149425,"server_id":5,"link":"photo_5998300.html","width":121,"caption":"Give a monkey a brain and he'll swear he's the centre of the universe (2009) ","height":121});
															thumbnails[5978592] = clik.newPhoto({"id":5978592,"src":"Crash-helmet-1490_thumb.jpg","galleries_id":203399,"server_id":5,"link":"photo_5978592.html","width":121,"caption":"Crash helmet","height":121});
															thumbnails[5978598] = clik.newPhoto({"id":5978598,"src":"Crash-helmet-2490_thumb.jpg","galleries_id":203399,"server_id":5,"link":"photo_5978598.html","width":130,"caption":"Crash helmet","height":130});
															thumbnails[5978606] = clik.newPhoto({"id":5978606,"src":"Crash-helmet-3-490_thumb.jpg","galleries_id":203399,"server_id":5,"link":"photo_5978606.html","width":130,"caption":" crash helmet","height":130});
															thumbnails[3439242] = clik.newPhoto({"id":3439242,"src":"Curves2490a_thumb.jpg","galleries_id":149429,"server_id":5,"link":"photo_3439242.html","width":121,"caption":"Learning curves#2 ","height":121});
															thumbnails[3436419] = clik.newPhoto({"id":3436419,"src":"Woodwork1490_thumb.jpg","galleries_id":149425,"server_id":5,"link":"photo_3436419.html","width":121,"caption":"Out of the woodwork#4","height":121});
															thumbnails[3436674] = clik.newPhoto({"id":3436674,"src":"Woodwork5490_thumb.jpg","galleries_id":149425,"server_id":5,"link":"photo_3436674.html","width":121,"caption":"Ot of the woodwork#5","height":121});
															thumbnails[3436676] = clik.newPhoto({"id":3436676,"src":"Woodwork6490_thumb.jpg","galleries_id":149425,"server_id":5,"link":"photo_3436676.html","width":121,"caption":"Out of the woodwork#6","height":121});
															thumbnails[3436679] = clik.newPhoto({"id":3436679,"src":"Woodwork7490_thumb.jpg","galleries_id":149425,"server_id":5,"link":"photo_3436679.html","width":121,"caption":"Out of the woodwork#7","height":121});
															thumbnails[3436683] = clik.newPhoto({"id":3436683,"src":"Woodwork8490_thumb.jpg","galleries_id":149425,"server_id":5,"link":"photo_3436683.html","width":121,"caption":"Out of the woodwork#8","height":121});
															thumbnails[3432584] = clik.newPhoto({"id":3432584,"src":"Moment-good490_thumb.jpg","galleries_id":149425,"server_id":5,"link":"photo_3432584.html","width":121,"caption":"Moment ","height":122});
															thumbnails[3432757] = clik.newPhoto({"id":3432757,"src":"Untitled-490x700_thumb.jpg","galleries_id":149425,"server_id":5,"link":"photo_3432757.html","width":121,"caption":"Untitled","height":121});
															thumbnails[3391783] = clik.newPhoto({"id":3391783,"src":"Conflict-management490_thumb.jpg","galleries_id":149425,"server_id":5,"link":"photo_3391783.html","width":130,"caption":"Conflict management ","height":125});
															thumbnails[3336053] = clik.newPhoto({"id":3336053,"src":"Snatch_thumb.jpg","galleries_id":203399,"server_id":5,"link":"photo_3336053.html","width":130,"caption":"Snatch","height":174});
															thumbnails[3335554] = clik.newPhoto({"id":3335554,"src":"Ladybird_thumb.jpg","galleries_id":203399,"server_id":5,"link":"photo_3335554.html","width":130,"caption":"Ladybird ","height":138});
															thumbnails[2288533] = clik.newPhoto({"id":2288533,"src":"Angeltrap700h_thumb.jpg","galleries_id":149425,"server_id":5,"link":"photo_2288533.html","width":121,"caption":"Angel-Trap","height":121});
															thumbnails[2288560] = clik.newPhoto({"id":2288560,"src":"avatar_thumb.gif","galleries_id":149425,"server_id":5,"link":"photo_2288560.html","width":121,"caption":"Avatar","height":121});
															thumbnails[2288577] = clik.newPhoto({"id":2288577,"src":"Cause&effect1490_thumb.jpg","galleries_id":149429,"server_id":5,"link":"photo_2288577.html","width":121,"caption":"Cause and Effect","height":121});
															thumbnails[2288582] = clik.newPhoto({"id":2288582,"src":"Beauty-dies-young-2001_thumb.gif","galleries_id":149425,"server_id":5,"link":"photo_2288582.html","width":121,"caption":"Beauty Dies Young","height":121});
															thumbnails[2288600] = clik.newPhoto({"id":2288600,"src":"Chtuhlu-Idol_thumb.gif","galleries_id":149425,"server_id":5,"link":"photo_2288600.html","width":121,"caption":"Chtuhlu Idol","height":121});
															thumbnails[2288651] = clik.newPhoto({"id":2288651,"src":"Coughing-Lesson_thumb.gif","galleries_id":149425,"server_id":5,"link":"photo_2288651.html","width":121,"caption":"Coughing Lesson","height":121});
															thumbnails[2290144] = clik.newPhoto({"id":2290144,"src":"Coil1_thumb.jpg","galleries_id":149425,"server_id":5,"link":"photo_2290144.html","width":121,"caption":"Coil","height":121});
															thumbnails[2295433] = clik.newPhoto({"id":2295433,"src":"BOC-490x7002_thumb.jpg","galleries_id":149425,"server_id":5,"link":"photo_2295433.html","width":121,"caption":"Beauty of Chance ","height":121});
															thumbnails[2295435] = clik.newPhoto({"id":2295435,"src":"Bird-490x490_thumb.jpg","galleries_id":149425,"server_id":5,"link":"photo_2295435.html","width":121,"caption":"Bird","height":121});
															thumbnails[2295436] = clik.newPhoto({"id":2295436,"src":"Doll490x700_thumb.jpg","galleries_id":149425,"server_id":5,"link":"photo_2295436.html","width":121,"caption":"Doll","height":121});
															thumbnails[2295437] = clik.newPhoto({"id":2295437,"src":"erotomania_thumb.gif","galleries_id":149425,"server_id":5,"link":"photo_2295437.html","width":121,"caption":"Erotomania","height":121});
															thumbnails[2295439] = clik.newPhoto({"id":2295439,"src":"Feed-the-flesh-side_thumb.gif","galleries_id":149425,"server_id":5,"link":"photo_2295439.html","width":121,"caption":"Feed the Flesh","height":121});
															thumbnails[2295440] = clik.newPhoto({"id":2295440,"src":"Flying-fuck_thumb.gif","galleries_id":149425,"server_id":5,"link":"photo_2295440.html","width":121,"caption":"Flying Fuck","height":121});
															thumbnails[2295441] = clik.newPhoto({"id":2295441,"src":"Forty_thumb.gif","galleries_id":149425,"server_id":5,"link":"photo_2295441.html","width":121,"caption":"Forty","height":121});
															thumbnails[2295442] = clik.newPhoto({"id":2295442,"src":"Forty-something-black_thumb.gif","galleries_id":149425,"server_id":5,"link":"photo_2295442.html","width":121,"caption":"Forty Something","height":121});
															thumbnails[2295443] = clik.newPhoto({"id":2295443,"src":"Gravit-Addict-top_thumb.gif","galleries_id":149425,"server_id":5,"link":"photo_2295443.html","width":121,"caption":"Gravity Addict","height":121});
															thumbnails[2295444] = clik.newPhoto({"id":2295444,"src":"guilthorse-original_thumb.gif","galleries_id":149425,"server_id":5,"link":"photo_2295444.html","width":121,"caption":"Riding the  guilt horse to the gates of paradise","height":121});
															thumbnails[2295445] = clik.newPhoto({"id":2295445,"src":"If-Swallowed_thumb.gif","galleries_id":149425,"server_id":5,"link":"photo_2295445.html","width":121,"caption":"If swallowed seek medical attention","height":121});
															thumbnails[2295447] = clik.newPhoto({"id":2295447,"src":"Lick-boxed_thumb.gif","galleries_id":149425,"server_id":5,"link":"photo_2295447.html","width":121,"caption":"Lick","height":121});
															thumbnails[2295448] = clik.newPhoto({"id":2295448,"src":"Fairy_thumb.gif","galleries_id":149425,"server_id":5,"link":"photo_2295448.html","width":121,"caption":"Fairy","height":121});
															thumbnails[2295449] = clik.newPhoto({"id":2295449,"src":"Only-Humans_thumb.gif","galleries_id":149425,"server_id":5,"link":"photo_2295449.html","width":121,"caption":"Only Humans play with fire","height":121});
															thumbnails[2295450] = clik.newPhoto({"id":2295450,"src":"Orchtile_thumb.gif","galleries_id":149425,"server_id":5,"link":"photo_2295450.html","width":121,"caption":"Orchtile","height":121});
															thumbnails[2295451] = clik.newPhoto({"id":2295451,"src":"ww1490x490_thumb.jpg","galleries_id":149425,"server_id":5,"link":"photo_2295451.html","width":121,"caption":"Out of the woodwork","height":121});
															thumbnails[2295452] = clik.newPhoto({"id":2295452,"src":"out-of-the-wood-2a_thumb.jpg","galleries_id":149425,"server_id":5,"link":"photo_2295452.html","width":121,"caption":"Out of the woodwork  #2","height":121});
															thumbnails[2295453] = clik.newPhoto({"id":2295453,"src":"Woodwork490x700_thumb.jpg","galleries_id":149425,"server_id":5,"link":"photo_2295453.html","width":121,"caption":"Out of the woodwork #3","height":121});
															thumbnails[2295454] = clik.newPhoto({"id":2295454,"src":"Peculiar-logic-of-obsession_thumb.gif","galleries_id":149425,"server_id":5,"link":"photo_2295454.html","width":121,"caption":"Peculiar logic of obsession","height":121});
															thumbnails[2295455] = clik.newPhoto({"id":2295455,"src":"Phibian_thumb.jpg","galleries_id":149425,"server_id":5,"link":"photo_2295455.html","width":121,"caption":"Phibian","height":121});
															thumbnails[2295457] = clik.newPhoto({"id":2295457,"src":"Possession_thumb.gif","galleries_id":149425,"server_id":5,"link":"photo_2295457.html","width":121,"caption":"Possession","height":121});
															thumbnails[2295460] = clik.newPhoto({"id":2295460,"src":"Relic_thumb.gif","galleries_id":149425,"server_id":5,"link":"photo_2295460.html","width":121,"caption":"Relic","height":121});
															thumbnails[2295462] = clik.newPhoto({"id":2295462,"src":"She's-my-faith_thumb.gif","galleries_id":149425,"server_id":5,"link":"photo_2295462.html","width":121,"caption":"She's my faith","height":121});
															thumbnails[2295463] = clik.newPhoto({"id":2295463,"src":"Spider-walking-on-my-tongue_thumb.gif","galleries_id":149425,"server_id":5,"link":"photo_2295463.html","width":121,"caption":"Spider walking on my tongue","height":121});
															thumbnails[2295465] = clik.newPhoto({"id":2295465,"src":"Storm-in-the-Port_thumb.gif","galleries_id":149425,"server_id":5,"link":"photo_2295465.html","width":121,"caption":"Storm in the port","height":121});
															thumbnails[2295467] = clik.newPhoto({"id":2295467,"src":"Turning-to-soil-_thumb.gif","galleries_id":149425,"server_id":5,"link":"photo_2295467.html","width":121,"caption":"Turning to soil","height":121});
															thumbnails[2295468] = clik.newPhoto({"id":2295468,"src":"Untitled-1_thumb.gif","galleries_id":149425,"server_id":5,"link":"photo_2295468.html","width":121,"caption":"Synaptic ammonite torso","height":121});
															thumbnails[2295469] = clik.newPhoto({"id":2295469,"src":"untempted-by-heaven_thumb.jpg","galleries_id":149425,"server_id":5,"link":"photo_2295469.html","width":121,"caption":"Untempted by heaven","height":121});
															thumbnails[2295471] = clik.newPhoto({"id":2295471,"src":"Virus-2_thumb.gif","galleries_id":149425,"server_id":5,"link":"photo_2295471.html","width":121,"caption":"Virus 2","height":121});
															thumbnails[2295472] = clik.newPhoto({"id":2295472,"src":"Wisp-wood_thumb.jpg","galleries_id":149425,"server_id":5,"link":"photo_2295472.html","width":121,"caption":"Wisp wood","height":121});
															thumbnails[2295476] = clik.newPhoto({"id":2295476,"src":"Turbine490_thumb.jpg","galleries_id":149425,"server_id":5,"link":"photo_2295476.html","width":121,"caption":"Turbine","height":121});
															thumbnails[2295482] = clik.newPhoto({"id":2295482,"src":"Cause-&-effect-2Dodo490_thumb.jpg","galleries_id":149429,"server_id":5,"link":"photo_2295482.html","width":130,"caption":"Dodo","height":130});
															thumbnails[2295483] = clik.newPhoto({"id":2295483,"src":"Drop490_thumb.jpg","galleries_id":149429,"server_id":5,"link":"photo_2295483.html","width":121,"caption":"Drop","height":121});
															thumbnails[2295484] = clik.newPhoto({"id":2295484,"src":"Cause-&-effect3490_thumb.jpg","galleries_id":149429,"server_id":5,"link":"photo_2295484.html","width":121,"caption":"Oval","height":121});
															thumbnails[2295486] = clik.newPhoto({"id":2295486,"src":"Learning-Curves490_thumb.jpg","galleries_id":149429,"server_id":5,"link":"photo_2295486.html","width":121,"caption":"Learning Curves","height":121});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[149425] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Knotwork ","link":"gallery_149425.html","maxRecords":0.0,"photoIDs":[8643544.0,6915603.0,6915628.0,6915650.0,5998300.0,3436419.0,3436674.0,3436676.0,3436679.0,3436683.0,3432584.0,3432757.0,3391783.0,2288533.0,2288560.0,2288582.0,2288600.0,2288651.0,2290144.0,2295433.0,2295435.0,2295436.0,2295437.0,2295439.0,2295440.0,2295441.0,2295442.0,2295443.0,2295444.0,2295445.0,2295447.0,2295448.0,2295449.0,2295450.0,2295451.0,2295452.0,2295453.0,2295454.0,2295455.0,2295457.0,2295460.0,2295462.0,2295463.0,2295465.0,2295467.0,2295468.0,2295469.0,2295471.0,2295472.0,2295476.0],"skipIndex":0,"section_code":"gallery","featured_images":"3391783,2295440,2290144","id":149425,"singleSection":false});				  						galleries[149429] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Cause & effect","link":"gallery_149429.html","maxRecords":0.0,"photoIDs":[3439242.0,2288577.0,2295482.0,2295483.0,2295484.0,2295486.0],"skipIndex":0,"section_code":"gallery","featured_images":2295482.0,"id":149429,"singleSection":false});				  						galleries[203399] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Miscellaneous","link":"gallery_203399.html","maxRecords":0.0,"photoIDs":[5978592.0,5978598.0,5978606.0,3336053.0,3335554.0],"skipIndex":0,"section_code":"gallery","featured_images":3336053.0,"id":203399,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '3339023';
imageSets[2] = '3391783,3336053,3335645,2295482,2295440,2290144';
imageSets[3] = '8643544,6915650,6915628,6915603,5998300,5978606,5978598,5978592,3439242,3436683,3436679,3436676,3436674,3436419,3432757,3432584,3391783,3339023,3336053,3335645,3335554,2821463,2295487,2295486,2295484,2295483,2295482,2295476,2295472,2295471,2295469,2295468,2295467,2295465,2295463,2295462,2295460,2295457,2295455,2295454,2295453,2295452,2295451,2295450,2295449,2295448,2295447,2295445,2295444,2295443';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'www12.clikpic.com/seamusmoran/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'www.clikpic.com/seamusmoran/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/seamusmoran/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/seamusmoran/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/seamusmoran/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/seamusmoran/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/seamusmoran/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/seamusmoran/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/seamusmoran/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/seamusmoran/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/seamusmoran/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/seamusmoran/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/seamusmoran/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/seamusmoran/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/seamusmoran/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/seamusmoran/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/seamusmoran/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/seamusmoran/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/seamusmoran/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/seamusmoran/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/seamusmoran/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/seamusmoran/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/seamusmoran/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/seamusmoran/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/seamusmoran/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 = 'seamusmoran.com: ' + 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({					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;
	}
}

			

