var Navigation = Class.create({
  initialize: function( nav ){
    this.categoryId = nav.categoryId      || null;
    this.section    = nav.section         || null;
    this.sectionId  = nav.sectionId       || null;
    this.sectionBlocks = $$( nav.sectionBlocks ) || null;
    this.categoryBlocks = $$( nav.categoryBlocks ) || null;
    this.init();
  },

  init: function(){
    // Close all sections
    this.sectionBlocks.invoke( 'hide' );

    // Place toggles on each one of the categories
    this.categoryBlocks.each( function( category ){
        category.observe( 'click', this.toggle.bindAsEventListener( category ) );
      }.bind( this ) );

    //Highlight specific sections
    if ( this.categoryId && this.section && this.sectionId ){
       $( 'cat-' + this.categoryId ).adjacent( 'ul.catsection' ).invoke( 'show' );
       $( this.section + '-' + this.sectionId + '-' + this.categoryId ).setStyle( {backgroundColor: '#990000'} );
    }
  },

  toggle: function(evt){
    evt.stop();
    this.adjacent( 'ul.catsection' ).invoke( 'toggle' );
    return false;
  }
});