$(document).ready(function() {
  $('#focus-2 button').click(function() {
    $('#focus-2 li:lt(2)').addClass('special');
  });
  
  
  $('#after button').click(function() {
    $('#after a[href$=.pdf]')
      .after(' <img src="/images/pdf.png" alt="PDF" />');
  });
    
  $('#css button').click(function() {
    $('#css a').css({
      color: 'red',
      fontWeight: 'bold',
      'background-color': '#ff3'
    });
  });
  


  $('#submit-1 form').submit(function() {
    if ( $('#name').val() == '' ) {
      $('span.help').show();
      return false;
    }
  });


  $('#click a.menu').click(function() {
    $(this).next().toggle();
    return false;
  });

  $('#slideToggle a.menu').click(function() {
    $(this).next().slideToggle('slow');
    return false;
  });

  $('#slide button').click(function() {
    $('div.block').animate({
      fontSize: '2em',
      width: '+=20%',
      backgroundColor: 'green'
    });
  });
  
  $('#hideshow button').click(function() {
    $('div.block').hide('slow', function() {
      $(this).show('slow');
    });
  });
  
  $('#load button').click(function() {
    $('div.load').load('file.html');
  });
  
  $('#load2 button').click(function() {
    $('#load2 div.load').load('file.html h2');
  });
  
  $('#live-table tr')
  .bind('click', function() {
    $(this).css({color: '#f00'});
  })
  .live('click', function() {
    $(this).css({backgroundColor: '#ff0'});
  });
  
	$('#add-row').click(function() {
    $('#live-table tr:last').after('<tr><td colspan="3">new row!</td></tr>');
		return false;
	});
	
	$('<li><a></a></li>')
    .find('a')
    .attr('href', 'http://www.learningjquery.com/')
    .html('Learn More')
  .end()
  .appendTo('#html ul');
  
  $("#row-striping form").submit(function() {
		var $thisSlide = $(this).parents('.slide');
		var selector = $("#stripe").val();

		$thisSlide.find('.alt').removeClass('alt');
    $thisSlide.find(selector).addClass('alt');
		return false;
	});
});

