(function($){$.fn.twitLimit=function(_1){$.fn.twitLimit.defaults={limit:140, message:"%1 .",counterElem:"#limit",allowNegative:false,dangerMode:true,dangerBold:true,dangerColors:{dark:"550505",medium:"980808",bright:"e90909"},onNegative:function(){},onPositive:function(){}};var o=$.extend({},$.fn.twitLimit.defaults,_1);o.limit=Math.abs(o.limit);function _2(_3){var _4=$("<p />");if(_3<=20&&_3>=10){var _5=$("<span />").attr("class","twitLimit_count").text(_3).css({"color":"#"+o.dangerColors.dark});}else{if(_3<10&&_3>0){var _5=$("<span />").attr("class","twitLimit_count").text(_3).css({"color":"#"+o.dangerColors.medium});}else{if(_3<=0){var _5=$("<span />").attr("class","twitLimit_count").text(_3).css({"color":"#"+o.dangerColors.bright});}else{return _3;}}}if(o.dangerBold==true){_5.css({"font-weight":"bold"});}if(_3<=20){_4.append(_5);}_5=_4.html();return _5;};function _6(_7,_8){_7=$(_7);_8=$(_8);if(o.allowNegative===false){if(_7.val().length>o.limit){_7.val(_7.val().substr(0,o.limit));}}if(o.dangerMode==true){_8.html(o.message.replace(/%1/,_2((o.limit-_7.val().length))));}else{_8.html(o.message.replace(/%1/,(o.limit-_7.val().length)));}if(o.limit-_7.val().length<0){o.onNegative(_7,_8);}if(o.limit-_7.val().length>=0){o.onPositive(_7,_8);}};return this.each(function(e){var _9=$(this);_9.bind("keydown keypress keyup change focus mouseout mouseover paste",function(e){_6(_9,o.counterElem);});if(_9.addEventListener){_9.addEventListener("input",function(){_6(_9,o.counterElem);},false);}_6(_9,o.counterElem);});};})(jQuery);
