/*
 * AJAX - Asynchronous JavaScript And XML Functions
 * 
 */

/**
 * Function to get the XMLHTTP Object, if returns null - browser very old!
 * 
 * Usage:
 * 
 * var xmlHttp = GetXmlHttpObject()
 * 
 * var url = "/your_request?id=x";
 * xmlHttp.onreadystatechange=stateChanged;
 * xmlHttp.open("GET",url,true); (true=asynchronous)
 * xmlHttp.send(null);
 * 
 * Define a function called stateChanged()
 * 
 * Verify xmlHttp.readyState :
 * 0 = The request is not initialized
 * 1 = The request has been set up
 * 2 = The request has been sent
 * 3 = The request is in process
 * 4 = The request is complete
 * 
 * Server's answer: xmlHttp.responseText
 * 
 * If your answer is XML then do: 
 * var xmlDoc=xmlHttp.responseXML.documentElement;
 * 
 */
function GetXmlHttpObject() {
	var xmlHttp=null;
	try {
	  // Firefox, Opera 8.0+, Safari
	  xmlHttp=new XMLHttpRequest();
	  } catch (e) {
	  // Internet Explorer
	  try {
	    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
	  } catch (e) {
	    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	}
	return xmlHttp;
}