document.observe('dom:loaded', function() {
    //hideAllNav();
    //$$('.subcalend')[0].show();
    //$$('.calend a')[0].addClassName('cur_y');

    $$('.calend a').each(function(_year) {
        _year.observe('click', function(event) {
            cur_y = $$('.calend a.current_year');
            if(cur_y.length > 0) {
                cur_y[0].removeClassName('current_year');
            }
            Event.stop(event);
            hideAllNav();
            subcalend = $('sc_'+this.innerHTML);
            //console.log('div.subcalend#sc_'+this.textContent);
            this.addClassName('current_year');
            if(subcalend) {
              subcalend.appear({duration: 0.5, queue: 'end' });
            }
        });

    });
});

function hideAllNav() {
  $$("div.subcalend").each(function(_lnk) {
      if(_lnk.visible()) {
        _lnk.fade({duration: 0.5, queue: 'end' });
      }
  });
}
