var xmlHttp
var myIndex
var myCond
var campo

//Lista cidades por estado
function ajaxRede(aj_acao,aj_valor,aj_campo)
{
	campo=aj_campo;
	document.getElementById(campo).innerHTML="<img src='images/hourglass_trans.gif'>";
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
  	{
		alert ("O seu navegador não suporta AJAX!");
		return;
  	}
	var url="./inc/rede_ajax.asp?ajax_acao=" + aj_acao + "&ajax_valor=" + aj_valor;
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function stateChanged() 
{ 
if (xmlHttp.readyState==4)
   {
	   document.getElementById(campo).innerHTML=xmlHttp.responseText;
	   
	  /* if ( xmlHttp.status == 200)
	   {
		   if (myIndex=="")
		   {
			   document.getElementById("NomeCPF").innerHTML=xmlHttp.responseText;
		   } else {
			   document.getElementById("Nome"+myIndex).innerHTML=xmlHttp.responseText;
		   }
	   }*/
   }
}

function GetXmlHttpObject()
{
	var xmlHttp=null;
	try
	  {
	  // Firefox, Opera 8.0+, Safari
	  xmlHttp=new XMLHttpRequest();
	  }
	catch (e)
	  {
	  // Internet Explorer
	  try
		{
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
	  catch (e)
		{
		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	  }
	return xmlHttp;
}



