var originalHeight = 0;

//Menu voor IE
function menu() {
	if (document.all && document.getElementById) {
		navRoot = document.getElementById("cms");
		for (i=0; i<navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.nodeName=="LI") {
				node.onmouseover=function() {
				this.className+=" over";
				}
				node.onmouseout=function() {
				this.className=this.className.replace("over", "");
				}
			
			}
		}
	}
}

//Height = Viewport...
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;
}

function setHeight() {
	if (originalHeight == 0) {
		originalHeight = document.getElementById('opiniepeiler').offsetHeight;
	}
	if (document.getElementById) {
		var windowHeight = getWindowHeight();
		if (windowHeight > 0) {
			var opinieElement = document.getElementById('opiniepeiler');
			var menuElement = document.getElementById('menu');
			var lijnElement = document.getElementById('verticalelijn');
			
			var contentHeight = originalHeight + 400;
			if (windowHeight - contentHeight >= 0) {
					menuElement.style.height = (windowHeight - 154) + 'px';
					lijnElement.style.height = (windowHeight - 20) + 'px';
					opinieElement.style.height = (windowHeight - 440) + 'px';
			}
			else {
				menuElement.style.height = (originalHeight + 247) + 'px';
				lijnElement.style.height = (originalHeight + 380) + 'px';
			}
		}
	}
}


window.onload = function() {
	setHeight();
	//menu() //aanzetten bij submenuitems
}
window.onresize = function() {
	setHeight();
}


