window.thumbnails = {};
															thumbnails[5094673] = clik.newPhoto({"id":5094673,"src":"Large_White_Bowl_thumb.jpg","galleries_id":287053,"server_id":5,"link":"photo_5094673.html","width":130,"caption":"Memory Vessel","height":87});
															thumbnails[5094690] = clik.newPhoto({"id":5094690,"src":"my_favourite_tools_thumb.JPG","galleries_id":287047,"server_id":5,"link":"photo_5094690.html","width":130,"caption":"My favourite tools","height":98});
															thumbnails[5196428] = clik.newPhoto({"id":5196428,"src":"photo_shoot_nov_05_028_thumb.jpg","galleries_id":293400,"server_id":5,"link":"photo_5196428.html","width":130,"caption":"Odd Man Out","height":86});
															thumbnails[5196435] = clik.newPhoto({"id":5196435,"src":"photo_shoot_oct08_023_thumb.jpg","galleries_id":293400,"server_id":5,"link":"photo_5196435.html","width":130,"caption":"Protected Vessels","height":87});
															thumbnails[5196438] = clik.newPhoto({"id":5196438,"src":"Vessel_Cluster_thumb.jpg","galleries_id":293400,"server_id":5,"link":"photo_5196438.html","width":130,"caption":"Coctail Party Moment","height":87});
															thumbnails[5266328] = clik.newPhoto({"id":5266328,"src":"bun1_thumb.JPG","galleries_id":287047,"server_id":5,"link":"photo_5266328.html","width":130,"caption":"No caption required!","height":173});
															thumbnails[5275337] = clik.newPhoto({"id":5275337,"src":"mountain_thumb.jpg","galleries_id":287047,"server_id":5,"link":"photo_5275337.html","width":130,"caption":"","height":98});
															thumbnails[5275339] = clik.newPhoto({"id":5275339,"src":"open_road_thumb.jpg","galleries_id":287047,"server_id":5,"link":"photo_5275339.html","width":130,"caption":"","height":98});
															thumbnails[5278853] = clik.newPhoto({"id":5278853,"src":"stamp_thumb.jpg","galleries_id":287047,"server_id":5,"link":"photo_5278853.html","width":130,"caption":"My Stamp","height":195});
															thumbnails[5278865] = clik.newPhoto({"id":5278865,"src":"2008_1204sketchbook0009_thumb.JPG","galleries_id":287047,"server_id":5,"link":"photo_5278865.html","width":130,"caption":"Hussein Chalayan exhibition, London 2009.  ","height":173});
															thumbnails[5402596] = clik.newPhoto({"id":5402596,"src":"frosty_day_009_thumb.jpg","galleries_id":287047,"server_id":5,"link":"photo_5402596.html","width":130,"caption":"","height":98});
															thumbnails[5402613] = clik.newPhoto({"id":5402613,"src":"manchester_015_thumb.jpg","galleries_id":287047,"server_id":5,"link":"photo_5402613.html","width":130,"caption":"","height":98});
															thumbnails[5402619] = clik.newPhoto({"id":5402619,"src":"frosty_day_013_thumb.jpg","galleries_id":287047,"server_id":5,"link":"photo_5402619.html","width":130,"caption":"","height":98});
															thumbnails[6044951] = clik.newPhoto({"id":6044951,"src":"3L4F6735_-_Copy_thumb.jpg","galleries_id":287053,"server_id":5,"link":"photo_6044951.html","width":130,"caption":"Double-Hipped Manganese-Black Vessels","height":97});
															thumbnails[6103629] = clik.newPhoto({"id":6103629,"src":"2010-04-_SYR0232-ICSaraFlynn_thumb.jpg","galleries_id":287053,"server_id":5,"link":"photo_6103629.html","width":130,"caption":"Monochrome Landscape Vessel","height":195});
															thumbnails[6153771] = clik.newPhoto({"id":6153771,"src":"sketchbook_2_thumb.JPG","galleries_id":287047,"server_id":5,"link":"photo_6153771.html","width":130,"caption":"","height":98});
															thumbnails[6153774] = clik.newPhoto({"id":6153774,"src":"sketchbook_1_thumb.JPG","galleries_id":287047,"server_id":5,"link":"photo_6153774.html","width":130,"caption":"","height":173});
															thumbnails[6153777] = clik.newPhoto({"id":6153777,"src":"shetchbook_3_thumb.JPG","galleries_id":287047,"server_id":5,"link":"photo_6153777.html","width":130,"caption":"","height":173});
															thumbnails[7043448] = clik.newPhoto({"id":7043448,"src":"sara_-_Copy_thumb.jpg","galleries_id":287047,"server_id":5,"link":"photo_7043448.html","width":130,"caption":"","height":130});
															thumbnails[7343784] = clik.newPhoto({"id":7343784,"src":"texture_colour_form_thumb.JPG","galleries_id":287047,"server_id":5,"link":"photo_7343784.html","width":130,"caption":"texture, colour, form...","height":173});
															thumbnails[7343820] = clik.newPhoto({"id":7343820,"src":"pathway_light_shade_thumb.JPG","galleries_id":287047,"server_id":5,"link":"photo_7343820.html","width":130,"caption":"","height":173});
															thumbnails[7844199] = clik.newPhoto({"id":7844199,"src":"gesture_vessels_2_thumb.jpg","galleries_id":293400,"server_id":5,"link":"photo_7844199.html","width":130,"caption":"Gesture Vessels","height":86});
															thumbnails[5073121] = clik.newPhoto({"id":5073121,"src":"Black_Hipped_Vessels_thumb.jpg","galleries_id":287053,"server_id":5,"link":"photo_5073121.html","width":130,"caption":"Black Hipped Vessels","height":195});
															thumbnails[5278859] = clik.newPhoto({"id":5278859,"src":"Sara_Flynn_6_thumb.jpg","galleries_id":287053,"server_id":5,"link":"photo_5278859.html","width":130,"caption":"Soft Spine Vessel","height":195});
															thumbnails[5278860] = clik.newPhoto({"id":5278860,"src":"Celadon_Spine_Vessel_thumb.jpg","galleries_id":287053,"server_id":5,"link":"photo_5278860.html","width":130,"caption":"Celadon Sharp Spine Vessel","height":195});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[287053] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Altered Vessels","link":"gallery_287053.html","maxRecords":0.0,"photoIDs":[5094673.0,6044951.0,6103629.0,5073121.0,5278859.0,5278860.0],"skipIndex":0,"section_code":"gallery","featured_images":"6103629,6044951,5278860,5278859,5094673,5073121","id":287053,"singleSection":false});				  						galleries[293400] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Clustered Vessels","link":"gallery_293400.html","maxRecords":0.0,"photoIDs":[5196428.0,5196435.0,5196438.0,7844199.0],"skipIndex":0,"section_code":"gallery","featured_images":"7844199,5196438,5196435,5196428","id":293400,"singleSection":false});				  						galleries[287047] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Sketchbook","link":"gallery_287047.html","maxRecords":0.0,"photoIDs":[5094690.0,5266328.0,5275337.0,5275339.0,5278853.0,5278865.0,5402596.0,5402613.0,5402619.0,6153771.0,6153774.0,6153777.0,7043448.0,7343784.0,7343820.0],"skipIndex":0,"section_code":"gallery","featured_images":"7343820,7343784,7043448,6153777,6153774,6153771,5402619,5402613,5402596,5278865","id":287047,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '7043448,6103629,6044951,5278853,5196438,5196435,5196428,5094673,5073121,5278860';
imageSets[3] = '7844199,7343820,7343784,7043448,6153777,6153774,6153771,6103629,6044951,5402619,5402613,5402596,5278865,5278860,5278859,5278853,5275339,5275337,5266328,5196438,5196435,5196428,5094690,5094673,5073121';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/sarastu/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/sarastu/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/sarastu/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/sarastu/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/sarastu/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/sarastu/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/sarastu/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/sarastu/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/sarastu/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/sarastu/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/sarastu/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/sarastu/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/sarastu/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/sarastu/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/sarastu/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/sarastu/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/sarastu/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/sarastu/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/sarastu/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/sarastu/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/sarastu/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/sarastu/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/sarastu/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/sarastu/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/sarastu/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/sarastu/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/sarastu/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 = 'sara flynn - porcelain vessels: ' + 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;
	}
}

			

