function showSection(id) {
		var divs = document.getElementsByTagName("div");
		for (var i=0; i<divs.length; i++) {
				if (divs[i].className.indexOf("section") == -1) continue;
				if (divs[i].getAttribute("id") != id) {
						divs[i].style.display = "none";
					} else {
							divs[i].style.display = "block";
						}
			}			
	}
	
function prepareInternalnav() {
		if (!document.getElementById("navigation")) return false;
		var nav = document.getElementById("navigation");
		var links = nav.getElementsByTagName("a");
		for (var i=0; i<links.length; i++) {	
				var sectionId = links[i].getAttribute("href").split("#")[1];
				var homeId = links[i].getAttribute("href").split("#")[1];
				if (!document.getElementById(sectionId)) continue;
				if (homeId == "index") {
				document.getElementById(homeId).style.display = "block";
				links[i].destination = homeId;
				links[i].onmouseover = function() {
						showSection(this.destination);
						return false;
					}
				} else {
				document.getElementById(sectionId).style.display = "none";
				links[i].destination = sectionId;
				links[i].onmouseover = function() {
						showSection(this.destination);
						return false;
					}
				}
			}
	}
	
function hideBackToTop() {
		if (!document.getElementsByTagName("p")) return false;
		var x = document.getElementsByTagName("p");
		for (var i=0; i < x.length; i++) {
				if (x[i].className == "backtotop") {
						x[i].style.display = "none";
					}
			}
	}
	
function addLoadEvent(func) {
		var oldonload = window.onload;
		if (typeof window.onload != 'function') {
				window.onload = func;
			} else {
					window.onload = function() {
							oldonload();
							func();
						}
				}
	}
	
addLoadEvent(prepareInternalnav);
addLoadEvent(hideBackToTop);
