   
	function pageinit(_pages,_pageNo,_total,pageSize,startPage,endPage,currentPage){
		var _startPage = parseInt(startPage);
		var _endPage = parseInt(endPage);
		var _currentPage = parseInt(currentPage);
		var html = '<li><a href="javascript:void(0);" id="start"  class="p1">首页</a></li>'+'<li><a href="javascript:void(0);" id="previous" class="p2">上一页</a></li>';
		
		var html1 = '<li><a href="javascript:void(0);" id="next" class="p2">下一页</a></li>'+'<li><a href="javascript:void(0);" id="end" class="p1">尾页</a></li>'
		+'<li id="toolBar_jumpPage" style="line-height: 30px;">&nbsp;&nbsp;&nbsp;跳到<input type="text" style="width: 30px;height: 20px;line-height: 20px;" id="pageNum" style="width:30px" value=""/>页<a href="javascript:void(0);" id="jumpPageNum" class="p4">跳转</a></li>';
			
		for(var i=_startPage;i<=_endPage;i++){
			if(_currentPage==i){
				html += '<li class="active"><a  href="javascript:void(0);" class="p3">'+i+'</a></li>';
			}else{
				html += '<li><a  href="javascript:void(0);" class="p3">'+i+'</a></li>';
			}
		}
		
		html = html + html1;
		$("#bootstrappager").html(html);
	
		//按钮初始状态
		if(_currentPage==_startPage){
			//当前页等于第一页时，首页和上一页不能点击,下一页和尾页 可以点击
			$("#start").parent().addClass("disabled");
			$("#previous").parent().addClass("disabled");
			$("#end").parent().removeClass("disabled");
			$("#next").parent().removeClass("disabled");
		}else if(_currentPage==_endPage){
			//当前页等于最后一页时，下一页和尾页不能点击, 首页和上一页可以点击
			$("#next").parent().addClass("disabled");
			$("#end").parent().addClass("disabled");
			$("#start").parent().removeClass("disabled");
			$("#previous").parent().removeClass("disabled");
		}else {
			$("#next").parent().removeClass("disabled");
			$("#end").parent().removeClass("disabled");
			$("#start").parent().removeClass("disabled");
			$("#previous").parent().removeClass("disabled");
		}
		//只有一页时, 都不能点击
		if(_startPage==_endPage&&_startPage==1){
			$("#start").parent().addClass("disabled");
			$("#previous").parent().addClass("disabled");
			$("#next").parent().addClass("disabled");
			$("#end").parent().addClass("disabled");
		}
	}
    
  /*  var _pages = 100;
	var _pageNo = 2;
	var _total = 1000;
	var pageSize = 10;
	var startPage = 20;
	var endPage = 26;
	var currentPage = 10;
	pageinit(_pages,_pageNo,_total,pageSize,startPage,endPage,currentPage);*/
    
	
	$(function() {	
		$("body").unbind('click').delegate(".p1,.p2,.p3,.p4","click", function(event){
			var $this = $(this);
			if($this.parent().hasClass("disabled")){
				return;
			}else{
				var startPage = 1;
				var endPage = parseInt($("#pageTotal").val());
				var className = $this.attr("class");
				var page = 1;
				if("p3"==className){
					//点击 页码
					page = parseInt($this.html());				
				}else if("p2"==className){
					//点击上一页或下一页
					var id = $this.attr("id");
					if("previous"==id){
						page = parseInt($("#currentPage").val())-1;
					}else if ("next"==id){
						page = parseInt($("#currentPage").val())+1;
					}
				}else if("p1"==className){
					//点击首页或尾页
					var id = $this.attr("id");
					if("start"==id){
						page = 1;
					}else if("end"==id){
						page = endPage;
					}
				}else if("p4"==className){
					//手动输入数字
					var targetPage = $.trim($("#toolBar_jumpPage>#pageNum").val());
					if("" == targetPage ){
						$("#toolBar_jumpPage>#pageNum").addClass("pageNumError");
						return; 
					}
					if(isNaN(targetPage)){
						$("#toolBar_jumpPage>#pageNum").addClass("pageNumError");
						return;
					}
					var _targetPage = parseInt(targetPage);
					if(_targetPage<startPage||_targetPage>endPage){
						$("#toolBar_jumpPage>#pageNum").addClass("pageNumError");
						return;
					}
					$("#toolBar_jumpPage>#pageNum").removeClass("pageNumError");
					page = _targetPage;
				}
				queryEvent(page);		
			}
		});
	});

	function queryEvent(currentPage) {
		$("#currentPage").val(currentPage);
		$("#pageNo").val(currentPage)
		initData();
	}