function page_info(pageno)
{
	var xmlhttp;
if (window.XMLHttpRequest)
  {xmlhttp=new XMLHttpRequest();
  }
else
  {xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("pages").innerHTML=xmlhttp.responseText;
    }
  };
xmlhttp.open("GET","pages.php?pageno="+pageno,true);
xmlhttp.send();
return false; 
} 


function show_pages(pageno)
{
	pageno = pageno+1;
	window.location.hash = "#"+pageno;
	
}
window.onhashchange = check_hashchange;
function check_hashchange() {
	//window.scrollTo('#pages');
	//window.scrollBy(0, -10); // change this '10' as needed to control the smoothness of the scroll
  //if(window.pageYOffset > 0) setTimeout(scrollUp, 5);
	 var pageno = window.location.hash.match(/\d+/) | 0;
	if(pageno!=0)
	{
		pageno = pageno-1
		page_info(pageno);
	}
	else
		page_info(pageno); 
		
		$("html, body").animate({ scrollTop: 0 }, 3000);
}
