
//Gets the browser specific XmlHttpRequest Object 
function getXmlHttpRequestObject() {
 if (window.XMLHttpRequest) {
    return new XMLHttpRequest(); //Mozilla, Safari ...
 } else if (window.ActiveXObject) {
    return new ActiveXObject("Microsoft.XMLHTTP"); //IE
 } else {
    //Display our error message
    alert("Your browser doesn't support the XmlHttpRequest object.");
 }
}

//Our XmlHttpRequest object
var receiveReq = getXmlHttpRequestObject();

//Initiate the AJAX request
function makeRequestVraagjes(url, param) {
//If our readystate is either not started or finished, initiate a new request
 if (receiveReq.readyState == 4 || receiveReq.readyState == 0) {
   //Set up the connection to captcha_test.html. True sets the request to asyncronous(default) 
   receiveReq.open("POST", url, true);
   //Set the function that will be called when the XmlHttpRequest objects state changes
   receiveReq.onreadystatechange = updatePageVraagjes; 

   receiveReq.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
   receiveReq.setRequestHeader("Content-length", param.length);
   receiveReq.setRequestHeader("Connection", "close");

   //Make the request
   receiveReq.send(param);
 }   
}

//Called every time our XmlHttpRequest objects state changes
function updatePageVraagjes() {
 //Check if our response is ready
 if (receiveReq.readyState == 4) {
   //Set the content of the DIV element with the response text
   document.getElementById('subCats').innerHTML = receiveReq.responseText;
   init_sub();
 }
}

//Set the URL
url = 'libs/functions/categorie.php';  
//Called every time when form is perfomed

/* VANAF HIER VRAAGSTELLEN PAGE SUBCATS  */
function getParamHoofdCat1(theForm) {
 //Set up the parameters of our AJAX call
 //var cat1 = theForm._1_.name + "=" + encodeURIComponent( theForm._1_.value );                                                                             
 var cat1 = 0 + "=" + encodeURIComponent( theForm._1_.name);                                                                              
 var postStr = cat1; 
 //Call the function that initiate the AJAX request
 makeRequestVraagjes(url, postStr);
}

function getParamHoofdCat2(theForm) {
  var cat2 = 0 + "=" + encodeURIComponent( theForm._2_.name );
  var postStr = cat2; 
  makeRequestVraagjes(url, postStr);
}
function getParamHoofdCat3(theForm) {
  var cat3 = 0 + "=" + encodeURIComponent( theForm._3_.name );
  var postStr = cat3; 
  makeRequestVraagjes(url, postStr);
}
function getParamHoofdCat4(theForm) {
  var cat4 = 0 + "=" + encodeURIComponent( theForm._4_.name );
  var postStr = cat4; 
  makeRequestVraagjes(url, postStr);
}
function getParamHoofdCat5(theForm) {
  var cat5 = 0 + "=" + encodeURIComponent( theForm._5_.name );
  var postStr = cat5; 
  makeRequestVraagjes(url, postStr);
}
function getParamHoofdCat6(theForm) {
  var cat6 = 0 + "=" + encodeURIComponent( theForm._6_.name );
  var postStr = cat6; 
  makeRequestVraagjes(url, postStr);
}
function getParamHoofdCat7(theForm) {
  var cat7 = 0 + "=" + encodeURIComponent( theForm._7_.name );
  var postStr = cat7; 
  makeRequestVraagjes(url, postStr);
}
function getParamHoofdCat8(theForm) {
  var cat8 = 0 + "=" + encodeURIComponent( theForm._8_.name );
  var postStr = cat8; 
  makeRequestVraagjes(url, postStr);
}
function getParamHoofdCat9(theForm) {
  var cat9 = 0 + "=" + encodeURIComponent( theForm._9_.name );
  var postStr = cat9; 
  makeRequestVraagjes(url, postStr);
}
function getParamHoofdCat10(theForm) {
  var cat10 = 0 + "=" + encodeURIComponent( theForm._10_.name );
  var postStr = cat10; 
  makeRequestVraagjes(url, postStr);
}
function getParamHoofdCat11(theForm) {
  var cat11 = 0 + "=" + encodeURIComponent( theForm._11_.name );
  var postStr = cat11; 
  makeRequestVraagjes(url, postStr);
}
function getParamHoofdCat12(theForm) {
  var cat12 = 0 + "=" + encodeURIComponent( theForm._12_.name );
  var postStr = cat12; 
  makeRequestVraagjes(url, postStr);
}



