// JavaScript Document

function init() {
	setFooter();
	initImage();
}

function initImage() {

	//default tilt and shade
	cvi_instant.defaultShadow = 15; //INT 0-100 (% opacity)
	cvi_instant.defaultColor = '#f4f4f4'; //STR '#000000'-'#ffffff'
	cvi_instant.defaultNoshade = true; //BOOLEAN


	//action
	cvi_instant.add(document.getElementById("img"), { tilt: "right", shadow: 25, shade: 10 });
	//alert('done');
}

// JavaScript Document

startList = function() {
	if (document.all&&document.getElementById) {
	navRoot = document.getElementById("nav");
	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", "");
				}
			}
		}
	}
}
window.onload=startList;

function setFooter() {

	//initImage();
	
	if (document.getElementById) {
		var windowHeight = getWindowHeight() -3;  // ik weet niet waarom, maar zonder deze 3 pixels doet de strict document-type mode vreemd
		
		if (windowHeight > 0) {
			var wrapperHeight = document.getElementById('wrapper').offsetHeight;
			var footerHeight = document.getElementById('onder').offsetHeight;
			var kopHeight = document.getElementById('boven').offsetHeight;
			var topperHeight = kopHeight + footerHeight; 
			var bgbalkHeight = document.getElementById('bgbalk').offsetHeight;
			var maincontentHeight = document.getElementById('midden').offsetHeight;
			//alert(wrapperHeight + " + " + windowHeight);
			
			//if (maincontentHeight+topperHeight > wrapperHeight) {
			//	document.getElementById('wrapper').style.height = maincontentHeight+topperHeight + 'px';
			//}
			
			if (maincontentHeight+topperHeight<windowHeight) {
				document.getElementById('wrapper').style.height = windowHeight + 'px';
				//document.getElementById('frame_bottom').style.top = windowHeight + 'px';
				document.getElementById('middencontainer').style.height = windowHeight-topperHeight + 'px';
				document.getElementById('bgbalk').style.top = windowHeight-bgbalkHeight + 'px';
			} else {
				//document.getElementById('wrapper').style.height = wrapperHeight + 'px';
				document.getElementById('middencontainer').style.height = maincontentHeight + 'px';
				document.getElementById('bgbalk').style.top = maincontentHeight+topperHeight-bgbalkHeight + 'px';
			}
			
	
			}
		}
	}

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;
		}

window.onresize = function() {
	setFooter();
	}
