window.thumbnails = {};
															thumbnails[5447274] = clik.newPhoto({"id":5447274,"src":"A_thumb.jpg","galleries_id":275634,"server_id":18,"link":"photo_5447274.html","width":104,"caption":"DUCHESS","height":130});
															thumbnails[5447278] = clik.newPhoto({"id":5447278,"src":"B1_thumb.jpg","galleries_id":275634,"server_id":18,"link":"photo_5447278.html","width":104,"caption":"DUKE","height":130});
															thumbnails[5447286] = clik.newPhoto({"id":5447286,"src":"C1_thumb.jpg","galleries_id":275634,"server_id":18,"link":"photo_5447286.html","width":130,"caption":"Raoul and Rosina ","height":130});
															thumbnails[5447289] = clik.newPhoto({"id":5447289,"src":"D_thumb.jpg","galleries_id":275634,"server_id":18,"link":"photo_5447289.html","width":130,"caption":"Red fox","height":130});
															thumbnails[5447292] = clik.newPhoto({"id":5447292,"src":"E2_thumb.jpg","galleries_id":275634,"server_id":18,"link":"photo_5447292.html","width":112,"caption":"Gypsy and tiger","height":130});
															thumbnails[5447300] = clik.newPhoto({"id":5447300,"src":"F1_thumb.jpg","galleries_id":275634,"server_id":18,"link":"photo_5447300.html","width":97,"caption":"Eagle vs Snake ","height":130});
															thumbnails[4870605] = clik.newPhoto({"id":4870605,"src":"1_full1_thumb.gif","galleries_id":275634,"server_id":18,"link":"photo_4870605.html","width":107,"caption":"Gypsy with butterfly ","height":130});
															thumbnails[4870606] = clik.newPhoto({"id":4870606,"src":"2_full1_thumb.gif","galleries_id":275634,"server_id":18,"link":"photo_4870606.html","width":103,"caption":"Fortune ","height":130});
															thumbnails[4870607] = clik.newPhoto({"id":4870607,"src":"3_full1_thumb.gif","galleries_id":275634,"server_id":18,"link":"photo_4870607.html","width":130,"caption":"Juan and Frieda","height":129});
															thumbnails[4870609] = clik.newPhoto({"id":4870609,"src":"5_full1_thumb.gif","galleries_id":275634,"server_id":18,"link":"photo_4870609.html","width":130,"caption":"Finders keepers","height":128});
															thumbnails[4870621] = clik.newPhoto({"id":4870621,"src":"10_full1_thumb.gif","galleries_id":275634,"server_id":18,"link":"photo_4870621.html","width":130,"caption":"Anchor and swallow","height":128});
															thumbnails[4870628] = clik.newPhoto({"id":4870628,"src":"11_full1_thumb.gif","galleries_id":275634,"server_id":18,"link":"photo_4870628.html","width":107,"caption":"Gypsy head","height":130});
															thumbnails[4870631] = clik.newPhoto({"id":4870631,"src":"0111_thumb.jpg","galleries_id":275634,"server_id":18,"link":"photo_4870631.html","width":130,"caption":"Pirate girl ","height":130});
															thumbnails[4870633] = clik.newPhoto({"id":4870633,"src":"0121_thumb.jpg","galleries_id":275634,"server_id":18,"link":"photo_4870633.html","width":130,"caption":"Owl and locket ","height":130});
															thumbnails[4870640] = clik.newPhoto({"id":4870640,"src":"15_full1_thumb.gif","galleries_id":275634,"server_id":18,"link":"photo_4870640.html","width":130,"caption":"Owl","height":127});
															thumbnails[4870650] = clik.newPhoto({"id":4870650,"src":"16_full1_thumb.gif","galleries_id":275634,"server_id":18,"link":"photo_4870650.html","width":130,"caption":"Homeward bound","height":127});
															thumbnails[4870675] = clik.newPhoto({"id":4870675,"src":"24_full1_thumb.gif","galleries_id":275634,"server_id":18,"link":"photo_4870675.html","width":130,"caption":"Nautical pin up","height":128});
															thumbnails[4870676] = clik.newPhoto({"id":4870676,"src":"25_full1_thumb.gif","galleries_id":275634,"server_id":18,"link":"photo_4870676.html","width":107,"caption":"Navy dream","height":130});
															thumbnails[4870753] = clik.newPhoto({"id":4870753,"src":"0401_thumb.jpg","galleries_id":275634,"server_id":18,"link":"photo_4870753.html","width":95,"caption":"Jose and Maria ","height":130});
															thumbnails[4870754] = clik.newPhoto({"id":4870754,"src":"0411_thumb.jpg","galleries_id":275634,"server_id":18,"link":"photo_4870754.html","width":122,"caption":"Fighting hares","height":130});
															thumbnails[4870756] = clik.newPhoto({"id":4870756,"src":"0431_thumb.jpg","galleries_id":275634,"server_id":18,"link":"photo_4870756.html","width":44,"caption":"Blue peacock","height":130});
															thumbnails[4870759] = clik.newPhoto({"id":4870759,"src":"0441_thumb.jpg","galleries_id":275634,"server_id":18,"link":"photo_4870759.html","width":91,"caption":"Mary","height":130});
															thumbnails[4870761] = clik.newPhoto({"id":4870761,"src":"0451_thumb.jpg","galleries_id":275634,"server_id":18,"link":"photo_4870761.html","width":126,"caption":"Red pirate","height":130});
															thumbnails[6179683] = clik.newPhoto({"id":6179683,"src":"bird-skel3_thumb.jpg","galleries_id":275634,"server_id":18,"link":"photo_6179683.html","width":130,"caption":"Rosa with Jay ","height":130});
															thumbnails[6179686] = clik.newPhoto({"id":6179686,"src":"new-owl_thumb.jpg","galleries_id":275634,"server_id":18,"link":"photo_6179686.html","width":106,"caption":"owl and crown","height":130});
															thumbnails[6179693] = clik.newPhoto({"id":6179693,"src":"new_locket_thumb.jpg","galleries_id":275634,"server_id":18,"link":"photo_6179693.html","width":130,"caption":"two swallows","height":130});
															thumbnails[6568585] = clik.newPhoto({"id":6568585,"src":"owl1_thumb.jpg","galleries_id":275634,"server_id":18,"link":"photo_6568585.html","width":101,"caption":"love from home","height":130});
															thumbnails[6568733] = clik.newPhoto({"id":6568733,"src":"stag1_thumb.jpg","galleries_id":275634,"server_id":18,"link":"photo_6568733.html","width":130,"caption":"glory","height":128});
															thumbnails[6834644] = clik.newPhoto({"id":6834644,"src":"couple1_thumb.gif","galleries_id":275634,"server_id":18,"link":"photo_6834644.html","width":130,"caption":"True love","height":130});
															thumbnails[6834691] = clik.newPhoto({"id":6834691,"src":"eagle-02_thumb.gif","galleries_id":275634,"server_id":18,"link":"photo_6834691.html","width":105,"caption":"The Baron ","height":130});
															thumbnails[6834703] = clik.newPhoto({"id":6834703,"src":"eagle_thumb.gif","galleries_id":275634,"server_id":18,"link":"photo_6834703.html","width":98,"caption":"Eagle with skull","height":130});
															thumbnails[6834713] = clik.newPhoto({"id":6834713,"src":"family_thumb.gif","galleries_id":275634,"server_id":18,"link":"photo_6834713.html","width":130,"caption":"Family","height":130});
															thumbnails[6834731] = clik.newPhoto({"id":6834731,"src":"pip-squeak_thumb.gif","galleries_id":275634,"server_id":18,"link":"photo_6834731.html","width":101,"caption":"Princess","height":130});
															thumbnails[6834734] = clik.newPhoto({"id":6834734,"src":"tiger_thumb.gif","galleries_id":275634,"server_id":18,"link":"photo_6834734.html","width":130,"caption":"Tiger head","height":130});
															thumbnails[6834902] = clik.newPhoto({"id":6834902,"src":"tiger1_thumb.gif","galleries_id":275633,"server_id":18,"link":"photo_6834902.html","width":130,"caption":"Tiger head","height":130});
															thumbnails[7374298] = clik.newPhoto({"id":7374298,"src":"web_072_thumb.jpg","galleries_id":275633,"server_id":18,"link":"photo_7374298.html","width":86,"caption":"Hope SORRY SOLD ltd edition prints available","height":130});
															thumbnails[7374305] = clik.newPhoto({"id":7374305,"src":"web_073_thumb.jpg","galleries_id":275633,"server_id":18,"link":"photo_7374305.html","width":130,"caption":"STAY TRUE","height":107});
															thumbnails[7374311] = clik.newPhoto({"id":7374311,"src":"web_074_thumb.jpg","galleries_id":275633,"server_id":18,"link":"photo_7374311.html","width":99,"caption":"Prince SOLD","height":130});
															thumbnails[7374330] = clik.newPhoto({"id":7374330,"src":"web_0711_thumb.jpg","galleries_id":275634,"server_id":18,"link":"photo_7374330.html","width":130,"caption":"Pedro and Rita","height":130});
															thumbnails[7374333] = clik.newPhoto({"id":7374333,"src":"web_0721_thumb.jpg","galleries_id":275634,"server_id":18,"link":"photo_7374333.html","width":86,"caption":"hope","height":130});
															thumbnails[7374334] = clik.newPhoto({"id":7374334,"src":"web_0731_thumb.jpg","galleries_id":275634,"server_id":18,"link":"photo_7374334.html","width":130,"caption":"stay true","height":107});
															thumbnails[7374337] = clik.newPhoto({"id":7374337,"src":"web_0741_thumb.jpg","galleries_id":275634,"server_id":18,"link":"photo_7374337.html","width":99,"caption":"Prince","height":130});
															thumbnails[7374338] = clik.newPhoto({"id":7374338,"src":"web_0751_thumb.jpg","galleries_id":275634,"server_id":18,"link":"photo_7374338.html","width":104,"caption":"Earl","height":130});
															thumbnails[7619767] = clik.newPhoto({"id":7619767,"src":"Pedro_and_Rita_thumb.jpg","galleries_id":275634,"server_id":18,"link":"photo_7619767.html","width":130,"caption":"Pedro and Rita","height":130});
															thumbnails[7619786] = clik.newPhoto({"id":7619786,"src":"magpie_thumb.jpg","galleries_id":275634,"server_id":18,"link":"photo_7619786.html","width":130,"caption":"the ring thief","height":130});
															thumbnails[7847072] = clik.newPhoto({"id":7847072,"src":"077_thumb.gif","galleries_id":275633,"server_id":18,"link":"photo_7847072.html","width":103,"caption":"Herzog SOLD","height":130});
															thumbnails[7847081] = clik.newPhoto({"id":7847081,"src":"0771_thumb.gif","galleries_id":275634,"server_id":18,"link":"photo_7847081.html","width":103,"caption":"Herzog","height":130});
															thumbnails[7847096] = clik.newPhoto({"id":7847096,"src":"078_thumb.gif","galleries_id":275633,"server_id":18,"link":"photo_7847096.html","width":130,"caption":"Memento mori","height":130});
															thumbnails[7847105] = clik.newPhoto({"id":7847105,"src":"0781_thumb.gif","galleries_id":275634,"server_id":18,"link":"photo_7847105.html","width":130,"caption":"Memento mori ","height":130});
															thumbnails[7847110] = clik.newPhoto({"id":7847110,"src":"079_thumb.gif","galleries_id":275633,"server_id":18,"link":"photo_7847110.html","width":130,"caption":"Lucky in love","height":130});
															thumbnails[7847117] = clik.newPhoto({"id":7847117,"src":"0791_thumb.gif","galleries_id":275634,"server_id":18,"link":"photo_7847117.html","width":130,"caption":"Lucky in love","height":130});
															thumbnails[7847123] = clik.newPhoto({"id":7847123,"src":"080_thumb.gif","galleries_id":275633,"server_id":18,"link":"photo_7847123.html","width":88,"caption":"Mermaid SOLD","height":130});
															thumbnails[7847125] = clik.newPhoto({"id":7847125,"src":"0801_thumb.gif","galleries_id":275634,"server_id":18,"link":"photo_7847125.html","width":88,"caption":"Mermaid","height":130});
															thumbnails[7847129] = clik.newPhoto({"id":7847129,"src":"081_thumb.gif","galleries_id":275634,"server_id":18,"link":"photo_7847129.html","width":67,"caption":"Reap what you sow","height":130});
															thumbnails[7847133] = clik.newPhoto({"id":7847133,"src":"082_thumb.gif","galleries_id":275634,"server_id":18,"link":"photo_7847133.html","width":130,"caption":"The village wedding","height":103});
															thumbnails[8537601] = clik.newPhoto({"id":8537601,"src":"083_thumb.jpg","galleries_id":275633,"server_id":18,"link":"photo_8537601.html","width":130,"caption":"True til death","height":130});
															thumbnails[8537605] = clik.newPhoto({"id":8537605,"src":"0831_thumb.jpg","galleries_id":275634,"server_id":18,"link":"photo_8537605.html","width":130,"caption":"True til death","height":130});
															thumbnails[8537610] = clik.newPhoto({"id":8537610,"src":"084_thumb.jpg","galleries_id":275634,"server_id":18,"link":"photo_8537610.html","width":130,"caption":"Vanity ","height":130});
															thumbnails[8537619] = clik.newPhoto({"id":8537619,"src":"087_thumb.jpg","galleries_id":275633,"server_id":18,"link":"photo_8537619.html","width":104,"caption":"El Gato","height":130});
															thumbnails[8537631] = clik.newPhoto({"id":8537631,"src":"0871_thumb.jpg","galleries_id":275634,"server_id":18,"link":"photo_8537631.html","width":104,"caption":"el gato","height":130});
															thumbnails[8537648] = clik.newPhoto({"id":8537648,"src":"088_thumb.jpg","galleries_id":275633,"server_id":18,"link":"photo_8537648.html","width":64,"caption":"Tempus fugit","height":130});
															thumbnails[8537653] = clik.newPhoto({"id":8537653,"src":"0881_thumb.jpg","galleries_id":275634,"server_id":18,"link":"photo_8537653.html","width":64,"caption":"Tempus fugit","height":130});
															thumbnails[8537658] = clik.newPhoto({"id":8537658,"src":"090_thumb.jpg","galleries_id":275633,"server_id":18,"link":"photo_8537658.html","width":91,"caption":"Owl with Tea cup","height":130});
															thumbnails[8537668] = clik.newPhoto({"id":8537668,"src":"0901_thumb.jpg","galleries_id":275634,"server_id":18,"link":"photo_8537668.html","width":91,"caption":"Owl with Tea cup","height":130});
															thumbnails[8537674] = clik.newPhoto({"id":8537674,"src":"091_thumb.jpg","galleries_id":275633,"server_id":18,"link":"photo_8537674.html","width":130,"caption":"Through still and storm","height":108});
															thumbnails[8537678] = clik.newPhoto({"id":8537678,"src":"092_thumb.jpg","galleries_id":275633,"server_id":18,"link":"photo_8537678.html","width":99,"caption":"Jackdaw on skull ","height":130});
															thumbnails[8537680] = clik.newPhoto({"id":8537680,"src":"0921_thumb.jpg","galleries_id":275634,"server_id":18,"link":"photo_8537680.html","width":99,"caption":"Jackdaw on skull","height":130});
															thumbnails[8540027] = clik.newPhoto({"id":8540027,"src":"091_B1E5BC03-1EC9-D45B-1C250F9F8DD80452_thumb.jpg","galleries_id":275634,"server_id":18,"link":"photo_8540027.html","width":130,"caption":"Through Still and Storm","height":108});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[275633] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"- Originals","link":"gallery_275633.html","maxRecords":0.0,"photoIDs":[6834902.0,7374298.0,7374305.0,7374311.0,7847072.0,7847096.0,7847110.0,7847123.0,8537601.0,8537619.0,8537648.0,8537658.0,8537674.0,8537678.0],"skipIndex":0,"section_code":"gallery","featured_images":8537678.0,"id":275633,"singleSection":false});				  						galleries[275634] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"- Limited edition prints","link":"gallery_275634.html","maxRecords":0.0,"photoIDs":[5447274.0,5447278.0,5447286.0,5447289.0,5447292.0,5447300.0,4870605.0,4870606.0,4870607.0,4870609.0,4870621.0,4870628.0,4870631.0,4870633.0,4870640.0,4870650.0,4870675.0,4870676.0,4870753.0,4870754.0,4870756.0,4870759.0,4870761.0,6179683.0,6179686.0,6179693.0,6568585.0,6568733.0,6834644.0,6834691.0,6834703.0,6834713.0,6834731.0,6834734.0,7374330.0,7374333.0,7374334.0,7374337.0,7374338.0,7619767.0,7619786.0,7847081.0,7847105.0,7847117.0,7847125.0,7847129.0,7847133.0,8537605.0,8537610.0,8537631.0,8537653.0,8537668.0,8537680.0,8540027.0],"skipIndex":0,"section_code":"gallery","featured_images":8537653.0,"id":275634,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '8537678,8537658,8537619,8537601,7619786';
imageSets[2] = '8537678,8537653';
imageSets[3] = '8537674,8537619,4870754,4870675,4870640,4870633,4870621,4870609';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/kerryevans1965/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/kerryevans1965/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/kerryevans1965/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/kerryevans1965/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/kerryevans1965/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/kerryevans1965/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/kerryevans1965/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/kerryevans1965/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/kerryevans1965/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/kerryevans1965/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/kerryevans1965/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/kerryevans1965/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/kerryevans1965/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/kerryevans1965/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/kerryevans1965/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/kerryevans1965/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/kerryevans1965/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/kerryevans1965/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/kerryevans1965/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/kerryevans1965/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/kerryevans1965/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/kerryevans1965/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/kerryevans1965/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/kerryevans1965/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/kerryevans1965/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/kerryevans1965/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/kerryevans1965/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 = 'Kerry Evans 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="KERRYEVANS1965">';
			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;
	}
}

			

