
	//
	// divId 				: div de destination
	// url 					: l'url a charger dans le div de destination
	// splash 			: afficher ou non un 'loading please wait'
	// callBack 		: fonction démarrée apres le chargement
	// argt 				: argument a passer a la fonction de callback
	// callMethod 	: methode de transfert des données : GET ou POST
	//
	// Appel type 1 : loadXMLDoc([['divId','destination1Id'],['callUrl','page2.php?a=12'],['callMethod','POST'],['callBack',page],['callArgt',1],['splash',1]]);
	// Appel type 2 : loadXMLDoc('destination2Id','page2.php?a=12',1,'GET',page,1);"
	
	function loadXMLDoc(divId,callUrl,splash,callMethod,callBack,callArgt)
	{
		if(typeof(divId) == "object" && arguments.length == 1)
		{
			var a = divId;
			for(x=0;x<a.length;x++)
			{
				eval("var " + a[x][0] + "=a[x][1]")
			}
		}
		
		var xmlhttp
		
		if(!document.getElementById(divId))
		{
			alert('DIV ' + divId + ' not found');
			return 0;
		}
		
		if(!callMethod)
		{
			var callMethod = "GET";
		}
		
		if(splash == 1)
		{
			if(typeof(splash_content) != "undefined")
			{
				document.getElementById(divId).innerHTML = splash_content;
			}
			else
			{
				document.getElementById(divId).innerHTML = '<div align="center">Working in progress ... please wait</div>';
			}
		}
		
		var b = constructUrl(callUrl)
		
		if(callMethod == "POST")
			callUrl = b[0];
		else
			callUrl = b[0] + '?' + b[1];
		
		function state_Change()
		{
			if (xmlhttp.readyState == 4)
		  {
			  if (xmlhttp.status == 200)
			  {
				  document.getElementById(divId).innerHTML = xmlhttp.responseText
				  if(callBack && callArgt)
				  	callBack(callArgt);
				  else if(callBack)
				  	callBack();
			  }
			  else
			  {
				  alert("Problem retrieving XML data\nUrl : " + callUrl + "\nError : " +  xmlhttp.statusText)
			  }
		  }
		}
		
		if (window.XMLHttpRequest)
	  {
		  xmlhttp=new XMLHttpRequest()
		  xmlhttp.onreadystatechange = state_Change;
		  xmlhttp.open(callMethod,callUrl,true)
		  if(callMethod == "POST")
		  {
		  	xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded;text/html;charset=utf-8");
		  	xmlhttp.send(b[1])
		  }
			else
				xmlhttp.send(null)
	  }
		else if (window.ActiveXObject)
		{
			xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
	    if (xmlhttp)
	    {
		    xmlhttp.open(callMethod,callUrl,true)
		    xmlhttp.onreadystatechange = state_Change
			  if(callMethod == "POST")
			  {
			  	xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded;text/html;charset=utf-8");
			  	xmlhttp.send(b[1])
			  }
				else
			    xmlhttp.send()
	 		}
	  }
	  
	  return 0;
	}

	function constructUrl(url)
	{
		var reg = new RegExp("\\?");
		var now = new Date();
		var timestamp = now.getTime();
		
		if (reg.test(url)) sep = "&"; else sep = "?";
		url = url + sep + "refresh=" + timestamp;

		var a = url.split('?');
		return a;
	}
