$(document).ready(function() {
  
  // Homepage Slideshow Functionality
  $('#home-slides').cycle({
		fx: 'scrollLeft',
    timeout: 5000,
    speed: 500,
    easing: 'backinout',
    next: '#next-slide',
    prev: '#previous-slide',
    pause: 1
	});
  
  // Homepage Podcast Functionality
  $('#podcasts').before('<ul id="podcast-nav">').cycle({ 
    fx:     'fade', 
    speed:  'fast', 
    timeout: 0, 
    pager:  '#podcast-nav', 
    pauseOnPagerHover: true,
    pagerEvent: 'mouseover',
    pagerAnchorBuilder: function(idx, slide) { 
      return '#podcast-nav li:eq(' + idx + ') img'; 
    } 
  });
	
  // Navigation Fancy Things!
  $('#nav ul').superfish({
    hoverClass: 'sfhover',
    delay: 0,
    animation: { opacity: 'show' },
    autoArrows: false,
    speed: 200
  }); 
  
  // Rollover Image Functionality
  // Just give the image a class of "rollover" and it'll change the _off and _on in the filename on hover.
  $(".rollover").hover(
    function() {
      this.src = this.src.replace("_off","_on");
    },
    function() {
      this.src = this.src.replace("_on","_off");
    }
  );
  
  // Fancybox Implementation
  $(".fancybox").fancybox({
    'width': '95%',
    'height': '75%',
    'autoScale': false,
    'transitionIn': 'none',
    'transitionOut': 'none',
    'type': 'iframe',
    'overlayOpacity': '.8',
    'overlayColor': '#000000'
  });	
  
  $("a.lightbox").fancybox();

  $('a.top').click(function(){
    $('html, body').animate({scrollTop:0}, 'slow');
    return false;
  });
  
});

