var zoneHeaderChosen1, zoneHeaderChosen2;
var zoneClicked = false;
var lastZone = -1;


// Setup the main navigation events
function BuildNav() 
{

    if (document.getElementById) 
    {
        var navRoot   = document.getElementById("nav");
        var activeNav = document.getElementById("activeNav");

        for (i=0; i<navRoot.childNodes.length; i++) 
        {
	        node = navRoot.childNodes[i];
	        if (node.nodeName=="LI") 
	        {
        	    node.onmouseover=function() 
        	    {

        	        if(this.id == "activeNav")
        	            return;
        	            
         	        this.className+= " over";  
         	        
                   if(activeNav != null )
                    {
        	            activeNav.className = activeNav.className.replace("over", "");  
      	            }
        	            
        	            
        	    }
                node.onmouseout=function() 
                {

         	       if(this.id == "activeNav")
        	            return;
        	            
     	           this.className = this.className.replace("over", "");  

                   if(activeNav != null)
        	            activeNav.className+=" over";  
        	            
                }
            }
           
            
        }
        
        if(activeNav != null)
            activeNav.className+=" over";
        
   }
}

function ZoneSelectColumn(zone)
{

    if(zoneClicked)
    {
        zoneHeaderChosen1.className = "";
        zoneHeaderChosen2.className = "";
    }

    zoneClicked = true;

    var zoneColHeader1 = document.getElementById("ctl00_mainContent_zone"+zone+"Table1");
    var zoneColHeader2 = document.getElementById("ctl00_mainContent_zone"+zone+"Table2");
    
    zoneColHeader1.className = "selected"
    zoneColHeader2.className = "selected"

    zoneHeaderChosen1 = zoneColHeader1;
    zoneHeaderChosen2 = zoneColHeader2;
    
    
    if(document.styleSheets[2].href == "/styles/FreightZones.css")
    {
        document.styleSheets[2].rules[zone].style.color = document.styleSheets[2].rules[0].style.color;
        document.styleSheets[2].rules[zone].style.borderLeft = document.styleSheets[2].rules[0].style.borderLeft;
        document.styleSheets[2].rules[zone].style.borderRight = document.styleSheets[2].rules[0].style.borderRight;
    }
    
    if(lastZone > -1)
    {
        document.styleSheets[2].rules[lastZone].style.color = "";
        document.styleSheets[2].rules[lastZone].style.borderLeft = "";
        document.styleSheets[2].rules[lastZone].style.borderRight = "";
    }
    
    lastZone = zone;
    
   
}
