const app = {
    init: function () {
        $('.calculator-tab a').click(function (event) {
            event.preventDefault();
            $(this).tab('show');
        });

        $('#calculator-bmi-run').click(function () {
            var height = $('#calculator-bmi-height').val();
            var weight = $('#calculator-bmi-weight').val();

            var h = height / 100.0;
            var I = weight / ( h * h );

            $('#calculator-bmi-result').val(I)
        });

        $('#calculator-pulse-age-type').change(function () {
            $('#calculator-pulse-birthdate').prop('readonly', true);
            $('#calculator-pulse-age').prop('readonly', false);
        });

        $('#calculator-pulse-birthdate-type').change(function () {
            $('#calculator-pulse-age').prop('readonly', true);
            $('#calculator-pulse-birthdate').prop('readonly', false);
        });

        $('#calculator-pulse-age').blur(function () {
            fillTable(parseInt($('#calculator-pulse-age').val()));
        });

        const fillTable = function (age) {
            const max = 220 - age;
            const percent = max / 100.0;
            const result = {};
            [35, 50, 60, 70, 80, 90, 95].forEach(function (i) {
                result[i] = percent * i;
            });
            $('#calculator-pulse-table-max').text(max);
            $('#calculator-pulse-red-max').text(result[95]);
            $('#calculator-pulse-red-min').text(result[90]);
            $('#calculator-pulse-endurance-max').text(result[90]);
            $('#calculator-pulse-endurance-min').text(result[80]);
            $('#calculator-pulse-aerobic-max').text(result[80]);
            $('#calculator-pulse-aerobic-min').text(result[70]);
            $('#calculator-pulse-fat-max').text(result[70]);
            $('#calculator-pulse-fat-min').text(result[60]);
            $('#calculator-pulse-warm-max').text(result[60]);
            $('#calculator-pulse-warm-min').text(result[50]);
            $('#calculator-pulse-rest-max').text(result[50]);
            $('#calculator-pulse-rest-min').text(result[35]);
        }
    },

    changePage: function (event) {
        var delegateTarget = event.delegateTarget;
        $(delegateTarget).addClass("active");
        var formId = delegateTarget.id.replace('tab', 'form');
        $('#' + formId).removeClass("invisible")
    }
};
@@ -904,142 +904,8 @@
 );%0A%0A
-        $('#calculator-pulse-age').blur(function () %7B%0A            fillTable(parseInt($('#calculator-pulse-age').val()));%0A        %7D);%0A%0A
     
@@ -1996,33 +1996,51 @@
    %7D
+;%0A
 %0A    
-%7D,%0A%0A    changePage: 
+    $('#calculator-pulse-age').blur(
 func
@@ -2037,37 +2037,32 @@
 .blur(function (
-event
 ) %7B%0A        var 
@@ -2061,208 +2061,78 @@
     
-var delegateTarget = event.delegateTarget;%0A        $(delegateTarget).addClass(%22active%22);%0A        var formId = delegateTarget.id.replace('tab', 'form');%0A        $('#' + formId).removeClass(%22invisible%22)
+    fillTable(parseInt($('#calculator-pulse-age').val()));%0A        %7D);
 %0A   

replace function