// JavaScript Document
function CarregaDiv(acao){
	var mreq;
	// Procura o componente nativo do Mozilla/Safari para rodar o AJAX 
	if(window.XMLHttpRequest){
		// Inicializa o Componente XMLHTTP do Mozilla
		mreq = new XMLHttpRequest();
	// Caso ele nao  encontre, procura por uma versao ActiveX do IE 
	}else if(window.ActiveXObject){ 
		// Inicializa o Componente ActiveX para o AJAX
		mreq = new ActiveXObject("Microsoft.XMLHTTP");
	}else{ 
		// Caso nao consiga inicializar nenhum dos componentes, exibe um erro
		alert("Seu navegador nao tem suporte a AJAX.");
	}

	// Carrega a funçao de execuçao do AJAX
	mreq.onreadystatechange = function() {
		if(mreq.readyState == 1){
			// Quando estiver "Carregando a página", exibe a mensagem
			document.getElementById(acao).innerHTML = 'Carregando';			
		}else if(mreq.readyState == 4){ 
			// Quando estiver completado o Carregamento
			// Procura pela DIV com o id="minha_div" e insere as informaçoes 
			document.getElementById(acao).innerHTML = mreq.responseText;
		}
	};
	// Envia via método GET as informaçoes
	var strEnvio = "CarregaDivIndex.asp";
	strEnvio = strEnvio + "?Action=" + acao;
	mreq.open("GET",strEnvio,true);
    mreq.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=iso-8859-1") 
	mreq.send(null);
}



/*function LibCreateRequestObject()
{
	var request_o;
	if(navigator.appName == "Microsoft Internet Explorer")
		request_o = new ActiveXObject("Microsoft.XMLHTTP");
	else
		request_o = new XMLHttpRequest();
	return request_o;
}

function CarregaDiv(acao)
{
	var httpPesquisar = LibCreateRequestObject();
	var strEnvio = "CarregaDivIndex.asp";
	strEnvio = strEnvio + "?Action=" + acao;
	httpPesquisar.open('get', strEnvio,false);
	httpPesquisar.send(null);
	httpPesquisar.onreadystatechange = function HandlePesquisa()
	{
		if(httpPesquisar.readyState == 4)
		{
			document.getElementById(acao).innerHTML = httpPesquisar.responseText;
		}
	}
	httpPesquisar.send(null);		
}*/
