(function ($) {
    $(document).ready(function () {
        $('#auth-login, #auth-password').bind(
             'blur', function (e) {
                 var el = $(this);
                 if ('' === el.val()) {
                     el.val(
                         el.attr('data-placeholder')
                     );
                 } 
             }
         ).bind(
             'focus change', function (e) {
                 var el = $(this);
                 if (el.val() === el.attr('data-placeholder')) {
                     el.val('');
                 }
             }
         );

         $('#open-form').click(function (e) {
             toggleAuthForm(true);
             e.preventDefault();
         });

         $('#close-form').click(function (e) {
             toggleAuthForm(false);
             e.preventDefault();
         });
    });

    var toggleAuthForm = function (toggle) {
        $('#auth-form').toggleClass('form-visible', toggle);
    };
}(jQuery));
