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;
}

//
// CONSTRUCTOR
//
function CXMLLoader()
{
	this._req = GetXmlHttpObject();
	this._init = true;
	this._xlsStyleSheet = undefined;
	
	if(this._req == null)
	{
		this._init = false;
	}
}

//
// Private data
//
CXMLLoader.prototype._req = undefined;
CXMLLoader.prototype._onData = function(func)
{
	if (this._req.readyState == 4) {
		// only if "OK"
        if (this._req.status == 200) {
			func(this._req.responseText, this._req.responseXML);
		}
		else {
			alert("There was a problem retrieving the XML data:\n" + this._req.statusText);
		}
	}
}

//
// Public Data and Functions
//
CXMLLoader.prototype.load = function (url, func)
{
	// url    : the url to retrieve
	// func   : the function to be called after the data has been returned
	var _this = this;

	this._req.onreadystatechange = function() { _this._onData(func); }

	this._req.open("GET", url, true);
	this._req.send(null);
}

CXMLLoader.prototype.send = function (url, parms, func)
{
	// url    : the url to send the parms to
	// parms  : url encoded parameters
	// func   : the function to be called after the data has been returned
	var _this = this;

	this._req.onreadystatechange = function() { _this._onData(func); }

	this._req.open("POST", url, true);
	this._req.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	this._req.setRequestHeader("Content-length", parms.length);
	this._req.setRequestHeader("Connection", "close");
	this._req.send(parms);
}
