// FUNÇÃO PARA FORMATAR CAMPO VALOR ////////////////////////////////////////////////////////////////
function FormataValor(ConteudoCampo){
	if ((event.keyCode > 47) && (event.keyCode < 58)){
	   return(true);}
	else return(false)
}

// FUNÇÃO PARA VALIDAR PREENCHIMENTO CAMPOS NO CADASTRO DE AGÊNCIAS ///////////////////////////////////
function Checar_Agencia() {
missinginfo = "";
if (document.form.fantasia.value == "") {
missinginfo += "\n     -  Agency/Company";
}

if (document.form.razao.value == "") {
missinginfo += "\n     -  Documents of the company";
}

if ((document.form.FsTipo[0].checked == false)&&(document.form.FsTipo[1].checked == false)){
	missinginfo += "\n     -  Type";
}

if ( (document.form.FsTipo[0].checked == true) && ( (document.form.FsCnpj_Matriz.value == "")||(isNaN(document.form.FsCnpj_Matriz.value)) ) ){
	missinginfo += "\n     -  Head Office register";
}

if ((document.form.cnpj.value == "")||(isNaN(document.form.cnpj.value))) {
missinginfo += "\n     -  Register";
}

if (document.form.endereco.value == "") {
missinginfo += "\n     -  Address";
}

if (document.form.bairro.value == "") {
missinginfo += "\n     -  County";
}

if (document.form.cidade.value == "") {
missinginfo += "\n     -  City";
}

if (document.form.estado.value == "Vazio") {
   missinginfo += "\n     -  State";
}

if (document.form.pais.value == ""){
   missinginfo += "\n     -  Country";
}

if (document.form.cep.value == ""){
   missinginfo += "\n     -  Zip Code";
}

if (document.form.telefone.value == "") {
missinginfo += "\n     -  Telephone";
}

if (document.form.responsavel.value == "") {
missinginfo += "\n     -  Person In Charge";
}

if (document.form.cargo.value == "") {
missinginfo += "\n     -  Department";
}

if ((document.form.email.value == "") || 
	(document.form.email.value.indexOf('@') == -1) || 
	(document.form.email.value.indexOf('.') == -1) ||
	(document.form.email.value.indexOf(' ') != -1)) {
     missinginfo += "\n     -  Email";
}

if ((document.form.email_faturamento.value == "") || 
	(document.form.email_faturamento.value.indexOf('@') == -1) || 
	(document.form.email_faturamento.value.indexOf('.') == -1) ||
	(document.form.email_faturamento.value.indexOf(' ') != -1)) {
     missinginfo += "\n     -  Invoice Email";
}

if (document.form.username.value == "") {
missinginfo += "\n     -  Username";
}

if (document.form.senha1.value == "") {
missinginfo += "\n     -  Password";
}

if (document.form.senha2.value == "") {
missinginfo += "\n     -  Re-enter your password";
}

if ((!document.form.FsTermo.checked) && (missinginfo == "")){
 alert('In case of not accepting the\nGeneral Conditions\nwe won´t be able to complete\nyour registration.');
 return false;
}

if (missinginfo != "") {
missinginfo ="Please, fill in the following information\n" +
"_____________________________\n" +
missinginfo + 
"\n_____________________________";
alert(missinginfo);
return false;
}
else return true;
}

// FUNÇÃO PARA VALIDAR PREENCHIMENTO CAMPOS NO CADASTRO DE AGÊNCIAS ///////////////////////////////////
function Checar_Agencia_1() {
missinginfo = "";
if (document.form.fantasia.value == "") {
missinginfo += "\n     -  Agency/Company";
}

if (document.form.razao.value == "") {
missinginfo += "\n     -  Documents of the company";
}

if ((document.form.cnpj.value == "")||(isNaN(document.form.cnpj.value))) {
missinginfo += "\n     -  Register";
}

if (document.form.endereco.value == "") {
missinginfo += "\n     -  Address";
}

if (document.form.bairro.value == "") {
missinginfo += "\n     -  County";
}

if (document.form.cidade.value == "") {
missinginfo += "\n     -  City";
}

if (document.form.estado.value == "Vazio") {
   missinginfo += "\n     -  State";
}

if (document.form.pais.value == ""){
   missinginfo += "\n     -  Country";
}

if (document.form.cep.value == ""){
   missinginfo += "\n     -  Zip Code";
}

if (document.form.telefone.value == "") {
missinginfo += "\n     -  Telephone";
}

if (document.form.responsavel.value == "") {
missinginfo += "\n     -  Person In Charge";
}

if (document.form.cargo.value == "") {
missinginfo += "\n     -  Department";
}

if ((document.form.email.value == "") || 
	(document.form.email.value.indexOf('@') == -1) || 
	(document.form.email.value.indexOf('.') == -1) ||
	(document.form.email.value.indexOf(' ') != -1)) {
     missinginfo += "\n     -  Email";
}

if ((document.form.email_faturamento.value == "") || 
	(document.form.email_faturamento.value.indexOf('@') == -1) || 
	(document.form.email_faturamento.value.indexOf('.') == -1) ||
	(document.form.email_faturamento.value.indexOf(' ') != -1)) {
     missinginfo += "\n     -  Invoice Email";
}

if (document.form.username.value == "") {
missinginfo += "\n     -  Username";
}

if (document.form.senha1.value == "") {
missinginfo += "\n     -  Password";
}

if (document.form.senha2.value == "") {
missinginfo += "\n     -  Re-enter your password";
}

if (missinginfo != "") {
missinginfo ="Please, fill in the following information\n" +
"_____________________________\n" +
missinginfo + 
"\n_____________________________";
alert(missinginfo);
return false;
}
else return true;
}


// FUNÇÃO PARA VALIDAR PREENCHIMENTO CAMPOS NO CADASTRO - CELULAR ///////////////////////////////////////////
function Checar_Celular() {
	missinginfo = "";
	if (document.frmLocacaoCelular.FsNomePax.value == "") {
		missinginfo += "\n     -  Requested by";
	}
	if ((document.frmLocacaoCelular.FsQuantidade.value == "") || (isNaN(document.frmLocacaoCelular.FsQuantidade.value))){
		missinginfo += "\n     -  Number of Mobile Phones";
	}
	if (document.frmLocacaoCelular.FsDataEntrega.value == ""){
		missinginfo += "\n     -  Delivery Date";
	}
	if (document.frmLocacaoCelular.FsHorarioEntrega.value == ""){
		missinginfo += "\n     -  Delivery Time";
	}
    if (document.frmLocacaoCelular.FsDataDevolucao.value == ""){
		missinginfo += "\n     -  Returning Date";
	}
	if (document.frmLocacaoCelular.FsLocalEntrega.value == ""){
		missinginfo += "\n     -  Delivery at";
	}
	if (document.frmLocacaoCelular.FsNumeroTelefone.value == ""){
		missinginfo += "\n     -  Telephone Number";
	}
	if (document.frmLocacaoCelular.FsReferencia.value == ""){
		missinginfo += "\n     -  Reference";
	}
	
	if (missinginfo != "") {
		missinginfo ="Please fill in the bellow information\n" +
		"_________________________________\n" +
		missinginfo + "\n_________________________________";
		alert(missinginfo);
		return false;
	}
	else return true;
}


// FUNÇÃO PARA VALIDAR PREENCHIMENTO CAMPOS NO CADASTRO - EVENTOS //////////////////////////////////////////
function Checar_Eventos() {
missinginfo = "";

if (document.frmEventos.FsNome_Evento.value == "") {
missinginfo += "\n     -  Event";
}

if ((document.frmEventos.FsDia.value == "")||(document.frmEventos.FsMes.value == "")||(document.frmEventos.FsAno.value == "")||
    (document.frmEventos.FsDia2.value == "")||(document.frmEventos.FsMes2.value == "")||(document.frmEventos.FsAno2.value == "")) {
missinginfo += "\n     -  Date";
}

if (document.frmEventos.FsNumero_Pax.value == "") {
missinginfo += "\n     -  Number of Pax";
}

if (document.frmEventos.FsSl_Principal_Numero_Paxs.value == "") {
missinginfo += "\n     -  Number of Paxs - Main Room";
}

if (document.frmEventos.FsHorario.value == "") {
missinginfo += "\n     -  Period of Time" ;
}

if (missinginfo != "") {
		missinginfo ="Please fill in the bellow information\n" +
		"_________________________________\n" +
		missinginfo + "\n_________________________________";
		alert(missinginfo);
		return false;
	}
	else return true;
}


// FUNÇÃO PARA VALIDAR PREENCHIMENTO CAMPOS DO CADASTRO - TRANSFER //////////////////////////////////////////////////
function Checar_Transfer() {
missinginfo = "";
if ((document.frmTransfer.FsDia.value == "")||(document.frmTransfer.FsMes.value == "")||(document.frmTransfer.FsAno.value == "")) {
	missinginfo += "\n     -  Transfer's Date";
}

if ((document.frmTransfer.FsQuantidadePax.value == "")||(isNaN(document.frmTransfer.FsQuantidadePax.value))) {
	missinginfo += "\n     -  Quantity of persons";
}

if (document.frmTransfer.FsRooming.value == "") {
	missinginfo += "\n     -  Passenger's names";
}

if (document.frmTransfer.FsOrigemDestino.value == "") {
	missinginfo += "\n     -  From/To";
}

if ((document.frmTransfer.FsNumeroVooIn.value == "")||(document.frmTransfer.FsHorarioVooIn.value == "")||(document.frmTransfer.FsAeroportoVooIn.value == "")) {
	missinginfo += "\n     -  Outgoing Flight";
}

if ((document.frmTransfer.FsNumeroVooOut.value == "")||(document.frmTransfer.FsHorarioVooOut.value == "")||(document.frmTransfer.FsAeroportoVooOut.value == "")) {
	missinginfo += "\n     -  Incomming Flight";
}

if ((document.frmTransfer.FsGuia[0].checked)&&(document.frmTransfer.FsIdiomaGuia.value == "Não Informado")) {
	alert('Select language of Tour Guide.');
	missinginfo += "\n     -  Tour Guide";
}

if ((document.frmTransfer.FsMotorista[0].checked)&&(document.frmTransfer.FsIdiomaMotorista.value == "Não Informado")) {
	alert('Select language of Driver.');
	missinginfo += "\n     -  Driver";
}

if ((document.frmTransfer.FsQuantidadeCarros.value == "")||(isNaN(document.frmTransfer.FsQuantidadeCarros.value))) {
	missinginfo += "\n     -  Quantity of cars" ;
}

if (missinginfo != "") {
	missinginfo ="Please fill in the bellow information\n" +
	"_________________________________\n" +
	missinginfo + "\n_________________________________";
	alert(missinginfo);
	return false;
}
	else return true;
}


// FUNÇÃO PARA VALIDAR PREENCHIMENTO CAMPOS DO CADASTRO - CITY TOUR ////////////////////////////////////////////
function Checar_CityTour() {
	if (
	    (((document.frmCitytour.FsTipoCity.value != "nenhum")||(document.frmCitytour.FsOutroCity.value != "")) && (
	      (document.frmCitytour.FsDiaCity.value == "")||(document.frmCitytour.FsMesCity.value == "")||
		  (document.frmCitytour.FsAnoCity.value == "")||(document.frmCitytour.FsQuantidadePaxCity.value == "")||
		  (document.frmCitytour.FsLocalCity.value == "")||(document.frmCitytour.FsIdiomaGuiaCity.value == "nenhum")))
		||
		(((document.frmCitytour.FsTipoPasseio.value != "nenhum")||(document.frmCitytour.FsOutroPasseio.value != "")) && (
	      (document.frmCitytour.FsDiaSaidaPasseio.value == "")||(document.frmCitytour.FsMesSaidaPasseio.value == "")||
	      (document.frmCitytour.FsAnoSaidaPasseio.value == "")||(document.frmCitytour.FsDiaRetornoPasseio.value == "")||
		  (document.frmCitytour.FsMesRetornoPasseio.value == "")||(document.frmCitytour.FsAnoRetornoPasseio.value == "")||
		  (document.frmCitytour.FsQuantidadePaxPasseio.value == "")||(document.frmCitytour.FsLocalPasseio.value == "")||
		  (document.frmCitytour.FsIdiomaGuiaPasseio.value == "nenhum")))
		) {
			alert('All the spaces with (*) has to be filled.');
			return false;
	}
	if (((document.frmCitytour.FsTipoCity.value == "nenhum")&&(document.frmCitytour.FsOutroCity.value == ""))&&
		((document.frmCitytour.FsTipoPasseio.value == "nenhum")&&(document.frmCitytour.FsOutroPasseio.value == ""))){
			alert('All the spaces with (*) has to be filled.');
			return false;
	}
	else return true;
}


// FUNÇÃO PARA VALIDAR PREENCHIMENTO CAMPOS DO CADASTRO - ALUGUEL DE CELULAR ////////////////////////////////////
function Checar_CelularAluguel() {
	if (
	    (document.frmCelular.FsNome.value == "")||(document.frmCelular.FsEndereco.value == "")||
	    (document.frmCelular.FsCidade.value == "")||(document.frmCelular.FsEstado.value == "")||
		(document.frmCelular.FsPais.value == "")||(document.frmCelular.FsCep.value == "")||
		(document.frmCelular.FsTelefone.value == "")||(document.frmCelular.FsRg.value == "")||
		(document.frmCelular.FsCpf.value == "")||(document.frmCelular.FsDiaRetirada.value == "")||
		(document.frmCelular.FsMesRetirada.value == "")||(document.frmCelular.FsAnoRetirada.value == "")||
		(document.frmCelular.FsHorarioRetirada.value == "")||(document.frmCelular.FsDiaDevolucao.value == "")||
		(document.frmCelular.FsMesDevolucao.value == "")||(document.frmCelular.FsAnoDevolucao.value == "")||
		(document.frmCelular.FsHorarioDevolucao.value == "")||(document.frmCelular.FsQuantidade.value == "")||
		((!document.frmCelular.FsTipoRetirada[0].checked)&&(!document.frmCelular.FsTipoRetirada[1].checked)&&(!document.frmCelular.FsTipoRetirada[2].checked))||
   	    ((!document.frmCelular.FsTipoDevolucao[0].checked)&&(!document.frmCelular.FsTipoDevolucao[1].checked)&&(!document.frmCelular.FsTipoDevolucao[2].checked)) ){
			alert('All the spaces with (*) has to be filled.');
			return false;
	}
	else return true;
}


// FUNÇÃO PARA VALIDAR PREENCHIMENTO CAMPOS DO CADASTRO - ALUGUEL DE CARRO /////////////////////////////////////////
function Checar_Carro() {
	if (
	    (document.frmCarro.FsNome.value == "")||(document.frmCarro.FsEndereco.value == "")||
	    (document.frmCarro.FsCidade.value == "")||(document.frmCarro.FsEstado.value == "")||
		(document.frmCarro.FsPais.value == "")||(document.frmCarro.FsCep.value == "")||
		(document.frmCarro.FsTelefone.value == "")||(document.frmCarro.FsRg.value == "")||
		(document.frmCarro.FsCpf.value == "")||(document.frmCarro.FsEmail.value == "")||
		(document.frmCarro.FsGrupo.value == "nenhum")||(document.frmCarro.FsDiaRetirada.value == "")||
		(document.frmCarro.FsMesRetirada.value == "")||(document.frmCarro.FsAnoRetirada.value == "")||
		(document.frmCarro.FsHorarioRetirada.value == "")||(document.frmCarro.FsDiaDevolucao.value == "")||
		(document.frmCarro.FsMesDevolucao.value == "")||(document.frmCarro.FsAnoDevolucao.value == "")||
		(document.frmCarro.FsHorarioDevolucao.value == "") ){
			alert('All the spaces with (*) has to be filled.');
			return false;
	}
	else return true;
}
