var subMenu1 = new Array("<a class=menu nohref=''>Firmenprofil</a>",
                         "<a class=menu href='./mitarbeiter.php'>Mitarbeiter</a>",
                         "<a class=menu nohref=''>Filialen</a>");
var subIcon1 = new Array("<img class=menuicon src='./images/icon_constr.gif' border=0 width=11 height=11>",
                         "<img class=menuicon src='./images/icon_mitarb.gif' border=0 width=12 height=11>",
                         "<img class=menuicon src='./images/icon_constr.gif' border=0 width=11 height=11>");
var subCount1 = 3;

var subMenu2 = new Array("<a class=menu href='./address.php'>Adressen</a>",
                         "<a class=menu href='./mailform.php'>Mail-Formular</a>");
var subIcon2 = new Array("<img class=menuicon src='./images/icon_address.gif' border=0 width=11 height=11>",
                         "<img class=menuicon src='./images/icon_mailform.gif' border=0 width=12 height=9>");
var subCount2 = 2;

var subMenu3 = new Array("<a class=menu href='./support.php'>Kundensupport</a>",
                         "<a class=menu href='./support.php'>H&auml;ndlersupport</a>",
                         "<a class=menu href='./downloads.php'>Downloads</a>",
                         "<a class=menu nohref=''>FAQ</a>");
var subIcon3 = new Array("<img class=menuicon src='./images/icon_constr.gif' border=0 width=11 height=11>",
                         "<img class=menuicon src='./images/icon_constr.gif' border=0 width=11 height=11>",
                         "<img class=menuicon src='./images/icon_downloads.gif' border=0 width=11 height=11>",
                         "<img class=menuicon src='./images/icon_constr.gif' border=0 width=11 height=11>");
var subCount3 = 4;

var subMenu4 = new Array("<a class=menu href='./highlights.php'>Highlights</a>",
                         "<a class=menu href='./beschreibung.php'>Beschreibung</a>",
                         "<a class=menu href='./AZ.php'>A-Z</a>");
var subIcon4 = new Array("<img class=menuicon src='./images/icon_highlights.gif' border=0 width=11 height=11>",
                         "<img class=menuicon src='./images/icon_beschreibung.gif' border=0 width=9 height=11>",
                         "<img class=menuicon src='./images/icon_az.gif' border=0 width=9 height=11>");
var subCount4 = 3;

var subMenu5 = new Array("<a class=menu nohref=''>Anwenderberichte</a>",
                         "<a class=menu nohref=''>Pressestelle</a>",
                         "<a class=menu nohref=''>Kundenreferenzen</a>");
var subIcon5 = new Array("<img class=menuicon src='./images/icon_constr.gif' border=0 width=11 height=11>",
                         "<img class=menuicon src='./images/icon_constr.gif' border=0 width=11 height=11>",
                         "<img class=menuicon src='./images/icon_constr.gif' border=0 width=11 height=11>");
var subCount5 = 3;


var newImages = new Array();
var ie4 = 0;
var nc4 = 0;
var nn6 = 0;

var timerID = null;
var submenuID = null;
var onSubmenu = null;
var timerWait = 500;

var menuBlock = null;
var lastMenuID = null;

function clearSubmenu()
{
	document.all.submenu.innerHTML = "";
}

function nullAll()
{
	if (ie4)
	{
		if (menuBlock != null) menuBlock = null;
		if (onSubmenu == null)
		{
			if (timerID != null)
			{
				clearInterval(timerID);
				timerID = null;
			}
			if (submenuID != null)
			{
		//		document.all.submenu.innerHTML = "";
				submenuID = null;
				if (lastMenuID != null)
				{
					showSubMenu(lastMenuID);
				}
			}
		}
	}
}


function subMenuContent(ind)
{
	if (ie4)
	{
		_s = "<table cellpadding=0 cellspacing=0 border=0><tr>";
		_count = eval("subCount" + ind);
		for (i=0; i<_count; i++)
		{
			if (eval("subIcon" + ind + "[" + i + "]") != "")
				_s += "<td>" + eval("subIcon" + ind + "[" + i + "]") + "</td>";
			_s += "<td>&nbsp;" + eval("subMenu" + ind + "[" + i + "]") + "&nbsp;&nbsp;&nbsp;</td>";
		}
		_s += "</tr></table>";
	} 

	if (nc4)
	{	
		_s = "<table cellpadding=0 cellspacing=0 border=0 height=17><tr><td width=10>&nbsp;&nbsp;&nbsp;</td>";
		_count = eval("subCount" + ind);
		for (i=0; i<_count; i++)
		{
			if (eval("subIcon" + ind + "[" + i + "]") != "")
				_s += "<td>" + eval("subIcon" + ind + "[" + i + "]") + "</td>";
			_s += "<td>&nbsp;" + eval("subMenu" + ind + "[" + i + "]") + "&nbsp;&nbsp;&nbsp;</td>";
		}
		_s += "</tr></table>";
	}

	if (nn6)
	{	
		_s = "<table cellpadding=0 cellspacing=0 border=0 height=17><tr>";
		_count = eval("subCount" + ind);
		for (i=0; i<_count; i++)
		{
			if (eval("subIcon" + ind + "[" + i + "]") != "")
				_s += "<td>" + eval("subIcon" + ind + "[" + i + "]") + "</td>";
			_s += "<td>&nbsp;" + eval("subMenu" + ind + "[" + i + "]") + "&nbsp;&nbsp;&nbsp;</td>";
		}
		_s += "</tr></table>";
	}
	return _s;
}

function showSubMenu(ind)
{
	if (ie4)
	{
		if (menuBlock == null)
		{
			nullAll();
			_s = subMenuContent(ind);
			document.all.submenu.innerHTML = "";
			document.all.submenu.insertAdjacentHTML("BeforeEnd",_s);
			submenuID = 1;
		}
		lastMenuID = ind;
	}
	if (nc4)
	{
		x = document.layers["submenu"];
		x.document.layers["submenu"+ind].visibility = "show";
	}
	if (nn6)
	{
		_s = subMenuContent(ind);
		document.getElementById("submenu").innerHTML = _s;
		document.getElementById("submenu").style.visibility = "show";
	}
}

function hideSubMenu()
{
	if (ie4)
	{
		if (menuBlock == null)
		{
			if (submenuID != null)
			{
				timerID = setInterval("nullAll()",timerWait);
				menuBlock = 1;
			}
		}
		lastMenuID = null;
	}
	if (nc4)
	{
		x = document.layers["submenu"];
		for (var i=1; i<=x.document.layers.length; i++)
			x.document.layers["submenu"+i].visibility = "hide";
	}
	if (nn6)
	{
		document.getElementById("submenu").innerHTML = "";
	}
}

function On(ind)
{
	var coll;
	if (ie4)	coll = window.document.all;
	if (nc4)	coll = window.document.images;
	if (nn6)	coll = window.document.images;

	if (coll)	coll["actmenu"+ind].src = newImages[ind].onsrc;
}

function Off(ind)
{
	var coll;
	if (ie4)	coll = window.document.all;
	if (nc4)	coll = window.document.images;
	if (nn6)	coll = window.document.images;

	if (coll)	coll["actmenu"+ind].src = newImages[ind].offsrc;
}


function checkBrowser()
{
	ie4 = (document.all)? true:false;
	nc4 = (document.layers)? true:false;
	nn6 = (window.sidebar)? true:false;
}

function init()
{
	checkBrowser();
	var coll;
	var k = 1;

	if (ie4)
	{
		coll=window.document.all.actmenu;
		if (coll)
		{
			for (i=0;i<coll.length;i++)
			{

				newImages[k]		= new Image();
				newImages[k].src	= coll(i).src;
				newImages[k].offsrc	= coll(i).src;
				newImages[k].onsrc	= coll(i).src.substr(0,coll(i).src.length-4) + "_.gif";
				k++;

			}
		}
	}

	if (nc4)
	{
		coll = window.document.images;
		if (coll)
			for (i=0;i<coll.length;i++)
				if (coll[i].name.substr(0,7) == "actmenu")
				{
					newImages[k]		= new Image();
					newImages[k].src	= coll[i].src;
					newImages[k].offsrc	= coll[i].src;
					newImages[k].onsrc	= coll[i].src.substr(0,coll[i].src.length-4) + "_.gif";
					k++;
				}
	}

	if (nn6)
	{
		coll = window.document.images;
		if (coll)
			for (i=0;i<coll.length;i++)
				if (coll[i].name.substr(0,7) == "actmenu")
				{
					newImages[k]		= new Image();
					newImages[k].src	= coll[i].src;
					newImages[k].offsrc	= coll[i].src;
					newImages[k].onsrc	= coll[i].src.substr(0,coll[i].src.length-4) + "_.gif";
					k++;
				}
	}
}

//persistent layer in Mitarbeiter.htm 

function flevDivPositionValue(sDiv, sProperty) 
{
	this.opera = (window.opera); // Opera 5+
	this.ns4 = (document.layers); // Netscape 4.x
	this.ns6 = (document.getElementById && !document.all && !this.opera); // Netscape 6+
	this.ie = (document.all);  // Internet Explorer 4+
    var sValue = ""; docObj = eval("MM_findObj('" + sDiv + "')"); if (docObj == null) {return 0;}
	if ((sProperty == "left") || (sProperty == "top")) {
		if (!this.ns4) {docObj = docObj.style;} 
		sValue = eval("docObj." + sProperty);
		if ((this.ie) && (sValue == "")) { // IE (on PC) bug with nested layers
			if (sProperty == "top") { sValue = eval(sDiv + ".offsetTop"); } 
			else { sValue = eval(sDiv + ".offsetLeft"); } 
		};
	}
	else {
		if (this.opera) {
			docObj = docObj.style;
			if (sProperty == "height") { sValue = docObj.pixelHeight; } 
			else if (sProperty == "width") { sValue = docObj.pixelWidth; } 
		}
		else if (this.ns4) {sValue = eval("docObj.clip." + sProperty);} 
		else if (this.ns6) {sValue = document.defaultView.getComputedStyle(docObj, "").getPropertyValue(sProperty); } 
	    else if (this.ie) { 
			if (sProperty == "width") { sValue = eval(sDiv + ".offsetWidth"); } 
			else if (sProperty == "height") { sValue = eval(sDiv + ".offsetHeight"); } 
		}
   	}
	sValue = (sValue == "") ? 0 : sValue; 
	if (isNaN(sValue)) { if (sValue.indexOf('px') > 0) { sValue = sValue.substring(0,sValue.indexOf('px')); } } 
	return parseInt(sValue); 
}

function flevPersistentLayer() 
{
	var sD = arguments[0], oD = eval("MM_findObj('" + sD + "')"), iWW, iWH, iSX, iSY, iT = 10, sS = "";
	if (!document.layers) {oD = oD.style;}
	if (oD.tmpTimeout != null) {clearTimeout(oD.tmpTimeout);}
	var sXL = arguments[1], sXC = arguments[2], sXR = arguments[3], sYT = arguments[4], sYC = arguments[5], sYB = arguments[6];
	var iS = (arguments.length > 7) ? parseInt(arguments[7]) : 0, iPx = (arguments.length > 8) ? parseInt(arguments[8]) : 0;
	if (window.innerWidth) { // NS4, NS6 and Opera
		var oW = window; iWW = oW.innerWidth; iWH = oW.innerHeight; iSX = oW.pageXOffset; iSY = oW.pageYOffset; }
	else if (document.documentElement && document.documentElement.clientWidth) { // IE6 in standards compliant mode
		var oDE = document.documentElement; iWW = oDE.clientWidth; iWH = oDE.clientHeight; iSX = oDE.scrollLeft; iSY = oDE.scrollTop; }
	else if (document.body) { // IE4+
		var oDB = document.body; iWW = oDB.clientWidth; iWH = oDB.clientHeight; iSX = oDB.scrollLeft; iSY = oDB.scrollTop; }
	else {return;}
	var iCX = iNX = flevDivPositionValue(sD, 'left'), iCY = iNY = flevDivPositionValue(sD, 'top');
	if (sXL != "") {iNX = iSX + parseInt(sXL);} 
	else if (sXC != "") {iNX = Math.round(iSX + (iWW/2) - (flevDivPositionValue(sD, 'width')/2));}
	else if (sXR != "") {iNX = iSX + iWW - (flevDivPositionValue(sD, 'width') + parseInt(sXR));}
	if (sYT != "") {iNY = iSY + parseInt(sYT);}
	else if (sYC != "") {iNY = Math.round(iSY + (iWH/2) - (flevDivPositionValue(sD, 'height')/2));}
	else if (sYB != "") {iNY = iSY + (iWH - flevDivPositionValue(sD, 'height') - parseInt(sYB));}
	if ((iCX != iNX) || (iCY != iNY)) {
		if (iS > 0) {
			if (iPx > 0) { iT = iS;
				var iPxX = iPx, iPxY = iPx, iMX = Math.abs(iCX - iNX), iMY = Math.abs(iCY - iNY);
				// take care of diagonal movement
				if (iMX < iMY) {iPxY = (iMX != 0) ? ((iMY/iMX)*iPx) : iPx;}
				else {iPxX = (iMY != 0) ? ((iMX/iMY)*iPx) : iPx;}
				if (iPxX >= iMX) {iPxX = Math.min(Math.ceil(iPxX), iPx);}
				if (iPxY >= iMY) {iPxY = Math.min(Math.ceil(iPxY), iPx);}
				// temporary X/Y coordinates
				if ((iCX < iNX) && (iCX + iPxX < iNX)) {iNX = iCX + iPxX;}
				if ((iCX > iNX) && (iCX - iPxX > iNX)) {iNX = iCX - iPxX;}
				if ((iCY < iNY) && (iCY + iPxY < iNY)) {iNY = iCY + iPxY;}
				if ((iCY > iNY) && (iCY - iPxY > iNY)) {iNY = iCY - iPxY;} }
			else { 
				var iMX = ((iNX - iCX) / iS), iMY = ((iNY - iCY) / iS); 
				iMX = (iMX > 0) ? Math.ceil(iMX) : Math.floor(iMX); iNX = iCX + iMX; 
				iMY = (iMY > 0) ? Math.ceil(iMY) : Math.floor(iMY); iNY = iCY + iMY; } }
		if ((parseInt(navigator.appVersion)>4 || navigator.userAgent.indexOf("MSIE")>-1) && (!window.opera)) {sS="px";}
		if (iMX != 0) {eval("oD.left = '" + iNX + sS + "'");}
		if (iMY != 0) {eval("oD.top = '" + iNY + sS + "'");} }
	var sF = "flevPersistentLayer('" + sD + "','" + sXL + "','" + sXC + "','" + sXR + "','" + sYT + "','" + sYC + "','" + sYB + "'," + iS + "," + iPx + ")";
	oD.tmpTimeout = setTimeout(sF,10);
}

function flevInitPersistentLayer() 
{
	if (arguments.length < 8) {return;}
	var sD = arguments[0]; if (sD == "") {return;}
	var	oD = eval("MM_findObj('" + sD + "')"); if (!oD) {return;}
	var iCSS = parseInt(arguments[1]);
	var sXL = arguments[2], sXC = arguments[3], sXR = arguments[4], sYT = arguments[5], sYC = arguments[6], sYB = arguments[7];
	var iS = (arguments.length > 8) ? parseInt(arguments[8]) : 0, iPx = (arguments.length > 9) ? parseInt(arguments[9]) : 0;
	if (iCSS != 0) { if (!document.layers) {oD = oD.style;} sXL = parseInt(oD.left), sYT = parseInt(oD.top);}
	var sF = "flevPersistentLayer('" + sD + "','" + sXL + "','" + sXC + "','" + sXR + "','" + sYT + "','" + sYC + "','" + sYB + "'," + iS + "," + iPx + ")";
	eval(sF);
}


function MM_findObj(n, d) {
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}


function MM_swapImage() {
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


function MM_swapImgRestore() {
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}


function MM_preloadImages() {
 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
   var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function setLyr(obj,lyr)
{
	var newX = findPosX(obj);
	var newY = findPosY(obj);

	var x = new getObj(lyr);
	x.style.top = 56 +'px';
	x.style.left = newX  + 'px';
}


function getObj(name)
{
 if (document.getElementById)
 {
	   this.obj = document.getElementById(name);
	   this.style = document.getElementById(name).style;
 }
 else if (document.all)
 {
	   this.obj = document.all[name];
	   this.style = document.all[name].style;
 }
 else if (document.layers)
 {
	   if (document.layers[name])
	   {
	   	this.obj = document.layers[name];
	   	this.style = document.layers[name];
	   }
	   
 }
}


function findPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}


function findPosY(obj)
{
	var curtop = 0;
	
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
		
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	
	return curtop;
}


function getLayerRef (id) {
  if (!document)
    document = window.document;


  if (document.layers) {
    for (var l = 0; l < document.layers.length; l++)
      if (document.layers[l].id == id)
        return document.layers[l];
    for (var l = 0; l < document.layers.length; l++) {
      var result = getLayerRef(id, document.layers[l].document);
      if (result)
        return result;
    }
    return null;
  } else if (document.all) {
    return document.all[id];
  } else if (document.getElementById) {
    return document.getElementById(id);
  }
}


function setVisibility(objLayer, visible ) {

  if(document.layers){
    objLayer.visibility  = 
        (visible == true) ? 'show' : 'hide';
  } else {
    objLayer.style.visibility = 
        (visible == true) ? 'visible' : 'hidden';
  }

}


function submenu_colorOn(obj)
{
	obj.style.backgroundColor='#146992';
	obj.style.fontColor='#ffffff';
	submenu.style.filter='Alpha(opacity=0)';
}

	
function submenu_colorOff(obj)
{
	obj.style.backgroundColor='#E9F1F8';
}
