function SimpleAJAX()
{
	
	var xmlhttp = null; //objeto XMLHttpRequest
	var client; // funçao que tratara o valor xmlhttp
	var config = new Array(); // configuraçao
	config['transferMode'] = 'GET';
	config['responseType'] = 'text';
	config['contentType']  = 'text/xml';
	config['str'] = null;
	

	this.setTransferMode = function(mode)
	{
		if(mode == 'get')
			config['transferMode'] = 'GET';
		else if(mode == 'post')
			config['transferMode'] = 'POST';
	}
	this.setResponseType = function(type)
	{
		config['responseType'] = type;
	}
	this.setContentType = function(type)
	{
		if(type == 'form')
			config['contentType'] = "application/x-www-form-urlencoded; charset=UTF-8";
		else if(type == 'text')
			config['contentType'] = "text/xml; charset=UTF-8";		
	}
	this.setUrl = function()
	{
		config['url'] = arguments[0];
	}
	this.setClient = function()
	{
		client = arguments[0];
	}
	this.setStr = function(str)
	{
		config['str'] = str;
	}
	this.openAjax = function()
	{
		try{
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		}catch(e){
			try{			
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			}catch(E){
				xmlhttp = false;
			}		
		}
		if (!xmlhttp && typeof XMLHttpRequest != 'undefined')
		{
			try{
				xmlhttp = new XMLHttpRequest();
			}catch(e){
				xmlhttp = false;
			}
		}
	}
	this.requestAjax = function()
	{
		this.openAjax();
			
		if(xmlhttp)
		{
			xmlhttp.onreadystatechange = this.processState;

			switch(config['transferMode'])
			{
				case 'GET':
					xmlhttp.open(config['transferMode'], config['url']);
					break;
				case 'POST':
					xmlhttp.open(config['transferMode'], config['url'],true);
					break;
			}			
				
			xmlhttp.setRequestHeader("Content-Type", config['contentType']);
			xmlhttp.setRequestHeader("charset","UTF-8");
			xmlhttp.setRequestHeader("Encoding","UTF-8");
			switch(config['method'])
			{
				case null:
					xmlhttp.send(config['str']);
					break;
				default:
					xmlhttp.send(config['str']);
					break;				
			}
		}
		else
			alert("xmlhttp nao inicializado");
	}
	this.processState = function()
	{
		if(xmlhttp.readyState == 4 && xmlhttp.status == 200)
		{
			var response;
			if(config['responseType'] == "xml")
			{
				response = xmlhttp.responseXML;
			}
			if(config['responseType'] == "text")
			{
				response = xmlhttp.responseText;
			}
			client(response);
		}
		if(xmlhttp.readyState == 4 && xmlhttp.status == 404)
			alert('página não encontrada');
	}
	
}