<!--

var varischanged = false;

function SetChanged() {
	varischanged = true;
}
function ClearChanged() {
	varischanged = false;
}

function CheckChanged() {
	if (varischanged)
       {
		   if (confirm('Weet u zeker dat u de gegevens niet wilt opslaan?')) 
		   {
			   varischanged = false;
			   return true;
		   }
		   else
		   {
			   return false;
		   }
		   
		}
	else
  		{return true;}
}

function HistoryBack() {
history.back();
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


function bereken(form) {
myDays= ["Zondag","Maandag","Dinsdag","Woensdag","Donderdag","Vrijdag","Zaterdag","Zondag"]
myMonths= ["Januari","Februari","Maart","April","Mei","Juni","Juli","Augustus","September","Oktober","November","December"]
day = document.ZWANGER_FORM.dag.selectedIndex;
month = document.ZWANGER_FORM.maand.selectedIndex;
year = document.ZWANGER_FORM.jaar.value;
var d = new Date(year,month-1,day);
var today = new Date();
var leader = "";
if (d>today)
  {leader = "Je bent nog niet zwanger.\nLees van te voren het boekje Kinderwens of maak een afspraak bij de verloskundige. \nDe verloskundige kan je van alles vertellen voor je zwanger wordt. \n\nDe uitgerekende datum is:\n";}
else
  {leader = "Gefeliciteerd, je bent zwanger.\nDe uitgerekende datum is:\n\n";}
  
//d.setDate(d.getDate()+280);
d.setTime(d.valueOf()+280*24*60*60*1000);
if (d<today)
  {leader = "Je bent al zwanger geweest.\nDe uitgerekende datum was:\n\n";}

month = d.getMonth()
wday = d.getDay()
day = d.getDate()
year = d.getYear()
if (year<2000) {year=year+1900}
r = leader + myDays[wday] + ", " + day.toString() + " " + myMonths[month] + " " + year.toString() ;
  

document.ZWANGER_FORM.result.value = r;
}

function CheckKeuze() {
          var day,month,year;
          var d = new Date();

          day = document.ZWANGER_FORM.dag.selectedIndex;
          month = document.ZWANGER_FORM.maand.selectedIndex;
          year = document.ZWANGER_FORM.jaar.value;
          
          document.ZWANGER_FORM.dag.selectedIndex;
          document.ZWANGER_FORM.maand.selectedIndex;
          if (document.ZWANGER_FORM.maand.selectedIndex != 0 
               && document.ZWANGER_FORM.jaar.selectedIndex != 0 
               && document.ZWANGER_FORM.dag.selectedIndex != 0 
               && validate()) {
          }
          else {
               alert("Gelieve een keuze te maken."); return false;
          }
     }
     
function validate() {
   if (document.ZWANGER_FORM.maand.selectedIndex == 2 && document.ZWANGER_FORM.dag.selectedIndex > 29) {alert("Er zijn max 29 dagen in Februari."); return false;}
   if (document.ZWANGER_FORM.maand.selectedIndex == 4 && document.ZWANGER_FORM.dag.selectedIndex == 31) {alert("Er zijn maar 30 dagen in April."); return false;}
   if (document.ZWANGER_FORM.maand.selectedIndex == 6 && document.ZWANGER_FORM.dag.selectedIndex == 31) {alert("Er zijn maar 30 dagen in Juni."); return false;}
   if (document.ZWANGER_FORM.maand.selectedIndex == 9 && document.ZWANGER_FORM.dag.selectedIndex == 31) {alert("Er zijn maar 30 dagen in September."); return false;}
   if (document.ZWANGER_FORM.maand.selectedIndex == 11 && document.ZWANGER_FORM.dag.selectedIndex == 31) {alert("Er zijn maar 30 dagen in November."); return false;}
else{
   return true;
    }
}

function recalcbestellingprive() {
    var result;
	var aantal;
    var leader = "";
	result = 0;
	aantal = 0;
	
	if (document.BESTELLEN.chkwens.checked == true) { aantal++;}
	if (document.BESTELLEN.chkzwanger.checked == true) { aantal++;}
	if (document.BESTELLEN.chkborst.checked == true) { aantal++;}
	if (document.BESTELLEN.chkkraam.checked == true) { aantal++;}
	if (document.BESTELLEN.chk04jaar.checked == true) { aantal++;}
	if (document.BESTELLEN.chk414jaar.checked == true) { aantal++;}
	if (document.BESTELLEN.chkpuber.checked == true) { aantal++;}
	if (document.BESTELLEN.chkplanning.checked == true) { aantal++;}
	if (document.BESTELLEN.chkpregnancy.checked == true) { aantal++;}
	if (document.BESTELLEN.chkbreast.checked == true) { aantal++;}
	if (document.BESTELLEN.chkmaternal.checked == true) { aantal++;}
	if (document.BESTELLEN.chkages04.checked == true) { aantal++;}
	
   if  (aantal != 0) {
		result = 3.5 * aantal; 
				leader = "U staat op het punt om " + aantal.toFixed(0)  + " boek(en) te bestellen.\n\nBoeken\n" + aantal.toFixed(0) + " * 3.50 = " + result.toFixed(2) + "\n\nVerzendkosten NL\n1 * 6.00 = 6.00\n\n";
		result = 3.5 * aantal + 6;
		leader = leader + "Totaal " + result.toFixed(2)+ " Euro";
		}
	else
		{leader = "U heeft geen boeken\ngeselecteerd.";}
		
	document.BESTELLEN.result.value = leader;
}



function recalcbestellingprof() {
    var result;
    var verzend;
	var tempresult;
	var btwl;
	var btwh;
	var Prijswens;
	var Prijszwanger;
	var Prijsborst;
	var Prijskraam;
	var Prijs04;
	var Prijs412;
	var Prijspuber;
	var Prijscassette;
	var Prijsblwstd;
	var Prijsblwstdextra;
	var Prijsblwlogo;
	var Prijsblwlogoextra;
	
	verzendnl = 0;
	verzenden = 0;
	result = 0;
	tempresult = 0;
	btwl=0;
	btwh=0;
	
	Prijswens = 101.2;
	Prijszwanger = 69.6;
	Prijsborst = 90.2;
	Prijskraam = 76.8;
	Prijs04 = 79.8;
	Prijs412 = 78.3;
	Prijspuber = 81;

	Prijsparenthood = 33;
	Prijspregnanacy = 27;
	Prijsbreast = 30.8;
	Prijspostnatal = 30;
	Prijsages04 = 94.5;
	
	
	Prijscassette = 27.5; 
	Prijsblwstd = 597;
	Prijsblwstdextra = 300;
	Prijsblwlogo= 145;
	Prijsblwlogoextra= 58;

	  /*
	  
	  Doosprijzen

	Kinderwens =1
	Zwanger =2
	Borstvoeding =3
	Kraam =4
	0-4 jaar =5
	4-12 jaar =6
	Puberteit =7
	
	zie database

*/
	


	var aantwens = 0;
	if (isnumeric(document.BESTELLEN.aant1.value)) {
		aantwens = document.BESTELLEN.aant1.value;
		if (aantwens < 0) { aantwens = 0;}
		} else {document.BESTELLEN.aant1.value = 0}


	var aantzwanger;
	aantzwanger=0;
	if (isnumeric(document.BESTELLEN.aant2.value)) { 
		aantzwanger = document.BESTELLEN.aant2.value;
		if (aantzwanger < 0) { aantzwanger = 0;}
		} else {document.BESTELLEN.aant2.value = 0}
	
	var aantborst;
	aantborst=0;
	if (isnumeric(document.BESTELLEN.aant3.value)) { 
		aantborst = document.BESTELLEN.aant3.value;
		if (aantborst < 0) { aantborst = 0;}
		} else {document.BESTELLEN.aant3.value = 0}
	
	var aantkraam;
	aantkraam=0;
	if (isnumeric(document.BESTELLEN.aant4.value)) { 
		aantkraam = document.BESTELLEN.aant4.value;
		if (aantkraam < 0) { aantkraam = 0;}
		} else {document.BESTELLEN.aant4.value = 0}
	
	var aant04jaar;
	aant04jaar=0;
	if (isnumeric(document.BESTELLEN.aant5.value)) { 
		aant04jaar = document.BESTELLEN.aant5.value;
		if (aant04jaar < 0) { aant04jaar = 0;}
		} else {document.BESTELLEN.aant5.value = 0}
	
	var aant412jaar;
	aant412jaar=0;
	if (isnumeric(document.BESTELLEN.aant6.value)) { 
		aant412jaar = document.BESTELLEN.aant6.value;
		if (aant412jaar < 0) { aant412jaar = 0;}
		} else {document.BESTELLEN.aant6.value = 0}
		
	var aantpuber;
	aantpuber=0;
	if (isnumeric(document.BESTELLEN.aant7.value)) { 
		aantpuber = document.BESTELLEN.aant7.value;
		if (aantpuber < 0) { aantpuber = 0;}
		} else {document.BESTELLEN.aant7.value = 0}
		
		
	var aantparenthood;
	aantparenthood=0;
	if (isnumeric(document.BESTELLEN.aant9.value)) { 
		aantparenthood = document.BESTELLEN.aant9.value;
		if (aantparenthood < 0) { aantparenthood = 0;}
		} else {document.BESTELLEN.aant9.value = 0}
	
	var aantpregnanacy;
	aantpregnanacy=0;
	if (isnumeric(document.BESTELLEN.aant10.value)) { 
		aantpregnanacy = document.BESTELLEN.aant10.value;
		if (aantpregnanacy < 0) { aantpregnanacy = 0;}
		} else {document.BESTELLEN.aant10.value = 0}
	
	var aantbreast;
	aantbreast=0;
	if (isnumeric(document.BESTELLEN.aant11.value)) { 
		aantbreast = document.BESTELLEN.aant11.value;
		if (aantbreast < 0) { aantbreast = 0;}
		} else {document.BESTELLEN.aant11.value = 0}
	
	var aantpostnatal;
	aantpostnatal=0;
	if (isnumeric(document.BESTELLEN.aant12.value)) { 
		aantpostnatal = document.BESTELLEN.aant12.value;
		if (aantpostnatal < 0) { aantpostnatal = 0;}
		} else {document.BESTELLEN.aant12.value = 0}
	
	var aantages04;
	aantages04=0;
	if (isnumeric(document.BESTELLEN.aant15.value)) { 
		aantages04 = document.BESTELLEN.aant15.value;
		if (aantages04 < 0) { aantages04 = 0;}
		} else {document.BESTELLEN.aant15.value = 0}
	
	var aantcassette;
	aantcassette=0;
	if (isnumeric(document.BESTELLEN.aantcassette.value)) { 
		aantcassette = document.BESTELLEN.aantcassette.value;
		if (aantcassette < 0) { aantcassette = 0;}
		} else {document.BESTELLEN.aantcassette.value = 0}
	
	var aantbladwstd;
	aantbladwstd=0;
	if (isnumeric(document.BESTELLEN.aantbladwstd.value)) { 
		aantbladwstd = document.BESTELLEN.aantbladwstd.value;
		if (aantbladwstd < 0) { aantbladwstd = 0;}
		} else {document.BESTELLEN.aantbladwstd.value = 0}
	
	var aantbladwlogo;
	aantbladwlogo=0;
	if (isnumeric(document.BESTELLEN.aantbladwlogo.value)) { 
		aantbladwlogo = document.BESTELLEN.aantbladwlogo.value;
		if (aantbladwlogo < 0) { aantbladwlogo = 0;}
		} else {document.BESTELLEN.aantbladwlogo.value = 0}
	
	if (aantwens > 0) {
		if (verzendnl == 0) { verzendnl = 4;}
		verzendnl = verzendnl + 11 * aantwens;
		
		tempresult = Prijswens * aantwens;
		btwl = btwl + 0.06 * tempresult;
			
		document.BESTELLEN.res1.value = tempresult.toFixed(2)
		result = result + tempresult;
			
	} else {document.BESTELLEN.res1.value = 0}
				
	if (aantzwanger > 0) {
		if (verzendnl == 0) {verzendnl = 4;}
		verzendnl = verzendnl + 11 * aantzwanger;

		tempresult = Prijszwanger * aantzwanger;
		btwl = btwl + 0.06 * tempresult;
			
		document.BESTELLEN.res2.value = tempresult.toFixed(2)
		result = result + tempresult;
			
	} else {document.BESTELLEN.res2.value = 0}

	if (aantborst > 0) {
		if (verzendnl == 0) {verzendnl = 4;}
		verzendnl = verzendnl + 11 * aantborst;

		tempresult = Prijsborst * aantborst;
		btwl = btwl + 0.06 * tempresult;

		document.BESTELLEN.res3.value = tempresult.toFixed(2)
		result = result + tempresult;
		
	} else {document.BESTELLEN.res3.value = 0}

	if (aantkraam > 0) {
		if (verzendnl == 0) {verzendnl = 4;}
		verzendnl = verzendnl + 11 * aantkraam;

		tempresult = Prijskraam * aantkraam;
		btwl = btwl + 0.06 * tempresult;
			
		document.BESTELLEN.res4.value = tempresult.toFixed(2)
		result = result + tempresult;
			
	} else {document.BESTELLEN.res4.value = 0}

	if (aant04jaar > 0) {
		if (verzendnl == 0) {verzendnl = 4;}
		verzendnl = verzendnl + 11 * aant04jaar;

		tempresult = Prijs04 * aant04jaar;
		btwl = btwl + 0.06 * tempresult;
			
		document.BESTELLEN.res5.value = tempresult.toFixed(2)
		result = result + tempresult;
			
	} else {document.BESTELLEN.res5.value = 0}

	if (aant412jaar > 0) {
		if (verzendnl == 0) {verzendnl = 4;}
		verzendnl = verzendnl + 11 * aant412jaar;

		tempresult = Prijs412 * aant412jaar;
		btwl = btwl + 0.06 * tempresult;
			
		document.BESTELLEN.res6.value = tempresult.toFixed(2)
		result = result + tempresult;
			
	} else {document.BESTELLEN.res6.value = 0}
	
	if (aantpuber > 0) {
		if (verzendnl == 0) {verzendnl = 4;}
		verzendnl = verzendnl + 11 * aantpuber;

		tempresult = Prijspuber * aantpuber;
		btwl = btwl + 0.06 * tempresult;
			
		document.BESTELLEN.res7.value = tempresult.toFixed(2)
		result = result + tempresult;
			
	} else {document.BESTELLEN.res7.value = 0}
	
	
	
	
	if (aantparenthood > 0) {
		if (verzenden == 0) {verzenden = 6;}
		verzenden = verzenden + 5 * aantparenthood;

		tempresult = Prijsparenthood * aantparenthood;
		btwl = btwl + 0.06 * tempresult;
			
		document.BESTELLEN.res9.value = tempresult.toFixed(2)
		result = result + tempresult;
			
	} else {document.BESTELLEN.res9.value = 0}
	
	if (aantpregnanacy > 0) {
		if (verzenden == 0) {verzenden = 6;}
		verzenden = verzenden + 5 * aantpregnanacy;

		tempresult = Prijspregnanacy * aantpregnanacy;
		btwl = btwl + 0.06 * tempresult;
			
		document.BESTELLEN.res10.value = tempresult.toFixed(2)
		result = result + tempresult;
			
	} else {document.BESTELLEN.res10.value = 0}
	
	
	if (aantbreast > 0) {
		if (verzenden == 0) {verzenden = 6;}
		verzenden = verzenden + 5 * aantbreast;

		tempresult = Prijsbreast * aantbreast;
		btwl = btwl + 0.06 * tempresult;
			
		document.BESTELLEN.res11.value = tempresult.toFixed(2)
		result = result + tempresult;
			
	} else {document.BESTELLEN.res11.value = 0}
	
	
	if (aantpostnatal > 0) {
		if (verzenden == 0) {verzenden = 6;}
		verzenden = verzenden + 5 * aantpostnatal;

		tempresult = Prijspostnatal * aantpostnatal;
		btwl = btwl + 0.06 * tempresult;
			
		document.BESTELLEN.res12.value = tempresult.toFixed(2)
		result = result + tempresult;
			
	} else {document.BESTELLEN.res12.value = 0}
	
	if (aantages04 > 0) {
		if (verzenden == 0) {verzenden = 6;}
		verzenden = verzenden + 5 * aantages04;

		tempresult = Prijsages04 * aantages04;
		btwl = btwl + 0.06 * tempresult;
			
		document.BESTELLEN.res15.value = tempresult.toFixed(2)
		result = result + tempresult;
			
	} else {document.BESTELLEN.res15.value = 0}
	
	
	

	if (aantcassette > 0) {
		if (verzendnl == 0) {verzendnl = 4;}
		verzendnl = verzendnl + 11 * aantcassette;

		tempresult = Prijscassette * aantcassette;
		btwl = btwl + 0.06 * tempresult;
			
		document.BESTELLEN.rescassette.value = tempresult.toFixed(2)
		result = result + tempresult;
			
	} else {document.BESTELLEN.rescassette.value = 0}

	if (aantbladwstd > 0) {
		if (verzendnl == 0) {verzendnl = 4;}
		verzendnl = verzendnl + 11 * aantbladwstd;
		tempresult = Prijsblwstd + Prijsblwstdextra * (aantbladwstd - 1); 
		btwh = btwh + 0.19 * tempresult;
		document.BESTELLEN.resbladwstd.value = tempresult.toFixed(2)
		result = result + tempresult;
		
	} else {document.BESTELLEN.resbladwstd.value = 0}

	if (aantbladwlogo > 0) {
		if (verzendnl == 0) {verzendnl = 4;}
		verzendnl = verzendnl + 11 * aantbladwlogo;

		tempresult = Prijsblwlogo + Prijsblwlogoextra * (aantbladwlogo - 1); 
		btwh = btwh + 0.19 * tempresult;
		document.BESTELLEN.resbladwlogo.value = tempresult.toFixed(2)
		result = result + tempresult;
	} else {document.BESTELLEN.resbladwlogo.value = 0}
		
	btwl = btwl + 0.06 * (verzendnl + verzenden);
		
		document.BESTELLEN.resverzendnl.value = verzendnl.toFixed(2)
		document.BESTELLEN.resverzenden.value = verzenden.toFixed(2)
		document.BESTELLEN.resbtwlaag.value = btwl.toFixed(2)
		document.BESTELLEN.resbtwhoog.value = btwh.toFixed(2)
		
		result = result + verzendnl + verzenden + btwl + btwh;
		
		document.BESTELLEN.restotaal.value = result.toFixed(2)

}


var datePickerDivID = "datepicker";
var iFrameDivID = "datepickeriframe";

var dayArrayShort = new Array('Zo', 'Ma', 'Di', 'Wo', 'Do', 'Vr', 'Za');
var dayArrayMed = new Array('Zon', 'Maa', 'Din', 'Woe', 'Don', 'Vri', 'Zat');
var dayArrayLong = new Array('Zondag', 'Maandag', 'Dinsdag', 'Woensdag', 'Donderdag', 'Vrijdag', 'Zaterdag');
var monthArrayShort = new Array('Jan', 'Feb', 'Mar', 'Apr', 'Mei', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dec');
var monthArrayMed = new Array('Jan', 'Feb', 'Mar', 'Apr', 'Mei', 'Juni', 'Juli', 'Aug', 'Sept', 'Okt', 'Nov', 'Dec');
var monthArrayLong = new Array('Januari', 'Februari', 'Maart', 'April', 'Mei', 'Juni', 'Juli', 'Augustus', 'September', 'Oktober', 'November', 'December');
var defaultDateSeparator = "/";        // common values would be "/" or "."
var defaultDateFormat = "dmy"    // valid values are "mdy", "dmy", and "ymd"
var dateSeparator = defaultDateSeparator;
var dateFormat = defaultDateFormat;


function displayDatePicker(dateFieldName, displayBelowThisObject, dtFormat, dtSep)
{
  var targetDateField = document.getElementsByName (dateFieldName).item(0);
 
  // if we weren't told what node to display the datepicker beneath, just display it
  // beneath the date field we're updating
  if (!displayBelowThisObject)
    displayBelowThisObject = targetDateField;
 
  // if a date separator character was given, update the dateSeparator variable
  if (dtSep)
    dateSeparator = dtSep;
  else
    dateSeparator = defaultDateSeparator;
 
  // if a date format was given, update the dateFormat variable
  if (dtFormat)
    dateFormat = dtFormat;
  else
    dateFormat = defaultDateFormat;
 
  var x = displayBelowThisObject.offsetLeft;
  var y = displayBelowThisObject.offsetTop + displayBelowThisObject.offsetHeight ;
 
  // deal with elements inside tables and such
  var parent = displayBelowThisObject;
  while (parent.offsetParent) {
    parent = parent.offsetParent;
    x += parent.offsetLeft;
    y += parent.offsetTop ;
  }
 
  drawDatePicker(targetDateField, x, y);
}

function drawDatePicker(targetDateField, x, y)
{
  var dt = getFieldDate(targetDateField.value );
 
  if (!document.getElementById(datePickerDivID)) {
    var newNode = document.createElement("div");
    newNode.setAttribute("id", datePickerDivID);
    newNode.setAttribute("class", "dpDiv");
    newNode.setAttribute("style", "visibility: hidden;");
    document.body.appendChild(newNode);
  }
 
  var pickerDiv = document.getElementById(datePickerDivID);
  pickerDiv.style.position = "absolute";
  pickerDiv.style.left = x + "px";
  pickerDiv.style.top = y + "px";
  pickerDiv.style.visibility = (pickerDiv.style.visibility == "visible" ? "hidden" : "visible");
  pickerDiv.style.display = (pickerDiv.style.display == "block" ? "none" : "block");
  pickerDiv.style.zIndex = 10000;
 
  refreshDatePicker(targetDateField.name, dt.getFullYear(), dt.getMonth(), dt.getDate());
}


function refreshDatePicker(dateFieldName, year, month, day)
{
  var thisDay = new Date();
 
  if ((month >= 0) && (year > 0)) {
    thisDay = new Date(year, month, 1);
  } else {
    day = thisDay.getDate();
    thisDay.setDate(1);
  }
 
  var crlf = "\r\n";
  var TABLE = "<table cols=7 class='dpTable'>" + crlf;
  var xTABLE = "</table>" + crlf;
  var TR = "<tr class='dpTR'>";
  var TR_title = "<tr class='dpTitleTR'>";
  var TR_days = "<tr class='dpDayTR'>";
  var TR_todaybutton = "<tr class='dpTodayButtonTR'>";
  var xTR = "</tr>" + crlf;
  var TD = "<td class='dpTD' onMouseOut='this.className=\"dpTD\";' onMouseOver=' this.className=\"dpTDHover\";' ";    
  var TD_title = "<td colspan=5 class='dpTitleTD'>";
  var TD_buttons = "<td class='dpButtonTD'>";
  var TD_todaybutton = "<td colspan=7 class='dpTodayButtonTD'>";
  var TD_days = "<td class='dpDayTD'>";
  var TD_selected = "<td class='dpDayHighlightTD' onMouseOut='this.className=\"dpDayHighlightTD\";' onMouseOver='this.className=\"dpTDHover\";' ";    
  var xTD = "</td>" + crlf;
  var DIV_title = "<div class='dpTitleText'>";
  var DIV_selected = "<div class='dpDayHighlight'>";
  var xDIV = "</div>";
 
  var html = TABLE;
 
  html += TR_title;
  html += TD_buttons + getButtonCode(dateFieldName, thisDay, -1, "&lt;") + xTD;
  html += TD_title + DIV_title + monthArrayLong[ thisDay.getMonth()] + " " + thisDay.getFullYear() + xDIV + xTD;
  html += TD_buttons + getButtonCode(dateFieldName, thisDay, 1, "&gt;") + xTD;
  html += xTR;
 
  html += TR_days;
  for(i = 0; i < dayArrayShort.length; i++)
    html += TD_days + dayArrayShort[i] + xTD;
  html += xTR;
 
  html += TR;
 
  for (i = 0; i < thisDay.getDay(); i++)
    html += TD + "&nbsp;" + xTD;
 
  do {
    dayNum = thisDay.getDate();
    TD_onclick = " onclick=\"updateDateField('" + dateFieldName + "', '" + getDateString(thisDay) + "');\">";
    
    if (dayNum == day)
      html += TD_selected + TD_onclick + DIV_selected + dayNum + xDIV + xTD;
    else
      html += TD + TD_onclick + dayNum + xTD;
    
    if (thisDay.getDay() == 6)
      html += xTR + TR;
    
    thisDay.setDate(thisDay.getDate() + 1);
  } while (thisDay.getDate() > 1)
 
  if (thisDay.getDay() > 0) {
    for (i = 6; i > thisDay.getDay(); i--)
      html += TD + "&nbsp;" + xTD;
  }
  html += xTR;
 
  var today = new Date();
  var todayString = "Vandaag " + dayArrayMed[today.getDay()] + ", " + monthArrayMed[ today.getMonth()] + " " + today.getDate();
  html += TR_todaybutton + TD_todaybutton;
  html += "<button class='dpTodayButton' onClick='refreshDatePicker(\"" + dateFieldName + "\");'>vandaag</button> ";
  html += "<button class='dpTodayButton' onClick='updateDateField(\"" + dateFieldName + "\");'>sluit</button>";
  html += xTD + xTR;
 
  html += xTABLE;
 
  document.getElementById(datePickerDivID).innerHTML = html;
  adjustiFrame();
}


function getButtonCode(dateFieldName, dateVal, adjust, label)
{
  var newMonth = (dateVal.getMonth () + adjust) % 12;
  var newYear = dateVal.getFullYear() + parseInt((dateVal.getMonth() + adjust) / 12);
  if (newMonth < 0) {
    newMonth += 12;
    newYear += -1;
  }
 
  return "<button class='dpButton' onClick='refreshDatePicker(\"" + dateFieldName + "\", " + newYear + ", " + newMonth + ");'>" + label + "</button>";
}


function getDateString(dateVal)
{
  var dayString = "00" + dateVal.getDate();
  var monthString = "00" + (dateVal.getMonth()+1);
  dayString = dayString.substring(dayString.length - 2);
  monthString = monthString.substring(monthString.length - 2);
 
  switch (dateFormat) {
    case "dmy" :
      return dayString + dateSeparator + monthString + dateSeparator + dateVal.getFullYear();
    case "ymd" :
      return dateVal.getFullYear() + dateSeparator + monthString + dateSeparator + dayString;
    case "mdy" :
    default :
      return monthString + dateSeparator + dayString + dateSeparator + dateVal.getFullYear();
  }
}


function getFieldDate(dateString)
{
  var dateVal;
  var dArray;
  var d, m, y;
 
  try {
    dArray = splitDateString(dateString);
    if (dArray) {
      switch (dateFormat) {
        case "dmy" :
          d = parseInt(dArray[0], 10);
          m = parseInt(dArray[1], 10) - 1;
          y = parseInt(dArray[2], 10);
          break;
        case "ymd" :
          d = parseInt(dArray[2], 10);
          m = parseInt(dArray[1], 10) - 1;
          y = parseInt(dArray[0], 10);
          break;
        case "mdy" :
        default :
          d = parseInt(dArray[1], 10);
          m = parseInt(dArray[0], 10) - 1;
          y = parseInt(dArray[2], 10);
          break;
      }
      dateVal = new Date(y, m, d);
    } else if (dateString) {
      dateVal = new Date(dateString);
    } else {
      dateVal = new Date();
    }
  } catch(e) {
    dateVal = new Date();
  }
 
  return dateVal;
}


function splitDateString(dateString)
{
  var dArray;
  if (dateString.indexOf("/") >= 0)
    dArray = dateString.split("/");
  else if (dateString.indexOf(".") >= 0)
    dArray = dateString.split(".");
  else if (dateString.indexOf("-") >= 0)
    dArray = dateString.split("-");
  else if (dateString.indexOf("\\") >= 0)
    dArray = dateString.split("\\");
  else
    dArray = false;
 
  return dArray;
}


function updateDateField(dateFieldName, dateString)
{
  var targetDateField = document.getElementsByName (dateFieldName).item(0);
  if (dateString)
    targetDateField.value = dateString;
 
  var pickerDiv = document.getElementById(datePickerDivID);
  pickerDiv.style.visibility = "hidden";
  pickerDiv.style.display = "none";
 
  adjustiFrame();
  targetDateField.focus();
 
  if ((dateString) && (typeof(datePickerClosed) == "function"))
    datePickerClosed(targetDateField);
}

function adjustiFrame(pickerDiv, iFrameDiv)
{
  var is_opera = (navigator.userAgent.toLowerCase().indexOf("opera") != -1);
  if (is_opera)
    return;
  
  try {
    if (!document.getElementById(iFrameDivID)) {
      var newNode = document.createElement("iFrame");
      newNode.setAttribute("id", iFrameDivID);
      newNode.setAttribute("src", "javascript:false;");
      newNode.setAttribute("scrolling", "no");
      newNode.setAttribute ("frameborder", "0");
      document.body.appendChild(newNode);
    }
    
    if (!pickerDiv)
      pickerDiv = document.getElementById(datePickerDivID);
    if (!iFrameDiv)
      iFrameDiv = document.getElementById(iFrameDivID);
    
    try {
      iFrameDiv.style.position = "absolute";
      iFrameDiv.style.width = pickerDiv.offsetWidth;
      iFrameDiv.style.height = pickerDiv.offsetHeight ;
      iFrameDiv.style.top = pickerDiv.style.top;
      iFrameDiv.style.left = pickerDiv.style.left;
      iFrameDiv.style.zIndex = pickerDiv.style.zIndex - 1;
      iFrameDiv.style.visibility = pickerDiv.style.visibility ;
      iFrameDiv.style.display = pickerDiv.style.display;
    } catch(e) {
    }
 
  } catch (ee) {
  }
 
}

var toothPickerDivID = "toothPicker";
var iFrameDivID = "toothPickeriframe";

/**
This is the main function you'll call from the onClick event of a button.
Normally, you'll have something like this on your HTML page:

Start Date: <input name="ATooth">
<input type=button value="select" onclick="displaytoothPicker('ATooth');">

That will cause the toothPicker to be displayed beneath the StartDate field 

<input type=button value="select" onclick="displaytoothPicker('ATooth', this);">

*/
function displaytoothPicker(toothFieldName, displayBelowThisObject)
{
  var targetToothField = document.getElementsByName (toothFieldName).item(0);
 
  // if we weren't told what node to display the toothPicker beneath, just display it
  // beneath the date field we're updating
  if (!displayBelowThisObject)
    displayBelowThisObject = targetToothField;
 
  var x = displayBelowThisObject.offsetLeft;
  var y = displayBelowThisObject.offsetTop + displayBelowThisObject.offsetHeight ;
 
  // deal with elements inside tables and such
  var parent = displayBelowThisObject;
  while (parent.offsetParent) {
    parent = parent.offsetParent;
    x += parent.offsetLeft;
    y += parent.offsetTop ;
  }
 
  drawtoothPicker(targetToothField, x, y);
}


/**
Draw the toothPicker object (which is just a table with calendar elements) at the
specified x and y coordinates, using the targetToothField object as the input tag
that will ultimately be populated with a date.

This function will normally be called by the displaytoothPicker function.
*/
function drawtoothPicker(targetToothField, x, y)
{
  // the toothPicker table will be drawn inside of a <div> with an ID defined by the
  // global toothPickerDivID variable. If such a div doesn't yet exist on the HTML
  // document we're working with, add one.
  if (!document.getElementById(toothPickerDivID)) {
    // don't use innerHTML to update the body, because it can cause global variables
    // that are currently pointing to objects on the page to have bad references
    //document.body.innerHTML += "<div id='" + toothPickerDivID + "' class='dpDiv'></div>";
    var newNode = document.createElement("div");
    newNode.setAttribute("id", toothPickerDivID);
    newNode.setAttribute("class", "tpDiv");
    newNode.setAttribute("style", "visibility: hidden;");
    document.body.appendChild(newNode);
  }
 
  // move the toothPicker div to the proper x,y coordinate and toggle the visiblity
  var pickerDiv = document.getElementById(toothPickerDivID);
  pickerDiv.style.position = "absolute";
  pickerDiv.style.left = x + "px";
  pickerDiv.style.top = y + "px";
  pickerDiv.style.visibility = (pickerDiv.style.visibility == "visible" ? "hidden" : "visible");
  pickerDiv.style.display = (pickerDiv.style.display == "block" ? "none" : "block");
  pickerDiv.style.zIndex = 10000;
 
  // draw the toothPicker table
  refreshtoothPicker(targetToothField.name);
}


/**
This is the function that actually draws the toothPicker calendar.
*/
function refreshtoothPicker(toothFieldName)
{
   
  // the calendar will be drawn as a table
  // you can customize the table elements with a global CSS style sheet,
  // or by hardcoding style and formatting elements below
  var crlf = "\r\n";
  var TABLE = "<table cols=1 class='tpTable'>" + crlf;
  var xTABLE = "</table>" + crlf;
  var TR_closebutton = "<tr class='tpButtonTR'>";
  var TR_image = "<tr class='tpImageTR'>";
  var xTR = "</tr>" + crlf;
  var TD_closebutton = "<td class='tpButtonTD'>";
  var TD_image = "<td class='tpImageTD'>";
  var xTD = "</td>" + crlf;
 
  // start generating the code for the calendar table
  var html = TABLE;
 
  html += TR_image + TD_image;
  html += "<img src=\"/gfx/images/melkgebid2.png\" width=\"173\" height=\"181\" border=\"0\" usemap=\"#Teeth\">";
  html += "<map name=\"Teeth\">";
  html += "<area shape=\"circle\" coords=\"56,17,7\" title=\"Linker snijtand linksboven\" onClick='updateToothField(\"" + toothFieldName + "\", \"4\");'/>";
html += "<area shape=\"circle\" coords=\"75,11,7\" title=\"Middelste snijtand linksboven\" onClick='updateToothField(\"" + toothFieldName + "\", \"5\");'/>";
html += "<area shape=\"circle\" coords=\"99,10,7\" title=\"Middelste snijtand rechtsboven\" onClick='updateToothField(\"" + toothFieldName + "\", \"6\");'/>";
html += "<area shape=\"circle\" coords=\"119,16,8\" title=\"Rechter snijtand rechtsboven\" onClick='updateToothField(\"" + toothFieldName + "\",\"7\");'/>";
html += "<area shape=\"circle\" coords=\"133,29,8\" title=\"Hoektand rechtsboven\" onClick='updateToothField(\"" + toothFieldName + "\", \"8\");'/>";
html += "<area shape=\"circle\" coords=\"139,108,14\" title=\"Achterste kies rechtsonder\" onClick='updateToothField(\"" + toothFieldName + "\", \"11\");'/>";
html += "<area shape=\"circle\" coords=\"150,74,14\" title=\"Achterste kies rechtsboven\" onClick='updateToothField(\"" + toothFieldName + "\", \"10\");'/>";
html += "<area shape=\"circle\" coords=\"145,49,12\" title=\"Voorste kies rechtsboven\" onClick='updateToothField(\"" + toothFieldName + "\", \"9\");'/>";
html += "<area shape=\"circle\" coords=\"131,136,13\" title=\"Voorste kies rechtsonder\" onClick='updateToothField(\"" + toothFieldName + "\", \"12\");'/>";
html += "<area shape=\"circle\" coords=\"120,155,7\" title=\"Hoektand rechtsonder\" onClick='updateToothField(\"" + toothFieldName + "\", \"13\");'/>";
html += "<area shape=\"circle\" coords=\"110,168,7\" title=\"Rechter snijtand rechtsonder\" onClick='updateToothField(\"" + toothFieldName + "\", \"14\");'/>";
html += "<area shape=\"circle\" coords=\"92,170,7\" title=\"Middelste snijtand rechtsonder\" onClick='updateToothField(\"" + toothFieldName + "\", \"15\");'/>";
html += "<area shape=\"circle\" coords=\"79,171,6\" title=\"Middelste snijtand linksonder\" onClick='updateToothField(\"" + toothFieldName + "\", \"16\");'/>";
html += "<area shape=\"circle\" coords=\"63,165,7\" title=\"Linker snijtand linksonder\" onClick='updateToothField(\"" + toothFieldName + "\", \"17\");'/>";
html += "<area shape=\"circle\" coords=\"46,156,8\" title=\"Hoektand linksonder\" onClick='updateToothField(\"" + toothFieldName + "\", \"18\");'/>";
html += "<area shape=\"circle\" coords=\"32,139,11\" title=\"Voorste kies linksonder\" onClick='updateToothField(\"" + toothFieldName + "\", \"19\");'/>";
html += "<area shape=\"circle\" coords=\"24,110,15\" title=\"Achterste kies linksonder\" onClick='updateToothField(\"" + toothFieldName + "\", \"20\");'/>";
html += "<area shape=\"circle\" coords=\"21,74,15\" title=\"Achterste kies linksboven\" onClick='updateToothField(\"" + toothFieldName + "\", \"1\");'/>";
html += "<area shape=\"circle\" coords=\"30,46,12\" title=\"Voorste kies linksboven\" onClick='updateToothField(\"" + toothFieldName + "\", \"2\");'/>";
html += "<area shape=\"circle\" coords=\"39,28,9\" title=\"Hoektand linksboven\" onClick='updateToothField(\"" + toothFieldName + "\", \"3\");'/>";
  html += "</map>";
  html += xTD + xTR;


  html += TR_closebutton + TD_closebutton;
  html += "<button class='tpButton' onClick='updateToothField(\"" + toothFieldName + "\");'>close</button>";
  html += xTD + xTR;
 
  // and finally, close the table
  html += xTABLE;
 
  document.getElementById(toothPickerDivID).innerHTML = html;
  // add an "iFrame shim" to allow the toothPicker to display above selection lists
  adjustiFrame();
}



function updateToothField(toothFieldName, tooth)
{
  var targetToothField = document.getElementsByName (toothFieldName).item(0);
  if (tooth)
   targetToothField.value = tooth;
 
  var pickerDiv = document.getElementById(toothPickerDivID);
  pickerDiv.style.visibility = "hidden";
  pickerDiv.style.display = "none";
 
  adjustiFrame();
  targetToothField.focus();
 
  // after the toothPicker has closed, optionally run a user-defined function called
  // toothPickerClosed, passing the field that was just updated as a parameter
  // (note that this will only run if the user actually selected a date from the toothPicker)
  if ((dateString) && (typeof(toothPickerClosed) == "function"))
    toothPickerClosed(targetToothField);
}

function confirmdel(delCheckName, boodschap, box) {
	var targetDelField = document.getElementsByName (delCheckName).item(0);
	if (box == 0) {
		if (targetDelField.checked ) {
			var answer = confirm(boodschap);
	    	targetDelField.checked = answer;
		}
	} else {
		if (targetDelField.checked ) {
		} else {
			var answer = confirm(boodschap);
	    	targetDelField.checked = answer;
		}
	}
}

function doubleconfirmdel(delCheckName, boodschap, box, element1) {
	var targetDelField = document.getElementsByName (delCheckName).item(0);
	if (box == 0) {
		if (targetDelField.checked ) {
			var answer = confirm(boodschap);
			if (answer) {
				answer = confirm('Bevestig nogmaals het verwijderen van het kind.');
		    }
			targetDelField.checked = answer;
			if (answer) {
				element1 = document.getElementById(element1);   
				element1.style.display = 'block';   
			}
		}
	} else {
		if (targetDelField.checked ) {
		} else {
			var answer = confirm(boodschap);
			if (answer) {
				answer = confirm('Bevestig nogmaals het verwijderen van het kind.');
			}
	    	targetDelField.checked = answer;
			if (answer) {
				element1 = document.getElementById(element1);   
				element1.style.display = 'block';   
			}
		}
	}
}

function toggleElement(element1) {   
	element1 = document.getElementById(element1);   
	if (element1.style.display == 'block' || element1.style.display == '')      
		element1.style.display = 'none';   
	else      
		element1.style.display = 'block';   
}

function toggleMijlpaalElement(element1, element2) {   
	element1 = document.getElementById(element1);   
	element2 = document.getElementById(element2);   
	if (element1.style.display == 'block' || element1.style.display == '') {
		element1.style.display = 'none';
		element2.style.display = 'block';   
	} else {
		element1.style.display = 'block';
		element2.style.display = 'none';   
	}
}

-->


