function getPage(tip){
	var  filename=location.href;
	filename=filename.substr(filename.lastIndexOf('/')+1); 
	prefname=filename.substr(0,filename.lastIndexOf('.'));
	attrv = prefname.split('_');
	if (typeof(attrv[tip]) == 'undefined')
	{
		return 1;
	} else {
		return attrv[tip];
	}
}
function gprev(){
	if(nowPage > 1){
		var thispage = nowPage-1;
		window.location.href = pageurl.replace("{page}",thispage);
	}
}

function gnext(){
	var totalpage = parseInt(document.getElementById("totalpage").value); //总页数 
	if(nowPage < totalpage){
		var thispage = nowPage + 1;
		window.location.href = pageurl.replace("{page}",thispage);
	}
} 

function jumpPage(e){
	pageurl = document.getElementById("pagerule").value; //分页规则 
	if (( e ? e.which :event.keyCode)==37) { 
		gprev();
	}
	if (( e ? e.which :event.keyCode)==39) { 
		gnext();
	}
}

var nowPage = parseInt(getPage(2));
var pageurl = null;
document.onkeydown=jumpPage;
/*function jump()
{ 
	var jumpnum   = parseInt(document.getElementById("jumpnum").value); //输入框中跳转的页数
	var totalpage = parseInt(document.getElementById("totalpage").value); //总页数 
	if (jumpnum <= 0) {
		jumpnum = 1; // 小于0时设为1
	} else if (jumpnum > totalpage) {
		jumpnum = totalpage; //大与总页数时，设为总页数
	}
	var pageurl = document.getElementById("pagerule").value; //分页规则 
	window.location.href = pageurl.replace("{page}",jumpnum);//跳转 
}*/