
var PN;
var PE;
var NPC;
function createPageHTML(_nPageCount, _nCurrIndex, _sPageName, _sPageExt,_sRecordCount)
{
	PN = _sPageName;
	PE = _sPageExt;
  NPC = _nPageCount;


if(_nPageCount == null || _nPageCount<=1)
         {

            return;

         }
document.write("<table width=100% align=center><tr><td align=center bgcolor=#ffffff height=18 class='clsPage'>");
var nCurrIndex = _nCurrIndex || 0;


	// 1 输出首页和上一页
	// 1.1 当前页是首页
if(nCurrIndex == 0){

         document.write("<span>首页</span><span>上一页</span>");

 }
 //1.2 当前页不是首页
 else{
		var nPreIndex = nCurrIndex - 1;
		var sPreFileExt = nPreIndex == 0 ? "" : ("_" + nPreIndex);

		document.write("<a href=\""+_sPageName+"."+_sPageExt+"\">首页</a>");
		document.write("<a href=\"" + _sPageName + sPreFileExt + "."+_sPageExt+"\">上一页</a>");
		//document.write("<a href=\""+_sPageName+"."+_sPageExt+"\">1</a>");
	}

	// 2 输出中间分页
if(nCurrIndex > 4  && _nPageCount > 5)
{
        tt=nCurrIndex + 3 ;

        if( tt > _nPageCount )

        tt= _nPageCount ;

         for(var i=nCurrIndex-2; i< tt ; i++)

         {
                 if(nCurrIndex == i)

                   {
					document.write("<span>"+(i+1) + "</span>");
                   }
                 else{

					document.write("<a href=\""+_sPageName+"_" + i + "."+_sPageExt+"\">"+(i+1)+"</a>");
                  }

         }

}
else
{
        tt=nCurrIndex + 3 ;

        if( tt > _nPageCount )

        tt= _nPageCount ;

         for(var i=0; i< tt ; i++)

         {

                 if(nCurrIndex == i)

                   {
					document.write("<span>"+(i+1) + "</span>");
                   }

                 else{
                      if(i==0){
                       document.write("<a href=\""+_sPageName+ "."+_sPageExt+"\">"+(i+1)+"</a>&nbsp;");
                     }else{
						document.write("<a href=\""+_sPageName+"_" + i + "."+_sPageExt+"\">"+(i+1)+"</a>");
                     }
                 }
         }
}
	// 3 输出下一页和尾页
	// 3.1 当前页是尾页
	if(nCurrIndex == (_nPageCount-1)){
		document.write("<span>下一页</span><span>尾页</span>");
	}
	// 3.2 当前页不是尾页
	else{
		var nNextIndex = nCurrIndex + 1;
		var sPreFileExt = nPreIndex == 0 ? "" : ("_" + nPreIndex);

		document.write("<a href=\""+_sPageName+"_" + nNextIndex + "."+_sPageExt+"\">下一页</a>&nbsp;");
		document.write("<a href=\""+_sPageName+"_" + (_nPageCount-1) + "."+_sPageExt+"\">尾页</a>");
	}







//document.write("&nbsp;共&nbsp;");

//document.write(_nPageCount);

//document.write("&nbsp;页&nbsp;");

document.write("&nbsp;共&nbsp;");

document.write(_sRecordCount);

document.write("&nbsp;条记录&nbsp;");

document.write("&nbsp;转到第 <input id=pageNumText type=text style='height: 17px; width:50px; border: 1px solid #cccccc;' size='6' maxlength='6' /> 页 <a href=\"#\" onClick=\"goPage(pageNumText.value)\" class=\"list\">GO</a>&nbsp;");

document.write("</td></tr></table>");

}

//WCM置标

function goPage(pageNum)
{
	if(pageNum.search("^-?\\d+$")!=0)
	{
		alert('请输入整数');
		return false;
	}
	if(pageNum > NPC)
	{
		alert('输入数字不能大于' + NPC);
		return false;
	}
	if(pageNum <= 0)
	{
		alert('输入数字不能小于0');
		return false;
	}
	location.href = PN + ((pageNum - 1)==0?"":("_" + (pageNum - 1))) + "." + PE;
}
