<!--
//-------------------------------------------------------------------------------
//	
// Dernières Modification :
//	28/07/2006 - FBN :  ajout de la fonction getContentURLAsynchrone pour faire fonctionner le mode Asynchrone pour le PDF
//	24/09/2007 - RBR :	ajout de la fonction getResponseService de mef pour l'ajax dans la recherche de financement
//-------------------------------------------------------------------------------
var xhr_object;

function getContentURLAsynchrone(method, strUrl, strData, strAction) {

	var retour = "";

	if (window.XMLHttpRequest) // Firefox   
		xhr_object = new XMLHttpRequest();
	else if(window.ActiveXObject) // Internet Explorer  
		xhr_object = new ActiveXObject("Microsoft.XMLHTTP");   
	else { // XMLHttpRequest non supporté par le navigateur   
		alert("Erreur : Votre navigateur ne supporte pas les objets XMLHTTPRequest");
		return;
	}
	 
	if (method != "POST" && strData != "") {
		strUrl = strUrl + "?" + strData;
	}
	xhr_object.open(method, strUrl, true); 

	xhr_object.onreadystatechange = function() {
		
		if(xhr_object.readyState == 4) {
			var retour = xhr_object.responseText;
			
//			if (retour.indexOf("\"") >= 0 || xhr_object.status != 200) {
			if (xhr_object.status != 200) {
				alert("Erreur : \n\n" + retour);
				retour = "";
			}
			else {
				retour = retour.replace(new RegExp("'", "g"), "\\'");
				retour = retour.replace(new RegExp("\n", "g"), "\\n");				
				retour = strAction.replace(new RegExp("contentUrl", "g"), "'" + retour + "'");

				eval(retour);
			}			
			xhr_object = null;
		}
	}

	if (method == "POST") {
		xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");   
	}

	xhr_object.send(null);
	

	return retour;
}

function getContentURL(method, strUrl, strData, strAction) {
		
	var retour = "";

	if (window.XMLHttpRequest) // Firefox   
		xhr_object = new XMLHttpRequest();
	else if(window.ActiveXObject) // Internet Explorer  
		xhr_object = new ActiveXObject("Microsoft.XMLHTTP");   
	else { // XMLHttpRequest non supporté par le navigateur   
		alert("Erreur : Votre navigateur ne supporte pas les objets XMLHTTPRequest");
		return;
	}
	 
	if (method != "POST" && strData != "") {
		strUrl = strUrl + "?" + strData;
	}
	xhr_object.open(method, strUrl, false); 
	
	xhr_object_onreadystatechange = function() {
		if(xhr_object.readyState == 4) {
			var retour = xhr_object.responseText;
			
			//alert(xhr_object.status);
			if (retour.indexOf("\"") >= 0 || xhr_object.status != 200) {
				alert("Erreur : \n\n" + retour);
				retour = "";
			}
			else {
			//alert(retour);
				//retour = replaceAll(retour, "'", "\\'");
				//retour = replaceAll(retour, "\n", "\\n");
				retour = retour.replace(new RegExp("'", "g"), "\\'");
				retour = retour.replace(new RegExp("\n", "g"), "\\n");				
				retour = strAction.replace(new RegExp("contentUrl", "g"), "'" + retour + "'");
				
				eval(retour);
			}			
			xhr_object = null;
		}
	}
	
	if (method == "POST") {
		xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");   
	}
	xhr_object.send(strData);
	
	xhr_object_onreadystatechange();
		   	
	return retour;
}

function getResponseURL(method, strUrl, strData) {
	var xhr_object;
	
	var retour = "";

	if(window.XMLHttpRequest) // Firefox   
		xhr_object = new XMLHttpRequest();
	else if(window.ActiveXObject) // Internet Explorer  
		xhr_object = new ActiveXObject("Microsoft.XMLHTTP");   
	else { // XMLHttpRequest non supporté par le navigateur   
		alert("Erreur : Votre navigateur ne supporte pas les objets XMLHTTPRequest");
		return;
	}
	 
	if (method != "POST") {
		strUrl = strUrl + "?" + strData;
	}

	xhr_object.open(method, strUrl, false);
		
	xhr_object.send(strData);
	
	retour = xhr_object.responseText;	
	
	return retour;
}

// utilisation de sigma-navigateur
function getResponseService(url, params) {	
	var monService = new SigmaService();
	monService.url = url;
	monService.params = params;
	//monService.callback = handler;
	monService.lancerSynchrone();
	
	return monService.reponseText;
}
//-->
