var OVERFLOW_ELEMENT_TOP_OFFSET = 194;

/* Vraag de clientarea van de browser op. Let op: dit script mag niet in
 * de HEAD van de pagina worden uitgevoerd. Op dat moment bestaat
 * 'document.body' namelijk nog niet.
 * Dus alleen na de BODY tag, op window.onload of op window.onresize.
 */
function getClientSize() {
	if (window.innerWidth){
		// gecko, opera
		return {width:window.innerWidth,height:window.innerHeight};
	} else if (document.documentElement.clientHeight) {
		// IE 6
		return {width:document.documentElement.clientWidth,height:document.documentElement.clientHeight};
	} else if (document.body) {
		// IE 5.x
		return {width:document.body.clientWidth,height:document.body.clientHeight};
	}
	return null;
}

function setOverflowElementSize(width, height)
{
	var overflowElement = document.getElementById('overflow');
	overflowElement.style.width = width + 'px';
	overflowElement.style.height = height + 'px';
}

function resizeOverflowElement(asStyle)
{
	var dw =  getClientSize();
	var newWidth = dw.width;
	if ( newWidth <= 0 ) newWidth = 1;
	var newHeight = dw.height - OVERFLOW_ELEMENT_TOP_OFFSET;
	if ( newHeight <= 0 ) newHeight = 1;

	if (!asStyle) {
		setOverflowElementSize(newWidth, newHeight);
	} else {
		return "#overflow{width:"+newWidth+"px;"+"height:"+newHeight+"px;}";
	}
}

window.onresize = function()
{
	resizeOverflowElement();
}



