
function checkPassword(passwd){var intScore=0
var strVerdict="weak"
var strLog=""
if(passwd.length>0&&passwd.length<5){intScore=(intScore+3)}
else if(passwd.length>4&&passwd.length<8){intScore=(intScore+6)}
else if(passwd.length>7&&passwd.length<16){intScore=(intScore+12)}
else if(passwd.length>15){intScore=(intScore+18)}
if(passwd.match(/[a-z]/)){intScore=(intScore+1)}
if(passwd.match(/[A-Z]/)){intScore=(intScore+5)}
if(passwd.match(/\d+/)){intScore=(intScore+5)}
if(passwd.match(/(.*[0-9].*[0-9].*[0-9])/)){intScore=(intScore+5)}
if(passwd.match(/.[!,@,#,$,%,^,&,*,?,_,~]/)){intScore=(intScore+5)}
if(passwd.match(/(.*[!,@,#,$,%,^,&,*,?,_,~].*[!,@,#,$,%,^,&,*,?,_,~])/)){intScore=(intScore+5)}
if(passwd.match(/([a-z].*[A-Z])|([A-Z].*[a-z])/)){intScore=(intScore+2)}
if(passwd.match(/([a-zA-Z])/)&&passwd.match(/([0-9])/)){intScore=(intScore+2)}
if(passwd.match(/([a-zA-Z0-9].*[!,@,#,$,%,^,&,*,?,_,~])|([!,@,#,$,%,^,&,*,?,_,~].*[a-zA-Z0-9])/)){intScore=(intScore+2)}
if(intScore==0){strVerdict="Weak"
strColor="#4AE817";strPrec=0;}
else if(intScore>0&&intScore<16){strVerdict="Very weak"
strColor="#4AE817";strPrec=25;}
else if(intScore>15&&intScore<25){strVerdict="Weak"
strColor="#4AE817";strPrec=50;}
else if(intScore>24&&intScore<35){strVerdict="Mediocre"
strColor="#4AE817";strPrec=75;}
else{strVerdict="Strong"
strColor="#4AE817";strPrec=100;}
var meter=(strPrec/25>0)?strPrec/25:0;for(c=1;c<=meter;c++){meterBar=document.getElementById("meter"+c);meterBar.style.backgroundColor=strColor;}
for(c=meter+1;c<=4;c++){meterBar=document.getElementById("meter"+c);meterBar.style.backgroundColor='#FFFFFF';}}