  function switchStijl(object,actie){
	  if (actie == "hover") {
		  onrustStatus();
	  }
  	  var uiterstRechts = 634;
	  var pijltonen     = false;
	  var vanafLinks = document.getElementById(object.id).offsetLeft;
	  var eindeKnop  = document.getElementById("na"+object.id).offsetLeft;
	  //if (object.id != selectedHfdKnp) {
		  object.className = "hoofdmenuitem" + actie;
	  //}
	  var breedte = eindeKnop - vanafLinks;
	  var midden  = Math.floor(breedte / 2);
	  if (hideTimerPijl){
		window.clearTimeout(hideTimerPijl);
		window.clearTimeout(hideTimerSubmenu);
		window.clearTimeout(toonRust);
	  }

	  if (actie == "") {
        hideTimerPijl = window.setTimeout("document.getElementById(\"pijltje\").style.display = \"none\"",1000);
        hideTimerSubmenu = window.setTimeout("document.getElementById(\"submenuinhoud\").style.display = \"none\"",1000);
		toonRust = window.setTimeout("rustStatus()",1000);
		pijltonen = true;
	  }
	  else {
		var inhoud = "";
		var submenuBreedte = 10;
		for (i = 0; i < navmenu_array.length; i++) {
			if (navmenu_array[i][0] == object.id){
				inhoud = navmenu_array[i][1];
				submenuBreedte = navmenu_array[i][2];
			}
		}
        document.getElementById("submenuinhoud").innerHTML = inhoud;
		if (inhoud != ""){
			document.getElementById("pijltje").style.display = "block";
	        document.getElementById("submenuinhoud").style.display = "block";
			document.getElementById("pijltje").style.left = (vanafLinks + midden - 6) + 'px';
			pijltonen = true;
		}
		var aflinks  = vanafLinks + midden - Math.floor(submenuBreedte / 2);
		var afrechts = vanafLinks + midden + Math.floor(submenuBreedte / 2);
		if (afrechts > uiterstRechts){
			aflinks = aflinks - (afrechts - uiterstRechts);
			afrechts = uiterstRechts;
		}
		if (aflinks < 0){
			afrechts = afrechts - aflinks;
			aflinks = 0;
		}
		document.getElementById("submenuinhoud").style.left = aflinks + "px";
	  }
	  if (pijltonen == false) {
		  document.getElementById("pijltje").style.display = "none";
	  }
  }

	function switchSubStijl (object, actie){
		if (hideTimerPijl){
			window.clearTimeout(hideTimerPijl);
			window.clearTimeout(hideTimerSubmenu);
			window.clearTimeout(toonRust);
		}
		object.className = "submenuitem" + actie;
		if (actie == ""){
		    hideTimerPijl = window.setTimeout("document.getElementById(\"pijltje\").style.display = \"none\"",1000);
	        hideTimerSubmenu = window.setTimeout("document.getElementById(\"submenuinhoud\").style.display = \"none\"",1000);
			toonRust = window.setTimeout("rustStatus()",1000);
		}
	}

function getElementPosition(object) {
    var offsetTrail = object;
    var offsetLeft = 0;
    var offsetTop = 0;
    while (offsetTrail) {
        offsetLeft += offsetTrail.offsetLeft;
        offsetTop += offsetTrail.offsetTop;
        offsetTrail = offsetTrail.offsetParent;
    }
    if (navigator.userAgent.indexOf("Mac") != -1 && 
        typeof document.body.leftMargin != "undefined") {
        offsetLeft += document.body.leftMargin;
        offsetTop += document.body.topMargin;
    }
    return {left:offsetLeft, top:offsetTop};
}
