// JavaScript Document
	
	function getHTTPObject() {
		var xmlhttp;
		/*@cc_on
		@if (@_jscript_version >= 5)
		try {
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		}catch (e) {
		try {
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}catch (E) {
		xmlhttp = false;
		}
		}
		@else xmlhttp = false;
		@end @*/
		if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
			try { xmlhttp = new XMLHttpRequest();
			} catch (e) {
				xmlhttp = false;
			}
		}
		return xmlhttp;
	}
	
		function getFoto(foto) {
			var req = new getHTTPObject();
			req.open('GET', 'includes/getfoto.php?foto='+foto, false);
			req.setRequestHeader('Content-type',
			'application/x-www-form-urlencoded;charset=ISO-8859-1;');

			req.send(null);
			if(req.status == 200)
			{
				document.getElementById('foto').innerHTML = req.responseText;	
			} 
		}
		
function getBairros(cidade){
		var req = new getHTTPObject();
		//limpa o select
		var c=document.getElementById("bairro")
		while(c.options.length>0)c.options[0]=null
		c.options[0]=new Option(" -- Aguarde ... -- "," -- Aguarde ... -- ")
	
		//Monta a url com a uf
		req.open("GET", "/includes/getbairros.php?cidade="+cidade,false);
		req.setRequestHeader('Content-type',
		'application/x-www-form-urlencoded;charset=UTF-8;');
		req.send(null);
		
		if(req.status==200)
		{
			var c=document.getElementById("bairro")
			while(c.options.length>0)c.options[0]=null
			var bairros = req.responseText.split(",");
			c.options[0] = new Option('Todos',0);
			for(var i=0;i<bairros.length;i++){
				bairros[i]=unescape(bairros[i])
				c.options[c.options.length]=new Option(bairros[i],bairros[i])
			}
		}
}