window.thumbnails = {};
															thumbnails[5735074] = clik.newPhoto({"id":5735074,"src":"BlackVanilla_Bead1_BB03B781-1D09-001F-99A138924CA34E90_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"Black vanilla bead","height":158});
															thumbnails[5745571] = clik.newPhoto({"id":5745571,"src":"GBUK-banner_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"GBUK Banner","height":16});
															thumbnails[5750273] = clik.newPhoto({"id":5750273,"src":"member_NDA_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":42});
															thumbnails[6053252] = clik.newPhoto({"id":6053252,"src":"Silvercobwebs_thumb.jpg","galleries_id":320849,"server_id":32,"link":"photo_6053252.html","width":130,"caption":"Silver cobwebs","height":173});
															thumbnails[6053258] = clik.newPhoto({"id":6053258,"src":"Flowerinsand_thumb.jpg","galleries_id":320849,"server_id":32,"link":"photo_6053258.html","width":130,"caption":"Flowers in the sand focal bead","height":173});
															thumbnails[6053302] = clik.newPhoto({"id":6053302,"src":"TurquoiseSwirl_thumb.jpg","galleries_id":320849,"server_id":32,"link":"photo_6053302.html","width":130,"caption":"Turquoise Swirls","height":139});
															thumbnails[6053319] = clik.newPhoto({"id":6053319,"src":"LampworkFocals1_thumb.jpg","galleries_id":320849,"server_id":32,"link":"photo_6053319.html","width":130,"caption":"Lampwork focals","height":98});
															thumbnails[6053329] = clik.newPhoto({"id":6053329,"src":"BlackcustardSwirl_thumb.jpg","galleries_id":320849,"server_id":32,"link":"photo_6053329.html","width":130,"caption":"Black custard swirl","height":147});
															thumbnails[5663661] = clik.newPhoto({"id":5663661,"src":"Yelloworange_scarf1_thumb.jpg","galleries_id":320848,"server_id":32,"link":"photo_5663661.html","width":130,"caption":"Yellow orange nuno felt scarf £35.00 (NF1)","height":173});
															thumbnails[5745664] = clik.newPhoto({"id":5745664,"src":"Blue_yellow_squares1_thumb.jpg","galleries_id":320848,"server_id":32,"link":"photo_5745664.html","width":130,"caption":"Blue yellow squares nuno felt scarf (NF2)","height":192});
															thumbnails[5663798] = clik.newPhoto({"id":5663798,"src":"Pink_lilac_scarf1_thumb.jpg","galleries_id":320848,"server_id":32,"link":"photo_5663798.html","width":130,"caption":"Ice cream pink nuno felt scarf £35.00 (NF3)","height":173});
															thumbnails[5663869] = clik.newPhoto({"id":5663869,"src":"Cerise_pink_scarf1_thumb.jpg","galleries_id":320848,"server_id":32,"link":"photo_5663869.html","width":130,"caption":"Cerise pink nuno felt scarf £35.00 (NF4)","height":173});
															thumbnails[5745661] = clik.newPhoto({"id":5745661,"src":"Blue_green1_thumb.jpg","galleries_id":320848,"server_id":32,"link":"photo_5745661.html","width":130,"caption":"Blue greens nuno felt scarf (NF5)","height":203});
															thumbnails[5664167] = clik.newPhoto({"id":5664167,"src":"1Red_Black_scarf2_thumb.jpg","galleries_id":320848,"server_id":32,"link":"photo_5664167.html","width":130,"caption":"Red black nuno felt scarf .... SOLD","height":173});
															thumbnails[5664925] = clik.newPhoto({"id":5664925,"src":"GreenSilver_thumb.JPG","galleries_id":320849,"server_id":32,"link":"photo_5664925.html","width":130,"caption":"Green mauve lampworked glass bead","height":108});
															thumbnails[5745669] = clik.newPhoto({"id":5745669,"src":"pink_purplecerise1_thumb.jpg","galleries_id":320848,"server_id":32,"link":"photo_5745669.html","width":130,"caption":"Pink purple cerise nuno felt scarf (NF8)","height":211});
															thumbnails[5664898] = clik.newPhoto({"id":5664898,"src":"Green_cerise_scarf1_thumb.jpg","galleries_id":320848,"server_id":32,"link":"photo_5664898.html","width":130,"caption":"Green cerise nuno felt scarf £30.00 (NF9)","height":98});
															thumbnails[5664947] = clik.newPhoto({"id":5664947,"src":"3FocalBead_Brooches_thumb.JPG","galleries_id":320849,"server_id":32,"link":"photo_5664947.html","width":130,"caption":"Three focal bead brooches","height":87});
															thumbnails[5665199] = clik.newPhoto({"id":5665199,"src":"green_beads_trio_thumb.jpg","galleries_id":320849,"server_id":32,"link":"photo_5665199.html","width":130,"caption":"Silver core green beads","height":98});
															thumbnails[5665296] = clik.newPhoto({"id":5665296,"src":"PinkBeadPendant_thumb.jpg","galleries_id":320849,"server_id":32,"link":"photo_5665296.html","width":130,"caption":"Pink purple pendant","height":98});
															thumbnails[5665282] = clik.newPhoto({"id":5665282,"src":"pinkmauve_thumb.JPG","galleries_id":320849,"server_id":32,"link":"photo_5665282.html","width":130,"caption":"Pink mauve focal bead","height":97});
															thumbnails[5679219] = clik.newPhoto({"id":5679219,"src":"Black_lemonscarf1_thumb.jpg","galleries_id":320848,"server_id":32,"link":"photo_5679219.html","width":130,"caption":"Black and lemon nuno felt scarf £35.00 (NF10)","height":173});
															thumbnails[5745666] = clik.newPhoto({"id":5745666,"src":"lilacpatterns_thumb.jpg","galleries_id":320848,"server_id":32,"link":"photo_5745666.html","width":130,"caption":"Lilac patterns nuno felt scarf (NF11)","height":214});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[320848] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Gallery 1","link":"gallery_320848.html","maxRecords":0.0,"photoIDs":[5663661.0,5745664.0,5663798.0,5663869.0,5745661.0,5664167.0,5745669.0,5664898.0,5679219.0,5745666.0],"skipIndex":0,"section_code":"gallery","featured_images":"5679219,5664898,5664167,5663869,5663798,5663661","id":320848,"singleSection":false});				  						galleries[320849] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Gallery 2","link":"gallery_320849.html","maxRecords":0.0,"photoIDs":[6053252.0,6053258.0,6053302.0,6053319.0,6053329.0,5664925.0,5664947.0,5665199.0,5665296.0,5665282.0],"skipIndex":0,"section_code":"gallery","featured_images":"5665296,5665282,5665199,5664947,5664925","id":320849,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '5663661,5663798,5663869,5664167,5664925,5665296,5665199,5664947,5664898,5679219,5665282';
imageSets[2] = '5663661,5663798,5663869,5664167,5664925,5665296,5665199,5664947,5664898,5679219,5665282';
imageSets[3] = '6053329,6053319,6053302,6053258,6053252,5750273,5745669,5745666,5745664,5745661,5745571,5735074,5679219,5665296,5665282,5665199,5664947,5664925,5664898,5664167,5663869,5663798,5663661';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/beadsnfelt/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/beadsnfelt/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/beadsnfelt/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/beadsnfelt/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/beadsnfelt/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/beadsnfelt/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/beadsnfelt/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/beadsnfelt/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/beadsnfelt/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/beadsnfelt/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/beadsnfelt/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/beadsnfelt/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/beadsnfelt/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/beadsnfelt/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/beadsnfelt/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/beadsnfelt/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/beadsnfelt/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/beadsnfelt/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/beadsnfelt/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/beadsnfelt/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/beadsnfelt/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/beadsnfelt/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/beadsnfelt/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/beadsnfelt/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/beadsnfelt/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/beadsnfelt/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/beadsnfelt/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 = 'Felt and Glass Beads: ' + 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;
	}
}

			

