var callbackhist = function(){
	historyListener(0);
	document.getElementById("paging").addEventListener('click', historyListener, false);
};

if (
    document.readyState === "complete" ||
    (document.readyState !== "loading" && !document.documentElement.doScroll)
) {
  callbackhist();
} else {
  document.addEventListener("DOMContentLoaded", callbackhist);
}

function historyListener(e){
	if (e != 0) {
		target_class = e.target.className;
		parent_class = e.target.parentNode.className;
		if (target_class == "pagenavi") {
			return false;
		} else if (target_class == "econt") {
			return false;
		} else if (parent_class == "nexton") {
			this_page = document.getElementsByClassName("this")[0].innerText;
			hist_page = parseInt(this_page) + 1;
		} else if (parent_class == "prevoff") {
			this_page = document.getElementsByClassName("this")[0].innerText;
			hist_page = parseInt(this_page) - 1;
		} else {
			hist_page = e.target.innerText;
		}
	} else {
		hist_page = 0;
	}
		searchBooks();
	paging.toPage(hist_page);
		change();
		window.scrollTo(0,0);
}