window.thumbnails = {};
															thumbnails[6206490] = clik.newPhoto({"id":6206490,"src":"studio_wall12_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":89});
															thumbnails[6261184] = clik.newPhoto({"id":6261184,"src":"press_The_Lady_I_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":107});
															thumbnails[8505162] = clik.newPhoto({"id":8505162,"src":"i_love_itsmallversion_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"I Love It 2011","height":99});
															thumbnails[8505254] = clik.newPhoto({"id":8505254,"src":"lifeanddeathsmallversion_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Life and Death 2011","height":172});
															thumbnails[8505271] = clik.newPhoto({"id":8505271,"src":"missing_personsmallversion_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Missing Person 2011","height":177});
															thumbnails[8505274] = clik.newPhoto({"id":8505274,"src":"ode_to_Kouyu_Abesmallversion_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Ode to Kouyu Abe 2011","height":98});
															thumbnails[8505278] = clik.newPhoto({"id":8505278,"src":"wordssmallversion_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Words 2011","height":103});
															thumbnails[8515966] = clik.newPhoto({"id":8515966,"src":"lady_garden_small_version_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Lady Garden 2011","height":100});
															thumbnails[8515967] = clik.newPhoto({"id":8515967,"src":"scarlet_woman_small_version_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Scarlet Woman 2011","height":182});
															thumbnails[8515970] = clik.newPhoto({"id":8515970,"src":"strata_small_version_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Strata 2011","height":98});
															thumbnails[8519021] = clik.newPhoto({"id":8519021,"src":"flying_or_jumpingsmall_version_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Flying or Jumping 2011","height":95});
															thumbnails[8519024] = clik.newPhoto({"id":8519024,"src":"Untitled_small_version_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Untitled 2011","height":96});
															thumbnails[914129] = clik.newPhoto({"id":914129,"src":"untitled_sequoia_detail1_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":79});
															thumbnails[6214456] = clik.newPhoto({"id":6214456,"src":"Atacama_I_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":106});
															thumbnails[6259613] = clik.newPhoto({"id":6259613,"src":"untitledWLAC_postcard_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":86});
															thumbnails[7890658] = clik.newPhoto({"id":7890658,"src":"sequoias1_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":103});
															thumbnails[7890718] = clik.newPhoto({"id":7890718,"src":"twinkle_twinkle1_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":97});
															thumbnails[8102355] = clik.newPhoto({"id":8102355,"src":"crossed_wires_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Crossed Wires  charcoal and conte crayon on paper 21 x 30cm","height":188});
															thumbnails[8490294] = clik.newPhoto({"id":8490294,"src":"free_spirit_small_version_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Balloons Chatting 2011","height":97});
															thumbnails[914068] = clik.newPhoto({"id":914068,"src":"boathouses drawing jpg_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":104});
															thumbnails[914160] = clik.newPhoto({"id":914160,"src":"Kung_Fu_bandstandjpg123_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":173});
															thumbnails[6214460] = clik.newPhoto({"id":6214460,"src":"atacama_II_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":106});
															thumbnails[6259247] = clik.newPhoto({"id":6259247,"src":"untitled_Beautiful_losers_details_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":167});
															thumbnails[457802] = clik.newPhoto({"id":457802,"src":"Pathjpg_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":103});
															thumbnails[457917] = clik.newPhoto({"id":457917,"src":"South_Beach_Miami_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":106});
															thumbnails[914083] = clik.newPhoto({"id":914083,"src":"boathouses studyjpg_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":79});
															thumbnails[1012855] = clik.newPhoto({"id":1012855,"src":"Safe_II_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":174});
															thumbnails[1012921] = clik.newPhoto({"id":1012921,"src":"twos_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Twos","height":175});
															thumbnails[1012931] = clik.newPhoto({"id":1012931,"src":"secret_IIjpg_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":159});
															thumbnails[6259074] = clik.newPhoto({"id":6259074,"src":"2002-2005blank_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":78});
															thumbnails[6259359] = clik.newPhoto({"id":6259359,"src":"trees_blank_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":78});
															thumbnails[6259593] = clik.newPhoto({"id":6259593,"src":"untitled_bernardo_st_lucia_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":164});
															thumbnails[457926] = clik.newPhoto({"id":457926,"src":"getty_museum_II_Los_Angeles12_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":181});
															thumbnails[914120] = clik.newPhoto({"id":914120,"src":"skater_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":193});
															thumbnails[1012867] = clik.newPhoto({"id":1012867,"src":"secretjpg_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":161});
															thumbnails[6214414] = clik.newPhoto({"id":6214414,"src":"artwork_2003_004_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":97});
															thumbnails[6259307] = clik.newPhoto({"id":6259307,"src":"travelling_wilderness_detail12_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":59});
															thumbnails[457914] = clik.newPhoto({"id":457914,"src":"Getty_Museum_I_Los_Angeles12_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":109});
															thumbnails[1012860] = clik.newPhoto({"id":1012860,"src":"youre_not_alonejpg_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":106});
															thumbnails[1678892] = clik.newPhoto({"id":1678892,"src":"city_christmas_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":161});
															thumbnails[4702695] = clik.newPhoto({"id":4702695,"src":"tree_detail12_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":56});
															thumbnails[5195959] = clik.newPhoto({"id":5195959,"src":"Beautiful_Losers_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Beautiful Losers Oil on Canvas 183x160cm","height":87});
															thumbnails[6209670] = clik.newPhoto({"id":6209670,"src":"number_one12345_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":179});
															thumbnails[457853] = clik.newPhoto({"id":457853,"src":"tree people light boxjpg_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":71});
															thumbnails[1012845] = clik.newPhoto({"id":1012845,"src":"boathousesjpg_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":106});
															thumbnails[4702129] = clik.newPhoto({"id":4702129,"src":"costume_lady_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":151});
															thumbnails[6210204] = clik.newPhoto({"id":6210204,"src":"number_5_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":164});
															thumbnails[1012857] = clik.newPhoto({"id":1012857,"src":"Safe_Ijpg1_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":106});
															thumbnails[4702122] = clik.newPhoto({"id":4702122,"src":"birdbeard_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":76});
															thumbnails[6210156] = clik.newPhoto({"id":6210156,"src":"number_three_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":168});
															thumbnails[6210205] = clik.newPhoto({"id":6210205,"src":"number_6_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":178});
															thumbnails[6259495] = clik.newPhoto({"id":6259495,"src":"trees_blank_II_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":78});
															thumbnails[457816] = clik.newPhoto({"id":457816,"src":"Openingjpg1_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":101});
															thumbnails[914141] = clik.newPhoto({"id":914141,"src":"monkey_puzzle_hoodie_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":106});
															thumbnails[3087654] = clik.newPhoto({"id":3087654,"src":"broken_drum_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":98});
															thumbnails[6209907] = clik.newPhoto({"id":6209907,"src":"number_21_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":106});
															thumbnails[6259643] = clik.newPhoto({"id":6259643,"src":"football_practice12_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":60});
															thumbnails[1012876] = clik.newPhoto({"id":1012876,"src":"high rise roller_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"High Rise Roller","height":107});
															thumbnails[4702132] = clik.newPhoto({"id":4702132,"src":"untitled1_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":109});
															thumbnails[4702137] = clik.newPhoto({"id":4702137,"src":"fly_on_studio_wall_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":108});
															thumbnails[6210162] = clik.newPhoto({"id":6210162,"src":"number_4123_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":98});
															thumbnails[7807867] = clik.newPhoto({"id":7807867,"src":"Birth_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":87});
															thumbnails[8323061] = clik.newPhoto({"id":8323061,"src":"Union_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":145});
															thumbnails[1012881] = clik.newPhoto({"id":1012881,"src":"Lowry figure I_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Lowry Figure I","height":107});
															thumbnails[6210382] = clik.newPhoto({"id":6210382,"src":"untitled_hyde_park_stage1_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":107});
															thumbnails[6259524] = clik.newPhoto({"id":6259524,"src":"untitled_trees_etching_in_lightbox_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":90});
															thumbnails[7731710] = clik.newPhoto({"id":7731710,"src":"head_stars_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"\"Headstars\" graphite on paper 10x15cm for WLAC May 2011","height":198});
															thumbnails[1012883] = clik.newPhoto({"id":1012883,"src":"Lowry figure II_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Lowry Figure II","height":108});
															thumbnails[6210368] = clik.newPhoto({"id":6210368,"src":"untitled_me_and_the_chickens1234_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":98});
															thumbnails[7526311] = clik.newPhoto({"id":7526311,"src":"forest_gouache_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":50});
															thumbnails[6210353] = clik.newPhoto({"id":6210353,"src":"untitled_the_guardianjpg_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":196});
															thumbnails[8272851] = clik.newPhoto({"id":8272851,"src":"shedding_light_on_a_folly_of_misleading_spectacles_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":114});
															thumbnails[1869737] = clik.newPhoto({"id":1869737,"src":"Untitled_winter_hutjpg123_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":162});
															thumbnails[914145] = clik.newPhoto({"id":914145,"src":"self portrait 2jpg_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"self portrait","height":141});
															thumbnails[7673379] = clik.newPhoto({"id":7673379,"src":"head_stars1234_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":198});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '8519024,8519021,8515970,8515967,8515966,8505278,8505274,8505271,8505254,8505162,8490294';
imageSets[2] = '6259247,914160,457926,6210204,4702129,6210156,8323061,1869737,914145';
imageSets[3] = '8519024,8519021,8515970,8515967,8515966,8505278,8505274,8505271,8505254,8505162,8490294,8323061,8272851,8102355,7890718,7890658,7807867,7731710,7673379,7526311,6261184,6259643,6259613,6259593,6259524,6259495,6259359,6259307,6259247,6259074,6214460,6214456,6214414,6210382,6210368,6210353,6210205,6210204,6210162,6210156,6209907,6209670,6206490,5195959,4702695,4702137,4702132,4702129,4702122,3087654';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'www12.clikpic.com/natashamorland/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/natashamorland/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/natashamorland/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/natashamorland/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/natashamorland/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/natashamorland/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/natashamorland/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/natashamorland/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/natashamorland/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/natashamorland/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/natashamorland/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/natashamorland/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/natashamorland/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/natashamorland/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/natashamorland/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/natashamorland/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/natashamorland/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/natashamorland/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/natashamorland/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/natashamorland/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/natashamorland/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/natashamorland/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/natashamorland/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/natashamorland/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/natashamorland/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 += '.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 && '' != '') {
					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 = 'Natasha Morland: ' + 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;
	}
}

			

