﻿(function($) {    
    jQuery.fn.max = function(controlId, spanTextId, limit) {
            controlId.keyup(function() {
                var text = controlId.val();
                var textLength = text.length;

                if (textLength <= limit) {
                    spanTextId.html((limit - textLength) + ' remaining');
                }
            });

            controlId.blur(function(e) {
                spanTextId.hide();
            });

            controlId.focus(function(e) {
                spanTextId.show();
            });
        return this;
    }
})(jQuery);  
