/* Minification failed. Returning unminified contents.
(1673,4899-4900): run-time error JS1195: Expected expression: >
(1673,4904-4905): run-time error JS1010: Expected identifier: {
(1673,4922-4923): run-time error JS1195: Expected expression: =
(1673,4947-4948): run-time error JS1014: Invalid character: `
(1673,4949-4950): run-time error JS1004: Expected ';': {
(1673,4952-4953): run-time error JS1195: Expected expression: :
(1673,4982-4983): run-time error JS1002: Syntax error: }
(1673,4984-4985): run-time error JS1014: Invalid character: `
(1673,4993-4994): run-time error JS1195: Expected expression: .
(1673,5111-5112): run-time error JS1195: Expected expression: >
(1673,5174-5175): run-time error JS1195: Expected expression: )
(1673,5175-5176): run-time error JS1193: Expected ',' or ')': ;
(1673,5250-5251): run-time error JS1002: Syntax error: }
(1673,5366-5367): run-time error JS1002: Syntax error: }
(1673,5369-5370): run-time error JS1197: Too many errors. The file might not be a JavaScript file: .
(1673,4925-4926): run-time error JS1298: Assignment to constant: e
(1673,4945-4946): run-time error JS1298: Assignment to constant: e
 */
/*
 * jQuery Cycle Plugin (core engine only)
 * Examples and documentation at: http://jquery.malsup.com/cycle/
 * Copyright (c) 2007-2010 M. Alsup
 * Version: 2.99 (12-MAR-2011)
 * Dual licensed under the MIT and GPL licenses.
 * http://jquery.malsup.com/license.html
 * Requires: jQuery v1.3.2 or later
 */
(function($){var ver="2.99";if($.support==undefined){$.support={opacity:!($.browser.msie)};}function debug(s){$.fn.cycle.debug&&log(s);}function log(){window.console&&console.log&&console.log("[cycle] "+Array.prototype.join.call(arguments," "));}$.expr[":"].paused=function(el){return el.cyclePause;};$.fn.cycle=function(options,arg2){var o={s:this.selector,c:this.context};if(this.length===0&&options!="stop"){if(!$.isReady&&o.s){log("DOM not ready, queuing slideshow");$(function(){$(o.s,o.c).cycle(options,arg2);});return this;}log("terminating; zero elements found by selector"+($.isReady?"":" (DOM not ready)"));return this;}return this.each(function(){var opts=handleArguments(this,options,arg2);if(opts===false){return;}opts.updateActivePagerLink=opts.updateActivePagerLink||$.fn.cycle.updateActivePagerLink;if(this.cycleTimeout){clearTimeout(this.cycleTimeout);}this.cycleTimeout=this.cyclePause=0;var $cont=$(this);var $slides=opts.slideExpr?$(opts.slideExpr,this):$cont.children();var els=$slides.get();if(els.length<2){log("terminating; too few slides: "+els.length);return;}var opts2=buildOptions($cont,$slides,els,opts,o);if(opts2===false){return;}var startTime=opts2.continuous?10:getTimeout(els[opts2.currSlide],els[opts2.nextSlide],opts2,!opts2.backwards);if(startTime){startTime+=(opts2.delay||0);if(startTime<10){startTime=10;}debug("first timeout: "+startTime);this.cycleTimeout=setTimeout(function(){go(els,opts2,0,!opts.backwards);},startTime);}});};function handleArguments(cont,options,arg2){if(cont.cycleStop==undefined){cont.cycleStop=0;}if(options===undefined||options===null){options={};}if(options.constructor==String){switch(options){case"destroy":case"stop":var opts=$(cont).data("cycle.opts");if(!opts){return false;}cont.cycleStop++;if(cont.cycleTimeout){clearTimeout(cont.cycleTimeout);}cont.cycleTimeout=0;$(cont).removeData("cycle.opts");if(options=="destroy"){destroy(opts);}return false;case"toggle":cont.cyclePause=(cont.cyclePause===1)?0:1;checkInstantResume(cont.cyclePause,arg2,cont);return false;case"pause":cont.cyclePause=1;return false;case"resume":cont.cyclePause=0;checkInstantResume(false,arg2,cont);return false;case"prev":case"next":var opts=$(cont).data("cycle.opts");if(!opts){log('options not found, "prev/next" ignored');return false;}$.fn.cycle[options](opts);return false;default:options={fx:options};}return options;}else{if(options.constructor==Number){var num=options;options=$(cont).data("cycle.opts");if(!options){log("options not found, can not advance slide");return false;}if(num<0||num>=options.elements.length){log("invalid slide index: "+num);return false;}options.nextSlide=num;if(cont.cycleTimeout){clearTimeout(cont.cycleTimeout);cont.cycleTimeout=0;}if(typeof arg2=="string"){options.oneTimeFx=arg2;}go(options.elements,options,1,num>=options.currSlide);return false;}}return options;function checkInstantResume(isPaused,arg2,cont){if(!isPaused&&arg2===true){var options=$(cont).data("cycle.opts");if(!options){log("options not found, can not resume");return false;}if(cont.cycleTimeout){clearTimeout(cont.cycleTimeout);cont.cycleTimeout=0;}go(options.elements,options,1,!options.backwards);}}}function removeFilter(el,opts){if(!$.support.opacity&&opts.cleartype&&el.style.filter){try{el.style.removeAttribute("filter");}catch(smother){}}}function destroy(opts){if(opts.next){$(opts.next).unbind(opts.prevNextEvent);}if(opts.prev){$(opts.prev).unbind(opts.prevNextEvent);}if(opts.pager||opts.pagerAnchorBuilder){$.each(opts.pagerAnchors||[],function(){this.unbind().remove();});}opts.pagerAnchors=null;if(opts.destroy){opts.destroy(opts);}}function buildOptions($cont,$slides,els,options,o){var opts=$.extend({},$.fn.cycle.defaults,options||{},$.metadata?$cont.metadata():$.meta?$cont.data():{});if(opts.autostop){opts.countdown=opts.autostopCount||els.length;}var cont=$cont[0];$cont.data("cycle.opts",opts);opts.$cont=$cont;opts.stopCount=cont.cycleStop;opts.elements=els;opts.before=opts.before?[opts.before]:[];opts.after=opts.after?[opts.after]:[];if(!$.support.opacity&&opts.cleartype){opts.after.push(function(){removeFilter(this,opts);});}if(opts.continuous){opts.after.push(function(){go(els,opts,0,!opts.backwards);});}saveOriginalOpts(opts);if(!$.support.opacity&&opts.cleartype&&!opts.cleartypeNoBg){clearTypeFix($slides);}if($cont.css("position")=="static"){$cont.css("position","relative");}if(opts.width){$cont.width(opts.width);}if(opts.height&&opts.height!="auto"){$cont.height(opts.height);}if(opts.startingSlide){opts.startingSlide=parseInt(opts.startingSlide);}else{if(opts.backwards){opts.startingSlide=els.length-1;}}if(opts.random){opts.randomMap=[];for(var i=0;i<els.length;i++){opts.randomMap.push(i);}opts.randomMap.sort(function(a,b){return Math.random()-0.5;});opts.randomIndex=1;opts.startingSlide=opts.randomMap[1];}else{if(opts.startingSlide>=els.length){opts.startingSlide=0;}}opts.currSlide=opts.startingSlide||0;var first=opts.startingSlide;$slides.css({position:"absolute",top:0,left:0}).hide().each(function(i){var z;if(opts.backwards){z=first?i<=first?els.length+(i-first):first-i:els.length-i;}else{z=first?i>=first?els.length-(i-first):first-i:els.length-i;}$(this).css("z-index",z);});$(els[first]).css("opacity",1).show();removeFilter(els[first],opts);if(opts.fit&&opts.width){$slides.width(opts.width);}if(opts.fit&&opts.height&&opts.height!="auto"){$slides.height(opts.height);}var reshape=opts.containerResize&&!$cont.innerHeight();if(reshape){var maxw=0,maxh=0;for(var j=0;j<els.length;j++){var $e=$(els[j]),e=$e[0],w=$e.outerWidth(),h=$e.outerHeight();if(!w){w=e.offsetWidth||e.width||$e.attr("width");}if(!h){h=e.offsetHeight||e.height||$e.attr("height");}maxw=w>maxw?w:maxw;maxh=h>maxh?h:maxh;}if(maxw>0&&maxh>0){$cont.css({width:maxw+"px",height:maxh+"px"});}}if(opts.pause){$cont.hover(function(){this.cyclePause++;},function(){this.cyclePause--;});}if(supportMultiTransitions(opts)===false){return false;}var requeue=false;options.requeueAttempts=options.requeueAttempts||0;$slides.each(function(){var $el=$(this);this.cycleH=(opts.fit&&opts.height)?opts.height:($el.height()||this.offsetHeight||this.height||$el.attr("height")||0);this.cycleW=(opts.fit&&opts.width)?opts.width:($el.width()||this.offsetWidth||this.width||$el.attr("width")||0);if($el.is("img")){var loadingIE=($.browser.msie&&this.cycleW==28&&this.cycleH==30&&!this.complete);var loadingFF=($.browser.mozilla&&this.cycleW==34&&this.cycleH==19&&!this.complete);var loadingOp=($.browser.opera&&((this.cycleW==42&&this.cycleH==19)||(this.cycleW==37&&this.cycleH==17))&&!this.complete);var loadingOther=(this.cycleH==0&&this.cycleW==0&&!this.complete);if(loadingIE||loadingFF||loadingOp||loadingOther){if(o.s&&opts.requeueOnImageNotLoaded&&++options.requeueAttempts<100){log(options.requeueAttempts," - img slide not loaded, requeuing slideshow: ",this.src,this.cycleW,this.cycleH);setTimeout(function(){$(o.s,o.c).cycle(options);},opts.requeueTimeout);requeue=true;return false;}else{log("could not determine size of image: "+this.src,this.cycleW,this.cycleH);}}}return true;});if(requeue){return false;}opts.cssBefore=opts.cssBefore||{};opts.cssAfter=opts.cssAfter||{};opts.cssFirst=opts.cssFirst||{};opts.animIn=opts.animIn||{};opts.animOut=opts.animOut||{};$slides.not(":eq("+first+")").css(opts.cssBefore);$($slides[first]).css(opts.cssFirst);if(opts.timeout){opts.timeout=parseInt(opts.timeout);if(opts.speed.constructor==String){opts.speed=$.fx.speeds[opts.speed]||parseInt(opts.speed);}if(!opts.sync){opts.speed=opts.speed/2;}var buffer=opts.fx=="none"?0:opts.fx=="shuffle"?500:250;while((opts.timeout-opts.speed)<buffer){opts.timeout+=opts.speed;}}if(opts.easing){opts.easeIn=opts.easeOut=opts.easing;}if(!opts.speedIn){opts.speedIn=opts.speed;}if(!opts.speedOut){opts.speedOut=opts.speed;}opts.slideCount=els.length;opts.currSlide=opts.lastSlide=first;if(opts.random){if(++opts.randomIndex==els.length){opts.randomIndex=0;}opts.nextSlide=opts.randomMap[opts.randomIndex];}else{if(opts.backwards){opts.nextSlide=opts.startingSlide==0?(els.length-1):opts.startingSlide-1;}else{opts.nextSlide=opts.startingSlide>=(els.length-1)?0:opts.startingSlide+1;}}if(!opts.multiFx){var init=$.fn.cycle.transitions[opts.fx];if($.isFunction(init)){init($cont,$slides,opts);}else{if(opts.fx!="custom"&&!opts.multiFx){log("unknown transition: "+opts.fx,"; slideshow terminating");return false;}}}var e0=$slides[first];if(opts.before.length){opts.before[0].apply(e0,[e0,e0,opts,true]);}if(opts.after.length){opts.after[0].apply(e0,[e0,e0,opts,true]);}if(opts.next){$(opts.next).bind(opts.prevNextEvent,function(){return advance(opts,1);});}if(opts.prev){$(opts.prev).bind(opts.prevNextEvent,function(){return advance(opts,0);});}if(opts.pager||opts.pagerAnchorBuilder){buildPager(els,opts);}exposeAddSlide(opts,els);return opts;}function saveOriginalOpts(opts){opts.original={before:[],after:[]};opts.original.cssBefore=$.extend({},opts.cssBefore);opts.original.cssAfter=$.extend({},opts.cssAfter);opts.original.animIn=$.extend({},opts.animIn);opts.original.animOut=$.extend({},opts.animOut);$.each(opts.before,function(){opts.original.before.push(this);});$.each(opts.after,function(){opts.original.after.push(this);});}function supportMultiTransitions(opts){var i,tx,txs=$.fn.cycle.transitions;if(opts.fx.indexOf(",")>0){opts.multiFx=true;opts.fxs=opts.fx.replace(/\s*/g,"").split(",");for(i=0;i<opts.fxs.length;i++){var fx=opts.fxs[i];tx=txs[fx];if(!tx||!txs.hasOwnProperty(fx)||!$.isFunction(tx)){log("discarding unknown transition: ",fx);opts.fxs.splice(i,1);i--;}}if(!opts.fxs.length){log("No valid transitions named; slideshow terminating.");return false;}}else{if(opts.fx=="all"){opts.multiFx=true;opts.fxs=[];for(p in txs){tx=txs[p];if(txs.hasOwnProperty(p)&&$.isFunction(tx)){opts.fxs.push(p);}}}}if(opts.multiFx&&opts.randomizeEffects){var r1=Math.floor(Math.random()*20)+30;for(i=0;i<r1;i++){var r2=Math.floor(Math.random()*opts.fxs.length);opts.fxs.push(opts.fxs.splice(r2,1)[0]);}debug("randomized fx sequence: ",opts.fxs);}return true;}function exposeAddSlide(opts,els){opts.addSlide=function(newSlide,prepend){var $s=$(newSlide),s=$s[0];if(!opts.autostopCount){opts.countdown++;}els[prepend?"unshift":"push"](s);if(opts.els){opts.els[prepend?"unshift":"push"](s);}opts.slideCount=els.length;$s.css("position","absolute");$s[prepend?"prependTo":"appendTo"](opts.$cont);if(prepend){opts.currSlide++;opts.nextSlide++;}if(!$.support.opacity&&opts.cleartype&&!opts.cleartypeNoBg){clearTypeFix($s);}if(opts.fit&&opts.width){$s.width(opts.width);}if(opts.fit&&opts.height&&opts.height!="auto"){$s.height(opts.height);}s.cycleH=(opts.fit&&opts.height)?opts.height:$s.height();s.cycleW=(opts.fit&&opts.width)?opts.width:$s.width();$s.css(opts.cssBefore);if(opts.pager||opts.pagerAnchorBuilder){$.fn.cycle.createPagerAnchor(els.length-1,s,$(opts.pager),els,opts);}if($.isFunction(opts.onAddSlide)){opts.onAddSlide($s);}else{$s.hide();}};}$.fn.cycle.resetState=function(opts,fx){fx=fx||opts.fx;opts.before=[];opts.after=[];opts.cssBefore=$.extend({},opts.original.cssBefore);opts.cssAfter=$.extend({},opts.original.cssAfter);opts.animIn=$.extend({},opts.original.animIn);opts.animOut=$.extend({},opts.original.animOut);opts.fxFn=null;$.each(opts.original.before,function(){opts.before.push(this);});$.each(opts.original.after,function(){opts.after.push(this);});var init=$.fn.cycle.transitions[fx];if($.isFunction(init)){init(opts.$cont,$(opts.elements),opts);}};function go(els,opts,manual,fwd){if(manual&&opts.busy&&opts.manualTrump){debug("manualTrump in go(), stopping active transition");$(els).stop(true,true);opts.busy=0;}if(opts.busy){debug("transition active, ignoring new tx request");return;}var p=opts.$cont[0],curr=els[opts.currSlide],next=els[opts.nextSlide];if(p.cycleStop!=opts.stopCount||p.cycleTimeout===0&&!manual){return;}if(!manual&&!p.cyclePause&&!opts.bounce&&((opts.autostop&&(--opts.countdown<=0))||(opts.nowrap&&!opts.random&&opts.nextSlide<opts.currSlide))){if(opts.end){opts.end(opts);}return;}var changed=false;if((manual||!p.cyclePause)&&(opts.nextSlide!=opts.currSlide)){changed=true;var fx=opts.fx;curr.cycleH=curr.cycleH||$(curr).height();curr.cycleW=curr.cycleW||$(curr).width();next.cycleH=next.cycleH||$(next).height();next.cycleW=next.cycleW||$(next).width();if(opts.multiFx){if(opts.lastFx==undefined||++opts.lastFx>=opts.fxs.length){opts.lastFx=0;}fx=opts.fxs[opts.lastFx];opts.currFx=fx;}if(opts.oneTimeFx){fx=opts.oneTimeFx;opts.oneTimeFx=null;}$.fn.cycle.resetState(opts,fx);if(opts.before.length){$.each(opts.before,function(i,o){if(p.cycleStop!=opts.stopCount){return;}o.apply(next,[curr,next,opts,fwd]);});}var after=function(){opts.busy=0;$.each(opts.after,function(i,o){if(p.cycleStop!=opts.stopCount){return;}o.apply(next,[curr,next,opts,fwd]);});};debug("tx firing("+fx+"); currSlide: "+opts.currSlide+"; nextSlide: "+opts.nextSlide);opts.busy=1;if(opts.fxFn){opts.fxFn(curr,next,opts,after,fwd,manual&&opts.fastOnEvent);}else{if($.isFunction($.fn.cycle[opts.fx])){$.fn.cycle[opts.fx](curr,next,opts,after,fwd,manual&&opts.fastOnEvent);}else{$.fn.cycle.custom(curr,next,opts,after,fwd,manual&&opts.fastOnEvent);}}}if(changed||opts.nextSlide==opts.currSlide){opts.lastSlide=opts.currSlide;if(opts.random){opts.currSlide=opts.nextSlide;if(++opts.randomIndex==els.length){opts.randomIndex=0;}opts.nextSlide=opts.randomMap[opts.randomIndex];if(opts.nextSlide==opts.currSlide){opts.nextSlide=(opts.currSlide==opts.slideCount-1)?0:opts.currSlide+1;}}else{if(opts.backwards){var roll=(opts.nextSlide-1)<0;if(roll&&opts.bounce){opts.backwards=!opts.backwards;opts.nextSlide=1;opts.currSlide=0;}else{opts.nextSlide=roll?(els.length-1):opts.nextSlide-1;opts.currSlide=roll?0:opts.nextSlide+1;}}else{var roll=(opts.nextSlide+1)==els.length;if(roll&&opts.bounce){opts.backwards=!opts.backwards;opts.nextSlide=els.length-2;opts.currSlide=els.length-1;}else{opts.nextSlide=roll?0:opts.nextSlide+1;opts.currSlide=roll?els.length-1:opts.nextSlide-1;}}}}if(changed&&opts.pager){opts.updateActivePagerLink(opts.pager,opts.currSlide,opts.activePagerClass);}var ms=0;if(opts.timeout&&!opts.continuous){ms=getTimeout(els[opts.currSlide],els[opts.nextSlide],opts,fwd);}else{if(opts.continuous&&p.cyclePause){ms=10;}}if(ms>0){p.cycleTimeout=setTimeout(function(){go(els,opts,0,!opts.backwards);},ms);}}$.fn.cycle.updateActivePagerLink=function(pager,currSlide,clsName){$(pager).each(function(){$(this).children().removeClass(clsName).eq(currSlide).addClass(clsName);});};function getTimeout(curr,next,opts,fwd){if(opts.timeoutFn){var t=opts.timeoutFn.call(curr,curr,next,opts,fwd);while(opts.fx!="none"&&(t-opts.speed)<250){t+=opts.speed;}debug("calculated timeout: "+t+"; speed: "+opts.speed);if(t!==false){return t;}}return opts.timeout;}$.fn.cycle.next=function(opts){advance(opts,1);};$.fn.cycle.prev=function(opts){advance(opts,0);};function advance(opts,moveForward){var val=moveForward?1:-1;var els=opts.elements;var p=opts.$cont[0],timeout=p.cycleTimeout;if(timeout){clearTimeout(timeout);p.cycleTimeout=0;}if(opts.random&&val<0){opts.randomIndex--;if(--opts.randomIndex==-2){opts.randomIndex=els.length-2;}else{if(opts.randomIndex==-1){opts.randomIndex=els.length-1;}}opts.nextSlide=opts.randomMap[opts.randomIndex];}else{if(opts.random){opts.nextSlide=opts.randomMap[opts.randomIndex];}else{opts.nextSlide=opts.currSlide+val;if(opts.nextSlide<0){if(opts.nowrap){return false;}opts.nextSlide=els.length-1;}else{if(opts.nextSlide>=els.length){if(opts.nowrap){return false;}opts.nextSlide=0;}}}}var cb=opts.onPrevNextEvent||opts.prevNextClick;if($.isFunction(cb)){cb(val>0,opts.nextSlide,els[opts.nextSlide]);}go(els,opts,1,moveForward);return false;}function buildPager(els,opts){var $p=$(opts.pager);$.each(els,function(i,o){$.fn.cycle.createPagerAnchor(i,o,$p,els,opts);});opts.updateActivePagerLink(opts.pager,opts.startingSlide,opts.activePagerClass);}$.fn.cycle.createPagerAnchor=function(i,el,$p,els,opts){var a;if($.isFunction(opts.pagerAnchorBuilder)){a=opts.pagerAnchorBuilder(i,el);debug("pagerAnchorBuilder("+i+", el) returned: "+a);}else{a='<a href="#">'+(i+1)+"</a>";}if(!a){return;}var $a=$(a);if($a.parents("body").length===0){var arr=[];if($p.length>1){$p.each(function(){var $clone=$a.clone(true);$(this).append($clone);arr.push($clone[0]);});$a=$(arr);}else{$a.appendTo($p);}}opts.pagerAnchors=opts.pagerAnchors||[];opts.pagerAnchors.push($a);$a.bind(opts.pagerEvent,function(e){e.preventDefault();opts.nextSlide=i;var p=opts.$cont[0],timeout=p.cycleTimeout;if(timeout){clearTimeout(timeout);p.cycleTimeout=0;}var cb=opts.onPagerEvent||opts.pagerClick;if($.isFunction(cb)){cb(opts.nextSlide,els[opts.nextSlide]);}go(els,opts,1,opts.currSlide<i);});if(!/^click/.test(opts.pagerEvent)&&!opts.allowPagerClickBubble){$a.bind("click.cycle",function(){return false;});}if(opts.pauseOnPagerHover){$a.hover(function(){opts.$cont[0].cyclePause++;},function(){opts.$cont[0].cyclePause--;});}};$.fn.cycle.hopsFromLast=function(opts,fwd){var hops,l=opts.lastSlide,c=opts.currSlide;if(fwd){hops=c>l?c-l:opts.slideCount-l;}else{hops=c<l?l-c:l+opts.slideCount-c;}return hops;};function clearTypeFix($slides){debug("applying clearType background-color hack");function hex(s){s=parseInt(s).toString(16);return s.length<2?"0"+s:s;}function getBg(e){for(;e&&e.nodeName.toLowerCase()!="html";e=e.parentNode){var v=$.css(e,"background-color");if(v&&v.indexOf("rgb")>=0){var rgb=v.match(/\d+/g);return"#"+hex(rgb[0])+hex(rgb[1])+hex(rgb[2]);}if(v&&v!="transparent"){return v;}}return"#ffffff";}$slides.each(function(){$(this).css("background-color",getBg(this));});}$.fn.cycle.commonReset=function(curr,next,opts,w,h,rev){$(opts.elements).not(curr).hide();if(typeof opts.cssBefore.opacity=="undefined"){opts.cssBefore.opacity=1;}opts.cssBefore.display="block";if(opts.slideResize&&w!==false&&next.cycleW>0){opts.cssBefore.width=next.cycleW;}if(opts.slideResize&&h!==false&&next.cycleH>0){opts.cssBefore.height=next.cycleH;}opts.cssAfter=opts.cssAfter||{};opts.cssAfter.display="none";$(curr).css("zIndex",opts.slideCount+(rev===true?1:0));$(next).css("zIndex",opts.slideCount+(rev===true?0:1));};$.fn.cycle.custom=function(curr,next,opts,cb,fwd,speedOverride){var $l=$(curr),$n=$(next);var speedIn=opts.speedIn,speedOut=opts.speedOut,easeIn=opts.easeIn,easeOut=opts.easeOut;$n.css(opts.cssBefore);if(speedOverride){if(typeof speedOverride=="number"){speedIn=speedOut=speedOverride;}else{speedIn=speedOut=1;}easeIn=easeOut=null;}var fn=function(){$n.animate(opts.animIn,speedIn,easeIn,function(){cb();});};$l.animate(opts.animOut,speedOut,easeOut,function(){$l.css(opts.cssAfter);if(!opts.sync){fn();}});if(opts.sync){fn();}};$.fn.cycle.transitions={fade:function($cont,$slides,opts){$slides.not(":eq("+opts.currSlide+")").css("opacity",0);opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts);opts.cssBefore.opacity=0;});opts.animIn={opacity:1};opts.animOut={opacity:0};opts.cssBefore={top:0,left:0};}};$.fn.cycle.ver=function(){return ver;};$.fn.cycle.defaults={activePagerClass:"activeSlide",after:null,allowPagerClickBubble:false,animIn:null,animOut:null,autostop:0,autostopCount:0,backwards:false,before:null,cleartype:!$.support.opacity,cleartypeNoBg:false,containerResize:1,continuous:0,cssAfter:null,cssBefore:null,delay:0,easeIn:null,easeOut:null,easing:null,end:null,fastOnEvent:0,fit:0,fx:"fade",fxFn:null,height:"auto",manualTrump:true,next:null,nowrap:0,onPagerEvent:null,onPrevNextEvent:null,pager:null,pagerAnchorBuilder:null,pagerEvent:"click.cycle",pause:0,pauseOnPagerHover:0,prev:null,prevNextEvent:"click.cycle",random:0,randomizeEffects:1,requeueOnImageNotLoaded:true,requeueTimeout:250,rev:0,shuffle:null,slideExpr:null,slideResize:1,speed:1000,speedIn:null,speedOut:null,startingSlide:0,sync:1,timeout:4000,timeoutFn:null,updateActivePagerLink:null};})(jQuery);;
/*
* This script provides the general site enhancements.
* Including: Slideshows, popovers, tabbed content, drop downs, hide / show elements, toggling class names.
* Function comments inline below.
*/

jQuery(document).ready(function ($) {

    // Necessary for functions that may require images being loaded before the function runs
    $(window).load(function () {
        if ($("div.top-container div.panel div.panel-content").length > 0) equalHeight($("div.top-container div.panel"), "div.panel-content");
        if ($("div.general-content div.content-box").length > 0) setMinimumHeight($("div.general-content div.content-box"), "div.header", "div.content")
        if ($("div.triple-col-content div.homepage-column div.content").length > 0) equalHeight($("div.triple-col-content"), "div.homepage-column div.content");
        if (($("div.events-calendar").length > 0) && ($("div.bordered-list").length > 0)) equalHeight($("div#content-container"), "div.calendar-bordered-list-container > div.events-calendar,div.bordered-list");
        if ($("div.photo-gallery-container div.photo-gallery").length > 0) equalHeight($("div.photo-gallery"), "div.object");
        if ($("div.collection-overlays div.object-info").length > 0) equalHeight($("div.collection-overlays"), "div.object-info");
        if ($("div.collection-overlays div.department").length > 0) equalHeight($("div.collection-overlays"), "div.department");

        // Takes a group of elements and sets their min heights to be the same as that of the tallest element
        function equalHeight(parents, children) {
            parents.each(function () {
                var parent = $(this);
                var tallest = 0;

                parent.find(children).each(function () {
                    var thisHeight = $(this).height();
                    if (thisHeight > tallest) {
                        tallest = thisHeight;
                    }
                })
                parent.find(children).css("min-height", tallest);
            });
        }

        // Get the height of an element (getHeight) and set the min-height of another element (setHeight)
        function setMinimumHeight(parent, getHeight, setHeight) {
            parent.each(function () {
                var height = $(this).find(getHeight).height();

                $(this).find(setHeight).css("min-height", height)
            });
        }

        // MyMet tag cloud.        
        if ($("#tagCloudWords").length > 0) { $("#tagCloudWords").jQCloud($.parseJSON($('#tagCloudJson').html()), { shape: "rectangular" }); }
    });

    if ($("div#my-met").length > 0) {
        var myMet = $("div#my-met");
        // Needs to be above slideContainer function call
        addHTML(myMet, '<div class="close-my-met"><a href="#">Close</a></div>', false)
        slideContainer(myMet, $("div.my-met-topbar a"), null);
        slideContainer(myMet, $("div.close-my-met a"), null);
    }

    if ($("div#landing-feature div#slideshow").children().length > 1) {
        setUpHomepageSlideshow($("div#landing-feature"), $("div#landing-feature div#slideshow"));
        $("div#landing-feature div#slideshow .slideshow-overlay").click(function (e) {
            var url = $(this).data("url");
            if (url) {
                location.href = url;
                e.preventDefault();
            }
        });
    }

    if ($("input#blog-search-field").length > 0) setSearchText($("input#blog-search-field"), "Search This Blog");
    if ($("input#allblogs-search-field").length > 0) setSearchText($("input#allblogs-search-field"), "Search the Blogs");
    if ($("input#search-field").length > 0) setSearchText($("input#search-field"), "Search metmuseum.org");
    if ($("input#email-field").length > 0) setSearchText($("input#email-field"), "Email address");
    if ($("input#events-search-field").length > 0) setSearchText($("input#events-search-field"), "Enter search terms");
    if ($("input#search-by-who").length > 0) setSearchText($("input#search-by-who"), "Search by artist, maker, or culture");
    if ($("input#search-by-what").length > 0) setSearchText($("input#search-by-what"), "Search by technique or material");
    if ($("input#search-by-where").length > 0) setSearchText($("input#search-by-where"), "Search by geographic location");
    if ($("input#search-by-when").length > 0) setSearchText($("input#search-by-when"), "Search by era or date of art");
    if ($("input#search-by-in-the-museum").length > 0) setSearchText($("input#search-by-in-the-museum"), "Search by department in the museum");
    if ($("input#text-date").length > 0) setSearchText($("input#text-date"), "Enter date");
    if ($("input#start-date").length > 0) setSearchText($("input#start-date"), "Start date");
    if ($("input#end-date").length > 0) setSearchText($("input#end-date"), "End date");

    if ($('div.date-range-search').length > 0) showOnSelectBoxTrigger($("div.date-range-search"), 'select', 'Between', "div.date-range-between", 'div#single-date-field');
    if ($('div.date-range-search').length > 0) showOnDivTrigger($("div.date-range-search"), $('div.drop-select.when'), 'Between', "div.date-range-between", 'div#single-date-field');

    // Dynamic request image count
    if ($('ul.image-request').length > 0) {
        requestedImages();
    }

    initialisePopover();

    /* TABS */
    changeClass($("div.recommendations"), "ul.recommended-events", "li", "div.recommended-content", "front");
    changeClass($("div.calendar-holder"), "ul.tabset", "li", "div.tab-content", "visible");
    changeClass($("div.general-content"), "div.image-slider ul.tabs", "li", "div.tab-content", "visible");
    changeClass($("div.museum-map-features"), "ul.tabs", "li", "div.tab-content", "visible");
    changeClass($("div.general-content"), "div.tabbed-container ul.tabs", "li", "div.events-listing", "front");
    changeClass($("div.gallery-container"), "ul.main-gallery-tabs", "li", "div.gallery-info", "visible");
    changeClass($("div.gallery-container"), "ul.main-gallery-tabs", "li", "div.show-location", "visible");
    changeClass($("div.image-slider"), "ul.tabs", "li", "div.tab-panel", "visible");
    changeClass($("div.top-container"), "ul.tabs", "li", "div.events-listing div.events-container", "front");
    changeClass($("div.half-column"), "ul.tabs", "li", "div.events-listing div.events-container", "front");
    changeClass($("div.related-content-container"), "ul.related-content-tabs", "li", "div.related-content", "visible");
    changeClass($("div.events-listing-container"), "div.events-switcher", "a", "div.switcher", "front");
    changeClass($("div.visit div.top-container"), "ul.tabs", "li", "div.panel", "front");
    changeClass($("div.search-collections"), "div.tabbed-container ul.tabs", "li", "div.search-terms.tabbed", "front");
    changeClass($("div.search-by"), "div.tabbed-container ul.tabs", "li", "div.search-terms", "front");
    changeClass($("div.collections.l1"), "ul.tabs.landing", "li", "div.collections-tabbed-content", "visible");
    changeClass($("div.itinerary"), "ul.tabs.landing", "li", "div.tabbed-content", "visible");
    changeClass($("div.exhibitions"), "ul.inner-tab-menu", "li", "div.inner-tab-content", "visible");
    changeClass($("div.search-results-listing"), "div.tabbed-container ul.tabs", "li", "div.tab-content", "visible");
    changeClass($("div.collections.search-results"), "div.tabbed-container ul.tabs", "li", "div.search-terms", "front");
    changeClass($("div.collections.search-results"), "div.tabbed-container ul.display-options", "li", "div.search-results-container", "visible");
    changeClass($("div.collections.a-z"), "div.tabbed-container ul.tabs", "li", "div.search-results-container", "front");
    changeClass($("div.collections.a-z"), "div.tabbed-container ul.tabs", "li", "div.search-summary-container", "front");
    changeClass($("div.exhibition-listing"), "div.tabbed-container ul.tabs", "li", "div.tabbed-content", "front");
    changeClass($("div.exhibitions"), "div.tab-menu", "li", "div.tab-content", "visible");
    changeClass($("ul.membership-categories li.category"), "p.button.more-details", "a", "div.buttons", "hidden");
    changeClass($("div.my-met-container"), "ul.tag-view-list", "li", "div.tab-content", "visible");
    changeClass($("div.blog-cloud-view"), "ul.tag-view-list", "li", "div.tab-content", "visible");
           

    //changeClass($("div.my-met-container"), "ul.view-list", "li", "div.tab-content", "visible");

    /* END TABS */

    //hide content
    hideContent($("div.search-collections"), "div.tabbed-container ul.tabs li", "div.search-null");

    if ($("div.disclosure").length > 0) { slideSingleContainer($("div.disclosure"), "div.hidden-panel", "p.reveal a", "up", false, false) }
    if ($("div.bordered-list").length > 0) slideContainer($("div.bordered-list ul.hidden-programs"), $("div.bordered-list p.view-more-link a"), "up");
    if ($("div.video-holder").length > 0) slideContainer($("div.video-holder div.description div.transcript-info"), $("div.video-holder div.description div.action-bar a.opener"), "up");
    if ($("div.general-content div.video").length > 0) slideContainer($("div.general-content div.description div.transcript-info"), $("div.general-content div.description div.action-bar a.opener"), "up");
    if ($("div.blog-content div.video").length > 0) slideContainer($("div.blog-content div.description div.transcript-info"), $("div.blog-content div.description div.action-bar a.opener"), "up");
    if ($("div.gallery-blurb p.disclosure").length > 0) slideContainer($("div.gallery-blurb div.disclosure-hidden"), $("div.gallery-blurb p.disclosure a"), "up");
    if ($(".membership-categories div.additional-content").length > 0) slideSingleContainer($("ul.membership-categories li div.slide-container"), "div.additional-content", "p.more-details a", "up", "Hide details", false);
    if ($("div.gallery-disclosure div.topics").length > 0) slideSingleContainer($("div.gallery-disclosure"), "div.topics", "a.switcher", "down", false, false);

    if ($("ul.object-list li div.disclosure").length > 0) slideSingleContainer($("ul.object-list li div.disclosure"), ".disclosure-hidden", "a.disclosure-black-arrow", "up", false, false);

    if ($("ul.object-list li div.lower-content.disclosure").length > 0) slideSingleContainer($("ul.object-list li .hover-content"), ".lower-content.disclosure-hidden", ".lower-content a.disclosure-black-arrow", "up", false, false);

    if ($("div.my-met-container div.sidebar ul.menu").length > 0) accordionAnimator($("div.my-met-container div.sidebar ul.menu li a.opener"), "div.my-met-container div.sidebar ul.menu li div.holder");

    //if ($("div.gallery-disclosure").length > 0) slideContainer($("div.gallery-disclosure div.topics"), $("div.gallery-disclosure a.disclosure-black-arrow"), "up");

    if ($('ul.promo-accordion li a.category').length > 0) accordionAnimator($('ul.promo-accordion li a.category'), 'div.accordion-content');

    if ($("div.date_range").length > 0 || $("div.calendar-container").length > 0) {
        revealElement("div.set-dates a.open", "div.date_range", false, false);
        revealElement("div.date_range p.close a", "div.date_range", false, false);
    }

    if ($("a.show-content").length > 0) revealElement("a.show-content", "div.hidden-content", false, true);

    if ($("div.create-set-overlay").length > 0) {
        revealElement("ul.actions li.create a", "div.create-set-overlay", "ul.actions li.create", false);
        revealElement("div.create-set-overlay div.create-set a.cancel", "div.create-set-overlay", "ul.actions li.create", false);
    }

    // if ($("div.detail-form").find("div.participant-box").length > 0) {
    // 	showParticipants($("div.detail-form"), "div.quantity-box select", "div.participant-box", "div.participant", "span.price", "span.total");
    // }

    // elParent, elToSlide, trigger, elToSlideToggleClass, hideLinkText
    if ($("div.collections div.accordion").length > 0) slideSingleContainer($("div.collections div.accordion"), "div.hidden-panel", "p.reveal a", "up", false, false);
    if ($("p.reveal a.disclosure-black-arrow").length > 0) toggleText($("p.reveal a.disclosure-black-arrow"), "more", "fewer")
    if ($("div#readMoreLink a").length > 0) toggleText($("div#readMoreLink a"), "more", "less")

    if ($("div.my-met-container div.disclosure").length > 0) {
        slideSingleContainer($("div.my-met-container div.disclosure"), "div.hidden-panel", "p.trigger a", "up", false, false);
        triggerClick($("div.my-met-container div.newsletter div.row"), "input.check", "p.trigger a", "div.hidden-panel");
    }

    // elParent, elToSlide, trigger, elToSlideToggleClass, hideLinkText
    if ($("div.my-met-container div.events-container ul.actions").length > 0) slideSingleContainer($("div.events-container ul.actions li"), "div.hidden-panel", "a.show-toggle", "up", false, false);
    if ($("div.my-met-container div.events-container ul.event-actions").length > 0) slideSingleContainer($("div.events-container ul.event-actions li"), "div.hidden-panel", "a.show-toggle", "up", false, 'div.scrollable');


    // collection form builder js for user testing only - REMOVE FOR LIVE
    if ($("p.add-row a").length > 0) {
        showFormFields($('p.add-row a'), 'div.extra-form');
    }

    if ($("div.search-terms p.disclosure").length > 0) slideParent($("div.search-terms p.disclosure"), "div.search-terms", "front");

    if ($("div.image-result-options input.checkbox").length > 0) submitForm($("div.image-result-options input.checkbox"));
        
    if ($("div.photo-gallery-container div.photo-gallery").length > 0) revealHoverElement($("div.photo-gallery"), "div.object", "div.object-info");

    // handles the input element in the display options on search results
    if ($("div.search-results ul.display-options").length > 0) updateCookie($("div.search-results ul.display-options"), 'a');
        
    // handles the tab switching in the exhibitions page that determines which tab is visible so that the add to my met button works properly
    if ($("div.exhibitions.l3 div.tabbed-container").length > 0) updateExhibCookie($("div.toolbar.tab-menu"), 'a');

    if ($("div.not-found").length > 0) updateHeightOf404();

    if ($("div.content-media-slider").length > 0) reloadSlider($("div.content-media-slider"));

    if ($('div.share-content p a')) {
        showHideContent($('div.share-content p a.share-confirm'), $('div.share-collapsible'), $('div.share-collapsible ul li a.cancel'));
    }

	if ($("div.itinerary-container div.scrollable ul.items-list").length > 0) {
		// handles the remove from set link which was getting masked by the clicking div below
		$("div.itinerary-container div.scrollable ul.items-list li div.description p a").click(function() {
			window.location.href = $(this).attr('href');
			return false
		});
		triggerDivClick($("div.itinerary-container div.scrollable ul.items-list li"), "div.container a");
    }

    if ($('fieldset.collapsible-container legend')) {
        slideSingleContainer($('fieldset.collapsible-container'), 'div.collapsible', 'legend', 'closed', false);
    }

	if($('div.advanced-search-collections div.tabbed-container p a.switch-advanced-search').length > 0) {
		showContent($('div.advanced-search-collections div.tabbed-container p a.switch-advanced-search'), $('div.as-step-one'), $('div.as-step-two'))
	}

    /*
    advanced search form
    input on losing focus, append/delete from a JSON file
    */

    // auto submit when SELECT changed
    if ($("div.image-result-options select").length > 0) submitFormChange($("div.image-result-options select"));

    // auto submit facets - only for second step
    //if ($("div.image-result-options select").length > 0) submitForm($("div.image-result-options select"));

	if($('fieldset#advanced-search').length > 0) {
		var auto_check = false;
		$('fieldset#advanced-search input').each(function() {
			
			$(this).blur(function() {
				auto_check = false;
				$('ul.ui-autocomplete').each(function() {
					if($(this).is(':visible')) {
						auto_check = true;
					}
				});
				
				if(!auto_check) {
					createAndSendJSON('#'+$(this).attr('id'), true);
				}

			})
		});

		$('fieldset#advanced-search select').each(function() {
			$(this).blur(function() {
				createAndSendJSON('#'+$(this).attr('id'), true);
			})
        })

        $('fieldset.refinements input').each(function () {
            $(this).change(function () {
                createAndSendJSON('#' + $(this).attr('id'), false);
            })
        });

		// handle the unchecking of the 'all departments' checkbox
		$('.collapsible li input.checkbox').each(function() {
			$(this).not('#all-departments').click(function() {
				$('#all-departments').attr('checked', false);
			})
		})
	}
	
	if ($(".pageable").length > 0) {
		$(".pageable").quickPager();
	}
	
	function triggerDivClick(items, link) {
	    items.each(function () {
	        $(this).click(function () {
	            window.location = $(this).find("div.container a").attr("href");
	            return false;
	        })
	    })
    }

    // JSON calls for N RESULT feedback
    //    function DoJSONquery() {
    //        var nresult;

    //        if ($('fieldset#advanced-search').length > 0) {

    //            $('div.advanced-search-collections').find('input').each(function () {
    //                if ($(this).attr('type') == 'checkbox') {
    //                    $(this).click(function () {
    //                        createAndSendJSON();
    //                    })
    //                }
    //                else {
    //                    $(this).blur(function () {
    //                        createAndSendJSON();
    //                    })
    //                }
    //            })

    //            $('div.advanced-search-collections').find('select').each(function () {
    //                $(this).change(function () {
    //                    createAndSendJSON();
    //                })
    //            })
    //        }
    //        return nresult;
    //    }

    function createAndSendJSON(elementid, displayPopup) {
        JSONobj = ($('div.advanced-search-collections .json-ready').serializeJSON());
        $.extend(JSONobj, { 'departments': $('div.advanced-search-collections .json-ready-checkbox').serializeJSON() });
        $.extend(JSONobj, { 'refinements-one': $('div.advanced-search-collections .json-ready-refinements-one').serializeJSON() });
        $.extend(JSONobj, { 'refinements-two': $('div.advanced-search-collections .json-ready-refinements-two').serializeJSON() });

        jQuery.ajax({
            url: "searchnresult.ashx?rob=n", //"http://localhost:57372/Collections/search-the-collections/advanced-collections-search/",
            type: "POST",
            data: JSONobj,
            dataType: "json",
            beforeSend: function (x) {
                if (x && x.overrideMimeType) {
                    x.overrideMimeType("application/j-son;charset=UTF-8");
                }
            },
            success: function (data) {
                //update the total result counter with the returned result
                var displaytext;
                try {
                    displaytext = data.result;
                }
                catch (err) {
                    displaytext = "Search to find";
                }

                $('#estimated-result-count').text(displaytext);
                $('#estimated-result-count-refine').text(displaytext);
                                
                if (displayPopup == true) {
                    $('#feedback-container div').html(displaytext + " results available").fadeIn(1500).delay(3000).fadeOut(1500)
                } 
            }
        });
    }

	// sort out scroll of the feedback container. has to stop at certain positions to stop it going over stuff
	if($('#advanced-search').length > 0) {
		$(window).scroll(function(){
			
			if (isScrolledIntoView($('fieldset.collapsible-container'))) {
				$('#feedback-container').addClass('absolute-bottom')
				$('#feedback-container').css('top', $('fieldset.collapsible-container').offset().top - 375 )
				$('#feedback-container div').removeClass('fixed');
			}
			
			if (isScrolledOutOfView($('fieldset.collapsible-container'))) {
				$('#feedback-container').removeClass('absolute-bottom')
				$('#feedback-container div').addClass('fixed');
			}
			
		});
		
		// if the window is resized when the feedback container is visible, it can go into the footer so prevent that from hpaenning
		$(window).resize(function() {
			if (isScrolledIntoView($('fieldset.collapsible-container'))) {
				$('#feedback-container').addClass('absolute-bottom')
				$('#feedback-container div').removeClass('fixed');
			}
			
			if (isScrolledOutOfView($('fieldset.collapsible-container'))) {
				$('#feedback-container').removeClass('absolute-bottom')
				$('#feedback-container div').addClass('fixed');
			}
		})
	}
	
	
	function isScrolledIntoView(elem) {
		var docViewTop = $(window).scrollTop() + $(window).height();
		var elemTop = elem.offset().top;

		return (docViewTop >= elemTop);
	}
	
	function isScrolledOutOfView(elem) {
		var docViewTop = $(window).scrollTop() + $(window).height();
		var elemTop = elem.offset().top;

		return (docViewTop < elemTop);
	}

    // End Advanced Search

    function triggerDivClick(items, link) {

        items.each(function () {
            $(this).click(function () {
                window.location = $(this).find("div.container a").attr("href");
                return false;
            })
        })

    }

	// simple function
    function showContent(showTrigger, divToShow, divToHide) {
        showTrigger.click(function () {
            divToShow.show()
			divToHide.hide()
            return false
        })

    }

    // simple function
    function showHideContent(showTrigger, divToShow, hideTrigger) {
        showTrigger.click(function () {
            divToShow.show()
            return false
        })
        hideTrigger.click(function () {
            divToShow.hide()
            return false
        })

    }

    function reloadSlider(containerDiv) {
        //find the slider
        var sliderVar = $(containerDiv.find('div.continuous-slider'));

        //iterate through the links. when clicked match the link class with the object class and hide the others
        containerDiv.find('div.links a').each(function () {
            $(this).click(function () {
                //get the link class

                className = $(this).attr('class');
                if (className.indexOf('selected') < 0) {
                    className = className.replace('icon-link ', '')
                    containerDiv.find('div.links a.selected').removeClass('selected')
                    $(this).addClass('selected')
                    sliderVar.find('div.object').each(function () {
                        if (className == 'All') {
                            $(this).css('display', 'block')
                        }
                        else if (!$(this).hasClass(className)) {
                            $(this).css('display', 'none')
                        }
                        else {
                            $(this).css('display', 'block')
                        }
                    })
                }

                return false
            })
        })

        //re load the slider, somehow.
    }


    // sort out the display of the 404 page.
    function updateHeightOf404() {
        imgHeight = $("div.not-found").find('img').height();

        $("div.not-found").find("div.content-wrapper").css('margin-top', (imgHeight * -1) + 'px').css('min-height', imgHeight + 'px');
    }

    //create a cookie and update it's values depending on what value is clicked
    function updateCookie(parentElement, trigger) {
	
		if($.cookie("MMACollectionSearchView") == null) {
        	$.cookie("MMACollectionSearchView", 'imgDesc', { path: '/' }); //default the cookie to be the image description view
		}		
        parentElement.find(trigger).each(function () {
            $(this).click(function () {
                if ($(this).parent().hasClass('img-desc')) {                    
                    $.cookie("MMACollectionSearchView", 'imgDesc', { path: '/' });
                }
                else if ($(this).parent().hasClass('img-only')) {                   
                    $.cookie("MMACollectionSearchView", 'imgOnly', { path: '/' });
                }
                else if ($(this).parent().hasClass('slideshow')) {
                    $.cookie("MMACollectionSearchView", 'imgSlide', { path: '/' });
                }
            });
        });

    }

    // sets a cookie so that we know what tab is being viewed so we can add the correct object to my met when that button is pressed
    function updateExhibCookie(parentElement, trigger) {

        var frontClass = parentElement.find('li.front').attr('class').replace(" front", "");

        $.cookie("MMAExhibitionAddToMyMet", frontClass, { path: '/' }); // default cookie set to whatever is visible first.

        parentElement.find(trigger).each(function () {
            $(this).click(function () {
                if ($(this).parent().hasClass('videos')) {
                    $.cookie("MMAExhibitionAddToMyMet", 'videos', { path: '/' });
                }
                else if ($(this).parent().hasClass('audio')) {
                    $.cookie("MMAExhibitionAddToMyMet", 'audio', { path: '/' });
                }
                else if ($(this).parent().hasClass('interactive')) {
                    $.cookie("MMAExhibitionAddToMyMet", 'interactive', { path: '/' });
                }
            });
        });
    }

    // given an element, reveal an element when it's parent is hovered.
    function revealHoverElement(parentElement, hoverElement, revealElement) {

        parentElement.find(hoverElement).each(function () {
            var currentRevealElement = $($(this).find(revealElement));
            if (currentRevealElement) {
                $(this).hover(function () {
                    //currentRevealElement.slideDown('slow')
                    currentRevealElement.toggle()
                },
				function () {
				    //currentRevealElement.slideUp('slow')
				    currentRevealElement.toggle()
				});
            }
        });

    }

    // Toggle display of text when focus / blur of form field
    function toggleText(element, startWord, swapWord) {
        element.click(function () {
            var content = $(this).text();

            if (content.indexOf(startWord) > -1) {
                $(this).text($(this).text().replace(startWord, swapWord))
            } else {
                $(this).text($(this).text().replace(swapWord, startWord))
            }
        });
    }

    // Submit closest form element on click
    function submitForm(element) {
        element.live('click', function () {
            $(this).closest('form').submit();
        });
    }
    

	// submit closest form element on change
	function submitFormChange(element) {
		element.live('change', function() {
			$(this).closest('form').submit();
		})
	}

    // Slide a child element 'div.search-terms' on click of another element 'elTrigger'
    function slideParent(elTrigger, parent, className) {
        elTrigger.find('a').click(function () {
            $(this).closest('div.search-terms').animate({ height: 'toggle' }, 1000, function () {
                $(this).removeClass(className)
            });
            return false;
        });
    }

    // On click of an element (activate), trigger the click of another set of elements (trigger)
    function triggerClick(parent, activate, trigger, ifHidden) {
        parent.each(function () {
            var elParent = $(this);
            $(this).children(activate).click(function () {
                if (($(this)[0].nodeName.toLowerCase() != "input") || ($(this).attr("checked"))) {
                    if (elParent.find(ifHidden).css("display") == "none") elParent.find(trigger).trigger("click")
                }
            });
        })
    }

    function requestedImages() {

        $("div.requested-images").append('<h3 class="no-margin">You have requested <span class="checkbox-count">' + $("ul.image-request input:checked").length + '</span> items</h3>');

        $("ul.image-request input").click(function () {
            $(".checkbox-count").html($("ul.image-request input:checked").length);
        });
    }

    // Function hides one form element and shows another triggered by a select box change
    function showOnDivTrigger(elContainingDiv, trigger, triggerVal, divToShow, elToHide) {
        var selectBox = trigger;

        selectBox.find('ul li a').click(function () {

            if ($(this).html() == triggerVal) {
                elContainingDiv.find(elToHide).fadeOut('fast', function () {
                    elContainingDiv.find(divToShow).fadeIn('fast');
                })
            } else {
                elContainingDiv.find(divToShow).fadeOut('fast', function () {
                    elContainingDiv.find(elToHide).fadeIn('fast');
                })
            }
        });
    }

    // Function hides one form element and shows another triggered by a select box change
    function showOnSelectBoxTrigger(elContainingDiv, trigger, triggerVal, divToShow, elToHide) {
        var selectBox = elContainingDiv.find(trigger);

        selectBox.change(function () {
            if (selectBox.val() == triggerVal) {
                elContainingDiv.find(elToHide).fadeOut('fast', function () {
                    elContainingDiv.find(divToShow).fadeIn('fast');
                })
            } else {
                elContainingDiv.find(divToShow).fadeOut('fast', function () {
                    elContainingDiv.find(elToHide).fadeIn('fast');
                })
            }
        });
    }

    function showFormFields(elLink, divToShow) {
        elLink.click(function () {
            var container = $(this).closest('.input-field');
            var count = 0;
            container.find(divToShow).each(function () {
                if (count == 0) {
                    if ($(this).css('position') == 'absolute') {
                        $(this).addClass('visible');
                        count++;
                    }
                }
            });
            return false;
        });
    }

    // Function that takes a parent element
    // and hides a child element when another child element is clicked
    function hideContent(elParent, elActivate, elChildToHide) {

        if ((elParent.find(elActivate).length > 0) && (elParent.find(elChildToHide))) {

            elParent.each(function () {
                var parent = $(this);
                parent.find(elActivate).each(function () {
                    $(this).click(function () {
                        parent.find(elChildToHide).css('display', 'none');
                        return false;
                    })
                })
            })
        }
    }



    // Function that takes a parent element (to restrict conflicts),
    // and checks for activation and reveal content child elements
    // if it finds them, then on click of the activation elements it switches the reveal content elements
    function changeClass(elParent, elActivate, childElementSelector, elToAddClass, classToAdd) {                
        if ((elParent.find(elActivate).length > 0) && (elParent.find(childElementSelector))) {
            elParent.each(function () {
                var parent = $(this);

                parent.find(elActivate).each(function () {

                    var childElements = $(this).find(childElementSelector);

                    childElements.each(function (intIndex) {
                        var activate = $(this);
                        activate.click(function () {

                            if (childElements.length > 1) {
                                $(this).closest(childElementSelector).siblings().removeClass("front");
                                activate.addClass("front");

                                if (parent.find(elToAddClass).length > 1) {
                                    parent.find(elToAddClass).removeClass(classToAdd);
                                    parent.find(elToAddClass).eq(intIndex).addClass(classToAdd);
                                }
                                else {
                                    parent.find(elToAddClass).toggleClass(classToAdd);
                                }
                            }
                            return false;
                        })
                    });
                });
            })
        }
    }   
        
    // Function to create the slideshow (with navigation) on the homepage
    function setUpHomepageSlideshow(container, slideshow) {
        container.prepend('<a href="#" class="prev" name="Previous slide"><span class="hide-content">Previous</span></a>');
        container.prepend('<a href="#" class="next" name="Next slide"><span class="hide-content">Next</span></a>');

        slideshow.before('<div id="pager"><div id="pager-container">').cycle({
            fx: 'fade',
            speed: 1000,
            timeout: 5000,
            pager: '#pager-container',
            next: '.next',
            prev: '.prev',
            pause: 1
            //easing: 'backinout'
        });

        $("a.prev").prependTo("div#pager");
        $("a.next").appendTo("div#pager");

        //find the second to last link in pager (the one before 'next') and give it a class to remove the border
        var lastLink = $("div#pager-container a").last().addClass('no-bg');

        $("div#pager-container a").click(function () {
            slideshow.cycle("pause");
        });

    }

    // On click of an element, revealanother element
    function revealElement(elActivate, elReveal, elSelected, slide) {
        $(elActivate).live("click", function () {
            if (slide) {
                $(elReveal).slideToggle();
            } else {
                $(elReveal).fadeToggle();
            }
            if (elSelected) {
                $(elSelected).toggleClass("selected");
            }

            return false;
        });
    }

    // Appends / prepends a chunk of HTML to an element 
    function addHTML(elToAddTo, htmlToAdd, append) {
        if (append) {
            elToAddTo.append(htmlToAdd)
        } else {
            elToAddTo.prepend(htmlToAdd);
        }
    }

    // Accordion link slider, does some class switching too
    // had to re use the slide toggle so that I could chain the toggleClass afterwards
    function accordionAnimator(accordionLinks, elementStringToShow) {
        accordionLinks.each(function (index) {
            //grab the first one and open it
            if (index == 0) {
                $(this).addClass('selected');
                $(this).next($(elementStringToShow)).addClass('selected');
            }
            $(this).click(function () {
                //$(this).next($(elementStringToShow)).slideToggle("medium");
                $(this).next($(elementStringToShow)).animate({ height: 'toggle' }, 500);
                $(this).toggleClass('selected');
                return false;
            });
        });
    }

    /*  Takes an input field element (elInputField) and adds a specified text value (textToHide)
    *  FOCUS: When that input field is given focus the term is removed
    *  BLUR: If the focus is lost when the field is empty the text value (textToHide) is reinstated  
    */
    function setSearchText(elInputField, textToHide) {
        if (elInputField.attr("value") == "") {
            elInputField.attr("value", textToHide)
        }

        elInputField.focus(function () {
            if (elInputField.attr("value") == textToHide) elInputField.attr("value", "");
        })
        elInputField.blur(function () {
            if (elInputField.attr("value") == "") elInputField.attr("value", textToHide);
        })
        elInputField.closest("form").submit(function () {
            if (elInputField.attr("value") == textToHide) {
                elInputField.attr("value", "");
            }
        })
    }

    // Function to create slide animated form elements
    function slideFormContainer(elParent, elToSlide, trigger, elToSlideToggleClass, hideLinkText) {

        elParent.each(function () {
            var parent = $(this);
            var elTrigger = parent.find(trigger);

            if (hideLinkText) var initialContent = elTrigger.text();

            elTrigger.click(function () {
                //elToSlide.slideToggle("slow");
                parent.find(elToSlide).animate({ height: 'toggle' }, 1000, function () {
                    if (elToSlideToggleClass) {
                        elTrigger.toggleClass(elToSlideToggleClass);

                        if (hideLinkText) {
                            if (elTrigger.text() == initialContent) {
                                elTrigger.find('span').html(hideLinkText);
                            } else {
                                elTrigger.find('span').html(initialContent);
                            }
                        }
                    }
                });
                var triggerAnchor = elTrigger[0].nodeName.toLowerCase();
                if (triggerAnchor == "a") return false;
            });
        })

    }

    // Function to create slide animated drop downs
    function slideSingleContainer(elParent, elToSlide, trigger, elToSlideToggleClass, hideLinkText, elParentScroller) {

        elParent.each(function () {
            var parent = $(this);
            var elTrigger = parent.find(trigger);

            if (hideLinkText) var initialContent = elTrigger.text();

            elTrigger.click(function () {

                //elToSlide.slideToggle("slow");
                parent.find(elToSlide).animate({ height: 'toggle' }, 1000, function () {
                    if (elToSlideToggleClass) {
                        elTrigger.toggleClass(elToSlideToggleClass);


                        if (hideLinkText) {
                            if (elTrigger.text() == initialContent) {
                                elTrigger.find('span').html(hideLinkText);
                            } else {
                                elTrigger.find('span').html(initialContent);
                            }
                        }
                    }
                    if (elParentScroller) {
                        if (elTrigger.closest('li.event-item').hasClass('last')) {
                            elParent.closest(elParentScroller).animate({
                                scrollTop: 700
                            })
                        }
                    }
                });
                var triggerAnchor = elTrigger[0].nodeName.toLowerCase();
                if (triggerAnchor == "a") return false;
            });
        })

    }

    /*	Slides a container.
    ARGS: The container to slide, the link to trigger, a classname to put on the link pressed (if any) to show an arrow changing for example
    */
    function slideContainer(elToSlide, trigger, elToSlideToggleClass) {
        trigger.click(function () {
            //elToSlide.slideToggle("slow");
            elToSlide.animate({ height: 'toggle' }, 500);
            if (elToSlideToggleClass) {
                trigger.toggleClass(elToSlideToggleClass);
            }
            return false;
        });
    }

    function l(msg) { console.log(msg) }

    // Function that initiliases the fullscreen artwork popover
    function initialisePopover() {
        if ($('a.activate-overlay').length > 0) {

            var activateOverlay = $('a.activate-overlay');
            var modal_id = activateOverlay.attr('name');


            $(window).bind('hashchange', function (event) {
                if (window.location.hash != "#fullscreen") {
                    close_modal();
                }
            });

            activateOverlay.click(function () {
                show_modal(modal_id);

                $(document).keydown(function (event) {
                    // If escape is pressed then close the modal window
                    if (event.keyCode == 27) {
                        close_modal();
                    }
                });
                return false;
            });

        }
        if (jQuery('div.overlay p.close a').length > 0) {
            $('div.overlay p.close a').click(function () {
                history.go(-1);
                return false;
            });
        }

    }

    // Function to hide the fullscreen artwork popover
    function close_modal() {
        window.scrollTo(0, 0);
        $(document).unbind("keydown");
        $('div.mask').fadeOut(500);
        $('div.overlay').fadeOut(500);
        $('div#wrapper').css({ 'display': 'block' });
        $("body").css({ 'overflow': 'visible' })
    }

    // Function to show the fullscreen artwork popover
    function show_modal(modal_id) {
        window.location.hash = "fullscreen";
        window.scrollTo(0, 0);
        $('div.mask').css({ 'display': 'block', opacity: 0 });
        $('div.mask').fadeTo(500, 1);
        $('#' + modal_id).fadeIn(500, function () {
            $('div#wrapper').css({ 'display': 'none' });
        });
        $('div.mask').css({ 'min-height': $(window).height() });

        $("body").css({ 'overflow': 'hidden' })
    }

});

(function( $ ){
$.fn.serializeJSON=function() {
	var json = {};

	jQuery.map($(this).serializeArray(), function(n, i){
		json[n['name']] = n['value'];
		});

	return json;
	};
})( jQuery );
;
/************************* globals, utility methods, etc. **************************************/
/* this is a workaround to the global nature of select lists on the site. Intended to ease
* manipulation via left offset value. Populated at document.ready()
*/
var selectListLeftOffsetValues = null;


/* utility method to find the maximum value of an array */
Array.max = function (array) {
    return Math.max.apply(Math, array);
};

/* constants for  plus and minus sign slider controls */
var togglePlusClassName = "metpubs-search-toggle-plus";
var toggleMinusClassName = "metpubs-search-toggle-minus";





/************************* data objects **************************************/


/* this object maps the div which gets clicked with the one that slides open and closed */
var slidingPaneMap = new Object();
//slidingPaneMap["metpubs_toggle_search"] = "metpubs_advanced_search_container";
/* slidingPaneMap method: pass the name of the div that clicks, and get the name of the div that slides */
slidingPaneMap.getSlidingObj = function (str) { return this[str]; };

var slidingPaneMapTabBar = new Object();
slidingPaneMapTabBar["metpubs_related_titles_author_bar"] = ["metpubs_related_titles_author_toggle", "metpubs_related_titles_author_contents"];
slidingPaneMapTabBar["metpubs_related_titles_thematic_bar"] = ["metpubs_related_titles_thematic_toggle", "metpubs_related_titles_thematic_contents"];
slidingPaneMapTabBar["metpubs_related_titles_department_bar"] = ["metpubs_related_titles_department_toggle", "metpubs_related_titles_department_contents"];
slidingPaneMapTabBar["metpubs_resources_exhibition_bar"] = ["metpubs_resources_exhibition_toggle", "metpubs_resources_exhibition_contents"];
slidingPaneMapTabBar["metpubs_resources_met_works_bar"] = ["metpubs_resources_met_works_toggle", "metpubs_resources_met_works_contents"];
slidingPaneMapTabBar["metpubs_resources_timeline_bar"] = ["metpubs_resources_timeline_toggle", "metpubs_resources_timeline_contents"];
slidingPaneMapTabBar["metpubs_about_description_bar"] = ["metpubs_about_description_toggle", "metpubs_about_description"];
slidingPaneMapTabBar["metpubs_about_contents_bar"] = ["metpubs_about_contents_toggle", "metpubs_about_contents"];
slidingPaneMapTabBar["metpubs_about_authors_bar"] = ["metpubs_about_authors_toggle", "metpubs_about_authors"];
slidingPaneMapTabBar["metpubs_about_reviews_bar"] = ["metpubs_about_reviews_toggle", "metpubs_about_reviews"];
slidingPaneMapTabBar["metpubs_about_press_bar"] = ["metpubs_about_press_toggle", "metpubs_about_press"];
slidingPaneMapTabBar["metpubs_about_tags_bar"] = ["metpubs_about_tags_toggle", "metpubs_about_tags"];
slidingPaneMapTabBar.getSlidingToggle = function (str) { return this[str][0]; };
slidingPaneMapTabBar.getSlidingContent = function (str) { return this[str][1]; };





/* tabmap object maps tab ids to content obj ids */
var tabMap = new Object();
tabMap.arr = new Array();
tabMap.arr.push(["metpubs_about_tab", "metpubs_about_container", "metpubs_about_tab_image", "/content/img/presentation/buttons/tab_about_on.png", "/content/img/presentation/buttons/tab_about_off.png", "80", "about_the_title"]);
tabMap.arr.push(["metpubs_related_tab", "metpubs_related_container", "metpubs_related_tab_image", "/content/img/presentation/buttons/tab_related_on.png", "/content/img/presentation/buttons/tab_related_off.png", "90", "related_titles"]);
tabMap.arr.push(["metpubs_resources_tab", "metpubs_resources_container", "metpubs_resources_tab_image", "/content/img/presentation/buttons/tab_resources_on.png", "/content/img/presentation/buttons/tab_resources_off.png", "80", "additional_resources"]);


/* the array returned by this method pushes the tabs to be hidden first,
* then adds the id to be shown last. This is meant to ease its use in the tabTo()
* method. A simple loop can be used to perform hide() operations first,
* on the last item, show() is called.
* return array: [0]content container id, [1]image id, [2]appropriate image path
*/
tabMap.getTabContentObjIdArr = function (str) {  
    var returnArray = new Array();
    var selectedTabObject = new Array();
    for (var i = 0; i < tabMap.arr.length; i++) {
        if (str == tabMap.arr[i][0]) {           
            selectedTabObject = [tabMap.arr[i][1], tabMap.arr[i][2], tabMap.arr[i][3], tabMap.arr[i][0], tabMap.arr[i][5], tabMap.arr[i][6]];
        }
        else {
            returnArray.push([tabMap.arr[i][1], tabMap.arr[i][2], tabMap.arr[i][4], tabMap.arr[i][0], tabMap.arr[i][5], tabMap.arr[i][6]]);
        }
    }
    returnArray.push(selectedTabObject);
    return returnArray;
};

tabMap.getLength = function () { return this.arr.length; };


/************************* document ready ****************************************/

$(document).ready(function () {

    /* create an Array that contains left offset values for select list divs */
    selectListLeftOffsetValues = new Array();
    $('div.yaselect-current').each(function () {
        selectListLeftOffsetValues.push([$(this).offset().left]);
    });

    
    

    $('div.yaselect-current').each(function () {

        if (selectListLeftOffsetValues.length > 4) {
            if ($(this).offset().left < Array.max(selectListLeftOffsetValues)) {
                $(this).parent().addClass("metpubs-search-select-width");
            }
        }
        else {
            $(this).parent().addClass("metpubs-search-select-width");
        }

    });

    if ($('div.metpubs-sort-container .yaselect-wrap').length > 0) $('div.metpubs-sort-container .yaselect-wrap').addClass("metpubs-search-sort-width");

    if ($("div#m_ThematicCategoryDiv").length > 0) ToggleRelatedContent($("div#m_ThematicCategoryDiv"), "div#m_ThematicCategoryContent");
    if ($("div#m_AuthorDiv").length > 0) ToggleRelatedContent($("div#m_AuthorDiv"), "div#m_AuthorContent");


    $(document).ready(function () {
        $(".metpubs-search-text-input").keypress(function (e) {
            var key = e.keyCode || e.which;
            if (key == 13) {
                e.preventDefault();
                var title = $('#txtTitle').val();
                if (title == "Title")
                    title = "";
                var author = $('#txtAuthor').val();
                if (author == "Author")
                    author = "";                
                var tag = $('#txtKeyword').val();
                if (tag == "Keyword")
                    tag = "";
                var publicationType = $('#publicationTypeDropdown').val();
                var thematicCategory = $('#thematicCategoryDropdown').val();
                var department = $('#departmentDropdown').val();
                var format = $('#formatDropdown').val();
                document.location.href = "/art/metpublications/search-publication-results?searchType=C&Tag=" + tag + "&title=" + title + "&author=" + author + "&pt=" + publicationType + "&tc=" + thematicCategory + "&dept=" + department + "&fmt=" + format;
                return false;
            }
        });

        $("#resetButton").click(function () {
            setQuerystring("clear", "Y");
            return false;

        });

        $("#RunButton").click(function () {
            var title = $('#txtTitle').val();
            if (title == "Title")
                title = "";
            var author = $('#txtAuthor').val();
            if (author == "Author")
                author = "";
            var tag = $('#txtKeyword').val();
            if (tag == "Keyword")
                tag = "";
            var publicationType = $('#publicationTypeDropdown').val();
            var thematicCategory = $('#thematicCategoryDropdown').val();
            var department = $('#departmentDropdown').val();
            var format = $('#formatDropdown').val();
            document.location.href = "/art/metpublications/search-publication-results?searchType=C&Tag=" + tag + "&title=" + title + "&author=" + author + "&pt=" + publicationType + "&tc=" + thematicCategory + "&dept=" + department + "&fmt=" + format + "&sort=PublicationYear%7CDesc";
            return false;
        });

        $("#search-field").keypress(function (e) {
            var key = e.keyCode || e.which;
            if (key == 13) {
                e.preventDefault();
                var searchterm = $('#search-field').val();
                document.location.href = "/search-results?ft=" + searchterm;
                return false;
            }
        });

        if ($("div#metpubs_about_tab").length > 0) {
            var found = false;
            
            for (var i = 0; i < tabMap.arr.length; i++) {
                if (window.location.hash.toLowerCase().search(tabMap.arr[i][6]) > -1) {
                    $("#" + tabMap.arr[i][1]).show();
                    $("#" + tabMap.arr[i][0]).css("z-index", 1000);
                    $("#" + tabMap.arr[i][2]).attr("src", tabMap.arr[i][3]);
                    found = true;
                }
                else {
                    $("#" + tabMap.arr[i][1]).hide();
                    $("#" + tabMap.arr[i][0]).css("z-index", tabMap.arr[i][5]);
                    $("#" + tabMap.arr[i][2]).attr("src", tabMap.arr[i][4]);
                }
            }
            if (!found) {
                $("#" + tabMap.arr[0][1]).show();
                $("#" + tabMap.arr[0][0]).css("z-index", 1000);
                $("#" + tabMap.arr[0][2]).attr("src", tabMap.arr[0][3]);                
            }
            
        }

        
        if ($("input#txtTitle").length > 0) setMetpubsSearchText($("input#txtTitle"), "");
        if ($("input#txtAuthor").length > 0) setMetpubsSearchText($("input#txtAuthor"), "");
        if ($("input#txtKeyword").length > 0) setMetpubsSearchText($("input#txtKeyword"), "");

        
    });

    $("#metpubs-share-link").click(function (e) {
        e.preventDefault();
        $(this).hide();
        $("#metpubs-share-icons").css("display", "inline-block");
    });


    /* switch between gridview and listview*/
    $("#gridLink").click(function () {
        setQuerystring("view", "G");
        /* $("#divList").hide();
        $("#divGrid").show();*/
    });
    $("#listLink").click(function () {
        setQuerystring("view", "L");
        /* $("#divList").show();
        $("#divGrid").hide();*/
    });

    /*event for change of sort dropdown */
    $('#SortDropdown').change(function (e) {
        var sortvalue = $(this).val();
        // Add new parameters or update existing ones
        if (sortvalue == "T") {
            setQuerystring('sort', 'TitleSort');
        }
        if (sortvalue == "YD") {
            setQuerystring('sort', 'PublicationYear|Desc');
        }
        if (sortvalue == "YA") {
            setQuerystring('sort', 'PublicationYear|Asc')
        }

    });




});

//Sets the input search text boxes to text passed
function setMetpubsSearchText(elInputField, textToHide) {
    if (elInputField.attr("value") == "") {
        elInputField.attr("value", textToHide)
    }

    elInputField.focus(function () {
        if (elInputField.attr("value") == textToHide) elInputField.attr("value", "");
    })
    elInputField.blur(function () {
        if (elInputField.attr("value") == "") elInputField.attr("value", textToHide);
    })    
}

// Accordion link slider, does some class switching too
// had to re use the slide toggle so that I could chain the toggleClass afterwards
function ToggleRelatedContent(accordionLinks, elementStringToShow) {
    accordionLinks.each(function (index) {
        $(this).click(function () {
            //$(this).next($(elementStringToShow)).slideToggle("slow");
            $(this).next($(elementStringToShow)).animate({ height: 'toggle' }, 500);
            $(this).toggleClass('selected');
            return false;
        });
    });
}

function setQuerystring(name, value) {
    /*
    * queryParameters -> handles the query string parameters
    * queryString -> the query string without the fist '?' character
    * re -> the regular expression
    * m -> holds the string matching the regular expression
    */
    var queryParameters = {}, queryString = location.search.substring(1),
         re = /([^&=]+)=([^&]*)/g, m;

    // Creates a map with the query string parameters
    while (m = re.exec(queryString)) {
        queryParameters[decodeURIComponent(m[1])] = decodeURIComponent(m[2]);
    }

    // Add new parameters or update existing ones
    queryParameters[name] = value;

    /*
    * Replace the query portion of the URL.
    * Query.param() -> create a serialized representation of an array or
    *     object, suitable for use in a URL query string or Ajax request.
    */
    location.search = $.param(queryParameters);
}


// jQuery(document).ready(function (a) {
//     a(window).load(function () {
//         var sliders = jQuery("div.sliderGeneral");
//         if (sliders.length > 0) {
//             sliders.each(function () {
//                 var queryString = $(this).find('span.queryString').html();

//                 $(this).slider({
//                     ajaxNavigation: true,
//                     continuousNavigation: false,
//                     stopElementsFromEnd: 3,
//                     imageType: 'thumbnail',
//                     thumbnails: true,
//                     autoScroll: false,
//                     animationSpeed: 300,
//                     numToLoad: 10,
//                     urlForAjax: "/ajax/slider/slidermetpublications.ashx?" + queryString,
//                     numBeforeLoad: 7
//                 });
//             });
//         }
//     });
// });


/************************** event handling *********************************/

/******* search events *************** commented all Pooja /
/*$("input[name='metpubs_search_title_input']").click(function () {
$(this).val("");
});
$("input[name='metpubs_search_author_input']").click(function () {
$(this).val("");
});
$("input[name='metpubs_search_keyword_input']").click(function () {
$(this).val("");
});

$("#metpubs_search_reset_control").click(function () {
$("input[name='metpubs_search_title_input']").val("");
$("input[name='metpubs_search_author_input']").val("");
$("input[name='metpubs_search_keyword_input']").val("");
$("input[name='metpubs_publication_type_select']").val('empty');
$("input[name='metpubs_thematic_category_select']").val('empty');
$("input[name='metpubs_department_select']").val('empty');

$('div.yaselect-current').each(function () {
       
if (selectListLeftOffsetValues.length > 3) {
if ($(this).offset().left < Array.max(selectListLeftOffsetValues)) {
$(this).text("");
}
}
else {
$(this).text("");
}
});

});
$("#metpubs_search_control").click(function () {

metpubsSearch();

});*/



/******************** toggle events **********************************/

$("#metpubs_toggle_search").click(function () { toggleAndSlide("metpubs_toggle_search"); });

$("#metpubs_about_description_bar").click(function () { toggleAndSlideFromBar("metpubs_about_description_bar"); });
$("#metpubs_about_contents_bar").click(function () { toggleAndSlideFromBar("metpubs_about_contents_bar"); });
$("#metpubs_about_authors_bar").click(function () { toggleAndSlideFromBar("metpubs_about_authors_bar"); });
$("#metpubs_about_reviews_bar").click(function () { toggleAndSlideFromBar("metpubs_about_reviews_bar"); });
$("#metpubs_about_press_bar").click(function () { toggleAndSlideFromBar("metpubs_about_press_bar"); });
$("#metpubs_about_tags_bar").click(function () { toggleAndSlideFromBar("metpubs_about_tags_bar"); });
$("#metpubs_related_titles_author_bar").click(function () { toggleCloseAndSlideFromBar("metpubs_related_titles_author_bar"); });
$("#metpubs_related_titles_thematic_bar").click(function () { toggleCloseAndSlideFromBar("metpubs_related_titles_thematic_bar"); });
$("#metpubs_related_titles_department_bar").click(function () { toggleCloseAndSlideFromBar("metpubs_related_titles_department_bar"); });
$("#metpubs_resources_exhibition_bar").click(function () { toggleAndSlideFromBar("metpubs_resources_exhibition_bar"); });
$("#metpubs_resources_met_works_bar").click(function () { toggleAndSlideFromBar("metpubs_resources_met_works_bar"); });
$("#metpubs_resources_timeline_bar").click(function () { toggleAndSlideFromBar("metpubs_resources_timeline_bar"); });


function toggleAndSlide(headerId) {
    if ($("#" + headerId).hasClass(toggleMinusClassName)) {
        $("#" + headerId).removeClass(toggleMinusClassName);
        $("#" + headerId).addClass(togglePlusClassName);
        $("#" + slidingPaneMap.getSlidingObj(headerId)).slideUp();
    } else {
        $("#" + headerId).removeClass(togglePlusClassName);
        $("#" + headerId).addClass(toggleMinusClassName);
        $("#" + slidingPaneMap.getSlidingObj(headerId)).slideDown();
    }

}

function ToggleandSlideContent(slidingBar, slidingContent)
{
    if ($("#" + slidingBar).hasClass(toggleMinusClassName)) {
        $("#" + slidingBar).removeClass(toggleMinusClassName);
        $("#" + slidingBar).addClass(togglePlusClassName);
        $("#" + slidingContent).slideUp();
    } else {
        $("#" + slidingBar).removeClass(togglePlusClassName);
        $("#" + slidingBar).addClass(toggleMinusClassName);
        $("#" + slidingContent).slideDown();
    }

}


function toggleAndSlideFromBar(headerId) {
    if ($("#" + slidingPaneMapTabBar.getSlidingToggle(headerId)).hasClass(toggleMinusClassName)) {
        $("#" + slidingPaneMapTabBar.getSlidingToggle(headerId)).removeClass(toggleMinusClassName);
        $("#" + slidingPaneMapTabBar.getSlidingToggle(headerId)).addClass(togglePlusClassName);
        $("#" + slidingPaneMapTabBar.getSlidingContent(headerId)).slideUp();
    } else {
        $("#" + slidingPaneMapTabBar.getSlidingToggle(headerId)).removeClass(togglePlusClassName);
        $("#" + slidingPaneMapTabBar.getSlidingToggle(headerId)).addClass(toggleMinusClassName);
        $("#" + slidingPaneMapTabBar.getSlidingContent(headerId)).slideDown();
    }

}


function toggleCloseAndSlideFromBar(headerId) {

    var initialState = $("#" + slidingPaneMapTabBar.getSlidingToggle(headerId)).hasClass(togglePlusClassName);

    /* close everything */
    $("#metpubs_related_titles_author_toggle").removeClass(toggleMinusClassName);
    $("#metpubs_related_titles_author_toggle").addClass(togglePlusClassName);
    $("#" + slidingPaneMapTabBar.getSlidingContent("metpubs_related_titles_author_bar")).slideUp();

    $("#metpubs_related_titles_thematic_toggle").removeClass(toggleMinusClassName);
    $("#metpubs_related_titles_thematic_toggle").addClass(togglePlusClassName);
    $("#" + slidingPaneMapTabBar.getSlidingContent("metpubs_related_titles_thematic_bar")).slideUp();

    $("#metpubs_related_titles_department_toggle").removeClass(toggleMinusClassName);
    $("#metpubs_related_titles_department_toggle").addClass(togglePlusClassName);
    $("#" + slidingPaneMapTabBar.getSlidingContent("metpubs_related_titles_department_bar")).slideUp();

    /* open selected tab */
    if (initialState == true) {
        $("#" + slidingPaneMapTabBar.getSlidingToggle(headerId)).removeClass(togglePlusClassName);
        $("#" + slidingPaneMapTabBar.getSlidingToggle(headerId)).addClass(toggleMinusClassName);
        $("#" + slidingPaneMapTabBar.getSlidingContent(headerId)).slideDown();
    }

}

/*********************** tab events ****************************************/

$("#metpubs_about_tab").click(function () {
    /* this is a good candidate for placement of an ajax call for tab content */
    tabTo("metpubs_about_tab");
});
$("#metpubs_related_tab").click(function () { tabTo("metpubs_related_tab"); });
$("#metpubs_resources_tab").click(function () { tabTo("metpubs_resources_tab"); });



function tabTo(tabId) {
    var hashInUrl = window.location.hash;
    var arr = tabMap.getTabContentObjIdArr(tabId);
    for (var i = 0; i < arr.length; i++) {
        if (i < (arr.length - 1)) {
            $("#" + arr[i][0]).hide();
            $("#" + arr[i][3]).css("z-index", arr[i][4]);
            $("#" + arr[i][1]).attr("src", arr[i][2]);
            $tabForURL = arr[i][5];
            if (hashInUrl.toLowerCase().search($tabForURL) > -1)
                hashInUrl = hashInUrl.toLowerCase().replace($tabForURL, "");

        } else {
            $("#" + arr[i][0]).show();
            $("#" + arr[i][3]).css("z-index", 1000);
            $("#" + arr[i][1]).attr("src", arr[i][2]);
            $tabForURL = arr[i][5];
            
            hashInUrl = $tabForURL;

        }
    }
    window.location.hash = hashInUrl;
}



/************************ event utilities (pop-ups) ***********************************/

function showInfo(imageContainer, infoContainer) {
    $("#" + imageContainer).css("display", "absolute");
    $("#" + imageContainer).css("z-index", 101);
    $("#" + infoContainer).show();
}
function hideInfo(imageContainer, infoContainer) {
    $("#" + infoContainer).hide();
    $("#" + imageContainer).css("z-index", 10);
}








;
var metpubUrl = "";
var totalPages = 0;
var pagesPerPages = 10;
var totalCount = 0;

$(document).ready(function () {
    $("#hdnCurrentPage").val("0");
    metpubUrl = "/api/WorksOfArt/WorksOfArt/GetWorksofArt?metpubitemname=" + $("#hdnItemName").val();
    GetJSON(metpubUrl);
});

//makes an async call to get a subset of works of art
function GetJSON(jsonUrl) {
    $.getJSON(jsonUrl,
     function (data) {
         var text = data;
         var obj = JSON.parse(text);

         SetPaging(obj.pages);
         totalPages = obj.pages;
         totalCount = obj.totalcount;

         //hide controls if there are no worksofart items
         if (totalCount == 0) {
             $('#metpubs_resources_met_works_bar').hide();
             $('#metpubs_resources_met_works_contents').hide();
         }

         $("#woa-bar").text("Met works of art (" + obj.totalcount + ")");
         var count = parseInt(obj.works.length);
         if (count != NaN) {
             $('.metpubs_mwoa_overall_container').empty();

             for (var i = 0; i < obj.works.length; i++) {
                 var newDiv = GetWOAContainerHtml(obj.works[i]);
                 $(newDiv).appendTo($('.metpubs_mwoa_overall_container'));
             }
         }
     });
}

//sets paging links
function SetPaging(pages) {
    $('#page-buttons').empty();
    var intPages = parseInt(pages);

    if (intPages != NaN) {
        var currentPage = parseInt($("#hdnCurrentPage").val()) + 1;
        var numberofDisplayPages = 9;
        var eachSidePageCount = 4;
        var startPage = 1;
        var endPage = intPages;

        if (intPages > numberofDisplayPages) {
            //determine start page and end page

            if (currentPage - eachSidePageCount < 1)
                startPage = 1;
            else
                startPage = currentPage - eachSidePageCount;

            if ((currentPage + eachSidePageCount) > intPages) {
                endPage = intPages;
                startPage = endPage - numberofDisplayPages + 1;
            }
            else
                endPage = (currentPage + eachSidePageCount) < numberofDisplayPages ? numberofDisplayPages : (currentPage + eachSidePageCount);
        }

        var html;

        if (startPage != 1) {
            html = '<a id="m_btnFirstPage" onclick="GetWorksOfArt(this);" class="pageSpace">' + "1" + '</a>';
            $(html).appendTo($('#page-buttons'));
        }

        if (startPage > 2) {
            html = "<span id=\"m_LitBegin\" class=\"metpubs-result-page-number pageSpace\">" + "..." + "</>";
            $(html).appendTo($('#page-buttons'));
        }

        for (var i = startPage; i <= endPage; i++) {
            if ((i - 1) == parseInt($("#hdnCurrentPage").val())) //if this page is current
            {
                html = "<span class=\"metpubs-result-page-number pageSpace\">" + i + "</>";
            }
            else {
                html = '<a onclick="GetWorksOfArt(this);" class="pageSpace">' + i + '</a>';
            }

            $(html).appendTo($('#page-buttons'));
        }

        if (endPage < (intPages - 1)) {
            html = "<span id=\"m_LitEnd\" class=\"metpubs-result-page-number pageSpace\">" + "..." + "</>";
            $(html).appendTo($('#page-buttons'));
        }

        if (endPage != intPages) {
            html = '<a id="m_btnLastPage" onclick="GetWorksOfArt(this);" class="pageSpace">' + intPages + '</a>';
            $(html).appendTo($('#page-buttons'));
        }

        SetNextAndPrev($("#hdnCurrentPage").val(), intPages - 1);
    }
}

//writes out the html for works of art items
function GetWOAContainerHtml(woaObject) {
    if (woaObject.TeaserImage != undefined && woaObject.TeaserImage != null && woaObject.TeaserImage != "") {
        var imgPath = woaObject.TeaserImage;
    }
    else {
        var imgPath = "/content/img/placeholders/NoImageAvailable_placeholder.png";
    }

    return '<div class="metpubs-mwoa-container"' + 'id="metpubs_mwoa_container_' + woaObject.CRDID + '"'
        + ' onmouseover=\'javascript:showInfo("metpubs_mwoa_img_container_' + woaObject.CRDID + '", "metpubs_mwoa_info_container_' + woaObject.CRDID + '");\''
        + ' onmouseout=\'javascript:hideInfo("metpubs_mwoa_img_container_' + woaObject.CRDID + '", "metpubs_mwoa_info_container_' + woaObject.CRDID + '");\'>'
        + '<div class="metpubs-center" id="metpubs_mwoa_img_container_' + woaObject.CRDID + '"> <a href="' + woaObject.Url + '" target="_blank"> '
        + '<img class="metpubs-mwoa-image" src="' + imgPath + '"' + '"alt="' + woaObject.Title + 'onerror="this.onerror=null;this.src="/content/img/placeholders/NoImageAvailable_placeholder.png";"/></a>'
        + '</div>'
        + '<div class="metpubs-opacity-filter-trans metpubs-mwoa-info-popup" id="metpubs_mwoa_info_container_' + woaObject.CRDID + '">'
        + '<a href="' + woaObject.Url + '" target=_blank> <div class="metpubs-opacity-filter-opaq metpubs-gridview-info-text metpubs-gridview-info-text-bold">'
        + woaObject.Title + '</div>' + '<div class="metpubs-gridview-info-text">' + woaObject.TeaserText + '</div></a></div></div>';
}

//gets the page number and call GetJSON()
function GetWorksOfArt(senderObject) {
    var pageNumber = parseInt($(senderObject).text()) - 1;
    var jsonUrl = metpubUrl + "&worksofartpage=" + pageNumber;
    GetJSON(jsonUrl);
    $("#hdnCurrentPage").val(pageNumber);
    event.preventDefault();
}

//gets the page number for Next or Previous link and calls GetJSON()
function GetNextOrPrevious(senderObject) {
    var pageNumber = $(senderObject).attr("rel");
    var jsonUrl = metpubUrl + "&worksofartpage=" + pageNumber;
    GetJSON(jsonUrl);
    $("#hdnCurrentPage").val(pageNumber);
    event.preventDefault();
}

//sets Next and Previous links
function SetNextAndPrev(currentPage, lastPage) {
    var intCurrentPage = parseInt(currentPage);
    var intLastPage = parseInt(lastPage);

    $("#m_LinkNext").attr("rel", intCurrentPage + 1);
    $("#m_LinkPrev").attr("rel", intCurrentPage - 1);

    if (intCurrentPage == intLastPage) {
        $("#m_LinkNext").css("display", "none");
    }
    else {
        $("#m_LinkNext").css("display", "block");
    }

    if (intCurrentPage == 0) {
        $("#m_LinkPrev").css("display", "none");
    }
    else {
        $("#m_LinkPrev").css("display", "block");
    }
};
!function(t){var e={};function i(n){if(e[n])return e[n].exports;var s=e[n]={i:n,l:!1,exports:{}};return t[n].call(s.exports,s,s.exports,i),s.l=!0,s.exports}i.m=t,i.c=e,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var s in t)i.d(n,s,function(e){return t[e]}.bind(null,s));return n},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=19)}([function(t,e,i){var n,s;!function(o,r){n=[i(7)],void 0===(s=function(t){return function(t,e){"use strict";var i={extend:function(t,e){for(var i in e)t[i]=e[i];return t},modulo:function(t,e){return(t%e+e)%e}},n=Array.prototype.slice;i.makeArray=function(t){return Array.isArray(t)?t:null==t?[]:"object"==typeof t&&"number"==typeof t.length?n.call(t):[t]},i.removeFrom=function(t,e){var i=t.indexOf(e);-1!=i&&t.splice(i,1)},i.getParent=function(t,i){for(;t.parentNode&&t!=document.body;)if(t=t.parentNode,e(t,i))return t},i.getQueryElement=function(t){return"string"==typeof t?document.querySelector(t):t},i.handleEvent=function(t){var e="on"+t.type;this[e]&&this[e](t)},i.filterFindElements=function(t,n){t=i.makeArray(t);var s=[];return t.forEach((function(t){if(t instanceof HTMLElement)if(n){e(t,n)&&s.push(t);for(var i=t.querySelectorAll(n),o=0;o<i.length;o++)s.push(i[o])}else s.push(t)})),s},i.debounceMethod=function(t,e,i){i=i||100;var n=t.prototype[e],s=e+"Timeout";t.prototype[e]=function(){var t=this[s];clearTimeout(t);var e=arguments,o=this;this[s]=setTimeout((function(){n.apply(o,e),delete o[s]}),i)}},i.docReady=function(t){var e=document.readyState;"complete"==e||"interactive"==e?setTimeout(t):document.addEventListener("DOMContentLoaded",t)},i.toDashed=function(t){return t.replace(/(.)([A-Z])/g,(function(t,e,i){return e+"-"+i})).toLowerCase()};var s=t.console;return i.htmlInit=function(e,n){i.docReady((function(){var o=i.toDashed(n),r="data-"+o,a=document.querySelectorAll("["+r+"]"),h=document.querySelectorAll(".js-"+o),l=i.makeArray(a).concat(i.makeArray(h)),c=r+"-options",d=t.jQuery;l.forEach((function(t){var i,o=t.getAttribute(r)||t.getAttribute(c);try{i=o&&JSON.parse(o)}catch(e){return void(s&&s.error("Error parsing "+r+" on "+t.className+": "+e))}var a=new e(t,i);d&&d.data(t,n,a)}))}))},i}(o,t)}.apply(e,n))||(t.exports=s)}(window)},function(t,e,i){var n,s;!function(o,r){n=[i(2),i(4),i(0),i(8),i(9),i(10)],void 0===(s=function(t,e,i,n,s,r){return function(t,e,i,n,s,o,r){"use strict";var a=t.jQuery,h=t.getComputedStyle,l=t.console;function c(t,e){for(t=n.makeArray(t);t.length;)e.appendChild(t.shift())}var d=0,u={};function p(t,e){var i=n.getQueryElement(t);if(i){if(this.element=i,this.element.flickityGUID){var s=u[this.element.flickityGUID];return s&&s.option(e),s}a&&(this.$element=a(this.element)),this.options=n.extend({},this.constructor.defaults),this.option(e),this._create()}else l&&l.error("Bad element for Flickity: "+(i||t))}p.defaults={accessibility:!0,cellAlign:"center",freeScrollFriction:.075,friction:.28,namespaceJQueryEvents:!0,percentPosition:!0,resize:!0,selectedAttraction:.025,setGallerySize:!0},p.createMethods=[];var f=p.prototype;n.extend(f,e.prototype),f._create=function(){var e=this.guid=++d;for(var i in this.element.flickityGUID=e,u[e]=this,this.selectedIndex=0,this.restingFrames=0,this.x=0,this.velocity=0,this.originSide=this.options.rightToLeft?"right":"left",this.viewport=document.createElement("div"),this.viewport.className="flickity-viewport",this._createSlider(),(this.options.resize||this.options.watchCSS)&&t.addEventListener("resize",this),this.options.on){var n=this.options.on[i];this.on(i,n)}p.createMethods.forEach((function(t){this[t]()}),this),this.options.watchCSS?this.watchCSS():this.activate()},f.option=function(t){n.extend(this.options,t)},f.activate=function(){this.isActive||(this.isActive=!0,this.element.classList.add("flickity-enabled"),this.options.rightToLeft&&this.element.classList.add("flickity-rtl"),this.getSize(),c(this._filterFindCellElements(this.element.children),this.slider),this.viewport.appendChild(this.slider),this.element.appendChild(this.viewport),this.reloadCells(),this.options.accessibility&&(this.element.tabIndex=0,this.element.addEventListener("keydown",this)),this.emitEvent("activate"),this.selectInitialIndex(),this.isInitActivated=!0,this.dispatchEvent("ready"))},f._createSlider=function(){var t=document.createElement("div");t.className="flickity-slider",t.style[this.originSide]=0,this.slider=t},f._filterFindCellElements=function(t){return n.filterFindElements(t,this.options.cellSelector)},f.reloadCells=function(){this.cells=this._makeCells(this.slider.children),this.positionCells(),this._getWrapShiftCells(),this.setGallerySize()},f._makeCells=function(t){return this._filterFindCellElements(t).map((function(t){return new s(t,this)}),this)},f.getLastCell=function(){return this.cells[this.cells.length-1]},f.getLastSlide=function(){return this.slides[this.slides.length-1]},f.positionCells=function(){this._sizeCells(this.cells),this._positionCells(0)},f._positionCells=function(t){t=t||0,this.maxCellHeight=t&&this.maxCellHeight||0;var e=0;if(t>0){var i=this.cells[t-1];e=i.x+i.size.outerWidth}for(var n=this.cells.length,s=t;s<n;s++){var o=this.cells[s];o.setPosition(e),e+=o.size.outerWidth,this.maxCellHeight=Math.max(o.size.outerHeight,this.maxCellHeight)}this.slideableWidth=e,this.updateSlides(),this._containSlides(),this.slidesWidth=n?this.getLastSlide().target-this.slides[0].target:0},f._sizeCells=function(t){t.forEach((function(t){t.getSize()}))},f.updateSlides=function(){if(this.slides=[],this.cells.length){var t=new o(this);this.slides.push(t);var e="left"==this.originSide?"marginRight":"marginLeft",i=this._getCanCellFit();this.cells.forEach((function(n,s){if(t.cells.length){var r=t.outerWidth-t.firstMargin+(n.size.outerWidth-n.size[e]);i.call(this,s,r)||(t.updateTarget(),t=new o(this),this.slides.push(t)),t.addCell(n)}else t.addCell(n)}),this),t.updateTarget(),this.updateSelectedSlide()}},f._getCanCellFit=function(){var t=this.options.groupCells;if(!t)return function(){return!1};if("number"==typeof t){var e=parseInt(t,10);return function(t){return t%e!=0}}var i="string"==typeof t&&t.match(/^(\d+)%$/),n=i?parseInt(i[1],10)/100:1;return function(t,e){return e<=(this.size.innerWidth+1)*n}},f._init=f.reposition=function(){this.positionCells(),this.positionSliderAtSelected()},f.getSize=function(){this.size=i(this.element),this.setCellAlign(),this.cursorPosition=this.size.innerWidth*this.cellAlign};var g={center:{left:.5,right:.5},left:{left:0,right:1},right:{right:0,left:1}};f.setCellAlign=function(){var t=g[this.options.cellAlign];this.cellAlign=t?t[this.originSide]:this.options.cellAlign},f.setGallerySize=function(){if(this.options.setGallerySize){var t=this.options.adaptiveHeight&&this.selectedSlide?this.selectedSlide.height:this.maxCellHeight;this.viewport.style.height=t+"px"}},f._getWrapShiftCells=function(){if(this.options.wrapAround){this._unshiftCells(this.beforeShiftCells),this._unshiftCells(this.afterShiftCells);var t=this.cursorPosition,e=this.cells.length-1;this.beforeShiftCells=this._getGapCells(t,e,-1),t=this.size.innerWidth-this.cursorPosition,this.afterShiftCells=this._getGapCells(t,0,1)}},f._getGapCells=function(t,e,i){for(var n=[];t>0;){var s=this.cells[e];if(!s)break;n.push(s),e+=i,t-=s.size.outerWidth}return n},f._containSlides=function(){if(this.options.contain&&!this.options.wrapAround&&this.cells.length){var t=this.options.rightToLeft,e=t?"marginRight":"marginLeft",i=t?"marginLeft":"marginRight",n=this.slideableWidth-this.getLastCell().size[i],s=n<this.size.innerWidth,o=this.cursorPosition+this.cells[0].size[e],r=n-this.size.innerWidth*(1-this.cellAlign);this.slides.forEach((function(t){s?t.target=n*this.cellAlign:(t.target=Math.max(t.target,o),t.target=Math.min(t.target,r))}),this)}},f.dispatchEvent=function(t,e,i){var n=e?[e].concat(i):i;if(this.emitEvent(t,n),a&&this.$element){var s=t+=this.options.namespaceJQueryEvents?".flickity":"";if(e){var o=new a.Event(e);o.type=t,s=o}this.$element.trigger(s,i)}},f.select=function(t,e,i){if(this.isActive&&(t=parseInt(t,10),this._wrapSelect(t),(this.options.wrapAround||e)&&(t=n.modulo(t,this.slides.length)),this.slides[t])){var s=this.selectedIndex;this.selectedIndex=t,this.updateSelectedSlide(),i?this.positionSliderAtSelected():this.startAnimation(),this.options.adaptiveHeight&&this.setGallerySize(),this.dispatchEvent("select",null,[t]),t!=s&&this.dispatchEvent("change",null,[t]),this.dispatchEvent("cellSelect")}},f._wrapSelect=function(t){var e=this.slides.length;if(!(this.options.wrapAround&&e>1))return t;var i=n.modulo(t,e),s=Math.abs(i-this.selectedIndex),o=Math.abs(i+e-this.selectedIndex),r=Math.abs(i-e-this.selectedIndex);!this.isDragSelect&&o<s?t+=e:!this.isDragSelect&&r<s&&(t-=e),t<0?this.x-=this.slideableWidth:t>=e&&(this.x+=this.slideableWidth)},f.previous=function(t,e){this.select(this.selectedIndex-1,t,e)},f.next=function(t,e){this.select(this.selectedIndex+1,t,e)},f.updateSelectedSlide=function(){var t=this.slides[this.selectedIndex];t&&(this.unselectSelectedSlide(),this.selectedSlide=t,t.select(),this.selectedCells=t.cells,this.selectedElements=t.getCellElements(),this.selectedCell=t.cells[0],this.selectedElement=this.selectedElements[0])},f.unselectSelectedSlide=function(){this.selectedSlide&&this.selectedSlide.unselect()},f.selectInitialIndex=function(){var t=this.options.initialIndex;if(this.isInitActivated)this.select(this.selectedIndex,!1,!0);else{if(t&&"string"==typeof t)if(this.queryCell(t))return void this.selectCell(t,!1,!0);var e=0;t&&this.slides[t]&&(e=t),this.select(e,!1,!0)}},f.selectCell=function(t,e,i){var n=this.queryCell(t);if(n){var s=this.getCellSlideIndex(n);this.select(s,e,i)}},f.getCellSlideIndex=function(t){for(var e=0;e<this.slides.length;e++){if(-1!=this.slides[e].cells.indexOf(t))return e}},f.getCell=function(t){for(var e=0;e<this.cells.length;e++){var i=this.cells[e];if(i.element==t)return i}},f.getCells=function(t){t=n.makeArray(t);var e=[];return t.forEach((function(t){var i=this.getCell(t);i&&e.push(i)}),this),e},f.getCellElements=function(){return this.cells.map((function(t){return t.element}))},f.getParentCell=function(t){var e=this.getCell(t);return e||(t=n.getParent(t,".flickity-slider > *"),this.getCell(t))},f.getAdjacentCellElements=function(t,e){if(!t)return this.selectedSlide.getCellElements();e=void 0===e?this.selectedIndex:e;var i=this.slides.length;if(1+2*t>=i)return this.getCellElements();for(var s=[],o=e-t;o<=e+t;o++){var r=this.options.wrapAround?n.modulo(o,i):o,a=this.slides[r];a&&(s=s.concat(a.getCellElements()))}return s},f.queryCell=function(t){if("number"==typeof t)return this.cells[t];if("string"==typeof t){if(t.match(/^[#.]?[\d/]/))return;t=this.element.querySelector(t)}return this.getCell(t)},f.uiChange=function(){this.emitEvent("uiChange")},f.childUIPointerDown=function(t){"touchstart"!=t.type&&t.preventDefault(),this.focus()},f.onresize=function(){this.watchCSS(),this.resize()},n.debounceMethod(p,"onresize",150),f.resize=function(){if(this.isActive&&!this.isAnimating&&!this.isDragging){this.getSize(),this.options.wrapAround&&(this.x=n.modulo(this.x,this.slideableWidth)),this.positionCells(),this._getWrapShiftCells(),this.setGallerySize(),this.emitEvent("resize");var t=this.selectedElements&&this.selectedElements[0];this.selectCell(t,!1,!0)}},f.watchCSS=function(){this.options.watchCSS&&(-1!=h(this.element,":after").content.indexOf("flickity")?this.activate():this.deactivate())},f.onkeydown=function(t){var e=document.activeElement&&document.activeElement!=this.element;if(this.options.accessibility&&!e){var i=p.keyboardHandlers[t.keyCode];i&&i.call(this)}},p.keyboardHandlers={37:function(){var t=this.options.rightToLeft?"next":"previous";this.uiChange(),this[t]()},39:function(){var t=this.options.rightToLeft?"previous":"next";this.uiChange(),this[t]()}},f.focus=function(){var e=t.pageYOffset;this.element.focus({preventScroll:!0}),t.pageYOffset!=e&&t.scrollTo(t.pageXOffset,e)},f.deactivate=function(){this.isActive&&(this.element.classList.remove("flickity-enabled"),this.element.classList.remove("flickity-rtl"),this.unselectSelectedSlide(),this.cells.forEach((function(t){t.destroy()})),this.element.removeChild(this.viewport),c(this.slider.children,this.element),this.options.accessibility&&(this.element.removeAttribute("tabIndex"),this.element.removeEventListener("keydown",this)),this.isActive=!1,this.emitEvent("deactivate"))},f.destroy=function(){this.deactivate(),t.removeEventListener("resize",this),this.allOff(),this.emitEvent("destroy"),a&&this.$element&&a.removeData(this.element,"flickity"),delete this.element.flickityGUID,delete u[this.guid]},n.extend(f,r),p.data=function(t){var e=(t=n.getQueryElement(t))&&t.flickityGUID;return e&&u[e]},n.htmlInit(p,"flickity"),a&&a.bridget&&a.bridget("flickity",p);return p.setJQuery=function(t){a=t},p.Cell=s,p.Slide=o,p}(o,t,e,i,n,s,r)}.apply(e,n))||(t.exports=s)}(window)},function(t,e,i){var n,s;"undefined"!=typeof window&&window,void 0===(s="function"==typeof(n=function(){"use strict";function t(){}var e=t.prototype;return e.on=function(t,e){if(t&&e){var i=this._events=this._events||{},n=i[t]=i[t]||[];return-1==n.indexOf(e)&&n.push(e),this}},e.once=function(t,e){if(t&&e){this.on(t,e);var i=this._onceEvents=this._onceEvents||{};return(i[t]=i[t]||{})[e]=!0,this}},e.off=function(t,e){var i=this._events&&this._events[t];if(i&&i.length){var n=i.indexOf(e);return-1!=n&&i.splice(n,1),this}},e.emitEvent=function(t,e){var i=this._events&&this._events[t];if(i&&i.length){i=i.slice(0),e=e||[];for(var n=this._onceEvents&&this._onceEvents[t],s=0;s<i.length;s++){var o=i[s];n&&n[o]&&(this.off(t,o),delete n[o]),o.apply(this,e)}return this}},e.allOff=function(){delete this._events,delete this._onceEvents},t})?n.call(e,i,e,t):n)||(t.exports=s)},function(t,e,i){var n,s;
/*!
 * Unipointer v2.4.0
 * base class for doing one thing with pointer event
 * MIT license
 */!function(o,r){n=[i(2)],void 0===(s=function(t){return function(t,e){"use strict";function i(){}var n=i.prototype=Object.create(e.prototype);n.bindStartEvent=function(t){this._bindStartEvent(t,!0)},n.unbindStartEvent=function(t){this._bindStartEvent(t,!1)},n._bindStartEvent=function(e,i){var n=(i=void 0===i||i)?"addEventListener":"removeEventListener",s="mousedown";"ontouchstart"in t?s="touchstart":t.PointerEvent&&(s="pointerdown"),e[n](s,this)},n.handleEvent=function(t){var e="on"+t.type;this[e]&&this[e](t)},n.getTouch=function(t){for(var e=0;e<t.length;e++){var i=t[e];if(i.identifier==this.pointerIdentifier)return i}},n.onmousedown=function(t){var e=t.button;e&&0!==e&&1!==e||this._pointerDown(t,t)},n.ontouchstart=function(t){this._pointerDown(t,t.changedTouches[0])},n.onpointerdown=function(t){this._pointerDown(t,t)},n._pointerDown=function(t,e){t.button||this.isPointerDown||(this.isPointerDown=!0,this.pointerIdentifier=void 0!==e.pointerId?e.pointerId:e.identifier,this.pointerDown(t,e))},n.pointerDown=function(t,e){this._bindPostStartEvents(t),this.emitEvent("pointerDown",[t,e])};var s={mousedown:["mousemove","mouseup"],touchstart:["touchmove","touchend","touchcancel"],pointerdown:["pointermove","pointerup","pointercancel"]};return n._bindPostStartEvents=function(e){if(e){var i=s[e.type];i.forEach((function(e){t.addEventListener(e,this)}),this),this._boundPointerEvents=i}},n._unbindPostStartEvents=function(){this._boundPointerEvents&&(this._boundPointerEvents.forEach((function(e){t.removeEventListener(e,this)}),this),delete this._boundPointerEvents)},n.onmousemove=function(t){this._pointerMove(t,t)},n.onpointermove=function(t){t.pointerId==this.pointerIdentifier&&this._pointerMove(t,t)},n.ontouchmove=function(t){var e=this.getTouch(t.changedTouches);e&&this._pointerMove(t,e)},n._pointerMove=function(t,e){this.pointerMove(t,e)},n.pointerMove=function(t,e){this.emitEvent("pointerMove",[t,e])},n.onmouseup=function(t){this._pointerUp(t,t)},n.onpointerup=function(t){t.pointerId==this.pointerIdentifier&&this._pointerUp(t,t)},n.ontouchend=function(t){var e=this.getTouch(t.changedTouches);e&&this._pointerUp(t,e)},n._pointerUp=function(t,e){this._pointerDone(),this.pointerUp(t,e)},n.pointerUp=function(t,e){this.emitEvent("pointerUp",[t,e])},n._pointerDone=function(){this._pointerReset(),this._unbindPostStartEvents(),this.pointerDone()},n._pointerReset=function(){this.isPointerDown=!1,delete this.pointerIdentifier},n.pointerDone=function(){},n.onpointercancel=function(t){t.pointerId==this.pointerIdentifier&&this._pointerCancel(t,t)},n.ontouchcancel=function(t){var e=this.getTouch(t.changedTouches);e&&this._pointerCancel(t,e)},n._pointerCancel=function(t,e){this._pointerDone(),this.pointerCancel(t,e)},n.pointerCancel=function(t,e){this.emitEvent("pointerCancel",[t,e])},i.getPointerPoint=function(t){return{x:t.pageX,y:t.pageY}},i}(o,t)}.apply(e,n))||(t.exports=s)}(window)},function(t,e,i){var n,s;
/*!
 * getSize v2.0.3
 * measure size of elements
 * MIT license
 */window,void 0===(s="function"==typeof(n=function(){"use strict";function t(t){var e=parseFloat(t);return-1==t.indexOf("%")&&!isNaN(e)&&e}var e="undefined"==typeof console?function(){}:function(t){console.error(t)},i=["paddingLeft","paddingRight","paddingTop","paddingBottom","marginLeft","marginRight","marginTop","marginBottom","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"],n=i.length;function s(t){var i=getComputedStyle(t);return i||e("Style returned "+i+". Are you running this code in a hidden iframe on Firefox? See https://bit.ly/getsizebug1"),i}var o,r=!1;function a(e){if(function(){if(!r){r=!0;var e=document.createElement("div");e.style.width="200px",e.style.padding="1px 2px 3px 4px",e.style.borderStyle="solid",e.style.borderWidth="1px 2px 3px 4px",e.style.boxSizing="border-box";var i=document.body||document.documentElement;i.appendChild(e);var n=s(e);o=200==Math.round(t(n.width)),a.isBoxSizeOuter=o,i.removeChild(e)}}(),"string"==typeof e&&(e=document.querySelector(e)),e&&"object"==typeof e&&e.nodeType){var h=s(e);if("none"==h.display)return function(){for(var t={width:0,height:0,innerWidth:0,innerHeight:0,outerWidth:0,outerHeight:0},e=0;e<n;e++)t[i[e]]=0;return t}();var l={};l.width=e.offsetWidth,l.height=e.offsetHeight;for(var c=l.isBorderBox="border-box"==h.boxSizing,d=0;d<n;d++){var u=i[d],p=h[u],f=parseFloat(p);l[u]=isNaN(f)?0:f}var g=l.paddingLeft+l.paddingRight,v=l.paddingTop+l.paddingBottom,m=l.marginLeft+l.marginRight,y=l.marginTop+l.marginBottom,b=l.borderLeftWidth+l.borderRightWidth,S=l.borderTopWidth+l.borderBottomWidth,E=c&&o,x=t(h.width);!1!==x&&(l.width=x+(E?0:g+b));var C=t(h.height);return!1!==C&&(l.height=C+(E?0:v+S)),l.innerWidth=l.width-(g+b),l.innerHeight=l.height-(v+S),l.outerWidth=l.width+m,l.outerHeight=l.height+y,l}}return a})?n.call(e,i,e,t):n)||(t.exports=s)},function(t,e,i){var n,s;
/*!
 * Flickity imagesLoaded v2.0.0
 * enables imagesLoaded option for Flickity
 */window,n=[i(6),i(18)],void 0===(s=function(t,e){return function(t,e,i){"use strict";e.createMethods.push("_createImagesLoaded");var n=e.prototype;return n._createImagesLoaded=function(){this.on("activate",this.imagesLoaded)},n.imagesLoaded=function(){if(this.options.imagesLoaded){var t=this;i(this.slider).on("progress",(function(e,i){var n=t.getParentCell(i.img);t.cellSizeChange(n&&n.element),t.options.freeScroll||t.positionSliderAtSelected()}))}},e}(0,t,e)}.apply(e,n))||(t.exports=s)},function(t,e,i){var n,s,o;
/*!
 * Flickity v2.3.0
 * Touch, responsive, flickable carousels
 *
 * Licensed GPLv3 for open source use
 * or Flickity Commercial License for commercial use
 *
 * https://flickity.metafizzy.co
 * Copyright 2015-2021 Metafizzy
 */window,s=[i(1),i(11),i(13),i(14),i(15),i(16),i(17)],void 0===(o="function"==typeof(n=function(t){return t})?n.apply(e,s):n)||(t.exports=o)},function(t,e,i){var n,s;!function(o,r){"use strict";void 0===(s="function"==typeof(n=r)?n.call(e,i,e,t):n)||(t.exports=s)}(window,(function(){"use strict";var t=function(){var t=window.Element.prototype;if(t.matches)return"matches";if(t.matchesSelector)return"matchesSelector";for(var e=["webkit","moz","ms","o"],i=0;i<e.length;i++){var n=e[i]+"MatchesSelector";if(t[n])return n}}();return function(e,i){return e[t](i)}}))},function(t,e,i){var n,s;window,n=[i(4)],void 0===(s=function(t){return function(t,e){"use strict";function i(t,e){this.element=t,this.parent=e,this.create()}var n=i.prototype;return n.create=function(){this.element.style.position="absolute",this.element.setAttribute("aria-hidden","true"),this.x=0,this.shift=0,this.element.style[this.parent.originSide]=0},n.destroy=function(){this.unselect(),this.element.style.position="";var t=this.parent.originSide;this.element.style[t]="",this.element.style.transform="",this.element.removeAttribute("aria-hidden")},n.getSize=function(){this.size=e(this.element)},n.setPosition=function(t){this.x=t,this.updateTarget(),this.renderPosition(t)},n.updateTarget=n.setDefaultTarget=function(){var t="left"==this.parent.originSide?"marginLeft":"marginRight";this.target=this.x+this.size[t]+this.size.width*this.parent.cellAlign},n.renderPosition=function(t){var e="left"===this.parent.originSide?1:-1,i=this.parent.options.percentPosition?t*e*(this.parent.size.innerWidth/this.size.width):t*e;this.element.style.transform="translateX("+this.parent.getPositionValue(i)+")"},n.select=function(){this.element.classList.add("is-selected"),this.element.removeAttribute("aria-hidden")},n.unselect=function(){this.element.classList.remove("is-selected"),this.element.setAttribute("aria-hidden","true")},n.wrapShift=function(t){this.shift=t,this.renderPosition(this.x+this.parent.slideableWidth*t)},n.remove=function(){this.element.parentNode.removeChild(this.element)},i}(0,t)}.apply(e,n))||(t.exports=s)},function(t,e,i){var n,s;window,void 0===(s="function"==typeof(n=function(){"use strict";function t(t){this.parent=t,this.isOriginLeft="left"==t.originSide,this.cells=[],this.outerWidth=0,this.height=0}var e=t.prototype;return e.addCell=function(t){if(this.cells.push(t),this.outerWidth+=t.size.outerWidth,this.height=Math.max(t.size.outerHeight,this.height),1==this.cells.length){this.x=t.x;var e=this.isOriginLeft?"marginLeft":"marginRight";this.firstMargin=t.size[e]}},e.updateTarget=function(){var t=this.isOriginLeft?"marginRight":"marginLeft",e=this.getLastCell(),i=e?e.size[t]:0,n=this.outerWidth-(this.firstMargin+i);this.target=this.x+this.firstMargin+n*this.parent.cellAlign},e.getLastCell=function(){return this.cells[this.cells.length-1]},e.select=function(){this.cells.forEach((function(t){t.select()}))},e.unselect=function(){this.cells.forEach((function(t){t.unselect()}))},e.getCellElements=function(){return this.cells.map((function(t){return t.element}))},t})?n.call(e,i,e,t):n)||(t.exports=s)},function(t,e,i){var n,s;window,n=[i(0)],void 0===(s=function(t){return function(t,e){"use strict";var i={startAnimation:function(){this.isAnimating||(this.isAnimating=!0,this.restingFrames=0,this.animate())},animate:function(){this.applyDragForce(),this.applySelectedAttraction();var t=this.x;if(this.integratePhysics(),this.positionSlider(),this.settle(t),this.isAnimating){var e=this;requestAnimationFrame((function(){e.animate()}))}},positionSlider:function(){var t=this.x;this.options.wrapAround&&this.cells.length>1&&(t=e.modulo(t,this.slideableWidth),t-=this.slideableWidth,this.shiftWrapCells(t)),this.setTranslateX(t,this.isAnimating),this.dispatchScrollEvent()},setTranslateX:function(t,e){t+=this.cursorPosition,t=this.options.rightToLeft?-t:t;var i=this.getPositionValue(t);this.slider.style.transform=e?"translate3d("+i+",0,0)":"translateX("+i+")"},dispatchScrollEvent:function(){var t=this.slides[0];if(t){var e=-this.x-t.target,i=e/this.slidesWidth;this.dispatchEvent("scroll",null,[i,e])}},positionSliderAtSelected:function(){this.cells.length&&(this.x=-this.selectedSlide.target,this.velocity=0,this.positionSlider())},getPositionValue:function(t){return this.options.percentPosition?.01*Math.round(t/this.size.innerWidth*1e4)+"%":Math.round(t)+"px"},settle:function(t){!this.isPointerDown&&Math.round(100*this.x)==Math.round(100*t)&&this.restingFrames++,this.restingFrames>2&&(this.isAnimating=!1,delete this.isFreeScrolling,this.positionSlider(),this.dispatchEvent("settle",null,[this.selectedIndex]))},shiftWrapCells:function(t){var e=this.cursorPosition+t;this._shiftCells(this.beforeShiftCells,e,-1);var i=this.size.innerWidth-(t+this.slideableWidth+this.cursorPosition);this._shiftCells(this.afterShiftCells,i,1)},_shiftCells:function(t,e,i){for(var n=0;n<t.length;n++){var s=t[n],o=e>0?i:0;s.wrapShift(o),e-=s.size.outerWidth}},_unshiftCells:function(t){if(t&&t.length)for(var e=0;e<t.length;e++)t[e].wrapShift(0)},integratePhysics:function(){this.x+=this.velocity,this.velocity*=this.getFrictionFactor()},applyForce:function(t){this.velocity+=t},getFrictionFactor:function(){return 1-this.options[this.isFreeScrolling?"freeScrollFriction":"friction"]},getRestingPosition:function(){return this.x+this.velocity/(1-this.getFrictionFactor())},applyDragForce:function(){if(this.isDraggable&&this.isPointerDown){var t=this.dragX-this.x-this.velocity;this.applyForce(t)}},applySelectedAttraction:function(){if((!this.isDraggable||!this.isPointerDown)&&!this.isFreeScrolling&&this.slides.length){var t=(-1*this.selectedSlide.target-this.x)*this.options.selectedAttraction;this.applyForce(t)}}};return i}(0,t)}.apply(e,n))||(t.exports=s)},function(t,e,i){var n,s;!function(o,r){n=[i(1),i(12),i(0)],void 0===(s=function(t,e,i){return function(t,e,i,n){"use strict";n.extend(e.defaults,{draggable:">1",dragThreshold:3}),e.createMethods.push("_createDrag");var s=e.prototype;n.extend(s,i.prototype),s._touchActionValue="pan-y",s._createDrag=function(){this.on("activate",this.onActivateDrag),this.on("uiChange",this._uiChangeDrag),this.on("deactivate",this.onDeactivateDrag),this.on("cellChange",this.updateDraggable)},s.onActivateDrag=function(){this.handles=[this.viewport],this.bindHandles(),this.updateDraggable()},s.onDeactivateDrag=function(){this.unbindHandles(),this.element.classList.remove("is-draggable")},s.updateDraggable=function(){">1"==this.options.draggable?this.isDraggable=this.slides.length>1:this.isDraggable=this.options.draggable,this.isDraggable?this.element.classList.add("is-draggable"):this.element.classList.remove("is-draggable")},s.bindDrag=function(){this.options.draggable=!0,this.updateDraggable()},s.unbindDrag=function(){this.options.draggable=!1,this.updateDraggable()},s._uiChangeDrag=function(){delete this.isFreeScrolling},s.pointerDown=function(e,i){this.isDraggable?this.okayPointerDown(e)&&(this._pointerDownPreventDefault(e),this.pointerDownFocus(e),document.activeElement!=this.element&&this.pointerDownBlur(),this.dragX=this.x,this.viewport.classList.add("is-pointer-down"),this.pointerDownScroll=r(),t.addEventListener("scroll",this),this._pointerDownDefault(e,i)):this._pointerDownDefault(e,i)},s._pointerDownDefault=function(t,e){this.pointerDownPointer={pageX:e.pageX,pageY:e.pageY},this._bindPostStartEvents(t),this.dispatchEvent("pointerDown",t,[e])};var o={INPUT:!0,TEXTAREA:!0,SELECT:!0};function r(){return{x:t.pageXOffset,y:t.pageYOffset}}return s.pointerDownFocus=function(t){o[t.target.nodeName]||this.focus()},s._pointerDownPreventDefault=function(t){var e="touchstart"==t.type,i="touch"==t.pointerType,n=o[t.target.nodeName];e||i||n||t.preventDefault()},s.hasDragStarted=function(t){return Math.abs(t.x)>this.options.dragThreshold},s.pointerUp=function(t,e){delete this.isTouchScrolling,this.viewport.classList.remove("is-pointer-down"),this.dispatchEvent("pointerUp",t,[e]),this._dragPointerUp(t,e)},s.pointerDone=function(){t.removeEventListener("scroll",this),delete this.pointerDownScroll},s.dragStart=function(e,i){this.isDraggable&&(this.dragStartPosition=this.x,this.startAnimation(),t.removeEventListener("scroll",this),this.dispatchEvent("dragStart",e,[i]))},s.pointerMove=function(t,e){var i=this._dragPointerMove(t,e);this.dispatchEvent("pointerMove",t,[e,i]),this._dragMove(t,e,i)},s.dragMove=function(t,e,i){if(this.isDraggable){t.preventDefault(),this.previousDragX=this.dragX;var n=this.options.rightToLeft?-1:1;this.options.wrapAround&&(i.x%=this.slideableWidth);var s=this.dragStartPosition+i.x*n;if(!this.options.wrapAround&&this.slides.length){var o=Math.max(-this.slides[0].target,this.dragStartPosition);s=s>o?.5*(s+o):s;var r=Math.min(-this.getLastSlide().target,this.dragStartPosition);s=s<r?.5*(s+r):s}this.dragX=s,this.dragMoveTime=new Date,this.dispatchEvent("dragMove",t,[e,i])}},s.dragEnd=function(t,e){if(this.isDraggable){this.options.freeScroll&&(this.isFreeScrolling=!0);var i=this.dragEndRestingSelect();if(this.options.freeScroll&&!this.options.wrapAround){var n=this.getRestingPosition();this.isFreeScrolling=-n>this.slides[0].target&&-n<this.getLastSlide().target}else this.options.freeScroll||i!=this.selectedIndex||(i+=this.dragEndBoostSelect());delete this.previousDragX,this.isDragSelect=this.options.wrapAround,this.select(i),delete this.isDragSelect,this.dispatchEvent("dragEnd",t,[e])}},s.dragEndRestingSelect=function(){var t=this.getRestingPosition(),e=Math.abs(this.getSlideDistance(-t,this.selectedIndex)),i=this._getClosestResting(t,e,1),n=this._getClosestResting(t,e,-1);return i.distance<n.distance?i.index:n.index},s._getClosestResting=function(t,e,i){for(var n=this.selectedIndex,s=1/0,o=this.options.contain&&!this.options.wrapAround?function(t,e){return t<=e}:function(t,e){return t<e};o(e,s)&&(n+=i,s=e,null!==(e=this.getSlideDistance(-t,n)));)e=Math.abs(e);return{distance:s,index:n-i}},s.getSlideDistance=function(t,e){var i=this.slides.length,s=this.options.wrapAround&&i>1,o=s?n.modulo(e,i):e,r=this.slides[o];if(!r)return null;var a=s?this.slideableWidth*Math.floor(e/i):0;return t-(r.target+a)},s.dragEndBoostSelect=function(){if(void 0===this.previousDragX||!this.dragMoveTime||new Date-this.dragMoveTime>100)return 0;var t=this.getSlideDistance(-this.dragX,this.selectedIndex),e=this.previousDragX-this.dragX;return t>0&&e>0?1:t<0&&e<0?-1:0},s.staticClick=function(t,e){var i=this.getParentCell(t.target),n=i&&i.element,s=i&&this.cells.indexOf(i);this.dispatchEvent("staticClick",t,[e,n,s])},s.onscroll=function(){var t=r(),e=this.pointerDownScroll.x-t.x,i=this.pointerDownScroll.y-t.y;(Math.abs(e)>3||Math.abs(i)>3)&&this._pointerDone()},e}(o,t,e,i)}.apply(e,n))||(t.exports=s)}(window)},function(t,e,i){var n,s;
/*!
 * Unidragger v2.4.0
 * Draggable base class
 * MIT license
 */!function(o,r){n=[i(3)],void 0===(s=function(t){return function(t,e){"use strict";function i(){}var n=i.prototype=Object.create(e.prototype);n.bindHandles=function(){this._bindHandles(!0)},n.unbindHandles=function(){this._bindHandles(!1)},n._bindHandles=function(e){for(var i=(e=void 0===e||e)?"addEventListener":"removeEventListener",n=e?this._touchActionValue:"",s=0;s<this.handles.length;s++){var o=this.handles[s];this._bindStartEvent(o,e),o[i]("click",this),t.PointerEvent&&(o.style.touchAction=n)}},n._touchActionValue="none",n.pointerDown=function(t,e){this.okayPointerDown(t)&&(this.pointerDownPointer={pageX:e.pageX,pageY:e.pageY},t.preventDefault(),this.pointerDownBlur(),this._bindPostStartEvents(t),this.emitEvent("pointerDown",[t,e]))};var s={TEXTAREA:!0,INPUT:!0,SELECT:!0,OPTION:!0},o={radio:!0,checkbox:!0,button:!0,submit:!0,image:!0,file:!0};return n.okayPointerDown=function(t){var e=s[t.target.nodeName],i=o[t.target.type],n=!e||i;return n||this._pointerReset(),n},n.pointerDownBlur=function(){var t=document.activeElement;t&&t.blur&&t!=document.body&&t.blur()},n.pointerMove=function(t,e){var i=this._dragPointerMove(t,e);this.emitEvent("pointerMove",[t,e,i]),this._dragMove(t,e,i)},n._dragPointerMove=function(t,e){var i={x:e.pageX-this.pointerDownPointer.pageX,y:e.pageY-this.pointerDownPointer.pageY};return!this.isDragging&&this.hasDragStarted(i)&&this._dragStart(t,e),i},n.hasDragStarted=function(t){return Math.abs(t.x)>3||Math.abs(t.y)>3},n.pointerUp=function(t,e){this.emitEvent("pointerUp",[t,e]),this._dragPointerUp(t,e)},n._dragPointerUp=function(t,e){this.isDragging?this._dragEnd(t,e):this._staticClick(t,e)},n._dragStart=function(t,e){this.isDragging=!0,this.isPreventingClicks=!0,this.dragStart(t,e)},n.dragStart=function(t,e){this.emitEvent("dragStart",[t,e])},n._dragMove=function(t,e,i){this.isDragging&&this.dragMove(t,e,i)},n.dragMove=function(t,e,i){t.preventDefault(),this.emitEvent("dragMove",[t,e,i])},n._dragEnd=function(t,e){this.isDragging=!1,setTimeout(function(){delete this.isPreventingClicks}.bind(this)),this.dragEnd(t,e)},n.dragEnd=function(t,e){this.emitEvent("dragEnd",[t,e])},n.onclick=function(t){this.isPreventingClicks&&t.preventDefault()},n._staticClick=function(t,e){this.isIgnoringMouseUp&&"mouseup"==t.type||(this.staticClick(t,e),"mouseup"!=t.type&&(this.isIgnoringMouseUp=!0,setTimeout(function(){delete this.isIgnoringMouseUp}.bind(this),400)))},n.staticClick=function(t,e){this.emitEvent("staticClick",[t,e])},i.getPointerPoint=e.getPointerPoint,i}(o,t)}.apply(e,n))||(t.exports=s)}(window)},function(t,e,i){var n,s;window,n=[i(1),i(3),i(0)],void 0===(s=function(t,e,i){return function(t,e,i,n){"use strict";var s="http://www.w3.org/2000/svg";function o(t,e){this.direction=t,this.parent=e,this._create()}o.prototype=Object.create(i.prototype),o.prototype._create=function(){this.isEnabled=!0,this.isPrevious=-1==this.direction;var t=this.parent.options.rightToLeft?1:-1;this.isLeft=this.direction==t;var e=this.element=document.createElement("button");e.className="flickity-button flickity-prev-next-button",e.className+=this.isPrevious?" previous":" next",e.setAttribute("type","button"),this.disable(),e.setAttribute("aria-label",this.isPrevious?"Previous":"Next");var i=this.createSVG();e.appendChild(i),this.parent.on("select",this.update.bind(this)),this.on("pointerDown",this.parent.childUIPointerDown.bind(this.parent))},o.prototype.activate=function(){this.bindStartEvent(this.element),this.element.addEventListener("click",this),this.parent.element.appendChild(this.element)},o.prototype.deactivate=function(){this.parent.element.removeChild(this.element),this.unbindStartEvent(this.element),this.element.removeEventListener("click",this)},o.prototype.createSVG=function(){var t=document.createElementNS(s,"svg");t.setAttribute("class","flickity-button-icon"),t.setAttribute("viewBox","0 0 100 100");var e,i=document.createElementNS(s,"path"),n="string"==typeof(e=this.parent.options.arrowShape)?e:"M "+e.x0+",50 L "+e.x1+","+(e.y1+50)+" L "+e.x2+","+(e.y2+50)+" L "+e.x3+",50  L "+e.x2+","+(50-e.y2)+" L "+e.x1+","+(50-e.y1)+" Z";return i.setAttribute("d",n),i.setAttribute("class","arrow"),this.isLeft||i.setAttribute("transform","translate(100, 100) rotate(180) "),t.appendChild(i),t},o.prototype.handleEvent=n.handleEvent,o.prototype.onclick=function(){if(this.isEnabled){this.parent.uiChange();var t=this.isPrevious?"previous":"next";this.parent[t]()}},o.prototype.enable=function(){this.isEnabled||(this.element.disabled=!1,this.isEnabled=!0)},o.prototype.disable=function(){this.isEnabled&&(this.element.disabled=!0,this.isEnabled=!1)},o.prototype.update=function(){var t=this.parent.slides;if(this.parent.options.wrapAround&&t.length>1)this.enable();else{var e=t.length?t.length-1:0,i=this.isPrevious?0:e;this[this.parent.selectedIndex==i?"disable":"enable"]()}},o.prototype.destroy=function(){this.deactivate(),this.allOff()},n.extend(e.defaults,{prevNextButtons:!0,arrowShape:{x0:10,x1:60,y1:50,x2:70,y2:40,x3:30}}),e.createMethods.push("_createPrevNextButtons");var r=e.prototype;return r._createPrevNextButtons=function(){this.options.prevNextButtons&&(this.prevButton=new o(-1,this),this.nextButton=new o(1,this),this.on("activate",this.activatePrevNextButtons))},r.activatePrevNextButtons=function(){this.prevButton.activate(),this.nextButton.activate(),this.on("deactivate",this.deactivatePrevNextButtons)},r.deactivatePrevNextButtons=function(){this.prevButton.deactivate(),this.nextButton.deactivate(),this.off("deactivate",this.deactivatePrevNextButtons)},e.PrevNextButton=o,e}(0,t,e,i)}.apply(e,n))||(t.exports=s)},function(t,e,i){var n,s;window,n=[i(1),i(3),i(0)],void 0===(s=function(t,e,i){return function(t,e,i,n){"use strict";function s(t){this.parent=t,this._create()}s.prototype=Object.create(i.prototype),s.prototype._create=function(){this.holder=document.createElement("ol"),this.holder.className="flickity-page-dots",this.dots=[],this.handleClick=this.onClick.bind(this),this.on("pointerDown",this.parent.childUIPointerDown.bind(this.parent))},s.prototype.activate=function(){this.setDots(),this.holder.addEventListener("click",this.handleClick),this.bindStartEvent(this.holder),this.parent.element.appendChild(this.holder)},s.prototype.deactivate=function(){this.holder.removeEventListener("click",this.handleClick),this.unbindStartEvent(this.holder),this.parent.element.removeChild(this.holder)},s.prototype.setDots=function(){var t=this.parent.slides.length-this.dots.length;t>0?this.addDots(t):t<0&&this.removeDots(-t)},s.prototype.addDots=function(t){for(var e=document.createDocumentFragment(),i=[],n=this.dots.length,s=n+t,o=n;o<s;o++){var r=document.createElement("li");r.className="dot",r.setAttribute("aria-label","Page dot "+(o+1)),e.appendChild(r),i.push(r)}this.holder.appendChild(e),this.dots=this.dots.concat(i)},s.prototype.removeDots=function(t){this.dots.splice(this.dots.length-t,t).forEach((function(t){this.holder.removeChild(t)}),this)},s.prototype.updateSelected=function(){this.selectedDot&&(this.selectedDot.className="dot",this.selectedDot.removeAttribute("aria-current")),this.dots.length&&(this.selectedDot=this.dots[this.parent.selectedIndex],this.selectedDot.className="dot is-selected",this.selectedDot.setAttribute("aria-current","step"))},s.prototype.onTap=s.prototype.onClick=function(t){var e=t.target;if("LI"==e.nodeName){this.parent.uiChange();var i=this.dots.indexOf(e);this.parent.select(i)}},s.prototype.destroy=function(){this.deactivate(),this.allOff()},e.PageDots=s,n.extend(e.defaults,{pageDots:!0}),e.createMethods.push("_createPageDots");var o=e.prototype;return o._createPageDots=function(){this.options.pageDots&&(this.pageDots=new s(this),this.on("activate",this.activatePageDots),this.on("select",this.updateSelectedPageDots),this.on("cellChange",this.updatePageDots),this.on("resize",this.updatePageDots),this.on("deactivate",this.deactivatePageDots))},o.activatePageDots=function(){this.pageDots.activate()},o.updateSelectedPageDots=function(){this.pageDots.updateSelected()},o.updatePageDots=function(){this.pageDots.setDots()},o.deactivatePageDots=function(){this.pageDots.deactivate()},e.PageDots=s,e}(0,t,e,i)}.apply(e,n))||(t.exports=s)},function(t,e,i){var n,s;window,n=[i(2),i(0),i(1)],void 0===(s=function(t,e,i){return function(t,e,i){"use strict";function n(t){this.parent=t,this.state="stopped",this.onVisibilityChange=this.visibilityChange.bind(this),this.onVisibilityPlay=this.visibilityPlay.bind(this)}n.prototype=Object.create(t.prototype),n.prototype.play=function(){"playing"!=this.state&&(document.hidden?document.addEventListener("visibilitychange",this.onVisibilityPlay):(this.state="playing",document.addEventListener("visibilitychange",this.onVisibilityChange),this.tick()))},n.prototype.tick=function(){if("playing"==this.state){var t=this.parent.options.autoPlay;t="number"==typeof t?t:3e3;var e=this;this.clear(),this.timeout=setTimeout((function(){e.parent.next(!0),e.tick()}),t)}},n.prototype.stop=function(){this.state="stopped",this.clear(),document.removeEventListener("visibilitychange",this.onVisibilityChange)},n.prototype.clear=function(){clearTimeout(this.timeout)},n.prototype.pause=function(){"playing"==this.state&&(this.state="paused",this.clear())},n.prototype.unpause=function(){"paused"==this.state&&this.play()},n.prototype.visibilityChange=function(){this[document.hidden?"pause":"unpause"]()},n.prototype.visibilityPlay=function(){this.play(),document.removeEventListener("visibilitychange",this.onVisibilityPlay)},e.extend(i.defaults,{pauseAutoPlayOnHover:!0}),i.createMethods.push("_createPlayer");var s=i.prototype;return s._createPlayer=function(){this.player=new n(this),this.on("activate",this.activatePlayer),this.on("uiChange",this.stopPlayer),this.on("pointerDown",this.stopPlayer),this.on("deactivate",this.deactivatePlayer)},s.activatePlayer=function(){this.options.autoPlay&&(this.player.play(),this.element.addEventListener("mouseenter",this))},s.playPlayer=function(){this.player.play()},s.stopPlayer=function(){this.player.stop()},s.pausePlayer=function(){this.player.pause()},s.unpausePlayer=function(){this.player.unpause()},s.deactivatePlayer=function(){this.player.stop(),this.element.removeEventListener("mouseenter",this)},s.onmouseenter=function(){this.options.pauseAutoPlayOnHover&&(this.player.pause(),this.element.addEventListener("mouseleave",this))},s.onmouseleave=function(){this.player.unpause(),this.element.removeEventListener("mouseleave",this)},i.Player=n,i}(t,e,i)}.apply(e,n))||(t.exports=s)},function(t,e,i){var n,s;window,n=[i(1),i(0)],void 0===(s=function(t,e){return function(t,e,i){"use strict";var n=e.prototype;return n.insert=function(t,e){var i=this._makeCells(t);if(i&&i.length){var n=this.cells.length;e=void 0===e?n:e;var s=function(t){var e=document.createDocumentFragment();return t.forEach((function(t){e.appendChild(t.element)})),e}(i),o=e==n;if(o)this.slider.appendChild(s);else{var r=this.cells[e].element;this.slider.insertBefore(s,r)}if(0===e)this.cells=i.concat(this.cells);else if(o)this.cells=this.cells.concat(i);else{var a=this.cells.splice(e,n-e);this.cells=this.cells.concat(i).concat(a)}this._sizeCells(i),this.cellChange(e,!0)}},n.append=function(t){this.insert(t,this.cells.length)},n.prepend=function(t){this.insert(t,0)},n.remove=function(t){var e=this.getCells(t);if(e&&e.length){var n=this.cells.length-1;e.forEach((function(t){t.remove();var e=this.cells.indexOf(t);n=Math.min(e,n),i.removeFrom(this.cells,t)}),this),this.cellChange(n,!0)}},n.cellSizeChange=function(t){var e=this.getCell(t);if(e){e.getSize();var i=this.cells.indexOf(e);this.cellChange(i)}},n.cellChange=function(t,e){var i=this.selectedElement;this._positionCells(t),this._getWrapShiftCells(),this.setGallerySize();var n=this.getCell(i);n&&(this.selectedIndex=this.getCellSlideIndex(n)),this.selectedIndex=Math.min(this.slides.length-1,this.selectedIndex),this.emitEvent("cellChange",[t]),this.select(this.selectedIndex),e&&this.positionSliderAtSelected()},e}(0,t,e)}.apply(e,n))||(t.exports=s)},function(t,e,i){var n,s;window,n=[i(1),i(0)],void 0===(s=function(t,e){return function(t,e,i){"use strict";e.createMethods.push("_createLazyload");var n=e.prototype;function s(t,e){this.img=t,this.flickity=e,this.load()}return n._createLazyload=function(){this.on("select",this.lazyLoad)},n.lazyLoad=function(){var t=this.options.lazyLoad;if(t){var e="number"==typeof t?t:0,n=this.getAdjacentCellElements(e),o=[];n.forEach((function(t){var e=function(t){if("IMG"==t.nodeName){var e=t.getAttribute("data-flickity-lazyload"),n=t.getAttribute("data-flickity-lazyload-src"),s=t.getAttribute("data-flickity-lazyload-srcset");if(e||n||s)return[t]}var o=t.querySelectorAll("img[data-flickity-lazyload], img[data-flickity-lazyload-src], img[data-flickity-lazyload-srcset]");return i.makeArray(o)}(t);o=o.concat(e)})),o.forEach((function(t){new s(t,this)}),this)}},s.prototype.handleEvent=i.handleEvent,s.prototype.load=function(){this.img.addEventListener("load",this),this.img.addEventListener("error",this);var t=this.img.getAttribute("data-flickity-lazyload")||this.img.getAttribute("data-flickity-lazyload-src"),e=this.img.getAttribute("data-flickity-lazyload-srcset");this.img.src=t,e&&this.img.setAttribute("srcset",e),this.img.removeAttribute("data-flickity-lazyload"),this.img.removeAttribute("data-flickity-lazyload-src"),this.img.removeAttribute("data-flickity-lazyload-srcset")},s.prototype.onload=function(t){this.complete(t,"flickity-lazyloaded")},s.prototype.onerror=function(t){this.complete(t,"flickity-lazyerror")},s.prototype.complete=function(t,e){this.img.removeEventListener("load",this),this.img.removeEventListener("error",this);var i=this.flickity.getParentCell(this.img),n=i&&i.element;this.flickity.cellSizeChange(n),this.img.classList.add(e),this.flickity.dispatchEvent("lazyLoad",t,n)},e.LazyLoader=s,e}(0,t,e)}.apply(e,n))||(t.exports=s)},function(t,e,i){var n,s;
/*!
 * imagesLoaded v4.1.4
 * JavaScript is all like "You images are done yet or what?"
 * MIT License
 */!function(o,r){"use strict";n=[i(2)],void 0===(s=function(t){return function(t,e){var i=t.jQuery,n=t.console;function s(t,e){for(var i in e)t[i]=e[i];return t}var o=Array.prototype.slice;function r(t,e,a){if(!(this instanceof r))return new r(t,e,a);var h,l=t;("string"==typeof t&&(l=document.querySelectorAll(t)),l)?(this.elements=(h=l,Array.isArray(h)?h:"object"==typeof h&&"number"==typeof h.length?o.call(h):[h]),this.options=s({},this.options),"function"==typeof e?a=e:s(this.options,e),a&&this.on("always",a),this.getImages(),i&&(this.jqDeferred=new i.Deferred),setTimeout(this.check.bind(this))):n.error("Bad element for imagesLoaded "+(l||t))}r.prototype=Object.create(e.prototype),r.prototype.options={},r.prototype.getImages=function(){this.images=[],this.elements.forEach(this.addElementImages,this)},r.prototype.addElementImages=function(t){"IMG"==t.nodeName&&this.addImage(t),!0===this.options.background&&this.addElementBackgroundImages(t);var e=t.nodeType;if(e&&a[e]){for(var i=t.querySelectorAll("img"),n=0;n<i.length;n++){var s=i[n];this.addImage(s)}if("string"==typeof this.options.background){var o=t.querySelectorAll(this.options.background);for(n=0;n<o.length;n++){var r=o[n];this.addElementBackgroundImages(r)}}}};var a={1:!0,9:!0,11:!0};function h(t){this.img=t}function l(t,e){this.url=t,this.element=e,this.img=new Image}return r.prototype.addElementBackgroundImages=function(t){var e=getComputedStyle(t);if(e)for(var i=/url\((['"])?(.*?)\1\)/gi,n=i.exec(e.backgroundImage);null!==n;){var s=n&&n[2];s&&this.addBackground(s,t),n=i.exec(e.backgroundImage)}},r.prototype.addImage=function(t){var e=new h(t);this.images.push(e)},r.prototype.addBackground=function(t,e){var i=new l(t,e);this.images.push(i)},r.prototype.check=function(){var t=this;function e(e,i,n){setTimeout((function(){t.progress(e,i,n)}))}this.progressedCount=0,this.hasAnyBroken=!1,this.images.length?this.images.forEach((function(t){t.once("progress",e),t.check()})):this.complete()},r.prototype.progress=function(t,e,i){this.progressedCount++,this.hasAnyBroken=this.hasAnyBroken||!t.isLoaded,this.emitEvent("progress",[this,t,e]),this.jqDeferred&&this.jqDeferred.notify&&this.jqDeferred.notify(this,t),this.progressedCount==this.images.length&&this.complete(),this.options.debug&&n&&n.log("progress: "+i,t,e)},r.prototype.complete=function(){var t=this.hasAnyBroken?"fail":"done";if(this.isComplete=!0,this.emitEvent(t,[this]),this.emitEvent("always",[this]),this.jqDeferred){var e=this.hasAnyBroken?"reject":"resolve";this.jqDeferred[e](this)}},h.prototype=Object.create(e.prototype),h.prototype.check=function(){this.getIsImageComplete()?this.confirm(0!==this.img.naturalWidth,"naturalWidth"):(this.proxyImage=new Image,this.proxyImage.addEventListener("load",this),this.proxyImage.addEventListener("error",this),this.img.addEventListener("load",this),this.img.addEventListener("error",this),this.proxyImage.src=this.img.src)},h.prototype.getIsImageComplete=function(){return this.img.complete&&this.img.naturalWidth},h.prototype.confirm=function(t,e){this.isLoaded=t,this.emitEvent("progress",[this,this.img,e])},h.prototype.handleEvent=function(t){var e="on"+t.type;this[e]&&this[e](t)},h.prototype.onload=function(){this.confirm(!0,"onload"),this.unbindEvents()},h.prototype.onerror=function(){this.confirm(!1,"onerror"),this.unbindEvents()},h.prototype.unbindEvents=function(){this.proxyImage.removeEventListener("load",this),this.proxyImage.removeEventListener("error",this),this.img.removeEventListener("load",this),this.img.removeEventListener("error",this)},l.prototype=Object.create(h.prototype),l.prototype.check=function(){this.img.addEventListener("load",this),this.img.addEventListener("error",this),this.img.src=this.url,this.getIsImageComplete()&&(this.confirm(0!==this.img.naturalWidth,"naturalWidth"),this.unbindEvents())},l.prototype.unbindEvents=function(){this.img.removeEventListener("load",this),this.img.removeEventListener("error",this)},l.prototype.confirm=function(t,e){this.isLoaded=t,this.emitEvent("progress",[this,this.element,e])},r.makeJQueryPlugin=function(e){(e=e||t.jQuery)&&((i=e).fn.imagesLoaded=function(t,e){return new r(this,t,e).jqDeferred.promise(i(this))})},r.makeJQueryPlugin(),r}(o,t)}.apply(e,n))||(t.exports=s)}("undefined"!=typeof window?window:this)},function(t,e,i){"use strict";i.r(e);var n=function t(e){const i=Object.getOwnPropertyNames(e);for(const n of i){const i=e[n];i&&"object"==typeof i&&t(i)}return Object.freeze(e)}({initializedClassName:"js-marble-initialized",FOCUSABLES_SELECTOR:"a[href]:not(.invisible-redundant-link), button, input, textarea, select, details, [tabindex]:not(.invisible-redundant-link)"}),s=i(5),o=i.n(s);const r={accessibility:!0,autoPlay:!1,cellAlign:"left",prevNextButtons:!0,pageDots:!1,friction:.4,contain:!0,resize:!0,wrapAround:!1,imagesLoaded:!1,arrowShape:{x0:15,x1:65,y1:45,x2:70,y2:40,x3:27}};var a=(t={})=>{let{selectorString:e}=t;e=e||".js-carousel",e=`${e}:not(.${n.initializedClassName})`;let i={...r,...t};document.querySelectorAll(e).forEach(t=>{const e=new o.a(t,i).on("change",(function(){this.cells.forEach(t=>{const e=t.element.querySelector("video");null!==e&&e.pause()});const t=this.selectedElements[0].querySelector("video");null!==t&&t.play()})),s=()=>{t.classList.add("is-loading");!t.querySelector(".loading")&&(e.resize(),t.classList.remove("is-loading"))};t.addEventListener("image-loaded",s,!1),t.addEventListener("image-errored",s,!1),t.classList.add(n.initializedClassName),t.setAttribute("role","region"),t.setAttribute("aria-label","Interactive slide carousel. Use left and right arrows to change slides.")})};document.querySelectorAll(".js-carousel").length>0&&a({groupCells:!0,imagesLoaded:!0}),document.querySelectorAll(".js-main-nav").length>0&&a({selectorString:".js-main-nav",watchCSS:!0,pageDots:!1,prevNextButtons:!1});let h=document.querySelector(".metpubs-search-heading"),l=document.querySelector(".metpubs-leftside__content");const c=t=>{t.currentTarget.classList.toggle("opened-toggle"),l.classList.toggle("display-content")};h&&h.addEventListener("click",c);let d=document.querySelector(".js-metpubs-subnav-trigger"),u=document.querySelector(".metpubs-subnav__secondlevel");d.addEventListener("click",t=>{t.preventDefault(),t.currentTarget.classList.toggle("opened-toggle"),u.classList.toggle("active")})}]);;
