// Copyright © Kelta Systems 2002-2005 - All rights reserved
// The following code is used under license from Kelta Systems - www.kelta.co.uk
// compressed
/* 20050701 Licensed to The Whitehart Inn for use on www.whitehartinnbodmin.co.uk */
function zExhibit(parameters){
 if (parameters != null) {
  parse_parameters(this,parameters)
  this.loaded = false;
  //listProperties(this)
 }
}
zExhibit.prototype.lowsrc = 'blank.gif';
new zExhibit()
function zGallery(parameters){
 if (parameters != null) {
  //alert('Gallery parameters=' + parameters);
  parse_parameters(this,parameters);
  this.exhibits = new Array();
  //listProperties(this);
  this.initialDisplay = true;
  if (this.controls == null) this.controls = '';
  if (this.mode == 'display') {
   if (this.controls.indexOf('F') > -1) this.controlsFirst = true;
   if (this.controls.indexOf('P') > -1) this.controlsPrevious = true;
   if (this.controls.indexOf('N') > -1) this.controlsNext = true;
   if (this.controls.indexOf('L') > -1) this.controlsLast = true;
  }
  else {
   this.mode = 'show';
   if (this.controls.indexOf('F') > -1) this.controlsFaster = true;
   if (this.controls.indexOf('C') > -1) this.controlsContinue = true;
   if (this.controls.indexOf('P') > -1) this.controlsPause = true;
   if (this.controls.indexOf('S') > -1) this.controlsSlower = true;
   if (this.controls.indexOf('X') > -1) this.controlsPrevious = true;
   if (this.controls.indexOf('N') > -1) this.controlsNext = true;
  }
 }
}
zGallery.prototype.dir = 'images';
zGallery.prototype.xfadeduration = '2'; // 1 second
zGallery.prototype.displayIx = '-1';
zGallery.prototype.showSpeed = '7000'; // 7 seconds
zGallery.prototype.showInitial = '9000'; // 9 seconds
zGallery.prototype.showLoop = '*'; // forever
zGallery.prototype.showcaption = true;
zGallery.prototype.showDelay = '0'; // 0 seconds
zGallery.prototype.preload = false;
new zGallery()
function zGallery_displayControls(parameters) {
 if (this.controls != '') {
  controls = new zMenu(parameters);
  if (this.controlsFaster) controls.zButton('text=Faster,status=Speed-up slideshow,href=javascript: ' + this.name + '.showFaster(),img=controls-faster.gif');
  if (this.controlsContinue) controls.zButton('text=Continue,status=Contine the slideshow,href=javascript: ' + this.name + '.showStart(),img=controls-next.gif');
  if (this.controlsPause) controls.zButton('text=Pause,status=Pause the slideshow,href=javascript: ' + this.name + '.showPause(),img=controls-pause.gif');
  if (this.controlsSlower) controls.zButton('text=Slower,status=Slow-down slideshow,href=javascript: ' + this.name + '.showSlower(),img=controls-slower.gif');
  if (this.controlsFirst) controls.zButton('text=First,status=First image,href=javascript: ' + this.name + '.displayFirst(),img=controls-first.gif');
  if (this.controlsPrevious) controls.zButton('text=Previous,status=Previous image,href=javascript: ' + this.name + '.displayPrevious(),img=controls-previous.gif');
  if (this.controlsNext) controls.zButton('text=Next,status=next Image,href=javascript: ' + this.name + '.displayNext(),img=controls-next.gif');
  if (this.controlsLast) controls.zButton('text=Last,status=last picure,href=javascript: ' + this.name + '.displayLast(),img=controls-last.gif');
  controls.display();
 }
}
zGallery.prototype.displayControls = zGallery_displayControls;
function zGallery_exhibit(parameters) {
 if (parameters != null) {
   var i = this.exhibits.length;
   this.exhibits[i] = new zExhibit('name=' + this.name + i + ',' + parameters);
   this.displayIx = i;
  }
}
zGallery.prototype.zExhibit = zGallery_exhibit;
function zGallery_display(ix) {
 if (typeof ix == 'undefined') ix = this.displayIx;
 var xcaption,ycaption,zcaption,dir
 window.status = ' ';
 if (this.dir != '') dir = this.dir + '\/'
 var exhibit = this.exhibits[this.displayIx]
 var graphic = dir + exhibit.img;
 var lowsrc = dir + exhibit.lowsrc;
 image = document.images[this.name];
 if (image) {
  image.src = graphic;
 }
 else {image = new Image();
  image.name = this.name;
  image.lowsrc = lowsrc;
  image.src = graphic;
  if (this.height != null) image.height = this.height;
  if (this.width != null) image.width = this.height;
 }
 if (document.all) {
   document.images[this.name].style.filter="blendTrans(duration=this.xfadeduration)";
   document.images[this.name].filters.blendTrans.Apply();
   document.images[this.name].filters.blendTrans.Play()
 }
 if (this.showcaption == true) {
  xcaption = exhibit.img.match(/-%20\w\S+%20-%20\w\d/);
  var cssclass = 'zCaption';
  if (this.cssclass != null) cssclass = this.cssclass
  if (exhibit.cssclass != null) cssclass = exhibit.cssclass
  if (xcaption != null) {
   ycaption = xcaption.toString().replace(/%20/g,' ');
   zcaption = ycaption.substring(2,ycaption.length-4)
   if (document.all && zcaption != null) {
    document.all.caption.innerHTML = '<span class="' + this.style + '">' + zcaption + '</span>';
    document.all.caption.className = cssclass;
   }
   else window.status = zcaption
  }
 }
}
zGallery.prototype.display = zGallery_display;
function zGallery_displayFirst() {
  this.displayIx = 0;
  this.display()
}
zGallery.prototype.displayFirst = zGallery_displayFirst;
function zGallery_displayLast() {
  this.displayIx = this.exhibits.length - 1;
  this.display()
}
zGallery.prototype.displayLast = zGallery_displayLast;
function zGallery_displayNext() {
  this.displayIx++;
  this.displayIx = this.displayIx % this.exhibits.length;
  this.display()
}
zGallery.prototype.displayNext = zGallery_displayNext;
function zGallery_displayPrevious() {
  this.displayIx--;
  if (this.displayIx < '0') {this.displayIx = this.exhibits.length--}
  this.display()
}
zGallery.prototype.displayPrevious = zGallery_displayPrevious;
function zGallery_preloadNext() {
  var displayIx = parseInt(this.displayIx) + 1;
  if (displayIx > this.exhibits.length - 1) {displayIx = '0'}
  if (this.exhibits[displayIx].loaded == false) {
   if (this.dir != '') dir = this.dir + '\/'
   var preload = new Image();
   preload.src = dir + this.exhibits[displayIx].img
  }
}
zGallery.prototype.preloadNext = zGallery_preloadNext;
function zGallery_showDisplay() {
 if (this.displayIx == this.exhibits.length - 1) {
  this.showLoops++;
  if (this.showLoop == "*") this.showPlay = true;
  else {
   if (this.showLoops > this.showLoop) this.showPlay = false;
   else this.showPlay = true;
  }
 }
 if (this.showPlay) {
  this.displayNext();
  var showSpeed = (this.exhibits[this.displayIx].loaded == true) ? this.showSpeed : this.showSpeedInitial;
  if (this.exhibits.length > 1) setTimeout(this.name + '.showDisplay()',showSpeed);
  this.exhibits[this.displayIx].loaded = true;
 }
}
zGallery.prototype.showDisplay = zGallery_showDisplay
function zGallery_showFaster() {
 this.showSpeed = (this.showSpeed - 1000 < 2000) ? 2000 : this.showSpeed - 1000; // 2 sec minimum
}
zGallery.prototype.showFaster = zGallery_showFaster
function zGallery_showPause() {
 this.showPlay = false;
}
zGallery.prototype.showPause = zGallery_showPause
function zGallery_showSlower() {
 this.showSpeed = parseInt(this.showSpeed) + 1000;
 if (this.showSpeed > 20000) {this.showSpeed = 20000} // 20 second maximum
}
zGallery.prototype.showSlower = zGallery_showSlower
function zGallery_showStart() {
 this.showPlay = true;
 this.showLoops = 0;
 setTimeout(this.name + '.showDisplay()',this.showDelay);
}
zGallery.prototype.showStart = zGallery_showStart