﻿
$(document).ready(
    function() 
    {
        // handle the hover image for menubars
        $('.menu_roller').hover(
            // hover takes 2 parameters, a hover start and hover end function
            function() {
                $(this).attr('src', $(this).attr('rollover_src'));
                
            }
            ,
            function() {
                $(this).attr('src', $(this).attr('starting_src'));
            }
        );
        
        // hide the sub menus
        $('.submenu_container').hide();
        
        $('.sub_expander').hover(
            function() {
                $(this).children('.submenu_container').slideDown('fast');
            }
            ,
            function() {
                $(this).children('.submenu_container').slideUp('fast');
            }
        );
    }
);

function makeActivePage(pageName) {
    // change the src and starting_src
    var originalSrc = $('#menu_' + pageName).attr('src');
    // this replaces the directory instance of static
    originalSrc = originalSrc.replace('Static', 'Active');
    // this replaces the filename instance of static
    originalSrc = originalSrc.replace('Static', 'Active');
    
    $('#menu_' + pageName).attr('src', originalSrc);
    $('#menu_' + pageName).attr('starting_src', originalSrc);
    $('#menu_' + pageName).attr('rollover_src', originalSrc);
}


