$(function() {

  $('input.disable-toggle-body').change(function() {
    $('.toggle-body').slideToggle();
  });

  $('h3:first-child, h2:first-child, h1:first-child').addClass('first');
  
    $('a.add-another').click(function() {
      var $container = $(this).parent().prev();
      var $template = $('.template', $container);
      
      $template.clone(true).hide().removeClass('template').appendTo($container).fadeIn();
      return false;
    });
    
    $('a.delete-row').click(function() {
  var $p = $(this).parent();
  
  if($p.is('td')) {
   $p = $p.parent();
  }
  
      $p.fadeOut(function() {
        $(this).remove();
      });
      return false;
    });
    
    $('#dashboard .beef li a').hover(function() {
      $(this).animate({backgroundColor:'#851307', color:'white'}, 'fast');
    }, function() {
      $(this).animate({backgroundColor:'#c8c8c8', color:'black'}, 'fast');
    });
    
    $('#dashboard .lamb li a').hover(function() {
      $(this).animate({backgroundColor:'#06923C', color:'white'}, 'fast');
    }, function() {
      $(this).animate({backgroundColor:'#c8c8c8', color:'black'}, 'fast');
    });
    
    $('#nav').droppy();
    
    /* Tab bars */
    $('.tab-bar li a').click(function() {
      var id = $(this).attr('id').replace('tab-button-', '');
      $('.tab-bar li').removeClass('selected');
      $(this).parent().addClass('selected');
      $('.tab-page').hide();
      $('#tab-page-'+id).show();
      return false;
    })
    
    $('input[type=radio]').addClass('radio');
    
    $('.flash').animate({'opacity':1}, 1000, function() {
      $(this).animate({'opacity':0.2}, 1000, function() {
        $(this).animate({'opacity':1},1000);
      });
    });
});