function Password(){};
Password.check = function(pwd,tipsDivId) {
var id = Password.getResult(pwd);
var msg = ["密码过短","密码强度差","密码强度良好","密码强度高"];
var sty = [-45,-30,-15,0];
var col = ["#999999","#66CC00"];
var sWidth = 300, sHeight = 15;
var Bobj = $(tipsDivId);
if(!Bobj)return;
with(Bobj){
style.fontSize = "12px";
style.width = sWidth + "px";
style.height = sHeight + "px";
style.lineHeight = sHeight + "px";
}
var html = "";
for(var i=0; i<msg.length; i++) {
var bg_color = (i<=id)?col[1]:col[0];
html += "<span style='width:30px;background-color="+bg_color+";'> </span>";
}
Bobj.innerHTML = html;
Bobj.title = msg[id];
};
Password.getResult = function(/*string*/pwd) {
if(pwd.length<6) return0;
var ls = 0;
if(pwd.match(/[a-z]/ig)) ls++;
if(pwd.match(/[0-9]/ig)) ls++;
if(pwd.match(/(.[^a-z0-9])/ig)) ls++;
if(pwd.length<6&&ls>0) ls--;
return ls;
};