var Earbox = {};

Earbox.Menu = function() {
  return {
    init: function() {
      $('#menu a.active').css({borderTopColor: "#a0c2cd"});
      $('#menu a:not(.logo,.logo_blog)').hover(
        function() { 
          var a = $(this),
              img_src = '/images/menu_'+a.attr('class')+'_on.gif';
          if (!a.hasClass('active')) {
            a.stop(true,true)
              .css({borderTopColor: "#a0c2cd"})
              .find('img').attr('src', img_src);
          }
        },
        function() { 
          var a = $(this),
              img_src = '/images/menu_'+a.attr('class')+'_off.gif';
          if (!a.hasClass('active')) {
            a.stop(true,true)
              .animate({borderTopColor: '#000' }, 500)
              .find('img').attr('src', img_src);
          }
        }
      );
    }
  };
}();

$(Earbox.Menu.init);

// Add "first" class to first P and first letter of news posts on home page
$(function() {
  var ps = $('.p-first').find('p:first');
  ps.addClass('first');
});


// Archive Selected
$(function() {
  var _sel = $('.archive_select');
  _sel.change(function() {
    if (_sel.val() == '') {
      return false;
    } else {
      var _url = ['', 'archive', _sel.val()].join('/');
      window.location = _url;
    }
  })
});






