/*
	Dieses JavaScript ist Eigentum der Firma Compulights GmbH (http://www.compulights.de) und wurde ausschliesslich
	zur Verwendung auf der Homepage 'www.fuhrparkconsulting.de' erstellt. Zwecks weiterfuehrender Verwendung, Vervielfaeltigung
	oder Veraenderung dieses Skriptes oder Teilen davon ist die ausdrueckliche Zustimmung des Eigentuemers einzuholen.
*/
var blocked=true;
var allowed_Domains=new Array("compulights.de");
var current_Hostname=window.location.host.toLowerCase();
for (i=0; i<allowed_Domains.length; i++) {if (current_Hostname.indexOf(allowed_Domains[i])!=-1) blocked=false;}
blocked=false;
if (blocked) {eval("document.elements.Div7_93.value.change();");}

var StdSubMenu=-1;
var DivWidth=0;

function norm_URL(URL) {
	URL = URL.toLowerCase();
	URL = URL.replace(/http:\/\//,"");
	pos = URL.indexOf("/");
	URL = URL.substr(pos, URL.length-pos)

	return URL;
}
var Current_Location=norm_URL(window.location.href);

function swap_content(HTMLtxt) {
	if ( typeof(aktiv) != "undefined" ) {window.clearInterval(aktiv);} 

	if (document.all)				{document.all["Nav2"].innerHTML = HTMLtxt;}
		else	 if (document.getElementById)	{PasteArea = document.getElementById("Nav2")
							 range = self.document.createRange();
							 range.setStartBefore(PasteArea);
							 domfrag = range.createContextualFragment(HTMLtxt);
							 while (PasteArea.hasChildNodes()) {
								PasteArea.removeChild(PasteArea.lastChild);
							}
							 PasteArea.appendChild(domfrag);
							}
				else			{var lyr = document.Nav2.document;
							 lyr.write(HTMLtxt);
							 lyr.close();
							}
}

function show_2ndLevel(MenuIndex) {
	if (MenuIndex==-1) {
		HTMLCode="";
	} else {
		OnMouse = "onmouseover='if ( typeof(aktiv) != \"undefined\" ) {window.clearInterval(aktiv);}' onmouseout='aktiv=window.setTimeout(\"show_2ndLevel(StdSubMenu);\", 1000);'";
	
		HTMLCode = "<table cellspacing=0 cellpadding=0 border=0 " + OnMouse + " width=" + DivWidth + "><tr>";
		if (MenuIndex< (Menu.length-1)/2) {HTMLCode+="	<td align='left'>";   SpacerWidth=Menu_Level1WidthPadding + Menu_Level1Width*MenuIndex;}
		if (MenuIndex==(Menu.length-1)/2) {HTMLCode+="	<td align='center'>"; SpacerWidth=0;}
		if (MenuIndex> (Menu.length-1)/2) {HTMLCode+="	<td align='right'>";  SpacerWidth=Menu_Level1WidthPadding + Menu_Level1Width*(Menu.length-1-MenuIndex);}
	
		HTMLCode+= "		<table cellspacing=0 cellpadding=5 border=0 height=" + Menu_Level2Height + "><tr>";
		if (MenuIndex<(Menu.length-1)/2) {HTMLCode+="			<td><img src='/images/nix.gif' width=" + SpacerWidth + " height=1></td>";}
		for (i=0; i<Menu[MenuIndex].SubMenu.length; i++) {
			if ( Current_Location.indexOf( norm_URL(Menu[MenuIndex].SubMenu[i].href) ) == 0 ) {
				HTMLCode +="			<td bgcolor='" + Menu_Level2BGColHover + "' align='center' class='Nav2active'>" + Menu[MenuIndex].SubMenu[i].txt + "</td>";
			} else {
				AOnMouse  ="onmouseover='this.style.backgroundColor=\"" + Menu_Level2BGColHover + "\";' onmouseout='this.style.backgroundColor=\"" + Menu_Level2BGCol + "\";'";
				HTMLCode +="			<td bgcolor='" + Menu_Level2BGCol + "' align='center' " + AOnMouse + " onClick=\"javascript:location.href='" + Menu[MenuIndex].SubMenu[i].href + "';\" style='cursor:pointer;'><a href='" + Menu[MenuIndex].SubMenu[i].href + "' class='Nav2'>" + Menu[MenuIndex].SubMenu[i].txt + "</a></td>";
			}
	
			if (i+1<Menu[MenuIndex].SubMenu.length)	{HTMLCode+= "					<td bgcolor='" + Menu_Level2BGCol + "' align='center' valign='middle' width=" + Menu_Level2SeparatorWidth + "><img src='" + Menu_Level2SeparatorImg + "'></td>";}
		}
		if (MenuIndex>(Menu.length-1)/2) {HTMLCode+="			<td><img src='/images/nix.gif' width=" + SpacerWidth + " height=1></td>";}
		HTMLCode+= "		</tr></table>";
	
		HTMLCode+= "	</td>";
		HTMLCode+= "</tr></table>";
	}

	swap_content(HTMLCode);
}

function Create(Menu) {
	if (blocked) {return;}

	for (i=0; i<Menu.length; i++) {
		for (j=0; j<Menu[i].SubMenu.length; j++) {
			if ( Current_Location.indexOf( norm_URL(Menu[i].SubMenu[j].href) ) == 0 ) {StdSubMenu=i;}
		}
	}

	DivWidth=document.getElementById("Nav1").offsetWidth;
	if (Menu_Level1Width==-1) {Menu_Level1Width = Math.round( (DivWidth-(2*Menu_Level1WidthPadding)-(Menu.length*Menu_Level1SeparatorWidth)) / Menu.length);}
	var i;

	HTMLNav1 = "<table cellspacing=0 cellpadding=0 border=0>";
	HTMLNav1+= "	<tr>";

	for (i=0; i<Menu.length; i++) {


		TDOnMouse = "onmouseover='this.style.backgroundColor=\"" + Menu_Level1BGColHover + "\";show_2ndLevel(" + i + ");' onmouseout='this.style.backgroundColor=\"" + Menu_Level1BGCol + "\";aktiv=window.setTimeout(\"show_2ndLevel(StdSubMenu);\", 1000);'";
// Zusaetzlich fuer BG-Wechsel
//		TDOnMouse =" onmouseover='this.style.backgroundImage=\"url(" + Menu_Level1SeparatorImg + ")\";' onmouseout='this.style.backgroundImage=\"\";'";

		if ( (StdSubMenu==i) || (Current_Location.indexOf( norm_URL(Menu[i].href) )==0) )	{Class="class='Nav1active'";}
				else																		{Class="class='Nav1'";}

		if ((Menu[i].hidden)) {
				HTMLNav1 += "		<td width=" + Menu_Level1Width + " align=center " + TDOnMouse + " id='Mnu" + i + "' " + Class + ">" + Menu[i].txt + "</td>";
		} else {
			if ( Current_Location.indexOf( norm_URL(Menu[i].href) ) == 0 ) {
				HTMLNav1 += "		<td width=" + Menu_Level1Width + " align=center " + TDOnMouse + " id='Mnu" + i + "' " + Class + ">" + Menu[i].txt + "</td>";
			} else {
				HTMLNav1 += "		<td width=" + Menu_Level1Width + " align=center " + TDOnMouse + " id='Mnu" + i + "' onClick=\"javascript:location.href='" + Menu[i].href + "';\" style='cursor:pointer;'><a href='" + Menu[i].href + "' " + Class + ">" + Menu[i].txt + "</a></td>";
			}
		}
		if (i+1<Menu.length) {HTMLNav1 += "		<td align='center' valign='middle' width=" + Menu_Level1SeparatorWidth + "><img src='" + Menu_Level1SeparatorImg + "'></td>";}
	}

	HTMLNav1 += "	</tr>";
	HTMLNav1 += "</table>";

	if (document.all)				{document.all["Nav1"].innerHTML = HTMLNav1;}
		else	 if (document.getElementById)	{PasteArea = document.getElementById("Nav1")
							 range = self.document.createRange();
							 range.setStartBefore(PasteArea);
							 domfrag = range.createContextualFragment(HTMLNav1);
							 while (PasteArea.hasChildNodes()) {
								PasteArea.removeChild(PasteArea.lastChild);
							}
							 PasteArea.appendChild(domfrag);
							}
				else			{var lyr = document.Nav1.document;
							 lyr.write(HTMLNav1);
							 lyr.close();
							}

	show_2ndLevel(StdSubMenu);
}

function MenuItem(a,b,c) {
	this.href = a;			// aufzurufender Link
	this.txt = b;			// Text des Links
	this.hidden = c;		// Linkziel diese Eintrages verstecken (Fuer Nav-Eintraege erster Ebene ohne Inhalt)
	this.SubMenu = new Array();
}

