try {
$(function() {
$.fn.wordlimitor = function() {
$(this).each(function(i) {
if ($(this).nextAll('span.textlimit').size() == 0) {
if ($(this).nextAll('font').size() != 0) {
$(this).next('font').after('0');
} else {
$(this).after('0');
}
}
$(this).bind('propertychange focus keyup input paste', function() {
var _max = $(this).attr('max');
var _length = $(this).val().length;
if (_length > _max) {
$(this).val($(this).val().substring(0, _max));
_length = _max;
}
$(this).nextAll('span.textlimit').html(" " + "" + _length + "" + '/' + _max);
});
$(this).focus(function() {
$(this).nextAll('span.textlimit').fadeIn('slow');
});
$(this).blur(function() {
$(this).nextAll('span.textlimit').fadeOut('slow');
});
});
};
$('textarea[max],input[max]').wordlimitor();
});
} catch (err) {}