document.writeln("<script src ='/js_common/gnumcheck.js'></script>");
document.writeln("<script src ='/js_common/gnumcheck_cn.js'></script>");
var objBack = new String();
function CreatAjax()
{
     var HttpRequest  = false;
	 try
	 {
			HttpRequest = new XMLHttpRequest();
	 }
	 catch(microsoft)
	 {
	      try
		  {
				HttpRequest = new ActiveXObject("Msxml2.XMLHTTP");
		  }
		  catch(othermicrosoft)
		  {
		       try
			   {
					HttpRequest = new ActiveXObject("Microsoft.XMLHTTP");
			   }
			   catch(failed)
			   {
					HttpRequest = false;
					alert("ajax_false");
			   }
		  }
	 }
	 return HttpRequest;
}
function JP_SetCookie(sName, sValue, expires)
{
	if(sName != "NULL")
	{
		var expDays = expires*24*60*60*1000;
		var expDate = new Date();
		expDate.setTime(expDate.getTime()+expDays);
		document.cookie = sName + "=" + escape(sValue) + "; expires=" + expDate.toGMTString();
	}
}
var gJumpPages = new Object();
gJumpPages = function (lang,url,totalpage,currentpage,total,pagesize,name,pagesizew)
{

	var regS = /&/g;

//	this.Url = url.replace(regS,"@");
	this.Url = escape(url);
	
	if(totalpage && gNumCheckFormat(totalpage,objBack,0,1,1))
		this.TotalPage = totalpage;
	else 
		this.TotalPage = 1;

	if(currentpage && gNumCheckFormat(currentpage,objBack,0,1,1))
		this.CurrentPage = currentpage;
	else 
		this.CurrentPage = 1;

	if(pagesize && gNumCheckFormat(pagesize,objBack,0,1,1))
		this.PageSize = pagesize;
	else 
		this.PageSize = 10;

	if(total && gNumCheckFormat(total,objBack,0,1,1))
		this.Total = total;
	else 
		this.Total = 0;

	if(lang)
		this.Lang = lang;
	else 
		this.Lang = cn;

	if(name)
		this.sName = name;
	else
		this.sName = "NULL";	

	if(pagesizew)
		this.PageSizeW = pagesizew;
	else
		this.PageSizeW = 0;	
	

	this.creat = function()
	{
		document.writeln("<span id='JumpPages'></span>");

		var ajax = CreatAjax();
		var urlto = "/js_common/gjumppages.php";	
		var strPost = "Url="+this.Url+"&Lang="+this.Lang+"&TotalPage="+this.TotalPage+"&CurrentPage="+this.CurrentPage+"&PageSize="+this.PageSize+"&PageSizeW="+this.PageSizeW+"&Total="+this.Total+"&CookieName="+this.sName;

		ajax.open("POST",urlto,true);
		ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		ajax.send(strPost);

		ajax.onreadystatechange=function()
		{
			if(ajax.readyState == 4)
			{
				//alert(ajax.responseText);
				document.getElementById("JumpPages").innerHTML = ajax.responseText;
			}
		}
	}
	this.reload = function(intTotalPage, intCurrentPage, intPageSize, intPageSizeW, intTotal)
	{
		//alert(intTotalPage + "-" + intCurrentPage + "-" + intPageSize + "-" + intPageSizeW + "-" + intTotal);
		if (intTotalPage != "")
		{
			this.TotalPage = intTotalPage;
		}
		if (intCurrentPage != "")
		{
			this.CurrentPage = intCurrentPage;
		}
		if (intPageSize != "")
		{
			this.PageSize = intPageSize;
		}
		if (intPageSizeW != "")
		{
			this.PageSizeW = intPageSizeW;
		}
		if (intTotal != "")
		{
			this.Total = intTotal;
		}
		var ajax = CreatAjax();
		var urlto = "/js_common/gjumppages.php";	
		var strPost = "Url="+this.Url+"&Lang="+this.Lang+"&TotalPage="+this.TotalPage+"&CurrentPage="+this.CurrentPage+"&PageSize="+this.PageSize+"&PageSizeW="+this.PageSizeW+"&Total="+this.Total+"&CookieName="+this.sName;

		ajax.open("POST",urlto,true);
		ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		ajax.send(strPost);

		ajax.onreadystatechange=function()
		{
			if(ajax.readyState == 4)
			{
				//alert(ajax.responseText);
				document.getElementById("JumpPages").innerHTML = ajax.responseText;
			}
		}
	}
}

