function init_ccal_usage() {
    $$('div.calc_table input').each(function(element) {
        element.observe('keyup', ccal_recalc_total);
    });
}
function ccal_recalc_total(e) {
    var result = 0;
    $$('div.calc_table input').each(function(element) {
        var value = parseInt(element.value);
        var koef = parseFloat(element.readAttribute('ccal'));
        if (!isNaN(value) && !isNaN(koef)) {
            result += value * koef;
        }
    });
    $$('div.calc_table tr.total input').first().value = Math.round(result).toString();
}
function ccal_clear() {
    $$('div.calc_table input').each(function(element) {
        element.value = '';
    });
}