text: (function ($) {
  
  Drupal.behaviors.initColorbox = {
    attach: function (context, settings) {
      if (!$.isFunction($.colorbox)) {
        return;
      }
      $('a, area, input', context)
        .filter('.colorbox')
        .once('init-colorbox')
        .colorbox(settings.colorbox);
    }
  };
  
  {
    $(document).bind('cbox_complete', function () {
      Drupal.attachBehaviors('#cboxLoadedContent');
    });
  }
  
  })(jQuery);
  ;
  Drupal.behaviors.mediaGalleryColorbox = {};
  
  Drupal.behaviors.mediaGalleryColorbox.attach = function (context, settings) {
    var $ = jQuery, $galleries, $gallery, href, $links, $link, $dummyLinksPre, $dummyLinksPost, i, j;
    if ($.fn.colorbox) {
      // Add a colorbox group for each media gallery field on the page.
      $galleries = $('.field-name-media-gallery-media');
      for (i = 0; i < $galleries.length; i++) {
        $gallery = $($galleries[i]);
        $links = $('a.cbEnabled', $gallery);
        $dummyLinksPre = $gallery.parent().find('ul:has(a.colorbox-supplemental-link.pre)');
        $dummyLinksPost = $gallery.parent().find('ul:has(a.colorbox-supplemental-link.post)');
        $dummyLinksPost.appendTo($gallery);
        $links = $links.add('a', $dummyLinksPre).add('a', $dummyLinksPost);
        $links.attr('rel', 'colorbox-' + i);
        for (j = 0; j < $links.length; j++) {
          // Change the link href to point to the lightbox version of the media.
          $link = $($links[j]);
          href = $link.attr('href');
          $link.attr('href', href.replace(/\/detail\/([0-9]+)\/([0-9]+)/, '/lightbox/$1/$2'));
        }
        $links.not('.meta-wrapper').colorbox({
          slideshow: true,
          slideshowAuto: false,
          slideshowStart: Drupal.t('Slideshow'),
          slideshowStop: '[' + Drupal.t('stop slideshow') + ']',
          slideshowSpeed: 4000,
          current: Drupal.t('Item !current of !total', {'!current':'{current}', '!total':'{total}'}),
          innerWidth: 'auto',
          // If 'title' evaluates to false, Colorbox will use the title from the
          // underlying <a> element, which we don't want. Using a space is the
          // officially approved workaround. See
          // http://groups.google.com/group/colorbox/msg/7671ae69708950bf
          title: ' ',
          transition: 'fade',
          preloading: true,
          fastIframe: false,
          onComplete: function () {
            $(this).colorbox.resize();
          }
        });
      }
      $('a.meta-wrapper').bind('click', Drupal.mediaGalleryColorbox.metaClick);
      // Subscribe to the media_youtube module's load event, so we can pause
      // the slideshow and play the video.
      $(window).bind('media_youtube_load', Drupal.mediaGalleryColorbox.handleMediaYoutubeLoad);
    }
  };
  
  Drupal.mediaGalleryColorbox = {};
  
  /**
   * Handles the click event on the metadata.
   */
  Drupal.mediaGalleryColorbox.metaClick = function (event) {
    event.preventDefault();
    jQuery(this).prev('.media-gallery-item').find('a.cbEnabled').click();
  };
  
  /**
   * Handles the media_youtube module's load event.
   *
   * If the colorbox slideshow is playing, and it gets to a video, the video
   * should play automatically, and the slideshow should pause until it's done.
   */
  Drupal.mediaGalleryColorbox.handleMediaYoutubeLoad = function (event, videoSettings) {
    var $ = jQuery;
    var slideshowOn = $('#colorbox').hasClass('cboxSlideshow_on');
    // Set a width on a wrapper for the video so that the colorbox will size properly.
    $('#colorbox .media-gallery-item').width(videoSettings.width + 'px').height(videoSettings.height + 'px');
    if (slideshowOn) {
      videoSettings.options.autoplay = 1;
      $('#cboxSlideshow')
        // Turn off the slideshow while the video is playing.
        .click() // No, there is not a better way.
        .text('[' + Drupal.t('resume slideshow') + ']');
        // TODO: If YouTube makes its JavaScript API available for iframe videos,
        // set the slideshow to restart when the video is done playing.
    }
  };
  ;
  (function ($) {
  
  Drupal.toolbar = Drupal.toolbar || {};
  
  /**
   * Attach toggling behavior and notify the overlay of the toolbar.
   */
  Drupal.behaviors.toolbar = {
    attach: function(context) {
  
      // Set the initial state of the toolbar.
      $('#toolbar', context).once('toolbar', Drupal.toolbar.init);
  
      // Toggling toolbar drawer.
      $('#toolbar a.toggle', context).once('toolbar-toggle').click(function(e) {
        Drupal.toolbar.toggle();
        // Allow resize event handlers to recalculate sizes/positions.
        $(window).triggerHandler('resize');
        return false;
      });
    }
  };
  
  /**
   * Retrieve last saved cookie settings and set up the initial toolbar state.
   */
  Drupal.toolbar.init = function() {
    // Retrieve the collapsed status from a stored cookie.
    var collapsed = $.cookie('Drupal.toolbar.collapsed');
  
    // Expand or collapse the toolbar based on the cookie value.
    if (collapsed == 1) {
      Drupal.toolbar.collapse();
    }
    else {
      Drupal.toolbar.expand();
    }
  };
  
  /**
   * Collapse the toolbar.
   */
  Drupal.toolbar.collapse = function() {
    var toggle_text = Drupal.t('Show shortcuts');
    $('#toolbar div.toolbar-drawer').addClass('collapsed');
    $('#toolbar a.toggle')
      .removeClass('toggle-active')
      .attr('title',  toggle_text)
      .html(toggle_text);
    $('body').removeClass('toolbar-drawer').css('paddingTop', Drupal.toolbar.height());
    $.cookie(
      'Drupal.toolbar.collapsed',
      1,
      {
        path: Drupal.settings.basePath,
        // The cookie should "never" expire.
        expires: 36500
      }
    );
  };
  
  /**
   * Expand the toolbar.
   */
  Drupal.toolbar.expand = function() {
    var toggle_text = Drupal.t('Hide shortcuts');
    $('#toolbar div.toolbar-drawer').removeClass('collapsed');
    $('#toolbar a.toggle')
      .addClass('toggle-active')
      .attr('title',  toggle_text)
      .html(toggle_text);
    $('body').addClass('toolbar-drawer').css('paddingTop', Drupal.toolbar.height());
    $.cookie(
      'Drupal.toolbar.collapsed',
      0,
      {
        path: Drupal.settings.basePath,
        // The cookie should "never" expire.
        expires: 36500
      }
    );
  };
  
  /**
   * Toggle the toolbar.
   */
  Drupal.toolbar.toggle = function() {
    if ($('#toolbar div.toolbar-drawer').hasClass('collapsed')) {
      Drupal.toolbar.expand();
    }
    else {
      Drupal.toolbar.collapse();
    }
  };
  
  Drupal.toolbar.height = function() {
    var $toolbar = $('#toolbar');
    var height = $toolbar.outerHeight();
    // In modern browsers (including IE9), when box-shadow is defined, use the
    // normal height.
    var cssBoxShadowValue = $toolbar.css('box-shadow');
    var boxShadow = (typeof cssBoxShadowValue !== 'undefined' && cssBoxShadowValue !== 'none');
    // In IE8 and below, we use the shadow filter to apply box-shadow styles to
    // the toolbar. It adds some extra height that we need to remove.
    if (!boxShadow && /DXImageTransform\.Microsoft\.Shadow/.test($toolbar.css('filter'))) {
      height -= $toolbar[0].filters.item("DXImageTransform.Microsoft.Shadow").strength;
    }
    return height;
  };
  
  })(jQuery);
  ;
  