
var message='<a href="#top" onclick="if(ie4)this.blur();" title="Naar boven"">^</a>'
function regenerate(){
	window.location.reload();
}
function regenerate2(){
	if (document.layers) setTimeout("window.onresize=regenerate",400);
}

function positionit(){
	var dsocleft=ie4? document.body.scrollLeft : pageXOffset
	var dsoctop=ie4? document.body.scrollTop : pageYOffset
	var window_width=ieNOTopera? document.body.clientWidth : window.innerWidth-20
	var window_height=ieNOTopera? document.body.clientHeight : window.innerHeight

	if (ie4||w3c){
		thNow = parseInt(topmsg_obj.style.top);
		thTarget = parseInt(dsoctop)+parseInt(window_height)-topmsg_obj.offsetHeight-10;
		thNew = Math.abs(thTarget-thNow)<3?thTarget:thNow+parseInt((thTarget-thNow)/6);
		topmsg_obj.style.top=thNew;
	}else if (ns4){
		topmsg_obj.top=dsoctop+window_height-topmsg_obj.document.height-17
	}
}

function setTopLink(){
	if(hasLayers){
		if (ns4){
			topmsg_obj=new Layer(window.innerWidth)
			regenerate2()
			topmsg_obj.document.write(message)
			topmsg_obj.document.close()
			positionit()
			topmsg_obj.visibility="show"
		} else if(ie4||w3c) {
			positionit()
			topmsg_obj.style.visibility="visible"
		}
		setInterval("positionit()",60)
	}
}

function writeTopLink(){
	var docheight=ieNOTopera?document.body.scrollHeight:document.height;
	var window_height=ieNOTopera? document.body.clientHeight : window.innerHeight
	if (docheight>window_height||mac&&ie){
		var doctop=ie4? document.body.scrollTop : window.pageYOffset
		if(arguments[1]) message = arguments[1];
		var tStyle="position:absolute;"+arguments[0]
		tStyle +="visibility:hidden;top:"+(doctop+window_height+2)+";"
		if (ie4||w3c){
			document.body.insertAdjacentHTML('afterBegin','<a name="top"></a>');
			document.body.insertAdjacentHTML('beforeEnd','<div id="topmsg" style="'+tStyle+'" class="toTopLink">'+message+'</div>');
		}
		topmsg_obj=ie4?document.all.topmsg : w3c? document.getElementById("topmsg") : ns4 ? document.layers['topmsg'] :document.topmsg;
		setTopLink()
	}
}

