$.extend(SSS, {
	/*
	MenuTimer : function(node, interval) {
      	this.node = node;
      	// this.hideInterval = interval;
      	// this.timer = null;

		$(node).hover(
			$(this).addClass('over'), 
			$(this).removeClass('over')
			);
			
      	$(node).children("li").hover(
			$(this).addClass('over'), 
			$(this).removeClass('over')
			);
    },
	*/
	
	menus_active : [],
	
	activateMenu : function(node) {	
		$(node).children("li").each(
			function() {
				var ok = true;
				if (this.id) {
					if (SSS.hasMenu(this.id)) {
						ok = false;
					} else {
						SSS.menus_active.push(this.id);
					}
				}
				
				if (ok) {
					$(this).hover(
						function() { $(this).addClass('over') }, 
						function() { $(this).removeClass('over') }
					);
				
					$(this).children("ul").each(
						function() {
							SSS.activateMenu(this);
						}
					);
				}
			}
		);
  	},

	hasMenu : function(id) {
		for (elt in SSS.menus_active) {
			if (elt == id) {
				return true;
			}
		}
		return false;
	}
});

/*
    connect : function(n) {
      dojo.event.connect(n, "onmouseover", this, "onMouseOver");
      dojo.event.connect(n, "onmouseout", this, "onMouseOut");
    },
*/

/*
    start : function() {
      var _this = this;
      var _node = this.node;

      var hidemenu = function () {
        dojo.html.removeClass(_node, 'over');
        //_node.lastChild.style.display="none";
        this.stop();
        //dojo.debug("fired");
      }

      this.timer = dojo.lang.setTimeout(hidemenu, _this.hideInterval);
      //dojo.debug("timer start: " + this.timer);
    },

*/

/*
    stop : function() {
      dojo.lang.clearTimeout(this.timer);
      //dojo.debug("timer stop: " + this.timer);
      this.timer = null;
    },

    isRunning : function() {
      return (this.timer != null);
    },

    onMouseOver: function() {
      if (this.isRunning()) {
        this.stop();
      }
      //if (!this.node.lastChild.style.display == "block") {
        dojo.html.addClass(this.node, 'over');
        //this.node.lastChild.style.display="block";
        //}
    },

    onMouseOut: function() {
      if (this.isRunning()) {
        this.stop();
      }
      this.start();
    }
  });
*/


$(function() { 
	SSS.activateMenu('.menu');
});
