/**
 * @file
 * The New Group scripts
 */
(function($) {
  Drupal.behaviors.theNewGroupWebsite = {
    attach: function (context, settings) {
      // Remove .active menu class on frontpage and replace manually.
      $('body.front #main-menu li, body.front #main-menu a').removeClass('active');

      // Animate links to anchors on the same page.
      $('body.front #main-menu a.front, body.front .logo-img a, body.front .region-content a[href^="#"]').click(function() {
        $('html, body').animate({scrollTop: $($(this).attr('hash')).offset().top}, 'slow');
        return false;
      });

      // Ensure body is the height of the viewport if not on the frontpage.
      var viewportHeight = $(window).height();
      $('body.not-front').css('height', viewportHeight);

      // Add a top margin to content zone equal to the height of administration zone.
      $('body.not-front #zone-content-wrapper').css('paddingTop', $('#zone-administration-wrapper').height() + 35);

      // Add Big Target to rollover state of Portfolio Tiles.
      $('.view-portfolio-tiles .group-hover h2.node-title a').bigTarget({
        hoverClass: 'over', // CSS class applied to the click zone onHover
        clickZone : 'div:eq(0)' // jQuery parent selector
      });

      // Make sure the content area for Portfolio Records is at least the height of the pullquote.
      $('body.node-type-portfolio-record .node-portfolio-record .content').css('minHeight', $('body.node-type-portfolio-record .field-name-field-pullquote').height() + 29);
    }
  }
})(jQuery);
;

