<!--

  // ######################################################################
  // object checkBrowser  
  function checkBrowser()
  {
      this.ver=navigator.appVersion
      this.dom=document.getElementById?1:0
      this.ie5=( (this.ver.indexOf("MSIE 5")>-1 || 
                  this.ver.indexOf("MSIE 6")>-1) && this.dom)?1:0
      this.ie4=(document.all && !this.dom)?1:0
      this.ns5=(this.dom && parseInt(this.ver) >= 5)?1:0
      this.ns4=(document.layers && !this.dom)?1:0
      this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5)
      return this
  }

  // General Skripts for layer handling
  function divExists(myName)
  {
      return ( bw.dom?document.getElementById(myName):
               bw.ie4?document.all[myName+'Sub']:
               bw.ns4?eval('document.'+myName):false ) 
  }

  function addLayer(name) {
      myLayer = new layer(name)
      layers[layers.length] = myLayer
      return myLayer
      
  }
  function getLayerByName(name)
  {
      i = 0
      while (i < layers.length)
      {
          if (layers[i].name == name)
          {
              return layers[i]
          }
          i++
      }
      return false
  }
  // /object checkBrowser  
  // ######################################################################

  // ######################################################################
  // classdef
  // layer object to handle the <div>s

  function layer(name)
  {
      if (! divExists(name))
      {
          this.name=false
          return (this)
      }
      // Zugriff auf DOM oder Layer-Attribute
      this.css=bw.dom?document.getElementById(name).style:
          bw.ie4?document.all[name].style:
          bw.ns4?eval("document.layers."+name):0
      // LayerObject
      this.el=bw.dom?document.getElementById(name):
          bw.ie4?document.all[name]:
          bw.ns4?eval('document.'+name):0
      // DocumentObject - ist bei NS4 im Layer-Object verschachtelt
      this.ref=bw.dom || bw.ie4?document:bw.ns4?eval("document.layers."
              +name+".document"):0
      this.write=layerWrite
      this.x=0
      this.y=0
      this.name=name
      this.Width=bw.ns4?this.ref.width:this.el.offsetWidth
      this.Height=bw.ns4?this.ref.height:this.el.offsetHeight
      this.setX=layerSetX
      this.setY=layerSetY
      this.setHeight=layerSetHeight
      this.setWidth=layerSetWidth
      this.hide=layerHide
      this.unhide=layerUnhide
      this.vis=layerVis
      this.moveIt=layerMoveTo
      this.zoom=layerZoom
      this.unzoom=layerUnzoom
      this.setClipping = layerSetClipping
      this.toggle = layerToggle
      this.timer = null
      this.clipX2 = 0
      this.clipY2 = 0
      this.opacitiy = 1
      return(this)
  }

      function layerToggle(speed) {
          if (this.vis()) {
              this.unzoom(speed);
          } else {
              this.zoom(speed);
          }
          return true;
      }
    
      function layerSetClipping(x1,y1,x2,y2) {
          if( this.el.clip ) { 
              this.el.clip.top = y1;
              this.el.clip.bottom = y2;
              this.el.clip.left = x1;
              this.el.clip.right = y2;
              return true;
          } 
          if( this.css ) { 
              clipping = "rect(" + y1 + "px " + x2 + "px " + y2 + "px " + x1 +"px)";
              this.css.clip = clipping;
          }
          return true;
      }
    
      function layerZoom(speed)
      {
          if (this.timer) {
              window.clearTimeout(this.timer);
          }
//          this.clipX2=0;
//          this.clipY2=0;
          this.opacity=0;

          this.moveIt(mousePosX + ttOffX, mousePosY + ttOffY - this.Height)
          this.setClipping(0,0,0,0)
          this.unhide();
          dx = speed 
          dy = (this.Height / this.Width) * speed
          command = 'widenLayer("' + this.name + '",' + dx + ',' + dy + ')';
          this.timer = setTimeout(command, animationspeed);
          return true;
      }
    
      function widenLayer(name,dx,dy) {
          var myLayer = getLayerByName(name);
          var opacity = myLayer.clipX2 / myLayer.Width 
          myLayer.css.opacity = opacity
          var filter = 'alpha(opacity=' + (Math.round(opacity*100)) + ',style=0)'
          myLayer.css.filter = filter
          if (myLayer.clipX2 > myLayer.Width) {
              // myLayer.setClipping(0,0,myLayer.clipX2, myLayer.clipY2)
              myLayer.setClipping(0, 0,myLayer.Width+dx, myLayer.Height+dy)
              myLayer.timer = null
              return true;
          }
          myLayer.setClipping(0, myLayer.Height - myLayer.clipY2,myLayer.clipX2, myLayer.Height)
          // myLayer.setClipping(0,0,myLayer.clipX2, myLayer.clipY2)
          myLayer.clipX2+=dx;
          myLayer.clipY2+=dy;
          command = 'widenLayer("' + name + '",' + dx + ',' + dy + ')';
          myLayer.timer = setTimeout(command, animationspeed);
          return true;
      }
    
    
      function layerUnzoom(speed)
      {
          if (this.timer) {
              window.clearTimeout(this.timer);
          }

//          this.clipX2=this.Width;
//          this.clipY2=this.Height;
          this.unhide();
          dx = speed 
          dy = (this.Height / this.Width) * speed
          command = 'narrowLayer("' + this.name + '",' + dx + ',' + dy + ')';
          this.timer = setTimeout(command, animationspeed);
          return true;
      }
    
      function narrowLayer(name,dx,dy) {
          myLayer = getLayerByName(name);
          if (myLayer.clipX2 <= 0) {
              myLayer.clipX2 = 0;
              myLayer.clipY2 = 0;
              myLayer.hide();
              myLayer.timer = null
              return true;
          }
          var opacity = myLayer.clipX2 / myLayer.Width 
          myLayer.css.opacity = opacity
          myLayer.css.filter = 'alpha(opacity=' + Math.round(opacity*100) + ')'

          myLayer.setClipping(0, myLayer.Height - myLayer.clipY2,myLayer.clipX2, myLayer.Height)
          // myLayer.setClipping(0,0,myLayer.clipX2, myLayer.clipY2)
          myLayer.clipX2-=dx;
          myLayer.clipY2-=dy;
          command = 'narrowLayer("' + name + '",' + dx + ',' + dy + ')';
          myLayer.timer = setTimeout(command, animationspeed);
          return true;
      }
    
      // methods for class layer
      function layerSetHeight(height)
      {
          this.css.height=height + "px"
          return true
      }

      function layerSetWidth(width)
      {
          this.css.width=width + "px"
          return true
      }

      function layerHide()
      {
          this.css.visibility="hidden"
          return true
      }

      function layerUnhide()
      {
          this.css.visibility="visible"
          return true
      }
      function layerVis()
      {
          if(this.css.visibility=='hidden' || this.css.visibility=='hide' || this.css.visibility=='') 
          {
              return false
          }
          return true
      }

      function layerMoveTo(x,y)
      {
          this.setX(x)
          this.setY(y)
          return true
      }

      function layerSetY(y)
      {
          this.y=y; this.css.top=y + 'px'
          return true
      }
      function layerSetX(x)
      {
//          alert("Setting " + this.name + " to " + x)
          this.x=x; this.css.left=x + 'px'
          return true
      }
    
      function layerWrite(text)
      {
          if (bw.dom) 
          {
              this.el.firstChild.nodeValue = text
          }

          if (bw.ns4)
          {
              toEval = "document.layers." + this.name +
                       ".document.write('" + text + "')"
              eval(toEval);
              toEval = "document.layers." + this.name + ".document.close()"
              eval(toEval);
          }
          return true
      }
  // /Classdef Layer
  // ######################################################################

  // ######################################################################
  // Event Capture - captures mousemoves and sets mouse position in 
  // globals mousePosX and mousePosY
  function mouseGetPos(e) 
  {
      mousePosX=(bw.ns4||bw.ns5)?e.pageX:event.clientX;
      mousePosY=(bw.ns4||bw.ns5)?e.pageY:event.clientY;
      i = 0
      /*
      while (i < layers.length)
      {
          myLayer = layers[i]
          myLayer.moveIt(mousePosX + ttOffX, mousePosY + ttOffY)
          i++
      }
      */

/*
      if (toolTipLayer)
      {
          toolTipLayer.moveIt(mousePosX + ttOffX, mousePosY + ttOffY)
      }
      */
      return true;
  }

  function setMouseCapture()
  {
      if (bw.ns4) {
          document.captureEvents(Event.MOUSEMOVE)
      }
      document.onmousemove=mouseGetPos
  }
  // /Event Capture
  // ######################################################################

  // Globals
  var bw                     // browser capabilities object
  var initialized=false      // layers inititialized?
  var layers = new Array()   // Array of layers
  var clockLayer             // The clock layer
  var toolTipLayer           // the tooltip layer
  var mousePosX              // mouse position
  var mousePosY
  var ttOffX = 16            // offset of the tooltip
  var ttOffY = -16            // relative to mouseposition
  var capturemouse=false     // set this to 'true' inside the html source
                             // in order to let the mouse to be captured:
                             // <script language="JavaScript">
                             //     capturemouse = true
                             // </script>
 
  var animationspeed=30;
  // the bw object must exist before the page ist loaded completely
  bw = new checkBrowser()
  // ######################################################################
  // function to be called from within the body

  // Layer initialization
  function initLayers()
  {
      if (initialized) return 0
      initialized = true
      if (capturemouse == true)
      {
          setMouseCapture()
      }
      return true
  }


  function showToolTip(layerName, text)
  {
      if (! capturemouse)
      {
          return false
      }
      if (! toolTipLayer)
      {
          toolTipLayer = new layer(layerName)
      }
      toolTipLayer.write(text)
      toolTipLayer.unhide()
  }

  function hideToolTip(layerName)
  {
      if (! toolTipLayer)
      {
          toolTipLayer = new layer(layerName)
      }
      toolTipLayer.hide()
  }
  // -->

