(function($) {
$.fn.charCounter = function (max, settings) {
max = max || 100;
settings = $.extend({
container: "<span></span>",
classname: "charcounter",
format: "(%1 characters remaining)",
pulse: true,
delay: 0
}, settings);
var p, timeout;
function count(el, container) {
el = $(el);
if (el.val().length > max) {
el.val(el.val().substring(0, max));
if (settings.pulse && !p) {
pulse(container, true);
};
};
if (settings.delay > 0) {
if (timeout) {