
// Einbindung in ein HTML-Dokument: <script langauge="JavaScript" type="text/javascript" src="images/rollover.js"></script>
// Aufruf: <a href="javaScript: nichts();" onMouseover='showComment("Text")' onMouseout ='hideComment()'>
// Aufruf im <img>-Tag: <img src="Bild.JPG" width="600" onMouseover="showComment('Text')" onMouseout ="hideComment()">

var aktiv = false;
if (document)
{
  document.write('<div id="comment" style="position: absolute; width:200px; visibility:hidden; background-color: #FFFFFF; border: 2px solid #EAF9DC; font:normal 12px Verdana; padding:3pt;">&nbsp;</div>');
  document.onmousemove = MousemoveHandler;
}

// Bestimme die Position des Mauszeigers
function MousemoveHandler(e){
  if (document.all) // Microsoft Internet Explorer
  {
    xPosMaus = document.body.scrollLeft + event.clientX - 100;
    yPosMaus = document.body.scrollTop  + event.clientY + 20;
  }
  else if (document) // Mozilla
  {
    xPosMaus = document.body.scrollLeft + e.clientX - 100;
    yPosMaus = document.body.scrollTop  + e.clientY + 20;
  }
  if (aktiv == true) moveComment();
}

// Verschieben der Texte falls sie bereits sichtbar ist
function moveComment() {
  if (document)
  {
    document.getElementById("comment").style.left = xPosMaus;
    document.getElementById("comment").style.top  = yPosMaus;
  }
}

// Einblenden der Texte
function showComment(aktuellerText) {
  if (document)
  {
    document.getElementById("comment").style.visibility = "visible";
    document.getElementById("comment").firstChild.nodeValue = aktuellerText;
  }
  aktiv = true;
}

// Ausblenden der Texte
function hideComment() {
  if (document)
  {
    document.getElementById("comment").style.visibility = "hidden";
    aktiv = false;
    xPosMaus = -500;
    yPosMaus = -500;
    moveComment();
  }
}