// die nachfolgende function erstellt ein XMLHttpRequest object
function AJAX() {
  var o = false;
  /*@cc_on @*/
  /*@if (@_jscript_version >= 5)
  try {
    o = new ActiveXObject("Msxml2.XMLHTTP");
  }
  catch (e) {
    try {
      o = new ActiveXObject("Microsoft.XMLHTTP");
    }
    catch (E) {
      o = false;
    }
  }
  @end @*/
  if (!o && typeof XMLHttpRequest != 'undefined') {
    o = new XMLHttpRequest();
  }
  return o;
}
var http = AJAX();

function updateMinishopSumme(url, fldcnt){
  var url = url;
  var fldcnt = fldcnt;

  var vars = '';
  for (i = 1; i <= fldcnt; i++) {
    //alert(document.getElementById('artikel['+i+']').value);
    if (document.getElementById('artikel['+i+']')) {
      vars += '&artikel['+i+']='+document.getElementById('artikel['+i+']').value;
      vars += '&artikelpreis['+i+']='+document.getElementById('artikelpreis['+i+']').value;
    }
  }
  http.abort();
  http.onreadystatechange = handleUpdateMinishopSumme;
  http.open('post', url);
  http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
  http.send('action=summe'+vars);
  //http.send('id='+id+'&display='+document.getElementById(id).style.display);
}

function handleUpdateMinishopSumme() {
  /* Make sure that the transaction has finished. The XMLHttpRequest object
  has a property called readyState with several states:
  0: Uninitialized, 1: Loading, 2: Loaded, 3: Interactive, 4: Finished */
  if (http.readyState == 4) {
    /* We have got the response from the server-side script,
    let's see just what it was. using the responseText property of
    the XMLHttpRequest object. */
    var response = http.responseText;
    /* And now we want to change the product_categories <div> content.
    we do this using an ability to get/change the content of a page element
    that we can find: innerHTML. */
    document.getElementById('summe').value = response;
    //alert(response);
  }
}

function minishopArtikelInfo(id) {
 var id = id;
 var w = window.open('popup.htm?id='+id, 'artikelInfo', 'width=400,height=300,top=60,left=60,resizable=yes,scrollbars=yes');
 w.focus();
 return;
}
