/* —————————————————————————————————————————————————————————————————————————————— *
 *  tools.js 
 * —————————————————————————————————————————————————————————————————————————————— */

  function AddToFavorites(url,title) 
  { 
    if (window.sidebar) // Mozilla Firefox Bookmark		
    { 
      window.sidebar.addPanel(title, url,"");	
    } 
    else if(window.external)  // IE Favorite		
    { 
      window.external.AddFavorite( url, title); 
    }	
    else if(window.opera && window.print) // Opera Hotlist		
    { 
      return true; 
    } 
  }

  function checkForm() 
  {
    if ((document.kontform.name.value == ""))
    {
      alert("Bitte geben Sie Ihren Namen ein.");
      return false;
    }
    document.kontform.submit();
    return true;
  }
  
  function statusText(text)
  {
   name1=text;
   setTimeout("window.status=name1;",0.1);
   return true;
  }
  
  function mainNavCheckRightBorder(LI)
  {
    var M = LI.firstChild;
    do
    {
      if(M.nodeName == "UL") 
      {
        if (LI.className.indexOf("selected") == -1)
          LI.firstChild.style.borderRightWidth = "0px";
      }
      M = M.nextSibling;
    }
    while(M);     
  }
  
  function mainNavHideRightBorder(LI)
  {
    LI.firstChild.style.borderRightWidth = "1px";
  }
        
  function hoverIE() 
  {
//    if (navigator.userAgent.indexOf("MSIE 6") != -1)
//    {      
//      if(window.navigator.systemLanguage && !window.navigator.language) 
//      {
        var LI = document.getElementById("mainNav").firstChild;
        do 
        {
          if (sucheUL(LI.firstChild)) 
          {
            if(LI.className.indexOf('selected') == -1){
              LI.onmouseover=einblenden; LI.onmouseout=ausblenden;
            }
          }
          LI = LI.nextSibling;
        }
        while(LI);
//      }
//    }
  }

  function sucheUL(UL)
  {      
    do 
    {
      if(UL) UL = UL.nextSibling;
      if(UL && UL.nodeName == "UL") return UL;
    }
    while(UL);
    return false;
  }

  function einblenden()
  {
    
    var UL = sucheUL(this.firstChild);
    UL.style.visibility = "visible";
    
    //---------------------------------------
    var windowHeight = getWindowWize();
    var topUL = getTop(UL);
    if(topUL+UL.offsetHeight > windowHeight) {
      UL.style.top = -1*(UL.offsetHeight-(windowHeight-topUL)) + 'px';
    }
    //---------------------------------------
    
    if (this.className.indexOf("selected") == -1)
    {
      this.firstChild.style.borderRightWidth = "0px";
    }
    
    // iframe
    var hoehe = UL.offsetHeight;
    if(hoehe < 0)
      hoehe = 0
    
    if(this.childNodes[2] != null && this.childNodes[2].nodeName == "IFRAME")
    {
      this.childNodes[2].style.display = "block";
      this.childNodes[2].style.height = hoehe + "px";
    }
  }

  function ausblenden() 
  {
    sucheUL(this.firstChild).style.visibility = "hidden";
    
    //---------------------------------------
    if (this.className.indexOf("selected") == -1){
    sucheUL(this.firstChild).style.top = '0px'; }
    //---------------------------------------

      this.firstChild.style.borderRightWidth = "1px";
    
    //iframe
    if(this.childNodes[2] != null && this.childNodes[2].nodeName == "IFRAME")
      this.childNodes[2].style.display = "none";
  }

  //-----------------------------------------------------------------------------
  // Funktionen zum Positionieren des Layers, wenn dieser so groß ist, dass
  // er nicht mehr komplett angezeigt wird.
  //-----------------------------------------------------------------------------
  
  // Abstand zwischen dem Layer und dem oberen Rand des Anzeigebereichs ermitteln
  function getTop(Element){
    var Parent = Element;
    var layerTop = 0;
    while (Parent) {
      layerTop = layerTop + Parent.offsetTop;
      Parent = Parent.offsetParent;
    }
    var scrollY = 0;
   if (typeof( window.innerHeight ) == 'number') { //Non-IE
    scrollY = window.pageYOffset;
   }
   else if (document.documentElement && (document.documentElement.clientHeight)) { //IE 6+ in 'standards compliant mode'
    scrollY = document.documentElement.scrollTop;
   }
   else if (document.body && (document.body.clientHeight)) { //IE 4 compatible
    scrollY = document.body.scrollTop;
   }
    return layerTop-scrollY;
  }
  
  // Höhe des Anzeigebereichs ermitteln
  function getWindowWize() {
   var myHeight = 0;
   if (typeof( window.innerHeight ) == 'number') { //Non-IE
    myHeight = window.innerHeight;
   }
   else if (document.documentElement && (document.documentElement.clientHeight)) { //IE 6+ in 'standards compliant mode'
    myHeight = document.documentElement.clientHeight;
   }
   else if (document.body && (document.body.clientHeight)) { //IE 4 compatible
    myHeight = document.body.clientHeight;
   }
   return myHeight;
  }
  
/* ------------------------------------------------------------------------------ *
 * (C) multi-INTER-media GmbH
 *     Letzte Aenderung : 27.08.2009
 * ------------------------------------------------------------------------------ */
