var oXmlHttp;

function OnSetReductionCode(){
	var strData = 'cmd=setreductioncode&code=' + document.getElementById('reductioncode').value;
	if(!(oXmlHttp = getXmlHttp())){ alert('Erreur.'); return; }
	oXmlHttp.open('POST', '../scripts/cart_manager.php', true);
	oXmlHttp.setRequestHeader('User-Agent', 'XMLHTTP/1.0');
	oXmlHttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
	oXmlHttp.setRequestHeader('Content-length', strData.length);
	oXmlHttp.setRequestHeader('Connection', 'Close');
	oXmlHttp.onreadystatechange = function(){
		if(oXmlHttp.readyState == 4){
			document.location.href='index.php';
		}
	}
	oXmlHttp.send(strData);
}

function OnAddBatch(nIndex){
	var strData = 'cmd=addbatch&index=' + nIndex;
	if(!(oXmlHttp = getXmlHttp())){ alert('Erreur.'); return; }
	oXmlHttp.open('POST', '../scripts/cart_manager.php', true);
	oXmlHttp.setRequestHeader('User-Agent', 'XMLHTTP/1.0');
	oXmlHttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
	oXmlHttp.setRequestHeader('Content-length', strData.length);
	oXmlHttp.setRequestHeader('Connection', 'Close');
	oXmlHttp.onreadystatechange = function(){
		if(oXmlHttp.readyState == 4){
			document.location.href='index.php';
		}
	}
	oXmlHttp.send(strData);
}

function OnRemoveBatch(nIndex){
	var strData = 'cmd=removebatch&index=' + nIndex;
	if(!(oXmlHttp = getXmlHttp())){ alert('Erreur.'); return; }
	oXmlHttp.open('POST', '../scripts/cart_manager.php', true);
	oXmlHttp.setRequestHeader('User-Agent', 'XMLHTTP/1.0');
	oXmlHttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
	oXmlHttp.setRequestHeader('Content-length', strData.length);
	oXmlHttp.setRequestHeader('Connection', 'Close');
	oXmlHttp.onreadystatechange = function(){
		if(oXmlHttp.readyState == 4){
			document.location.href='index.php';
		}
	}
	oXmlHttp.send(strData);
	
}

function OnRemoveItem(nIndex){
	
	var strData = 'cmd=removeitem&index=' + nIndex;
	if(!(oXmlHttp = getXmlHttp())){ alert('Erreur.'); return; }
	oXmlHttp.open('POST', '../scripts/cart_manager.php', true);
	oXmlHttp.setRequestHeader('User-Agent', 'XMLHTTP/1.0');
	oXmlHttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
	oXmlHttp.setRequestHeader('Content-length', strData.length);
	oXmlHttp.setRequestHeader('Connection', 'Close');
	oXmlHttp.onreadystatechange = function(){
		if(oXmlHttp.readyState == 4){
			document.location.href='index.php';
		}
	}
	oXmlHttp.send(strData);
}