/*================================================================
Created:2013-9-2
Copyright:www.Kesion.com  bbs.kesion.com
Version:KesionCMS V9.5
Service QQ：111394,54004407
==================================================================*/
function Page(curPage,labelid,classid,installdir,url,refreshtype,specialid,infoid)
   {
   this.labelid=labelid;
   this.classid=classid;
   this.url=url;
   if (labelid.substring(0,5)=="{SQL_")
   {
	var slabelid=labelid.split('(')[0];
    slabelid=slabelid.replace("{","");
    this.c_obj="c_"+slabelid;
    this.p_obj="p_"+slabelid;
   }
   else
   {
   this.c_obj="c_"+labelid;
   this.p_obj="p_"+labelid;
   }
   this.installdir=installdir;
   this.refreshtype=refreshtype;
   this.specialid=specialid;
   this.infoid=infoid;
   this.page=curPage;
   loadData(1);
   }
function loadData(p)
{  this.page=p;
  $("#"+c_obj).html("<div align='center'><img src='"+installdir+"images/loading.gif'>正在读取数据...</div>");
   $.ajax({
		  type:"post",
		  url:installdir+url+"?labelid="+escape(labelid)+"&infoid="+infoid+"&classid="+classid+"&refreshtype="+refreshtype+"&specialid=" +specialid+"&curpage="+p+getUrlParam(),
		  cache:false,
		  success:function(d){
			$("#"+c_obj).html("<ul>"+d+"</ul>");
  }});

}
//取url传的参数
function getUrlParam()
{
	var URLParams = new Object() ;
	var aParams = document.location.search.substr(1).split('&') ;//substr(n,m)截取字符从n到m,split('o')以o为标记,分割字符串为数组
	if(aParams!=''&&aParams!=null){
		var sum=new Array(aParams.length);//定义数组
		for (i=0 ; i < aParams.length ; i++) {
		sum[i]=new Array();
		var aParam = aParams[i].split('=') ;//以等号分割
		URLParams[aParam[0]] = aParam[1] ;
		sum[i][0]=aParam[0];
		sum[i][1]=aParam[1];
		}
		var p='';
		for(i=0;i<sum.length;i++)
		{
		  p=p+'&'+sum[i][0]+"="+sum[i][1]
		}
	   return p;
	}else{
	   return "";
	}
}

function homePage(i)
{
   if(i==1)
    alert("已经是首页了！")
   else
   loadData(1);
} 
function lastPage(i,e)
{
   if(i==e)
    alert("已经是最后一页了！")
   else
   loadData(e);
} 
function turn(i)
{
     loadData(i);
}