/* Placeholder plugin
------------------------------------------------------------------------------------------------ */

(function($) {

    $.fn.placeholder = function() {

        $(this).addClass('placeholder');

        $(this).focus(function() {

            if (!$(this).data('defaultValue')) {
                $(this).data('defaultValue', $(this).attr('value'));
            }

            if ($(this).data('defaultValue') == $(this).attr('value')) {
                $(this).removeClass('placeholder');
                $(this).attr('value', '');
            }

        }).blur(function() {

            if (!$(this).attr('value').length) {
                $(this).addClass('placeholder');
                $(this).attr('value', $(this).data('defaultValue'));
            }

        });
    };

})(jQuery);

