﻿function cisla(p) {
    if (p.kusu.value.match(/^\d+$/))
        return (true);
    alert("Počet kusů není kladné číslo.");
    return (false)
}

function swap_password_type(a) {
    if (a.type = 'text') {
        var password = document.createElement("input");
        password.type = "password";
        password.name = a.name;
        password.className = a.className;
        var insertedElement = a.parentNode.insertBefore(password, a);
        a.parentNode.removeChild(a);
        password.focus();
    }
}

function CheckForm() {

    var errorMsg = "";
    if (!document.druhPlatbyFrm.druhPlatby[0].checked && !document.druhPlatbyFrm.druhPlatby[1].checked) {
        errorMsg += "\n\t- vyberte druh platby";
    }
    if (errorMsg != "") {
        msg = "Zkontrolujte následující položky.\n\n";
        msg += "* * * * * * * * * * * * * * * * \n";
        errorMsg += alert(msg + errorMsg + "\n\n");
        return false;
    }
    return true;
}

function CheckForm2() {

    var errorMsg = "";
    if (!document.druhPlatbyFrm.druhPlatby[0].checked && !document.druhPlatbyFrm.druhPlatby[1].checked && !document.druhPlatbyFrm.druhPlatby[2].checked && !document.druhPlatbyFrm.druhPlatby[3].checked) {
        errorMsg += "\n\t- vyberte druh platby";
    }
    if (errorMsg != "") {
        msg = "Zkontrolujte následující položky.\n\n";
        msg += "* * * * * * * * * * * * * * * * \n";
        errorMsg += alert(msg + errorMsg + "\n\n");
        return false;
    }

    return true;
}

function reload() {
    for (var i = 0; i < document.druhPlatbyFrm.druhPlatby.length; i++) {
        if (document.druhPlatbyFrm.druhPlatby[i].checked)
            var val = document.druhPlatbyFrm.druhPlatby[i].value
    }
    self.location = 'kontrola.asp?druhPlatby=' + val;
}

