(function($){$.fn.shortPass='Too short';$.fn.badPass='Weak';$.fn.goodPass='Good';$.fn.strongPass='Strong';$.fn.samePassword='Username and Password identical.';$.fn.resultStyle="";$.fn.passStrength=function(options){var defaults={shortPass:"shortPass",badPass:"badPass",goodPass:"goodPass",strongPass:"strongPass",baseStyle:"testresult",userid:"",messageloc:1};var opts=$.extend(defaults,options);return this.each(function(){var obj=$(this);$(obj).unbind().keyup(function()
{var results=$.fn.teststrength($(this).val(),$(opts.userid).val(),opts);if(opts.messageloc===1)
{$(this).next("."+opts.baseStyle).remove();$(this).after("<span class=\""+opts.baseStyle+"\"><span></span></span>");$(this).next("."+opts.baseStyle).addClass($(this).resultStyle).find("span").text(results);}
else
{$(this).prev("."+opts.baseStyle).remove();$(this).before("<span class=\""+opts.baseStyle+"\"><span></span></span>");$(this).prev("."+opts.baseStyle).addClass($(this).resultStyle).find("span").text(results);}});$.fn.teststrength=function(password,username,option){var score=0;if(password.length<4){this.resultStyle=option.shortPass;return $(this).shortPass;}
score+=password.length*4;score+=($.fn.checkRepetition(1,password).length-password.length)*1;score+=($.fn.checkRepetition(2,password).length-password.length)*1;score+=($.fn.checkRepetition(3,password).length-password.length)*1;score+=($.fn.checkRepetition(4,password).length-password.length)*1;if(password.match(/(.*[0-9].*[0-9].*[0-9])/)){score+=5;}
if(password.match(/(.*[!,@,#,$,%,^,&,*,?,_,~].*[!,@,#,$,%,^,&,*,?,_,~])/)){score+=5;}
if(password.match(/([a-z].*[A-Z])|([A-Z].*[a-z])/)){score+=10;}
if(password.match(/([a-zA-Z])/)&&password.match(/([0-9])/)){score+=15;}
if(password.match(/([!,@,#,$,%,^,&,*,?,_,~])/)&&password.match(/([0-9])/)){score+=15;}
if(password.match(/([!,@,#,$,%,^,&,*,?,_,~])/)&&password.match(/([a-zA-Z])/)){score+=15;}
if(password.match(/^\w+$/)||password.match(/^\d+$/)){score-=10;}
if(score<0){score=0;}
if(score>100){score=100;}
if(score<34){this.resultStyle=option.badPass;return $(this).badPass;}
if(score<68){this.resultStyle=option.goodPass;return $(this).goodPass;}
this.resultStyle=option.strongPass;return $(this).strongPass;};});};})(jQuery);$.fn.checkRepetition=function(pLen,str){var res="";for(var i=0;i<str.length;i++)
{var repeated=true;for(var j=0;j<pLen&&(j+i+pLen)<str.length;j++){repeated=repeated&&(str.charAt(j+i)==str.charAt(j+i+pLen));}
if(j<pLen){repeated=false;}
if(repeated){i+=pLen-1;repeated=false;}
else{res+=str.charAt(i);}}
return res;};
