// this sets up the show pages, hiding all sections then revealing just the current one

function showCurrentSection(which) {


	// HIDE ALL SECTIONS
	var showContentDiv = document.getElementById("showContent");
	var sections = showContentDiv.getElementsByTagName("div");
	for (var i=0; i < sections.length; i++) {
		sections[i].style.display = 'none';
	}
	// SHOW SELECTED SECTION
	sections[which].style.display = 'block';

	// SELECT CURRENT SECTION IN NAV
	var sectionsList = document.getElementById("showSubNav");
	var links = sectionsList.getElementsByTagName("a");
	for ( var i=0; i < links.length; i++) {
		links[i].className = "";
	}
	links[which].className = "selected";
	
	
}

function prepareShowContent() {
	
	var sectionsList = document.getElementById("showSubNav");
	if (sectionsList) {
		var links = sectionsList.getElementsByTagName("a");

		var linkInfo = "";
		for (var i=0; i < links.length; i++) {
			linkInfo = linkInfo + "Link #" + i + "= " + links[i] + "\n";
		}

		for ( var i=0; i < links.length; i++) {
			links[i].id=i;
			links[i].onclick=function() {
				showCurrentSection(this.id);
				return false;
			}
		}
	
		// show current section and hide all others
		
		// find out if there's a page section in ULR (eg "#Reviews")
	   /* var urlAnchor = window.location.href.substr(window.location.href.indexOf('#') + 1);
	
		alert(urlAnchor);
		
		if (urlAnchor && false) {
			showCurrentSection(urlAnchor);
		} else {
			showCurrentSection(0);
		}*/
		showCurrentSection(0);
	}
}

addLoadEvent(prepareShowContent);