function get_style_guide(){
  $('#style_guide').text("");
  $.post('/admin/styleguide/',{},
        function(data) {
          $('#style_guide').append(data);
        });
  $('#style_guide').toggle();
}

var MENU = {
  // Menu feature for every page.
  hide_class: ".hide",
  expandable_class: ".expandable",

  init: function() {
    this.hide_hideables();
    // this.add_togglers();
    this.set_visible();
  },

  hide_hideables: function() {
      $("#nav ul li ul").hide();
  },

  add_togglers: function() {
    $("#nav a.expandable").each(function(){
        $(this).click(function(){
            $(this).next().children().toggle("fast")
            return false;
        });
    });
  },
  
  set_visible: function() {
      url = window.location.pathname.split('/')
      $("#nav-" + url[1]).next().show()
      $("#nav-" + url[1]).next().children().each(function(){
          $(this).children().show()
      })
  }

  // toggle_set: function(id) {
  //   $("."+id).each(function(){
  //     $(this).toggle(MENU.hide_speed);
  //     // This *should* work, no?
  //     // if ($(this).is(":hidden")) {
  //     if ($(this).css("height") != "1px") { // hidden
  //       MENU.hide_set(this.id);
  //     }
  //   });
  // },

  // hide_set: function(id) {
  //   $("."+id).each(function(){
  //     $(this).hide(MENU.hide_speed);
  //   });
  // }
}

$(function(){
  // Add init()s for various features here.
  MENU.init();
  
  url = window.location.pathname.split('/')
  $("#nav-"+ url[1]).css("background-image", "url(/static/images/bg-nav-item-over.gif)")
  $("#nav-"+ url[1]).css("color", "white")
  
  $("#nav-newsletters").click(function(){
      window.open(this.href);
      return false;
  })
});