// JavaScript changes to current page
// CSU Libraries: Water Resources Archive: Carpenter and the Compacts
// Greg Vogl 2006-03-23
window.onload = function() {
	// check all links in the page
    var a = document.getElementsByTagName("A");
    for (var i=0; i<a.length; i++)
		// highlight any links to current page in navigation bars to orient the user
		if (a[i].href == window.location.href.split("#")[0]) {
			a[i].style.cursor = "default";
			// do not highlight the home page logo link
//			if (!a[i].href.match("index.html")) { 
                a[i].style.color = "#ff5555"; // 
				a[i].style.backgroundColor = "transparent";
//			}
			a[i].style.textDecoration = "none";
	        a[i].title = "(You are at this page" 
	   		+ (a[i].title ? ": " + a[i].title : 
			   (a[i].innerText ? ": " + a[i].innerText : "")) + ")";
		}
	return true;
}

var pages = new Array("./","history.html","items.php?cat=People","items.php?cat=Conventions","items.php?cat=Camp","items.php?cat=Trips","items.php?cat=Stock","items.php?cat=Harvest","items.php?cat=Scenes","items.php?cat=Documents");

function getPage()
{
	var url=window.location.href;
	for (var i=1; i<pages.length; i++) {
		var p = pages[i];
		var e = p.indexOf('=');
		if (e >= 0) p = p.substr(e+1);
		if (url.match(p)) return i; 
	}
	return 0;
}

function getNextPage(i)
{
	var n=getPage();
	n+=i; 
	if (n == pages.length) n = 0; 
	else if (n == -1) n = pages.length-1;
	return pages[n];
}
