// JavaScript Document
function Fensterweite()
{
	if (window.innerWidth){
		return window.innerWidth;
	} else if (document.body && document.documentElement.clientWidth){
		return document.documentElement.clientWidth;
	} else {
		return 0;
	}
}
function Fensterhoehe()
{
	if (window.innerHeight){
		return window.innerHeight;
	} else if (document.documentElement.clientHeight){
		return document.documentElement.clientHeight;
	} else if (document.body.clientHeight){
		return document.body.clientHeight;
	} else {
		return 0;
	}
}
function getScrollXY(whichXY) {
	var scrOfX = 0, scrOfY = 0;
	if( typeof( window.pageYOffset ) == 'number' ) {
		//Netscape compliant
		scrOfY = window.pageYOffset;
		scrOfX = window.pageXOffset;
	} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
		//DOM compliant
		scrOfY = document.body.scrollTop;
		scrOfX = document.body.scrollLeft;
	} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
		//IE6 standards compliant mode
		scrOfY = document.documentElement.scrollTop;
		scrOfX = document.documentElement.scrollLeft;
	}
	if(whichXY == "x"){
		return scrOfX;
	} else if(whichXY == "y"){
		return scrOfY;
	}
}
function setFooterPos(){
	var footerRef = document.getElementById("footer");
	var browserHeight = Fensterhoehe();
	var browserWidth = Fensterweite();
	var minWidth = 975;
	
	browserHeight += getScrollXY("y");
	browserWidth += getScrollXY("x");

	if(browserWidth < minWidth){
		footerRef.style.top = browserHeight - 89 + "px";
	} else {
		footerRef.style.top = browserHeight - 74 + "px";
	}
}
function setFooterHeight(){
	var minWidth = 975;
	var myWidth = Fensterweite();
	var footerRef = document.getElementById("footer");
	if(myWidth < minWidth){
		footerRef.style.height = "35px";
	} else {
		footerRef.style.height = "20px";
	}
	resizeHeader();
}
function resizerListener(){
	setFooterPos();
	//setFooterHeight();
	resizeHeader();
}
function resizeHeader(){
	var minHeight = 642;
	var myHeight = Fensterhoehe();
	if(document.getElementById("mainNav") && document.getElementById("subNav")){
		var mnRef = document.getElementById("mainNav");
		var snRef = document.getElementById("subNav");
		if(document.getElementById("divhome")){
			var divhomeRef = document.getElementById("divhome");
		}
		if(minHeight > myHeight){
			// set header height
			mnRef.style.top = "480px";
			snRef.style.top = "480px";
			if(divhomeRef){
				divhomeRef.style.height = "0px";
			}
		} else {
			mnRef.style.top = "513px";
			snRef.style.top = "513px";
			if(divhomeRef){
				divhomeRef.style.height = "34px";
			}
		}
	}
}
//setFooterPos();
window.onscroll = setFooterPos;
window.onload = setFooterHeight;
window.onresize = resizerListener;
