function getXhr()
 {
  if(window.XMLHttpRequest) xhr = new XMLHttpRequest();
  else if(window.ActiveXObject)
   {
    try
     {
      xhr = new ActiveXObject("Msxml2.XMLHTTP");
     }
    catch (e)
     {
      xhr = new ActiveXObject("Microsoft.XMLHTTP");
     }
   }
  else
   {
    alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest, veuillez le mettre à jour");
    xhr = false;
   }
   return xhr;
 }
 
function afficheTitre(page_cour,lang){
	xhr9=getXhr();
  xhr9.onreadystatechange = function(){
    if(xhr9.readyState == 4 &&  xhr9.status== 200){
      document.getElementById("block_news").innerHTML=xhr9.responseText;
     }
  }
  xhr9.open("POST",'ajax/php/affiche_titres_news.php',true);
  xhr9.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
  xhr9.send("pageCour="+page_cour+"&langue="+lang);
}

function incrementCompteurDevis() {
	xhr10=getXhr();
    
	xhr10.open('GET', 'inc/ajax/php/incrementCompteurDevis.php?code=verificationAcces', true);
  xhr10.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
  xhr10.send(null);
}

function changeNumE(etat,langue){
	
  getXhr();
  xhr.onreadystatechange = function()
  {
    if(xhr.readyState == 4 && xhr.status == 200)
    {
      // Nous remplacons le contenu du div iris par le retour de "ajax/ajaxiris.php"
	  	if(etat=='0'){
      	document.getElementById('txtCottage').innerHTML = '';
				document.getElementById('selectCottage').innerHTML = xhr.responseText;
			}else if(etat=='1'){
				document.getElementById('txtCottage').innerHTML = '';
				document.getElementById('selectCottage').innerHTML = xhr.responseText;
	    }
    }
  }
  xhr.open("POST",'inc/ajax/php/select_cottage.php',true);
  xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=iso-8859-1');
  xhr.send("lang="+langue+"&etat="+etat);

}

