window.thumbnails = {};
															thumbnails[3617602] = clik.newPhoto({"id":3617602,"src":"P10009012_thumb.JPG","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"6035 PINK-oil on canvas80cm x 40cm","height":166});
															thumbnails[3617604] = clik.newPhoto({"id":3617604,"src":"P10009002_thumb.JPG","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"SCOOPCUP-oil on canvas80cm x 60cm","height":177});
															thumbnails[3635800] = clik.newPhoto({"id":3635800,"src":"test6_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"TIGER AFFECTION-<br>\r\noil on canvas<br>\r\n800 x 1000","height":93});
															thumbnails[3657079] = clik.newPhoto({"id":3657079,"src":"011_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"NOSEY COW-acrylic and oil on canvas40cm x 40cm(available to purchase)","height":128});
															thumbnails[3657081] = clik.newPhoto({"id":3657081,"src":"022_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"BLUE BOY-acrylic and oil on canvas20cm x 15cm","height":161});
															thumbnails[3666539] = clik.newPhoto({"id":3666539,"src":"P100090611_thumb.JPG","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"PATCH-oil on canvas<br>\r\n50cm x 50cm","height":120});
															thumbnails[3727785] = clik.newPhoto({"id":3727785,"src":"Sacrifice_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"SACRIFICE-<br>\r\noil on linen<br>\r\n50cm x 100cm","height":95});
															thumbnails[3727788] = clik.newPhoto({"id":3727788,"src":"darryn_cotswolds_70_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"SUBMERGENCE-<br>\r\noil on linen<br>\r\n100cm x 40cm","height":244});
															thumbnails[3727791] = clik.newPhoto({"id":3727791,"src":"marwell_2_2006_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"WILD DOG-<br>\r\noil on linen<br>\r\n30cm x 15cm","height":199});
															thumbnails[3727977] = clik.newPhoto({"id":3727977,"src":"darryn_art_ref_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"LEOPARD PORTRAIT-<br>\r\noil on canvas<br>\r\n30cm x 50cm","height":68});
															thumbnails[3753089] = clik.newPhoto({"id":3753089,"src":"P1010345_thumb.JPG","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"GEURNSEY PINK-acrylic and oil on canvas80cm x 80cm(available to purchase)","height":131});
															thumbnails[3753184] = clik.newPhoto({"id":3753184,"src":"P1010327_thumb.JPG","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"HALF BAKED-acrylic and oil on canvas80cm x 80cm(availble to purchase)","height":130});
															thumbnails[3904811] = clik.newPhoto({"id":3904811,"src":"P1010355_thumb.JPG","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"STRAWBERRY MILKSHAKE-acrylic and oil on board40cm x 30cm","height":164});
															thumbnails[3904813] = clik.newPhoto({"id":3904813,"src":"P10103571_thumb.JPG","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"HOLSTIEN GREEN-<br>\r\nacrylic and oil on canvas<br>\r\n80cm x 80cm","height":128});
															thumbnails[3912384] = clik.newPhoto({"id":3912384,"src":"DSC00328_thumb.JPG","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"STOP AND LOOK-acrylic and oil on canvas30cm x 20cm","height":173});
															thumbnails[4344227] = clik.newPhoto({"id":4344227,"src":"P1010577_thumb.JPG","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"CHELSEA AND TIPPY<br>\r\noil on canvas<br>\r\n70cm x 100 cm","height":89});
															thumbnails[4837556] = clik.newPhoto({"id":4837556,"src":"P1010719_thumb.JPG","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"MURPHY<br>\r\noil on canvas<br>\r\n40cm x 60cm","height":90});
															thumbnails[5244835] = clik.newPhoto({"id":5244835,"src":"P1020136_thumb.JPG","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"ROSIE-<br>\r\noil on canvas<br>\r\n50cm x 50cm","height":131});
															thumbnails[8158948] = clik.newPhoto({"id":8158948,"src":"PURPLE_HAZE_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"","height":132});
															thumbnails[3616952] = clik.newPhoto({"id":3616952,"src":"test1_thumb.jpg","galleries_id":393659,"server_id":15,"link":"photo_3616952.html","width":130,"caption":"ACHROMATIC- oil on canvas 80cm x 100cm","height":91});
															thumbnails[3617607] = clik.newPhoto({"id":3617607,"src":"test7_thumb.jpg","galleries_id":393659,"server_id":15,"link":"photo_3617607.html","width":130,"caption":"ALL EARS- oil on canvas  40cm x 100cm","height":51});
															thumbnails[3657083] = clik.newPhoto({"id":3657083,"src":"P1010347_thumb.JPG","galleries_id":393659,"server_id":15,"link":"photo_3657083.html","width":130,"caption":"SIDE BY SIDE- acrylic and oil on canvas 30cm x 50cm","height":61});
															thumbnails[3727781] = clik.newPhoto({"id":3727781,"src":"DSC00294_thumb.JPG","galleries_id":393659,"server_id":15,"link":"photo_3727781.html","width":130,"caption":"GREVVY- acrylic and oil on linen 40cm x 40cm","height":128});
															thumbnails[3779124] = clik.newPhoto({"id":3779124,"src":"DSC00320_thumb.JPG","galleries_id":393659,"server_id":15,"link":"photo_3779124.html","width":130,"caption":"TO BE LOVED- acrylic and oil on canvas 70cm x 100cm","height":91});
															thumbnails[3904815] = clik.newPhoto({"id":3904815,"src":"P1010358_thumb.JPG","galleries_id":393659,"server_id":15,"link":"photo_3904815.html","width":130,"caption":"BEAUTIFUL TOGETHER- acrylic and oil on linen  90cm x 90cm","height":126});
															thumbnails[5190585] = clik.newPhoto({"id":5190585,"src":"nudge_thumb.JPG","galleries_id":393659,"server_id":15,"link":"photo_5190585.html","width":130,"caption":"NUDGE- oil on canvas 100cm x 100cm","height":130});
															thumbnails[6178609] = clik.newPhoto({"id":6178609,"src":"cheetah1_thumb.jpg","galleries_id":393659,"server_id":15,"link":"photo_6178609.html","width":130,"caption":"LAZY LOOK- oil on canvas 90cm x 90cm","height":127});
															thumbnails[6178610] = clik.newPhoto({"id":6178610,"src":"morninglight_thumb.jpg","galleries_id":393659,"server_id":15,"link":"photo_6178610.html","width":130,"caption":"LOW SUN- oil on canvas 30cm x 40cm","height":97});
															thumbnails[6178613] = clik.newPhoto({"id":6178613,"src":"neveralone_thumb.jpg","galleries_id":393659,"server_id":15,"link":"photo_6178613.html","width":130,"caption":"NEVER ALONE- oil on canvas 30cm x 40cm","height":95});
															thumbnails[6178614] = clik.newPhoto({"id":6178614,"src":"sidestripes1_thumb.jpg","galleries_id":393659,"server_id":15,"link":"photo_6178614.html","width":130,"caption":"SIDE STRIPES- oil on canvas 80cm x 80cm","height":125});
															thumbnails[7277875] = clik.newPhoto({"id":7277875,"src":"123_thumb.jpg","galleries_id":393659,"server_id":15,"link":"photo_7277875.html","width":130,"caption":"JUST CHILLING- oil on canvas 120cm x120cm","height":130});
															thumbnails[7278231] = clik.newPhoto({"id":7278231,"src":"1234_thumb.jpg","galleries_id":393659,"server_id":15,"link":"photo_7278231.html","width":130,"caption":"BECOME ONE- oil on canvas 150cm x 130cm","height":112});
															thumbnails[7278366] = clik.newPhoto({"id":7278366,"src":"09_thumb.jpg","galleries_id":393659,"server_id":15,"link":"photo_7278366.html","width":130,"caption":"SOMETIME AROUND DUSK- oil on canvas 90cm x 90cm","height":132});
															thumbnails[7278375] = clik.newPhoto({"id":7278375,"src":"098_thumb.jpg","galleries_id":393659,"server_id":15,"link":"photo_7278375.html","width":130,"caption":"GREY SWAY- oil on canvas 110cm x 130cm","height":101});
															thumbnails[7278379] = clik.newPhoto({"id":7278379,"src":"0987_thumb.jpg","galleries_id":393659,"server_id":15,"link":"photo_7278379.html","width":130,"caption":"ZEBRA GLANCE- oli on canvas 80cm x 80cm","height":128});
															thumbnails[7278380] = clik.newPhoto({"id":7278380,"src":"12345_thumb.jpg","galleries_id":393659,"server_id":15,"link":"photo_7278380.html","width":130,"caption":"ACCELERATE- oil on canvas 120cm x 120cm","height":134});
															thumbnails[7278384] = clik.newPhoto({"id":7278384,"src":"098765_thumb.jpg","galleries_id":393659,"server_id":15,"link":"photo_7278384.html","width":130,"caption":"IMPI- oil on canvas 90cm x 90cm","height":129});
															thumbnails[7278386] = clik.newPhoto({"id":7278386,"src":"123456_thumb.jpg","galleries_id":393659,"server_id":15,"link":"photo_7278386.html","width":130,"caption":"COMING CLOSER- oil on canvas 130 x 130cm ","height":134});
															thumbnails[7278389] = clik.newPhoto({"id":7278389,"src":"0987654_thumb.jpg","galleries_id":393659,"server_id":15,"link":"photo_7278389.html","width":130,"caption":"HUNTER- oil on canvas 120cm x 120cm","height":135});
															thumbnails[7278395] = clik.newPhoto({"id":7278395,"src":"1234567_thumb.jpg","galleries_id":393659,"server_id":15,"link":"photo_7278395.html","width":130,"caption":"MOCK CHARGE- oil on canvas 150cm x 150cm","height":136});
															thumbnails[7278397] = clik.newPhoto({"id":7278397,"src":"09876543_thumb.jpg","galleries_id":393659,"server_id":15,"link":"photo_7278397.html","width":130,"caption":"PUNK- oil on canvas 50cm x 50cm","height":131});
															thumbnails[7278401] = clik.newPhoto({"id":7278401,"src":"12345678_thumb.jpg","galleries_id":393659,"server_id":15,"link":"photo_7278401.html","width":130,"caption":"SWAGGER- oil on canvas 120cm x 120cm","height":136});
															thumbnails[7278406] = clik.newPhoto({"id":7278406,"src":"123456789_thumb.jpg","galleries_id":393659,"server_id":15,"link":"photo_7278406.html","width":130,"caption":"THE MATRIARCH- oil on canvas 150cm x 150cm","height":131});
															thumbnails[7278408] = clik.newPhoto({"id":7278408,"src":"Magenta.tusker.130cmx130cm1_thumb.jpg","galleries_id":393659,"server_id":15,"link":"photo_7278408.html","width":130,"caption":"MAGENTA TUSKER- oil on canvas 130cm x 130cm","height":130});
															thumbnails[7279993] = clik.newPhoto({"id":7279993,"src":"09876_thumb.jpg","galleries_id":393659,"server_id":15,"link":"photo_7279993.html","width":130,"caption":"GRACE-  oil on canvas 90cm x 90cm","height":129});
															thumbnails[7280146] = clik.newPhoto({"id":7280146,"src":"111_thumb.jpg","galleries_id":393659,"server_id":15,"link":"photo_7280146.html","width":130,"caption":"PAWS 4 THOUGHT- oil on canvas 100cm x 100cm","height":133});
															thumbnails[7280151] = clik.newPhoto({"id":7280151,"src":"222_thumb.jpg","galleries_id":393659,"server_id":15,"link":"photo_7280151.html","width":130,"caption":"LAZY LOOK- oil on canvas 90cm x 90cm","height":129});
															thumbnails[7280152] = clik.newPhoto({"id":7280152,"src":"3333_thumb.jpg","galleries_id":393659,"server_id":15,"link":"photo_7280152.html","width":130,"caption":"LEOPARD PROFILE- oil on canvas 90cm x 90cm","height":129});
															thumbnails[7280153] = clik.newPhoto({"id":7280153,"src":"4444_thumb.jpg","galleries_id":393659,"server_id":15,"link":"photo_7280153.html","width":130,"caption":"NICE SPOT- oil on canvas 50cm x 50cm","height":119});
															thumbnails[4351764] = clik.newPhoto({"id":4351764,"src":"0326_eggleton_in_motion_thumb.jpg","galleries_id":393659,"server_id":15,"link":"photo_4351764.html","width":130,"caption":"IN MOTION (tryptich)- oil on linen 240cm x 70cm","height":43});
															thumbnails[3727775] = clik.newPhoto({"id":3727775,"src":"DSC00293_thumb.JPG","galleries_id":393655,"server_id":15,"link":"photo_3727775.html","width":130,"caption":"LEOPARD STUDY- charcaol and pastel on board 30cm x 50cm","height":70});
															thumbnails[3727975] = clik.newPhoto({"id":3727975,"src":"bcn_thumb.jpg","galleries_id":393655,"server_id":15,"link":"photo_3727975.html","width":130,"caption":"BENGAL STUDY- charcoal and pastel on board 50cm x 80cm","height":89});
															thumbnails[4280685] = clik.newPhoto({"id":4280685,"src":"website1_thumb.jpg","galleries_id":393655,"server_id":15,"link":"photo_4280685.html","width":130,"caption":"ZEBRA CHARCOAL charcoal on paper 70cm x 40cm","height":227});
															thumbnails[6178616] = clik.newPhoto({"id":6178616,"src":"P1040052_thumb.JPG","galleries_id":393655,"server_id":15,"link":"photo_6178616.html","width":130,"caption":"SILENT HUNTER- charcoal on board 70cm x 120cm","height":83});
															thumbnails[7470801] = clik.newPhoto({"id":7470801,"src":"lioncub_thumb.jpg","galleries_id":405002,"server_id":15,"link":"photo_7470801.html","width":130,"caption":"","height":160});
															thumbnails[7470833] = clik.newPhoto({"id":7470833,"src":"zebz_thumb.jpg","galleries_id":405002,"server_id":15,"link":"photo_7470833.html","width":130,"caption":"","height":67});
															thumbnails[7470843] = clik.newPhoto({"id":7470843,"src":"P1040813_thumb.JPG","galleries_id":405002,"server_id":15,"link":"photo_7470843.html","width":130,"caption":"","height":98});
															thumbnails[7470856] = clik.newPhoto({"id":7470856,"src":"P1040951_thumb.JPG","galleries_id":405002,"server_id":15,"link":"photo_7470856.html","width":130,"caption":"","height":98});
															thumbnails[7470874] = clik.newPhoto({"id":7470874,"src":"P1050082_thumb.JPG","galleries_id":405002,"server_id":15,"link":"photo_7470874.html","width":130,"caption":"","height":98});
															thumbnails[7470881] = clik.newPhoto({"id":7470881,"src":"P1050169_thumb.JPG","galleries_id":405002,"server_id":15,"link":"photo_7470881.html","width":130,"caption":"","height":98});
															thumbnails[7470926] = clik.newPhoto({"id":7470926,"src":"P1050171_thumb.jpg","galleries_id":405002,"server_id":15,"link":"photo_7470926.html","width":130,"caption":"","height":142});
															thumbnails[7470944] = clik.newPhoto({"id":7470944,"src":"P1050154_thumb.jpg","galleries_id":405002,"server_id":15,"link":"photo_7470944.html","width":130,"caption":"","height":153});
															thumbnails[7470953] = clik.newPhoto({"id":7470953,"src":"P1040988_thumb.JPG","galleries_id":405002,"server_id":15,"link":"photo_7470953.html","width":130,"caption":"","height":98});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[405002] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"my photos","link":"section484133.html","maxRecords":0.0,"photoIDs":[7470801.0,7470833.0,7470843.0,7470856.0,7470874.0,7470881.0,7470926.0,7470944.0,7470953.0],"skipIndex":0,"section_code":"section484133","featured_images":"7470953,7470944,7470926,7470881,7470874,7470856,7470843,7470833,7470801","id":405002,"singleSection":true});				  						galleries[393655] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"wildlife drawings","link":"section467985.html","maxRecords":0.0,"photoIDs":[3727775.0,3727975.0,4280685.0,6178616.0],"skipIndex":0,"section_code":"section467985","featured_images":3727775.0,"id":393655,"singleSection":true});				  						galleries[393659] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"wildlife paintings","link":"section467991.html","maxRecords":0.0,"photoIDs":[3616952.0,3617607.0,3657083.0,3727781.0,3779124.0,3904815.0,5190585.0,6178609.0,6178610.0,6178613.0,6178614.0,7277875.0,7278231.0,7278366.0,7278375.0,7278379.0,7278380.0,7278384.0,7278386.0,7278389.0,7278395.0,7278397.0,7278401.0,7278406.0,7278408.0,7279993.0,7280146.0,7280151.0,7280152.0,7280153.0,4351764.0],"skipIndex":0,"section_code":"section467991","featured_images":"7280153,7280152,7280151,7280146,7279993,7278408,7278406,7278401,7278397,7278395","id":393659,"singleSection":true});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '8158948';
imageSets[2] = '3912384,3904811,3727775,3657081,3635800';
imageSets[3] = '7280153,7280152,7280151,7280146,7279993,7278408,7278406,7278401,7278397,7278395,7278389,7278386,7278384,7278380,7278375,7278366,7278231,6178616,6178614,6178613,6178610,6178609,5190585,3904815,3779124,3727781,3657083,3617607';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/kitson/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/kitson/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/kitson/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/kitson/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/kitson/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/kitson/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/kitson/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/kitson/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/kitson/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/kitson/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/kitson/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/kitson/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/kitson/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/kitson/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/kitson/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/kitson/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/kitson/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/kitson/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/kitson/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/kitson/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/kitson/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/kitson/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/kitson/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/kitson/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 += 'section467991.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 && 'section467991' != '') {
					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 = 'darryn  eggleton  artist: ' + 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;
	}
}

			

