/* Создание нового объекта XMLHttpRequest для общения с Web-сервером */
var xmlHttp = false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
try {
  xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
  try {
    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (e2) {
    xmlHttp = false;
  }
}
@end @*/

if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {
  xmlHttp = new XMLHttpRequest();
}


function boxAddProduct(idgoods,name) {
	//var url = "box_ajax.php?a=add&id="+idgoods;
	var url = "/box.php?config=order&id="+idgoods;

	document.getElementById('show_add_'+name).style.display = '';
	document.getElementById('show_remove_'+name).style.display = 'none';

	xmlHttp.open("GET", url, true);
	xmlHttp.onreadystatechange = boxAddProductAnswer;
	xmlHttp.send(null);
}
function boxAddProductAnswer() {
	if (xmlHttp.readyState == 4) {
		//var response = xmlHttp.responseText;
		//alert('send:'+response);
	}
}

function boxRemoveProduct(idgoods,name) {
	//var url = "box_ajax.php?a=add&id="+idgoods;
	var url = "/box.php?config=order&id="+idgoods;
	
	document.getElementById('show_add_'+name).style.display = 'none';
	document.getElementById('show_remove_'+name).style.display = '';
	
	xmlHttp.open("GET", url, true);
	xmlHttp.onreadystatechange = boxRemoveProductAnswer;
	xmlHttp.send(null);
}
function boxRemoveProductAnswer() {
	if (xmlHttp.readyState == 4) {
		//var response = xmlHttp.responseText;
		//alert('send:'+response);
	}
}
