/**
 * 跳转至指定页
 * @param {Number} _totalPage
 * @param {Function} _fun
 * @param {Object | null | undefined} _panel
 */
function newPagination(_totalPage, _fun, _panel) {
	_totalPage = parseInt(_totalPage || "0",10);
	if(_totalPage) {
		var pagePanel = _panel ? _panel : $("div[class=jump]");
		
		function checkIpt(_val,_this) {
			_val = GD.trim(_val);
			_val = parseInt(_val || 0,10);
			if(_val >= 1 && _val <= _totalPage) {
				if(GD.isFunction(_fun)) {
					_fun(_val);
				}
			} else {
				$(_this).trigger("focus");
				alert("页码输入无效，请输入1~"+_totalPage+"之间的数字");
			}
		}
		
		pagePanel.find("button").click(function() {
			var _iptElem = $(this).siblings("input:eq(0)");
			var _val = _iptElem.val();
			checkIpt(_val,_iptElem);
		});
		pagePanel.find("input:eq(0)").pressEnter(function() {
			checkIpt(this.value,this);
		});
		pagePanel = null;
	}
}
