var aktiv;

function centerPage() {
	var maxHeight = 0;
	var wBTHeightMax = 0;
	var wBCHeightMax = 0;
	var wBRHeightMax = 0;

	var wBlockMain = document.getElementById("wBlockMain");

	var wBlockTop = document.getElementById("wBlockTop");
	if (wBlockTop) {
		var wBTHeight = wBlockTop.offsetHeight;
		if (wBTHeight > wBTHeightMax) wBTHeightMax = wBTHeight;
		var wBTHeight = wBlockTop.clientHeight;
		if (wBTHeight > wBTHeightMax) wBTHeightMax = wBTHeight;
	}

	var wBlockContent = document.getElementById("wBlockContent");
	if (wBlockContent) {
		var wBCHeight = wBlockContent.offsetHeight;
		if (wBCHeight > wBCHeightMax) wBCHeightMax = wBCHeight;
		var wBCHeight = wBlockContent.clientHeight;
		if (wBCHeight > wBCHeightMax) wBCHeightMax = wBCHeight;
	}
	var wBlockRight = document.getElementById("wBlockRight");
	if (wBlockRight) {
		var wBRHeight = wBlockRight.offsetHeight;
		if (wBRHeight > wBRHeightMax) wBRHeightMax = wBRHeight;
		var wBRHeight = wBlockRight.clientHeight;
		if (wBRHeight > wBRHeightMax) wBRHeightMax = wBRHeight;
	}

	var maxHeight = wBCHeightMax;
	if (wBRHeightMax > maxHeight) maxHeight = wBRHeightMax;
	maxHeight = maxHeight + wBTHeightMax;

	var windowValue = getWinSize(window);
	var windowHeight = windowValue.height;
	var marginTop = (windowHeight - maxHeight) / 2 - 50;

	if (marginTop < 0) marginTop=0;

	marginTop = marginTop + "px";
	var wBlockMain = document.getElementById("wBlockMain");
	if (wBlockMain) {
		wBlockMain.style.paddingTop = marginTop;
	}
}
////////////////////////////////////////////////////////////
// getWinSize(window)
function getWinSize(win)
{
    if(!win) win = window;
    var s = new Object();
    if(typeof win.innerWidth != 'undefined')
    {
        s.width = win.innerWidth;
        s.height = win.innerHeight;
    }
    else
    {
         var obj = getBody(win);
         s.width = parseInt(obj.clientWidth);
         s.height = parseInt(obj.clientHeight);
    }
    return s;
}
////////////////////////////////////////////////////////////
// Der IE hat 2 verschiedene Objekte für den strict und quirks Mode.
function getBody(w)
{
    return (w.document.compatMode && w.document.compatMode == "CSS1Compat") ? w.document.documentElement : w.document.body || null;
}  


/* Navigation */
function showHide(element) {
	var children = element.getElementsByTagName("DIV");
	if (children.length > 0) {
		var firstList=children[0];
		if (firstList.style.display == 'block') {
			firstList.style.display = 'none'
		} else {
			firstList.style.display = 'block'
		}
	}
	return true;
}

/* Sprache */
function selection_mouseOver(element) {
	element.getElementsByTagName("DIV")[0].style.display = "block";
}
function selection_mouseOut(element) {
	element.getElementsByTagName("DIV")[0].style.display = "none";
}

function maskEmail(name, domain) {
	document.writeln('<a href="mailto:'+name+'@'+domain+'">'+name+'@'+domain+'</a>');
}

function popUp1(wintype) {
  var nwl = (screen.width-1000)/2;
  var nwh = (screen.height-790)/2;
  popUp=window.open(wintype, 'PopUp','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=1000,height=790,left='+nwl+',top='+nwh+''); 
  popUp.window.focus(); 
}

// Popup Chairfinder
function popUp2(wintype) {
  var nwl = (screen.width-1050)/2;
  var nwh = (screen.height-800)/2;
  popUp=window.open(wintype, 'PopUp','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=1050,height=800,left='+nwl+',top='+nwh+''); 
  popUp.window.focus(); 
}



function init() {
	centerPage();
}
window.onload = init;
