(function ($) {
	"use strict";

	Drupal.behaviors.about_page_terms_and_conditions_block = {
		attach: function (context, settings) {

			var $block = $('#block-views-about-page-blocks-terms');

			if($block.is('.processed')) {
				return;
			}

			$block.addClass('processed');

			var $fields = $('.views-field', $block);

			// Hide all but the first
			$fields.filter('.views-field:not(:first-child)').hide();

			// Add the titles of each field to a nav block
			var $nav = $('<div class="item-list"><ul class="nav"></ul></div>');

			$('h3', $fields).each(function(index, item) {
				$('ul', $nav).append('<li><a href="#">' + $(item).text() + '</a></li>');
			});

			$nav.prependTo($('.content', $block))

			// Handle click events on the nav
			$block.delegate('.nav a', 'click', function(e) {

				e.preventDefault();

				$fields
					.eq($(this).closest('li').index())
					.show()
					.siblings()
					.hide();

			});


		}
	};


})(jQuery);
;
(function ($) {
	"use strict";

	Drupal.behaviors.lightbox = {
		attach: function (context, settings) {

			$('.node-mode-lightbox', context)
				.find('.field:eq(0)')
					.show()
				.end()
				.find('.clickable-overlay')
					.click(function(e) {

						var $content = $(this).closest('.content').clone();
						$('.field:gt(0)', $content).wrapAll('<div class="meta"></div>');

						var $video = $('video', $content);
						if($video.length > 0) {

							//$('video', $content).replaceWith();
							$content.prepend($('<video width="830" height="550" src="' + $video.attr('src') + '"></video>'));
							$('.mediaelement-video', $content).remove();

						}


						$('img', $content).each(function(index, item) {
							$content.addClass('loading');
							$(item).attr('src', $(item).attr('src').replace(/^(.*\/sites\/default\/files\/styles\/)[a-z_]*\/(.*)$/, '$1lightbox_large/$2'));

							$(item).load(function() {
								$content.removeClass('loading');
							});

						});

						$content
							.dialog({
								open: true,
								minWidth: 830,
								minHeight: 550,
								modal: true,
								dialogClass: 'gloster-lightbox',
								resizable: false
							});

						$('video', $content).mediaelementplayer({
							width: 830,
							height: 550
						});



					});


		}
	};


})(jQuery);
;
(function ($) {
	"use strict";

	Drupal.behaviors.meganav = {
		attach: function (context, settings) {

			var $collections = $('.menu-536', context);
			var $header = $('#header', context);
			var $meganav = $('#meganav', $header);
			
			// Main hover (activate over collections item)
			$collections.once().mouseenter(function(e){

				$meganav.stop(true, true).fadeIn();

			});
			// Deactivate hover once leaving meganav div and hovering over other items
			$meganav.once().mouseleave(function(e){

				$meganav.stop(true, true).fadeOut();

			});
			$('#header #logo').mouseenter(function(e){

				$meganav.stop(true, true).fadeOut();
			
			});
			$('#main-menu-links li').not($collections).mouseenter(function(e){

				$meganav.stop(true, true).fadeOut();
			
			});
			$header.not($meganav).mouseleave(function(e){
				
				$meganav.stop(true, true).fadeOut();
				
			});
			$('#header #secondary-menu-links').mouseenter(function(e){
			
				$meganav.stop(true, true).fadeOut();
				
			});

			// Individual collection items hover
			$('.view-meganav-nodes .views-field-field-listing-image', $meganav)
				.once()
				.css('display', 'block')
				.hide();

			$('.view-meganav-nodes', $meganav)
				.once()
				.delegate('li', 'mouseover', function(e) {

					var $this = $(this);
					$('.views-field-field-listing-image', $this).stop(true, true).fadeIn();

				})
				.delegate('li', 'mouseout', function(e) {
					var $this = $(this);
					setTimeout(function() { $('.views-field-field-listing-image', $this).stop(true, true).fadeOut()}, 2000);

				});

		}

	};

})(jQuery);
;
(function ($) {

/**
 * Open Mollom privacy policy link in a new window.
 *
 * Required for valid XHTML Strict markup.
 */
Drupal.behaviors.mollomPrivacy = {
  attach: function (context) {
    $('.mollom-privacy a', context).click(function () {
      this.target = '_blank';
    });
  }
};

/**
 * Attach click event handlers for CAPTCHA links.
 */
Drupal.behaviors.mollomCaptcha = {
  attach: function (context, settings) {
    // @todo Pass the local settings we get from Drupal.attachBehaviors(), or
    //   inline the click event handlers, or turn them into methods of this
    //   behavior object.
    $('a.mollom-switch-captcha', context).click(getMollomCaptcha);
  }
};

/**
 * Fetch a Mollom CAPTCHA and output the image or audio into the form.
 */
function getMollomCaptcha() {
  // Get the current requested CAPTCHA type from the clicked link.
  var newCaptchaType = $(this).hasClass('mollom-audio-captcha') ? 'audio' : 'image';

  var context = $(this).parents('form');

  // Extract the Mollom session id and form build id from the form.
  var mollomSessionId = $('input.mollom-session-id', context).val();
  var formBuildId = $('input[name="form_build_id"]', context).val();

  // Retrieve a CAPTCHA:
  $.getJSON(Drupal.settings.basePath + 'mollom/captcha/' + newCaptchaType + '/' + formBuildId + '/' + mollomSessionId,
    function (data) {
      if (!(data && data.content)) {
        return;
      }
      // Inject new CAPTCHA.
      $('.mollom-captcha-content', context).parent().html(data.content);
      // Update session id.
      $('input.mollom-session-id', context).val(data.session_id);
      // Add an onclick-event handler for the new link.
      Drupal.attachBehaviors(context);
      // Focus on the CATPCHA input.
      $('input[name="mollom[captcha]"]', context).focus();
    }
  );
  return false;
}

})(jQuery);
;
/**
 * jQuery.ScrollTo - Easy element scrolling using jQuery.
 * Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
 * Dual licensed under MIT and GPL.
 * Date: 5/25/2009
 * @author Ariel Flesler
 * @version 1.4.2
 *
 * http://flesler.blogspot.com/2007/10/jqueryscrollto.html
 */
;(function(d){var k=d.scrollTo=function(a,i,e){d(window).scrollTo(a,i,e)};k.defaults={axis:'xy',duration:parseFloat(d.fn.jquery)>=1.3?0:1};k.window=function(a){return d(window)._scrollable()};d.fn._scrollable=function(){return this.map(function(){var a=this,i=!a.nodeName||d.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!i)return a;var e=(a.contentWindow||a).document||a.ownerDocument||a;return d.browser.safari||e.compatMode=='BackCompat'?e.body:e.documentElement})};d.fn.scrollTo=function(n,j,b){if(typeof j=='object'){b=j;j=0}if(typeof b=='function')b={onAfter:b};if(n=='max')n=9e9;b=d.extend({},k.defaults,b);j=j||b.speed||b.duration;b.queue=b.queue&&b.axis.length>1;if(b.queue)j/=2;b.offset=p(b.offset);b.over=p(b.over);return this._scrollable().each(function(){var q=this,r=d(q),f=n,s,g={},u=r.is('html,body');switch(typeof f){case'number':case'string':if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(f)){f=p(f);break}f=d(f,this);case'object':if(f.is||f.style)s=(f=d(f)).offset()}d.each(b.axis.split(''),function(a,i){var e=i=='x'?'Left':'Top',h=e.toLowerCase(),c='scroll'+e,l=q[c],m=k.max(q,i);if(s){g[c]=s[h]+(u?0:l-r.offset()[h]);if(b.margin){g[c]-=parseInt(f.css('margin'+e))||0;g[c]-=parseInt(f.css('border'+e+'Width'))||0}g[c]+=b.offset[h]||0;if(b.over[h])g[c]+=f[i=='x'?'width':'height']()*b.over[h]}else{var o=f[h];g[c]=o.slice&&o.slice(-1)=='%'?parseFloat(o)/100*m:o}if(/^\d+$/.test(g[c]))g[c]=g[c]<=0?0:Math.min(g[c],m);if(!a&&b.queue){if(l!=g[c])t(b.onAfterFirst);delete g[c]}});t(b.onAfter);function t(a){r.animate(g,j,b.easing,a&&function(){a.call(this,n,b)})}}).end()};k.max=function(a,i){var e=i=='x'?'Width':'Height',h='scroll'+e;if(!d(a).is('html,body'))return a[h]-d(a)[e.toLowerCase()]();var c='client'+e,l=a.ownerDocument.documentElement,m=a.ownerDocument.body;return Math.max(l[h],m[h])-Math.min(l[c],m[c])};function p(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery);;

// Avoid stray console messages crashing clients that don't support console
window.console = window.console || {'log': function () {}};

// Global namespace
Gloster = {};;

