function centerDiv(vis) {
	if(vis=='visible'){
		document.getElementById("overlayer").style.width = getWindowWidth()+'px';
		document.getElementById("overlayer").style.height = getWindowHeight()+'px';
		document.getElementById("overlayer").style.top=document.body.scrollTop+'px';
	}else{
		document.getElementById("overlayer").style.width = '0px';
		document.getElementById("overlayer").style.height = '0px';
	}

	document.getElementById("popup").style.visibility = vis;
	document.getElementById("overlayer").style.visibility = vis;
	
}
function popUpActions(state) {
	if (state == "visible"){
		centerDiv('visible');
		new Effect.Opacity("overlayer", { from: 0, to: 0.5, duration: 0.15 });
	} else {
		centerDiv('hidden');
		new Effect.Opacity("overlayer", { from: 0.5, to: 0, duration: 0.15 });
	}
}

function globalListener(){
	if(document.getElementById("popup")!=null){
		if (document.getElementById("popup").style.visibility == "visible") {
			centerDiv('visible');
		}
	}
}

function scrollListener(){
	document.getElementById("overlayer").style.top=document.body.scrollTop+'px';
}

function getWindowWidth() {
  var windowWidth = 0;
	
  if (typeof(window.innerWidth) == 'number')
	windowWidth = window.innerWidth;
	
  else {
		
	if (document.documentElement && document.documentElement.clientWidth)
	  windowWidth = document.documentElement.clientWidth;
		
	else {
	  if (document.body && document.body.clientWidth)
		windowWidth = document.body.clientWidth; }; };
				
  return windowWidth;
};

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 loadEvents(){
	if(sIFR != null && sIFR.replaceElement != null){
	sIFR.replaceElement("h1", "swf/tle_groenpas.swf", "#008C37", null, null, "none", 0, 0, 0, 0, null);
	};
	
	if($("content")!=null&&$("sidecolumn_right")!=null){
		if($("content").offsetHeight>$("sidecolumn_right").offsetHeight){
			$("streepje").style.height=($("content").offsetHeight+79)+"px";
		}else if($("sidecolumn_right").offsetHeight>654) {
			$("streepje").style.height=($("sidecolumn_right").offsetHeight+79)+"px";
		}	
	}
}

if (document.getElementById) window.onload = loadEvents;
if (document.getElementById) window.onresize = globalListener;
if (document.getElementById) window.onscroll = scrollListener;