var IsShowing = 0;
var Current = 0;
var Previous = 0;
var zWin;
var helpWin;
var jsCookie = 0;

function Initialize()
{
	document.getElementsByTagName("body")[0].setAttribute("onhelp",helpWindow);
        window.focus();
}

function SelectItem(Item)
{
}

function Event_OnMouseMove()
{
/* Die folgenden Befehle wurden verlagert nach Event_OnMouseOver und sollten,
   wenn alles läuft, entfernt werden!
        if (document.all.IdToolTipBox && IsShowing)
        {
                if ((window.event.x + 220) >= document.all.azSeite.offsetWidth)
                {
                    document.all.IdToolTipBox.style.left =
                        document.all.azSeite.offsetWidth - 220;
                }
                else {
                    document.all.IdToolTipBox.style.left = window.event.x;
                }
                document.all.IdToolTipBox.style.top = window.event.y + 50;
        }
*/
}

function Show(text)
{
        if (!IsShowing)
        {

                document.all.IdToolTipBox.innerHTML = text;
                document.all.IdToolTipBox.style.display = "inline";
                status = text;
                IsShowing = 1;
        }
        return true;
}

function Hide()
{
        if (IsShowing)
        {
                document.all.IdToolTipBox.style.display = "none";
                status = "";
                IsShowing = 0;
        }
        return true;
}

function Event_OnMouseOver()
{
    var xxoffs; 
    /* Änderung für citrix(22.01.2001, vgt): 
	Die Positionierung der Tooltips ist fehlerhaft, so dass je nach
	Schriftgrad die Tooltipbox u. U. auf dem entspr. Link gelegt
	wird, was dazu führt, dass dieser Link nicht mehr aufgerufen werden 
	kann. Daher werden die Tooltip-Anzeigen erst einmal abgeschaltet. */
    if (document.all) {
      if (navigator.appVersion.substr(17,6) != "MSIE 5") {
        if ((document.all.IdToolTipBox) && (window.event.srcElement) &&
		(window.event.srcElement.id == "Hinweis"))
        {
                if ((window.event.x + 220) >= document.all.azSeite.offsetWidth)
                {
                    document.all.IdToolTipBox.style.left =
                        document.all.azSeite.offsetWidth - 220;
                }
                else {
                    document.all.IdToolTipBox.style.left = window.event.x;
                }
                document.all.IdToolTipBox.style.top = window.event.y + 20;

                Show("Details zu " + window.event.srcElement.innerHTML + " anzeigen");
        }
      }
    }
}

function Event_OnMouseOut()
{
    if (document.all) {
        if ((document.all.IdToolTipBox) && (window.event.srcElement) &&
			(window.event.srcElement.id == "Hinweis"))
        {
                Hide();
        }
    }
}

function Event_OnKeyPress()
{
	var i, j;

	if (jsCookie == 0) {
	    jsCookie = 1;
	    if (document.forms.length > 0) {
	      // Prüfen ob Feld COOKIE in einem Formular vorkommt 
	      for (i = 0; i < document.forms.length; i++) {
		for (j = 0; j < document.forms[i].elements.length; j++) {
		    if (document.forms[i].elements[j].name == "COOKIE") {
			if (document.forms[i].elements[j].value != "N") {
			    jsCookie = 2;
			    break;
			}
		    }
		}
	      }
	    }
	    else {
	      // nicht Bestandteil eines Frames
	      if (parent.frames.length == 0) {
		 jsCookie = 3;
	      }
	    }
	}
	if (jsCookie >= 2) {
	    // COOKIE war vorhanden und nicht auf 'N' oder
	    // Das Fenster hatte kein Formular und ist nicht Bestandteil eines Frames
	    if (event.keyCode == 27) {
		if (jsCookie == 3) {
		   window.close();
		}
		else {
		   closeFenster(false);
		   return false;
		}
	    }
	}
}

function IsNumber(Text)
{
        if (Text == "")
         {
                return false;
        }
        else
        {
                 for (i = 0; i < Text.length; ++i)
                {
                        if (Text.charAt(i) < "0"
                                || Text.charAt(i) > "9")
                        {
                                return false;
                        }
                }
        }
        return true;
}

function chkTxtFld(text, minlen)
{
        var mylen = 0;
        var zlen = 0;
        var i;
        if (minlen == 0) {
                mylen = text.length;
        }
        else {
                mylen = minlen;
        }
        zlen = text.length;
        for (i = (text.length - 1); i > 0; i--) {
            if (text.substr(i,1) != " ") {
                break;
            }
            zlen--;
        }
        for (i = 0; i < zlen; i++) {
            if (text.substr(i,1) != " ") {
                break;
            }
            zlen--;
        }
        if (zlen < mylen) {
                return false;
        }
        return true;
}

function newWindow(wName,hsize,vsize)
{
        var wstrg;
        if ((zWin) && (zWin.closed == false)) {
            zWin.resizeTo((hsize + 30),(vsize + 30));
	    zWin.name = wName;
        }
        else {
	    if (wName != window.name) {
	       wstrg = "width=" + hsize + ",height=" + vsize + 
		   ",resizable=yes,scrollbars=yes";
	       zWin = window.open("",wName,wstrg);
	    }
        }
}

function clsWindow()
{
        if ((zWin) && (zWin.closed == false)) {
                zWin.close();
        }
        if ((helpWin) && (helpWin.closed == false)) {
                helpWin.close();
        }
}

function helpWindow()
{
        if ((helpWin) && (helpWin.closed == false)) {
            helpWin.focus();
        }
        else {
            helpWin = window.open("/anw/wwwddv/hilfe.html","hilfeFenster",
		"width=600,height=450,resizable=yes,scrollbars=yes");
        }
	return false;
}

