// funktioniert in Explorer 5.5 (im <a> und <img> Tag), Netscape 4.7 (nur im <a>-Tag, nicht im <img>-Tag)
// funktioniert nicht in Netscape 6.1, Opera
// Einbindung in ein HTML-Dokument: <script langauge="JavaScript" type="text/javascript" src="./Textfahne.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.all)    document.write('<div id="comment" style="position: absolute; width:250px; visibility:hidden; background-color: #ffffff; border: 1px solid #0000ff; font:normal 10px verdana; color:#808080; padding:3pt;"></div>');
if (document.layers) document.write('<layer id="NNcomment"></layer>');
if (document.layers) document.captureEvents(Event.MOUSEMOVE);
document.onmousemove = MousemoveHandler;

// Bestimme die Position des Mauszeigers
function MousemoveHandler(e){
  if (document.all) {
    xPosMaus = document.body.scrollLeft + event.clientX - 100;
    yPosMaus = document.body.scrollTop  + event.clientY + 20;
  }
  else {
    xPosMaus = e.pageX + 10;
    yPosMaus = e.pageY + 10;
  }
  if (aktiv == true) moveComment();
}

// Verschieben der Textfahne falls sie bereits sichtbar ist
function moveComment() {
  if (document.all) {
    document.all.comment.style.posLeft = xPosMaus;
    document.all.comment.style.posTop  = yPosMaus;
  }
  if (document.layers) {
    document.NNcomment.left = xPosMaus;
    document.NNcomment.top  = yPosMaus;
  }
}

// Einblenden der Textfahne mit übergebenem Text
function showComment(aktuellerText) {
  if (document.all) {
    document.all.comment.style.visibility = "visible";
    document.all.comment.innerText = aktuellerText;
  }
  if (document.layers) {
    document.NNcomment.visibility = "visible";
    document.NNcomment.document.open();
    document.NNcomment.document.write("<table style='background-color: #dddddd; padding:3pt;'><tr><td width=350px><p style='font: normal 10px verdana, arial;'>" + aktuellerText + "</td></tr></table>");
    document.NNcomment.document.close();
  }
  aktiv = true;
}

// Ausblenden der Textfahne
function hideComment() {
  if (document.all)    document.all.comment.style.visibility = "hidden";
  if (document.layers) document.NNcomment.visibility = "hidden";
  aktiv = false;
  xPosMaus = -500;
  yPosMaus = -500;
  moveComment();
}

// wird aufgerufen, falls Textfahne im <a>-Tag steht
function nichts() {}