function setColor(src){
	src.style.cursor="hand";
	src.bgColor="#f5f5f5";
}
function getColor(src){
	src.bgColor = "#e5e5e5";
}
function setClick(src){
	window.location.href=src;
}
function setParentClick(src){
	window.parent.location.href=src;
}
//***** parte 2 **************************
function setColor2(src){
	src.style.cursor="hand";
	src.bgColor="#e5e5e5";
}
function getColor2(src){
	src.bgColor = "#f5f5f5";
}
//-----------------------------------------
function valida_cpf(cpf) {

	var cpf = new String(cpf);
    var aux_cpf = "";
	
	if(cpf.length!=11)
		return false;
		
    for(j=0;j<cpf.length;j++)
  		if(cpf.substr(j,1)>="0" && cpf.substr(j,1)<="9")
   			aux_cpf += cpf.substr(j,1);
	if(aux_cpf.length!=11)
		return false;
    else {
    	var cpf1 = String(aux_cpf);
    	var cpf2 = cpf.substr(cpf.length-2,2);
      	var controle = "";
      	var start = 2;
      	var end = 10;
      	for(var i=1;i<=2;i++) {
      		var soma = 0;
      		for(j=start;j<=end;j++)
      			soma += cpf1.substr((j-i-1),1)*(end+1+i-j);
        	if(i==2)
          		soma += digito * 2;
        	digito = (soma * 10) % 11;
        	if(digito==10)
          		digito = 0;
        	controle += digito;
        	start = 3;
        	end = 11;
      	}
      	if(controle!=cpf2)
        	return false;
    }
	return true;
}
function valida_cep(cep) {
	if(cep.length>9 || (cep.indexOf("-")==-1 && cep.length>8))
		return false;
	
	var pat = /((\d{5})(-)(\d{3}))|(\d{8})/;
	
	var cepdiv = cep.match(pat);
	
	if(cepdiv==null)
		return false;
	return true;
}
    function emailVerify(str) { 
        if(!str.match(/^[\w]{1}[\w\.\-_]*@[\w]{1}[\w\-_\.]*\.[\w]{2,6}$/i)) { 
            return false; 
        } else { 
            return true; 
        } 
    }  

    function ehNumero(str) { 
        if(!str.match('[0-9]+')) { 
            return false; 
        } else { 
            return true; 
        } 
    }  
	
	function todaysDate(){
		 var now = new Date();
		 var mName = now.getMonth() + 1;
		 var dName = now.getDay() + 1;
		 var dayNr = now.getDate();
		 var yearNr=now.getYear();
		 if(dName==1) Day = "Domingo";
		 if(dName==2) Day = "Segunda-feira";
		 if(dName==3) Day = "Ter&ccedil;a-feira";
		 if(dName==4) Day = "Quarta-feira";
		 if(dName==5) Day = "Quinta-feira";
		 if(dName==6) Day = "Sexta-feira";
		 if(dName==7) Day = "S&aacute;bado";
		 if(yearNr < 2000) Year = 1900 + yearNr;
		 else Year = yearNr;
		 if (mName < 10) mName = "0" + mName;
		 if (dayNr < 10) dayNr = "0" + dayNr;
		 return (" " + Day + ",&nbsp;" + dayNr + "/" + mName + "/" + Year);
		//-->
	}
 
	function wOpen(oQue) {
		switch (oQue){
			case "ged":
				if (screen.height == 600)
					newWin=window.open("http://wwwexe.lsc.ufsc.br/~etges/ged","null","height="+(screen.height-50)+",width="+(screen.width-7)+",status=no,toolbar=no,menubar=no,location=no,resizable=yes,titlebar=no,scrollbars=yes,fullscreen=no,top=0,left=0");
				else if (screen.height == 768)
					newWin=window.open("http://wwwexe.lsc.ufsc.br/~etges/ged","null","height="+(screen.height-60)+",width="+(screen.width-7)+",status=no,toolbar=no,menubar=no,location=no,resizable=yes,titlebar=no,scrollbars=yes,fullscreen=no,top=0,left=0");
				else 
					newWin=window.open("http://wwwexe.lsc.ufsc.br/~etges/ged","null","height="+(screen.height-60)+",width="+(screen.width-7)+",status=no,toolbar=no,menubar=no,location=no,resizable=yes,titlebar=no,scrollbars=yes,fullscreen=no,top=0,left=0");
				break;
		}
	}
	
	function dataCompleta(objeto){
		if(event.keyCode!=8){
			tamanho=objeto.value.length;
			if(((tamanho==2)&&(objeto.value.substring(1,2)!="/"))||((tamanho==5)&&!((objeto.value.substring(3,4)=="/")||
				(objeto.value.substring(4,5)=="/"))&&(objeto.value.substring(1,2)!="/"))){
				objeto.value=objeto.value+"/";}
		}
	}
	
	function comparaData(dataMenor,dataMaior){
		dataMenorAMD=dataMenor.substring(6,10)+""+dataMenor.substring(3,5)+""+dataMenor.substring(0,2);
		dataMaiorAMD=dataMaior.substring(6,10)+""+dataMaior.substring(3,5)+""+dataMaior.substring(0,2);
		if(dataMaiorAMD>=dataMenorAMD){
			return true;}
		else{
			return false;}
	}
	
	function dataVerifica(objeto){
		problema=false;
		qtBarra=0;
		tamanho=objeto.value.length;
		if(tamanho>4){
			caracteres="0123456789/";
			for(i=0;i<tamanho;i++){
				algarismo=objeto.value.substring(i,i+1);
				if((caracteres.search(algarismo)==-1)&&!(problema)){
					msg="Data inválida!\n";
					msg+=" - Data informada: "+objeto.value+"\n\n";
					msg+="Verificação: \n";
					msg+=" - Caracter informado inválido;\n\n";
					msg+="Informações úteis: \n";
					msg+=" - Caracteres válidos para compor a data: \n   -> 1,2,3,4,5,6,7,8,9,0 e '/'(separador);\n";
					alert(msg);
					problema=true;
				}
				if(algarismo=="/"){
					qtBarra++;
				}
			}
			if(!(problema)){
				if(qtBarra>2){
					msg="Data inválida!\n";
					msg+=" - Data informada: "+objeto.value+"\n\n";
					msg+="Verificação: \n";
					msg+=" - Caracter informado inválido;\n\n";
					msg+="Informações úteis: \n";
					msg+=" - Caracteres válidos para compor a data: \n   -> 1,2,3,4,5,6,7,8,9,0 e '/'(separador);\n";
					msg+=" - Formato da data: dd/mm/aaaa";
					alert(msg);
					problema=true;
				}
			}
			if(!(problema)){
				for(i=0;i<tamanho;i++){
					algarismo=objeto.value.substring(i,i+1);
					if(algarismo=="/"){
						if(i==1){
							objeto.value="0"+objeto.value;
						}
						else
						if(i==4){
							objeto.value=objeto.value.substring(0,3)+"0"+objeto.value.substring(3,10);
						}
					}
				}
				tamanho=objeto.value.length;
				if(tamanho<10){
					ano=parseFloat(objeto.value.substring(6,10));
					if((ano>0)&&(ano<30)){
						anoi="20";
						if(ano<10){
							anoi="200";
						}
						objeto.value=objeto.value.substring(0,6)+""+anoi+ano;
					}
					if((ano>29)&&(ano<100)){
						objeto.value=objeto.value.substring(0,6)+"19"+ano;
					}
					if((ano>99)&&(ano<999)){
						objeto.value=objeto.value.substring(0,6)+"0"+ano;
					}
				}
			}
			tamanho=objeto.value.length;
			dia=objeto.value.substring(0,2);
			mes=objeto.value.substring(3,5);
			ano=objeto.value.substring(6,10);
			barra1=objeto.value.substring(2,3);
			barra2=objeto.value.substring(5,6);
			if(!(problema)){
				if((barra1!="/")||(barra2!="/")){
					alert("Formato da data inválido. Exemplo: 01/01/2002");
					problema=true;
				}
			}
			if(!(problema)){
				if(tamanho!=10){
					msg="Ano informado inválido!\n";
					msg+=" - Ano Informado: "+ano+"\n\n";
					msg+="Verificação: \n";
					msg+=" - Ano informado diferente do formato (aaaa);\n\n";
					msg+="Informações úteis: \n";
					msg+=" - O ano deve conter 4 caracteres;\n";
					alert(msg);
					problema=true;
				}
			}
			if(!(problema)){
				if((parseFloat(mes)>12)||(parseFloat(mes)<1)){
					msg="Mês informado inválido!\n";
					msg+=" - Mês Informado: "+mes+"\n\n";
					msg+="Verificação: \n";
					msg+=" - Dia informado maior que 12;\n";
					msg+=" - Mês Informado menor que 01;\n\n";
					msg+="Informações úteis: \n";
					msg+=" - Mês informado: "+mes+";\n";
					alert(msg);
					problema=true;
				}
			}
			if(!(problema)){
				maiorDia=new Date(ano,mes,0);
				maiorDia=maiorDia.getDate();
				if((parseFloat(dia)>maiorDia)||(parseFloat(dia)<1)){
					msg="Dia informado inválido!\n";
					msg+=" - Dia Informado: "+dia+"\n\n";
					msg+="Verificação: \n";
					msg+=" - Dia informado igual a 00;\n";
					msg+=" - Dia informado não existe no mês informado;\n\n";
					msg+="Informações úteis: \n";
					msg+=" - Mês informado: "+mes+";\n";
					msg+=" - Último dia do mês: "+maiorDia+";";
					alert(msg);
					problema=true;
				}
			}
		}
		else
		if(tamanho>0){
			msg="Data inválida!\n";
			msg+=" - Data informada: "+objeto.value+"\n\n";
			msg+="Verificação: \n";
			msg+=" - Data incompleta;\n\n";
			msg+="Informações úteis: \n";
			msg+=" - Formato da data: dd/mm/aaaa";
			alert(msg);
			problema=true;
		}
		if(problema){
			objeto.value="";
			objeto.focus();
			return true;
		}
	}
	
	//É número inteiro


//Formatando números (9.99)
function formata_numero(numero){
	if ((numero==null) || (numero=='')){
		numero = 0.00;
		return numero;
	}

	string_ponto = numero.toString()
	posicao_ponto = string_ponto.indexOf(".")
	if (posicao_ponto!= -1){
		numero = string_ponto.replace("." , "");
	}

	string_virgula = numero.toString()
	posicao_virgula = string_virgula.indexOf(",")
	if (posicao_virgula!= -1){
		numero = string_virgula.replace("," , ".");
	}

	numero_formatado = (parseFloat(numero) * 1000)/10;
	numero_formatado = parseInt(numero_formatado);
	numero_ultimo_digito = numero * 1000;
	numero_ultimo_digito = parseInt(numero_ultimo_digito);

	string_numero = numero_ultimo_digito.toString();
	ultimo_digito = string_numero.substring(string_numero.length-1,string_numero.length);

	if (ultimo_digito>=5){
		numero_formatado = numero_formatado + 1;
	}
	numero_formatado = numero_formatado / 100;
	return parseFloat(numero_formatado);
}


//Formatando números (9.999,99)

function formata_valor(numero) {
	numero_formatado = (parseFloat(numero) * 1000)/10;
	numero_formatado = parseInt(numero_formatado);
	numero_formatado = numero_formatado.toString();
	var tam = numero_formatado.length;

	if ( tam <= 1 ){
		numero_formatado = '0,0' + numero_formatado.substr( tam - 2, tam ); }
	if ( tam == 2 ){
		numero_formatado = '0,' + numero_formatado.substr( tam - 2, tam ); }
	if ( (tam > 2) && (tam <= 5) ){
		numero_formatado = numero_formatado.substr( 0, tam - 2 ) + ',' + numero_formatado.substr( tam - 2, tam ); }
	if ( (tam >= 6) && (tam <= 8) ){
		numero_formatado = numero_formatado.substr( 0, tam - 5 ) + '.' + numero_formatado.substr( tam - 5, 3 ) + ',' + numero_formatado.substr( tam - 2, tam ) ; }
	if ( (tam >= 9) && (tam <= 11) ){
		numero_formatado = numero_formatado.substr( 0, tam - 8 ) + '.' + numero_formatado.substr( tam - 8, 3 ) + '.' + numero_formatado.substr( tam - 5, 3 ) + ',' + numero_formatado.substr( tam - 2, tam ) ; }
	if ( (tam >= 12) && (tam <= 14) ){
		numero_formatado = numero_formatado.substr( 0, tam - 11 ) + '.' + numero_formatado.substr( tam - 11, 3 ) + '.' + numero_formatado.substr( tam - 8, 3 ) + '.' + numero_formatado.substr( tam - 5, 3 ) + ',' + numero_formatado.substr( tam - 2, tam ) ; }
	if ( (tam >= 15) && (tam <= 17) ){
		numero_formatado = numero_formatado.substr( 0, tam - 14 ) + '.' + numero_formatado.substr( tam - 14, 3 ) + '.' + numero_formatado.substr( tam - 11, 3 ) + '.' + numero_formatado.substr( tam - 8, 3 ) + '.' + numero_formatado.substr( tam - 5, 3 ) + ',' + numero_formatado.substr( tam - 2, tam ) ;}
	return numero_formatado;
}
function validarResposta(resposta){
		for(i=0;i<resposta.length;i++){
		  if(resposta[i].checked){
			return true;
		  }
		}
		return false;
	}

// Calculo do CNPJ 
function valida_cnpj(cnpj) {
	var erro = true; 
	var aux_cnpj = "";	
	var cnpj1=0,cnpj2=0;
	for(j=0;j<cnpj.length;j++)
		if(cnpj.substr(j,1)>="0" && cnpj.substr(j,1)<="9")
			aux_cnpj += cnpj.substr(j,1);
	if(aux_cnpj.length!=14)
		erro = false;
	else {
		cnpj1 = aux_cnpj.substr(0,12);
		cnpj2 = aux_cnpj.substr(aux_cnpj.length-2,2);
		fator = "543298765432";
		controle = "";
		for(j=0;j<2;j++) {
			soma = 0;
			for(i=0;i<12;i++) 
				soma += cnpj1.substr(i,1) * fator.substr(i,1);
			if(j==1) soma += digito * 2;
			digito = (soma * 10) % 11;
			if(digito==10) digito = 0;
			controle += digito;
			fator = "654329876543";
		} 
		if(controle!=cnpj2)
			erro = false;
	} 
	return erro;
}

// Validação do CPF
function valida_cpf(cpf) {

	var cpf = new String(cpf);
    var aux_cpf = "";
	
	if(cpf.length!=11)
		return false;
		
    for(j=0;j<cpf.length;j++)
  		if(cpf.substr(j,1)>="0" && cpf.substr(j,1)<="9")
   			aux_cpf += cpf.substr(j,1);
	if(aux_cpf.length!=11)
		return false;
    else {
    	var cpf1 = String(aux_cpf);
    	var cpf2 = cpf.substr(cpf.length-2,2);
      	var controle = "";
      	var start = 2;
      	var end = 10;
      	for(var i=1;i<=2;i++) {
      		var soma = 0;
      		for(j=start;j<=end;j++)
      			soma += cpf1.substr((j-i-1),1)*(end+1+i-j);
        	if(i==2)
          		soma += digito * 2;
        	digito = (soma * 10) % 11;
        	if(digito==10)
          		digito = 0;
        	controle += digito;
        	start = 3;
        	end = 11;
      	}
      	if(controle!=cpf2)
        	return false;
    }
	return true;
}

<!-- essa é a parte da conferção de números !-->
function validarNumero(objeto){
		numero=new String(objeto.value);
		original=numero;
		correto=true;
		if (numero!=''){ //não é vazio
			tamanho=numero.length;
			posicaoVirgula=tamanho;
			caracteres="01234567890,.";
			i=0; virgula=false;
			while((correto)&&(i<tamanho)){ //verifica se são caracteres válidos
				algarismo=numero.substring(i, i+1);
				if(caracteres.indexOf(algarismo)==-1)
					correto=false;
				if (algarismo==','){ //conta o número de vírgulas(máximo uma)
				  if (!virgula){
					virgula=true;
					posicaoVirgula=i;
				  }else
					correto=false;
				}
				i++;
			}
			if (correto){ //verfica os pontos de separacao de milhar
				while((numero.indexOf(".")!=-1)&&(correto)){
					posicaoPonto=numero.indexOf(".");
					if ((posicaoPonto>posicaoVirgula)||(((posicaoPonto-posicaoVirgula)%4)!=0)||(posicaoPonto==0))
						correto=false;
					else{
						numero=numero.replace("." , "");
						posicaoVirgula--;
					}
				}
			}
			if (correto) //função que formata o número
				numero=formataNumero(numero);
		}
		if (correto){
			objeto.value=numero;
			return true;
		}else{
			alert('O valor digitado "'+original+'" não é um número válido!');
			objeto.value=original;
			objeto.focus();
			objeto.select();
			return false;
		}
	}

	function formataNumero(numero) {
		numero=numero.replace(",",".");
		numero_formatado = (parseFloat(numero) * 1000)/10;
		numero_formatado = parseInt(numero_formatado);
		numero_formatado = numero_formatado.toString();
		var tam = numero_formatado.length;
	
		if ( tam <= 1 ){
			numero_formatado = '0,0' + numero_formatado.substr( tam - 2, tam ); }
		if ( tam == 2 ){
			numero_formatado = '0,' + numero_formatado.substr( tam - 2, tam ); }
		if ( (tam > 2) && (tam <= 5) ){
			numero_formatado = numero_formatado.substr( 0, tam - 2 ) + ',' + numero_formatado.substr( tam - 2, tam ); }
		if ( (tam >= 6) && (tam <= 8) ){
			numero_formatado = numero_formatado.substr( 0, tam - 5 ) + '.' + numero_formatado.substr( tam - 5, 3 ) + ',' + numero_formatado.substr( tam - 2, tam ) ; }
		if ( (tam >= 9) && (tam <= 11) ){
			numero_formatado = numero_formatado.substr( 0, tam - 8 ) + '.' + numero_formatado.substr( tam - 8, 3 ) + '.' + numero_formatado.substr( tam - 5, 3 ) + ',' + numero_formatado.substr( tam - 2, tam ) ; }
		if ( (tam >= 12) && (tam <= 14) ){
			numero_formatado = numero_formatado.substr( 0, tam - 11 ) + '.' + numero_formatado.substr( tam - 11, 3 ) + '.' + numero_formatado.substr( tam - 8, 3 ) + '.' + numero_formatado.substr( tam - 5, 3 ) + ',' + numero_formatado.substr( tam - 2, tam ) ; }
		if ( (tam >= 15) && (tam <= 17) ){
			numero_formatado = numero_formatado.substr( 0, tam - 14 ) + '.' + numero_formatado.substr( tam - 14, 3 ) + '.' + numero_formatado.substr( tam - 11, 3 ) + '.' + numero_formatado.substr( tam - 8, 3 ) + '.' + numero_formatado.substr( tam - 5, 3 ) + ',' + numero_formatado.substr( tam - 2, tam ) ;}
		return numero_formatado;	
	}

	function ehInteiro(numero){
		correto=true;
		if (numero!=''){ //não é vazio
			tamanho=numero.length;
			caracteres="01234567890";
			i=0; 
			while((correto)&&(i<tamanho)){ //verifica se são caracteres válidos
				algarismo=numero.substring(i, i+1);
				if(caracteres.indexOf(algarismo)==-1)
					correto=false;
				i++;
			}
		}
		return correto;
	}

	function ehDecimal(objeto){
		numero=new String(objeto.value);
		original=numero;
		correto=true;
		if (numero!=''){ //não é vazio
			tamanho=numero.length;
			posicaoVirgula=tamanho;
			caracteres="01234567890,.";
			i=0; virgula=false;
			while((correto)&&(i<tamanho)){ //verifica se são caracteres válidos
				algarismo=numero.substring(i, i+1);
				if(caracteres.indexOf(algarismo)==-1)
					correto=false;
				if (algarismo==','){ //conta o número de vírgulas(máximo uma)
				  if (!virgula){
					virgula=true;
					posicaoVirgula=i;
				  }else
					correto=false;
				}
				i++;
			}
			if (correto){ //verfica os pontos de separacao de milhar
				while((numero.indexOf(".")!=-1)&&(correto)){
					posicaoPonto=numero.indexOf(".");
					if ((posicaoPonto>posicaoVirgula)||(((posicaoPonto-posicaoVirgula)%4)!=0)||(posicaoPonto==0))
						correto=false;
					else{
						numero=numero.replace("." , "");
						posicaoVirgula--;
					}
				}
			}
		}
		if (correto){
			objeto.value=numero;
			return true;
		}else{
			alert('O valor digitado "'+original+'" não é um número válido!');
			objeto.focus();
			objeto.select();
			return false;
		}
	}
	
//***************************
// ismael@admin.com.br
// se mudar, envia para que possamos ver.
// http://meuregistro.zardack.com.br
//***************************

function FormataCPF(pForm,pCampo,pTamMax,pPos1,pPos2,pPosTraco,pTeclaPres){
 var wTecla, wVr, wTam;
 
       // alert(pForm[pCampo].value);
  
 wTecla = pTeclaPres.keyCode;
 wVr = pForm[pCampo].value;
 wVr = wVr.toString().replace( "-", "" );
 wVr = wVr.toString().replace( ".", "" );
 wVr = wVr.toString().replace( ".", "" );
 wVr = wVr.toString().replace( "/", "" );
 wTam = wVr.length ;

 if (wTam < pTamMax && wTecla != 8) { 
    wTam = wVr.length + 1 ; 
 }

 if (wTecla == 8 ) { 
    wTam = wTam - 1 ; 
 }
   
 if ( wTecla == 8 || wTecla == 88 || wTecla >= 48 && wTecla <= 57 || wTecla >= 96 && wTecla <= 105 ){
  if ( wTam <= 2 ){
    pForm[pCampo].value = wVr ;
  }
  if (wTam > pPosTraco && wTam <= pTamMax) {
        wVr = wVr.substr(0, wTam - pPosTraco) + '-' + wVr.substr(wTam - pPosTraco, wTam);
  }
  if ( wTam == pTamMax){
        wVr = wVr.substr( 0, wTam - pPos1 ) + '.' + wVr.substr(wTam - pPos1, 3) + '.' + wVr.substr(wTam - pPos2, wTam);
  }
  pForm[pCampo].value = wVr;
 
 }

}
//------------------------------------------------------------------------------------- fim
//formata campo de telefone --------------------------------------------------------- inicio
function TelefoneFormat(Campo, e) {
	var key = '';
	var len = 0;
	var strCheck = '0123456789';
	var aux = '';
	var whichCode = (window.Event) ? e.which : e.keyCode;
	
	if (whichCode == 13 || whichCode == 8 || whichCode == 0)
	{
		return true;  // Enter backspace ou FN qualquer um que não seja alfa numerico
	}
	key = String.fromCharCode(whichCode);
	if (strCheck.indexOf(key) == -1){
		return false;  //NÃO E VALIDO
	}
	
	aux =  Telefone_Remove_Format(Campo.value);
	
	len = aux.length;
	if(len>=10)
	{
		return false;	//impede de digitar um telefone maior que 10
	}
	aux += key;
	
	Campo.value = Telefone_Mont_Format(aux);
	return false;
}

function  Telefone_Mont_Format(Telefone)
{
	var aux = len = '';
	
	len = Telefone.length;
	if(len<=9)
	{
		tmp = 5;
	}
	else
	{
		tmp = 6;
	}
	
	aux = '';
	for(i = 0; i < len; i++)
	{
		if(i==0)
		{
			aux = '(';
		}
		aux += Telefone.charAt(i);
		if(i+1==2)
		{
			aux += ')';
		}
		
		if(i+1==tmp)
		{
			aux += '-';
		}
	}
	return aux ;
}

function  Telefone_Remove_Format(Telefone)
{
	var strCheck = '0123456789';
	var len = i = aux = '';
	len = Telefone.length;
	for(i = 0; i < len; i++)
	{
		if (strCheck.indexOf(Telefone.charAt(i))!=-1)
		{
			aux += Telefone.charAt(i);
		}
	}
	return aux;
}
//------------------------------------------------------------------------------- fim
// formata placa de veículos ---------------------------------------------------- inicio
function ConsistePlaca(Tecla)
{
	//Verifica a quantidade de valores, se for menor igual a 3 ele veriufica se é letra
	//se nao for retorna nulo
	if (document.form.Placa.value.length <= 2)
  { 
    if (Tecla > 96 && Tecla < 123)
    {
     event.returnValue = true;
    }
		else
		{
		 event.returnValue = false;	 
		}
  }
	else if(document.form.Placa.value.length == 3)
	{
	document.form.Placa.value += "-";
	event.returnValue = false;
	}
	//Se a quantidade de valores for maior que 3 ele verifica se é numero 
	//se nao for retorna nulo
	else if (Tecla > 47 && Tecla < 58)
	{
	 event.returnValue = true;
	}
	else 
	{
	event.returnValue = false;
  }
}
//--------------------------------------------------------------------------------- fim
// deixa digitar somente número --------------------------------------------------- inicio
function numerico(Campo, e,num) {
	var key = '';
	var len = 0;
	var strCheck = '0123456789';
	var aux = '';
	var whichCode = (window.Event) ? e.which : e.keyCode;
	
	if (whichCode == 13 || whichCode == 8 || whichCode == 0)
	{
		return true;  // Enter backspace ou FN qualquer um que não seja alfa numerico
	}
	key = String.fromCharCode(whichCode);
	if (strCheck.indexOf(key) == -1){
		return false;  //NÃO E VALIDO
	}
	
	aux =  num_Remove_Format(Campo.value);
	
	len = aux.length;
	if(len>=num)
	{
		return false;	//impede de digitar um telefone maior que 10
	}
	aux += key;
	
	Campo.value = num_Mont_Format(aux);
	return false;
}

function  num_Mont_Format(Telefone)
{
	var aux = len = '';
	
	len = Telefone.length;
	if(len<=9)
	{
		tmp = 5;
	}
	else
	{
		tmp = 6;
	}
	
	aux = '';
	for(i = 0; i < len; i++)
	{
		if(i==0)
		{
			aux = '';
		}
		aux += Telefone.charAt(i);
		if(i+1==2)
		{
			aux += '';
		}
		
		if(i+1==tmp)
		{
			aux += '';
		}
	}
	return aux ;
}

function  num_Remove_Format(Telefone)
{
	var strCheck = '0123456789';
	var len = i = aux = '';
	len = Telefone.length;
	for(i = 0; i < len; i++)
	{
		if (strCheck.indexOf(Telefone.charAt(i))!=-1)
		{
			aux += Telefone.charAt(i);
		}
	}
	return aux;
}
//-----------------------------------------------------------------fim
function findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function ShowHideLayers() { //v3.0
  var i,p,v,obj,args=ShowHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}
setTimeout("ShowHideLayers('MessageLayer','','hide');",10000);

