// JavaScript Document

try{
xmlhttp = new XMLHttpRequest();
}
catch(ee){
try{
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e){
try{
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
catch(E){
xmlhttp = false;
}
}
}

function mandaPais(str)	{

// PARA FIREFOX
if (navigator.userAgent.indexOf("Firefox") != -1) { // se Firefox
xmlHttp=GetXmlHttpObject();
}

// PARA IE
if (navigator.userAgent.indexOf("MSIE") != -1) { // se Explorer
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}

if (xmlHttp==null){
alert ("Este browser não suporta HTTP Request")
return
}
var url="selecionaEstado.php"
url=url+"?iso="+str
xmlHttp.open("GET",url)
xmlHttp.onreadystatechange=stateChanged
xmlHttp.send(null)
}

function stateChanged(){
if(xmlHttp.readyState==4){
document.getElementById("exibeEstado").innerHTML=xmlHttp.responseText
}
}

function mandaID(str) {

// PARA FIREFOX
if (navigator.userAgent.indexOf("Firefox") != -1) { // se Firefox
xmlHttp=GetXmlHttpObject();
}

// PARA IE
if (navigator.userAgent.indexOf("MSIE") != -1) { // se Explorer
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}

if (xmlHttp==null){
alert ("Este browser não suporta HTTP Request")
return
}
var url="selecionaCidade.php"
url=url+"?uf="+str
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChangedC
xmlHttp.open("GET",url)
xmlHttp.send(null)
}

function stateChangedC(){
if(xmlHttp.readyState==4){
document.getElementById("exibeCidade").innerHTML=xmlHttp.responseText
}
}

function GetXmlHttpObject() {
var objXMLHttp=null;
		if (window.XMLHttpRequest)
		{
		objXMLHttp=new XMLHttpRequest()
		}
		else if (window.ActiveXObject)
		{
		objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
		}
		return objXMLHttp
		}

