function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

addLoadEvent(menu);
addLoadEvent(popups);
addLoadEvent(doPrint);

function doPrint() {
	doPrint = document.getElementById("print");
	if(doPrint) {
		print();
	}
}

function popups() {
	var links=document.getElementsByTagName("a");
	for(i=0;i<links.length;i++) {
		if (links[i].className.indexOf("popup") >= 0) {
			links[i].onclick=function() {
				openPopup(this.href,"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=yes,copyhistory=0,width=450,height=450");
				return false;
			}
		}
	}
}

function openPopup(href,winopts) {
	smallwindow=window.open(href,"Popup",winopts);
	smallwindow.focus();
}

function menu() {
	if (window.attachEvent) { 
		// IE does not do :hover on <li> ==> add a class onmouseover
		sfHover();
	} 
}

function sfHover() {
	var BUA = navigator.userAgent;
	var BIE = BUA.indexOf("MSIE");
	var BIsIE = BIE>=0;

	var menu = document.getElementById("navigation");
	if(menu) {
		var uls = menu.getElementsByTagName('ul');
		var ul = uls[0];
		var lis = ul.getElementsByTagName('li');
		for(i=0;i<lis.length;i++) {
			if(lis[i].parentNode == ul) {
				// enkel die LIs die subitems hebben
				lis[i].onmouseover=function() {this.className+=" sfhover";}
				lis[i].onmouseout=function() {this.className=this.className.replace(new RegExp(" sfhover\\b"), "");}
							
				//all is normal till here. If we're using IE then this tells any first level item to have a width of 1px
				//lis[i].style.width = '1px';
			}
		}
	}
}

