$(function(){
    $("#form_login").submit(function(){
        $("#username, #password").removeClass(ERRCLASS);
        $(this).find(":text[value=''], :password[value='']").addClass(ERRCLASS);
        if ( $(this).find(":text[value=''], :password[value='']").size() ) {
            return false;
        }
        return true;
    });
});