<!--
/*======================================================================================================================
'Nome          : val_inscricao.js
'Tipo          : ASP - Active Server Pages
'Empresa       : Adaltech Soluções para Eventos   
'Autor         : Patrício Marin
'Descrição     : Validação do formulário de Cadastro de Inscrito
'Dependências  : Nenhuma
'Histórico     : - 15.08.2007 - Patrício Marin 
'              : - Adequação Sistema Modelo Versão 1.0
'=====================================================================================================================*/






function validaEmail(){
var obj = document.frm_1

	 if (obj.xemail.value.indexOf('@', 0) == -1 || 
	  	obj.xemail.value.indexOf('.', 0) == -1)
	  {
		alert("E-mail invalido!");
		obj.xemail.focus()
		return
	  }

}







var xmlHttp;
var varInsId;
var varInsQtdeAcp;
var varInsQtdeReservaHotel;
var varLoad;

function GetXmlHttpObject() {
	
	// Declaração da variável para o Objeto XMLHttpRequest
	var xmlHttp = null;

	try
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp = new XMLHttpRequest();
	}
	catch (e)
	{
		try
		{	
			// Internet Explorer
			xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");			
		}
		catch (e)
		{
			xmlHttp = new ActiveObject("Microsoft.XMLHTTP");
		}
	}
	return xmlHttp;
}

function Consultar_CEP(pCEP) {
	
	xmlHttp = GetXmlHttpObject();
	
	if (xmlHttp == null) {
		alert("Seu navegador não suporta AJAX !");
		return;
	}
	
	var strURL = "cep.asp";
	strURL = strURL + "?cep=" + pCEP.value;
	xmlHttp.onreadystatechange = Monitor_CEP;
	xmlHttp.open("GET", strURL, true);
	xmlHttp.send(null);
}

function Monitor_CEP() {
	
	var strEnderecoCEP;
	var intPosSeparador;
	
	if (xmlHttp.readyState == 1) {
		document.getElementById("divLoading").style.visibility = "visible";
	}
	
	if (xmlHttp.readyState == 4) {
		
		document.getElementById("divLoading").style.visibility = "hidden";

		strEnderecoCEP	= xmlHttp.responseText;
	//	intPosSeparador	= InStr(1, strEnderecoCEP, "$$");
		
		// Retorna o Logradouro
	//	alert(strEnderecoCEP);
		xstr = strEnderecoCEP.split(",");
		
		document.getElementById("insLogradouro").value = xstr[0];
		
		// Recebe o restante do endereço
	//	strEnderecoCEP	= strEnderecoCEP.substr(eval(intPosSeparador) + 1);
		
		// Verifica a posição do próximo separador
	//	intPosSeparador	= InStr(1, strEnderecoCEP, "$$");
		
		// Retorna o Bairro
		document.getElementById("insBairro").value = xstr[1];
		
		// Recebe o restante do endereço
	//	strEnderecoCEP	= strEnderecoCEP.substr(eval(intPosSeparador) + 1);
		
		// Recebe o restante do endereço
	//	intPosSeparador	= InStr(1, strEnderecoCEP, "$$");
		
		// Retorna a Cidade
		document.getElementById("insCidade").value  = xstr[2];
		
		// Recebe o restante do endereço
	//	strEnderecoCEP	= strEnderecoCEP.substr(eval(intPosSeparador) + 1);
		
		// Recebe o restante do endereço
	//	intPosSeparador	= InStr(1, strEnderecoCEP, "$$");
		
		// Retorna o UF
		if (  xstr[3].length > 1) {
		//	alert(strEnderecoCEP.trim());
			document.getElementById("ufSigla").value  = xstr[3];
			
		} else {
			document.getElementById("ufSigla").selectedIndex = 0;
		}

		// Seta o foco para o complemento
		document.getElementById("insComplemento").focus();
	} 
}



function Monitor_CPF_CNPJ() {

	if (xmlHttp.readyState == 4) {
		document.getElementById("valCPF_CNPJ").innerHTML = xmlHttp.responseText;		
	} 
}

function Inicializar_Ajax (pInsId, pInsQtdeAcp, pEveQtdeAcompanhantes, pInsQtdeReservaHotel, pEveQtdeReservasHotel, pLoad) {
	
	varInsId				= pInsId;
	varInsQtdeAcp			= pInsQtdeAcp;
	varInsQtdeReservaHotel	= pInsQtdeReservaHotel;
	varLoad					= pLoad;
	
	if ((eval(varInsQtdeAcp) > 0) && (eval(pEveQtdeAcompanhantes) > 0)) {
		Form_Acompanhantes(varInsId, varInsQtdeAcp, varLoad);
	} else {
		if ((eval(varInsQtdeReservaHotel) > 0) && (eval(pEveQtdeReservasHotel) > 0)) {
			Form_Hospedagem(varInsId, varInsQtdeReservaHotel, varLoad);
		}
	}
}

function Form_Acompanhantes(pInsId, pInsQtdeAcp, pLoad) {
	
	xmlHttp = GetXmlHttpObject();
	
	if (xmlHttp == null) {
		alert("Seu navegador não suporta AJAX !");
		return;
	}
	
	var strURL = "tbl_ajax_acompanhantes.asp";
	
	if (pLoad == 1) {
		intInsQtdeAcp = pInsQtdeAcp;
	} else {
		intInsQtdeAcp = pInsQtdeAcp.value;
	}
	
	strURL = strURL + "?insId=" + pInsId + "&insQtdAcompanhantes=" + intInsQtdeAcp;
	xmlHttp.onreadystatechange = Monitor_Acompanhantes;
	xmlHttp.open("GET", strURL, true);
	xmlHttp.send(null);
	
}

function Monitor_Acompanhantes() {

	if (xmlHttp.readyState == 4) {
				
		document.getElementById("STEP2.1").innerHTML = xmlHttp.responseText;	

		if ((eval(varLoad == 1)) && (eval(varInsQtdeAcp) > 0)) {
			Form_Hospedagem(varInsId, varInsQtdeReservaHotel, varLoad);
		}
	} 
}

function Form_Hospedagem(pInsId, pInsQtdeReserva, pLoad) {
	
	xmlHttp = GetXmlHttpObject();
	
	if (xmlHttp == null) {
		alert("Seu navegador não suporta AJAX !");
		return;
	}
	
	var strURL = "tbl_ajax_hospedagem.asp";
	
	if (pLoad == 1) {
		intInsQtdeReserva = pInsQtdeReserva;
	} else {
		intInsQtdeReserva = pInsQtdeReserva.value;
	}
	
	strURL = strURL + "?insId=" + pInsId + "&insQtdReservasHotel=" + intInsQtdeReserva;
	xmlHttp.onreadystatechange = Monitor_ReservaHotel;
	xmlHttp.open("GET", strURL, true);
	xmlHttp.send(null);
}

function Monitor_ReservaHotel() {

	if (xmlHttp.readyState == 4) {				
		document.getElementById("STEP4.1").innerHTML = xmlHttp.responseText;	
	} 
}

String.prototype.trim = function() {		
		
	texto = this
	
	for (x = 0 ; x <= this.length ; x++ ) {
		texto = texto.replace(/\s/ , "")
	}
	
	return texto
}		

String.prototype.ltrim = function() {
	
	return this.replace(/^\s+/,"");

}

String.prototype.rtrim = function() {
	
	return this.replace(/\s+$/,"");
}

function TamanhoSemHTML(pCampo) {
	
	var strSemHTML;
	var strSemEspacos;
	
	strSemHTML = pCampo.value.replace(/<.*?>/gi, "");
	strSemHTML = strSemHTML.ltrim();
	strSemHTML = strSemHTML.rtrim();
	
	return strSemHTML.length;

}

function InStr(n, s1, s2) {
					
	var numargs = InStr.arguments.length;	

	if(numargs < 3)
		return n.indexOf(s1)+1;
	else
		return s1.indexOf(s2, n)+1;
}

function Detalhes(pID1, pID2, pID3, pAcao) {
		
	if (pAcao == '+') {
		document.getElementById(pID1).className = "exibe";
		document.getElementById(pID2).className = "oculta";
		document.getElementById(pID3).className = "exibe";
	}
	else {
		document.getElementById(pID1).className = "oculta";
		document.getElementById(pID2).className = "exibe";
		document.getElementById(pID3).className = "oculta";
	}
}

function VerificaEmail(email) {
	
	if (!email) return false;

	var  BadChars = "*|,\":<>[]{}`\';()&$#% ";
	var  GoodChars = "@.";   

	for (var i = 0; i < email.length; i++) {
		if (BadChars.indexOf(email.charAt(i)) != -1) {
			return false;
		}
	}

	for (var i = 0; i < GoodChars.length; i++) {
		if (email.indexOf(GoodChars.charAt(i)) == -1) {
			return false;
		}
	}

	if (email.indexOf ('@.',0) != -1 || email.indexOf ('.@',0) != -1) {
		return false;
	}

   return true;
} 

function VerificaCNPJ(valor2) {

	var i;
	var i;
	var c = valor2.substr(0,12);
	var dv = valor2.substr(12,2);
	var d1 = 0;

	for (i = 0; i < 12; i++)
	{
		d1 += c.charAt(11-i)*(2+(i % 8));
	}

	if (d1 == 0) return false;
    d1 = 11 - (d1 % 11);
	if (d1 > 9) d1 = 0;
	if (dv.charAt(0) != d1)
	{
		return false;
	}
	d1 *= 2;

	for (i = 0; i < 12; i++)
	{
		d1 += c.charAt(11-i)*(2+((i+1) % 8));
	}

	d1 = 11 - (d1 % 11);
	if (d1 > 9) d1 = 0;
	if (dv.charAt(1) != d1)
	{
		return false;
	}
	return true;
}

function VerificaCPF(valor) {
	primeiro=valor.substr(1,1);
	falso=true;
	size=valor.length;
	if (size!=11){
		return false;
	}
	size--;
	for (i=2; i<size-1; ++i){
		proximo=(valor.substr(i,1));
		if (primeiro!=proximo) {
			falso=false
		}
	}
	if (falso){
		return false;
	}
   	if(modulo(valor.substring(0,valor.length - 2)) + "" + modulo(valor.substring(0,valor.length - 1)) != valor.substring(valor.length - 2,valor.length)) {
   		return false;
   	}
   	return true
}

function modulo(str) {
   	soma=0;
   	ind=2;
   	for(pos=str.length-1;pos>-1;pos=pos-1) {
   		soma = soma + (parseInt(str.charAt(pos)) * ind);
   		ind++;
   		if(str.length>11) {
   			if(ind>9) ind=2;
   		}
	}
   	resto = soma - (Math.floor(soma / 11) * 11);
   	if(resto < 2) {
    	return 0
   	}
   	else {
   		return 11 - resto
   	}
}

function CopiarDadosRecibo(cofComplemento, cofPais, cofSobreNome) {
		
	varForm = document.frmInscricao;
	
	// Verifica se deve copiar os dados do endereço do inscrito para o endereço de cobrança
	if (varForm.Copiar_End_Inscricao.checked == true) {

		varForm.pagLogradouro.value		  = varForm.insLogradouro.value;
		varForm.pagCidade.value		 	  = varForm.insCidade.value;
		varForm.pagBairro.value			  = varForm.insBairro.value;
		varForm.pagCEP.value			  = varForm.insCEP.value;
		varForm.pag_ufSigla.selectedIndex = varForm.ufSigla.selectedIndex;

		if (cofSobreNome == 'S') {
			varForm.pagNomeRecibo.value	  = varForm.insNome.value + ' ' + varForm.insSobreNome.value;
		} else {
			varForm.pagNomeRecibo.value	  = varForm.insNome.value;
		}

		varForm.pagCPF_CNPJ.value		  = varForm.insCPF_CNPJ.value;
		
		if (cofComplemento == 'S') {
		  varForm.pagComplemento.value	  = varForm.insComplemento.value;
		}
		
		if (cofPais == 'S') {
		  varForm.pag_paiId.selectedIndex = varForm.paiId.selectedIndex;
		}
		
		return false;	

	}
	else {
			
		varForm.pagLogradouro.value		  = '';
		varForm.pagCidade.value			  = '';
		varForm.pagBairro.value			  = '';
		varForm.pagCEP.value			  = '';
		varForm.pag_ufSigla.selectedIndex = 0;
		varForm.pagNomeRecibo.value		  = '';
		varForm.pagCPF_CNPJ.value		  = '';
		
		if (cofComplemento == 'S') {
		  varForm.pagComplemento.value	  = '';
		}
		
		if (cofPais == 'S') {
		  varForm.pag_paiId.selectedIndex = 0;
		}
		
		return false;	

	}
}

function Val_Tipo(Campo,str,msg) {

	var checkOK = str;
	var checkStr = Campo.value;
	var allValid = true;
	var decPoints = 0;
	var allNum = "";
	
	for (i = 0;  i < checkStr.length;  i++) {
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOK.length;  j++)
			if (ch == checkOK.charAt(j))
			break;
		if (j == checkOK.length)
		{
			allValid = false;
			break;
		}
		if (ch != " ")
		allNum += ch;
	}

	if (!allValid) {
		alert(msg) 
		Campo.value=allNum
		Campo.focus();
		return false;
	}
	return true;
}	

function val_radio(formulario, campo, msgAlerta) {
	for(x=0 ; x < formulario.length ; x++) {  
		if(formulario.elements[x].name == campo) {
			if(formulario.elements[x].checked) {
				return true;
			}
		}
	}
 alert(msgAlerta);
 return false;
}

function val_radio_aux(formulario, campo) {
	for(x=0 ; x < formulario.length ; x++) {  
		if(formulario.elements[x].name == campo) {
			if ((formulario.elements[x].checked) && (formulario.elements[x].disabled == false)) {
				return 'OK';
			}
		}
	}
 return 'NOK';
}

function val_acompanhantes(formulario, campo, msgAlerta) {
	
	for (x = 0; x < formulario.length; x++) {  
		
		if (formulario.elements[x].name == campo) {
			
			if (formulario.elements[x].value == '') {
				
				alert(msgAlerta);
				Detalhes('STEP2','ABRIR_STEP2','FECHAR_STEP2','+');
				formulario.elements[x].focus();
				return false;
				
			} else {	

				if (formulario.elements[x].name == 'acpCPF') {

					if (!VerificaCPF(formulario.elements[x].value)) {
						alert('O nº do CPF de acompanhante é inválido');
						Detalhes('STEP2','ABRIR_STEP2','FECHAR_STEP2','+');
						formulario.elements[x].focus();
						return false;
					}
				}
				
				if (formulario.elements[x].name == 'acpEmail') {
					if (!VerificaEmail(formulario.elements[x].value)) {
						alert(msgAlerta);
						Detalhes('STEP2','ABRIR_STEP2','FECHAR_STEP2','+');
						formulario.elements[x].focus();
						return false;
					}
				}
			}
		}
	}
}

function val_hospedagem(formulario, campo, msgAlerta) {
	
	for (x = 0; x < formulario.length; x++) {  
		
		if (formulario.elements[x].name == campo) {
			
			if ((formulario.elements[x].value == '') || (formulario.elements[x].value == '0')) {
				
				alert(msgAlerta);
				Detalhes('STEP4','ABRIR_STEP4','FECHAR_STEP4','+');
				formulario.elements[x].focus();
				return false;
				
			}
		}
	}
}

function Consultar_Inscrito() {
	
	varForm = document.frmInscricao;
	
	if (varForm.strConsultar.value == '') {
		alert('Informe um e-mail ou CPF')
		varForm.strConsultar.focus();
		return false;
	}
	
	var strConsultar = document.getElementById("strConsultar").value;
	
	document.location='frm_inscricao.asp?strConsultar=' + strConsultar;
}

function Consistir_Inscricao(pBandeira, insId, strGerencial, strMostrarMatricula, eveQtdeAcompanhantes, insQtdeAcpOk, eveQtdeReservasHotel, insQtdeReservasOk, eveInscValorNovoCad, eveInscValorAreaRes, cofSobrenome, cofNomeCracha, cofNacionalidade, cofParticipacao, cofRG, cofSexo, cofDataNascimento, cofInscricaoPF_PJ, cofPais) {
	
	var varForm = document.frmInscricao;
	
	switch (pBandeira) {
		
	case "BRA":
		var strAlerta01		= "Preencha o Nome";
		var strAlerta02		= "Preencha o Sobrenome";
		var strAlerta03		= "Preencha o Nome para Crachá";
		var strAlerta04		= "Preencha o campo Nacionalidade";
		var strAlerta05		= "Preencha o campo Sexo";
		var strAlerta06		= "Se não for Brasileiro o campo Passaporte deve ser preenchido";
		var strAlerta07		= "Se for Brasileiro o campo CPF / CNPJ deve ser preenchido";
		var strAlerta08		= "O nº do CPF / CNPJ é inválido";
		var strAlerta09		= "Se for Brasileiro o campo RG deve ser preenchido";
		var strAlerta10		= "Se for Brasileiro o campo Órgão Emissor deve ser preenchido";
		var strAlerta11		= "Escolha o Tipo de Inscrição";
		var strAlerta12		= "Preencha o campo Data de Nascimento (dd/mm/aaaa)";
		var strAlerta13		= "Preencha o campo categoria de participação";
		var strAlerta14		= "e-mail inválido ou faltando";
		var strAlerta15		= "Favor digitar a Senha";
		var strAlerta16		= "Favor confirmar sua Senha";
		var strAlerta17		= "A senha de confirmação deve ser a mesma digitada no campo senha";
		var strAlerta18		= "Preencha o CEP";
		var strAlerta19		= "Preencha o Logradouro";
		var strAlerta20		= "Preencha a Cidade";
		var strAlerta21		= "Preencha o Estado";
		var strAlerta22		= "Preencha o Pais";
		var strAlerta23		= "Preencha o Telefone";
		var strAlerta24		= "Preencha o CEP para Recibo/Boleto";
		var strAlerta25		= "Preencha o Logradouro para Comprovante, Recibo e Boleto";
		var strAlerta26		= "Preencha a Cidade para Recibo/Boleto";
		var strAlerta27		= "Preencha a UF para Recibo/Boleto";
		var strAlerta28		= "Preencha o Pais para Recibo/Boleto";
		var strAlerta29		= "Preencha o Nome para Recibo/Boleto";
		var strAlerta30		= "Preencha o CPF/CNPJ para Recibo/Boleto";
		var strAlerta31		= "O nº do CPF / CNPJ para Recibo/Boleto é inválido";
		var strAlerta32		= "Preencha o nome do acompanhante";
		var strAlerta33		= "Preencha o nome do crachá do acompanhante";
		var strAlerta34		= "Preencha o CPF do acompanhante";
		var strAlerta35		= "Preencha o e-mail do acompanhante";
		var strAlerta36		= "Escolha a Categoria de preço de Inscrição";
		var strAlerta37		= "Preencha os campos dia, mês e ano da data de Check In";
		var strAlerta38		= "Preencha os campos dia, mês e ano da data de Check Out";
		var strAlerta39		= "Selecione a acomodação da Reserva";
		var strAlerta40		= "Escolha a Forma de Pagamento";
		var strConfirmacao	= "Confirma o envio da atualização da inscrição ?";
		var strAlerta41     = "E-mail de acompanhante é inválido ou está faltando";
		break;
	case "ESP":
		var strAlerta01		= "Rellene el nombre";
		var strAlerta02		= "Rellene el apellido";
		var strAlerta03		= "Rellene el nombre para la placa";
		var strAlerta04		= "Rellene la Nacionalidad";
		var strAlerta05		= "Rellene el género";
		var strAlerta06		= "Si brasileño el Pasaporte deve ser completado";
		var strAlerta07		= "Si brasileño el Pasaporte/RIF debe ser completado";
		var strAlerta08		= "El número de Pasaporte/RIF no es válido";
		var strAlerta09		= "Si brasileño el cédula de Identidad debe ser completado";
		var strAlerta10		= "Si brasileño la organización de la expedicíon debe ser completado";
		var strAlerta11		= "Escolha o Tipo de Inscrição";
		var strAlerta12		= "Rellene Fecha de Nacimiento (dd / mm / aaaa)";
		var strAlerta13		= "Rellene en la categoría de la participación";
		var strAlerta14		= "E-mail no válido o desaparecido";
		var strAlerta15		= "Favor digitar a Senha";
		var strAlerta16		= "Por favor, confirme su contraseña";
		var strAlerta17		= "La contraseña de confirmación deberá consignarse en el mismo campo de la contraseña";
		var strAlerta18		= "Rellene el código postal";
		var strAlerta19		= "Rellene en la Acera";
		var strAlerta20		= "Rellene en la Ciudad";
		var strAlerta21		= "Rellene el Estado";
		var strAlerta22		= "Rellene el País";
		var strAlerta23		= "Rellene tu teléfono";
		var strAlerta24		= "Rellene le códio postal para Recibo/Menudillo";
		var strAlerta25		= "Rellene en la acera para la Preba, Recibo y Menudillo";
		var strAlerta26		= "Rellene en la Ciudad de Recibo/Menudillo";
		var strAlerta27		= "Rellene la estado para Recibo/Menudillo";
		var strAlerta28		= "Rellene el país para Recibo/Menudillo";
		var strAlerta29		= "Rellene el nombre de Recibo/Menudillo";
		var strAlerta30		= "Rellene el pasaporte/RIF para el Recibo/Menudillo";
		var strAlerta31		= "El número de pasaporte/RIF para recibo / Menudillo válido";
		var strAlerta32		= "Preencha o nome do acompanhante";
		var strAlerta33		= "Preencha o nome do crachá do acompanhante";
		var strAlerta34		= "Preencha o CPF do acompanhante";
		var strAlerta35		= "Preencha o e-mail do acompanhante";
		var strAlerta36		= "Elige una Categoría Precio Registro";
		var strAlerta37		= "Rellene los campos día, mes y año de la fecha de check in";
		var strAlerta38		= "Rellene los campos día, mes y año de la fecha de check-out";
		var strAlerta39		= "Selecione a acomodação da Reserva";
		var strAlerta40		= "Elija de pago";
		var strConfirmacao	= "¿Confirmó que se había actualizado la registro?";
		var strAlerta41     = "E-mail compañero o no es válido";
		break;
	case "ING":
		var strAlerta01		= "Fill in the Name";
		var strAlerta02		= "Fill Last name";
		var strAlerta03		= "Fill in the Name Badge";
		var strAlerta04		= "Fill in the Nationality";
		var strAlerta05		= "Fill in the sex";
		var strAlerta06		= "If it is the Brazilian passport field must be filled";
		var strAlerta07		= "If the field Brazilian CPF / CNPJ must be completed";
		var strAlerta08		= "The number of the CPF / CNPJ is invalid";
		var strAlerta09		= "If the Brazilian field must be filled RG";
		var strAlerta10		= "If the Brazilian Issuing Authority field must be filled";
		var strAlerta11		= "Escolha o Tipo de Inscrição";
		var strAlerta12		= "Fill in Date of Birth (dd / mm / yyyy)";
		var strAlerta13		= "Fill in the category of participation";
		var strAlerta14		= "e-mail is invalid or missing";
		var strAlerta15		= "Please enter your password";
		var strAlerta16		= "Please confirm your password";
		var strAlerta17		= "The password confirmation must be the same password you typed in the";
		var strAlerta18		= "Fill in the zip code";
		var strAlerta19		= "Fill in the adress 1";
		var strAlerta20		= "Fill in the City";
		var strAlerta21		= "Fill in the State";
		var strAlerta22		= "Fill in the Country";
		var strAlerta23		= "Complete the Phone number";
		var strAlerta24		= "Fill in the zip code for Receipt / tickt";
		var strAlerta25		= "Fill in the adress  to proof, Receipt and Payment Slip";
		var strAlerta26		= "Fill in the City for Receipt /Payment Slip ";
		var strAlerta27		= "Fill in the state for Receipt / Payment Slip ";
		var strAlerta28		= "Fill in the country for Receipt / Payment Slip ";
		var strAlerta29		= "Fill in the Name for Receipt / Payment Slip ";
		var strAlerta30		= "Fill in the passport / social security number for Receipt /Payment Slip ";
		var strAlerta31		= "The passport / social security number for Receipt / Payment Slip  is invalid";
		var strAlerta32		= "Fill in the name of the Accompanying person";
		var strAlerta33		= "Fill in the name of the badge of the Accompanying person";
		var strAlerta34		= "Preencha o CPF do acompanhante(brasileiro)";
		var strAlerta35		= "Fill in the email of Accompanying person";
		var strAlerta36		= "Choose a Category Registration ";
		var strAlerta37		= "Fill in the fields day, month and year of the date of Check In";
		var strAlerta38		= "Fill in the fields day, month and year of the date of Check Out";
		var strAlerta39		= "Selecione a acomodação da Reserva";
		var strAlerta40		= "Choose Payment";
		var strConfirmacao	= "Confirms update registration sending?";
		var strAlerta41     = "E-mail compañero o no es válido";
		break;
	default:
		var strAlerta01		= "Preencha o Nome";
		var strAlerta02		= "Preencha o Sobrenome";
		var strAlerta03		= "Preencha o Nome para Crachá";
		var strAlerta04		= "Preencha o campo Nacionalidade";
		var strAlerta05		= "Preencha o campo Sexo";
		var strAlerta06		= "Se não for Brasileiro o campo Passaporte deve ser preenchido";
		var strAlerta07		= "Se for Brasileiro o campo CPF / CNPJ deve ser preenchido";
		var strAlerta08		= "O nº do CPF / CNPJ é inválido";
		var strAlerta09		= "Se for Brasileiro o campo RG deve ser preenchido";
		var strAlerta10		= "Se for Brasileiro o campo Órgão Emissor deve ser preenchido";
		var strAlerta11		= "Escolha o Tipo de Inscrição";
		var strAlerta12		= "Preencha o campo Data de Nascimento (dd/mm/aaaa)";
		var strAlerta13		= "Preencha o campo categoria de participação";
		var strAlerta14		= "e-mail inválido ou faltando";
		var strAlerta15		= "Favor digitar a Senha";
		var strAlerta16		= "Favor confirmar sua Senha";
		var strAlerta17		= "A senha de confirmação deve ser a mesma digitada no campo senha";
		var strAlerta18		= "Preencha o CEP";
		var strAlerta19		= "Preencha o Logradouro";
		var strAlerta20		= "Preencha a Cidade";
		var strAlerta21		= "Preencha o Estado";
		var strAlerta22		= "Preencha o Pais";
		var strAlerta23		= "Preencha o Telefone";
		var strAlerta24		= "Preencha o CEP para Recibo/Boleto";
		var strAlerta25		= "Preencha o Logradouro para Comprovante, Recibo e Boleto";
		var strAlerta26		= "Preencha a Cidade para Recibo/Boleto";
		var strAlerta27		= "Preencha a UF para Recibo/Boleto";
		var strAlerta28		= "Preencha o Pais para Recibo/Boleto";
		var strAlerta29		= "Preencha o Nome para Recibo/Boleto";
		var strAlerta30		= "Preencha o CPF/CNPJ para Recibo/Boleto";
		var strAlerta31		= "O nº do CPF / CNPJ para Recibo/Boleto é inválido";
		var strAlerta32		= "Preencha o nome do acompanhante";
		var strAlerta33		= "Preencha o nome do crachá do acompanhante";
		var strAlerta34		= "Preencha o CPF do acompanhante";
		var strAlerta35		= "Preencha o e-mail do acompanhante";
		var strAlerta36		= "Escolha a Categoria de preço de Inscrição";
		var strAlerta37		= "Preencha os campos dia, mês e ano da data de Check In";
		var strAlerta38		= "Preencha os campos dia, mês e ano da data de Check Out";
		var strAlerta39		= "Selecione a acomodação da Reserva";
		var strAlerta40		= "Escolha a Forma de Pagamento";
		var strConfirmacao	= "Confirma o envio da atualização da inscrição ?";
		var strAlerta41     = "E-mail de acompanhante é inválido ou está faltando";
		break;
	}
								
	if (varForm.insNome.value == '') {
		alert(strAlerta01)
		Detalhes('STEP1','ABRIR_STEP1','FECHAR_STEP1','+');
		varForm.insNome.focus();
		return false;
	}
	
	if (cofSobrenome == 'S') {
		if (varForm.insSobreNome.value == '') {
			alert(strAlerta02)
			Detalhes('STEP1','ABRIR_STEP1','FECHAR_STEP1','+');
			varForm.insSobreNome.focus();
			return false;
		}
	}
	
	if (cofNomeCracha == 'S') {
		if (varForm.insNomeCracha.value == '') {
			alert(strAlerta03)
			Detalhes('STEP1','ABRIR_STEP1','FECHAR_STEP1','+');
			varForm.insNomeCracha.focus();
			return false;
		}
	}
	
	// Quando for gerencial, só valida os campos Nome, nome Crachá e Categoria de inscrição.
	if (strGerencial != 'S') {
		
		if (cofNacionalidade == 'S') {
			
			if ((varForm.insEstrangeiro[0].checked == false) && (varForm.insEstrangeiro[1].checked == false)) {
				alert(strAlerta04)
				Detalhes('STEP1','ABRIR_STEP1','FECHAR_STEP1','+');
				varForm.insEstrangeiro[0].focus();
				return false;
			}
		}
		
		if (cofSexo == 'S') {
			if ((varForm.insSexo[0].checked == false) && (varForm.insSexo[1].checked == false)) {
				alert(strAlerta05)
				Detalhes('STEP1','ABRIR_STEP1','FECHAR_STEP1','+');
				varForm.insSexo[0].focus();
				return false;
			}
		}
		
		if (cofNacionalidade == 'S') {

			if (varForm.insEstrangeiro[1].checked == true) {
				if (varForm.insPassaporte.value == '') {
					alert(strAlerta06)
					Detalhes('STEP1','ABRIR_STEP1','FECHAR_STEP1','+');
					varForm.insPassaporte.focus();
					return false;
				}
			}
			
			if (varForm.insEstrangeiro[0].checked == true) {
				
				if (varForm.insCPF_CNPJ.value == '') {
					alert(strAlerta07)
					Detalhes('STEP1','ABRIR_STEP1','FECHAR_STEP1','+');
					varForm.insCPF_CNPJ.focus();
					return false;
				}
				
				if ((varForm.insCPF_CNPJ.value.length > 0) && (!VerificaCPF(varForm.insCPF_CNPJ.value)) && (!VerificaCNPJ(varForm.insCPF_CNPJ.value))) {
					alert(strAlerta08);
					Detalhes('STEP1','ABRIR_STEP1','FECHAR_STEP1','+');
					varForm.insCPF_CNPJ.focus();
					return false;
				}
				
				if (cofRG == 'S') {

					if (varForm.insRG.value == '') {
						alert(strAlerta09);
						Detalhes('STEP1','ABRIR_STEP1','FECHAR_STEP1','+');
						varForm.insRG.focus();
						return false;
					}
					
					if (varForm.insOrgaoEmissor.value == '') {
						alert(strAlerta10);
						Detalhes('STEP1','ABRIR_STEP1','FECHAR_STEP1','+');
						varForm.insOrgaoEmissor.focus();
						return false;
					}
				}
			}
		}
		
		if (cofInscricaoPF_PJ == 'S') {
			if (val_radio(varForm, "insInscricaoPF_PJ", strAlerta11) == false) {
				return false;
			}
		}
						
		if (cofDataNascimento == 'S') {
			if ((varForm.insDiaNasc.value == '') || (varForm.insMesNasc.value == '') || (varForm.insAnoNasc.value == '')) {
				alert(strAlerta12);
				Detalhes('STEP1','ABRIR_STEP1','FECHAR_STEP1','+');
				varForm.insDiaNasc.focus();
				return false;
			}
		}
		
		if (cofParticipacao == 'S') {
			if (varForm.parId.selectedIndex == 0) {
				alert(strAlerta13);
				Detalhes('STEP1','ABRIR_STEP1','FECHAR_STEP1','+');
				varForm.parId.focus();
				return false;
			}
		}

		if (varForm.insEmail.value.length == 0 || ! VerificaEmail(varForm.insEmail.value)) {
			alert(strAlerta14);
			Detalhes('STEP1','ABRIR_STEP1','FECHAR_STEP1','+');
			varForm.insEmail.focus();
			return false;
		}
		
		if (varForm.insSenha.value.length == 0) {
			alert(strAlerta15);
			Detalhes('STEP1','ABRIR_STEP1','FECHAR_STEP1','+');
			varForm.insSenha.focus();
			return false;
		}
		
		if (varForm.insSenhaConf.value.length == 0) {
			alert(strAlerta16);
			Detalhes('STEP1','ABRIR_STEP1','FECHAR_STEP1','+');
			varForm.insSenhaConf.focus();
			return false;
		}
		
		if (varForm.insSenha.value != varForm.insSenhaConf.value) {
			alert(strAlerta17);
			Detalhes('STEP1','ABRIR_STEP1','FECHAR_STEP1','+');
			varForm.insSenhaConf.focus();
			return false;
		}
		
		if ((varForm.insResposta_Pergunta_A[0].checked == false) && (varForm.insResposta_Pergunta_A[1].checked == false)) {
			alert("Seus dados podem ser enviados para creditação no CNA?");
			Detalhes('STEP1','ABRIR_STEP1','FECHAR_STEP1','+');
			return false;
		}

		if (cofNacionalidade == 'S') {
			if (varForm.insEstrangeiro[0].checked == true) {
				if (varForm.insCEP.value == '') {
					alert(strAlerta18);
					Detalhes('STEP1','ABRIR_STEP1','FECHAR_STEP1','+');
					varForm.insCEP.focus();
					return false;
				}
			}
		}
		
		if (varForm.insLogradouro.value == '') {
			alert(strAlerta19)
			Detalhes('STEP1','ABRIR_STEP1','FECHAR_STEP1','+');
			varForm.insLogradouro.focus();
			return false;
		}
		
		if (varForm.insCidade.value == '') {
			alert(strAlerta20);
			Detalhes('STEP1','ABRIR_STEP1','FECHAR_STEP1','+');
			varForm.insCidade.focus();
			return false;
		}
		
		if (cofNacionalidade == 'S') {
			if (varForm.insEstrangeiro[0].checked == true) {
				if (varForm.ufSigla.value == '') {
					alert(strAlerta21);
					Detalhes('STEP1','ABRIR_STEP1','FECHAR_STEP1','+');
					varForm.ufSigla.focus();
					return false;
				}
			}
		}
								
		if (cofPais == 'S') {
			if (varForm.paiId.value == '') {
				alert(strAlerta22);
				Detalhes('STEP1','ABRIR_STEP1','FECHAR_STEP1','+');
				varForm.paiId.focus();
				return false;
			}
		}

		if ((varForm.insDDITel.value == '') || (varForm.insDDDTel.value == '') || (varForm.insTelefone.value == '')) {
			alert(strAlerta23);
			Detalhes('STEP1','ABRIR_STEP1','FECHAR_STEP1','+');
			varForm.insDDITel.focus();
			return false;
		}
		
		if (varForm.Copiar_End_Inscricao.checked == false) {
			
			if (cofNacionalidade == 'S') {
				if (varForm.insEstrangeiro[0].checked == true) {
					if (varForm.pagCEP.value == '') {
						alert(strAlerta24);
						Detalhes('STEP1','ABRIR_STEP1','FECHAR_STEP1','+');
						varForm.pagCEP.focus();
						return false;
					}
				}
			}
			
			if (varForm.pagLogradouro.value == '') {
				alert(strAlerta25);
				Detalhes('STEP1','ABRIR_STEP1','FECHAR_STEP1','+');
				varForm.pagLogradouro.focus();
				return false;
			}
			
			if (varForm.pagCidade.value == '') {
				alert(strAlerta26);
				Detalhes('STEP1','ABRIR_STEP1','FECHAR_STEP1','+');
				varForm.pagCidade.focus();
				return false;
			}
			
			if (cofNacionalidade == 'S') {
				if (varForm.insEstrangeiro[0].checked == true) {
					if (varForm.pag_ufSigla.value == '') {
						alert(strAlerta27);
						Detalhes('STEP1','ABRIR_STEP1','FECHAR_STEP1','+');
						varForm.pag_ufSigla.focus();
						return false;
					}
				}
			}
								
			if (cofPais == 'S') {
				if (varForm.pag_paiId.value == '') {
					alert(strAlerta28);
					Detalhes('STEP1','ABRIR_STEP1','FECHAR_STEP1','+');
					varForm.pag_paiId.focus();
					return false;
				}
			}
						
			if (varForm.pagNomeRecibo.value == '') {
				alert(strAlerta29);
				Detalhes('STEP1','ABRIR_STEP1','FECHAR_STEP1','+');
				varForm.pagNomeRecibo.focus();
				return false;
			}
			
			if (cofNacionalidade == 'S') {
				if (varForm.insEstrangeiro[0].checked == true) {
					if (varForm.pagCPF_CNPJ.value == '') {
						alert(strAlerta30);
						Detalhes('STEP1','ABRIR_STEP1','FECHAR_STEP1','+');
						varForm.pagCPF_CNPJ.focus();
						return false;
					}
					
					if ((varForm.pagCPF_CNPJ.value.length > 0) && (!VerificaCPF(varForm.pagCPF_CNPJ.value)) && (!VerificaCNPJ(varForm.pagCPF_CNPJ.value))) {
						alert(strAlerta31);
						Detalhes('STEP1','ABRIR_STEP1','FECHAR_STEP1','+');
						varForm.pagCPF_CNPJ.focus();
						return false;
					}
				}
			}		
		}
	}
	
	if (eveQtdeAcompanhantes > 0) {
		
		if (varForm.insQtdeAcompanhantes.selectedIndex > 0) {
			
			var intNovaCompraAcp = (eval(varForm.insQtdeAcompanhantes.value) - eval(insQtdeAcpOk));
					
			if (val_acompanhantes(varForm, "acpNome", strAlerta32) == false) {
				return false;
			}
			
			if (val_acompanhantes(varForm, "acpNomeCracha", strAlerta33) == false) {
				return false;
			}
			
			if(pBandeira == "BRA"){
			   if (val_acompanhantes(varForm, "acpCPF", strAlerta34) == false) {
				 return false;
			   }
			}

			if (val_acompanhantes(varForm, "acpEmail", strAlerta35) == false) {
				return false;
			}
		}		
	}
	
	if (((insId == 0) && (eveInscValorNovoCad == 'S')) || ((insId > 0) && (eveInscValorAreaRes == 'S')) || ((insId > 0) && (strGerencial == 'S'))) {
		if (val_radio(varForm, "pevId", strAlerta36) == false) {
			Detalhes('STEP3','ABRIR_STEP3','FECHAR_STEP3','+');
			return false;
		}
	}
	
	if (eveQtdeReservasHotel > 0) {
				
		if (varForm.insQtdeReservasHotel.selectedIndex > 0) {
			
			var intNovaCompraHotel	 = (eval(varForm.insQtdeReservasHotel.value) - eval(insQtdeReservasOk));
			var strDesAlertaCheckIn  = strAlerta37; 
			var strDesAlertaCheckOut = strAlerta38; 
			
			if (val_hospedagem(varForm, "acoId", strAlerta39) == false) {
				return false;
			} 
			
			if (val_hospedagem(varForm, "resDiaE", strDesAlertaCheckIn) == false) {
				return false;
			}
			
			if (val_hospedagem(varForm, "resMesE", strDesAlertaCheckIn) == false) {
				return false;
			}

			if (val_hospedagem(varForm, "resAnoE", strDesAlertaCheckIn) == false) {
				return false;
			}
			
			if (val_hospedagem(varForm, "resDiaS", strDesAlertaCheckOut) == false) {
				return false;
			}
			
			if (val_hospedagem(varForm, "resMesS", strDesAlertaCheckOut) == false) {
				return false;
			}
			
			if (val_hospedagem(varForm, "resAnoS", strDesAlertaCheckOut) == false) {
				return false;
			}
		}
	}
	
	if ((insId == 0) && (eveInscValorNovoCad == 'S')) {
		if (val_radio(varForm, "pagForma", strAlerta40) == false) {
			Detalhes('STEP5','ABRIR_STEP5','FECHAR_STEP5','+');
			return false;
		}
	} else {
		if (((insId > 0) && (eveInscValorAreaRes == 'S') && (strGerencial != 'S')) || (intNovaCompraAcp > 0) || ((val_radio_aux(varForm, "atvId_Incluir") == 'OK') && (strMostrarMatricula == 'S')) || (intNovaCompraHotel > 0)) {
			if (val_radio(varForm, "pagForma", strAlerta40) == false) {
				Detalhes('STEP5','ABRIR_STEP5','FECHAR_STEP5','+');
				return false;
			}
		}
	}
	
	resp = confirm(strConfirmacao);
		
	if (!resp) {
		return false;
	}
	
	return true;
	
}
//-->
