function Request ()
{
	this.http = oDOMUtils.getHTTPObject();
	this.responseText = null;
	this.responseXML = null;
	this.working = false;
	this.xmlType = null;
	this.method = null;
	this.url = null;
	this.data = null;
	this.xmlType = null;
	this.assynchronous = true;
	this.listenerObjList = new Array();
}

Request.prototype.addRequestListener = function (obj)
{
	this.listenerObjList.push(obj);
}

Request.prototype.submit = function (formObj)
{
	this.method = formObj.method;
	this.url = formObj.action;
	this.data = oDOMUtils.getFormData(formObj);
	this.open();
}

Request.prototype.open = function()
{
	if (!this.working)
	{
		var me = this;
		this.http.open(this.method, this.url, this.assynchronous);
		this.http.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=iso-8859-1");
		this.http.setRequestHeader("Cache-Control","no-store, no-cache, must-revalidate");
		this.http.setRequestHeader("Cache-Control","post-check=0, pre-check=0");
		this.http.setRequestHeader("Pragma", "no-cache");
		this.http.onreadystatechange = function () { me.getRequestAnswer() };
		this.http.send(this.data);
		this.working = true;
	}
}

Request.prototype.getRequestAnswer = function ()
{
	if (this.http.readyState == 4)
	{
		this.working = false;
		if (this.http.status == 200) 
		{
			this.responseText = this.http.responseText;
			this.responseXML = this.http.responseXML;
			
			tempList = this.listenerObjList;
			this.listenerObjList = null;
			this.listenerObjList = new Array();
			 
			if(tempList)
			{
			    for (i = 0; i < tempList.length; i++)
			    {
			    	tempList[i].ajaxRequestFinished();
			    }
			}
		   
		   	tempList = null;
		
		}
		else
		{
			alert('Ocorreu um erro desconhecido: '+this.http.status);
		}
	}
}

Request.prototype.getResponseText = function ()
{
	return this.responseText;	
}

Request.prototype.getResponseXML = function ()
{
	return this.responseXML;	
}