function ident(){
  var login = document.getElementById("login").value ;
  var mdp = document.getElementById("mdp").value ;

  var xhrIdent = null ;
  try{
    xhrIdent = new XMLHttpRequest(); 
  }
  catch(e){ 
    try{
	  xhrIdent = new ActiveXObject("Msxml2.XMLHTTP"); 
	} 
    catch (e2){ 
      try {
	    xhrIdent = new ActiveXObject("Microsoft.XMLHTTP"); 
	  } 
      catch (e) {}
    }
  }
  xhrIdent.onreadystatechange  = function(){ 
    if(xhrIdent.readyState==4){
      if(xhrIdent.status==200){
	    document.getElementById("div_ident").innerHTML = xhrIdent.responseText ;
	  }
    }
  }; 
  var param = "" ;
  param+="login="+login ;
  param+="&mdp="+mdp ;
  xhrIdent.open("POST", "php/ident.php", true);
  xhrIdent.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); 
  xhrIdent.send(param) ;
}

// ======================================================================================= //
// ======================================================================================= //
// ======================================================================================= //
// ======================================================================================= //

function modif_infos(){
  var xhrModifInfos = null ;
  try{
    xhrModifInfos = new XMLHttpRequest(); 
  }
  catch(e){ 
    try{
	  xhrModifInfos = new ActiveXObject("Msxml2.XMLHTTP"); 
	} 
    catch (e2){ 
      try {
	    xhrModifInfos = new ActiveXObject("Microsoft.XMLHTTP"); 
	  } 
      catch (e) {}
    }
  }
  xhrModifInfos.onreadystatechange  = function(){ 
    if(xhrModifInfos.readyState==4){
      if(xhrModifInfos.status==200){
	    document.getElementById("div_ident").innerHTML = xhrModifInfos.responseText ;
	  }
    }
  }; 
  xhrModifInfos.open("POST", "inc/form_infos_ident.php", true);
  xhrModifInfos.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); 
  xhrModifInfos.send(null) ;
}

// ======================================================================================= //
// ======================================================================================= //
// ======================================================================================= //
// ======================================================================================= //

function trait_modif_infos(){
  var id = document.getElementById("infos_id").value ;
  var nom = document.getElementById("infos_nom").value ;
  var prenom = document.getElementById("infos_prenom").value ;
  var adresse = document.getElementById("infos_adresse").value ;
  var cp = document.getElementById("infos_cp").value ;
  var ville = document.getElementById("infos_ville").value ;
  var pays = document.getElementById("infos_pays").value ;
  var tel = document.getElementById("infos_tel").value ;
  var xhrTraitModifInfos = null ;
  try{
    xhrTraitModifInfos = new XMLHttpRequest(); 
  }
  catch(e){ 
    try{
	  xhrTraitModifInfos = new ActiveXObject("Msxml2.XMLHTTP"); 
	} 
    catch (e2){ 
      try {
	    xhrTraitModifInfos = new ActiveXObject("Microsoft.XMLHTTP"); 
	  } 
      catch (e) {}
    }
  }
  xhrTraitModifInfos.onreadystatechange  = function(){ 
    if(xhrTraitModifInfos.readyState==4){
      if(xhrTraitModifInfos.status==200){
	    document.getElementById("div_ident").innerHTML = xhrTraitModifInfos.responseText ;
	  }
    }
  }; 
  param = "id="+id ;
  param+="&nom="+nom ;
  param+="&prenom="+prenom ;
  param+="&adresse="+adresse ;
  param+="&cp="+cp ;
  param+="&ville="+ville ;
  param+="&pays="+pays ;
  param+="&tel="+tel ;
  xhrTraitModifInfos.open("POST", "php/trait_modif_infos.php", true);
  xhrTraitModifInfos.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); 
  xhrTraitModifInfos.send(param) ;

}

// ======================================================================================= //
// ======================================================================================= //
// ======================================================================================= //
// ======================================================================================= //

function modif_mdp(){
  var xhrModifMdp = null ;
  try{
    xhrModifMdp = new XMLHttpRequest(); 
  }
  catch(e){ 
    try{
	  xhrModifMdp = new ActiveXObject("Msxml2.XMLHTTP"); 
	} 
    catch (e2){ 
      try {
	    xhrModifMdp = new ActiveXObject("Microsoft.XMLHTTP"); 
	  } 
      catch (e) {}
    }
  }
  xhrModifMdp.onreadystatechange  = function(){ 
    if(xhrModifMdp.readyState==4){
      if(xhrModifMdp.status==200){
	    document.getElementById("div_ident").innerHTML = xhrModifMdp.responseText ;
	  }
    }
  }; 
  xhrModifMdp.open("POST", "inc/form_modif_mdp.php", true);
  xhrModifMdp.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); 
  xhrModifMdp.send(null) ;
}

// ======================================================================================= //
// ======================================================================================= //
// ======================================================================================= //
// ======================================================================================= //
function trait_modif_mdp(){
  var id = document.getElementById("infos_id").value ;
  var mdp = document.getElementById("infos_mdp").value ;
  var new_mdp = document.getElementById("infos_new_mdp").value ;
  var new_mdp2 = document.getElementById("infos_new_mdp2").value ;
  var res = true ;
  if(mdp==""){
    alert("Merci d'enter votre ancien mot de passe...") ;
	document.getElementById("infos_mdp").focus() ;
	res = false ;
  }
  else if(new_mdp==""){
	alert("Merci d'enter votre nouveau mot de passe...") ;
	document.getElementById("infos_new_mdp").focus() ;
	res = false ;
  }
  else if(new_mdp!=new_mdp2){
	alert("La confirmation de votre mot de passe ne correspond pas...") ;
	document.getElementById("infos_new_mdp2").focus() ;
	res = false ;
  }
  if(res){
    var xhrTraitModifMdp = null ;
    try{
      xhrTraitModifMdp = new XMLHttpRequest(); 
    }
    catch(e){ 
      try{
	    xhrTraitModifMdp = new ActiveXObject("Msxml2.XMLHTTP"); 
	  } 
      catch (e2){ 
        try {
	      xhrTraitModifMdp = new ActiveXObject("Microsoft.XMLHTTP"); 
	    } 
        catch (e) {}
      }
    }
    xhrTraitModifMdp.onreadystatechange  = function(){ 
      if(xhrTraitModifMdp.readyState==4){
        if(xhrTraitModifMdp.status==200){
	      document.getElementById("div_ident").innerHTML = xhrTraitModifMdp.responseText ;
	    }
      }
    }; 
    param = "id="+id ;
    param+="&mdp="+mdp ;
    param+="&new_mdp="+new_mdp ;
    xhrTraitModifMdp.open("POST", "php/trait_modif_mdp.php", true);
    xhrTraitModifMdp.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); 
    xhrTraitModifMdp.send(param) ;
  }
}

// ======================================================================================= //
// ======================================================================================= //
// ======================================================================================= //
// ======================================================================================= //

function deconnexion(){
  var xhrDeco = null ;
  try{
    xhrDeco = new XMLHttpRequest(); 
  }
  catch(e){ 
    try{
	  xhrDeco = new ActiveXObject("Msxml2.XMLHTTP"); 
	} 
    catch (e2){ 
      try {
	    xhrDeco = new ActiveXObject("Microsoft.XMLHTTP"); 
	  } 
      catch (e) {}
    }
  }
  xhrDeco.onreadystatechange  = function(){ 
    if(xhrDeco.readyState==4){
      if(xhrDeco.status==200){
	    document.getElementById("div_ident").innerHTML = xhrDeco.responseText ;
	  }
    }
  }; 
  xhrDeco.open("POST", "php/deco.php", true);
  xhrDeco.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); 
  xhrDeco.send(null) ;
}

// ======================================================================================= //
// ======================================================================================= //
// ======================================================================================= //
// ======================================================================================= //

function affiche_infos_ident(){
  var xhrAfficheInfosIdent = null ;
  try{
    xhrAfficheInfosIdent = new XMLHttpRequest(); 
  }
  catch(e){ 
    try{
	  xhrAfficheInfosIdent = new ActiveXObject("Msxml2.XMLHTTP"); 
	} 
    catch (e2){ 
      try {
	    xhrAfficheInfosIdent = new ActiveXObject("Microsoft.XMLHTTP"); 
	  } 
      catch (e) {}
    }
  }
  xhrAfficheInfosIdent.onreadystatechange  = function(){ 
    if(xhrAfficheInfosIdent.readyState==4){
      if(xhrAfficheInfosIdent.status==200){
	    document.getElementById("div_ident").innerHTML = xhrAfficheInfosIdent.responseText ;
	  }
    }
  }; 
  xhrAfficheInfosIdent.open("POST", "inc/infos_ident.php", true);
  xhrAfficheInfosIdent.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); 
  xhrAfficheInfosIdent.send(null) ;
}

// ======================================================================================= //
// ======================================================================================= //
// ======================================================================================= //
// ======================================================================================= //
function omdp(){
  var xhrOmdp = null ;
  try{
    xhrOmdp = new XMLHttpRequest(); 
  }
  catch(e){ 
    try{
	  xhrOmdp = new ActiveXObject("Msxml2.XMLHTTP"); 
	} 
    catch (e2){ 
      try {
	    xhrOmdp = new ActiveXObject("Microsoft.XMLHTTP"); 
	  } 
      catch (e) {}
    }
  }
  xhrOmdp.onreadystatechange  = function(){ 
    if(xhrOmdp.readyState==4){
      if(xhrOmdp.status==200){
	    document.getElementById("div_ident").innerHTML = xhrOmdp.responseText ;
	  }
    }
  }; 
  xhrOmdp.open("POST", "inc/omdp.php", true);
  xhrOmdp.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); 
  xhrOmdp.send(null) ;
}
// ======================================================================================= //
// ======================================================================================= //
// ======================================================================================= //
// ======================================================================================= //
function trait_omdp(){
  var email = document.getElementById("email").value ;
  var res = true ;
  if(email==""){
    alert("Vous devez saisir votre adresse email...") ;
	document.getElementById("email").focus() ;
	res = false ;
  }
  if(res){
    var xhrTraitOmdp = null ;
    try{
      xhrTraitOmdp = new XMLHttpRequest(); 
    }
    catch(e){ 
      try{
	    xhrTraitOmdp = new ActiveXObject("Msxml2.XMLHTTP"); 
	  } 
      catch (e2){ 
        try {
	      xhrTraitOmdp = new ActiveXObject("Microsoft.XMLHTTP"); 
	    } 
        catch (e) {}
      }
    }
    xhrTraitOmdp.onreadystatechange  = function(){ 
      if(xhrTraitOmdp.readyState==4){
        if(xhrTraitOmdp.status==200){
	      document.getElementById("div_ident").innerHTML = xhrTraitOmdp.responseText ;
	    }
      }
    }; 
    param = "email="+email ;
    xhrTraitOmdp.open("POST", "php/trait_omdp.php", true);
    xhrTraitOmdp.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); 
    xhrTraitOmdp.send(param) ;
  }
}
// ======================================================================================= //
// ======================================================================================= //
// ======================================================================================= //
// ======================================================================================= //
function new_ident(){
  var xhrNewIdent = null ;
  try{
    xhrNewIdent = new XMLHttpRequest(); 
  }
  catch(e){ 
    try{
	  xhrNewIdent = new ActiveXObject("Msxml2.XMLHTTP"); 
	} 
    catch (e2){ 
      try {
	    xhrNewIdent = new ActiveXObject("Microsoft.XMLHTTP"); 
	  } 
      catch (e) {}
    }
  }
  xhrNewIdent.onreadystatechange  = function(){ 
    if(xhrNewIdent.readyState==4){
      if(xhrNewIdent.status==200){
	    document.getElementById("div_ident").innerHTML = xhrNewIdent.responseText ;
	  }
    }
  }; 
  xhrNewIdent.open("POST", "inc/new_ident.php", true);
  xhrNewIdent.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); 
  xhrNewIdent.send(null) ;
}
// ======================================================================================= //
// ======================================================================================= //
// ======================================================================================= //
// ======================================================================================= //
function trait_new_ident(){
  var id = document.getElementById("infos_id").value ;
  var nom = document.getElementById("infos_nom").value ;
  var prenom = document.getElementById("infos_prenom").value ;
  var adresse = document.getElementById("infos_adresse").value ;
  var cp = document.getElementById("infos_cp").value ;
  var ville = document.getElementById("infos_ville").value ;
  var pays = document.getElementById("infos_pays").value ;
  var tel = document.getElementById("infos_tel").value ;
  var email = document.getElementById("infos_email").value ;
  var email2 = document.getElementById("infos_email2").value ;
  var mdp = document.getElementById("infos_mdp").value ;
  var mdp2 = document.getElementById("infos_mdp2").value ;
  var res = true ;
  if(email==""){
    alert("Vous devez entrer votre adresse email, elle vous servira d'identifiant unique...") ;
	document.getElementById("infos_email").focus() ;
	res = false ;
  }
  else if(email!=email2){
    alert("La confirmation de votre adresse email ne correspond pas...") ;
	document.getElementById("infos_email2").focus() ;
	res = false ;
  }
  else if(mdp==""){
    alert("Vous devez entrer votre mot de passe...") ;
	document.getElementById("infos_mdp").focus() ;
	res = false ;
  }
  else if(mdp!=mdp2){
    alert("La confirmation de votre mot de passe ne correspond pas...") ;
	document.getElementById("infos_mdp2").focus() ;
	res = false ;
  }
  if(res){
    var xhrNewIdent = null ;
    try{
      xhrNewIdent = new XMLHttpRequest(); 
    }
    catch(e){ 
      try{
	    xhrNewIdent = new ActiveXObject("Msxml2.XMLHTTP"); 
	  } 
      catch (e2){ 
        try {
	      xhrNewIdent = new ActiveXObject("Microsoft.XMLHTTP"); 
	    } 
        catch (e) {}
      }
    }
    xhrNewIdent.onreadystatechange  = function(){ 
      if(xhrNewIdent.readyState==4){
        if(xhrNewIdent.status==200){
	      document.getElementById("div_ident").innerHTML = xhrNewIdent.responseText ;
	    }
      }
    }; 
	var param = "id="+id ;
	param+="&nom="+nom ;
	param+="&prenom="+prenom ;
	param+="&adresse="+adresse ;
	param+="&cp="+cp ;
	param+="&ville="+ville ;
	param+="&pays="+pays ;
	param+="&tel="+tel ;
	param+="&email="+email ;
	param+="&mdp="+mdp ;
    xhrNewIdent.open("POST", "php/trait_new_ident.php", true);
    xhrNewIdent.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); 
    xhrNewIdent.send(param) ;
  }
}
// ======================================================================================= //
// ======================================================================================= //
// ======================================================================================= //
// ======================================================================================= //
function afficheInfosEvenement(ide,idd){
  var xhrEtape1 = null ;
  try{
    xhrEtape1 = new XMLHttpRequest(); 
  }
  catch(e){ 
    try{
	  xhrEtape1 = new ActiveXObject("Msxml2.XMLHTTP"); 
	} 
    catch (e2){ 
      try {
	    xhrEtape1 = new ActiveXObject("Microsoft.XMLHTTP"); 
	  } 
      catch (e) {}
    }
  }
  xhrEtape1.onreadystatechange  = function(){ 
    if(xhrEtape1.readyState==4){
      if(xhrEtape1.status==200){
	    document.getElementById("div_infos_evenement").innerHTML = xhrEtape1.responseText ;
	  }
    }
  }; 
  param = "ide="+ide ;
  param+="&idd="+idd ;
  xhrEtape1.open("POST", "inc/div_infos_evenement.php", true);
  xhrEtape1.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); 
  xhrEtape1.send(param) ;
}
// ======================================================================================= //
// ======================================================================================= //
// ======================================================================================= //
// ======================================================================================= //
function etape1(ids,idc,ide){
  var xhrEtape1 = null ;
  try{
    xhrEtape1 = new XMLHttpRequest(); 
  }
  catch(e){ 
    try{
	  xhrEtape1 = new ActiveXObject("Msxml2.XMLHTTP"); 
	} 
    catch (e2){ 
      try {
	    xhrEtape1 = new ActiveXObject("Microsoft.XMLHTTP"); 
	  } 
      catch (e) {}
    }
  }
  xhrEtape1.onreadystatechange  = function(){ 
    if(xhrEtape1.readyState==4){
      if(xhrEtape1.status==200){
	    document.getElementById("div_billetteries").innerHTML = xhrEtape1.responseText ;
		afficheInfosEvenement(ide) ;
	  }
    }
  }; 
  param = "ide="+ide ;
  param+= "&idc="+idc ;
  param+= "&ids="+ids ;
  xhrEtape1.open("POST", "inc/etape1.php", true);
  xhrEtape1.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); 
  xhrEtape1.send(param) ;
}
// ======================================================================================= //
// ======================================================================================= //
// choix d'une date pour affichage des tarifs
// ======================================================================================= //
// ======================================================================================= //
function selectDate(ids,idc,ide,idd){
  if(idd>0){
    var xhrSelectDate = null ;
    try{
      xhrSelectDate = new XMLHttpRequest(); 
    }
    catch(e){ 
      try{
	    xhrSelectDate = new ActiveXObject("Msxml2.XMLHTTP"); 
	  } 
      catch (e2){ 
        try {
	      xhrSelectDate = new ActiveXObject("Microsoft.XMLHTTP"); 
	    } 
        catch (e) {}
      }
    }
    xhrSelectDate.onreadystatechange  = function(){ 
      if(xhrSelectDate.readyState==4){
        if(xhrSelectDate.status==200){
	      document.getElementById("div_choix_tarif").innerHTML = xhrSelectDate.responseText ;
		  afficheInfosEvenement(ide,idd) ;
	    }
      }
    }; 
	param = "ids="+ids ;
    param+= "&idc="+idc ;
	param+="&ide="+ide ;
	param+="&idd="+idd ;
    xhrSelectDate.open("POST", "inc/div_choix_tarif.php", true);
    xhrSelectDate.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); 
    xhrSelectDate.send(param) ;
  }
}
// ======================================================================================= //
// ======================================================================================= //
// modification de la qte ds le tableau des tarifs
// ======================================================================================= //
// ======================================================================================= //
function changeQte(idt,qte,cpt){
  var xhrChangeQte = null ;
  try{
    xhrChangeQte = new XMLHttpRequest(); 
  }
  catch(e){ 
    try{
	  xhrChangeQte = new ActiveXObject("Msxml2.XMLHTTP"); 
	} 
    catch (e2){ 
      try {
	    xhrChangeQte = new ActiveXObject("Microsoft.XMLHTTP"); 
	  } 
      catch (e) {}
    }
  }
  xhrChangeQte.onreadystatechange  = function(){ 
    if(xhrChangeQte.readyState==4){
      if(xhrChangeQte.status==200){
	    eval("document.getElementById('div_montant_tarif_"+idt+"').innerHTML = xhrChangeQte.responseText") ;
		majTotal() ;
	  }
    }
  }; 
  param = "qte="+qte ;
  param+="&cpt="+cpt ;
  param+="&idt="+idt ;
  xhrChangeQte.open("POST", "php/get_montant.php", true);
  xhrChangeQte.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); 
  xhrChangeQte.send(param) ;
}
// ======================================================================================= //
// ======================================================================================= //
// mise a jour du total
// ======================================================================================= //
// ======================================================================================= //
function majTotal(){
  var xhrMajTotal = null ;
  try{
    xhrMajTotal = new XMLHttpRequest(); 
  }
  catch(e){ 
    try{
	  xhrMajTotal = new ActiveXObject("Msxml2.XMLHTTP"); 
	} 
    catch (e2){ 
      try {
	    xhrMajTotal = new ActiveXObject("Microsoft.XMLHTTP"); 
	  } 
      catch (e) {}
    }
  }
  xhrMajTotal.onreadystatechange  = function(){ 
    if(xhrMajTotal.readyState==4){
      if(xhrMajTotal.status==200){
	   document.getElementById("div_total").innerHTML = xhrMajTotal.responseText ;
	  }
    }
  }; 
  var nb_tot = document.getElementById("nb_tar").value ;
  param = "nb_tot="+nb_tot ;
  for(var tmp=1;tmp<=nb_tot;tmp++){
    param+="&tot"+tmp+"="+eval("document.getElementById('tot_"+tmp+"').value") ;
  }
  xhrMajTotal.open("POST", "php/get_montant_total.php", true);
  xhrMajTotal.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); 
  xhrMajTotal.send(param) ;
}
// ======================================================================================= //
// ======================================================================================= //
// passage etape 2
// ======================================================================================= //
// ======================================================================================= //
function etape2(ids,idc,ide,idd){
  var res = false ;
  var param = "idc="+idc+"&ide="+ide+"&idd="+idd ;
  var cpt = 0 ;
  for(var tmp=1;tmp<=document.getElementById("nb_tar").value;tmp++){
	var idt = eval("document.getElementById('idt"+tmp+"').value") ;
    if(eval("document.getElementById('tot_"+tmp+"').value")>0){
      res = true ;
	  cpt++;
	  param+="&idt"+cpt+"="+idt ;
	  param+="&qte"+cpt+"="+eval("document.getElementById('qte_"+idt+"').value") ;
	}
  }
  param+="&cpt="+cpt ;
  if(res){
    var xhrEtape2 = null ;
    try{
      xhrEtape2 = new XMLHttpRequest(); 
    }
    catch(e){ 
      try{
	    xhrEtape2 = new ActiveXObject("Msxml2.XMLHTTP"); 
	  }  
      catch (e2){ 
        try {
	      xhrEtape2 = new ActiveXObject("Microsoft.XMLHTTP"); 
	    } 
        catch (e) {}
      }
    }
    xhrEtape2.onreadystatechange  = function(){ 
      if(xhrEtape2.readyState==4){
        if(xhrEtape2.status==200){
	      document.getElementById("div_billetteries").innerHTML = xhrEtape2.responseText ;
		  afficheInfosEvenement(ide,idd) ;
	    }
      }
    }; 
	param+= "&ids="+ids ;
    xhrEtape2.open("POST", "inc/etape2.php", true);
    xhrEtape2.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); 
    xhrEtape2.send(param) ;
  }
  else alert("Vous devez choisir une quantité pour passer à l'étape suivante...") ;
}
// ======================================================================================= //
// ======================================================================================= //
// retour liste evenement
// ======================================================================================= //
// ======================================================================================= //
function retourListeEvt(ids,idc){
  var xhrRetourListeEvt = null ;
  try{
    xhrRetourListeEvt = new XMLHttpRequest(); 
  }
  catch(e){ 
    try{
	  xhrRetourListeEvt = new ActiveXObject("Msxml2.XMLHTTP"); 
	} 
    catch (e2){ 
      try {
	    xhrRetourListeEvt = new ActiveXObject("Microsoft.XMLHTTP"); 
	  } 
      catch (e) {}
    }
  }
  xhrRetourListeEvt.onreadystatechange  = function(){ 
    if(xhrRetourListeEvt.readyState==4){
      if(xhrRetourListeEvt.status==200){
	   document.getElementById("div_billetteries").innerHTML = xhrRetourListeEvt.responseText ;
	   document.getElementById("div_infos_evenement").innerHTML = "" ;
	  }
    }
  }; 
  param = "idc="+idc ;
  param+="&ids="+ids ;
  xhrRetourListeEvt.open("POST", "inc/div_billetteries.php", true);
  xhrRetourListeEvt.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); 
  xhrRetourListeEvt.send(param) ;
}
// ======================================================================================= //
// ======================================================================================= //
// retour liste evenement
// ======================================================================================= //
// ======================================================================================= //
function retourChoixTarif(ids,idc,ide,idd){
  var xhrRetourChoixTarif = null ;
  try{
    xhrRetourChoixTarif = new XMLHttpRequest(); 
  }
  catch(e){ 
    try{
	  xhrRetourChoixTarif = new ActiveXObject("Msxml2.XMLHTTP"); 
	} 
    catch (e2){ 
      try {
	    xhrRetourChoixTarif = new ActiveXObject("Microsoft.XMLHTTP"); 
	  } 
      catch (e) {}
    }
  }
  xhrRetourChoixTarif.onreadystatechange  = function(){ 
    if(xhrRetourChoixTarif.readyState==4){
      if(xhrRetourChoixTarif.status==200){
	   document.getElementById("div_billetteries").innerHTML = xhrRetourChoixTarif.responseText ;
	  }
    }
  }; 
  param = "ids="+ids+"&idc="+idc+"&ide="+ide+"&idd="+idd ;
  xhrRetourChoixTarif.open("POST", "inc/etape1.php", true);
  xhrRetourChoixTarif.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); 
  xhrRetourChoixTarif.send(param) ;
}
// ======================================================================================= //
// ======================================================================================= //
// etape 3
// ======================================================================================= //
// ======================================================================================= //
function etape3(ids,idc,ide,idd,idf){
  var res = true ;
  var nom = document.getElementById("nom").value ;
  var prenom = document.getElementById("prenom").value ;
  var adresse = document.getElementById("adresse").value ;
  var cp = document.getElementById("cp").value ;
  var ville = document.getElementById("ville").value ;
  var email = document.getElementById("email").value ;
  var email2 = document.getElementById("email2").value ;
  if(nom==""){
    alert("Veuillez saisir le nom de l'acheteur...") ;
	document.getElementById("nom").focus() ;
	res = false ;
  }
  else if(prenom==""){
	alert("Veuillez saisir le prenom de l'acheteur...") ;
	document.getElementById("prenom").focus() ;
	res = false ;
  }
  else if(email==""){
	alert("Veuillez saisir l'adresse email de l'acheteur...") ;
	document.getElementById("email").focus() ;
	res = false ;
  }
  else if(email!=email2){
	alert("La confirmation de votre adresse email ne correspond pas...") ;
	document.getElementById("email2").focus() ;
	res = false ;
  }
  if(res){
	var res2 = true ;
	param = "ids="+ids+"&idc="+idc+"&ide="+ide+"&idd="+idd+"&nom="+nom+"&prenom="+prenom+"&adresse="+adresse+"&cp="+cp+"&ville="+ville+"&email="+email+"&idf="+idf+"&nbq="+document.getElementById("nbq").value ;
	for(var cpt=1;cpt<=document.getElementById("nbq").value;cpt++){
	  param+="&que_"+cpt+"_id="+eval("document.getElementById('que_"+cpt+"_id').value") ;
	  param+="&que_"+cpt+"_obl="+eval("document.getElementById('que_"+cpt+"_obl').value") ;
	  param+="&rep_"+cpt+"_id="+eval("document.getElementById('rep_"+cpt+"_id').value") ;
	  param+="&reponse_"+cpt+"="+eval("document.getElementById('reponse_"+cpt+"').value") ;
	  if(res2){
	    if(eval("document.getElementById('que_"+cpt+"_obl').value")==1 && eval("document.getElementById('reponse_"+cpt+"').value")==""){
		  alert("Merci de repondre a la question : \""+eval("document.getElementById('que_"+cpt+"_libel').value")+"\"") ;
          eval("document.getElementById('reponse_"+cpt+"').focus()") ;
		  res2 = false ;
		}
	  }
	}
	if(res2){
      var xhrEtape3 = null ;
      try{
        xhrEtape3 = new XMLHttpRequest(); 
      }
      catch(e){ 
        try{
	      xhrEtape3 = new ActiveXObject("Msxml2.XMLHTTP"); 
	    } 
        catch (e2){ 
          try {
	        xhrEtape3 = new ActiveXObject("Microsoft.XMLHTTP"); 
	      }  
          catch (e) {}
        }
      }
      xhrEtape3.onreadystatechange  = function(){ 
        if(xhrEtape3.readyState==4){
          if(xhrEtape3.status==200){
	        document.getElementById("div_billetteries").innerHTML = xhrEtape3.responseText ;
	      }
        }
      }; 
      xhrEtape3.open("POST", "inc/etape3.php", true);
      xhrEtape3.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); 
      xhrEtape3.send(param) ;
	}
  }
}
// ======================================================================================= //
// ======================================================================================= //
// retour a l'etape 2
// ======================================================================================= //
// ======================================================================================= //
function retourEtape2(ids,idc,ide,idd,idf){
  var xhrRetourEtape2 = null ;
    try{
      xhrRetourEtape2 = new XMLHttpRequest(); 
    }
    catch(e){ 
      try{
	    xhrRetourEtape2 = new ActiveXObject("Msxml2.XMLHTTP"); 
	  }  
      catch (e2){ 
        try {
	      xhrRetourEtape2 = new ActiveXObject("Microsoft.XMLHTTP"); 
	    } 
        catch (e) {}
      }
    }
    xhrRetourEtape2.onreadystatechange  = function(){ 
      if(xhrRetourEtape2.readyState==4){
        if(xhrRetourEtape2.status==200){
	      document.getElementById("div_billetteries").innerHTML = xhrRetourEtape2.responseText ;
	    }
      }
    }; 
	var param = "idc="+idc+"&ide="+ide+"&idd="+idd+"&idf="+idf ;
	param+= "&ids="+ids ;
    xhrRetourEtape2.open("POST", "inc/etape2.php", true);
    xhrRetourEtape2.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); 
    xhrRetourEtape2.send(param) ;
}
// ======================================================================================= //
// ======================================================================================= //
// passage a l'etape 4 avec simulation du paiement
// ======================================================================================= //
// ======================================================================================= //
function etape3b(ids,idc,ide,idd,idcli,idf){
  var xhrEtape4 = null ;
  try{
    xhrEtape4 = new XMLHttpRequest(); 
  }
  catch(e){ 
    try{
      xhrEtape4 = new ActiveXObject("Msxml2.XMLHTTP"); 
    }  
    catch (e2){ 
      try {
        xhrEtape4 = new ActiveXObject("Microsoft.XMLHTTP"); 
      } 
      catch (e) {}
    }
  }
  xhrEtape4.onreadystatechange  = function(){ 
    if(xhrEtape4.readyState==4){
      if(xhrEtape4.status==200){
        document.getElementById("div_billetteries").innerHTML = xhrEtape4.responseText ;
      }
    }
  }; 
  var tp = 1 ;
  if(document.form_mode_paiement.tp[0]){
    if(document.form_mode_paiement.tp[0].checked) tp = 1 ;
    else if(document.form_mode_paiement.tp[1].checked) tp = 2 ;
  }
  else tp = document.getElementById("type_mp").value ;
  var param = "idc="+idc+"&ide="+ide+"&idd="+idd+"&idcli="+idcli+"&tp="+tp+"&idf="+idf+"&ids="+ids ;
  xhrEtape4.open("POST", "inc/etape3b.php", true);
  xhrEtape4.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); 
  xhrEtape4.send(param) ;
}
// ======================================================================================= //
// ======================================================================================= //
// retour à l'étape 3
// ======================================================================================= //
// ======================================================================================= //
function retourEtape3(ids,idc,ide,idd,idf){
  var xhrRetourEtape3 = null ;
  try{
    xhrRetourEtape3 = new XMLHttpRequest(); 
  }
  catch(e){ 
    try{
      xhrRetourEtape3 = new ActiveXObject("Msxml2.XMLHTTP"); 
    } 
    catch (e2){ 
      try {
        xhrRetourEtape3 = new ActiveXObject("Microsoft.XMLHTTP"); 
      }  
      catch (e) {}
    }
  }
  xhrRetourEtape3.onreadystatechange  = function(){ 
    if(xhrRetourEtape3.readyState==4){
      if(xhrRetourEtape3.status==200){
        document.getElementById("div_billetteries").innerHTML = xhrRetourEtape3.responseText ;
      }
    }
  }; 
  param = "ids="+ids+"&idc="+idc+"&ide="+ide+"&idd="+idd+"&idf="+idf ;
  xhrRetourEtape3.open("POST", "inc/etape3.php", true);
  xhrRetourEtape3.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); 
  xhrRetourEtape3.send(param) ;
}
// ======================================================================================= //
// ======================================================================================= //
// étape 4
// ======================================================================================= //
// ======================================================================================= //
function etape4(ids,idc,ide,idd,idcli,idf){
  var xhrEtape4 = null ;
  try{
    xhrEtape4 = new XMLHttpRequest(); 
  }
  catch(e){ 
    try{
      xhrEtape4 = new ActiveXObject("Msxml2.XMLHTTP"); 
    }  
    catch (e2){ 
      try {
        xhrEtape4 = new ActiveXObject("Microsoft.XMLHTTP"); 
      } 
      catch (e) {}
    }
  }
  xhrEtape4.onreadystatechange  = function(){ 
    if(xhrEtape4.readyState==4){
      if(xhrEtape4.status==200){
        document.getElementById("div_billetteries").innerHTML = xhrEtape4.responseText ;
      }
    }
  }; 
  var param = "idc="+idc+"&ide="+ide+"&idd="+idd+"&idcli="+idcli+"&idf="+idf+"&ids="+ids ;
  xhrEtape4.open("POST", "inc/etape4.php", true);
  xhrEtape4.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); 
  xhrEtape4.send(param) ;
}
// ======================================================================================= //
// ======================================================================================= //
// afficher cacher
// ======================================================================================= //
// ======================================================================================= //
function afficheCache(nom){
  var display = "none" ;
  if(eval("document.getElementById('"+nom+"').style.display")=="none" || eval("document.getElementById('"+nom+"').style.display")=="") display = "block" ;
  eval("document.getElementById('"+nom+"').style.display = '"+display+"'") ;
}
// ======================================================================================= //
// ======================================================================================= //
// billet
// ======================================================================================= //
// ======================================================================================= //
function billet(){
  document.fbillet.submit() ;
}
