/* Inclusão de somente dígitos no campo escolhido.
 * ex: onKeyPress="return SoNumeros(event);" */
function SoNumeros(e) 
{
    if (window.event) { ctecla = e.keyCode; }
	else { ctecla = e.which; }
	tecla = String.fromCharCode(ctecla);
	er = /[0-9.,]+/;
	return er.test(tecla);
} 

function ContaQuantidadeCaracteres(Campo, Id, TamanhoMaximo) 
{
    var quantosFaltam = TamanhoMaximo - Campo.value.length;
    document.getElementById(Id).innerHTML = quantosFaltam;
    //document.getElementsByName(Id).innerHTML = quantosFaltam;
    if (quantosFaltam > 0) 
    {
        //window.alert(quantosFaltam);
        return true;
    }
    else 
    {
        return false;
    }
}
function MudaFoco(txtPerdeFoco,txtRecebeFoco,tamanho)
{
    if(txtPerdeFoco.value.length == tamanho)
    {
        
        txtRecebeFoco.focus();   
    }
    
}
function LimparMsg(controle, controle2, controle3)
{
        document.getElementById(controle).value = '0';       
        document.getElementById(controle2).innerHTML = '';       
        document.getElementById(controle3).innerHTML = '';       
}

function LimparTexto(txt, lbl)
{
    document.getElementById(txt).innerHTML = '';       
    document.getElementById(lbl).innerHTML = '';       
}

function desmarcaRadioButton(obj) 
{        
    var numero_item;
    numero_item = "";
    for (var i=0;i<document.forms(0).elements.length;i++) {
        var e = document.forms(0).elements;
        if (e.type=="radio" ) {
            e.checked = false;
        }
    }
    obj.checked = true;
}
