/**
  * Classe HttpReq
**/
function HttpReq()
{
	this.xhr = null; 
}

HttpReq.prototype.getXhr = function()
{
	var xhr;
	if(window.XMLHttpRequest) // Firefox et autres
	   xhr = new XMLHttpRequest(); 
	else if(window.ActiveXObject)
	{ // Internet Explorer 
	    try 
	    {
           xhr = new ActiveXObject("Msxml2.XMLHTTP");
        } 
		catch (e)
		{
           xhr = new ActiveXObject("Microsoft.XMLHTTP");
        }
	}
	else 
	{ // XMLHttpRequest non supporté par le navigateur 
	   alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest..."); 
	   xhr = false; 
	}
	
	return xhr;
} // getXhr()


HttpReq.prototype.goGet = function(id,url,async /* true | false */)
{
	var xhr = this.getXhr();

	xhr.onreadystatechange = function() 
	{
		if (xhr.readyState == 4 && xhr.status == 200) 
		{
			if(async)
			{
				if(id != null)
				{
					var c = document.getElementById(id);
					c.innerHTML = xhr.responseText;
		
					var allscript = c.getElementsByTagName("script");
					for(var i=0; i < allscript.length; i++) 
					{ 
						window.eval(allscript[i].text);	
					}
				}
			}
		}
	}
	
	xhr.open("GET",url,async);
	xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	xhr.send(null);
}//goGet()

HttpReq.prototype.goPost = function(id,url,send,async /* true | false */)
{
	var xhr = this.getXhr();
		
	xhr.onreadystatechange = function() 
	{
		if (xhr.readyState == 4 && xhr.status == 200) 
		{
			if(async)
			{
				var c = document.getElementById(id);
				c.innerHTML = xhr.responseText;
				var allscript = c.getElementsByTagName("script");
				for(var i=0; i < allscript.length; i++) 
				{ 
					window.eval(allscript[i].text);
				}
			}
		}
	}
	
	xhr.open("POST",url,async);
	xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	xhr.send(send);
}//goGet()