/*
Navigatie Script, voor Internetexplorer 4.0 en Netscape 4.0 en hoger
Geschreven door: Jesse Houwing
*/

function previous(){
	if (navigator.appName == "Netscape" && navigator.appVersion.substring(0,1)>=5) {
		if (parent.select_frame.document.pagenav.pages.selectedIndex == 0){
			parent.select_frame.document.pagenav.pages.options[parent.select_frame.document.pagenav.pages.length-1].selected = true;
			parent.text.location.replace(stripFilename(parent.select_frame.parent.text.location.pathname) + "/" +parent.select_frame.document.pagenav.pages.options[parent.select_frame.document.pagenav.pages.selectedIndex].value)
		}
		else{
			parent.select_frame.document.pagenav.pages.options[(parent.select_frame.document.pagenav.pages.selectedIndex)-1].selected = true;
			parent.text.location.replace(stripFilename(parent.select_frame.parent.text.location.pathname) + "/" +parent.select_frame.document.pagenav.pages.options[parent.select_frame.document.pagenav.pages.selectedIndex].value)
		}
		parent.select_frame.parent.text.focus();
	}else if (navigator.appName == "Netscape" && navigator.appVersion.substring(0,1)<5) {
		if (parent.select_frame.document.select.document.pagenav.pages.selectedIndex == 0){
			parent.select_frame.document.select.document.pagenav.pages.options[parent.select_frame.document.select.document.pagenav.pages.length-1].selected = true;
			parent.text.location.replace(stripFilename(parent.select_frame.parent.text.location.pathname) + "/" +parent.select_frame.document.select.document.pagenav.pages.options[parent.select_frame.document.select.document.pagenav.pages.selectedIndex].value)
		}
		else{
			parent.select_frame.document.select.document.pagenav.pages.options[(parent.select_frame.document.select.document.pagenav.pages.selectedIndex)-1].selected = true;
			parent.text.location.replace(stripFilename(parent.select_frame.parent.text.location.pathname) + "/" +parent.select_frame.document.select.document.pagenav.pages.options[parent.select_frame.document.select.document.pagenav.pages.selectedIndex].value)
		}
		parent.select_frame.parent.text.focus();
	}else{
		if (parent.select_frame.document.all.pagenav.pages.selectedIndex == 0){
			parent.select_frame.document.all.pagenav.pages.options[parent.select_frame.document.all.pagenav.pages.length-1].selected = true;
			parent.text.location.replace(stripFilename(parent.select_frame.parent.text.location.pathname) + "/" +parent.select_frame.document.all.pages.options[parent.select_frame.document.all.pagenav.pages.selectedIndex].value)
		}
		else{
			parent.select_frame.document.all.pagenav.pages.options[parent.select_frame.document.all.pagenav.pages.selectedIndex-1].selected = true;
			parent.text.location.replace(stripFilename(parent.select_frame.parent.text.location.pathname) + "/" +parent.select_frame.document.all.pages.options[parent.select_frame.document.all.pagenav.pages.selectedIndex].value)
		}
		parent.select_frame.parent.text.focus();
	}
}

function stripFilename(path){
	newpath1 = path.substring(0, path.lastIndexOf("\\"));
	newpath2 = path.substring(0, path.lastIndexOf("/"));
	
	if (newpath1.length<newpath2.length){
		return newpath2;
	}else{
		return newpath1;
	}
}

function goIndex(){
	if (navigator.appName == "Netscape" && navigator.appVersion.substring(0,1)>=5) {
			parent.select_frame.document.pagenav.pages.options[0].selected = true;
			parent.text.location.replace(stripFilename(parent.select_frame.parent.text.location.pathname) + "/" +parent.select_frame.document.pagenav.pages.options[parent.select_frame.document.pagenav.pages.selectedIndex].value)
	}
	else if (navigator.appName == "Netscape" && navigator.appVersion.substring(0,1)<5) {
			parent.select_frame.document.select.document.pagenav.pages.options[0].selected = true;
			parent.text.location.replace(stripFilename(parent.select_frame.parent.text.location.pathname) + "/" +parent.select_frame.document.select.document.pagenav.pages.options[parent.select_frame.document.select.document.pagenav.pages.selectedIndex].value)
	}else{
		parent.select_frame.document.all.pagenav.pages.options[0].selected = true;
		parent.text.location.replace(stripFilename(parent.select_frame.parent.text.location.pathname) + "/" +parent.select_frame.document.all.pages.options[parent.select_frame.document.all.pagenav.pages.selectedIndex].value)
	}
	parent.select_frame.parent.text.focus();	
}

function next(){
	if (navigator.appName == "Netscape" && navigator.appVersion.substring(0,1)>=5) {
		if (parent.select_frame.document.pagenav.pages.selectedIndex == parent.select_frame.document.pagenav.pages.length-1){
			parent.select_frame.document.pagenav.pages.options[0].selected = true;
			parent.text.location.replace(stripFilename(parent.select_frame.parent.text.location.pathname) + "/" +parent.select_frame.document.pagenav.pages.options[parent.select_frame.document.pagenav.pages.selectedIndex].value)
		}
		else{
			parent.select_frame.document.pagenav.pages.options[parent.select_frame.document.pagenav.pages.selectedIndex+1].selected = true;
			parent.text.location.replace(stripFilename(parent.select_frame.parent.text.location.pathname) + "/" +parent.select_frame.document.pagenav.pages.options[parent.select_frame.document.pagenav.pages.selectedIndex].value)
		}
		parent.select_frame.parent.text.focus();
	}
	else if (navigator.appName == "Netscape" && navigator.appVersion.substring(0,1)<5) {
		if (parent.select_frame.document.select.document.pagenav.pages.selectedIndex == parent.select_frame.document.select.document.pagenav.pages.length-1){
			parent.select_frame.document.select.document.pagenav.pages.options[0].selected = true;
			parent.text.location.replace(stripFilename(parent.select_frame.parent.text.location.pathname) + "/" +parent.select_frame.document.select.document.pagenav.pages.options[parent.select_frame.document.select.document.pagenav.pages.selectedIndex].value)
		}
		else{
			parent.select_frame.document.select.document.pagenav.pages.options[parent.select_frame.document.select.document.pagenav.pages.selectedIndex+1].selected = true;
			parent.text.location.replace(stripFilename(parent.select_frame.parent.text.location.pathname) + "/" +parent.select_frame.document.select.document.pagenav.pages.options[parent.select_frame.document.select.document.pagenav.pages.selectedIndex].value)
		}
		parent.select_frame.parent.text.focus();	
	}else{
		if (parent.select_frame.document.all.pagenav.pages.selectedIndex == parent.select_frame.document.all.pagenav.pages.length-1){
			parent.select_frame.document.all.pagenav.pages.options[0].selected = true;
			parent.text.location.replace(stripFilename(parent.select_frame.parent.text.location.pathname) + "/" +parent.select_frame.document.all.pages.options[parent.select_frame.document.all.pagenav.pages.selectedIndex].value)
		}
		else{
			parent.select_frame.document.all.pagenav.pages.options[parent.select_frame.document.all.pagenav.pages.selectedIndex+1].selected = true;
			parent.text.location.replace(stripFilename(parent.select_frame.parent.text.location.pathname) + "/" +parent.select_frame.document.all.pages.options[parent.select_frame.document.all.pagenav.pages.selectedIndex].value)
		}
		parent.select_frame.parent.text.focus();
	}
}

function openpage(){
	if (navigator.appName == "Netscape" && navigator.appVersion.substring(0,1)>=5) {
		parent.text.location.replace(document.pagenav.pages.options[document.pagenav.pages.selectedIndex].value);
	}else if (navigator.appName == "Netscape" && navigator.appVersion.substring(0,1)<5) {
		parent.text.location.replace(document.select.document.pagenav.pages.options[document.select.document.pagenav.pages.selectedIndex].value);
	}else{
		parent.text.location.replace(document.all.pagenav.pages.options[document.all.pagenav.pages.selectedIndex].value);
	}
	parent.select_frame.parent.text.focus();
}
