var login = (function() {
    var myForm = "#bos_login";
    /**
     * @param object node  : jQuery node object
     */
    function highlight (node) {
        node
            .animate(
                { height: "22px", backgroundColor: "#B7D1D2" },
                { duration: "slow" }
            )
            .focus();
    };
    function checkValues() {
        var check = true;
        $(myForm).find("input.form_input").each(
            function () {
                if($(this).val().length < 3) {
                    highlight($(this));
                    check = false;
                }
            }
        );
        return check;
    };
    return {
        /**
         * @return bool
         */
        submit : function () {
            var pw;
            if(checkValues() === false) {
                return false;
            }
            pw = sha256Hash($("input#Passwort").val());
            $("input#Passwort").css('display','none').val(pw);
            return true;
        }
    };
})();
$(function() {
    $("#form_login_submit").bind('click.login',function(){
        return login.submit();
    });
    $("input#Benutzername").focus(function () {
        $(this).unbind("focus").val("");
    });
    $("input#Passwort_dummy").focus(function () {
        $("input#Passwort").show().focus();
        $(this).unbind().remove();
    });
});

