<%@ page contentType="text/html; charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>

<div class="content_top_page">
	<ul>
	    <li class="total_page">共<span id="totalCountSpan">${page.totalCount}</span>条记录，当前页：${page.currentPage}，共 ${page.totalPage} 页</li>
	    
		<li id="preLi">
			<c:choose>
				<c:when test="${page.currentPage != 1}">
					<a href="javascript:goPage1(0);" id="pagePreLi">首页</a>				
				</c:when>
				<c:otherwise>
					<a href="javascript:void(0);" id="pagePreLi">首页</a>
				</c:otherwise>
			</c:choose>
		</li>
		
		<li id="preLi">
			<c:choose>
				<c:when test="${page.currentPage != 1}">
					<a href="javascript:goPage('pre');" id="pagePreLi">上一页</a>				
				</c:when>
				<c:otherwise>
					<a href="javascript:void(0);" id="pagePreLi">上一页</a>
				</c:otherwise>
			</c:choose>
		</li>
		 
			<input id="currentPageInput" class="input_page" type="hidden" value="${page.currentPage}" />
		 
		
	    <li id="nextLi">
	    	<c:choose>
	    		<c:when test="${page.currentPage != page.totalPage && page.totalPage > 0}">
	    			<a href="javascript:goPage('next');" id="pageNextLi">下一页</a>
	    		</c:when>
	    		<c:otherwise>
	    			<a href="javascript:void(0);" id="pageNextLi">下一页</a>
	    		</c:otherwise>
	    	</c:choose> 
	    </li>	
	    
	     <li id="nextLi">
	     	<c:choose>
	    		<c:when test="${page.currentPage != page.totalPage && page.totalPage > 0}">
	    			<a href="javascript:goPage1('${page.totalPage }');" id="pageNextLi">末页</a>
	    		</c:when>
	    		<c:otherwise>
	    			<a href="javascript:void(0);" id="pageNextLi">末页</a>
	    		</c:otherwise>
	    	</c:choose>  	
	    </li>		
     </ul>
</div>
<input type="hidden" id="initQuery" name="initQuery" value="1"/>
<input type="hidden" id="currentPage" name="currentPage" value="${page.currentPage}"/>
<input type="hidden" id="pageSize" name="pageSize" value="${page.pageSize}"/>
<script type="text/javascript">
	
	function goPage(type)
	{
		var currentPage = $('#currentPage').val();
		if(type == 'pre')
			currentPage = parseInt(currentPage, 10) - 1;
		if(type == "next")
			currentPage = parseInt(currentPage, 10) + 1;
		
		if(!isNaN(currentPage))
		{
			$('#currentPage').val(currentPage);
			$('#initQuery').val("0");
			document.forms[0].submit();
		}
	}
	
	function goPage1(type)
	{
	
			$('#currentPage').val(type);
			$('#initQuery').val("0");
			document.forms[0].submit();
	}
	
	
/* 	document.onkeydown=function(event){            
		var e = event || window.event || arguments.callee.caller.arguments[0];            
		if(e && e.keyCode==13 && document.activeElement.id=="currentPageInput"){ // enter 键     
			var currentPage = $('#currentPageInput').val();   
			if(currentPage<=0 || currentPage>${page.totalPage}){
				alert("您好输入的页码不是有效的!");return;
			}
			$('#currentPage').val(currentPage);   
			$('#initQuery').val("0");   
			document.forms[0].submit();
		}
	}; */ 
</script>
