jQuery(document).ready(function($) {
  $('a.more').click(function(e) {
    e.preventDefault();
    $(this).next('.more').slideToggle(200);
    if ($(this).html() == '+') {
      $(this).html('&ndash;');
    } else {
      $(this).html('+');
    }
  });
  
  $('a.even-more').click(function(e) {
    e.preventDefault();
    $(this).next('.even-more').fadeIn(250);
    $(this).replaceWith('.');
  });
  
  $('a.inline-expand').click(function(e) {
    e.preventDefault();
    $(this).next('span').fadeIn(250);
    $(this).hide();
  });
  
  $('#stream-filter a').click(function(e) {
    e.preventDefault();
    $('#stream-filter a').removeClass('active');
    $(this).addClass('active');
    
    var kind = $(this).attr('data-value');
    if (kind == 'all') {
      $('#stream-content li').fadeIn();
    } else {
      $('#stream-content .' + kind).fadeIn();
      $('#stream-content li').not('.' + $(this).attr('data-value')).fadeOut();
    }
  })
  
  $('#stream').hover(function() {
    $('#stream-mask').css('overflow-x', 'auto');
  }, function() {
    $('#stream-mask').css('overflow-x', 'hidden');
  })

  function resizeStream() {
    $('#stream-mask').width($(document.body).width() - 120);
  }
  $(window).resize(resizeStream); resizeStream();
});
