	var linkArray = new Array();
	var nextLink = ""
	var prevLink = ""
	function nextSlide(){
		if(nextLink!="")document.location.href=nextLink
	}

	function prevSlide(){
		if(prevLink!="")document.location.href=prevLink
	}
	function subMenuFocus(){
	//sets the proper style to the active page in submenus
		var ctr = document.getElementById("subMenu") // the container that submenus are in (other links should not be in here)
		if (ctr!=undefined){
			linkArray = ctr.getElementsByTagName("A"); 
			file_max = linkArray.length
			for(var i=0; i < linkArray.length; i++) {
				if (document.location.href.indexOf(linkArray[i].href)>-1){
					if(i<(linkArray.length-1)) nextLink = linkArray[i+1].href
					if(i>0) prevLink = linkArray[i-1].href
					linkArray[i].className="active";
					var topicNumber = document.getElementById("topicNumber")
					if(topicNumber!=undefined) topicNumber.innerHTML = (i+1)
				} 
			}
			if (nextLink=="" && document.location.href.indexOf("index.html")>-1) nextLink=linkArray[0].href
		}
	}
	
	function addLoadEvent(func) {
	  var oldonload = window.onload;
	  if (typeof window.onload != 'function') {
		window.onload = func;
	  } else {
		window.onload = function() {
		  if (oldonload) {
			oldonload();
		  }
		  func();
		}
	  }
	}
	addLoadEvent(subMenuFocus);
	addLoadEvent(function() {
		var btns = new Array(); btns = document.getElementsByTagName("INPUT"); 
		for(var i=0; i < btns.length; i++) {
			if(btns[i].value.indexOf("Prev")>-1){
				if(prevLink=="") btns[i].disabled=true;
				btns[i].onclick = prevSlide;
			}
			if(btns[i].value.indexOf("Next")>-1){
				if(nextLink=="") btns[i].disabled=true;
				btns[i].onclick = nextSlide;
			}
		}
	});