var product_maat_xs;
var product_maat_s;
var product_maat_m;
var product_maat_l;
var product_maat_xl;
var product_maat;
var product_id;
var product_tekoop;

 function ajaxAddtoCart(product_id, product_maat) {
	 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) {
        alert("Your browser is old and does not have AJAX support!");
        return false;
      }
    }
  }
  xmlHttp.onreadystatechange = function() {
    if(xmlHttp.readyState == 4) {
      var responseText = xmlHttp.responseText.split("|");
      document.getElementById('fr_aantal_totaal').innerHTML = responseText[0];
      document.getElementById('fr_subtotaal_totaal').innerHTML = responseText[1];
      alert("Het artikel is nu terug te vinden in uw Winkeltas.");
    }
  }

  var xmlParams = "";
  xmlParams = xmlParams + "product_id=" + product_id + "&";
  xmlParams = xmlParams + "product_maat=" + product_maat + "&";
  xmlParams = xmlParams + "datumtijd=" + datumtijd + "&";      

  xmlHttp.open("GET", "/content/ajax_addtocart.asp?" + xmlParams, true);
  xmlHttp.send(null);
 }

 function ajaxdeleteFromCart(product_id, product_maat) {
	 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) {
        alert("Your browser is old and does not have AJAX support!");
        return false;
      }
    }
  }
  xmlHttp.onreadystatechange = function() {
    if(xmlHttp.readyState == 4) {
      //var responseText = xmlHttp.responseText.split("|");
      //document.getElementById('fr_aantal_totaal').innerHTML = responseText[0];
      //document.getElementById('fr_subtotaal_totaal').innerHTML = responseText[1];
      document.location.href = '/Winkeltas/';
      //alert("Het artikel is nu verwijderd uit uw Winkeltas.");
    }
  }

  var xmlParams = "";
  xmlParams = xmlParams + "product_id=" + product_id + "&";
  xmlParams = xmlParams + "product_maat=" + product_maat + "&";
  xmlParams = xmlParams + "datumtijd=" + datumtijd + "&";      

  xmlHttp.open("GET", "/content/ajax_delfromcart.asp?" + xmlParams, true);
  xmlHttp.send(null);
 }

 function ajaxChangeDetail(product_id) {
	 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) {
        alert("Your browser is old and does not have AJAX support!");
        return false;
      }
    }
  }
  xmlHttp.onreadystatechange = function() {
    if(xmlHttp.readyState == 4) {
      if(xmlHttp.responseText != '') {
        var responseText = xmlHttp.responseText.split("|");
        product_maat_xs = responseText[5];
        product_maat_s  = responseText[6];
        product_maat_m  = responseText[7];
        product_maat_l  = responseText[8];
        product_maat_xl = responseText[9];
        product_maat    = responseText[10];
        //product_id    = responseText[11];
        product_tekoop  = responseText[12];
        if (product_tekoop == "1") {
          document.getElementById('pas_detail_titel').innerHTML = responseText[0];
          document.getElementById('pas_detail_euro').innerHTML  = '&euro; ';
          document.getElementById('pas_detail_prijs').innerHTML = responseText[2];
          document.getElementById('pas_detail_foto').innerHTML = '<img src="/viewdbimg.asp?id=' + responseText[3] + '&maxbreedte=68&maxhoogte=104" width="68" height="104">';
          document.getElementById('pas_detail_maten').innerHTML = responseText[4];
          document.getElementById('pas_detail_text2').style.display = 'block';
          document.getElementById('cont_winkeltas').style.display = 'block';
          document.getElementById('cont_detail').style.display = 'block';
        } else {
          document.getElementById('pas_detail_titel').innerHTML = responseText[0];
          document.getElementById('pas_detail_euro').innerHTML  = '';
          document.getElementById('pas_detail_prijs').innerHTML = '';
          document.getElementById('pas_detail_foto').innerHTML = '<img src="/viewdbimg.asp?id=' + responseText[3] + '&maxbreedte=68&maxhoogte=104" width="68" height="104">';
          document.getElementById('pas_detail_maten').innerHTML = '';

          document.getElementById('pas_detail_text2').style.display = 'none';
          document.getElementById('cont_winkeltas').style.display = 'none';
          document.getElementById('cont_detail').style.display = 'block';
        }
      }
    }
  }

  var xmlParams = "";
  xmlParams = xmlParams + "product_id=" + product_id + "&";
  xmlParams = xmlParams + "datumtijd=" + datumtijd + "&";      

  xmlHttp.open("GET", "/content/ajax_paskamer.asp?" + xmlParams, true);
  xmlHttp.send(null);
 }
