window.thumbnails = {};
															thumbnails[2768079] = clik.newPhoto({"id":2768079,"src":"120908_1335142 copy_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"","height":81});
															thumbnails[2837255] = clik.newPhoto({"id":2837255,"src":"pilchards1_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"pilchards cans","height":130});
															thumbnails[2854877] = clik.newPhoto({"id":2854877,"src":"books2wide copy1_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"","height":22});
															thumbnails[2890390] = clik.newPhoto({"id":2890390,"src":"bookglass1 copy_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"","height":130});
															thumbnails[2910535] = clik.newPhoto({"id":2910535,"src":"websitefilmstrip2 copy_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"","height":19});
															thumbnails[2815609] = clik.newPhoto({"id":2815609,"src":"recycledtextile_thumb.jpg","galleries_id":168747,"server_id":5,"link":"photo_2815609.html","width":130,"caption":"reused textiles","height":130});
															thumbnails[2816707] = clik.newPhoto({"id":2816707,"src":"monster1 copy_thumb.jpg","galleries_id":168696,"server_id":5,"link":"photo_2816707.html","width":130,"caption":"monster sculpture","height":130});
															thumbnails[2816750] = clik.newPhoto({"id":2816750,"src":"newspaperbasket_thumb.jpg","galleries_id":168745,"server_id":5,"link":"photo_2816750.html","width":130,"caption":"wastebasket","height":130});
															thumbnails[2817274] = clik.newPhoto({"id":2817274,"src":"skull_thumb.jpg","galleries_id":168745,"server_id":5,"link":"photo_2817274.html","width":130,"caption":"skull","height":130});
															thumbnails[2817278] = clik.newPhoto({"id":2817278,"src":"mexicomask copy_thumb.jpg","galleries_id":168745,"server_id":5,"link":"photo_2817278.html","width":130,"caption":"festival mask","height":130});
															thumbnails[2835210] = clik.newPhoto({"id":2835210,"src":"cubanaplane1_thumb.jpg","galleries_id":168745,"server_id":5,"link":"photo_2835210.html","width":130,"caption":"model plane","height":130});
															thumbnails[2837174] = clik.newPhoto({"id":2837174,"src":"basketcuba1 copy_thumb.jpg","galleries_id":168744,"server_id":5,"link":"photo_2837174.html","width":130,"caption":"shopping basket","height":130});
															thumbnails[2837205] = clik.newPhoto({"id":2837205,"src":"cushionapel1 copy_thumb.jpg","galleries_id":168747,"server_id":5,"link":"photo_2837205.html","width":130,"caption":"cushion cover","height":130});
															thumbnails[2837218] = clik.newPhoto({"id":2837218,"src":"glasses1 copy_thumb.jpg","galleries_id":168697,"server_id":5,"link":"photo_2837218.html","width":130,"caption":"tumblers","height":130});
															thumbnails[2837228] = clik.newPhoto({"id":2837228,"src":"heathlamp1 copy_thumb.jpg","galleries_id":168744,"server_id":5,"link":"photo_2837228.html","width":130,"caption":"pendant lamp","height":130});
															thumbnails[2837233] = clik.newPhoto({"id":2837233,"src":"lampcastrol1 copy_thumb.jpg","galleries_id":168696,"server_id":5,"link":"photo_2837233.html","width":130,"caption":"oil lamp","height":130});
															thumbnails[2837239] = clik.newPhoto({"id":2837239,"src":"moneybox1 copy_thumb.jpg","galleries_id":168696,"server_id":5,"link":"photo_2837239.html","width":130,"caption":"money box","height":130});
															thumbnails[2837247] = clik.newPhoto({"id":2837247,"src":"origamibasket1 copy_thumb.jpg","galleries_id":168745,"server_id":5,"link":"photo_2837247.html","width":130,"caption":"basket","height":130});
															thumbnails[2837258] = clik.newPhoto({"id":2837258,"src":"rubberjug_thumb.jpg","galleries_id":168746,"server_id":5,"link":"photo_2837258.html","width":130,"caption":"jug","height":130});
															thumbnails[2844489] = clik.newPhoto({"id":2844489,"src":"baubles1 copy_thumb.jpg","galleries_id":168697,"server_id":5,"link":"photo_2844489.html","width":130,"caption":"beads","height":130});
															thumbnails[2844496] = clik.newPhoto({"id":2844496,"src":"glasses2 copy_thumb.jpg","galleries_id":168697,"server_id":5,"link":"photo_2844496.html","width":130,"caption":"wineglasses","height":130});
															thumbnails[2844499] = clik.newPhoto({"id":2844499,"src":"spicejar1 copy_thumb.jpg","galleries_id":168697,"server_id":5,"link":"photo_2844499.html","width":130,"caption":"spice jar","height":130});
															thumbnails[2844501] = clik.newPhoto({"id":2844501,"src":"cookiejar2 copy_thumb.jpg","galleries_id":168697,"server_id":5,"link":"photo_2844501.html","width":130,"caption":"cookie jar","height":130});
															thumbnails[2854139] = clik.newPhoto({"id":2854139,"src":"framemichelin1 copy_thumb.jpg","galleries_id":168746,"server_id":5,"link":"photo_2854139.html","width":130,"caption":"photo frame","height":130});
															thumbnails[2854143] = clik.newPhoto({"id":2854143,"src":"heartbowl1 copy_thumb.jpg","galleries_id":168745,"server_id":5,"link":"photo_2854143.html","width":130,"caption":"basket","height":130});
															thumbnails[2854160] = clik.newPhoto({"id":2854160,"src":"mobileholder1 copy_thumb.jpg","galleries_id":168746,"server_id":5,"link":"photo_2854160.html","width":130,"caption":"mobile phone case","height":130});
															thumbnails[2854167] = clik.newPhoto({"id":2854167,"src":"rubberbucket1 copy_thumb.jpg","galleries_id":168746,"server_id":5,"link":"photo_2854167.html","width":130,"caption":"bucket","height":130});
															thumbnails[2854867] = clik.newPhoto({"id":2854867,"src":"banglesplastic1 copy_thumb.jpg","galleries_id":168744,"server_id":5,"link":"photo_2854867.html","width":130,"caption":"bangles","height":130});
															thumbnails[2854881] = clik.newPhoto({"id":2854881,"src":"braceletglass1 copy_thumb.jpg","galleries_id":168697,"server_id":5,"link":"photo_2854881.html","width":130,"caption":"necklace","height":130});
															thumbnails[2854884] = clik.newPhoto({"id":2854884,"src":"braceletrubber1 copy_thumb.jpg","galleries_id":168746,"server_id":5,"link":"photo_2854884.html","width":130,"caption":"necklace","height":130});
															thumbnails[2855784] = clik.newPhoto({"id":2855784,"src":"captarp1 copy_thumb.jpg","galleries_id":168747,"server_id":5,"link":"photo_2855784.html","width":130,"caption":"cap","height":130});
															thumbnails[2855799] = clik.newPhoto({"id":2855799,"src":"rug11 copy_thumb.jpg","galleries_id":168747,"server_id":5,"link":"photo_2855799.html","width":130,"caption":"knotted rug","height":130});
															thumbnails[2855822] = clik.newPhoto({"id":2855822,"src":"rug21 copy_thumb.jpg","galleries_id":168747,"server_id":5,"link":"photo_2855822.html","width":130,"caption":"woven rug","height":130});
															thumbnails[2855834] = clik.newPhoto({"id":2855834,"src":"zodiac1_thumb.jpg","galleries_id":168747,"server_id":5,"link":"photo_2855834.html","width":130,"caption":"zodiak","height":130});
															thumbnails[2858917] = clik.newPhoto({"id":2858917,"src":"bikeexhaust1 copy_thumb.jpg","galleries_id":168696,"server_id":5,"link":"photo_2858917.html","width":130,"caption":"motorbike","height":130});
															thumbnails[2858922] = clik.newPhoto({"id":2858922,"src":"bo0ok1 copy_thumb.jpg","galleries_id":168747,"server_id":5,"link":"photo_2858922.html","width":130,"caption":"notebook","height":130});
															thumbnails[2858926] = clik.newPhoto({"id":2858926,"src":"mieliebagza1 copy_thumb.jpg","galleries_id":168747,"server_id":5,"link":"photo_2858926.html","width":130,"caption":"handbag","height":130});
															thumbnails[2858943] = clik.newPhoto({"id":2858943,"src":"wineglassza1 copy_thumb.jpg","galleries_id":168697,"server_id":5,"link":"photo_2858943.html","width":130,"caption":"wineglass","height":130});
															thumbnails[2858977] = clik.newPhoto({"id":2858977,"src":"zozost1 copy_thumb.jpg","galleries_id":168746,"server_id":5,"link":"photo_2858977.html","width":130,"caption":"township toys \"Zolo\"","height":130});
															thumbnails[2887365] = clik.newPhoto({"id":2887365,"src":"shapesorter11 copy_thumb.jpg","galleries_id":168744,"server_id":5,"link":"photo_2887365.html","width":130,"caption":"shape sorter","height":130});
															thumbnails[2887369] = clik.newPhoto({"id":2887369,"src":"paperhat21 copy_thumb.jpg","galleries_id":168745,"server_id":5,"link":"photo_2887369.html","width":130,"caption":"sunhat","height":130});
															thumbnails[2887376] = clik.newPhoto({"id":2887376,"src":"beercancap1 copy_thumb.jpg","galleries_id":168696,"server_id":5,"link":"photo_2887376.html","width":130,"caption":"cap","height":130});
															thumbnails[2887379] = clik.newPhoto({"id":2887379,"src":"bagbrazil1 copy_thumb.jpg","galleries_id":168696,"server_id":5,"link":"photo_2887379.html","width":130,"caption":"shoulderbag","height":130});
															thumbnails[2887382] = clik.newPhoto({"id":2887382,"src":"bagbnutu1 copy_thumb.jpg","galleries_id":168746,"server_id":5,"link":"photo_2887382.html","width":130,"caption":"clutch bag","height":130});
															thumbnails[2887761] = clik.newPhoto({"id":2887761,"src":"bangless1 copy_thumb.jpg","galleries_id":168744,"server_id":5,"link":"photo_2887761.html","width":130,"caption":"bangles","height":130});
															thumbnails[2890391] = clik.newPhoto({"id":2890391,"src":"chickenn1 copy_thumb.jpg","galleries_id":168744,"server_id":5,"link":"photo_2890391.html","width":130,"caption":"chicken","height":130});
															thumbnails[2890395] = clik.newPhoto({"id":2890395,"src":"pallette1 copy_thumb.jpg","galleries_id":168744,"server_id":5,"link":"photo_2890395.html","width":130,"caption":"palette","height":130});
															thumbnails[2890396] = clik.newPhoto({"id":2890396,"src":"stovemex1 copy1_thumb.jpg","galleries_id":168696,"server_id":5,"link":"photo_2890396.html","width":130,"caption":"charcoal stove","height":130});
															thumbnails[2890399] = clik.newPhoto({"id":2890399,"src":"wolabowla1 copy_thumb.jpg","galleries_id":168745,"server_id":5,"link":"photo_2890399.html","width":130,"caption":"bowl","height":130});
															thumbnails[2893736] = clik.newPhoto({"id":2893736,"src":"karmmarg1 copy_thumb.jpg","galleries_id":168747,"server_id":5,"link":"photo_2893736.html","width":130,"caption":"folder","height":130});
															thumbnails[2815423] = clik.newPhoto({"id":2815423,"src":"metalwoven1_thumb.jpg","galleries_id":168696,"server_id":5,"link":"photo_2815423.html","width":130,"caption":"recycled metal","height":130});
															thumbnails[2815601] = clik.newPhoto({"id":2815601,"src":"recycledglass copy_thumb.jpg","galleries_id":168697,"server_id":5,"link":"photo_2815601.html","width":130,"caption":"recycled glass","height":130});
															thumbnails[2817285] = clik.newPhoto({"id":2817285,"src":"paperwoven1_thumb.jpg","galleries_id":168745,"server_id":5,"link":"photo_2817285.html","width":130,"caption":"recycled  paper","height":130});
															thumbnails[2835203] = clik.newPhoto({"id":2835203,"src":"rubbertexture1_thumb.jpg","galleries_id":168746,"server_id":5,"link":"photo_2835203.html","width":130,"caption":"recycled rubber","height":130});
															thumbnails[2837270] = clik.newPhoto({"id":2837270,"src":"plastictexture1 copy1_thumb.jpg","galleries_id":168744,"server_id":5,"link":"photo_2837270.html","width":130,"caption":"recycled plastic","height":130});
															thumbnails[2756117] = clik.newPhoto({"id":2756117,"src":"img_0491136_thumb.jpg","galleries_id":168744,"server_id":5,"link":"photo_2756117.html","width":130,"caption":"handbag","height":143});
															thumbnails[2816692] = clik.newPhoto({"id":2816692,"src":"cairovase copy_thumb.jpg","galleries_id":168697,"server_id":5,"link":"photo_2816692.html","width":130,"caption":"vase","height":130});
															thumbnails[2835206] = clik.newPhoto({"id":2835206,"src":"whitewallshoes1_thumb.jpg","galleries_id":168746,"server_id":5,"link":"photo_2835206.html","width":130,"caption":"sandals","height":130});
															thumbnails[2837210] = clik.newPhoto({"id":2837210,"src":"frame1 copy_thumb.jpg","galleries_id":168696,"server_id":5,"link":"photo_2837210.html","width":130,"caption":"picture frame","height":130});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[168697] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"GLASS","link":"gallery_168697.html","maxRecords":0.0,"photoIDs":[2837218.0,2844489.0,2844496.0,2844499.0,2844501.0,2854881.0,2858943.0,2815601.0,2816692.0],"skipIndex":0,"section_code":"gallery","featured_images":2815601.0,"id":168697,"singleSection":false});				  						galleries[168696] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"METAL","link":"gallery_168696.html","maxRecords":0.0,"photoIDs":[2816707.0,2837233.0,2837239.0,2858917.0,2887376.0,2887379.0,2890396.0,2815423.0,2837210.0],"skipIndex":0,"section_code":"gallery","featured_images":2815423.0,"id":168696,"singleSection":false});				  						galleries[168745] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"PAPER","link":"gallery_168745.html","maxRecords":0.0,"photoIDs":[2816750.0,2817274.0,2817278.0,2835210.0,2837247.0,2854143.0,2887369.0,2890399.0,2817285.0],"skipIndex":0,"section_code":"gallery","featured_images":2817285.0,"id":168745,"singleSection":false});				  						galleries[168744] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"PLASTIC","link":"gallery_168744.html","maxRecords":0.0,"photoIDs":[2837174.0,2837228.0,2854867.0,2887365.0,2887761.0,2890391.0,2890395.0,2837270.0,2756117.0],"skipIndex":0,"section_code":"gallery","featured_images":2837270.0,"id":168744,"singleSection":false});				  						galleries[168746] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"RUBBER","link":"gallery_168746.html","maxRecords":0.0,"photoIDs":[2837258.0,2854139.0,2854160.0,2854167.0,2854884.0,2858977.0,2887382.0,2835203.0,2835206.0],"skipIndex":0,"section_code":"gallery","featured_images":2835203.0,"id":168746,"singleSection":false});				  						galleries[168747] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"TEXTILES","link":"gallery_168747.html","maxRecords":0.0,"photoIDs":[2815609.0,2837205.0,2855784.0,2855799.0,2855822.0,2855834.0,2858922.0,2858926.0,2893736.0],"skipIndex":0,"section_code":"gallery","featured_images":2815609.0,"id":168747,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '2837228';
imageSets[2] = '2837270,2835203,2817285,2815609,2815601,2815423';
imageSets[3] = '2910535,2893736,2890399,2890396,2890395,2890391,2890390,2887761,2887382,2887379,2887376,2887369,2887365,2858977,2858943,2858926,2858922,2858917,2855834,2855822,2855799,2855784,2854884,2854881,2854877,2854867,2854167,2854160,2854143,2854139,2844501,2844499,2844496,2844489,2837270,2837258,2837255,2837247,2837239,2837233,2837228,2837218,2837210,2837205,2837174,2835210,2835206,2835203,2817285,2817278';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/thomsonneil/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/thomsonneil/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/thomsonneil/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/thomsonneil/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/thomsonneil/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/thomsonneil/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/thomsonneil/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/thomsonneil/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/thomsonneil/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/thomsonneil/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/thomsonneil/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/thomsonneil/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/thomsonneil/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/thomsonneil/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/thomsonneil/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/thomsonneil/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/thomsonneil/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/thomsonneil/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/thomsonneil/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/thomsonneil/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/thomsonneil/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/thomsonneil/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/thomsonneil/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/thomsonneil/images';
		break;
	}
		return val;
}

/***************************************************************************
* img = reference to image object in which to show image                   *
***************************************************************************/
function showHomeImage(img) {
	imageID = randomListVal('');
	if (!basic) {
		img.src = photos[imageID].src;
		img.width = photos[imageID].width;
		img.height = photos[imageID].height;
		img.parentNode.title = img.alt = photos[imageID].caption;
	} else {
		newImage = new Image(photos[imageID].width,photos[imageID].height);
		newImage.src = photos[imageID].src;
		document.images[img.name] = newImage;
		
	}
}

function getHomeImageLink(imageID) {
  	var href='', photo = backgrounds && backgrounds[imageID];
	if(photo){
		if (photo && photo.galleries_id != '') {
  			href = photo.fnGalleryLink();
  		}
  		  		else {
  				href += '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 = 'knowtrash: ' + 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>maker </strong>' +  this.location + '</div>';
	}
	
	if (this.photographer != '') {
		
		temp += '<div class="imageinfo" id="imagePhotographer"><strong>photo </strong>' + this.photographer + '</div>';
	}
				
				if (temp != '') {
		temp += '<div class="spacer"></div>';
	}
	return temp;
};

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
clik.photo.fnGetPaymentInfo = function(){
	var temp = '';
	if (this.item_price !== '') {
				temp += '<p>Order this print:</p>';
				temp += '<div class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> ' + (this.item_price).toFixed(2) + '</div>';
		var item_name  = this.purchase_instruction;
		var amount = (this.item_price).toFixed(2);
		var item_option  = 0;
	}
	else if (this.payment_groups_id !== '') {
		temp += '<p>Buy this print online:</p>';
				temp += '<form id="paymentOptions" style="margin:0px;border:0px;" name="paymentOptions">';
											temp += '<select class="paymentlink" name="payment_options_id" onchange="updateItemValues($(this.form).next(\'#paymentForm\')[0],this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value);">';
		
		temp += getPaymentOptions(this.payment_groups_id);
		temp += '</select>';
		temp += '</form>';
				var item_option  = paymentGroups[this.payment_groups_id].options[0];
		if(paymentOptions[item_option]){
			var item_name  = paymentOptions[item_option].payment_option;
			var amount =  paymentOptions[item_option].price;
		}
			}
	else {
		
	}
	if (this.item_price !== '' || this.payment_groups_id !== '') {
			temp += '<div class="clearing">&nbsp;</div>';
	}
	return temp;};

/***************************************************************************
* Pick a photo at random from the featured images of a gallery.            *
* Gallery_id = id of gallery to choose,                                    *
* img = reference to html image in                                         *
* which to show image                                                      *
***************************************************************************/
function showGalleryImage(gallery_id, img, updateLink) {
	
	if(img){
		if (location.hash.match('galleries_id=' + gallery_id) && (imageID = location.hash.match('.*photos_id=(.+)$'))) {
		  	imageID = imageID[1];
		} else {
		  	imageID = randomListVal(galleries[gallery_id].featured_images);
		}
		
		if (imageID != 0) {
			img.src = thumbnails[imageID].src;
			img.width = thumbnails[imageID].width;
			img.height = thumbnails[imageID].height;
			img.alt = galleries[gallery_id].title;
			if (updateLink) {
				$(img).parent().attr({					href: thumbnails[imageID].fnGalleryLink(gallery_id),					title: galleries[gallery_id].title				});
			}
		}
	}
}

/***************************************************************************
* If we have dynamic HTML, replace the galleries link with a list that     *
* doesn't include thecurrent gallery                                       *
***************************************************************************/
function showGalleries(gallery_id) {
		
	
	if (!basic) {
		temp = '';
		for (i = 0; i < galleries.length; i++) {
						
			
			if (galleries[i].id != gallery_id) {
								
				if (temp != '') {
					temp += ' | ';
				}
								temp += '<a href="' + galleries[i].section_code + '_' + galleries[i].id + '.html">' + galleries[i].title + '</a>';
							}
		}
		document.all.galleryLinks.innerHTML = 'Other galleries: ' + temp;
	}
}

			

