function validate() {

    document.getElementById('aviso').click();
    return true;
}
Page_IsValid = false;

function showWarning() { document.getElementById('light').style.display = 'block'; document.getElementById('fade').style.display = 'block'; }
function hideWarning() { document.getElementById('light').style.display = 'none'; document.getElementById('fade').style.display = 'none' }
function trim(str) { str += ''; whitespace = " \n\r\t\f\x0b\xa0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000"; var l = str.length; for (i = 0; i < l; i++) { if (whitespace.indexOf(str.charAt(i)) === -1) { str = str.substring(i); break; } } l = str.length; for (i = l - 1; i >= 0; i--) { if (whitespace.indexOf(str.charAt(i)) === -1) { str = str.substring(0, i + 1); break; } } return whitespace.indexOf(str.charAt(0)) === -1 ? str : ''; }
/*function hideNoScript() { document.getElementById('noscript').style.display = 'none'; document.getElementById('fadenoscript').style.display = 'none' }*/
function hook() {
    if (Page_IsValid == false) EndRequestHandler();
    if (location.href.indexOf('#vld') == -1) location.href = location.href + '#vld'; //else location.href = location.href;
}
function EndRequestHandler() { if (document.getElementById('light')) hideWarning(); }
function showback() { var o = document.getElementById('backlink'); if (o != 'undefined') { if (o.style.display == 'none') o.style.display = 'block'; else o.style.display = 'none'; } }
function format(num) { 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 calcular() {
    var valor = $.trim($('.jq_valor').val()); var meses = $.trim($('.jq_meses').val()); var porc = $.trim($('.jq_juros').val()); if (valor.length == 0 || meses.length == 0 || porc.length == 0) {
        if (location.href.indexOf('/english/') > 0)
            alert('Please fill in all fields');
        else if (location.href.indexOf('/espanol/') > 0)
            alert('Por favor rellene todos los campos');
        else alert('Por favor preencha todos os campos');
        return;
    } 
    var resultado = valor * meses * (porc / 100); $('#valor').text(format(valor)); $('#juros').text(format(resultado)); $('#devolver').text(format((parseFloat(resultado) + parseFloat(valor)))); $('#resultado').show(500); }
window.onload = function () {
    if (typeof (window['Sys']) != 'undefined')
        Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
}

