// TODO: alle Aufrufer sollen auf /js/*.js umsteigen!

function makeImgSrcTag(sRelSrc)
{
	var oLocation = window.location;
	var sProtocol = oLocation.protocol;
	if ((sProtocol!="http:") && (sProtocol!="https:")) sProtocol = "http:";
	var sHost= oLocation.host.toLowerCase();
	if ((""+sbase == "undefined") || (sbase=="") || (sHost == "premium-link.net") || (sHost == "")) sHost = "www.faz.net";
	return sProtocol + "//" + sHost + "/IN/INtemplates/faznet/" + sRelSrc;
}

function Browser() 
{
	//alert("inc/navigation/newmenu.js: Browser()");

	var b=navigator.appName;
	if (b.indexOf('Netscape')!=-1) this.b="ns";
	else if ((b=="Opera") || (navigator.userAgent.indexOf("Opera")>0)) this.b = "opera";
	else if (b=="Microsoft Internet Explorer") this.b="ie";
	if (!b) alert('Unidentified browser.\nThis browser is not supported,');
	this.version=navigator.appVersion;
	this.v=parseInt(this.version);
	this.ns=(this.b=="ns" && this.v>=4);
	this.ns4=(this.b=="ns" && this.v==4);
	this.ns6=(this.b=="ns" && this.v==5);
	this.ie=(this.b=="ie" && this.v>=4);
	this.ie4=(this.version.indexOf('MSIE 4')>0);
	this.ie5=(this.version.indexOf('MSIE 5')>0);
	this.ie55=(this.version.indexOf('MSIE 5.5')>0);
	this.ie6=(this.version.indexOf('MSIE 6.0')>0);
	this.opera=(this.b=="opera");
	this.dom=(document.createElement && document.appendChild && document.getElementsByTagName)?true:false;
	this.def=(this.ie||this.dom); // most used browsers, for faster if loops
	var ua=navigator.userAgent.toLowerCase();
	if (ua.indexOf("win")>-1) this.platform="win32";
	else if (ua.indexOf("mac")>-1) this.platform="mac";
	else this.platform="other";
}

is=new Browser();

var IE4 = (document.all) ? 1 : 0;
var NS4 = (document.layers) ? 1 : 0;
var NS6 = (document.getElementById && !IE4) ? 1 : 0;
var NS7_1 = (window.GeckoActiveXObject && NS6) ? 1 : 0;

var ver4 = (IE4 || NS4 || NS6) ? 1 : 0;

var clTop = 0;
var clBot = 18;

var clTopLinks = 0;
var clBotLinks = 16;

var menuPrefix = "mnu";
var menuCurrent = null;
var menuCurrentName = "";
var menuBarPrePostFix = "&nbsp;&nbsp;&nbsp;";
var bAktienSubisOpen = true;
var bAnleihenSubisOpen = true;
var bDevisenSubisOpen = true;
var bWirtschaftSubisOpen = true;
var bPulldownsActive = true;
var ly = -2 * menuBarHeight;
var mndis = 4;

var bsubmenu = false;
var bMapOver = false;

var armenuPosLinks = new Array();
var armenuPosLinks_neu = new Array();
var hauptnaviarray = new Array();
var hauptnaviarray2 = new Array();
var lastsrc="";
// Adressierung ab Server fuer statische Seiten
var  sHref = "";
var sHost= window.location.host.toLowerCase();
if (sHost.indexOf("195.")> -1 || sHost.indexOf("wsfe")> -1 || sHost.indexOf("localhost")> -1)  sbase = "http://"+sHost+"/IN/INtemplates/faznet/";
if (sbase == "")
{
   if (sHost=="faz.net")  
	{
		sHref = "http://faz.net"
	} else
	{
		sHref = "http://www.faz.net";
    }
} else {
  sHref = sbase.replace(/\/IN\/INtemplates\/faznet/gi,"");
}
alert(sHref);

for (i=1;i<10;i++) {
	hauptnaviarray[i-1] = makeImgSrcTag("img/navigation/ebene1_"+i+"h.gif");
	hauptnaviarray2[i-1] = makeImgSrcTag("img/navigation/ebene1_"+i+".gif");
}

var icontiparray= new Array();
var icontiparray2= new Array();
icontiparray[7]= makeImgSrcTag("img/head/h1_roll7.gif");
icontiparray2[7] = makeImgSrcTag("img/head/h1_roll7h.gif");
icontiparray[8] = makeImgSrcTag("img/head/h1_roll8.gif");
icontiparray2[8] = makeImgSrcTag("img/head/h1_roll8h.gif");
icontiparray[9] = makeImgSrcTag("img/head/h1_roll9.gif");
icontiparray2[9] = makeImgSrcTag("img/head/h1_roll9h.gif");
icontiparray[10] = makeImgSrcTag("img/head/h1_roll10.gif");
icontiparray2[10] = makeImgSrcTag("img/head/h1_roll10h.gif");

var gbUsrLoggedIn = fnIsUserLoggedIn();
var sLogin, sLevel;

function IconChange(thename,thenum)
{
	lastsrc=document.images[thename].src;
	document.images[thename].src = icontiparray2[thenum];
}

function IconChangeBack(thename)
{
	document.images[thename].src = lastsrc;
}

function HauptNaviChange(thename,thenum,on)
{
	//alert("HauptNaviChange(" + thename + ", " + thenum + ", " + on + ")");
	if (on)
	{
		document.images[thename].src = hauptnaviarray[thenum-1];
	} else {
		document.images[thename].src = hauptnaviarray2[thenum-1];
	}
}

var menuTimeout;

function menuClearTimeout()
{
	if(menuTimeout)clearTimeout(menuTimeout);
}

function menuInstallTimeout(TimeoutTime)
{
	menuClearTimeout();
	menuTimeout = setTimeout("menuCloser();", TimeoutTime > 0?TimeoutTime:200);
}

function menuCloser()
{
	if (bMapOver) return; 
	setObjPosVis(document.menu,-300,-300,false);
	
	if(NS4 && document.menu)
	{
		document.menu.document.writeln("");
		document.menu.document.close();
	}
	else if (document.menu != null)
	{
		if(document.menu)document.menu.innerHTML = "";
	}
	menuCurrent = null;
	
}

function getMenuLayer()
{
	if(NS4 && document.layers) return document.layers['menu'];
	if(document.all)return document.all['menu'];
    if(NS6)return document.getElementById('menu');
}

function menuHiLo(menu,hilo)
{
  //alert("menuHiLo(" + menu + ", " + hilo + ")")
  if(NS4)
	 menu.bgColor = hilo?menuBgHiColor:menuBgColor;
  else
	 menu.style.backgroundColor = hilo?menuBgHiColor:menuBgColor;
}

function setObjPosVis(obj,x,y,isVisible)
{
	if(!obj)return;
	
	if(NS4) 
	  {
		ly= -2 * menuBarHeight;
		var objMenuLayer = getMenuLayer();
		
		if(menuCurrent)
		   objMenuLayer.resizeTo(menuWidth,(menuCurrent.length-2) * menuBarHeight + 8 + mndis);
		
		if(!bAktienSubisOpen && menuCurrent.name == "Aktien")
			objMenuLayer.resizeTo(menuWidth, 10 * menuBarHeight + 8 + mndis);
		if(!bAnleihenSubisOpen && menuCurrent.name == "Anleihen")
			objMenuLayer.resizeTo(menuWidth, 6 * menuBarHeight + 8 + mndis);
		if(!bDevisenSubisOpen && menuCurrent.name == "Devisen")
			objMenuLayer.resizeTo(menuWidth, 4 * menuBarHeight + 8 + mndis);
		if(!bWirtschaftSubisOpen && menuCurrent.name == "Wirtschaft")
			objMenuLayer.resizeTo(menuWidth, 8 * menuBarHeight + 8 + mndis);

		if(bWirtschaftSubisOpen && menuCurrent.name == "Wirtschaft")// nur bei offenem Submenu für IAA 2001
			objMenuLayer.resizeTo(menuWidth, 9 * menuBarHeight + 8 + mndis);
			
		obj.left = x;
		obj.top = y;
		obj.visibility = (isVisible?"visible":"hidden");
	  }
	else if (obj != 'undefined' && obj != null)
	  {
		if(NS6)
		  {
			obj.style.left = x;
			obj.style.top = y;
			obj.style.visibility = (isVisible?"visible":"hidden");
		  }
		else
		  {
			obj.style.left = x;
			obj.style.top = y;
			obj.style.posLeft = x;
			obj.style.posTop = y;
			obj.pixelLeft = x;
			obj.pixelTop = y;
			obj.style.visibility = (isVisible?"visible":"hidden");
		  }
	  }
}

// string property
function sprop(name,val)
{
	if(val && val != "")
		return name + '="' + val + '" ';
	return ""; 
}

function navigate(id)
{
 var iposlast = id.lastIndexOf("_");
 var iposfirst = id.indexOf("_");
 var iidnrlast, iidnrfirst;
 var sMenu; 

 if(iposfirst > 0) // Nur ausführen wenn Unterstrich enthalten
  {
   iidnrfirst = id.slice(iposlast + 1, id.length); // Menue-ID ermitteln
   
   if(iposlast == iposfirst) // Wenn nur ein Unterstrich enthalten -> kein Submenue
	  {
	   sMenu =  menuCurrent[iidnrfirst][0].toLowerCase(); // Menue-Bezeichnung auslesen
	   // !!!WICHTIG:Submenue-Überschriften enthalten z.Z. alle den Teilstring 'charts'.
	   //			 Bei Einführung neuer Submenues u.s If-Anweisung mit ODER-Verknüpfung
	   //			 auf neuen Teilstring testen.
	   //			 Z.B.: if(sMenu.indexOf("charts") >= 0 || sMenu.indexOf("beispielsub") >= 0)
	   if(sMenu.indexOf("charts") >= 0 ) //|| sMenu.indexOf("iaa") >= 0) // Ist Menue-Bezeichnung eine Submenue-Überschrift
		  {
           menuItemClick(id); // Investor-Submenue aufklappen/schliessen
		   return;
		  }
	   document.location.href = menuCurrent[iidnrfirst][1]; // Link auslesen und aufrufen
	  }
   else // Es sind zwei Unterstriche enthalten -> SubMenue
	  {
	   iidnrlast = id.slice(iposlast + 1,id.length); // Submenue-ID ermitteln
	   iidnrfirst = id.slice(iposfirst + 1, iposlast); // Menue-ID ermitteln
	   document.location.href = menuCurrent[iidnrfirst][iidnrlast][1]; // Link auslesen und aufrufen
	  }
  }
}

// Eventhandler für NS4-Menu-Layer
function doClick (ev)
{
  var menu;
  var sLink = new String(this.below.document.links[0]);
 
  if(sLink.indexOf("void") >= 0)
	{
	  if(menuCurrent.name == "Aktien")
         menu = "mnu_5";
	  else
         menu = "mnu_3";
	  menuItemClick(menu);// Investor-Submenu auf/zu
	}
  else
    {
	 document.location.href = this.below.document.links[0];
    }
  return true;
}

// Eventhandler für NS-Menu-Layer setzen
function handleEventClick(lay)
{
  lay.captureEvents(Event.CLICK);
  lay.onclick = doClick;
 }

// div tag
function div(xid,width,height,bgcolor)
{
 var out = "";
 if(xid != "menu")
	{
	  return out;
	}
	
	if(NS4)
	  {
		out += "<LAYER ";
		out += sprop("id",xid);
		out += sprop("width",width);
		out += sprop("height",height);
		out += sprop("pagex",0,true);
		out += sprop("pagey",0,true);
	    out += sprop("bgcolor",bgcolor);
	    out += sprop("visibility","hidden");
	  }
	else
	  {
		if(NS6)
		  {
		    out += "<DIV ";
		    out += sprop("id",xid);
		    out += sprop(" style","position:absolute;top:0;left:0;visibility:hidden;width:"+
						   width + ";height:" + height);
		  }
		else
		  {
		    out += "<DIV ";
		    out += sprop("id",xid);
		    out += sprop("style","position:absolute;top:0;left:0;visibility:hidden;background-color:"+
						  bgcolor + ";cursor:hand;width:" + width + ";height:" + height);
		  }
	  }
  return out +">";
}

function e_div()
{
  if(NS4)
	 return "</LAYER>\n";
  
  return "</DIV>\n";
}

function menuItemClick(p)// Öffnet und schließt Submenues in Investor ->(Charts)  -- gibts die noch???
{
	//alert("menuItemClick(" + p + ")");
	var obj;
	var objMenuLayer = getMenuLayer();
    var out = "";
	var sName = menuCurrent.name;

	//alert("about to eval(" + "obj = mbarArray." + p + ")");
	eval("obj = mbarArray."+p);
	ly= -2 * menuBarHeight;

    if(sName == "Aktien")bAktienSubisOpen = (bAktienSubisOpen?false:true);
    if(sName == "Anleihen")bAnleihenSubisOpen = (bAnleihenSubisOpen?false:true);
    if(sName == "Devisen")bDevisenSubisOpen = (bDevisenSubisOpen?false:true);
	if(sName == "Wirtschaft")bWirtschaftSubisOpen = (bWirtschaftSubisOpen?false:true);

	if(obj && obj.hasSub)
	{
		if(NS4)
		  {
            if(sName == "Aktien")
               objMenuLayer.resizeTo(menuWidth,(obj.length + 2) * menuBarHeight + 8 + mndis);
			else
			   objMenuLayer.resizeTo(menuWidth,obj.length * menuBarHeight + 8 + mndis);
			
			if(bAktienSubisOpen && sName == "Aktien" || bAnleihenSubisOpen && sName == "Anleihen" || bDevisenSubisOpen && sName == "Devisen")
		       objMenuLayer.resizeTo(menuWidth, (menuCurrent.length-2) * menuBarHeight + 8 + mndis);

			if(bWirtschaftSubisOpen && sName == "Wirtschaft")
			   objMenuLayer.resizeTo(menuWidth, 9 * menuBarHeight + 8 + mndis);

			out = menuBuild(menuCurrent,0,menuPrefix,0);
	
			objMenuLayer.document.open();
			objMenuLayer.document.write(out);
			objMenuLayer.document.close();
		  }
        else // IE4 u. NS6
          {
            out = menuBuild(menuCurrent,0,menuPrefix,0);
            objMenuLayer.innerHTML = out;
          }
	}

}

// assuming an array contains only strings or sub-arrays (recursively)
function fnArrayToString(item)
{
	if (typeof(item) == "string")
	{
		return item;
	} else if (typeof(item) != "object")
	{
		return "" + item;
	} else {
		var sRet = "(";
		for (var i = 0; i < item.length ; i++ )
		{
			if (i > 0) sRet += ", ";
			sRet += fnArrayToString(item[i])
		}
		sRet += ")";
	}
	return sRet;	
}

function menuBuild(arr,indent,path,distance)
{
	//alert("menuBuild(" + fnArrayToString(arr) + ", " + indent + ", " + path + ", " + distance + ")");

	ly += menuBarHeight;
	var out = "",i;
	var currPath = "";
	
	arr.name = arr[0];
	arr.url = arr[1];
	arr.hasSub = (typeof(arr[2]) == "object");

	currPath = "|" + path;
	
	if(indent > 0)
	{
		var label = arr.name;
		
		if(arr.hasSub) 
		  {
			var iLen = arr.length;
			
			if(bAktienSubisOpen && iLen == 8 && menuCurrent.name == "Aktien")bsubmenu=true;
			if(bAnleihenSubisOpen && iLen == 6 && menuCurrent.name == "Anleihen")bsubmenu=true;
			if(bDevisenSubisOpen && iLen == 4 && menuCurrent.name == "Devisen")bsubmenu=true;
			if(bWirtschaftSubisOpen && iLen == 6 && menuCurrent.name == "Wirtschaft")bsubmenu=true;

			label = label.bold();
		   
			if(NS4)
			   arr.url="javascript:void(null);";
		    if(menuCurrent.name == "Wirtschaft") // nur bei offenem Menu für IAA 2001
			   arr.url = arr[1];
		  }
	
			if(indent == 2)// Text einrücken bei Submenus
     		   label = menuBarPrePostFix+label;
	
    
	var sColor4WinkelGif = menuBgColor.replace("#","");
    var sWinkelGifPath = makeImgSrcTag("img/navigation/winkel_klappmenue_"+sColor4WinkelGif+".gif");
	if(distance == 2  && indent != 2)out += menuDistance();
	if(NS4)// NS 4.7
	  {
	   out += "<table border='0' width='100%' cellspacing='0' cellpadding='0'>";
	   out += "	 <tr>";
	   out += "	   <td width='100%' height='" + menuBarHeight + "' bgcolor='" + menuBorderColorNS + "'>"+
					 "<font size=1>&nbsp;<img src='"+sWinkelGifPath+"' border=0></font>"+
					   "<layer position=absolute left=1 top=" + ly + " bgcolor='" + menuBgColor + "' width=" + (menuWidth-2) + " height='" + menuBarHeight + "'>"+
					     "<font size=1 face='Verdana,Geneva,Helvetica,Arial' color='#000000'>" + menuBarPrePostFix+label + "</font>"+
		                   "<a href='" + arr.url + "'></a>"+
		               "</layer>"+
		           "</td>";
	   out += "	 </tr>";
       out += "</table>";
	   out += "<layer position=absolute left=1 top=" + ly + " width=" + (menuWidth-2) + " height='" + menuBarHeight 
			+ "' onmouseover=menuHiLo(this.below,true); onmouseout=menuHiLo(this.below,false); onload=handleEventClick(this);></layer>";
	  }
	else
	  {
		if(NS6)
	      {
	        out += "<table border='0' width='100%' cellspacing='0' style='border-left:1px solid;border-right:1px solid;border-color:" + menuBorderColor + "'>";
			out += "	<tr valign='top' height='" + menuBarHeight + "' bgcolor='" + menuBgColor + "' onclick=navigate('" + path + "'); onmouseover=menuHiLo(this,true); onmouseout=menuHiLo(this,false); >";
			out += "		<td width='10%'><img src='" + makeImgSrcTag("img/leer.gif") + "' height='4' width='2' border=0><br><img align=left src='" + makeImgSrcTag("img/leer.gif") + "' height='5' width='2' border=0><a class='menuitem' href=" + arr.url + "><img src='"+sWinkelGifPath+"' border=0></a></td>";
			out += "		<td align='left'><a class='menuitem' href=" + arr.url + ">" + label + "</a></td>";
			out += "	</tr>";
			out += "</table>";
		  }
		else // IE
          {
			out += "<table border='0' width='100%' cellspacing='0' style='border-left:1px solid;border-right:1px solid;border-color:" + menuBorderColor + "'>";
			out += "	<tr valign='top' height='" + menuBarHeight + "' bgcolor='" + menuBgColor + "' onclick=navigate('" + path + "'); onmouseover=menuHiLo(this,true); onmouseout=menuHiLo(this,false); >";
			out += "		<td width='14pt'><img src='" + makeImgSrcTag("img/leer.gif") + "' height='4' width='2' border=0><br><img align=left src='" + makeImgSrcTag("img/leer.gif") + "' height='5' width='2' border=0><img src='"+sWinkelGifPath+"' border=0></td>";
			out += "		<td><font class='menuitem'>" + label + "</font></td>";
			out += "	</tr>";
			out += "</table>";
	      }
	  }
		arr.path = path;
		eval("mbarArray."+path+" = arr");
	}
	else
	{
		arr.path = path;
	}
	if(arr.hasSub && !bsubmenu)
	{
		indent++;
		    for(var i=2;i<arr.length;i++)
		      {
			    currPath = path+"_"+i;
			    arr[i].parent = arr;

			    out += menuBuild(arr[i],indent,currPath,i);

//===Nur aktivieren, wenn Submenu für IAA auf-/zuklappbar sein soll=======
/*
		if(!bWirtschaftSubisOpen && arr[i].name.indexOf("IAA") >= 0 )
          {
			
			for(var j=2;j<arr[i].length;j++)
			  {
				currPath = path+"_"+i+"_"+j;
				arr[i][j].parent = arr;
				
				out += menuBuild(arr[i][j],2,currPath,0);
			  
			  }
		  
		  }
*/
//========================================================================
			  }

		    indent--;

	}
	bsubmenu=false;
	if(indent == 0 && arr.length > 2) // Menu Abschluss-Image anfügen
	   out += "<div><img border='0' width=" + menuWidth + " height=8 src='" + makeImgSrcTag(newMenuBottomPic) + "'></div>";

	return out;
}

function menuDistance()
{
	
	var out = "";
	if(NS4)// NS 4.7
	  {
	   out += "<table border='0' width='100%' cellspacing='0' cellpadding='0'>";
	   out += "	 <tr>";
	   out += "	   <td width='100%' height='" + mndis + "' >"+
					   "<layer position=relativ left=0 top=0 bgcolor='" + menuBorderColorNS + "' width=" + menuWidth + " height='" + mndis + "'>"+
		               "</layer>"+
		           "</td>";
	   out += "	 </tr>";
       out += "</table>";
	   out += "<layer position=relativ left=1 top=0 bgcolor='" + menuBgColor + "' width=" + (menuWidth-2) + " height='" + mndis + "'></layer>";
	  }
	else
	  {
		if(NS6)
	      {
	        out += "<table border='0' width='100%' cellspacing='0' style='border-left:1px solid;border-right:1px solid;border-color:" + menuBorderColor + "'>";
			out += "	<tr height='" + mndis + "' bgcolor='" + menuBgColor + "'>";
			out += "		<td height='" + mndis + "' width='" + (menuWidth-4) + "'><spacer type='block' height='" + mndis + "' width='" + (menuWidth-4) + "'></td>";
			out += "	</tr>";
			out += "</table>";
		  }
		else // IE
          {
			out += "<table border='0' width='100%' cellspacing='0' style='border-left:1px solid;border-right:1px solid;border-color:" + menuBorderColor + "'>";
			out += "	<tr height='" + mndis + "' bgcolor='" + menuBgColor + "'>";
			out += "		<td></td>";
			out += "	</tr>";
			out += "</table>";
	      }
	  }

 ly += mndis;
 return out;
}

function menuBarClick(index)
{
	//alert("menuBarClick(" + index + ")");
	ly = -2 * menuBarHeight;
	var menu1 = getMenuLayer();

	if(menuCurrent == mbarArray[index])
	   return;
		
	menuCurrent = mbarArray[index];
	//alert("menuCurrent:" + fnArrayToString(menuCurrent));

	var out = menuCurrent.menuString;

	if(!out || 1)
	{
		out = menuBuild(menuCurrent,0,menuPrefix,0);
		menuCurrent.menuString = out;
	}
	if(NS4 && menu1)
	{
		menu1.document.writeln(out);
		menu1.document.close();
	}
	else if (''+menu1 != 'undefined' && menu1 != null)
	{
      menu1.innerHTML = out;
	}

	menuTurnOn(index);

	return false;
}

function menuTurnOn(index) {
	//alert("menuTurnOn(" + index + ")");

	if (bPulldownsActive != true) return;

	var startY = 8;
	var menu = document.menu;

	if(NS4 && menu)
	{
		menu.menuTop = document.layers["menuTopLayer"];
		startY = menu.menuTop.pageY;
	}
	else if (menu != 'undefined' && menu != null)
	{
		if(!menu)return;
		if(NS6)
		   menu.menuTop = document.getElementById("menuTopDiv");
		else
		   menu.menuTop = document.all["menuTopDiv"];

		startY = menu.menuTop.offsetTop;

		if (startY < 10 || isNaN(startY)) startY = 130;
		
	}

  var startX = armenuPos[index + 1][2];
  if (startX + menuWidth > 773) startX = 773- menuWidth;

  if(is.platform == "win32")
	{
	if (NS7_1)
		  setObjPosVis(menu,startX ,startY-3,true);
	  else if(NS6)
		  setObjPosVis(menu,startX ,startY-19,true);
	  else if (NS4)
		  setObjPosVis(menu,startX ,startY-17,true);
	  else
		  setObjPosVis(menu,startX ,startY,true);
  } else
  {
    if(NS6)
		  setObjPosVis(menu,startX ,startY-19,true);
	  else if (NS4)
		  setObjPosVis(menu,startX ,startY-14,true);
	  else
		  setObjPosVis(menu,startX ,startY-18,true);
  }
}

function menuFinish(index) // Aufruf extern
{
	var out = "";
	if(NS4)
	   out = div("menu",menuWidth,0,null) + e_div();
	else
	   out = div("menu",menuWidth,0,null) + e_div();

	document.writeln(out);
	document.menu = getMenuLayer();
	
	if(!document.menu)return;
	document.menu.onMouseOver = menuClearTimeout;
	document.menu.onMouseOut = menuInstallTimeout;
	document.menu.onmouseover = menuClearTimeout;
	document.menu.onmouseout = menuInstallTimeout;
	return false;
}

function fnGenNaviMap(name, arr, top, bot) {
	//alert("fnGenNaviMap(" + name + ", " + fnArrayToString(arr) + ", " + top + ", " + bot + ")");
	var out = "";
	var i = 0;

	out += "<MAP NAME='" + name + "'>";
	//if ((typeof(arr) != "object") || (typeof(mbarArray) != "object")) alert ("arr or mbarArray not an object: " + typeof(arr) + ", " + typeof(mbarArray) );
	// arr[1 ... length-1]  kontra  mbarArray[0 ... length-1]
	for (i=1 ; (i < arr.length) && (i <= mbarArray.length); i++)
	{
		//alert("mbarArray[" + i + "][1]: " + mbarArray[i][1]);
		out += "<AREA SHAPE='RECT' COORDS='" + (arr[i][0]) + "," + top + " " + (arr[i][1]) + "," + bot + "' ";
		out += "HREF='"+ mbarArray[i - 1][1] +"' onMouseOver='mapOver(" + i + ",true);menuBarClick(" + (i - 1) + ")' ";
		out += "onMouseOut='mapOver(" + i + ",false);menuInstallTimeout(200)' >";
	}

	out += "</MAP>";

	return out;
}
map = fnGenNaviMap;	// because lots of external pages will call this for a while

function mapLinks_neu(name, arr, top, bot) {
	//alert("mapLinks_neu(" + name + ", " + fnArrayToString(arr) + ", " + top + ", " + bot + ")");
	var out = "";
	var i = 0;

	// Positionen der Links (1.Ebene)
	armenuPosLinks[1]=new Array(1,16,1,sLogin_LogoutLink);
	armenuPosLinks[2]=new Array(18,81,18,sLnk_MyData);
	armenuPosLinks[3]=new Array(82,111,82,sLnk_Mail);
	armenuPosLinks[4]=new Array(112,173,113,sLnk_MySite);
	armenuPosLinks[5]=new Array(174,221,156,sLnk_Portfolio);
	armenuPosLinks[6]=new Array(222,255,255,sLnk_Shop);

	out += "<MAP NAME='" + name + "'>";

	// arr[1 ... length-1]  kontra  mbarArray[0 ... length-1]
	for (i=1 ; (i < arr.length) && (i <= armenuPosLinks.length); i++)
	{
		
		out += "<AREA SHAPE='RECT' COORDS='" + (arr[i][0]) + "," + top + " " + (arr[i][1]) + "," + bot + "' ";
		out += "HREF=" + '"' +  armenuPosLinks[i][3] + '"' +  " onMouseOver='mapOverLinks(" + i + ",true)' ";
		out += "onMouseOut='mapOverLinks(" + i + ",false)' >";
	}

	out += "</MAP>";
	
	return out;
}

function highlightcurrent(menuName) {
	//alert("highlightcurrent(" + menuName + ")");
	if (armenuPos.length != null)
	{
		for (var i = 1; i < armenuPos.length  ; i++)
		{
			if (menuName == armenuPos[i][3])
			{
				highlight(i);
				break;
			}
		}
		menuCurrentName = menuName;
	}
}

function highlight(which) {
	if (!ver4) { return; }
    //Bugfix NS6/7
	var hight = false;
     if (IE4) {hight = (document.all.elMenuOver2)? true: false;}
			else if (NS6) {hight = (document.getElementById("elMenuOver2"))? true: false;}
			else {hight = (document.elMenu.document.elMenuOver2)? true: false;}
   
	if (hight)
	{
		if (IE4) { whichEl = document.all.elMenuOver2.style; }
			else if (NS6) {whichEl = document.getElementById("elMenuOver2").style;}
			else { whichEl = document.elMenu.document.elMenuOver2;}

		clLeft = armenuPos[which][0];
		clRight = armenuPos[which][1];

		if (NS4) {
				whichEl.clip.left = clLeft;
				whichEl.clip.right = clRight;
		}
		else {
				whichEl.clip = "rect(" + clTop + " " + clRight + " " + clBot + " " + clLeft + ")";
		}

		whichEl.visibility = "visible";
	}
}

function mapOver(which,on) {
	bMapOver = on;
	if (menuCurrentName == armenuPos[which][3]) { return;}
	if (!ver4) { return; }
	if (IE4) { whichEl = document.all.elMenuOver.style; }
		else if (NS6) {whichEl = document.getElementById("elMenuOver").style;}
		else { whichEl = document.elMenu.document.elMenuOver;}

	if (!on) { 
		whichEl.visibility = "hidden"; 
		return;
	}

	clLeft = armenuPos[which][0];
	clRight = armenuPos[which][1];

	if (NS4) {
			whichEl.clip.left = clLeft;
			whichEl.clip.right = clRight;
	}
	else {
			whichEl.clip = "rect(" + clTop + " " + clRight + " " + clBot + " " + clLeft + ")";
	}

	whichEl.visibility = "visible";
}

function mapOverLinks(which,on) {
	if (!ver4) { return;}
	if (IE4) { whichEl = document.all.elMenuOverLinks.style;}
		else if (NS6) {whichEl = document.getElementById("elMenuOverLinks").style;}
		else { whichEl = document.elMenuLinks.document.elMenuOverLinks; }

	if (!on) { whichEl.visibility = "hidden"; return; }

	clLeft = armenuPosLinks[which][0];
	clRight = armenuPosLinks[which][1];

if (NS4) {
		whichEl.clip.left = clLeft;
		whichEl.clip.right = clRight;
}
else {
		whichEl.clip = "rect(" + clTopLinks + " " + clRight + " " + clBotLinks + " " + clLeft + ")";
//alert( "rect(" + clTopLinks + " " + clRight + " " + clBotLinks + " " + clLeft + ")");
}

	whichEl.visibility = "visible"; 
}

function mapOverGlossar(which,on) {
	var whichE2 = null;
	if (!ver4) { return;}
	if (IE4) { whichE2 = document.all.elGlossarOver.style;}
		else if (NS6) {whichE2 = document.getElementById("elGlossarOver").style;}
		else { whichE2 = document.elGlossar.document.elGlossarOver; }
	if (!on) { whichE2.visibility = "hidden"; return; }

    var aPoss = arGlossarPosLinks[which].split(",");
	var Pos1  = aPoss[1];
	var Pos2 = aPoss[2]; 
    var Pos3 = aPoss[3]; 
    var Pos0 = aPoss[0]; 

	if (NS4) {
		whichE2.clip.left = Pos0;
		whichE2.clip.right = Pos2;
	}
	else {
       whichE2.clip = "rect(" + Pos1 + " " + Pos2 + " " + Pos3 + " " + Pos0 + ")";
	}
	whichE2.visibility = "visible"; 
}

function fnShowSite (sSite, sDesk)
{
	window.open(sHref+'/IN/INtemplates/faznet/default.asp?tpl=central/'+sSite+'&site='+sDesk,'PopUp','scrollbars=yes,status=no,resizable=yes,width=535,height=420');
	return;
}

function fnShowAGBSite (sSite)
{
	window.open(sHref+'/IN/INtemplates/faznet/default.asp?tpl=central/'+sSite+'','PopUp','scrollbars=yes,status=no,resizable=yes,width=605,height=460');
	return;
}

function fnShowMailSite (sSite, sDesk)
{
	window.open(sHref+'/IN/INtemplates/faznet/default.asp?tpl=central/'+sSite+'&site='+sDesk,'PopUp','scrollbars=yes,status=no,resizable=yes,width=362,height=506');
	return;
}

function fnShowPrintSite (sSite)
{
	alert("old!! fnShowPrintSite(" + sSite + ")");
	var sURL = (sSite.indexOf('/') == 0)?sSite:'/IN/INtemplates/faznet/default.asp?tpl='+sSite;
//	alert("sURL: " + sURL);
	sURL = fnModify4Premium(sURL);
//	alert("sURL: " + sURL);
	window.open(sURL,'PopUp','scrollbars=yes,menubar=yes,status=yes,resizable=yes,width=750,height=454,screenX=0,screenY=0');
	return;
}
function fnModify4Premium (sUrl)
{
	alert("old!! fnModify4Premium (" + sUrl + ")");
	var sHost= window.location.host.toLowerCase();
	if (sHost.indexOf("premium-link.net") > -1)
	{
		var iBeg = window.location.pathname.indexOf("$");
		var iEnd = window.location.pathname.indexOf("$",iBeg+1);
		var iEnd2 = window.location.pathname.indexOf("$",iEnd+1);
		var sPremKey = window.location.pathname.substr(iBeg,iEnd2-iBeg+1);
		sPremKey = "http://premium-link.net/" + sPremKey + "/";
		sUrl = sPremKey + sUrl.substr(3);      
		alert("modified URL: " + sUrl);
	}
	return sUrl;
}


function fnGetCookieValue (sCookie, sProp)
{
  var pos = sCookie.indexOf (sProp+'=');
  if (pos != -1) {
    var end = sCookie.indexOf ('&', pos+sProp.length+1);
    if (end == -1) end = sProp.length+1;	// just in case (no trailing '&')
    return sCookie.substring (pos+sProp.length+1, end);
  }
  return;
}

function fnIsUserLoggedIn()
{
  var res = false;
  var sCookie = unescape("" + document.cookie) + ";";
  var pos = sCookie.indexOf("FAZNET=");
  if (pos != -1)
  {
    var end = sCookie.indexOf (';', pos+8);					// Extract cookie 
    var sCookie = sCookie.substring (pos+8, end) + "&";
    sLogin = fnGetCookieValue (sCookie, 'usr');
    if (sLogin)
    {
      sLevel = fnGetCookieValue (sCookie, 'lvl');
      res = true;
    }
  }
  return res;
}

function fnShowUserlogo()
{
  var sMemberIcon = '';
  var slogin = "&lt;Gast&gt;";

  if (sLogin) {
    slogin = "<b>"+ sLogin +"</b>";
	if (sLevel && sLevel != "new") {
	  sMemberIcon = "h1_membericon_"+ sLevel +".gif";
	  document.write("<A href=\"javascript:fnShowVisitenkarte ('"
		+ sLogin + "');\"><img src='" + makeImgSrcTag("img/head/" + sMemberIcon) 
		+ "' width='15' height='10' align='bottom' border='0'></A>");
	} else
	  document.write ('<img src="' + makeImgSrcTag("img/leer.gif") + ' width="15" height="10" align="bottom" border="0">');
  }
  document.write("&nbsp;" + slogin);
}

function fnOpenForenThemen()
{
  window.open(sHref+'/IN/INtemplates/faznet/default.asp?tpl=central/coguard.asp&forenthemen=1','PopUp','scrollbars=no,resizable=no,width=268,height=454');
}

function fnShowSizedPopUp (sTemplate, iWidth, iHeight,sUrl)
{
    if (''+sUrl=='undefined')
    {
    sUrl = "http://www.faz.net";
	} else
	{
	sUrl = "http://"+sUrl+"/";
	}
	var PopUp=window.open(sUrl+sTemplate,'PopUp','scrollbars=yes,status=no,resizable=yes,width='+iWidth+',height='+iHeight);
    PopUp.focus();
}

function fnShowVisitenkarte(usrid){
  window.open(sHref+'/d/mysite/mycardshow.aspx?usr='+usrid,'BCard','scrollbars=no,status=no,resizable=yes,width=280,height=550');
  return;
}

function fnShowFalk (preset){
  window.open('http://ri.falk.de/ri.fcg?SET=route&TSET=faz'+preset ,'routenplaner','toolbar=yes,location=no,scrollbars=yes,resizable=no,titlebar=yes,status=yes,directiories=no,width=620,height=665');
  return;
}

function fnShowBasket(){
  window.open('/IN/INtemplates/faznet/default.asp?tpl=central/basket/basket.asp','PopUp','scrollbars=yes,status=no,resizable=yes,width=355,height=120');
  return;
}
function fnSearchMain(form)
{
	if (form.searchWord.value == '')
 	 {	var sAlert = 'Bitte tragen Sie einen Suchbegriff ein.';
	 	alert(sAlert);
		return false;
	 }
	return true;
}

