//to make ie hover stuff...
sfHover = function() {
	var sfEls = document.getElementById("menu").getElementsByTagName("li");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}




function loadSubMenu(pageID) {
	$('submenu_container').innerHTML = '';
	//load current submenu into submenu-section
	if (!isNaN(pageID)) {	//check if pageID is numeric
		if ($('li'+pageID) != undefined) { //check if li exists
			var oMenu = $('li'+pageID);
			if (oMenu.childNodes.length > 1) { //check if menu has submenu
				var thisTitle = '<h1>' + oMenu.childNodes[0].innerHTML + '</h1>';
				var thisSubMenu = '<ul id=submenu>' + oMenu.childNodes[1].innerHTML + '</ul>';
				$('submenu_container').innerHTML = thisTitle + thisSubMenu;
			}
		}
	}
	return true;
}

// Resize window
function resizeWindow() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
	var margintop = (myHeight  - 580)/2;
	if (margintop<1)margintop = 0;
  $("container").style.margin = margintop+"px auto 0px auto";
}

//functie om pagina te openen via javascript
function go(paginaURL) {
	parent.location.href = paginaURL;
}


// string manipulations ----------------------------------------------------
function Left(str, n){
	if (n <= 0)
	    return "";
	else if (n > String(str).length)
	    return str;
	else
	    return String(str).substring(0,n);
}

function Right(str, n) {
	if (n <= 0) {
		return "";
	} else if (n > String(str).length) {
		return str;
	} else {
		var iLen = String(str).length;
		return String(str).substring(iLen, iLen - n);
	}
}

function trim(str) {
	return str.replace(/^\s*|\s*$/g, "");
}

// -------------------------------------------------------------------------

/* ================ Automatic Popup's ================ */
function setPopLinks() {
	var x = document.getElementsByTagName('a');
 	for (var i=0;i<x.length;i++) {
		if (x[i].className == 'popup' || x[i].className == 'popupNoImg') {
			x[i].onclick = function () {
				return pop(this.href)
			}
			x[i].title += ' (opent in nieuw venster)';
		}
	}
}

function pop(url) {
	newwindow=window.open(url);
	if (window.focus) {newwindow.focus()}
	return false;
}


// -------------------------------------------------------------------------