/*
*Função que facilita o comando getElementById
*/
	function getObj(idObj)
	{
		return document.getElementById(idObj);
	}

/*
*Função usada para se instaciar um objeto desse tipo
*/
	function criaXMLHttp()
	{

	  var xmlHttp = null;
	  try
	  {
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	  }
	  catch (e)
	  {
		 // Internet Explorer
		 try
		 {
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		 }
		 catch (e)
		 {
			  try
			  {
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			  }
	  		  catch (e)
			  {
				alert("Seu suporte não suporta AJAX!");
				return false;
			  }
		 }
	   }

	  return xmlHttp;
	}



	/*
	 *  id_do_objeto - Objeto que vai ser modificado com o conteúdo da requisição AJAX
	 * url_destino - URL que vai ser buscada por ajax
	 */
	function getUrl2(url_destino,id_do_objeto_destino)
	{

		//alert(url_destino);

		xmlHttp = criaXMLHttp();
		xmlHttp.open("POST",url_destino,true);

		xmlHttp.onreadystatechange = function()
		{
			if(xmlHttp.readyState==4)
			{
				getObj(id_do_objeto_destino).innerHTML = xmlHttp.responseText;
			}
		}
		xmlHttp.send(null);

	}



	function getUrl(url_destino,id_do_objeto_destino)
	{

		//alert(url_destino);



		xmlHttp = criaXMLHttp();
		xmlHttp.open("POST",url_destino,true);

		xmlHttp.onreadystatechange = function()
		{
			if(xmlHttp.readyState==4)
			{
				getObj(id_do_objeto_destino).innerHTML = xmlHttp.responseText;
			}
		}
		xmlHttp.send(null);

	}


	//Chama uma página, apresenta em algum objeto e executa algo depois
	//Função de ajax com possibildade de se executar algo depois
	function getUrl_execute_function(url_destino, id_do_objeto_destino, executar_depois)
	{
		var xmlHttp = null;
		xmlHttp = criaXMLHttp();
		xmlHttp.open("POST",url_destino,true);

		xmlHttp.onreadystatechange = function()
		{
			if(xmlHttp.readyState==4)
			{
				getObj(id_do_objeto_destino).innerHTML = xmlHttp.responseText;
				setTimeout(executar_depois,1);
			}
		}
		xmlHttp.send(null);

	}
