// JavaScript Document
function checkFontSize()
{
	//*zelf toegevoegd: telt het aantal beschikbare divs en sluit alle divs behalve de aangewezen div
	var howmanyaltDivs;
	var d;
	howmanyaltDivs = count_altDivs();

	//lees cookie
	var x = readCookie('fontcookie');
	if(x) {
		document.getElementById('content').style.fontSize = x;
  		document.getElementById('navigatie').style.fontSize = x;
  		
		for(d = 0; d < howmanyaltDivs; d++) {
			document.getElementById('altdiv'+(d+1)).style.fontSize = x;
		}
	}
	else { 
		document.getElementById('content').style.fontSize = 11;
  		document.getElementById('navigatie').style.fontSize = 11;
		for(d = 0; d < howmanyaltDivs; d++) {
			document.getElementById('altdiv'+(d+1)).style.fontSize = 11;
		}
	}
}

function changeFontSize(inc)
{
	//*zelf toegevoegd: telt het aantal beschikbare divs en sluit alle divs behalve de aangewezen div
	var howmanyaltDivs;
	var d;
	howmanyaltDivs = count_altDivs();

	if(document.getElementById('content').style.fontSize)
	{
	  var size = parseInt(document.getElementById('content').style.fontSize.replace("px", ""));
	} else {
	  var size = 11;  
	}
	document.getElementById('content').style.fontSize = size+inc+ 'px';
	document.getElementById('navigatie').style.fontSize = size+inc+ 'px';
	for(d = 0; d < howmanyaltDivs; d++) {
	  document.getElementById('altdiv'+(d+1)).style.fontSize = size+inc+ 'px';
	}
	//set cookie met nieuwe fontsize
	createCookie('fontcookie',size+inc+'px',365);
}
  
function resetFontSize()
{
	//*zelf toegevoegd: telt het aantal beschikbare divs en sluit alle divs behalve de aangewezen div
	var howmanyaltDivs;
	howmanyaltDivs = count_altDivs();

	var x = eraseCookie('fontcookie');
	document.getElementById('content').style.fontSize = 11+'px';
  	document.getElementById('navigatie').style.fontSize = 11+'px';
	for(d = 0; d < howmanyaltDivs; d++) {
		document.getElementById('altdiv'+(d+1)).style.fontSize = 11+'px';
	}
}
	

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);
}


  //var p = document.getElementsByTagName('div');
  //for(n=0; n<p.length; n++) {
  //  if(p[n].style.fontSize) {
  //     var size = parseInt(p[n].style.fontSize.replace("px", ""));
  //  } else {
  //     var size = 12;
  //  }
  //  p[n].style.fontSize = size+inc + 'px';
  // }
//}


function dirFoto(nr) {
 var the_width=740;
 var the_height=580;	<!-- screen.height*0.7 //-->
 // set window position
 var from_top=20;
 var from_left=20;
 // set other attributes
 var has_toolbar='no';
 var has_location='no';
 var has_directories='no';
 var has_status='no';
 var has_menubar='no';
 var has_scrollbars='yes';
 var is_resizable='yes';
	attr ='width='+the_width+',height='+the_height+',top='+from_top+',screenY='+from_top+',left='+from_left+',screenX='+from_left;
 	attr +=',toolbar='+has_toolbar+',location='+has_location+',directories='+has_directories+',status='+has_status;
 	attr +=',menubar='+has_menubar+',scrollbars='+has_scrollbars+',resizable='+is_resizable;  
sList = window.open("dir_personalia.php?nr="+nr, "list",attr);
}


//*zelf toegevoegde functie
function count_altDivs() {
		var allDIVS = document.getElementsByTagName('DIV');
		var el, i = 0, howmany = 0;
		while (el = allDIVS.item(i++)) if (el.id.substr(0,6) == 'altdiv') howmany++;
		return howmany;
}

