// JavaScript Document
//booleana que verifica inst�ncia v�lida para o IE
var xmlhttp2 = false;

//verificar se � IE
try
{
	xmlhttp2 = new ActiveXObject("Msxml2.XMLHTTP");
	//alert("Internet explorer!");
}
catch(E)
{
	try
	{
		xmlhttp2 = new ActiveXObject("Microsoft.XMLHTTP");
		//alert("Internet explorer!");
	}
	catch (E)
	{
		xmlhttp2 = false;
	}
}

//se estiver usando um navegador diferente do IE que suporta XMLHttpRequest
if(!xmlhttp2 && typeof XMLHttpRequest != 'undefined')
{
	xmlhttp2 = new XMLHttpRequest();
	//alert("Outro browser!");
}

function retornaConteudo(serverPage, objID)
{

	//manda mostrar a div carregando
	document.getElementById('carregando').style.display='block'; 
	
	mostraCarregando('Carregando...');
	
	var obj = document.getElementById(objID);
	xmlhttp2.open("GET",serverPage);
	xmlhttp2.onreadystatechange = function()
	{
		if(xmlhttp2.readyState == 4 && xmlhttp2.status == 200)
		{
			//manda esconder o carregando
			document.getElementById('carregando').style.display='none'; 
			
			//devolve a resposta do Ajax
			obj.innerHTML = xmlhttp2.responseText;
		}
	}
	xmlhttp2.send(null);
}

//informar que está carregando
function mostraCarregando(msg)
{
  var e = document.getElementById('carregando');
  e.innerHTML = "<img src='imagens/ajax.gif'><br />"+msg;
}
