var kLoadProgressStr = "";

if (kLoadProgressStr == "") {
  var s = new String(top.location);
  if (s.indexOf("_en") == -1) {
    kLoadProgressStr = "Produktdaten werden geladen";
  }
  else {
    kLoadProgressStr = "Loading product data";
  }
}



var allMenus = new Array();
var lastclicked=null;
var STEP=1000;
var defaulttarget="content";

/****************************************************** 
 * This library is extended and modified version of 
 * vmaxdhtmllib6.js (optimized for best performance
 * in particular task of sliding menu )
 ******************************************************
 * DHTML library by Virtual_Max ( http://come.to/vmax )
 * Copyright, 2000 
 * This library and it's derivatives is free for use 
 * until this notice remains unchanged and present in 
 * all copies and derivatives.
 * revision: 21/11/2000
 ******************************************************/

function getById(id,o){
    if(document.getElementById) return document.getElementById(id);
    if(document.all)            return document.all[id]
    if(o==null) o=window.document;

    if(o.layers[id]){
      return o.layers[id]
    }

    if(o.images[id]){
      return o.images[id]
    }

    for(var i=0; i<o.layers.length; i++){
       var oo=getById(id,o.layers[i].document); 
       if(oo!=null) return oo;
    }
    return null;
}

function Dimension(x,y,w,h) {
  this.w=w; this.h=h; this.x=x; this.y=y;
}

function getDivSizes(o){
 if(o==null) return null;
 var x,y,w,h;
 if(document.layers) {
     x=o.left;
     y=o.top;
     if(o.height==null) o.height=o.clip.height;
     if(o.width==null)  o.width=o.clip.width;
     h=o.height;
     w=o.width;
  }
  else if(document.all){
     x=o.offsetLeft;
     y=o.offsetTop;
     w=o.scrollWidth;
     h=o.scrollHeight;
 }
 else{
     x=o.offsetLeft;
     y=o.offsetTop;
     w=o.offsetWidth;
     h=o.offsetHeight;
 }
 return new Dimension(x,y,w,h);
}


function getViewPort(){
  var x=0,y=0,w=640,h=480;
  if(document.all) {
     var o=window.document.body;
     x=o.scrollLeft;
     w=o.offsetWidth;
     y=o.scrollTop;
     h=o.offsetHeight;
  } 
  else {
     x=window.pageXOffset;
     w=window.innerWidth;
     y=window.pageYOffset;
     h=window.innerHeight;
  }

  return new Dimension(x,y,w,h);
}

function getPageSize(){
  var w=640,h=480;
  if(document.all) {
     var o=window.document.body;
     w=o.scrollWidth;
     h=o.scrollHeight;
  } 
  else {
     w=document.width;
     h=document.height;
  }
  return new Dimension(0,0,w,h);
}


function showDiv(o,vis) {
  if( o==null ) return;
  if(!document.layers) o=o.style;
    o.visibility = vis ? "visible" : "hidden";
}

function moveDiv(o,x,y){
  if( o==null ) return;
  if(document.layers){
     o.moveTo(x,y);     
  }
  else {
    o=o.style;
    if(document.all) {
       o.pixelLeft=x;
       o.pixelTop=y;
    }
    else {
       o.left=x+'px';
       o.top=y+'px';     
    }
  }
}



/*----- zIndex functions -------*/

function setZindex(o, index){
  if( o==null ) return;
  if(!document.layers)    o=o.style;
  o.zIndex=index;
}

function getZindex(o){
  if( o==null ) return 0;
  if(!document.layers) o=o.style;
  return parseInt(o.zIndex);
}

	
//==============================================

function changeContent(o,content){
 if(o==null) return;
 if(document.layers){
    o.document.writeln(content);
    o.document.close();
 }
 else o.innerHTML = content
}




/***************************************************/

var load_cnt=0;

function vmaxMenu(id, pappyid) {
  
  this.className = null;
  this.opened    = 0;
  this.pappy     = (pappyid==null)?null:allMenus["VML"+pappyid];
  this.depth     = (this.pappy==null)? -1: (this.pappy.depth+1) 

  this.divName  = "VML"+id
  this.n=id;
  this.y=0;
  this.x=0;
  this.h=0;
  this.expand=false;
  this.collapse=false;
  this.shown=false; 
  this.lastx=-1;
  this.lasty=-1;
  this.obj=null;
  this.sub=new Array();
  if(this.pappy!=null) this.pappy.sub[this.pappy.sub.length]=this;


  showCnt(load_cnt);
}


function showCnt(cnt) {
  if(!document.layers){
   loadingdiv=getById("LOADING");
   if(loadingdiv==null) {
      return;
   }
 
     load_cnt++;
     s=kLoadProgressStr + "<br/>"+cnt;
     changeContent(loadingdiv,s);
   }
}


function createMenu(m){
    m.y=0;
    m.x=0;
    m.h=0;
    m.expand=false;
    m.collapse=false;
    m.shown=false; 
    m.lastx=-1;
    m.lasty=-1;
    m.obj=null; 
   
   if(m.pappy!=null)  {
      m.depth=m.pappy.depth+1;
   }
   else {
      m.opened=1000;
   }
   for(var i=0; i<m.sub.length; i++){    
     createMenu(m.sub[i]);
   }   
}


function collapseAll(m){
    m.expand=false;
    m.collapse=true;   
    for(var i=0; i<m.sub.length; i++){    
     collapseAll(m.sub[i]);       
   }   

  
}


function clickM(n,link){
   var m=allMenus["VML"+n];
   if(m==null) return;

   var oldn=-1;
   if(lastclicked!=null)  {
     oldn = lastclicked.n;     
   }

   lastclicked=m;
   collapseAll(mymenu);
  
   var p=m;
   while(p!=null){
     p.expand=true;
     p.collapse=false;   
     p=p.pappy;
   }

   startMove();   
   return ((link.href+'')!='javascript:void(0)');
}

var expanding=false, collapsing=false;

var tmpl=null
function startMove(){
   expanding=false;
   collapsing=false;

   for(var nn in allMenus){
      var m = allMenus[nn];
      if(m.collapse) { 
         m.opened-=STEP;
         if(m.opened<0){
            m.opened=0;
            m.collapse=false;
         }
         else {
          collapsing=true;
         }
      }
      else if(m.expand) {
         m.opened+=STEP;
      }
  
   }
   var y = placeMenu(mymenu,mymenu.x,mymenu.y)
   if(expanding||collapsing) {
     setTimeout("startMove()",10);
     return;
   }
   if(document.layers) {
     document.height=y+30;
   }
}




function placeMenu(m,x,y){

   if (m.obj==null) m.obj=getById(m.divName);
   var pappy=m.pappy;

   m.x=x;
   m.y=y;

   if(pappy!=null) {
     if(y>=pappy.y+pappy.opened+pappy.h){
      if(m.shown){
        showDiv(m.obj,false)
        m.shown=false; 
      }
     }
     else{
       if(!m.shown) {
          showDiv(m.obj,true)
          m.shown=true;
       }    
     }        
     if(m.h==0) {
       var d=getDivSizes(m.obj)
       m.h = d.h;
     }
     if(m.shown) {    
         if(document.all){
           if(m.lastx!=x) m.obj.style.pixelLeft=x;
           if(m.lasty!=y) m.obj.style.pixelTop=y;
         }
         else if(m.lasty!=y || m.lastx!=x) moveDiv(m.obj,x,y);
         m.lastx=x;
         m.lasty=y;
     }
     y+=m.h;  
   }
     
   for(var i=0;i<m.sub.length;i++){     
     y=placeMenu(m.sub[i],x,y);     
   }
   if(pappy!=null) {
     if(y > m.y+m.h+m.opened) {
       if(m.expand) expanding=true;
       return m.y+m.h+m.opened
     }
     else{
       if(m.expand) {
         m.opened = y-m.y-m.h;
         m.expand=expanding;
       }
     }
   }
   
   return y;


}

 function myunescape(s){
   var inx=0;
   while((inx=s.indexOf("+",inx))>=0){
      s=s.substring(0,inx)+" "+s.substring(inx+1);
   }
   return unescape(s);
 }


//===================================

