var agt = navigator.userAgent.toLowerCase();
var px = !!(agt.indexOf("msie 5.") > -1 && agt.indexOf('mac_powerpc') > -1) ? 'px' : '';

function winhoogte() {
	var myHeight = 0;
	if( typeof(window.innerWidth) == 'number') {//Non-IE
		myHeight = window.innerHeight;
	} else if(document.documentElement && document.documentElement.clientHeight) {//IE 6+ in 'standards compliant mode'
		myHeight = document.documentElement.clientHeight;
	} else if(document.body && document.body.clientHeight) {//IE 4 compatible
		myHeight = document.body.clientHeight;
	}
	return myHeight;
}

function htmlbodyhoogte(){
	if(!document.body){ return }
	var x=0;
	var test1 = document.body.scrollHeight;
	var test2 = document.body.offsetHeight;
	if (test1 > test2) { // all but Explorer Mac
		x = document.body.scrollWidth;
		return document.body.scrollHeight;
	} else { // Explorer Mac; would also work in Explorer 6 Strict, Mozilla and Safari
		x = document.body.offsetWidth;
		return document.body.offsetHeight;
	}
}

var origResizeHoogte=0;
var eraf = 15;
// if(agt.indexOf("msie ") > -1){ eraf +=24 }// omdat bij htmlbodyhoogte in IE de scrollbar-x erbij geteld wordt...

function resizenav() {
	var windowhoogte = winhoogte() - eraf;
	var contenthoogte = htmlbodyhoogte() - eraf;
	if(windowhoogte < contenthoogte){ return; }
	var tmp = !!(windowhoogte>contenthoogte)?windowhoogte:contenthoogte;
	if(tmp>origResizeHoogte){
		if(document.getElementById && document.getElementById('container')){
			document.getElementById('container').style.height = tmp+'px';
		} else if (document.all && document.all('container')){
			document.all('container').style.height = tmp+px;
		}
		origResizeHoogte=tmp;
	}
}

var wcht=null;
function wacht_resizenav(){
	clearTimeout(wcht);
	wcht=setTimeout("resizenav()", 100);
}

window.onresize=wacht_resizenav;
onload = resizenav;
