function mascara_preco (ob) {
	var aux = ""
	ob.value = ob.value.replace(",","");
	ob.value = ob.value.replace(".","");
	ob.value = limpaString(ob.value);
	var cont = 0;
	if(ob.value.length >= 6) {
		for(i=0;i<ob.value.length;i++) {
			if(i == ob.value.length - 5)
				aux += ".";
			if(i == ob.value.length - 8) {
			  if(ob.value.length==9)
				aux += ".";
			}
			aux += ob.value.substring(i,i+1);
			cont++;
		}
		ob.value = aux;
		aux = "";
	}
	if(ob.value.length >= 3) {
		cont = 0;
		for(i=0;i<ob.value.length;i++) {
			if(i == ob.value.length - 2)
				aux += ",";				
			aux += ob.value.substring(i,i+1);
			cont++;
		}
		ob.value = aux;		
	}
	
}
function corrige(valor) {
	if(valor.value.length==2) {
		valor.value = "0,"+valor.value;
	}
	if(valor.value.length==1) {
		valor.value = "0,0"+valor.value;
	}	
}
function teclaReal (e)  {
	if(window.event) // IE
	{
		keynum = e.keyCode
	}
	else if(e.which) // Netscape/Firefox/Opera
	{
		keynum = e.which
	}
	if(e.keyCode!=9 && e.keyCode!=40 && e.keyCode!=39 && e.keyCode!=38 && e.keyCode!=37) {
		if(keynum !=8) {
			keychar = String.fromCharCode(keynum);
			numcheck = /\d/;		
			return numcheck.test(keychar);	
		}
	}
}
function limpaString (str) {
	var	aux = "";
	for(i=0;i<str.length;i++) {			
		if(parseInt(str.substring(i,i+1)) || parseInt(str.substring(i,i+1)) == 0)
				aux += str.substring(i,i+1);
	}
	
	return aux;
}