        
function voegKindElementToe(aantalKinderen){        
  
  //tabel = document.getElementById('tabelregistreer');
  tabelBody = document.getElementById('plaatsKinders');
  for(i=1;i<100;i++){
    if(tabelBody.hasChildNodes()){
      tabelBody.removeChild(document.getElementById(i));
    }
    else{
      i = 100;
    }
   }                
  if(aantalKinderen > 0){
	  b = 0;
	  for(a=0;a<aantalKinderen;a++){
	    b = b + 1;
	
	    nieuwTr = document.createElement('tr');
	    nieuwTd = document.createElement('td');
	    nieuwTdInput = document.createElement('td');
	   
	   
	   
	    nieuwTr.setAttribute('id',b);
	    nieuwInput = document.createElement('input');
	    td = document.createTextNode('Leeftijd '+b+'e kind');
	
	    nieuwInput.setAttribute('id','leeftijdKind'+b);
	    nieuwInput.setAttribute('name','leeftijdkind[]');
	    nieuwInput.setAttribute('class','text');
	    nieuwInput.setAttribute('size','3');            
	    nieuwTd.setAttribute('align','right');
	
	    nieuwTd.appendChild(td);
	    nieuwTdInput.appendChild(nieuwInput);
	                            
	    nieuwTr.appendChild(nieuwTd);
	    nieuwTr.appendChild(nieuwTdInput); 
	    tabelBody.appendChild(nieuwTr);         
	  }
	}    
}    
function maakPartner(burgelijkeStaat){
 
  invoegTabel = document.getElementById('TbodyPartner');
  while (invoegTabel.hasChildNodes()){
   invoegTabel.removeChild(invoegTabel.firstChild);
  }
  if((burgelijkeStaat != 'Alleenstaand') && (burgelijkeStaat != 'Gescheiden') && (burgelijkeStaat != 'Weduwe')){         
    nieuwTr           = document.createElement('tr');
    nieuwTdText       = document.createElement('td');
    nieuwTdText.align ='left';
    nieuwText         = document.createTextNode('Voornaam partner');
                
    nieuwTdText.appendChild(nieuwText);
    nieuwTr.appendChild(nieuwTdText); 

    nieuwTdText       = document.createElement('td');
    nieuwTdText.align ='left';
    nieuwInput        = document.createElement('input');
    nieuwInput.name   = "partnerVoornaam";
    
    nieuwTdText.appendChild(nieuwInput);
    nieuwTr.appendChild(nieuwTdText);    
    invoegTabel.appendChild(nieuwTr);
    
    nieuwTr           = document.createElement('tr');
    nieuwTdText       = document.createElement('td');
    nieuwTdText.align ='left';
    nieuwText         = document.createTextNode('Achternaam partner');
                
    nieuwTdText.appendChild(nieuwText);
    nieuwTr.appendChild(nieuwTdText); 

    nieuwTdText       = document.createElement('td');
    nieuwTdText.align ='left';
    nieuwInput        = document.createElement('input');
    nieuwInput.name   = "partnerAchternaam";
    
    nieuwTdText.appendChild(nieuwInput);
    nieuwTr.appendChild(nieuwTdText);    
    invoegTabel.appendChild(nieuwTr);
    
      //Geboortedatum partner
      nieuwTr = document.createElement('tr');
        nieuwTdText = document.createElement('td');
          nieuwText = document.createTextNode('Geboortedatum partner');                  
        nieuwTdGeboortedatumPartner = document.createElement('td');
          nieuwSelectDag = document.createElement('select');                
          nieuwSelectMaand = document.createElement('select');                
          nieuwSelectJaar = document.createElement('select');
        
        //Maak de waardes van de geboortedag
        for(var a = 1;a<32;a++){
          nieuwOption = document.createElement('option');
          nieuwValue = document.createTextNode(a);
          nieuwOption.appendChild(nieuwValue);
          nieuwSelectDag.appendChild(nieuwOption);
        }
        //Maak de waardes van de geboortemaand
        for(var a = 1;a<13;a++){
          nieuwOption = document.createElement('option');
          nieuwValue = document.createTextNode(a);
          nieuwOption.appendChild(nieuwValue);
          nieuwSelectMaand.appendChild(nieuwOption);
        }
        //Maak de waardes van de geboortejaar
        var curdate = new Date();
        var minJaar = curdate.getFullYear() - 99;                
        var maxJaar = curdate.getFullYear() + 1;
        var selectJaar = curdate.getFullYear() - 39;
        
        for(var a = minJaar;a<maxJaar;a++){
          nieuwOption = document.createElement('option');
          nieuwValue = document.createTextNode(a);
          nieuwOption.appendChild(nieuwValue);
            if(a == selectJaar){
              nieuwOption.selected = 'true';
            }
          nieuwSelectJaar.appendChild(nieuwOption);
        }
           
        nieuwTdText.appendChild(nieuwText);
          nieuwTdText.align='left';
        nieuwTr.appendChild(nieuwTdText);
        
        nieuwTdGeboortedatumPartner.appendChild(nieuwSelectDag);
        nieuwTdGeboortedatumPartner.appendChild(nieuwSelectMaand);         
        nieuwTdGeboortedatumPartner.appendChild(nieuwSelectJaar); 
          nieuwSelectDag.id='register_geboortedatumpartnerdag';
          nieuwSelectMaand.id='register_geboortedatumpartnermaand';
          nieuwSelectJaar.id='register_geboortedatumpartnerjaar';
          
          nieuwSelectDag.name='geboortedatumPartnerDag';
          nieuwSelectMaand.name='geboortedatumPartnerMaand';
          nieuwSelectJaar.name='geboortedatumPartnerJaar';
          
            nieuwSelectDag.setAttribute('class', 'text');
            nieuwSelectMaand.setAttribute('class', 'text');
            nieuwSelectJaar.setAttribute('class', 'text');
      nieuwTr.appendChild(nieuwTdGeboortedatumPartner);     
    invoegTabel.appendChild(nieuwTr);              
    //Geslacht Partner
    nieuwTr = document.createElement('tr');
      nieuwTdText = document.createElement('td');
        nieuwTdText.align='left';
        nieuwText = document.createTextNode('Geslacht partner');
      nieuwTdGeslachtPartner = document.createElement('td');                  
      nieuwSelectGeslacht = document.createElement('select');
      nieuwSelectGeslacht.name = "geslachtPartner";
      nieuwSelectGeslacht.setAttribute('class', 'text');
        nieuwOptionMan = document.createElement('option');
        nieuwOptionVrouw = document.createElement('option');
          nieuwTextMan = document.createTextNode('Man');
          nieuwTextVrouw = document.createTextNode('Vrouw');
        nieuwOptionMan.appendChild(nieuwTextMan);
        nieuwOptionVrouw.appendChild(nieuwTextVrouw);
      nieuwSelectGeslacht.appendChild(nieuwOptionMan);
      nieuwSelectGeslacht.appendChild(nieuwOptionVrouw);
      nieuwSelectGeslacht.id='register_sexpartner';
    nieuwTdText.appendChild(nieuwText);
    nieuwTdGeslachtPartner.appendChild(nieuwSelectGeslacht);   
    nieuwTr.appendChild(nieuwTdText); 
    nieuwTr.appendChild(nieuwTdGeslachtPartner); 
    invoegTabel.appendChild(nieuwTr);
    

    
                                            
  } 
}
function switchImg(imgId, imgValue){
	document.getElementById(imgId).src = imgValue;
}
