function AllChecked()
{
    var form =document.forms[0];
    for(i=0;i<form.elements.length;i++)
    {
        if(form.elements[i].type=="checkbox")
        {
            if(form.elements[i].checked==false){
                form.elements[i].checked=true;
            }else{
                form.elements[i].checked=false;
            }
        }
    }
}

function CheckedAllInfo()
{
    var InputList = document.getElementsByName("cb_delete");
    for(var j = 0 ; j < InputList.length ; j++){
        if(InputList[j].type == "checkbox"){
             if(InputList[j].checked==false){
                InputList[j].checked=true;
            }else{
                InputList[j].checked=false;
            }
        }
    }
}
function CheckedAllInfo2(cname)
{
    var InputList = document.getElementsByName(cname);
    for(var j = 0 ; j < InputList.length ; j++){
        if(InputList[j].type == "checkbox"){
            if(InputList[j].checked==false){
                InputList[j].checked=true;
            }else{
                InputList[j].checked=false;
            }
        }
    }
}
chColor=function(obj,color){obj.style.background=color;obj.style.cursor="pointer";};


function OpenDialogArticleCategoryst(ObjID){
    if (navigator.appVersion.indexOf("MSIE") == -1){
        this.returnAction=function(strResult){
            if(strResult!=null && document.getElementById(ObjID)){
                GetValueArray = strResult.split("|");
            
                document.getElementById("hf" + ObjID).value = GetValueArray[0];
                document.getElementById(ObjID).value = GetValueArray[1];
            }
        }
        window.open('Tab_child_st.aspx','newWin','modal=yes,width=550,height=550,top=200,left=300,resizable=no,scrollbars=no');
        return;
    }else{
        var GetValue = showModalDialog('Tab_child_st.aspx',window,'dialogWidth:500px;dialogHeight:600px;')
        if (GetValue != null && document.getElementById(ObjID)) {
            if(document.getElementById(ObjID)){
                GetValueArray = GetValue.split("|");
                document.getElementById("hf" + ObjID).value = GetValueArray[0];
                
                document.getElementById(ObjID).value = GetValueArray[1];
            }
        } 
    }
}
function OpenDialogArticleCategoryadd(ObjID,pid){

    if (navigator.appVersion.indexOf("MSIE") == -1){
        this.returnAction=function(strResult){
            if(strResult!=null && document.getElementById(ObjID)){
                GetValueArray = strResult.split("|");
            
                document.getElementById("hf" + ObjID).value = GetValueArray[0];
                document.getElementById(ObjID).value = GetValueArray[1];
            }
        }
        window.open('Tab_child_tadd.aspx?pid='+pid,'newWin','modal=yes,width=550,height=550,top=200,left=300,resizable=no,scrollbars=no');
        return;
    }else{
        var GetValue = window.showModalDialog('Tab_child_tadd.aspx?pid='+pid,window,'dialogWidth:500px;dialogHeight:600px;');
        if (GetValue != null && document.getElementById(ObjID)) {
            if(document.getElementById(ObjID)){
                GetValueArray = GetValue.split("|");
                document.getElementById("hf" + ObjID).value = GetValueArray[0];
                
                document.getElementById(ObjID).value = GetValueArray[1];
            }
        } 
    }
}
//编辑事件
var count = 0;
function CheckEdits(){
    count = 0;
    var ids = GetCheckedBoxall();
    if(ids == "0"){
        alert("请选择一条你要编辑的记录");
        return false;
    }else{
        document.getElementById("CheckedIDS").value = ids.replace('0,','');
        return true;
    }
}
//获取全部选中CHECKBOX的值集合
function GetCheckedBoxall(){
    var ids = "0";
    var InputList = document.getElementsByTagName("input");
    var InputAll = document.getElementById("CheckAllBox");
    for(var j = 0 ; j < InputList.length ; j++){
        if(InputList[j].type == "checkbox"){
            if(InputList[j].checked == true){
                if(InputList[j].value=="on"){
                    continue;
                }
                ids += "," + InputList[j].value;
                count++;
            }
        }
    }
    document.getElementById("CheckedIDS").value=ids;
    return ids;                                               
}
//将选中的类别放入父窗体的控件中
function InitAdsCategoryall(){
    if(CheckEdits()){
        var id = document.getElementById("CheckedIDS").value;                     
        if (navigator.appVersion.indexOf("MSIE") == -1){
            window.opener.returnAction(id);
            window.location.href="TabChildlist.aspx?type_list_id="+id+"&pid="+pid; 
            window.close();
        }else{
            window.returnValue = id;
            dialogArguments.location.href="TabChildlist.aspx?type_list_id="+id+"&pid="+pid;
            window.close();
        }
        return true;
    }else{
        return false;
    }
}
function Input_(){
    var form =document.forms[0];
    for(i=0;i<form.elements.length;i++)
    {
        if(form.elements[i].type=="text")
        {
            form.elements[i].onfocus=function(){this.style.border="#66BBFF 1px solid"}
            form.elements[i].onblur=function(){this.style.border="#e5e5e5 1px solid"}
        }
    }
}
function copy_clip(copy){
    if (window.clipboardData){
    window.clipboardData.setData("Text", copy);}
    else if (window.netscape){
    netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
    var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);
    if (!clip) return;
    var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);
    if (!trans) return;
    trans.addDataFlavor('text/unicode');
    var str = new Object();
    var len = new Object();
    var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
    var copytext=copy;
    str.data=copytext;
    trans.setTransferData("text/unicode",str,copytext.length*2);
    var clipid=Components.interfaces.nsIClipboard;
    if (!clip) return false;
    clip.setData(trans,null,clipid.kGlobalClipboard);}
    alert("已复制"+copy)
    return false;
}
