	var ativo=1;
	d1="div_carros"
	d2="div_motos"
	d3="div_caminhoes"
	if (ativo<1)  ativo=1;
	function MudaForm(para){
		eval("document.getElementById('"+eval("d"+ativo)+"').style.display='none';");
		eval("document.getElementById('"+eval("d"+para)+"').style.display='';");
		ativo=para;
		if (ativo==1){document.getElementById('linha1').style.width='70px';}else{document.getElementById('linha1').style.width='49px';}
	}
function getkey(e)
{
if (window.event)
   return window.event.keyCode;
else if (e)
   return e.which;
else
   return null;
}
var texto="";
function FormatPreco(e, goods, word)
{
	var key, keychar;
	key = getkey(e);
	texto=word;
	
	if (key == null) return true;
    
	keychar = String.fromCharCode(key);
	keychar = keychar.toLowerCase();
	goods = goods.toLowerCase();

	if (goods.indexOf(keychar) != -1)
		 return true; 

	if ( key==null || key==0 || key==8 || key==9 || key==13 || key==27 )
  		 return true;
	
	return false;
}
var num="1234567890";
var num1="1234567890abcdefghijklmnopqrstuvxwyz_.@";
function VerAno(campo){
	//ano=1980;
	//if (campo.value>0){
	  //if (campo.value<ano-40 || campo.value>ano+1 ) {
		//alert("Ano inválido!\n("+(ano-40) + " a "+(ano+1)+")");
		//campo.select();}
	//}
}
function RetFormato(campo){
  	l=campo.length
	
	fim=l;
	//if (fim>14) fim=14;
	for(i=l-1, j=0, c="",p="";i>-1;i--)
		if(num.indexOf(campo.charAt(i))>-1)
			c=campo.charAt(i)+c;			

	if (c.charAt(0)=='0')
		c=c.substring(1,c.length);

	return c;
}
function InsFormato1(Telefone){
  	l=Telefone.value.length
	k=texto.length;
  
  if(k==l){
	
  }else{

	fim=l;

	for(i=l-1, j=0, c="",p="";i>-1;i--){
		if(num.indexOf(Telefone.value.charAt(i))>-1){
			j++
			c=Telefone.value.charAt(i)+c;	
			if(j==1 && Telefone.value.charAt(i-1)!=' ')  c="."+c; 		
		}
	}
	if (c.charAt(0)=='0'){
		c=c.substring(1,c.length);
	}
	//if(c.length>0)  c="R$ "+c;
	Telefone.value=c;
	texto=Telefone.value;
	//Submeter();
  }
}
function InsFormato(Telefone){
  	l=Telefone.value.length
	k=texto.length;
  
  if(k==l){
	
  }else{

	fim=l;
	//if (fim>14) fim=14;
	for(i=l-1, j=0, c="",p="";i>-1;i--){
		if(num.indexOf(Telefone.value.charAt(i))>-1){
			j++
			c=Telefone.value.charAt(i)+c;	
			if(j%3==0 && Telefone.value.charAt(i-1)!=' ')  c="."+c; 		
		}
	}
	if (c.charAt(0)=='0'){
		c=c.substring(1,c.length);
	}
	if(c.length>0)  c="R$ "+c;
	Telefone.value=c;
	texto=Telefone.value;
	Submeter();
  }
}
function Submeter(){
	f= "f"+ativo; 
	eval("document."+f+".fprei.value=RetFormato(document."+f+".fpre1.value)");
	eval("document."+f+".fpref.value=RetFormato(document."+f+".fpre2.value)");
	//document.f.submit();
}

 
 function CapturarF5(){
  	var tecla=window.event.keyCode;
	//var f = window.frames['direita'];
  	if (tecla==116) {
		event.keyCode=0;
		event.returnValue=false;
		document.location.reload(); 
	}
}

