
sfHover = function() {
	var sfEls = document.getElementById("nav").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"), "");
		}
	}
	
	// Voor submenu's van werkgebieden
  if (document.getElementById("werkgebiedenmenu") != null) {
    var sfOther = document.getElementById("werkgebiedenmenu").getElementsByTagName("li");
	
  	for (var i=0; i<sfOther.length; i++) {
  		sfOther[i].onmouseover=function() {
  			this.className+=" sfhover";
  		}
  		sfOther[i].onmouseout=function() {
  			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
  		}
  	}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);


// Menus werkgebieden en alfabet
function hoverMenu(naam){
	document.getElementById(naam + 'Button').className = naam + 'ButtonHover';
}
function openMenu(naam){
	document.getElementById(naam).style.left = '0px';
	document.getElementById(naam + 'Button').className = naam + 'ButtonActive';
}

function sluitMenu(naam){
	document.getElementById(naam).style.left = '-2000px';
	document.getElementById(naam + 'Button').className = naam + 'Button';
}


//------------------------------------------------------
// init

window.onload = init;
function init(){
  setListlength('rechtszijmenu',10,0)
}
// End init
//------------------------------------------------------


function setListlength(objID,x,c){
  var e = document.getElementById(objID);
  var u = e.getElementsByTagName('UL');
  for(n=0;n<u.length;n++){
    var l = u[n].getElementsByTagName('LI');
    var d = document.createElement('DIV');
    var g = fpn(u[n],'DIV');
    g.appendChild(d);
    generateList(d,l,c,x);
  }
}
function clearList(l,c,x) {
    for(i=c;i<x;i++){
      l[i].style.display="none"
    }
}
function generateList(d,l,c,x) {
    for(i=c;i<x;i++){
      if ( typeof l[i] == 'undefined' ) { break; }
      l[i].style.display="list-item"
    }
    if(l.length<=10){return;}
    var a = d.getElementsByTagName('A');
    
    if (c==0 && x!=l.length){
      d.innerHTML="<p class='pages'>"+(c+1)+" - "+x+" / ("+l.length+")&nbsp;&nbsp;<a href='javascript:void(0);'>&gt;&gt;</a></p>"
      a[0].onclick = function(){ clearList(l,c,x); c=c+10; x=x+10; if (x>l.length){x=(l.length)}; generateList(d,l,c,x); }
    } else if (c>=1 && x>=l.length){
      d.innerHTML="<p class='pages'><a href='javascript:void(0);'>&lt;&lt;</a>&nbsp;&nbsp;"+(c+1)+" - "+x+" / ("+l.length+")</p>"
      a[0].onclick = function(){ clearList(l,c,x); c=c-10; x=x-10; if (c<1){x=(10);c=(0)}; generateList(d,l,c,x); }
    } else {
      d.innerHTML="<p class='pages'><a href='javascript:void(0);'>&lt;&lt;</a>&nbsp;&nbsp;"+(c+1)+" - "+x+" / ("+l.length+")&nbsp;&nbsp;<a href='javascript:void(0);'>&gt;&gt;</a></p>"
      a[0].onclick = function(){ clearList(l,c,x); c=c-10; x=x-10; if (c<1){x=(10);c=(0)}; generateList(d,l,c,x); }
      a[1].onclick = function(){ clearList(l,c,x); c=c+10; x=x+10; if (x>l.length){x=(l.length);c=(l.length-11)}; generateList(d,l,c,x); }
    }
}


function fpn(elem,e){var o=elem;while(o.previousSibling.nodeName!=e.toUpperCase()){o=o.previousSibling;}return o.previousSibling;}

function popup(pId, pUrl, pWidth, pHeight) {
	pTop = screen.height/2 - pHeight/2;
	pLeft = screen.width/2 - pWidth/2;
  var optionString = "toolbar=0, location=0, directories=0, status=0, menubar=0, scrollbars=0, resizable=0, width=" + pWidth + ", height=" + pHeight + ", top=" + pTop + ", left=" + pLeft;
  var aWindow = window.open(pUrl, pId, optionString);
  if (aWindow) {
    aWindow.focus();
    return true;
  } else {
    return false;
  }
}

function setCookie(id) {
	var the_cookie = escape(id);
	var the_date = new Date("December 31, 2050");
        var the_cookie_date = the_date.toGMTString();
	the_cookie = the_cookie + ";expires=" + the_cookie_date;
	document.cookie = the_cookie;
}

function readCookie(id) {
	var the_cookie = document.cookie;
	var the_cookie = unescape(the_cookie);
	if (the_cookie.indexOf(id) >= 0) {
		return true;
	} else {
		return false;
	}
}