function checkAll() {

    if (checkPassword($("#oldUserPassWord"),$("#oldpswmsg")) == false) {
        $("#oldUserPassWord").focus();
        return false;
    }

    if (checkPassword($("#UserPassword"),$("#newpswmsg")) == false) {
        $("#UserPassword").focus();
        return false;
    }

    if (checkPassword2($("#rePassWord"), $("#UserPassword"),$("#repswmsg")) == false) {
        $("#rePassWord").focus();
        return false;
    }
	return true;

}	


function UpdatePassSubmit()
{
	
	var isok =checkform();
	if(isok) {
		//Fast_UpdateUserPass('oldUserPassWord','UserPassword');
		//window.location.replace("/UserInfo/User.aspx") ;
		var uNameId = "oldUserPassWord";
		var uPassId = "UserPassword";
		var datatype = 0;
		if(!datatype) datatype = 0;
		var uName = (datatype==0)?$("#"+uNameId).val():uNameId;
		var uPass = (datatype==0)?$("#"+uPassId).val():uPassId;
		AjaxSubmit(
			null,
			"/index.aspx?s=/UserInfo/UserPassUpdate/&IsAdd=9",
			{"oldUserPassWord":uName,"UserPassword":uPass},
			function(msg)
			{
			 	if(msg>0) Alert('密码已修改!',1,function(){Common.Refresh();});
				else alert("密码修改失败,可能的原因:\r\n 1.旧密码不正确;\r\n 2.登陆超时;\r\n 3.系统故障.");
				
			},null
			
		);		
		
		
	}
	//else alert("数据验证失败,请检查您输入的旧密码、新密码及重复密码的有效性。");
}		

//密码强度判断
function CheckPassAndShowMsg(ctr)
{

	var value = jQuery("#"+ctr.id).val();
	var level = Common.CheckPasswordStrong (value);
	if (level == 0) {
		return '<font color="red">太短(不低于6位)!</font>';
	}
	if (level == 1) {
		return '<font color="black">较弱</font>';
	}
	if (level == 2) {
		return '<font color="blue">一般</font>';
	}
	if (level == 3) {
		return '<font color="green">极佳</font>';
	}
}	



function checkform()
{
    var ok = jQuery.checkForm({
        ctrls: [                                   
				{id: "oldUserPassWord",wid:"divTitle_oldUserPassWord",type:"mustRegular", par: /^[\w]{6,20}$/, msg:"6~20位，字母数字混用可提高密码强度。",msgok:CheckPassAndShowMsg}//
				,{id: "UserPassword",wid:"divTitle_UserPassword",type:"mustRegular", par: /^[\w]{6,20}$/, msg:"6~20位，字母数字混用可提高密码强度。",msgok:CheckPassAndShowMsg}//
				,{id: "rePassWord",wid:"divTitle_rePassWord",type:"mustEqualTo", par: "UserPassword", msg:"两次输入的密码不一样",msgok:""}//
            ]
    });
	return ok;	
}		
	
	
	
	
jQuery(function(){		
	jQuery("#imgBtnSubmit").click(function(){UpdatePassSubmit();});		
})			