//
// AJAX request objects
//

function getHttpRequestObject()
{
 var XmlHttp = false;
 try
 {
	// Legacy implementation
	XmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
 }
 catch(e)
 {
	try
	{
	    // IE implementation
	    XmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	}
	catch(E)
	{
	    XmlHttp = false;
	}
 }
 if (!XmlHttp && typeof XMLHttpRequest != "undefined")
 {
	// Mozilla implementation
	XmlHttp = new XMLHttpRequest();
 }
 return XmlHttp;
}

function getHttpRequestObjectResults(XmlHttp,objFunc)
{
	if (XmlHttp.readyState == 4)
	{
		if (XmlHttp.status == 200)
		{
		    objFunc(XmlHttp.responseXML);    
		}
		else
		{
		    //alert('XmlHttp.statusText: ' + XmlHttp.statusText);
		}
	}
}

function ajaxRequest(path,data,objFunc,asynch)
{
	var XmlHttp = new getHttpRequestObject();
	XmlHttp.open("POST", path, asynch);
	XmlHttp.onreadystatechange = function() { getHttpRequestObjectResults(XmlHttp,objFunc); };
	try
	{
		XmlHttp.send(data);
	}
	catch(e)
	{
		alert(e);
	}
}
