window.thumbnails = {};
															thumbnails[7627439] = clik.newPhoto({"id":7627439,"src":"CeretColliore12_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"","height":97});
															thumbnails[7627441] = clik.newPhoto({"id":7627441,"src":"CeretColliore2_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"","height":97});
															thumbnails[7627442] = clik.newPhoto({"id":7627442,"src":"CeretColliore3_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"","height":97});
															thumbnails[8064518] = clik.newPhoto({"id":8064518,"src":"christine-lester_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"","height":110});
															thumbnails[8064520] = clik.newPhoto({"id":8064520,"src":"signature_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"","height":43});
															thumbnails[8064647] = clik.newPhoto({"id":8064647,"src":"saa-member_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"","height":163});
															thumbnails[8064769] = clik.newPhoto({"id":8064769,"src":"christine-and-students_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"","height":54});
															thumbnails[8064780] = clik.newPhoto({"id":8064780,"src":"woodbridge_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"","height":34});
															thumbnails[8064781] = clik.newPhoto({"id":8064781,"src":"more-woodbridge_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"","height":69});
															thumbnails[8064793] = clik.newPhoto({"id":8064793,"src":"Untitled-2_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"Southwold Beach","height":126});
															thumbnails[8064809] = clik.newPhoto({"id":8064809,"src":"christine-canvases_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"","height":35});
															thumbnails[5372727] = clik.newPhoto({"id":5372727,"src":"P1010069_thumb.jpg","galleries_id":302906,"server_id":5,"link":"photo_5372727.html","width":130,"caption":"Southwold Beach","height":126});
															thumbnails[5806437] = clik.newPhoto({"id":5806437,"src":"5991043_27193032_thumb.jpg","galleries_id":328763,"server_id":5,"link":"photo_5806437.html","width":130,"caption":"","height":173});
															thumbnails[5806451] = clik.newPhoto({"id":5806451,"src":"5991045_23122945_thumb.jpg","galleries_id":328763,"server_id":5,"link":"photo_5806451.html","width":130,"caption":"","height":98});
															thumbnails[5806452] = clik.newPhoto({"id":5806452,"src":"5991048_5789666_thumb.jpg","galleries_id":328763,"server_id":5,"link":"photo_5806452.html","width":130,"caption":"","height":98});
															thumbnails[5806453] = clik.newPhoto({"id":5806453,"src":"5991050_33355625_thumb.jpg","galleries_id":328763,"server_id":5,"link":"photo_5806453.html","width":130,"caption":"","height":98});
															thumbnails[5806454] = clik.newPhoto({"id":5806454,"src":"5991051_14103140_thumb.jpg","galleries_id":328763,"server_id":5,"link":"photo_5806454.html","width":130,"caption":"","height":98});
															thumbnails[5806471] = clik.newPhoto({"id":5806471,"src":"5991052_2979310_thumb.jpg","galleries_id":328763,"server_id":5,"link":"photo_5806471.html","width":130,"caption":"","height":98});
															thumbnails[5806487] = clik.newPhoto({"id":5806487,"src":"5991053_10054588_thumb.jpg","galleries_id":328763,"server_id":5,"link":"photo_5806487.html","width":130,"caption":"","height":98});
															thumbnails[5806492] = clik.newPhoto({"id":5806492,"src":"cnv00005_thumb.jpg","galleries_id":328763,"server_id":5,"link":"photo_5806492.html","width":130,"caption":"","height":98});
															thumbnails[5806494] = clik.newPhoto({"id":5806494,"src":"cnv00029_thumb.jpg","galleries_id":328763,"server_id":5,"link":"photo_5806494.html","width":130,"caption":"","height":98});
															thumbnails[5806495] = clik.newPhoto({"id":5806495,"src":"untitled_thumb.jpg","galleries_id":328763,"server_id":5,"link":"photo_5806495.html","width":130,"caption":"","height":173});
															thumbnails[5806581] = clik.newPhoto({"id":5806581,"src":"CNV00020_thumb.jpg","galleries_id":328763,"server_id":5,"link":"photo_5806581.html","width":130,"caption":"","height":98});
															thumbnails[5806584] = clik.newPhoto({"id":5806584,"src":"P1030126_thumb.jpg","galleries_id":328763,"server_id":5,"link":"photo_5806584.html","width":130,"caption":"","height":98});
															thumbnails[5948884] = clik.newPhoto({"id":5948884,"src":"DH000005_thumb.jpg","galleries_id":302906,"server_id":5,"link":"photo_5948884.html","width":130,"caption":"Dog on Boat","height":174});
															thumbnails[5948889] = clik.newPhoto({"id":5948889,"src":"DH000006_thumb.jpg","galleries_id":302906,"server_id":5,"link":"photo_5948889.html","width":130,"caption":"Aldeburgh Boat Yard","height":97});
															thumbnails[5482478] = clik.newPhoto({"id":5482478,"src":"cnv000014_thumb.jpg","galleries_id":302906,"server_id":5,"link":"photo_5482478.html","width":130,"caption":"Summer outside The Viper","height":133});
															thumbnails[5482481] = clik.newPhoto({"id":5482481,"src":"man_with_3_dogs_thumb.jpg","galleries_id":302906,"server_id":5,"link":"photo_5482481.html","width":130,"caption":"Man with three dogs","height":182});
															thumbnails[5482486] = clik.newPhoto({"id":5482486,"src":"old_ladies_with_chickens_thumb.jpg","galleries_id":302906,"server_id":5,"link":"photo_5482486.html","width":130,"caption":"Old ladies with chickens","height":93});
															thumbnails[5482489] = clik.newPhoto({"id":5482489,"src":"child_thumb.jpg","galleries_id":302906,"server_id":5,"link":"photo_5482489.html","width":130,"caption":"Young child","height":98});
															thumbnails[5372734] = clik.newPhoto({"id":5372734,"src":"P1030004_thumb.jpg","galleries_id":302906,"server_id":5,"link":"photo_5372734.html","width":130,"caption":"Beach Huts","height":113});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[328763] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Photos","link":"gallery_328763.html","maxRecords":0.0,"photoIDs":[5806437.0,5806451.0,5806452.0,5806453.0,5806454.0,5806471.0,5806487.0,5806492.0,5806494.0,5806495.0,5806581.0,5806584.0],"skipIndex":0,"section_code":"gallery","featured_images":"5806584,5806581,5806495,5806494,5806492,5806487,5806471,5806454,5806453,5806452","id":328763,"singleSection":false});				  						galleries[302906] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Christine's Canvasses","link":"gallery_302906.html","maxRecords":0.0,"photoIDs":[5372727.0,5948884.0,5948889.0,5482478.0,5482481.0,5482486.0,5482489.0,5372734.0],"skipIndex":0,"section_code":"gallery","featured_images":"5948889,5948884,5482489,5482486,5482481,5482478,5372734,5372727","id":302906,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '8064518';
imageSets[3] = '8064809,8064793,8064781,8064780,8064769,8064647,8064520,8064518,7627442,7627441,7627439,5948889,5948884,5806584,5806581,5806495,5806494,5806492,5806487,5806471,5806454,5806453,5806452,5806451,5806437,5482489,5482486,5482481,5482478,5372734,5372727';
imageSets[243257] = '8064520';
imageSets[243258] = '8064647';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/ArtBreaksEastAnglia/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/ArtBreaksEastAnglia/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/ArtBreaksEastAnglia/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/ArtBreaksEastAnglia/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/ArtBreaksEastAnglia/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/ArtBreaksEastAnglia/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/ArtBreaksEastAnglia/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/ArtBreaksEastAnglia/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/ArtBreaksEastAnglia/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/ArtBreaksEastAnglia/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/ArtBreaksEastAnglia/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/ArtBreaksEastAnglia/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/ArtBreaksEastAnglia/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/ArtBreaksEastAnglia/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/ArtBreaksEastAnglia/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/ArtBreaksEastAnglia/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/ArtBreaksEastAnglia/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/ArtBreaksEastAnglia/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/ArtBreaksEastAnglia/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/ArtBreaksEastAnglia/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/ArtBreaksEastAnglia/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/ArtBreaksEastAnglia/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/ArtBreaksEastAnglia/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/ArtBreaksEastAnglia/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/ArtBreaksEastAnglia/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/ArtBreaksEastAnglia/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/ArtBreaksEastAnglia/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 = ' Art Breaks East Anglia: ' + 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;
	}
}

			

