window.thumbnails = new Object();
												thumbnails[2526499] = new thumbnail(2526499,'','<strong>Jude Stoll</strong>','jude_manipulating_coke_bot_thumb.jpg',130, 98,5,'#');
												thumbnails[2526526] = new thumbnail(2526526,'','<strong>Easter Rabbits</strong>','lenoxbunnies_thumb.jpg',130, 98,5,'#');
												thumbnails[2526531] = new thumbnail(2526531,'','Ed Modelling renshaw 1','modelling_renshaw1_thumb.jpg',130, 98,5,'#');
												thumbnails[2526534] = new thumbnail(2526534,'','Ed modelling renshaw 2','modelling_renshawthumb5_thumb.jpg',90, 130,5,'#');
												thumbnails[2526565] = new thumbnail(2526565,'','ed sledging close up','Sledgingcloseup_thumb.jpg',98, 130,5,'#');
												thumbnails[2526569] = new thumbnail(2526569,'','ed sledging face','Sledgingface_thumb.jpg',130, 98,5,'#');
												thumbnails[2526572] = new thumbnail(2526572,'','sledging teach','Sledgingteach1d_thumb.jpg',130, 98,5,'#');
												thumbnails[2526592] = new thumbnail(2526592,'','<strong>Vial Vessel</strong>','vial_vessel_IIIdetail_thumb.jpg',130, 98,5,'#');
												thumbnails[2416794] = new thumbnail(2416794,'156378','<strong>Art 07 trophy</strong>','arto7trophy_thumb.jpg',98, 130,5,'photo_2416794.html');
												thumbnails[2416879] = new thumbnail(2416879,'156378','<strong>Recycling Roadshow Trophy</strong>','CCC_trophy_thumb.jpg',98, 130,5,'photo_2416879.html');
												thumbnails[2416911] = new thumbnail(2416911,'156383','<strong>Dragonfly</strong>','dragonfly_thumb.jpg',98, 130,5,'photo_2416911.html');
												thumbnails[2417242] = new thumbnail(2417242,'156383','<strong>Icarus</strong>','icarusdetail_thumb.jpg',130, 98,5,'photo_2417242.html');
												thumbnails[2421214] = new thumbnail(2421214,'156383','<strong>Strata</strong> ','strata2_thumb.jpg',130, 98,5,'photo_2421214.html');
												thumbnails[2526562] = new thumbnail(2526562,'156378','<strong>Open Art Trophy</strong>','shirehall_thumb.jpg',98, 130,5,'photo_2526562.html');
												thumbnails[2416789] = new thumbnail(2416789,'156377','<strong>Aidyfis</strong>','Aidyfis_thumb.jpg',98, 130,5,'photo_2416789.html');
												thumbnails[2416813] = new thumbnail(2416813,'150344','<strong>Birdie Vase</strong>','birdiesingle_thumb.jpg',98, 130,5,'photo_2416813.html');
												thumbnails[2421028] = new thumbnail(2421028,'156376','<strong>Manhattan/Bianco</strong>','Manhattan_group_thumb.jpg',98, 130,5,'photo_2421028.html');
												thumbnails[2416923] = new thumbnail(2416923,'156377','<strong>Eye in the Sky</strong>','Eyeinthesky1_thumb.jpg',98, 130,5,'photo_2416923.html');
												thumbnails[2526580] = new thumbnail(2526580,'150344','<strong>Timely Traditions Clock</strong>','Timelytraditionsclock1_thumb.jpg',98, 130,5,'photo_2526580.html');
												thumbnails[2526616] = new thumbnail(2526616,'156376','<strong>Zoom</strong>','zoomgravel_thumb.jpg',98, 130,5,'photo_2526616.html');
												thumbnails[2416929] = new thumbnail(2416929,'156377','<strong>Flood Red</strong>','Floodred1_thumb.jpg',98, 130,5,'photo_2416929.html');
												thumbnails[2526417] = new thumbnail(2526417,'150344','<strong>Timely Traditions Clock</strong>','decoclock_thumb.jpg',98, 130,5,'photo_2526417.html');
												thumbnails[2526588] = new thumbnail(2526588,'156376','<strong>Toucan</strong>','Toucanteaset_thumb.jpg',98, 130,5,'photo_2526588.html');
												thumbnails[2416822] = new thumbnail(2416822,'156376','<strong>Bombay Sapphire Martini Glass</strong>','bombaymartini_thumb.jpg',98, 130,5,'photo_2416822.html');
												thumbnails[2417240] = new thumbnail(2417240,'156377','<strong>Hidden Dip</strong>','Hiddendip1_thumb.jpg',98, 130,5,'photo_2417240.html');
												thumbnails[2526584] = new thumbnail(2526584,'150344','<strong>Timely Traditions Clock</strong>','timelytradtions2_thumb.jpg',98, 130,5,'photo_2526584.html');
												thumbnails[2416933] = new thumbnail(2416933,'156376','<strong>Flower Foot</strong>','flowerfoot_thumb.jpg',98, 130,5,'photo_2416933.html');
												thumbnails[2421041] = new thumbnail(2421041,'156377','<strong>Nearly There</strong>','Nearlythere2_thumb.jpg',98, 130,5,'photo_2421041.html');
												thumbnails[2526539] = new thumbnail(2526539,'150344','<strong>Oak</strong>','oak_thumb.jpg',98, 130,5,'photo_2526539.html');
												thumbnails[2416797] = new thumbnail(2416797,'156376','<strong>Stump</strong> ','stump_thumb.jpg',130, 98,5,'photo_2416797.html');
												thumbnails[2420877] = new thumbnail(2420877,'156377','<strong>Little Horn</strong> ','Littlehorn2_thumb.jpg',98, 130,5,'photo_2420877.html');
												thumbnails[2526545] = new thumbnail(2526545,'150344','<strong>Pillar</strong>','Pillar_thumb.jpg',98, 130,5,'photo_2526545.html');
												thumbnails[2416876] = new thumbnail(2416876,'150344','<strong>Rowan</strong> ','Rowan_thumb.jpg',98, 130,5,'photo_2416876.html');
												thumbnails[2421170] = new thumbnail(2421170,'156377','<strong>Ovals</strong> ','ovals_thumb.jpg',130, 98,5,'photo_2421170.html');
												thumbnails[2526607] = new thumbnail(2526607,'156376','<strong>Zoom</strong>','Zoomblue_thumb.jpg',130, 98,5,'photo_2526607.html');
												thumbnails[2420905] = new thumbnail(2420905,'150344','<strong>Willow</strong> ','willow_thumb.jpg',98, 130,5,'photo_2420905.html');
												thumbnails[2526430] = new thumbnail(2526430,'156377','<strong>Helado</strong>','icecreamcones_thumb.jpg',130, 98,5,'photo_2526430.html');
												thumbnails[2526610] = new thumbnail(2526610,'156376','<strong>Zoom</strong>','zoomchopsticks_thumb.jpg',130, 98,5,'photo_2526610.html');
												thumbnails[2416816] = new thumbnail(2416816,'156377','<strong>Birdie Vase</strong>','birdietriple_thumb.jpg',98, 130,5,'photo_2416816.html');
												thumbnails[2416887] = new thumbnail(2416887,'150344','<strong>Cobra</strong>','cobra_thumb.jpg',130, 98,5,'photo_2416887.html');
												thumbnails[2417236] = new thumbnail(2417236,'156376','<strong>The Royal Collection Golden Jubilee Range</strong>','royalcollection_thumb.jpg',130, 98,5,'photo_2417236.html');
												thumbnails[2416914] = new thumbnail(2416914,'156377','<strong>Renshaw Vase</strong>','renshaw_thumb.jpg',130, 98,5,'photo_2416914.html');
												thumbnails[2416916] = new thumbnail(2416916,'156377','<strong>Silhouette Vase</strong>','silhouette_thumb.jpg',98, 130,5,'photo_2416916.html');
												thumbnails[2421037] = new thumbnail(2421037,'150344','<strong>Mother\'s Ruin</strong>','mothersruin_thumb.jpg',98, 130,5,'photo_2421037.html');
												thumbnails[2526556] = new thumbnail(2526556,'156377','<strong>Novales Vase</strong>','Novales_thumb.jpg',98, 130,5,'photo_2526556.html');
												thumbnails[2526602] = new thumbnail(2526602,'156377','<strong>Vial Vessel</strong>','vialvesselyinyang_thumb.jpg',98, 130,5,'photo_2526602.html');
												thumbnails[2526595] = new thumbnail(2526595,'156377','<strong>Vial Vessel</strong>','vialv4_thumb.jpg',130, 98,5,'photo_2526595.html');
												thumbnails[2526598] = new thumbnail(2526598,'156377','<strong>Vial Vessel</strong>','vialvessel2detail_thumb.jpg',130, 98,5,'photo_2526598.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[156376] = new gallery(156376,'2421028','Tableware','gallery',[2421028,2526616,2526588,2416822,2416933,2416797,2526607,2526610,2417236],0, 0, '', 'gallery_156376.html',0,0);
				  					galleries[156383] = new gallery(156383,'2416911','Architectural Glass','gallery',[2416911,2417242,2421214],0, 0, '', 'gallery_156383.html',0,0);
				  					galleries[150344] = new gallery(150344,'2526584','Giftware','gallery',[2416813,2526580,2526417,2526584,2526539,2526545,2416876,2420905,2416887,2421037],0, 0, '', 'gallery_150344.html',0,0);
				  					galleries[156378] = new gallery(156378,'2416794','Trophies','gallery',[2416794,2416879,2526562],0, 0, '', 'gallery_156378.html',0,0);
				  					galleries[156377] = new gallery(156377,'2416816','Interior Accessories','gallery',[2416789,2416923,2416929,2417240,2421041,2420877,2421170,2526430,2416816,2416914,2416916,2526556,2526602,2526595,2526598],0, 0, '', 'gallery_156377.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '2526607,2526598,2526592,2526430,2421214,2417236,2416914,2416887';
imageSets[2] = '2526584,2421028,2416911,2416816,2416794';
imageSets[3] = '2526616,2526610,2526607,2526602,2526598,2526595,2526592,2526588,2526584,2526580,2526572,2526569,2526565,2526562,2526556,2526545,2526539,2526534,2526531,2526526,2526499,2526430,2526417,2421214,2421170,2421041,2421037,2421028,2420905,2420877,2417242,2417240,2417236,2416933,2416929,2416923,2416916,2416914,2416911,2416887,2416879,2416876,2416822,2416816,2416813,2416797,2416794,2416789';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/bentleystoll/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/bentleystoll/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/bentleystoll/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/bentleystoll/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/bentleystoll/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/bentleystoll/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/bentleystoll/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/bentleystoll/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/bentleystoll/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/bentleystoll/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/bentleystoll/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/bentleystoll/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/bentleystoll/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/bentleystoll/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/bentleystoll/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/bentleystoll/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/bentleystoll/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/bentleystoll/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/bentleystoll/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/bentleystoll/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/bentleystoll/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/bentleystoll/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:'',
                    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 (!basic) {
    if (op.updateHash && clik.getIDInUrl(location.href,'photo') != op.nextPhoto.id) {
		clik.changeHash('photos_id=' + op.nextPhoto.id, true);
    }
				
    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));		  $('body').trigger('clikUpdate');		}, op.onBefore);
      }    }
    	if (op.field) {
		op.field.value = photoId;
	} else {
		op.$photo.data('image_id', photoId);
    }
	    if (op.$title.length > 0) {
  		op.$title.fadeGalleryDetails(photoCaption, op.speed);
    }
        if (op.updateDocumentTitle) {
						  document.title = 'Ceramic and Glass Product Design and Development  : ' + photoCaption;
			    }
        if (op.$detail.length > 0) {
      temp = op.nextPhoto.fnGetImageDetails();
	    op.$detail.fadeGalleryDetails(temp, op.speed, function(){
	    var options = {};	    	      	      resizePhotoInfo(options);
        if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
  	      toggleAddToCartConfirm(backgrounds);
  	    } else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
  	      toggleAddToCartConfirm(photos);
  	    }
	    });
    }
        if (!op.speed) {      clik.doColumnResize(false, op.$photo.add(op.$detail).add(op.$title));      $('body').trigger('clikUpdate');    }        
    return html;			}
	else {
				
		window.location = 'photo_' + nextPhoto.id + '.html';
	}
		
}

/***************************************************************************
* Toggle add to cart confirmation element and set up the click event for   *
* the 'Add to cart' button.                                                *
***************************************************************************/
function toggleAddToCartConfirm(array){
  if (typeof(array) !== 'object' || array == undefined) {
    array = photos;
  }
	if($('#paymentConfirm').length > 0){
		$('#paymentConfirm').hide();
		$('#paymentAddButton')
		.unbind()
		.click(function(){
						form = document.getElementById('paymentForm');
			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').text('Item added to cart').show();}
				else{
					$('#paymentConfirm').text('Item added to cart').fadeIn();
					dspOrderDetails(form.site.value);
				}
			}
			else{
				$('#paymentConfirm').text('Item not added - check cookies are enabled in your browser.').fadeIn();
			}
		});
	}
}
/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
photo.prototype.fnGetImageDetails = function(){
	var temp = '';
	if (this.description != '') {
		temp = temp +  '<p id="imageDescription">' + this.description + '</p>';
	}
		if (this.photo_ref != '') {
		temp = temp + '<p class="imageinfo" id="imageRef"><strong>Ref: </strong>' + this.photo_ref + '</p>';
	}
		if (this.takendate != '') {
				
		temp = temp + '<p class="imageinfo" id="imageDate"><strong>Date: </strong>' + this.takendate + '</p>';
	}
	
	if (this.location != '') {
				
		temp = temp + '<p class="imageinfo" id="imageLocation"><strong>Location: </strong>' +  this.location + '</p>';
	}
	
	if (this.photographer != '') {
				
		temp = temp + '<p class="imageinfo" id="imagePhotographer"><strong>Photographer: </strong>' + this.photographer + '</p>';
	}
					
				if (temp != '') {
		temp = temp + '<div class="spacer"></div>';
	}
	return temp;
};

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
photo.prototype.fnGetPaymentInfo = function(){
	var temp = '';
	if (this.item_price !== '') {
				temp = temp + '<p>Order this print:</p>';
				temp = temp + '<p class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> ' + (this.item_price).toFixed(2) + '</p>';
		var item_name  = this.purchase_instruction;
		var amount = (this.item_price).toFixed(2);
		var item_option  = 0;
	}
	else if (this.payment_groups_id !== '') {
		temp = temp + '<p>Buy this print online:</p>';
				temp = temp + '<form id="paymentOptions" style="margin:0px;border:0px;" name="paymentOptions">';
											temp = temp + '<select class="paymentlink" name="payment_options_id" onchange="updateItemValues(document.forms.paymentForm,this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value);">';
				
		temp = temp + getPaymentOptions(this.payment_groups_id);
		temp = temp + '</select>';
		temp = 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 = 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 + ' | ';
				}
				temp = temp + '<a href="' + galleries[i].section_code + '_' + galleries[i].id + '.html">' + galleries[i].title + '</a>';
			}
		}
		document.all.galleryLinks.innerHTML = 'Other galleries: ' + temp;
	}
}

		

