// JavaScript Document

// functie toegevoegd 3 -12 -2009 wordt o.a. gebruikt bij aanmelding lid
function popup(url){
myWin=window.open(url,'aanmelden','top=75,left=150,width=640,height=550,status=no,toolbar=no,menubar=no,scrollbars=yes');
/* 
myWin=window.open(keus,'top=100,left=150,width=640,height=480,status=no,toolbar=no,menubar=no,scrollbars=no');
*/
}


//functie voor popup toegevoegd in dit bestand op 9-11-2009


function popup2(picture, titel){ 
myWin=window.open('','nieuw_venster','top=0,left=15,width=950,height=725,status=no,toolbar=no,menubar=no,scrollbars=yes');
myWin.document.write('<html><head><title>' , titel , '</title>' );
// myWin.document.write('<meta http-equiv="Page-Enter" content="revealTrans(Duration=1.0,Transition=23)">');
myWin.document.write('</head><body>');
myWin.document.write('<div align="center"> <font size="3">');
myWin.document.write('<p><img border="0" src='+ picture+ '></p>');
myWin.document.write('<form><input type="button" value="sluit venster" onClick="self.close()" /></form>');
myWin.document.write('</font></div>');
myWin.document.write('</body></html>');
}

function popup3(url){
var w = 640;
var h = 800;
myWin=window.open(url,'aanmelden','top=75px,left=150px,width=800px,height=800px,status=no,toolbar=no,menubar=no,scrollbars=yes');
/* 
myWin=window.open(keus,'top=100,left=150,width=640,height=480,status=no,toolbar=no,menubar=no,scrollbars=no');
*/
}


// toegevoegd 3-10-2009
// hiermee wordt de opaciteit van de foto's bepaald 
function lightup(imageobject, opacity){
 if (navigator.appName.indexOf("Netscape")!=-1
  &&parseInt(navigator.appVersion)>=5)
    imageobject.style.MozOpacity=opacity/100
 else if (navigator.appName.indexOf("Microsoft")!= -1 
  &&parseInt(navigator.appVersion)>=4)
    imageobject.filters.alpha.opacity=opacity
}


 /* opgemaakt 2-10-2009, bron PCM okt 2009, functie om spam te vermeiden
 
Voorbeeld van tekst:
E-mail: <script type="text/javascript"> mailto("nicolette.boersma","rondommantelzorg.nl")</script>.
*/
function mailto(voor_ad,na_ad){
	mailadres=(voor_ad + "&#64" + na_ad);
	document.write( "<a href = 'mailto:" + mailadres + "'>"+ mailadres + "</a>");
}

 // opgemaakt op 5-9-2009 voor knoppen met snelkoppeling
function prul(url) { 
var timeID = setTimeout("url", 1);
 }

// Heinle's function for retrieving a cookie.

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

// An adaptation of Dorcht's function for setting a cookie.
function setCookie(name, value, expires, path, domain, secure) {
  document.cookie = name + "=" + escape(value) +
  ((expires == null) ? "" : "; expires=" + expires.toGMTString()) +
  ((path == null) ? "" : "; path=" + path) +
  ((domain == null) ? "" : "; domain=" + domain) +
  ((secure == null) ? "" : "; secure");
}

// An adaptation of Dorcht's function for deleting a cookie.
function delCookie (name,path,domain) {
  if (getCookie(name)) {
    document.cookie = name + "=" +
    ((path == null) ? "" : "; path=" + path) +
    ((domain == null) ? "" : "; domain=" + domain) +
    "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}

var firstCall = true;

function changeFontsize(fSize, increment) {
  if (firstCall) {
    firstCall = false;
    if (increment != "")
      changeFontsize('12', '');
  }
  if (document.getElementsByTagName) {
    tags = new Array ( "p", "td", "li", "ul", "h1", "h2", "h3", "h4", "h5", "h6" );
    for (j=0; j<tags.length; j++) {
      var getElement = document.getElementsByTagName(tags[j]);
      var eachElement, currentFontSize, fontIncrease, newFontSize;
      for (i=0; i<getElement.length; i++) {
        eachElement = getElement[i];
        if (increment != "") {
          currentFontSize = parseInt(eachElement.style.fontSize);
          fontIncrease = parseInt(increment);
          newFontSize = currentFontSize + fontIncrease;
          }
        else if (fSize != "")
          newFontSize = parseInt(fSize);
          setCookie('fontSize', newFontSize);
        if (tags[j] == "li")
          eachElement.style.lineHeight = Math.round(newFontSize*1.2) + "px";
        else
          eachElement.style.lineHeight = Math.round(newFontSize*1.5) + "px";
        if (fSize != "") {
          switch(tags[j]) {
           case "h1": newFontSize += 6; break;
         case "h2": newFontSize += 4; break;
          case "h3": newFontSize += 2; break;
          case "h4": newFontSize += 1; break;
          case "h5": newFontSize += 1; break;
          case "h6": newFontSize += 1;
          }
        }
        eachElement.style.fontSize = newFontSize + "px";
//        setCookie('fontSize', newFontSize); deze regel 75 verplaats naar 59; dit voorkomt dat bij het herladen de lettergrootte steeds groter wordt.
      }
    }
  }
}

function FP_swapImg() {//v1.0
 var doc=document,args=arguments,elm,n; doc.$imgSwaps=new Array(); for(n=2; n<args.length;
 n+=2) { elm=FP_getObjectByID(args[n]); if(elm) { doc.$imgSwaps[doc.$imgSwaps.length]=elm;
 elm.$src=elm.src; elm.src=args[n+1]; } }
}

function FP_preloadImgs() {//v1.0
 var d=document,a=arguments; if(!d.FP_imgs) d.FP_imgs=new Array();
 for(var i=0; i<a.length; i++) { d.FP_imgs[i]=new Image; d.FP_imgs[i].src=a[i]; }
}

function FP_getObjectByID(id,o) {//v1.0
 var c,el,els,f,m,n; if(!o)o=document; if(o.getElementById) el=o.getElementById(id);
 else if(o.layers) c=o.layers; else if(o.all) el=o.all[id]; if(el) return el;
 if(o.id==id || o.name==id) return o; if(o.childNodes) c=o.childNodes; if(c)
 for(n=0; n<c.length; n++) { el=FP_getObjectByID(id,c[n]); if(el) return el; }
 f=o.forms; if(f) for(n=0; n<f.length; n++) { els=f[n].elements;
 for(m=0; m<els.length; m++){ el=FP_getObjectByID(id,els[n]); if(el) return el; } }
 return null;
}
// alternatief font grootte -------------------------------------------------------


// var k = 0;
// var w = 3;
var y = 0;
var klas =  Array ("grootte1", "grootte2", "grootte3", "grootte4") ;

// -------------------------------------------------------------------------------------------
function verwisselStijl() 
{
	var alleAlineas = document.getElementsByTagName('div');
	for (var i=0; i < alleAlineas.length; i++)
	{
		if (w==1) { 
	if (alleAlineas[i].className == klas[0]){
		alleAlineas[i].className = klas[1];
		/*	currentFontSize = parseInt(alleAlineas[i].style.fontSize);
		newFontSize = currentFontSize + 24;
		alleAlineas[i].style.fontSize = newFontSize + "px";
		*/
		}
		
	}
	else{
	if (alleAlineas[i].className == klas[1]){
		alleAlineas[i].className = klas[0];
	}
	}
} 
 if (w==1)  w=0;  else w=1;
}
// --------------------------------------------------------------------------

function startStijl(p){
	var alleAlineas = document.getElementsByTagName('div');
	for (var i=0; i < alleAlineas.length; i++)
	{
	for (var j=0; j < klas.length; j++) 	
	{
	if (alleAlineas[i].className == klas[j]){
		alleAlineas[i].className = klas[p];
		y=p;  //hiermee wordt de start van de cyclus in functie verwisselstijl2 () bepaald 
			}
	}

}
}


function verwisselStijl2() 
{
	
	var alleAlineas = document.getElementsByTagName('div');
	var z = y; y++;  y=y%klas.length;
for (var i=0; i < alleAlineas.length; i++)
	{
		
	if (alleAlineas[i].className == klas[z]){
		alleAlineas[i].className = klas[y];
			}
	}
 setCookie('fontSize', y);
}
		
function grootte1() 
{
	var alleAlineas = document.getElementsByTagName('div');
	for (var i=0; i < alleAlineas.length; i++)
	{
	for (var j=0; j < klas.length; j++) 	
	{
	if (alleAlineas[i].className == klas[j]){
		alleAlineas[i].className = klas[0];
			}
	}
y=0;
setCookie('fontSize', 0);
}
}
	 

function showDiv(id){
	
		obj = document.getElementById(id);
		obj.style.display = "";
	}



function hideDiv(id){
		obj = document.getElementById(id);
		obj.style.display = "none";
	
}
 
function toonPopup() {
	var popUpPanel=document.getElementById("popupPanel");
	popUpPanel.style.display='block';
}

function verbergPopup() {
	var popUpPanel=document.getElementById("popupPanel");
	popUpPanel.style.display = 'none';
}
// ------------------------------------------------------------------------------------
 // 2 nov 2010 twee functies toegevoegd voor de popup van het spreekuur in menurechts

function firstday(jr,mnd){
	dg_vdw = new Array ("zondag", "maandag", "dinsdag", "woensdag", "donderdag", "vrijdag","zaterdag");
	var jr;
	var mnd;
	for(i=2; i<9; i++) {
   		var j = i-1;
  		pieke = new Date(jr,mnd, i);
  		piekje = new Date(jr,mnd, i-1);
  	if (dg_vdw[pieke.getUTCDay()] == dg_vdw[3]) {
	return piekje  
 	i=11;
  	}
	}
}

function firstdaytekst() {
huidigeDatum = new Date()
// let op maand en dag van de week beginnen met 0
// huidigeDatum = new Date(2010,10,3,6)	
dag= 10
var n =0
var tijdvoor = 3600000
var tijdna = 46800000
var tijdlater = 86400000
var tekst = "" 	
	
if (huidigeDatum - firstday(huidigeDatum.getUTCFullYear(), huidigeDatum.getMonth())>=0) {n=1}
if ((huidigeDatum - firstday(huidigeDatum.getUTCFullYear( ), huidigeDatum.getMonth())> 0)&&(huidigeDatum - firstday(huidigeDatum.getUTCFullYear( ), huidigeDatum.getMonth()) < tijdna)){
	n=1
tekst = "het spreekuur is vandaag van 11 uur tot 13 uur<br><br>"
// document.write(tekst )
}
if ((huidigeDatum - firstday(huidigeDatum.getUTCFullYear( ), huidigeDatum.getMonth())>= tijdna)&&(huidigeDatum - firstday(huidigeDatum.getUTCFullYear( ), huidigeDatum.getMonth()) < tijdlater)){
	n=1
tekst = "het spreekuur is vandaag geweest<br><br>"	
// document.write(tekst)
}
tekst += "Het eerstvolgende inloopspreekuur wordt gehouden op: &rArr;  "+ firstday(huidigeDatum.getUTCFullYear( ), huidigeDatum.getMonth()+n).toLocaleDateString()+ '<br>'
document.write(tekst);  
}
