<%@ Control Language="C#" AutoEventWireup="true" Codebehind="UserPermissionModify.ascx.cs"
    Inherits="PowerEasy.Module.General.WebSite.Admin.Controls.User.UserPermissionModify" %>
    
<table width="100%" cellpadding="2" cellspacing="1" style="background-color: white;">
   <tr align="center">
      <td colspan="2" class="spacingtitle">
         <b>常规模块权限设置 </b>
      </td>
   </tr>
   <tr class="tdbg">
      <td align="left" class="tdbg" colspan="2" valign="top" style="padding-left: 2px;">
          <fieldset id="ModelPurview" style="border: 1px solid #FFFFFF;">
             <table width="100%" border="0" cellpadding="0" cellspacing="1">
                 <pe:ExtendedLabel HtmlEncode="false" ID="LblModelPurview" Text="" runat="server" />
                 </pe:ExtendedLabel>
             </table>
          </fieldset> 
      </td>
   </tr>
</table>

    <script language="javascript" id="check" type="text/javascript"> 
        
    function CheckModel(obj){
    
	    var oSpanArr = document.getElementsByTagName('fieldset');
	    var j = oSpanArr.length;
		
	    //更改所有所有子节点的状态
	    for ( var i=0; i<j; i++ ) 
	    {    
		    if (oSpanArr[i].id != ""){       
			    var inputArr = oSpanArr[i].getElementsByTagName('input');
			    var m = inputArr.length
			    for ( var r=0; r< m; r++ ) 
			    {
				    var t = inputArr[r];
				    if (t.id){
				       if (t.id.substr(0,obj.id.length+1) == obj.id + '_')
				       t.checked = obj.checked;
				    }  
			    }
		    }
	    }
		    
		//开始更改父节点的状态
		if(obj.checked==true){
			CheckParentModel(obj.id);
		}
		else{
			ChangeParentModel(obj.id);
		}
	}
	
	function CheckParentModel(objID){
		if(objID.indexOf("_") > 0)
		{
		    var parentid=objID.substr(0,objID.lastIndexOf("_"));
		    document.getElementById(parentid).checked=true;
		    CheckParentModel(parentid);
		}
	}
	function ChangeParentModel(objID){
		if(objID.indexOf("_") > 0)
		{
            var oSpanArr = document.getElementsByTagName('fieldset');
		    var j = oSpanArr.length;
		    var parentid=objID.substr(0,objID.lastIndexOf("_"));
		    document.getElementById(parentid).checked = false;

		    for ( var i=0; i<j; i++ ) 
		    {    
			    if (oSpanArr[i].id != ""){       
				    var inputArr = oSpanArr[i].getElementsByTagName('input');
				    var m = inputArr.length
				    
				    for ( var r=0; r< m; r++ ) 
				    {
					    var t = inputArr[r];
					    if (t.id){
					       if (t.id.substr(0,parentid.length+1) == parentid + '_'){
						       if(t.checked == true){
							       document.getElementById(parentid).checked = true;
							       break;
						       }
						    }
					    }
				    }
			    }
		    }
		    ChangeParentModel(parentid);
		}
	}
	
    </script>