function formatCurrency(num) {
num = num.toString().replace(/\$|\,/g,'');
if(isNaN(num))
num = "0";
sign = (num == (num = Math.abs(num)));
num = Math.floor(num*100+0.50000000001);
cents = num%100;
num = Math.floor(num/100).toString();
if(cents<10)
cents = "0" + cents;
for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
num = num.substring(0,num.length-(4*i+3))+'.'+
num.substring(num.length-(4*i+3));
return (((sign)?'':'-') + '' +  num + ',' + cents);
}

function verTecla() {
if (event.keyCode < 45 || event.keyCode > 57) event.returnValue = false;

}

 function checkValor(form) 
{
var subdescricao1 = 0; 
var subdescricao2 = 0;
var subdescricao3 = 0;
var subdescricao4 = 0;
var teste = 0;
if (document.calculo.faturamento.value > 0)
	subdescricao1 = eval(document.calculo.faturamento.value);
if (document.calculo.acumulado.value >= 0)
	subdescricao2 = ( eval(3));
if (document.calculo.acumulado.value > 60000)
	subdescricao2 = ( eval(4));
if (document.calculo.acumulado.value > 90000)
	subdescricao2 = ( eval(5));
if (document.calculo.acumulado.value > 120000)
	subdescricao2 = ( eval(5.4));
if (document.calculo.acumulado.value > 240000)
	subdescricao2 = ( eval(5.8));
if (document.calculo.acumulado.value > 360000)
	subdescricao2 = ( eval(6.2));
if (document.calculo.acumulado.value > 480000)
	subdescricao2 = ( eval(6.6));
if (document.calculo.acumulado.value > 600000)
	subdescricao2 = ( eval(7));
if (document.calculo.acumulado.value > 720000)
	subdescricao2 = ( eval(7.4));
if (document.calculo.acumulado.value > 840000)
	subdescricao2 = ( eval(7.8));
if (document.calculo.acumulado.value > 960000)
	subdescricao2 = ( eval(8.2));
if (document.calculo.acumulado.value > 1080000)
	subdescricao2 = ( eval(8.6));
if (document.calculo.acumulado.value > 1200000)
	subdescricao2 = ( eval(10.32));
if ((subdescricao1 == 0) && (subdescricao2 == 0) && (subdescricao3 == 0) && (subdescricao4 == 0))
	total = 0;
else {
total1 = (subdescricao1 * subdescricao2)/100;
total2 = (subdescricao2);
}
 document.calculo.valsimples.value =formatCurrency(total1);
 document.calculo.simples.value =(total2);
}