window.thumbnails = new Object();
												thumbnails[3695263] = new thumbnail(3695263,'','','dec_bowl11_thumb.jpg',130, 87,15,'#');
												thumbnails[5037977] = new thumbnail(5037977,'','','bowl_detail21_B7231BE4-1D09-001F-99AF4F37CE87954E_thumb.jpg',90, 81,15,'#');
												thumbnails[3699665] = new thumbnail(3699665,'','','rest_life12_thumb.jpg',130, 72,15,'#');
												thumbnails[5765599] = new thumbnail(5765599,'','','rest_bed_thumb.jpg',90, 63,15,'#');
												thumbnails[5766605] = new thumbnail(5766605,'','','rest_bath1_thumb.jpg',90, 56,15,'#');
												thumbnails[3617496] = new thumbnail(3617496,'214770','','Decandescence1tealight2_thumb.jpg',130, 201,15,'photo_3617496.html');
												thumbnails[3699523] = new thumbnail(3699523,'214803','','rest_group2_thumb.jpg',130, 86,15,'photo_3699523.html');
												thumbnails[3704303] = new thumbnail(3704303,'221231','','dec_bowl1b_thumb.jpg',130, 87,15,'photo_3704303.html');
												thumbnails[3699630] = new thumbnail(3699630,'221231','','bowl_detail11_thumb.jpg',130, 98,15,'photo_3699630.html');
												thumbnails[5766011] = new thumbnail(5766011,'214803','','rest_bed1_thumb.jpg',90, 63,15,'photo_5766011.html');
												thumbnails[3614759] = new thumbnail(3614759,'214770','','Decandescence1tealightbase2_thumb.jpg',130, 192,15,'photo_3614759.html');
												thumbnails[3699549] = new thumbnail(3699549,'221231','','dec_bowl21_thumb.jpg',130, 94,15,'photo_3699549.html');
												thumbnails[3699717] = new thumbnail(3699717,'214803','','rest_glass1_thumb.jpg',130, 80,15,'photo_3699717.html');
												thumbnails[3699649] = new thumbnail(3699649,'221231','','bowl_detail21_thumb.jpg',130, 98,15,'photo_3699649.html');
												thumbnails[3617499] = new thumbnail(3617499,'214770','','Decandescence2tealight2_thumb.jpg',130, 163,15,'photo_3617499.html');
												thumbnails[3699603] = new thumbnail(3699603,'221231','','dec_bowl32_thumb.jpg',130, 171,15,'photo_3699603.html');
												thumbnails[3699767] = new thumbnail(3699767,'214803','','rest1_thumb.jpg',130, 98,15,'photo_3699767.html');
												thumbnails[3614766] = new thumbnail(3614766,'214770','','Decandescence3tealightbase4_thumb.jpg',130, 173,15,'photo_3614766.html');
												thumbnails[5773556] = new thumbnail(5773556,'214803','','rest_bath2_thumb.jpg',90, 57,15,'photo_5773556.html');
												thumbnails[5773566] = new thumbnail(5773566,'214803','','rest_bathb_thumb.jpg',90, 57,15,'photo_5773566.html');
												thumbnails[3617548] = new thumbnail(3617548,'214770','','Decandescence7tealight2_thumb.jpg',130, 169,15,'photo_3617548.html');
												thumbnails[3614770] = new thumbnail(3614770,'214770','','Decandescence5tealight2_thumb.jpg',130, 195,15,'photo_3614770.html');
												thumbnails[3617545] = new thumbnail(3617545,'214770','','Decandescence6tealight2_thumb.jpg',130, 174,15,'photo_3617545.html');
												thumbnails[3614774] = new thumbnail(3614774,'214770','','decandescence9tealight3_thumb.jpg',130, 186,15,'photo_3614774.html');
												thumbnails[3617500] = new thumbnail(3617500,'214770','','Decandescence4tealight2_thumb.jpg',130, 165,15,'photo_3617500.html');
												thumbnails[3614780] = new thumbnail(3614780,'214770','','decandescence8tealight3_thumb.jpg',130, 196,15,'photo_3614780.html');
												thumbnails[3614788] = new thumbnail(3614788,'214770','','decandescenceinterior2_thumb.jpg',130, 196,15,'photo_3614788.html');
												thumbnails[3614802] = new thumbnail(3614802,'214770','','decandescence10tealight3_thumb.jpg',130, 217,15,'photo_3614802.html');
												thumbnails[3615191] = new thumbnail(3615191,'214774','','hooplascooptablelamp_thumb.jpg',130, 95,15,'photo_3615191.html');
												thumbnails[3614195] = new thumbnail(3614195,'220888','','claras_mum12_thumb.jpg',130, 382,15,'photo_3614195.html');
												thumbnails[6884452] = new thumbnail(6884452,'221200','','storage_stool_9D60B946-1D09-001F-9900795830E60E26_thumb.jpg',49, 90,15,'photo_6884452.html');
												thumbnails[3613256] = new thumbnail(3613256,'220888','','candlestick_21_thumb.jpg',130, 384,15,'photo_3613256.html');
												thumbnails[6884450] = new thumbnail(6884450,'221200','','Lula_Dressing_Stool4_thumb.jpg',52, 90,15,'photo_6884450.html');
												thumbnails[3613257] = new thumbnail(3613257,'220888','','candlestick_2_detail_thumb.jpg',130, 208,15,'photo_3613257.html');
												thumbnails[6884675] = new thumbnail(6884675,'221200','','high_back_9D900B79-1D09-001F-990ECBC05DFB4EE9_thumb.jpg',35, 90,15,'photo_6884675.html');
												thumbnails[3614209] = new thumbnail(3614209,'220888','','flybylightlibelluladepressa1_thumb.jpg',130, 86,15,'photo_3614209.html');
												thumbnails[6884466] = new thumbnail(6884466,'221200','','high_back_detail_9D61D526-1D09-001F-9917A26A57858105_thumb.jpg',65, 90,15,'photo_6884466.html');
												thumbnails[3614211] = new thumbnail(3614211,'220888','','flybylightlluladetail1_thumb.jpg',130, 88,15,'photo_3614211.html');
												thumbnails[3614600] = new thumbnail(3614600,'220888','','Flybylightllulaon2_thumb.jpg',130, 89,15,'photo_3614600.html');
												thumbnails[3613272] = new thumbnail(3613272,'220888','','figure_twist_12_thumb.jpg',130, 194,15,'photo_3613272.html');
												thumbnails[3613274] = new thumbnail(3613274,'220888','','figure_twist_21_thumb.jpg',130, 204,15,'photo_3613274.html');
												thumbnails[3613277] = new thumbnail(3613277,'220888','','figure_twist_3_thumb.jpg',130, 194,15,'photo_3613277.html');
												thumbnails[3614607] = new thumbnail(3614607,'220888','','FlybyLightAeshnaGrandison3_thumb.jpg',130, 106,15,'photo_3614607.html');
												thumbnails[3614267] = new thumbnail(3614267,'220888','','FlybyLightAeshnaGrandisoff1_thumb.jpg',130, 102,15,'photo_3614267.html');
												thumbnails[3614874] = new thumbnail(3614874,'221200','','stool_group_thumb.jpg',130, 186,15,'photo_3614874.html');
												thumbnails[3614269] = new thumbnail(3614269,'220888','','flybylightaeshnagrandisdetail_thumb.jpg',130, 86,15,'photo_3614269.html');
												thumbnails[3614609] = new thumbnail(3614609,'220888','','flybylightleucorrhiniacauda1_thumb.jpg',130, 83,15,'photo_3614609.html');
												thumbnails[3613298] = new thumbnail(3613298,'220888','','the_lover_3_thumb.jpg',130, 188,15,'photo_3613298.html');
												thumbnails[3613300] = new thumbnail(3613300,'220888','','the_lover_thumb.jpg',130, 273,15,'photo_3613300.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[214774] = new gallery(214774,'3615191','Table lamps','section255317',[3615191],0, 0, '', 'section255317_214774.html',0,0);
				  					galleries[221223] = new gallery(221223,'','Shades','section255317',[],0, 0, '', 'section255317_221223.html',0,0);
				  					galleries[221200] = new gallery(221200,'3614874','Seating','section271790',[6884452,6884450,6884675,6884466,3614874],0, 0, '', 'section271790_221200.html',0,0);
				  					galleries[214770] = new gallery(214770,'3617496','Tea-lights','section255319',[3617496,3614759,3617499,3614766,3617548,3614770,3617545,3614774,3617500,3614780,3614788,3614802],0, 0, '', 'section255319_214770.html',0,0);
				  					galleries[221231] = new gallery(221231,'3704303','Bowls','section255319',[3704303,3699630,3699549,3699649,3699603],0, 0, '', 'section255319_221231.html',0,0);
				  					galleries[214803] = new gallery(214803,'3699523','\'Rest\'','section255319',[3699523,5766011,3699717,3699767,5773556,5773566],0, 0, '', 'section255319_214803.html',0,0);
				  					galleries[220888] = new gallery(220888,'3613272','Gallery','section271790',[3614195,3613256,3613257,3614209,3614211,3614600,3613272,3613274,3613277,3614607,3614267,3614269,3614609,3613298,3613300],0, 0, '', 'section271790_220888.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[193920] = '6884452';
imageSets[1] = '3704303,3699665,3617548,3614874,3614607,3613272';
imageSets[2] = '3704303,3699523,3617496,3615191,3614874,3613272';
imageSets[3] = '6884675,6884466,6884452,6884450,5773566,5773556,5766605,5766011,5765599,5037977,3704303,3699767,3699717,3699665,3699649,3699630,3699603,3699549,3699523,3695263,3617548,3617545,3617500,3617499,3617496,3615191,3614874,3614802,3614788,3614780,3614774,3614770,3614766,3614759,3614609,3614607,3614600,3614269,3614267,3614211,3614209,3614195,3613300,3613298,3613277,3613274,3613272,3613257,3613256';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/embidesigns/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/embidesigns/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/embidesigns/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/embidesigns/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/embidesigns/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/embidesigns/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/embidesigns/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/embidesigns/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/embidesigns/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/embidesigns/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/embidesigns/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/embidesigns/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/embidesigns/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/embidesigns/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/embidesigns/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/embidesigns/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/embidesigns/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/embidesigns/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/embidesigns/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/embidesigns/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/embidesigns/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/embidesigns/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 += 'section255319.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 && 'section255319' != '') {
					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 = 'www.embi.co.uk: ' + 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 = 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;
	}
}

			

