/**
 * Função que retorna o objeto que
 * faz requisição ajax
 *
 * @return
 */
var xmlhttp;
function objAjax()
{
	try {
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
	catch(e) {
	    try {
	    	xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	    }
	    catch(ex) {
		      try {
		    	  xmlhttp = new XMLHttpRequest();
		      }
		      catch(exc) {
		      	alert("Esse browser não tem recursos para uso do Ajax");
		      	xmlhttp = null;
		      }
	    }
	}
	return xmlhttp;
}
 
function consultaSeccao(codUf){
  	if(objAjax() != null) {
	    mensagem = document.getElementById("mensagem");
 
		var url="consulta.php"
		url=url+"?id_cat="+codUf;
		xmlhttp.onreadystatechange = function() {
			      //enquanto estiver processando...emite a msg de carregando
			      if(xmlhttp.readyState == 1) {
			    	  mensagem.innerHTML = "A carregar dados!";
			      }
			      //após ser processado a requisicao ajax
			      if(xmlhttp.readyState == 4 ) {
			    	  	if(xmlhttp.responseText){
			    	    	document.getElementById("seccao").innerHTML = xmlhttp.responseText;
			    	    	mensagem.innerHTML = "";
				        }else {
					     	mensagem.innerHTML = "Selecione o estado";
					    }
			      }
			  }
		xmlhttp.open("GET",url,true)
		xmlhttp.send(null)
 
  	}
}

function Acompanhante(op){
        if(op == 1)
		{
            document.getElementById('acompanhantes').style.display = "";
        }
		else if(op == 0)
		{
            document.getElementById('acompanhantes').style.display = "none";
		}
	}
	
function evento_local_xpto(op){
	formulario_inscricao.local.value = op;
}
function evento_local(op){
  	if(objAjax() != null) {

		var url="consulta_2.php"
		url=url+"?id="+op;
		xmlhttp.onreadystatechange = function() {
			      //enquanto estiver processando...emite a msg de carregando
			      if(xmlhttp.readyState == 1) {
			    	  mensagem.innerHTML = "A carregar dados!";
			      }
			      //após ser processado a requisicao ajax
			      if(xmlhttp.readyState == 4 ) {
			    	  	if(xmlhttp.responseText){
			    	    	formulario_inscricao.local.value = xmlhttp.responseText;
			    	    }
			      }
			  }
		xmlhttp.open("GET",url,true)
		xmlhttp.send(null)
 
  	}
}	
	
function mostraDiv(op){
	document.getElementById(op).style.display = "block";
                                }
function escondeDiv(op){
    document.getElementById(op).style.display = "none";
                                }
								

								
								
								
