// JavaScript Document

var isIE=navigator.userAgent.toUpperCase().indexOf("MSIE")!=-1;

function initControlPageUp() {
	setInterval("controlPageUp()", 200);	
}

function controlPageUp() {
	var knopTopRef = document.getElementById("knop_top");

	// skip all if no top button in page
	if (!knopTopRef) return;

	var scrollTop = document.body.scrollTop || (document.documentElement && document.documentElement.scrollTop);
	var docHeight = (isIE)? document.body.clientHeight : document.documentElement.offsetHeight;
	var windowHeight = document.documentElement.clientHeight;
	
	// calculate new relative position
	var newPos = Math.max(docHeight - windowHeight - scrollTop, 0);
	
	// set new relative position
	knopTopRef.style.top = -(newPos) + "px";
	
	// if no scroll, don't show button
	knopTopRef.style.visibility = scrollTop > 0 ? "visible" : "hidden";
}