window.thumbnails = {};
															thumbnails[3078257] = clik.newPhoto({"id":3078257,"src":"Sean_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":196});
															thumbnails[3078296] = clik.newPhoto({"id":3078296,"src":"Sean (1)_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":196});
															thumbnails[3078297] = clik.newPhoto({"id":3078297,"src":"Sean (2)_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":196});
															thumbnails[3078300] = clik.newPhoto({"id":3078300,"src":"Sean (9)_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":196});
															thumbnails[3502802] = clik.newPhoto({"id":3502802,"src":"sean52_thumb.jpg","galleries_id":178430,"server_id":32,"link":"photo_3502802.html","width":130,"caption":"25pt Diamond Triskel Pendant","height":93});
															thumbnails[3502818] = clik.newPhoto({"id":3502818,"src":"Sean 3_thumb.jpg","galleries_id":178432,"server_id":32,"link":"photo_3502818.html","width":130,"caption":"Celtic Weave Earrings","height":93});
															thumbnails[3502908] = clik.newPhoto({"id":3502908,"src":"Sean 2_thumb.jpg","galleries_id":178430,"server_id":32,"link":"photo_3502908.html","width":130,"caption":"Teardrop Pendant","height":93});
															thumbnails[3542540] = clik.newPhoto({"id":3542540,"src":"Saltire_large_thumb.jpg","galleries_id":178430,"server_id":32,"link":"photo_3542540.html","width":130,"caption":"Scotland Homecoming<br>\r\n         Pendant © <br>\r\n<br>\r\n<br>\r\n<br>\r\n","height":93});
															thumbnails[2871047] = clik.newPhoto({"id":2871047,"src":"-14_thumb.jpg","galleries_id":178426,"server_id":32,"link":"photo_2871047.html","width":130,"caption":"Eternal Bracelet","height":87});
															thumbnails[2871230] = clik.newPhoto({"id":2871230,"src":"-22_thumb.jpg","galleries_id":178427,"server_id":32,"link":"photo_2871230.html","width":130,"caption":"Solid Twist","height":87});
															thumbnails[2937695] = clik.newPhoto({"id":2937695,"src":"Sean01_thumb.jpg","galleries_id":178430,"server_id":32,"link":"photo_2937695.html","width":130,"caption":"Celtic Twist Pendant","height":87});
															thumbnails[2871048] = clik.newPhoto({"id":2871048,"src":"-15_thumb.jpg","galleries_id":178426,"server_id":32,"link":"photo_2871048.html","width":130,"caption":"Loveknot Bracelet","height":87});
															thumbnails[2937696] = clik.newPhoto({"id":2937696,"src":"Sean02_thumb.jpg","galleries_id":178430,"server_id":32,"link":"photo_2937696.html","width":130,"caption":"The Isle Of Skye Pendant","height":87});
															thumbnails[2871049] = clik.newPhoto({"id":2871049,"src":"-16_thumb.jpg","galleries_id":178428,"server_id":32,"link":"photo_2871049.html","width":130,"caption":"Cuillin Ridge Cufflinks©","height":87});
															thumbnails[2871217] = clik.newPhoto({"id":2871217,"src":"-17_thumb.jpg","galleries_id":178428,"server_id":32,"link":"photo_2871217.html","width":130,"caption":"Blaven Cufflinks©","height":87});
															thumbnails[2937697] = clik.newPhoto({"id":2937697,"src":"Sean03_thumb.jpg","galleries_id":178430,"server_id":32,"link":"photo_2937697.html","width":130,"caption":"Celtic Button Pendant","height":87});
															thumbnails[2871050] = clik.newPhoto({"id":2871050,"src":"-18_thumb.jpg","galleries_id":178428,"server_id":32,"link":"photo_2871050.html","width":130,"caption":"Ben-na-Caillach Cufflinks©","height":87});
															thumbnails[2937698] = clik.newPhoto({"id":2937698,"src":"Sean04_thumb.jpg","galleries_id":178430,"server_id":32,"link":"photo_2937698.html","width":130,"caption":"Butterfly Pendant","height":87});
															thumbnails[2871051] = clik.newPhoto({"id":2871051,"src":"-19_thumb.jpg","galleries_id":178428,"server_id":32,"link":"photo_2871051.html","width":130,"caption":"Old Man Of Storr Cufflinks©","height":87});
															thumbnails[2937699] = clik.newPhoto({"id":2937699,"src":"Sean05_thumb.jpg","galleries_id":178430,"server_id":32,"link":"photo_2937699.html","width":130,"caption":"Squre Knot Pendant","height":87});
															thumbnails[2937700] = clik.newPhoto({"id":2937700,"src":"Sean06_thumb.jpg","galleries_id":178430,"server_id":32,"link":"photo_2937700.html","width":130,"caption":"Celtic Arrow Pendant","height":87});
															thumbnails[2871053] = clik.newPhoto({"id":2871053,"src":"-20_thumb.jpg","galleries_id":178427,"server_id":32,"link":"photo_2871053.html","width":130,"caption":"Wolfhead","height":87});
															thumbnails[2937701] = clik.newPhoto({"id":2937701,"src":"Sean07_thumb.jpg","galleries_id":178430,"server_id":32,"link":"photo_2937701.html","width":130,"caption":"The Targe","height":87});
															thumbnails[2871054] = clik.newPhoto({"id":2871054,"src":"-21_thumb.jpg","galleries_id":178427,"server_id":32,"link":"photo_2871054.html","width":130,"caption":"Kell","height":87});
															thumbnails[2937702] = clik.newPhoto({"id":2937702,"src":"Sean08_thumb.jpg","galleries_id":178430,"server_id":32,"link":"photo_2937702.html","width":130,"caption":"Celtic Frame Pendant","height":87});
															thumbnails[2871055] = clik.newPhoto({"id":2871055,"src":"-23_thumb.jpg","galleries_id":178427,"server_id":32,"link":"photo_2871055.html","width":130,"caption":"Celtic Rope ","height":87});
															thumbnails[2937703] = clik.newPhoto({"id":2937703,"src":"Sean09_thumb.jpg","galleries_id":178430,"server_id":32,"link":"photo_2937703.html","width":130,"caption":"Celtic Weave Pendant","height":87});
															thumbnails[2871056] = clik.newPhoto({"id":2871056,"src":"-24_thumb.jpg","galleries_id":178427,"server_id":32,"link":"photo_2871056.html","width":130,"caption":"Celtic Weave","height":87});
															thumbnails[2937704] = clik.newPhoto({"id":2937704,"src":"Sean10_thumb.jpg","galleries_id":178430,"server_id":32,"link":"photo_2937704.html","width":130,"caption":"Loveknot Pendant","height":87});
															thumbnails[2937705] = clik.newPhoto({"id":2937705,"src":"Sean11_thumb.jpg","galleries_id":178430,"server_id":32,"link":"photo_2937705.html","width":130,"caption":"Triskel Pendant","height":87});
															thumbnails[2937706] = clik.newPhoto({"id":2937706,"src":"Sean12_thumb.jpg","galleries_id":178430,"server_id":32,"link":"photo_2937706.html","width":130,"caption":"The Lewis & Harris","height":87});
															thumbnails[2871060] = clik.newPhoto({"id":2871060,"src":"-27_thumb.jpg","galleries_id":178427,"server_id":32,"link":"photo_2871060.html","width":130,"caption":"Dew","height":87});
															thumbnails[2937708] = clik.newPhoto({"id":2937708,"src":"Sean14_thumb.jpg","galleries_id":178427,"server_id":32,"link":"photo_2937708.html","width":130,"caption":"The Targe","height":87});
															thumbnails[2871061] = clik.newPhoto({"id":2871061,"src":"-28_thumb.jpg","galleries_id":178427,"server_id":32,"link":"photo_2871061.html","width":130,"caption":"Loveknot","height":87});
															thumbnails[2871062] = clik.newPhoto({"id":2871062,"src":"-29_thumb.jpg","galleries_id":178427,"server_id":32,"link":"photo_2871062.html","width":130,"caption":"Strath","height":87});
															thumbnails[2937710] = clik.newPhoto({"id":2937710,"src":"Sean16_thumb.jpg","galleries_id":178428,"server_id":32,"link":"photo_2937710.html","width":130,"caption":"The Caman Kiltpin","height":87});
															thumbnails[2871063] = clik.newPhoto({"id":2871063,"src":"-30_thumb.jpg","galleries_id":178427,"server_id":32,"link":"photo_2871063.html","width":130,"caption":"Otters Tail","height":87});
															thumbnails[2937711] = clik.newPhoto({"id":2937711,"src":"Sean17_thumb.jpg","galleries_id":178427,"server_id":32,"link":"photo_2937711.html","width":130,"caption":"Strath 12pt Diamond","height":87});
															thumbnails[2871065] = clik.newPhoto({"id":2871065,"src":"-32_thumb.jpg","galleries_id":178427,"server_id":32,"link":"photo_2871065.html","width":130,"caption":"Celtic Triskel","height":87});
															thumbnails[2871066] = clik.newPhoto({"id":2871066,"src":"-33_thumb.jpg","galleries_id":178427,"server_id":32,"link":"photo_2871066.html","width":130,"caption":"Celtic Twist","height":87});
															thumbnails[2871068] = clik.newPhoto({"id":2871068,"src":"-34_thumb.jpg","galleries_id":178427,"server_id":32,"link":"photo_2871068.html","width":130,"caption":"Triskel Twist","height":87});
															thumbnails[2871069] = clik.newPhoto({"id":2871069,"src":"-35_thumb.jpg","galleries_id":178432,"server_id":32,"link":"photo_2871069.html","width":130,"caption":"Triskel Earrings","height":87});
															thumbnails[2871070] = clik.newPhoto({"id":2871070,"src":"-36_thumb.jpg","galleries_id":178432,"server_id":32,"link":"photo_2871070.html","width":130,"caption":"Celtic Twist Earrings","height":87});
															thumbnails[2871071] = clik.newPhoto({"id":2871071,"src":"-37_thumb.jpg","galleries_id":178432,"server_id":32,"link":"photo_2871071.html","width":130,"caption":"Diamond Triskel Earrings","height":87});
															thumbnails[2934440] = clik.newPhoto({"id":2934440,"src":"2ct heart dia1_thumb.jpg","galleries_id":178429,"server_id":32,"link":"photo_2934440.html","width":130,"caption":"3 Carat Heart Shape Dia Earrings","height":97});
															thumbnails[2934441] = clik.newPhoto({"id":2934441,"src":"-801_thumb.jpg","galleries_id":178429,"server_id":32,"link":"photo_2934441.html","width":130,"caption":"Shaped Wed Bands","height":86});
															thumbnails[2934442] = clik.newPhoto({"id":2934442,"src":"Donna 0551_thumb.jpg","galleries_id":178429,"server_id":32,"link":"photo_2934442.html","width":130,"caption":"Shaped Wed Bands","height":76});
															thumbnails[2934443] = clik.newPhoto({"id":2934443,"src":"DSC000161_thumb.JPG","galleries_id":178429,"server_id":32,"link":"photo_2934443.html","width":130,"caption":"2 Carat Blue Topaz Ring","height":96});
															thumbnails[2934538] = clik.newPhoto({"id":2934538,"src":"DSC00060 (2)1_thumb.JPG","galleries_id":178429,"server_id":32,"link":"photo_2934538.html","width":130,"caption":"2 colour Celtic Band","height":99});
															thumbnails[2934541] = clik.newPhoto({"id":2934541,"src":"DSC000611_thumb.JPG","galleries_id":178429,"server_id":32,"link":"photo_2934541.html","width":130,"caption":"3\/4 Carat Dia Band","height":95});
															thumbnails[2934542] = clik.newPhoto({"id":2934542,"src":"IMGP03441_thumb.JPG","galleries_id":178429,"server_id":32,"link":"photo_2934542.html","width":130,"caption":"3 part wed band","height":104});
															thumbnails[2934545] = clik.newPhoto({"id":2934545,"src":"IMGP57611_thumb.JPG","galleries_id":178429,"server_id":32,"link":"photo_2934545.html","width":130,"caption":"Pink Sapph Band","height":97});
															thumbnails[2934547] = clik.newPhoto({"id":2934547,"src":"SL3705291_thumb.JPG","galleries_id":178429,"server_id":32,"link":"photo_2934547.html","width":130,"caption":"Shaped Wed Bands","height":86});
															thumbnails[2934548] = clik.newPhoto({"id":2934548,"src":"SL3705401_thumb.JPG","galleries_id":178429,"server_id":32,"link":"photo_2934548.html","width":130,"caption":"Dia\/Sapph Shaped Cluster","height":86});
															thumbnails[2934549] = clik.newPhoto({"id":2934549,"src":"two tone twist1_thumb.jpg","galleries_id":178429,"server_id":32,"link":"photo_2934549.html","width":130,"caption":"Two Colour Twist","height":97});
															thumbnails[3078540] = clik.newPhoto({"id":3078540,"src":"045_thumb.JPG","galleries_id":178429,"server_id":32,"link":"photo_3078540.html","width":130,"caption":"Nautical Anchor","height":98});
															thumbnails[4165231] = clik.newPhoto({"id":4165231,"src":"011_thumb.JPG","galleries_id":178429,"server_id":32,"link":"photo_4165231.html","width":130,"caption":"18 Carat white\/yellow Gents wed band","height":95});
															thumbnails[5387387] = clik.newPhoto({"id":5387387,"src":"8730_329339455296_766255296_9524121_6640156_n_thumb.jpg","galleries_id":178429,"server_id":32,"link":"photo_5387387.html","width":130,"caption":"Wed Bands","height":86});
															thumbnails[3763748] = clik.newPhoto({"id":3763748,"src":"Rings_16_thumb.jpg","galleries_id":178429,"server_id":32,"link":"photo_3763748.html","width":130,"caption":"Plain Wedding Bands","height":89});
															thumbnails[3763749] = clik.newPhoto({"id":3763749,"src":"SL371186_thumb.jpg","galleries_id":178429,"server_id":32,"link":"photo_3763749.html","width":130,"caption":"18ct W Shaped Wed\/Eng Bands","height":95});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[178426] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Bracelets","link":"section221844_178426.html","maxRecords":0.0,"photoIDs":[2871047.0,2871048.0],"skipIndex":0,"section_code":"section221844","featured_images":"2871048,2871047","id":178426,"singleSection":false});				  						galleries[178429] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Commissions","link":"section224815.html","maxRecords":0.0,"photoIDs":[2934440.0,2934441.0,2934442.0,2934443.0,2934538.0,2934541.0,2934542.0,2934545.0,2934547.0,2934548.0,2934549.0,3078540.0,4165231.0,5387387.0,3763748.0,3763749.0],"skipIndex":0,"section_code":"section224815","featured_images":"5387387,4165231,3763749,3763748,3078540,2934549,2934548,2934547,2934545,2934542","id":178429,"singleSection":true});				  						galleries[178428] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Cufflinks & Kiltpins","link":"section221844_178428.html","maxRecords":0.0,"photoIDs":[2871049.0,2871217.0,2871050.0,2871051.0,2937710.0],"skipIndex":0,"section_code":"section221844","featured_images":"2937710,2871217,2871051,2871050,2871049","id":178428,"singleSection":false});				  						galleries[178432] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Earrings","link":"section221844_178432.html","maxRecords":0.0,"photoIDs":[3502818.0,2871069.0,2871070.0,2871071.0],"skipIndex":0,"section_code":"section221844","featured_images":"3502818,2871071,2871070,2871069","id":178432,"singleSection":false});				  						galleries[178430] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Necklaces","link":"section221844_178430.html","maxRecords":0.0,"photoIDs":[3502802.0,3502908.0,3542540.0,2937695.0,2937696.0,2937697.0,2937698.0,2937699.0,2937700.0,2937701.0,2937702.0,2937703.0,2937704.0,2937705.0,2937706.0],"skipIndex":0,"section_code":"section221844","featured_images":"3542540,3502908,3502802,2937706,2937705,2937704,2937703,2937702,2937701,2937700","id":178430,"singleSection":false});				  						galleries[178427] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Rings","link":"section221844_178427.html","maxRecords":0.0,"photoIDs":[2871230.0,2871053.0,2871054.0,2871055.0,2871056.0,2871060.0,2937708.0,2871061.0,2871062.0,2871063.0,2937711.0,2871065.0,2871066.0,2871068.0],"skipIndex":0,"section_code":"section221844","featured_images":"2937711,2937708,2871230,2871068,2871066,2871065,2871063,2871062,2871061,2871060","id":178427,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '3542540,3502908,3502818,3502802,2934441,2937695,2871230,2871047,2937696,2871048,2937697,2871217,2871049,2937698,2871050,2937699,2871051,2937700,2937701,2871053,2937702,2871054,2937703,2871055,2937704,2871056,2937705,2937706,2937708,2871060,2871061,2937710,2871062,2937711,2871063,2871065,2871066,2871068,2871069,2871070,2871071';
imageSets[3] = '5387387,4165231,3763749,3763748,3542540,3502908,3502818,3502802,3078540,3078300,3078297,3078296,3078257,2937711,2937710,2937708,2937706,2937705,2937704,2937703,2937702,2937701,2937700,2937699,2937698,2937697,2937696,2937695,2934549,2934548,2934547,2934545,2934542,2934541,2934538,2934443,2934442,2934441,2934440,2871230,2871217,2871071,2871070,2871069,2871068,2871066,2871065,2871063,2871062,2871061';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/jewelweb/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/jewelweb/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/jewelweb/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/jewelweb/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/jewelweb/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/jewelweb/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/jewelweb/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/jewelweb/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/jewelweb/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/jewelweb/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/jewelweb/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/jewelweb/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/jewelweb/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/jewelweb/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/jewelweb/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/jewelweb/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/jewelweb/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/jewelweb/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/jewelweb/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/jewelweb/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/jewelweb/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/jewelweb/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/jewelweb/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/jewelweb/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/jewelweb/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/jewelweb/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/jewelweb/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 += 'section221844.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 && 'section221844' != '') {
					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 = 'Sean Cameron Jewellery: ' + 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 item 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="JEWELWEB">';
			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;
	}
}

			

