//-------------------------------------------------------------------
// CLASSE C_XML_HTTP_Request
// By Felipe Souza 
//-------------------------------------------------------------------
function c_xml_http_request()
{
	this.req_header = new Array();
	this.req_value  = new Array();

	if( !( document.implementation && document.implementation.createDocument ) )
	{
		var A_ACTIVEX = [ "Msxml2.XMLHTTP", "Microsoft.XMLHTTP" ];
		
		for( var i=0; i < A_ACTIVEX.length && !this.xmlhttp; i++ )
			this.xmlhttp = new ActiveXObject( A_ACTIVEX[i] );
		
		this.isIE = true;
	}
	else
		this.xmlhttp = new XMLHttpRequest();
}

c_xml_http_request.prototype.load = function( s_method, s_url, httpRequest, s_callback )
{
	if( !s_method || !s_url )
		return false;
	
	if( this.isIE )
		this.xmlhttp.Open( s_method, s_url, false );
	else
		this.xmlhttp.open( s_method, s_url, false );

	for( var x = 0; x < this.req_header.length; x ++ )
		this.xmlhttp.setRequestHeader( this.req_header[x], this.req_value[x] );

	this.xmlhttp.send( httpRequest );

	this.text = this.xmlhttp.responseText;
	
	if( s_callback ) eval( s_callback );

	return this.xmlhttp.responseText;
}

c_xml_http_request.prototype.setRequestHeader = function( s_header, s_value )
{
	if( !s_header || !s_value )
		return false;

	this.req_header[ this.req_header.length ] = s_header;
	this.req_value[ this.req_value.length ]	  = s_value;
}
