
function addToCart(stam_id, voorraad_id, voorraad_aantal) {
  toDay = new Date();
  datumtijd = toDay.getTime();
  var xmlHttp;
  try { xmlHttp = new XMLHttpRequest();
  } catch (e) { try { xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (e) { try { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (e) { return false; } } }
  xmlHttp.onreadystatechange = function() {
    if(xmlHttp.readyState == 4) {
      document.getElementById('bestellenInfo').innerHTML = xmlHttp.responseText;
      updateHeader();
    }
  }
  var xmlParams = "";
  xmlParams = xmlParams + "stam_id=" + stam_id + "&";
  xmlParams = xmlParams + "voorraad_id=" + voorraad_id + "&";
  xmlParams = xmlParams + "voorraad_aantal=" + voorraad_aantal + "&";
  xmlParams = xmlParams + "datumtijd=" + datumtijd + "&";      
  if (checkCookies() == false) {
    alert('Uw browser staat geen \'cookies\' toe,\ncontroleer uw instellingen in uw browser.');
  } else {
    xmlHttp.open("GET", "/content/exec_addtocart.asp?" + xmlParams, true);
    xmlHttp.send(null);
  }
}

function updateHeader() {
  toDay = new Date();
  datumtijd = toDay.getTime();
  var xmlHttp;
  try { xmlHttp = new XMLHttpRequest();
  } catch (e) { try { xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (e) { try { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (e) { return false; } } }
  xmlHttp.onreadystatechange = function() {
    if(xmlHttp.readyState == 4) {
      responseTextString = xmlHttp.responseText;
      responseTextArray = responseTextString.split('||');
      if (responseTextArray[1] != undefined) {
        document.getElementById('header_quantity').innerHTML = responseTextArray[1];
        document.getElementById('header_total').innerHTML = responseTextArray[2];
      } else {
        document.getElementById('header_quantity').innerHTML = 0;
        document.getElementById('header_total').innerHTML = "0,00";
      }
    }
  }
  var xmlParams = "";
  xmlParams = xmlParams + "datumtijd=" + datumtijd + "&";      
  xmlHttp.open("GET", "/content/exec_updateheader.asp?" + xmlParams, true);
  xmlHttp.send(null);
}