var current=document.URL;
if (current.indexOf("#")!=-1) //test for "#" in the URL, if not present, skip next line
	current = current.substring(current.lastIndexOf("#"), 0);
var mykey=((current).split("/"))[((current).split("/")).length-1];
var mykey1=((mykey).split("\\"))[((mykey).split("\\")).length-1];
var fname = mykey1.substring(mykey1.lastIndexOf("."),0);
p=fname;

/*if (parent.location.href == self.location.href || !parent.correct_frame)
setTimeout("chlocation()", 150)

function chlocation(){
window.location.href = 'index.html?'+fname;
}*/

function finish(){
p=p+"";             //converting number to string
	if (p==0){
	p="index";}
	if (p.length<2){     //checking number of digits of page number
	p=("000"+p);}//if there is only one, add a "000" in front
	if (p.length<3){   
	p=("00"+p);}//if there are two...
	if (p.length<4){    
	p=("0"+p);}//if there are three...          
window.location.href(p+".html"); //open appropriate window        
page="0";      //reset values for page
p=0;      //reset values for p
}


function nextPage() {
if(p=='start'){window.location.href("toc1.html");}
else if(p=='1430'){window.location.href("index.html");}
else{p=p-0; //convert to number
p=p+1;    //add 1 to get the next page number
finish();
}}
 
function prevPage() {
if(p=='start'){window.location.href("1430.html");}
else{p=p-0; //convert to number
p=p-1;    //subtract 1 to get the previous page number
finish();
}}

function HandleKey(){
//alert(event.keyCode);

	if(event.keyCode == 36)//home
	{
		window.location.href("index.html");
	}
	if(event.keyCode == 37)//prev
	{
		prevPage();
	}
	if(event.keyCode == 39)//next
	{
		nextPage();
	}
}

