$(document).ready(function(){
  // slideshow behaviour 
  $('#slideshow-slides')
  .after('<div id="slideshow-nav"><p id="slideshow-caption"></p></div>')
  .cycle({
  	fx: 'fade', 
  	speed: 600, 
  	timeout: 3000, 
  	pager: '#slideshow-nav',
  	height: '190px',
  	pause: 1,
  	before: function() {$('#slideshow-caption').fadeOut(100)},
  	after: function() {$('#slideshow-caption').html($(this).contents().attr('alt')).fadeIn(100)}
  });
  
  // map address form
  $("input.clearonfocus").focus(function() {
  	if ( $(this).val() == $(this).attr("alt"))
  		$(this).val('');
  });
  
  /* Why is this here?
  $(".black-sidebar").click(function() {
  	this.next().slideToggle();
  });
  */
  
  // leadership team bios
  $('div.bios-content').hide();

  $('div.bios-header').click(function () { 
          $('div.bios-content:visible').not($(this).next()).slideToggle();
          $(this).next().slideToggle(); 
  });
  
  // podcast search form
  $('#filter_form').submit(function(){return false;});
  $("#filter_form #keywords_fld").keyup(function () {
      var filter = $(this).val(), count = 0;
      $(".filtered:first").children().each(function () {
          if ($(this).text().search(new RegExp(filter, "i")) < 0) {
              $(this).addClass("hide");
          } else {
              $(this).removeClass("hide");
              count++;
          }
      });

      $("#filter_count").text(count);

  });
}); 