var MainMenu;
var Menu = Class.create();
Menu.prototype = {
    initialize: function(href, base, ie) {
        this.menu = $('mainmenu');
        this.items = this.menu.getElementsBySelector('li');
        this.currentUL = null;
        if (!base.match(/\/$/))
            base += '/';
        var found = href==base;
        for (var i = 0; i < this.items.length; i++) {
            var a = this.items[i].getElementsBySelector('a').first();
            var re = eval('/^'+a.href.replace(/\//g,"\\/")+(found ? '$' : '')+'/i');
            if ((href.match(re) && found) || (href.match(re) && !found && base!=a.href))
                a.addClassName('visit');
        }
        MainMenu = this;
    },

    highlight: function(path) {
        for (var i = 0; i < this.items.length; i++) {
            var a = this.items[i].getElementsBySelector('a').first();
            if (a.href.match(path))
                a.addClassName('visit');
        }
    }
};
