<!--
/**
 *
 */
function validarLoginSenha(form) 
{
   var login = form.email_login;
   var senha = form.senha;


   if (login.value == "(e-mail)" && senha.value == ""){
	   alert('Login e Senha sao de preenchimentos Obrigatorios.');
	   login.focus();
	   return false;
		   
   }
   else{
	   if (login.value == "" && senha.value != ""){
		   alert('Login e de preenchimento Obrigatorio.');
		   login.focus();
		   return false;
	   }
	   else{
		   if (login.value != "" && senha.value == ""){
			   alert('Senha e de preenchimento Obrigatorio.');
			   senha.focus();
			   return false;
		   }
	   }
   }
}


function validarLogin(form) 
{
   var login = form.login;
   var senha = form.senha;

   if (login.value == "")
   {   alert('Login é de preenchimento Obrigatório.');
	   login.focus();
	   return false;
   }
   if (senha.value == "")
   {   alert('Senha é de preenchimento Obrigatório.');
	   senha.focus();
	   return false;
   }
}

/**
 *
 */
function validaEvento(form) 
{
   var action   = form.action;
   var foto_pt  = document.getElementById("foto_pt");
   var foto_en  = document.getElementById("foto_en");
   var nomePT   = document.getElementById("nome_PT");
   var complPT  = document.getElementById("compl_PT");
   var localPT  = document.getElementById("local_PT");
   var nomeEN   = document.getElementById("nome_EN");
   var complEN  = document.getElementById("compl_EN");
   var localEN  = document.getElementById("local_EN");
   var cidade   = document.getElementById("cidade");
   var estado   = document.getElementById("estado");
   var pais     = document.getElementById("dt_ini");
   var dt_ini   = document.getElementById("dt_ini");
   var dt_fim   = document.getElementById("dt_fim");
   var endereco = document.getElementById("endereco");
   var dditel   = document.getElementById("ddiTelefone");
   var dddtel   = document.getElementById("dddTelefone");
   var numtel   = document.getElementById("numTelefone");
   var ddifax   = document.getElementById("ddiFax");
   var dddfax   = document.getElementById("dddFax");
   var numfax   = document.getElementById("numFax");
   var max_part = document.getElementById("numMaxPartic");
   var senha    = document.getElementById("senha");
   var nome_cont  = document.getElementById("nome_cont");
   var email_cont = document.getElementById("email_cont");
   var cargo_cont = document.getElementById("cargo_cont");
   var cliente = document.getElementById("cliente");
   var job = document.getElementById("job");
   var telefone_cont = document.getElementById("telefone_cont");
   var tipo = /^[\w-]+(\.[\w-]+)*@(([\w-]{2,63}\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/;

   if (cliente.value == "" || cliente.length > 0)
   {   alert("Campo Cliente é de preenchimeno Obrigatório");
       cliente.focus();
	   return false;
   }
   if (job.value == "" || job.length > 0)
   {   alert("Campo Job é de preenchimeno Obrigatório");
       job.focus();
	   return false;
   }
   // Critica de fotos
   /*if (action.value == "inserir") {    
	   if (foto_pt.value == "") {
	       alert("Foto Português é de seleção Obrigatória.");    
  		   foto_pt.focus();
		   return false;
	   }
	   else
       if(foto_pt.value.search("\[a-zA-Z0-9].*\.[jpg|jpeg|gif|pjpeg]$") == -1) {
  	      alert("Foto Português inválida");    
	  	  foto_pt.focus();
		  return false;
       }

	   if (foto_en.value == "") {
	       alert("Foto Inglês é de seleção Obrigatória.");    
  		   foto_en.focus();
		   return false;
	   }
	   else
       if(foto_en.value.search("\[a-zA-Z0-9].*\.[jpg|jpeg|gif|pjpeg]$") == -1) {
  	      alert("Foto Inglês inválida");    
	  	  foto_en.focus();
		  return false;
       }
   }
   else {
	   if (foto_pt.value != "") {
	       if(foto_pt.value.search("\[a-zA-Z0-9].*\.[jpg|jpeg|gif|pjpeg]$") == -1) {
  		      alert("Foto Português inválida");    
		  	  foto_pt.focus();
			  return false;
	       }
	   }

	   if (foto_en.value != "") {
	       if(foto_en.value.search("\[a-zA-Z0-9].*\.[jpg|jpeg|gif|pjpeg]$") == -1) {
  		      alert("Foto Inglês inválida");    
		  	  foto_en.focus();
			  return false;
	       }
	   }
   }*/

   if (dt_ini.value == "")
   {   alert('Data de Início é de preenchimento Obrigatório.');
	   dt_ini.focus();
	   return false;
   }
   else
   if (!isNaN(dt_ini.value)){
       alert('Data de Início deve conter apenas números.');
	   dt_ini.focus();
	   return false;
   }	
   else
   {   hoje = new Date();
	   anoAtual = 2500;
	   barras = dt_ini.value.split("/");

	   if (barras.length == 3)
	   {   dia = barras[0];
    	   mes = barras[1];
	       ano = barras[2];
		   resultado = (!isNaN(dia) && (dia > 0) && (dia < 32)) && 
					   (!isNaN(mes) && (mes > 0) && (mes < 13)) && 
					   (!isNaN(ano) && (ano.length == 4) && (ano <= anoAtual && ano >= 1900));
	       if (!resultado) 
		   {  alert('Data de Início inválida.');
			  dt_ini.focus();
			  return false;
    	   }
	   }
	   else 
	   {   alert('Data de Início inválida.');
		   dt_ini.focus();
		   return false;
	   }
   }

   if (dt_fim.value == "" || dt_fim.value.length < 10)
   {   alert('Data de Termíno é de preenchimento Obrigatório.');
	   dt_fim.focus();
	   return false;
   }
   else
   if (!isNaN(dt_fim.value)){
       alert('Data de Termíno deve conter apenas números.');
	   dt_fim.focus();
	   return false;
   }	
   else
   {   hoje = new Date();
	   anoAtual = 2500;
	   barras = dt_fim.value.split("/");

	   if (barras.length == 3)
	   {   dia = barras[0];
    	   mes = barras[1];
	       ano = barras[2];
		   resultado = (!isNaN(dia) && (dia > 0) && (dia < 32)) && 
					   (!isNaN(mes) && (mes > 0) && (mes < 13)) && 
					   (!isNaN(ano) && (ano.length == 4) && (ano <= anoAtual && ano >= 1900));
	       if (!resultado) 
		   {  alert('Data de Termíno inválida.');
			  dt_fim.focus();
			  return false;
    	   }
	   }
	   else 
	   {   alert('Data de Termíno inválida.');
		   dt_fim.focus();
		   return false;
	   }
   }
   
   var arrIni = dt_ini.value.split("/");
   var arrFim = dt_fim.value.split("/");
   var dt1 = new Date( arrIni[2], arrIni[1], arrIni[0]);
   var dt2 = new Date( arrFim[2], arrFim[1], arrFim[0]);
   
   if ( dt2 < dt1 )
   {   alert("Data de Termíno do evento não pode ser MENOR que a Data de Início.");
       dt_fim.focus();
	   return false;
   } 
   if (max_part.value == "" || max_part.length > 0)
   {   alert("Campo Número máximo de Participantes é de preenchimeno Obrigatório");
       max_part.focus();
	   return false;
   } 
   if (senha.value == "" || senha.length > 0)
   {   alert("Campo Senha é de preenchimeno Obrigatório");
       senha.focus();
	   return false;
   } 
   if (endereco.value == "" || endereco.length > 0)
   {   alert("Campo Endereço é de preenchimeno Obrigatório");
       endereco.focus();
	   return false;
   } 
   if (cidade.value == "" || cidade.length > 0)
   {   alert("Campo Cidade é de preenchimeno Obrigatório");
       cidade.focus();
	   return false;
   } 
   if (estado.value == "" || estado.length > 0)
   {   alert("Campo Estado é de preenchimeno Obrigatório");
       estado.focus();
	   return false;
   } 
   if (pais.value == "" || pais.length > 0)
   {   alert("Campo Pais é de preenchimeno Obrigatório");
       pais.focus();
	   return false;
   } 

   if (dditel.value == "" || dditel.length > 0)
   {   alert("Campo DDI do Telefone é de preenchimeno Obrigatório");
       dditel.focus();
	   return false;
   } 
   if (dddtel.value == "" || dddtel.length > 0)
   {   alert("Campo DDD do Telefone é de preenchimeno Obrigatório");
       dddtel.focus();
	   return false;
   } 
   if (numtel.value == "" || numtel.length > 0)
   {   alert("Campo Número do Telefone é de preenchimeno Obrigatório");
       numtel.focus();
	   return false;
   } 

   if (ddifax.value != "") {
	   if (dddfax.value == "") {
		   alert("Campo DDD do Fax é de preenchimeno Obrigatório");
		   dddfax.focus();
	   	   return false;	   
	   }
	   if (numfax.value == "") {
		   alert("Campo Número do Fax é de preenchimeno Obrigatório");
		   numfax.focus();
	   	   return false;	   
	   }
   }
   if (dddfax.value != "") {
	   if (ddifax.value == "") {
		   alert("Campo DDI do Fax é de preenchimeno Obrigatório");
		   ddifax.focus();
	   	   return false;	   
	   }
	   if (numfax.value == "") {
		   alert("Campo Número do Fax é de preenchimeno Obrigatório");
		   numfax.focus();
	   	   return false;	   
	   }
   }
   if (numfax.value != "") {
	   if (ddifax.value == "") {
		   alert("Campo DDI do Fax é de preenchimeno Obrigatório");
		   ddifax.focus();
	   	   return false;	   
	   }
	   if (dddfax.value == "") {
		   alert("Campo DDD do Telefone é de preenchimeno Obrigatório");
		   dddfax.focus();
	   	   return false;	   
	   }
   }

   if (nome_cont.value == "")
   {   alert('Nome do Contato é de preenchimento Obrigatório.');
	   nome_cont.focus();
	   return false;
   }
   if (email_cont.value == "")
   {   alert('E-mail do Contato é de preenchimento Obrigatório.');
	   email_cont.focus();
	   return false;
   }
   else 
   if (!tipo.test(email_cont.value)) {
       alert("E-mail do Contato inválido.")
       email_cont.focus();
       return false;
   } 
   if (cargo_cont.value == "")
   {   alert('Cargo do Contato é de preenchimento Obrigatório.');
	   cargo_cont.focus();
	   return false;
   }
   if (telefone_cont.value == "")
   {   alert('Telefone do Contato é de preenchimento Obrigatório.');
	   telefone_cont.focus();
	   return false;
   }

   if (nomePT.value == "" || nomePT.length > 0)
   {   alert("Campo Nome Principal em Português é de preenchimeno Obrigatório");
       nomePT.focus();
	   return false;
   }
   if (complPT.value == "" || complPT.length > 0)
   {   alert("Campo Complemento Nome em Português é de preenchimeno Obrigatório");
       complPT.focus();
	   return false;
   }
   if (localPT.value == "" || localPT.length > 0)
   {   alert("Campo Local em Português é de preenchimeno Obrigatório");
       localPT.focus();
	   return false;
   } 

   /*if (nomeEN.value == "" || nomeEN.length > 0)
   {   alert("Campo Nome Principal em Inglês é de preenchimeno Obrigatório");
       nomeEN.focus();
	   return false;
   }
   if (complEN.value == "" || complEN.length > 0)
   {   alert("Campo Complemento Nome em Inglês é de preenchimeno Obrigatório");
       complEN.focus();
	   return false;
   }
   if (localEN.value == "" || localEN.length > 0)
   {   alert("Campo Local em Inglês é de preenchimeno Obrigatório");
       localEN.focus();
	   return false;
   }*/
}

/**
 *
 */
function validaPalestrante(form) 
{
   var nome = form.nome;
   var cargo = form.cargo;
   var empresa = form.empresa;
   var curriculo = form.curriculo;
   var foto = form.foto;

   if (nome.value == "" || nome.length > 0)
   {   alert("Campo Nome é de preenchimeno Obrigatório");
       nome.focus();
	   return false;
   } 
   if (cargo.value == "" || cargo.length > 0)
   {   alert("Campo Cargo é de preenchimeno Obrigatório");
       codigo.focus();
	   return false;
   } 
   if (empresa.value == "" || empresa.length > 0)
   {   alert("Campo Empresa é de preenchimeno Obrigatório");
       empresa.focus();
	   return false;
   } 
   if (foto.value != "") {    
       if(foto.value.search("\[a-zA-Z0-9].*\.[jpg|jpeg|gif|pjpeg]$") == -1) {
  	      alert("Foto inválida");    
	  	  foto.focus();
		  return false;
       }
   }
}

/**
 *
 */
function validaPatrocinador(form) 
{
   var nome = form.nome;
   var site = form.site;
   var foto = form.foto;
   var action = form.action;

   if (nome.value == "" || nome.length > 0)
   {   alert("Campo Nome é de preenchimeno Obrigatório");
       nome.focus();
	   return false;
   } 

   /*if (action.value != "alterar") {    
	   if (foto.value == "") {
	       alert("Foto é de seleção Obrigatória.");    
  		   foto.focus();
		   return false;
	   }
	   else
       if(foto.value.search("\[a-zA-Z0-9].*\.[jpg|jpeg|gif|pjpeg]$") == -1) {
  	      alert("Foto inválida");    
	  	  foto.focus();
		  return false;
       }
   }
   else {
	   if (foto.value != "") {
	       if(foto.value.search("\[a-zA-Z0-9].*\.[jpg|jpeg|gif|pjpeg]$") == -1) {
  		      alert("Foto inválida");    
		  	  foto.focus();
			  return false;
	       }
	   }
   }*/
}

/**
 *
 */
function validarFormNovaCategoria(form) {

   var titulo_pt = document.getElementById("nome_pt");
   var titulo_en = document.getElementById("nome_en");

   if (titulo_pt.value == "")
   {   alert('Campo Nome Categoria Português é de preenchimento Obrigatório.');
	   titulo_pt.focus();
	   return false;
   }
   if (titulo_en.value == "")
   {   alert('Campo Nome Categoria Inglês é de preenchimento Obrigatório.');
	   titulo_en.focus();
	   return false;
   }
}

/**
 *
 */
function validarFormEditaCategoria(form) {
function validarFormEditaCategoria(form) {

   var patrocinio = document.getElementById("patrocinio");
   // Pega os dados dentro do campo patrocinio e os deixa selecionados
   		form.patrocinio.multiple=true;
		form.patrocinio.focus();

	    for(var i=0; i<form.patrocinio.length; i++) 
		{   form.patrocinio[i].selected=true;
	    }
   // Valida se os campos estão vazios e faz a validação		
   if (document.editCategoria.titulo_materia.value == "")
   {
      alert("Por favor Campo Titulo matéria e de preenchimento Obrigatório!");
      document.editCategoria.titulo_materia.focus()
      return false
   }
   if (document.editCategoria.autor.value == "")
   {
      alert("Por favor Campo Autor e de preenchimento Obrigatório!")
      document.editCategoria.autor.focus()
      return false
   }
   if (document.editCategoria.dt_veiculacao.value == "")
   {
      alert("Por favor Campo Data_veiculacao e de preenchimento Obrigatório!")
      document.editCategoria.dt_veiculacao.focus()
      return false
   }
   if (document.editCategoria.veiculo.value == "")
   {
      alert("Por favor Campo Veículo e de preenchimento Obrigatório!")
      document.editCategoria.veiculo.focus()
      return false
   }
   if (document.editCategoria.resumo.value == "")
   {
      alert("Por favor Campo Resumo e de preenchimento Obrigatório!")
      document.editCategoria.resumo.focus()
      return false
   }
   if (document.editCategoria.patrocinios.value == "")
   {
      alert("Por favor Campo Cliente e de preenchimento Obrigatório!")
      document.editCategoria.patrocinios.focus()
      return false
   }
   return true
}

/**
 *
 */
function validaFormGradeEvento(form) {

   var data = form.data;

   if (data.value == "" || data.value.length < 10)
   {   alert('Data é de preenchimento Obrigatório.');
	   data.focus();
	   return false;
   }
   else
   if (!isNaN(data.value)){
       alert('Data deve conter apenas números.');
	   data.focus();
	   return false;
   }	
   else
   {   hoje = new Date();
	   anoAtual = hoje.getFullYear();
	   barras = data.value.split("/");

	   if (barras.length == 3)
	   {   dia = barras[0];
    	   mes = barras[1];
	       ano = barras[2];
		   resultado = (!isNaN(dia) && (dia > 0) && (dia < 32)) && 
					   (!isNaN(mes) && (mes > 0) && (mes < 13)) && 
					   (!isNaN(ano) && (ano.length == 4) && (ano <= anoAtual && ano >= 1900));
	       if (!resultado) 
		   {  alert('Data inválida.');
			  data.focus();
			  return false;
    	   }
	   }
	   else 
	   {   alert('Data inválida.');
		   data.focus();
		   return false;
	   }
   }
}

/**
 *
 */
function validarFoto(form)
{
	var msg       = 'Por favor corrija o(s) seguinte(s) erro(s):\n\n';
	var titulo_pt = form.titulo_pt;
	var titulo_en = form.titulo_en;
	var data      = form.data;
	var foto      = form.foto;
	var action    = form.action;
	
	if (titulo_pt.value == "" || titulo_pt.value.length < 2)
	{   msg = msg +'Título Português é de preenchimento Obrigatório.\n';
	}
	if (titulo_en.value == "" || titulo_en.value.length < 2)
	{   msg = msg +'Título Inglês é de preenchimento Obrigatório.\n';
	}
	if (data.value == "" || data.value.length < 2)
	{   msg = msg +'Data é de preenchimento Obrigatório.\n';
	}
	else
    if (!isNaN(data.value)){
        msg = msg +'Data de Veiculação deve conter apenas numeros.\n';
    }	
	else
	{   hoje = new Date();
	    anoAtual = hoje.getFullYear();
	    barras = data.value.split("/");

		if (barras.length == 3)
		{   dia = barras[0];
    	    mes = barras[1];
	        ano = barras[2];
		    resultado = (!isNaN(dia) && (dia > 0) && (dia < 32)) && 
						(!isNaN(mes) && (mes > 0) && (mes < 13)) && 
						(!isNaN(ano) && (ano.length == 4) && (ano <= anoAtual && ano >= 1900));
	        if (!resultado) 
			{  msg = msg +'Data de Veiculação inválida.\n';
    	    }
	    }
		else 
		{   msg = msg +'Data de Veiculação inválida.\n';
	    }
	}
    if (action.value != "alterar") {
		if (foto.value == "") {
			msg = msg +'Foto é de preenchimento Obrigatório.\n';
	    }
	}
	if (foto.value != "") {
	    if(foto.value.toLowerCase().search("\[a-zA-Z0-9].*\.[jpg|jpeg|gif|pjpeg]$") == -1) {
  		   alert("Foto inválida");    
	  	   foto.focus();
		   return false;
    	}
	}
	
    if (msg != 'Por favor corrija o(s) seguinte(s) erro(s):\n\n')
    {   alert(msg);
		return false;
	}	
}

/**
 *
 */
function validarPalestraEvento(form)
{
	var msg    = 'Por favor corrija o(s) seguinte(s) erro(s):\n\n';
	var titulo_pt = document.getElementById("titulo_pt");
	var titulo_en = document.getElementById("titulo_en");
	var cargo_pt  = document.getElementById("cargo_pt");
	var cargo_en  = document.getElementById("cargo_en");
	var pales_pt  = document.getElementById("cargo_pt");
	var pales_en  = document.getElementById("cargo_en");
	var empresa = form.empresa;
	var pdf     = form.pdf;
	var action  = form.action;
	
	if (titulo_pt.value == "" || titulo_pt.value.length < 2)
	{   msg = msg +'Título Português é de preenchimento Obrigatório.\n';
	}
	if (titulo_en.value == "" || titulo_en.value.length < 2)
	{   msg = msg +'Título Inglês é de preenchimento Obrigatório.\n';
	}

	if (pales_pt.value == "" || pales_pt.value.length < 2)
	{   msg = msg +'Nome do Palestrante Português é de preenchimento Obrigatório.\n';
	}
	if (pales_en.value == "" || pales_en.value.length < 2)
	{   msg = msg +'Nome do Palestrante Inglês é de preenchimento Obrigatório.\n';
	}

	if (cargo_pt.value == "" || cargo_pt.value.length < 2)
	{   msg = msg +'Cargo Português é de preenchimento Obrigatório.\n';
	}
	if (cargo_en.value == "" || cargo_en.value.length < 2)
	{   msg = msg +'Cargo Inglês é de preenchimento Obrigatório.\n';
	}

	if (empresa.value == "" || empresa.value.length < 2)
	{   msg = msg +'Empresa é de preenchimento Obrigatório.\n';
	}
    if (action.value != "alterar") {
		if (pdf.value == "") {
			msg = msg +'PDF é de preenchimento Obrigatório.\n';
	    }
	}
	if (pdf.value != "")
    {   if (pdf.value.toLowerCase().search("\[A-Za-z1-9]*pdf$\|ppt$") == -1) {
		     msg = msg +'Pdf inválido\n';
	   	}	
	}
	
    if (msg != 'Por favor corrija o(s) seguinte(s) erro(s):\n\n')
    {   alert(msg);
		return false;
	}	
}

/**
 *
 */
function validarDestaqueHome(form) 
{
   var action  = form.action;
   var titulo_pt = document.getElementById("titulo_pt");
   var titulo_en = document.getElementById("titulo_en");
   var idioma    = form.idioma;
   var url 		 = form.url;
   var secao 	 = form.secao;
   var foto 	 = form.foto;

   if (titulo_pt.value == "")
   {   alert('Título em Português é de preenchimento Obrigatório.');
	   titulo_pt.focus();
	   return false;
   }
   if (titulo_en.value == "")
   {   alert('Título em Inglês é de preenchimento Obrigatório.');
	   titulo_en.focus();
	   return false;
   }
   if (idioma.value == "0")
   {   alert('Lingua é de seleção Obrigatória.');
	   idioma.focus();
	   return false;
   }
   if (url.value == "" && secao.value == "0")
   {   alert('É de preenchimento obrigatório pelo um dos campos (Link, Seção).');
	   url.focus();
	   return false;
   }

    if (action.value != "alterar") {
		if (foto.value == "") {
			alert('Foto é de preenchimento Obrigatório.');
	  	    foto.focus();
		    return false;
	    }
	}
	if (foto.value != "") {
	    if(foto.value.toLowerCase().search("\[a-zA-Z0-9].*\.[jpg|jpeg|gif]$") == -1) {
  		   alert("Foto inválida");    
	  	   foto.focus();
		   return false;
    	}
	}
}


function isCPF(s) {

  if (s == "00000000000" || s == "11111111111" || 
	  s == "22222222222" || s == "33333333333" ||
	  s == "44444444444" || s == "55555555555" || 
	  s == "66666666666" || s == "77777777777" || 
	  s == "88888888888" || s == "99999999999")
      return false;  

  var c = s.substr(0,9);
  var dv = s.substr(9,2);
  var d1 = 0;

  for (var i=0; i<9; i++) {
 	   d1 += c.charAt(i)*(10-i);
  }

  if (d1 == 0) {
	  return false;
  }

  d1 = 11 - (d1 % 11);
  if (d1 > 9) d1 = 0;

  if (dv.charAt(0) != d1){
	  return false;
  }

  d1 *= 2;
  for (var i=0; i<9; i++) {
       d1 += c.charAt(i)*(11-i);
  }

  d1 = 11 - (d1 % 11);
  if (d1 > 9) d1 = 0;

  if (dv.charAt(1) != d1){
	  return false;
  }
  return true;
}

// Verifica se o CNPJ é válido

function isCNPJ(s) {

	var i;
    var c = s.substr(0,12);
    var dv = s.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 isCreditCard(st) {
  if (st.length > 19)
      return (false);

  sum = 0; mul = 1; l = st.length;
  for (i = 0; i < l; i++) {
    digit = st.substring(l-i-1,l-i);
    tproduct = parseInt(digit ,10)*mul;
    if (tproduct >= 10)
      sum += (tproduct % 10) + 1;
    else
      sum += tproduct;
    if (mul == 1)
      mul++;
    else
      mul--;
  }
  if ((sum % 10) == 0)
    return (true);
  else
    return (false);
}

function validarInscricao(form) {

	var nome = form.nome;
	var cpf_cnpj = form.cpf_cnpj;
	var tipo_pessoa = form.tipo_pessoa;

	var rz_social = form.razao_social;
//	var inscricao_estadual = form.insc_est;
	var ramo_atv = form.ramo_atv;

	var nm_cracha = form.nome_cracha;
	var cargo = form.cargo;
	var identidade = form.identidade;
	var endereco = form.endereco;
	var cidade = form.cidade;
	var cep = form.cep;
	var estado = form.estado;

	var ddd_telefone = form.ddd_telefone;
	var telefone = form.telefone;
	var ddd_fax = form.ddd_fax;
	var fax = form.fax;
	var email = form.email;
	var tipo = /^[\w-]+(\.[\w-]+)*@(([\w-]{2,63}\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/;

	var pagamento = form.pagamento; 
	// pagamento -- DEP
	var banco = form.banco;
	// pagamento -- CAR
	var bandeira = form.bandeira;
	var CC_nome = form.CC_nome;
	var CC_numero = form.CC_numero;
	var CC_cod = form.CC_cod;
	var CC_validade_mes = form.CC_validade_mes;
	var CC_validade_ano = form.CC_validade_ano;
	// pagamento -- COR
	var desc_cor = form.desc_cor;


    if (nome.value == "" || nome.value == " ")
    {   alert('Campo Nome é de preenchimento obrigatório.');
	    nome.focus();
	    return false;
    }
    if (cpf_cnpj.value == "")
    {   alert('Campo CPF/CNPJ é de preenchimento obrigatório.');
	    cpf_cnpj.focus();
	    return false;
    }

		if (tipo_pessoa.value == "PJ") {
	    if (cpf_cnpj.value.length < 14) {
			alert('Campo CNPJ é deve possuir 14 dígitos.');
		    cpf_cnpj.focus();
		    return false;
		}
		if (isCNPJ(cpf_cnpj.value) == '') {
			alert('Campo CNPJ inválido.');
		    cpf_cnpj.focus();
		    return false;
		}
    }
	else {
	    if (cpf_cnpj.value.length < 11) {
			alert('Campo CPF é deve possuir 11 dígitos.');
		    cpf_cnpj.focus();
		    return false;
		}
		if (isCPF(cpf_cnpj.value) == '') {
			alert('Campo CPF inválido.');
		    cpf_cnpj.focus();
		    return false;
		}
	}

    if (tipo_pessoa.value == "PJ") {
	    if (rz_social.value == "" || rz_social.value == " ")
	    {   alert('Campo Razão Social é de preenchimento obrigatório.');
	   	    rz_social.focus();
		    return false;
        }
	    if (ramo_atv.value == "" || ramo_atv.value == " ")
	    {   alert('Campo Ramo de Atividade é de preenchimento obrigatório.');
	   	    ramo_atv.focus();
		    return false;
        }
	}

    if (nm_cracha.value == "" || nm_cracha.value == " ")
    {   alert('Campo Nome para Crachá é de preenchimento obrigatório.');
	    nm_cracha.focus();
	    return false;
    }
    if (cargo.value == "" || cargo.value == " ")
    {   alert('Campo Cargo é de preenchimento obrigatório.');
	    cargo.focus();
	    return false;
    }
    if (identidade.value == "")
    {   alert('Campo RG é de preenchimento obrigatório.');
	    identidade.focus();
	    return false;
    }
    if (endereco.value == "" || endereco.value == " ")
    {   alert('Campo Endereço é de preenchimento obrigatório.');
	    endereco.focus();
	    return false;
    }
    if (cidade.value == "" || cidade.value == " ")
    {   alert('Campo Cidade é de preenchimento obrigatório.');
	    cidade.focus();
	    return false;
    }
    if (cep.value == "" || cep.value == " ")
    {   alert('Campo CEP é de preenchimento obrigatório.');
	    cep.focus();
	    return false;
    }
	else 
    if (cep.value.length < 8)
    {   alert('Campo CEP deve possuir 9 digítos.');
	    cep.focus();
	    return false;
    }
    if (estado.value == "" || estado.value == " ")
    {   alert('Campo Estado é de preenchimento obrigatório.');
	    estado.focus();
	    return false;
    }
    if (ddd_telefone.value == "")
    {   alert('Campo DDD do Telefone é de preenchimento obrigatório.');
	    ddd_telefone.focus();
	    return false;
    }
    if (telefone.value == "")
    {   alert('Campo Número Telefone é de preenchimento obrigatório.');
	    telefone.focus();
	    return false;
    }
    if (ddd_fax.value == "" && fax.value != "") {
		alert('Campo DDD do Fax é de preenchimento obrigatório.');
	    ddd_fax.focus();
	    return false;
	}
    if (ddd_fax.value != "" && fax.value == "") {
		alert('Campo Número Fax é de preenchimento obrigatório.');
	    ddd_fax.focus();
	    return false;
	}
    if (email.value == "")  {
		alert('Campo E-mail é de preenchimento obrigatório.');
	    email.focus();
	    return false;
	}
	else
	if (!tipo.test(email.value)) {
		alert('E-mail inválido.');
	    email.focus();
	    return false;
	}

    if (pagamento[0].checked == false && 
		pagamento[1].checked == false && 
		pagamento[2].checked == false && 
		pagamento[3].checked == false) {
		alert('Tipo de Pagamento é de seleção Obrigatória.');
    	pagamento[0].focus();
	    return false;
	}

    if (pagamento[0].checked == true) {
	    if (banco.value == "")
    	{   alert('Banco é de seleção obrigatória.');
	    	banco.focus();
		    return false;
	    }
    }
	else
    if (pagamento[2].checked == true) {
	    if (bandeira.value == "")
    	{   alert('Campo Operadora é de seleção obrigatória.');
	    	bandeira.focus();
		    return false;
	    }
	    if (CC_nome.value == "" || CC_nome.value == " ")
    	{   alert('Campo Nome do Titular é de preenchimento obrigatório.');
	    	CC_nome.focus();
		    return false;
	    }
	    if (CC_numero.value == "")
    	{   alert('Campo Número do Cartão é de preenchimento obrigatório.');
	    	CC_nome.focus();
		    return false;
	    }
		else
	    if (!isCreditCard(CC_numero.value)) {
			alert('Número do Cartão inválido.');
	    	CC_numero.focus();
		    return false;
		}
	    if (CC_cod.value == "")
    	{   alert('Campo Código de Segurançao é de preenchimento obrigatório.');
	    	CC_cod.focus();
		    return false;
	    }
	    if (CC_validade_ano.value == "" || CC_validade_mes.value == "")
    	{   alert('Campo Validade do Cartão é de preenchimento obrigatório.');
	    	CC_validade_mes.focus();
		    return false;
	    }
    }
	else
    if (pagamento[3].checked == true) {
	    if (desc_cor.value == "" || desc_cor.value == " ")
    	{   alert('Descreva o Tipo de cortesia que está utilizando.');
	    	desc_cor.focus();
		    return false;
	    }
    }
}

function validarInscricaoING(form) {

	var nome = form.nome;
	var cpf_cnpj = form.cpf_cnpj;
	var tipo_pessoa = form.tipo_pessoa;

	var rz_social = form.razao_social;
//	var inscricao_estadual = form.insc_est;
	var ramo_atv = form.ramo_atv;

	var nm_cracha = form.nome_cracha;
	var cargo = form.cargo;
	var identidade = form.identidade;
	var endereco = form.endereco;
	var cidade = form.cidade;
	var cep = form.cep;
	var estado = form.estado;

	var ddd_telefone = form.ddd_telefone;
	var telefone = form.telefone;
	var ddd_fax = form.ddd_fax;
	var fax = form.fax;
	var email = form.email;
	var tipo = /^[\w-]+(\.[\w-]+)*@(([\w-]{2,63}\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/;

	var pagamento = form.pagamento; 
	// pagamento -- DEP
	var banco = form.banco;
	// pagamento -- CAR
	var bandeira = form.bandeira;
	var CC_nome = form.CC_nome;
	var CC_numero = form.CC_numero;
	var CC_cod = form.CC_cod;
	var CC_validade_mes = form.CC_validade_mes;
	var CC_validade_ano = form.CC_validade_ano;
	// pagamento -- COR
	var desc_cor = form.desc_cor;

    if (nome.value == "" || nome.value == " ")
    {   alert('Field Name/Company required.');
	    nome.focus();
	    return false;
    }
    if (nm_cracha.value == "" || nm_cracha.value == " ")
    {   alert('Field Badge Name required.');
	    nm_cracha.focus();
	    return false;
    }
    if (cargo.value == "" || cargo.value == " ")
    {   alert('Field Position required.');
	    cargo.focus();
	    return false;
    }
    if (endereco.value == "" || endereco.value == " ")
    {   alert('Field Address required.');
	    endereco.focus();
	    return false;
    }
    if (cidade.value == "" || cidade.value == " ")
    {   alert('Field City required.');
	    cidade.focus();
	    return false;
    }
    if (cep.value == "" || cep.value == " ")
    {   alert('Field ZipCode required.');
	    cep.focus();
	    return false;
    }
    if (estado.value == "" || estado.value == " ")
    {   alert('Field State required');
	    estado.focus();
	    return false;
    }
    if (ddd_telefone.value == "")
    {   alert('Field Phone required.');
	    ddd_telefone.focus();
	    return false;
    }
    if (telefone.value == "")
    {   alert('Field Phone required.');
	    telefone.focus();
	    return false;
    }
    if (ddd_fax.value == "" && fax.value != "") {
		alert('Field Fax required.');
	    ddd_fax.focus();
	    return false;
	}
    if (ddd_fax.value != "" && fax.value == "") {
		alert('Field Fax required.');
	    ddd_fax.focus();
	    return false;
	}
    if (email.value == "")  {
		alert('Field E-mail required.');
	    email.focus();
	    return false;
	}
	else
	if (!tipo.test(email.value)) {
		alert('E-mail invalid.');
	    email.focus();
	    return false;
	}

    if (pagamento[0].checked == false && pagamento[1].checked == false) {
		alert('Type of Payment is required.');
    	pagamento[0].focus();
	    return false;
    }

    if (pagamento[0].checked == true) {
	    if (bandeira.value == "")
    	{   alert('Field Operadora required.');
	    	bandeira.focus();
		    return false;
	    }
	    if (CC_nome.value == "" || CC_nome.value == " ")
    	{   alert('Field Card Holder required.');
	    	CC_nome.focus();
		    return false;
	    }
	    if (CC_numero.value == "")
    	{   alert('Field Card Number required.');
	    	CC_nome.focus();
		    return false;
	    }
		else
	    if (!isCreditCard(CC_numero.value)) {
			alert('Card Number invalid.');
	    	CC_numero.focus();
		    return false;
		}
	    if (CC_cod.value == "")
    	{   alert('Field Security Coderequired.');
	    	CC_cod.focus();
		    return false;
	    }
	    if (CC_validade_ano.value == "" || CC_validade_mes.value == "")
    	{   alert('Field Expires Card required.');
	    	CC_validade_mes.focus();
		    return false;
	    }
    }
	else
    if (pagamento[1].checked == true) {
	    if (desc_cor.value == "" || desc_cor.value == " ")
    	{   alert('Field Free required.');
	    	desc_cor.focus();
		    return false;
	    }
    }
}


function validarLocalEvento(form) {
	
  var desc_pt = form.desc_pt;
  var desc_en = form.desc_en;
  var foto 	  = form.foto;

  if (desc_pt.value == "") {
      alert('Campo Descrição do Local em Português é de preenchimento Obrigatório');
      desc_pt.focus();
      return false;
  }
  if (desc_en.value == "") {
      alert('Campo Descrição do Local em Inglês é de preenchimento Obrigatório');
      desc_en.focus();
      return false;
  }
  if (foto.value != "") {
	 if(foto.value.toLowerCase().search("\[a-zA-Z0-9].*\.[jpg|jpeg|gif]$") == -1) {
  	    alert("Foto inválida");    
	    foto.focus();
	    return false;
     }
  }
}

function validarHospedagemEvento(form) {

  var foto1 = document.getElementById("file_foto1");
  var foto2 = document.getElementById("file_foto2");
  var pdf   = document.getElementById("file_pdf");

  if (pdf.value != "") {
      if (pdf.value.toLowerCase().search("\[A-Za-z1-9]*pdf$") == -1) {
	  	  alert("PDF inválido");    
	      pdf.focus();
	      return false;
	  }	
  }

  if (foto1.value != "") {
	 if(foto1.value.toLowerCase().search("\[A-Za-z1-9]*jpg$\|gif$\|jpeg$") == -1) {
  	    alert("Foto1 inválida");    
	    foto1.focus();
	    return false;
     }
  }

  if (foto2.value != "") {
	 if(foto2.value.toLowerCase().search("\[A-Za-z1-9]*jpg$\|gif$\|jpeg$") == -1) {
  	    alert("Foto2 inválida");    
	    foto2.focus();
	    return false;
     }
  }
}
}