window.thumbnails = new Object();
												thumbnails[5756846] = new thumbnail(5756846,'','','menuweb_thumb.jpg',130, 121,5,'#');
												thumbnails[5757011] = new thumbnail(5757011,'','','montageweb3_thumb.JPG',130, 130,5,'#');
												thumbnails[5867309] = new thumbnail(5867309,'','','IMG_5610_thumb.JPG',130, 87,5,'#');
												thumbnails[5867386] = new thumbnail(5867386,'','','0004bwtint_thumb.JPG',130, 181,5,'#');
												thumbnails[5940129] = new thumbnail(5940129,'','','cafe_frontweb1_thumb.JPG',130, 92,5,'#');
												thumbnails[5940445] = new thumbnail(5940445,'','','ripples_thumb.JPG',130, 85,5,'#');
												thumbnails[7504035] = new thumbnail(7504035,'325654','','WEBmenu_front_thumb.jpg',130, 184,5,'photo_7504035.html');
												thumbnails[7504037] = new thumbnail(7504037,'325654','','WEBmenu_inside_thumb.jpg',130, 184,5,'photo_7504037.html');
												thumbnails[5867030] = new thumbnail(5867030,'331536','','IMG_5536fx_thumb.JPG',130, 85,5,'photo_5867030.html');
												thumbnails[5867031] = new thumbnail(5867031,'331536','','IMG_5539_thumb.JPG',130, 87,5,'photo_5867031.html');
												thumbnails[5867037] = new thumbnail(5867037,'331536','','IMG_5545fx_thumb.JPG',130, 201,5,'photo_5867037.html');
												thumbnails[5867039] = new thumbnail(5867039,'331536','','IMG_5548bwtint_thumb.JPG',130, 87,5,'photo_5867039.html');
												thumbnails[5867048] = new thumbnail(5867048,'331536','','IMG_55551_thumb.JPG',130, 87,5,'photo_5867048.html');
												thumbnails[5867076] = new thumbnail(5867076,'331536','','IMG_55591_thumb.JPG',130, 195,5,'photo_5867076.html');
												thumbnails[5867078] = new thumbnail(5867078,'331536','','IMG_5562_thumb.JPG',130, 87,5,'photo_5867078.html');
												thumbnails[5867079] = new thumbnail(5867079,'331536','','IMG_5567_thumb.JPG',130, 195,5,'photo_5867079.html');
												thumbnails[5867161] = new thumbnail(5867161,'331536','','IMG_5571tint_thumb.JPG',130, 87,5,'photo_5867161.html');
												thumbnails[5867253] = new thumbnail(5867253,'331536','','IMG_5579tint_thumb.JPG',130, 195,5,'photo_5867253.html');
												thumbnails[5867298] = new thumbnail(5867298,'331536','','IMG_5599tint_thumb.JPG',130, 88,5,'photo_5867298.html');
												thumbnails[5867312] = new thumbnail(5867312,'331536','','IMG_5617tint_thumb.JPG',130, 195,5,'photo_5867312.html');
												thumbnails[5867314] = new thumbnail(5867314,'331536','','IMG_5624_thumb.JPG',130, 198,5,'photo_5867314.html');
												thumbnails[5867315] = new thumbnail(5867315,'331536','','IMG_5630_thumb.JPG',130, 101,5,'photo_5867315.html');
												thumbnails[5867316] = new thumbnail(5867316,'331536','','IMG_5648tint_thumb.JPG',130, 92,5,'photo_5867316.html');
												thumbnails[5867384] = new thumbnail(5867384,'331536','','0003bwtint_thumb.JPG',130, 192,5,'photo_5867384.html');
												thumbnails[5867387] = new thumbnail(5867387,'331536','','0009bw_thumb.JPG',130, 184,5,'photo_5867387.html');
												thumbnails[5867389] = new thumbnail(5867389,'331536','','0011bwtint_thumb.JPG',130, 87,5,'photo_5867389.html');
												thumbnails[5867390] = new thumbnail(5867390,'331536','','0012bwtint_thumb.JPG',130, 85,5,'photo_5867390.html');
												thumbnails[5867392] = new thumbnail(5867392,'331536','','0015_thumb.JPG',130, 88,5,'photo_5867392.html');
												thumbnails[5867394] = new thumbnail(5867394,'331536','','0017bw_thumb.JPG',130, 195,5,'photo_5867394.html');
												thumbnails[5867396] = new thumbnail(5867396,'331536','','0023bwtint_thumb.JPG',130, 82,5,'photo_5867396.html');
												thumbnails[5867401] = new thumbnail(5867401,'331536','','0032_thumb.JPG',130, 84,5,'photo_5867401.html');
												thumbnails[5867404] = new thumbnail(5867404,'331536','','0033bwtint_thumb.JPG',130, 88,5,'photo_5867404.html');
												thumbnails[5867408] = new thumbnail(5867408,'331536','','0035bwtint_thumb.JPG',130, 87,5,'photo_5867408.html');
												thumbnails[5867436] = new thumbnail(5867436,'331536','','0036bwtint_thumb.JPG',130, 87,5,'photo_5867436.html');
												thumbnails[5867444] = new thumbnail(5867444,'331536','','0040bwtint_thumb.JPG',130, 87,5,'photo_5867444.html');
												thumbnails[5867445] = new thumbnail(5867445,'331536','','0042bwweb_thumb.JPG',130, 87,5,'photo_5867445.html');
												thumbnails[5867446] = new thumbnail(5867446,'331536','','0044bw_thumb.JPG',130, 87,5,'photo_5867446.html');
												thumbnails[5867450] = new thumbnail(5867450,'331536','','0045bwtint_thumb.JPG',130, 85,5,'photo_5867450.html');
												thumbnails[5867452] = new thumbnail(5867452,'331536','','0049bwtint_thumb.JPG',130, 87,5,'photo_5867452.html');
												thumbnails[5867456] = new thumbnail(5867456,'331536','','0050bwtint_thumb.JPG',130, 82,5,'photo_5867456.html');
												thumbnails[5867457] = new thumbnail(5867457,'331536','','0057bwtint_thumb.JPG',130, 87,5,'photo_5867457.html');
												thumbnails[5867460] = new thumbnail(5867460,'331536','','0054_thumb.JPG',130, 83,5,'photo_5867460.html');
												thumbnails[5867463] = new thumbnail(5867463,'331536','','0061bwtint_thumb.JPG',130, 87,5,'photo_5867463.html');
												thumbnails[5867464] = new thumbnail(5867464,'331536','','0063bwtint_thumb.JPG',130, 81,5,'photo_5867464.html');
												thumbnails[5867468] = new thumbnail(5867468,'331536','','0067bwtint_thumb.JPG',130, 181,5,'photo_5867468.html');
												thumbnails[5867470] = new thumbnail(5867470,'331536','','0071_thumb.JPG',130, 83,5,'photo_5867470.html');
												thumbnails[5997368] = new thumbnail(5997368,'331536','','Tedweb_thumb.jpg',130, 193,5,'photo_5997368.html');
												thumbnails[6056007] = new thumbnail(6056007,'331536','','IMG_1120web_thumb.jpg',130, 95,5,'photo_6056007.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[331536] = new gallery(331536,'6056007,5997368,5867470,5867468,5867464,5867463,5867460,5867457,5867456,5867452','Ooooh','section397370',[5867030,5867031,5867037,5867039,5867048,5867076,5867078,5867079,5867161,5867253,5867298,5867312,5867314,5867315,5867316,5867384,5867387,5867389,5867390,5867392,5867394,5867396,5867401,5867404,5867408,5867436,5867444,5867445,5867446,5867450,5867452,5867456,5867457,5867460,5867463,5867464,5867468,5867470,5997368,6056007],0, 0, '', 'section397370.html',0,1);
				  					galleries[325654] = new gallery(325654,'7504037,7504035','Our Menu','gallery',[7504035,7504037],0, 0, '', 'gallery.html',0,1);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '5940129';
imageSets[3] = '7504037,7504035,6056007,5997368,5940445,5940129,5867470,5867468,5867464,5867463,5867460,5867457,5867456,5867452,5867450,5867446,5867445,5867444,5867436,5867408,5867404,5867401,5867396,5867394,5867392,5867390,5867389,5867387,5867386,5867384,5867316,5867315,5867314,5867312,5867309,5867298,5867253,5867161,5867079,5867078,5867076,5867048,5867039,5867037,5867031,5867030,5757011,5756846';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/sophieadele/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/sophieadele/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/sophieadele/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/sophieadele/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/sophieadele/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/sophieadele/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/sophieadele/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/sophieadele/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/sophieadele/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/sophieadele/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/sophieadele/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/sophieadele/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/sophieadele/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/sophieadele/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/sophieadele/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/sophieadele/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/sophieadele/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/sophieadele/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/sophieadele/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/sophieadele/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/sophieadele/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/sophieadele/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 = 'Adele\'s cafe: ' + 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;
	}
}

			

