
function validate_username_and_password() {
    var login_form = document.getElementById("login_form");
    $.post(window.REL_PHP_CODE_FOLDER + "/run_function.php", {
        function_to_call: "login",
        username: login_form.username.value,
        password: login_form.password.value
    }, function(result) {
        if (result == "fail") {
            alert("Username and password are incorrect!");
            login_form.password.value = "";
        } else if (result == "success") {
            window.location.reload();
        }
    });
}

function log_out() {
    $.post(window.REL_PHP_CODE_FOLDER + "/run_function.php", {
        function_to_call: "logout"
    }, function(){
        window.location.reload();
    });
}
