//cookie functies
function setCookie(name, value, expires, path, domain, secure) {
  var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires.toGMTString() : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
  document.cookie = curCookie;
}

function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}

function deleteCookie(name, path, domain) {
  if (getCookie(name)) {
    document.cookie = name + "=" +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}

//einde cookie functies

/* generieke popup functie	*/	
function popup(url,hoogte,breedte)	{
	var height, width;
	if (document.all)
	    height = document.body.offsetHeight, width = document.body.offsetWidth;
	else if (document.layers)
	    height = window.innerHeight, width = window.innerWidth;
		
	var y = (height/4)-0, x = (width/4)-0;
	
	popupvenster = window.open(url,"venster","width="+breedte+",height="+hoogte+",toolbar=0,scrollbars=no,directories=0,status=0,menubar=0,location=0,resizable=0,top=" + y + ",screenY=" + y + ",left=" + x + ",screenX=" + x);
}
		
		
/* show/hide layers */	
function getStyle( layer ) {
	if( document.getElementById ) {
		return document.getElementById( layer ).style
		} 
	else if( document.all ) {
		return document.all[layer].style
		} 
	else {
		return document[layer]
		}
	}


function showLayer(laag)	{
	getStyle(laag).visibility = "visible";
	getStyle(laag).display = "inline";
	}
	
function hideLayer(laag)	{
	getStyle(laag).visibility = "hidden";
	getStyle(laag).display = "none";
	}

	
/* empty formfield */
function makeEmpty(myFormObject)	{
	myFormObject.value = "";
	}
	
	
/* venster herladen als Nav4 resized */
function MM_reloadPage(init) {  
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);




/* Font-size */



window.fontSize = 11;
window.fontSizeTimeout = 250;
window.fontStep = 3;
window.fontMin = 11;
window.fontMax = 17;

//cookie
if(getCookie("fontsize"))	{
	window.fontSize = parseInt(getCookie("fontsize"));
}

function SetFramesFontSize(timeout)	{

    var fs = window.fontSize;
	
    SetFontSize(document.getElementsByTagName("BODY")[0],  fs);
    
	if (typeof content != "undefined")	{
		SetFontSize(content.document.getElementsByTagName("BODY")[0], fs);
	}
	
    if (timeout)

    {
        window.setTimeout("SetFramesFontSize(true)", window.fontSizeTimeout);
    }

}
function SetFontSize(obj, size)	{
    size = Math.round(100 * size) / 100;
    var fs = size + "px";
    if (obj && obj.style)
    {
        if (obj.style.fontSize != fs)
        {
            obj.style.fontSize = fs;
			//opslaan in cookie
			setCookie("fontsize", size);
        }
    }
}

function IncreaseFontSize()
{
    if (window.fontSize < window.fontMax)
    {
        window.fontSize += window.fontStep;
    }
	else	{	//resetten boven de fontMax (1 juni 2005 - jdk)
		 window.fontSize = window.fontMin;
	}
    SetFramesFontSize();
}

function DecreaseFontSize()
{
    if (window.fontSize > window.fontMin)
    {
        window.fontSize -= window.fontStep;
    }
    SetFramesFontSize();
}

function ResetFontSize()
{
  	window.fontSize = 11;
    SetFramesFontSize();
	deleteCookie("fontsize");
}


function nieuwsbriefPopup(nbId,nbaId)	{	//nbId=nieuwsbriefId, nbaId=nieuwsbriefarchiefId - zie tabellen database
	url = "nieuwsbrief.php?nbId="+nbId+"&nbaId="+nbaId;
	hoogte = 400;
	breedte = 500;
	popup(url,hoogte,breedte);
}
	


	
	
