function Pager(id,current,pagenum,totalSize,fun){
   this.id=id;
   this.current=current;
   this.pagenum=pagenum;
   this.fun=fun;
   this.totalSize = totalSize;
   this.pageNavigation=function(){
      var low = this.current - (this.current%10)+1;
      var hight = low+9;
      var content="<font color='#0072BC'>共有 " + this.totalSize +" 条记录；当前："+this.current+" /"+this.pagenum+"页</font>";
        if(this.current >0 && this.current%10==0){
          hight = this.current;
          low = hight-9;
        }
            
        if(low>1){
             var _previous="<a href='#' onclick='" + this.fun + "(" + (low-1) +")'><<</a>"; 
        }else{
             var _previous="<span class='disabled_tnt_pagination'><<-</span>";
        }
        content += _previous;
        
        for(var i=low;i<=hight;i++){
            var urltext;
            if(i==this.current){
              urltext="<span class='active_tnt_link'>" +i+ "</span>";
            }else{
                urltext="<a href='#' onclick='" + this.fun + "(" + i +")'>"+i+"</a>";
            }
            if(this.pagenum<i){
                urltext="<span class='disabled_tnt_pagination'>" +i+ "</span>";
            }
            content += urltext;
        }
        
         if(hight<pagenum){
              var _next="<a href='#' onclick='" + this.fun + "(" + (hight+1) +")'>>></a>";
         }else{
            var _next="<span class='disabled_tnt_pagination'>->></span>";
         }
         
         content +=_next;  
         document.getElementById(this.id).innerHTML = content;
      }
}
//解决 firefox 下动态加载节点的错误
if(typeof HTMLElement!="undefined" && !HTMLElement.prototype.insertAdjacentElement)
{
     HTMLElement.prototype.insertAdjacentElement = function(where,parsedNode)
     {
        switch (where)
        {
            case 'beforeBegin':
                this.parentNode.insertBefore(parsedNode,this)
                break;
            case 'afterBegin':
                this.insertBefore(parsedNode,this.firstChild);
                break;
            case 'beforeEnd':
                this.appendChild(parsedNode);
                break;
            case 'afterEnd':
                if (this.nextSibling) this.parentNode.insertBefore(parsedNode,this.nextSibling);
                    else this.parentNode.appendChild(parsedNode);
                break;
         }
     }

     HTMLElement.prototype.insertAdjacentHTML = function (where,htmlStr)
     {
         var r = this.ownerDocument.createRange();
         r.setStartBefore(this);
         var parsedHTML = r.createContextualFragment(htmlStr);
         this.insertAdjacentElement(where,parsedHTML)
     }

     HTMLElement.prototype.insertAdjacentText = function (where,txtStr)
     {
         var parsedText = document.createTextNode(txtStr)
         this.insertAdjacentElement(where,parsedText)
     }
}
