/**
 *	Object for making AJAX requests.
 */
function AjaxObject()
{
	this.xmlHttp = null;
	try
	{
		// Firefox, Opera 8.0+, Safari
		this.xmlHttp = new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer
		try { this.xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); }
		catch (e) { this.xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); }
	}
}

AjaxObject.prototype.getResponse = function()
{
	var result;
	if (this.xmlHttp.readyState == 4)
	{
		if (this.xmlHttp.status == 200)
		{
			result = this.xmlHttp.responseText;
		}
		else
		{
			result = "Error retrieving data: " + this.xmlHttp.statusText;
		}
	}
	else
	{
		result = "Loading - Please wait";
	}
	return result;
};

AjaxObject.prototype.isReady = function()
{
	return this.xmlHttp.readyState == 4;
};

AjaxObject.prototype.isSupported = function()
{
	return this.xmlHttp != null;
};

AjaxObject.prototype.sendRequest = function(url, method, stateChanged, params)
{
	// The following allows cross context Ajax requests.
	/*
	try 
	{
		netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
    	netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
	}
	catch (e) { }
	*/
	this.xmlHttp.onreadystatechange = stateChanged;
	this.xmlHttp.open(method, url, true);
	if (params != null)
	{
		this.xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		this.xmlHttp.setRequestHeader("Content-length", params.length);
		this.xmlHttp.setRequestHeader("Connection", "close");
		this.xmlHttp.send(params);
	}
	else
	{
		this.xmlHttp.send(null);
	}
};