$(document).ready(function() {
  $("#volunteer_type").hide();
  
  $('#registration_form').validate({
    rules: {
       email_again: {
         equalTo: "#email"
       }
     }
  });
  
  $("#registration_form .date").datepicker({
    changeMonth: true,
		changeYear: true,
		minDate: new Date(1996, 08),
		maxDate: new Date(2004, 08),
		defaultDate: '-10y'
		});
  
  $('a[rel*=external]').attr("target", "_blank");
  
  $("input#would_like_to_volunteer").click(function()
  {
    if($(this).is(":checked"))
    {
     $("#volunteer_type").show(); 
    }
    else
    {
     $("#volunteer_type").hide();
    }
  });
  
  var endDate = new Date(2010, 9, 12, 0, 0, 0);
  var today = new Date();
  
  $('#countdown_dashboard').css('display', 'block');
  
  if(today < endDate)
  {
    $('#countdown_dashboard').countDown({
  		targetDate: {
  			'day': 		16,
  			'month': 	8,
  			'year': 	2010,
  			'hour': 	0,
  			'min': 		0,
  			'sec': 		0
  		}
  	});
  }
  else if(today >= new Date(2010, 9, 12, 0, 0, 0) && today <= new Date(2010, 9, 13, 0, 0, 0))
  {
    $('#countdown_dashboard').html('<h2>Season Begins Today!</h2>');
  }
  else 
  {
    $('#countdown_dashboard').html('<h2>SEASON HAS STARTED!</h2>');
  }
});
