   var isNN = (navigator.appName.indexOf("Netscape") != -1);
   

// =============================================================================================
// Rotina    : Abre janela popup centralizada
//
// Autor     : Marcelo Sanches - 15/07/02
//
// Parametros: strUrl    - URL a ser aberta pela janela
//             strNome   - Nome do objeto janela a ser aberto
//             intWidth  - Largura da janela
//             intHeight - Altura da janela
// =============================================================================================
   function WindowPopup(strUrl, strNome, intStatus, intScrollbars, intWidth, intHeight)
   {   
   // Define variáveis
   // ----------------
      var intWinW;
      var intWinH;
      var intWinX;
      var intWinY;
      var ObjWindow; 

   // Define varlores das variáveis
   // -----------------------------
      intWinW = intWidth;
      intWinH = intHeight;
      intWinX = Math.ceil( (window.screen.width  - intWinW) / 2 );
      intWinY = Math.ceil( (window.screen.height - intWinH) / 2 ); 

   // Verifica a altura da janela e redefine se é o mesmo tamanho da resolução
   // ------------------------------------------------------------------------
      if (intWinH = window.screen.height)
      {
        intWinH = intWinH - 28;
      }

   // Abre a janela popup
   // -------------------
      ObjWindow = window.open( strUrl, strNome, "fullscreen=0,toolbar=0,location=0,directories=0,status=" + intStatus + ",menubar=0,scrollbars=" + intScrollbars + ",resizable=0,width=" + intWinW + ",height=" + intWinH);
      ObjWindow.resizeTo( intWidth, intHeight );
      ObjWindow.moveTo  ( intWinX , intWinY );
      ObjWindow.focus();
   }
      
  // window.onload=function()
//   WindowPopup(festival.asp, "brw_Festival", 0, 0, 100, 300)

   
// =============================================================================================
// Rotina    : Fecha o browse atualmente aberto
//
// Autor     : Marcelo Sanches - 15/07/02
//
// Parametros: Nenhum parâmetro
// =============================================================================================
   function WindowClose()
   {
   // Fecha janela
   // ------------
      window.close();
   }



// =============================================================================================
// Rotina    : Postagem do form de busca de curso
//
// Autor     : Marcelo Sanches - 15/07/02
//
// Parametros: Nenhum parâmetro
// =============================================================================================
   function BuscaCurso()
   {
   // Define variáveis
   // ----------------
      var objFrmBuscaCurso;

   // Constroi a querystring
   // ----------------------
      objFrmBuscaCurso = window.document.frm_BuscaCurso;

   // Submit do formulário de busca de curso
   // --------------------------------------
      objFrmBuscaCurso.submit();
   }



// =============================================================================================
// Rotina    : Envia votação da enquete
//
// Autor     : Marcelo Sanches - 15/07/02
//
// Parametros: Nenhum parâmetro
// =============================================================================================
   function EnviaEnquete()
   {
   // Define variáveis
   // ----------------
      var objFrmEnquete;
      var bolChkEnq;

   // Constroi a querystring
   // ----------------------
      objFrmEnquete = window.document.frmEnquete;
      strPagina = "enquete.asp?";
      strPagina = strPagina + "idenquete=" + objFrmEnquete.IdEnquete.value;

   // Verifica se tem radiobox de enquete selecionado
   // -----------------------------------------------
      bolChkEnq = false;
      for (i=0;i<objFrmEnquete.length;i++){
        if(objFrmEnquete.elements[i].checked==true && objFrmEnquete.elements[i].name=="chkEnquete")
        {
          strPagina = strPagina + "&idresposta=" + objFrmEnquete.elements[i].value;
          bolChkEnq = true;
        }
      }

   // Valida radiobox de enquete
   // --------------------------
      if(!bolChkEnq) {
        alert("Selecione uma opção da enquete para votação.");
        return false;
      }
       
   // Chama página de enquete
   // -----------------------
      WindowPopup(strPagina, "brw_Enquete", 0, 0, 550, 370)
  }



// =============================================================================================
// Rotina    : Valida e-mail
//
// Autor     : Marcelo Sanches - 15/07/02
//
// Parametros: Nenhum parâmetro
// =============================================================================================
   function ValidaEmail(txtEmail)
   {
      var strMail = txtEmail

      if (strMail.indexOf("@") == -1)
      {
         return false
      }
      return true;
   }



// =============================================================================================
// Rotina    : Envia cadastro de newsletter
//
// Autor     : Marcelo Sanches - 15/07/02
//
// Parametros: Nenhum parâmetro
// =============================================================================================
   function CadastraNewsletter()
   {
   // Define variáveis
   // ----------------
      var objFrmNewsletter;

   // Define formuário de newsletter
   // ------------------------------
      objFrmNewsletter = window.document.frmNewsletter;

   // Valida campo nome
   // -----------------
      if(objFrmNewsletter.txtNome.value == "") {
        alert("Informe o nome para o cadastro.");
        objFrmNewsletter.txtNome.focus();
        return false;
      }

   // Valida campo de e-mail
   // ----------------------
      if(!ValidaEmail(objFrmNewsletter.txtEmail.value)) {
        alert("Informe um e-mail válido para o cadastro.");
        objFrmNewsletter.txtEmail.focus();
        return false;
      }

   // Constroi a querystring
   // ----------------------
      strPagina = "newsletter.asp?";
      strPagina = strPagina + "nome=" + objFrmNewsletter.txtNome.value;
      strPagina = strPagina + "&email=" + objFrmNewsletter.txtEmail.value;

   // Chama página de newsletter
   // --------------------------
      WindowPopup(strPagina, "brw_Newsletter", 0, 0, 550, 350)

   // Limpa campos do formulário
   // --------------------------
      objFrmNewsletter.txtNome.value = "";
      objFrmNewsletter.txtEmail.value= "";
  }
  
  
// =============================================================================================
// Rotina    : Incica o curso selecionado
//
// Autor     : Marcelo Sanches - 15/07/02
//
// Parametros: Nenhum parâmetro
// =============================================================================================
   function IndicaCurso()
   {
   // Define variáveis
   // ----------------
      var objFrmIndicaCurso;

   // Define formuário de newsletter
   // ------------------------------
      objFrmIndicaCurso = window.document.frmIndicaCurso;

   // Valida campo nome
   // -----------------
      if(objFrmIndicaCurso.txtNome.value == "") {
        alert("Informe o nome do seu amigo.");
        objFrmIndicaCurso.txtNome.focus();
        return false;
      }

   // Valida campo de e-mail
   // ----------------------
      if(!ValidaEmail(objFrmIndicaCurso.txtEmail.value)) {
        alert("Informe um e-mail válido.");
        objFrmIndicaCurso.txtEmail.focus();
        return false;
      }

   // Constroi a querystring
   // ----------------------
      strPagina = "../../indica.asp?Tipo=Curso";
      strPagina = strPagina + "&IdCurso=" + objFrmIndicaCurso.txtIdCurso.value;	  
      strPagina = strPagina + "&intEAD=" + objFrmIndicaCurso.intEAD.value;	  	  
      strPagina = strPagina + "&txtNome=" + objFrmIndicaCurso.txtNome.value;
      strPagina = strPagina + "&txtEmail=" + objFrmIndicaCurso.txtEmail.value;

   // Chama página de incicação de curso
   // ----------------------------------
      WindowPopup(strPagina, "brw_IncicaCurso", 0, 0, 500, 300)

   // Limpa campos do formulário
   // --------------------------
      objFrmIndicaCurso.txtNome.value = "";
      objFrmIndicaCurso.txtEmail.value= "";
  }
  
  
// =============================================================================================
// Rotina    : Incica a notícia atual
//
// Autor     : Marcelo Sanches - 15/07/02
//
// Parametros: Nenhum parâmetro
// =============================================================================================
   function IndicaNoticia()
   {
   // Define variáveis
   // ----------------
      var objFrmIndicaNoticia;

   // Define formuário de indicação de notícia
   // ----------------------------------------
      objFrmIndicaNoticia = window.document.frmIndicaNoticia;
	  
   // Valida campo nome
   // -----------------
      if(objFrmIndicaNoticia.txtNomeRemetente.value == "") {
        alert("Informe o seu nome.");
        objFrmIndicaNoticia.txtNomeRemetente.focus();
        return false;
      }

   // Valida campo de e-mail
   // ----------------------
      if(!ValidaEmail(objFrmIndicaNoticia.txtEmailRemetente.value)) {
        alert("Informe o seu e-mail válido.");
        objFrmIndicaNoticia.txtEmailRemetente.focus();
        return false;
      }	  

   // Valida campo nome
   // -----------------
      if(objFrmIndicaNoticia.txtNome.value == "") {
        alert("Informe o nome do seu amigo.");
        objFrmIndicaNoticia.txtNome.focus();
        return false;
      }
	  
   // Valida campo de e-mail
   // ----------------------
      if(!ValidaEmail(objFrmIndicaNoticia.txtEmail.value)) {
        alert("Informe o e-mail do seu amigo.");
        objFrmIndicaNoticia.txtEmail.focus();
        return false;
      }	  	  

   // Chama página de indicação de notícia
   // ------------------------------------
      objFrmIndicaNoticia.submit();
  }  
  
  
  
// =============================================================================================
// Rotina    : Formata mascara de campos de formulário
//
// Autor     : Marcelo Sanches - 15/07/02
//
// Parametros: Nenhum parâmetro
// =============================================================================================
   function FormatarMascara(src, mask, objEvent) {
      var i = src.value.length;
      
      if (mask.length == i){
         return false;
      }		
      
      var saida = mask.substring(i,i+1);
      var ascii = objEvent.keyCode;
      if (saida == "A") {
         if (((ascii >= 97) && (ascii <= 122)) || (ascii <= 231)) { 
            objEvent.keyCode -= 32;
         }
         else { 
            objEvent.keyCode = 0; 
         }
      } else if (saida == "Z") {
         if (((ascii >= 65) && (ascii <= 90)) || ((ascii >= 97) && (ascii <= 122)) || (ascii <= 231)) { 
            objEvent.keyCode = objEvent.keyCode;
         }
         else { 
            objEvent.keyCode = 0;
         }
      } else if (saida == "0") {
         if ((ascii >= 48) && (ascii <= 57)) { 
            return;
         }
         else { 
            objEvent.keyCode = 0;
         }
      } else if (saida == "#") {
         return;
      } else {
         src.value += saida;
         i += 1;
         saida = mask.substring(i,i+1);
         if (saida == "A") {
            if (((ascii >= 97) && (ascii <= 122)) || (ascii <= 231)) { 
               objEvent.keyCode -= 32; 
            }
            else { 
               objEvent.keyCode = 0; 
            }
         } else if (saida == "Z") {
            if (((ascii >= 65) && (ascii <= 90)) || ((ascii >= 97) && (ascii <= 122)) || (ascii <= 231)) { 
               objEvent.keyCode = objEvent.keyCode;
            }
            else { 
               objEvent.keyCode = 0;
            }

         } else if (saida == "0") {
            if ((ascii >= 48) && (ascii <= 57)) { 
               return;
            }
            else { 
               objEvent.keyCode = 0;
            }
         } else { return; }
      }
   }


// =============================================================================================
// Rotina    : Validar a idade limite do curso
//
// Autor     : Marcelo Sanches - 15/07/02
//
// Parametros: Nenhum parâmetro
// =============================================================================================
   function ValidarIdade(){
		// Validar a data de nascimento
		if (!ValidarData(window.document.frm_Matricula.datNascimento.value)) {
			alert("Informe uma data válida para Nascimento");
			window.document.frm_Matricula.datNascimento.focus();										
			return false;	
		}
		
		var data = window.document.frm_Matricula.datNascimento.value;
		
		if(data.length==8) {
			var dia = parseInt(data.substring(0,2),10);
			var mes = parseInt(data.substring(2,4),10);
			var ano = parseInt(data.substring(4,8),10)
		} else {
			var dia = parseInt(data.substring(0,2),10);
			var mes = parseInt(data.substring(3,5),10);
			var ano = parseInt(data.substring(6,10),10)
				
			if((data.charAt(2)!='/')||(data.charAt(5)!='/')) {
				if(data!="") {			
							return false;
					}
			}
		}
		
		var dataatual = new Date();
		var diaatual = dataatual.getDate();
		var mesatual = dataatual.getMonth() + 1;
		var anoatual = dataatual.getYear();
		
		if (anoatual < 100) anoatual += 1900;
		var idade = anoatual - ano;
		if (mesatual < mes) idade --;	
		if ((mesatual == mes) && (diaatual < dia)) idade --;

		if (idade < window.document.frm_Matricula.intIdadeMinima.value){	
			alert("Idade mínima " + window.document.frm_Matricula.intIdadeMinima.value + " anos");
			window.document.frm_Matricula.datNascimento.focus();										
			return false;	
		}
		
		return true;
   }


   function ValidarData(obj){
		if(obj.length==8) {
		 dia = parseInt(obj.substring(0,2),10);
		 mes = parseInt(obj.substring(2,4),10);
		 ano = parseInt(obj.substring(4,8),10)
		}
		else {
		 dia = parseInt(obj.substring(0,2),10);
		 mes = parseInt(obj.substring(3,5),10);
		 ano = parseInt(obj.substring(6,10),10)
			
		 if((obj.charAt(2)!='/')||(obj.charAt(5)!='/')) {
			if(obj!="") {			
			   return false;
			}
		 }
		}
		
		if((dia > 31) || (dia == 0)) {
				return false;		
		}
		if ((mes > 12) || (mes == 0)) {
		return false;		
		}
		if(ano%4 == 0)
		 varauxbissexto = 1;
		else
		 varauxbissexto = 0;
		if(((mes == 2) && (dia > (28 + parseInt(varauxbissexto,10)))) || (mes == 4 || mes == 6 || mes == 9 || mes == 11) && (dia > 30)){
		 return false;
		}	
		
		return true;
   }   
   
   
// =============================================================================================
// Rotina    : Enviar e-mail para o senac
//
// Autor     : Marcelo Sanches - 15/07/02
//
// Parametros: Nenhum parâmetro
// =============================================================================================
   function EnviaEmail()
   {
   // Define variáveis
   // ----------------
      var objFrmContato;

   // Define formuário de newsletter
   // ------------------------------
      objFrmContato = window.document.frmContato;

   // Valida campo nome
   // -----------------
      if(objFrmContato.txtNome.value == "") {
        alert("Informe o nome para contato.");
        objFrmContato.txtNome.focus();
        return false;
      }

   // Valida campo de e-mail
   // ----------------------
      if(!ValidaEmail(objFrmContato.txtEmail.value)) {
        alert("Informe um e-mail válido.");
        objFrmContato.txtEmail.focus();
        return false;
      }
	  
   // Valida campo mensagem
   // ---------------------
      if(objFrmContato.txtMensagem.value == "") {
        alert("Informe a mensagem.");
        objFrmContato.txtMensagem.focus();
        return false;
      }	  

   // Constroi a querystring
   // ----------------------
      strPagina = "../../email.asp?Destino=" + objFrmContato.txtDestino.value;	  
      strPagina = strPagina + "&Nome=" + objFrmContato.txtNome.value;
      strPagina = strPagina + "&Email=" + objFrmContato.txtEmail.value;
      strPagina = strPagina + "&Mensagem=" + objFrmContato.txtMensagem.value;	  	  

   // Chama página de incicação de curso
   // ----------------------------------
      WindowPopup(strPagina, "brw_EnviaEmail", 0, 0, 500, 300)

   // Limpa campos do formulário
   // --------------------------
      objFrmContato.txtNome.value = "";
      objFrmContato.txtEmail.value= "";
      objFrmContato.txtMensagem.value= "";	  
  }
  
  
// =============================================================================================
// Rotina    : Enviar formulário de cadastro da pré-matrícula
//
// Autor     : Marcelo Sanches - 15/07/02
//
// Parametros: Nenhum parâmetro
// =============================================================================================
   function EnviaMatricula()
   {
   // Define variáveis
   // ----------------
      var objFrmPrematricula;

   // Define formuário de Pre-matricula
   // ---------------------------------
      objFrmPrematricula = window.document.frm_Prematricula;

   // Valida campo nome
   // -----------------
      if(objFrmPrematricula.chrNome.value == "") {
        alert("Informe o nome.");
        objFrmPrematricula.chrNome.focus();
        return false;
      }
	  
   // Valida campo de Nome do Pai
   // ---------------------------
      if(objFrmPrematricula.chrNomePai.value == "") {
        alert("Informe o nome do pai.");
        objFrmPrematricula.chrNomePai.focus();
        return false;
      }	  
	  
   // Valida campo de Nome da Mãe
   // ---------------------------
      if(objFrmPrematricula.chrNomeMae.value == "") {
        alert("Informe o nome da mãe.");
        objFrmPrematricula.chrNomeMae.focus();
        return false;
      }
	  
   // Valida campo de Endereço
   // ------------------------
      if(objFrmPrematricula.chrEndereco.value == "") {
        alert("Informe o endereço.");
        objFrmPrematricula.chrEndereco.focus();
        return false;
      }
	  
   // Valida campo de Número
   // ----------------------
      if(objFrmPrematricula.chrNumero.value == "") {
        alert("Informe o número do endereço.");
        objFrmPrematricula.chrNumero.focus();
        return false;
        }

   // Valida campo de Bairro
   // ----------------------
      if(objFrmPrematricula.chrBairro.value == "") {
        alert("Informe o bairro.");
        objFrmPrematricula.chrBairro.focus();
        return false;
      }	  
	  
   // Valida campo de CEP
   // -------------------
      if(objFrmPrematricula.chrCep.value == "") {
        alert("Informe o CEP.");
        objFrmPrematricula.chrCep.focus();
        return false;
      }	  

   // Valida campo de Município
   // -------------------------
      if(objFrmPrematricula.intIdMunicipio.value == "") {
        alert("Informe o município.");
        objFrmPrematricula.intIdMunicipio.focus();
        return false;
      }	 
	  
   // Valida campo de Telefone
   // ------------------------
      if(objFrmPrematricula.chrTelefone01.value == "") {
        alert("Informe o telefone.");
        objFrmPrematricula.chrTelefone01.focus();
        return false;
      }
	  
   // Valida campo de e-mail
   // ----------------------
      if(!ValidaEmail(objFrmPrematricula.chrEmail.value)) {
        alert("Informe um e-mail válido.");
        objFrmPrematricula.chrEmail.focus();
        return false;
      }
	  
   // Valida campo de RG
   // ------------------
      if(objFrmPrematricula.chrRG.value == "") {
        alert("Informe o número de RG.");
        objFrmPrematricula.chrRG.focus();
        return false;
      }

   // Valida campo de data emissão do RG
   // ----------------------------------
      if(objFrmPrematricula.datRGEmissao.value == "") {
        alert("Informe a data de emissão do RG.");
        objFrmPrematricula.datRGEmissao.focus();
        return false;
      }
	  
   // Valida campo de órgão emissor do RG
   // -----------------------------------
      if(objFrmPrematricula.chrRGOrgaoEmissor.value == "") {
        alert("Informe o órgão emissor do RG.");
        objFrmPrematricula.chrRGOrgaoEmissor.focus();
        return false;
      }

   // Valida campo de CPF
   // -------------------
      if(objFrmPrematricula.chrCpf.value == "") {
        alert("Informe o CPF.");
        objFrmPrematricula.chrCpf.focus();
        return false;
      }

   // Valida campo de Nacionalidade
   // -----------------------------
      if(objFrmPrematricula.chrNacionalidade.value == "") {
        alert("Informe a nacionalidade.");
        objFrmPrematricula.chrNacionalidade.focus();
        return false;
      }

   // Valida campo de Naturalidade
   // -----------------------------
      if(objFrmPrematricula.intIdNaturalidade.value == "") {
        alert("Informe a naturalidade.");
        objFrmPrematricula.intIdNaturalidade.focus();
        return false;
      }

   // Valida campo de Data de Nascimento
   // ----------------------------------
      if(objFrmPrematricula.datNascimento.value == "") {
        alert("Informe a data de nascimento.");
        objFrmPrematricula.datNascimento.focus();
        return false;
      }

   // Submit do formulário
   // --------------------
  	  objFrmPrematricula.submit();
  }  


// =============================================================================================
// Rotina    : Mudar a imagem de objEventos
//
// Autor     : Marcelo Sanches - 15/07/02
//
// Parametros: Nenhum parâmetro
// =============================================================================================
   function MudaImageEvento( strImgEvento ){
      var objImgEvento = window.document.getElementById("imgEvento");	
      objImgEvento.src = strImgEvento;
   }

  
// =============================================================================================
// Rotina    : Validar acesso de aluno
//
// Autor     : Marcelo Sanches - 15/07/02
//
// Parametros: Nenhum parâmetro
// =============================================================================================
   function ValidarAcessoAluno(){
	// Validar campo cpf
	if (!VerificaCPF(window.document.frmAcessoAluno.chrCpf.value)) {
		alert("Informe um CPF válido");
		window.document.frmAcessoAluno.chrCpf.focus();										
		return false;	
	}

	RsExecute("html/alunos/alunodados.asp", window.document.frmAcessoAluno);
   }   

  
// =============================================================================================
// Rotina    : Validar matrícula
//
// Autor     : Marcelo Sanches - 15/07/02
//
// Parametros: Nenhum parâmetro
// =============================================================================================
   var retorno;
   var mpg_popup;
   window.name = "loja";
   function ValidarMatricula(){
		// Valida o passo
		if (window.document.frm_Matricula.hid_Passo.value == "PP") {
			// Validar a política de privacidade
			if (!window.document.frm_Matricula.chkPolitica.checked) {
				alert("É necessário que você concorde com a Política de Privacidade");
				window.document.frm_Matricula.chkPolitica.focus();						
				return false;	
			}		
		}

		// Valida o passo
		if (window.document.frm_Matricula.hid_Passo.value == "TC") {
			// Validar termos e condições
			if (!window.document.frm_Matricula.chkTermos.checked) {
				alert("É necessário que você concorde com seus Termos e Condições");
				window.document.frm_Matricula.chkTermos.focus();						
				return false;	
			}		
		}
		
		// Valida o passo
		if (window.document.frm_Matricula.hid_Passo.value == "DA") {
			// Validar dados do aluno
			if (!ValidarDadosAluno()) {
				return false;	
			}		
		}		

		// Valida o passo
		if (window.document.frm_Matricula.hid_Passo.value == "DP") {
			// Validar campo de tipo de pagamento
			if (window.document.frm_Matricula.intTipoPagamento.value == "0") {
				alert("Informe o Pagamento");
				window.document.frm_Matricula.intTipoPagamento.focus();
				return false;	
			}									
			   
			// Validar campo de forma de pagamento
			if (window.document.frm_Matricula.intIdFormaDePagamento.value == "0") {
				alert("Informe a Forma de Pagamento");
				window.document.frm_Matricula.intIdFormaDePagamento.focus();
				return false;	
			}									
			
			// Validar campo de parcelamento
			if (window.document.frm_Matricula.intQtParcela.value == "0" && window.document.frm_Matricula.intTipoPagamento.value == "2") {
				alert("Informe o Parcelamento");
				window.document.frm_Matricula.intQtParcela.focus();
				return false;	
			}	
			
			// Verifica a forma de pagamento
			if (window.document.frm_Matricula.intIdFormaDePagamento.value == 1 || window.document.frm_Matricula.intIdFormaDePagamento.value == 2) {
				// Validar campo de número cartão
				//if (window.document.frm_Matricula.intNumeroCartao.value == "") {
				//	alert("Informe o Número do Cartão");
				//	window.document.frm_Matricula.intNumeroCartao.focus();
				//	return false;	
				//}	
				
				// Validar campo de código verificador
				//if (window.document.frm_Matricula.intCodigoVerifica.value == "") {
				//	alert("Informe o Código Verificador");
				//	window.document.frm_Matricula.intCodigoVerifica.focus();
				//	return false;	
				//}	
				
				// Validar campo de títular
				if (window.document.frm_Matricula.chrLivre06.value == "") {
					alert("Informe o Títular");
					window.document.frm_Matricula.chrLivre06.focus();
					return false;	
				}					
				
				// Validar campo de validade mês
				//if (window.document.frm_Matricula.intValidadeMes.value == "0") {
				//	alert("Informe o mês de Validade do Cartão");
				//	window.document.frm_Matricula.intValidadeMes.focus();
				//	return false;	
				//}	
				
				// Validar campo de validade ano
				//if (window.document.frm_Matricula.intValidadeAno.value == "0") {
				//	alert("Informe o ano de Validade do Cartão");
				//	window.document.frm_Matricula.intValidadeAno.focus();
				//	return false;	
				//}	
			}
		}

		return true;
   }


// =============================================================================================
// Rotina    : Finaliza matrícula do aluno
//
// Autor     : Marcelo Sanches - 15/07/02
//
// Parametros: Nenhum parâmetro
// =============================================================================================
   function FinalizaMatricula(){
		if(navigator.appName.indexOf("Netscape") != -1)
			mpg_popup = window.open("", "mpg_popup","toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=0,screenX=0,screenY=0,left=0,top=0,width=765,height=440");
		else
			mpg_popup = window.open("", "mpg_popup","toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1,screenX=0,screenY=0,left=0,top=0,width=765,height=440");

		window.document.frm_Matricula.submit();
		window.location = "matriculaaguarde.asp";   
   } 
   

// =============================================================================================
// Rotina    : Valida matrícula do aluno
//
// Autor     : Marcelo Sanches - 15/07/02
//
// Parametros: Nenhum parâmetro
// =============================================================================================
   function ValidaMatricula(){
		if (!ValidarMatricula())    
   			return false;
   
		str_Action = window.document.frm_Matricula.action;
		str_Target = window.document.frm_Matricula.target;		
		window.document.frm_Matricula.action = "matriculaconfirma.asp";
		window.document.frm_Matricula.target = "frmConfirma";
		window.document.frm_Matricula.submit();
		window.document.frm_Matricula.action = str_Action;
		window.document.frm_Matricula.target = str_Target;
   }   
   
   
// =============================================================================================
// Rotina    : Habilita opção de matrícula
//
// Autor     : Alexandre Bacelar - 18/07/05
//
// Parametros: Nenhum parâmetro
// =============================================================================================
   function MudarTipoPagamento(){
			var objPagar = window.document.getElementById("objPagar");		      
			var objParcelamento = window.document.getElementById("objParcelamento");		   
			
			// Verifica o tipo de pagamento
			if (window.document.frm_Matricula.intTipoPagamento.value == 2) {
					objPagar.style.display = "none";			
					objParcelamento.style.display = "";
			} else {
					objPagar.style.display = "";						
					objParcelamento.style.display = "none";			
			}
  }   


// =============================================================================================
// Rotina    : Validar dados do aluno
//
// Autor     : Marcelo Sanches - 15/07/02
//
// Parametros: Nenhum parâmetro
// =============================================================================================
   function ValidarDadosAluno()
   {
			// Define formuário de matricula
			var objFormMatricula = window.document.frm_Matricula;

			// Validar campo cpf
			if (window.document.frm_Matricula.chrCpf.value == "") {
				alert("Informe o campo de CPF");
				window.document.frm_Matricula.chrCpf.focus();										
				return false;	
			}
					
			// Validar campo cpf
			if (!VerificaCPF(window.document.frm_Matricula.chrCpf.value)) {
				alert("Informe um CPF válido");
				window.document.frm_Matricula.chrCpf.focus();										
				return false;	
			}
					
			// Validar campo nome
			if (objFormMatricula.chrNome.value == "") {
				alert("Informe o campo de Nome");
				objFormMatricula.chrNome.focus();										
				return false;	
			}
			
			// Validar campo estado civil
			if (objFormMatricula.intIdEstadoCivil.value == "") {
				alert("Informe o campo de Estado Civil");
				objFormMatricula.intIdEstadoCivil.focus();										
				return false;	
			}
			
			// Validar campo sexo
			if (objFormMatricula.chrIdSexo.value == "") {
				alert("Informe o campo de Sexo");
				objFormMatricula.chrIdSexo.focus();										
				return false;	
			}			
			
			// Validar campo nascimento
			if (objFormMatricula.datNascimento.value == "") {
				alert("Informe o campo de Nascimento");
				objFormMatricula.datNascimento.focus();
				return false;	
			}
			
			// Validar a data para nascimento
			if (!ValidarIdade()) {
				return false;	
			}
			
			// Validar campo naturalidade
			if (objFormMatricula.intIdNaturalidade.value == "") {
				alert("Informe o campo de Naturalidade");
				objFormMatricula.intIdNaturalidade.focus();										
				return false;	
			}
			
			// Validar campo nacionalidade
			if (objFormMatricula.chrNacionalidade.value == "") {
				alert("Informe o campo de Nacionalidade");
				objFormMatricula.chrNacionalidade.focus();										
				return false;	
			}			

			// Validar campo escolaridade
			if (objFormMatricula.intIdEscolaridade.value == "") {
				alert("Informe o campo de Escolaridade");
				objFormMatricula.intIdEscolaridade.focus();										
				return false;	
			}			
			
			// Validar campo profissão
			if (objFormMatricula.intIdProfissao.value == "") {
				alert("Informe o campo de Profissão");
				objFormMatricula.intIdProfissao.focus();										
				return false;	
			}			

			// Validar campo situação
			if (objFormMatricula.intIdSituacao.value == "") {
				alert("Informe o campo de Situação");
				objFormMatricula.intIdSituacao.focus();										
				return false;	
			}			
			
			// Validar campo raça
			if (objFormMatricula.intIdRaca.value == "") {
				alert("Informe o campo de Raça");
				objFormMatricula.intIdRaca.focus();										
				return false;	
			}						
			
			// Validar campo deficiência
			if (objFormMatricula.intIdDeficiencia.value == "") {
				alert("Informe o campo de Deficiência");
				objFormMatricula.intIdDeficiencia.focus();										
				return false;	
			}						
			
			// Validar campo rg
			if (objFormMatricula.chrRG.value == "") {
				alert("Informe o campo de RG");
				objFormMatricula.chrRG.focus();										
				return false;	
			}
			
			// Validar campo rg
			if (objFormMatricula.chrRGOrgaoEmissor.value == "") {
				alert("Informe o campo Órgão Emissor");
				objFormMatricula.chrRGOrgaoEmissor.focus();										
				return false;	
			}			

			// Validar campo cpf
			if (objFormMatricula.chrCpf.value == "") {
				alert("Informe o campo de CPF");
				objFormMatricula.chrCpf.focus();										
				return false;	
			}
			
			// Validar campo cpf
			if (!VerificaCPF(objFormMatricula.chrCpf.value)) {
				alert("Informe um CPF válido");
				objFormMatricula.chrCpf.focus();										
				return false;	
			}			

			// Validar campo endereço
			if (objFormMatricula.chrEndereco.value == "") {
				alert("Informe o campo de Endereço");
				objFormMatricula.chrEndereco.focus();										
				return false;	
			}									

			// Validar campo numero do endereço
			if (objFormMatricula.chrNumero.value == "") {
				alert("Informe o campo de Número do Endereço");
				objFormMatricula.chrNumero.focus();										
				return false;	
			}									

			// Validar campo bairro do endereço
			if (objFormMatricula.chrBairro.value == "") {
				alert("Informe o campo de Bairro do Endereço");
				objFormMatricula.chrBairro.focus();										
				return false;	
			}									
			
			// Validar campo cep do endereço
			if (objFormMatricula.chrCep.value == "") {
				alert("Informe o campo de CEP do Endereço");
				objFormMatricula.chrCep.focus();										
				return false;	
			}									

			// Validar campo município do endereço
			if (objFormMatricula.intIdMunicipio.value == "") {
				alert("Informe o campo de Município do Endereço");
				objFormMatricula.intIdMunicipio.focus();										
				return false;	
			}									

			// Validar campo ddd do Telefone
			if (objFormMatricula.chrDDDTelefone01.value == "") {
				alert("Informe o campo de DDD do Telefone");
				objFormMatricula.chrDDDTelefone01.focus();
				return false;	
			}									

			// Validar campo Telefone
			if (objFormMatricula.chrTelefone01.value == "") {
				alert("Informe o campo de Telefone");
				objFormMatricula.chrTelefone01.focus();
				return false;	
			}									
			
			// Validar campo e-mail
			if (!ValidaEmail(objFormMatricula.chrEmail.value)) {
				alert("Informe o campo de E-mail");
				objFormMatricula.chrEmail.focus();
				return false;	
			}									

			return true;
  }   


// =============================================================================================
// Rotina    : Obter dados do aluno
//
// Autor     : Marcelo Sanches - 15/07/02
//
// Parametros: Nenhum parâmetro
// =============================================================================================
   function ObterDadosAluno(){
		// Validar campo cpf
		if (window.document.frm_Matricula.chrCpf.value == "") {
			alert("Informe o campo de CPF");
			window.document.frm_Matricula.chrCpf.focus();										
			return false;	
		}
				
		// Validar campo cpf
		if (!VerificaCPF(window.document.frm_Matricula.chrCpf.value)) {
			alert("Informe um CPF válido");
			window.document.frm_Matricula.chrCpf.focus();										
			return false;	
		}			
		
		str_Action = window.document.frm_Matricula.action;
		str_Target = window.document.frm_Matricula.target;		
		window.document.frm_Matricula.action = "matriculaaluno.asp";
		window.document.frm_Matricula.target = "frmDadosaluno";
		window.document.frm_Matricula.submit();
		window.document.frm_Matricula.action = str_Action;
		window.document.frm_Matricula.target = str_Target;				
   }   
 

// =============================================================================================
// Rotina    : Seleciona combobox
//
// Autor     : Marcelo Sanches - 15/07/02
//
// Parametros: Nenhum parâmetro
// =============================================================================================
   function SelecionaCombobox( objSelect, optionVal ){
      var lst = objSelect;
      for( var i = 0; i< lst.options.length; i++ ){
         if( lst.options[i].value == optionVal ){
            lst.selectedIndex = i;
            return;
         }  
      }
   }   


// =============================================================================================
// Rotina    : Carregar combobox de município
//
// Autor     : Marcelo Sanches - 15/07/02
//
// Parametros: objComboUf - Combo de Uf
//             strNomeCombo - Nome do combo a ser carregado
// =============================================================================================
   function CarregaMunicipio(objComboUf, strNomeCombo){
		// Chama remote para carregar combobox de município
		RsExecute("matriculamunicipio.asp", Array(objComboUf.value, strNomeCombo));
   }
   
   
// =============================================================================================
// Rotina    : Habilita opção de matrícula
//
// Autor     : Alexandre Bacelar - 18/07/05
//
// Parametros: strOpcao - Opção de matrícula selecionada
// =============================================================================================
   function OpcaoMatricula( strPagina, strOpcao, strPasso ){
   			var bolAcao = true;
			switch (strOpcao) {
				case "PP" :
					if (!(strPasso == "PP" || strPasso == "TC" || strPasso == "DA" || strPasso == "DP")) {
						void(0);			
						bolAcao = false;
					}
					break;
				case "TC" :
					if (!(strPasso == "TC" || strPasso == "DA" || strPasso == "DP")) {
						void(0);
						bolAcao = false;									
					}	
					break;			
				case "DA" :
					if (!(strPasso == "DA" || strPasso == "DP")) {
						void(0);
						bolAcao = false;									
					}
					break;			
				case "DP" :
					if (!(strPasso == "DP")) {
						void(0);
						bolAcao = false;									
					}
					break;			
			}
			
			if (window.document.frm_Matricula.hid_Passo.value == "PM") {
				void(0);
			} else {
				if (bolAcao) {
					window.location.href = strPagina;
				} else {	
					if (ValidarMatricula()) {
						void(0);
						bolAcao = false;									
					}			
				}			
			}			
   }   


   function FormatarNumero(objEvent) {
      var int_keyCod = (isNN) ? objEvent.which : objEvent.keyCode; 
      
      if ((int_keyCod >= 48) && (int_keyCod <= 57)) {
         return;
      }
      else { 
         objEvent.keyCode = 0;
      }
   }
   
   
   function VerificaCPF(lCPF) {
		//Define variáveis
		var CPF = ""; 
		var ch = "";
	
		// Verifica se o campo é diferente de nulo
		if (lCPF != '') {  
			// Retira a máscara do CPF	
			for (I=0; I<=lCPF.length; I++)
			{    
			   ch = lCPF.substring(I, I + 1);
			   if (ch >= "0" && ch <= "9")
			   {
					 CPF = CPF.toString() + ch.toString()
			   }
			}
			
			// Aqui começa a checagem do CPF
			var POSICAO, I, SOMA, DV, DV_INFORMADO;
			var DIGITO = new Array(10);
			DV_INFORMADO = CPF.substr(9, 2); // Retira os dois últimos dígitos do número informado
			
			// Desemembra o número do CPF na array DIGITO
			for (I=0; I<=8; I++) {
			  DIGITO[I] = CPF.substr( I, 1);
			}
			
			// Calcula o valor do 10º dígito da verificação
			POSICAO = 10;
			SOMA = 0;
			   for (I=0; I<=8; I++) {
				  SOMA = SOMA + DIGITO[I] * POSICAO;
				  POSICAO = POSICAO - 1;
			   }
			DIGITO[9] = SOMA % 11;
			   if (DIGITO[9] < 2) {
					DIGITO[9] = 0;
			}
			   else{
				   DIGITO[9] = 11 - DIGITO[9];
			}
			
			// Calcula o valor do 11º dígito da verificação
			POSICAO = 11;
			SOMA = 0;
			   for (I=0; I<=9; I++) {
				  SOMA = SOMA + DIGITO[I] * POSICAO;
				  POSICAO = POSICAO - 1;
			   }
			DIGITO[10] = SOMA % 11;
			if (DIGITO[10] < 2) {
					DIGITO[10] = 0;
			}
			else {
					DIGITO[10] = 11 - DIGITO[10];
			}
			
			// Verifica se os valores dos dígitos verificadores conferem
			DV = DIGITO[9] * 10 + DIGITO[10];
			if (DV != DV_INFORMADO) {
				  return false;
			} 
		}
		
		return true;
   }
   
   
// =============================================================================================
// Rotina    : Limpar campos do formulário de matrícula
//
// Autor     : Marcelo Sanches - 15/07/02
//
// Parametros: Nenhum parâmetro
// =============================================================================================
   function LimpaCamposFormMatricula(){
			// Define formuário de matricula
			var objFormMatricula = window.document.frm_Matricula;
   
			objFormMatricula.chrNome.value = "";
			SelecionaCombobox(objFormMatricula.intIdEstadoCivil, "");
			SelecionaCombobox(objFormMatricula.chrIdSexo, "");
			objFormMatricula.datNascimento.value = "";
			objFormMatricula.chrNomePai.value = "";
			objFormMatricula.chrNomeMae.value = "";
			SelecionaCombobox(objFormMatricula.intUfNaturalidade, "");
			SelecionaCombobox(objFormMatricula.intIdNaturalidade, "");
			objFormMatricula.chrNacionalidade.value = "";
			SelecionaCombobox(objFormMatricula.intIdEscolaridade, "");
			SelecionaCombobox(objFormMatricula.intIdProfissao, "");
			SelecionaCombobox(objFormMatricula.intIdSituacao, "");
			SelecionaCombobox(objFormMatricula.intIdRaca, "");
			SelecionaCombobox(objFormMatricula.intIdDeficiencia, "");
			objFormMatricula.intRGTipo.value = "0";
			objFormMatricula.chrRG.value = "";
			objFormMatricula.datRGEmissao.value = "";
			objFormMatricula.chrRGOrgaoEmissor.value = "";
			//objFormMatricula.chrCpf.value = "";
			//objFormMatricula.chrCpfNome.value = "";
			objFormMatricula.chrEndereco.value = "";
			objFormMatricula.chrComplemento.value = "";
			objFormMatricula.chrNumero.value = "";
			objFormMatricula.chrBairro.value = "";
			objFormMatricula.chrCep.value = "";
			SelecionaCombobox(objFormMatricula.intUfMunicipio, "");
			SelecionaCombobox(objFormMatricula.intIdMunicipio, "");
			//objFormMatricula.intIdRegiao.value = "";
			objFormMatricula.chrDDDTelefone01.value = "";
			objFormMatricula.chrTelefone01.value = "";
			objFormMatricula.chrTelefone02.value = "";
			objFormMatricula.chrDDDCelular.value = "";
			objFormMatricula.chrCelular.value = "";
			objFormMatricula.chrContato.value = "";
			objFormMatricula.chrEmail.value = "";
			objFormMatricula.chrEmpresa.value = "";
			objFormMatricula.chrEnderecoEmp.value = "";
			objFormMatricula.chrComplementoEmp.value = "";
			objFormMatricula.chrNumeroEmp.value = "";
			objFormMatricula.chrBairroEmp.value = "";
			SelecionaCombobox(objFormMatricula.intUfMunicipioEmp, "");
			SelecionaCombobox(objFormMatricula.intIdMunicipioEmp, "");
			objFormMatricula.chrCepEmp.value = "";
			objFormMatricula.chrDDDTelefoneEmp.value = "";
			objFormMatricula.chrTelefoneEmp.value = "";
			objFormMatricula.chrRamalEmp.value = "";  
			
			var objDadosAluno = window.document.getElementById("objDadosAluno");		      
			objDadosAluno.style.display = "none";			 
   }
   
   
   // =============================================================================================
// Rotina    : Incica o curso selecionado
//
// Autor     : Marcelo Sanches - 15/07/02
//
// Parametros: Nenhum parâmetro
// =============================================================================================
   function IndicaLivro()
   {
   // Define variáveis
   // ----------------
      var objfrmIndicaLivro;

   // Define formuário de newsletter
   // ------------------------------
      objfrmIndicaLivro = window.document.frmIndicaLivro;

   // Valida campo nome
   // -----------------
      if(objfrmIndicaLivro.txtNome.value == "") {
        alert("Informe o nome do seu amigo.");
        objfrmIndicaLivro.txtNome.focus();
        return false;
      }

   // Valida campo de e-mail
   // ----------------------
      if(!ValidaEmail(objfrmIndicaLivro.txtEmail.value)) {
        alert("Informe um e-mail válido.");
        objfrmIndicaLivro.txtEmail.focus();
        return false;
      }

   // Constroi a querystring
   // ----------------------
      strPagina = "../../indica.asp?Tipo=Livro";
      strPagina = strPagina + "&IdLivro=" + objfrmIndicaLivro.txtIdLivro.value;	  
      strPagina = strPagina + "&txtNome=" + objfrmIndicaLivro.txtNome.value;
      strPagina = strPagina + "&txtEmail=" + objfrmIndicaLivro.txtEmail.value;

   // Chama página de incicação de curso
   // ----------------------------------
      WindowPopup(strPagina, "brw_IndicaLivro", 0, 0, 500, 300)

   // Limpa campos do formulário
   // --------------------------
      objfrmIndicaLivro.txtNome.value = "";
      objfrmIndicaLivro.txtEmail.value= "";
  }
  


// =============================================================================================
// Rotina    : Incica o livro selecionado
//
// Autor     : Marcelo Sanches - 21/03/06
//
// Parametros: Nenhum parâmetro
// =============================================================================================
   function EnviaEmailLivro()
   {
   // Define variáveis
   // ----------------
      var objFrmEmailLivro;

   // Define formuário de newsletter
   // ------------------------------
      objFrmEmailLivro = window.document.frmEnviaLivro;

   // Valida campo nome
   // -----------------
      if(objFrmEmailLivro.txtNome.value == "") {
        alert("Informe o nome para contato.");
        objFrmEmailLivro.txtNome.focus();
        return false;
      }

   // Valida campo de e-mail
   // ----------------------
      if(!ValidaEmail(objFrmEmailLivro.txtEmail.value)) {
        alert("Informe um e-mail válido.");
        objFrmEmailLivro.txtEmail.focus();
        return false;
      }

   // Valida campo Fone
   // ---------------------
      if(objFrmEmailLivro.txtFone.value == "") {
        alert("Informe o Telefone.");
        objFrmEmailLivro.txtFone.focus();
        return false;
      }	  

   // Valida campo mensagem
   // ---------------------
      if(objFrmEmailLivro.txtMensagem.value == "") {
        alert("Informe a mensagem.");
        objFrmEmailLivro.txtMensagem.focus();
        return false;
      }	  

   // Constroi a querystring
   // ----------------------
      strPagina = "../../livroemail.asp?Destino=" + objFrmEmailLivro.txtDestino.value;
	  strPagina = strPagina + "&Livro=" + objFrmEmailLivro.txtLivro.value;
      strPagina = strPagina + "&Nome=" + objFrmEmailLivro.txtNome.value;
      strPagina = strPagina + "&Email=" + objFrmEmailLivro.txtEmail.value;
	  strPagina = strPagina + "&Fone=" + objFrmEmailLivro.txtFone.value;
      strPagina = strPagina + "&Mensagem=" + objFrmEmailLivro.txtMensagem.value;	  	  

   // Chama página de incicação de curso
   // ----------------------------------
      WindowPopup(strPagina, "brw_EnviaEmail", 0, 0, 500, 300)

   // Limpa campos do formulário
   // --------------------------
      objFrmEmailLivro.txtNome.value = "";
      objFrmEmailLivro.txtEmail.value= "";
	  objFrmEmailLivro.txtFone.value= "";

      objFrmEmailLivro.txtMensagem.value= "";	  
  }

	function IniciarMatriculaonline(str_Pagina) 
	{
		var obj_WinSistema;
		var int_WinPow;
		var int_WinPoh;
		var int_WinPox;
		var int_WinPoy;
		
		int_WinPow = window.screen.width;
		int_WinPoh = window.screen.height;
			
		int_WinPox = (window.screen.width  - int_WinPow) / 2;
		int_WinPoy = (window.screen.height - int_WinPoh) / 2;
		
		obj_WinSistema = window.open(str_Pagina, "brw_MatriculaOnline", "Toolbar=No,location=No,directories=No,status=Yes,menubar=No,scrollbars=Yes,resizable=Yes,width=" + int_WinPow + ",height=" + int_WinPoh);
		obj_WinSistema.focus();
	}