(function ($) {
    function visible(element) {
        return $.expr.filters.visible(element) && !$(element).parents().addBack().filter(function () {
            return $.css(this, 'visibility') === 'hidden';
        }).length;
    }

    function focusable(element, isTabIndexNotNaN) {
        var map, mapName, img, nodeName = element.nodeName.toLowerCase();
        if ('area' === nodeName) {
            map = element.parentNode;
            mapName = map.name;
            if (!element.href || !mapName || map.nodeName.toLowerCase() !== 'map') {
                return false;
            }
            img = $('img[usemap=#' + mapName + ']')[0];
            return !!img && visible(img);
        }
        return (/input|select|textarea|button|object/.test(nodeName) ?
            !element.disabled :
            'a' === nodeName ?
                element.href || isTabIndexNotNaN :
                isTabIndexNotNaN) &&
            // the element and all of its ancestors must be visible
            visible(element);
    }

    $.extend($.expr[':'], {
        focusable: function (element) {
            return focusable(element, !isNaN($.attr(element, 'tabindex')));
        }
    });
})(jQuery);
jQuery.curCSS = function (element, prop, val) {
    return jQuery(element).css(prop, val);
};;
/*!
	Colorbox 1.5.14
	license: MIT
	http://www.jacklmoore.com/colorbox
*/
(function ($, document, window) {
	var
	// Default settings object.
	// See http://jacklmoore.com/colorbox for details.
	defaults = {
		// data sources
		html: false,
		photo: false,
		iframe: false,
		inline: false,

		// behavior and appearance
		transition: "elastic",
		speed: 300,
		fadeOut: 300,
		width: false,
		initialWidth: "600",
		innerWidth: false,
		maxWidth: false,
		height: false,
		initialHeight: "450",
		innerHeight: false,
		maxHeight: false,
		scalePhotos: true,
		scrolling: true,
		opacity: 0.9,
		preloading: true,
		className: false,
		overlayClose: true,
		escKey: true,
		arrowKey: true,
		top: false,
		bottom: false,
		left: false,
		right: false,
		fixed: false,
		data: undefined,
		closeButton: true,
		fastIframe: true,
		open: false,
		reposition: true,
		loop: true,
		slideshow: false,
		slideshowAuto: true,
		slideshowSpeed: 2500,
		slideshowStart: "start slideshow",
		slideshowStop: "stop slideshow",
		photoRegex: /\.(gif|png|jp(e|g|eg)|bmp|ico|webp|jxr|svg)((#|\?).*)?$/i,

		// alternate image paths for high-res displays
		retinaImage: false,
		retinaUrl: false,
		retinaSuffix: '@2x.$1',

		// internationalization
		current: "image {current} of {total}",
		previous: "previous",
		next: "next",
		close: "close",
		xhrError: "This content failed to load.",
		imgError: "This image failed to load.",

		// accessbility
		returnFocus: true,
		trapFocus: true,

		// callbacks
		onOpen: false,
		onLoad: false,
		onComplete: false,
		onCleanup: false,
		onClosed: false,

		rel: function() {
			return this.rel;
		},
		href: function() {
			// using this.href would give the absolute url, when the href may have been inteded as a selector (e.g. '#container')
			return $(this).attr('href');
		},
		title: function() {
			return this.title;
		}
	},

	// Abstracting the HTML and event identifiers for easy rebranding
	colorbox = 'colorbox',
	prefix = 'cbox',
	boxElement = prefix + 'Element',
	
	// Events
	event_open = prefix + '_open',
	event_load = prefix + '_load',
	event_complete = prefix + '_complete',
	event_cleanup = prefix + '_cleanup',
	event_closed = prefix + '_closed',
	event_purge = prefix + '_purge',

	// Cached jQuery Object Variables
	$overlay,
	$box,
	$wrap,
	$content,
	$topBorder,
	$leftBorder,
	$rightBorder,
	$bottomBorder,
	$related,
	$window,
	$loaded,
	$loadingBay,
	$loadingOverlay,
	$title,
	$current,
	$slideshow,
	$next,
	$prev,
	$close,
	$groupControls,
	$events = $('<a/>'), // $({}) would be prefered, but there is an issue with jQuery 1.4.2
	
	// Variables for cached values or use across multiple functions
	settings,
	interfaceHeight,
	interfaceWidth,
	loadedHeight,
	loadedWidth,
	index,
	photo,
	open,
	active,
	closing,
	loadingTimer,
	publicMethod,
	div = "div",
	requests = 0,
	previousCSS = {},
	init;

	// ****************
	// HELPER FUNCTIONS
	// ****************
	
	// Convenience function for creating new jQuery objects
	function $tag(tag, id, css) {
		var element = document.createElement(tag);

		if (id) {
			element.id = prefix + id;
		}

		if (css) {
			element.style.cssText = css;
		}

		return $(element);
	}
	
	// Get the window height using innerHeight when available to avoid an issue with iOS
	// http://bugs.jquery.com/ticket/6724
	function winheight() {
		return window.innerHeight ? window.innerHeight : $(window).height();
	}

	function Settings(element, options) {
		if (options !== Object(options)) {
			options = {};
		}

		this.cache = {};
		this.el = element;

		this.value = function(key) {
			var dataAttr;

			if (this.cache[key] === undefined) {
				dataAttr = $(this.el).attr('data-cbox-'+key);

				if (dataAttr !== undefined) {
					this.cache[key] = dataAttr;
				} else if (options[key] !== undefined) {
					this.cache[key] = options[key];
				} else if (defaults[key] !== undefined) {
					this.cache[key] = defaults[key];
				}
			}

			return this.cache[key];
		};

		this.get = function(key) {
			var value = this.value(key);
			return $.isFunction(value) ? value.call(this.el, this) : value;
		};
	}

	// Determine the next and previous members in a group.
	function getIndex(increment) {
		var
		max = $related.length,
		newIndex = (index + increment) % max;
		
		return (newIndex < 0) ? max + newIndex : newIndex;
	}

	// Convert '%' and 'px' values to integers
	function setSize(size, dimension) {
		return Math.round((/%/.test(size) ? ((dimension === 'x' ? $window.width() : winheight()) / 100) : 1) * parseInt(size, 10));
	}
	
	// Checks an href to see if it is a photo.
	// There is a force photo option (photo: true) for hrefs that cannot be matched by the regex.
	function isImage(settings, url) {
		return settings.get('photo') || settings.get('photoRegex').test(url);
	}

	function retinaUrl(settings, url) {
		return settings.get('retinaUrl') && window.devicePixelRatio > 1 ? url.replace(settings.get('photoRegex'), settings.get('retinaSuffix')) : url;
	}

	function trapFocus(e) {
		if ('contains' in $box[0] && !$box[0].contains(e.target) && e.target !== $overlay[0]) {
			e.stopPropagation();
			$box.focus();
		}
	}

	function setClass(str) {
		if (setClass.str !== str) {
			$box.add($overlay).removeClass(setClass.str).addClass(str);
			setClass.str = str;
		}
	}

	function getRelated(rel) {
		index = 0;
		
		if (rel && rel !== false && rel !== 'nofollow') {
			$related = $('.' + boxElement).filter(function () {
				var options = $.data(this, colorbox);
				var settings = new Settings(this, options);
				return (settings.get('rel') === rel);
			});
			index = $related.index(settings.el);
			
			// Check direct calls to Colorbox.
			if (index === -1) {
				$related = $related.add(settings.el);
				index = $related.length - 1;
			}
		} else {
			$related = $(settings.el);
		}
	}

	function trigger(event) {
		// for external use
		$(document).trigger(event);
		// for internal use
		$events.triggerHandler(event);
	}

	var slideshow = (function(){
		var active,
			className = prefix + "Slideshow_",
			click = "click." + prefix,
			timeOut;

		function clear () {
			clearTimeout(timeOut);
		}

		function set() {
			if (settings.get('loop') || $related[index + 1]) {
				clear();
				timeOut = setTimeout(publicMethod.next, settings.get('slideshowSpeed'));
			}
		}

		function start() {
			$slideshow
				.html(settings.get('slideshowStop'))
				.unbind(click)
				.one(click, stop);

			$events
				.bind(event_complete, set)
				.bind(event_load, clear);

			$box.removeClass(className + "off").addClass(className + "on");
		}

		function stop() {
			clear();
			
			$events
				.unbind(event_complete, set)
				.unbind(event_load, clear);

			$slideshow
				.html(settings.get('slideshowStart'))
				.unbind(click)
				.one(click, function () {
					publicMethod.next();
					start();
				});

			$box.removeClass(className + "on").addClass(className + "off");
		}

		function reset() {
			active = false;
			$slideshow.hide();
			clear();
			$events
				.unbind(event_complete, set)
				.unbind(event_load, clear);
			$box.removeClass(className + "off " + className + "on");
		}

		return function(){
			if (active) {
				if (!settings.get('slideshow')) {
					$events.unbind(event_cleanup, reset);
					reset();
				}
			} else {
				if (settings.get('slideshow') && $related[1]) {
					active = true;
					$events.one(event_cleanup, reset);
					if (settings.get('slideshowAuto')) {
						start();
					} else {
						stop();
					}
					$slideshow.show();
				}
			}
		};

	}());


	function launch(element) {
		var options;

		if (!closing) {

			options = $(element).data(colorbox);

			settings = new Settings(element, options);
			
			getRelated(settings.get('rel'));

			if (!open) {
				open = active = true; // Prevents the page-change action from queuing up if the visitor holds down the left or right keys.

				setClass(settings.get('className'));
				
				// Show colorbox so the sizes can be calculated in older versions of jQuery
				$box.css({visibility:'hidden', display:'block', opacity:''});
				
				$loaded = $tag(div, 'LoadedContent', 'width:0; height:0; overflow:hidden; visibility:hidden');
				$content.css({width:'', height:''}).append($loaded);

				// Cache values needed for size calculations
				interfaceHeight = $topBorder.height() + $bottomBorder.height() + $content.outerHeight(true) - $content.height();
				interfaceWidth = $leftBorder.width() + $rightBorder.width() + $content.outerWidth(true) - $content.width();
				loadedHeight = $loaded.outerHeight(true);
				loadedWidth = $loaded.outerWidth(true);

				// Opens inital empty Colorbox prior to content being loaded.
				var initialWidth = setSize(settings.get('initialWidth'), 'x');
				var initialHeight = setSize(settings.get('initialHeight'), 'y');
				var maxWidth = settings.get('maxWidth');
				var maxHeight = settings.get('maxHeight');

				settings.w = (maxWidth !== false ? Math.min(initialWidth, setSize(maxWidth, 'x')) : initialWidth) - loadedWidth - interfaceWidth;
				settings.h = (maxHeight !== false ? Math.min(initialHeight, setSize(maxHeight, 'y')) : initialHeight) - loadedHeight - interfaceHeight;

				$loaded.css({width:'', height:settings.h});
				publicMethod.position();

				trigger(event_open);
				settings.get('onOpen');

				$groupControls.add($title).hide();

				$box.focus();
				
				if (settings.get('trapFocus')) {
					// Confine focus to the modal
					// Uses event capturing that is not supported in IE8-
					if (document.addEventListener) {

						document.addEventListener('focus', trapFocus, true);
						
						$events.one(event_closed, function () {
							document.removeEventListener('focus', trapFocus, true);
						});
					}
				}

				// Return focus on closing
				if (settings.get('returnFocus')) {
					$events.one(event_closed, function () {
						$(settings.el).focus();
					});
				}
			}

			var opacity = parseFloat(settings.get('opacity'));
			$overlay.css({
				opacity: opacity === opacity ? opacity : '',
				cursor: settings.get('overlayClose') ? 'pointer' : '',
				visibility: 'visible'
			}).show();
			
			if (settings.get('closeButton')) {
				$close.html(settings.get('close')).appendTo($content);
			} else {
				$close.appendTo('<div/>'); // replace with .detach() when dropping jQuery < 1.4
			}

			load();
		}
	}

	// Colorbox's markup needs to be added to the DOM prior to being called
	// so that the browser will go ahead and load the CSS background images.
	function appendHTML() {
		if (!$box) {
			init = false;
			$window = $(window);
			$box = $tag(div).attr({
				id: colorbox,
				'class': $.support.opacity === false ? prefix + 'IE' : '', // class for optional IE8 & lower targeted CSS.
				role: 'dialog',
				tabindex: '-1'
			}).hide();
			$overlay = $tag(div, "Overlay").hide();
			$loadingOverlay = $([$tag(div, "LoadingOverlay")[0],$tag(div, "LoadingGraphic")[0]]);
			$wrap = $tag(div, "Wrapper");
			$content = $tag(div, "Content").append(
				$title = $tag(div, "Title"),
				$current = $tag(div, "Current"),
				$prev = $('<button type="button"/>').attr({id:prefix+'Previous'}),
				$next = $('<button type="button"/>').attr({id:prefix+'Next'}),
				$slideshow = $tag('button', "Slideshow"),
				$loadingOverlay
			);

			$close = $('<button type="button"/>').attr({id:prefix+'Close'});
			
			$wrap.append( // The 3x3 Grid that makes up Colorbox
				$tag(div).append(
					$tag(div, "TopLeft"),
					$topBorder = $tag(div, "TopCenter"),
					$tag(div, "TopRight")
				),
				$tag(div, false, 'clear:left').append(
					$leftBorder = $tag(div, "MiddleLeft"),
					$content,
					$rightBorder = $tag(div, "MiddleRight")
				),
				$tag(div, false, 'clear:left').append(
					$tag(div, "BottomLeft"),
					$bottomBorder = $tag(div, "BottomCenter"),
					$tag(div, "BottomRight")
				)
			).find('div div').css({'float': 'left'});
			
			$loadingBay = $tag(div, false, 'position:absolute; width:9999px; visibility:hidden; display:none; max-width:none;');
			
			$groupControls = $next.add($prev).add($current).add($slideshow);
		}
		if (document.body && !$box.parent().length) {
			$(document.body).append($overlay, $box.append($wrap, $loadingBay));
		}
	}

	// Add Colorbox's event bindings
	function addBindings() {
		function clickHandler(e) {
			// ignore non-left-mouse-clicks and clicks modified with ctrl / command, shift, or alt.
			// See: http://jacklmoore.com/notes/click-events/
			if (!(e.which > 1 || e.shiftKey || e.altKey || e.metaKey || e.ctrlKey)) {
				e.preventDefault();
				launch(this);
			}
		}

		if ($box) {
			if (!init) {
				init = true;

				// Anonymous functions here keep the public method from being cached, thereby allowing them to be redefined on the fly.
				$next.click(function () {
					publicMethod.next();
				});
				$prev.click(function () {
					publicMethod.prev();
				});
				$close.click(function () {
					publicMethod.close();
				});
				$overlay.click(function () {
					if (settings.get('overlayClose')) {
						publicMethod.close();
					}
				});
				
				// Key Bindings
				$(document).bind('keydown.' + prefix, function (e) {
					var key = e.keyCode;
					if (open && settings.get('escKey') && key === 27) {
						e.preventDefault();
						publicMethod.close();
					}
					if (open && settings.get('arrowKey') && $related[1] && !e.altKey) {
						if (key === 37) {
							e.preventDefault();
							$prev.click();
						} else if (key === 39) {
							e.preventDefault();
							$next.click();
						}
					}
				});

				if ($.isFunction($.fn.on)) {
					// For jQuery 1.7+
					$(document).on('click.'+prefix, '.'+boxElement, clickHandler);
				} else {
					// For jQuery 1.3.x -> 1.6.x
					// This code is never reached in jQuery 1.9, so do not contact me about 'live' being removed.
					// This is not here for jQuery 1.9, it's here for legacy users.
					$('.'+boxElement).live('click.'+prefix, clickHandler);
				}
			}
			return true;
		}
		return false;
	}

	// Don't do anything if Colorbox already exists.
	if ($[colorbox]) {
		return;
	}

	// Append the HTML when the DOM loads
	$(appendHTML);


	// ****************
	// PUBLIC FUNCTIONS
	// Usage format: $.colorbox.close();
	// Usage from within an iframe: parent.jQuery.colorbox.close();
	// ****************
	
	publicMethod = $.fn[colorbox] = $[colorbox] = function (options, callback) {
		var settings;
		var $obj = this;

		options = options || {};

		if ($.isFunction($obj)) { // assume a call to $.colorbox
			$obj = $('<a/>');
			options.open = true;
		} else if (!$obj[0]) { // colorbox being applied to empty collection
			return $obj;
		}


		if (!$obj[0]) { // colorbox being applied to empty collection
			return $obj;
		}
		
		appendHTML();

		if (addBindings()) {

			if (callback) {
				options.onComplete = callback;
			}

			$obj.each(function () {
				var old = $.data(this, colorbox) || {};
				$.data(this, colorbox, $.extend(old, options));
			}).addClass(boxElement);

			settings = new Settings($obj[0], options);
			
			if (settings.get('open')) {
				launch($obj[0]);
			}
		}
		
		return $obj;
	};

	publicMethod.position = function (speed, loadedCallback) {
		var
		css,
		top = 0,
		left = 0,
		offset = $box.offset(),
		scrollTop,
		scrollLeft;
		
		$window.unbind('resize.' + prefix);

		// remove the modal so that it doesn't influence the document width/height
		$box.css({top: -9e4, left: -9e4});

		scrollTop = $window.scrollTop();
		scrollLeft = $window.scrollLeft();

		if (settings.get('fixed')) {
			offset.top -= scrollTop;
			offset.left -= scrollLeft;
			$box.css({position: 'fixed'});
		} else {
			top = scrollTop;
			left = scrollLeft;
			$box.css({position: 'absolute'});
		}

		// keeps the top and left positions within the browser's viewport.
		if (settings.get('right') !== false) {
			left += Math.max($window.width() - settings.w - loadedWidth - interfaceWidth - setSize(settings.get('right'), 'x'), 0);
		} else if (settings.get('left') !== false) {
			left += setSize(settings.get('left'), 'x');
		} else {
			left += Math.round(Math.max($window.width() - settings.w - loadedWidth - interfaceWidth, 0) / 2);
		}
		
		if (settings.get('bottom') !== false) {
			top += Math.max(winheight() - settings.h - loadedHeight - interfaceHeight - setSize(settings.get('bottom'), 'y'), 0);
		} else if (settings.get('top') !== false) {
			top += setSize(settings.get('top'), 'y');
		} else {
			top += Math.round(Math.max(winheight() - settings.h - loadedHeight - interfaceHeight, 0) / 2);
		}

		$box.css({top: offset.top, left: offset.left, visibility:'visible'});
		
		// this gives the wrapper plenty of breathing room so it's floated contents can move around smoothly,
		// but it has to be shrank down around the size of div#colorbox when it's done.  If not,
		// it can invoke an obscure IE bug when using iframes.
		$wrap[0].style.width = $wrap[0].style.height = "9999px";
		
		function modalDimensions() {
			$topBorder[0].style.width = $bottomBorder[0].style.width = $content[0].style.width = (parseInt($box[0].style.width,10) - interfaceWidth)+'px';
			$content[0].style.height = $leftBorder[0].style.height = $rightBorder[0].style.height = (parseInt($box[0].style.height,10) - interfaceHeight)+'px';
		}

		css = {width: settings.w + loadedWidth + interfaceWidth, height: settings.h + loadedHeight + interfaceHeight, top: top, left: left};

		// setting the speed to 0 if the content hasn't changed size or position
		if (speed) {
			var tempSpeed = 0;
			$.each(css, function(i){
				if (css[i] !== previousCSS[i]) {
					tempSpeed = speed;
					return;
				}
			});
			speed = tempSpeed;
		}

		previousCSS = css;

		if (!speed) {
			$box.css(css);
		}

		$box.dequeue().animate(css, {
			duration: speed || 0,
			complete: function () {
				modalDimensions();
				
				active = false;
				
				// shrink the wrapper down to exactly the size of colorbox to avoid a bug in IE's iframe implementation.
				$wrap[0].style.width = (settings.w + loadedWidth + interfaceWidth) + "px";
				$wrap[0].style.height = (settings.h + loadedHeight + interfaceHeight) + "px";
				
				if (settings.get('reposition')) {
					setTimeout(function () {  // small delay before binding onresize due to an IE8 bug.
						$window.bind('resize.' + prefix, publicMethod.position);
					}, 1);
				}

				if ($.isFunction(loadedCallback)) {
					loadedCallback();
				}
			},
			step: modalDimensions
		});
	};

	publicMethod.resize = function (options) {
		var scrolltop;
		
		/*if (open) {
			options = options || {};
			
			if (options.width) {
				settings.w = setSize(options.width, 'x') - loadedWidth - interfaceWidth;
			}

			if (options.innerWidth) {
				settings.w = setSize(options.innerWidth, 'x');
			}

			$loaded.css({width: settings.w});
			
			if (options.height) {
				settings.h = setSize(options.height, 'y') - loadedHeight - interfaceHeight;
			}

			if (options.innerHeight) {
				settings.h = setSize(options.innerHeight, 'y');
			}

			if (!options.innerHeight && !options.height) {
				scrolltop = $loaded.scrollTop();
				$loaded.css({height: "auto"});
				settings.h = $loaded.height();
			}

			$loaded.css({height: settings.h});

			if(scrolltop) {
				$loaded.scrollTop(scrolltop);
			}
			
			publicMethod.position(settings.get('transition') === "none" ? 0 : settings.get('speed'));
		}*/
	};

	publicMethod.prep = function (object) {
		if (!open) {
			return;
		}
		
		var callback, speed = settings.get('transition') === "none" ? 0 : settings.get('speed');

		$loaded.remove();

		$loaded = $tag(div, 'LoadedContent').append(object);
		
		function getWidth() {
			settings.w = settings.w || $loaded.width();
			settings.w = settings.mw && settings.mw < settings.w ? settings.mw : settings.w;
			return settings.w;
		}
		function getHeight() {
			settings.h = settings.h || $loaded.height();
			settings.h = settings.mh && settings.mh < settings.h ? settings.mh : settings.h;
			return settings.h;
		}
		
		$loaded.hide()
		.appendTo($loadingBay.show())// content has to be appended to the DOM for accurate size calculations.
		.css({width: getWidth(), overflow: settings.get('scrolling') ? 'auto' : 'hidden'})
		.css({height: getHeight()})// sets the height independently from the width in case the new width influences the value of height.
		.prependTo($content);
		
		$loadingBay.hide();
		
		// floating the IMG removes the bottom line-height and fixed a problem where IE miscalculates the width of the parent element as 100% of the document width.
		
		$(photo).css({'float': 'none'});

		setClass(settings.get('className'));

		callback = function () {
			var total = $related.length,
				iframe,
				complete;
			
			if (!open) {
				return;
			}
			
			function removeFilter() { // Needed for IE8 in versions of jQuery prior to 1.7.2
				if ($.support.opacity === false) {
					$box[0].style.removeAttribute('filter');
				}
			}
			
			complete = function () {
				clearTimeout(loadingTimer);
				$loadingOverlay.hide();
				trigger(event_complete);
				settings.get('onComplete');
			};

			
			$title.html(settings.get('title')).show();
			$loaded.show();
			
			if (total > 1) { // handle grouping
				if (typeof settings.get('current') === "string") {
					$current.html(settings.get('current').replace('{current}', index + 1).replace('{total}', total)).show();
				}
				
				$next[(settings.get('loop') || index < total - 1) ? "show" : "hide"]().html(settings.get('next'));
				$prev[(settings.get('loop') || index) ? "show" : "hide"]().html(settings.get('previous'));
				
				slideshow();
				
				// Preloads images within a rel group
				if (settings.get('preloading')) {
					$.each([getIndex(-1), getIndex(1)], function(){
						var img,
							i = $related[this],
							settings = new Settings(i, $.data(i, colorbox)),
							src = settings.get('href');

						if (src && isImage(settings, src)) {
							src = retinaUrl(settings, src);
							img = document.createElement('img');
							img.src = src;
						}
					});
				}
			} else {
				$groupControls.hide();
			}
			
			if (settings.get('iframe')) {
				iframe = document.createElement('iframe');
				
				if ('frameBorder' in iframe) {
					iframe.frameBorder = 0;
				}
				
				if ('allowTransparency' in iframe) {
					iframe.allowTransparency = "true";
				}

				if (!settings.get('scrolling')) {
					iframe.scrolling = "no";
				}
				
				$(iframe)
					.attr({
						src: settings.get('href'),
						name: (new Date()).getTime(), // give the iframe a unique name to prevent caching
						'class': prefix + 'Iframe',
						allowFullScreen : true // allow HTML5 video to go fullscreen
					})
					.one('load', complete)
					.appendTo($loaded);
				
				$events.one(event_purge, function () {
					iframe.src = "//about:blank";
				});

				if (settings.get('fastIframe')) {
					$(iframe).trigger('load');
				}
			} else {
				complete();
			}
			
			if (settings.get('transition') === 'fade') {
				$box.fadeTo(speed, 1, removeFilter);
			} else {
				removeFilter();
			}
		};
		
		if (settings.get('transition') === 'fade') {
			$box.fadeTo(speed, 0, function () {
				publicMethod.position(0, callback);
			});
		} else {
			publicMethod.position(speed, callback);
		}
	};

	function load () {
		var href, setResize, prep = publicMethod.prep, $inline, request = ++requests;
		
		active = true;
		
		photo = false;
		
		trigger(event_purge);
		trigger(event_load);
		settings.get('onLoad');
		
		settings.h = settings.get('height') ?
				setSize(settings.get('height'), 'y') - loadedHeight - interfaceHeight :
				settings.get('innerHeight') && setSize(settings.get('innerHeight'), 'y');
		
		settings.w = settings.get('width') ?
				setSize(settings.get('width'), 'x') - loadedWidth - interfaceWidth :
				settings.get('innerWidth') && setSize(settings.get('innerWidth'), 'x');
		
		// Sets the minimum dimensions for use in image scaling
		settings.mw = settings.w;
		settings.mh = settings.h;
		
		// Re-evaluate the minimum width and height based on maxWidth and maxHeight values.
		// If the width or height exceed the maxWidth or maxHeight, use the maximum values instead.
		if (settings.get('maxWidth')) {
			settings.mw = setSize(settings.get('maxWidth'), 'x') - loadedWidth - interfaceWidth;
			settings.mw = settings.w && settings.w < settings.mw ? settings.w : settings.mw;
		}
		if (settings.get('maxHeight')) {
			settings.mh = setSize(settings.get('maxHeight'), 'y') - loadedHeight - interfaceHeight;
			settings.mh = settings.h && settings.h < settings.mh ? settings.h : settings.mh;
		}
		
		href = settings.get('href');
		
		loadingTimer = setTimeout(function () {
			$loadingOverlay.show();
		}, 100);
		
		if (settings.get('inline')) {
			var $target = $(href);
			// Inserts an empty placeholder where inline content is being pulled from.
			// An event is bound to put inline content back when Colorbox closes or loads new content.
			$inline = $('<div>').hide().insertBefore($target);

			$events.one(event_purge, function () {
				$inline.replaceWith($target);
			});

			prep($target);
		} else if (settings.get('iframe')) {
			// IFrame element won't be added to the DOM until it is ready to be displayed,
			// to avoid problems with DOM-ready JS that might be trying to run in that iframe.
			prep(" ");
		} else if (settings.get('html')) {
			prep(settings.get('html'));
		} else if (isImage(settings, href)) {

			href = retinaUrl(settings, href);

			photo = new Image();

			$(photo)
			.addClass(prefix + 'Photo')
			.bind('error',function () {
				prep($tag(div, 'Error').html(settings.get('imgError')));
			})
			.one('load', function () {
				if (request !== requests) {
					return;
				}

				// A small pause because some browsers will occassionaly report a 
				// img.width and img.height of zero immediately after the img.onload fires
				setTimeout(function(){
					var percent;

					$.each(['alt', 'longdesc', 'aria-describedby'], function(i,val){
						var attr = $(settings.el).attr(val) || $(settings.el).attr('data-'+val);
						if (attr) {
							photo.setAttribute(val, attr);
						}
					});

					if (settings.get('retinaImage') && window.devicePixelRatio > 1) {
						photo.height = photo.height / window.devicePixelRatio;
						photo.width = photo.width / window.devicePixelRatio;
					}

					if (settings.get('scalePhotos')) {
						setResize = function () {
							photo.height -= photo.height * percent;
							photo.width -= photo.width * percent;
						};
						if (settings.mw && photo.width > settings.mw) {
							percent = (photo.width - settings.mw) / photo.width;
							setResize();
						}
						if (settings.mh && photo.height > settings.mh) {
							percent = (photo.height - settings.mh) / photo.height;
							setResize();
						}
					}
					
					if (settings.h) {
						photo.style.marginTop = Math.max(settings.mh - photo.height, 0) / 2 + 'px';
					}
					
					if ($related[1] && (settings.get('loop') || $related[index + 1])) {
						photo.style.cursor = 'pointer';
						photo.onclick = function () {
							publicMethod.next();
						};
					}

					photo.style.width = photo.width + 'px';
					photo.style.height = photo.height + 'px';
					prep(photo);
				}, 1);
			});
			
			photo.src = href;

		} else if (href) {
			$loadingBay.load(href, settings.get('data'), function (data, status) {
				if (request === requests) {
					prep(status === 'error' ? $tag(div, 'Error').html(settings.get('xhrError')) : $(this).contents());
				}
			});
		}
	}
		
	// Navigates to the next page/image in a set.
	publicMethod.next = function () {
		if (!active && $related[1] && (settings.get('loop') || $related[index + 1])) {
			index = getIndex(1);
			launch($related[index]);
		}
	};
	
	publicMethod.prev = function () {
		if (!active && $related[1] && (settings.get('loop') || index)) {
			index = getIndex(-1);
			launch($related[index]);
		}
	};

	// Note: to use this within an iframe use the following format: parent.jQuery.colorbox.close();
	publicMethod.close = function () {
		if (open && !closing) {
			
			closing = true;
			open = false;
			trigger(event_cleanup);
			settings.get('onCleanup');
			$window.unbind('.' + prefix);
			$overlay.fadeTo(settings.get('fadeOut') || 0, 0);
			
			$box.stop().fadeTo(settings.get('fadeOut') || 0, 0, function () {
				$box.hide();
				$overlay.hide();
				trigger(event_purge);
				$loaded.remove();
				
				setTimeout(function () {
					closing = false;
					trigger(event_closed);
					settings.get('onClosed');
				}, 1);
			});
		}
	};

	// Removes changes Colorbox made to the document, but does not remove the plugin.
	publicMethod.remove = function () {
		if (!$box) { return; }

		$box.stop();
		$[colorbox].close();
		$box.stop(false, true).remove();
		$overlay.remove();
		closing = false;
		$box = null;
		$('.' + boxElement)
			.removeData(colorbox)
			.removeClass(boxElement);

		$(document).unbind('click.'+prefix).unbind('keydown.'+prefix);
	};

	// A method for fetching the current element Colorbox is referencing.
	// returns a jQuery object.
	publicMethod.element = function () {
		return $(settings.el);
	};

	publicMethod.settings = defaults;

}(jQuery, document, window));
;
/*!
* jQuery Cycle2; version: 2.1.5 build: 20140415
* http://jquery.malsup.com/cycle2/
* Copyright (c) 2014 M. Alsup; Dual licensed: MIT/GPL
*/
!function(a){"use strict";function b(a){return(a||"").toLowerCase()}var c="2.1.5";a.fn.cycle=function(c){var d;return 0!==this.length||a.isReady?this.each(function(){var d,e,f,g,h=a(this),i=a.fn.cycle.log;if(!h.data("cycle.opts")){(h.data("cycle-log")===!1||c&&c.log===!1||e&&e.log===!1)&&(i=a.noop),i("--c2 init--"),d=h.data();for(var j in d)d.hasOwnProperty(j)&&/^cycle[A-Z]+/.test(j)&&(g=d[j],f=j.match(/^cycle(.*)/)[1].replace(/^[A-Z]/,b),i(f+":",g,"("+typeof g+")"),d[f]=g);e=a.extend({},a.fn.cycle.defaults,d,c||{}),e.timeoutId=0,e.paused=e.paused||!1,e.container=h,e._maxZ=e.maxZ,e.API=a.extend({_container:h},a.fn.cycle.API),e.API.log=i,e.API.trigger=function(a,b){return e.container.trigger(a,b),e.API},h.data("cycle.opts",e),h.data("cycle.API",e.API),e.API.trigger("cycle-bootstrap",[e,e.API]),e.API.addInitialSlides(),e.API.preInitSlideshow(),e.slides.length&&e.API.initSlideshow()}}):(d={s:this.selector,c:this.context},a.fn.cycle.log("requeuing slideshow (dom not ready)"),a(function(){a(d.s,d.c).cycle(c)}),this)},a.fn.cycle.API={opts:function(){return this._container.data("cycle.opts")},addInitialSlides:function(){var b=this.opts(),c=b.slides;b.slideCount=0,b.slides=a(),c=c.jquery?c:b.container.find(c),b.random&&c.sort(function(){return Math.random()-.5}),b.API.add(c)},preInitSlideshow:function(){var b=this.opts();b.API.trigger("cycle-pre-initialize",[b]);var c=a.fn.cycle.transitions[b.fx];c&&a.isFunction(c.preInit)&&c.preInit(b),b._preInitialized=!0},postInitSlideshow:function(){var b=this.opts();b.API.trigger("cycle-post-initialize",[b]);var c=a.fn.cycle.transitions[b.fx];c&&a.isFunction(c.postInit)&&c.postInit(b)},initSlideshow:function(){var b,c=this.opts(),d=c.container;c.API.calcFirstSlide(),"static"==c.container.css("position")&&c.container.css("position","relative"),a(c.slides[c.currSlide]).css({opacity:1,display:"block",visibility:"visible"}),c.API.stackSlides(c.slides[c.currSlide],c.slides[c.nextSlide],!c.reverse),c.pauseOnHover&&(c.pauseOnHover!==!0&&(d=a(c.pauseOnHover)),d.hover(function(){c.API.pause(!0)},function(){c.API.resume(!0)})),c.timeout&&(b=c.API.getSlideOpts(c.currSlide),c.API.queueTransition(b,b.timeout+c.delay)),c._initialized=!0,c.API.updateView(!0),c.API.trigger("cycle-initialized",[c]),c.API.postInitSlideshow()},pause:function(b){var c=this.opts(),d=c.API.getSlideOpts(),e=c.hoverPaused||c.paused;b?c.hoverPaused=!0:c.paused=!0,e||(c.container.addClass("cycle-paused"),c.API.trigger("cycle-paused",[c]).log("cycle-paused"),d.timeout&&(clearTimeout(c.timeoutId),c.timeoutId=0,c._remainingTimeout-=a.now()-c._lastQueue,(c._remainingTimeout<0||isNaN(c._remainingTimeout))&&(c._remainingTimeout=void 0)))},resume:function(a){var b=this.opts(),c=!b.hoverPaused&&!b.paused;a?b.hoverPaused=!1:b.paused=!1,c||(b.container.removeClass("cycle-paused"),0===b.slides.filter(":animated").length&&b.API.queueTransition(b.API.getSlideOpts(),b._remainingTimeout),b.API.trigger("cycle-resumed",[b,b._remainingTimeout]).log("cycle-resumed"))},add:function(b,c){var d,e=this.opts(),f=e.slideCount,g=!1;"string"==a.type(b)&&(b=a.trim(b)),a(b).each(function(){var b,d=a(this);c?e.container.prepend(d):e.container.append(d),e.slideCount++,b=e.API.buildSlideOpts(d),e.slides=c?a(d).add(e.slides):e.slides.add(d),e.API.initSlide(b,d,--e._maxZ),d.data("cycle.opts",b),e.API.trigger("cycle-slide-added",[e,b,d])}),e.API.updateView(!0),g=e._preInitialized&&2>f&&e.slideCount>=1,g&&(e._initialized?e.timeout&&(d=e.slides.length,e.nextSlide=e.reverse?d-1:1,e.timeoutId||e.API.queueTransition(e)):e.API.initSlideshow())},calcFirstSlide:function(){var a,b=this.opts();a=parseInt(b.startingSlide||0,10),(a>=b.slides.length||0>a)&&(a=0),b.currSlide=a,b.reverse?(b.nextSlide=a-1,b.nextSlide<0&&(b.nextSlide=b.slides.length-1)):(b.nextSlide=a+1,b.nextSlide==b.slides.length&&(b.nextSlide=0))},calcNextSlide:function(){var a,b=this.opts();b.reverse?(a=b.nextSlide-1<0,b.nextSlide=a?b.slideCount-1:b.nextSlide-1,b.currSlide=a?0:b.nextSlide+1):(a=b.nextSlide+1==b.slides.length,b.nextSlide=a?0:b.nextSlide+1,b.currSlide=a?b.slides.length-1:b.nextSlide-1)},calcTx:function(b,c){var d,e=b;return e._tempFx?d=a.fn.cycle.transitions[e._tempFx]:c&&e.manualFx&&(d=a.fn.cycle.transitions[e.manualFx]),d||(d=a.fn.cycle.transitions[e.fx]),e._tempFx=null,this.opts()._tempFx=null,d||(d=a.fn.cycle.transitions.fade,e.API.log('Transition "'+e.fx+'" not found.  Using fade.')),d},prepareTx:function(a,b){var c,d,e,f,g,h=this.opts();return h.slideCount<2?void(h.timeoutId=0):(!a||h.busy&&!h.manualTrump||(h.API.stopTransition(),h.busy=!1,clearTimeout(h.timeoutId),h.timeoutId=0),void(h.busy||(0!==h.timeoutId||a)&&(d=h.slides[h.currSlide],e=h.slides[h.nextSlide],f=h.API.getSlideOpts(h.nextSlide),g=h.API.calcTx(f,a),h._tx=g,a&&void 0!==f.manualSpeed&&(f.speed=f.manualSpeed),h.nextSlide!=h.currSlide&&(a||!h.paused&&!h.hoverPaused&&h.timeout)?(h.API.trigger("cycle-before",[f,d,e,b]),g.before&&g.before(f,d,e,b),c=function(){h.busy=!1,h.container.data("cycle.opts")&&(g.after&&g.after(f,d,e,b),h.API.trigger("cycle-after",[f,d,e,b]),h.API.queueTransition(f),h.API.updateView(!0))},h.busy=!0,g.transition?g.transition(f,d,e,b,c):h.API.doTransition(f,d,e,b,c),h.API.calcNextSlide(),h.API.updateView()):h.API.queueTransition(f))))},doTransition:function(b,c,d,e,f){var g=b,h=a(c),i=a(d),j=function(){i.animate(g.animIn||{opacity:1},g.speed,g.easeIn||g.easing,f)};i.css(g.cssBefore||{}),h.animate(g.animOut||{},g.speed,g.easeOut||g.easing,function(){h.css(g.cssAfter||{}),g.sync||j()}),g.sync&&j()},queueTransition:function(b,c){var d=this.opts(),e=void 0!==c?c:b.timeout;return 0===d.nextSlide&&0===--d.loop?(d.API.log("terminating; loop=0"),d.timeout=0,e?setTimeout(function(){d.API.trigger("cycle-finished",[d])},e):d.API.trigger("cycle-finished",[d]),void(d.nextSlide=d.currSlide)):void 0!==d.continueAuto&&(d.continueAuto===!1||a.isFunction(d.continueAuto)&&d.continueAuto()===!1)?(d.API.log("terminating automatic transitions"),d.timeout=0,void(d.timeoutId&&clearTimeout(d.timeoutId))):void(e&&(d._lastQueue=a.now(),void 0===c&&(d._remainingTimeout=b.timeout),d.paused||d.hoverPaused||(d.timeoutId=setTimeout(function(){d.API.prepareTx(!1,!d.reverse)},e))))},stopTransition:function(){var a=this.opts();a.slides.filter(":animated").length&&(a.slides.stop(!1,!0),a.API.trigger("cycle-transition-stopped",[a])),a._tx&&a._tx.stopTransition&&a._tx.stopTransition(a)},advanceSlide:function(a){var b=this.opts();return clearTimeout(b.timeoutId),b.timeoutId=0,b.nextSlide=b.currSlide+a,b.nextSlide<0?b.nextSlide=b.slides.length-1:b.nextSlide>=b.slides.length&&(b.nextSlide=0),b.API.prepareTx(!0,a>=0),!1},buildSlideOpts:function(c){var d,e,f=this.opts(),g=c.data()||{};for(var h in g)g.hasOwnProperty(h)&&/^cycle[A-Z]+/.test(h)&&(d=g[h],e=h.match(/^cycle(.*)/)[1].replace(/^[A-Z]/,b),f.API.log("["+(f.slideCount-1)+"]",e+":",d,"("+typeof d+")"),g[e]=d);g=a.extend({},a.fn.cycle.defaults,f,g),g.slideNum=f.slideCount;try{delete g.API,delete g.slideCount,delete g.currSlide,delete g.nextSlide,delete g.slides}catch(i){}return g},getSlideOpts:function(b){var c=this.opts();void 0===b&&(b=c.currSlide);var d=c.slides[b],e=a(d).data("cycle.opts");return a.extend({},c,e)},initSlide:function(b,c,d){var e=this.opts();c.css(b.slideCss||{}),d>0&&c.css("zIndex",d),isNaN(b.speed)&&(b.speed=a.fx.speeds[b.speed]||a.fx.speeds._default),b.sync||(b.speed=b.speed/2),c.addClass(e.slideClass)},updateView:function(a,b){var c=this.opts();if(c._initialized){var d=c.API.getSlideOpts(),e=c.slides[c.currSlide];!a&&b!==!0&&(c.API.trigger("cycle-update-view-before",[c,d,e]),c.updateView<0)||(c.slideActiveClass&&c.slides.removeClass(c.slideActiveClass).eq(c.currSlide).addClass(c.slideActiveClass),a&&c.hideNonActive&&c.slides.filter(":not(."+c.slideActiveClass+")").css("visibility","hidden"),0===c.updateView&&setTimeout(function(){c.API.trigger("cycle-update-view",[c,d,e,a])},d.speed/(c.sync?2:1)),0!==c.updateView&&c.API.trigger("cycle-update-view",[c,d,e,a]),a&&c.API.trigger("cycle-update-view-after",[c,d,e]))}},getComponent:function(b){var c=this.opts(),d=c[b];return"string"==typeof d?/^\s*[\>|\+|~]/.test(d)?c.container.find(d):a(d):d.jquery?d:a(d)},stackSlides:function(b,c,d){var e=this.opts();b||(b=e.slides[e.currSlide],c=e.slides[e.nextSlide],d=!e.reverse),a(b).css("zIndex",e.maxZ);var f,g=e.maxZ-2,h=e.slideCount;if(d){for(f=e.currSlide+1;h>f;f++)a(e.slides[f]).css("zIndex",g--);for(f=0;f<e.currSlide;f++)a(e.slides[f]).css("zIndex",g--)}else{for(f=e.currSlide-1;f>=0;f--)a(e.slides[f]).css("zIndex",g--);for(f=h-1;f>e.currSlide;f--)a(e.slides[f]).css("zIndex",g--)}a(c).css("zIndex",e.maxZ-1)},getSlideIndex:function(a){return this.opts().slides.index(a)}},a.fn.cycle.log=function(){window.console&&console.log&&console.log("[cycle2] "+Array.prototype.join.call(arguments," "))},a.fn.cycle.version=function(){return"Cycle2: "+c},a.fn.cycle.transitions={custom:{},none:{before:function(a,b,c,d){a.API.stackSlides(c,b,d),a.cssBefore={opacity:1,visibility:"visible",display:"block"}}},fade:{before:function(b,c,d,e){var f=b.API.getSlideOpts(b.nextSlide).slideCss||{};b.API.stackSlides(c,d,e),b.cssBefore=a.extend(f,{opacity:0,visibility:"visible",display:"block"}),b.animIn={opacity:1},b.animOut={opacity:0}}},fadeout:{before:function(b,c,d,e){var f=b.API.getSlideOpts(b.nextSlide).slideCss||{};b.API.stackSlides(c,d,e),b.cssBefore=a.extend(f,{opacity:1,visibility:"visible",display:"block"}),b.animOut={opacity:0}}},scrollHorz:{before:function(a,b,c,d){a.API.stackSlides(b,c,d);var e=a.container.css("overflow","hidden").width();a.cssBefore={left:d?e:-e,top:0,opacity:1,visibility:"visible",display:"block"},a.cssAfter={zIndex:a._maxZ-2,left:0},a.animIn={left:0},a.animOut={left:d?-e:e}}}},a.fn.cycle.defaults={allowWrap:!0,autoSelector:".cycle-slideshow[data-cycle-auto-init!=false]",delay:0,easing:null,fx:"fade",hideNonActive:!0,loop:0,manualFx:void 0,manualSpeed:void 0,manualTrump:!0,maxZ:100,pauseOnHover:!1,reverse:!1,slideActiveClass:"cycle-slide-active",slideClass:"cycle-slide",slideCss:{position:"absolute",top:0,left:0},slides:"> img",speed:500,startingSlide:0,sync:!0,timeout:4e3,updateView:0},a(document).ready(function(){a(a.fn.cycle.defaults.autoSelector).cycle()})}(jQuery),/*! Cycle2 autoheight plugin; Copyright (c) M.Alsup, 2012; version: 20130913 */
function(a){"use strict";function b(b,d){var e,f,g,h=d.autoHeight;if("container"==h)f=a(d.slides[d.currSlide]).outerHeight(),d.container.height(f);else if(d._autoHeightRatio)d.container.height(d.container.width()/d._autoHeightRatio);else if("calc"===h||"number"==a.type(h)&&h>=0){if(g="calc"===h?c(b,d):h>=d.slides.length?0:h,g==d._sentinelIndex)return;d._sentinelIndex=g,d._sentinel&&d._sentinel.remove(),e=a(d.slides[g].cloneNode(!0)),e.removeAttr("id name rel").find("[id],[name],[rel]").removeAttr("id name rel"),e.css({position:"static",visibility:"hidden",display:"block"}).prependTo(d.container).addClass("cycle-sentinel cycle-slide").removeClass("cycle-slide-active"),e.find("*").css("visibility","hidden"),d._sentinel=e}}function c(b,c){var d=0,e=-1;return c.slides.each(function(b){var c=a(this).height();c>e&&(e=c,d=b)}),d}function d(b,c,d,e){var f=a(e).outerHeight();c.container.animate({height:f},c.autoHeightSpeed,c.autoHeightEasing)}function e(c,f){f._autoHeightOnResize&&(a(window).off("resize orientationchange",f._autoHeightOnResize),f._autoHeightOnResize=null),f.container.off("cycle-slide-added cycle-slide-removed",b),f.container.off("cycle-destroyed",e),f.container.off("cycle-before",d),f._sentinel&&(f._sentinel.remove(),f._sentinel=null)}a.extend(a.fn.cycle.defaults,{autoHeight:0,autoHeightSpeed:250,autoHeightEasing:null}),a(document).on("cycle-initialized",function(c,f){function g(){b(c,f)}var h,i=f.autoHeight,j=a.type(i),k=null;("string"===j||"number"===j)&&(f.container.on("cycle-slide-added cycle-slide-removed",b),f.container.on("cycle-destroyed",e),"container"==i?f.container.on("cycle-before",d):"string"===j&&/\d+\:\d+/.test(i)&&(h=i.match(/(\d+)\:(\d+)/),h=h[1]/h[2],f._autoHeightRatio=h),"number"!==j&&(f._autoHeightOnResize=function(){clearTimeout(k),k=setTimeout(g,50)},a(window).on("resize orientationchange",f._autoHeightOnResize)),setTimeout(g,30))})}(jQuery),/*! caption plugin for Cycle2;  version: 20130306 */
function(a){"use strict";a.extend(a.fn.cycle.defaults,{caption:"> .cycle-caption",captionTemplate:"{{slideNum}} / {{slideCount}}",overlay:"> .cycle-overlay",overlayTemplate:"<div>{{title}}</div><div>{{desc}}</div>",captionModule:"caption"}),a(document).on("cycle-update-view",function(b,c,d,e){if("caption"===c.captionModule){a.each(["caption","overlay"],function(){var a=this,b=d[a+"Template"],f=c.API.getComponent(a);f.length&&b?(f.html(c.API.tmpl(b,d,c,e)),f.show()):f.hide()})}}),a(document).on("cycle-destroyed",function(b,c){var d;a.each(["caption","overlay"],function(){var a=this,b=c[a+"Template"];c[a]&&b&&(d=c.API.getComponent("caption"),d.empty())})})}(jQuery),/*! command plugin for Cycle2;  version: 20140415 */
function(a){"use strict";var b=a.fn.cycle;a.fn.cycle=function(c){var d,e,f,g=a.makeArray(arguments);return"number"==a.type(c)?this.cycle("goto",c):"string"==a.type(c)?this.each(function(){var h;return d=c,f=a(this).data("cycle.opts"),void 0===f?void b.log('slideshow must be initialized before sending commands; "'+d+'" ignored'):(d="goto"==d?"jump":d,e=f.API[d],a.isFunction(e)?(h=a.makeArray(g),h.shift(),e.apply(f.API,h)):void b.log("unknown command: ",d))}):b.apply(this,arguments)},a.extend(a.fn.cycle,b),a.extend(b.API,{next:function(){var a=this.opts();if(!a.busy||a.manualTrump){var b=a.reverse?-1:1;a.allowWrap===!1&&a.currSlide+b>=a.slideCount||(a.API.advanceSlide(b),a.API.trigger("cycle-next",[a]).log("cycle-next"))}},prev:function(){var a=this.opts();if(!a.busy||a.manualTrump){var b=a.reverse?1:-1;a.allowWrap===!1&&a.currSlide+b<0||(a.API.advanceSlide(b),a.API.trigger("cycle-prev",[a]).log("cycle-prev"))}},destroy:function(){this.stop();var b=this.opts(),c=a.isFunction(a._data)?a._data:a.noop;clearTimeout(b.timeoutId),b.timeoutId=0,b.API.stop(),b.API.trigger("cycle-destroyed",[b]).log("cycle-destroyed"),b.container.removeData(),c(b.container[0],"parsedAttrs",!1),b.retainStylesOnDestroy||(b.container.removeAttr("style"),b.slides.removeAttr("style"),b.slides.removeClass(b.slideActiveClass)),b.slides.each(function(){a(this).removeData(),c(this,"parsedAttrs",!1)})},jump:function(a,b){var c,d=this.opts();if(!d.busy||d.manualTrump){var e=parseInt(a,10);if(isNaN(e)||0>e||e>=d.slides.length)return void d.API.log("goto: invalid slide index: "+e);if(e==d.currSlide)return void d.API.log("goto: skipping, already on slide",e);d.nextSlide=e,clearTimeout(d.timeoutId),d.timeoutId=0,d.API.log("goto: ",e," (zero-index)"),c=d.currSlide<d.nextSlide,d._tempFx=b,d.API.prepareTx(!0,c)}},stop:function(){var b=this.opts(),c=b.container;clearTimeout(b.timeoutId),b.timeoutId=0,b.API.stopTransition(),b.pauseOnHover&&(b.pauseOnHover!==!0&&(c=a(b.pauseOnHover)),c.off("mouseenter mouseleave")),b.API.trigger("cycle-stopped",[b]).log("cycle-stopped")},reinit:function(){var a=this.opts();a.API.destroy(),a.container.cycle()},remove:function(b){for(var c,d,e=this.opts(),f=[],g=1,h=0;h<e.slides.length;h++)c=e.slides[h],h==b?d=c:(f.push(c),a(c).data("cycle.opts").slideNum=g,g++);d&&(e.slides=a(f),e.slideCount--,a(d).remove(),b==e.currSlide?e.API.advanceSlide(1):b<e.currSlide?e.currSlide--:e.currSlide++,e.API.trigger("cycle-slide-removed",[e,b,d]).log("cycle-slide-removed"),e.API.updateView())}}),a(document).on("click.cycle","[data-cycle-cmd]",function(b){b.preventDefault();var c=a(this),d=c.data("cycle-cmd"),e=c.data("cycle-context")||".cycle-slideshow";a(e).cycle(d,c.data("cycle-arg"))})}(jQuery),/*! hash plugin for Cycle2;  version: 20130905 */
function(a){"use strict";function b(b,c){var d;return b._hashFence?void(b._hashFence=!1):(d=window.location.hash.substring(1),void b.slides.each(function(e){if(a(this).data("cycle-hash")==d){if(c===!0)b.startingSlide=e;else{var f=b.currSlide<e;b.nextSlide=e,b.API.prepareTx(!0,f)}return!1}}))}a(document).on("cycle-pre-initialize",function(c,d){b(d,!0),d._onHashChange=function(){b(d,!1)},a(window).on("hashchange",d._onHashChange)}),a(document).on("cycle-update-view",function(a,b,c){c.hash&&"#"+c.hash!=window.location.hash&&(b._hashFence=!0,window.location.hash=c.hash)}),a(document).on("cycle-destroyed",function(b,c){c._onHashChange&&a(window).off("hashchange",c._onHashChange)})}(jQuery),/*! loader plugin for Cycle2;  version: 20131121 */
function(a){"use strict";a.extend(a.fn.cycle.defaults,{loader:!1}),a(document).on("cycle-bootstrap",function(b,c){function d(b,d){function f(b){var f;"wait"==c.loader?(h.push(b),0===j&&(h.sort(g),e.apply(c.API,[h,d]),c.container.removeClass("cycle-loading"))):(f=a(c.slides[c.currSlide]),e.apply(c.API,[b,d]),f.show(),c.container.removeClass("cycle-loading"))}function g(a,b){return a.data("index")-b.data("index")}var h=[];if("string"==a.type(b))b=a.trim(b);else if("array"===a.type(b))for(var i=0;i<b.length;i++)b[i]=a(b[i])[0];b=a(b);var j=b.length;j&&(b.css("visibility","hidden").appendTo("body").each(function(b){function g(){0===--i&&(--j,f(k))}var i=0,k=a(this),l=k.is("img")?k:k.find("img");return k.data("index",b),l=l.filter(":not(.cycle-loader-ignore)").filter(':not([src=""])'),l.length?(i=l.length,void l.each(function(){this.complete?g():a(this).load(function(){g()}).on("error",function(){0===--i&&(c.API.log("slide skipped; img not loaded:",this.src),0===--j&&"wait"==c.loader&&e.apply(c.API,[h,d]))})})):(--j,void h.push(k))}),j&&c.container.addClass("cycle-loading"))}var e;c.loader&&(e=c.API.add,c.API.add=d)})}(jQuery),/*! pager plugin for Cycle2;  version: 20140415 */
function(a){"use strict";function b(b,c,d){var e,f=b.API.getComponent("pager");f.each(function(){var f=a(this);if(c.pagerTemplate){var g=b.API.tmpl(c.pagerTemplate,c,b,d[0]);e=a(g).appendTo(f)}else e=f.children().eq(b.slideCount-1);e.on(b.pagerEvent,function(a){b.pagerEventBubble||a.preventDefault(),b.API.page(f,a.currentTarget)})})}function c(a,b){var c=this.opts();if(!c.busy||c.manualTrump){var d=a.children().index(b),e=d,f=c.currSlide<e;c.currSlide!=e&&(c.nextSlide=e,c._tempFx=c.pagerFx,c.API.prepareTx(!0,f),c.API.trigger("cycle-pager-activated",[c,a,b]))}}a.extend(a.fn.cycle.defaults,{pager:"> .cycle-pager",pagerActiveClass:"cycle-pager-active",pagerEvent:"click.cycle",pagerEventBubble:void 0,pagerTemplate:"<span>&bull;</span>"}),a(document).on("cycle-bootstrap",function(a,c,d){d.buildPagerLink=b}),a(document).on("cycle-slide-added",function(a,b,d,e){b.pager&&(b.API.buildPagerLink(b,d,e),b.API.page=c)}),a(document).on("cycle-slide-removed",function(b,c,d){if(c.pager){var e=c.API.getComponent("pager");e.each(function(){var b=a(this);a(b.children()[d]).remove()})}}),a(document).on("cycle-update-view",function(b,c){var d;c.pager&&(d=c.API.getComponent("pager"),d.each(function(){a(this).children().removeClass(c.pagerActiveClass).eq(c.currSlide).addClass(c.pagerActiveClass)}))}),a(document).on("cycle-destroyed",function(a,b){var c=b.API.getComponent("pager");c&&(c.children().off(b.pagerEvent),b.pagerTemplate&&c.empty())})}(jQuery),/*! prevnext plugin for Cycle2;  version: 20140408 */
function(a){"use strict";a.extend(a.fn.cycle.defaults,{next:"> .cycle-next",nextEvent:"click.cycle",disabledClass:"disabled",prev:"> .cycle-prev",prevEvent:"click.cycle",swipe:!1}),a(document).on("cycle-initialized",function(a,b){if(b.API.getComponent("next").on(b.nextEvent,function(a){a.preventDefault(),b.API.next()}),b.API.getComponent("prev").on(b.prevEvent,function(a){a.preventDefault(),b.API.prev()}),b.swipe){var c=b.swipeVert?"swipeUp.cycle":"swipeLeft.cycle swipeleft.cycle",d=b.swipeVert?"swipeDown.cycle":"swipeRight.cycle swiperight.cycle";b.container.on(c,function(){b._tempFx=b.swipeFx,b.API.next()}),b.container.on(d,function(){b._tempFx=b.swipeFx,b.API.prev()})}}),a(document).on("cycle-update-view",function(a,b){if(!b.allowWrap){var c=b.disabledClass,d=b.API.getComponent("next"),e=b.API.getComponent("prev"),f=b._prevBoundry||0,g=void 0!==b._nextBoundry?b._nextBoundry:b.slideCount-1;b.currSlide==g?d.addClass(c).prop("disabled",!0):d.removeClass(c).prop("disabled",!1),b.currSlide===f?e.addClass(c).prop("disabled",!0):e.removeClass(c).prop("disabled",!1)}}),a(document).on("cycle-destroyed",function(a,b){b.API.getComponent("prev").off(b.nextEvent),b.API.getComponent("next").off(b.prevEvent),b.container.off("swipeleft.cycle swiperight.cycle swipeLeft.cycle swipeRight.cycle swipeUp.cycle swipeDown.cycle")})}(jQuery),/*! progressive loader plugin for Cycle2;  version: 20130315 */
function(a){"use strict";a.extend(a.fn.cycle.defaults,{progressive:!1}),a(document).on("cycle-pre-initialize",function(b,c){if(c.progressive){var d,e,f=c.API,g=f.next,h=f.prev,i=f.prepareTx,j=a.type(c.progressive);if("array"==j)d=c.progressive;else if(a.isFunction(c.progressive))d=c.progressive(c);else if("string"==j){if(e=a(c.progressive),d=a.trim(e.html()),!d)return;if(/^(\[)/.test(d))try{d=a.parseJSON(d)}catch(k){return void f.log("error parsing progressive slides",k)}else d=d.split(new RegExp(e.data("cycle-split")||"\n")),d[d.length-1]||d.pop()}i&&(f.prepareTx=function(a,b){var e,f;return a||0===d.length?void i.apply(c.API,[a,b]):void(b&&c.currSlide==c.slideCount-1?(f=d[0],d=d.slice(1),c.container.one("cycle-slide-added",function(a,b){setTimeout(function(){b.API.advanceSlide(1)},50)}),c.API.add(f)):b||0!==c.currSlide?i.apply(c.API,[a,b]):(e=d.length-1,f=d[e],d=d.slice(0,e),c.container.one("cycle-slide-added",function(a,b){setTimeout(function(){b.currSlide=1,b.API.advanceSlide(-1)},50)}),c.API.add(f,!0)))}),g&&(f.next=function(){var a=this.opts();if(d.length&&a.currSlide==a.slideCount-1){var b=d[0];d=d.slice(1),a.container.one("cycle-slide-added",function(a,b){g.apply(b.API),b.container.removeClass("cycle-loading")}),a.container.addClass("cycle-loading"),a.API.add(b)}else g.apply(a.API)}),h&&(f.prev=function(){var a=this.opts();if(d.length&&0===a.currSlide){var b=d.length-1,c=d[b];d=d.slice(0,b),a.container.one("cycle-slide-added",function(a,b){b.currSlide=1,b.API.advanceSlide(-1),b.container.removeClass("cycle-loading")}),a.container.addClass("cycle-loading"),a.API.add(c,!0)}else h.apply(a.API)})}})}(jQuery),/*! tmpl plugin for Cycle2;  version: 20121227 */
function(a){"use strict";a.extend(a.fn.cycle.defaults,{tmplRegex:"{{((.)?.*?)}}"}),a.extend(a.fn.cycle.API,{tmpl:function(b,c){var d=new RegExp(c.tmplRegex||a.fn.cycle.defaults.tmplRegex,"g"),e=a.makeArray(arguments);return e.shift(),b.replace(d,function(b,c){var d,f,g,h,i=c.split(".");for(d=0;d<e.length;d++)if(g=e[d]){if(i.length>1)for(h=g,f=0;f<i.length;f++)g=h,h=h[i[f]]||c;else h=g[c];if(a.isFunction(h))return h.apply(g,e);if(void 0!==h&&null!==h&&h!=c)return h}return c})}})}(jQuery);
//# sourceMappingURL=jquery.cycle2.js.map;
/* Plugin for Cycle2; Copyright (c) 2012 M. Alsup; v20140114 */
(function(e){"use strict";e(document).on("cycle-bootstrap",function(e,t,i){"carousel"===t.fx&&(i.getSlideIndex=function(e){var t=this.opts()._carouselWrap.children(),i=t.index(e);return i%t.length},i.next=function(){var e=t.reverse?-1:1;t.allowWrap===!1&&t.currSlide+e>t.slideCount-t.carouselVisible||(t.API.advanceSlide(e),t.API.trigger("cycle-next",[t]).log("cycle-next"))})}),e.fn.cycle.transitions.carousel={preInit:function(t){t.hideNonActive=!1,t.container.on("cycle-destroyed",e.proxy(this.onDestroy,t.API)),t.API.stopTransition=this.stopTransition;for(var i=0;t.startingSlide>i;i++)t.container.append(t.slides[0])},postInit:function(t){var i,n,s,o,r=t.carouselVertical;t.carouselVisible&&t.carouselVisible>t.slideCount&&(t.carouselVisible=t.slideCount-1);var l=t.carouselVisible||t.slides.length,c={display:r?"block":"inline-block",position:"static"};if(t.container.css({position:"relative",overflow:"hidden"}),t.slides.css(c),t._currSlide=t.currSlide,o=e('<div class="cycle-carousel-wrap"></div>').prependTo(t.container).css({margin:0,padding:0,top:0,left:0,position:"absolute"}).append(t.slides),t._carouselWrap=o,r||o.css("white-space","nowrap"),t.allowWrap!==!1){for(n=0;(void 0===t.carouselVisible?2:1)>n;n++){for(i=0;t.slideCount>i;i++)o.append(t.slides[i].cloneNode(!0));for(i=t.slideCount;i--;)o.prepend(t.slides[i].cloneNode(!0))}o.find(".cycle-slide-active").removeClass("cycle-slide-active"),t.slides.eq(t.startingSlide).addClass("cycle-slide-active")}t.pager&&t.allowWrap===!1&&(s=t.slideCount-l,e(t.pager).children().filter(":gt("+s+")").hide()),t._nextBoundry=t.slideCount-t.carouselVisible,this.prepareDimensions(t)},prepareDimensions:function(t){var i,n,s,o,r=t.carouselVertical,l=t.carouselVisible||t.slides.length;if(t.carouselFluid&&t.carouselVisible?t._carouselResizeThrottle||this.fluidSlides(t):t.carouselVisible&&t.carouselSlideDimension?(i=l*t.carouselSlideDimension,t.container[r?"height":"width"](i)):t.carouselVisible&&(i=l*e(t.slides[0])[r?"outerHeight":"outerWidth"](!0),t.container[r?"height":"width"](i)),n=t.carouselOffset||0,t.allowWrap!==!1)if(t.carouselSlideDimension)n-=(t.slideCount+t.currSlide)*t.carouselSlideDimension;else for(s=t._carouselWrap.children(),o=0;t.slideCount+t.currSlide>o;o++)n-=e(s[o])[r?"outerHeight":"outerWidth"](!0);t._carouselWrap.css(r?"top":"left",n)},fluidSlides:function(t){function i(){clearTimeout(s),s=setTimeout(n,20)}function n(){t._carouselWrap.stop(!1,!0);var e=t.container.width()/t.carouselVisible;e=Math.ceil(e-r),t._carouselWrap.children().width(e),t._sentinel&&t._sentinel.width(e),l(t)}var s,o=t.slides.eq(0),r=o.outerWidth()-o.width(),l=this.prepareDimensions;e(window).on("resize",i),t._carouselResizeThrottle=i,n()},transition:function(t,i,n,s,o){var r,l={},c=t.nextSlide-t.currSlide,a=t.carouselVertical,d=t.speed;if(t.allowWrap===!1){s=c>0;var u=t._currSlide,p=t.slideCount-t.carouselVisible;c>0&&t.nextSlide>p&&u==p?c=0:c>0&&t.nextSlide>p?c=t.nextSlide-u-(t.nextSlide-p):0>c&&t.currSlide>p&&t.nextSlide>p?c=0:0>c&&t.currSlide>p?c+=t.currSlide-p:u=t.currSlide,r=this.getScroll(t,a,u,c),t.API.opts()._currSlide=t.nextSlide>p?p:t.nextSlide}else s&&0===t.nextSlide?(r=this.getDim(t,t.currSlide,a),o=this.genCallback(t,s,a,o)):s||t.nextSlide!=t.slideCount-1?r=this.getScroll(t,a,t.currSlide,c):(r=this.getDim(t,t.currSlide,a),o=this.genCallback(t,s,a,o));l[a?"top":"left"]=s?"-="+r:"+="+r,t.throttleSpeed&&(d=r/e(t.slides[0])[a?"height":"width"]()*t.speed),t._carouselWrap.animate(l,d,t.easing,o)},getDim:function(t,i,n){var s=e(t.slides[i]);return s[n?"outerHeight":"outerWidth"](!0)},getScroll:function(e,t,i,n){var s,o=0;if(n>0)for(s=i;i+n>s;s++)o+=this.getDim(e,s,t);else for(s=i;s>i+n;s--)o+=this.getDim(e,s,t);return o},genCallback:function(t,i,n,s){return function(){var i=e(t.slides[t.nextSlide]).position(),o=0-i[n?"top":"left"]+(t.carouselOffset||0);t._carouselWrap.css(t.carouselVertical?"top":"left",o),s()}},stopTransition:function(){var e=this.opts();e.slides.stop(!1,!0),e._carouselWrap.stop(!1,!0)},onDestroy:function(){var t=this.opts();t._carouselResizeThrottle&&e(window).off("resize",t._carouselResizeThrottle),t.slides.prependTo(t.container),t._carouselWrap.remove()}}})(jQuery);;
/* Plugin for Cycle2; Copyright (c) 2012 M. Alsup; v20140128 */
(function(e){"use strict";e.event.special.swipe=e.event.special.swipe||{scrollSupressionThreshold:10,durationThreshold:1e3,horizontalDistanceThreshold:30,verticalDistanceThreshold:75,setup:function(){var i=e(this);i.bind("touchstart",function(t){function n(i){if(r){var t=i.originalEvent.touches?i.originalEvent.touches[0]:i;s={time:(new Date).getTime(),coords:[t.pageX,t.pageY]}}}var s,o=t.originalEvent.touches?t.originalEvent.touches[0]:t,r={time:(new Date).getTime(),coords:[o.pageX,o.pageY],origin:e(t.target)};i.bind("touchmove",n).one("touchend",function(){i.unbind("touchmove",n),r&&s&&s.time-r.time<e.event.special.swipe.durationThreshold&&Math.abs(r.coords[0]-s.coords[0])>e.event.special.swipe.horizontalDistanceThreshold&&Math.abs(r.coords[1]-s.coords[1])<e.event.special.swipe.verticalDistanceThreshold&&r.origin.trigger("swipe").trigger(r.coords[0]>s.coords[0]?"swipeleft":"swiperight"),r=s=void 0})})}},e.event.special.swipeleft=e.event.special.swipeleft||{setup:function(){e(this).bind("swipe",e.noop)}},e.event.special.swiperight=e.event.special.swiperight||e.event.special.swipeleft})(jQuery);;
(function () {
    var ccl_carousel;

    ccl_carousel = window.ccl_carousel ? window.ccl_carousel : {};

    ccl_carousel.Carousel = (function () {
        function Carousel(el, opts) {
            this.el = el;
            this.opts = opts;
            var _this = this;
            _this.$pager = this.el.find("ul.pager");

            if (this.el.length === 0) {
                return;
            }

            if ($(this.el.parent())[0].hasAttribute("data-pager")) {
                $(this.el.parent().attr("data-pager")).replaceWith(_this.$pager);
            }

            this.el.closest("#hero-section").addClass("content-loaded").removeClass("loading-content");
            this.el.closest(".carousel-widget").removeAttr("style");
            this.initResponsiveImages();
            if (this.el.length && !this.el.find(".slides").data("cycle.API")) {
                this.setSpecialClicks();
                this.setClicksPlayer();
                if (this.el.find(".slides > li").length >= 2
                    || (this.el.find(".slides > li").length == 0 && this.el.find(".slides > .slide").length > 0)) {
                    this.initCarousel();
                    if (this.el.find(".cycle-slide").not(".cycle-sentinel").length <= 1) {
                        this.el.find('.ccl-carousel-controls, .ccl-carousel-btn-pause').hide();
                        _this.$pager.hide();
                    }
                  this.SetFocusBehaviour();
                }
                else {
                    var $prev = $(this.el.parent())[0].hasAttribute("data-prev-button") ? $(this.el.parent().attr("data-prev-button")) : this.el.parent().find(".prev");
                    var $next = $(this.el.parent())[0].hasAttribute("data-next-button") ? $(this.el.parent().attr("data-next-button")) : this.el.parent().find(".next");
                    $prev.hide();
                    $next.hide();
                    this.el.find('.ccl-carousel-controls, .ccl-carousel-btn-pause').hide();
                    _this.$pager.hide();
                }
            } else {
                this.el.find('.slides').cycle('resume');
            }
            _this.$pager.attr('role', 'list');
            this.el.find('a.ccl-carousel-controls').unbind("click");
            this.el.find('a.ccl-carousel-controls').on("click", function (e) {
                if ($(this).hasClass("ccl-carousel-btn-play")) {
                    $(this).removeClass('ccl-carousel-btn-play').addClass('ccl-carousel-btn-pause').find('span').text('Pause animation');
                    _this.el.find(".slides").cycle('resume');
                }
                else if ($(this).hasClass("ccl-carousel-btn-pause")) {
                    $(this).removeClass('ccl-carousel-btn-pause').addClass('ccl-carousel-btn-play').find('span').text('Start animation');
                    _this.el.find(".slides").cycle('pause');
                }
            });

            //Initialization a11y
            var array = this.el.find('.slides').find('img').map(function (index, item) {
                return $(item).attr('alt');
            }).get();

            var items = _this.$pager.find("li>a");
            items.each(function (i) {
                $(this).data("alt-bullet", array[i]);
                var context = "";
                if (i == 0) {
                    context = array[i] + " - Current Slide Number " + (i + 1) + " of " + items.length;
                }
                else {
                    context = array[i] + " - Slide Number " + (i + 1) + " of " + items.length;
                }
                $(this).attr("title", context);
                $(this).attr("aria-label", context);
            });
            this.setADALinksAriaLabel();
            this.SetNextPrevAda(0);
            $(document).trigger("CCL-ccl_carousel-initialized");
        }

        Carousel.prototype.setADALinksAriaLabel = function () {
            var $itemsList = $("#HeroSlidesContainer li");
            $itemsList.each(function () {
                if ($itemsList.find('a').length) {
                    if ($itemsList.find('.overlay').length) {
                        if ($itemsList.find(".overlay").children().length > 0) {
                            var onlyP = $itemsList.find('.overlay').find('p:only-child');
                            if (onlyP.length) { if ($.trim(onlyP.text()).length == 0) { return; } }
                        }
                    }
                }
            });

        };

        Carousel.prototype.setSpecialClicks = function () {
            var $videoLB;
            var _this = this;
            this.el.on("click", "a.video", function (e) {
                $videoLB = _this.GetVideoLightbox();
                var url;
                url = $(e.currentTarget).attr("href");
                $.colorbox({
                    inline: true,
                    transition: "none",
                    opacity: 1,
                    href: $videoLB,
                    reposition: false,
                    onOpen: function () {
                        $('#cboxClose').show();
                        $videoLB.find("iframe").attr("src", url);
                        return _this.el.find(".slides").cycle("pause");
                    },
                    onClosed: function () {
                        return $('#cboxClose').hide();
                    },
                    onCleanup: function () {
                        $videoLB.find("iframe").attr("src", "");
                        return window.setTimeout((function () {
                            return _this.el.find(".slides").cycle("resume").cycle("next");
                        }), 1000);
                    }
                });
                return e.preventDefault();
            });
            if (window.navigator.userAgent.match(/iPad/i)) { //Pause Carousel
                this.el.on("click", "a.panorama-overlay, div.slide #panorama, div.slide #panorama div, div.slide #panorama canvas, div.slide.qtvr", function (e) {
                    _this.el.find(".slides").cycle("pause");
                    _this.el.find("a.call-to-action").one("click", function (e, opt, outgoing, incoming, fwd) {
                        _this.el.find(".slides").cycle("resume");

                    });
                });
            }
            return this.el.on("click", "a.panorama-overlay", function (e) {
                var $overlay, panHtml;
                $overlay = $(e.currentTarget);
                if (!$overlay.hasClass('html5')) {
                    panHtml = $overlay.next(".panorama").html().replace(/transparent/g, "opaque");
                    $overlay.parent().html(panHtml);
                } else {
                    $overlay.remove();
                }
                return e.preventDefault();
            });
        };

        Carousel.prototype.setClicksPlayer = function () {
            var _this = this;
            var $videoLb = _this.GetVideoLightbox();
            this.el.on("click", "a.ccl-video-player", function (e) {
                var $anchor = $(this);
                if ($anchor.parents().is(".ccl-mobile")) {
                    _this.openMobileVideoModal(e, _this);
                    return e.preventDefault();
                }
                _this.initVideoPlayer($anchor);
                _this.openCclVideoPlayer($videoLb, $anchor);
                return e.preventDefault();
            });
        };

        Carousel.prototype.openModal = function (self, $lastFocus) {
            var $modal = this.GetVideoLightbox();
            if ($modal.length === 1) {
                var classList = $modal.attr('class').split(/\s+/);
                $.each(classList,
                    function (index, item) {
                        $modal.addClass(item + "--open");
                        var html = "<div id='" + item + "-video' class='" + item + "__wrapper'><header class='" +
                            item +
                            "__header'><button class='" +
                            item +
                            "__close' aria- label='close modal' role='button'></button></header>" +
                            "<div class='video-container'><div class='pane mobile'><div id='media'></div></div></div></div>";
                        $modal.html(html);
                        self.initCloseModal(item, $lastFocus);
                    });   
            }
            //this.setModalExclusiveTabbing();
        };
        Carousel.prototype.closeModal = function () {
            var $modal = this.GetVideoLightbox();
            var classList = $modal.attr('class').split(/\s+/);
            $.each(classList,
                function (index, item) {
                    $modal.removeClass(item + "--open");
                });
            var videoContainer = $(".video-container #media");
            videoContainer.empty();
        };
        Carousel.prototype.initCloseModal = function (modalClassName, lastFocus) {
            var $modal = $("." + modalClassName);
            var $close = $modal.find('.' + modalClassName + '__close');
            var $overlay = $modal.siblings('.' + modalClassName + '__overlay');
            var self = this;
            $close.add($overlay).on('click',
                function (e) {
                    e.preventDefault();
                    self.closeModal();
                    $(lastFocus).focus();
                });
        };

        Carousel.prototype.openMobileVideoModal = function (e, self) {
            var $this = $(e.currentTarget);
            var videoId = $this.attr("data-video-id");
            var videoDescription = $this.attr("data-video-description-id");
            var idYoutube = videoId ? this.getVideoId(videoId) : '';
            var videoDescId = videoDescription ? this.getVideoId(videoDescription) : ''; 
            var title = $this.attr("data-title");
            var multiplier = $this.attr("data-size-multiplier") ? $(this).attr("data-size-multiplier") : 19;
            e.preventDefault();
            self.openModal(self, $this);
            self.createVideo(idYoutube, videoDescId, title, multiplier);
        };

        Carousel.prototype.createVideo = function (videoId, videoDescId, title, multiplier) {
            var videoContainer = $(".video-container #media");
            var videoHtml = '<div class="ccl-yt-video" data-video-id="' +
                videoId +
                '" data-video-description-id="' +
                videoDescId +
                '" data-size-multiplier="' +
                multiplier +
                '" data-title="' +
                title +
                '"></div>';
            videoContainer.html(videoHtml);
            $(".ccl-yt-video").cclVideo(true);
        };

        Carousel.prototype.openCclVideoPlayer = function ($videoLb, $anchor) {
            var _this = this;
            $.colorbox({
                inline: true,
                transition: "none",
                opacity: 1,
                reposition: true,
                scrolling: false,
                href: $videoLb,
                trapFocus: false,
                height: "720px",
                width: "660px",
                onOpen: function () {
                    //Trap focus
                    $("body").on("keydown.colorboxTab", '.ccl-video .radio-toggle input:radio', function (e) {
                        var pressedKey = (e.keyCode ? e.keyCode : e.which);
                        // Check for TAB key press
                        if (pressedKey === 9) {
                            if (!e.shiftKey) {
                                $("body").find("#cboxClose").focus();
                                e.preventDefault();
                            }
                        }
                    });
                    $("body").on("keydown.colorboxTab", "#cboxClose", function (e) {
                        var pressedKey = (e.keyCode ? e.keyCode : e.which);
                        // Check for TAB key press
                        if (pressedKey === 9) {
                            // SHIFT + TAB key
                            if (e.shiftKey) {
                                $('.video-lightbox input[name="ad-toggle0"]').first().focus();
                                e.preventDefault();
                            }
                        }
                        else {
                            if (pressedKey === 13) {
                                $('#cboxClose').click();
                                e.preventDefault();
                            }
                        }
                    });
                    $("body").on("focus.colorboxTab", "#cboxClose", function () {
                        $('#cboxClose').addClass("ccl-explicithighlights");

                    });
                    $("body").on("focusout.colorboxTab", "#cboxClose", function () {
                        $('#cboxClose').removeClass("ccl-explicithighlights");
                    });

                    
                    fixCloseButtonTabOrderAndFocus();

                    function fixCloseButtonTabOrderAndFocus() {
                        $("#cboxClose").show();
                        $("#cboxClose").attr("tabindex", "0").attr("role", "button").attr("aria-label", "Close Video Dialog");
                        setTimeout(function() {
                            $("#cboxClose").detach().prependTo("#cboxContent");
                            setTimeout(function() {
                                $("#cboxClose").focus();
                            }, 500);
                        }, 50);
                    }

                    setTimeout(function () {
                        $("#cboxClose").focus();
                    }, 50);

                    return _this.el.find(".slides").cycle("pause");
                },
                onClosed: function () {
                    $videoLb.html("");
                    $("body").off(".colorboxTab");
                    return $('#cboxClose').hide();
                },
                onCleanup: function () {
                    $anchor.focus();
                    return window.setTimeout((function () {
                        return _this.el.find(".slides").cycle("resume").cycle("next");
                    }), 1000);
                }
            });
        };

        Carousel.prototype.initVideoPlayer = function (el) {
            var _this = this;
            _this.initCclVideoPlayer(el);
        };

        Carousel.prototype.initCclVideoPlayer = function (el) {
            var $videoLb = this.GetVideoLightbox();
            var videoId = el.attr("data-video-id");
            var idYoutube = videoId ? this.getVideoId(videoId) : '';
            var title = el.attr("data-title");
            var videoDescription = el.attr("data-video-description-id");

            if (idYoutube !== "") {
                var youtubeDescId = videoDescription ? this.getVideoId(videoDescription) : '';
                var multiplier = 32;
                var $videoTag = $('<div class="ccl-yt-video ccl-video-spaceless" data-video-id="' +
                    idYoutube +
                    '" data-video-description-id="' +
                    youtubeDescId +
                    '" data-size-multiplier="' +
                    multiplier +
                    '" data-title="' +
                    title +
                    '" data-width="100%" data-height="300px"></div>');
                $videoLb.html("");
                //$videoLb.append("<a tabindex='0' id='HelperPlayer' aria-label='Close Video Dialog' role='button' style='outline: 0 !important;height: 0;width: 0;'>&nbsp</a>");
                $videoLb.append($videoTag);
                $videoTag.cclVideo();
            }
        };

        Carousel.prototype.getVideoId = function (description) {
            if (description && description.indexOf("youtu.be") === -1 && description.indexOf("youtube.com") === -1) {
                return description;
            } else {
                var regExp = /^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=|\?v=)([^#\&\?]*).*/;
                var match = description.match(regExp);
                if (match && match[2].length === 11) {
                    return match[2];
                }
            }
            return null;
        };

        Carousel.prototype.initResponsiveImages = function () {
            var _this = this;
            var bgItems = this.el.find("li[data-desktop-src]");

            bgItems.each(function (index, value) {
                var mobileImg = $(this).attr('data-mobile-src');
                var desktopImg = $(this).attr('data-desktop-src');
                _this.loadImage(mobileImg);
                _this.loadImage(desktopImg);
            });

            _this.handle_resize();
        };

        Carousel.prototype.loadImage = function(imgUrl, callbackFn) {
            var image = new Image();
            image.src = imgUrl;
            if (callbackFn) {
                image.onload = function() {
                    callbackFn();
                };
            }
        };

        Carousel.prototype.handle_resize = function () {
            var _this = this;
            var lastWindowWidth;

            function setImage() {
                var w = $(window).width();
                if ((w >= 1024 && !lastWindowWidth) || (w >= 1024 && lastWindowWidth < 1024)) {
                    _this.setDesktopImages();
                } else if ((w < 1024 && !lastWindowWidth) || (w < 1024 && lastWindowWidth <= 1024)) {
                    _this.setMobileImages();
                }
                lastWindowWidth = w;
            }

            setImage();
            $(window).resize(setImage);
        };

        Carousel.prototype.setDesktopImages = function () {
            var bgItems = this.el.find("li[data-desktop-src]");

            bgItems.each(function (index, value) {
                var img = $(this).attr('data-desktop-src');
                $(this).css('background-image', 'url("' + img + '")');
            });
        };

        Carousel.prototype.setMobileImages = function () {
            var bgItems = this.el.find("li[data-mobile-src]");

            bgItems.each(function (index, value) {
                var img = $(this).attr('data-mobile-src');
                $(this).css('background-image', 'url("' + img + '")');
            });
        };

        Carousel.prototype.initCarousel = function () {
            var defaultOpts, hasSwipe, opts, transitionFx, rotateSeconds, $prev, $next, _this = this;
            opts = $.isEmptyObject(this.el.data()) ? this.opts : this.el.data();
            hasSwipe = this.el.find('.slides').hasClass('has-pan') ? false : true;
            transitionFx = $(this.el.parent())[0].hasAttribute("data-transition") ? this.el.parent().attr("data-transition") : (this.el.find('.slides').hasClass('hero') ? 'fade' : 'scrollHorz');
            $prev = $(this.el.parent())[0].hasAttribute("data-prev-button") ? $(this.el.parent().attr("data-prev-button")) : this.el.parent().find(".prev");
            $next = $(this.el.parent())[0].hasAttribute("data-next-button") ? $(this.el.parent().attr("data-next-button")) : this.el.parent().find(".next");
            this.SetClickOnEnterKeyPress($prev);
            this.SetClickOnEnterKeyPress($next);
            rotateSeconds = parseInt(this.el.parent().attr("data-timeout") || $("#HeroBannerRotationTimeinSeconds").val() || "6");
            defaultOpts = {
                log: false,
                pager: _this.$pager,
                pagerTemplate: "<li><a href='javascript:;'><span class='bullet'></span></a></li>",
                slides: this.el.find(".slides").children(),
                prev: $prev,
                next: $next,
                speed: 1000,
                timeout: rotateSeconds * 1000,
                swipe: hasSwipe,
                fx: transitionFx,
                width: 860,
                pauseOnHover: true
            };
            this.options = opts ? $.extend(defaultOpts, opts) : defaultOpts;
            if (this.el.find(".slides").children().length > 1 || (this.el.find(".slides > li").length == 0 && this.el.find(".slides > .slide").length > 0)) {
                return this.el.css("height", "100%").find(".slides").on("cycle-before", function (e, opt, outgoing, incoming, fwd) {
                    var $ob, code, par;
                    $ob = $(incoming).find("object, embed, #panorama");
                    if ($ob.length) {
                        $ob.show();
                    }
                    $ob = $(incoming).find("object,embed");
                    if ((window.navigator.userAgent.match(/MSIE/i) || window.navigator.userAgent.match(/Trident/i)) && $ob.length) {
                        if ($ob.length) {
                            code = $ob.parent().html();
                            par = $ob.parent().empty();
                            return window.setTimeout(function () {
                                return par.html(code);
                            }, 10);
                        }
                    }
                    var fixedHiddenBanner = $('#hero-section div.carousel-widget.typehero li.cycle-slide')
                        .filter(function () {
                            return $(this).css('visibility') == 'hidden';
                        })[0];
                    if (fixedHiddenBanner) {
                        if (!$(fixedHiddenBanner).attr("aria-hidden")) {
                            $(fixedHiddenBanner).attr("aria-hidden", true);
                        }
                    }
                }).on("cycle-resumed", function () {
                    if (_this.el.find('a.ccl-carousel-controls').hasClass("ccl-carousel-btn-play")) {
                        $(this).closest(".slides").cycle('pause');
                    }
                }).on("cycle-after", function (e, opt, outgoing, incoming, fwd) {
                    var $ob, $pan, attributes, flashvars, gyro, pano, params, xml;

                    if (!_this.el.parent().hasClass("full-cover")) {
                        _this.el.find(".slides").cycle("resume");
                    }
                    
                    //a11y behavior
                    var items = _this.$pager.find("li>a");
                    items.each(function (i) {
                        var alt = $(this).data("alt-bullet");
                        var context = "";
                        if ($(this).closest(".cycle-pager-active").length == 1) {
                            context = alt + " - Current Slide Number " + (i + 1) + " of " + items.length;

                            if (rotateSeconds <= 0) {
                                _this.el.find(".carousel-context").text(context);
                            }

                            _this.SetNextPrevAda(i);
                        }
                        else {
                            context = alt + " - Slide Number " + (i + 1) + " of " + items.length;
                        }
                        $(this).attr("title", context);
                        $(this).attr("aria-label", context);
                    });

                    $ob = $(outgoing).find("object, embed, #panorama");
                    if ($ob.length) {
                        $ob.hide();
                    }
                    $pan = $(incoming).find('#panorama');
                    if ($pan.length && !$(incoming).hasClass('added')) {
                        console.log('Add panorama');
                        $(incoming).addClass('added');
                        if (ggHasHtml5Css3D() || ggHasWebGL()) {
                            pano = new pano2vrPlayer('panorama');
                            pano.readConfigUrl($pan.attr('data-pano'));
                            return gyro = new pano2vrGyro(pano, 'panorama');
                        } else {
                            flashvars = {
                                externalinterface: '1'
                            };
                            params = {
                                quality: 'high',
                                bgcolor: '#ffffff',
                                allowscriptaccess: 'sameDomain',
                                allowfullscreen: 'true',
                                wmode: 'transparent'
                            };
                            attributes = {
                                id: 'pano',
                                name: 'pano',
                                align: 'middle'
                            };
                            return swfobject.embedSWF($pan.attr('data-panoswf'), "panorama", "100%", "275", "9.0.0", "", flashvars, params, attributes);
                        }
                    }
                    else if ($pan.length
                        && $(incoming).hasClass('added')
                        && !$(incoming).find('.panorama-overlay').length
                        && window.navigator.userAgent.match(/iPad/i)) {
                        _this.el.find(".slides").cycle("pause");
                    }

                    $(document).trigger("ccl-carousel-cycled",
                        {
                            $el: _this.el
                        });
                }).on("cycle-initialized", function (e, opt) {
                    var $ob;
                    $ob = $(e.currentTarget).find("object, embed");
                    if ($ob.length) {
                        $ob.hide();
                        return window.setTimeout(function () {
                            return $ob.show();
                        }, 10);
                    }
                    if (_this.el.parent().hasClass("full-cover")) {
                        _this.el.find(".slides").cycle("pause");
                    }
                    console.log("Carousel initialized.");
                }).cycle(this.options);
            } else {
                return this.el.find('.step-nav').hide();
            }
        };

        Carousel.prototype.SetFocusBehaviour = function () {
            var anchors = this.el.find(".slides > li > a");
            var slideItemsWithoutLink = this.el.find(".slides > li").not(":has(a)");
            var slides = this.el.find(".slides");
            var pager = this.$pager.find("li>a");

            anchors.each(function () {
              $(this).on("focus",
                function() {
                  slides.cycle('pause');
                  $(this).parent().closest('div').addClass("carousel-reference-focused");
                });
            });

            anchors.each(function () {
                $(this).on("blur",
                    function () {
                        if ($(this).parent().find("a:focus-within").length === 0) {
                            slides.cycle('resume');
                        }
                        anchors.parent().closest('div').removeClass("carousel-reference-focused");
                    });
            });

            pager.each(function () {
                $(this).on("focus",
                    function () {
                        slides.cycle('resume');
                    });
            });

            pager.each(function () {
                $(this).on("blur",
                    function () {
                        if ($(this).parent().find("a:focus-within").length === 0) {
                            slides.cycle('pause');
                        }
                    });
            });

            slideItemsWithoutLink.focus(
                function () {
                    slides.cycle('pause');
                    $(this).parent().closest('div').addClass("carousel-reference-focused");
                }).blur(
                function () {
                    slides.cycle('resume');
                    $(this).parent().closest('div').removeClass("carousel-reference-focused");
                });
        }

        Carousel.prototype.SetClickOnEnterKeyPress = function($ele, $focusEl) {
          $ele.keyup(function (e) {
              var pressedKey = (e.keyCode ? e.keyCode : e.which);
              if (pressedKey === 13) {
                  $(this).click();
              }
          });
        }
        
        Carousel.prototype.destroy = function () {
            return this.el.find(".slides").cycle("destroy");
        };

        Carousel.prototype.SetNextPrevAda = function(i) {
            var items = this.$pager.find("li>a");

            if (!items || items.length <= 1) {
            return;
            }

            var prevIndex, nextIndex;

            if (i === 0) {
                prevIndex = items.length - 1;
                nextIndex = i + 1;
            } else if (i === (items.length - 1)) {
                prevIndex = i - 1;
                nextIndex = 0;
            } else {
                prevIndex = i - 1;
                nextIndex = i + 1;
            }

            var prevText = items.eq(prevIndex).find("span").text();
            var nextText = items.eq(nextIndex).find("span").text();
            var $prev = $(this.el.parent())[0].hasAttribute("data-prev-button") ? $(this.el.parent().attr("data-prev-button")) : this.el.parent().find(".prev");
            var $next = $(this.el.parent())[0].hasAttribute("data-next-button") ? $(this.el.parent().attr("data-next-button")) : this.el.parent().find(".next");

            $prev.html("<span class='ccl-srOnly'>Go to previous slide - " + prevText + "</span>");
            $next.html("<span class='ccl-srOnly'>Go to next slide - " + nextText + "</span>");
        }

        Carousel.prototype.GetVideoLightbox = function () {
            var modalSelector = "#hero-lightbox.video-lightbox";
            var $modal = $(modalSelector);
            if ($modal.length === 0) {
                $("body").append('<div id="hero-lightbox" class="video-lightbox" role="dialog" aria-modal="true"></div>');
                $modal = $(modalSelector);
            }

            return $modal;
        };

        return Carousel;

    })();

    window.ccl_carousel = ccl_carousel;

    //(function ($) {
    //    return $('.carousel-widget').each(function (i, el) {
    //        return new ccl_carousel.Carousel($(el));
    //    });
    //})(jQuery);


}).call(this);
console.log("Carousel loaded.");
$(document).trigger("CCL-ccl_carousel-loaded");
;
/* Modernizr 2.6.2 (Custom Build) | MIT & BSD
 * Build: http://modernizr.com/download/#-fontface-backgroundsize-borderimage-borderradius-boxshadow-flexbox-flexboxlegacy-hsla-multiplebgs-opacity-rgba-textshadow-cssanimations-csscolumns-generatedcontent-cssgradients-cssreflections-csstransforms-csstransforms3d-csstransitions-audio-video-input-inputtypes-shiv-mq-cssclasses-teststyles-testprop-testallprops-prefixes-domprefixes-load
 */
;window.Modernizr=function(a,b,c){function B(a){j.cssText=a}function C(a,b){return B(n.join(a+";")+(b||""))}function D(a,b){return typeof a===b}function E(a,b){return!!~(""+a).indexOf(b)}function F(a,b){for(var d in a){var e=a[d];if(!E(e,"-")&&j[e]!==c)return b=="pfx"?e:!0}return!1}function G(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:D(f,"function")?f.bind(d||b):f}return!1}function H(a,b,c){var d=a.charAt(0).toUpperCase()+a.slice(1),e=(a+" "+p.join(d+" ")+d).split(" ");return D(b,"string")||D(b,"undefined")?F(e,b):(e=(a+" "+q.join(d+" ")+d).split(" "),G(e,b,c))}function I(){e.input=function(c){for(var d=0,e=c.length;d<e;d++)t[c[d]]=c[d]in k;return t.list&&(t.list=!!b.createElement("datalist")&&!!a.HTMLDataListElement),t}("autocomplete autofocus list placeholder max min multiple pattern required step".split(" ")),e.inputtypes=function(a){for(var d=0,e,f,h,i=a.length;d<i;d++)k.setAttribute("type",f=a[d]),e=k.type!=="text",e&&(k.value=l,k.style.cssText="position:absolute;visibility:hidden;",/^range$/.test(f)&&k.style.WebkitAppearance!==c?(g.appendChild(k),h=b.defaultView,e=h.getComputedStyle&&h.getComputedStyle(k,null).WebkitAppearance!=="textfield"&&k.offsetHeight!==0,g.removeChild(k)):/^(search|tel)$/.test(f)||(/^(url|email)$/.test(f)?e=k.checkValidity&&k.checkValidity()===!1:e=k.value!=l)),s[a[d]]=!!e;return s}("search tel url email datetime date month week time datetime-local number range color".split(" "))}var d="2.6.2",e={},f=!0,g=b.documentElement,h="modernizr",i=b.createElement(h),j=i.style,k=b.createElement("input"),l=":)",m={}.toString,n=" -webkit- -moz- -o- -ms- ".split(" "),o="Webkit Moz O ms",p=o.split(" "),q=o.toLowerCase().split(" "),r={},s={},t={},u=[],v=u.slice,w,x=function(a,c,d,e){var f,i,j,k,l=b.createElement("div"),m=b.body,n=m||b.createElement("body");if(parseInt(d,10))while(d--)j=b.createElement("div"),j.id=e?e[d]:h+(d+1),l.appendChild(j);return f=["&#173;",'<style id="s',h,'">',a,"</style>"].join(""),l.id=h,(m?l:n).innerHTML+=f,n.appendChild(l),m||(n.style.background="",n.style.overflow="hidden",k=g.style.overflow,g.style.overflow="hidden",g.appendChild(n)),i=c(l,a),m?l.parentNode.removeChild(l):(n.parentNode.removeChild(n),g.style.overflow=k),!!i},y=function(b){var c=a.matchMedia||a.msMatchMedia;if(c)return c(b).matches;var d;return x("@media "+b+" { #"+h+" { position: absolute; } }",function(b){d=(a.getComputedStyle?getComputedStyle(b,null):b.currentStyle)["position"]=="absolute"}),d},z={}.hasOwnProperty,A;!D(z,"undefined")&&!D(z.call,"undefined")?A=function(a,b){return z.call(a,b)}:A=function(a,b){return b in a&&D(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=v.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(v.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(v.call(arguments)))};return e}),r.flexbox=function(){return H("flexWrap")},r.flexboxlegacy=function(){return H("boxDirection")},r.rgba=function(){return B("background-color:rgba(150,255,150,.5)"),E(j.backgroundColor,"rgba")},r.hsla=function(){return B("background-color:hsla(120,40%,100%,.5)"),E(j.backgroundColor,"rgba")||E(j.backgroundColor,"hsla")},r.multiplebgs=function(){return B("background:url(https://),url(https://),red url(https://)"),/(url\s*\(.*?){3}/.test(j.background)},r.backgroundsize=function(){return H("backgroundSize")},r.borderimage=function(){return H("borderImage")},r.borderradius=function(){return H("borderRadius")},r.boxshadow=function(){return H("boxShadow")},r.textshadow=function(){return b.createElement("div").style.textShadow===""},r.opacity=function(){return C("opacity:.55"),/^0.55$/.test(j.opacity)},r.cssanimations=function(){return H("animationName")},r.csscolumns=function(){return H("columnCount")},r.cssgradients=function(){var a="background-image:",b="gradient(linear,left top,right bottom,from(#9f9),to(white));",c="linear-gradient(left top,#9f9, white);";return B((a+"-webkit- ".split(" ").join(b+a)+n.join(c+a)).slice(0,-a.length)),E(j.backgroundImage,"gradient")},r.cssreflections=function(){return H("boxReflect")},r.csstransforms=function(){return!!H("transform")},r.csstransforms3d=function(){var a=!!H("perspective");return a&&"webkitPerspective"in g.style&&x("@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}",function(b,c){a=b.offsetLeft===9&&b.offsetHeight===3}),a},r.csstransitions=function(){return H("transition")},r.fontface=function(){var a;return x('@font-face {font-family:"font";src:url("https://")}',function(c,d){var e=b.getElementById("smodernizr"),f=e.sheet||e.styleSheet,g=f?f.cssRules&&f.cssRules[0]?f.cssRules[0].cssText:f.cssText||"":"";a=/src/i.test(g)&&g.indexOf(d.split(" ")[0])===0}),a},r.generatedcontent=function(){var a;return x(["#",h,"{font:0/0 a}#",h,':after{content:"',l,'";visibility:hidden;font:3px/1 a}'].join(""),function(b){a=b.offsetHeight>=3}),a},r.video=function(){var a=b.createElement("video"),c=!1;try{if(c=!!a.canPlayType)c=new Boolean(c),c.ogg=a.canPlayType('video/ogg; codecs="theora"').replace(/^no$/,""),c.h264=a.canPlayType('video/mp4; codecs="avc1.42E01E"').replace(/^no$/,""),c.webm=a.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,"")}catch(d){}return c},r.audio=function(){var a=b.createElement("audio"),c=!1;try{if(c=!!a.canPlayType)c=new Boolean(c),c.ogg=a.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),c.mp3=a.canPlayType("audio/mpeg;").replace(/^no$/,""),c.wav=a.canPlayType('audio/wav; codecs="1"').replace(/^no$/,""),c.m4a=(a.canPlayType("audio/x-m4a;")||a.canPlayType("audio/aac;")).replace(/^no$/,"")}catch(d){}return c};for(var J in r)A(r,J)&&(w=J.toLowerCase(),e[w]=r[J](),u.push((e[w]?"":"no-")+w));return e.input||I(),e.addTest=function(a,b){if(typeof a=="object")for(var d in a)A(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return e;b=typeof b=="function"?b():b,typeof f!="undefined"&&f&&(g.className+=" "+(b?"":"no-")+a),e[a]=b}return e},B(""),i=k=null,function(a,b){function k(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x<style>"+b+"</style>",d.insertBefore(c.lastChild,d.firstChild)}function l(){var a=r.elements;return typeof a=="string"?a.split(" "):a}function m(a){var b=i[a[g]];return b||(b={},h++,a[g]=h,i[h]=b),b}function n(a,c,f){c||(c=b);if(j)return c.createElement(a);f||(f=m(c));var g;return f.cache[a]?g=f.cache[a].cloneNode():e.test(a)?g=(f.cache[a]=f.createElem(a)).cloneNode():g=f.createElem(a),g.canHaveChildren&&!d.test(a)?f.frag.appendChild(g):g}function o(a,c){a||(a=b);if(j)return a.createDocumentFragment();c=c||m(a);var d=c.frag.cloneNode(),e=0,f=l(),g=f.length;for(;e<g;e++)d.createElement(f[e]);return d}function p(a,b){b.cache||(b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag()),a.createElement=function(c){return r.shivMethods?n(c,a,b):b.createElem(c)},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+l().join().replace(/\w+/g,function(a){return b.createElem(a),b.frag.createElement(a),'c("'+a+'")'})+");return n}")(r,b.frag)}function q(a){a||(a=b);var c=m(a);return r.shivCSS&&!f&&!c.hasCSS&&(c.hasCSS=!!k(a,"article,aside,figcaption,figure,footer,header,hgroup,nav,section{display:block}mark{background:#FF0;color:#000}")),j||p(a,c),a}var c=a.html5||{},d=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,e=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,f,g="_html5shiv",h=0,i={},j;(function(){try{var a=b.createElement("a");a.innerHTML="<xyz></xyz>",f="hidden"in a,j=a.childNodes.length==1||function(){b.createElement("a");var a=b.createDocumentFragment();return typeof a.cloneNode=="undefined"||typeof a.createDocumentFragment=="undefined"||typeof a.createElement=="undefined"}()}catch(c){f=!0,j=!0}})();var r={elements:c.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",shivCSS:c.shivCSS!==!1,supportsUnknownElements:j,shivMethods:c.shivMethods!==!1,type:"default",shivDocument:q,createElement:n,createDocumentFragment:o};a.html5=r,q(b)}(this,b),e._version=d,e._prefixes=n,e._domPrefixes=q,e._cssomPrefixes=p,e.mq=y,e.testProp=function(a){return F([a])},e.testAllProps=H,e.testStyles=x,g.className=g.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(f?" js "+u.join(" "):""),e}(this,this.document),function(a,b,c){function d(a){return"[object Function]"==o.call(a)}function e(a){return"string"==typeof a}function f(){}function g(a){return!a||"loaded"==a||"complete"==a||"uninitialized"==a}function h(){var a=p.shift();q=1,a?a.t?m(function(){("c"==a.t?B.injectCss:B.injectJs)(a.s,0,a.a,a.x,a.e,1)},0):(a(),h()):q=0}function i(a,c,d,e,f,i,j){function k(b){if(!o&&g(l.readyState)&&(u.r=o=1,!q&&h(),l.onload=l.onreadystatechange=null,b)){"img"!=a&&m(function(){t.removeChild(l)},50);for(var d in y[c])y[c].hasOwnProperty(d)&&y[c][d].onload()}}var j=j||B.errorTimeout,l=b.createElement(a),o=0,r=0,u={t:d,s:c,e:f,a:i,x:j};1===y[c]&&(r=1,y[c]=[]),"object"==a?l.data=c:(l.src=c,l.type=a),l.width=l.height="0",l.onerror=l.onload=l.onreadystatechange=function(){k.call(this,r)},p.splice(e,0,u),"img"!=a&&(r||2===y[c]?(t.insertBefore(l,s?null:n),m(k,j)):y[c].push(l))}function j(a,b,c,d,f){return q=0,b=b||"j",e(a)?i("c"==b?v:u,a,b,this.i++,c,d,f):(p.splice(this.i++,0,a),1==p.length&&h()),this}function k(){var a=B;return a.loader={load:j,i:0},a}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=s?l:n.parentNode,l=a.opera&&"[object Opera]"==o.call(a.opera),l=!!b.attachEvent&&!l,u=r?"object":l?"script":"img",v=l?"script":u,w=Array.isArray||function(a){return"[object Array]"==o.call(a)},x=[],y={},z={timeout:function(a,b){return b.length&&(a.timeout=b[0]),a}},A,B;B=function(a){function b(a){var a=a.split("!"),b=x.length,c=a.pop(),d=a.length,c={url:c,origUrl:c,prefixes:a},e,f,g;for(f=0;f<d;f++)g=a[f].split("="),(e=z[g.shift()])&&(c=e(c,g));for(f=0;f<b;f++)c=x[f](c);return c}function g(a,e,f,g,h){var i=b(a),j=i.autoCallback;i.url.split(".").pop().split("?").shift(),i.bypass||(e&&(e=d(e)?e:e[a]||e[g]||e[a.split("/").pop().split("?")[0]]),i.instead?i.instead(a,e,f,g,h):(y[i.url]?i.noexec=!0:y[i.url]=1,f.load(i.url,i.forceCSS||!i.forceJS&&"css"==i.url.split(".").pop().split("?").shift()?"c":c,i.noexec,i.attrs,i.timeout),(d(e)||d(j))&&f.load(function(){k(),e&&e(i.origUrl,h,g),j&&j(i.origUrl,h,g),y[i.url]=2})))}function h(a,b){function c(a,c){if(a){if(e(a))c||(j=function(){var a=[].slice.call(arguments);k.apply(this,a),l()}),g(a,j,b,0,h);else if(Object(a)===a)for(n in m=function(){var b=0,c;for(c in a)a.hasOwnProperty(c)&&b++;return b}(),a)a.hasOwnProperty(n)&&(!c&&!--m&&(d(j)?j=function(){var a=[].slice.call(arguments);k.apply(this,a),l()}:j[n]=function(a){return function(){var b=[].slice.call(arguments);a&&a.apply(this,b),l()}}(k[n])),g(a[n],j,b,n,h))}else!c&&l()}var h=!!a.test,i=a.load||a.both,j=a.callback||f,k=j,l=a.complete||f,m,n;c(h?a.yep:a.nope,!!i),i&&c(i)}var i,j,l=this.yepnope.loader;if(e(a))g(a,0,l,0);else if(w(a))for(i=0;i<a.length;i++)j=a[i],e(j)?g(j,0,l,0):w(j)?B(j):Object(j)===j&&h(j,l);else Object(a)===a&&h(a,l)},B.addPrefix=function(a,b){z[a]=b},B.addFilter=function(a){x.push(a)},B.errorTimeout=1e4,null==b.readyState&&b.addEventListener&&(b.readyState="loading",b.addEventListener("DOMContentLoaded",A=function(){b.removeEventListener("DOMContentLoaded",A,0),b.readyState="complete"},0)),a.yepnope=k(),a.yepnope.executeStack=h,a.yepnope.injectJs=function(a,c,d,e,i,j){var k=b.createElement("script"),l,o,e=e||B.errorTimeout;k.src=a;for(o in d)k.setAttribute(o,d[o]);c=j?h:c||f,k.onreadystatechange=k.onload=function(){!l&&g(k.readyState)&&(l=1,c(),k.onload=k.onreadystatechange=null)},m(function(){l||(l=1,c(1))},e),i?k.onload():n.parentNode.insertBefore(k,n)},a.yepnope.injectCss=function(a,c,d,e,g,i){var e=b.createElement("link"),j,c=i?h:c||f;e.href=a,e.rel="stylesheet",e.type="text/css";for(j in d)e.setAttribute(j,d[j]);g||(n.parentNode.insertBefore(e,n),m(c,0))}}(this,document),Modernizr.load=function(){yepnope.apply(window,[].slice.call(arguments,0))};;
(function () {
    "use strict";
    function youtubePlayerExecCommand($playerIframe, command) {
        if (!command || !$playerIframe) return;
        $playerIframe.contentWindow.postMessage('{"event":"command","func":"' + command + '","args":""}', '*');
    }

    function getVideoId(description) {
        if (description && description.indexOf("youtu.be") === -1 && description.indexOf("youtube.com") === -1) {
            return description;
        } else {
            var regExp = /^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=|\?v=)([^#\&\?]*).*/;
            var match = description.match(regExp);
            if (match && match[2].length === 11) {
                return match[2];
            }
        }
        return null;
    }

    jQuery.fn.cclVideo = function (isMobile, pluginOptions) {
        var defaultOptions = {
            enablejsapi: false
        };
        
        if (typeof pluginOptions == 'object') {
            pluginOptions = $.extend(defaultOptions, pluginOptions);
        } else {
            pluginOptions = defaultOptions;
        }

        var loadSvg = function() {
            if ($("#icon-audio-desc").length === 0) {
                $("body").prepend('<div style="height:0;overflow:hiden;"><svg width="0" height="0" class="hidden"><symbol id="icon-audio-desc" viewBox="0 0 24 24"><title>audio-desc</title><path d="M9.62,7.043l-.043,9.895-2.236.011.085-2.2-3.663.018L2.168,16.975,0,16.986,7.411,7.054Zm-2.15,6.08L7.6,9.492H7.568L4.932,13.136Z"></path><path d="M13.644,7.092a5.076,5.076,0,0,1,1.772.3,3.85,3.85,0,0,1,1.42.91,4.2,4.2,0,0,1,.937,1.517,6.133,6.133,0,0,1,.338,2.137,6.824,6.824,0,0,1-.276,1.986A4.365,4.365,0,0,1,17,15.517a3.9,3.9,0,0,1-1.392,1.041,4.712,4.712,0,0,1-1.965.379H10.673V7.092Zm-.152,8.025a2.777,2.777,0,0,0,.91-.152,2.007,2.007,0,0,0,.786-.5,2.53,2.53,0,0,0,.551-.917,4.024,4.024,0,0,0,.207-1.379,5.743,5.743,0,0,0-.144-1.344,2.684,2.684,0,0,0-.476-1.027,2.109,2.109,0,0,0-.876-.655,3.5,3.5,0,0,0-1.344-.227h-.268v6.2Z"></path><path d="M18.682,15.976a3.792,3.792,0,0,1-.963.975H18.76a5.479,5.479,0,0,0,2.29-5,5.643,5.643,0,0,0-2.4-4.938H17.632a3.64,3.64,0,0,1,.9.8,5.017,5.017,0,0,1,.863,1.715,8.392,8.392,0,0,1,.311,2.418A9.375,9.375,0,0,1,19.45,14.2,5.386,5.386,0,0,1,18.682,15.976Z"></path><path d="M21.631,15.976a3.792,3.792,0,0,1-.963.975h1.041a5.479,5.479,0,0,0,2.29-5,5.643,5.643,0,0,0-2.4-4.938H20.582a3.64,3.64,0,0,1,.9.8,5.017,5.017,0,0,1,.863,1.715,8.392,8.392,0,0,1,.311,2.418A9.375,9.375,0,0,1,22.4,14.2,5.386,5.386,0,0,1,21.631,15.976Z"></path></symbol></svg></div>');
            }
        };

        var $IsMobileLayout = $("#IsMobileLayout");
        if (isMobile === undefined && $IsMobileLayout.length > 0) {
            if ($IsMobileLayout.val().toLowerCase() === "true") {
                isMobile = true;
            }
        }

        loadSvg();
        var i = $('.ccl-video .video-player').length; // Check for other instances

        return this.each(function () {
            var self = this;
            var $this = $(this);
            var videoId = $this.attr("data-video-id");
            var videoDescription = $this.attr("data-video-description-id");
            var options = {
                videoId: videoId ? getVideoId(videoId) : '',
                audioVideoId: videoDescription ? getVideoId(videoDescription) : '',
                widthAspectRatio: 16,
                heightAspectRatio: 9,
                multiplier: $this.attr("data-size-multiplier") ? $this.attr("data-size-multiplier") : 32,
                width: 640,
                height: 360,
                titleAttr: ""
            };

            if ($this.attr("data-height") && $this.attr("data-width")) {
                options.width = $this.attr("data-width");
                options.height = $this.attr("data-height");
            } else {
                options.width = options.widthAspectRatio * options.multiplier + "px";
                options.height = options.heightAspectRatio * options.multiplier + "px";
            }

            if ($this.attr("data-title")) {
                options.title = 'title="' + $this.attr("data-title") + '"';
            }

            var loadPlayer = function (videoId) {
                var isLoaded = $this.find(".video-player").length > 0;

                if (!isLoaded) {
                    var mobileAriaLabel1 = isMobile
                        ? 'aria-label="Toggle audio description grouping. off radio button checked 1 of 2"'
                        : '';
                    var mobileAriaLabel2 = isMobile
                        ? 'aria-label="on radio button unchecked 1 of 2"'
                        : '';
                    var content = '<div class="video-player"></div>';

                    content += '<div class="audio-desc" role="radiogroup" aria-labelledby="ad-label' + i +'">';
                    content += '  <div id="ad-label' + i +'" aria-label="Toggle audio description" class="audio-desc-icon">';
                    content += '    <svg class="svg-icon svg-icon-audio-desc" aria-hidden="true"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#icon-audio-desc"></use></svg>';
                    content += '  </div>';

                    content += '  <div class="audio-desc-toggle">';
                    content += '    <div class="radio-toggle">';
                    content += '      <label id="ad-disabled-label' + i + '" for="ad-disabled' + i +'"><input id="ad-disabled' + i + '" type="radio" name="ad-toggle' + i + '" formControlName="ad-toggle' + i +'" checked="" aria-labelledby="ad-label' + i +' ad-disabled-label' + i + '" value="false" ' + mobileAriaLabel1 + '>';
                    content += '      off</label>';
                    content += '    </div>';
                    content += '    <div class="radio-toggle">';
                    content += '      <label id="ad-enabled-label' + i + '" for="ad-enabled' + i +'"><input id="ad-enabled' + i + '" type="radio" name="ad-toggle' + i + '" formControlName="ad-toggle' + i +'" aria-labelledby="ad-label' + i + ' ad-enabled-label' + i + '" value="true" ' + mobileAriaLabel2 + '>';
                    content += '      on</label>';
                    content += '    </div></div></div>';

                    $this.addClass('ccl-video');
                    $this.html(content);
                }

                var player = '<iframe frameborder="0" allowfullscreen ' + options.title + ' width="' + options.width + '" height="' + options.height + '" ';
                player += 'src="https://www.youtube-nocookie.com/embed/' + videoId + (pluginOptions.enablejsapi ? '?enablejsapi=1' : '') + '">';
                player += '</iframe>';

                $this.find(".video-player").html(player);

                if (pluginOptions.enablejsapi) {
                    var $ytIframe = $this.find('iframe')[0];
                    self.playVideo = function () {
                        youtubePlayerExecCommand($ytIframe, 'playVideo');
                    };
                    self.pauseVideo = function () {
                        youtubePlayerExecCommand($ytIframe, 'pauseVideo');
                    };
                    self.stopVideo = function () {
                        youtubePlayerExecCommand($ytIframe, 'stopVideo');
                    };
                }
            };

            var setAdditionalAriaLabelsOnChecked = function(radioGroup) {
                var selectedOption = radioGroup.filter(':checked');
                var unselectedOption = radioGroup.not(':checked');
                if (radioGroup && radioGroup.length) {
                    var selectedIndex = radioGroup.index(selectedOption);
                    var unselectedIndex = radioGroup.index(unselectedOption);
                    var selectedOptionLabel = $(selectedOption).siblings().filter('label')[0];
                    var unselectedOptionLabel = $(unselectedOption).siblings().filter('label')[0];
                    var selectedLabelText = $(selectedOptionLabel).text();
                    var unselectedLabelText = $(unselectedOptionLabel).text();
                    $(selectedOption).attr('aria-label',
                        'Toggle audio description grouping. ' +
                        selectedLabelText +
                        ' radio button checked ' +
                        (selectedIndex + 1) +
                        ' of 2');
                    $(unselectedOption).attr('aria-label',
                        unselectedLabelText +
                        ' radio button unchecked ' +
                        (unselectedIndex + 1) +
                        ' of 2');
                }
            };

            var onRadioChanged = function() {
                var radioGroup = $this.find(".audio-desc input:radio");
                var selectedOption = radioGroup.filter(':checked');
                var value = selectedOption.val();
                var isAd = value === "true";
                var currentId = isAd ? options.audioVideoId : options.videoId;
                loadPlayer(currentId);
                // If mobile we need to explicitly give context to the selected option
                if (isMobile) {
                    setAdditionalAriaLabelsOnChecked(radioGroup);
                }
            };

            loadPlayer(options.videoId);
            $this.find(".audio-desc input:radio").change(onRadioChanged);
            i++;
        });
    };

    (function () {
        var carnival = window.Carnival ? window.Carnival : {};
        var cclVideo = carnival.cclVideo ? carnival.cclVideo : {};

        cclVideo = (function () {


            function CclVideo() {
                //load colorbox JS if not already loaded
                $(function () {
                    if (typeof ($.colorbox) !== "function") {
                        console.log("colorbox not loaded, loading JS");
                        jQuery.ajax({
                            url: "/common/global/js/libs/jquery.colorbox-min.js",
                            dataType: "script",
                            async: true,
                            cache: true
                        });
                    }
                });
            };

            CclVideo.prototype.videoColorboxLink_onClick = function (e) {

                var $videoLB = $(".video-lightbox");
                $videoLB.remove();
                $("body").append('<div class="hidden"><div class="video-lightbox"><div class="ccl-video" data-video-id="" data-video-description-id=""></div></div></div>');
                $videoLB = $(".video-lightbox");

                var $video = $videoLB.find(".ccl-video");
                var $this = $(e.currentTarget);
                var href = $this.addClass("active").attr("href");
                if (href === "#") return e.preventDefault();
                var videoId = $this.attr("data-video-id") ? getVideoId($this.attr("data-video-id")) : '';
                var videoDescId = $this.attr("data-video-description-id") ? getVideoId($this.attr("data-video-description-id")) : '';

                $.colorbox({
                    inline: true,
                    transition: "none",
                    opacity: 1,
                    reposition: true,
                    scrolling: false,
                    href: $videoLB,
                    trapFocus: false,
                    height: "720px",
                    width: "660px",
                    onOpen: function () {
                        $video.attr("data-video-id", videoId).attr("data-video-description-id", videoDescId);

                        if ($this.attr("data-width")) {
                            $video.attr("data-width", $this.attr("data-width"));
                        }
                        if ($this.attr("data-height")) {
                            $video.attr("data-height", $this.attr("data-height"));
                        }
                        if ($this.attr("data-title")) {
                            $video.attr("data-title", $this.attr("data-title"));
                        }
                        if ($this.attr("data-size-multiplier")) {
                            $video.attr("data-size-multiplier", $this.attr("data-size-multiplier"));
                        }

                        $video.cclVideo();

                        //Trap focus
                        $("body").on("keydown.colorboxVideoRadio",
                            ".ccl-video .radio-toggle input:radio",
                            function (e) {
                                var pressedKey = (e.keyCode ? e.keyCode : e.which);
                                // Check for TAB key press
                                if (pressedKey === 9) {
                                    if (!e.shiftKey) {
                                        $("body").find("#cboxClose").focus();
                                        e.preventDefault();
                                    }
                                }
                            });
                        $("body").on("keydown.colorboxClose",
                            "#cboxClose",
                            function (e) {
                                var pressedKey = (e.keyCode ? e.keyCode : e.which);
                                // Check for TAB key press
                                if (pressedKey === 9) {
                                    // SHIFT + TAB key
                                    if (e.shiftKey) {
                                        $("body").find(".ccl-video .radio-toggle input:radio:checked").focus();
                                        e.preventDefault();
                                    }
                                } else {
                                    if (pressedKey === 13) {
                                        $('#cboxClose').click();
                                        e.preventDefault();
                                    }
                                }
                            });

                        fixCloseButtonTabOrderAndFocus();

                        function fixCloseButtonTabOrderAndFocus() {
                            $("#cboxClose").show();
                            setTimeout(function () {
                                $("#cboxClose").detach().prependTo("#cboxContent");
                                setTimeout(function () {
                                    $("#cboxClose").focus();
                                }, 500);
                            }, 50);
                        }

                        return;
                    },
                    onCleanup: function () {
                        $videoLB.remove();
                        return $this.removeClass("active");
                    },
                    onClosed: function () {
                        if ($this.is(":visible")) {
                            return $this.focus();
                        }
                        if ($this.closest(":visible").is(":focusable")) {
                            return $this.closest(":visible").focus();
                        }
                        return $this.closest(":visible").find(":focusable").focus();
                    }
                });
                return e.preventDefault();
            }

            return CclVideo;
        })();

        window.Carnival.cclVideo = cclVideo;
    }).call(this);

})();;
(function () {
    var carnival = window.Carnival || {};
    var cclVideoHero = carnival.videoHero || {};

    cclVideoHero.VideoHeros = (function () {
        function VideoHero() {
            var self = this;
            self.$videos = $(".hero-video-file") || {};
            self.$carousel = $(".carousel-widget");
            self.$overlay = $("#videoOverlay");
            self.videoSrc = $(".hero-video-file").find("source").attr("src");
            self.disableVideoForMobile = $(".hero-video-file").data("disablevideo").toLowerCase() === "true";
            self.initialize();
            self.handleOverlay();
            if (self.disableVideoForMobile) {
                self.handleVideoResize();
            }
        }

        VideoHero.prototype.initialize = function () {
            var self = this;
            self.$videos.on("ended", function (e) {
                var $video = $(this);
                var videoId = $(this).attr("id");
                var $carouselControls = self.$carousel.find('a.ccl-carousel-controls');
                if ($carouselControls.hasClass("ccl-carousel-btn-play")) {
                    $carouselControls.removeClass("ccl-carousel-btn-play").addClass("ccl-carousel-btn-pause").find("span").text("Pause animation");
                    self.$carousel.find(".slides").cycle("resume");
                }

                if (self.$overlay.hasClass("off")) {
                    return self.$overlay.removeClass("off");
                }
                var overlayContent = $video.closest(".video-wrapper").find("[data-videoid=" + videoId + "]").html();
                if (overlayContent) {
                    self.$overlay.append(overlayContent);
                    self.$overlay.insertAfter($video);
                }
            });
            self.$videos.on("play", function (e) {
                var $carouselControls = self.$carousel.find('a.ccl-carousel-controls');
                if ($carouselControls.hasClass("ccl-carousel-btn-pause")) {
                    $carouselControls.removeClass("ccl-carousel-btn-pause").addClass("ccl-carousel-btn-play").find("span").text("Start animation");
                    self.$carousel.find(".slides").cycle("pause");
                }
            });
        };

        VideoHero.prototype.handleOverlay = function () {
            var self = this;
            self.$overlay.on("click", function (e) {
                self.$overlay.addClass("off");
            });
        };

        VideoHero.prototype.handleVideoResize = function () {
            var self = this;
            function enableVideo() {

                self.$videos.each(function(i, video) {
                    var $video = $(video);
                    if ($video.find("source").length === 0) {
                        $video.removeClass("disabled");
                        $video.prepend("<source src='" + self.videoSrc + "'>");
                        $video[0].autoplay = false;
                        $video[0].load();
                    }
                });

                
            }
            function disableVideo() {
                self.$videos.each(function(i, video) {
                    var $video = $(video);
                    if ($video.find("source").length > 0) {
                        $video.addClass("disabled");
                        $video.find("source").remove();
                        $video[0].autoplay = false;
                        $video[0].load();
                    }
                });
            }
            function enableDisableVideo() {
                var innerWidth = window.innerWidth;
                if (innerWidth <= 1024) {
                    disableVideo();
                } else {
                    enableVideo();
                }
            }
            $(window).on("resize", enableDisableVideo);
            enableDisableVideo();
        };

        return VideoHero;
    })();

    carnival.videoHero = cclVideoHero;
    window.Carnival = carnival;
}).call(this);
(function () {
    var loadVideoHeros_cnt = 0;
    function loadVideoHeros() {
        if ($("#hero-section.content-loaded").length > 0 && $(".hero-video-file").length > 0) {
            console.log("Video Hero banners loaded.");
            var $videoHeros = new Carnival.videoHero.VideoHeros();
        } else {
            if ($("#hero-section.content-loaded").length > 0) {
                return console.log("No Video Hero banners found.");
            }
            console.log("Hero banners not ready yet.");
            loadVideoHeros_cnt++;
            if (loadVideoHeros_cnt < 50) {
                setTimeout(function () {
                    loadVideoHeros();
                }, 500);
            }            
        }
    }
    loadVideoHeros();
})();;
