﻿// JScript 文件
//全选
    function CheckAll(tableId)
    {
       
       for(n=1;n<document.getElementById(tableId).childNodes(0).childNodes.length;n++)
       {
         document.getElementById(tableId).childNodes(0).childNodes(n).childNodes(0).childNodes(0).checked=true
       }
    }
    //反选
    function CheckAnother(tableId)
    {
       for(n=1;n<document.getElementById(tableId).childNodes(0).childNodes.length;n++)
       {
         if (document.getElementById(tableId).childNodes(0).childNodes(n).childNodes(0).childNodes(0).checked==true)
         {
         document.getElementById(tableId).childNodes(0).childNodes(n).childNodes(0).childNodes(0).checked=false
         }
         else
         {
          document.getElementById(tableId).childNodes(0).childNodes(n).childNodes(0).childNodes(0).checked=true
         }
       }
    }
    
    //获取选择项的ID
    function GetID(tableId)
    {
         
        var str="";
        for(n=1;n<document.getElementById(tableId).childNodes(0).childNodes.length;n++)
        {
        
            if(document.getElementById(tableId).childNodes(0).childNodes(n).childNodes(0).childNodes(0).checked==true)
            {
                str = str + document.getElementById(tableId).childNodes(0).childNodes(n).childNodes(0).innerText + "," ;
            }
        }
        
        document.form1.selectID.value=str;
    }
    
    //添加的时候获取选择项的ID
    function AddList(tableId)//添加选择的信息,将选择的信息写入一个文本框
    {
        GetID(tableId);//获取选择项的ID
        if(document.form1.selectID.value=="")
        {
            alert("没有选择任何项!");
            return false;
        }
       else if (window.confirm('是否要添加当前选择项?')==true)
	   {
	        return true;
	   }
	   else
	   {
	        document.form1.selectID.value="";
	        return false;
	   }
    }
    
    //删除的时候获取选择项的ID
    function DeleteList(tableId)//删除选择的信息,将选择的信息写入一个文本框
    {
        GetID(tableId);//获取选择项的ID
        if(document.form1.selectID.value=="")
        {
            alert("没有选择任何项!");
            return false;
        }
       else if (window.confirm('是否要删除选择项?')==true)
	   {
	        return true;
	   }
	   else
	   {
	        document.form1.selectID.value="";
	        return false;
	   }
    }
    
    //审核的时候获取选择项的ID,将选择的信息写入一个文本框
    function CheckList(tableId)
    {
        GetID(tableId);
        if(document.form1.selectID.value=="")
        {
            alert("没有选择任何项!");
            return false;
        }
       else if (window.confirm('是否要审核选择项?')==true)
	   {
	        return true;
	   }
	   else
	   {
	        document.form1.selectID.value="";
	        return false;
	   }
    }
    
     //发布
    function Publish(tableId)//发布选择的信息,将选择的信息写入一个文本框
    {
        
        GetID(tableId);//获取选择项的ID
        if(document.form1.selectID.value=="")
        {
            alert("没有选择任何项!");
            return false;
        }
       else if (window.confirm('是否要发布选择项?')==true)
	   {
	        return true;
	   }
	   else
	   {
	        document.form1.selectID.value="";
	        return false;
	   }
    }
    
    //发布
    function UnPublish(tableId)//发布选择的信息,将选择的信息写入一个文本框
    {
        GetID(tableId);//获取选择项的ID
        if(document.form1.selectID.value=="")
        {
            alert("没有选择任何项!");
            return false;
        }
       else if (window.confirm('是否要取消发布选择项?')==true)
	   {
	        return true;
	   }
	   else
	   {
	        document.form1.selectID.value="";
	        return false;
	   }
    }

 //保存排序
    function SaveSeq(tableId)//发布选择的信息,将选择的信息写入一个文本框
    {
        
        GetID(tableId);//获取选择项的ID
        if(document.form1.selectID.value=="")
        {
            alert("没有选择任何项!");
            return false;
        }
       else if (window.confirm('是否要保存排序?')==true)
	   {
	        return true;
	   }
	   else
	   {
	        document.form1.selectID.value="";
	        return false;
	   }
    }
    
    //居中打开一窗口
    function OpenWindowS(url,Width,Height)
  {	 
    var top  = Math.round((screen.Height - Height)/2) + 20;
    var left = Math.round((screen.Width - Width)/2);
   var Ys="toolbar=no,location=no,directions=no,scrollbars=auto,status=no,revisable=no,width=" 
   + Width + ",height=" + Height +",top=" + top +",left=" + left +"";	      
    
   window.open(url,'',Ys);
   } 
  
  function OpenWindowS(url,Width,Height,IsScroll)
  {	 
    var top  = Math.round((screen.Height - Height)/2) + 20;
    var left = Math.round((screen.Width - Width)/2);
  
   var Ys="toolbar=no,location=no,directions=no,scrollbars=yes,status=no,revisable=no,width=" 
   + Width + ",height=" + Height +",top=" + top +",left=" + left +"";      
    
   window.open(url,'',Ys);
     
   //win.moveTo(Math.round((screen.Width - Width)/2),Math.round((screen.Height - Height)/2) + 20);
    
  } 