// JScript 文件
//分级全选//
function CheckAll(objCheck)
{
    
    if (objCheck == undefined)
        objEvent = event.srcElement;    //IE
    else
        objEvent = objCheck;            //FireFox
   var obj = document.getElementsByTagName("input");
   for (var i = 0;i < obj.length;i++)
   {
      if(obj[i].type == "checkbox")
          {
            var strID = obj[i].id;
            if (strID.substring(0,objEvent.id.length) == objEvent.id)
            {
                obj[i].checked = objEvent.checked; 
                if(obj[i].checked ==true)
                {
                    var s = obj[i].id + ",";
                    document.getElementById("txtHid").value = document.getElementById("txtHid").value.replace(s,"");
                    document.getElementById("txtHid").value =   document.getElementById("txtHid").value + obj[i].id + ",";
                    if(obj[i].id == "CheckBox" || obj[i].id == "CheckBoxC" || obj[i].id == "CheckBoxE" || obj[i].id == "CheckBoxF")
                    {
                        var s = obj[i].id + ",";
                        document.getElementById("txtHid").value = document.getElementById("txtHid").value.replace(s,"");
                    }
                }
                else
                {
                    var s = obj[i].id + ",";
                    document.getElementById("txtHid").value = document.getElementById("txtHid").value.replace(s,"");
                }
             }
         }
    }  
}

//根据权限判断填充CheckBox控件//
function PowerCheck()
{
   var obj = document.getElementsByTagName("input");
   for (var i = 0;i < obj.length;i++)
   {
      if(obj[i].type == "checkbox")
      {
        if(obj[i].checked ==true)
        {
            document.getElementById("txtHid").value =  document.getElementById("txtHid").value + obj[i].id + ",";
        }
      }
   }
}

//验证密码//
 function validPass()
            {
                var myReg = /\S{3,12}/;
                if(document.getElementById("txtOldPas").value.length < 1)
                {
                    alert('请填写旧密码');
                    return false;
                }
                else if(document.getElementById("txtRePas").value.length < 1)
                {
                    alert("请填写密码确认");
                    return false;
                }
                else if(document.getElementById("txtNewPas").value.length < 1)
                {
                    alert("请填写新密码");
                    return false;
                }
                else if(document.getElementById("txtNewPas").value != document.getElementById("txtRePas").value)
                {
                    alert("密码和密码确认不一致");
                    return false;
                }
                else if(!myReg.test(document.getElementById("txtOldPas").value)||!myReg.test(document.getElementById("txtRePas").value)||!myReg.test(document.getElementById("txtNewPas").value))
                {
                    alert("所有密码长度在3-12位");
                    return false;
                }
            }