// Functions

// Pop Up Window Function
var popUpWin=0;
function popUpWindow(URLStr, left, top, width, height)
{
  //if(popUpWin)
  //{
    //if(!popUpWin.closed) popUpWin.close();
  //}
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menub ar=no,scrollbar=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

function popUpWindowDetail(URLStr, left, top, width, height)
{
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menub ar=no,scrollbar=yes,resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

function getActiveTopic(lvl) {
	var navPrefix = "nav_";

	// 1. check for active topics
	var lvlID = document.getElementsByTagName("BODY")[0].getAttribute("id");
	var newlvlID = lvlID.replace("nav_", "");
	var lvlArr = newlvlID.split("_");
	
	return lvlArr[lvl];
}

function initNav()
{
	navPrefix = "nav";
	lvlAid = getActiveTopic(0);
	lvlBid = getActiveTopic(1);

	var lvlA = document.getElementById(navPrefix+lvlAid);
	if (lvlA) {
		lvlA.className = "activeNavMain";
		if(lvlA.nextSibling && lvlA.nextSibling.nextSibling) {
			lvlA.nextSibling.nextSibling.style.display = "block";
		}
	}
	
	var lvlB = document.getElementById(navPrefix+lvlBid);
	if (lvlB) {
		lvlB.className = "activeNav";
	}
}


window.onload=function(){
    initNav();    
}

function sb_writeMail(rcp) {
	var recipient = rcp;
	var domain = "arnettreuhand.ch";
	var contact = recipient+'@'+domain;
	var construct = '<a href="mailto:'+contact+'">'+contact+'</a>';
	document.write(construct);
}
