var xhr = null;
 
// Fonction de creation de l'objet XMLHttpRequest qui resservira pour chaques fonctions AJAX
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; 
   } 
 }
 
 
//function fiche()
// {
//  getXhr();
 // xhr.onreadystatechange = function()
 //  {
  //  if(xhr.readyState == 4 && xhr.status == 200)
   //  {
      // Nous recuperons ce coup ci le retour dans une variable
    //  var chaine = xhr.responseText;
	  //document.getElementById('fiche').style.visibility = "visible";
    //  document.getElementById('fiche').innerHTML=(chaine);
	 // alert(chaine);		  
	 // }
  // }
 // xhr.open("GET",'ajax/affiche_fiche.php',true);
 // xhr.send(null);
 //}
 
 
  function envoi_requete(requete)
 {
  getXhr();
  xhr.onreadystatechange = function()
   {
    if(xhr.readyState == 4 && xhr.status == 200)
     {
      // Nous recuperons ce coup ci le retour dans une variable
      var chaine = xhr.responseText;
	  	document.getElementById('fiche').style.visibility = "visible";
		//document.getElementById('fond').style.visibility = "visible";
        document.getElementById('fiche').innerHTML=(chaine);
		//document.getElementsByTagName("html")[0].style.overflow = 'hidden';
		
		
		//POP UP AU CENTRE
		//var position_x = (screen.width)/4 //(largeur ecran - largeur image)/2
        //var position_y = (screen.height)/4 //(hauteur ecran - hauteur image)/2
		//alert(position_x);alert(position_y);
		//document.getElementById("fiche").style.top = position_y;
		//document.getElementById("fiche").style.left = position_x;
        
	  }
   }
  xhr.open("GET",'ajax/'+requete+'',true); 
  xhr.send(null);
 }
 
function cache(){
document.getElementById('fiche').style.visibility = "hidden";
document.getElementById('fond').style.visibility = "hidden";
}
