function linkFoxQueE()
{
    window.open("/ebssite/indexapp.jsp?centro=fox_quee.jsp&esquerdo=fox.jsp","_self");
}

function linkFoxDiferenciais()
{
    window.open("/ebssite/indexapp.jsp?centro=fox_diferenciais.jsp&esquerdo=fox.jsp","_self");
}
function linkFoxAssistencia()
{
    window.open("/ebssite/indexapp.jsp?centro=fox_assistencia.jsp&esquerdo=fox.jsp","_self");
}
function linkFoxCompras()
{
    window.open("/ebssite/indexapp.jsp?centro=fox_compras.jsp&esquerdo=fox.jsp","_self");
}
function linkFoxEstoque()
{
    window.open("/ebssite/indexapp.jsp?centro=fox_estoque.jsp&esquerdo=fox.jsp","_self");
}
function linkFoxFinancas()
{
    window.open("/ebssite/indexapp.jsp?centro=fox_financas.jsp&esquerdo=fox.jsp","_self");
}
function linkFoxModulos()
{
    window.open("/ebssite/indexapp.jsp?centro=fox_modulos.jsp&esquerdo=fox.jsp","_self");
}
function linkFoxProducao()
{
    window.open("/ebssite/indexapp.jsp?centro=fox_producao.jsp&esquerdo=fox.jsp","_self");
}
function linkFoxVendas()
{
    window.open("/ebssite/indexapp.jsp?centro=fox_vendas.jsp&esquerdo=fox.jsp","_self");
}


function linkProdutosDiferenciais()
{
    window.open("/ebssite/indexapp.jsp?centro=produtos_diferenciais.jsp&esquerdo=produtos.jsp&direito=demonstracao.jsp","_self");
}

function linkProdutosVantagens()
{
    window.open("/ebssite/indexapp.jsp?centro=produtos_vantagens.jsp&esquerdo=produtos.jsp&direito=demonstracao.jsp","_self");
}


function linkCrh()
{
    window.open("/ebssite/indexapp.jsp?centro=produtos_crh.jsp&esquerdo=produtos.jsp&direito=produtos_crh.jsp","_self");
}
function linkCef()
{
    window.open("/ebssite/indexapp.jsp?centro=produtos_cef.jsp&esquerdo=produtos.jsp&direito=produtos_cef.jsp","_self");
}
function linkCsc()
{
    window.open("/ebssite/indexapp.jsp?centro=produtos_csc.jsp&esquerdo=produtos.jsp&direito=produtos_csc.jsp","_self");
}
function linkCcp()
{
    window.open("/ebssite/indexapp.jsp?centro=produtos_ccp.jsp&esquerdo=produtos.jsp&direito=produtos_ccp.jsp","_self");
}
function linkGe()
{
    window.open("/ebssite/indexapp.jsp?centro=produtos_ge.jsp&esquerdo=produtos.jsp&direito=produtos_ge.jsp","_self");
}
function linkCev()
{
    window.open("/ebssite/indexapp.jsp?centro=produtos_cev.jsp&esquerdo=produtos.jsp","_self");
}

function linkDownloadDemo(tipo)
{
   window.open("/ebssite/indexapp.jsp?centro=produtos_download.jsp?tipo="+tipo+"&esquerdo=produtos.jsp","_self");
//   cmd  = "download_demo";
//   window.open("/ebssite/servletEbs?cmd=" + cmd, "_self");
}

function validDownloadDemo()
{
   if(document.frmDownload.txtNome.value=="")
   {
       alert("Por favor, preencha o campo NOME.");
       document.frmDownload.txtNome.focus();
       return(false);
   }
   if(document.frmDownload.txtEmail.value=="")
   {
       alert("Por favor, preencha o campo EMAIL.");
       document.frmDownload.txtEmail.focus();
       return(false);
   }
   if(document.frmDownload.txtCidade.value=="")
   {
       alert("Por favor, preencha o campo CIDADE.");
       document.frmDownload.txtCidade.focus();
       return(false);
   }
   if(document.frmDownload.txtCep.value=="")
   {
       alert("Por favor, preencha o campo CEP.");
       document.frmDownload.txtCep.focus();
       return(false);
   }
   if(document.frmDownload.txtBairro.value=="")
   {
       alert("Por favor, preencha o campo BAIRRO.");
       document.frmDownload.txtBairro.focus();
       return(false);
   }

   if(document.frmDownload.txtDdd.value=="")
   {
       alert("Por favor, preencha o campo TELEFONE.");
       document.frmDownload.txtDdd.focus();
       return(false);
   }
   if(document.frmDownload.txtTelefone.value=="")
   {
       alert("Por favor, preencha o campo TELEFONE.");
       document.frmDownload.txtTelefone.focus();
       return(false);
   }

}

function linkFoxDownload()
{
   window.open("/ebssite/indexapp.jsp?centro=fox_download.jsp&esquerdo=fox.jsp","_self");
}

function abrirJanela()
{
	window.open("/ebssite/popup/cafe_ebs.jsp", "_blank","top=0, left=0, width=906, height=454");
}

function linkVideosDemo()
{
   window.open("/ebssite/indexapp.jsp?centro=produtos_demonstracao.jsp&esquerdo=produtos.jsp&direito=demonstracao.jsp","_self");
}

function abrirVideoDemonstracao(palavra)
{
	window.open("/ebssite/demonstracao/"+palavra+".jsp", "_blank","top=0, left=0, width=800, height=600, resizable=yes, status=no");
}

function validCadastroUnico()
{
   if(document.frmDownload.txtNome.value=="")
   {
       alert("Por favor, preencha o campo NOME.");
       document.frmDownload.txtNome.focus();
       return(false);
   }
   if(document.frmDownload.txtEmpresa.value=="")
   {
       alert("Por favor, preencha o campo EMPRESA.");
       document.frmDownload.txtEmpresa.focus();
       return(false);
   }
   if(document.frmDownload.txtEndereco.value=="")
   {
       alert("Por favor, preencha o campo ENDERECO.");
       document.frmDownload.txtEndereco.focus();
       return(false);
   }
   if(document.frmDownload.txtCidade.value=="")
   {
       alert("Por favor, preencha o campo CIDADE.");
       document.frmDownload.txtCidade.focus();
       return(false);
   }
   if(document.frmDownload.txtCep.value=="")
   {
       alert("Por favor, preencha o campo CEP.");
       document.frmDownload.txtCep.focus();
       return(false);
   }
   if(document.frmDownload.txtBairro.value=="")
   {
       alert("Por favor, preencha o campo BAIRRO.");
       document.frmDownload.txtBairro.focus();
       return(false);
   }
   if(document.frmDownload.txtDdd.value=="")
   {
       alert("Por favor, preencha o campo TELEFONE.");
       document.frmDownload.txtDdd.focus();
       return(false);
   }
   if(document.frmDownload.txtTelefone.value=="")
   {
       alert("Por favor, preencha o campo TELEFONE.");
       document.frmDownload.txtTelefone.focus();
       return(false);
   }
   if(document.frmDownload.txtEmail.value=="")
   {
       alert("Por favor, preencha o campo EMAIL.");
       document.frmDownload.txtEmail.focus();
       return(false);
   }
 /*  if(document.frmDownload.txtLogin.value=="")
   {
       alert("Por favor, preencha o campo LOGIN.");
       document.frmDownload.txtLogin.focus();
       return(false);
   }              */
   if(document.frmDownload.txtSenha.value=="")
   {
       alert("Por favor, preencha o campo SENHA.");
       document.frmDownload.txtSenha.focus();
       return(false);
   }else{
       if(document.frmDownload.txtSenha.value != document.frmDownload.txtConfirmeSenha.value)
       {
           alert("Os campos SENHA e CONFIRME A SENHA não conferem!");
           document.frmDownload.txtConfirmeSenha.focus();
           return(false);
       }
   }
}

function validaCadastroUnicoAlteracao()
{
   if(document.frmDownloadAlteracao.txtNome.value=="")
   {
       alert("Por favor, preencha o campo NOME.");
       document.frmDownloadAlteracao.txtNome.focus();
       return(false);
   }
   if(document.frmDownloadAlteracao.txtDdd.value=="")
   {
       alert("Por favor, preencha o campo TELEFONE.");
       document.frmDownloadAlteracao.txtDdd.focus();
       return(false);
   }
   if(document.frmDownloadAlteracao.txtTelefone.value=="")
   {
       alert("Por favor, preencha o campo TELEFONE.");
       document.frmDownloadAlteracao.txtTelefone.focus();
       return(false);
   }
   if(document.frmDownloadAlteracao.txtEmail.value=="")
   {
       alert("Por favor, preencha o campo EMAIL.");
       document.frmDownloadAlteracao.txtEmail.focus();
       return(false);
   }
    if(document.frmDownloadAlteracao.txtSenhaAtual.value=="")
   {
       alert("Por favor, preencha o campo SENHA ATUAL.");
       document.frmDownloadAlteracao.txtSenhaAtual.focus();
       return(false);
   }
   if(!document.frmDownloadAlteracao.txtSenha.value=="")
   {
        if(document.frmDownloadAlteracao.txtSenha.value != document.frmDownloadAlteracao.txtConfirmeSenha.value)
       {
           alert("Os campos SENHA NOVA e CONFIRME A SENHA NOVA diferentes! Confirme novamente a senha.");
           document.frmDownloadAlteracao.txtConfirmeSenha.focus();
           return(false);
       }
   }
}
function abrirVideo(palavra, tipo, caminho)
{
	window.open("/ebssite/demonstracao/Video.jsp?tipo="+tipo+"&caminho="+caminho, "_blank","top=0, left=0, width=800, height=600, resizable=yes, status=no");
}

function AplicarMascara_CEP(objeto,f){
	campo = eval("document."+f+"."+objeto);
	validaNumero(objeto);
	caracteres = '1234567890';
	if ((window.event.keyCode == 36)||(window.event.keyCode == 41)||(window.event.keyCode == 94)||(window.event.keyCode == 124)||(window.event.keyCode == 109)||(window.event.keyCode == 189)) {
		event.returnValue = false;
	}
	else {
		if ((campo.value.length == 5 )&&(window.event.keyCode != 8)&&(window.event.keyCode != 109)&&(window.event.keyCode != 189)) {
	 		campo.value = campo.value + '-';
		}
	}
}

function AplicarMascara_Fone(objeto,f){
	campo = eval("document."+f+"."+objeto);
	validaNumero(objeto);
	caracteres = '1234567890';
	if ((window.event.keyCode == 36)||(window.event.keyCode == 41)||(window.event.keyCode == 94)||(window.event.keyCode == 124)||(window.event.keyCode == 109)||(window.event.keyCode == 189)) {
		event.returnValue = false;
	}
	else {
		if ((campo.value.length == 4 )&&(window.event.keyCode != 8)&&(window.event.keyCode != 109)&&(window.event.keyCode != 189)) {
	 		campo.value = campo.value + '-';
		}
	}
}

function AplicarMascara_Data(objeto,f){
	//alert(window.event.keyCode);
	campo = eval("document."+f+"."+objeto);
	validaNumero(objeto);
	caracteres = '1234567890';
	if ((window.event.keyCode == 36)||(window.event.keyCode == 41)||(window.event.keyCode == 94)||(window.event.keyCode == 124)||(window.event.keyCode == 109)||(window.event.keyCode == 189)||(window.event.keyCode == 111)) {
		event.returnValue = false;
	}
	else {
		if (((campo.value.length == 2 )||(campo.value.length == 5))&&(window.event.keyCode != 8)&&(window.event.keyCode != 109)&&(window.event.keyCode != 189)) {
	 		campo.value = campo.value + '/';
		}
	}
}

function retornaCidade() {
    
    jancid = window.open('/ebssite/servletEbs?cmd=listaestado','jancid', 'width=320,height=240,left=300,top=100,scrollbars');
}

function addFormCidadeSite(cd_cidade,cd_estado,descricao) {

    opener.document.forms[1].cd_cidade.value=cd_cidade;
    opener.document.forms[1].cd_estado.value=cd_estado;
    opener.document.forms[1].txtCidade.value=descricao.replace("###","'");
    self.close();
}

function validaEmail(campo){
 var email     = campo.value;
 var BadChars  = "*|,\":<>[]{}`\'';()!&$#% ";
 var GoodChars = "@.";
 var posarroba = email.indexOf ("@",0);
 if (email == "")
  return(true);
 if (email.length < 5) // o email é menor que 5 caracteres
 {
  alert("E-mail inválido! "+ campo.value);
     campo.value = "";
     campo.focus();
     return (false);
 }
 for (var i = 0; i < email.length; i++)
 {
  if (BadChars.indexOf(email.charAt(i)) != -1) // Contém caracteres inválidos, badchars
  {
   alert("E-mail inválido! "+ campo.value);
     campo.value = "";
     campo.focus();
     return (false);
  }
 }
 for (var i = 0; i < GoodChars.length; i++)
 {
  if (email.indexOf(GoodChars.charAt(i)) == -1) // não tem goodchars
  {
   alert("E-mail inválido! "+ campo.value);
     campo.value = "";
     campo.focus();
     return (false);
  }

if (email.indexOf(GoodChars.charAt(i),0) == 0) // começou com goodchars (. ou @)
  {
   alert("E-mail inválido! "+ campo.value);
     campo.value = "";
     campo.focus();
     return (false);
  }
  if (email.lastIndexOf(GoodChars.charAt(i)) > email.length-3) //existe menos de 2 caracteres depo
  {
   alert("E-mail inválido! "+ campo.value);
     campo.value = "";
     campo.focus();
     return (false);
  }
 }
 if (email.lastIndexOf("@") > email.lastIndexOf(".")) //Não tem ponto depois do arroba
 {
  alert("E-mail inválido! "+ campo.value);
     campo.value = "";
     campo.focus();
     return (false);
 }
 if (email.indexOf ("@.",0) != -1 || email.indexOf (".@",0) != -1) // . e @ colados
 {
  alert("E-mail inválido! "+ campo.value);
     campo.value = "";
     campo.focus();
     return (false);
 }
 if (email.indexOf ("@",posarroba+1) != -1) // Contém mais de um " @ "
 {
  alert("E-mail inválido! "+ campo.value);
     campo.value = "";
     campo.focus();
     return (false);
 }
 return(true);
}

