var currentPage = _PAGE_INDEX-1;//所在页从0开始
var prevPage = currentPage-1//上一页
var nextPage = currentPage+1//下一页
var countPage = _PAGE_COUNT//共多少页
if(countPage==1)
document.write("<div style='display:none'>");

document.write("共&nbsp;"+countPage+"&nbsp;页&nbsp;");
//设置上一页代码
if(countPage>1&&currentPage!=0&&currentPage!=1)
	document.write("<a href=\""+_PAGE_NAME+"."+_PAGE_EXT+"\">首页</a>&nbsp;<a href=\""+_PAGE_NAME+"_" + prevPage + "."+_PAGE_EXT+"\">上一页</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
else if(countPage>1&&currentPage!=0&&currentPage==1)
	document.write("<a href=\""+_PAGE_NAME+"."+_PAGE_EXT+"\">首页</a>&nbsp;<a href=\""+_PAGE_NAME+"."+_PAGE_EXT+"\">上一页</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
else
	document.write("首页&nbsp;&nbsp;上一页&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
//循环
var num = 5;
for(var i=0+(currentPage-1-(currentPage-1)%num) ; i<=(num+(currentPage-1-(currentPage-1)%num))&&(i<countPage) ; i++){
	if(currentPage==i)
		document.write((i+1)+"&nbsp;");
	else
	if(i==0)	
		document.write("<a href=\"" +_PAGE_NAME+"."+_PAGE_EXT+"\">"+(i+1)+"</a>&nbsp;");
        else
	        document.write("<a href=\"" +_PAGE_NAME+ "_" + i + "."+_PAGE_EXT+"\">"+(i+1)+"</a>&nbsp;");

}

//设置下一页代码 
if(countPage>1&&currentPage!=(countPage-1))
	document.write("&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"" +_PAGE_NAME+ "_" + nextPage + "."+_PAGE_EXT+"\">下一页</a>&nbsp;<a href=\""+_PAGE_NAME+"_" + (countPage-1) + "."+_PAGE_EXT+"\">尾页</a>&nbsp;");
else
	document.write("&nbsp;&nbsp;&nbsp;&nbsp;下一页&nbsp;&nbsp;尾页&nbsp;&nbsp;&nbsp;&nbsp;");
	
//跳转页面
document.write("<font class='9ptb'>转到第<input type='text' id='num' value="+(currentPage+1)+" style='width:20px' class='typetxt2'>页"+
		             "&nbsp;<input class='button3' type='submit' value='GO' onClick=javacript:toPage()></font>");
if(countPage==1)
document.write("</div>");

function toPage(){
	var _num = document.getElementById("num").value;
	if((isNaN(_num)))
	{
	  alert("Hi! Please input a numric!!");	  
	  //window.history.go(-1);
	  document.getElementById("num").value=1;
	  return false;
	}
	var str = _PAGE_NAME+"_"+(_num-1)+"."+_PAGE_EXT;
	var url = location.href.substring(0,location.href.lastIndexOf("/")+1);
	if(_num<=1||_num==null)
		location.href = url+_PAGE_NAME+"."+_PAGE_EXT;
	else if(_num>countPage)
		alert("本频道最多"+countPage+"页");
	else
		location.href = url+str;
}	
		//去除最后一个分隔行
//		var page_seps = document.all("page_sep");
//		if (page_seps.length != null) {
//  		for (i=0;i<page_seps.length;i++) {
 //   		if (i==page_seps.length-1) page_seps[i].style.display = 'none';
  	//	}
//		}
