//FUNCAO QUE VALIDA O FORMULARIO DE CONSULTA
function validateFormFind()
{
	if (!validateStartEndDate(document.getElementById('transdatainicial'),document.getElementById('transdatafinal')))
	{
		return false;
	}
	return true;
}

function setaPassaportes(passporte)
{
	passaporte = parseInt(passporte,10);
	document.getElementById('trchegada').style.display = '';
	document.getElementById('trsaida').style.display = '';
	document.getElementById('trquantidade').style.display = '';

	if (passaporte == 1) {
		document.getElementById('ctPassaporte').value = 'Passaporte Iguassu';
	} else if (passaporte == 2) {
		document.getElementById('ctPassaporte').value = 'Passaporte Ecológico';
	} else if (passaporte == 3) {
		document.getElementById('ctPassaporte').value = 'Passaporte Parques';
	} else if (passaporte == 4) {
		document.getElementById('ctPassaporte').value = 'Passaporte Aventura';
	}

}


function abrePopUpContato(funcionario, setor) {
	window.open("contatoPopUp.php?funcionario=" + funcionario + "&setor=" + setor,"contato","left=5,top=5,width=350,height=260,resizable=no,status=no,scrollbars=no");
}

//funcao para validacao e envio de email da funcionalidade contato
function enviaFormulario(idForm, idHideSelect, msgErro) {
	var formulario = document.getElementById(idForm);
	var formCompleto = true;

	for (i=0; i<formulario.length; i++)	{
		if ((formulario[i].id != "ctChegada") &&
			(formulario[i].id != "ctSaida") &&
			(formulario[i].id != "ctQuantidade") &&
			(formulario[i].id != "ctPassaporte")) {
			if (formulario[i].type == "text" || formulario[i].type == "textarea") {
				if (formulario[i].value == "") {
					formCompleto = false;
				}
			}
			if (formulario[i].type == "select-one") {
				if (formulario[i].selectedIndex == 0) {
					formCompleto = false;
				}
				else {
					document.getElementById(idHideSelect).value = formulario[i].selectedIndex;
				}
			}
		}
	}

	if(!validateEmail(document.getElementById("ctEmail").value))
	{
		alert("Formato de e-mail incorreto");
		return;
	}

	if (formCompleto) {
		formulario.submit();
	}
	else {
		alert(msgErro);
	}
}
//limpa os campos do formulario na funcionalidade contato
function limpaFormulario(idForm) {
	var formulario = document.getElementById(idForm);
	for (i=0; i<formulario.length; i++)	{
		if (formulario[i].type == "text" || formulario[i].type == "textarea" || formulario[i].type == "hidden") {
			formulario[i].value = "";
		}
		if (formulario[i].type == "select-one") {
			formulario[i].selectedIndex = 0;
		}
	}
}
