// Kontextscript erstellt das Infofenster (Info I, blau)
// Dies ist das Werk des Mehnert. Ich hoffe er hat es ausreichend kommentiert.

text=new Array();
title=new Array();

title[1]="Hier steht der Titel";
text[1]="Jede menge Text<b>------</b>. " +
"&nbsp;&nbsp;<br>" +
"<b>WICHTIG:</b>&nbsp;&nbsp;";

title[2]="";
text[2]="";

var x = 0;
var xx=10;
var yy=0;
var y = 0;
var showit = 0;
var TipWndWidth = 300; // muss an die Fenstergr&ouml;sse angepasst werden
var yAbstand=5;        // Abstand vom Cursor
////////////////////////////Herausfinden des benutzten Browser des Kunden///////////////////////////////////
ns = (document.layers)? true:false
ie4 = (document.all)? true:false
ie5 = false;
ff = false;
if (navigator.userAgent.indexOf('Firefox')>0) {ff = true;}


if (ie4)
{
  if (navigator.userAgent.indexOf('MSIE 5')>0) {ie5 = true;}
}
// Welche Plattform? bei IE auf MAC keine popi-Fenster
if ( navigator.platform.substring(0,3).toUpperCase() == "MAC" && (ie4 || ie5) )
   mac = true;
else
   mac = false;
if ( (ns) || (ie4) || (ff) )
{
    if (ns)
        over = document.TipWnd;
    if (ie4 || ff)
        over = TipWnd.style;

    document.onmousemove = mouseMove;
    if (ns)
        document.captureEvents(Event.MOUSEMOVE);
}

function wtl(txt)
{
    if (ns)
    {
        var lll = document.TipWnd.document;
        lll.write(txt);
        lll.close();
    }
    else
    {
        if (ie4 || ff)
        {
            document.getElementById('TipWnd').innerHTML = txt;
        }
    }
}
function show(obj)
{
    if (ns)
        obj.visibility = "show";
    else if (ie4 || ff)
        obj.visibility = "visible";
}
function hide(obj)
{
    if (ns)
        obj.visibility = "hide";
    else if (ie4 || ff)
        obj.visibility = "hidden";
}
function moveTo(obj,lx,ly)
{
    obj.left = Math.max(lx,0);
    obj.top = Math.max(ly,0);
}
function popuphidden()
{
    if (mac)
        return;
    if ( (ns) || (ie4) || (ff))
    {
        showit = 0;
        hide(over);
    }
}
///////////////////////////////// zusammenstellen des Popup Fensters////////////////////////////////

function rpopi(text, title)
{
    txt = "<TABLE width='"+TipWndWidth+"' "+"class=popup id=MainTable>";
    txt+= "<TR>";
    txt+= "<TD>";
    txt+= "<TABLE class=popuptitel width=100% >";
    txt+= "<TR>";
    txt+= "<TD>";
    txt+= "<SPAN ID=\"thetext\">";
    txt+= "<B><FONT face=\"Arial\" size=-1>"+title+"</FONT></B>";
    txt+= "</SPAN>";
    txt+= "</TD>";
    txt+= "</TR>";
    txt+= "</TABLE>";
    txt+= "<TABLE class=popuptext>";
    txt+= "<TR>";
    txt+= "<TD>";
    txt+= "<SPAN ID=\"thetext2\">";
    txt+= "<FONT face=\"Arial, Helvetica\" size=-1 class=\"lt\">";
    txt+= text;
    txt+= "</FONT>";
    txt+= "<SPAN>";
    txt+= "</TD>";
    txt+= "</TR>";
    txt+= "</TABLE>";
    txt+= "</TD>";
    txt+= "</TR>";
    txt+= "</TABLE>";
    wtl(txt);
    display_it();
}
function popup(i)
{
    if (mac)
        return;
    //var ar=TipWndTxt[i].split("|");
    var ar=i.split("|");
    xx=ar[0];
    yy=Math.max(ar[1],-2000);
    TipWndWidth=ar[2];
    rpopi(ar[4],ar[3]);
}
///////////////////////////// anzeigen des Popup- Fensters//////////////////////////////////////////////////////
function display_it()
{
    if ( (ns) || (ie4) || ff )
    {
        if (showit == 0)
        {
            SetKoord();
            show(over);
            showit = 1;
        }
    }
}
////////////////////////////// Auf mousemoves reagieren////////////////////////////////////////////////////////
function mouseMove(e)
{
        if(ff || ns)
        {
       x=e.pageX;
       y=e.pageY;
        }

        if (ie4)
        {
        x=event.x;
        y=event.y;
    }
    if (ie5)
    {
        x=event.x+document.body.scrollLeft;
        y=event.y;
    }
    if (showit)
    {
        SetKoord();
    }
}
function SetKoord()
{

        // netscape
        if(window.pageYOffset && (ff==false))
        {
            moveTo(over,x-xx-TipWndWidth,y+yy+window.pageYOffset+yAbstand);   //links
            //moveTo(over,x+xx,y+yy+window.pageYOffset+yAbstand);             //rechts
        }
        if(window.pageYOffset && ff)
        {
            moveTo(over,x-xx-TipWndWidth,y+yy+yAbstand);   //links
            //moveTo(over,x+xx,y+yy+window.pageYOffset+yAbstand);             //rechts
        }

        else
        {
            moveTo(over,x-xx-TipWndWidth,y+yy+document.body.scrollTop+yAbstand);   //links
            //moveTo(over,x+xx,y+yy+document.body.scrollTop+yAbstand);             //rechts
        }
}
