
// stores the reference to the XMLHttpRequest object
var xmlHttpRequest = CreateXmlHttpRequestObject(); 

// retrieves the XMLHttpRequest object
function CreateXmlHttpRequestObject() 
{  
	// will store the reference to the XMLHttpRequest object
	var xmlHttpRequest;
	var errorMessage = "";
	if (window.ActiveXObject) // if running Internet Explorer
	{
		try
		{
			xmlHttpRequest = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try
			{
				xmlHttpRequest = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e) 
			{
				xmlHttpRequest = false;
				errorMessage = e.name + ": " + e.message;
			}
		}
	}
	else if (window.XMLHttpRequest) // if running Mozilla or other browsers
	{
		try 
		{
			xmlHttpRequest = new XMLHttpRequest();
		}
		catch (e) 
		{
			xmlHttpRequest = false;
			errorMessage = e.name + ": " + e.message;
		}
	}
	else // can't figure out how to create request
	{
		xmlHttpRequest = false;
		errorMessage = "Cannot find window.Msxml2.XMLHTTP, window.Microsoft.XMLHTTP, or window.XMLHttpRequest";
	}
	if (!xmlHttpRequest)
	{
		// At this time, do nothing
	}

	// return the created object or false if the create failed
	return xmlHttpRequest;
}

