window.thumbnails = {};
															thumbnails[5332312] = clik.newPhoto({"id":5332312,"src":"lariat1_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"Lariat","height":102});
															thumbnails[5332353] = clik.newPhoto({"id":5332353,"src":"Rings1_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"Woven Rings","height":139});
															thumbnails[5334922] = clik.newPhoto({"id":5334922,"src":"Mobiusrosette_thumb.JPG","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"Necklace & bracelet ","height":107});
															thumbnails[5335017] = clik.newPhoto({"id":5335017,"src":"CoolPinkEarrings_thumb.JPG","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"Pink Drops","height":124});
															thumbnails[5428862] = clik.newPhoto({"id":5428862,"src":"Silver_Mobius_earrings_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"Knot earrings","height":88});
															thumbnails[5557648] = clik.newPhoto({"id":5557648,"src":"Lapis_cubed_drops_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"Lapis lazuli drop earrings","height":171});
															thumbnails[5557687] = clik.newPhoto({"id":5557687,"src":"Grey_Scale_earrings_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"Fuchsia","height":158});
															thumbnails[5595837] = clik.newPhoto({"id":5595837,"src":"Figure_of_8_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"Figure of 8","height":93});
															thumbnails[5753612] = clik.newPhoto({"id":5753612,"src":"Edina_cuff_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"Black & White Cuff","height":130});
															thumbnails[5990808] = clik.newPhoto({"id":5990808,"src":"Sunflower_thumb.JPG","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"Sunflower necklace & earrings","height":123});
															thumbnails[6886666] = clik.newPhoto({"id":6886666,"src":"copper_bracelet_1_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"Copper bracelet","height":142});
															thumbnails[7328897] = clik.newPhoto({"id":7328897,"src":"Titanium_chain_with_mixed_semi_precious_beads_web_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"Titanium Chain","height":86});
															thumbnails[7357129] = clik.newPhoto({"id":7357129,"src":"workshop_example_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"Roundmaille rubber and aluminium bracelet","height":118});
															thumbnails[7363412] = clik.newPhoto({"id":7363412,"src":"sweet_pea_2_web_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"Sweet Pea necklace","height":106});
															thumbnails[7372579] = clik.newPhoto({"id":7372579,"src":"Pangolin_drops_4_web_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"Pangolin earrings","height":180});
															thumbnails[7388020] = clik.newPhoto({"id":7388020,"src":"japan_12_in_2_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"Japanese weave neckpiece","height":89});
															thumbnails[7404471] = clik.newPhoto({"id":7404471,"src":"spiral_form_men_web_thumb.JPG","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"Spiral chain","height":113});
															thumbnails[7404501] = clik.newPhoto({"id":7404501,"src":"steel_byzantine_for_men_web_thumb.JPG","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"Byzantine chain","height":94});
															thumbnails[7404530] = clik.newPhoto({"id":7404530,"src":"dragon_scale_bracelet_for_men_web_thumb.JPG","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"Dragon scale bracelet","height":104});
															thumbnails[7475679] = clik.newPhoto({"id":7475679,"src":"Woven_earings_long_web_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"Large woven earrings","height":121});
															thumbnails[7508762] = clik.newPhoto({"id":7508762,"src":"The_End_detail_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"Detail of finished piece.","height":131});
															thumbnails[7606975] = clik.newPhoto({"id":7606975,"src":"Afgan_lapis_web_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"Afghan Lapis","height":112});
															thumbnails[7627957] = clik.newPhoto({"id":7627957,"src":"Citrus_Tagua_web_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"Rubber foxweave","height":102});
															thumbnails[7628027] = clik.newPhoto({"id":7628027,"src":"workshop_5_web_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"","height":100});
															thumbnails[7628028] = clik.newPhoto({"id":7628028,"src":"worshop_6_web_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"","height":83});
															thumbnails[7628031] = clik.newPhoto({"id":7628031,"src":"workshop3_web1_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"","height":160});
															thumbnails[7646026] = clik.newPhoto({"id":7646026,"src":"handmade_glass_beads_on_copper_chain_web_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"Copper chain with hand made beads","height":93});
															thumbnails[7687657] = clik.newPhoto({"id":7687657,"src":"Titanium_bracelet_web_thumb.JPG","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"Titanium Bracelet","height":86});
															thumbnails[7688254] = clik.newPhoto({"id":7688254,"src":"Round_maille_Rope_web_thumb.JPG","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"Roundmaille Rope Necklace","height":156});
															thumbnails[7696448] = clik.newPhoto({"id":7696448,"src":"with_pliers_web_thumb.JPG","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"Necklace interwoven with red beads","height":111});
															thumbnails[8030668] = clik.newPhoto({"id":8030668,"src":"steel_and_rubber_flower_2_web_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"Daisy Chain","height":93});
															thumbnails[8030716] = clik.newPhoto({"id":8030716,"src":"Cuffs_1_web_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"Hand knitted cuffs","height":103});
															thumbnails[8030736] = clik.newPhoto({"id":8030736,"src":"steel_and_copper_bracelet_1web_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"Steel and copper bracelet","height":90});
															thumbnails[8030861] = clik.newPhoto({"id":8030861,"src":"heamatite_with_steel_cut_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"Shaggy Loops necklace","height":115});
															thumbnails[8144902] = clik.newPhoto({"id":8144902,"src":"silver_cuff_web_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"Knitted cuff","height":126});
															thumbnails[8144916] = clik.newPhoto({"id":8144916,"src":"rubber_rings_with_silver_web_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"Rubber & silver neckpiece","height":86});
															thumbnails[8208899] = clik.newPhoto({"id":8208899,"src":"New_073_web_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"Flower Bracelet","height":86});
															thumbnails[8212095] = clik.newPhoto({"id":8212095,"src":"collar_web_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"Woven lace collar","height":102});
															thumbnails[8255823] = clik.newPhoto({"id":8255823,"src":"Lapis_chain_web_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"Byzantine Lapis ","height":144});
															thumbnails[8290179] = clik.newPhoto({"id":8290179,"src":"Sunflower_1_web_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"Sunflower neckpiece & earrings","height":123});
															thumbnails[8297459] = clik.newPhoto({"id":8297459,"src":"Celtic_Lace_neckpiece_and_earrings_web_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"Celtic Lace ","height":98});
															thumbnails[8537175] = clik.newPhoto({"id":8537175,"src":"image001web_s_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"","height":184});
															thumbnails[8702293] = clik.newPhoto({"id":8702293,"src":"Carnelian_chunks_web_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"","height":98});
															thumbnails[8702329] = clik.newPhoto({"id":8702329,"src":"Fushia_Earrings_red_web_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"Fuchsia Earrings","height":157});
															thumbnails[8702390] = clik.newPhoto({"id":8702390,"src":"Shaggy_clear_web_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"A Touch of Frost","height":106});
															thumbnails[8710403] = clik.newPhoto({"id":8710403,"src":"Fushia_Earrings_red_web_large_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"","height":157});
															thumbnails[8880685] = clik.newPhoto({"id":8880685,"src":"silvercuffweb_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"Sterling silver cuff","height":150});
															thumbnails[8915151] = clik.newPhoto({"id":8915151,"src":"Stunning_neckpiece_2_web_large_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"","height":112});
															thumbnails[8968602] = clik.newPhoto({"id":8968602,"src":"Stunning_collar_1_web_large_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"","height":92});
															thumbnails[8983433] = clik.newPhoto({"id":8983433,"src":"stunning_neckpiece_white_background_2aweb_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"","height":107});
															thumbnails[9043079] = clik.newPhoto({"id":9043079,"src":"A__J_Hinchcliffe_2_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"","height":106});
															thumbnails[9043243] = clik.newPhoto({"id":9043243,"src":"celtic_lace_with_pearls_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"Celtic Lace with pearls","height":94});
															thumbnails[7649848] = clik.newPhoto({"id":7649848,"src":"mens_steel_bracelet_web_thumb.JPG","galleries_id":394910,"server_id":5,"link":"photo_7649848.html","width":130,"caption":"Woven steel bracelet","height":82});
															thumbnails[8351710] = clik.newPhoto({"id":8351710,"src":"Liberty_web_thumb.jpg","galleries_id":394910,"server_id":5,"link":"photo_8351710.html","width":130,"caption":"Woven neckpiece","height":93});
															thumbnails[8426106] = clik.newPhoto({"id":8426106,"src":"Autumn_collar_web_thumb.jpg","galleries_id":394910,"server_id":5,"link":"photo_8426106.html","width":130,"caption":"Shades of Autumn ","height":93});
															thumbnails[8971379] = clik.newPhoto({"id":8971379,"src":"Mobius_compressed_thumb.jpg","galleries_id":394910,"server_id":5,"link":"photo_8971379.html","width":130,"caption":"Mobius Knot Necklace & Earrings","height":185});
															thumbnails[8971720] = clik.newPhoto({"id":8971720,"src":"Round_maille_rope_necklaces_cropped_thumb1.JPG","galleries_id":394910,"server_id":5,"link":"photo_8971720.html","width":130,"caption":"Round maille rope necklaces","height":146});
															thumbnails[9043286] = clik.newPhoto({"id":9043286,"src":"Touch_of_Frost_sparkle_thumb.jpg","galleries_id":394910,"server_id":5,"link":"photo_9043286.html","width":130,"caption":"A Touch of Frost Necklace","height":106});
															thumbnails[9067930] = clik.newPhoto({"id":9067930,"src":"Spiders_web_earrings_300_web_thumb.jpg","galleries_id":394910,"server_id":5,"link":"photo_9067930.html","width":130,"caption":"NEW Spider's Web Earrings","height":105});
															thumbnails[9067948] = clik.newPhoto({"id":9067948,"src":"Soft_Rope_2_300_thumb.jpg","galleries_id":394910,"server_id":5,"link":"photo_9067948.html","width":130,"caption":"NEW Soft Weave Rope Necklace","height":97});
															thumbnails[9067984] = clik.newPhoto({"id":9067984,"src":"Silver_collar_2012_web_thumb.jpg","galleries_id":394910,"server_id":5,"link":"photo_9067984.html","width":130,"caption":"NEW Collar 2012","height":107});
															thumbnails[9068040] = clik.newPhoto({"id":9068040,"src":"silvercuffweb_7285B11A-1EC9-DFB6-090C93486DA06EB9_thumb.jpg","galleries_id":394910,"server_id":5,"link":"photo_9068040.html","width":130,"caption":"Large Silver Cuff","height":150});
															thumbnails[7508707] = clik.newPhoto({"id":7508707,"src":"Stage_1_web_thumb.jpg","galleries_id":407160,"server_id":5,"link":"photo_7508707.html","width":130,"caption":"Stage 1","height":87});
															thumbnails[7508741] = clik.newPhoto({"id":7508741,"src":"Stage_2_web_thumb.jpg","galleries_id":407160,"server_id":5,"link":"photo_7508741.html","width":130,"caption":"Stage 2","height":104});
															thumbnails[7508757] = clik.newPhoto({"id":7508757,"src":"Stage_3_web_thumb.jpg","galleries_id":407160,"server_id":5,"link":"photo_7508757.html","width":130,"caption":"Stage 3","height":151});
															thumbnails[7508758] = clik.newPhoto({"id":7508758,"src":"Stage_4_web_thumb.jpg","galleries_id":407160,"server_id":5,"link":"photo_7508758.html","width":130,"caption":"Stage 4","height":120});
															thumbnails[8104354] = clik.newPhoto({"id":8104354,"src":"large_byzantine_chain_web_thumb.jpg","galleries_id":407160,"server_id":5,"link":"photo_8104354.html","width":130,"caption":"Final Stage - finished piece","height":120});
															thumbnails[8255804] = clik.newPhoto({"id":8255804,"src":"bike_chain_example_web_thumb.jpg","galleries_id":407160,"server_id":5,"link":"photo_8255804.html","width":130,"caption":"Stage 1 - old rusty bike chain","height":100});
															thumbnails[8255806] = clik.newPhoto({"id":8255806,"src":"earrings_web_thumb.jpg","galleries_id":407160,"server_id":5,"link":"photo_8255806.html","width":130,"caption":"Final stage - finished earrings","height":145});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[407160] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"De-Junk Re-Junk","link":"section487010.html","maxRecords":0.0,"photoIDs":[7508707.0,7508741.0,7508757.0,7508758.0,8104354.0,8255804.0,8255806.0],"skipIndex":0,"section_code":"section487010","featured_images":"8255806,8255804,8104354,7508758,7508757,7508741,7508707","id":407160,"singleSection":true});				  						galleries[394910] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"2012 Collection","link":"section469687.html","maxRecords":0.0,"photoIDs":[7649848.0,8351710.0,8426106.0,8971379.0,8971720.0,9043286.0,9067930.0,9067948.0,9067984.0,9068040.0],"skipIndex":0,"section_code":"section469687","featured_images":"9068040,9067984,9067948,9067930,9043286,8971720,8971379,8426106,8351710,7649848","id":394910,"singleSection":true});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '9043079';
imageSets[3] = '7606975';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/anjohi/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/anjohi/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/anjohi/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/anjohi/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/anjohi/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/anjohi/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/anjohi/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/anjohi/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/anjohi/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/anjohi/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/anjohi/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/anjohi/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/anjohi/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/anjohi/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/anjohi/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/anjohi/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/anjohi/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/anjohi/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/anjohi/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/anjohi/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/anjohi/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/anjohi/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/anjohi/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/anjohi/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/anjohi/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/anjohi/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/anjohi/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 += 'section469687.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 && 'section469687' != '') {
					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 = 'Anjo Designs: ' + photoCaption;
			    }
        if (op.$detail.length > 0) {
      	temp = op.nextPhoto.fnGetImageDetails();
	    op.$detail.fadeGalleryDetails(temp, op.speed, function(){
			if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
				toggleAddToCartConfirm(backgrounds, op.$detail);
			} else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
				toggleAddToCartConfirm(photos, op.$detail);
			}
			$('body').trigger('clikUpdate.popup');
	    });
    }
        $(op.$detailContainer).find('.replaceable[class*=replaceable_photo-]').each(function(){
    	var field = clik.getPrefixedClass(this.className, 'replaceable_photo-');
    	if (field in op.nextPhoto) {
    		$(this).fadeGalleryDetails(op.nextPhoto[field], op.speed);
    	}
    }).end().find('.replaceable.photoPayment').fadeGalleryDetails(op.nextPhoto.fnGetPaymentInfo(), op.speed, function(){
		if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
			toggleAddToCartConfirm(backgrounds, op.$detailContainer);
		} else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
			toggleAddToCartConfirm(photos, op.$detailContainer);
		}
		$('body').trigger('clikUpdate.popup');
	});
		if (op.$photo.length > 0) {
		html = $('<img/>',{
			'class': 'mainphoto photo',
			src: photoSrc,
			id: 'mainPic',
			name: 'mainPic',
			width: op.nextPhoto.width,
			height: op.nextPhoto.height,
			alt: photoCaption,
			css: op.css || {}
		});
		if (op.href) {
			if (op.href.match(/<a/)) {
				html = $(op.href).append(html);
			} else {
				html = $('<a/>', {
					href: op.href,
					title: photoCaption
				}).append(html);
			}
		} else {
			html = $('<a/>', {
				title: photoCaption
			}).append(html);
		}
		if (op.speed == 0) {			op.$photo.html(html);			if (op.onBefore) {			  	op.onBefore.apply(op.$photo);			}			if (op.onAfter) {			  	op.onAfter.apply(op.$photo);			}		} else {			op.$photo.stop(true,true).fadeReplaceWith(html,op.speed,'',function(){  				if (op.onAfter) {				  	op.onAfter.apply(this);				}				clik.doColumnResize(false, $(this).add(op.$detail).add(op.$title));			}, op.onBefore);
		}	}
    if (op.field) {
		op.field.value = photoId;
	} else {
		op.$photo.data('image_id', photoId);
    }
        if (!op.speed) {
      	clik.doColumnResize(false, op.$photo.add(op.$detail).add(op.$title));
    }
        
    return html;
	}

/***************************************************************************
* Toggle add to cart confirmation element and set up the click event for   *
* the 'Add to cart' button.                                                *
***************************************************************************/
function toggleAddToCartConfirm(array, root){
	if (typeof(array) !== 'object' || array === null) {
	  	array = photos;
	}
	if (!$(root).length) {		root = $('body');	}	if($('#paymentConfirm', root).length > 0){
		$('#paymentConfirm', root).hide();
		$('#paymentAddButton', root)
		.unbind()
		.click(function(){
						form = $('#paymentForm', root)[0];
			option_id = 0;
			if(form.item_option.value){
				option_id = form.item_option.value;
			}
			if(addItemToBasket(form.item_number.value,array,form.site.value,parseInt(form.quantity.value, 10),option_id)){
				if($.browser.msie){$('#paymentConfirm', root).text('Item added to cart').show();}
				else{
					$('#paymentConfirm', root).text('Item added to cart').fadeIn();
					dspOrderDetails(form.site.value);
				}
			}
			else{
				$('#paymentConfirm', root).text('Item not added - check cookies are enabled in your browser.').fadeIn();
			}
		});
	}
}

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
clik.photo.fnGetImageDetails = function(){
	var temp = '';
	if (this.description != '') {
		temp +=  '<div id="imageDescription">' + this.description + '</div>';
	}
		if (this.photo_ref != '') {
		temp += '<div class="imageinfo" id="imageRef"><strong>Ref: </strong>' + this.photo_ref + '</div>';
	}
		if (this.takendate != '') {
		
		temp += '<div class="imageinfo" id="imageDate"><strong>Date: </strong>' + this.takendate + '</div>';
	}
	
	if (this.location != '') {
		
		temp += '<div class="imageinfo" id="imageLocation"><strong>Location: </strong>' +  this.location + '</div>';
	}
	
	if (this.photographer != '') {
		
		temp += '<div class="imageinfo" id="imagePhotographer"><strong>Photographer: </strong>' + this.photographer + '</div>';
	}
				
				if (temp != '') {
		temp += '<div class="spacer"></div>';
	}
	return temp;
};

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
clik.photo.fnGetPaymentInfo = function(){
	var temp = '';
	if (this.item_price !== '') {
				temp += '<p>Order this print:</p>';
				temp += '<div class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> ' + (this.item_price).toFixed(2) + '</div>';
		var item_name  = this.purchase_instruction;
		var amount = (this.item_price).toFixed(2);
		var item_option  = 0;
	}
		else {
		
	}
	if (this.item_price !== '') {
			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;
	}
}

			

