﻿function openAjax(){var Ajax;try{Ajax=new XMLHttpRequest();}catch(ee){try{Ajax=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{Ajax=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){Ajax=false;}}}
return Ajax;}
function carregaAjax(id,url,metodo){if(document.getElementById){var exibeResultado=document.getElementById(id);var Ajax=openAjax();if(metodo=='GET'){Ajax.open("GET",url,true);Ajax.onreadystatechange=function()
{if(Ajax.readyState==1){exibeResultado.innerHTML="carregando ...";}
if(Ajax.readyState==4){if(Ajax.status==200){var resultado=Ajax.responseText;resultado=resultado.replace(/\+/g," ");resultado=unescape(resultado);exibeResultado.innerHTML=resultado;}else{exibeResultado.innerHTML="Erro: .";}}}
Ajax.send(null);}else if(metodo=='POST'){Ajax.open("POST",url,true);Ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");Ajax.onreadystatechange=function()
{if(Ajax.readyState==1){exibeResultado.innerHTML="<div align='center'><strong>Carregando...</strong></div>";}
if(Ajax.readyState==4){if(Ajax.status==200){var resultado=Ajax.responseText;resultado=resultado.replace(/\+/g," ");resultado=unescape(resultado);exibeResultado.innerHTML=resultado;}else{exibeResultado.innerHTML="Erro: .";}}}
Ajax.send(dados+'&method=post');}}}
