function enviarForm(){
	document.codGrupo.submit();
}
function validarDir(Diretorio){
	var d = document.Diretorio;  
  	if (d.empresa.value.length < 1){alert("Por favor, digitar Empresa.");d.empresa.focus();return (false);}
	if (d.descricao.value.length < 1){alert("Por favor, digitar Descrição.");d.descricao.focus();return (false);}
  	if ((d.email.value.indexOf ('@', 0) == -1)||(d.email.value.length < 5)) {alert("Por favor, digitar E-mail ou conferir a digitação.");d.email.focus();return (false);}
	if (d.estado.value == ""){alert("Por favor, selecionar um Estado.");d.estado.focus();return (false);}
	if (d.bairro.value.length < 1){alert("Por favor, digitar Bairro.");d.bairro.focus();return (false);}
	if (d.endereco.value.length < 1){alert("Por favor, digitar Endereço.");d.endereco.focus();return (false);}
	if (d.ddd.value.length < 1){alert("Por favor, digitar DDD.");d.ddd.focus();return (false);}
	if (d.telefone.value.length < 1){alert("Por favor, digitar Telefone.");d.telefone.focus();return (false);}
	if (d.codSub.value == ""){alert("Por favor, escolher uma Subcategoria.");d.codSub.focus();return (false);}

    return (true);
}
function validarClassi(Classificado){
	var d = document.Classificado;
	if (d.codProd.value == ""){alert("Por favor, escolher Tipo de Produto.");d.codProd.focus();return (false);}  
  	if (d.produto.value.length < 1){alert("Por favor, digitar Produto.");d.produto.focus();return (false);}
  	if ((d.email.value.indexOf ('@', 0) == -1)||(d.email.value.length < 5)) {alert("Por favor, digitar E-mail ou conferir a digitação.");d.email.focus();return (false);}
	if (d.ddd.value.length < 1){alert("Por favor, digitar DDD.");d.ddd.focus();return (false);}
	if (d.telefone.value.length < 1){alert("Por favor, digitar Telefone.");d.telefone.focus();return (false);}
	if (d.preco.value.length < 1){alert("Por favor, digitar Preço.");d.preco.focus();return (false);}
	if (d.estado.value == ""){alert("Por favor, selecionar um Estado.");d.estado.focus();return (false);}

    return (true);
}
function validarBusca(Busca){
	var d = document.Busca;
	if (d.busca.value == ""){alert("Por favor, escrever o conteúdo da Busca.");d.busca.focus();return (false);}  
    return (true);
}

function veiculo(valor){
	if (valor == 1){
		document.getElementById('veiculos').style.display = "block";
		document.getElementById('pes').style.display = "block";
		document.getElementById('motores').style.display = "block";
	} 
	if (valor == 2){
		document.getElementById('veiculos').style.display = "none";
		document.getElementById('motores').style.display = "none";
	} 
	if (valor == 3){
		document.getElementById('veiculos').style.display = "none";
		document.getElementById('pes').style.display = "none";
		document.getElementById('motores').style.display = "block";
	} 
	if (valor == 6){
		document.getElementById('veiculos').style.display = "none";
		document.getElementById('motores').style.display = "none";
	} 
	if (valor == 37){
		document.getElementById('veiculos').style.display = "block";
		document.getElementById('pes').style.display = "block";
		document.getElementById('motores').style.display = "none";
	} 
}
function veiculo2(valor){
	if ((valor == 1) || (valor == 7) || (valor == 8) || (valor == 14)){
		document.getElementById('motores').style.display = "block";
		document.getElementById('pes').style.display = "block";
	} 
	if (valor == 37){
		document.getElementById('motores').style.display = "none";
	} 
	if (valor == 3){
		document.getElementById('motores').style.display = "none";
		document.getElementById('pes').style.display = "none";
	} 
}
function enviaEmail(rede,email,empresa,tipo)
{
	window.open('envia_email.php?email=' + email + '&empresa=' + empresa + '&rede=' + rede + '$tipo=' + tipo, '', "Height=320px, Width= 500px, Top= 25px, Left= 25px, help= Yes, resizable= no, status= no")
}
function cartao(cod)
{
	window.open('cartao.php?cod=' + cod ,'', "Height=220px, Width= 550px, Top= 25px, Left= 25px, help= Yes, resizable= no, status= no,scrollbars=YES ")
}


var HttpReq = null;
var dest_combo = null;

function ajaxComboBox(urli,comboBox,valor){
    var indice = document.getElementById('codProd').selectedIndex;
    var sigla = document.getElementById('codProd').value;
    var url = urli + '?tipo=' + sigla + '&valor='+valor;
	veiculo(sigla);
	ajaxProcMarcas(0);
    if (document.getElementById) { //Verifica se o Browser suporta DHTML.
        if (window.XMLHttpRequest) {
            HttpReq = new XMLHttpRequest();
            HttpReq.onreadystatechange = XMLHttpRequestChange;
            HttpReq.open("GET", url, true);
            HttpReq.send(null);
        } else if (window.ActiveXObject) {
            HttpReq = new ActiveXObject("Microsoft.XMLHTTP");
            if (HttpReq) {
                HttpReq.onreadystatechange = XMLHttpRequestChange;
                HttpReq.open("GET", url, true);
                HttpReq.send();
            }
        }
    }
}
function ajaxProcMarcas(tipo){
    var url2 = "ajax_select_marca.php?tipo=" + tipo;
	veiculo2(tipo);
    if (document.getElementById) { //Verifica se o Browser suporta DHTML.
        if (window.XMLHttpRequest) {
            HttpReq2 = new XMLHttpRequest();
            HttpReq2.onreadystatechange = XMLHttpRequestChangeMarca;
            HttpReq2.open("GET", url2, true);
            HttpReq2.send(null);
        } else if (window.ActiveXObject) {
            HttpReq2 = new ActiveXObject("Microsoft.XMLHTTP");
            if (HttpReq2) {
                HttpReq2.onreadystatechange = XMLHttpRequestChangeMarca;
                HttpReq2.open("GET", url2, true);
                HttpReq2.send();
            }
        }
    }
}

function XMLHttpRequestChange() {
    if (HttpReq.readyState == 4 && HttpReq.status == 200){
        var result = HttpReq.responseXML;
        var subcategorias = result.getElementsByTagName("nome");
        document.getElementById('codSub').innerHTML = "";
        for (var i = 0; i < subcategorias.length; i++) {
            new_opcao = create_opcao(subcategorias[i]);
            document.getElementById('codSub').appendChild(new_opcao);
        }
    }
}
function XMLHttpRequestChangeMarca() {
    if (HttpReq2.readyState == 4 && HttpReq2.status == 200){
        var result = HttpReq2.responseXML;
        var subcategorias = result.getElementsByTagName("nome");
        document.getElementById('codMarca').innerHTML = "";
        for (var i = 0; i < subcategorias.length; i++) {
            new_opcao = create_opcao(subcategorias[i]);
            document.getElementById('codMarca').appendChild(new_opcao);
        }
    }
}

function create_opcao(subcategoria) { 
    var new_opcao = document.createElement("option"); 
    var texto = document.createTextNode(subcategoria.childNodes[0].data);
	var selec = subcategoria.getAttribute("selecionado");
    new_opcao.setAttribute("value",subcategoria.getAttribute("cod")); 
	if (selec == 1){
		new_opcao.setAttribute("selected","selected");
	}
    new_opcao.appendChild(texto); //Adiciona o texto a OPTION.
   return new_opcao; // Retorna a nova OPTION.
}

// Menu Diretorio///////////////////////////////////////////////////////////////////
c=0
du="";
function escondediv(dv,n){		
		   for(i=1;i<=n;i++){			
			   if(i==dv ){
				   if(du!=dv){
				      document.getElementById('mdiv'+i).style.display="block"
					   du=dv
					}else{
					   du=""
					   document.getElementById('mdiv'+i).style.display="none"
					}
			   }else{
				     document.getElementById('mdiv'+i).style.display="none"				  					
			   }				
			}		
		}
///////////////////////////////////////////////////////////////////////////
// Menu Classificados - Veiculos///////////////////////////////////////////////////////////////////
cV=0
duV="";
function escondedivV(dv,n){		
		   for(i=1;i<=n;i++){			
			   if(i==dv ){
				   if(duV!=dv){
				      document.getElementById('mdivV'+i).style.display="block"
					   duV=dv
					}else{
					   duV=""
					   document.getElementById('mdivV'+i).style.display="none"
					}
			   }else{
				     document.getElementById('mdivV'+i).style.display="none"				  					
			   }				
			}		
		}
function mostraInfo(){		
	if(document.getElementById('info').style.display=="block"){
		document.getElementById('info').style.display="none"
	}else{
		document.getElementById('info').style.display="block"
	}		
}
//////Procurar Cidades////////////////////////////////////////////////////////////////////////////////////////////////////
function procCidades(estado){
	var HttpReq = createXMLHTTP();
	HttpReq.open("GET", "admin/guia_institucional_ajax_cidades.php?estado=" + estado, true);
	HttpReq.onreadystatechange=function(){
		if (HttpReq.readyState == 4 && HttpReq.status == 200){
        			var result = HttpReq.responseXML;
        			var subcategorias = result.getElementsByTagName("nome");
        			document.getElementById('cidade').innerHTML = "";
        			for (var i = 0; i < subcategorias.length; i++) {
            			new_opcao = create_opcao(subcategorias[i]);
            			document.getElementById('cidade').appendChild(new_opcao);
        			}
					var valor = subcategorias[0].getAttribute("cod");
    	}
	}
	HttpReq.send(null);
}
/////Selects Guia/////////////////////////////////////////////////////////////////////////////////////////
function procGuiaSub(categoria){
	var HttpReq = createXMLHTTP();
	HttpReq.open("GET", "ajax/guia_procura_sub.php?categoria=" + categoria, true);
	HttpReq.onreadystatechange=function(){
		if (HttpReq.readyState == 4 && HttpReq.status == 200){
        			var result = HttpReq.responseXML;
        			var subcategorias = result.getElementsByTagName("nome");
        			document.getElementById('codSub').innerHTML = "";
        			for (var i = 0; i < subcategorias.length; i++) {
            			new_opcao = create_opcao(subcategorias[i]);
            			document.getElementById('codSub').appendChild(new_opcao);
        			}
    	}
	}
	HttpReq.send(null);
}
function MM_preloadImages() { //v3.0
     var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
     var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
     if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function adiciona_bookmark(){
    var url      = "http://www.pousadasselecionadas.com.br";
    var title    = "Pousadas Selecionadas de Santa Catarina";
    if (window.sidebar) window.sidebar.addPanel(title, url,"");
    else if(window.opera && window.print){
        var mbm = document.createElement('a');
        mbm.setAttribute('rel','sidebar');
        mbm.setAttribute('href',url);
        mbm.setAttribute('title',title);
        mbm.click();
    }
    else if(document.all){window.external.AddFavorite(url, title);}
}
function validarInstitucional(Institucional){
	var d = document.Institucional;  
  	if (d.empresa.value.length < 1){alert("Por favor, digitar Empresa.");d.empresa.focus();return (false);}
  	if ((d.email.value.indexOf ('@', 0) == -1)||(d.email.value.length < 5)) {alert("Por favor, digitar E-mail ou conferir a digitação.");d.email.focus();return (false);}
	if (d.estado.value == ""){alert("Por favor, selecionar um Estado.");d.estado.focus();return (false);}
	if (d.bairro.value.length < 1){alert("Por favor, digitar Bairro.");d.bairro.focus();return (false);}
	if (d.endereco.value.length < 1){alert("Por favor, digitar Endereço.");d.endereco.focus();return (false);}
	if (d.ddd.value.length < 1){alert("Por favor, digitar DDD.");d.ddd.focus();return (false);}
	if (d.telefone.value.length < 1){alert("Por favor, digitar Telefone.");d.telefone.focus();return (false);}
	if (d.codSub.value == ""){alert("Por favor, escolher uma Subcategoria.");d.codSub.focus();return (false);}

    return (true);
}
window.onload=MM_preloadImages('imagens_buscador/btn_busca_classi_maior.jpg','imagens_buscador/btn_busca_over_maior.jpg','imagens_buscador/btn_busca_press_maior.jpg','imagens_buscador/botoes.jpg','imagens_buscador/botoes_up.jpg','imagens_buscador/botoes_press.jpg','imagens_buscador/btn_comoanunciar_up.png','imagens_buscador/btn_tarifas_up.png','botoes/anuncie-sua-empresa.jpg','botoes/anuncie-sua-empresa-up.jpg','botoes/anuncie-seu-classi.jpg','botoes/anuncie-seu-classi-up.jpg','botoes/anuncie-nos-classi.jpg','botoes/anuncie-nos-classi-up.jpg','botoes/anuncie-no-guia-nautico.jpg','botoes/anuncie-no-guia-nautico-up.jpg');