function linke(tipo,id)
{
	location.href = 'anuncio.php?tipo='+tipo+'&id='+id;
}

// Limite para text area
// -----------------------------------------------------------------------
function maxLength(textAreaField, limit)
// -----------------------------------------------------------------------
{
	var ta = document.getElementById(textAreaField);
	if (ta.value.length >= limit) {

		ta.value = ta.value.substring(0, limit-1);
	}
}





// -----------------------------------------------------------------------

// CRIA E APRESENTA DIV 'CARREGANDO' ESTILO GMAIL

// -----------------------------------------------------------------------

function mostra_carregando()

{

	// verifica se existe o elemento

	document.getElementById('load').style.visibility = "visible";

	

}

// -----------------------------------------------------------------------

// REMOVE DIV 'CARREGANDO'

// -----------------------------------------------------------------------

function esconde_carregando()

{



	// verifica se existe o elemento

	document.getElementById('load').style.visibility = "hidden";

	

	

}



function anuncia(anun,anunT)

{



	if(anun>=anunT)

	{

		alert('Numero maximo de an&uacute;ncios alcançado');	

	}

	else

	{

		window.location.href = "cadDataPub.php";	

	}

}



function disabilita(campo, chk)

{

	if (document.getElementById(chk).checked != '')

	{

		document.getElementById(campo).value = "";

		document.getElementById(campo).disabled = "disabled";

	}

	else

	{

		document.getElementById(campo).disabled = "";

	}

}



function etapas(onde)

{

	     document.getElementById('load').style.visibility = "visible";

		document.getElementById('form').action = onde;

		document.getElementById('form').submit();

}



function loadFoto()

{

	     document.getElementById('load').style.visibility = "visible";

}

function escondeLoad()

{

	document.getElementById('load').style.visibility = "hidden";

}



function grava(cad, onde)

{

	

		var data1 = document.getElementById('atual').value;

		var data2 = document.getElementById('data_1').value;

		var edit = document.getElementById('Edit').value;

		if ( parseInt( data2.split( "/" )[2].toString() + data2.split( "/" )[1].toString() + data2.split( "/" )[0].toString() ) >= parseInt( data1.split( "/" )[2].toString() + data1.split( "/" )[1].toString() + data1.split( "/" )[0].toString() ) || edit == '1' )

		{

			document.getElementById('load').style.visibility = "visible";

			document.getElementById('form').action = cad + '?vai=' + onde;

			document.getElementById('form').submit();		}

		else

		{

		  alert('A data seleciona ja passou, por favor escolha outra!');

			return false;

		}

	    

}



function gravaRestrito(cad, onde)

{



			if (vazio('marca','MARCA')) return false;

			

			if (vazio('modelo','MODELO')) return false;

			



			

			if (vazio('placa','PLACA')) return false;

			if (vazio('placa','PLACA')) return false;

			

			if (vazio('ano_fab','ANO FABRICACAO')) return false;

			if (document.getElementById('ano_fab').value.length < 4)

			{

				alert('Preencha corretamente o campo ANO FABRICACAO!');	

				 return false;

			}

			

			if (vazio('ano_modelo','Ano MODELO')) return false;

			

			if (document.getElementById('ano_modelo').value.length < 4)

			{

				alert('Preencha corretamente o campo ANO MODELO!');	

				 return false;

			}

			

			if (document.getElementById("zero").checked != 1 && document.getElementById("km").value == '')

			{

				alert('Preeencha corretamente o campo Quilometragem!');

					document.getElementById('km').style.border='solid 1px #f00'; 

					

				return false;

			}

			

			if (vazio('cor','COR')) return false;

			

			

			if (vazio('descricao','DESCRICAO')) return false;

			

			

			if (document.getElementById("sob").checked != 1 && document.getElementById("preco").value == '')

			{

				alert('Preeencha corretamente o campo Preco!');

				document.getElementById('preco').style.border='solid 1px #f00'; 

				return false;

			}



			document.getElementById('load').style.visibility = "visible";

			document.getElementById('form').action = cad + '?vai=' + onde;

			document.getElementById('form').submit();

}



function filtra(box)

{

	txt = document.getElementById(box).value;

	

	if (txt.search("puta") > -1 || txt.search("filha da") > -1 || txt.search("filho da") > -1 || txt.search(" no cu") > -1 || txt.search("buceta") > -1 || txt.search("bixa") > -1 || txt.search("puto") > -1 || txt.search("viado") > -1 || txt.search("<") > -1 || txt.search(">") > -1 || txt.search("'") > -1 || txt.search('"') > -1  )

	{

		alert('Existem Palavras / Caracteres restritas para o sistema!');

		return true;

	}

}



function trans(box)

{

	txt = document.getElementById(box).value.toLowerCase();

	document.getElementById(box).value = txt;

}

function gravaFinal(cad, onde)

{



			document.getElementById('load').style.visibility = "visible";

			document.getElementById('form').action = cad + '?vai=' + onde;

			document.getElementById('form').submit();

	    

}







/*-----------------

Rolagem depoimentos

-----------------*/

var temporizador = null;

var temporizador2 = null;

var totalCliques = 0;

var vertical = 0;

function paraRolagem() {

	clearTimeout(temporizador);

	totalCliques = 0;

}

	function ativaRolagem(sentido) {

		totalCliques++;

		if (totalCliques == 1) {

			rolagem(sentido);

		}

	}

	function rolagem(sentido) {

		if (sentido == 'baixo') {

			vertical+=5;

		} else {

			vertical-=5;

		}

		conteudo.scroll(0,vertical);

		temporizador = setTimeout("rolagem('"+sentido+"')",50);

				

	}

	/*-----------------

Acerta rodape

-----------------*/

function conta_nro()

{

	document.getElementById('nro').value=300 - document.getElementById('descricao').value.length;

}

function conta_tam(e)

{

	if (window.event)

		tecla = e.keyCode;

	else

		tecla = e.which;

		document.getElementById('descricao').style.background='';

	if (document.getElementById('descricao').value.length>=300 && tecla !=8)

		{

		document.getElementById('descricao').value=document.getElementById('descricao').value.substring(0,300);

		return false;

}}



function conta_nro2(txt)

{

	document.getElementById('nro').value=500 - document.getElementById(txt).value.length;

}

function conta_nro3(txt)

{

	document.getElementById('nro2').value=500 - document.getElementById(txt).value.length;

}

function conta_nro4(txt)

{

	document.getElementById('nro3').value=500 - document.getElementById(txt).value.length;

}

function conta_tam2(e,txt)

{

	if (window.event)

		tecla = e.keyCode;

	else

		tecla = e.which;

		document.getElementById(txt).style.background='';

	if (document.getElementById(txt).value.length>=500 && tecla !=8)

		{

		document.getElementById(txt).value=document.getElementById(txt).value.substring(0,500);

		return false;

}}



function mudar()

{

	valor=parseInt(document.getElementById('base').offsetHeight);

	if(valor>300){

	document.getElementById('rodape').style.top=300+valor+'px';

	document.getElementById('total').style.height=300+valor+'px';}

	else

	{

		document.getElementById('rodape').style.top=400+250+'px';

	document.getElementById('total').style.height=100+250+'px';

		}

}



function mudarMURAL()

{



	valor=parseInt(document.getElementById('retorno').offsetHeight);

	document.getElementById('rodape').style.top=500+valor+'px';

	document.getElementById('total').style.height=300+valor+'px';

	document.getElementById('conteudo_pagina').style.height=300+valor+'px';

	

}

function mudarBUSCA()

{



	valor=parseInt(document.getElementById('retorno').offsetHeight);

	document.getElementById('rodape').style.top=500+valor+'px';

	document.getElementById('total').style.height=50+'px';

}



/*-----------------

Formulario de cadastro - Acerta botão

-----------------*/



function mudar_pag()

{

	valor=parseInt(document.getElementById('base').offsetHeight);

	document.getElementById('conteudo_pagina').style.height=50+valor+'px';



}

/*-----------------

Valida painel

-----------------*/

function valida_login()

{

	if (vazio('usuario','Usuario')) return false;

	if (vazio('senha','Senha')) return false;

	$('login').submit();

	}

/*-----------------

Valida busca

-----------------*/

function valida_busca()

{

	if (vazio_busca('termo_busca','Termo da busca')) return false;

	$('busca').submit();

	}

/*-----------------

Valda News

-----------------*/

function valida_news()

{

	if (vazio('nome','Nome')) return false;

	if (vazio('email','E-mail')) return false;

	

	if  (document.getElementById('email').value.search("@") == -1 || document.getElementById('email').value.search("[.*]") == -1)

		 {

		  alert("Digite um e-mail valido!");

		  document.getElementById("email").style.border='solid 1px #f00';

		  document.getElementById("email").focus();

		  return false;

		 }

		document.getElementById("email").style.border='solid 1px #CCC';

		

	$('news').submit();

	}

	/*-----------------

Formulario de cadastro - Valida

-----------------*/

function valida_contato()

{



	if (vazio_busca('nome','Nome')) return false;

	if (vazio_busca('email','E-mail')) return false;

	

	if  (document.getElementById('email').value.search("@") == -1 || document.getElementById('email').value.search("[.*]") == -1)

		 {

		  alert("Digite um e-mail valido!");

		  document.getElementById("email").style.border='solid 1px #f00';

		  document.getElementById("email").focus();

		  return false;

		 }

		document.getElementById("email").style.border='solid 1px #CCC';

		

	if (vazio_busca('fone','Fone')) return false;

	if (vazio_busca('assunto','Assunto')) return false;

	if (vazio_busca('msg','Mensagem')) return false;

	$('#rCont').html('<img src="images/loading.gif" width="16" height="16" align="top" alt="aguarde" /> Aguarde...');
	$.post("contato.php", $('#form').serialize(),
				  function(data){
					$('#rCont').html(data);
					document.getElementById("form").reset();
				  });

	}

/*-----------------

Formulario de cadastro - Valida

-----------------*/

function valida_cadastro()

{

	

	

	tipo=document.getElementById('tipo').value;

	if (tipo==1)

	{

	if (vazio_busca('razao','Razao Social')) return false;

	if (vazio_busca('fantasia','Nome Fantasia')) return false;

	if (vazio_busca('cnpj','CNPJ')) return false;

	if (!validacnpj(document.getElementById('cnpj')))return false;

	

	if (vazio_busca('cep','CEP')) return false;

	if (vazio_busca('cidade','CEP')) return false;

	if (vazio_busca('estado','CEP')) return false;

	

	if (vazio_busca('responsavel','Responsavel')) return false;



	if (vazio_busca('email','E-mail')) return false;

	if  (document.getElementById('email').value.search("@") == -1 || document.getElementById('email').value.search("[.*]") == -1)

		 {

		  alert("Digite um e-mail valido!");

		  document.getElementById("email").style.border='solid 1px #f00';

		  document.getElementById("email").focus();

		  return false;

		 }

		document.getElementById("email").style.border='solid 1px #CCC';

	if (vazio_busca('fone','Fone')) return false;

	}

	if (tipo==2)

	{

	if (vazio_busca('nome','Nome')) return false;



	if (vazio_busca('cpf','CPF')) return false;

	if (!validacpf(document.getElementById('cpf')))return false;

	if (vazio_busca('cep','CEP')) return false;


	if (vazio_busca('cidade','CEP')) return false;
	
	

	if (vazio_busca('estado','CEP')) return false;	

	

	if (vazio_busca('email','E-mail')) return false;

	if  (document.getElementById('email').value.search("@") == -1 || document.getElementById('email').value.search("[.*]") == -1)

		 {

		  alert("Digite um e-mail valido!");

		  document.getElementById("email").style.border='solid 1px #f00';

		  document.getElementById("email").focus();

		  return false;

		 }

		document.getElementById("email").style.border='solid 1px #CCC';

	if (vazio_busca('fone','Fone')) return false;

	}

	

	if (vazio_busca('usuario','Usuario')) return false;

	

	

	if (document.getElementById('userBox').value == '')

	{

		alert('Este Usuario ja existe, por favor escolha outro!');

		document.getElementById('usuario').style.border='solid 1px #f00'; 

		return false;

	}

	document.getElementById('usuario').style.border='solid 1px #999'; 

	

	if (vazio_busca('senha','Senha')) return false;

	

	if (document.getElementById('senha').value.length <= 5)

	{

		alert('A senha deve ter no minimo 6 caracteres!');

		document.getElementById('senha2').style.border='solid 1px #f00'; 

		document.getElementById('senha').style.border='solid 1px #f00'; 

		return false;

	}

	

	if(document.getElementById('senha2').value!=document.getElementById('senha').value)

	{



		document.getElementById('senha2').value='';

		document.getElementById('senha').value='';

		alert('Repita corretamente a sua senha!');

		document.getElementById('senha').focus();

		document.getElementById('senha2').style.border='solid 1px #f00'; 

		document.getElementById('senha').style.border='solid 1px #f00'; 

		return false;

	}

	

	document.getElementById('senha2').style.border='solid 1px #999999';

	document.getElementById('senha').style.border='solid 1px #999999';

		

	if(document.getElementById('aceita').checked==false){

		alert('O contrato deve ser lido  o campo de de confirmacao marcado');

		document.getElementById('contrato').style.border='solid 1px #F00';

		return false;

	}

	else

	{

			document.getElementById('contrato').style.border='0px';

	}

		

	inserir();

	

	}

/*-----------------

Formulario de cadastro - Fisico

-----------------*/

function opcao_cad_fis()

{

	document.getElementById('resposta').innerHTML='<table width="100%"><tr><td width="20%">'+'Nome:'+'</td><td>'+'<input name="nome" type="text" class="box" id="nome" style="width:322px" onblur="this.style.border=\'solid 1px #999999\'" />'+'</td></tr><tr><td>'+'CPF:'+'</td><td>'+'<input name="cpf" type="text" class="box" id="cpf" onKeyPress="return mask(this.id,\'999.999.999-99\',event);" size="30" maxlength="14" onblur="this.style.border=\'solid 1px #999999\'" />'+'</td></tr></table>';

	

		document.getElementById('cont').innerHTML='<table width="100%"><tr><td width="20%">'+'E-mail:'+'</td><td>'+'<input name="email" type="text" class="box" id="email" style="width:322px" onblur="this.style.border=\'solid 1px #999999\'" />'+'</td></tr><tr><td>'+'Fone:'+'</td><td>'+'<input name="fone" type="text" class="box" id="fone" size="30" maxlength="14" onKeyPress="return mask(this.id,\'(99) 9999-9999\',event);" onblur="this.style.border=\'solid 1px #999999\'" />'+'</td></tr></table>';

		document.getElementById('tipo').value=2;

		mudar_pag();

				mudar();

}

/*-----------------

Formulario de cadastro - Juridico

-----------------*/

function opcao_cad_juri()

{

	document.getElementById('resposta').innerHTML='<table width="100%"><tr><td width="20%">'+'Raz&atilde;o social:'+'</td><td>'+'<input name="razao" type="text" class="box" id="razao" style="width:322px" onblur="this.style.border=\'solid 1px #999999\'" />'+'</td></tr><tr><td>'+'Nome Fantasia:'+'</td><td>'+'<input name="fantasia" type="text" class="box" id="fantasia" style="width:322px" onblur="this.style.border=\'solid 1px #999999\'" />'+'</td></tr><tr><td>'+'CNPJ:'+'</td><td>'+'<input name="cnpj" type="text" class="box" id="cnpj" size="30" maxlength="18" onKeyPress="return mask(this.id,\'99.999.999/9999-99\',event);" onblur="this.style.border=\'solid 1px #999999\'" />'+'</td></tr></table>';

			document.getElementById('cont').innerHTML='<table width="100%"><tr><td width="20%">'+'Respons&aacute;vel:'+'</td><td>'+'<input name="responsavel" type="text" class="box" id="responsavel" style="width:322px" onblur="this.style.border=\'solid 1px #999999\'" />'+'</td></tr><tr><td>'+'E-mail:'+'</td><td>'+'<input name="email" type="text" class="box" id="email" style="width:322px" maxlength="100" onblur="this.style.border=\'solid 1px #999999\'" />'+'</td></tr><tr><td>'+'Fone:'+'</td><td>'+'<input name="fone" type="text" class="box" id="fone" size="30" maxlength="14" onKeyPress="return mask(this.id,\'(99) 9999-9999\',event);" />'+'</td></tr><tr><td>'+'Celular:'+'</td><td>'+'<input name="celular" type="text" class="box" id="celular" size="30" maxlength="14" onKeyPress="return mask(this.id,\'(99) 9999-9999\',event);" />'+'(opcional)</td></tr></table>';

			document.getElementById('tipo').value="1";

			mudar_pag();

				mudar();

}



/*-----------------

Volta campo busca sem borda

-----------------*/

function volta()

{

	document.getElementById('termo_busca').style.border='0px;';

	}

/*-----------------

Marca opção busca

-----------------*/

function opcao_marca(opcao)

{

	marca=opcao;

	document.getElementById(marca).checked='checked';

}



/*-----------------

Valida campo vazio

-----------------*/

function vazio(campo, mensagem)

{

//limpa cor de fundo

  document.getElementById(campo).style.border='solid 1px #999999';

   i = '0';

  if (filtra(campo))

  {

	  i = '1';

	};

 if (document.getElementById(campo).value == '' || i == '1') 

 {

	document.getElementById(campo).style.border='solid 1px #f00'; 

	//posiciona o cursor no campo

    alert (' Preencha corretamente o campo ' + mensagem + '!');

	document.getElementById(campo).focus();

	//retorna verdadeiro se estiver vazio

    return true;

    }

	document.getElementById(campo).style.border='solid 1px #999999';

	//retorna falso se nao estiver vazio

	trans(campo);

	return false;

}



/*-----------------

Valida campo vazio busca

-----------------*/

function vazio_busca(campo, mensagem)

{

//limpa cor de fundo

  document.getElementById(campo).style.border='0px;';

  i = '0';

  if (filtra(campo))

  {

	  i = '1';

	};

 if (document.getElementById(campo).value == '' || i == '1') 

 {

	document.getElementById(campo).style.border='solid 1px #f00'; 

	//posiciona o cursor no campo

    alert (' Preencha corretamente o campo ' + mensagem + '!');

	document.getElementById(campo).focus();

	//retorna verdadeiro se estiver vazio

    return true;

    }

	//retorna falso se nao estiver vazio

	trans(campo);

	return false;

}



// ------------------------------------------------------------

function limpa_mask(campo)

{

	sValue = campo.value;

	while (sValue.indexOf('-')>=0)

		sValue = sValue.toString().replace( "-", "" );

	while (sValue.indexOf('.')>=0)

		sValue = sValue.toString().replace( ".", "" );

	while (sValue.indexOf('/')>=0)

		sValue = sValue.toString().replace( "/", "" );

	while (sValue.indexOf('(')>=0)

		sValue = sValue.toString().replace( "(", "" );

	while (sValue.indexOf(')')>=0)

		sValue = sValue.toString().replace( ")", "" );

	while (sValue.indexOf(' ')>=0)

		sValue = sValue.toString().replace( " ", "" );

	return sValue;

}



// ------------------------------------------------------------

function validacpf(campo)

{ 

	

	var i; 

	s = limpa_mask(campo);

	if (s.length==0)

		return true;

 	var c = s.substr(0,9); 

  	var dv = s.substr(9,2); 

  	var d1 = 0; 

  	for (i = 0; i < 9; i++) 

  		d1 += c.charAt(i)*(10-i); 

	if (d1 == 0)

	{ 

  		alert("CPF informado Invalido");

		document.getElementById('cpf').style.border='solid 1px #f00';

		campo.select();

  		return false; 

	}

  	d1 = 11 - (d1 % 11); 

  	if (d1 > 9) d1 = 0; 

  		if (dv.charAt(0) != d1) 

  		{ 

  			alert("CPF informado Invalido");

			campo.select();

			document.getElementById('cpf').style.border='solid 1px #f00';

  			return false; 

  		} 

  	d1 *= 2; 

  	for (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) 

  		{ 

  			alert("CPF informado Invalido"); 

			campo.select();

			document.getElementById('cpf').style.border='solid 1px #f00';

			return false; 

		} 

  	return true; 

} 



// ------------------------------------------------------------

function validacnpj(campo) 

{ 

	var numeros, digitos, soma, i, resultado, pos, tamanho, digitos_iguais; 

    digitos_iguais = 1;

	cnpj = limpa_mask(campo);

    if (cnpj.length < 14 && cnpj.length < 15) 

	{ 

  		alert("CNPJ informado Invalido");

		campo.select();

		document.getElementById('cnpj').style.border='solid 1px #f00';

  		return false; 

	}

    for (i = 0; i < cnpj.length - 1; i++) 

    	if (cnpj.charAt(i) != cnpj.charAt(i + 1)) 

        { 

         	digitos_iguais = 0; 

            break; 

        } 

    if (!digitos_iguais) 

    { 

		tamanho = cnpj.length - 2 

		numeros = cnpj.substring(0,tamanho); 

		digitos = cnpj.substring(tamanho); 

		soma = 0; 

		pos = tamanho - 7; 

		for (i = tamanho; i >= 1; i--) 

		{ 

			soma += numeros.charAt(tamanho - i) * pos--; 

			if (pos < 2) 

				pos = 9; 

		} 

		resultado = soma % 11 < 2 ? 0 : 11 - soma % 11; 

		if (resultado != digitos.charAt(0)) 

		{ 

			alert("CNPJ informado Invalido");

			campo.select();

			document.getElementById('cnpj').style.border='solid 1px #f00';

			return false; 

		}

		tamanho = tamanho + 1; 

		numeros = cnpj.substring(0,tamanho); 

		soma = 0; 

		pos = tamanho - 7; 

		for (i = tamanho; i >= 1; i--) 

		{ 

		  soma += numeros.charAt(tamanho - i) * pos--; 

		  if (pos < 2) 

				pos = 9; 

		} 

        resultado = soma % 11 < 2 ? 0 : 11 - soma % 11; 

        if (resultado != digitos.charAt(1)) 

		{ 

			alert("CNPJ informado Invalido");

			campo.select();

			document.getElementById('cnpj').style.border='solid 1px #f00';

			return false; 

		}

        return true; 

    } 

    else 

	{ 

  		alert("CNPJ Invalido");

		campo.select();

  		return false; 

	}

}

// JavaScript Document

/*** 

* Descrição.: formata um campo do formulário de 

* acordo com a máscara informada... 

* Parâmetros: - objForm (o Objeto Form) 

* - strField (string contendo o nome do textbox) 

* - sMask (mascara que define o formato que o dado será apresentado, 

* 		usando o algarismo "9" para definir números e o símbolo "!" para 

* 		qualquer caracter... 

* - evtKeyPress (evento) 

* Uso.......: <input type="textbox" name="xxx"..... 

* onkeypress="return mask(document.rcfDownload, 'str_cep', '99999-999', event);"> 

* Observação: As máscaras podem ser representadas como os exemplos abaixo: 

* CEP -> 99.999-999 

* CPF -> 999.999.999-99 

* CNPJ -> 99.999.999/9999-99 

* Data -> 99/99/9999 

* Tel Resid -> (99) 999-9999 

* Tel Cel -> (99) 9999-9999 

* Processo -> 99.999999999/999-99 

* C/C -> 999999-! 

***/

function mask(strField, sMask, evtKeyPress)

{

	var i, nCount, sValue, fldLen, mskLen,bolMask, sCod, nTecla;

	

	if(document.all) { // Internet Explorer

		nTecla = evtKeyPress.keyCode;

	}

	else {

        nTecla = evtKeyPress.which;

	}

	// bug do backspace

	if (navigator.appName != "Microsoft Internet Explorer")

        if (nTecla == 8) { 

           return true;

        }

	 

//	sValue = limpa_mask(objForm[strField]);

	sValue = limpa_mask(document.getElementById(strField));

	

	fldLen = sValue.length;

	mskLen = sMask.length;

	

	i = 0;

	nCount = 0;

	sCod = "";

	mskLen = fldLen;

	

	while (i <= mskLen)

	{

		bolMask = ((sMask.charAt(i) == "-") || (sMask.charAt(i) == ".") || (sMask.charAt(i) == "/"))

		bolMask = bolMask || ((sMask.charAt(i) == "(") || (sMask.charAt(i) == ")") || (sMask.charAt(i) == " "))

	

		if (bolMask)

		{

			sCod += sMask.charAt(i);

			mskLen++;

		}

		else

		{

			sCod += sValue.charAt(nCount);

			nCount++;

		}

		i++;

	}

	

	document.getElementById(strField).value = sCod;

	

	if (nTecla != 8) // backspace

		if (sMask.charAt(i-1) == "9") // apenas números...

			return ((nTecla > 47) && (nTecla < 58));// números de 0 a 9

	return true;

}

// Fim da Função Máscaras Gerais



/*-----------------

MASCARA R$

-----------------*/
function mascara_num(obj){
  valida_num(obj)
  if (obj.value.match("-")){
    mod = "-";
  }else{
    mod = "";
  }
  valor = obj.value.replace("-","");
  valor = valor.replace(",","");
  if (valor.length >= 3){
    valor = poe_ponto_num(valor.substring(0,valor.length-2))+","+valor.substring(valor.length-2, valor.length);
  }
  obj.value = mod+valor;
}
function poe_ponto_num(valor){
  valor = valor.replace(/\./g,"");
  if (valor.length > 3){
    valores = "";
    while (valor.length > 3){
      valores = "."+valor.substring(valor.length-3,valor.length)+""+valores;
      valor = valor.substring(0,valor.length-3);
    }
    return valor+""+valores;
  }else{
    return valor;
  }
}
function valida_num(obj){
  numeros = new RegExp("[0-9]");
  while (!obj.value.charAt(obj.value.length-1).match(numeros)){
    if(obj.value.length == 1 && obj.value == "-"){
      return true;
    }
    if(obj.value.length >= 1){
      obj.value = obj.value.substring(0,obj.value.length-1)
    }else{
      return false;
    }
  }
}

