// Initialisierung //
// Variable m&uuml;ssen hier def. sein, da global verwendet!!
// 100-300 Pixel ist angenehm (Anz.d.Zeilen richtet sich nach Textl&auml;nge)
 var width = "250";
// Farbe Rahmen und Hintergrund bei &Uuml;berschrift (dunkel)
 var backcolor = "#000080";
// Farbe Text-&Uuml;berschrift (wei&szlig;)
 var capcolor = "#FFFFFF";
// Rahmendicke 1-5 Pixel sind annehmbar
 var border = "1";
// Textbereich Hintergrund
 var fcolor = "#CCCCFF";
// Textfarbe
 var textcolor = "#000000";
// Abstand popup Fenster neben der Maus; 3 - 12 sind annehmbar
 var offsetx = 3;
// Abstand popup Fenster unterhalb der Maus; 3 - 10 Pixel sind annehmbar
 var offsety = 5;
// Ende der Initialisierung
// welcher Browser
// IE
ie = ((document.all) && (window.offscreenBuffering)) ? true : false;
// Netscape
ns = ((document.captureEvents) && (!document.getElementById)) ? true : false;
// Mozilla
mz = ((document.getElementById) && (!document.all) && (document.documentElement)) ? true : false;
// Opera
op = ((document.getElementById) && (navigator.userAgent.indexOf('Opera') != -1)) ?
true : false
var x = 0;
var y = 0;
var sx = 0;
var sy = 0;
var sichtbar = false;
var dir = 1;
var objekt = "";
// alert ("ns= " + ns + "\n" + "ie= " + ie + "\n"  + "mz= " + mz)

function init()
{
  if ((mz)  || (op)) { objekt = document.getElementById("layer2");
     document.addEventListener("mousemove", mouseMove, true);
  }
  if ( (ns) || (ie) )
  {
    if (ns)  objekt = document.layer2;
    if (ie)  objekt = layer2.style
    document.onmousemove = mouseMove
    if (ns)  document.captureEvents(Event.MOUSEMOVE)
  }
}

// l&ouml;schen popup Hilfefenster
function funk2() {
  if ( (ns) || (ie) || (mz)  || (op))
  {
  sichtbar = false;
     bewege(objekt,1,1)
     verstecke(objekt);
     window.status = "";
  }
}

// Layer f&uuml;llen und anzeigen
function funk1(breit, titel, text) {
width=breit;
  txt = "<TABLE WIDTH='"+width+"' BORDER=0 CELLPADDING=0 CELLSPACING='"+border+"' BGCOLOR='"+backcolor+"'><TR><TD><TABLE WIDTH='100%' BORDER='"+border+"' CELLPADDING=2 CELLSPACING=0><TR><TD><SPAN ID=\"xyz\"><B><FONT FACE=\"Tahoma, Arial, Helvetica, sans-serif\"><FONT SIZE=\"-1\"><FONT COLOR=\""+capcolor+"\">"+titel+"</FONT></FONT></B></SPAN></TD></TR></TABLE><TABLE WIDTH=100% BORDER=0 CELLPADDING=1 CELLSPACING="+border+" BGCOLOR=\""+fcolor+"\"><TR><TD><SPAN ID=\"PST\"><FONT FACE=\"Tahoma, Arial, Helvetica, sans-serif\"><FONT SIZE=\"-1\"><FONT COLOR=\""+textcolor+"\">"+text+"</FONT></FONT></FONT></FONT><SPAN></TD></TR></TABLE></TD></TR></TABLE>"
  ausgabe(txt);
// popup Fenster rechts=1, links=0

  window.status = location.href + " --- " + titel + " ---";
  dir = 0;
  if (x-20 < width) { dir = 1; };
  if ( (ns) || (ie) || (mz) || (op)) {
     if (dir == 1) { // Right
        bewege(objekt,x+offsetx,y+offsety);
     }
     if (dir == 0) { // Left
        bewege(objekt,x-offsetx-width,y+offsety);
     }
     if (sichtbar == false) {
        zeige(objekt);
        sichtbar = true;
     }
  }
}

// nach Layer schreiben
function ausgabe(txt) {
  if (ns) {
     var lyr = document.layer2.document
     lyr.write(txt)
     lyr.close()
  }
  if (ie) document.all["layer2"].innerHTML = txt
  if ((mz) || (op)) { objekt.innerHTML = txt; }
}

// Layer positionieren
function mouseMove(e) {
   if ((mz) || (op))
   {  x = e.clientX; y = e.clientY + window.pageYOffset;
  zy = window.innerHeight + window.pageYOffset; /* Seitenende */
  zzy = document.getElementById("layer2").offsetHeight; /* Elementh&ouml;he */
  zz = window.pageYOffset; /* = scroll H&ouml;he */
      if (y+zzy+offsety > zy) y-=(zzy + offsety);
   }
   if (ns) { x=e.pageX; y=e.pageY;
      zy = window.pageYOffset + window.innerHeight /* koo bis BS-Ende */
      zzy=document.layers["layer2"].clip.height;
      if (y+zzy-5 > zy) y-=(zzy + offsety);
   }
   if (ie) { sx = document.body.scrollLeft; sy = document.body.scrollTop;
      x=event.clientX; y=event.clientY;
      zy= document.body.clientHeight;  /* H&ouml;he des Bilschirminhaltes */
      zzy=document.all.layer2.clientHeight /* H&ouml;he des Layers      */
      if (y+zzy-5 > zy) y-=(zzy + offsety);
      x = x + sx; y = y + sy;
   }
    if (sichtbar) {
     if (dir == 1) { // rechts der Maus
        bewege(objekt,x+offsetx,y+offsety);
     }
     if (dir == 0) { // links der Maus
        bewege(objekt,x-offsetx-width,y+offsety);
     }
   }
}

// Objekt layer1 sichtbar machen
function zeige(obj) {
  if ((mz) || (op)) { obj.style.visibility = 'visible'; }
  if (ns) obj.visibility = "show"
  if (ie) obj.visibility = "visible"
}

// Objekt layer1 verstecken -- ok
function verstecke(obj) {
   if ((mz) || (op)) {
     obj.innerHTML = "";
//     obj.style.visibility = 'hidden';
   }
   if (ns) obj.visibility = "hide"
   if (ie) { obj.innerHTML = ""; obj.visibility = "hidden" }
}

// Objekt layer1 bewegen
function bewege(obj,x2,y2) {
  if (x2 < 1) { x2 = 0 };
  if ((ie) || (ns))  {
//     if (y2 > 400) { y2 = y2-140 };
        obj.left = x2;
        obj.top = y2; }
  if ((mz) || (op)) {
     obj.style.left = x2 + 'px';
     obj.style.top = y2 + 'px';
  }
}
