/*
	author		Jeroen Butenaerts (formfab.nl)
	copyright	Jeroen Butenaerts (formfab.nl)
				Bobby van der Sluis (refunk.com)
*/
setOnloadEvent(setDivOffsets);

window.onresize = function(){ setDivOffsets(); }

function setDivOffsets(){
	if(document.getElementById){
		var combinedHeight = document.getElementById('linkwrap').offsetHeight + 25;
		var windowHeight = getWindowHeight();
		if(windowHeight > 0){
			if(combinedHeight < windowHeight){
				document.getElementById('topspacer').style.height = ((windowHeight - combinedHeight + 25) / 2) + 'px';
				document.getElementById('bodywrap').style.height = windowHeight + 'px';
			}
			else{
				document.getElementById('bodywrap').style.height = combinedHeight + 'px';
//alert("combinedHeight: "+combinedHeight);
			}
		}
	}
}
function getWindowHeight(){
	var windowHeight = 0;
	if((typeof(window.innerHeight) == 'number')){
		windowHeight = window.innerHeight;
	}
	else if(document.documentElement && document.documentElement.clientHeight){
		windowHeight = document.documentElement.clientHeight;
	}
	else if(document.body && document.body.clientHeight){
		windowHeight = document.body.clientHeight;
	}
	return windowHeight;
}


