/**
 * oldsitetopnav.js
 * Controls img 'on' and delinking the href
 * for included topnavs prior to the 2009/10 redesign.
 * --------------------------------------02/17/2010 m2 
 */
$(document).ready(function(){
	
        var locArray = location.href.split('/');
        var locSite = locArray[locArray.length - 2];
        var locSiteLength = locArray.length;
        var locSiteSub = locArray[locArray.length - 3];	

    $("#topnav").find("a").each(function(){
    
        // Get the folder name from the location variable.
        // Get the folder name from the current href.
        

        var thisPathArray = (this.href).split('/');
        var thisFolder = thisPathArray[thisPathArray.length - 2];
        
        
        if (thisFolder == locSite)  {
        
            var path = $(this).find('img');
            
            $(path).attr('src', function(){
                return this.src.replace(/off/, 'on');
            });
            $(path).attr('alt', function(){
                return this.alt + ' - selected';
            });
            
            // Remove href if this is index page.
            
            var locSiteIndex = locSite[1];
            
            if (locSiteIndex == 'index') {
                $(this).removeAttr('href');
            }
        }
    });
});

