(function($){$.fn.password=function(settings){settings=$.extend({},$.fn.password.defaults,settings);this.each(function(){var $this=$(this),scores=0,checkingerror=false,pstrength=$(this).parents("form").find(".password");$this.bind("keyup blur",function(){scores=$.fn.password.ratepasswd($this.val(),settings);scores>=0&&checkingerror==false&&(checkingerror=true);pstrength.find("span").removeClass("bgStrength");if(scores<35&&scores>=0){pstrength.find("span:first").addClass("bgStrength")}else{if(scores<60&&scores>=35){pstrength.find("span:lt(2)").addClass("bgStrength")}else{if(scores>=60){pstrength.find("span:lt(3)").addClass("bgStrength")}}}if(checkingerror&&($this.val().length<settings.minLen||$this.val().length>settings.maxLen)){settings.showmsg($this,$this.attr("errormsg"),3)}else{if(checkingerror){settings.showmsg($this,"",2)}}settings.trigger($this,!(scores>=0))})})};$.fn.password.ratepasswd=function(passwd,config){var len=passwd.length,scores;if(len>=config.minLen&&len<=config.maxLen){scores=$.fn.password.checkStrong(passwd)}else{scores=-1}return scores/4*100};$.fn.password.checkStrong=function(content){var modes=0,len=content.length;for(var i=0;i<len;i++){modes|=$.fn.password.charMode(content.charCodeAt(i))}return $.fn.password.bitTotal(modes)};$.fn.password.charMode=function(content){if(content>=48&&content<=57){return 1}else{if(content>=65&&content<=90){return 2}else{if(content>=97&&content<=122){return 4}else{return 8}}}};$.fn.password.bitTotal=function(num){var modes=0;for(var i=0;i<4;i++){if(num&1){modes++}num>>>=1}return modes};$.fn.password.defaults={minLen:0,maxLen:30,trigger:$.noop}})(jQuery);