
var Pages;//总页数
var Page=1;//当前页
var Count;//总记录数
var P;
var m=1;
var PageID="LL";
var PageName=this.PageID+"1";
var Function="PageShow";
var BottomCount=10;//按扭数
var IsLoad=false;//判断是否己经装载,如果是false则重新装载
var DoDel=false;//是否是删除操作

var PageShowID="PagesInfoStr";//显示信息的ID
var ShowFunction="";//翻页函数名PageShow(Page)
var PageInfo="";
var Class1="";//正常
var Class2="";//异色
	
var GoName="GO";

var nowPageName="nowPage";
/*
.A{color:#333333;cursor:pointer}
.B{color:#FF0000;}
*/


function load(class1,class2,PID,Showfun,pageinfo)//引用例子
{
if(this.DoDel==false)
{
this.Page=1;
}
this.Class1=class1;
this.Class2=class2;
this.PageShowID=PID;
this.ShowFunction=Showfun;
this.PageInfo=pageinfo;
this.PageShowLoad();
this.IsLoad=true;


}


function PageShowLoad()
{
 this.PageName=this.PageID+"1";
 var Info=this.PageInfo.split(',');
 this.Count=Info[0];
 this.Pages=Info[1];
 this.P=Info[2];
 ShowPageStr();

}

function PageShow(id)
{
 if(this.PageName!=id)
 {
 Page=id.replace(this.PageID,"");
 document.getElementById(id).className=this.Class2;
 document.getElementById(this.nowPageName).innerHTML=this.Page;
 try
 {
 document.getElementById(this.PageName).className=this.Class1;
 }
 catch(e)
 {}
 this.PageName=id;
 
 
 
 document.getElementById(this.GoName).value=this.Page;

 
 eval(this.ShowFunction+"("+this.Page+");");
 
 }
 


}

function ShowPageStr()//初始化分页
			{

			   var Str="";
			   if(this.Pages>this.BottomCount)
			   {
			   
			    Str="<a><<</a>&nbsp;";
			    for(i=1;i<=this.BottomCount;i++)
			    {
			      
					Str+="<a class="+this.Class1+" onclick="+this.Function+"(id) id="+this.PageID+i+">["+i+"]</a>&nbsp;";
			    
			    }
			    Str+="<a class="+this.Class1+" onclick=Next()>>></a>";
			      
			   
			   }
			   else 
			   {
			    if(this.Pages>0)
			    {
			    Str="<a><<</a>&nbsp;";
			    for(j=1;j<=this.Pages;j++)
			    {
			     
					Str+="<a class="+this.Class1+" onclick="+this.Function+"(id) id="+this.PageID+j+">["+j+"]</a>&nbsp;";
			    
			    }
			   Str+="<a>>></a>";
			    
			    }
			   
			   
			   }
			   
			  document.getElementById(this.PageShowID).innerHTML=PageShowInfo()+Str;
			  document.getElementById(this.GoName).value=this.Page;
			  try
			  {
			  document.getElementById(this.PageID+this.Page).className=this.Class2;
			  }
			  catch(e)
			  {
			
			  }
			  
			
			}
			
			function Next()
			{
			  Str="";
			  if(this.m<P-1)
			  {
			   
			   Str="<a class="+this.Class1+" onclick=Prv()><<</a>&nbsp;";
			    for(i=(this.m*this.BottomCount+1)*1;i<=(m+1)*this.BottomCount;i++)
			    {
			        
					Str+="<a class="+this.Class1+" onclick="+this.Function+"(id) id="+this.PageID+i+">["+i+"]</a>&nbsp;";
			    
			    }
			   Str+="<a class="+this.Class1+" onclick=Next()>>></a>";
			  
			    this.m++;
			    document.getElementById(this.PageShowID).innerHTML=PageShowInfo()+Str;
			  }
			  else
			  {  
			  Str="<a class="+this.Class1+" onclick=Prv()><<</a>&nbsp;";
			    for(j=(this.P-1)*this.BottomCount+1;j<=Pages;j++)
			    {
			
				Str+="<a class="+this.Class1+" onclick="+this.Function+"(id) id="+this.PageID+j+">["+j+"]</a>&nbsp;";
			    
			    }
			   Str+="<a>>></a>";
			   this.m=P;
			   document.getElementById(this.PageShowID).innerHTML=PageShowInfo()+Str;
			   			  
			  }
			  
			  
			  	
			}
			
			function Prv()
			{
			 var str="";
			 if(this.m>1)
			 {
			 if(this.m>2)
			 {
			 str="class="+this.Class1+" onclick=Prv()"
			 }
			  Str="<a  "+str+"><<</a>&nbsp;";
			    for(j=(this.m-2)*this.BottomCount+1;j<=(this.m-1)*this.BottomCount;j++)
			    {
			     
					Str+="<a class="+this.Class1+" onclick="+this.Function+"(id) id="+this.PageID+j+">["+j+"]</a>&nbsp;";
			    
			    }
			   Str+="<a class="+this.Class1+" onclick=Next()>>></a>";
			   this.m--;
			   
			  document.getElementById(this.PageShowID).innerHTML=PageShowInfo()+Str;
			   
			   }
			
			}
			
			function PageShowInfo()
			{ 
			 try
			 {
			  if (this.Page*1>this.Pages*1&&this.Pages*1>0)
                 { 
                    this.Page=this.Pages*1;
                    eval(this.ShowFunction+"("+this.Page+");");
                 }
              }
              catch(e)
              {}
              
              var Str= "\u603b\u8bb0\u5f55:"+Count+"\u6761\x20\u5171"+" <span id='"+this.nowPageName+"'class="+this.Class2+">"+this.Page+"</span>/"+Pages+" \u9875&nbsp;&nbsp;<INPUT id='"+this.GoName+"' type='text' class='GoTo' style='width:25px;height:12px;TEXT-ALIGN:center;border:1px #CCCCCC solid' onchange='GoTo()' >&nbsp;&nbsp;<a id='"+this.GoName+"_a' class='"+this.Class1+"' onclick='GoTo()'>GO</a>&nbsp;&nbsp;"; 

			  return Str;
			  
			}
			
			function GoTo()
			{
			
			var nowPage=document.getElementById(this.GoName).value*1;

			try{
			if(nowPage*1<=this.Pages*1&&nowPage*1>=1)
			{
			this.Page=nowPage*1;
			 
			var aa=(nowPage/BottomCount)+"";
			var index=aa.indexOf(".");
			if(index!=-1)
			{
			this.m=aa.substr(0,index)*1;
			
			}
			else
			{
			
			this.m=(aa-1)*1;
			
			
			}
			
			Next();
		    
		    document.getElementById(this.PageID+nowPage).className=this.Class2;
		    
		    document.getElementById(nowPageName).innerHTML=this.Page;
		    
		    this.PageName=this.PageID+nowPage;
		     
		    document.getElementById(this.GoName).value=this.Page;
		   
		    eval(this.ShowFunction+"("+this.Page+");");
		    }
		    else
		    {
		    
		    
		    }
		    }
		    catch(e)
		    {
		    
		    
		    }
			
			}
			
			function LoadAsPage()
			{
			if(this.Page*1<=this.Pages*1&&this.Page*1>=1)
			{
						 
			var aa=(this.Page/BottomCount)+"";
			var index=aa.indexOf(".");
			if(index!=-1)
			{
			this.m=aa.substr(0,index)*1;
			
			}
			else
			{
			
			this.m=(aa-1)*1;
			
			}
			
			Next();
			
			document.getElementById(this.PageID+this.Page).className=this.Class2;
		    document.getElementById(this.GoName).value=this.Page;
		    }
		    else
		    {
		    
		    
		    }
			
			}
