// JavaScript Document
function ajaxVerify(urlVerify, idCampo, idCarga) {
		
		var checkCampo = document.getElementById(idCampo).value;
		
		xmlhttp.open("POST", urlVerify+checkCampo, true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById(idCarga).innerHTML = '<img src="img/loading.gif"/>'
		   if(xmlhttp.readyState == 4){
					document.getElementById(idCarga).innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}
function ajaxCidadeCadastro() {
		xmlhttp.open("POST", "includes/viewCidades.asp?uf="+document.getElementById('uf').value ,true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('id_cidade').innerHTML = '<select name="cidade" class="fontTrebuchet11Preto" id="cidade" style="width: 150px;" disabled="disabled"><option value="">selecione</option></select>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('id_cidade').innerHTML = xmlhttp.responseText
					ajaxBairroCadastro()
				}}
			xmlhttp.send('') 
}
function ajaxBairroCadastro() {
		xmlhttp.open("POST", "includes/viewBairros.asp?uf="+document.getElementById('uf').value+"&cidade="+document.getElementById('cidade').value ,true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('id_bairro').innerHTML = '<select name="bairro" class="fontTrebuchet11Preto" id="bairro" style="width: 150px;" disabled="disabled"><option value="">selecione</option></select>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('id_bairro').innerHTML = xmlhttp.responseText
					ajaxUfCidadeBairroCadastro()
				}}
			xmlhttp.send('') 
}
function ajaxUfCidadeBairroCadastro() {
		xmlhttp.open("POST", "includes/viewUfCidadeBairro.asp?uf="+document.getElementById('uf').value+"&cidade="+document.getElementById('cidade').value+"&bairro="+document.getElementById('bairro').value ,true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('ufCidadeBairro').innerHTML = ''
		   if(xmlhttp.readyState == 4){
					document.getElementById('ufCidadeBairro').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}
