<!--

// Begin FUNÇÃO PARA GERAR POPUPS
function popUp(URL,WIDTH,HEIGHT) 
{
	day = new Date();
	id = "janela";
	eval("page" + id + " = window.open('" + URL + "', '" + id + "',"+ 
		 "'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,"+
		 "width=" + WIDTH + ",height=" + HEIGHT + ",left = 100,top = 100');");
}

function popUp2(URL) 
{
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,title=Invoice,location=0,statusbar=0,menubar=0,resizable=1,width=600,height=500,left = 162,top = 34');");
}

//FUNÇÃO PARA ESCONDER DIV
function divVisibility(elemento_id)
{
	var olddiv;
	
	if(olddiv != undefined)
		olddiv.style.visibility = "hidden";
		
	var DIV = document.getElementById(elemento_id);

	DIV.style.visibility = "visible";
	
	olddiv = DIV;
}

function js_mudaCorCampo( campo, cor )
{
  campo.style.backgroundColor = cor;
}


function IsValidEmail( Value )
{
	var i, Current, Tmp
	var Array = Value.split( '@' , 3 );

	// Se tiver mais ou menos que 1 Arroba ou nao tiver nada antes ou apos o Arroba
	if( Array.length != 2 || Array[0] == '' || Array[1] == '' )
		return false;

	Tmp = Array[0];
	// Se contiver caracteres especiais antes do Arroba
	for(i=0; i < Tmp.length ;i++)
		{
		Current =  Tmp.charAt(i);
		if( (Current < '0' || Current > '9') && (Current < 'A' || Current > 'Z') && (Current < 'a' || Current > 'z') && Current != '_' && Current != '-' && Current != '.' )
			return false;
		}

	Tmp = Array[1];
	// Se contiver caracteres especiais depois do Arroba
	for(i=0; i < Tmp.length ;i++)
		{
		Current =  Tmp.charAt(i);
		if( (Current < '0' || Current > '9') && (Current < 'A' || Current > 'Z') && (Current < 'a' || Current > 'z') && Current != '.' )
			return false;
		}

	Tmp = Tmp.split( '.' , 4 );
	// Se depois do arroba existir menos de 2 ou mais de 3 pontos
	if( Tmp.length != 2 && Tmp.length != 3 )
		return false;

	// Se depois do arroba existir menos de 2 ou mais de 3 pontos
	if( Tmp.length == 2 && (Tmp[0] == '' || Tmp[1] == '') )
		return false;

	// Se depois do arroba existir menos de 2 ou mais de 3 pontos
	if( Tmp.length == 3 && (Tmp[0] == '' || Tmp[1] == '' || Tmp[2] == '') )
		return false;

	return true
}

function valida()
{
  	with(document.frm_comentarios)
  	{
    	if(f_nome.value == "")
    	{
			alert("Informe seu Nome!");
		    f_nome.focus();
		    return false;
		}
		    
 		if(f_email.value != "")
    	{
    		if( !IsValidEmail(f_email.value) )
      		{
      			alert("O E-mail especificado é inválido!");
      			f_email.focus();
      			return false;
      		}
      		return true;
	    }
 		
 		if(f_mensagem.value == "")
    	{
      		alert("Digite o comentário!");
      		f_mensagem.focus();
      		return false;
    	}
	    return true;
  	}
}

function conta_letras(frm,obj,obj1,maximo)
{
	with(frm)
	{
		xstring = obj.value;
		obj1.value = xstring.length+1 ;
		if(maximo+1 <= obj1.value)
		{
			alert("Quantidade Máxima de caracteres foi atingida.");
			obj.value = xstring.slice(0,maximo+1)
		}
	}
}

function teclasNum(event, txtInput, intPos)
{ 
  var tecla = event.keyCode;
  
  if ((tecla > 47 && tecla < 58) || tecla == 46) // numeros de 0 a 9
    return true;
  else 
  {
    if(typeof(txtInput) != "undefined" && typeof(intPos) != "undefined" && txtInput.value.length == intPos)
    {
      if (tecla != 8 && tecla != 45) // backspace
        event.keyCode = 0;
      else
        return true;
    }
    else
    {
      if (tecla != 8) // backspace
        event.keyCode = 0;            
      else
        return true;
    }
  }
}

function autoTab(txtOriginal,txtDestination, intMax, event)
{
  var intTecla = event.keyCode;
  if ( (txtOriginal.value.length >= intMax) && (intTecla != 37 && intTecla != 36)  )
    txtDestination.focus();
}

function tecla()
{
	if ( event.keyCode == 13)
		{alert('Ok');}
		else
		{alert('Error');}
}

function js_validaFormContato()
{
  	with(document.fale_conosco)
  	{
    	if(f_nome.value == "")
    	{
			alert("Informe seu Nome!");
		    f_nome.focus();
		    return false;
		}
		
		if(f_assunto.value == "")
    	{
			alert("Informe o Assunto!");
		    f_assunto.focus();
		    return false;
		}
		
 		if(f_email.value != "")
    	{
    		if( !IsValidEmail(f_email.value) )
      		{
      			alert("O E-mail especificado é inválido");
      			f_email.focus();
      			return false;
      		}
	    }	 
    
    	if(f_mensagem.value == "")
    	{
      		alert("Digite sua Mensagem");
      		f_mensagem.focus();
      		return false;
    	}
	    return true;
  	}
  	
  	function salta_linha()
  	{
  		mensagem = $_REQUEST['f_mensagem'];
  		with(document.fale_conosco)
  		{
  			if ( event.keyCode == 13 )
  			{
  				mensagem = mensagem + "<br>";
  			}
  		}
  	}
}

//Função usada que os campos não sejam executados sem valor
//Utilizada no arquivo: apagar_conteudo_antigo.php.
function valida_periodo()
{
  	with(document.frm_apaga_conteudo_antigo)
  	{
    	if(f_data_inicial.value == "")
    	{
			alert("Informe a data inicial!");
		    f_data_inicial.focus();
		    return false;
		}
		    
 		if(f_data_final.value == "")
    	{
      		alert("Informe a data final!");
      		f_data_final.focus();
      		return false;
    	}
	    return true;
  	}
}
-->