// JavaScript Document
//copyright Casey Gordon
	
	function navOnClick(goToUrl)
	{
		window.location = goToUrl;
	}
	
	function navMouseOver(buttonObject,overClass)
	{		
		//set dynamic variable on the fly storing original class into new name (based on id)
		eval(buttonObject.id + "Container" + " = buttonObject.className");		
		//change the class to whatever is passed in
		buttonObject.className = overClass;
	}
	
	function navMouseOut(buttonObject)
	{
		//set the class to whatever it original was (by using the dynamic variable created when rolling on)
		buttonObject.className = eval(buttonObject.id + "Container");
	}
	
	function navAboutMouseOver(buttonObject,overClass)
	{
		turnAllTheAboutNavsToOff();
		closeAllSubNavDivs();
		buttonObject.className = "navYearOver";
		theButtonId = buttonObject.id;
		theYear = Right(theButtonId,4);
		turnOnObjectId = "navTextDiv" + theYear;
		divObject = document.getElementById(turnOnObjectId);
		divObject.className = "showDiv";
		
	}
	
	function navAboutMouseOut(buttonObject)
	{
		//don't do anything when mouseout...keep them on whatever section they are on
	}

	/* searches all divs on page for ones starting with "navTextDiv" and closes them */
	function closeAllSubNavDivs() 
	{
        var divCollection = document.getElementsByTagName("div");
        for (var i=0; i<divCollection.length; i++) {
            if(Left(divCollection[i].getAttribute("id"),10) == "navTextDiv") {
				divCollection[i].className = "hideDiv";
            } 
        }
    }

	/* searches all divs on page for ones starting with "navTextDiv" and set to the height of the tallest one */
	function aboutNavOnLoad() 
	{
        var divCollection = document.getElementsByTagName("div");
		var tallestHeight = 0;
        for (var i=0; i<divCollection.length; i++) {
            if(Left(divCollection[i].getAttribute("id"),10) == "navTextDiv") {
				thisHeight = $(divCollection[i]).height();
				if(thisHeight > tallestHeight) {
					tallestHeight = thisHeight;
				}
            } 
        }
        for (var i=0; i<divCollection.length; i++) {
            if(Left(divCollection[i].getAttribute("id"),10) == "navTextDiv") {
				divCollection[i].style.height = tallestHeight;
            } 
        }
    }

	/* searches all divs on page for ones starting with "navTextDiv" and closes them */
	function turnAllTheAboutNavsToOff() 
	{
        var liCollection = document.getElementsByTagName("li");
        for (var i=0; i<liCollection.length; i++) {
            if(Left(liCollection[i].getAttribute("id"),7) == "navYear") {
				//alert(liCollection[i].id);
				liCollection[i].className = "navYearOff";
            } 
        }
    }
