
function readCookie(cookieName){
  var searchName = cookieName + "="
  var cookies = document.cookie
  var start = cookies.indexOf(cookieName)
  if (start == -1){ // cookie not found 
    return ""
    }
  start += searchName.length  // start of cookie data  
  var end = cookies.indexOf(";", start)
  if (end == -1){
    end = cookies.length
    }
  return cookies.substring(start, end)
  }

function getCookieExpireDate(noDays){
  var today = new Date()
  var expr = new Date(today.getTime()+noDays*24*60*60*1000)
  return  expr.toGMTString()
  }
function makeCookie(name, noDays){
 


	if (document.forms['navigation'].noord.checked)
	{
	  var data = '0';
	}
	else
	{
	  data = '1';
	}
	if (document.forms['navigation'].zuid.checked)
	{
	  data += '0';
	}
	else
	{
	  data += '1';
	}
	if (document.forms['navigation'].derde.checked)
	{
  	   data +='0';
	}
	else
	{
	  data +='1';
	}
                var cookieStr = name + "=" + data;


  if (makeCookie.arguments.length > 1){
    cookieStr += "; expires=" + getCookieExpireDate(noDays)

    }
  document.cookie = cookieStr
	window.location.reload()
  }

  function initialize ()
  {
       // quit if this function has already been called
       if (arguments.callee.done) return;

       // flag this function so we don't do the same thing twice
       arguments.callee.done = true;

      var nav_cookie = readCookie('nav');

      if ( nav_cookie.charAt(0) == '0')
      { 
         document.forms['navigation'].noord.checked = true;
       }
      if ( nav_cookie.charAt(1) == '0')
      { 
         document.forms['navigation'].zuid.checked = true;
       }
      if ( nav_cookie.charAt(2) == '0')
      { 
         document.forms['navigation'].derde.checked = true;
       }
  };

initialize();
