/* author: Felix Henrique */
/* Creation date: 01/06/2004 */
<!--
function setOperacao(acao) {
 var op = document.getElementById("acao");
 op.value = acao;
}

function checkEnquete(){
	op = document.fmEnquete.op.value;
	alert(op);
	return true;
}

function checkLogin() {
  if (document.fmLogin.cxMatricula.value == ""){
   alert("Digite o LOGIN!");
   document.fmLogin.cxMatricula.focus();
   return;
  }
  if (document.fmLogin.cxSenha.value == ""){
   alert("Digite a SENHA!");
   document.fmLogin.cxSenha.focus();
   return;
  }
  document.fmLogin.submit();
}

function checkCons() {
  cons = document.fmCons.titulo.value.length;
  msg = "";
  if (cons == 0) {
    msg = "Digite uma palavra-chave";
    document.fmCons.titulo.focus();
  }
  if (cons > 0 && cons < 3) {
    msg = "Digite no mínimo 3 caracteres";
    document.fmCons.titulo.focus();
  }
  if (msg != "") {
   alert(msg);
      return false;
   } else {
	 return true;
   }
}

function abreJanela(link,janela,scrolling,w,h,t,l){
  if (!scrolling) { scrolling = 'auto' }
    window.open(link,janela,'top='+t+',left='+l+',width='+w+',height='+h+',toolbar=0,menubar=0,location=no,status=1,scrollbars='+scrolling+',resizable=no')
}

function do_submit() {
  if ( ( document.fale_conosco.cxNome.value == "" ) || ( document.fale_conosco.cxEmail.value == "" )|| ( document.fale_conosco.cxMensagem.value == "" ))
	alert( "Itens com (*) devem ser preenchidos." ) ;
  else
	document.fale_conosco.submit() ;
}

function AbrePopEnviar(UrlPagE,NameE,Wi,He,scrolling) {
    if (!scrolling) { scrolling = 'auto' }
	 PopEnviaNoticia = window.open(UrlPagE,NameE,'width='+Wi+',height='+He+',scrollbars=yes,scrollbars='+scrolling+',toolbar=no,location=no,status=no,menubar=no,resizable=no,left=250,top=100');
}

function AbrePopImprimir(UrlPagI,NameI,Wi,He,scrolling) {
    if (!scrolling) { scrolling = 'auto' }
  window.open(UrlPagI,NameI,'width='+Wi+',height='+He+',scrollbars=yes,toolbar=no,location=no,status=no,menubar=no,resizable=no,left=50,top=5');
}

function PrintPage() {
  if (window.print)
    window.print()
  else
    alert("O script não conseguiu envira o documento diretamente para impressão,nPressione Ctrl+P ou selecione Imprimir no menu Arquivo para imprimir esta página.");
}

function validarEnviaramigo() {
   remetente = document.enviaramigo.remetente.value
   email = document.enviaramigo.email.value
   destinatario = document.enviaramigo.destinatario.value
   mailto = document.enviaramigo.mailto.value
   msg = ""
   // Validando remetente
   if ((remetente.length < 1) || (remetente.length > 80)) {
      msg += "\n- Remetente (preenchimento obrigatório com no máximo 80 caracteres)"
   }
   // Validando email
   if ((email.length < 1) || (email.length > 35)) {
      msg += "\n- E-mail tem preenchimento obrigatório (com no máximo 35 caracteres)"
   } else {
      if ((email.indexOf("@") == -1) || (email.indexOf(".") == -1)) {
         msg += "\n- E-mail digitado não é válido!"
      }
   }
   // Validando destinatario
   if ((destinatario.length < 1) || (destinatario.length > 80)) {
      msg += "\n- Destinatario (preenchimento obrigatório com no máximo 80 caracteres)"
   }
   // Validando mailto
   if ((mailto.length < 1) || (mailto.length > 100)) {
      msg += "\n- E-mail tem preenchimento obrigatório (com no máximo 35 caracteres)"
   } else {
      if ((mailto.indexOf("@") == -1) || (mailto.indexOf(".") == -1)) {
         msg += "\n- E-mail digitado não é válido!"
      }
   }
   // Concluindo validação
   if (msg != "") {
      msg = "Atenção para o(s) campo(s) citado(s) abaixo:\n" + msg
      alert(msg)
      return false;
   } else {
      return true;
   }
}

function validatipoimagem(imagem,num){onBlur="validatipoimagem(tmp_imagem,0);"
if (LimitAttach(document.formulario,imagem,num))
   return true;
else
   return false;
}

function LimitAttachAmpliada(form, nomeimagem,num) {onBlur="validatipoimagemampliada(tmp_imagem_ampliada,0);"
  file = nomeimagem.value;
  allowSubmit = false;
  if (!file) return;
  while (file.indexOf("\\") != -1)
  file = file.slice(file.indexOf("\\") + 1);
  if (num=="1")  document.inserir.tmp_nomearquivo.value=file;
  ext = file.slice(file.indexOf(".")).toLowerCase();
  for (var i = 0; i < extArray.length; i++) {
	if (num=="0") {
	  if (extArray[i] == ext) { document.inserir.tmp_tipoampliada.value="image/pjpeg"; break; }
	  if (extArray2[i] == ext) { document.inserir.tmp_tipoampliada.value="image/gif"; break; }
	  if (extArray3[i] == ext) { document.inserir.tmp_tipoampliada.value="application/x-shockwave-flash"; break; }
	 }
  }
}

//Nome: CalQuant
//Parâmetros: obj -- objeto que dispara o evento portando pode ser "this";
//            Acao -- Informar 'I' para aumentar ou D Diminuir.
//Objetivo: Modificar a quantidade do campo informado.
function CalQuant(obj,Acao)
{
	if (Acao == 'I')
	{
		if (parseInt(obj.value) < 999)
		    obj.value = parseInt(obj.value) + 1;
	}
	else if (Acao = 'D')
	{
		if (parseInt(obj.value) > 1)
		    obj.value = parseInt(obj.value) - 1;
	}
}

function VerQuants(pcampoprefix, purlAction) {
    var midx, mhid, mqty, mqtyalt;

    midx = 0;
    mqtyalt = 0;

    do{
        try{
           mhid = window.document.Produtos[pcampoprefix + '_hid_' + midx.toString()].value;
           mqty = window.document.Produtos[pcampoprefix + '_default_' + midx.toString()].value;
        }
        catch(e){
           mhid = null;
           mqty = null;
        }

        if(mhid != null && mqty != null){
            mhid = parseInt(mhid);
            mqty = parseInt(mqty);

            if(mhid != mqty){
               mqtyalt = 1;
               alert('Atenção! A quantidade de um ou mais produtos foi alterada. Clique sobre o botão atualizar valores.');
               break;
            };
        };

        midx += 1;
    }while((mhid != null || mqty != null) && mqtyalt == 0);

    if(mqtyalt == 0){
        window.location = purlAction;
    }
}

function EnableKey(intKeyCodeValue,strRange,strOthers)
{
   /*
   Esta função impede que o usuário digite um valor que não é esperado para o campo.
   intKeyCodeValue = event *** o primeiro parâmetro desta função deve ser a palavra chave event, para que possamos identificar qual tecla foi pressionada.
   strRange  *** strRange são os valores das chaves que estão habilitadas. Esta variável deve conter dois números
                 inteiros representando o código ASCII da tecla, separados pelo sinal de ':'(dois pontos).
                 Serão habilitadas todas as teclas que forem maiores ou iguais ao primeiro valor(valor antes dos
                 dois pontos) e menores ou iguais ao segundo valor (valor após os dois pontos).
                 Caso o segundo valor seja maior que o primeiro, os valores serão trocados.

   strOthers *** strOthers é dividido por ponto-e-vírgulas(;). Os valores ASCII contidos em strOthers são excessões e quando
                 pressionados serão exibidos mesmo que não esteja no escopo do parâmetro strRange.
                 OBS***PASSE PARA strOthers OS CARACTERS ASCII!!!
   */

   strRange = strRange.split(":");
   var intFirst = strRange[0];
   var intEnd   = strRange[1];
   var intAux;

   if(strOthers.length>0)
   {
      strOthers = strOthers.split(";")
   }
   if(!(isNaN(intFirst) && isNaN(intEnd)))
   {
      if(intEnd < intFirst)
      {
         intAux   = intFirst;
         intFirst = intEnd;
         intEnd   = intAux;
      }
      if((intKeyCodeValue.keyCode < intFirst) || (intKeyCodeValue.keyCode > intEnd))
      {
         if(strOthers.length < 1)
         {
            intKeyCodeValue.keyCode = false;
         }

         intAux=0;
         for(var i=0; i<strOthers.length; i++)
         {
            if(!(isNaN(strOthers[i])))
            {
               if(intKeyCodeValue.keyCode == strOthers[i])
               {
                  intAux += 1;
               }
            }
         }
         if(intAux==0)
         {
            intKeyCodeValue.keyCode = false;
         }
      }
   }
}
   //Desenvolvido por NLA
   //"Relogio do Servidor"
   var hh = 16;
   var mm = 15;
   var ss = 0;
   function relogio(){
    if (ss >= 60){
	 ss = 00;
	 mm = mm + 1;
	 if (mm >= 60){
	  mm = 00;
	  hh = hh + 1;
	  if (hh >= 24){
	   hh = 00;
    }}}
	ss = ss + 1;
	if (hh <= 9){
	 xhh = "0" + hh;
	} else {
	 xhh = hh;
	}
	if (mm <= 9){
	 xmm = "0" + mm;
	} else {
	 xmm = mm;
	}
	if (ss <= 9){
	 xss = "0" + ss;
	} else {
	 xss = ss;
	}
   	document.all("span_relogio").innerHTML = xhh + ":" + xmm + ":" + xss;
	lrelogio = setTimeout("relogio()", 1000);
   }

function ocultar(ident)
{
  var obj = document.getElementsByTagName("table");
  for (i=0;i<obj.length;i++) {
    if (obj[i].id == ident) {
      if (obj[i].style.display == '')
       obj[i].style.display = 'block';
      else if (obj[i].style.display == 'block')
       obj[i].style.display = 'block';
    }else
      obj[i].style.display = '';
  }
}

function OcultarDiv(ident)
{
  var obj = document.getElementsByTagName("div");
  for (i=0;i<obj.length;i++)
  {
    if (obj[i].id == ident) {
      if (obj[i].style.visibility == 'hidden')
       obj[i].style.visibility = 'visible';
      else if (obj[i].style.visibility == 'visible')
       obj[i].style.visibility = 'visible';
    }else
      obj[i].style.visibility = 'hidden';
  }
}

function ExibirDiv() {
   LyCamara.style.visibility = 'visible';
}
function OcultarDiv() {
   LyCamara.style.visibility = 'hidden';     
}

-->
