//Vorher muß dei stdbibl eingebunden sein!

var StopHighLight = false;

//Gibt Scroll-Position zurück
function GetScrollPos(ScDir) {

  //ScDir = 1 --> Scrollpos von oben, sonst von links
  var ScPos;

  if(BrwsInf["DOM"] && !(BrwsInf["ID"] == "MS")) {

    ScPos = (ScDir == 1) ? window.pageYOffset : window.pageXOffset;
    return(ScPos);

  } else if(BrwsInf["ID"] == "MS") {
    ScPos = (ScDir == 1) ? document.body.scrollTop : document.body.scrollLeft;
    return(ScPos);

  } else if(BrwsInf["ID"] == "NS") {

    //Hier nochmal separat, falls es im neuen Netscape Änderungen gibt
    ScPos = (ScDir == 1) ? window.pageYOffset : window.pageXOffset;
    return(ScPos);

  }

}

//Gibt Fenster-Dimensionen zurück
function GetWinDim(ScDim) {

  //ScDir = 1 --> Scrollpos von oben, sonst von links
  var ScPos;

  if(BrwsInf["DOM"] && !(BrwsInf["ID"] == "MS")) {

    ScPos = (ScDim == 1) ? window.innerHeight : window.innerWidth;
    return(ScPos);

  } else if(BrwsInf["ID"] == "MS") {

    ScPos = (ScDim == 1) ? document.body.offsetHeight : document.body.offsetWidth;
    return(ScPos);

  } else if(BrwsInf["ID"] == "NS") {

    //Hier nochmal separat, falls es im neuen Netscape Änderungen gibt
    ScPos = (ScDim == 1) ? window.innerHeight : window.innerWidth;
    return(ScPos);

  }

}

//Gibt Fenster-Dimensionen zurück
function GetScreenDim(ScDim) {

  //ScDir = 1 --> Scrollpos von oben, sonst von links
  var ScPos;

  if(BrwsInf["DOM"] && !(BrwsInf["ID"] == "MS")) {

    ScPos = (ScDim == 1) ? GetMainRef().window.innerHeight : GetMainRef().window.innerWidth;
    return(ScPos);

  } else if(BrwsInf["ID"] == "MS") {

    ScPos = (ScDim == 1) ? GetMainRef().document.body.offsetHeight : GetMainRef().document.body.offsetWidth;
    return(ScPos);

  } else if(BrwsInf["ID"] == "NS") {

    //Hier nochmal separat, falls es im neuen Netscape Änderungen gibt
    ScPos = (ScDim == 1) ? GetMainRef().window.innerHeight : GetMainRef().window.innerWidth;
    return(ScPos);

  }

}

//Prüft ob aktuelles Fenster ein Elternfenster hat
//und gibt passenden Verweis zurück
//Wir eigentlich durch GetMainRef() erledigt (Altlast)
function GetParWinObj() {

  var TmpObj = null;

  TmpObj = GetMainRef();

  return TmpObj;

}

//Öffnet Fenster
function OpnDimWin(FPath,WinName,WinWidth,WinHeight,WinScBrs,WinDpd,WinRszbl,WinStatus) {

  return window.open(FPath,WinName,"width=" + WinWidth + ",height=" + WinHeight + ",scrollbars=" + WinScBrs + ",dependent=" + WinDpd + ",resizable=" + WinRszbl + ",status=" + WinStatus);

}

//Öffnet Info-Fenster
function OpnInfWin(LinkID,Perm,FPath,FCrit,SID) {

  var TmpName = LinkID.substr(0,2) + "InfWin";
  var TmpDir = null;

  //LinkID prüfen
  if(LinkID.length > 2 && !LinkID.substr(0,2).match(/\d/)) {

    TmpDir = GetBSDir() + FPath + "?SID=" + SID + "&LinkID=" + LinkID + "&FCrit=" + FCrit;

    if(Perm < 3) {
      window.open(TmpDir,TmpName,"width=450,height=350,scrollbars=yes,dependent=yes,resizable=no");
    } else {
      window.open(TmpDir,TmpName,"width=580,height=500,scrollbars=yes,dependent=yes,resizable=yes,status=yes");
    }

  }

}

//Öffnet Bild-Fenster
function OpnImgWin(FleRegID,SID) {

  var TmpDir = GetBSDir() + "/ind/cnt/img.php?SID=" + SID + "&FleRegID=" + FleRegID;

  window.open(TmpDir,FleRegID + "ImgWin","width=580,height=400,scrollbars=yes,dependent=yes,resizable=yes");

}

//Scrollt Navigation um Pixel
function ScrollNV(ScFrame,ScLeft,ScTop,ScTo) {

  //ScTo=0 --> ScrollBy
  //ScTo=1 --> Nur Top neusetzen
  //ScTo=2 --> Nur Left neusetzen
  //ScTo=3 --> Top und Left neusetzen

  switch(ScTo) {

    case 0:  parent.frames[ScFrame].scrollBy(ScLeft,ScTop);
             break;

    case 1:  parent.frames[ScFrame].scrollTo(parent.frames[ScFrame].GetScrollPos(0),ScTop);
             break;

    case 2:  parent.frames[ScFrame].scrollTo(ScLeft,parent.frames[ScFrame].GetScrollPos(1));
             break;

    case 3:  parent.frames[ScFrame].scrollTo(ScLeft,ScTop);
             break;

  }

  //Hintergrund Bild positionieren
  parent.frames[ScFrame].SetAttr("nvb0","left",parent.frames[ScFrame].GetScrollPos(0) + 5);
  parent.frames[ScFrame].SetAttr("nvb0","top",parent.frames[ScFrame].GetScrollPos(1) + 5);

}

//Öffnet Nachrichtenfenster
function MsgWinCtrl(MsgTxt,MsgTle,AutoClose,SSLUse) {

  BSDir = "http://" + window.location.host;

if(SSLUse!=1 && parent.frames['LREF']!=undefined) {

  //WaitWin Referenz aus Zwischenspeicher laden
  WaitWin=parent.frames['LREF'].WaitWin;
  BSDir = parent.LREF.BSDir;

  if((WaitWin!=null) && (!WaitWin.closed)) {
    WaitWin.close();
  }

}

if (MsgTxt!="") {

  var TmpDoc="";

  TmpDoc="<html><head><title>" + MsgTle + "<\/title><\/head><body bgcolor='#D7DEE6' background='" + BSDir + "/ind/all/img/nv40.gif'>\n";
  TmpDoc+="<table border='0' width='100%' height='100%'><tr><td width='100%' align='center'>\n";
  TmpDoc+="<font face='Arial' size='2' color='#1E3987'>" + MsgTxt + "<br><font size='1'>(Fenster schließt sich automatisch)\n";
  TmpDoc+="<\/font><\/font><\/td><\/tr><\/table><\/body><\/html>";

  TmpTop=screen.height/2-37.5;
  TmpLeft=screen.width /2-125;

  WaitWin = window.open("","WaitWin1","width=250,height=75,top=" + TmpTop + ",left=" + TmpLeft + ",scrollbars=yes,dependent=yes");

  WaitWin.document.open();
  WaitWin.document.write(TmpDoc);

  if(SSLUse!=1 && parent.frames['LREF']!=undefined) {
    //WaitWin Referenz in zwischenspeichern
    parent.frames['LREF'].WaitWin=WaitWin;
  }

}

if((AutoClose>0) && (!WaitWin.closed)) {

  setTimeout("WaitWin.close()", AutoClose);

}

}

//Vergrößert ein Bild
function ShowBImg(BImgPath,MsgTle) {

  var TmpDoc="";

  TmpDoc="<html><head><title>" + MsgTle + "<\/title><\/head><body bgcolor='#BEC9CB'>\n";
  TmpDoc+="<table border='0' width='100%' height='100%'><tr><td width='100%' align='center'>\n";
  TmpDoc+="<img src='" + BImgPath + "'><br><font face='Arial' size='1' color='#1C364C'>(Keine Gewähr für die Richtigkeit des Bildes)<br>\n";
  TmpDoc+="<a href='javascript:window.close()'><font color='#000000'>Fenster schließen<\/font></a><\/font>\n";
  TmpDoc+="<\/td><\/tr><\/table><\/body><\/html>";

  TmpTop=screen.height/2-275;
  TmpLeft=screen.width /2-225;

  ImgWin = window.open("","ImgWin1","width=450,height=550,top=" + TmpTop + "px,left=" + TmpLeft + ",scrollbars=yes,dependent=yes");

  ImgWin.document.open();
  ImgWin.document.write(TmpDoc);

}

//Läßt die Hintergrundfarbe blinken
function HighlightFormElem(FrmName,FldName,BSColor,HLColor,BSFontColor,HLFontColor,HLCnt) {

  if(document.forms[FrmName] != undefined) {

    var TmpObj = document.forms[FrmName].elements[FldName];

    if(HLCnt % 2 == 0 && !StopHighLight) {

      TmpObj.style.backgroundColor = HLColor;
      TmpObj.style.color = HLFontColor;
      TmpObj.options[TmpObj.selectedIndex].style.backgroundColor = HLColor;
      TmpObj.options[TmpObj.selectedIndex].style.color = HLFontColor;

    } else {

      TmpObj.style.backgroundColor = BSColor;
      TmpObj.style.color = BSFontColor;
      TmpObj.options[TmpObj.selectedIndex].style.backgroundColor = BSColor;
      TmpObj.options[TmpObj.selectedIndex].style.color = BSFontColor;

    }

    if(--HLCnt > 0 && !StopHighLight) {
      setTimeout("HighlightFormElem('" + FrmName + "','" + FldName + "','" + BSColor + "','" + HLColor  + "','" + BSFontColor + "','" + HLFontColor + "'," + HLCnt +")", 500);
    }

  }

}

//Stopt die Hilghlight function
function StopHighlight() {
  StopHighLight = true;
}
