Drupal.behaviors.wh_theme_homepage = function(context) {  
  // Main Rotator
  $('#homepage-rotator .home-top-block-container').removeClass('hide');
  
  $('#homepage-rotator').cycle({
    fx:   'fade',
    timeout: 7000, // milliseconds between slide transitions
    pause: 1,
    cleartype: 1,
    cleartypeNoBg: 1,
    pager: '#home-top-num-rotator',
    pagerAnchorBuilder: function(idx, slide) {
      var title = $('.home-top-intro h1 a', slide).html();
      var img = $('.home-slide-wrapper .photo-thumb', slide).html();
      var id = idx + 1;
      return '<li><a href="#">' + id + '</a><div class="tooltip"><h3>' + title + '</h3>' + img + '</div><!--/.tooltip--></li>';
    }
  });  
  
  $('#home-top-num-rotator a').click(function() {
    $('#homepage-rotator').cycle('pause');
  });  
  
  $('#home-top-num-rotator a').tooltip({
  	tip: '.tooltip',
  	effect: 'toggle',
  	delay: 0,
  	position: ['top', 'center']
  });
  
  // A New Foundation
  $('#home-a-new-foundation-rotator li').removeClass('hide');
  
  $('#home-a-new-foundation-rotator').cycle({
  	fx: 'fade',
  	timeout: 0,
  	next: '#home-a-new-foundation .next',
  	prev: '#home-a-new-foundation .back'	
  });
}
