var stndrdTxt = 10;       //Standaard grote in pt
var currTxt = stndrdTxt;  //Huidige grote
var stndrdlhTxt = 14;     //Standaard lijn-hoogte in pt
var currlhTxt = stndrdlhTxt; //Huidige lijn-hoogte
var stepTxt = 2;          //Pixel omhoog/omlaag
var minTxt = 0;           //Minimale grote. 0 = uit
var maxTxt = 0;           //Maximale grote. 0 = uit
var idTxt = new Array('left', 'text'); //Welke id worden aagetast?

if (readCookie('fontSize') == null) {
    createCookie('fontSize',currTxt,365)
    createCookie('LineHeight',currlhTxt,365)
}
else {
    currTxt = readCookie('fontSize');
    currlhTxt = readCookie('LineHeight');
}

function resize(v) {
	if (!document.getElementById) return;

	if (v == '+-') {
    currTxt = stndrdTxt;
    currlhTxt = stndrdlhTxt;
    
    
    createCookie('fontSize',currTxt,365)
    createCookie('LineHeight',currlhTxt,365)
    
    eraseCookie('fontSize');
    eraseCookie('LineHeight');
  }
	
  if (v == '+') {
    if (maxTxt > 0) {
      if ((currTxt + stepTxt) >= maxTxt) {
	       return false;
      }
    }
    currTxt = eval(currTxt + stepTxt);
    currlhTxt = eval(currlhTxt + stepTxt);
    
    createCookie('fontSize',currTxt,365)
    createCookie('LineHeight',currlhTxt,365)
  }
  
  if (v == '-') {
    if (minTxt < 1) {
      if ((currTxt - stepTxt) <= minTxt) {
	       return false;
      }
    }
    currTxt = eval(currTxt - stepTxt);
    currlhTxt = eval(currlhTxt - stepTxt);
    
    createCookie('fontSize',currTxt,365)
    createCookie('LineHeight',currlhTxt,365)
  }

  for ( i = 0 ; i < idTxt.length ; i++ ) {
    document.getElementById(idTxt[i]).style.fontSize = currTxt + "pt";
    document.getElementById(idTxt[i]).style.lineHeight = currlhTxt + "pt";
  }

	return false;
}

function openWin(link,w,h) {
  w = w || 800;
  h = h || 550;

  LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
  TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
  
  settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',location=0,status=0,menubar=0,directories=0,toolbar=0,resizable=0';
  popped = window.open(link, '',settings);
  
  if (popped == null) {
    alert('De venster wordt geblokkeerd door uw popupblocker.');
  }
  
  return false;
}

function createCookie(name,value,days) {
    if (days) {
        var date = new Date();
        date.setTime(date.getTime()+(days*24*60*60*1000));
        var expires = "; expires="+date.toGMTString();
    }
    else var expires = "";
    document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
    var nameEQ = name + "=";
    var ca = document.cookie.split(';');
    for(var i=0;i < ca.length;i++) {
        var c = ca[i];
        while (c.charAt(0)==' ') c = c.substring(1,c.length);
        if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
    }
    return null;
}

function eraseCookie(name) {
    createCookie(name,"",-1);
}
