﻿  /*
  * @jslint			    2009-01-28
  */
  
MSLM.navigation = {
 
    __version: 1.0, // class version 
    __class: 'MSLM.navigation', // class name

    // set default options
    _oDefaults: {
        topnavItems: "#topnav ul[class='select'][class!='active']",
        activeItem: "#topnav ul[class='select active'] .select_sub"
    },

    /**
    * Setup
    * @param {String} [sTitle], title
    * @param {String} [sUri], uri
    * @see _doAdd
    * @return {Void}
    */
    _setUp: function(oOptions) {
        var _scope = MSLM.navigation;
        // merge options and defaults
        _scope._oOpt = jQuery.extend({}, _scope._oDefaults, oOptions);
        _scope._oDefaults = null;
        jQuery(_scope._oOpt.topnavItems).bind("mouseover.topnav", this._hideActiveSubnav);
        jQuery(_scope._oOpt.topnavItems).bind("mouseout.topnav", this._showActiveSubnav);
    },

    _showActiveSubnav: function() {
        var _scope = MSLM.navigation;
        jQuery(_scope._oOpt.activeItem).css("display", "block");
    },
    _hideActiveSubnav: function() {
        var _scope = MSLM.navigation;
        jQuery(_scope._oOpt.activeItem).css("display", "none");
    },

    /**
    * Get singleton instance
    * @param {Object} [oOptions]
    * @return {Instance}
    */
    getInstance: function(oOptions) {
        return MSLM.navigation.initialize(oOptions);
    },

    /**
    * Constructor
    * @param {Object} [oOptions]
    * @constructor
    */
    initialize: function(oOptions) {
        // fake singleton
        if (this._oOpt) {
            return this;
        }
        // setup 
        this._setUp(oOptions);
        // fake singleton
        return this;
    }


};
