var MainNav = {
    base_path: "#mainNav",
    path: "p a",
    active: null,

    setActive: function(i) {
        if (i == null) return;
        MainNav.active = "#" + i + " a";
        MainNav.reset();
    },
    
    reset: function() {
        $(MainNav.path).removeClass("hover");
        if (MainNav.active != null) {
            $(MainNav.active).addClass("hover");
        }
    },

    init: function() {
        MainNav.path = MainNav.base_path + " " + MainNav.path;
        $(MainNav.path).hover(MainNav.hover);
        $(MainNav.base_path).mouseout(MainNav.reset);
    },
    
    hover: function() {
        MainNav.reset();
        $(this).addClass("hover");
    }
};
