﻿// var re = function(){if(typeof(setViewDiv) == "function") setViewDiv(); }
//    if (window.attachEvent) window.attachEvent("onresize", re);
    
    //获取IE栏地址参数
function getParValue(name)
{
    var str=window.location.search;
    
    if (str.indexOf(name)!=-1)
    {
        var pos_start=str.indexOf(name)+name.length+1;
        var pos_end=str.indexOf("&",pos_start);
        if (pos_end==-1)
        {
            return str.substring(pos_start);
        }
        else
        {
            return str.substring(pos_start,pos_end)
        }
    }
    else
    {
        return "";
    }
}
    
 String.prototype.trim = function()
{
  return this.replace(/(^\s*)|(\s*$)/g, "");
}

function pageNumgo(sum,now)
{
    if(now.trim().length == 0) 
    {
      alert('未输入页数');
      return false;
    }
    
    if(Number(now) > Number(sum)) 
    {
      alert('超过总页数');
      return false;
    }
  
  return true;
}

//勾选框获取全部
    function chkAll()
    {
      var allE = document.form1.getElementsByTagName("input");
      var isChecked = document.getElementById("chk_all");
      
      for(var i=0;i< allE.length;i++)
      {
        if(allE[i].type == "checkbox")
        {
          allE[i].checked = isChecked.checked;
        }
      }
   }
      
          //是否有选择
    function isChk(tbname)
    {
      var rowsCount = document.getElementById(tbname).rows.length;
      var tb = document.getElementById(tbname);
      
      for(var i=0;i<rowsCount;i++)
      {
        var chk = tb.rows[i].cells[0].children[0];
         if(!chk.checked || chk.id == "chk_all") continue;
         
         return true;
      }
      
      alert("未选择记录");
      return false;
    }
    
    //获取欲保存之列表
    function isvalid(settype,tbname,validCell)
    {
      var tb = document.getElementById(tbname);
      if(tb == null) return false;
      if(!isChk(tbname)) return false;
      
      var strList = "";
      
      var rowsCount = tb.rows.length;
      
      for(var i=0;i<rowsCount;i++)
      {
         var chk = tb.rows[i].cells[0].children[0];
         if(!chk.checked || chk.id == "chk_all") continue;
        
         strList += tb.rows[i].cells[validCell].children[0].innerHTML + "\n";
      }
      
      return confirm('确实要将\n\n' + strList + '\n' + settype + '吗？');
    }
