// Script    : Crossbrowser-Einrichten von DIV-Zeigern, Ermittlung von Dokumenthöhe und -breite.
// Version   : 2.2
// Autor     : (c) eleNet 2002 (http://www.elenet.de)
// Kommentar : Opera wird so lange nicht unterstützt, wie er
//             weder Clipping noch Div-write noch Div-Tag-Offsetwerte kennt.


var form;

// einfacher Brausercheck
var ie4=!!document.all;                    // Internet Explorer 4.x, 5.x, 6.x
var ns4=!!document.layers;                 // Netscape 4.x
var ns6=!!document.getElementById && !ie4; // Netscape 6.x, Mozilla

function init()
{
  ie4=!!document.all;                    // Internet Explorer 4.x, 5.x, 6.x
  ns4=!!document.layers;                 // Netscape 4.x
  ns6=!!document.getElementById && !ie4; // Netscape 6.x, Mozilla
  if(ie4)
  {
    docWidth  = document.body.offsetWidth;
    docHeight = document.body.offsetHeight; 
  }
  if(ns4)
  {
    docWidth  = window.innerWidth;
    docHeight = window.innerHeight;
  }
  if(ns6)
  {
    docWidth  = self.innerWidth;
    docHeight = self.innerHeight;
  }
}
window.onload = init;
 
 // Verhinderung des Rähmchens bei mouseclick (derzeit bei ie4+,ie5+ und ns6+)
function blurIt(verweis)
{
  if(ie4||ns6){verweis.blur();}
}

// initialisierung von Objekten
var pa      = {};
var pal     = {}
var ptop    = {};
var pleft   = {};
var pheight = {};
var pwidth  = {};

// Mache die Divs fuer alle Brauser unter gleichem Namen ansprechbar.
function basix(lay)
{
  ie4=!!document.all;                    // Internet Explorer 4.x, 5.x, 6.x
  ns4=!!document.layers;                 // Netscape 4.x
  ns6=!!document.getElementById && !ie4; // Netscape 6.x, Mozilla
  if(ns4)
  {
    var doc      = document;
    getLayers(doc,lay);
    pal[lay]     = pa[lay];
    ptop[lay]    = pa[lay].top;
    pleft[lay]   = pa[lay].left;
    pheight[lay] = pa[lay].document.height;
    pwidth[lay]  = pa[lay].document.width;
  }
  else
  {
    if(ie4)
    {
      pa[lay]      = document.all[lay].style;
      pal[lay]     = document.all[lay];
      ptop[lay]    = document.all[lay].offsetTop;
      pleft[lay]   = document.all[lay].offsetLeft;
      pheight[lay] = document.all[lay].offsetHeight;
      pwidth[lay]  = document.all[lay].offsetWidth;
    }
    else
    {
      if (ns6)
      {
        pa[lay]      = document.getElementById(lay).style;
        pal[lay]     = document.getElementById(lay);
        ptop[lay]    = document.getElementById(lay).offsetTop;
        pleft[lay]   = document.getElementById(lay).offsetLeft;
        pheight[lay] = document.getElementById(lay).offsetHeight;
        pwidth[lay]  = document.getElementById(lay).offsetWidth;
      }
    }
  }
}

// Rekursive Suche nach Div-Tags für NS4
// (Falls der anzusprechende Div-Tag in anderen Div-Tags verschachtelt ist).
// Variation eines Scripts von Michael Wallner (http://www.wallner-software.com)
function getLayers(doc,lay)
{
  pa      = {};
  pal     = {};
  ptop    = {};
  pleft   = {};
  pheight = {};
  pwidth  = {};
  var c = 0;
  while (c < doc.layers.length)
  {
    if (doc.layers[c].name==lay)
	  {
	    pa[lay] = doc.layers[c];
	    break;
    }
	  getLayers(doc.layers[c].document,lay);
	  c++;
  }
}
