// workaround fuer hintergrundbild mainbox hoehe:
function setMainboxHeight(page) {
	document.getElementById("mainbox").style.height = "100%";

	headerHeight = 170;
	
	if(page == "start") {
		add = 330;
		contentHeight = document.getElementById("content").offsetHeight;
	}
	else {
		add = 221;
		contentHeight = document.getElementById("topcontent").offsetHeight + document.getElementById("bottomcontent").offsetHeight;
		
		makeNavActive();
	}
	
	heightOffset = headerHeight + add;
	
	mainboxHeight = document.getElementById("mainbox").offsetHeight;
	
	if((heightOffset + contentHeight) > mainboxHeight) {
		mainboxHeight = contentHeight + heightOffset;
		mainboxHeight = mainboxHeight + "px"
		document.getElementById("mainbox").style.height = mainboxHeight;
	}
}

function navOver(theElement) {
	document.getElementById("subnav"+theElement).style.display = "block";
	document.getElementById("navi2container").style.display = "block";
}

function navOut(theElement) {
	document.getElementById("subnav"+theElement).style.display = "none";	
	document.getElementById("navi2container").style.display = "none";
}

function nav2over(theElement) {
	theElement.style.backgroundColor = "#000000";
	theElement.childNodes[0].style.color = '#ffffff';	
}

function nav2out(theElement) {
	if(theElement.childNodes[0].href != cleanHref()) {
		theElement.style.backgroundColor = "#ffffff";
		theElement.childNodes[0].style.color = '#000000';	
	}
}

function loadHref(theHref) {
	window.location.href = theHref;
}

var myImages = new Array();
function preloadImages() {
    for (i=0;i<preloadImages.arguments.length;i++) {
        myImages[i] = new Image();
        myImages[i].src = preloadImages.arguments[i];
    }
}


function makeNavActive() {
	//navi aktivieren, wenn die href des aktuellen navi-punkts der window.location.href entspricht
	windowHref = cleanHref();
	var links = document.getElementsByTagName('a');
    
    for(var i = 0; tag = links[i]; ++i) {
   	    if(tag.className == 'nav2link') {
   	    	if(links[i].href == windowHref) {
   	    		links[i].parentNode.style.backgroundColor = "#000000";
   	    		links[i].style.color = "#ffffff";
   	    	}
   	    }
    }
}

function cleanHref() {
	windowHref = window.location.href;
	windowHrefArray = windowHref.split(".php");
	windowHref = windowHrefArray[0] + ".php";
	
	return(windowHref);
}