function submitForm()
{
    var from = document.exchange.from.value;
    var to = document.exchange.to.value;
    var amount = document.exchange.amount.value;
    var fname = document.exchange.fname.value;
    var lname = document.exchange.lname.value;
    var address = document.exchange.address.value;
    var phone = document.exchange.phone.value;
    var email = document.exchange.email.value;
    var birthdate = document.exchange.birthdate.value;
    var account = document.exchange.account.value;

    if (from == "null" || to == "null" || amount == "" || account == "") {
        document.getElementById("error").innerHTML = "<img src='images/info.gif'> <font color='red'>Пожалуйста, заполните все поля!</font> <br /><br />";
        return;
    } else {
        if (fname == "" || lname == "" || birthdate == "" || address == "" || phone == "" || email == "") {
            document.getElementById("error").innerHTML = "<img src='images/info.gif'> <font color='red'>Пожалуйста, заполните все поля!</font> <br /><br />";
            return;
        } else {
            /* Form appears to be valid */
            document.exchange.submit();
        }
    }
}

function updateData()
{
    var from = document.exchange.from.value;
    var to = document.exchange.to.value;
    var amount = document.exchange.amount.value;

    if (from == "null" || to == "null" || amount == "") {
        document.exchange.result.value = "0.00";
        return;
    } else {
        /* Form data appears to be valid */
        getData()
    }
}

function checkAddForm()
{
    if (document.addoption.from.value == document.addoption.to.value && document.addoption.from.value != "null" && document.addoption.to.value != "null") {
        document.getElementById("optionaddbutton").disabled = true;
    } else {
        document.getElementById("optionaddbutton").disabled = false;
    }
}