/************ AJAX *******************/
var editionEnCours=false;
var XHR_Commande=null;
var TabProduit=new Array();
var IdAffichage=null;
//***********************************************************************************
//******************************** requeteHTTP **************************************
//***********************************************************************************
function AfficheProduit(id)
{
	//alert('ok');
	if(id==IdAffichage && document.getElementById('AjaxAffichageProduit')) { SetDiv('AjaxAffichageProduit',''); IdAffichage=null; return; }
	if (editionEnCours)	{ return; }
	else editionEnCours=true;
	SetDiv('AjaxAffichageProduit',str_attente(5));
	href='index.php?module=boutique&action=display&id='+id;
	info_href(href);
	XHR_Commande = getXMLHTTP();
	if (!XHR_Commande) { return false; }
	XHR_Commande.open("GET", ""+href+"&typeaffichage=ajax"+ieTrick(), true);
	XHR_Commande.onreadystatechange = function()
	{
		if (XHR_Commande.readyState==4)
		{
			SetDiv('AjaxAffichageProduit',XHR_Commande.responseText);
			IdAffichage=id;
			editionEnCours = false;
		}
	}
	XHR_Commande.send(null);
	return true;
}
//***********************************************************************************
//***********************************************************************************
function Commande(id)
{
	if (editionEnCours)	{ return; }
	else editionEnCours=true;
	//SetDiv('AjaxCommandeEnCours',str_attente(5));
	if(document.getElementById('Imgcaddie'+id))
		document.getElementById('Imgcaddie'+id).src='icones/indicator.gif';
	href='index.php?module=boutique&action=commandeencours&id='+id;
	if(!document.getElementById('AjaxBondecommande')) { href+='&display=1'; }
	info_href(href);
	XHR_Commande = getXMLHTTP();
	if (!XHR_Commande) { return false; }
	XHR_Commande.open("GET", ""+href+"&typeaffichage=ajax"+ieTrick(), true);
	XHR_Commande.onreadystatechange = function()
	{
		if (XHR_Commande.readyState==4)
		{
			SetDiv('AjaxCommandeEnCours',XHR_Commande.responseText);
			obj=document.getElementById('IndicatorCommandeEnCours');
			if(!obj || obj.value!='true')
			{
				alert('Une erreur a été détectée lors de l\'insertion de votre produit dans le panier ArtSouk...\nVérifiez que votre commande a bien été réalisée.\n\n\tNous vous excusons de la gêne occasionnée.');
				if(document.getElementById('Divcaddie'+id)) SetDiv('Divcaddie'+id,return_Commande_1(id));
			}
			else
			{
				if(document.getElementById('Divcaddie'+id)) SetDiv('Divcaddie'+id,return_Commande_2(id));
			}
			editionEnCours = false;
		}
	}
	XHR_Commande.send(null);
	return true;
}
function ValideCommande()
{
	IdAffichage="";
	EtatCommande('index.php?module=boutique&action=validecommande');
}
function DevalideCommande()
{
	IdAffichage="";
	EtatCommande('index.php?module=boutique&action=devalidecommande');
}
function EtatCommande(href)
{
	if (editionEnCours)	{ return; }
	else editionEnCours=true;
	SetDiv('AjaxBondecommande',str_attente(75));
	info_href(href);
	XHR_Commande = getXMLHTTP();
	if (!XHR_Commande) { return false; }
	XHR_Commande.open("GET", ""+href+"&typeaffichage=ajax"+ieTrick(), true);
	XHR_Commande.onreadystatechange = function()
	{
		if (XHR_Commande.readyState==4)
		{
			SetDiv('AjaxBondecommande',XHR_Commande.responseText);
			editionEnCours = false;
			Commande();
		}
	}
	XHR_Commande.send(null);
	return true;
}
//***********************************************************************************
//***********************************************************************************
function DeleteCommande()
{
	if (editionEnCours)	{ return; }
	else editionEnCours=true;
	if(!confirm('Voulez-vous annuler votre commande ?')) { editionEnCours = false; return; }
	//SetDiv('AjaxCommandeEnCours',str_attente(5));
	href='index.php?module=boutique&action=deletecommandeencours';
	XHR_Commande = getXMLHTTP();
	if (!XHR_Commande) { return false; }
	XHR_Commande.open("GET", ""+href+"&typeaffichage=ajax"+ieTrick(), true);
	XHR_Commande.onreadystatechange = function()
	{
		if (XHR_Commande.readyState==4)
		{
			SetDiv('AjaxCommandeEnCours',XHR_Commande.responseText);
			if(document.getElementById('AjaxAffichageProduit')) SetDiv('AjaxAffichageProduit','');
			obj=document.getElementById('IndicatorCommandeEnCours');
			if(!obj || obj.value!='true')
			{
				alert('Une erreur a été détectée lors de l\'annulation de votre commande...\n\n\tNous vous excusons de la gêne occasionnée.');
			}
			else
			{
				for(i=0;i<TabProduit.length;i++)
				{
					if(document.getElementById('IndicatorProduitCommande'+TabProduit[i]))
						if(document.getElementById('Divcaddie'+TabProduit[i]))
							SetDiv('Divcaddie'+TabProduit[i],return_Commande_1(TabProduit[i]));
				}
				if(document.getElementById('DivTableCommande')) SetDiv('DivTableCommande','<p style="padding:25px 0;">- Aucune commande en cours.</p>');
			}
			editionEnCours = false;
		}
	}
	XHR_Commande.send(null);
	return true;
}
function DeleteProduit(id)
{
	if (editionEnCours)	{ return; }
	else editionEnCours=true;
	if(!confirm('Voulez-vous supprimer ce produit de votre commande ?')) { editionEnCours = false; return; }
	//SetDiv('AjaxCommandeEnCours',str_attente(5));
	SetDiv('AjaxAffichageProduit','');
	//SetDiv('AjaxBondecommande',str_attente(5));
	href='index.php?module=boutique&action=deleteproduit&id='+id;
	XHR_Commande = getXMLHTTP();
	if (!XHR_Commande) { return false; }
	XHR_Commande.open("GET", ""+href+"&typeaffichage=ajax"+ieTrick(), true);
	XHR_Commande.onreadystatechange = function()
	{
		if (XHR_Commande.readyState==4)
		{
			SetDiv('AjaxBondecommande',XHR_Commande.responseText);
			editionEnCours = false;
			Commande();
		}
	}
	XHR_Commande.send(null);
	return true;
}
function ChangeQuantite(sel,id)
{
	if (editionEnCours)	{ return false; }
	else editionEnCours=true;
	Index=sel.selectedIndex;
	nb=sel.options[Index].value;
	href='index.php?module=boutique&action=changequantite&id='+id+'&nb='+nb;
	XHR_Commande = getXMLHTTP();
	if (!XHR_Commande) { return false; }
	XHR_Commande.open("GET", ""+href+"&typeaffichage=ajax"+ieTrick(), true);
	XHR_Commande.onreadystatechange = function()
	{
		if (XHR_Commande.readyState==4)
		{
			SetDiv('AjaxAffichageProduit',XHR_Commande.responseText);
			obj=document.getElementById('IndicatorCommandeEnCours');
			if(obj && obj.value=='true')
			{
				m=document.getElementById('IndicatorMontant').value;
				SetDiv('DivMontant'+id,'<p>'+m+' &euro;</p>');
				mt=document.getElementById('IndicatorMontantTotal').value;
				SetDiv('DivMontantTotal','<p>'+mt+' &euro;</p>');
				f=document.getElementById('IndicatorFrais').value;
				SetDiv('DivFrais','<p>'+f+' &euro;</p>');
				t=document.getElementById('IndicatorTotal').value;
				SetDiv('DivTotal','<p>'+t+' &euro;</p>');
				pt=document.getElementById('IndicatorPoidsTotal').value;
				SetDiv('DivPoidsTotal','Poids Total : '+pt+' kg');
			}
			editionEnCours=false;
			Commande();
			sel.selectedIndex=Index;
		}
	}
	XHR_Commande.send(null);
	return true;
}
function ChangeOption(sel,id)
{
	if (editionEnCours)	{ return false; }
	else editionEnCours=true;
	Index=sel.selectedIndex;
	nb=sel.options[Index].value;
	href='index.php?module=boutique&action=changeoption&id='+id+'&nb='+nb;
	XHR_Commande = getXMLHTTP();
	if (!XHR_Commande) { return false; }
	XHR_Commande.open("GET", ""+href+"&typeaffichage=ajax"+ieTrick(), true);
	XHR_Commande.onreadystatechange = function()
	{
		if (XHR_Commande.readyState==4)
		{
			SetDiv('AjaxAffichageProduit',XHR_Commande.responseText);
			editionEnCours=false;
			Commande();
			sel.selectedIndex=Index;
		}
	}
	XHR_Commande.send(null);
	return true;
}
//***********************************************************************************
//***********************************************************************************
function return_Commande_1(id)
{
	return '<a href="#" onclick="Commande(\''+id+'\'); return false;" title="Mettre au panier"><img src="icones/caddie3.gif" id="Imgcaddie'+id+'" border="0" align="absmiddle" style="padding:0 5px;"/>Mettre au Panier</a>';
}
function return_Commande_2(id)
{
	TextReturn='<a style="font-size:10px;"><img src="icones/caddie3.gif" id="Imgcaddie'+id+'" alt="Imgcaddie'+id+'" border="0" align="absmiddle" style="padding:0 5px;"/>Le produit est mis dans votre panier !</a>';
	TextReturn+='<br/><a href="index.php?module=boutique&action=bondecommande" title="Voir votre commande ?">Voir votre commande ?</a>';
	return TextReturn;
}
//***********************************************************************************
//***********************************************************************************
//************************         IDENTIFICTION        **********************************
//***********************************************************************************
//***********************************************************************************
//***********************************************************************************
function Deconnect()
{
	if (editionEnCours)	{ return false; }
	else editionEnCours=true;
	if(!confirm('Voulez-vous déconnecter votre compte client ?')) { editionEnCours=false; return; }
	href='index.php?module=boutique&action=deconnect';
	XHR_Commande = getXMLHTTP();
	if (!XHR_Commande) { return false; }
	XHR_Commande.open("GET", ""+href+"&typeaffichage=ajax"+ieTrick(), true);
	XHR_Commande.onreadystatechange = function()
	{
		if (XHR_Commande.readyState==4)
		{
			SetDiv('AjaxBondecommande',XHR_Commande.responseText);
			editionEnCours=false;
			Commande();
		}
	}
	XHR_Commande.send(null);
	return true;
}
function CommandeIdentification()
{
	if(!TestMail(document.getElementById('EmailIdentification').value)) { alert('Le mail n\'est pas valide !!'); return; }
	if (editionEnCours)	{ return false; }
	else editionEnCours=true;
	mail=(document.getElementById('EmailIdentification').value).replace(/&/g,'%26');
	pwd=(document.getElementById('PwdIdentification').value).replace(/&/g,'%26');
	document.getElementById('PwdIdentification').value='';
	DATA='module=boutique&action=identification&forms=1&mail='+mail+'&pwd='+pwd+'&typeaffichage=ajax'+ieTrick();
	XHR_Commande = getXMLHTTP();
	if (!XHR_Commande) { return false; }
	XHR_Commande.open("POST",'index.php',true);
	XHR_Commande.onreadystatechange = function()
	{
		if (XHR_Commande.readyState==4)
		{
			SetDiv('AjaxBondecommande',XHR_Commande.responseText);
			if(document.getElementById('IndicatorAlert'))
			{
				if(document.getElementById('IndicatorAlert').value=='erreur1')
					alert('Une erreur est survenue lors de l\'identification de votre compte client.\n\n\tVérifier votre mail ou votre mot de passe.');
			}
			//else alert('Une erreur est survenue lors de l\'identification de votre compte client.');
			editionEnCours=false;
			Commande();
		}
	}
	XHR_Commande.setRequestHeader("Content-type","application/x-www-form-urlencoded");
	XHR_Commande.send(DATA);
	return true;
}
function SaveIdentification()
{
	if(!document.getElementById('IdentificationCGDV').checked) { alert('Vous n\'avez pas accepté les conditions générales de vente d\'ArtSouk.'); return; }
	civ=(document.getElementById('IdentificationCivilite').value).replace(/&/g,'%26');
	name=(document.getElementById('IdentificationName').value).replace(/&/g,'%26');
	fname=(document.getElementById('IdentificationFirstName').value).replace(/&/g,'%26');
	add=(document.getElementById('IdentificationAdresse').value).replace(/&/g,'%26');
	cp=(document.getElementById('IdentificationCP').value).replace(/&/g,'%26');
	ville=(document.getElementById('IdentificationVille').value).replace(/&/g,'%26');
	pays=(document.getElementById('IdentificationPays').value).replace(/&/g,'%26');
	tel=(document.getElementById('IdentificationTel').value).replace(/&/g,'%26');
	email=(document.getElementById('IdentificationEmail').value).replace(/&/g,'%26');
	
	DATA ='module=boutique&action=identification&forms=2';
	DATA+='&civilite='+civ+'&name='+name+'&fname='+fname+'&add='+add;
	DATA+='&cp='+cp+'&ville='+ville+'&pays='+pays+'&tel='+tel+'&email='+email;
	DATA+='&typeaffichage=ajax'+ieTrick();
	XHR_Commande = getXMLHTTP();
	if (!XHR_Commande) { return false; }
	XHR_Commande.open("POST",'index.php',true);
	XHR_Commande.onreadystatechange = function()
	{
		if (XHR_Commande.readyState==4)
		{
			//alert(XHR_Commande.responseText);
			SetDiv('DivErrorInscription',XHR_Commande.responseText);
			if(document.getElementById('IndicatorAlert') && document.getElementById('IndicatorAlert').value=='true')
			{
				if(document.getElementById('IndicatorAlertName')) SetDiv('ErrorName',str_error(document.getElementById('IndicatorAlertName').value)); else SetDiv('ErrorName','&nbsp;');
				if(document.getElementById('IndicatorAlertAdresse')) SetDiv('ErrorAdresse',str_error(document.getElementById('IndicatorAlertAdresse').value)); else SetDiv('ErrorAdresse','&nbsp;');
				if(document.getElementById('IndicatorAlertEmail')) SetDiv('ErrorEmail',str_error(document.getElementById('IndicatorAlertEmail').value)); else SetDiv('ErrorEmail','&nbsp;');
			}
			else
			{
				TXT ='<table class="identification colore" cellspacing="0" cellpadding="0" border="0" style="width:88%; margin-top:100px;"><tr><td class="top">&nbsp;</td></tr><tr><td class="plein" style="text-align:left;">';
				TXT+='<h5 style="margin-top:10px;">L\'inscription de votre compte ArtSouk a &eacute;t&eacute; &eacute;ffectu&eacute; avec succ&egrave;s !</h5>';
				TXT+='<p style="margin-left:50px;">Un email vous a été envoyé à l\'adresse <b>'+email+'</b> confirmant votre inscription.</p>';
				TXT+='<p style="margin-left:50px;">Un mot de passe a été joint afin de vous connecter et de terminer votre commande sur la boutique artisanale d\'ArtSouk.</p>';
				TXT+='<p style="margin-top:20px; margin-left:20px;">L\'équipe d\'ArtSouk vous remercie de la confiance que vous lui apportez.</p>';
				TXT+='<h6 style="padding:0;">(Ces informations sont strictement confidentielles et ne doivent pour aucune raison &ecirc;tre communiqu&eacute;)</h6>';
				TXT+='</td></tr><tr><td class="bottom">&nbsp;</td></tr></table>';
				TXT+='<p align="center"><input type="button" value="Retour" onclick="window.location=\'index.php?module=boutique&action=identification\'"/></p>';
				SetDiv('AjaxBondecommande',TXT);
			}
			editionEnCours=false;
			Commande();
		}
	}
	XHR_Commande.setRequestHeader("Content-type","application/x-www-form-urlencoded");
	XHR_Commande.send(DATA);
	return true;
}
function FormsUpdateInfo()
{
	if (editionEnCours)	{ return false; }
	else editionEnCours=true;
	href='index.php?module=boutique&action=updateinfo';
	XHR_Commande = getXMLHTTP();
	if (!XHR_Commande) { return false; }
	XHR_Commande.open("GET", ""+href+"&typeaffichage=ajax"+ieTrick(), true);
	XHR_Commande.onreadystatechange = function()
	{
		if (XHR_Commande.readyState==4)
		{
			SetDiv('AjaxBondecommande',XHR_Commande.responseText);
			editionEnCours=false;
		}
	}
	XHR_Commande.send(null);
	return true;
}

var VAR='';

function UpdateIdentification1()
{
	civ=(document.getElementById('IdentificationCivilite').value).replace(/&/g,'%26');
	name=(document.getElementById('IdentificationName').value).replace(/&/g,'%26');
	fname=(document.getElementById('IdentificationFirstName').value).replace(/&/g,'%26');
	add=(document.getElementById('IdentificationAdresse').value).replace(/&/g,'%26');
	cp=(document.getElementById('IdentificationCP').value).replace(/&/g,'%26');
	ville=(document.getElementById('IdentificationVille').value).replace(/&/g,'%26');
	pays=(document.getElementById('IdentificationPays').value).replace(/&/g,'%26');
	tel=(document.getElementById('IdentificationTel').value).replace(/&/g,'%26');
	VAR='&civilite='+civ+'&name='+name+'&fname='+fname+'&add='+add+'&cp='+cp+'&ville='+ville+'&pays='+pays+'&tel='+tel;	
	
	DATA ='module=boutique&action=identification&forms=3'+VAR+'&typeaffichage=ajax'+ieTrick();
	XHR_Commande = getXMLHTTP();
	if (!XHR_Commande) { return false; }
	XHR_Commande.open("POST",'index.php',true);
	XHR_Commande.onreadystatechange = function()
	{
		if (XHR_Commande.readyState==4)
		{
			//alert(XHR_Commande.responseText);
			SetDiv('DivErrorInscription',XHR_Commande.responseText);
			if(document.getElementById('IndicatorAlert') && document.getElementById('IndicatorAlert').value=='true')
			{
				if(document.getElementById('IndicatorAlertName')) SetDiv('ErrorName',str_error(document.getElementById('IndicatorAlertName').value)); else SetDiv('ErrorName','&nbsp;');
				if(document.getElementById('IndicatorAlertAdresse')) SetDiv('ErrorAdresse',str_error(document.getElementById('IndicatorAlertAdresse').value)); else SetDiv('ErrorAdresse','&nbsp;');
			}
			else if((document.getElementById('IndicatorAlert') && document.getElementById('IndicatorAlert').value=='nop') || !document.getElementById('IndicatorAlert')) 
			{
				editionEnCours=false;
				AffichageIdentification();
				return;
			}			
			else
			{
				document.getElementById('DivTableInscription').style.display='none';
				SetDiv('DivSecurite',ReturnFormsSecurite());
			}
			editionEnCours=false;
			Commande();
		}
	}
	XHR_Commande.setRequestHeader("Content-type","application/x-www-form-urlencoded");
	XHR_Commande.send(DATA);
	return true;
}
function UpdateIdentification2()
{
	email=(document.getElementById('IdentificationEmail').value).replace(/&/g,'%26');
	mdp1=(document.getElementById('IdentificationMPD1').value).replace(/&/g,'%26');
	mdp2=(document.getElementById('IdentificationMPD2').value).replace(/&/g,'%26');
	VAR='&email='+email+'&mdp1='+mdp1+'&mdp2='+mdp2;	
	
	DATA ='module=boutique&action=identification&forms=4'+VAR+'&typeaffichage=ajax'+ieTrick();
	XHR_Commande = getXMLHTTP();
	if (!XHR_Commande) { return false; }
	XHR_Commande.open("POST",'index.php',true);
	XHR_Commande.onreadystatechange = function()
	{
		if (XHR_Commande.readyState==4)
		{
			//alert(XHR_Commande.responseText);
			SetDiv('DivErrorInscription',XHR_Commande.responseText);
			if(document.getElementById('IndicatorAlert') && document.getElementById('IndicatorAlert').value=='true')
			{
				if(document.getElementById('IndicatorAlertEmail')) SetDiv('ErrorEmail',str_error(document.getElementById('IndicatorAlertEmail').value)); else SetDiv('ErrorEmail','&nbsp;');
				if(document.getElementById('IndicatorAlertMDP')) SetDiv('ErrorMPD',str_error(document.getElementById('IndicatorAlertMDP').value)); else SetDiv('ErrorMPD','&nbsp;');
			}
			else if((document.getElementById('IndicatorAlert') && document.getElementById('IndicatorAlert').value=='nop') || !document.getElementById('IndicatorAlert')) 
			{
				editionEnCours=false;
				AffichageIdentification();
				return;
			}
			else
			{
				SetDiv('ErrorEmail','&nbsp;');
				SetDiv('ErrorMPD','&nbsp;');
				document.getElementById('DivTableInscription').style.display='none';
				SetDiv('DivSecurite',ReturnFormsSecurite());
			}
			editionEnCours=false;
			Commande();
		}
	}
	XHR_Commande.setRequestHeader("Content-type","application/x-www-form-urlencoded");
	XHR_Commande.send(DATA);
	return true;
}
function UpdateIdentificationRetour()
{
	SetDiv('DivSecurite','&nbsp;');
	document.getElementById('DivTableInscription').style.display='block';
}
function UpdateIdentification()
{
	MPD=(document.getElementById('IdentificationMPDSecu').value).replace(/&/g,'%26');
	DATA ='module=boutique&action=identification&forms=5'+'&mpdsecu='+MPD+VAR+'&typeaffichage=ajax'+ieTrick();
	XHR_Commande = getXMLHTTP();
	if (!XHR_Commande) { return false; }
	XHR_Commande.open("POST",'index.php',true);
	XHR_Commande.onreadystatechange = function()
	{
		if (XHR_Commande.readyState==4)
		{
			SetDiv('DivErrorInscription',XHR_Commande.responseText);
			if(document.getElementById('IndicatorAlert') && document.getElementById('IndicatorAlert').value=='true')
			{
				if(document.getElementById('IndicatorAlertSecu')) SetDiv('ErrorSecu',str_error(document.getElementById('IndicatorAlertSecu').value)); 
				else SetDiv('ErrorSecu',str_error('Une erreur est survenue lors de la vérification des données a modifiés !'));
				document.getElementById('IdentificationMPDSecu').value='';
				editionEnCours=false;
			}
			else
			{
				alert('Vos informations ont été modifiées avec succès !');
				SetDiv('DivSecurite','&nbsp;');
				editionEnCours=false;
				AffichageIdentification();
			}
		}
	}
	XHR_Commande.setRequestHeader("Content-type","application/x-www-form-urlencoded");
	XHR_Commande.send(DATA);
}
function ReturnFormsSecurite()
{
	return '<table class="identification colore" cellspacing="0" cellpadding="0" border="0" style="width:60%;">'
		+'<tr><td class="top" colspan="4">&nbsp;</td></tr>'
		+'<tr><td class="submit" colspan="4"><p class="titre" style="margin:5px 0 30px 0;">Pour des raisons de s&eacute;curit&eacute;, veuillez informer<br/>votre <font color="red">mot de passe</font> pour valider les changements :<p></td></tr>'
		+'<tr><td class="right">Mot de passe :</td>'
		+'<td class="middle" colspan="2" align="center"><input type="password" name="IdentificationMPDSecu" id="IdentificationMPDSecu" value="" size="30"/></td>'
		+'<td class="left"><input type="button" value="Valider" onclick="UpdateIdentification();"/></td></tr>'
		+'<tr><td class="errorSecu" colspan="4"><div id="ErrorSecu">&nbsp;</div></td></tr>'
		+'<tr><td class="bottom" colspan="4">&nbsp;</td></tr>'
	+'</table>'
	+'<p align="center"><a href="#" onclick="UpdateIdentificationRetour(); return false;" title="Retour">Retour</a></p>';
}
function AffichageIdentification()
{
	if (editionEnCours)	{ return false; }
	else editionEnCours=true;
	href='index.php?module=boutique&action=identification';
	XHR_Commande = getXMLHTTP();
	if (!XHR_Commande) { return false; }
	XHR_Commande.open("GET", ""+href+"&typeaffichage=ajax"+ieTrick(), true);
	XHR_Commande.onreadystatechange = function()
	{
		if (XHR_Commande.readyState==4)
		{
			SetDiv('AjaxBondecommande',XHR_Commande.responseText);
			editionEnCours=false;
			Commande();
		}
	}
	XHR_Commande.send(null);
	return true;
}
//***********************************************************************************
//***********************************************************************************
//****************************         PAIEMENT        ************************************
//***********************************************************************************
//***********************************************************************************
//***********************************************************************************
function ValidePaiement(mode)
{
	if (editionEnCours)	{ return false; }
	if(mode==1 && !confirm('Validez le réglement par carte bancaire via Paypal ?\n\nVous ne pourrez plus revenir en arrière par la suite.')) return false;
	else if(mode==2 && !confirm('Validez le réglement par virement bancaire ?\n\nVous ne pourrez plus revenir en arrière par la suite.')) return false;
	else if(mode==3 && !confirm('Validez le réglement par chèque ?\n\nVous ne pourrez plus revenir en arrière par la suite.')) return false;
	else
	editionEnCours=true;
	
	href='index.php?module=boutique&action=valide_commande&mode='+mode;
	XHR_Commande = getXMLHTTP();
	if (!XHR_Commande) { return false; }
	XHR_Commande.open("GET", ""+href+"&typeaffichage=ajax"+ieTrick(), true);
	XHR_Commande.onreadystatechange = function()
	{
		if (XHR_Commande.readyState==4)
		{
			SetDiv('DivIndicator',XHR_Commande.responseText);
			if((document.getElementById('Indicator') && document.getElementById('Indicator').value=='false') || !document.getElementById('Indicator'))
			{
				alert('Un problème est survenue lors de la validaton de votre commande !\n\n\tContactez un administrateur si le problème persiste ou si vous n\'arrivez plus à terminer votre commande.');
			}
			else
			{
				if(mode==1) document.getElementById('FormPaypal').submit();
				else window.location='index.php?module=boutique&action=paiement&validation='+mode;
			}
			editionEnCours=false;
		}
	}
	XHR_Commande.send(null);
	return false;
}


