function numerosVerificar(event)
{
    var intCodigo = event.keyCode  ? event.keyCode  :
                    event.charCode ? event.charCode :
                    event.which    ? event.which    : void 0;
    
    if((intCodigo >= 48) && (intCodigo <= 57))
        return true;
    else
        return false;
}

function alterarCesta(intOrdem, intProduto)
{
    intQuantidade = document.getElementById("txtQuantidade" + intOrdem).value;
    document.location.href = "produtos_internacional_alterar.php?id=" + intProduto + "&qtd=" + intQuantidade;
}

function atualizarFrete()
{
    if(document.frmCesta.cboFrete.value == "0")
    {
        document.getElementById("blnProsseguir").value = "0";
        document.getElementById("objValorFrete").innerHTML = "";
        document.getElementById("objValorTotal").innerHTML = "";
    }
}

function calcularFreteInternacional($strIdentificador)
{
    if(document.frmCesta.cboFrete.value == "0")
    {
        alert("Please select the Shipping Method.");
    }
    else
    {
        xajax_calcularFreteInternacional(document.frmCesta.cboFrete.value, $strIdentificador);
    }
}

function frete_calculado($fltValor, $fltValorFormatado)
{
    document.getElementById("blnProsseguir").value = "1";
    document.getElementById("objValorFrete").innerHTML = "$ " + $fltValor;
    total_calculado($fltValorFormatado);
}

function frete_erro(strErro)
{
    document.getElementById("blnProsseguir").value = "0";
    document.getElementById("objValorFrete").innerHTML = "";
    document.getElementById("objValorTotal").innerHTML = "";
    alert("Wrong freight calculation: Maximum weight exceeded.");
}

function roundNumber(rnum)
{
    return Math.round(rnum*Math.pow(10,2))/Math.pow(10,2);
}

function float2moeda(num)
{
    x = 0;
    
    if(num<0)
    {
        num = Math.abs(num);
        x = 1;
    }
    
    if(isNaN(num)) num = "0";
    
    cents = Math.floor((num*100+0.5)%100);
    
    num = Math.floor((num*100+0.5)/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));
    
    ret = num + ',' + cents;
    
    if (x == 1) ret = ' - ' + ret;
    
    return ret;
}

function moeda2float(moeda)
{
    moeda = moeda.replace(".","");
    moeda = moeda.replace(",",".");
    return parseFloat(moeda);
}