function CheckBox(PCName,PCId)
{
    var pc_id=PCId;
    var MyPCId=pc_id.split(",")
    if(document.all[PCName].checked==true)
    {
        for(var i=0;i<MyPCId.length;i++)
        {
            document.all["PCId_"+MyPCId[i]].checked=true
        }
       document.all["Show"+PCName].innerHTML="取消选择";
     }
     else
     {
        for(var i=0;i<MyPCId.length;i++)
        {
            document.all["PCId_"+MyPCId[i]].checked=false
        }
        document.all["Show"+PCName].innerHTML="选择全部";
     }
}
function CheckTable(TableId)
{
    Case_div=eval("CheckTable_" + TableId)
    if(document.all["PCId_"+TableId].checked==true)
    {
        Case_div.style.display=""
    }
    else
    {
        Case_div.style.display="none"
    }
}
function SelectAllChColColSpan(TableId)
{
    var TableNum=document.form1.TableNum.value;
    if(document.all["SelectAllChColColSpan"+TableId].checked==true)
    {
        for(var i=1;i<=TableNum;i++)
        {
            document.all["ChIdColumnId_"+i+"_"+TableId].checked=true
        }
    }
    else
    {
        for(var i=1;i<=TableNum;i++)
        {
            document.all["ChIdColumnId_"+i+"_"+TableId].checked=false
        }
    }
}
function SelectAllChColRowsSpan(TableNum)
{
    if(document.all["SelectAllChColRowsSpan"+TableNum].checked==true)
    {
        for(var i=1;i<=4;i++)
        {
            document.all["ChIdColumnId_"+TableNum+"_"+i].checked=true
        }
    }
    else
    {
        for(var i=1;i<=4;i++)
        {
            document.all["ChIdColumnId_"+TableNum+"_"+i].checked=false
        }
    }
}
function SelectAllChColColRows()
{
    var TableNum=document.form1.TableNum.value;
    if(document.form1.AllChColColRows.checked==true)
    {
        for(var i=1;i<=TableNum;i++)
        {
            for(var o=1;o<=4;o++)
            {
                document.all["ChIdColumnId_"+i+"_"+o].checked=true
                document.all["SelectAllChColColSpan"+o].checked=true
            }
            document.all["SelectAllChColRowsSpan"+i].checked=true
        }
    }
    else
    {
        for(var i=1;i<=TableNum;i++)
        {
            for(var o=1;o<=4;o++)
            {
                document.all["ChIdColumnId_"+i+"_"+o].checked=false
                document.all["SelectAllChColColSpan"+o].checked=false
            }
            document.all["SelectAllChColRowsSpan"+i].checked=false
        }
    }
}
function SelectOption()
{
    var SelectBoxValue1=document.form1.SelectBoxValue.value;
    var MySlectBoxValue=SelectBoxValue1.split(",")
    var SelectBox=document.form1.Select_Option.selectedIndex;
    for(var i=0;i<MySlectBoxValue.length;i++)
    {
        document.all["Select_"+MySlectBoxValue[i]].options[SelectBox].selected=true;
    }
}
function SelectCancel(Colspan,TableNum)
{
    var TableNumValue=document.form1.TableNum.value;
    if(document.all["ChIdColumnId_"+TableNum+"_"+Colspan].checked==false)
    {
        document.all["SelectAllChColColSpan"+Colspan].checked=false
        document.all["SelectAllChColRowsSpan"+TableNum].checked=false
        document.form1.AllChColColRows.checked=false;
    }
}
function SelectCancelUser(Colspan,TableNum)
{
    var TableNumValue=document.form1.TableNum.value;
    if(document.all["ChIdColumnId_"+TableNum+"_"+Colspan].checked==false)
    {
        document.all["SelectAllChColColSpan"+Colspan].checked=false
    }
}
function SelectCancelSelect()
{
    document.form1.Select_Option.options[0].selected=true;
}
function ModelPowerColumn(PowerId)
{
    window.location.href="PowerColumn.aspx?PowerId="+PowerId+"&ModelId="+PowerId+"";
}
function AllUserGroup(ColumnName)
{
    if(document.all[ColumnName].value=="")
    {
        alert("栏目设置不能为空！");
        document.all[ColumnName].focus();
        return false;
    }
    if(isNaN(document.all[ColumnName].value))
    {
        alert("栏目设置必须为数字！")
        document.all[ColumnName].focus();
        return false;
    }
    return true;
}
function SelectChannelInfoString(ChId,SpaceId,val)
{
    var ChannelString=$("ChannelInfoString").value;
    var _channel=",";
    var _channelstring;
    var __channelstring;
    ChannelString = ChannelString.substring(1, ChannelString.length);
    ChannelString = ChannelString.substring(0, ChannelString.length - 1);
    for(var i=0;i<ChannelString.split(',').length;i++)
    {
        _channelstring=ChannelString.split(',')[i];
        if(_channelstring.split('=')[0]==ChId)
        {
            __channelstring=_channelstring.split('=')[1];
            _channel+=_channelstring.split('=')[0]+"=";
            for(var p=0;p<__channelstring.split('|').length-1;p++)
            {
                if(p==SpaceId)
                {
                    if(val==true)
                    {
                        _channel+="1|";
                    }
                    else
                    {
                        _channel+="0|";
                    }
                }
                else
                {
                    _channel+=__channelstring.split('|')[p]+"|";
                }
            }
            _channel+=",";
        }
        else
        {
            _channel+=ChannelString.split(',')[i]+",";
        }
    }
    $("ChannelInfoString").value=_channel;
}
function SelectColumnInfoString(ChId,SpaceId,val)
{
    var ChannelString=$("ColumnInfoString").value;
    var _channel=",";
    var _channelstring;
    var __channelstring;
    ChannelString = ChannelString.substring(1, ChannelString.length);
    ChannelString = ChannelString.substring(0, ChannelString.length - 1);
    for(var i=0;i<ChannelString.split(',').length;i++)
    {
        _channelstring=ChannelString.split(',')[i];
        if(_channelstring.split('=')[0]==ChId)
        {
            __channelstring=_channelstring.split('=')[1];
            _channel+=_channelstring.split('=')[0]+"=";
            for(var p=0;p<__channelstring.split('|').length-1;p++)
            {
                if(p==SpaceId)
                {
                    if(val==true)
                    {
                        _channel+="1|";
                    }
                    else
                    {
                        _channel+="0|";
                    }
                }
                else
                {
                    _channel+=__channelstring.split('|')[p]+"|";
                }
            }
            _channel+=",";
        }
        else
        {
            _channel+=ChannelString.split(',')[i]+",";
        }
    }
    $("ColumnInfoString").value=_channel;
}