window.onload = function()
{
	selectCurrentLink();
}

// scans the links of a given container and
// if they match the page we're on, updates
// the links css class so we can give some indication
// that we're on this page
function selectCurrentLink(){
	var containerId = "left"; // object id that has our navigation links
	var selectedClassName = "selected"; // class of link that's selected
	var currentPath = trimPath(location.pathname);
	var container = document.getElementById(containerId);
	var arr = container.getElementsByTagName("A");
	var linkPath;

	for(var i = 0; i < arr.length; i++){
		linkPath = trimPath(arr[i].pathname);
		if(linkPath == currentPath) arr[i].className = selectedClassName;
	}
}

// just returns everything after the last slash
function trimPath(path)
{
	return path.slice(path.lastIndexOf("/")+1,path.length);
}


function stripe(tableId){
	var table = document.getElementById(tableId);
	if(table != null){
		var rows = table.getElementsByTagName("TR");
		var css = "alt"; // class for alternating rows
		for(var i = 0; i < rows.length; i++){
			if(i%2==0) rows[i].className = css;
		}
	} else { alert('cannot find ' + tableId); }
}

// temp function. remove for production
function switchbanner(id)
{
	var path = "images/banner" + id + ".gif";
	document.images.banner.src = path;
	return false;
}
