/**
 * Objet XmlHTTPRequest
 */
function getXMLHTTPRequest() {
	var xRequest=null;
	if (window.XMLHttpRequest) {
		xRequest=new XMLHttpRequest();
	}else if (typeof ActiveXObject != "undefined"){
		xRequest=new ActiveXObject("Microsoft.XMLHTTP");
	}
	return xRequest;
}

/**
 * envoie un request ajax a un uri et attendre la r?ponse, asynchrone si callbackFunction 
 * n'est pas sp?cifi?e, c a d la r?ponse est obtenue directement
 * sinon elle est renvoyee ? la fonction callbackFunction
 */
function sendAjaxRequest(uri, callbackFunction, functionArgs) {
//	alert('call to ' + uri);
	  var xmlHttp = getXMLHTTPRequest();
	  var bAsync = true;
	  if (!callbackFunction)
	    bAsync = false;    
	  xmlHttp.open('GET', uri, bAsync);
	  //xmlHttp.setRequestHeader("Content-type","text/html; charset=iso-8859-1");
	  xmlHttp.send(null);  

	  if (bAsync) {
	    if (callbackFunction) {
	      xmlHttp.onreadystatechange = function() {
	        if (xmlHttp.readyState == 4)
	          callbackFunction(xmlHttp.responseText, functionArgs);
	      }
	    }
	    return true;
	  }
	  else {
	    return xmlHttp.responseText;
	  }
}