function somente_numero(campo){
    var digits="0123456789,."
    var campo_temp 
    for (var i=0;i<campo.value.length;i++){
      campo_temp=campo.value.substring(i,i+1)    
      if (digits.indexOf(campo_temp)==-1){
            campo.value = campo.value.substring(0,i);
            break;
       }
    }
}

function troca(c) {
campo=c;
setTimeout("exec_troca()",1);
}

function exec_troca() {
campo.value = virgula(campo.value);
}

function virgula(texto) {
texto = texto.replace(",",".");
return texto;
}

function SomenteNumero(e){
    var tecla=(window.event)?event.keyCode:e.which;
    if((tecla > 47 && tecla < 58)) return true;
    else{
    if (tecla != 8) return false;
    else return true;
    }
}
