PageSourceSearch

https://musical-life.net/files/js/js_HxI6lCJlANgJfzOctrjevELv6b1vPqwu4STPwCeuoC4.js

js musical-life.net collected 2026-10-02 10:26:00 UTC 132,956 bytes, 3,355 lines download raw bytes

1Drupal.locale = { 'pluralFormula': function ($n) { return Number(($n!=1)); }, 'strings': {"":{"An AJAX HTTP error occurred.":"Ein AJAX-HTTP-Fehler ist aufgetreten.","HTTP Result Code: !status":"HTTP-R\u00fcckgabe-Code: !status","An AJAX HTTP request terminated abnormally.":"Eine AJAX-Anfrage ist abnormal beendet worden.","Debugging information follows.":"Im Folgenden finden Sie Debugging-Informationen.","Path: !uri":"Pfad: !uri","StatusText: !statusText":"Statustext: !statusText","ResponseText: !responseText":"Antworttext: !responseText","ReadyState: !readyState":"ReadyState: !readyState","Disabled":"Deaktiviert","Enabled":"Aktiviert","Edit":"Bearbeiten","Search":"Suche","Reset":"Zur\u00fccksetzen","none":"keine","Add":"Hinzuf\u00fcgen","Menu":"Men\u00fc","Configure":"Konfigurieren","All":"Alle","OK":"OK","Show":"Anzeigen","Select all rows in this table":"Alle Zeilen dieser Tabelle ausw\u00e4hlen","Deselect all rows in this table":"Alle Zeilen dieser Tabelle abw\u00e4hlen","Not published":"Nicht ver\u00f6ffentlicht","Shortcuts":"Verkn\u00fcpfungen","Please wait...":"Bitte warten...","Hide":"Ausblenden","Not in book":"Nicht im Buch","New book":"Neues Buch","By @name on @date":"Von @name am @date","By @name":"Von @name","Not in menu":"Nicht im Men\u00fc","Alias: @alias":"Alias: @alias","No alias":"Kein Alias","New revision":"Neue Version","Drag to re-order":"Ziehen, um die Reihenfolge zu \u00e4ndern","Changes made in this table will not be saved until the form is submitted.":"\u00c4nderungen in dieser Tabelle werden nicht gespeichert, bis dieses Formular abgesendet wurde.","The changes to these blocks will not be saved until the \u003Cem\u003ESave blocks\u003C\/em\u003E button is clicked.":"Die \u00c4nderungen an diesen Bl\u00f6cken werden nicht gespeichert, bis auf dem \u003Cem\u003EBl\u00f6cke speichern\u003C\/em\u003E-Button geklickt wurde.","This permission is inherited from the authenticated user role.":"Diese Berechtigung wird von der Rolle \u201aAuthentifizierte Benutzer\u2018 ererbt.","No revision":"Keine Version","Requires a title":"Ben\u00f6tigt einen Titel","Not restricted":"Uneingeschr\u00e4nkt","(active tab)":"(aktiver Reiter)","Not customizable":"Nicht anpassbar","Restricted to certain pages":"Auf bestimmte Seiten eingeschr\u00e4nkt","The block cannot be placed in this region.":"Der Block kann nicht in dieser Region abgelegt werden.","Hide summary":"Zusammenfassung verbergen","Edit summary":"Zusammenfassung bearbeiten","Don\u0027t display post information":"Beitragsinformationen nicht anzeigen","The selected file %filename cannot be uploaded. Only files with the following extensions are allowed: %extensions.":"Die ausgew\u00e4hlte Datei %filename konnte nicht hochgeladen werden. Nur Dateien mit den folgenden Erweiterungen sind zul\u00e4ssig: %extensions.","Re-order rows by numerical weight instead of dragging.":"Zeilen mittels numerischer Gewichtung ordnen statt mit Drag-and-Drop","Show row weights":"Zeilenreihenfolge anzeigen","Hide row weights":"Zeilenreihenfolge ausblenden","Autocomplete popup":"Popup zur automatischen Vervollst\u00e4ndigung","Searching for matches...":"Suche \u2026","Next page":"N\u00e4chste Seite","Content can only be inserted into CKEditor in the WYSIWYG mode.":"Inhalt kann nur dann in den CKEditor eingegeben werden, wenn der WYSIWYG Modus aktiviert ist.","No results":"Keine Ergebnisse","Available tokens":"Verf\u00fcgbare Token","Insert this token into your form":"Dieses Token in Ihr Formular einf\u00fcgen","First click a text field to insert your tokens into.":"Klicken Sie zun\u00e4chst auf ein Textfeld, um Ihr Token einzuf\u00fcgen.","Automatic alias":"Automatischer Alias","Remove group":"Gruppe entfernen","Apply (all displays)":"Anwenden (alle Anzeigen)","Revert to default":"Auf Standardwert zur\u00fccksetzen","Apply (this display)":"Anwenden (diese Anzeige)","Select all":"Alle au
vendor: 10,071 bytes, lines 1-7
1sw\u00e4hlen","all":"Alle","Select":"Auswahl","Deselect all":"Alles abw\u00e4hlen","Media browser":"Medien-Browser","Loading...":"Wird geladen ...","Cannot continue, nothing selected":"Zum Fortsetzen w\u00e4hlen Sie etwas aus","List additional actions":"Weitere Aktionen auflisten","Select All":"Alles ersetzen","Select None":"Nichts ausw\u00e4hlen","CustomMessage: !customMessage":"Benutzerdefinierte Nachricht: !customMessage","The response failed verification so will not be processed.":"Die Verifizierung der Antwort ist fehlgeschlagen, deshalb wird die Verarbeitung nicht fortgef\u00fchrt.","The callback URL is not local and not trusted: !url":"Die Callback-URL ist nicht lokal und nicht vertrauensw\u00fcrdig: !url","Colorbox":"Colorbox","Previous page":"Vorherige Seite","Translatable":"\u00dcbersetzbar","Pause":"Pause","Update Advanced Option":"Erweiterte Option aktualisieren","Applied Options":"Angewandte Optionen","Zoom level":"Vergr\u00f6\u00dferungsstufe","Inclusion: @value":"Einbeziehen: @value","Priority: @value":"Priorit\u00e4t: @value"}} };;
2/*!
3	Colorbox 1.6.4
4	license: MIT
5	http://www.jacklmoore.com/colorbox
6*/
7(function(t,e,i){function n(i,n,o){var r=e.createElement(i);return n&&(r.id=Z+n),o&&(r.style.cssText=o),t(r)}function o(){return i.innerHeight?i.innerHeight:t(i).height()}function r(e,i){i!==Object(i)&&(i={}),this.cache={},this.el=e,this.value=function(e){var n;return void 0===this.cache[e]&&(n=t(this.el).attr("data-cbox-"+e),void 0!==n?this.cache[e]=n:void 0!==i[e]?this.cache[e]=i[e]:void 0!==X[e]&&(this.cache[e]=X[e])),this.cache[e]},this.get=function(e){var i=this.value(e);return t.isFunction(i)?i.call(this.el,this):i}}function h(t){var e=W.length,i=(A+t)%e;return 0>i?e+i:i}function a(t,e){return Math.round((/%/.test(t)?("x"===e?E.width():o())/100:1)*parseInt(t,10))}function s(t,e){return t.get("photo")||t.get("photoRegex").test(e)}function l(t,e){return t.get("retinaUrl")&&i.devicePixelRatio>1?e.replace(t.get("photoRegex"),t.get("retinaSuffix")):e}function d(t){"contains"in x[0]&&!x[0].contains(t.target)&&t.target!==v[0]&&(t.stopPropagation(),x.focus())}function c(t){c.str!==t&&(x.add(v).removeClass(c.str).addClass(t),c.str=t)}function g(e){A=0,e&&e!==!1&&"nofollow"!==e?(W=t("."+te).filter(function(){var i=t.data(this,Y),n=new r(this,i);return n.get("rel")===e}),A=W.index(_.el),-1===A&&(W=W.add(_.el),A=W.length-1)):W=t(_.el)}function u(i){t(e).trigger(i),ae.triggerHandler(i)}function f(i){var o;if(!G){if(o=t(i).data(Y),_=new r(i,o),g(_.get("rel")),!U){U=$=!0,c(_.get("className")),x.css({visibility:"hidden",display:"block",opacity:""}),I=n(se,"LoadedContent","width:0; height:0; overflow:hidden; visibility:hidden"),b.css({width:"",height:""}).append(I),j=T.height()+k.height()+b.outerHeight(!0)-b.height(),D=C.width()+H.width()+b.outerWidth(!0)-b.width(),N=I.outerHeight(!0),z=I.outerWidth(!0);var h=a(_.get("initialWidth"),"x"),s=a(_.get("initialHeight"),"y"),l=_.get("maxWidth"),f=_.get("maxHeight");_.w=Math.max((l!==!1?Math.min(h,a(l,"x")):h)-z-D,0),_.h=Math.max((f!==!1?Math.min(s,a(f,"y")):s)-N-j,0),I.css({width:"",height:_.h}),J.position(),u(ee),_.get("onOpen"),O.add(F).hide(),x.focus(),_.get("trapFocus")&&e.addEventListener&&(e.addEventListener("focus",d,!0),ae.one(re,function(){e.removeEventListener("focus",d,!0)})),_.get("returnFocus")&&ae.one(re,function(){t(_.el).focus()})}var p=parseFloat(_.get("opacity"));v.css({opacity:p===p?p:"",cursor:_.get("overlayClose")?"pointer":"",visibility:"visible"}).show(),_.get("closeButton")?B.html(_.get("close")).appendTo(b):B.appendTo("<div/>"),w()}}function p(){x||(V=!1,E=t(i),x=n(se).attr({id:Y,"class":t.support.opacity===!1?Z+"IE":"",role:"dialog",tabindex:"-1"}).hide(),v=n(se,"Overlay").hide(),L=t([n(se,"LoadingOverlay")[0],n(se,"LoadingGraphic")[0]]),y=n(se,"Wrapper"),b=n(se,"Content").append(F=n(se,"Title"),R=n(se,"Current"),P=t('<button type="button"/>').attr({id:Z+"Previous"}),K=t('<button type="button"/>').attr({id:Z+"Next"}),S=t('<button type="button"/>').attr({id:Z+"Slideshow"}),L),B=t('<button type="button"/>').attr({id:Z+"Close"}),y.append(n(se).append(n(se,"TopLeft"),T=n(se,"TopCenter"),n(se,"TopRight")),n(se,!1,"clear:left").append(C=n(se,"MiddleLeft"),b,H=n(se,"MiddleRight")),n(se,!1,"clear:left").append(n(se,"BottomLeft"),k=n(se,"BottomCenter"),n(se,"BottomRight"))).find("div div").css({"float":"left"}),M=n(se,!1,"position:absolute; width:9999px; visibility:hidden; display:none; max-width:none;"),O=K.add(P).add(R).add(S)),e.body&&!x.parent().length&&t(e.body).append(v,x.append(y,M))}function m(){function i(t){t.which>1||t.shiftKey||t.altKey||t.metaKey||t.ctrlKey||(t.preventDefault(),f(this))}return x?(V||(V=!0,K.click(function(){J.next()}),P.click(function(){J.prev()}),B.click(function(){J.close()}),v.click(function(){_.get("overlayClose")&&J.close()}),t(e).bind("keydown."+Z,function(t){var e=t.keyCode;U&&_.get("escKey")&&27===e&&(t.preventDefault(),J.close()),U&&_.get("arrowKey")&&W[1]&&!t.altKey&&(37===e?(t.preventDefault(),P.click()):39===e&&(t.preventDefault(),K.click()))}),t.isFunction(t.fn.on)?t(e).on("click."+Z,"."+te,i):t("."+te).live("click."+Z,i)),!0):!1}function w(){var e,o,r,h=J.prep,d=++le;if($=!0,q=!1,u(he),u(ie),_.get("onLoad"),_.h=_.get("height")?a(_.get("height"),"y")-N-j:_.get("innerHeight")&&a(_.get("innerHeight"),"y"),_.w=_.get("width")?a(_.get("width"),"x")-z-D:_.get("innerWidth")&&a(_.get("innerWidth"),"x"),_.mw=_.w,_.mh=_.h,_.get("maxWidth")&&(_.mw=a(_.get("maxWidth"),"x")-z-D,_.mw=_.w&&_.w<_.mw?_.w:_.mw),_.get("maxHeight")&&(_.mh=a(_.get("maxHeight"),"y")-N-j,_.mh=_.h&&_.h<_.mh?_.h:_.mh),e=_.get("href"),Q=setTimeout(function(){L.show()},100),_.get("inline")){var c=t(e).eq(0);r=t("<div>").hide().insertBefore(c),ae.one(he,function(){r.replaceWith(c)}),h(c)}else _.get("iframe")?h(" "):_.get("html")?h(_.get("html")):s(_,e)?(e=l(_,e),q=_.get("createImg"),t(q).addClass(Z+"Photo").bind("error."+Z,function(){h(n(se,"Error").html(_.get("imgError")))}).one("load",function(){d===le&&setTimeout(function(){var e;_.get("retinaImage")&&i.devicePixelRatio>1&&(q.height=q.height/i.devicePixelRatio,q.width=q.width/i.devicePixelRatio),_.get("scalePhotos")&&(o=function(){q.height-=q.height*e,q.width-=q.width*e},_.mw&&q.width>_.mw&&(e=(q.width-_.mw)/q.width,o()),_.mh&&q.height>_.mh&&(e=(q.height-_.mh)/q.height,o())),_.h&&(q.style.marginTop=Math.max(_.mh-q.height,0)/2+"px"),W[1]&&(_.get("loop")||W[A+1])&&(q.style.cursor="pointer",t(q).bind("click."+Z,function(){J.next()})),q.style.width=q.width+"px",q.style.height=q.height+"px",h(q)},1)}),q.src=e):e&&M.load(e,_.get("data"),function(e,i){d===le&&h("error"===i?n(se,"Error").html(_.get("xhrError")):t(this).contents())})}var v,x,y,b,T,C,H,k,W,E,I,M,L,F,R,S,K,P,B,O,_,j,D,N,z,A,q,U,$,G,Q,J,V,X={html:!1,photo:!1,iframe:!1,inline:!1,transition:"elastic",speed:300,fadeOut:300,width:!1,initialWidth:"600",innerWidth:!1,maxWidth:!1,height:!1,initialHeight:"450",innerHeight:!1,maxHeight:!1,scalePhotos:!0,scrolling:!0,opacity:.9,preloading:!0,className:!1,overlayClose:!0,escKey:!0,arrowKey:!0,top:!1,bottom:!1,left:!1,right:!1,fixed:!1,data:void 0,closeButton:!0,fastIframe:!0,open:!1,reposition:!0,loop:!0,slideshow:!1,slideshowAuto:!0,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",photoRegex:/\.(gif|png|jp(e|g|eg)|bmp|ico|webp|jxr|svg)((#|\?).*)?$/i,retinaImage:!1,retinaUrl:!1,retinaSuffix:"@2x.$1",current:"image {current} of {total}",previous:"previous",next:"next",close:"close",xhrError:"This content failed to load.",imgError:"This image failed to load.",returnFocus:!0,trapFocus:!0,onOpen:!1,onLoad:!1,onComplete:!1,onCleanup:!1,onClosed:!1,rel:function(){return this.rel},href:function(){return t(this).attr("href")},title:function(){return this.title},createImg:function(){var e=new Image,i=t(this).data("cbox-img-attrs");return"object"==typeof i&&t.each(i,function(t,i){e[t]=i}),e},createIframe:function(){var i=e.createElement("iframe"),n=t(this).data("cbox-iframe-attrs");return"object"==typeof n&&t.each(n,function(t,e){i[t]=e}),"frameBorder"in i&&(i.frameBorder=0),"allowTransparency"in i&&(i.allowTransparency="true"),i.name=(new Date).getTime(),i.allowFullscreen=!0,i}},Y="colorbox",Z="cbox",te=Z+"Element",ee=Z+"_open",ie=Z+"_load",ne=Z+"_complete",oe=Z+"_cleanup",re=Z+"_closed",he=Z+"_purge",ae=t("<a/>"),se="div",le=0,de={},ce=function(){function t(){clearTimeout(h)}function e(){(_.get("loop")||W[A+1])&&(t(),h=setTimeout(J.next,_.get("slideshowSpeed")))}function i(){S.html(_.get("slideshowStop")).unbind(s).one(s,n),ae.bind(ne,e).bind(ie,t),x.removeClass(a+"off").addClass(a+"on")}function n(){t(),ae.unbind(ne,e).unbind(ie,t),S.html(_.get("slideshowStart")).unbind(s).one(s,function(){J.next(),i()}),x.removeClass(a+"on").addClass(a+"off")}function o(){r=!1,S.hide(),t(),ae.unbind(ne,e).unbind(ie,t),x.removeClass(a+"off "+a+"on")}var r,h,a=Z+"Slideshow_",s="click."+Z;return function(){r?_.get("slideshow")||(ae.unbind(oe,o),o()):_.get("slideshow")&&W[1]&&(r=!0,ae.one(oe,o),_.get("slideshowAuto")?i():n(),S.show())}}();t[Y]||(t(p),J=t.fn[Y]=t[Y]=function(e,i){var n,o=this;return e=e||{},t.isFunction(o)&&(o=t("<a/>"),e.open=!0),o[0]?(p(),m()&&(i&&(e.onComplete=i),o.each(function(){var i=t.data(this,Y)||{};t.data(this,Y,t.extend(i,e))}).addClass(te),n=new r(o[0],e),n.get("open")&&f(o[0])),o):o},J.position=function(e,i){function n(){T[0].style.width=k[0].style.width=b[0].style.width=parseInt(x[0].style.width,10)-D+"px",b[0].style.height=C[0].style.height=H[0].style.height=parseInt(x[0].style.height,10)-j+"px"}var r,h,s,l=0,d=0,c=x.offset();if(E.unbind("resize."+Z),x.css({top:-9e4,left:-9e4}),h=E.scrollTop(),s=E.scrollLeft(),_.get("fixed")?(c.top-=h,c.left-=s,x.css({position:"fixed"})):(l=h,d=s,x.css({position:"absolute"})),d+=_.get("right")!==!1?Math.max(E.width()-_.w-z-D-a(_.get("right"),"x"),0):_.get("left")!==!1?a(_.get("left"),"x"):Math.round(Math.max(E.width()-_.w-z-D,0)/2),l+=_.get("bottom")!==!1?Math.max(o()-_.h-N-j-a(_.get("bottom"),"y"),0):_.get("top")!==!1?a(_.get("top"),"y"):Math.round(Math.max(o()-_.h-N-j,0)/2),x.css({top:c.top,left
7:c.left,visibility:"visible"}),y[0].style.width=y[0].style.height="9999px",r={width:_.w+z+D,height:_.h+N+j,top:l,left:d},e){var g=0;t.each(r,function(t){return r[t]!==de[t]?(g=e,void 0):void 0}),e=g}de=r,e||x.css(r),x.dequeue().animate(r,{duration:e||0,complete:function(){n(),$=!1,y[0].style.width=_.w+z+D+"px",y[0].style.height=_.h+N+j+"px",_.get("reposition")&&setTimeout(function(){E.bind("resize."+Z,J.position)},1),t.isFunction(i)&&i()},step:n})},J.resize=function(t){var e;U&&(t=t||{},t.width&&(_.w=a(t.width,"x")-z-D),t.innerWidth&&(_.w=a(t.innerWidth,"x")),I.css({width:_.w}),t.height&&(_.h=a(t.height,"y")-N-j),t.innerHeight&&(_.h=a(t.innerHeight,"y")),t.innerHeight||t.height||(e=I.scrollTop(),I.css({height:"auto"}),_.h=I.height()),I.css({height:_.h}),e&&I.scrollTop(e),J.position("none"===_.get("transition")?0:_.get("speed")))},J.prep=function(i){function o(){return _.w=_.w||I.width(),_.w=_.mw&&_.mw<_.w?_.mw:_.w,_.w}function a(){return _.h=_.h||I.height(),_.h=_.mh&&_.mh<_.h?_.mh:_.h,_.h}if(U){var d,g="none"===_.get("transition")?0:_.get("speed");I.remove(),I=n(se,"LoadedContent").append(i),I.hide().appendTo(M.show()).css({width:o(),overflow:_.get("scrolling")?"auto":"hidden"}).css({height:a()}).prependTo(b),M.hide(),t(q).css({"float":"none"}),c(_.get("className")),d=function(){function i(){t.support.opacity===!1&&x[0].style.removeAttribute("filter")}var n,o,a=W.length;U&&(o=function(){clearTimeout(Q),L.hide(),u(ne),_.get("onComplete")},F.html(_.get("title")).show(),I.show(),a>1?("string"==typeof _.get("current")&&R.html(_.get("current").replace("{current}",A+1).replace("{total}",a)).show(),K[_.get("loop")||a-1>A?"show":"hide"]().html(_.get("next")),P[_.get("loop")||A?"show":"hide"]().html(_.get("previous")),ce(),_.get("preloading")&&t.each([h(-1),h(1)],function(){var i,n=W[this],o=new r(n,t.data(n,Y)),h=o.get("href");h&&s(o,h)&&(h=l(o,h),i=e.createElement("img"),i.src=h)})):O.hide(),_.get("iframe")?(n=_.get("createIframe"),_.get("scrolling")||(n.scrolling="no"),t(n).attr({src:_.get("href"),"class":Z+"Iframe"}).one("load",o).appendTo(I),ae.one(he,function(){n.src="//about:blank"}),_.get("fastIframe")&&t(n).trigger("load")):o(),"fade"===_.get("transition")?x.fadeTo(g,1,i):i())},"fade"===_.get("transition")?x.fadeTo(g,0,function(){J.position(0,d)}):J.position(g,d)}},J.next=function(){!$&&W[1]&&(_.get("loop")||W[A+1])&&(A=h(1),f(W[A]))},J.prev=function(){!$&&W[1]&&(_.get("loop")||A)&&(A=h(-1),f(W[A]))},J.close=function(){U&&!G&&(G=!0,U=!1,u(oe),_.get("onCleanup"),E.unbind("."+Z),v.fadeTo(_.get("fadeOut")||0,0),x.stop().fadeTo(_.get("fadeOut")||0,0,function(){x.hide(),v.hide(),u(he),I.remove(),setTimeout(function(){G=!1,u(re),_.get("onClosed")},1)}))},J.remove=function(){x&&(x.stop(),t[Y].close(),x.stop(!1,!0).remove(),v.remove(),G=!1,x=null,t("."+te).removeData(Y).removeClass(te),t(e).unbind("click."+Z).unbind("keydown."+Z))},J.element=function(){return t(_.el)},J.settings=X)})(jQuery,document,window);;
8/**
9 * @file
10 * Colorbox module init js.
11 */
12
13(function ($) {
14
15Drupal.behaviors.initColorbox = {
16  attach: function (context, settings) {
17    if (!$.isFunction($('a, area, input', context).colorbox) || typeof settings.colorbox === 'undefined') {
18      return;
19    }
20
21    if (settings.colorbox.mobiledetect && window.matchMedia) {
22      // Disable Colorbox for small screens.
23      var mq = window.matchMedia("(max-device-width: " + settings.colorbox.mobiledevicewidth + ")");
24      if (mq.matches) {
25        return;
26      }
27    }
28
29    // Use "data-colorbox-gallery" if set otherwise use "rel".
30    settings.colorbox.rel = function () {
31      if ($(this).data('colorbox-gallery')) {
32        return $(this).data('colorbox-gallery');
33      }
34      else {
35        return $(this).attr('rel');
36      }
37    };
38
39    $('.colorbox', context)
40      .once('init-colorbox').each(function(){
41        $(this).colorbox(settings.colorbox);
42      });
43
44    $(context).bind('cbox_complete', function () {
45      Drupal.attachBehaviors('#cboxLoadedContent');
46    });
47  }
48};
49
50})(jQuery);
51;
52/**
53 * @file
54 * Colorbox module style js.
55 */
56
57(function ($) {
58
59Drupal.behaviors.initColorboxDefaultStyle = {
60  attach: function (context, settings) {
61    $(context).bind('cbox_complete', function () {
62      // Only run if there is a title.
63      if ($('#cboxTitle:empty', context).length == false) {
64        $('#cboxLoadedContent img', context).bind('mouseover', function () {
65          $('#cboxTitle', context).slideDown();
66        });
67        $('#cboxOverlay', context).bind('mouseover', function () {
68          $('#cboxTitle', context).slideUp();
69        });
70      }
71      else {
72        $('#cboxTitle', context).hide();
73      }
74    });
75  }
76};
77
78})(jQuery);
79;
80/**
81 * @file better_exposed_filters.js
82 *
83 * Provides some client-side functionality for the Better Exposed Filters module
84 */
85(function ($) {
86  Drupal.behaviors.betterExposedFilters = {
87    attach: function(context) {
88      // Add highlight class to checked checkboxes for better theming
89      $('.bef-tree input[type=checkbox], .bef-checkboxes input[type=checkbox]')
90        // Highlight newly selected checkboxes
91        .change(function() {
92          _bef_highlight(this, context);
93        })
94        .filter(':checked').closest('.form-item', context).addClass('highlight')
95      ;
96    }
97  };
98
99  Drupal.behaviors.betterExposedFiltersSelectAllNone = {
100    attach: function(context) {
101
102      /*
103       * Add Select all/none links to specified checkboxes
104       */
105      var selected = $('.form-checkboxes.bef-select-all-none:not(.bef-processed)');
106      if (selected.length) {
107        var selAll = Drupal.t('Select All');
108        var selNone = Drupal.t('Select None');
109
110        // Set up a prototype link and event handlers
111        var link = $('<a class="bef-toggle" href="#">'+ selAll +'</a>')
112        link.click(function(event) {
113          // Don't actually follow the link...
114          event.preventDefault();
115          event.stopPropagation();
116
117          if (selAll == $(this).text()) {
118            // Select all the checkboxes
119            $(this)
120              .html(selNone)
121              .siblings('.bef-checkboxes, .bef-tree')
122                .find('.form-item input:checkbox').each(function() {
123                  $(this).attr('checked', true);
124                  _bef_highlight(this, context);
125                })
126              .end()
127
128              // attr() doesn't trigger a change event, so we do it ourselves. But just on
129              // one checkbox otherwise we have many spinning cursors
130              .find('input[type=checkbox]:first').change()
131            ;
132          }
133          else {
134            // Unselect all the checkboxes
135            $(this)
136              .html(selAll)
137              .siblings('.bef-checkboxes, .bef-tree')
138                .find('.form-item input:checkbox').each(function() {
139                  $(this).attr('checked', false);
140                  _bef_highlight(this, context);
141                })
142              .end()
143
144              // attr() doesn't trigger a change event, so we do it ourselves. But just on
145              // one checkbox otherwise we have many spinning cursors
146              .find('input[type=checkbox]:first').change()
147            ;
148          }
149        });
150
151        // Add link to the page for each set of checkboxes.
152        selected
153          .addClass('bef-processed')
154          .each(function(index) {
155            // Clone the link prototype and insert into the DOM
156            var newLink = link.clone(true);
157
158            newLink.insertBefore($('.bef-checkboxes, .bef-tree', this));
159
160            // If all checkboxes are already checked by default then switch to Select None
161            if ($('input:checkbox:checked', this).length == $('input:checkbox', this).length) {
162              newLink.click();
163            }
164          })
165        ;
166      }
167
168      // Check for and initialize datepickers
169      var befSettings = Drupal.settings.better_exposed_filters;
170      if (befSettings && befSettings.datepicker && befSettings.datepicker_options && $.fn.datepicker) {
171        var opt = [];
172        $.each(befSettings.datepicker_options, function(key, val) {
173          if (key && val) {
174            opt[key] = JSON.parse(val);
175          }
176        });
177        $('.bef-datepicker').datepicker(opt);
178      }
179
180    }                   // attach: function() {
181  };                    // Drupal.behaviors.better_exposed_filters = {
182
183  Drupal.behaviors.betterExposedFiltersAllNoneNested = {
184    attach:function (context, settings) {
185      $('.form-checkboxes.bef-select-all-none-nested li').has('ul').once('bef-all-none-nested', function () {
186        $(this)
187          // To respect term depth, check/uncheck child term checkboxes.
188          .find('input.form-checkboxes:first')
189          .click(function() {
190            var checkedParent = $(this).attr('checked');
191            if (!checkedParent) {
192              // Uncheck all children if parent is unchecked.
193              $(this).parents('li:first').find('ul input.form-checkboxes').removeAttr('checked');
194            }
195            else {
196              // Check all children if parent is checked.
197              $(this).parents('li:first').find('ul input.form-checkboxes').attr('checked', $(this).attr('checked'));
198            }
199          })
200          .end()
201          // When a child term is checked or unchecked, set the parent term's
202          // status.
203          .find('ul input.form-checkboxes')
204          .click(function() {
205            var checked = $(this).attr('checked');
206
207            // Determine the number of unchecked sibling checkboxes.
208            var ct = $(this).parents('ul:first').find('input.form-checkboxes:not(:checked)').size();
209
210            // If the child term is unchecked, uncheck the parent.
211            if (!checked) {
212              // Uncheck parent if any of the childres is unchecked.
213              $(this).parents('li:first').parents('li:first').find('input.form-checkboxes:first').removeAttr('checked');
214            }
215
216            // If all sibling terms are checked, check the parent.
217            if (!ct) {
218              // Check the parent if all the children are checked.
219              $(this).parents('li:first').parents('li:first').find('input.form-checkboxes:first').attr('checked', checked);
220            }
221          });
222      });
223    }
224  };
225
226  Drupal.behaviors.better_exposed_filters_slider = {
227    attach: function(context, settings) {
228      var befSettings = settings.better_exposed_filters;
229      if (befSettings && befSettings.slider && befSettings.slider_options) {
230        $.each(befSettings.slider_options, function(i, sliderOptions) {
231          var containing_parent = "#" + sliderOptions.viewId + " #edit-" + sliderOptions.id + "-wrapper .views-widget";
232          var $filter = $(containing_parent);
233
234          // If the filter is placed in a secondary fieldset, we may not have
235          // the usual wrapper element.
236          if (!$filter.length) {
237            containing_parent = "#" + sliderOptions.viewId + " .bef-slider-wrapper";
238            $filter = $(containing_parent);
239          }
240
241          // Only make one slider per filter.
242          $filter.once('slider-filter', function() {
243            var $input = $(this).find('input[type=text]');
244
245            // This is a "between" or "not between" filter with two values.
246            if ($input.length == 2) {
247              var $min = $input.parent().find('input#edit-' + sliderOptions.id + '-min'),
248                  $max = $input.parent().find('input#edit-' + sliderOptions.id + '-max'),
249                  default_min,
250                  default_max;
251
252              if (!$min.length || !$max.length) {
253                return;
254              }
255
256              // Get the default values.
257              // We use slider min & max if there are no defaults.
258              default_min = parseFloat(($min.val() == '') ? sliderOptions.min : $min.val(), 10);
259              default_max = parseFloat(($max.val() == '') ? sliderOptions.max : $max.val(), 10);
260              // Set the element value in case we are using the slider min & max.
261              $min.val(default_min);
262              $max.val(default_max);
263
264              $min.parents(containing_parent).after(
265                $('<div class="bef-slider"></div>').slider({
266                  range: true,
267                  min: parseFloat(sliderOptions.min, 10),
268                  max: parseFloat(sliderOptions.max, 10),
269                  step: parseFloat(sliderOptions.step, 10),
270                  animate: sliderOptions.animate ? sliderOptions.animate : false,
271                  orientation: sliderOptions.orientation,
272                  values: [default_min, default_max],
273                  // Update the textfields as the sliders are moved
274                  slide: function (event, ui) {
275                    $min.val(ui.values[0]);
276                    $max.val(ui.values[1]);
277                  },
278                  // This fires when the value is set programmatically or the
279                  // stop event fires.
280                  // This takes care of the case that a user enters a value
281                  // into the text field that is not a valid step of the slider.
282                  // In that case the slider will go to the nearest step and
283                  // this change event will update the text area.
284                  change: function (event, ui) {
285                    $min.val(ui.values[0]);
286                    $max.val(ui.values[1]);
287                  },
288                  // Attach stop listeners.
289                  stop: function(event, ui) {
290                    // Click the auto submit button.
291                    $(this).parents('form').find('.ctools-auto-submit-click').click();
292                  }
293                })
294              );
295
296              // Update the slider when the fields are updated.
297              $min.blur(function() {
298                befUpdateSlider($(this), 0, sliderOptions);
299              });
300              $max.blur(function() {
301                befUpdateSlider($(this), 1, sliderOptions);
302              });
303            }
304            // This is single value filter.
305            else if ($input.length == 1) {
306              if ($input.attr('id') != 'edit-' + sliderOptions.id) {
307                return;
308              }
309
310              // Get the default value. We use slider min if there is no default.
311              var default_value = parseFloat(($input.val() == '') ? sliderOptions.min : $input.val(), 10);
312              // Set the element value in case we are using the slider min.
313              $input.val(default_value);
314
315              $input.parents(containing_parent).after(
316                $('<div class="bef-slider"></div>').slider({
317                  min: parseFloat(sliderOptions.min, 10),
318                  max: parseFloat(sliderOptions.max, 10),
319                  step: parseFloat(sliderOptions.step, 10),
320                  animate: sliderOptions.animate ? sliderOptions.animate : false,
321                  orientation: sliderOptions.orientation,
322                  value: default_value,
323                  // Update the textfields as the sliders are moved.
324                  slide: function (event, ui) {
325                    $input.val(ui.value);
326                  },
327                  // This fires when the value is set programmatically or the
328                  // stop event fires.
329                  // This takes care of the case that a user enters a value
330                  // into the text field that is not a valid step of the slider.
331                  // In that case the slider will go to the nearest step and
332                  // this change event will update the text area.
333                  change: function (event, ui) {
334                    $input.val(ui.value);
335                  },
336                  // Attach stop listeners.
337                  stop: function(event, ui) {
338                    // Click the auto submit button.
339                    $(this).parents('form').find('.ctools-auto-submit-click').click();
340                  }
341                })
342              );
343
344              // Update the slider when the field is updated.
345              $input.blur(function() {
346                befUpdateSlider($(this), null, sliderOptions);
347              });
348            }
349            else {
350              return;
351            }
352          })
353        });
354      }
355    }
356  };
357
358  // This is only needed to provide ajax functionality
359  Drupal.behaviors.better_exposed_filters_select_as_links = {
360    attach: function(context, settings) {
361
362      $('.bef-select-as-links', context).once(function() {
363        var $element = $(this);
364
365        // Check if ajax submission is enabled. If it's not enabled then we
366        // don't need to attach our custom submission handling, because the
367        // links are already properly built.
368
369        // First check if any ajax views are contained in the current page.
370        if (typeof settings.views == 'undefined' || typeof settings.views.ajaxViews == 'undefined') {
371          return;
372        }
373
374        // Now check that the view for which the current filter block is used,
375        // is part of the configured ajax views.
376        var $uses_ajax = false;
377        $.each(settings.views.ajaxViews, function(i, item) {
378          var $view_name = item.view_name.replace(/_/g, '-');
379          var $view_display_id = item.view_display_id.replace(/_/g, '-');
380          var $id = 'views-exposed-form-' + $view_name + '-' + $view_display_id;
381          var $form_id = $element.parents('form').attr('id');
382          if ($form_id == $id) {
383            $uses_ajax = true;
384            return;
385          }
386        });
387
388        // If no ajax is used for form submission, we quit here.
389        if (!$uses_ajax) {
390          return;
391        }
392
393        // Attach selection toggle and form submit on click to each link.
394        $(this).find('a').click(function(event) {
395          var $wrapper = $(this).parents('.bef-select-as-links');
396          var $options = $wrapper.find('select option');
397          // We have to prevent the page load triggered by the links.
398          event.preventDefault();
399          event.stopPropagation();
400          // Un select if previously seleted toogle is selected.
401          var link_text = $(this).text();
402          removed = '';
403          $($options).each(function(i) {
404            if ($(this).attr('selected')) {
405              if (link_text == $(this).text()) {
406                removed = $(this).text();
407                $(this).removeAttr('selected');
408              }
409            }
410          });
411
412          // Set the corresponding option inside the select element as selected.
413          $selected = $options.filter(function() {
414            return $(this).text() == link_text && removed != link_text;
415          });
416          $selected.attr('selected', 'selected');
417          $wrapper.find('.bef-new-value').val($selected.val());
418          $wrapper.find('.bef-new-value[value=""]').attr("disabled", "disabled");
419          $(this).addClass('active');
420          // Submit the form.
421          $wrapper.parents('form').find('.views-submit-button *[type=submit]').click();
422        });
423
424        $('.bef-select-as-link').ready(function() {
425          $('.bef-select-as-link').find('a').removeClass('active');
426          $('.bef-new-value').each(function(i, val) {
427            id = $(this).parent().find('select').attr('id') + '-' + $(this).val();
428            $('#'+id).find('a').addClass('active');
429          });
430        });
431      });
432    }
433  };
434
435  Drupal.behaviors.betterExposedFiltersRequiredFilter = {
436    attach: function(context, settings) {
437      // Required checkboxes should re-check all inputs if a user un-checks
438      // them all.
439      $('.bef-select-as-checkboxes', context).once('bef-required-filter').ajaxComplete(function (e, xhr, s) {
440        var $element = $(this);
441
442        if (typeof settings.views == 'undefined' || typeof settings.views.ajaxViews == 'undefined') {
443          return;
444        }
445
446        // Now check that the view for which the current filter block is used,
447        // is part of the configured ajax views.
448        var $view_name;
449        var $view_display_id;
450        var $uses_ajax = false;
451        $.each(settings.views.ajaxViews, function(i, item) {
452          $view_name = item.view_name;
453          $view_display_id = item.view_display_id;
454          var $id = 'views-exposed-form-' + $view_name.replace(/_/g, '-') + '-' + $view_display_id.replace(/_/g, '-');
455          var $form_id = $element.parents('form').attr('id');
456          if ($form_id == $id) {
457            $uses_ajax = true;
458            return false;
459          }
460        });
461
462        //Check if we have any filters at all because of Views Selective Filter
463        if($('input', this).length > 0) {
464          var $filter_name = $('input', this).attr('name').slice(0, -2);
465          if (Drupal.settings.better_exposed_filters.views[$view_name].displays[$view_display_id].filters[$filter_name].required && $('input:checked', this).length == 0) {
466            $('input', this).prop('checked', true);
467          }
468        }
469      });
470    }
471  }
472
473  /*
474   * Helper functions
475   */
476
477  /**
478   * Adds/Removes the highlight class from the form-item div as appropriate
479   */
480  function _bef_highlight(elem, context) {
481    $elem = $(elem, context);
482    $elem.attr('checked')
483      ? $elem.closest('.form-item', context).addClass('highlight')
484      : $elem.closest('.form-item', context).removeClass('highlight');
485  }
486
487  /**
488   * Update a slider when a related input element is changed.
489   *
490   * We don't need to check whether the new value is valid based on slider min,
491   * max, and step because the slider will do that automatically and then we
492   * update the textfield on the slider's change event.
493   *
494   * We still have to make sure that the min & max values of a range slider
495   * don't pass each other though, however once this jQuery UI bug is fixed we
496   * won't have to. - http://bugs.jqueryui.com/ticket/3762
497   *
498   * @param $el
499   *   A jQuery object of the updated element.
500   * @param valIndex
501   *   The index of the value for a range slider or null for a non-range slider.
502   * @param sliderOptions
503   *   The options for the current slider.
504   */
505  function befUpdateSlider($el, valIndex, sliderOptions) {
506    var val = parseFloat($el.val(), 10),
507        currentMin = $el.parents('div.views-widget').next('.bef-slider').slider('values', 0),
508        currentMax = $el.parents('div.views-widget').next('.bef-slider').slider('values', 1);
509    // If we have a range slider.
510    if (valIndex != null) {
511      // Make sure the min is not more than the current max value.
512      if (valIndex == 0 && val > currentMax) {
513        val = currentMax;
514      }
515      // Make sure the max is not more than the current max value.
516      if (valIndex == 1 && val < currentMin) {
517        val = currentMin;
518      }
519      // If the number is invalid, go back to the last value.
520      if (isNaN(val)) {
521        val = $el.parents('div.views-widget').next('.bef-slider').slider('values', valIndex);
522      }
523    }
524    else {
525      // If the number is invalid, go back to the last value.
526      if (isNaN(val)) {
527        val = $el.parents('div.views-widget').next('.bef-slider').slider('value');
528      }
529    }
530    // Make sure we are a number again.
531    val = parseFloat(val, 10);
532    // Set the slider to the new value.
533    // The slider's change event will then update the textfield again so that
534    // they both have the same value.
535    if (valIndex != null) {
536      $el.parents('div.views-widget').next('.bef-slider').slider('values', valIndex, val);
537    }
538    else {
539      $el.parents('div.views-widget').next('.bef-slider').slider('value', val);
540    }
541  }
542
543}) (jQuery);
544;
545(function ($) {
546
547/**
548 * Attaches the autocomplete behavior to all required fields.
549 */
550Drupal.behaviors.autocomplete = {
551  attach: function (context, settings) {
552    var acdb = [];
553    $('input.autocomplete', context).once('autocomplete', function () {
554      var uri = this.value;
555      if (!acdb[uri]) {
556        acdb[uri] = new Drupal.ACDB(uri);
557      }
558      var $input = $('#' + this.id.substr(0, this.id.length - 13))
559        .attr('autocomplete', 'OFF')
560        .attr('aria-autocomplete', 'list');
561      $($input[0].form).submit(Drupal.autocompleteSubmit);
562      $input.parent()
563        .attr('role', 'application')
564        .append($('<span class="element-invisible" aria-live="assertive"></span>')
565          .attr('id', $input.attr('id') + '-autocomplete-aria-live')
566        );
567      new Drupal.jsAC($input, acdb[uri]);
568    });
569  }
570};
571
572/**
573 * Prevents the form from submitting if the suggestions popup is open
574 * and closes the suggestions popup when doing so.
575 */
576Drupal.autocompleteSubmit = function () {
577  return $('#autocomplete').each(function () {
578    this.owner.hidePopup();
579  }).length == 0;
580};
581
582/**
583 * An AutoComplete object.
584 */
585Drupal.jsAC = function ($input, db) {
586  var ac = this;
587  this.input = $input[0];
588  this.ariaLive = $('#' + this.input.id + '-autocomplete-aria-live');
589  this.db = db;
590
591  $input
592    .keydown(function (event) { return ac.onkeydown(this, event); })
593    .keyup(function (event) { ac.onkeyup(this, event); })
594    .blur(function () { ac.hidePopup(); ac.db.cancel(); });
595
596};
597
598/**
599 * Handler for the "keydown" event.
600 */
601Drupal.jsAC.prototype.onkeydown = function (input, e) {
602  if (!e) {
603    e = window.event;
604  }
605  switch (e.keyCode) {
606    case 40: // down arrow.
607      this.selectDown();
608      return false;
609    case 38: // up arrow.
610      this.selectUp();
611      return false;
612    default: // All other keys.
613      return true;
614  }
615};
616
617/**
618 * Handler for the "keyup" event.
619 */
620Drupal.jsAC.prototype.onkeyup = function (input, e) {
621  if (!e) {
622    e = window.event;
623  }
624  switch (e.keyCode) {
625    case 16: // Shift.
626    case 17: // Ctrl.
627    case 18: // Alt.
628    case 20: // Caps lock.
629    case 33: // Page up.
630    case 34: // Page down.
631    case 35: // End.
632    case 36: // Home.
633    case 37: // Left arrow.
634    case 38: // Up arrow.
635    case 39: // Right arrow.
636    case 40: // Down arrow.
637      return true;
638
639    case 9:  // Tab.
640    case 13: // Enter.
641    case 27: // Esc.
642      this.hidePopup(e.keyCode);
643      return true;
644
645    default: // All other keys.
646      if (input.value.length > 0 && !input.readOnly) {
647        this.populatePopup();
648      }
649      else {
650        this.hidePopup(e.keyCode);
651      }
652      return true;
653  }
654};
655
656/**
657 * Puts the currently highlighted suggestion into the autocomplete field.
658 */
659Drupal.jsAC.prototype.select = function (node) {
660  this.input.value = $(node).data('autocompleteValue');
661  $(this.input).trigger('autocompleteSelect', [node]);
662};
663
664/**
665 * Highlights the next suggestion.
666 */
667Drupal.jsAC.prototype.selectDown = function () {
668  if (this.selected && this.selected.nextSibling) {
669    this.highlight(this.selected.nextSibling);
670  }
671  else if (this.popup) {
672    var lis = $('li', this.popup);
673    if (lis.length > 0) {
674      this.highlight(lis.get(0));
675    }
676  }
677};
678
679/**
680 * Highlights the previous suggestion.
681 */
682Drupal.jsAC.prototype.selectUp = function () {
683  if (this.selected && this.selected.previousSibling) {
684    this.highlight(this.selected.previousSibling);
685  }
686};
687
688/**
689 * Highlights a suggestion.
690 */
691Drupal.jsAC.prototype.highlight = function (node) {
692  if (this.selected) {
693    $(this.selected).removeClass('selected');
694  }
695  $(node).addClass('selected');
696  this.selected = node;
697  $(this.ariaLive).html($(this.selected).html());
698};
699
700/**
701 * Unhighlights a suggestion.
702 */
703Drupal.jsAC.prototype.unhighlight = function (node) {
704  $(node).removeClass('selected');
705  this.selected = false;
706  $(this.ariaLive).empty();
707};
708
709/**
710 * Hides the autocomplete suggestions.
711 */
712Drupal.jsAC.prototype.hidePopup = function (keycode) {
713  // Select item if the right key or mousebutton was pressed.
714  if (this.selected && ((keycode && keycode != 46 && keycode != 8 && keycode != 27) || !keycode)) {
715    this.select(this.selected);
716  }
717  // Hide popup.
718  var popup = this.popup;
719  if (popup) {
720    this.popup = null;
721    $(popup).fadeOut('fast', function () { $(popup).remove(); });
722  }
723  this.selected = false;
724  $(this.ariaLive).empty();
725};
726
727/**
728 * Positions the suggestions popup and starts a search.
729 */
730Drupal.jsAC.prototype.populatePopup = function () {
731  var $input = $(this.input);
732  var position = $input.position();
733  // Show popup.
734  if (this.popup) {
735    $(this.popup).remove();
736  }
737  this.selected = false;
738  this.popup = $('<div id="autocomplete"></div>')[0];
739  this.popup.owner = this;
740  $(this.popup).css({
741    top: parseInt(position.top + this.input.offsetHeight, 10) + 'px',
742    left: parseInt(position.left, 10) + 'px',
743    width: $input.innerWidth() + 'px',
744    display: 'none'
745  });
746  $input.before(this.popup);
747
748  // Do search.
749  this.db.owner = this;
750  this.db.search(this.input.value);
751};
752
753/**
754 * Fills the suggestion popup with any matches received.
755 */
756Drupal.jsAC.prototype.found = function (matches) {
757  // If no value in the textfield, do not show the popup.
758  if (!this.input.value.length) {
759    return false;
760  }
761
762  // Prepare matches.
763  var ul = $('<ul></ul>');
764  var ac = this;
765  for (key in matches) {
766    $('<li></li>')
767      .html($('<div></div>').html(matches[key]))
768      .mousedown(function () { ac.hidePopup(this); })
769      .mouseover(function () { ac.highlight(this); })
770      .mouseout(function () { ac.unhighlight(this); })
771      .data('autocompleteValue', key)
772      .appendTo(ul);
773  }
774
775  // Show popup with matches, if any.
776  if (this.popup) {
777    if (ul.children().length) {
778      $(this.popup).empty().append(ul).show();
779      $(this.ariaLive).html(Drupal.t('Autocomplete popup'));
780    }
781    else {
782      $(this.popup).css({ visibility: 'hidden' });
783      this.hidePopup();
784    }
785  }
786};
787
788Drupal.jsAC.prototype.setStatus = function (status) {
789  switch (status) {
790    case 'begin':
791      $(this.input).addClass('throbbing');
792      $(this.ariaLive).html(Drupal.t('Searching for matches...'));
793      break;
794    case 'cancel':
795    case 'error':
796    case 'found':
797      $(this.input).removeClass('throbbing');
798      break;
799  }
800};
801
802/**
803 * An AutoComplete DataBase object.
804 */
805Drupal.ACDB = function (uri) {
806  this.uri = uri;
807  this.delay = 300;
808  this.cache = {};
809};
810
811/**
812 * Performs a cached and delayed search.
813 */
814Drupal.ACDB.prototype.search = function (searchString) {
815  var db = this;
816  this.searchString = searchString;
817
818  // See if this string needs to be searched for anyway. The pattern ../ is
819  // stripped since it may be misinterpreted by the browser.
820  searchString = searchString.replace(/^\s+|\.{2,}\/|\s+$/g, '');
821  // Skip empty search strings, or search strings ending with a comma, since
822  // that is the separator between search terms.
823  if (searchString.length <= 0 ||
824    searchString.charAt(searchString.length - 1) == ',') {
825    return;
826  }
827
828  // See if this key has been searched for before.
829  if (this.cache[searchString]) {
830    return this.owner.found(this.cache[searchString]);
831  }
832
833  // Initiate delayed search.
834  if (this.timer) {
835    clearTimeout(this.timer);
836  }
837  this.timer = setTimeout(function () {
838    db.owner.setStatus('begin');
839
840    // Ajax GET request for autocompletion. We use Drupal.encodePath instead of
841    // encodeURIComponent to allow autocomplete search terms to contain slashes.
842    $.ajax({
843      type: 'GET',
844      url: Drupal.sanitizeAjaxUrl(db.uri + '/' + Drupal.encodePath(searchString)),
845      dataType: 'json',
846      jsonp: false,
847      success: function (matches) {
848        if (typeof matches.status == 'undefined' || matches.status != 0) {
849          db.cache[searchString] = matches;
850          // Verify if these are still the matches the user wants to see.
851          if (db.searchString == searchString) {
852            db.owner.found(matches);
853          }
854          db.owner.setStatus('found');
855        }
856      },
857      error: function (xmlhttp) {
858        Drupal.displayAjaxError(Drupal.ajaxError(xmlhttp, db.uri));
859      }
860    });
861  }, this.delay);
862};
863
864/**
865 * Cancels the current autocomplete request.
866 */
867Drupal.ACDB.prototype.cancel = function () {
868  if (this.owner) this.owner.setStatus('cancel');
869  if (this.timer) clearTimeout(this.timer);
870  this.searchString = '';
871};
872
873})(jQuery);
874;
875(function ($) {
876
877// Auto-submit main search input after autocomplete
878if (typeof Drupal.jsAC != 'undefined') {
879
880  var getSetting = function (input, setting, defaultValue) {
881    // Earlier versions of jQuery, like the default for Drupal 7, don't properly
882    // convert data-* attributes to camel case, so we access it via the verbatim
883    // name from the attribute (which also works in newer versions).
884    var search = $(input).data('search-api-autocomplete-search');
885    if (typeof search == 'undefined'
886        || typeof Drupal.settings.search_api_autocomplete == 'undefined'
887        || typeof Drupal.settings.search_api_autocomplete[search] == 'undefined'
888        || typeof Drupal.settings.search_api_autocomplete[search][setting] == 'undefined') {
889      return defaultValue;
890    }
891    return Drupal.settings.search_api_autocomplete[search][setting];
892  };
893
894  var oldJsAC = Drupal.jsAC;
895  /**
896   * An AutoComplete object.
897   *
898   * Overridden to set the proper "role" attribute on the input element.
899   */
900  Drupal.jsAC = function ($input, db) {
901    if ($input.data('search-api-autocomplete-search')) {
902      $input.attr('role', 'combobox');
903      $input.parent().attr('role', 'search');
904    }
905    this.inSelect = false;
906    oldJsAC.call(this, $input, db);
907  };
908  Drupal.jsAC.prototype = oldJsAC.prototype;
909
910  /**
911   * Handler for the "keyup" event.
912   *
913   * Extend from Drupal's autocomplete.js to automatically submit the form
914   * when Enter is hit.
915   */
916  var default_onkeyup = Drupal.jsAC.prototype.onkeyup;
917  Drupal.jsAC.prototype.onkeyup = function (input, e) {
918    if (!e) {
919      e = window.event;
920    }
921    // Fire standard function.
922    default_onkeyup.call(this, input, e);
923
924    if (13 == e.keyCode && $(input).hasClass('auto_submit')) {
925      var selector = getSetting(input, 'selector', ':submit');
926      $(selector, input.form).trigger('click');
927    }
928  };
929
930  /**
931   * Handler for the "keydown" event.
932   *
933   * Extend from Drupal's autocomplete.js to avoid ajax interfering with the
934   * autocomplete.
935   */
936  var default_onkeydown = Drupal.jsAC.prototype.onkeydown;
937  Drupal.jsAC.prototype.onkeydown = function (input, e) {
938    if (!e) {
939      e = window.event;
940    }
941    // Fire standard function.
942    default_onkeydown.call(this, input, e);
943
944    // Prevent that the ajax handling of Views fires too early and thus
945    // misses the form update.
946    if (13 == e.keyCode && $(input).hasClass('auto_submit')) {
947      e.preventDefault();
948      return false;
949    }
950  };
951
952  var default_select = Drupal.jsAC.prototype.select;
953  Drupal.jsAC.prototype.select = function(node) {
954    // Check if this is a Search API autocomplete field
955    if (!$(this.input).data('search-api-autocomplete-search')) {
956      // Not a Search API field
957      return default_select.call(this, node);
958    }
959
960    // Protect against an (potentially infinite) recursion.
961    if (this.inSelect) {
962      return false;
963    }
964    this.inSelect = true;
965
966    var autocompleteValue = $(node).data('autocompleteValue');
967    // Check whether this is not a suggestion but a "link".
968    if (autocompleteValue.charAt(0) == ' ') {
969      window.location.href = autocompleteValue.substr(1);
970      this.inSelect = false;
971      return false;
972    }
973    this.input.value = autocompleteValue;
974    $(this.input).trigger('autocompleteSelect', [node]);
975    if ($(this.input).hasClass('auto_submit')) {
976      if (typeof Drupal.search_api_ajax != 'undefined') {
977        // Use Search API Ajax to submit
978        Drupal.search_api_ajax.navigateQuery($(this.input).val());
979      }
980      else {
981        var selector = getSetting(this.input, 'selector', ':submit');
982        $(selector, this.input.form).trigger('click');
983      }
984      this.inSelect = false;
985      return true;
986    }
987    this.inSelect = false;
988  };
989
990  /**
991   * Overwrite default behaviour.
992   *
993   * Just always return true to make it possible to submit even when there was
994   * an autocomplete suggestion list open.
995   */
996  Drupal.autocompleteSubmit = function () {
997    $('#autocomplete').each(function () {
998      this.owner.hidePopup();
999    });
1000    return true;
1001  };
1002
1003  /**
1004   * Performs a cached and delayed search.
1005   */
1006  Drupal.ACDB.prototype.search = function (searchString) {
1007    this.searchString = searchString;
1008
1009    // Check allowed length of string for autocomplete.
1010    var data = $(this.owner.input).first().data('min-autocomplete-length');
1011    if (data && searchString.length < data) {
1012      return;
1013    }
1014
1015    // See if this string needs to be searched for anyway.
1016    if (searchString.match(/^\s*$/)) {
1017      return;
1018    }
1019
1020    // Prepare search string.
1021    searchString = searchString.replace(/^\s+/, '');
1022    searchString = searchString.replace(/\s+/g, ' ');
1023
1024    // See if this key has been searched for before.
1025    if (this.cache[searchString]) {
1026      return this.owner.found(this.cache[searchString]);
1027    }
1028
1029    var db = this;
1030    this.searchString = searchString;
1031
1032    // Initiate delayed search.
1033    if (this.timer) {
1034      clearTimeout(this.timer);
1035    }
1036    var sendAjaxRequest = function () {
1037      db.owner.setStatus('begin');
1038
1039      var url;
1040
1041      // Allow custom Search API Autocomplete overrides for specific searches.
1042      if (getSetting(db.owner.input, 'custom_path', false)) {
1043        var queryChar = db.uri.indexOf('?') >= 0 ? '&' : '?';
1044        url = db.uri + queryChar + 'search=' + encodeURIComponent(searchString);
1045      }
1046      else {
1047        // We use Drupal.encodePath instead of encodeURIComponent to allow
1048        // autocomplete search terms to contain slashes.
1049        url = db.uri + '/' + Drupal.encodePath(searchString);
1050      }
1051
1052      // Ajax GET request for autocompletion.
1053      $.ajax({
1054        type: 'GET',
1055        url: url,
1056        dataType: 'json',
1057        success: function (matches) {
1058          if (typeof matches.status == 'undefined' || matches.status != 0) {
1059            db.cache[searchString] = matches;
1060            // Verify if these are still the matches the user wants to see.
1061            if (db.searchString == searchString) {
1062              db.owner.found(matches);
1063            }
1064            db.owner.setStatus('found');
1065          }
1066        },
1067        error: function (xmlhttp) {
1068          if (xmlhttp.status) {
1069            alert(Drupal.ajaxError(xmlhttp, db.uri));
1070          }
1071        }
1072      });
1073    };
1074    // Make it possible to override the delay via a setting.
1075    var delay = getSetting(this.owner.input, 'delay', this.delay);
1076    if (delay > 0) {
1077      this.timer = setTimeout(sendAjaxRequest, delay);
1078    }
1079    else {
1080      sendAjaxRequest.apply();
1081    }
1082  };
1083}
1084
1085})(jQuery);
1086;
1087/*!
1088 * jQuery Cycle Plugin (with Transition Definitions)
1089 * Examples and documentation at: http://jquery.malsup.com/cycle/
1090 * Copyright (c) 2007-2013 M. Alsup
1091 * Version: 3.0.3 (11-JUL-2013)
1092 * Dual licensed under the MIT and GPL licenses.
1093 * http://jquery.malsup.com/license.html
1094 * Requires: jQuery v1.7.1 or later
1095 */
1096;(function($, undefined) {
1097"use strict";
1098
1099var ver = '3.0.3';
1100
1101function debug(s) {
1102	if ($.fn.cycle.debug)
1103		log(s);
1104}		
1105function log() {
1106	/*global console */
1107	if (window.console && console.log)
1108		console.log('[cycle] ' + Array.prototype.join.call(arguments,' '));
1109}
1110$.expr[':'].paused = function(el) {
1111	return el.cyclePause;
1112};
1113
1114
1115// the options arg can be...
1116//   a number  - indicates an immediate transition should occur to the given slide index
1117//   a string  - 'pause', 'resume', 'toggle', 'next', 'prev', 'stop', 'destroy' or the name of a transition effect (ie, 'fade', 'zoom', etc)
1118//   an object - properties to control the slideshow
1119//
1120// the arg2 arg can be...
1121//   the name of an fx (only used in conjunction with a numeric value for 'options')
1122//   the value true (only used in first arg == 'resume') and indicates
1123//	 that the resume should occur immediately (not wait for next timeout)
1124
1125$.fn.cycle = function(options, arg2) {
1126	var o = { s: this.selector, c: this.context };
1127
1128	// in 1.3+ we can fix mistakes with the ready state
1129	if (this.length === 0 && options != 'stop') {
1130		if (!$.isReady && o.s) {
1131			log('DOM not ready, queuing slideshow');
1132			$(function() {
1133				$(o.s,o.c).cycle(options,arg2);
1134			});
1135			return this;
1136		}
1137		// is your DOM ready?  http://docs.jquery.com/Tutorials:Introducing_$(document).ready()
1138		log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)'));
1139		return this;
1140	}
1141
1142	// iterate the matched nodeset
1143	return this.each(function() {
1144		var opts = handleArguments(this, options, arg2);
1145		if (opts === false)
1146			return;
1147
1148		opts.updateActivePagerLink = opts.updateActivePagerLink || $.fn.cycle.updateActivePagerLink;
1149		
1150		// stop existing slideshow for this container (if there is one)
1151		if (this.cycleTimeout)
1152			clearTimeout(this.cycleTimeout);
1153		this.cycleTimeout = this.cyclePause = 0;
1154		this.cycleStop = 0; // issue #108
1155
1156		var $cont = $(this);
1157		var $slides = opts.slideExpr ? $(opts.slideExpr, this) : $cont.children();
1158		var els = $slides.get();
1159
1160		if (els.length < 2) {
1161			log('terminating; too few slides: ' + els.length);
1162			return;
1163		}
1164
1165		var opts2 = buildOptions($cont, $slides, els, opts, o);
1166		if (opts2 === false)
1167			return;
1168
1169		var startTime = opts2.continuous ? 10 : getTimeout(els[opts2.currSlide], els[opts2.nextSlide], opts2, !opts2.backwards);
1170
1171		// if it's an auto slideshow, kick it off
1172		if (startTime) {
1173			startTime += (opts2.delay || 0);
1174			if (startTime < 10)
1175				startTime = 10;
1176			debug('first timeout: ' + startTime);
1177			this.cycleTimeout = setTimeout(function(){go(els,opts2,0,!opts.backwards);}, startTime);
1178		}
1179	});
1180};
1181
1182function triggerPause(cont, byHover, onPager) {
1183	var opts = $(cont).data('cycle.opts');
1184	if (!opts)
1185		return;
1186	var paused = !!cont.cyclePause;
1187	if (paused && opts.paused)
1188		opts.paused(cont, opts, byHover, onPager);
1189	else if (!paused && opts.resumed)
1190		opts.resumed(cont, opts, byHover, onPager);
1191}
1192
1193// process the args that were passed to the plugin fn
1194function handleArguments(cont, options, arg2) {
1195	if (cont.cycleStop === undefined)
1196		cont.cycleStop = 0;
1197	if (options === undefined || options === null)
1198		options = {};
1199	if (options.constructor == String) {
1200		switch(options) {
1201		case 'destroy':
1202		case 'stop':
1203			var opts = $(cont).data('cycle.opts');
1204			if (!opts)
1205				return false;
1206			cont.cycleStop++; // callbacks look for change
1207			if (cont.cycleTimeout)
1208				clearTimeout(cont.cycleTimeout);
1209			cont.cycleTimeout = 0;
1210			if (opts.elements)
1211				$(opts.elements).stop();
1212			$(cont).removeData('cycle.opts');
1213			if (options == 'destroy')
1214				destroy(cont, opts);
1215			return false;
1216		case 'toggle':
1217			cont.cyclePause = (cont.cyclePause === 1) ? 0 : 1;
1218			checkInstantResume(cont.cyclePause, arg2, cont);
1219			triggerPause(cont);
1220			return false;
1221		case 'pause':
1222			cont.cyclePause = 1;
1223			triggerPause(cont);
1224			return false;
1225		case 'resume':
1226			cont.cyclePause = 0;
1227			checkInstantResume(false, arg2, cont);
1228			triggerPause(cont);
1229			return false;
1230		case 'prev':
1231		case 'next':
1232			opts = $(cont).data('cycle.opts');
1233			if (!opts) {
1234				log('options not found, "prev/next" ignored');
1235				return false;
1236			}
1237			if (typeof arg2 == 'string') 
1238				opts.oneTimeFx = arg2;
1239			$.fn.cycle[options](opts);
1240			return false;
1241		default:
1242			options = { fx: options };
1243		}
1244		return options;
1245	}
1246	else if (options.constructor == Number) {
1247		// go to the requested slide
1248		var num = options;
1249		options = $(cont).data('cycle.opts');
1250		if (!options) {
1251			log('options not found, can not advance slide');
1252			return false;
1253		}
1254		if (num < 0 || num >= options.elements.length) {
1255			log('invalid slide index: ' + num);
1256			return false;
1257		}
1258		options.nextSlide = num;
1259		if (cont.cycleTimeout) {
1260			clearTimeout(cont.cycleTimeout);
1261			cont.cycleTimeout = 0;
1262		}
1263		if (typeof arg2 == 'string')
1264			options.oneTimeFx = arg2;
1265		go(options.elements, options, 1, num >= options.currSlide);
1266		return false;
1267	}
1268	return options;
1269	
1270	function checkInstantResume(isPaused, arg2, cont) {
1271		if (!isPaused && arg2 === true) { // resume now!
1272			var options = $(cont).data('cycle.opts');
1273			if (!options) {
1274				log('options not found, can not resume');
1275				return false;
1276			}
1277			if (cont.cycleTimeout) {
1278				clearTimeout(cont.cycleTimeout);
1279				cont.cycleTimeout = 0;
1280			}
1281			go(options.elements, options, 1, !options.backwards);
1282		}
1283	}
1284}
1285
1286function removeFilter(el, opts) {
1287	if (!$.support.opacity && opts.cleartype && el.style.filter) {
1288		try { el.style.removeAttribute('filter'); }
1289		catch(smother) {} // handle old opera versions
1290	}
1291}
1292
1293// unbind event handlers
1294function destroy(cont, opts) {
1295	if (opts.next)
1296		$(opts.next).unbind(opts.prevNextEvent);
1297	if (opts.prev)
1298		$(opts.prev).unbind(opts.prevNextEvent);
1299	
1300	if (opts.pager || opts.pagerAnchorBuilder)
1301		$.each(opts.pagerAnchors || [], function() {
1302			this.unbind().remove();
1303		});
1304	opts.pagerAnchors = null;
1305	$(cont).unbind('mouseenter.cycle mouseleave.cycle');
1306	if (opts.destroy) // callback
1307		opts.destroy(opts);
1308}
1309
1310// one-time initialization
1311function buildOptions($cont, $slides, els, options, o) {
1312	var startingSlideSpecified;
1313	// support metadata plugin (v1.0 and v2.0)
1314	var opts = $.extend({}, $.fn.cycle.defaults, options || {}, $.metadata ? $cont.metadata() : $.meta ? $cont.data() : {});
1315	var meta = $.isFunction($cont.data) ? $cont.data(opts.metaAttr) : null;
1316	if (meta)
1317		opts = $.extend(opts, meta);
1318	if (opts.autostop)
1319		opts.countdown = opts.autostopCount || els.length;
1320
1321	var cont = $cont[0];
1322	$cont.data('cycle.opts', opts);
1323	opts.$cont = $cont;
1324	opts.stopCount = cont.cycleStop;
1325	opts.elements = els;
1326	opts.before = opts.before ? [opts.before] : [];
1327	opts.after = opts.after ? [opts.after] : [];
1328
1329	// push some after callbacks
1330	if (!$.support.opacity && opts.cleartype)
1331		opts.after.push(function() { removeFilter(this, opts); });
1332	if (opts.continuous)
1333		opts.after.push(function() { go(els,opts,0,!opts.backwards); });
1334
1335	saveOriginalOpts(opts);
1336
1337	// clearType corrections
1338	if (!$.support.opacity && opts.cleartype && !opts.cleartypeNoBg)
1339		clearTypeFix($slides);
1340
1341	// container requires non-static position so that slides can be position within
1342	if ($cont.css('position') == 'static')
1343		$cont.css('position', 'relative');
1344	if (opts.width)
1345		$cont.width(opts.width);
1346	if (opts.height && opts.height != 'auto')
1347		$cont.height(opts.height);
1348
1349	if (opts.startingSlide !== undefined) {
1350		opts.startingSlide = parseInt(opts.startingSlide,10);
1351		if (opts.startingSlide >= els.length || opts.startSlide < 0)
1352			opts.startingSlide = 0; // catch bogus input
1353		else 
1354			startingSlideSpecified = true;
1355	}
1356	else if (opts.backwards)
1357		opts.startingSlide = els.length - 1;
1358	else
1359		opts.startingSlide = 0;
1360
1361	// if random, mix up the slide array
1362	if (opts.random) {
1363		opts.randomMap = [];
1364		for (var i = 0; i < els.length; i++)
1365			opts.randomMap.push(i);
1366		opts.randomMap.sort(function(a,b) {return Math.random() - 0.5;});
1367		if (startingSlideSpecified) {
1368			// try to find the specified starting slide and if found set start slide index in the map accordingly
1369			for ( var cnt = 0; cnt < els.length; cnt++ ) {
1370				if ( opts.startingSlide == opts.randomMap[cnt] ) {
1371					opts.randomIndex = cnt;
1372				}
1373			}
1374		}
1375		else {
1376			opts.randomIndex = 1;
1377			opts.startingSlide = opts.randomMap[1];
1378		}
1379	}
1380	else if (opts.startingSlide >= els.length)
1381		opts.startingSlide = 0; // catch bogus input
1382	opts.currSlide = opts.startingSlide || 0;
1383	var first = opts.startingSlide;
1384
1385	// set position and zIndex on all the slides
1386	$slides.css({position: 'absolute', top:0, left:0}).hide().each(function(i) {
1387		var z;
1388		if (opts.backwards)
1389			z = first ? i <= first ? els.length + (i-first) : first-i : els.length-i;
1390		else
1391			z = first ? i >= first ? els.length - (i-first) : first-i : els.length-i;
1392		$(this).css('z-index', z);
1393	});
1394
1395	// make sure first slide is visible
1396	$(els[first]).css('opacity',1).show(); // opacity bit needed to handle restart use case
1397	removeFilter(els[first], opts);
1398
1399	// stretch slides
1400	if (opts.fit) {
1401		if (!opts.aspect) {
1402	        if (opts.width)
1403	            $slides.width(opts.width);
1404	        if (opts.height && opts.height != 'auto')
1405	            $slides.height(opts.height);
1406		} else {
1407			$slides.each(function(){
1408				var $slide = $(this);
1409				var ratio = (opts.aspect === true) ? $slide.width()/$slide.height() : opts.aspect;
1410				if( opts.width && $slide.width() != opts.width ) {
1411					$slide.width( opts.width );
1412					$slide.height( opts.width / ratio );
1413				}
1414
1415				if( opts.height && $slide.height() < opts.height ) {
1416					$slide.height( opts.height );
1417					$slide.width( opts.height * ratio );
1418				}
1419			});
1420		}
1421	}
1422
1423	if (opts.center && ((!opts.fit) || opts.aspect)) {
1424		$slides.each(function(){
1425			var $slide = $(this);
1426			$slide.css({
1427				"margin-left": opts.width ?
1428					((opts.width - $slide.width()) / 2) + "px" :
1429					0,
1430				"margin-top": opts.height ?
1431					((opts.height - $slide.height()) / 2) + "px" :
1432					0
1433			});
1434		});
1435	}
1436
1437	if (opts.center && !opts.fit && !opts.slideResize) {
1438		$slides.each(function(){
1439			var $slide = $(this);
1440			$slide.css({
1441				"margin-left": opts.width ? ((opts.width - $slide.width()) / 2) + "px" : 0,
1442				"margin-top": opts.height ? ((opts.height - $slide.height()) / 2) + "px" : 0
1443			});
1444		});
1445	}
1446		
1447	// stretch container
1448	var reshape = (opts.containerResize || opts.containerResizeHeight) && $cont.innerHeight() < 1;
1449	if (reshape) { // do this only if container has no size http://tinyurl.com/da2oa9
1450		var maxw = 0, maxh = 0;
1451		for(var j=0; j < els.length; j++) {
1452			var $e = $(els[j]), e = $e[0], w = $e.outerWidth(), h = $e.outerHeight();
1453			if (!w) w = e.offsetWidth || e.width || $e.attr('width');
1454			if (!h) h = e.offsetHeight || e.height || $e.attr('height');
1455			maxw = w > maxw ? w : maxw;
1456			maxh = h > maxh ? h : maxh;
1457		}
1458		if (opts.containerResize && maxw > 0 && maxh > 0)
1459			$cont.css({width:maxw+'px',height:maxh+'px'});
1460		if (opts.containerResizeHeight && maxh > 0)
1461			$cont.css({height:maxh+'px'});
1462	}
1463
1464	var pauseFlag = false;  // https://github.com/malsup/cycle/issues/44
1465	if (opts.pause)
1466		$cont.bind('mouseenter.cycle', function(){
1467			pauseFlag = true;
1468			this.cyclePause++;
1469			triggerPause(cont, true);
1470		}).bind('mouseleave.cycle', function(){
1471				if (pauseFlag)
1472					this.cyclePause--;
1473				triggerPause(cont, true);
1474		});
1475
1476	if (supportMultiTransitions(opts) === false)
1477		return false;
1478
1479	// apparently a lot of people use image slideshows without height/width attributes on the images.
1480	// Cycle 2.50+ requires the sizing info for every slide; this block tries to deal with that.
1481	var requeue = false;
1482	options.requeueAttempts = options.requeueAttempts || 0;
1483	$slides.each(function() {
1484		// try to get height/width of each slide
1485		var $el = $(this);
1486		this.cycleH = (opts.fit && opts.height) ? opts.height : ($el.height() || this.offsetHeight || this.height || $el.attr('height') || 0);
1487		this.cycleW = (opts.fit && opts.width) ? opts.width : ($el.width() || this.offsetWidth || this.width || $el.attr('width') || 0);
1488
1489		if ( $el.is('img') ) {
1490			var loading = (this.cycleH === 0 && this.cycleW === 0 && !this.complete);
1491			// don't requeue for images that are still loading but have a valid size
1492			if (loading) {
1493				if (o.s && opts.requeueOnImageNotLoaded && ++options.requeueAttempts < 100) { // track retry count so we don't loop forever
1494					log(options.requeueAttempts,' - img slide not loaded, requeuing slideshow: ', this.src, this.cycleW, this.cycleH);
1495					setTimeout(function() {$(o.s,o.c).cycle(options);}, opts.requeueTimeout);
1496					requeue = true;
1497					return false; // break each loop
1498				}
1499				else {
1500					log('could not determine size of image: '+this.src, this.cycleW, this.cycleH);
1501				}
1502			}
1503		}
1504		return true;
1505	});
1506
1507	if (requeue)
1508		return false;
1509
1510	opts.cssBefore = opts.cssBefore || {};
1511	opts.cssAfter = opts.cssAfter || {};
1512	opts.cssFirst = opts.cssFirst || {};
1513	opts.animIn = opts.animIn || {};
1514	opts.animOut = opts.animOut || {};
1515
1516	$slides.not(':eq('+first+')').css(opts.cssBefore);
1517	$($slides[first]).css(opts.cssFirst);
1518
1519	if (opts.timeout) {
1520		opts.timeout = parseInt(opts.timeout,10);
1521		// ensure that timeout and speed settings are sane
1522		if (opts.speed.constructor == String)
1523			opts.speed = $.fx.speeds[opts.speed] || parseInt(opts.speed,10);
1524		if (!opts.sync)
1525			opts.speed = opts.speed / 2;
1526		
1527		var buffer = opts.fx == 'none' ? 0 : opts.fx == 'shuffle' ? 500 : 250;
1528		while((opts.timeout - opts.speed) < buffer) // sanitize timeout
1529			opts.timeout += opts.speed;
1530	}
1531	if (opts.easing)
1532		opts.easeIn = opts.easeOut = opts.easing;
1533	if (!opts.speedIn)
1534		opts.speedIn = opts.speed;
1535	if (!opts.speedOut)
1536		opts.speedOut = opts.speed;
1537
1538	opts.slideCount = els.length;
1539	opts.currSlide = opts.lastSlide = first;
1540	if (opts.random) {
1541		if (++opts.randomIndex == els.length)
1542			opts.randomIndex = 0;
1543		opts.nextSlide = opts.randomMap[opts.randomIndex];
1544	}
1545	else if (opts.backwards)
1546		opts.nextSlide = opts.startingSlide === 0 ? (els.length-1) : opts.startingSlide-1;
1547	else
1548		opts.nextSlide = opts.startingSlide >= (els.length-1) ? 0 : opts.startingSlide+1;
1549
1550	// run transition init fn
1551	if (!opts.multiFx) {
1552		var init = $.fn.cycle.transitions[opts.fx];
1553		if ($.isFunction(init))
1554			init($cont, $slides, opts);
1555		else if (opts.fx != 'custom' && !opts.multiFx) {
1556			log('unknown transition: ' + opts.fx,'; slideshow terminating');
1557			return false;
1558		}
1559	}
1560
1561	// fire artificial events
1562	var e0 = $slides[first];
1563	if (!opts.skipInitializationCallbacks) {
1564		if (opts.before.length)
1565			opts.before[0].apply(e0, [e0, e0, opts, true]);
1566		if (opts.after.length)
1567			opts.after[0].apply(e0, [e0, e0, opts, true]);
1568	}
1569	if (opts.next)
1570		$(opts.next).bind(opts.prevNextEvent,function(){return advance(opts,1);});
1571	if (opts.prev)
1572		$(opts.prev).bind(opts.prevNextEvent,function(){return advance(opts,0);});
1573	if (opts.pager || opts.pagerAnchorBuilder)
1574		buildPager(els,opts);
1575
1576	exposeAddSlide(opts, els);
1577
1578	return opts;
1579}
1580
1581// save off original opts so we can restore after clearing state
1582function saveOriginalOpts(opts) {
1583	opts.original = { before: [], after: [] };
1584	opts.original.cssBefore = $.extend({}, opts.cssBefore);
1585	opts.original.cssAfter  = $.extend({}, opts.cssAfter);
1586	opts.original.animIn	= $.extend({}, opts.animIn);
1587	opts.original.animOut   = $.extend({}, opts.animOut);
1588	$.each(opts.before, function() { opts.original.before.push(this); });
1589	$.each(opts.after,  function() { opts.original.after.push(this); });
1590}
1591
1592function supportMultiTransitions(opts) {
1593	var i, tx, txs = $.fn.cycle.transitions;
1594	// look for multiple effects
1595	if (opts.fx.indexOf(',') > 0) {
1596		opts.multiFx = true;
1597		opts.fxs = opts.fx.replace(/\s*/g,'').split(',');
1598		// discard any bogus effect names
1599		for (i=0; i < opts.fxs.length; i++) {
1600			var fx = opts.fxs[i];
1601			tx = txs[fx];
1602			if (!tx || !txs.hasOwnProperty(fx) || !$.isFunction(tx)) {
1603				log('discarding unknown transition: ',fx);
1604				opts.fxs.splice(i,1);
1605				i--;
1606			}
1607		}
1608		// if we have an empty list then we threw everything away!
1609		if (!opts.fxs.length) {
1610			log('No valid transitions named; slideshow terminating.');
1611			return false;
1612		}
1613	}
1614	else if (opts.fx == 'all') {  // auto-gen the list of transitions
1615		opts.multiFx = true;
1616		opts.fxs = [];
1617		for (var p in txs) {
1618			if (txs.hasOwnProperty(p)) {
1619				tx = txs[p];
1620				if (txs.hasOwnProperty(p) && $.isFunction(tx))
1621					opts.fxs.push(p);
1622			}
1623		}
1624	}
1625	if (opts.multiFx && opts.randomizeEffects) {
1626		// munge the fxs array to make effect selection random
1627		var r1 = Math.floor(Math.random() * 20) + 30;
1628		for (i = 0; i < r1; i++) {
1629			var r2 = Math.floor(Math.random() * opts.fxs.length);
1630			opts.fxs.push(opts.fxs.splice(r2,1)[0]);
1631		}
1632		debug('randomized fx sequence: ',opts.fxs);
1633	}
1634	return true;
1635}
1636
1637// provide a mechanism for adding slides after the slideshow has started
1638function exposeAddSlide(opts, els) {
1639	opts.addSlide = function(newSlide, prepend) {
1640		var $s = $(newSlide), s = $s[0];
1641		if (!opts.autostopCount)
1642			opts.countdown++;
1643		els[prepend?'unshift':'push'](s);
1644		if (opts.els)
1645			opts.els[prepend?'unshift':'push'](s); // shuffle needs this
1646		opts.slideCount = els.length;
1647
1648		// add the slide to the random map and resort
1649		if (opts.random) {
1650			opts.randomMap.push(opts.slideCount-1);
1651			opts.randomMap.sort(function(a,b) {return Math.random() - 0.5;});
1652		}
1653
1654		$s.css('position','absolute');
1655		$s[prepend?'prependTo':'appendTo'](opts.$cont);
1656
1657		if (prepend) {
1658			opts.currSlide++;
1659			opts.nextSlide++;
1660		}
1661
1662		if (!$.support.opacity && opts.cleartype && !opts.cleartypeNoBg)
1663			clearTypeFix($s);
1664
1665		if (opts.fit && opts.width)
1666			$s.width(opts.width);
1667		if (opts.fit && opts.height && opts.height != 'auto')
1668			$s.height(opts.height);
1669		s.cycleH = (opts.fit && opts.height) ? opts.height : $s.height();
1670		s.cycleW = (opts.fit && opts.width) ? opts.width : $s.width();
1671
1672		$s.css(opts.cssBefore);
1673
1674		if (opts.pager || opts.pagerAnchorBuilder)
1675			$.fn.cycle.createPagerAnchor(els.length-1, s, $(opts.pager), els, opts);
1676
1677		if ($.isFunction(opts.onAddSlide))
1678			opts.onAddSlide($s);
1679		else
1680			$s.hide(); // default behavior
1681	};
1682}
1683
1684// reset internal state; we do this on every pass in order to support multiple effects
1685$.fn.cycle.resetState = function(opts, fx) {
1686	fx = fx || opts.fx;
1687	opts.before = []; opts.after = [];
1688	opts.cssBefore = $.extend({}, opts.original.cssBefore);
1689	opts.cssAfter  = $.extend({}, opts.original.cssAfter);
1690	opts.animIn	= $.extend({}, opts.original.animIn);
1691	opts.animOut   = $.extend({}, opts.original.animOut);
1692	opts.fxFn = null;
1693	$.each(opts.original.before, function() { opts.before.push(this); });
1694	$.each(opts.original.after,  function() { opts.after.push(this); });
1695
1696	// re-init
1697	var init = $.fn.cycle.transitions[fx];
1698	if ($.isFunction(init))
1699		init(opts.$cont, $(opts.elements), opts);
1700};
1701
1702// this is the main engine fn, it handles the timeouts, callbacks and slide index mgmt
1703function go(els, opts, manual, fwd) {
1704	var p = opts.$cont[0], curr = els[opts.currSlide], next = els[opts.nextSlide];
1705
1706	// opts.busy is true if we're in the middle of an animation
1707	if (manual && opts.busy && opts.manualTrump) {
1708		// let manual transitions requests trump active ones
1709		debug('manualTrump in go(), stopping active transition');
1710		$(els).stop(true,true);
1711		opts.busy = 0;
1712		clearTimeout(p.cycleTimeout);
1713	}
1714
1715	// don't begin another timeout-based transition if there is one active
1716	if (opts.busy) {
1717		debug('transition active, ignoring new tx request');
1718		return;
1719	}
1720
1721
1722	// stop cycling if we have an outstanding stop request
1723	if (p.cycleStop != opts.stopCount || p.cycleTimeout === 0 && !manual)
1724		return;
1725
1726	// check to see if we should stop cycling based on autostop options
1727	if (!manual && !p.cyclePause && !opts.bounce &&
1728		((opts.autostop && (--opts.countdown <= 0)) ||
1729		(opts.nowrap && !opts.random && opts.nextSlide < opts.currSlide))) {
1730		if (opts.end)
1731			opts.end(opts);
1732		return;
1733	}
1734
1735	// if slideshow is paused, only transition on a manual trigger
1736	var changed = false;
1737	if ((manual || !p.cyclePause) && (opts.nextSlide != opts.currSlide)) {
1738		changed = true;
1739		var fx = opts.fx;
1740		// keep trying to get the slide size if we don't have it yet
1741		curr.cycleH = curr.cycleH || $(curr).height();
1742		curr.cycleW = curr.cycleW || $(curr).width();
1743		next.cycleH = next.cycleH || $(next).height();
1744		next.cycleW = next.cycleW || $(next).width();
1745
1746		// support multiple transition types
1747		if (opts.multiFx) {
1748			if (fwd && (opts.lastFx === undefined || ++opts.lastFx >= opts.fxs.length))
1749				opts.lastFx = 0;
1750			else if (!fwd && (opts.lastFx === undefined || --opts.lastFx < 0))
1751				opts.lastFx = opts.fxs.length - 1;
1752			fx = opts.fxs[opts.lastFx];
1753		}
1754
1755		// one-time fx overrides apply to:  $('div').cycle(3,'zoom');
1756		if (opts.oneTimeFx) {
1757			fx = opts.oneTimeFx;
1758			opts.oneTimeFx = null;
1759		}
1760
1761		$.fn.cycle.resetState(opts, fx);
1762
1763		// run the before callbacks
1764		if (opts.before.length)
1765			$.each(opts.before, function(i,o) {
1766				if (p.cycleStop != opts.stopCount) return;
1767				o.apply(next, [curr, next, opts, fwd]);
1768			});
1769
1770		// stage the after callacks
1771		var after = function() {
1772			opts.busy = 0;
1773			$.each(opts.after, function(i,o) {
1774				if (p.cycleStop != opts.stopCount) return;
1775				o.apply(next, [curr, next, opts, fwd]);
1776			});
1777			if (!p.cycleStop) {
1778				// queue next transition
1779				queueNext();
1780			}
1781		};
1782
1783		debug('tx firing('+fx+'); currSlide: ' + opts.currSlide + '; nextSlide: ' + opts.nextSlide);
1784		
1785		// get ready to perform the transition
1786		opts.busy = 1;
1787		if (opts.fxFn) // fx function provided?
1788			opts.fxFn(curr, next, opts, after, fwd, manual && opts.fastOnEvent);
1789		else if ($.isFunction($.fn.cycle[opts.fx])) // fx plugin ?
1790			$.fn.cycle[opts.fx](curr, next, opts, after, fwd, manual && opts.fastOnEvent);
1791		else
1792			$.fn.cycle.custom(curr, next, opts, after, fwd, manual && opts.fastOnEvent);
1793	}
1794	else {
1795		queueNext();
1796	}
1797
1798	if (changed || opts.nextSlide == opts.currSlide) {
1799		// calculate the next slide
1800		var roll;
1801		opts.lastSlide = opts.currSlide;
1802		if (opts.random) {
1803			opts.currSlide = opts.nextSlide;
1804			if (++opts.randomIndex == els.length) {
1805				opts.randomIndex = 0;
1806				opts.randomMap.sort(function(a,b) {return Math.random() - 0.5;});
1807			}
1808			opts.nextSlide = opts.randomMap[opts.randomIndex];
1809			if (opts.nextSlide == opts.currSlide)
1810				opts.nextSlide = (opts.currSlide == opts.slideCount - 1) ? 0 : opts.currSlide + 1;
1811		}
1812		else if (opts.backwards) {
1813			roll = (opts.nextSlide - 1) < 0;
1814			if (roll && opts.bounce) {
1815				opts.backwards = !opts.backwards;
1816				opts.nextSlide = 1;
1817				opts.currSlide = 0;
1818			}
1819			else {
1820				opts.nextSlide = roll ? (els.length-1) : opts.nextSlide-1;
1821				opts.currSlide = roll ? 0 : opts.nextSlide+1;
1822			}
1823		}
1824		else { // sequence
1825			roll = (opts.nextSlide + 1) == els.length;
1826			if (roll && opts.bounce) {
1827				opts.backwards = !opts.backwards;
1828				opts.nextSlide = els.length-2;
1829				opts.currSlide = els.length-1;
1830			}
1831			else {
1832				opts.nextSlide = roll ? 0 : opts.nextSlide+1;
1833				opts.currSlide = roll ? els.length-1 : opts.nextSlide-1;
1834			}
1835		}
1836	}
1837	if (changed && opts.pager)
1838		opts.updateActivePagerLink(opts.pager, opts.currSlide, opts.activePagerClass);
1839	
1840	function queueNext() {
1841		// stage the next transition
1842		var ms = 0, timeout = opts.timeout;
1843		if (opts.timeout && !opts.continuous) {
1844			ms = getTimeout(els[opts.currSlide], els[opts.nextSlide], opts, fwd);
1845         if (opts.fx == 'shuffle')
1846            ms -= opts.speedOut;
1847      }
1848		else if (opts.continuous && p.cyclePause) // continuous shows work off an after callback, not this timer logic
1849			ms = 10;
1850		if (ms > 0)
1851			p.cycleTimeout = setTimeout(function(){ go(els, opts, 0, !opts.backwards); }, ms);
1852	}
1853}
1854
1855// invoked after transition
1856$.fn.cycle.updateActivePagerLink = function(pager, currSlide, clsName) {
1857   $(pager).each(function() {
1858       $(this).children().removeClass(clsName).eq(currSlide).addClass(clsName);
1859   });
1860};
1861
1862// calculate timeout value for current transition
1863function getTimeout(curr, next, opts, fwd) {
1864	if (opts.timeoutFn) {
1865		// call user provided calc fn
1866		var t = opts.timeoutFn.call(curr,curr,next,opts,fwd);
1867		while (opts.fx != 'none' && (t - opts.speed) < 250) // sanitize timeout
1868			t += opts.speed;
1869		debug('calculated timeout: ' + t + '; speed: ' + opts.speed);
1870		if (t !== false)
1871			return t;
1872	}
1873	return opts.timeout;
1874}
1875
1876// expose next/prev function, caller must pass in state
1877$.fn.cycle.next = function(opts) { advance(opts,1); };
1878$.fn.cycle.prev = function(opts) { advance(opts,0);};
1879
1880// advance slide forward or back
1881function advance(opts, moveForward) {
1882	var val = moveForward ? 1 : -1;
1883	var els = opts.elements;
1884	var p = opts.$cont[0], timeout = p.cycleTimeout;
1885	if (timeout) {
1886		clearTimeout(timeout);
1887		p.cycleTimeout = 0;
1888	}
1889	if (opts.random && val < 0) {
1890		// move back to the previously display slide
1891		opts.randomIndex--;
1892		if (--opts.randomIndex == -2)
1893			opts.randomIndex = els.length-2;
1894		else if (opts.randomIndex == -1)
1895			opts.randomIndex = els.length-1;
1896		opts.nextSlide = opts.randomMap[opts.randomIndex];
1897	}
1898	else if (opts.random) {
1899		opts.nextSlide = opts.randomMap[opts.randomIndex];
1900	}
1901	else {
1902		opts.nextSlide = opts.currSlide + val;
1903		if (opts.nextSlide < 0) {
1904			if (opts.nowrap) return false;
1905			opts.nextSlide = els.length - 1;
1906		}
1907		else if (opts.nextSlide >= els.length) {
1908			if (opts.nowrap) return false;
1909			opts.nextSlide = 0;
1910		}
1911	}
1912
1913	var cb = opts.onPrevNextEvent || opts.prevNextClick; // prevNextClick is deprecated
1914	if ($.isFunction(cb))
1915		cb(val > 0, opts.nextSlide, els[opts.nextSlide]);
1916	go(els, opts, 1, moveForward);
1917	return false;
1918}
1919
1920function buildPager(els, opts) {
1921	var $p = $(opts.pager);
1922	$.each(els, function(i,o) {
1923		$.fn.cycle.createPagerAnchor(i,o,$p,els,opts);
1924	});
1925	opts.updateActivePagerLink(opts.pager, opts.startingSlide, opts.activePagerClass);
1926}
1927
1928$.fn.cycle.createPagerAnchor = function(i, el, $p, els, opts) {
1929	var a;
1930	if ($.isFunction(opts.pagerAnchorBuilder)) {
1931		a = opts.pagerAnchorBuilder(i,el);
1932		debug('pagerAnchorBuilder('+i+', el) returned: ' + a);
1933	}
1934	else
1935		a = '<a href="#">'+(i+1)+'</a>';
1936		
1937	if (!a)
1938		return;
1939	var $a = $(a);
1940	// don't reparent if anchor is in the dom
1941	if ($a.parents('body').length === 0) {
1942		var arr = [];
1943		if ($p.length > 1) {
1944			$p.each(function() {
1945				var $clone = $a.clone(true);
1946				$(this).append($clone);
1947				arr.push($clone[0]);
1948			});
1949			$a = $(arr);
1950		}
1951		else {
1952			$a.appendTo($p);
1953		}
1954	}
1955
1956	opts.pagerAnchors =  opts.pagerAnchors || [];
1957	opts.pagerAnchors.push($a);
1958	
1959	var pagerFn = function(e) {
1960		e.preventDefault();
1961		opts.nextSlide = i;
1962		var p = opts.$cont[0], timeout = p.cycleTimeout;
1963		if (timeout) {
1964			clearTimeout(timeout);
1965			p.cycleTimeout = 0;
1966		}
1967		var cb = opts.onPagerEvent || opts.pagerClick; // pagerClick is deprecated
1968		if ($.isFunction(cb))
1969			cb(opts.nextSlide, els[opts.nextSlide]);
1970		go(els,opts,1,opts.currSlide < i); // trigger the trans
1971//		return false; // <== allow bubble
1972	};
1973	
1974	if ( /mouseenter|mouseover/i.test(opts.pagerEvent) ) {
1975		$a.hover(pagerFn, function(){/* no-op */} );
1976	}
1977	else {
1978		$a.bind(opts.pagerEvent, pagerFn);
1979	}
1980	
1981	if ( ! /^click/.test(opts.pagerEvent) && !opts.allowPagerClickBubble)
1982		$a.bind('click.cycle', function(){return false;}); // suppress click
1983	
1984	var cont = opts.$cont[0];
1985	var pauseFlag = false; // https://github.com/malsup/cycle/issues/44
1986	if (opts.pauseOnPagerHover) {
1987		$a.hover(
1988			function() { 
1989				pauseFlag = true;
1990				cont.cyclePause++; 
1991				triggerPause(cont,true,true);
1992			}, function() { 
1993				if (pauseFlag)
1994					cont.cyclePause--; 
1995				triggerPause(cont,true,true);
1996			} 
1997		);
1998	}
1999};
2000
2001// helper fn to calculate the number of slides between the current and the next
2002$.fn.cycle.hopsFromLast = function(opts, fwd) {
2003	var hops, l = opts.lastSlide, c = opts.currSlide;
2004	if (fwd)
2005		hops = c > l ? c - l : opts.slideCount - l;
2006	else
2007		hops = c < l ? l - c : l + opts.slideCount - c;
2008	return hops;
2009};
2010
2011// fix clearType problems in ie6 by setting an explicit bg color
2012// (otherwise text slides look horrible during a fade transition)
2013function clearTypeFix($slides) {
2014	debug('applying clearType background-color hack');
2015	function hex(s) {
2016		s = parseInt(s,10).toString(16);
2017		return s.length < 2 ? '0'+s : s;
2018	}
2019	function getBg(e) {
2020		for ( ; e && e.nodeName.toLowerCase() != 'html'; e = e.parentNode) {
2021			var v = $.css(e,'background-color');
2022			if (v && v.indexOf('rgb') >= 0 ) {
2023				var rgb = v.match(/\d+/g);
2024				return '#'+ hex(rgb[0]) + hex(rgb[1]) + hex(rgb[2]);
2025			}
2026			if (v && v != 'transparent')
2027				return v;
2028		}
2029		return '#ffffff';
2030	}
2031	$slides.each(function() { $(this).css('background-color', getBg(this)); });
2032}
2033
2034// reset common props before the next transition
2035$.fn.cycle.commonReset = function(curr,next,opts,w,h,rev) {
2036	$(opts.elements).not(curr).hide();
2037	if (typeof opts.cssBefore.opacity == 'undefined')
2038		opts.cssBefore.opacity = 1;
2039	opts.cssBefore.display = 'block';
2040	if (opts.slideResize && w !== false && next.cycleW > 0)
2041		opts.cssBefore.width = next.cycleW;
2042	if (opts.slideResize && h !== false && next.cycleH > 0)
2043		opts.cssBefore.height = next.cycleH;
2044	opts.cssAfter = opts.cssAfter || {};
2045	opts.cssAfter.display = 'none';
2046	$(curr).css('zIndex',opts.slideCount + (rev === true ? 1 : 0));
2047	$(next).css('zIndex',opts.slideCount + (rev === true ? 0 : 1));
2048};
2049
2050// the actual fn for effecting a transition
2051$.fn.cycle.custom = function(curr, next, opts, cb, fwd, speedOverride) {
2052	var $l = $(curr), $n = $(next);
2053	var speedIn = opts.speedIn, speedOut = opts.speedOut, easeIn = opts.easeIn, easeOut = opts.easeOut, animInDelay = opts.animInDelay, animOutDelay = opts.animOutDelay;
2054	$n.css(opts.cssBefore);
2055	if (speedOverride) {
2056		if (typeof speedOverride == 'number')
2057			speedIn = speedOut = speedOverride;
2058		else
2059			speedIn = speedOut = 1;
2060		easeIn = easeOut = null;
2061	}
2062	var fn = function() {
2063		$n.delay(animInDelay).animate(opts.animIn, speedIn, easeIn, function() {
2064			cb();
2065		});
2066	};
2067	$l.delay(animOutDelay).animate(opts.animOut, speedOut, easeOut, function() {
2068		$l.css(opts.cssAfter);
2069		if (!opts.sync) 
2070			fn();
2071	});
2072	if (opts.sync) fn();
2073};
2074
2075// transition definitions - only fade is defined here, transition pack defines the rest
2076$.fn.cycle.transitions = {
2077	fade: function($cont, $slides, opts) {
2078		$slides.not(':eq('+opts.currSlide+')').css('opacity',0);
2079		opts.before.push(function(curr,next,opts) {
2080			$.fn.cycle.commonReset(curr,next,opts);
2081			opts.cssBefore.opacity = 0;
2082		});
2083		opts.animIn	   = { opacity: 1 };
2084		opts.animOut   = { opacity: 0 };
2085		opts.cssBefore = { top: 0, left: 0 };
2086	}
2087};
2088
2089$.fn.cycle.ver = function() { return ver; };
2090
2091// override these globally if you like (they are all optional)
2092$.fn.cycle.defaults = {
2093    activePagerClass: 'activeSlide', // class name used for the active pager link
2094    after:            null,     // transition callback (scope set to element that was shown):  function(currSlideElement, nextSlideElement, options, forwardFlag)
2095    allowPagerClickBubble: false, // allows or prevents click event on pager anchors from bubbling
2096    animIn:           null,     // properties that define how the slide animates in
2097    animInDelay:      0,        // allows delay before next slide transitions in	
2098    animOut:          null,     // properties that define how the slide animates out
2099    animOutDelay:     0,        // allows delay before current slide transitions out
2100    aspect:           false,    // preserve aspect ratio during fit resizing, cropping if necessary (must be used with fit option)
2101    autostop:         0,        // true to end slideshow after X transitions (where X == slide count)
2102    autostopCount:    0,        // number of transitions (optionally used with autostop to define X)
2103    backwards:        false,    // true to start slideshow at last slide and move backwards through the stack
2104    before:           null,     // transition callback (scope set to element to be shown):     function(currSlideElement, nextSlideElement, options, forwardFlag)
2105    center:           null,     // set to true to have cycle add top/left margin to each slide (use with width and height options)
2106    cleartype:        !$.support.opacity,  // true if clearType corrections should be applied (for IE)
2107    cleartypeNoBg:    false,    // set to true to disable extra cleartype fixing (leave false to force background color setting on slides)
2108    containerResize:  1,        // resize container to fit largest slide
2109    containerResizeHeight:  0,  // resize containers height to fit the largest slide but leave the width dynamic
2110    continuous:       0,        // true to start next transition immediately after current one completes
2111    cssAfter:         null,     // properties that defined the state of the slide after transitioning out
2112    cssBefore:        null,     // properties that define the initial state of the slide before transitioning in
2113    delay:            0,        // additional delay (in ms) for first transition (hint: can be negative)
2114    easeIn:           null,     // easing for "in" transition
2115    easeOut:          null,     // easing for "out" transition
2116    easing:           null,     // easing method for both in and out transitions
2117    end:              null,     // callback invoked when the slideshow terminates (use with autostop or nowrap options): function(options)
2118    fastOnEvent:      0,        // force fast transitions when triggered manually (via pager or prev/next); value == time in ms
2119    fit:              0,        // force slides to fit container
2120    fx:               'fade',   // name of transition effect (or comma separated names, ex: 'fade,scrollUp,shuffle')
2121    fxFn:             null,     // function used to control the transition: function(currSlideElement, nextSlideElement, options, afterCalback, forwardFlag)
2122    height:           'auto',   // container height (if the 'fit' option is true, the slides will be set to this height as well)
2123    manualTrump:      true,     // causes manual transition to stop an active transition instead of being ignored
2124    metaAttr:         'cycle',  // data- attribute that holds the option data for the slideshow
2125    next:             null,     // element, jQuery object, or jQuery selector string for the element to use as event trigger for next slide
2126    nowrap:           0,        // true to prevent slideshow from wrapping
2127    onPagerEvent:     null,     // callback fn for pager events: function(zeroBasedSlideIndex, slideElement)
2128    onPrevNextEvent:  null,     // callback fn for prev/next events: function(isNext, zeroBasedSlideIndex, slideElement)
2129    pager:            null,     // element, jQuery object, or jQuery selector string for the element to use as pager container
2130    pagerAnchorBuilder: null,   // callback fn for building anchor links:  function(index, DOMelement)
2131    pagerEvent:       'click.cycle', // name of event which drives the pager navigation
2132    pause:            0,        // true to enable "pause on hover"
2133    pauseOnPagerHover: 0,       // true to pause when hovering over pager link
2134    prev:             null,     // element, jQuery object, or jQuery selector string for the element to use as event trigger for previous slide
2135    prevNextEvent:    'click.cycle',// event which drives the manual transition to the previous or next slide
2136    random:           0,        // true for random, false for sequence (not applicable to shuffle fx)
2137    randomizeEffects: 1,        // valid when multiple effects are used; true to make the effect sequence random
2138    requeueOnImageNotLoaded: true, // requeue the slideshow if any image slides are not yet loaded
2139    requeueTimeout:   250,      // ms delay for requeue
2140    rev:              0,        // causes animations to transition in reverse (for effects that support it such as scrollHorz/scrollVert/shuffle)
2141    shuffle:          null,     // coords for shuffle animation, ex: { top:15, left: 200 }
2142    skipInitializationCallbacks: false, // set to true to disable the first before/after callback that occurs prior to any transition
2143    slideExpr:        null,     // expression for selecting slides (if something other than all children is required)
2144    slideResize:      1,        // force slide width/height to fixed size before every transition
2145    speed:            1000,     // speed of the transition (any valid fx speed value)
2146    speedIn:          null,     // speed of the 'in' transition
2147    speedOut:         null,     // speed of the 'out' transition
2148    startingSlide:    undefined,// zero-based index of the first slide to be displayed
2149    sync:             1,        // true if in/out transitions should occur simultaneously
2150    timeout:          4000,     // milliseconds between slide transitions (0 to disable auto advance)
2151    timeoutFn:        null,     // callback for determining per-slide timeout value:  function(currSlideElement, nextSlideElement, options, forwardFlag)
2152    updateActivePagerLink: null,// callback fn invoked to update the active pager link (adds/removes activePagerClass style)
2153    width:            null      // container width (if the 'fit' option is true, the slides will be set to this width as well)
2154};
2155
2156}
2156)(jQuery);
2157
2158
2159/*!
2160 * jQuery Cycle Plugin Transition Definitions
2161 * This script is a plugin for the jQuery Cycle Plugin
2162 * Examples and documentation at: http://malsup.com/jquery/cycle/
2163 * Copyright (c) 2007-2010 M. Alsup
2164 * Version:	 2.73
2165 * Dual licensed under the MIT and GPL licenses:
2166 * http://www.opensource.org/licenses/mit-license.php
2167 * http://www.gnu.org/licenses/gpl.html
2168 */
2169(function($) {
2170"use strict";
2171
2172//
2173// These functions define slide initialization and properties for the named
2174// transitions. To save file size feel free to remove any of these that you
2175// don't need.
2176//
2177$.fn.cycle.transitions.none = function($cont, $slides, opts) {
2178	opts.fxFn = function(curr,next,opts,after){
2179		$(next).show();
2180		$(curr).hide();
2181		after();
2182	};
2183};
2184
2185// not a cross-fade, fadeout only fades out the top slide
2186$.fn.cycle.transitions.fadeout = function($cont, $slides, opts) {
2187	$slides.not(':eq('+opts.currSlide+')').css({ display: 'block', 'opacity': 1 });
2188	opts.before.push(function(curr,next,opts,w,h,rev) {
2189		$(curr).css('zIndex',opts.slideCount + (rev !== true ? 1 : 0));
2190		$(next).css('zIndex',opts.slideCount + (rev !== true ? 0 : 1));
2191	});
2192	opts.animIn.opacity = 1;
2193	opts.animOut.opacity = 0;
2194	opts.cssBefore.opacity = 1;
2195	opts.cssBefore.display = 'block';
2196	opts.cssAfter.zIndex = 0;
2197};
2198
2199// scrollUp/Down/Left/Right
2200$.fn.cycle.transitions.scrollUp = function($cont, $slides, opts) {
2201	$cont.css('overflow','hidden');
2202	opts.before.push($.fn.cycle.commonReset);
2203	var h = $cont.height();
2204	opts.cssBefore.top = h;
2205	opts.cssBefore.left = 0;
2206	opts.cssFirst.top = 0;
2207	opts.animIn.top = 0;
2208	opts.animOut.top = -h;
2209};
2210$.fn.cycle.transitions.scrollDown = function($cont, $slides, opts) {
2211	$cont.css('overflow','hidden');
2212	opts.before.push($.fn.cycle.commonReset);
2213	var h = $cont.height();
2214	opts.cssFirst.top = 0;
2215	opts.cssBefore.top = -h;
2216	opts.cssBefore.left = 0;
2217	opts.animIn.top = 0;
2218	opts.animOut.top = h;
2219};
2220$.fn.cycle.transitions.scrollLeft = function($cont, $slides, opts) {
2221	$cont.css('overflow','hidden');
2222	opts.before.push($.fn.cycle.commonReset);
2223	var w = $cont.width();
2224	opts.cssFirst.left = 0;
2225	opts.cssBefore.left = w;
2226	opts.cssBefore.top = 0;
2227	opts.animIn.left = 0;
2228	opts.animOut.left = 0-w;
2229};
2230$.fn.cycle.transitions.scrollRight = function($cont, $slides, opts) {
2231	$cont.css('overflow','hidden');
2232	opts.before.push($.fn.cycle.commonReset);
2233	var w = $cont.width();
2234	opts.cssFirst.left = 0;
2235	opts.cssBefore.left = -w;
2236	opts.cssBefore.top = 0;
2237	opts.animIn.left = 0;
2238	opts.animOut.left = w;
2239};
2240$.fn.cycle.transitions.scrollHorz = function($cont, $slides, opts) {
2241	$cont.css('overflow','hidden').width();
2242	opts.before.push(function(curr, next, opts, fwd) {
2243		if (opts.rev)
2244			fwd = !fwd;
2245		$.fn.cycle.commonReset(curr,next,opts);
2246		opts.cssBefore.left = fwd ? (next.cycleW-1) : (1-next.cycleW);
2247		opts.animOut.left = fwd ? -curr.cycleW : curr.cycleW;
2248	});
2249	opts.cssFirst.left = 0;
2250	opts.cssBefore.top = 0;
2251	opts.animIn.left = 0;
2252	opts.animOut.top = 0;
2253};
2254$.fn.cycle.transitions.scrollVert = function($cont, $slides, opts) {
2255	$cont.css('overflow','hidden');
2256	opts.before.push(function(curr, next, opts, fwd) {
2257		if (opts.rev)
2258			fwd = !fwd;
2259		$.fn.cycle.commonReset(curr,next,opts);
2260		opts.cssBefore.top = fwd ? (1-next.cycleH) : (next.cycleH-1);
2261		opts.animOut.top = fwd ? curr.cycleH : -curr.cycleH;
2262	});
2263	opts.cssFirst.top = 0;
2264	opts.cssBefore.left = 0;
2265	opts.animIn.top = 0;
2266	opts.animOut.left = 0;
2267};
2268
2269// slideX/slideY
2270$.fn.cycle.transitions.slideX = function($cont, $slides, opts) {
2271	opts.before.push(function(curr, next, opts) {
2272		$(opts.elements).not(curr).hide();
2273		$.fn.cycle.commonReset(curr,next,opts,false,true);
2274		opts.animIn.width = next.cycleW;
2275	});
2276	opts.cssBefore.left = 0;
2277	opts.cssBefore.top = 0;
2278	opts.cssBefore.width = 0;
2279	opts.animIn.width = 'show';
2280	opts.animOut.width = 0;
2281};
2282$.fn.cycle.transitions.slideY = function($cont, $slides, opts) {
2283	opts.before.push(function(curr, next, opts) {
2284		$(opts.elements).not(curr).hide();
2285		$.fn.cycle.commonReset(curr,next,opts,true,false);
2286		opts.animIn.height = next.cycleH;
2287	});
2288	opts.cssBefore.left = 0;
2289	opts.cssBefore.top = 0;
2290	opts.cssBefore.height = 0;
2291	opts.animIn.height = 'show';
2292	opts.animOut.height = 0;
2293};
2294
2295// shuffle
2296$.fn.cycle.transitions.shuffle = function($cont, $slides, opts) {
2297	var i, w = $cont.css('overflow', 'visible').width();
2298	$slides.css({left: 0, top: 0});
2299	opts.before.push(function(curr,next,opts) {
2300		$.fn.cycle.commonReset(curr,next,opts,true,true,true);
2301	});
2302	// only adjust speed once!
2303	if (!opts.speedAdjusted) {
2304		opts.speed = opts.speed / 2; // shuffle has 2 transitions
2305		opts.speedAdjusted = true;
2306	}
2307	opts.random = 0;
2308	opts.shuffle = opts.shuffle || {left:-w, top:15};
2309	opts.els = [];
2310	for (i=0; i < $slides.length; i++)
2311		opts.els.push($slides[i]);
2312
2313	for (i=0; i < opts.currSlide; i++)
2314		opts.els.push(opts.els.shift());
2315
2316	// custom transition fn (hat tip to Benjamin Sterling for this bit of sweetness!)
2317	opts.fxFn = function(curr, next, opts, cb, fwd) {
2318		if (opts.rev)
2319			fwd = !fwd;
2320		var $el = fwd ? $(curr) : $(next);
2321		$(next).css(opts.cssBefore);
2322		var count = opts.slideCount;
2323		$el.animate(opts.shuffle, opts.speedIn, opts.easeIn, function() {
2324			var hops = $.fn.cycle.hopsFromLast(opts, fwd);
2325			for (var k=0; k < hops; k++) {
2326				if (fwd)
2327					opts.els.push(opts.els.shift());
2328				else
2329					opts.els.unshift(opts.els.pop());
2330			}
2331			if (fwd) {
2332				for (var i=0, len=opts.els.length; i < len; i++)
2333					$(opts.els[i]).css('z-index', len-i+count);
2334			}
2335			else {
2336				var z = $(curr).css('z-index');
2337				$el.css('z-index', parseInt(z,10)+1+count);
2338			}
2339			$el.animate({left:0, top:0}, opts.speedOut, opts.easeOut, function() {
2340				$(fwd ? this : curr).hide();
2341				if (cb) cb();
2342			});
2343		});
2344	};
2345	$.extend(opts.cssBefore, { display: 'block', opacity: 1, top: 0, left: 0 });
2346};
2347
2348// turnUp/Down/Left/Right
2349$.fn.cycle.transitions.turnUp = function($cont, $slides, opts) {
2350	opts.before.push(function(curr, next, opts) {
2351		$.fn.cycle.commonReset(curr,next,opts,true,false);
2352		opts.cssBefore.top = next.cycleH;
2353		opts.animIn.height = next.cycleH;
2354		opts.animOut.width = next.cycleW;
2355	});
2356	opts.cssFirst.top = 0;
2357	opts.cssBefore.left = 0;
2358	opts.cssBefore.height = 0;
2359	opts.animIn.top = 0;
2360	opts.animOut.height = 0;
2361};
2362$.fn.cycle.transitions.turnDown = function($cont, $slides, opts) {
2363	opts.before.push(function(curr, next, opts) {
2364		$.fn.cycle.commonReset(curr,next,opts,true,false);
2365		opts.animIn.height = next.cycleH;
2366		opts.animOut.top   = curr.cycleH;
2367	});
2368	opts.cssFirst.top = 0;
2369	opts.cssBefore.left = 0;
2370	opts.cssBefore.top = 0;
2371	opts.cssBefore.height = 0;
2372	opts.animOut.height = 0;
2373};
2374$.fn.cycle.transitions.turnLeft = function($cont, $slides, opts) {
2375	opts.before.push(function(curr, next, opts) {
2376		$.fn.cycle.commonReset(curr,next,opts,false,true);
2377		opts.cssBefore.left = next.cycleW;
2378		opts.animIn.width = next.cycleW;
2379	});
2380	opts.cssBefore.top = 0;
2381	opts.cssBefore.width = 0;
2382	opts.animIn.left = 0;
2383	opts.animOut.width = 0;
2384};
2385$.fn.cycle.transitions.turnRight = function($cont, $slides, opts) {
2386	opts.before.push(function(curr, next, opts) {
2387		$.fn.cycle.commonReset(curr,next,opts,false,true);
2388		opts.animIn.width = next.cycleW;
2389		opts.animOut.left = curr.cycleW;
2390	});
2391	$.extend(opts.cssBefore, { top: 0, left: 0, width: 0 });
2392	opts.animIn.left = 0;
2393	opts.animOut.width = 0;
2394};
2395
2396// zoom
2397$.fn.cycle.transitions.zoom = function($cont, $slides, opts) {
2398	opts.before.push(function(curr, next, opts) {
2399		$.fn.cycle.commonReset(curr,next,opts,false,false,true);
2400		opts.cssBefore.top = next.cycleH/2;
2401		opts.cssBefore.left = next.cycleW/2;
2402		$.extend(opts.animIn, { top: 0, left: 0, width: next.cycleW, height: next.cycleH });
2403		$.extend(opts.animOut, { width: 0, height: 0, top: curr.cycleH/2, left: curr.cycleW/2 });
2404	});
2405	opts.cssFirst.top = 0;
2406	opts.cssFirst.left = 0;
2407	opts.cssBefore.width = 0;
2408	opts.cssBefore.height = 0;
2409};
2410
2411// fadeZoom
2412$.fn.cycle.transitions.fadeZoom = function($cont, $slides, opts) {
2413	opts.before.push(function(curr, next, opts) {
2414		$.fn.cycle.commonReset(curr,next,opts,false,false);
2415		opts.cssBefore.left = next.cycleW/2;
2416		opts.cssBefore.top = next.cycleH/2;
2417		$.extend(opts.animIn, { top: 0, left: 0, width: next.cycleW, height: next.cycleH });
2418	});
2419	opts.cssBefore.width = 0;
2420	opts.cssBefore.height = 0;
2421	opts.animOut.opacity = 0;
2422};
2423
2424// blindX
2425$.fn.cycle.transitions.blindX = function($cont, $slides, opts) {
2426	var w = $cont.css('overflow','hidden').width();
2427	opts.before.push(function(curr, next, opts) {
2428		$.fn.cycle.commonReset(curr,next,opts);
2429		opts.animIn.width = next.cycleW;
2430		opts.animOut.left   = curr.cycleW;
2431	});
2432	opts.cssBefore.left = w;
2433	opts.cssBefore.top = 0;
2434	opts.animIn.left = 0;
2435	opts.animOut.left = w;
2436};
2437// blindY
2438$.fn.cycle.transitions.blindY = function($cont, $slides, opts) {
2439	var h = $cont.css('overflow','hidden').height();
2440	opts.before.push(function(curr, next, opts) {
2441		$.fn.cycle.commonReset(curr,next,opts);
2442		opts.animIn.height = next.cycleH;
2443		opts.animOut.top   = curr.cycleH;
2444	});
2445	opts.cssBefore.top = h;
2446	opts.cssBefore.left = 0;
2447	opts.animIn.top = 0;
2448	opts.animOut.top = h;
2449};
2450// blindZ
2451$.fn.cycle.transitions.blindZ = function($cont, $slides, opts) {
2452	var h = $cont.css('overflow','hidden').height();
2453	var w = $cont.width();
2454	opts.before.push(function(curr, next, opts) {
2455		$.fn.cycle.commonReset(curr,next,opts);
2456		opts.animIn.height = next.cycleH;
2457		opts.animOut.top   = curr.cycleH;
2458	});
2459	opts.cssBefore.top = h;
2460	opts.cssBefore.left = w;
2461	opts.animIn.top = 0;
2462	opts.animIn.left = 0;
2463	opts.animOut.top = h;
2464	opts.animOut.left = w;
2465};
2466
2467// growX - grow horizontally from centered 0 width
2468$.fn.cycle.transitions.growX = function($cont, $slides, opts) {
2469	opts.before.push(function(curr, next, opts) {
2470		$.fn.cycle.commonReset(curr,next,opts,false,true);
2471		opts.cssBefore.left = this.cycleW/2;
2472		opts.animIn.left = 0;
2473		opts.animIn.width = this.cycleW;
2474		opts.animOut.left = 0;
2475	});
2476	opts.cssBefore.top = 0;
2477	opts.cssBefore.width = 0;
2478};
2479// growY - grow vertically from centered 0 height
2480$.fn.cycle.transitions.growY = function($cont, $slides, opts) {
2481	opts.before.push(function(curr, next, opts) {
2482		$.fn.cycle.commonReset(curr,next,opts,true,false);
2483		opts.cssBefore.top = this.cycleH/2;
2484		opts.animIn.top = 0;
2485		opts.animIn.height = this.cycleH;
2486		opts.animOut.top = 0;
2487	});
2488	opts.cssBefore.height = 0;
2489	opts.cssBefore.left = 0;
2490};
2491
2492// curtainX - squeeze in both edges horizontally
2493$.fn.cycle.transitions.curtainX = function($cont, $slides, opts) {
2494	opts.before.push(function(curr, next, opts) {
2495		$.fn.cycle.commonReset(curr,next,opts,false,true,true);
2496		opts.cssBefore.left = next.cycleW/2;
2497		opts.animIn.left = 0;
2498		opts.animIn.width = this.cycleW;
2499		opts.animOut.left = curr.cycleW/2;
2500		opts.animOut.width = 0;
2501	});
2502	opts.cssBefore.top = 0;
2503	opts.cssBefore.width = 0;
2504};
2505// curtainY - squeeze in both edges vertically
2506$.fn.cycle.transitions.curtainY = function($cont, $slides, opts) {
2507	opts.before.push(function(curr, next, opts) {
2508		$.fn.cycle.commonReset(curr,next,opts,true,false,true);
2509		opts.cssBefore.top = next.cycleH/2;
2510		opts.animIn.top = 0;
2511		opts.animIn.height = next.cycleH;
2512		opts.animOut.top = curr.cycleH/2;
2513		opts.animOut.height = 0;
2514	});
2515	opts.cssBefore.height = 0;
2516	opts.cssBefore.left = 0;
2517};
2518
2519// cover - curr slide covered by next slide
2520$.fn.cycle.transitions.cover = function($cont, $slides, opts) {
2521	var d = opts.direction || 'left';
2522	var w = $cont.css('overflow','hidden').width();
2523	var h = $cont.height();
2524	opts.before.push(function(curr, next, opts) {
2525		$.fn.cycle.commonReset(curr,next,opts);
2526		opts.cssAfter.display = '';
2527		if (d == 'right')
2528			opts.cssBefore.left = -w;
2529		else if (d == 'up')
2530			opts.cssBefore.top = h;
2531		else if (d == 'down')
2532			opts.cssBefore.top = -h;
2533		else
2534			opts.cssBefore.left = w;
2535	});
2536	opts.animIn.left = 0;
2537	opts.animIn.top = 0;
2538	opts.cssBefore.top = 0;
2539	opts.cssBefore.left = 0;
2540};
2541
2542// uncover - curr slide moves off next slide
2543$.fn.cycle.transitions.uncover = function($cont, $slides, opts) {
2544	var d = opts.direction || 'left';
2545	var w = $cont.css('overflow','hidden').width();
2546	var h = $cont.height();
2547	opts.before.push(function(curr, next, opts) {
2548		$.fn.cycle.commonReset(curr,next,opts,true,true,true);
2549		if (d == 'right')
2550			opts.animOut.left = w;
2551		else if (d == 'up')
2552			opts.animOut.top = -h;
2553		else if (d == 'down')
2554			opts.animOut.top = h;
2555		else
2556			opts.animOut.left = -w;
2557	});
2558	opts.animIn.left = 0;
2559	opts.animIn.top = 0;
2560	opts.cssBefore.top = 0;
2561	opts.cssBefore.left = 0;
2562};
2563
2564// toss - move top slide and fade away
2565$.fn.cycle.transitions.toss = function($cont, $slides, opts) {
2566	var w = $cont.css('overflow','visible').width();
2567	var h = $cont.height();
2568	opts.before.push(function(curr, next, opts) {
2569		$.fn.cycle.commonReset(curr,next,opts,true,true,true);
2570		// provide default toss settings if animOut not provided
2571		if (!opts.animOut.left && !opts.animOut.top)
2572			$.extend(opts.animOut, { left: w*2, top: -h/2, opacity: 0 });
2573		else
2574			opts.animOut.opacity = 0;
2575	});
2576	opts.cssBefore.left = 0;
2577	opts.cssBefore.top = 0;
2578	opts.animIn.left = 0;
2579};
2580
2581// wipe - clip animation
2582$.fn.cycle.transitions.wipe = function($cont, $slides, opts) {
2583	var w = $cont.css('overflow','hidden').width();
2584	var h = $cont.height();
2585	opts.cssBefore = opts.cssBefore || {};
2586	var clip;
2587	if (opts.clip) {
2588		if (/l2r/.test(opts.clip))
2589			clip = 'rect(0px 0px '+h+'px 0px)';
2590		else if (/r2l/.test(opts.clip))
2591			clip = 'rect(0px '+w+'px '+h+'px '+w+'px)';
2592		else if (/t2b/.test(opts.clip))
2593			clip = 'rect(0px '+w+'px 0px 0px)';
2594		else if (/b2t/.test(opts.clip))
2595			clip = 'rect('+h+'px '+w+'px '+h+'px 0px)';
2596		else if (/zoom/.test(opts.clip)) {
2597			var top = parseInt(h/2,10);
2598			var left = parseInt(w/2,10);
2599			clip = 'rect('+top+'px '+left+'px '+top+'px '+left+'px)';
2600		}
2601	}
2602
2603	opts.cssBefore.clip = opts.cssBefore.clip || clip || 'rect(0px 0px 0px 0px)';
2604
2605	var d = opts.cssBefore.clip.match(/(\d+)/g);
2606	var t = parseInt(d[0],10), r = parseInt(d[1],10), b = parseInt(d[2],10), l = parseInt(d[3],10);
2607
2608	opts.before.push(function(curr, next, opts) {
2609		if (curr == next) return;
2610		var $curr = $(curr), $next = $(next);
2611		$.fn.cycle.commonReset(curr,next,opts,true,true,false);
2612		opts.cssAfter.display = 'block';
2613
2614		var step = 1, count = parseInt((opts.speedIn / 13),10) - 1;
2615		(function f() {
2616			var tt = t ? t - parseInt(step * (t/count),10) : 0;
2617			var ll = l ? l - parseInt(step * (l/count),10) : 0;
2618			var bb = b < h ? b + parseInt(step * ((h-b)/count || 1),10) : h;
2619			var rr = r < w ? r + parseInt(step * ((w-r)/count || 1),10) : w;
2620			$next.css({ clip: 'rect('+tt+'px '+rr+'px '+bb+'px '+ll+'px)' });
2621			(step++ <= count) ? setTimeout(f, 13) : $curr.css('display', 'none');
2622		})();
2623	});
2624	$.extend(opts.cssBefore, { display: 'block', opacity: 1, top: 0, left: 0 });
2625	opts.animIn	   = { left: 0 };
2626	opts.animOut   = { left: 0 };
2627};
2628
2629})(jQuery);
2630;
2631/**
2632 *  @file
2633 *  A simple jQuery Cycle Div Slideshow Rotator.
2634 */
2635
2636/**
2637 * This will set our initial behavior, by starting up each individual slideshow.
2638 */
2639(function ($) {
2640  Drupal.behaviors.viewsSlideshowCycle = {
2641    attach: function (context) {
2642      $('.views_slideshow_cycle_main:not(.viewsSlideshowCycle-processed)', context).addClass('viewsSlideshowCycle-processed').each(function() {
2643        var fullId = '#' + $(this).attr('id');
2644        var settings = Drupal.settings.viewsSlideshowCycle[fullId];
2645        settings.targetId = '#' + $(fullId + " :first").attr('id');
2646
2647        settings.slideshowId = settings.targetId.replace('#views_slideshow_cycle_teaser_section_', '');
2648        // Pager after function.
2649        var pager_after_fn = function(curr, next, opts) {
2650          // Need to do some special handling on first load.
2651          var slideNum = opts.currSlide;
2652          if (typeof settings.processedAfter == 'undefined' || !sett
2652ings.processedAfter) {
2653            settings.processedAfter = 1;
2654            slideNum = (typeof settings.opts.startingSlide == 'undefined') ? 0 : settings.opts.startingSlide;
2655          }
2656          if (settings.pause_after_slideshow) {
2657            opts.counter += 1;
2658            if (opts.counter == settings.num_divs + 1) {
2659              opts.counter = 1;
2660              Drupal.viewsSlideshow.action({ "action": 'pause', "slideshowID": settings.slideshowId, "force": true });
2661            }
2662          }
2663          Drupal.viewsSlideshow.action({ "action": 'transitionEnd', "slideshowID": settings.slideshowId, "slideNum": slideNum });
2664        }
2665        // Pager before function.
2666        var pager_before_fn = function(curr, next, opts) {
2667          $(document).trigger('drupal:views_slideshow_cycle:before', {
2668            curr: curr, next: next, opts: opts, settings: settings
2669          });
2670
2671          var slideNum = opts.nextSlide;
2672
2673          // Remember last slide.
2674          if (settings.remember_slide) {
2675            createCookie(settings.vss_id, slideNum, settings.remember_slide_days);
2676          }
2677
2678          // Make variable height.
2679          if (!settings.fixed_height) {
2680            //get the height of the current slide
2681            var $ht = $(next).height();
2682            //set the container's height to that of the current slide
2683            $(next).parent().animate({height: $ht});
2684          }
2685
2686          // Need to do some special handling on first load.
2687          if (typeof settings.processedBefore == 'undefined' || !settings.processedBefore) {
2688            settings.processedBefore = 1;
2689            slideNum = (typeof opts.startingSlide == 'undefined') ? 0 : opts.startingSlide;
2690          }
2691
2692          Drupal.viewsSlideshow.action({ "action": 'transitionBegin', "slideshowID": settings.slideshowId, "slideNum": slideNum });
2693        }
2694        settings.loaded = false;
2695
2696        settings.opts = {
2697          speed:settings.speed,
2698          timeout:settings.timeout,
2699          delay:settings.delay,
2700          sync:settings.sync,
2701          random:settings.random,
2702          nowrap:settings.nowrap,
2703          pause_after_slideshow:settings.pause_after_slideshow,
2704          counter:0,
2705          after:pager_after_fn,
2706          before:pager_before_fn,
2707          cleartype:(settings.cleartype)? true : false,
2708          cleartypeNoBg:(settings.cleartypenobg)? true : false
2709        }
2710
2711        // Set the starting slide if we are supposed to remember the slide
2712        if (settings.remember_slide) {
2713          var startSlide = readCookie(settings.vss_id);
2714          if (startSlide == null) {
2715            startSlide = 0;
2716          }
2717          settings.opts.startingSlide = parseInt(startSlide);
2718        }
2719
2720        if (settings.effect == 'none') {
2721          settings.opts.speed = 1;
2722        }
2723        else {
2724          settings.opts.fx = settings.effect;
2725        }
2726
2727        // Take starting item from fragment.
2728        var hash = location.hash;
2729        if (hash) {
2730          var hash = hash.replace('#', '');
2731          var aHash = hash.split(';');
2732          var aHashLen = aHash.length;
2733
2734          // Loop through all the possible starting points.
2735          for (var i = 0; i < aHashLen; i++) {
2736            // Split the hash into two parts. One part is the slideshow id the
2737            // other is the slide number.
2738            var initialInfo = aHash[i].split(':');
2739            // The id in the hash should match our slideshow.
2740            // The slide number chosen shouldn't be larger than the number of
2741            // slides we have.
2742            if (settings.slideshowId == initialInfo[0] && settings.num_divs > initialInfo[1]) {
2743              settings.opts.startingSlide = parseInt(initialInfo[1]);
2744            }
2745          }
2746        }
2747
2748        // Pause on hover.
2749        if (settings.pause) {
2750          var mouseIn = function() {
2751            Drupal.viewsSlideshow.action({ "action": 'pause', "slideshowID": settings.slideshowId });
2752          }
2753
2754          var mouseOut = function() {
2755            Drupal.viewsSlideshow.action({ "action": 'play', "slideshowID": settings.slideshowId });
2756          }
2757
2758          if (jQuery.fn.hoverIntent) {
2759            $('#views_slideshow_cycle_teaser_section_' + settings.vss_id).hoverIntent(mouseIn, mouseOut);
2760          }
2761          else {
2762            $('#views_slideshow_cycle_teaser_section_' + settings.vss_id).hover(mouseIn, mouseOut);
2763          }
2764        }
2765
2766        // Play on hover.
2767        if (settings.play_on_hover) {
2768          var mouseIn = function() {
2769            Drupal.viewsSlideshow.action({ "action": 'play', "slideshowID": settings.slideshowId, "force": true });
2770          }
2771
2772          var mouseOut = function() {
2773            Drupal.viewsSlideshow.action({ "action": 'pause', "slideshowID": settings.slideshowId });
2774          }
2775
2776          if (jQuery.fn.hoverIntent) {
2777            $('#views_slideshow_cycle_teaser_section_' + settings.vss_id).hoverIntent(mouseIn, mouseOut);
2778          }
2779          else {
2780            $('#views_slideshow_cycle_teaser_section_' + settings.vss_id).hover(mouseIn, mouseOut);
2781          }
2782        }
2783
2784        // Pause on clicking of the slide.
2785        if (settings.pause_on_click) {
2786          $('#views_slideshow_cycle_teaser_section_' + settings.vss_id).click(function() {
2787            Drupal.viewsSlideshow.action({ "action": 'pause', "slideshowID": settings.slideshowId, "force": true });
2788          });
2789        }
2790
2791        if (typeof JSON != 'undefined') {
2792          var advancedOptions = JSON.parse(settings.advanced_options);
2793          for (var option in advancedOptions) {
2794            switch(option) {
2795
2796              // Standard Options
2797              case "activePagerClass":
2798              case "allowPagerClickBubble":
2799              case "autostop":
2800              case "autostopCount":
2801              case "backwards":
2802              case "bounce":
2803              case "cleartype":
2804              case "cleartypeNoBg":
2805              case "containerResize":
2806              case "continuous":
2807              case "delay":
2808              case "easeIn":
2809              case "easeOut":
2810              case "easing":
2811              case "fastOnEvent":
2812              case "fit":
2813              case "fx":
2814              case "manualTrump":
2815              case "metaAttr":
2816              case "next":
2817              case "nowrap":
2818              case "pager":
2819              case "pagerEvent":
2820              case "pause":
2821              case "pauseOnPagerHover":
2822              case "prev":
2823              case "prevNextEvent":
2824              case "random":
2825              case "randomizeEffects":
2826              case "requeueOnImageNotLoaded":
2827              case "requeueTimeout":
2828              case "rev":
2829              case "slideExpr":
2830              case "slideResize":
2831              case "speed":
2832              case "speedIn":
2833              case "speedOut":
2834              case "startingSlide":
2835              case "sync":
2836              case "timeout":
2837                var optionValue = advancedOptions[option];
2838                optionValue = Drupal.viewsSlideshowCycle.advancedOptionCleanup(optionValue);
2839                settings.opts[option] = optionValue;
2840                break;
2841
2842              // If width is set we need to disable resizing.
2843              case "width":
2844                var optionValue = advancedOptions["width"];
2845                optionValue = Drupal.viewsSlideshowCycle.advancedOptionCleanup(optionValue);
2846                settings.opts["width"] = optionValue;
2847                settings.opts["containerResize"] = 0;
2848                break;
2849
2850              // If height is set we need to set fixed_height to true.
2851              case "height":
2852                var optionValue = advancedOptions["height"];
2853                optionValue = Drupal.viewsSlideshowCycle.advancedOptionCleanup(optionValue);
2854                settings.opts["height"] = optionValue;
2855                settings.fixed_height = 1;
2856                break;
2857
2858              // These process options that look like {top:50, bottom:20}
2859              case "animIn":
2860              case "animInDelay":
2861              case "animOut":
2862              case "animOutDelay":
2863              case "cssBefore":
2864              case "cssAfter":
2865              case "shuffle":
2866                var cssValue = advancedOptions[option];
2867                cssValue = Drupal.viewsSlideshowCycle.advancedOptionCleanup(cssValue);
2868                settings.opts[option] = eval('(' + cssValue + ')');
2869                break;
2870
2871              // These options have their own functions.
2872              case "after":
2873                var afterValue = advancedOptions[option];
2874                afterValue = Drupal.viewsSlideshowCycle.advancedOptionCleanup(afterValue);
2875                // transition callback (scope set to element that was shown): function(currSlideElement, nextSlideElement, options, forwardFlag)
2876                settings.opts[option] = function(currSlideElement, nextSlideElement, options, forwardFlag) {
2877                  pager_after_fn(currSlideElement, nextSlideElement, options);
2878                  eval(afterValue);
2879                }
2880                break;
2881
2882              case "before":
2883                var beforeValue = advancedOptions[option];
2884                beforeValue = Drupal.viewsSlideshowCycle.advancedOptionCleanup(beforeValue);
2885                // transition callback (scope set to element to be shown):     function(currSlideElement, nextSlideElement, options, forwardFlag)
2886                settings.opts[option] = function(currSlideElement, nextSlideElement, options, forwardFlag) {
2887                  pager_before_fn(currSlideElement, nextSlideElement, options);
2888                  eval(beforeValue);
2889                }
2890                break;
2891
2892              case "end":
2893                var endValue = advancedOptions[option];
2894                endValue = Drupal.viewsSlideshowCycle.advancedOptionCleanup(endValue);
2895                // callback invoked when the slideshow terminates (use with autostop or nowrap options): function(options)
2896                settings.opts[option] = function(options) {
2897                  eval(endValue);
2898                }
2899                break;
2900
2901              case "fxFn":
2902                var fxFnValue = advancedOptions[option];
2903                fxFnValue = Drupal.viewsSlideshowCycle.advancedOptionCleanup(fxFnValue);
2904                // function used to control the transition: function(currSlideElement, nextSlideElement, options, afterCalback, forwardFlag)
2905                settings.opts[option] = function(currSlideElement, nextSlideElement, options, afterCalback, forwardFlag) {
2906                  eval(fxFnValue);
2907                }
2908                break;
2909
2910              case "onPagerEvent":
2911                var onPagerEventValue = advancedOptions[option];
2912                onPagerEventValue = Drupal.viewsSlideshowCycle.advancedOptionCleanup(onPagerEventValue);
2913                settings.opts[option] = function(zeroBasedSlideIndex, slideElement) {
2914                  eval(onPagerEventValue);
2915                }
2916                break;
2917
2918              case "onPrevNextEvent":
2919                var onPrevNextEventValue = advancedOptions[option];
2920                onPrevNextEventValue = Drupal.viewsSlideshowCycle.advancedOptionCleanup(onPrevNextEventValue);
2921                settings.opts[option] = function(isNext, zeroBasedSlideIndex, slideElement) {
2922                  eval(onPrevNextEventValue);
2923                }
2924                break;
2925
2926              case "pagerAnchorBuilder":
2927                var pagerAnchorBuilderValue = advancedOptions[option];
2928                pagerAnchorBuilderValue = Drupal.viewsSlideshowCycle.advancedOptionCleanup(pagerAnchorBuilderValue);
2929                // callback fn for building anchor links:  function(index, DOMelement)
2930                settings.opts[option] = function(index, DOMelement) {
2931                  var returnVal = '';
2932                  eval(pagerAnchorBuilderValue);
2933                  return returnVal;
2934                }
2935                break;
2936
2937              case "pagerClick":
2938                var pagerClickValue = advancedOptions[option];
2939                pagerClickValue = Drupal.viewsSlideshowCycle.advancedOptionCleanup(pagerClickValue);
2940                // callback fn for pager clicks:    function(zeroBasedSlideIndex, slideElement)
2941                settings.opts[option] = function(zeroBasedSlideIndex, slideElement) {
2942                  eval(pagerClickValue);
2943                }
2944                break;
2945
2946              case "paused":
2947                var pausedValue = advancedOptions[option];
2948                pausedValue = Drupal.viewsSlideshowCycle.advancedOptionCleanup(pausedValue);
2949                // undocumented callback when slideshow is paused:    function(cont, opts, byHover)
2950                settings.opts[option] = function(cont, opts, byHover) {
2951                  eval(pausedValue);
2952                }
2953                break;
2954
2955              case "resumed":
2956                var resumedValue = advancedOptions[option];
2957                resumedValue = Drupal.viewsSlideshowCycle.advancedOptionCleanup(resumedValue);
2958                // undocumented callback when slideshow is resumed:    function(cont, opts, byHover)
2959                settings.opts[option] = function(cont, opts, byHover) {
2960                  eval(resumedValue);
2961                }
2962                break;
2963
2964              case "timeoutFn":
2965                var timeoutFnValue = advancedOptions[option];
2966                timeoutFnValue = Drupal.viewsSlideshowCycle.advancedOptionCleanup(timeoutFnValue);
2967                settings.opts[option] = function(currSlideElement, nextSlideElement, options, forwardFlag) {
2968                  // Set a sane return value unless function overrides it.
2969                  var returnVal = settings.timeout;
2970                  eval(timeoutFnValue);
2971                  return returnVal;
2972                }
2973                break;
2974
2975              case "updateActivePagerLink":
2976                var updateActivePagerLinkValue = advancedOptions[option];
2977                updateActivePagerLinkValue = Drupal.viewsSlideshowCycle.advancedOptionCleanup(updateActivePagerLinkValue);
2978                // callback fn invoked to update the active pager link (adds/removes activePagerClass style)
2979                settings.opts[option] = function(pager, currSlideIndex) {
2980                  eval(updateActivePagerLinkValue);
2981                }
2982                break;
2983            }
2984          }
2985        }
2986
2987        // If selected wait for the images to be loaded.
2988        // otherwise just load the slideshow.
2989        if (settings.wait_for_image_load) {
2990          // For IE/Chrome/Opera we if there are images then we need to make
2991          // sure the images are loaded before starting the slideshow.
2992          settings.totalImages = $(settings.targetId + ' img').length;
2993          if (settings.totalImages) {
2994            settings.loadedImages = 0;
2995
2996            // Add a load event for each image.
2997            $(settings.targetId + ' img').each(function() {
2998              var $imageElement = $(this);
2999              $imageElement.bind('load', function () {
3000                Drupal.viewsSlideshowCycle.imageWait(fullId);
3001              });
3002
3003              // Removing the source and adding it again will fire the load event.
3004              var imgSrc = $imageElement.attr('src');
3005              $imageElement.attr('src', '');
3006              $imageElement.attr('src', imgSrc);
3007            });
3008
3009            // We need to set a timeout so that the slideshow doesn't wait
3010            // indefinitely for all images to load.
3011            setTimeout("Drupal.viewsSlideshowCycle.load('" + fullId + "')", settings.wait_for_image_load_timeout);
3012          }
3013          else {
3014            Drupal.viewsSlideshowCycle.load(fullId);
3015          }
3016        }
3017        else {
3018          Drupal.viewsSlideshowCycle.load(fullId);
3019        }
3020      });
3021    }
3022  };
3023
3024  /**
3025   * Views Slideshow swipe support.
3026   */
3027  Drupal.behaviors.viewsSlideshowSwipe = {
3028    attach: function (context) {
3029      var isTouch = (('ontouchstart' in window) || (navigator.msMaxTouchPoints > 0));
3030      if (isTouch === true && $('.views-slideshow-cycle-main-frame').length) {
3031        var $slider = $('.views-slideshow-cycle-main-frame'),
3032          opts = {
3033            start: {x: 0, y: 0},
3034            end: {x: 0, y: 0},
3035            hdiff: 0,
3036            vdiff: 0,
3037            length: 0,
3038            angle: null,
3039            direction: null,
3040          },
3041          optsReset = $.extend(true, {}, opts),
3042         H_THRESHOLD =  110, // roughly one inch effective resolution on ipad
3043         V_THRESHOLD = 50;
3044        $slider.data('bw', opts)
3045        .bind('touchstart.cycle', function (e) {
3046          var touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0];
3047          if (e.originalEvent.touches.length == 1) {
3048            var data = $(this).data('bw');
3049            data.start.x = touch.pageX;
3050            data.start.y = touch.pageY;
3051            $(this).data('bw', data);
3052          }
3053        })
3054        .bind('touchend.cycle', function (e) {
3055          var touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0];
3056          var data = $(this).data('bw');
3057          data.end.x = touch.pageX;
3058          data.end.y = touch.pageY;
3059          $(this).data('bw', data);
3060          if (data.start.x != 0 && data.start.y != 0) {
3061            data.vdiff = data.start.x - data.end.x;
3062            data.hdiff = data.end.y - data.start.y;
3063            if (Math.abs(data.vdiff) == data.start.x && Math.abs(data.hdiff) == data.start.y) {
3064              data.vdiff = 0;
3065              data.hdiff = 0;
3066            }
3067            var length = Math.round(Math.sqrt(Math.pow(data.vdiff,2) + Math.pow(data.hdiff,2)));
3068            var rads = Math.atan2(data.hdiff, data.vdiff);
3069            var angle = Math.round(rads*180/Math.PI);
3070            if (angle < 0) { angle = 360 - Math.abs(angle); }
3071            if (length > H_THRESHOLD && V_THRESHOLD > data.hdiff) {
3072              e.preventDefault();
3073              if (angle > 135 && angle < 225) {
3074                var cyopt = $slider.data('cycle.opts');
3075                if (cyopt.currSlide > 0) {
3076                  $slider.cycle((cyopt.currSlide - 1), 'scrollRight');
3077                }
3078                else {
3079                   $slider.cycle((cyopt.slideCount - 1), 'scrollRight');
3080                }
3081              }
3082              else if (angle > 315 || angle < 45) {
3083                $slider.cycle('next');
3084              }
3085            }
3086          }
3087          data = $.extend(true, {}, optsReset);
3088        });
3089      }
3090    }
3091  };
3092
3093  Drupal.viewsSlideshowCycle = Drupal.viewsSlideshowCycle || {};
3094
3095  // Cleanup the values of advanced options.
3096  Drupal.viewsSlideshowCycle.advancedOptionCleanup = function(value) {
3097    value = $.trim(value);
3098    value = value.replace(/\n/g, '');
3099    if (value.match(/^[\d.]+%$/)) {
3100      // noop
3101    }
3102    else if (!isNaN(parseInt(value))) {
3103      value = parseInt(value);
3104    }
3105    else if (value.toLowerCase() == 'true') {
3106      value = true;
3107    }
3108    else if (value.toLowerCase() == 'false') {
3109      value = false;
3110    }
3111
3112    return value;
3113  }
3114
3115  // This checks to see if all the images have been loaded.
3116  // If they have then it starts the slideshow.
3117  Drupal.viewsSlideshowCycle.imageWait = function(fullId) {
3118    if (++Drupal.settings.viewsSlideshowCycle[fullId].loadedImages == Drupal.settings.viewsSlideshowCycle[fullId].totalImages) {
3119      Drupal.viewsSlideshowCycle.load(fullId);
3120    }
3121  };
3122
3123  // Start the slideshow.
3124  Drupal.viewsSlideshowCycle.load = function (fullId) {
3125    var settings = Drupal.settings.viewsSlideshowCycle[fullId];
3126
3127    // Make sure the slideshow isn't already loaded.
3128    if (!settings.loaded) {
3129      $(settings.targetId).cycle(settings.opts);
3130      $(settings.targetId).parent().parent().addClass('views-slideshow-cycle-processed');
3131      settings.loaded = true;
3132
3133      // Start Paused
3134      if (settings.start_paused) {
3135        Drupal.viewsSlideshow.action({ "action": 'pause', "slideshowID": settings.slideshowId, "force": true });
3136      }
3137
3138      // Pause if hidden.
3139      if (settings.pause_when_hidden) {
3140        var checkPause = function(settings) {
3141          // If the slideshow is visible and it is paused then resume.
3142          // otherwise if the slideshow is not visible and it is not paused then
3143          // pause it.
3144          var visible = viewsSlideshowCycleIsVisible(settings.targetId, settings.pause_when_hidden_type, settings.amount_allowed_visible);
3145          if (visible) {
3146            Drupal.viewsSlideshow.action({ "action": 'play', "slideshowID": settings.slideshowId });
3147          }
3148          else {
3149            Drupal.viewsSlideshow.action({ "action": 'pause', "slideshowID": settings.slideshowId });
3150          }
3151        }
3152
3153        // Check when scrolled.
3154        $(window).scroll(function() {
3155         checkPause(settings);
3156        });
3157
3158        // Check when the window is resized.
3159        $(window).resize(function() {
3160          checkPause(settings);
3161        });
3162      }
3163    }
3164  };
3165
3166  Drupal.viewsSlideshowCycle.pause = function (options) {
3167    //Eat TypeError, cycle doesn't handle pause well if options isn't defined.
3168    try{
3169      if (options.pause_in_middle && $.fn.pause) {
3170        $('#views_slideshow_cycle_teaser_section_' + options.slideshowID).pause();
3171      }
3172      else {
3173        $('#views_slideshow_cycle_teaser_section_' + options.slideshowID).cycle('pause');
3174      }
3175    }
3176    catch(e){
3177      if(!e instanceof TypeError){
3178        throw e;
3179      }
3180    }
3181  };
3182
3183  Drupal.viewsSlideshowCycle.play = function (options) {
3184    Drupal.settings.viewsSlideshowCycle['#views_slideshow_cycle_main_' + options.slideshowID].paused = false;
3185    if (options.pause_in_middle && $.fn.resume) {
3186      $('#views_slideshow_cycle_teaser_section_' + options.slideshowID).resume();
3187    }
3188    else {
3189      $('#views_slideshow_cycle_teaser_section_' + options.slideshowID).cycle('resume');
3190    }
3191  };
3192
3193  Drupal.viewsSlideshowCycle.previousSlide = function (options) {
3194    $('#views_slideshow_cycle_teaser_section_' + options.slideshowID).cycle('prev');
3195  };
3196
3197  Drupal.viewsSlideshowCycle.nextSlide = function (options) {
3198    $('#views_slideshow_cycle_teaser_section_' + options.slideshowID).cycle('next');
3199  };
3200
3201  Drupal.viewsSlideshowCycle.goToSlide = function (options) {
3202    $('#views_slideshow_cycle_teaser_section_' + options.slideshowID).cycle(options.slideNum);
3203  };
3204
3205  // Verify that the value is a number.
3206  function IsNumeric(sText) {
3207    var ValidChars = "0123456789";
3208    var IsNumber=true;
3209    var Char;
3210
3211    for (var i=0; i < sText.length && IsNumber == true; i++) {
3212      Char = sText.charAt(i);
3213      if (ValidChars.indexOf(Char) == -1) {
3214        IsNumber = false;
3215      }
3216    }
3217    return IsNumber;
3218  }
3219
3220  /**
3221   * Cookie Handling Functions
3222   */
3223  function createCookie(name,value,days) {
3224    if (days) {
3225      var date = new Date();
3226      date.setTime(date.getTime()+(days*24*60*60*1000));
3227      var expires = "; expires="+date.toGMTString();
3228    }
3229    else {
3230      var expires = "";
3231    }
3232    document.cookie = name+"="+value+expires+"; path=/";
3233  }
3234
3235  function readCookie(name) {
3236    var nameEQ = name + "=";
3237    var ca = document.cookie.split(';');
3238    for(var i=0;i < ca.length;i++) {
3239      var c = ca[i];
3240      while (c.charAt(0)==' ') c = c.substring(1,c.length);
3241      if (c.indexOf(nameEQ) == 0) {
3242        return c.substring(nameEQ.length,c.length);
3243      }
3244    }
3245    return null;
3246  }
3247
3248  function eraseCookie(name) {
3249    createCookie(name,"",-1);
3250  }
3251
3252  /**
3253   * Checks to see if the slide is visible enough.
3254   * elem = element to check.
3255   * type = The way to calculate how much is visible.
3256   * amountVisible = amount that should be visible. Either in percent or px. If
3257   *                it's not defined then all of the slide must be visible.
3258   *
3259   * Returns true or false
3260   */
3261  function viewsSlideshowCycleIsVisible(elem, type, amountVisible) {
3262    // Get the top and bottom of the window;
3263    var docViewTop = $(window).scrollTop();
3264    var docViewBottom = docViewTop + $(window).height();
3265    var docViewLeft = $(window).scrollLeft();
3266    var docViewRight = docViewLeft + $(window).width();
3267
3268    // Get the top, bottom, and height of the slide;
3269    var elemTop = $(elem).offset().top;
3270    var elemHeight = $(elem).height();
3271    var elemBottom = elemTop + elemHeight;
3272    var elemLeft = $(elem).offset().left;
3273    var elemWidth = $(elem).width();
3274    var elemRight = elemLeft + elemWidth;
3275    var elemArea = elemHeight * elemWidth;
3276
3277    // Calculate what's hiding in the slide.
3278    var missingLeft = 0;
3279    var missingRight = 0;
3280    var missingTop = 0;
3281    var missingBottom = 0;
3282
3283    // Find out how much of the slide is missing from the left.
3284    if (elemLeft < docViewLeft) {
3285      missingLeft = docViewLeft - elemLeft;
3286    }
3287
3288    // Find out how much of the slide is missing from the right.
3289    if (elemRight > docViewRight) {
3290      missingRight = elemRight - docViewRight;
3291    }
3292
3293    // Find out how much of the slide is missing from the top.
3294    if (elemTop < docViewTop) {
3295      missingTop = docViewTop - elemTop;
3296    }
3297
3298    // Find out how much of the slide is missing from the bottom.
3299    if (elemBottom > docViewBottom) {
3300      missingBottom = elemBottom - docViewBottom;
3301    }
3302
3303    // If there is no amountVisible defined then check to see if the whole slide
3304    // is visible.
3305    if (type == 'full') {
3306      return ((elemBottom >= docViewTop) && (elemTop <= docViewBottom)
3307      && (elemBottom <= docViewBottom) &&  (elemTop >= docViewTop)
3308      && (elemLeft >= docViewLeft) && (elemRight <= docViewRight)
3309      && (elemLeft <= docViewRight) && (elemRight >= docViewLeft));
3310    }
3311    else if(type == 'vertical') {
3312      var verticalShowing = elemHeight - missingTop - missingBottom;
3313
3314      // If user specified a percentage then find out if the current shown percent
3315      // is larger than the allowed percent.
3316      // Otherwise check to see if the amount of px shown is larger than the
3317      // allotted amount.
3318      if (typeof amountVisible === 'string' && amountVisible.indexOf('%')) {
3319        return (((verticalShowing/elemHeight)*100) >= parseInt(amountVisible));
3320      }
3321      else {
3322        return (verticalShowing >= parseInt(amountVisible));
3323      }
3324    }
3325    else if(type == 'horizontal') {
3326      var horizontalShowing = elemWidth - missingLeft - missingRight;
3327
3328      // If user specified a percentage then find out if the current shown percent
3329      // is larger than the allowed percent.
3330      // Otherwise check to see if the amount of px shown is larger than the
3331      // allotted amount.
3332      if (typeof amountVisible === 'string' && amountVisible.indexOf('%')) {
3333        return (((horizontalShowing/elemWidth)*100) >= parseInt(amountVisible));
3334      }
3335      else {
3336        return (horizontalShowing >= parseInt(amountVisible));
3337      }
3338    }
3339    else if(type == 'area') {
3340      var areaShowing = (elemWidth - missingLeft - missingRight) * (elemHeight - missingTop - missingBottom);
3341
3342      // If user specified a percentage then find out if the current shown percent
3343      // is larger than the allowed percent.
3344      // Otherwise check to see if the amount of px shown is larger than the
3345      // allotted amount.
3346      if (typeof amountVisible === 'string' && amountVisible.indexOf('%')) {
3347        return (((areaShowing/elemArea)*100) >= parseInt(amountVisible));
3348      }
3349      else {
3350        return (areaShowing >= parseInt(amountVisible));
3351      }
3352    }
3353  }
3354})(jQuery);
3355;

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.