function ajax(url)
{
  if (url != 'ajax_auth_id.php') {
  	var ajax_auth_id = ajax('ajax_auth_id.php');
  }	  
  if (window.XMLHttpRequest) {
    objXHR = new XMLHttpRequest();
  } else {
    if (window.ActiveXObject) { 
      objXHR = new ActiveXObject("Microsoft.XMLHTTP");
    } else { 
      return false; 
    }
  }
  if (url != 'ajax_auth_id.php') {
  	objXHR.open("GET",url  + '&ajax_auth_id=' + ajax_auth_id,false);
  } else {
  	objXHR.open("GET",url,false);
  }
  objXHR.send(null);
  
  if (objXHR.readyState == 4) {
   	if (objXHR.responseText != 'Unauthorized access') {
    	return objXHR.responseText;
    } else {
    	document.location = '404.php';
    } 
  } else {
    return false;
  }
}

function ajax_async(url,function_return,function_wait)
{
    var xhr=null;
    
    if (window.XMLHttpRequest) { 
        xhr = new XMLHttpRequest();
    }
    else if (window.ActiveXObject) 
    {
        xhr = new ActiveXObject("Microsoft.XMLHTTP");
    }
    //on définit l'appel de la fonction au retour serveur
    xhr.onreadystatechange = function() {
    	if (xhr.readyState==4) {
   			if (xhr.responseText != 'Unauthorized access') {
	    		eval(function_return);
    		} else {
    			document.location = '404.php';
    		}
    	} 
 	};
    
    //on affiche le message d'acceuil
    if (function_wait != '') eval(function_wait);

    //on appelle le fichier reponse.txt
    var ajax_auth_id = ajax('ajax_auth_id.php');
    xhr.open("GET", url + '&ajax_auth_id=' + ajax_auth_id, true);
    xhr.send(null);
}
