/* jQuery Password Strength Plugin (pstrength) - A jQuery plugin to provide accessibility functions
 * Author: Tane Piper (digitalspaghetti@gmail.com) 
 * Website: http://digitalspaghetti.me.uk
 * Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php
 * Version 1.1 (20/08/2007)
 */
(function(Y){Y.fn.pstrength=function(c){var c=Y.extend({verdects:["very weak","weak","medium","strong","stronger"],scores:[16,25,35,45]},c);return this.each(function(){var u=Y(this).attr("id");Y(this).after("<div id=\""+u+"_text\"></div>");Y(this).after("<div id=\""+u+"_bar\" style=\"border: 1px solid white; font-size: 1px; height: 2px; width: 0px;\"></div>");Y(this).keyup(function(){Y.fn.runPassword(Y(this).val(),u,c);});});};Y.fn.runPassword=function(l,C,s){nPerc=Y.fn.checkPassword(l,s);var c="#"+C+"_bar";var u="#"+C+"_text";var k=Math.round(nPerc*2.2);if(k<(l.length*5)){k+=l.length*5;}if(k>100){k=100;}Y(c).css({width:k+"%"});if(nPerc<=s.scores[0]){strColor="red";strText=s.verdects[0];}else{if(nPerc>s.scores[0]&&nPerc<=s.scores[1]){strColor="#ffd801";strText=s.verdects[1];}else{if(nPerc>s.scores[1]&&nPerc<=s.scores[2]){strColor="#ffd801";strText=s.verdects[2];}else{if(nPerc>s.scores[2]&&nPerc<=s.scores[3]){strColor="orange";strText=s.verdects[3];}else{strColor="#3bce08";strText=s.verdects[4];}}}}Y(c).css({backgroundColor:strColor});Y(u).html("<span style='color: "+strColor+";'>"+strText+"</span>");};Y.fn.checkPassword=function(C,l){var u=0;var c=l.verdects[0];if(C.length<5){u=(u+6);}else{if(C.length>4&&C.length<8){u=(u+12);}else{if(C.length>7&&C.length<16){u=(u+24);}else{if(C.length>15){u=(u+36);}}}}if(C.match(/[a-z]/)){u=(u+2);}if(C.match(/[A-Z]/)){u=(u+10);}if(C.match(/\d+/)){u=(u+10);}if(C.match(/(.*[0-9].*[0-9].*[0-9])/)){u=(u+10);}if(C.match(/.[!,@,#,$,%,^,&,*,?,_,~]/)){u=(u+10);}if(C.match(/(.*[!,@,#,$,%,^,&,*,?,_,~].*[!,@,#,$,%,^,&,*,?,_,~])/)){u=(u+10);}if(C.match(/([a-z].*[A-Z])|([A-Z].*[a-z])/)){u=(u+4);}if(C.match(/([a-zA-Z])/)&&C.match(/([0-9])/)){u=(u+4);}if(C.match(/([a-zA-Z0-9].*[!,@,#,$,%,^,&,*,?,_,~])|([!,@,#,$,%,^,&,*,?,_,~].*[a-zA-Z0-9])/)){u=(u+4);}return u;};})(jQuery);