
function update() {
    var list = Array.from(document.getElementsByTagName("tr"));
    console.log(list);
    for (var i = list.length - 1; i >= 1 && i > list.length - 4; i--) {
        var row = list[i].children;
        var elsozh =  row[2].children[0].value > row[3].children[0].value ? row[2].children[0].value : row[3].children[0].value;
        var masodikzh =  row[4].children[0].value > row[5].children[0].value ? row[4].children[0].value : row[5].children[0].value;
        var ossz = Number(elsozh) + Number(masodikzh)
        row[6].textContent = ossz;
        if(ossz > 6){
            row[7].className = "alairva";
            row[7].textContent = "aláírva";
        }else{
            row[7].className = "megtagadva";
            row[7].textContent = "megtagadva";
        }
        if(ossz == 13 || ossz == 14){
            row[8].textContent = "5";
        }
        if(ossz == 11 || ossz == 12){
            row[8].textContent = "4";
        }
    }
}

function addline(){
    var flist = Array.from(document.getElementsByTagName("tr"));
    document.getElementById("MAIN").appendChild(flist[flist.length - 1].cloneNode(true));
}