
function initPage(){
	placeLogo ();
	var path = window.location.pathname;
	var lastslash = path.lastIndexOf("/");
	path = path.substring(lastslash+1);
	if (path != "projects.php" && path != "project.php"){
		activateProjekte();
		activateSub();
	} else {
		var pn =  window.document.getElementById("pronavi");
		pn.style.visibility = "visible";
	}
	window.onresize =  placeLogo;
}
function activateProjekte(){
	var projektButton = window.document.getElementById("projekt");
	addEvent(projektButton, 'mouseover', showSubNavi, false);
	addEvent(projektButton, 'mouseout', unShowSubNav, false);
}
function addEvent(elm, evType, fn, useCapture){
	if (elm.addEventListener) {
		elm.addEventListener(evType, fn, useCapture);
		return true;
	} else if (elm.attachEvent) {
		var r = elm.attachEvent('on' + evType, fn);
		return r;
	} else {
		elm['on' + evType] = fn;
	}
}
function activateSub(){
	var proNav = window.document.getElementById("pronavi");
	for (var i = 0; i < proNav.childNodes.length; i++){
		var tmp = proNav.childNodes[i];
		if (tmp.tagName == "A"){
			addEvent(tmp, 'mouseover', showSubNavi, false);
			addEvent(tmp, 'mouseout', unShowSubNav, false);
		}
	}
}
var hider=null;

function placeLogo (){
	//alert(document.documentElement.scrollWidth);
	var myPageWidth = document.documentElement.clientWidth;
	if (myPageWidth == undefined){
		myPageWidth = document.documentElement.scrollWidth;
	}
	if (myPageWidth == undefined){
		myPageWidth = 0;
	}
	var logoElement = window.document.getElementById("logo");
	var x =  Math.round((850 - myPageWidth) / 2);
	if (x > 0) {
		x = 0;
	}
	logoElement.style.left = x+"px";
	logoElement.style.visibility = "visible";
}
function showSubNavi(e){
	clearTimeout(hider);
	var subNav = window.document.getElementById("pronavi");
	subNav.style.visibility = "visible";
	//alert(navigator.vendor);
}
function hideSubNav(){
		var subNav = window.document.getElementById("pronavi");
		subNav.style.visibility = "hidden";
}
function unShowSubNav(e){
	hider = window.setTimeout("hideSubNav()", 500);
	if (window.event){
		var newOb = window.event.toElement;
		var ta = window.event.target;
	} else {
		var newOb = e.relatedTarget;
		var ta = e.target;
	}
}
/*function isKid (par, subj){
	for (var i = 0; i < par.childNodes.length; i++){
		if (par.childNodes[i] == subj){
			return true;
		}
	}
	return false;
}
function trace (str){
	dW = window.document.getElementById("debugger");
	dW.value += "\r"+str;
}*/