// Generated by CoffeeScript 1.3.3
(function() {

  this.Navigation = (function() {

    function Navigation() {
      var active;
      if ($('#accordion').length) {
        active = $('#accordion ul:has(li.active)').index('#accordion ul');
        $('#accordion').bind('accordionchange', this.log).accordion({
          active: active >= 0 ? active : 1,
          header: 'h3',
          autoHeight: false
        });
        $('#open_close_accordion a').click(this.toggle);
        $('#accordion').show();
      }
    }

    Navigation.prototype.log = function(event, ui) {
      return log_event('accordion', {
        newheader: ui.newHeader.text(),
        oldheader: ui.oldHeader.text()
      });
    };

    Navigation.prototype.toggle = function() {
      return $('.course-wrapper').toggleClass('closed');
    };

    return Navigation;

  })();

}).call(this);
