/*global $, Ext */

var ProjectMenu = {
  active_index: 1,
  
  init: function() {
    this.hide_everything();
    this.bind_mouse_events();
    this.turn_on_active();
  },

  hide_everything: function() {
    $("#content h1").hide();
  },

  turn_on_active: function() {
    var matches = /http:\/\/.+?\/step(\d)/.exec(location.href);
    ProjectMenu.active_index = matches[1];
    $("#sbs_" + ProjectMenu.active_index).show();
  },
  
  bind_mouse_events: function() {
    $("#build_nav a").mouseover(function() {
      var tgt = $(this).parent().attr("id").replace("bs_", "");
      $("#content h1").hide();
      $("#sbs_" + tgt).show();
    }).mouseout(function() {
      $("#content h1").hide();
      $("#sbs_" + ProjectMenu.active_index).show();
    });
  }
};

$(function() {
  ProjectMenu.init();
});
