window.thumbnails = {};
															thumbnails[541354] = clik.newPhoto({"id":541354,"src":"Lyn_Greyhound_Portrait_in_acrylics_thumb.JPG","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Shelbourne Lyn","height":101});
															thumbnails[568160] = clik.newPhoto({"id":568160,"src":"Longtailedtit_in_gouache_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Long-tailed Tit","height":152});
															thumbnails[568629] = clik.newPhoto({"id":568629,"src":"Coal_tit_gouache_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Coal Tit","height":143});
															thumbnails[568650] = clik.newPhoto({"id":568650,"src":"Blue_tit_gouache1_thumb.JPG","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Blue Tit","height":107});
															thumbnails[568681] = clik.newPhoto({"id":568681,"src":"Red_admiral_gouache_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Red Admiral","height":121});
															thumbnails[729226] = clik.newPhoto({"id":729226,"src":"Red_squirrel_acrylics_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Red Squirrel","height":168});
															thumbnails[541383] = clik.newPhoto({"id":541383,"src":"Sophie_Blue_Cream_Kitten_Portrait_in_graphite_thumb.JPG","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Sophie","height":98});
															thumbnails[3076987] = clik.newPhoto({"id":3076987,"src":"jr in bed400 72dpi_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"JR","height":174});
															thumbnails[5496955] = clik.newPhoto({"id":5496955,"src":"Robin_portrait_acrylic_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Robin ","height":169});
															thumbnails[541373] = clik.newPhoto({"id":541373,"src":"Max_Airedale_Portrait_in_graphite_thumb.JPG","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Max","height":179});
															thumbnails[541304] = clik.newPhoto({"id":541304,"src":"Pug-web_copy_thumb.jpg","galleries_id":42021,"server_id":1,"link":"photo_541304.html","width":130,"caption":"Harry ","height":108});
															thumbnails[6017260] = clik.newPhoto({"id":6017260,"src":"zebra_painting_reduced_thumb.jpg","galleries_id":379099,"server_id":1,"link":"photo_6017260.html","width":130,"caption":"Zebra","height":87});
															thumbnails[6996068] = clik.newPhoto({"id":6996068,"src":"Leopard-web_copy_thumb.jpg","galleries_id":42024,"server_id":1,"link":"photo_6996068.html","width":130,"caption":"Leopard","height":95});
															thumbnails[7334086] = clik.newPhoto({"id":7334086,"src":"Head-of-Hare_web_thumb.jpg","galleries_id":379094,"server_id":1,"link":"photo_7334086.html","width":112,"caption":"Head of Hare","height":160});
															thumbnails[7336494] = clik.newPhoto({"id":7336494,"src":"bull-hereford_web_copy_thumb.jpg","galleries_id":397027,"server_id":1,"link":"photo_7336494.html","width":130,"caption":"Hereford Bull","height":130});
															thumbnails[5829586] = clik.newPhoto({"id":5829586,"src":"Barti_painting_reduced_copyright_thumb.jpg","galleries_id":42022,"server_id":1,"link":"photo_5829586.html","width":130,"caption":"Barti","height":101});
															thumbnails[568616] = clik.newPhoto({"id":568616,"src":"Desert_Orchid_in_gouache_thumb.jpg","galleries_id":42023,"server_id":1,"link":"photo_568616.html","width":130,"caption":"Desert Orchid","height":124});
															thumbnails[594118] = clik.newPhoto({"id":594118,"src":"Fox_in_acrylic_thumb.JPG","galleries_id":379094,"server_id":1,"link":"photo_594118.html","width":130,"caption":"Fox","height":158});
															thumbnails[659170] = clik.newPhoto({"id":659170,"src":"bulldog _portrait_coloured_pencils_thumb.jpg","galleries_id":42021,"server_id":1,"link":"photo_659170.html","width":130,"caption":"Bulldog","height":98});
															thumbnails[1549790] = clik.newPhoto({"id":1549790,"src":"Red_Tabby_Face_acrylic 400 72dpi_thumb.jpg","galleries_id":42022,"server_id":1,"link":"photo_1549790.html","width":130,"caption":"Ginger and white","height":92});
															thumbnails[3059859] = clik.newPhoto({"id":3059859,"src":"Tigers eye 400 72dpi_thumb.jpg","galleries_id":42024,"server_id":1,"link":"photo_3059859.html","width":130,"caption":"Eye of the Tiger","height":90});
															thumbnails[6993696] = clik.newPhoto({"id":6993696,"src":"Lion-web-450_copy_thumb.jpg","galleries_id":42024,"server_id":1,"link":"photo_6993696.html","width":130,"caption":"Lion","height":98});
															thumbnails[7336570] = clik.newPhoto({"id":7336570,"src":"Pig2_web_thumb.jpg","galleries_id":397027,"server_id":1,"link":"photo_7336570.html","width":130,"caption":"Saddleback Pig","height":130});
															thumbnails[702175] = clik.newPhoto({"id":702175,"src":"cats_eyes_in_coloured_pencil_thumb.jpg","galleries_id":42022,"server_id":1,"link":"photo_702175.html","width":130,"caption":"Tortie","height":83});
															thumbnails[3061271] = clik.newPhoto({"id":3061271,"src":"fox in sun  400 72dpi_thumb.jpg","galleries_id":379094,"server_id":1,"link":"photo_3061271.html","width":130,"caption":"Early Sun","height":163});
															thumbnails[3061383] = clik.newPhoto({"id":3061383,"src":"Jaguar-web_copy_thumb.jpg","galleries_id":42024,"server_id":1,"link":"photo_3061383.html","width":130,"caption":"Jaguar","height":163});
															thumbnails[7336573] = clik.newPhoto({"id":7336573,"src":"ram2_web_thumb.jpg","galleries_id":397027,"server_id":1,"link":"photo_7336573.html","width":130,"caption":"Blackface Ram","height":130});
															thumbnails[8298959] = clik.newPhoto({"id":8298959,"src":"Wren-blossom-web_copy_thumb.jpg","galleries_id":379097,"server_id":1,"link":"photo_8298959.html","width":130,"caption":"Morning Song","height":104});
															thumbnails[541380] = clik.newPhoto({"id":541380,"src":"Brian_Ginger_cat_portrait_in_acrylics_thumb.JPG","galleries_id":42022,"server_id":1,"link":"photo_541380.html","width":130,"caption":"Brian","height":94});
															thumbnails[639595] = clik.newPhoto({"id":639595,"src":"wolf_portrait_acrylics_thumb.jpg","galleries_id":379099,"server_id":1,"link":"photo_639595.html","width":130,"caption":"Sleeping Wolf","height":184});
															thumbnails[677746] = clik.newPhoto({"id":677746,"src":"Staffy-web_copy_thumb.jpg","galleries_id":42021,"server_id":1,"link":"photo_677746.html","width":130,"caption":"Staffordshire Bull Terrier","height":99});
															thumbnails[729203] = clik.newPhoto({"id":729203,"src":"horse_eye_in_acrylics_thumb.jpg","galleries_id":42023,"server_id":1,"link":"photo_729203.html","width":130,"caption":"Horse Eye","height":83});
															thumbnails[7036842] = clik.newPhoto({"id":7036842,"src":"Robin-chippy-web_copy_thumb.jpg","galleries_id":379097,"server_id":1,"link":"photo_7036842.html","width":130,"caption":"Churchyard Robin","height":104});
															thumbnails[677737] = clik.newPhoto({"id":677737,"src":"Lyn_portrait_in_graphite_thumb.jpg","galleries_id":42021,"server_id":1,"link":"photo_677737.html","width":130,"caption":"Shelbourne Lyn","height":97});
															thumbnails[7293371] = clik.newPhoto({"id":7293371,"src":"Blue-Tit_web_copy_thumb.jpg","galleries_id":379097,"server_id":1,"link":"photo_7293371.html","width":130,"caption":"Gold and Blue","height":104});
															thumbnails[3062418] = clik.newPhoto({"id":3062418,"src":"tabby blue eyes profile 400 72dpi_thumb.jpg","galleries_id":42022,"server_id":1,"link":"photo_3062418.html","width":130,"caption":"Concentration","height":109});
															thumbnails[3060566] = clik.newPhoto({"id":3060566,"src":"Cat-Watching-web_copy_thumb.jpg","galleries_id":42022,"server_id":1,"link":"photo_3060566.html","width":130,"caption":"Watching","height":104});
															thumbnails[3076706] = clik.newPhoto({"id":3076706,"src":"cavalier 400 72dpi_thumb.jpg","galleries_id":42021,"server_id":1,"link":"photo_3076706.html","width":130,"caption":"Thoughtful","height":101});
															thumbnails[541339] = clik.newPhoto({"id":541339,"src":"Daisy_Jack_Russell_Portrait_in_acrylics_thumb.JPG","galleries_id":42021,"server_id":1,"link":"photo_541339.html","width":130,"caption":"Daisy","height":95});
															thumbnails[3061782] = clik.newPhoto({"id":3061782,"src":"tabby on canvas 300 72dpi_thumb.jpg","galleries_id":42022,"server_id":1,"link":"photo_3061782.html","width":130,"caption":"Tabby","height":133});
															thumbnails[7041083] = clik.newPhoto({"id":7041083,"src":"Owl-tawny-web_copy_thumb.jpg","galleries_id":379097,"server_id":1,"link":"photo_7041083.html","width":130,"caption":"Tawny Owl","height":134});
															thumbnails[541386] = clik.newPhoto({"id":541386,"src":"Tigger_Tabby_Cat_portrait_in_coloured_pencil_thumb.JPG","galleries_id":42022,"server_id":1,"link":"photo_541386.html","width":130,"caption":"Tigger ","height":168});
															thumbnails[541395] = clik.newPhoto({"id":541395,"src":"Foal-dun_copy_thumb.jpg","galleries_id":42023,"server_id":1,"link":"photo_541395.html","width":130,"caption":"Duncan","height":170});
															thumbnails[594114] = clik.newPhoto({"id":594114,"src":"Lucy_Labrador_portrait_graphite_thumb.JPG","galleries_id":42021,"server_id":1,"link":"photo_594114.html","width":130,"caption":"Lucy","height":147});
															thumbnails[7041093] = clik.newPhoto({"id":7041093,"src":"Owl-eagle-web-copy_thumb.jpg","galleries_id":379097,"server_id":1,"link":"photo_7041093.html","width":130,"caption":"Eagle Owl","height":133});
															thumbnails[7823567] = clik.newPhoto({"id":7823567,"src":"Snowy-hare-web500_copy_thumb.jpg","galleries_id":379094,"server_id":1,"link":"photo_7823567.html","width":130,"caption":"Frosty Morning","height":76});
															thumbnails[541438] = clik.newPhoto({"id":541438,"src":"Pony-willow-web_copy_thumb.jpg","galleries_id":42023,"server_id":1,"link":"photo_541438.html","width":130,"caption":"Willow","height":195});
															thumbnails[1466528] = clik.newPhoto({"id":1466528,"src":"choc-lab-web_copy_thumb.jpg","galleries_id":42021,"server_id":1,"link":"photo_1466528.html","width":130,"caption":"Chocolate Labrador","height":104});
															thumbnails[771469] = clik.newPhoto({"id":771469,"src":"Golden-retriever_web_copy_thumb.jpg","galleries_id":42021,"server_id":1,"link":"photo_771469.html","width":130,"caption":"Golden Retriever","height":163});
															thumbnails[702174] = clik.newPhoto({"id":702174,"src":"Beagle-web_copy_thumb.jpg","galleries_id":42021,"server_id":1,"link":"photo_702174.html","width":130,"caption":"Beagle<br>\r\n","height":169});
															thumbnails[4941499] = clik.newPhoto({"id":4941499,"src":"puskat_450_72pdi_thumb.jpg","galleries_id":358690,"server_id":1,"link":"photo_4941499.html","width":130,"caption":"Puskat","height":194});
															thumbnails[567348] = clik.newPhoto({"id":567348,"src":"Josie_tabby_cat_portrait_in_acrylics_thumb.JPG","galleries_id":358690,"server_id":1,"link":"photo_567348.html","width":130,"caption":"Josie","height":109});
															thumbnails[541369] = clik.newPhoto({"id":541369,"src":"Mally_CKC_portrait_in_graphite_thumb.JPG","galleries_id":358690,"server_id":1,"link":"photo_541369.html","width":130,"caption":"Mali","height":150});
															thumbnails[541889] = clik.newPhoto({"id":541889,"src":"Cleo_cp2_450_thumb.JPG","galleries_id":358690,"server_id":1,"link":"photo_541889.html","width":130,"caption":"Cleo","height":184});
															thumbnails[541359] = clik.newPhoto({"id":541359,"src":"Jim_and_Rab_Westies_in_graphite_thumb.JPG","galleries_id":358690,"server_id":1,"link":"photo_541359.html","width":130,"caption":"Jim & Rab","height":87});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[379097] = clik.newGallery({"parentGallery":379093,"usePopups":false,"title":"Birds","link":"gallery_379097.html","maxRecords":0.0,"photoIDs":[8298959.0,7036842.0,7293371.0,7041083.0,7041093.0],"skipIndex":0,"section_code":"gallery","featured_images":"8298959,7293371,7041093,7041083,7036842","id":379097,"singleSection":false});				  						galleries[379094] = clik.newGallery({"parentGallery":379093,"usePopups":false,"title":"British Wildlife","link":"gallery_379094.html","maxRecords":0.0,"photoIDs":[7334086.0,594118.0,3061271.0,7823567.0],"skipIndex":0,"section_code":"gallery","featured_images":"7823567,7334086,3061271,594118","id":379094,"singleSection":false});				  						galleries[358690] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Examples of Pet Portraits","link":"section427536.html","maxRecords":0.0,"photoIDs":[4941499.0,567348.0,541369.0,541889.0,541359.0],"skipIndex":0,"section_code":"section427536","featured_images":"4941499,567348,541889,541369,541359","id":358690,"singleSection":true});				  						galleries[379093] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Wildlife","link":"gallery_379093.html","maxRecords":0.0,"photoIDs":[],"skipIndex":0,"section_code":"gallery","featured_images":"8298959,7823567,7334086,7293371,7041093,7041083,7036842,6996068,6993696,6017260,3061383,3061271,3059859,639595,594118","id":379093,"singleSection":false});				  						galleries[397027] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Farm Animals","link":"gallery_397027.html","maxRecords":0.0,"photoIDs":[7336494.0,7336570.0,7336573.0],"skipIndex":0,"section_code":"gallery","featured_images":"7336573,7336570,7336494","id":397027,"singleSection":false});				  						galleries[42024] = clik.newGallery({"parentGallery":379093,"usePopups":false,"title":"Big Cats","link":"gallery_42024.html","maxRecords":0.0,"photoIDs":[6996068.0,3059859.0,6993696.0,3061383.0],"skipIndex":0,"section_code":"gallery","featured_images":"6996068,6993696,3061383,3059859","id":42024,"singleSection":false});				  						galleries[42022] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Cats","link":"gallery_42022.html","maxRecords":0.0,"photoIDs":[5829586.0,1549790.0,702175.0,541380.0,3062418.0,3060566.0,3061782.0,541386.0],"skipIndex":0,"section_code":"gallery","featured_images":"5829586,3062418,3061782,3060566,1549790,702175,541386,541380","id":42022,"singleSection":false});				  						galleries[379099] = clik.newGallery({"parentGallery":379093,"usePopups":false,"title":"Other","link":"gallery_379099.html","maxRecords":0.0,"photoIDs":[6017260.0,639595.0],"skipIndex":0,"section_code":"gallery","featured_images":"6017260,639595","id":379099,"singleSection":false});				  						galleries[42023] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Horses","link":"gallery_42023.html","maxRecords":0.0,"photoIDs":[568616.0,729203.0,541395.0,541438.0],"skipIndex":0,"section_code":"gallery","featured_images":"729203,568616,541438,541395","id":42023,"singleSection":false});				  						galleries[42021] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Dogs","link":"gallery_42021.html","maxRecords":0.0,"photoIDs":[541304.0,659170.0,677746.0,677737.0,3076706.0,541339.0,594114.0,1466528.0,771469.0,702174.0],"skipIndex":0,"section_code":"gallery","featured_images":"3076706,677746,659170,594114,541339,541304","id":42021,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '8298959';
imageSets[2] = '729226,7336494,7334086,6996068,6017260,541304,5829586,7336570,6993696,3059859,1549790,659170,594118,568616,8298959,7336573,3061383,3061271,702175,7036842,729203,677746,639595,541380,7293371,3062418,3076706,3060566,3061782,541339,7041083,7823567,7041093,594114,541395,541386,541438,5496955';
imageSets[3] = '8298959,7823567,7336573,7336570,7336494,7334086,7293371,7041093,7041083,7036842,6996068,6993696,6017260,5829586,5496955,4941499,3076987,3076706,3062418,3061782,3061383,3061271,3060566,3059859,1549790,1466528,771469,729226,729203,702175,702174,677746,677737,659170,639595,594118,594114,568681,568650,568629,568616,568160,567348,541889,541438,541395,541386,541383,541380,541373';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/dawnfox/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/dawnfox/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/dawnfox/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/dawnfox/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/dawnfox/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/dawnfox/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/dawnfox/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/dawnfox/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/dawnfox/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/dawnfox/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/dawnfox/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/dawnfox/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/dawnfox/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/dawnfox/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/dawnfox/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/dawnfox/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/dawnfox/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/dawnfox/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/dawnfox/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/dawnfox/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/dawnfox/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/dawnfox/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/dawnfox/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/dawnfox/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/dawnfox/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/dawnfox/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/dawnfox/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 = 'Dawn Fox animal art: ' + 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>';
	}
				
	temp += this.fnGetPaymentInfo();
				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>Buy now using PayPal:</p>';
				temp += '<div class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> &pound;' + (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="updateCartValue($(this.form).next(\'#paymentForm\')[0],this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value); if(divShowing(\'paymentConfirm\')){fadeOut(\'paymentConfirm\', 3)};">';
		
		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 += '<form id="paymentForm" style="margin:0px;border:0px;" name="paymentForm">';
			temp += '	<input type="hidden" name="item_option" value="' + item_option + '">';
			temp += '	<input type="hidden" name="site" value="DAWNFOX">';
			temp += '	<input type="hidden" name="item_number" value="'+ this.id +'">';
			temp += '	<input type="hidden" name="quantity" value="1">';
						temp += '	<input value="Add to cart" id="paymentAddButton" class="button" onmouseover="this.className=\'buttonHi\'\;" onmouseout="this.className=\'button\'\;" type="Button">';
							temp += '	<input value="View cart" id="paymentViewButton" class="button" onmouseover="this.className=\'buttonHi\';" onmouseout="this.className=\'button\';" type="Button" onclick="javascript:window.location=\'cart.html\'">';
			temp += '</form>';
						temp += '<div class="clearing">&nbsp;</div>';
			temp += '<div id="confirmContainer">';
			temp += '<div id="paymentConfirm">Item added to cart</div>';
			temp += '</div>';
			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;
	}
}

			

