var nav,fix=false,wait4init=true;
var DHTML = 0, DOM = 0, MS = 0, NS = 0, OP = 0;
if(window.opera) { OP = 1; }
if(document.getElementById) {
   DHTML = 1;
   DOM = 1; }
if(document.all && !OP) {
   DHTML = 1;
   MS = 1; }
if(document.layers && !OP) {
   DHTML = 1;
   NS = 1; }

function findScrollTop() {
 if (window.pageYOffset != null)
  return window.pageYOffset;
 if (document.body.scrollWidth != null)
  return document.body.scrollTop;
 return (null);
}

function PageHeight() {
 if (window.innerHeight != null)
  return window.innerHeight;
 if (document.body.clientHeight != null)
  return document.body.clientHeight;
 return (null);
}

function senseArea(ev)
{
 llim=0;
 rlim=44;
 x=0;
 y=0;

 if(DOM && !MS && !OP)  {
   y=ev.clientY;
   x=ev.clientX;  }
 else  {
   y=window.event.clientY;
   x=window.event.clientX;   }

 if(wait4init==false){
  if(x>=llim && x<=rlim)
   main.show(y);
  else
   if(main.checkLim(x,y)) main.hide();
 }
}

function init(){
 if(DOM && !MS && !OP) // NS6+
  document.addEventListener("mousemove", senseArea, true);
 else  // IE55+, OP7
  window.onMouseMove=senseArea;

 // menü-struktur
 main=new menu("main_menu",null,-45);
  lev0000=new menu("lev0000_menu",main,-5);
  lev0001=new menu("lev0001_menu",main,-5);

 wait4init=false;

 window.setTimeout("cent(400)",100);
 fix=false;
}

// objekte
function menu(name,prev,yOff){
 var width,height,off,y,next;
 this.yOff=yOff;
 this.next=null;
 this.name=name;
 this.y=y;
 this.prev=prev;
 this.visible=false;

  off=43;

  this.width=document.getElementById(name).offsetWidth
  this.height=document.getElementById(name).offsetHeight;

 if(prev==null)
  this.xOff=off;
 else
  this.xOff=this.prev.xOff+this.prev.width-5;

 // member-funktionen
 this.show=show;
 this.hide=hide;
 this.checkLim=checkLim;
}

function show(my){
 if(this.visible==false){
  if(this.prev!=null){
   if(this.prev.next) this.prev.next.hide();
   this.prev.next=this;
   ty=this.prev.y+this.yOff;
   if(ty<0) ty=0;
   this.y=ty;  }
  else{
   ty=my+this.yOff;
   if(ty<0) ty=0;
   this.y=ty; }

  this.next=null;

  document.getElementById(this.name).style.visibility = "visible";
  document.getElementById(this.name).style.left=this.xOff;
  document.getElementById(this.name).style.top=this.y+findScrollTop();
  this.visible=true;
 }
}

function hide(){
 if(this.next)
  this.next.hide();
  document.getElementById(this.name).style.visibility = "hidden";
 this.visible=false;
}

function checkLim(x,y){
 if(this.next)
  ret=this.next.checkLim(x,y);
 else
  ret=true;

 if(ret==true) // out of limits
  if(x>=this.xOff && x<=this.xOff+this.width && y>=this.y && y<=this.y+this.height)
   ret=false;
  else
   ret=true;

 return(ret);
}

function cent(hoe){
 var width,height,lp,tp,ret;

 height = PageHeight();
 document.getElementById("movelogo").style.top=(height-hoe)/2+findScrollTop();
 document.getElementById("movelogo").style.visibility = "visible";
 window.setTimeout("cent(400)",100);
}
