<!--script language="JavaScript"-->
<!--
// VERIFICA SE O CAMPO ESTA VAZIO E NÃO CONSIDERA CARACTERES FEITOS COM A BARRA DE ESPAÇO
	function verifica_branco(parametro){ 
	        teste_parametro = "false"; 
	        tamanho_parametro = parametro.length; 
	        if (tamanho_parametro != 0){ 
	                for (i = 0; i < tamanho_parametro; i++){
				if (parametro.charAt(i) != " "){ 
					teste_parametro = "true"
	                	} 
	                } 
			if (teste_parametro == "false"){
	          		return false; 
			}else{ 
	                	return true; 
			} 
		}else{ 
			return false; 
		} 
	}

// VALIDAÇÃO VÁLIDA PARA COMPARAÇÃO DAS DATAS
	function valida_inteiro(parametro){
		if (parametro.length != 0){
			if (!verifica_branco(parametro)){
				return true;
			}
			teste_ponto = "false";
			tamanho_parametro = parametro.length;
		if (isNaN(parametro)){
			return false;
		}else{
			for (k = 0; k < tamanho_parametro; k++){
				if ((parametro.charAt(k) == '.') || (parametro.charAt(k) == '-') || (parametro.charAt(k) == '+')){
					teste_ponto = "true";
				}
			}
			if (teste_ponto == "true"){
				return false;
			}else{
				return true;
				}
			}
		}else{
			return true;
		}
	}
	function bloqueia_alfa()	{
		//função que permite a digitação de números 0-9
		if (event.keyCode < 47 || event.keyCode >57)	{
			event.keyCode = 0;
			return false;
		}
		else	{
			if (event.keyCode == 47)	{
				event.keyCode = 0;
				return false;
			}
		}
	}
// FUNÇÃO QUE MASCARA CPF
	function mascara_cpf(param){
		bloqueia_alfa();
		if (param.value.length==3){
			param.value = param.value + ".";
			return;
		}
		if (param.value.length==7){
			param.value = param.value + ".";
			return;
		}
		if (param.value.length==11){
			param.value = param.value + "-";
			return;		
		}
	}
//VALIDA CPF
	function valida_cpf(cpf) {
		rcpf1 = cpf.substr(0,9); 
 		rcpf2 = cpf.substr(9,2); 
		if( (cpf=='11111111111') || (cpf=='22222222222') || (cpf=='33333333333') || (cpf=='44444444444') ||(cpf=='55555555555') ||(cpf=='66666666666') ||(cpf=='77777777777') ||(cpf=='88888888888') ||(cpf=='99999999999') || (cpf=='00000000000') ){
      			return false;
		}   
  		d1 = 0;
  		for (i=0;i<9;i++) 
			d1 += rcpf1.charAt(i)*(10-i);
			d1 = 11 - (d1 % 11);
  		if (d1>9) d1 = 0;
		  	if (rcpf2.charAt(0) != d1) 
    				return false;
  			d1 *= 2;
  		for (i=0;i<9;i++) 
			d1 += rcpf1.charAt(i)*(11-i);
			d1 = 11 - (d1 % 11);
  		if (d1>9) d1 = 0;
  			if (rcpf2.charAt(1) != d1) return false;
  		return true;
	}
//MASCARA CNPJ
	function mascara_cnpj(campo)
	{
		bloqueia_alfa();
		if (campo.value.length=="2") 
		{
			campo.value = campo.value + ".";
			return;
		}
		if (campo.value.length=="6") 
		{
			campo.value = campo.value + ".";
			return;
		}
		if (campo.value.length=="10") 
		{
			campo.value = campo.value + "/";
			return;
		}
		if (campo.value.length=="15") 
		{
			campo.value = campo.value + "-";
			return;
		}
	}

//VALIDA CNPJ
	function valida_cnpj(strCNPJ){
		if (strCNPJ == ""){
		return false;
		}
		var
			strDV = strCNPJ.substr(12,2),
			intSoma,
			intDigito = 0,
			strControle = "",
			strMultiplicador = "543298765432";
	
		strCNPJ = strCNPJ.substr(0, 12);
		for(var j = 1; j <= 2; j++){
			intSoma = 0;
			for(var i = 0; i <= 11; i++){
				intSoma += (parseInt(strCNPJ.substr(i, 1), 10) * parseInt(strMultiplicador.substr(i, 1), 10))
			}
			if(j == 2){intSoma += (2 * intDigito)}
			intDigito = (intSoma * 10) % 11;
			if(intDigito == 10){intDigito = 0}
			strControle += intDigito.toString();
			strMultiplicador = "654329876543";
			}
		return(strControle == strDV);
	}

// FUNÇÃO QUE VALIDA A DATA
	function valida_data(dia,mes,ano){
		var v_dia;
		var v_mes;
		var v_ano;			
		if (!valida_inteiro(dia)){
			return (false);		
		}
		if (!valida_inteiro(mes)){
			return (false);		
		}
		if (!valida_inteiro(ano)){
			return (false);		
		}		
		v_dia = dia;
		v_mes = mes;
		v_ano = ano;

		if (v_dia.length < 2){
			return(false);
		}		
		if (v_mes.length < 2){
			return(false);
		}
		if (v_ano.length < 4){
			return(false);
		}
		if (((v_ano < 1900) || (v_ano > 2079)) && (v_ano.length != 0)){
			return(false);
		}
		if (v_dia > 31 || v_dia < 1){
			return(false);
		}		
		if (v_mes > 12 || v_mes < 1){
			return(false);
		}
		if (v_dia == "31") {
			if ((v_mes == "04") || (v_mes == "06") || (v_mes == "09") || (v_mes == "11")){
			return(false);
			}
		}
	// VALIDAÇÃO DE ANO BISSEXTO
		if (v_mes == "02"){
			if (!(v_ano%4)){
				if (v_dia > 29){
					return(false);
				}
			}else if (v_dia > 28){
				return(false);
			}
		}	
	// O -if- abaixo testa se algum campo foi preenchido e outro deixado em branco deixando a data incompleta		
		if (((v_dia != "") || (v_mes != "") || (v_ano != "")) && ((v_dia == "") || (v_mes == "") || (v_ano == ""))){
			return(false);
		}
			return(true);
	}

//Caixa que mostra quantos caracteres aindam faltam para o limite declarado
	function textCounter(field, countfield, maxlimit) {
		if (field.value.length > maxlimit)
			field.value = field.value.substring(0, maxlimit);
		else 
			countfield.value = maxlimit - field.value.length;
	}

// BLOQUEIA TECLAS alfanuméricas. Usa no text ">>  OnKeyPress="return Numerico(event);"   <<"
	function Numerico(event){
		Tecla = event.which;
		if (Tecla == null)
		   Tecla = event.keyCode;
		if ((Tecla >= 48 && Tecla <= 57))
		   return true;
		return false;
		}
// Permite teclas numéricas, vírgula e ponto
	function Numerico1(event){
		Tecla = event.which;
		if (Tecla == null)
		   Tecla = event.keyCode;
		if ((Tecla >= 48 && Tecla <= 57) || (Tecla == 46) || (Tecla == 44))
		   return true;
		return false;
		}
//permite valores numéricos e espaços em brancos
	function Numerico2(event){
		Tecla = event.which;
		if (Tecla == null)
		   Tecla = event.keyCode;
		if ((Tecla >= 48 && Tecla <= 57) || (Tecla == 32))
		   return true;
		return false;
		}
//permite valores alfanumericos e espaços em brancos
	function alpha(event){
		Tecla = event.which;
		if (Tecla == null)
		   Tecla = event.keyCode;
//		alert(Tecla);
		if ((Tecla > 96) && (Tecla < 123) || (Tecla == 32)){
			return true;
			}
		if ((Tecla > 64) && (Tecla < 91) || (Tecla == 32)){
			return true;	
			}
		else{
		return false;
		}
	}

	function valida_MMAAAA(form,objeto,valor){
		var mNomes = "JanFebMarAprMayJunJulAugSepOctNovDec"
		var mValores = "312831303130313130313031"
		var alertMsg = ""
		var forFocus = form+"."+objeto+".focus()"
		var erro = true
		var args = valida_MMAAAA.arguments
		mes   	= parseInt(valor.substring(0,2),10)		// pega o mês
		ano   	= parseInt(valor.substring(3,7),10)		// pega o ano
		objeto = args[1]		// nome do objeto
		valor  = args[2]		// valor do campo
		if (valor.length<7){
			eval(forFocus)
			return false
			}
		else if  (valor.substring(2,3) != "/" ){
			eval(forFocus)
			return false
			}// Se o ano for menor que 1890, critica...
		else if (ano < 1890){
			eval(forFocus)
			return false
			}
		else if ((isNaN(mes)) || ( isNaN(ano)) ){
			eval(forFocus)
			return false
			}
		else if ((mes > 12) || (mes <= 0) ){
			eval(forFocus)
			return false
			}
		else {
	      var newValue = ""
		if (mes<10){
			mes = "0"+mes
			}
		return true
		}
	}
// Valida um data
	function valida_data(dia,mes,ano){
		var v_dia; 
		var v_mes; 
		var v_ano; 
		v_dia = dia; 
		v_mes = mes; 
		v_ano = ano; 
		if (v_dia.length < 2){
			return(false); 
		} 
		if (v_mes.length < 2){ 
			return(false); 
		} 
		if (v_ano.length < 4){ 
			return(false); 
		} 
		if (((v_ano < 1900) || (v_ano > 2079)) && (v_ano.length != 0)){ 
			return(false); 
		} 
		if (v_dia > 31){ 
		    return(false); 
		} 
		if (v_mes > 12){ 
			return(false); 
		} 
		if (v_dia == "31"){ 
			if ((v_mes == "04") || (v_mes == "06") || (v_mes == "09") || (v_mes == "11")){ 
				return(false); 
				} 
			} 
		if (v_mes == "02"){ 
			if (!(v_ano%4)){ 
				if (v_dia > 29){ 
					return(false); 
				} 
			} 
			else if (v_dia > 28){ 
				return(false); 
			} 
		} // o -if- abaixo testa se algum campo foi preenchido e outro deixado em branco deixando a data incompleta
		if (((v_dia != "") || (v_mes != "") || (v_ano != "")) && ((v_dia == "") || (v_mes == "") || (v_ano == ""))){ 
			return(false); 
			} 
			return(true); 
		} 
	function Mascara(TxtPeriodoInicial){
		if (event.keyCode != 8) {
			if(TxtPeriodoInicial.value.length == 2){
				TxtPeriodoInicial.value = TxtPeriodoInicial.value + '/';
			}
			if (TxtPeriodoInicial.value.length == 5){
				TxtPeriodoInicial.value = TxtPeriodoInicial.value + '/';						
			}
		}
		Tecla = event.which;
		if (Tecla == null)
		   Tecla = event.keyCode;
		if ((Tecla >= 48 && Tecla <= 57) || (Tecla == 46))
		   return true;
		return false;
	}	
	function Mascara1(Data){
		if (event.keyCode != 8) {
			if(Data.value.length == 2){
				Data.value = Data.value + '/';
			}
			if (Data.value.length == 5){
				Data.value = Data.value + '/';						
			}
		}
		Tecla = event.which;
		if (Tecla == null)
		   Tecla = event.keyCode;
		if ((Tecla >= 48 && Tecla <= 57) || (Tecla == 46))
		   return true;
		return false;
	}	

	function Mascara2(Data){  //Dia e Mes
		if (event.keyCode != 8) {
			if(Data.value.length == 2){
				Data.value = Data.value + '/';
			}
		}
		Tecla = event.which;
		if (Tecla == null)
		   Tecla = event.keyCode;
		if ((Tecla >= 48 && Tecla <= 57) || (Tecla == 46))
		   return true;
		return false;
	}	

	function Horario(Hora){
		if (event.keyCode != 8) {
			if(Hora.value.length == 2){
				Hora.value = Hora.value + ':';
			}
		}
		Tecla = event.which;
		if (Tecla == null)
		   Tecla = event.keyCode;
		if ((Tecla >= 48 && Tecla <= 57) || (Tecla == 46))
		   return true;
		return false;
	}	

function valida_inteiro(parametro)  //FUNCAO PARA VALIDACAO DE NÚMEROS INTEIROS, E ESPAÇOS EM BRANCO
{
	if (parametro.length != 0)
	{
		if (!verifica_branco(parametro))
		{
			return true;
		}

		teste_ponto = "false";
		tamanho_parametro = parametro.length;

		if (isNaN(parametro)) //valor digitado não é numérico
		{
			return false;
		}
		else //valor digitado é um numérico válido
		{	
			for (k = 0; k < tamanho_parametro; k++)
			{if ((parametro.charAt(k) == '.') || (parametro.charAt(k) == '-') || (parametro.charAt(k) == '+'))
				{
					teste_ponto = "true"; /*existe caracter ponto*/
				}
			}

			if (teste_ponto == "true") //encontrou caracter ponto(numero real)
			{
				return false;
			}
			else
			{
				return true;
			}
		}
	}
	else
	{
		return true;
	}
}
function valida_data(dia,mes,ano){
	//Funcionalidade:	Valida a Data retornando True se for uma Data 
	//					válida e False se não for.
	//					Antes de se usar esta função deve-se garantir que os parâmetros
	//					passados sejam numéricos e inteiros.
	// PARÂMETROS: 
	//		Dia = Dia da Data(caracteres numericos), 
	//		Mes = Mes da Data(caracteres numericos), 
	//		Ano = Ano da Data(caracteres numericos)
		
	var v_dia;
	var v_mes;
	var v_ano;

	if (!valida_inteiro(dia)){
		return (false);		
	}
	if (!valida_inteiro(mes)){
		return (false);		
	}
	if (!valida_inteiro(ano)){
		return (false);		
	}

	v_dia = dia;
	v_mes = mes;
	v_ano = ano;

	if (v_dia.length < 2)
	{
		return(false);
	}

	if (v_mes.length < 2)
	{
		return(false);
	}

	if (v_ano.length < 4)
	{
		return(false);
	}

	if (((v_ano < 1900) || (v_ano > 2079)) && (v_ano.length != 0))
	{
		return(false);
	}

	if (v_dia > 31 || v_dia < 1)
	{
		return(false);
	}

	if (v_mes > 12 || v_mes < 1)
	{
		return(false);
	}

	if (v_dia == "31") 
	{
		if ((v_mes == "04") || (v_mes == "06") || (v_mes == "09") || (v_mes == "11"))
		{
			return(false);
		}
	}

	//Validação de Ano Bissexto
	if (v_mes == "02")
	{
		if (!(v_ano%4)) 
		{
			if (v_dia > 29)
			{
				return(false);
			}
		}
		else if (v_dia > 28)
		{
			return(false);
		}
	}

	//o -if- abaixo testa se algum campo foi preenchido e outro deixado em branco deixando a data incompleta

	if (((v_dia != "") || (v_mes != "") || (v_ano != "")) && ((v_dia == "") || (v_mes == "") || (v_ano == "")))
	{
		return(false);
	}
	return(true);
}

// Colocar apenas abaixo ( Formato resultado 123,00)
// onKeyDown="FormataValores(this, 8, event);"
function FormataValores(campo,tammax,teclapres){
	var tecla = teclapres.keyCode;
	vr = campo.value;
	vr = vr.replace( "/", "" );
	vr = vr.replace( "/", "" );
	vr = vr.replace( ",", "" );
	vr = vr.replace( ".", "" );
	vr = vr.replace( ".", "" );
	vr = vr.replace( ".", "" );
	vr = vr.replace( ".", "" );
	tam = vr.length;
	if (tam < tammax && tecla != 8){ tam = vr.length + 1 ; }
		if (tecla == 8 ){	tam = tam - 1 ; }
			if ( tecla == 8 || tecla >= 48 && tecla <= 57 || tecla >= 96 && tecla <= 105 ){
		if ( tam <= 2 ){ 
 			campo.value = vr ; }
	 	if ( (tam > 2) && (tam <= 11) ){
	 		campo.value = vr.substr( 0, tam - 2 ) + ',' + vr.substr( tam - 2, tam ) ; }
	 	if ( (tam >= 6) && (tam <= 8) ){
	 		campo.value = vr.substr( 0, tam - 5 ) + '.' + vr.substr( tam - 5, 3 ) + ',' + vr.substr( tam - 2, tam ) ; }
	 	if ( (tam >= 9) && (tam <= 11) ){
	 		campo.value = vr.substr( 0, tam - 8 ) + '.' + vr.substr( tam - 8, 3 ) + '.' + vr.substr( tam - 5, 3 ) + ',' + vr.substr( tam - 2, tam ) ; }
	 	if ( (tam >= 12) && (tam <= 14) ){
	 		campo.value = vr.substr( 0, tam - 11 ) + '.' + vr.substr( tam - 11, 3 ) + '.' + vr.substr( tam - 8, 3 ) + '.' + vr.substr( tam - 5, 3 ) + ',' + vr.substr( tam - 2, tam ) ; }
	 	if ( (tam >= 15) && (tam <= 17) ){
	 		campo.value = vr.substr( 0, tam - 14 ) + '.' + vr.substr( tam - 14, 3 ) + '.' + vr.substr( tam - 11, 3 ) + '.' + vr.substr( tam - 8, 3 ) + '.' + vr.substr( tam - 5, 3 ) + ',' + vr.substr( tam - 2, tam ) ;}
	}
}

//formatar nº com casas decimais
function formatanumero(numero,decimais)
{
  if (isNaN(numero)) { return 0};
  if (numero=='') { return 0};
 
  var IsNegative=(parseInt(numero)<0);
  if(IsNegative)numero=-numero;

  var snum = new String(numero);
  var sec = snum.split('.');
  var whole = parseInt(sec[0]);
  var result = '';
  if(sec.length > 1){
    var dec = new String(sec[1]);
    dec = parseInt(dec)/Math.pow(10,parseInt(dec.length-decimais-1));
Math.round(dec);
dec = parseInt(dec)/10;

if(IsNegative)
{
  var x = 0-dec;
      x = Math.round(x);
  dec = - x;
}
else
{
      dec = Math.round(dec);
}

/*
  * If the number was rounded up from 9 to 10, and it was for 1 'decimal'
  * then we need to add 1 to the 'whole' and set the dec to 0.
  */
if(decimais==1 && dec==10)
{
  whole+=1;
  dec="0";
}

    dec = String(whole) + "." + String(dec);
    var dot = dec.indexOf('.');
    if(dot == -1){
      dec += '.';
      dot = dec.indexOf('.');
    }
var l=parseInt(dot)+parseInt(decimais);
    while(dec.length <= l) { dec += '0'; }
    result = dec;
  } else{
    var dot;
    var dec = new String(whole);
    dec += '.';
    dot = dec.indexOf('.');
var l=parseInt(dot)+parseInt(decimais);
    while(dec.length <= l) { dec += '0'; }
    result = dec;
  }
  if(IsNegative)result="-"+result;
  return result;
}

/*
    //ESSE CONTROLE ESTA EM SUPERIOR.ASP

    // AQUI DESABILITO O BOTÃO DIREITO
	function botaodireito(){
		if (event.button==2){
			//alert(' Botão direito Desabilitado! \n\n É expressamente proibida a cópia completa ou parcial \n do conteúdo deste site! ')
			alert('Botão direito Desabilitado!');	
		}
    } 
    document.onmousedown = botaodireito

    // AQUI DESABILITO O SELECIONAR TEXTO
	function disableselect(e){
		return false
	}
	
	function reEnable(){
		return true
	}
    document.onselectstart = new 
	Function ("return false")
	if (window.sidebar){
		document.onmousedown=disableselect
		document.onclick=reEnable
	}

*/

// Mensagem no rodapé da barra de status
	window.status = "Catalogo das Artes"

//-->	  


<!--/script-->