// JavaScript Document


function exibir(x){

var ap2=document.getElementById("ap2");
var ap3=document.getElementById("ap3");
var idadec1=document.getElementById("idadec1");
var idadec2=document.getElementById("idadec2");
var idadec3=document.getElementById("idadec3");

if (x==1)
  {
 
 ap2.style.display="none"
 ap3.style.display="none" 
 
 document.getElementById("npessoas2").value = 0
 document.getElementById("ncriancas2").value = 0
 document.getElementById("idadecriancas2").value = ""
 
 document.getElementById("npessoas3").value = 0
 document.getElementById("ncriancas3").value = 0
 document.getElementById("idadecriancas3").value = ""
 
 idadec2.style.display="none"
 idadec3.style.display="none"
 
  }else if (x==2){

 ap2.style.display="block"
 ap3.style.display="none"
 
 
 document.getElementById("npessoas3").value = 0
 document.getElementById("ncriancas3").value = 0
 document.getElementById("idadecriancas3").value = ""
 
  idadec3.style.display="none"
 
 }

 else if (x==3){

 ap2.style.display="block"
 ap3.style.display="block"
 

 }
}

	function exibiridade1(x){
	
	var idadec1=document.getElementById("idadec1");
	
	if (x > 0)
	  {
	
	idadec1.style.display="block"	
	 }
	 
	 else{
	idadec1.style.display="none"
	 } 
	} 
	
	function exibiridade2(x){
	
	var idadec2=document.getElementById("idadec2");
	
	if (x > 0)
	  {
	
	idadec2.style.display="block"	
	 }
	  else{
	idadec2.style.display="none"
	 } 
	} 
	
	function exibiridade3(x){
	
	var idadec3=document.getElementById("idadec3");
	
	if (x > 0)
	  {
	
	idadec3.style.display="block"	
	 }
	 
	  else{
	idadec3.style.display="none"
	 } 
	 
	} 


function mensagem (cpoform, s)
{   cpoform.focus()
    cpoform.select()
    alert(s)
    return false
}

function isEmpty(parm)
{ return ((parm.value == "") || (parm.length == 0)) }

function isNotEmail(parm)
{ return ((parm.value == "") || (parm.value.indexOf ('@',0) == -1 || parm.value.indexOf ('.',0) == -1)) }


function checkCheckBox(f) {}

function verificaconfirabuscaini (){
	
	 d = document.confirabuscaini;
	
	
	
	if (d.assunto.selectedIndex == 0){
                   alert("Selecione um assunto");
                    d.assunto.focus();
                    return false;
         }
	
 if (d.nome.value == ""){
                   alert("O campo Nome deve ser preenchido!");
                    d.nome.focus();
                    return false;
         }
		 
		 
		 
		 if (isNotEmail(d.remetente)){
                   alert("O campo Email deve ser preenchido!");
                    d.remetente.focus();
                    return false;
         }
		 
		 if (d.ddd.value == ""){
                   alert("O campo DDD deve ser preenchido!");
                    d.ddd.focus();
                    return false;
         }
		 
		 
		 if (d.tel.value == ""){
                   alert("O campo Telefone deve ser preenchido!");
                    d.tel.focus();
                    return false;
         }
		 
		 		 if (d.data_ent.value == ""){
                   alert("O campo data de entrada deve ser preenchido!");
                    d.data_ent.focus();
                    return false;
         }
		 
		 		 if (d.data_sai.value == ""){
                   alert("O campo data de saída deve ser preenchido!");
                    d.data_sai.focus();
                    return false;
         }
		 
		 
		var data1 = d.data_ent.value;
		var data2 = d.data_sai.value;
		
		var nova_data1 = parseInt(data1.split("/")[2].toString() + data1.split("/")[1].toString() + data1.split("/")[0].toString());
		var nova_data2 = parseInt(data2.split("/")[2].toString() + data2.split("/")[1].toString() + data2.split("/")[0].toString());
		 
		 if (nova_data2 < nova_data1){
         alert("A data saida é menor que a data entrada.");
         d.data_sai.focus();
		 return false;
         }
      
         if (nova_data1 == nova_data2){
         alert("A data entrada esta igual a data saida.");
          return false;
         }
 
		 		 if (d.npessoas.selectedIndex == 0){
                   alert("Selecione a qtd de hóspedes adulto no primeiro apartamento");
                    d.npessoas.focus();
                    return false;
         }
		 
		 

return true;
}