function Bairros(cidade)
{
	xmlHttp=GetXmlHttpObject();
	url="bairros2.asp";
	 
	var cidade = cidade;
	
	str_1 = new String(cidade);
	str_2 = str_1.split(","); 
	
	url = url + "?sid=" + Math.random();
	url = url + "&cidade="+ str_2[0];
	
	xmlHttp.onreadystatechange=Achou;
	 
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
 
	if (xmlHttp.readyState == 1) {
	                              document.getElementById("bairros").innerHTML="<font class='campo'> Aguarde..</font>";
								 
								 if(cidade!=''){
								 	   document.getElementById("textfake_cidade").innerHTML=str_2[1];
									   document.getElementById("bairros_c").value="2";
								     }else{
										 	document.getElementById("textfake_cidade").innerHTML="Cidade";
											document.getElementById("bairros_c").value="1";
										 }
                                 }
}

function Achou() 
	{ 
	
		if (xmlHttp.readyState==4)
			{ 
				document.getElementById("bairros").innerHTML=xmlHttp.responseText;
			}
	}

function GetXmlHttpObject()
	{
	 if (window.XMLHttpRequest) {   
			   a=new XMLHttpRequest(); } //Objeto nativo (FF/Safari/Opera7.6+)  
		   else {  
			 try {   
				a=new ActiveXObject("Msxml2.XMLHTTP");  //activeX (IE5.5+/MSXML2+)  
			 }	 
			 catch(e) {  
			   try {   
				  a=new ActiveXObject("Microsoft.XMLHTTP"); //activeX (IE5+/MSXML1)  
			   }	 
			   catch(e) { /* O navegador não tem suporte */   
				  a=false;   
			   }  
			 }  
		   }   
		   return a;  
	}
