function updatePanLivr(){
	//document.getElementById('alpha').style.display = 'block';
	document.getElementById('validation_achat_loading').innerHTML = "<div style='height: 130px;'></div><div style='border: 1px solid #CCCCCC; background-color: white; padding: 20px 30px 20px 30px;'><img src='/images/loading-bar.gif' border='0'><br /><br />Recalcul du panier...<br />Veuillez patienter...</div>";
	document.getElementById('validation_achat_loading').style.display = 'block';
	// Récupération des valeurs du formulaires et soumission en ajax
	data = null;
	for (i=0; i < document.form_livraison.elements.length; i++){
		if (document.form_livraison.elements[i]){
			if (document.form_livraison.elements[i].type != "radio" || (document.form_livraison.elements[i].type == "radio" && document.form_livraison.elements[i].checked)){
				if (i > 0){
					data = data + "&" + document.form_livraison.elements[i].name + "=" + document.form_livraison.elements[i].value;
				}else{
					data = document.form_livraison.elements[i].name + "=" + document.form_livraison.elements[i].value;
				}
			}
		}
	}
	httpPanV2 = createRequestObject();
	httpPanV2.open('POST', '/index.php?page=panier&mod=boutique', true);
	httpPanV2.onreadystatechange = ajax_update_pan_livr_callback;
	httpPanV2.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	httpPanV2.send(data);
	
	return true;
}

function updatePanReduc(){
	//document.getElementById('alpha').style.display = 'block';
	document.getElementById('validation_achat_loading').innerHTML = "<div style='height: 130px;'></div><div style='border: 1px solid #CCCCCC; background-color: white; padding: 20px 30px 20px 30px;'><img src='/images/loading-bar.gif' border='0'><br /><br />Recalcul du panier...<br />Veuillez patienter...</div>";
	document.getElementById('validation_achat_loading').style.display = 'block';
	// Récupération des valeurs du formulaires et soumission en ajax
	data = null;
	for (i=0; i < document.form_promo.elements.length; i++){
		if (document.form_promo.elements[i]){
			if (i > 0){
				data = data + "&" + document.form_promo.elements[i].name + "=" + document.form_promo.elements[i].value;
			}else{
				data = document.form_promo.elements[i].name + "=" + document.form_promo.elements[i].value;
			}
		}
	}
	httpPanV2 = createRequestObject();
	httpPanV2.open('POST', 'index.php?page=include/gestion_promo&mod=boutique', true);
	httpPanV2.onreadystatechange = ajax_update_pan_callback;
	httpPanV2.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	httpPanV2.send(data);
	
	return true;
}

function updatePan(){
	//document.getElementById('alpha').style.display = 'block';
	document.getElementById('validation_achat_loading').innerHTML = "<div style='height: 130px;'></div><div style='border: 1px solid #CCCCCC; background-color: white; padding: 20px 30px 20px 30px;'><img src='/images/loading-bar.gif' border='0'><br /><br />Recalcul du panier...<br />Veuillez patienter...</div>";
	document.getElementById('validation_achat_loading').style.display = 'block';
	// Récupération des valeurs du formulaires et soumission en ajax
	data = null;
	for (i=0; i < document.panier_produits.elements.length; i++){
		if (document.panier_produits.elements[i]){
			if (i > 0){
				data = data + "&" + document.panier_produits.elements[i].name + "=" + document.panier_produits.elements[i].value;
			}else{
				data = document.panier_produits.elements[i].name + "=" + document.panier_produits.elements[i].value;
			}
		}
	}
	httpPanV2 = createRequestObject();
	httpPanV2.open('POST', '/index.php?page=gestion_panier&mod=boutique&mode=ajax', true);
	httpPanV2.onreadystatechange = ajax_update_pan_callback;
	httpPanV2.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	httpPanV2.send(data);
	
	return true;
}

function ajax_update_pan_callback(){
	if(httpPanV2.readyState == 4)
	{
		//var response = httpPanV2.responseText;
		//document.getElementById('entete_panier').innerHTML = response;
		//document.getElementById('alpha').style.display = 'none';
		//document.getElementById('validation_achat_loading').style.display = 'none';
		httpPanV2 = createRequestObject();
		httpPanV2.open('GET', '/panier.fr.htm', true);
		httpPanV2.onreadystatechange = ajax_update_pan_callback2;
		httpPanV2.send('');
	}
}

function ajax_update_pan_callback2(){
	if(httpPanV2.readyState == 4)
	{
		var response = httpPanV2.responseText;
		document.body.innerHTML = response;
		//document.getElementById('alpha').style.display = 'none';
		//document.getElementById('validation_achat_loading').style.display = 'none';
	}
}

function ajax_update_pan_livr_callback(){
	if(httpPanV2.readyState == 4)
	{
		var response = httpPanV2.responseText;
		document.body.innerHTML = response;
		//document.getElementById('alpha').style.display = 'none';
		//document.getElementById('validation_achat_loading').style.display = 'none';
	}
}
