var BoxRef;
var BoxOver = false;
var Ns4 = document.layers ? 1 : 0;
var Ie5 = (document.all && document.getElementById) ? 1 : 0;
var Ns6 = (!document.all && document.getElementById) ? 1 : 0;
var Ie6 = document.all && document.fireEvent && document.createComment;
var CurUrl = window.location.href;
var CurPage = CurUrl.slice(CurUrl.lastIndexOf("/",CurUrl.lastIndexOf("/")-1) + 1);
if (CurPage.lastIndexOf("?")>0)
	CurPage = CurPage.substr(0,CurPage.lastIndexOf("?"));

// NS4 only, resize bug fix
if (Ns4) {  
  var OrigWidth = window.innerWidth;
  var OrigHeight = window.innerHeight;

		function Resize() {  // NS4 only, resize bug 
				if (window.innerWidth != OrigWidth || window.nnerHeight != OrigHeight)
						window.location.reload();
		}

  onresize = Resize;
}
//--------------------------

function ShowLevel(ElId) {
  var ElRef = document.getElementById("Box" + ElId);

  if (ElRef.style.display == "none" || ElRef.style.display == "") {
//    ElRef.style.display = "block";
    Ie6 ? ElRef.style.display = "inline-block" : ElRef.style.display = "block" ;

  document.images["Img" + ElId].src = "../../images/mpfeil_activ.gif";
	//  document.images["Img" + ElId].src = "/redesign/images/mpfeil_activ.gif";
  }
  else {
   ElRef.style.display = "none";
  document.images["Img" + ElId].src = "../../images/mpfeil.gif";
  //  document.images["Img" + ElId].src = "/redesign/images/mpfeil.gif";
  }
}




function LoadLan(ThisLan) {
  var Expr = new RegExp("http://[^/]*");
  var ThisUrl = window.location.href;

  ThisUrl = ThisUrl.replace(Expr,"");
  if (/notfound.asp/.test(ThisUrl)) ThisUrl = ThisUrl.substr(ThisUrl.lastIndexOf("Url=") + 4);
  else	window.location.href ="../../master/notfound.asp?Lan=" + ThisLan + "&Url=" + ThisUrl;
 // else	window.location.href ="/redesign/master/notfound.asp?Lan=" + ThisLan + "&Url=" + ThisUrl;
  return false;
}

function Init() {
  if (Ns6) document.getElementById("DivPrint").style.paddingRight = "15px";
  if (Ns6 || Ie5) {
    // close all menus
    var ElRef = document.getElementsByTagName("Div");
    for (var i = 0; i < ElRef.length; i++) {
      if (/Box/.test(ElRef[i].id)) {
        ElRef[i].style.display = "none";
      }
    }

    // menu aktiv setzen
		var Reg;

		if (CurPage=="") 
		  Reg = "default.asp" + "\\b";
		else
		  Reg = CurPage.substr(0,CurPage.length)+"$";
//		  Reg = CurPage + "\\b";

		Reg = Reg.replace('?','\\?');

		Reg = new RegExp(Reg);
		ElRef = document.getElementById("DivNavCont").getElementsByTagName("a");

		for (var i = 0; i < ElRef.length; i++) {
		// Level aktiv setzen
			if (Reg.test(ElRef[i].getAttribute("href"))) {
				if (ElRef[i].name) {
					if (document.getElementById("Box" + ElRef[i].name)) {
						ShowLevel(ElRef[i].name);
					}
				}
				else {
					var ParRef = ElRef[i].parentNode;
				
				// while (ParRef && ParRef.id != "TblLayout" && ParRef.id != "DivLan") 
				while (ParRef && ParRef.id != "DivNavCont" && ParRef.id != "DivLan") { 
					if (ParRef.id)	ShowLevel(ParRef.id.slice(3));
					ParRef = ParRef.parentNode;
				}
				}
			}
		}

	}
}


var Remote = null; //Vergrösserung Fotos
var RemoteImg;
function OpenWin(ImgName, PageWidth, PageHeight) {
  RemoteImg = "images/" + ImgName;
  if (Remote && Remote.open && !Remote.closed) {
    Remote.document.images['Foto'].src = RemoteImg;
    Remote.focus();
  }
  else 
    Remote = window.open("mitarbeiter.htm","ImgWin","width=" + PageWidth + ", height=" + PageHeight + ",toolbar=no,menubar=no,location=no,scrollbars=no,resizable=yes");
}

function OpenWin2(ImgName, PageWidth, PageHeight) {
  RemoteImg = "images/" + ImgName;
  if (Remote && Remote.open && !Remote.closed) Remote.close();
  Remote = window.open("mitarbeiter.htm","ImgWin","width=" + PageWidth + ", height=" + PageHeight + ",toolbar=no,menubar=no,location=no,scrollbars=no,resizable=yes");
}

function OpenWin3(url, PageWidth, PageHeight) {
  if (Remote && Remote.open && !Remote.closed) Remote.close();
  Remote = window.open(url,"ImgWin","width=" + PageWidth + ", height=" + PageHeight + ",toolbar=no,menubar=no,location=no,scrollbars=no,resizable=yes");
}



onload = Init;
