PageSourceSearch

https://www.armyaircorps.us/js/foundation.min.js

js armyaircorps.us collected 2026-10-02 21:42:31 UTC 198,742 bytes, 6,081 lines download raw bytes

1/*
2 * Foundation Responsive Library
3 * http://foundation.zurb.com
4 * Copyright 2014, ZURB
5 * Free to use under the MIT license.
6 * http://www.opensource.org/licenses/mit-license.php
7*/
8
9(function ($, window, document, undefined) {
10  'use strict';
11
12  var header_helpers = function (class_array) {
13    var i = class_array.length;
14    var head = $('head');
15
16    while (i--) {
17      if (head.has('.' + class_array[i]).length === 0) {
18        head.append('<meta class="' + class_array[i] + '" />');
19      }
20    }
21  };
22
23  header_helpers([
24    'foundation-mq-small',
25    'foundation-mq-small-only',
26    'foundation-mq-medium',
27    'foundation-mq-medium-only',
28    'foundation-mq-large',
29    'foundation-mq-large-only',
30    'foundation-mq-xlarge',
31    'foundation-mq-xlarge-only',
32    'foundation-mq-xxlarge',
33    'foundation-data-attribute-namespace']);
34
35  // Enable FastClick if present
36
37  $(function () {
38    if (typeof FastClick !== 'undefined') {
39      // Don't attach to body if undefined
40      if (typeof document.body !== 'undefined') {
41        FastClick.attach(document.body);
42      }
43    }
44  });
45
46  // private Fast Selector wrapper,
47  // returns jQuery object. Only use where
48  // getElementById is not available.
49  var S = function (selector, context) {
50    if (typeof selector === 'string') {
51      if (context) {
52        var cont;
53        if (context.jquery) {
54          cont = context[0];
55          if (!cont) {
56            return context;
57          }
58        } else {
59          cont = context;
60        }
61        return $(cont.querySelectorAll(selector));
62      }
63
64      return $(document.querySelectorAll(selector));
65    }
66
67    return $(selector, context);
68  };
69
70  // Namespace functions.
71
72  var attr_name = function (init) {
73    var arr = [];
74    if (!init) {
75      arr.push('data');
76    }
77    if (this.namespace.length > 0) {
78      arr.push(this.namespace);
79    }
80    arr.push(this.name);
81
82    return arr.join('-');
83  };
84
85  var add_namespace = function (str) {
86    var parts = str.split('-'),
87        i = parts.length,
88        arr = [];
89
90    while (i--) {
91      if (i !== 0) {
92        arr.push(parts[i]);
93      } else {
94        if (this.namespace.length > 0) {
95          arr.push(this.namespace, parts[i]);
96        } else {
97          arr.push(parts[i]);
98        }
99      }
100    }
101
102    return arr.reverse().join('-');
103  };
104
105  // Event binding and data-options updating.
106
107  var bindings = function (method, options) {
108    var self = this,
109        bind = function(){
110          var $this = S(this),
111              should_bind_events = !$this.data(self.attr_name(true) + '-init');
112          $this.data(self.attr_name(true) + '-init', $.extend({}, self.settings, (options || method), self.data_options($this)));
113
114          if (should_bind_events) {
115            self.events(this);
116          }
117        };
118
119    if (S(this.scope).is('[' + this.attr_name() +']')) {
120      bind.call(this.scope);
121    } else {
122      S('[' + this.attr_name() +']', this.scope).each(bind);
123    }
124    // # Patch to fix #5043 to move this *after* the if/else clause in order for Backbone and similar frameworks to have improved control over event binding and data-options updating.
125    if (typeof method === 'string') {
126      return this[method].call(this, options);
127    }
128
129  };
130
131  var single_image_loaded = function (image, callback) {
132    function loaded () {
133      callback(image[0]);
134    }
135
136    function bindLoad () {
137      this.one('load', loaded);
138
139      if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) {
140        var src = this.attr( 'src' ),
141            param = src.match( /\?/ ) ? '&' : '?';
142
143        param += 'random=' + (new Date()).getTime();
144        this.attr('src', src + param);
145      }
146    }
147
148    if (!image.attr('src')) {
149      loaded();
150      return;
151    }
152
153    if (image[0].complete || image[0].readyState === 4) {
154      loaded();
155    } else {
156      bindLoad.call(image);
157    }
158  };
159
160  /*
161    https://github.com/paulirish/matchMedia.js
162  */
163
164  window.matchMedia = window.matchMedia || (function ( doc ) {
165
166    'use strict';
167
168    var bool,
169        docElem = doc.documentElement,
170        refNode = docElem.firstElementChild || docElem.firstChild,
171        // fakeBody required for <FF4 when executed in <head>
172        fakeBody = doc.createElement( 'body' ),
173        div = doc.createElement( 'div' );
174
175    div.id = 'mq-test-1';
176    div.style.cssText = 'position:absolute;top:-100em';
177    fakeBody.style.background = 'none';
178    fakeBody.appendChild(div);
179
180    return function (q) {
181
182      div.innerHTML = '&shy;<style media="' + q + '"> #mq-test-1 { width: 42px; }</style>';
183
184      docElem.insertBefore( fakeBody, refNode );
185      bool = div.offsetWidth === 42;
186      docElem.removeChild( fakeBody );
187
188      return {
189        matches : bool,
190        media : q
191      };
192
193    };
194
195  }( document ));
196
197  /*
198   * jquery.requestAnimationFrame
199   * https://github.com/gnarf37/jquery-requestAnimationFrame
200   * Requires jQuery 1.8+
201   *
202   * Copyright (c) 2012 Corey Frang
203   * Licensed under the MIT license.
204   */
205
206  (function(jQuery) {
207
208
209  // requestAnimationFrame polyfill adapted from Erik Möller
210  // fixes from Paul Irish and Tino Zijdel
211  // http://paulirish.com/2011/requestanimationframe-for-smart-animating/
212  // http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
213
214  var animating,
215      lastTime = 0,
216      vendors = ['webkit', 'moz'],
217      requestAnimationFrame = window.requestAnimationFrame,
218      cancelAnimationFrame = window.cancelAnimationFrame,
219      jqueryFxAvailable = 'undefined' !== typeof jQuery.fx;
220
221  for (; lastTime < vendors.length && !requestAnimationFrame; lastTime++) {
222    requestAnimationFrame = window[ vendors[lastTime] + 'RequestAnimationFrame' ];
223    cancelAnimationFrame = cancelAnimationFrame ||
224      window[ vendors[lastTime] + 'CancelAnimationFrame' ] ||
225      window[ vendors[lastTime] + 'CancelRequestAnimationFrame' ];
226  }
227
228  function raf() {
229    if (animating) {
230      requestAnimationFrame(raf);
231
232      if (jqueryFxAvailable) {
233        jQuery.fx.tick();
234      }
235    }
236  }
237
238  if (requestAnimationFrame) {
239    // use rAF
240    window.requestAnimationFrame = requestAnimationFrame;
241    window.cancelAnimationFrame = cancelAnimationFrame;
242
243    if (jqueryFxAvailable) {
244      jQuery.fx.timer = function (timer) {
245        if (timer() && jQuery.timers.push(timer) && !animating) {
246          animating = true;
247          raf();
248        }
249      };
250
251      jQuery.fx.stop = function () {
252        animating = false;
253      };
254    }
255  } else {
256    // polyfill
257    window.requestAnimationFrame = function (callback) {
258      var currTime = new Date().getTime(),
259        timeToCall = Math.max(0, 16 - (currTime - lastTime)),
260        id = window.setTimeout(function () {
261          callback(currTime + timeToCall);
262        }, timeToCall);
263      lastTime = currTime + timeToCall;
264      return id;
265    };
266
267    window.cancelAnimationFrame = function (id) {
268      clearTimeout(id);
269    };
270
271  }
272
273  }( $ ));
274
275  function removeQuotes (string) {
276    if (typeof string === 'string' || string instanceof String) {
277      string = string.replace(/^['\\/"]+|(;\s?})+|['\\/"]+$/g, '');
278    }
279
280    return string;
281  }
282
283  window.Foundation = {
284    name : 'Foundation',
285
286    version : '5.5.1',
287
288    media_queries : {
289      'small'       : S('.foundation-mq-small').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''),
290      'small-only'  : S('.foundation-mq-small-only').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''),
291      'medium'      : S('.foundation-mq-medium').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''),
292      'medium-only' : S('.foundation-mq-medium-only').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''),
293      'large'       : S('.foundation-mq-large').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''),
294      'large-only'  : S('.foundation-mq-large-only').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''),
295      'xlarge'      : S('.foundation-mq-xlarge').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''),
296      'xlarge-only' : S('.foundation-mq-xlarge-only').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''),
297      'xxlarge'     : S('.foundation-mq-xxlarge').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, '')
298    },
299
300    stylesheet : $('<style></style>').appendTo('head')[0].sheet,
301
302    global : {
303      namespace : undefined
304    },
305
306    init : function (scope, libraries, method, options, response) {
307      var args = [scope, method, options, response],
308          responses = [];
309
310      // check RTL
311      this.rtl = /rtl/i.test(S('html').attr('dir'));
312
313      // set foundation global scope
314      this.scope = scope || this.scope;
315
316      this.set_namespace();
317
318      if (libraries && typeof libraries === 'string' && !/reflow/i.test(libraries)) {
319        if (this.libs.hasOwnProperty(libraries)) {
320          responses.push(this.init_lib(libraries, args));
321        }
322      } else {
323        for (var lib in this.libs) {
324          responses.push(this.init_lib(lib, libraries));
325        }
326      }
327
328      S(window).load(function () {
329        S(window)
330          .trigger('resize.fndtn.clearing')
331          .trigger('resize.fndtn.dropdown')
332          .trigger('resize.fndtn.equalizer')
333          .trigger('resize.fndtn.interchange')
334          .trigger('resize.fndtn.joyride')
335          .trigger('resize.fndtn.magellan')
336          .trigger('resize.fndtn.topbar')
337          .trigger('resize.fndtn.slider');
338      });
339
340      return scope;
341    },
342
343    init_lib : function (lib, args) {
344      if (this.libs.hasOwnProperty(lib)) {
345        this.patch(this.libs[lib]);
346
347        if (args && args.hasOwnProperty(lib)) {
348            if (typeof this.libs[lib].settings !== 'undefined') {
349              $.extend(true, this.libs[lib].settings, args[lib]);
350            } else if (typeof this.libs[lib].defaults !== 'undefined') {
351              $.extend(true, this.libs[lib].defaults, args[lib]);
352            }
353          return this.libs[lib].init.apply(this.libs[lib], [this.scope, args[lib]]);
354        }
355
356        args = args instanceof Array ? args : new Array(args);
357        return this.libs[lib].init.apply(this.libs[lib], args);
358      }
359
360      return function () {};
361    },
362
363    patch : function (lib) {
364      lib.scope = this.scope;
365      lib.namespace = this.global.namespace;
366      lib.rtl = this.rtl;
367      lib['data_options'] = this.utils.data_options;
368      lib['attr_name'] = attr_name;
369      lib['add_namespace'] = add_namespace;
370      lib['bindings'] = bindings;
371      lib['S'] = this.utils.S;
372    },
373
374    inherit : function (scope, methods) {
375      var methods_arr = methods.split(' '),
376          i = methods_arr.length;
377
378      while (i--) {
379        if (this.utils.hasOwnProperty(methods_arr[i])) {
380          scope[methods_arr[i]] = this.utils[methods_arr[i]];
381        }
382      }
383    },
384
385    set_namespace : function () {
386
387      // Description:
388      //    Don't bother reading the namespace out of the meta tag
389      //    if the namespace has been set globally in javascript
390      //
391      // Example:
392      //    Foundation.global.namespace = 'my-namespace';
393      // or make it an empty string:
394      //    Foundation.global.namespace = '';
395      //
396      //
397
398      // If the namespace has not been set (is undefined), try to read it out of the meta element.
399      // Otherwise use the globally defined namespace, even if it's empty ('')
400      var namespace = ( this.global.namespace === undefined ) ? $('.foundation-data-attribute-namespace').css('font-family') : this.global.namespace;
401
402      // Finally, if the namsepace is either undefined or false, set it to an empty string.
403      // Otherwise use the namespace value.
404      this.global.namespace = ( namespace === undefined || /false/i.test(namespace) ) ? '' : namespace;
405    },
406
407    libs : {},
408
409    // methods that can be inherited in libraries
410    utils : {
411
412      // Description:
413      //    Fast Selector wrapper returns jQuery object. Only use where getElementById
414      //    is not available.
415      //
416      // Arguments:
417      //    Selector (String): CSS selector describing the element(s) to be
418      //    returned as a jQuery object.
419      //
420      //    Scope (String): CSS selector describing the area to be searched. Default
421      //    is document.
422      //
423      // Returns:
424      //    Element (jQuery Object): jQuery object containing elements matching the
425      //    selector within the scope.
426      S : S,
427
428      // Description:
429      //    Executes a function a max of once every n milliseconds
430      //
431      // Arguments:
432      //    Func (Function): Function to be throttled.
433      //
434      //    Delay (Integer): Function execution threshold in milliseconds.
435      //
436      // Returns:
437      //    Lazy_function (Function): Function with throttling applied.
438      throttle : function (func, delay) {
439        var timer = null;
440
441        return function () {
442          var context = this, args = arguments;
443
444          if (timer == null) {
445            timer = setTimeout(function () {
446              func.apply(context, args);
447              timer = null;
448            }, delay);
449          }
450        };
451      },
452
453      // Description:
454      //    Executes a function when it stops being invoked for n seconds
455      //    Modified version of _.debounce() http://underscorejs.org
456      //
457      // Arguments:
458      //    Func (Function): Function to be debounced.
459      //
460      //    Delay (Integer): Function execution threshold in milliseconds.
461      //
462      //    Immediate (Bool): Whether the function should be called at the beginning
463      //    of the delay instead of the end. Default is false.
464      //
465      // Returns:
466      //    Lazy_function (Function): Function with debouncing applied.
467      debounce : function (func, delay, immediate) {
468        var timeout, result;
469        return function () {
470          var context = this, args = arguments;
471          var later = function () {
472            timeout = null;
473            if (!immediate) {
474              result = func.apply(context, args);
475            }
476          };
477          var callNow = immediate && !timeout;
478          clearTimeout(timeout);
479          timeout = setTimeout(later, delay);
480          if (callNow) {
481            result = func.apply(context, args);
482          }
483          return result;
484        };
485      },
486
487      // Description:
488      //    Parses data-options attribute
489      //
490      // Arguments:
491      //    El (jQuery Object): Element to be parsed.
492      //
493      // Returns:
494      //    Options (Javascript Object): Contents of the element's data-options
495      //    attribute.
496      data_options : function (el, data_attr_name) {
497        data_attr_name = data_attr_name || 'options';
498        var opts = {}, ii, p, opts_arr,
499            data_options = function (el) {
500              var namespace = Foundation.global.namespace;
501
502              if (namespace.length > 0) {
503                return el.data(namespace + '-' + data_attr_name);
504              }
505
506              return el.data(data_attr_name);
507            };
508
509        var cached_options = data_options(el);
510
511        if (typeof cached_options === 'object') {
512          return cached_options;
513        }
514
515        opts_arr = (cached_options || ':').split(';');
516        ii = opts_arr.length;
517
518        function isNumber (o) {
519          return !isNaN (o - 0) && o !== null && o !== '' && o !== false && o !== true;
520        }
521
522        function trim (str) {
523          if (typeof str === 'string') {
524            return $.trim(str);
525          }
526          return str;
527        }
528
529        while (ii--) {
530          p = opts_arr[ii].split(':');
531          p = [p[0], p.slice(1).join(':')];
532
533          if (/true/i.test(p[1])) {
534            p[1] = true;
535          }
536          if (/false/i.test(p[1])) {
537            p[1] = false;
538          }
539          if (isNumber(p[1])) {
540            if (p[1].indexOf('.') === -1) {
541              p[1] = parseInt(p[1], 10);
542            } else {
543              p[1] = parseFloat(p[1]);
544            }
545          }
546
547          if (p.length === 2 && p[0].length > 0) {
548            opts[trim(p[0])] = trim(p[1]);
549          }
550        }
551
552        return opts;
553      },
554
555      // Description:
556      //    Adds JS-recognizable media queries
557      //
558      // Arguments:
559      //    Media (String): Key string for the media query to be stored as in
560      //    Foundation.media_queries
561      //
562      //    Class (String): Class name for the generated <meta> tag
563      register_media : function (media, media_class) {
564        if (Foundation.media_queries[media] === undefined) {
565          $('head').append('<meta class="' + media_class + '"/>');
566          Foundation.media_queries[media] = removeQuotes($('.' + media_class).css('font-family'));
567        }
568      },
569
570      // Description:
571      //    Add custom CSS within a JS-defined media query
572      //
573      // Arguments:
574      //    Rule (String): CSS rule to be appended to the document.
575      //
576      //    Media (String): Optional media query string for the CSS rule to be
577      //    nested under.
578      add_custom_rule : function (rule, media) {
579        if (media === undefined && Foundation.stylesheet) {
580          Foundation.stylesheet.insertRule(rule, Foundation.stylesheet.cssRules.length);
581        } else {
582          var query = Foundation.media_queries[media];
583
584          if (query !== undefined) {
585            Foundation.stylesheet.insertRule('@media ' +
586              Foundation.media_queries[media] + '{ ' + rule + ' }');
587          }
588        }
589      },
590
591      // Description:
592      //    Performs a callback function when an image is fully loaded
593      //
594      // Arguments:
595      //    Image (jQuery Object): Image(s) to check if loaded.
596      //
597      //    Callback (Function): Function to execute when image is fully loaded.
598      image_loaded : function (images, callback) {
599        var self = this,
600            unloaded = images.length;
601
602        if (unloaded === 0) {
603          callback(images);
604        }
605
606        images.each(function () {
607          single_image_loaded(self.S(this), function () {
608            unloaded -= 1;
609            if (unloaded === 0) {
610              callback(images);
611            }
612          });
613        });
614      },
615
616      // Description:
617      //    Returns a random, alphanumeric string
618      //
619      // Arguments:
620      //    Length (Integer): Length of string to be generated. Defaults to random
621      //    integer.
622      //
623      // Returns:
624      //    Rand (String): Pseudo-random, alphanumeric string.
625      random_str : function () {
626        if (!this.fidx) {
627          this.fidx = 0;
628        }
629        this.prefix = this.prefix || [(this.name || 'F'), (+new Date).toString(36)].join('-');
630
631        return this.prefix + (this.fidx++).toString(36);
632      },
633
634      // Description:
635      //    Helper for window.matchMedia
636      //
637      // Arguments:
638      //    mq (String): Media query
639      //
640      // Returns:
641      //    (Boolean): Whether the media query passes or not
642      match : function (mq) {
643        return window.matchMedia(mq).matches;
644      },
645
646      // Description:
647      //    Helpers for checking Foundation default media queries with JS
648      //
649      // Returns:
650      //    (Boolean): Whether the media query passes or not
651
652      is_small_up : function () {
653        return this.match(Foundation.media_queries.small);
654      },
655
656      is_medium_up : function () {
657        return this.match(Foundation.media_queries.medium);
658      },
659
660      is_large_up : function () {
661        return this.match(Foundation.media_queries.large);
662      },
663
664      is_xlarge_up : function () {
665        return this.match(Foundation.media_queries.xlarge);
666      },
667
668      is_xxlarge_up : function () {
669        return this.match(Foundation.media_queries.xxlarge);
670      },
671
672      is_small_only : function () {
673        return !this.is_medium_up() && !this.is_large_up() && !this.is_xlarge_up() && !this.is_xxlarge_up();
674      },
675
676      is_medium_only : function () {
677        return this.is_medium_up() && !this.is_large_up() && !this.is_xlarge_up() && !this.is_xxlarge_up();
678      },
679
680      is_large_only : function () {
681        return this.is_medium_up() && this.is_large_up() && !this.is_xlarge_up() && !this.is_xxlarge_up();
682      },
683
684      is_xlarge_only : function () {
685        return this.is_medium_up() && this.is_large_up() && this.is_xlarge_up() && !this.is_xxlarge_up();
686      },
687
688      is_xxlarge_only : function () {
689        return this.is_medium_up() && this.is_large_up() && this.is_xlarge_up() && this.is_xxlarge_up();
690      }
691    }
692  };
693
694  $.fn.foundation = function () {
695    var args = Array.prototype.slice.call(arguments, 0);
696
697    return this.each(function () {
698      Foundation.init.apply(Foundation, [this].concat(args));
699      return this;
700    });
701  };
702
703}(jQuery, window, window.document));
704;(function ($, window, document, undefined) {
705  'use strict';
706
707  Foundation.libs.slider = {
708    name : 'slider',
709
710    version : '5.5.1',
711
712    settings : {
713      start : 0,
714      end : 100,
715      step : 1,
716      precision : null,
717      initial : null,
718      display_selector : '',
719      vertical : false,
720      trigger_input_change : false,
721      on_change : function () {}
722    },
723
724    cache : {},
725
726    init : function (scope, method, options) {
727      Foundation.inherit(this, 'throttle');
728      this.bindings(method, options);
729      this.reflow();
730    },
731
732    events : function () {
733      var self = this;
734
735      $(this.scope)
736        .off('.slider')
737        .on('mousedown.fndtn.slider touchstart.fndtn.slider pointerdown.fndtn.slider',
738        '[' + self.attr_name() + ']:not(.disabled, [disabled]) .range-slider-handle', function (e) {
739          if (!self.cache.active) {
740            e.preventDefault();
741            self.set_active_slider($(e.target));
742          }
743        })
744        .on('mousemove.fndtn.slider touchmove.fndtn.slider pointermove.fndtn.slider', function (e) {
745          if (!!self.cache.active) {
746            e.preventDefault();
747            if ($.data(self.cache.active[0], 'settings').vertical) {
748              var scroll_offset = 0;
749              if (!e.pageY) {
750                scroll_offset = window.scrollY;
751              }
752              self.calculate_position(self.cache.active, self.get_cursor_position(e, 'y') + scroll_offset);
753            } else {
754              self.calculate_position(self.cache.active, self.get_cursor_position(e, 'x'));
755            }
756          }
757        })
758        .on('mouseup.fndtn.slider touchend.fndtn.slider pointerup.fndtn.slider', function (e) {
759          self.remove_active_slider();
760        })
761        .on('change.fndtn.slider', function (e) {
762          self.settings.on_change();
763        });
764
765      self.S(window)
766        .on('resize.fndtn.slider', self.throttle(function (e) {
767          self.reflow();
768        }, 300));
769    },
770
771    get_cursor_position : function (e, xy) {
772      var pageXY = 'page' + xy.toUpperCase(),
773          clientXY = 'client' + xy.toUpperCase(),
774          position;
775
776      if (typeof e[pageXY] !== 'undefined') {
777        position = e[pageXY];
778      } else if (typeof e.originalEvent[clientXY] !== 'undefined') {
779        position = e.originalEvent[clientXY];
780      } else if (e.originalEvent.touches && e.originalEvent.touches[0] && typeof e.originalEvent.touches[0][clientXY] !== 'undefined') {
781        position = e.originalEvent.touches[0][clientXY];
782      } else if (e.currentPoint && typeof e.currentPoint[xy] !== 'undefined') {
783        position = e.currentPoint[xy];
784      }
785
786      return position;
787    },
788
789    set_active_slider : function ($handle) {
790      this.cache.active = $handle;
791    },
792
793    remove_active_slider : function () {
794      this.cache.active = null;
795    },
796
797    calculate_position : function ($handle, cursor_x) {
798      var self = this,
799          settings = $.data($handle[0], 'settings'),
800          handle_l = $.data($handle[0], 'handle_l'),
801          handle_o = $.data($handle[0], 'handle_o'),
802          bar_l = $.data($handle[0], 'bar_l'),
803          bar_o = $.data($handle[0], 'bar_o');
804
805      requestAnimationFrame(function () {
806        var pct;
807
808        if (Foundation.rtl && !settings.vertical) {
809          pct = self.limit_to(((bar_o + bar_l - cursor_x) / bar_l), 0, 1);
810        } else {
811          pct = self.limit_to(((cursor_x - bar_o) / bar_l), 0, 1);
812        }
813
814        pct = settings.vertical ? 1 - pct : pct;
815
816        var norm = self.normalized_value(pct, settings.start, settings.end, settings.step, settings.precision);
817
818        self.set_ui($handle, norm);
819      });
820    },
821
822    set_ui : function ($handle, value) {
823      var settings = $.data($handle[0], 'settings'),
824          handle_l = $.data($handle[0], 'handle_l'),
825          bar_l = $.data($handle[0], 'bar_l'),
826          norm_pct = this.normalized_percentage(value, settings.start, settings.end),
827          handle_offset = norm_pct * (bar_l - handle_l) - 1,
828          progress_bar_length = norm_pct * 100,
829          $handle_parent = $handle.parent(),
830          $hidden_inputs = $handle.parent().children('input[type=hidden]');
831
832      if (Foundation.rtl && !settings.vertical) {
833        handle_offset = -handle_offset;
834      }
835
836      handle_offset = settings.vertical ? -handle_offset + bar_l - handle_l + 1 : handle_offset;
837      this.set_translate($handle, handle_offset, settings.vertical);
838
839      if (settings.vertical) {
840        $handle.siblings('.range-slider-active-segment').css('height', progress_bar_length + '%');
841      } else {
842        $handle.siblings('.range-slider-active-segment').css('width', progress_bar_length + '%');
843      }
844
845      $handle_parent.attr(this.attr_name(), value).trigger('change').trigger('change.fndtn.slider');
846
847      $hidden_inputs.val(value);
848      if (settings.trigger_input_change) {
849          $hidden_inputs.trigger('change');
850      }
851
852      if (!$handle[0].hasAttribute('aria-valuemin')) {
853        $handle.attr({
854          'aria-valuemin' : settings.start,
855          'aria-valuemax' : settings.end
856        });
857      }
858      $handle.attr('aria-valuenow', value);
859
860      if (settings.display_selector != '') {
861        $(settings.display_selector).each(function () {
862          if (this.hasOwnProperty('value')) {
863            $(this).val(value);
864          } else {
865            $(this).text(value);
866          }
867        });
868      }
869
870    },
871
872    normalized_percentage : function (val, start, end) {
873      return Math.min(1, (val - start) / (end - start));
874    },
875
876    normalized_value : function (val, start, end, step, precision) {
877      var range = end - start,
878          point = val * range,
879          mod = (point - (point % step)) / step,
880          rem = point % step,
881          round = ( rem >= step * 0.5 ? step : 0);
882      return ((mod * step + round) + start).toFixed(precision);
883    },
884
885    set_translate : function (ele, offset, vertical) {
886      if (vertical) {
887        $(ele)
888          .css('-webkit-transform', 'translateY(' + offset + 'px)')
889          .css('-moz-transform', 'translateY(' + offset + 'px)')
890          .css('-ms-transform', 'translateY(' + offset + 'px)')
891          .css('-o-transform', 'translateY(' + offset + 'px)')
892          .css('transform', 'translateY(' + offset + 'px)');
893      } else {
894        $(ele)
895          .css('-webkit-transform', 'translateX(' + offset + 'px)')
896          .css('-moz-transform', 'translateX(' + offset + 'px)')
897          .css('-ms-transform', 'translateX(' + offset + 'px)')
898          .css('-o-transform', 'translateX(' + offset + 'px)')
899          .css('transform', 'translateX(' + offset + 'px)');
900      }
901    },
902
903    limit_to : function (val, min, max) {
904      return Math.min(Math.max(val, min), max);
905    },
906
907    initialize_settings : function (handle) {
908      var settings = $.extend({}, this.settings, this.data_options($(handle).parent())),
909          decimal_places_match_result;
910
911      if (settings.precision === null) {
912        decimal_places_match_result = ('' + settings.step).match(/\.([\d]*)/);
913        settings.precision = decimal_places_match_result && decimal_places_match_result[1] ? decimal_places_match_result[1].length : 0;
914      }
915
916      if (settings.vertical) {
917        $.data(handle, 'bar_o', $(handle).parent().offset().top);
918        $.data(handle, 'bar_l', $(handle).parent().outerHeight());
919        $.data(handle, 'handle_o', $(handle).offset().top);
920        $.data(handle, 'handle_l', $(handle).outerHeight());
921      } else {
922        $.data(handle, 'bar_o', $(handle).parent().offset().left);
923        $.data(handle, 'bar_l', $(handle).parent().outerWidth());
924        $.data(handle, 'handle_o', $(handle).offset().left);
925        $.data(handle, 'handle_l', $(handle).outerWidth());
926      }
927
928      $.data(handle, 'bar', $(handle).parent());
929      $.data(handle, 'settings', settings);
930    },
931
932    set_initial_position : function ($ele) {
933      var settings = $.data($ele.children('.range-slider-handle')[0], 'settings'),
934          initial = ((typeof settings.initial == 'number' && !isNaN(settings.initial)) ? settings.initial : Math.floor((settings.end - settings.start) * 0.5 / settings.step) * settings.step + settings.start),
935          $handle = $ele.children('.range-slider-handle');
936      this.set_ui($handle, initial);
937    },
938
939    set_value : function (value) {
940      var self = this;
941      $('[' + self.attr_name() + ']', this.scope).each(function () {
942        $(this).attr(self.attr_name(), value);
943      });
944      if (!!$(this.scope).attr(self.attr_name())) {
945        $(this.scope).attr(self.attr_name(), value);
946      }
947      self.reflow();
948    },
949
950    reflow : function () {
951      var self = this;
952      self.S('[' + this.attr_name() + ']').each(function () {
953        var handle = $(this).children('.range-slider-handle')[0],
954            val = $(this).attr(self.attr_name());
955        self.initialize_settings(handle);
956
957        if (val) {
958          self.set_ui($(handle), parseFloat(val));
959        } else {
960          self.set_initial_position($(this));
961        }
962      });
963    }
964  };
965
966}(jQuery, window, window.document));
967;(function ($, window, document, undefined) {
968  'use strict';
969
970  var Modernizr = Modernizr || false;
971
972  Foundation.libs.joyride = {
973    name : 'joyride',
974
975    version : '5.5.1',
976
977    defaults : {
978      expose                   : false,     // turn on or off the expose feature
979      modal                    : true,      // Whether to cover page with modal during the tour
980      keyboard                 : true,      // enable left, right and esc keystrokes
981      tip_location             : 'bottom',  // 'top' or 'bottom' in relation to parent
982      nub_position             : 'auto',    // override on a per tooltip bases
983      scroll_speed             : 1500,      // Page scrolling speed in milliseconds, 0 = no scroll animation
984      scroll_animation         : 'linear',  // supports 'swing' and 'linear', extend with jQuery UI.
985      timer                    : 0,         // 0 = no timer , all other numbers = timer in milliseconds
986      start_timer_on_click     : true,      // true or false - true requires clicking the first button start the timer
987      start_offset             : 0,         // the index of the tooltip you want to start on (index of the li)
988      next_button              : true,      // true or false to control whether a next button is used
989      prev_button              : true,      // true or false to control whether a prev button is used
990      tip_animation            : 'fade',    // 'pop' or 'fade' in each tip
991      pause_after              : [],        // array of indexes where to pause the tour after
992      exposed                  : [],        // array of expose elements
993      tip_animation_fade_speed : 300,       // when tipAnimation = 'fade' this is speed in milliseconds for the transition
994      cookie_monster           : false,     // true or false to control whether cookies are used
995      cookie_name              : 'joyride', // Name the cookie you'll use
996      cookie_domain            : false,     // Will this cookie be attached to a domain, ie. '.notableapp.com'
997      cookie_expires           : 365,       // set when you would like the cookie to expire.
998      tip_container            : 'body',    // Where will the tip be attached
999      abort_on_close           : true,      // When true, the close event will not fire any callback
1000      tip_location_patterns    : {
1001        top : ['bottom'],
1002        bottom : [], // bottom should not need to be repositioned
1003        left : ['right', 'top', 'bottom'],
1004        right : ['left', 'top', 'bottom']
1005      },
1006      post_ride_callback     : function () {},    // A method to call once the tour closes (canceled or complete)
1007      post_step_callback     : function () {},    // A method to call after each step
1008      pre_step_callback      : function () {},    // A method to call before each step
1009      pre_ride_callback      : function () {},    // A method to call before the tour starts (passed index, tip, and cloned exposed element)
1010      post_expose_callback   : function () {},    // A method to call after an element has been exposed
1011      template : { // HTML segments for tip layout
1012        link          : '<a href="#close" class="joyride-close-tip">&times;</a>',
1013        timer         : '<div class="joyride-timer-indicator-wrap"><span class="joyride-timer-indicator"></span></div>',
1014        tip           : '<div class="joyride-tip-guide"><span class="joyride-nub"></span></div>',
1015        wrapper       : '<div class="joyride-content-wrapper"></div>',
1016        button        : '<a href="#" class="small button joyride-next-tip"></a>',
1017        prev_button   : '<a href="#" class="small button joyride-prev-tip"></a>',
1018        modal         : '<div class="joyride-modal-bg"></div>',
1019        expose        : '<div class="joyride-expose-wrapper"></div>',
1020        expose_cover  : '<div class="joyride-expose-cover"></div>'
1021      },
1022      expose_add_class : '' // One or more space-separated class names to be added to exposed element
1023    },
1024
1025    init : function (scope, method, options) {
1026      Foundation.inherit(this, 'throttle random_str');
1027
1028      this.settings = this.settings || $.extend({}, this.defaults, (options || method));
1029
1030      this.bindings(method, options)
1031    },
1032
1033    go_next : function () {
1034      if (this.settings.$li.next().length < 1) {
1035        this.end();
1036      } else if (this.settings.timer > 0) {
1037        clearTimeout(this.settings.automate);
1038        this.hide();
1039        this.show();
1040        this.startTimer();
1041      } else {
1042        this.hide();
1043        this.show();
1044      }
1045    },
1046
1047    go_prev : function () {
1048      if (this.settings.$li.prev().length < 1) {
1049        // Do nothing if there are no prev element
1050      } else if (this.settings.timer > 0) {
1051        clearTimeout(this.settings.automate);
1052        this.hide();
1053        this.show(null, true);
1054        this.startTimer();
1055      } else {
1056        this.hide();
1057        this.show(null, true);
1058      }
1059    },
1060
1061    events : function () {
1062      var self = this;
1063
1064      $(this.scope)
1065        .off('.joyride')
1066        .on('click.fndtn.joyride', '.joyride-next-tip, .joyride-modal-bg', function (e) {
1067          e.preventDefault();
1068          this.go_next()
1069        }.bind(this))
1070        .on('click.fndtn.joyride', '.joyride-prev-tip', function (e) {
1071          e.preventDefault();
1072          this.go_prev();
1073        }.bind(this))
1074
1075        .on('click.fndtn.joyride', '.joyride-close-tip', function (e) {
1076          e.preventDefault();
1077          this.end(this.settings.abort_on_close);
1078        }.bind(this))
1079
1080        .on('keyup.fndtn.joyride', function (e) {
1081          // Don't do anything if keystrokes are disabled
1082          // or if the joyride is not being shown
1083          if (!this.settings.keyboard || !this.settings.riding) {
1084            return;
1085          }
1086
1087          switch (e.which) {
1088            case 39: // right arrow
1089              e.preventDefault();
1090              this.go_next();
1091              break;
1092            case 37: // left arrow
1093              e.preventDefault();
1094              this.go_prev();
1095              break;
1096            case 27: // escape
1097              e.preventDefault();
1098              this.end(this.settings.abort_on_close);
1099          }
1100        }.bind(this));
1101
1102      $(window)
1103        .off('.joyride')
1104        .on('resize.fndtn.joyride', self.throttle(function () {
1105          if ($('[' + self.attr_name() + ']').length >
1105 0 && self.settings.$next_tip && self.settings.riding) {
1106            if (self.settings.exposed.length > 0) {
1107              var $els = $(self.settings.exposed);
1108
1109              $els.each(function () {
1110                var $this = $(this);
1111                self.un_expose($this);
1112                self.expose($this);
1113              });
1114            }
1115
1116            if (self.is_phone()) {
1117              self.pos_phone();
1118            } else {
1119              self.pos_default(false);
1120            }
1121          }
1122        }, 100));
1123    },
1124
1125    start : function () {
1126      var self = this,
1127          $this = $('[' + this.attr_name() + ']', this.scope),
1128          integer_settings = ['timer', 'scrollSpeed', 'startOffset', 'tipAnimationFadeSpeed', 'cookieExpires'],
1129          int_settings_count = integer_settings.length;
1130
1131      if (!$this.length > 0) {
1132        return;
1133      }
1134
1135      if (!this.settings.init) {
1136        this.events();
1137      }
1138
1139      this.settings = $this.data(this.attr_name(true) + '-init');
1140
1141      // non configureable settings
1142      this.settings.$content_el = $this;
1143      this.settings.$body = $(this.settings.tip_container);
1144      this.settings.body_offset = $(this.settings.tip_container).position();
1145      this.settings.$tip_content = this.settings.$content_el.find('> li');
1146      this.settings.paused = false;
1147      this.settings.attempts = 0;
1148      this.settings.riding = true;
1149
1150      // can we create cookies?
1151      if (typeof $.cookie !== 'function') {
1152        this.settings.cookie_monster = false;
1153      }
1154
1155      // generate the tips and insert into dom.
1156      if (!this.settings.cookie_monster || this.settings.cookie_monster && !$.cookie(this.settings.cookie_name)) {
1157        this.settings.$tip_content.each(function (index) {
1158          var $this = $(this);
1159          this.settings = $.extend({}, self.defaults, self.data_options($this));
1160
1161          // Make sure that settings parsed from data_options are integers where necessary
1162          var i = int_settings_count;
1163          while (i--) {
1164            self.settings[integer_settings[i]] = parseInt(self.settings[integer_settings[i]], 10);
1165          }
1166          self.create({$li : $this, index : index});
1167        });
1168
1169        // show first tip
1170        if (!this.settings.start_timer_on_click && this.settings.timer > 0) {
1171          this.show('init');
1172          this.startTimer();
1173        } else {
1174          this.show('init');
1175        }
1176
1177      }
1178    },
1179
1180    resume : function () {
1181      this.set_li();
1182      this.show();
1183    },
1184
1185    tip_template : function (opts) {
1186      var $blank, content;
1187
1188      opts.tip_class = opts.tip_class || '';
1189
1190      $blank = $(this.settings.template.tip).addClass(opts.tip_class);
1191      content = $.trim($(opts.li).html()) +
1192        this.prev_button_text(opts.prev_button_text, opts.index) +
1193        this.button_text(opts.button_text) +
1194        this.settings.template.link +
1195        this.timer_instance(opts.index);
1196
1197      $blank.append($(this.settings.template.wrapper));
1198      $blank.first().attr(this.add_namespace('data-index'), opts.index);
1199      $('.joyride-content-wrapper', $blank).append(content);
1200
1201      return $blank[0];
1202    },
1203
1204    timer_instance : function (index) {
1205      var txt;
1206
1207      if ((index === 0 && this.settings.start_timer_on_click && this.settings.timer > 0) || this.settings.timer === 0) {
1208        txt = '';
1209      } else {
1210        txt = $(this.settings.template.timer)[0].outerHTML;
1211      }
1212      return txt;
1213    },
1214
1215    button_text : function (txt) {
1216      if (this.settings.tip_settings.next_button) {
1217        txt = $.trim(txt) || 'Next';
1218        txt = $(this.settings.template.button).append(txt)[0].outerHTML;
1219      } else {
1220        txt = '';
1221      }
1222      return txt;
1223    },
1224
1225    prev_button_text : function (txt, idx) {
1226      if (this.settings.tip_settings.prev_button) {
1227        txt = $.trim(txt) || 'Previous';
1228
1229        // Add the disabled class to the button if it's the first element
1230        if (idx == 0) {
1231          txt = $(this.settings.template.prev_button).append(txt).addClass('disabled')[0].outerHTML;
1232        } else {
1233          txt = $(this.settings.template.prev_button).append(txt)[0].outerHTML;
1234        }
1235      } else {
1236        txt = '';
1237      }
1238      return txt;
1239    },
1240
1241    create : function (opts) {
1242      this.settings.tip_settings = $.extend({}, this.settings, this.data_options(opts.$li));
1243      var buttonText = opts.$li.attr(this.add_namespace('data-button')) || opts.$li.attr(this.add_namespace('data-text')),
1244          prevButtonText = opts.$li.attr(this.add_namespace('data-button-prev')) || opts.$li.attr(this.add_namespace('data-prev-text')),
1245        tipClass = opts.$li.attr('class'),
1246        $tip_content = $(this.tip_template({
1247          tip_class : tipClass,
1248          index : opts.index,
1249          button_text : buttonText,
1250          prev_button_text : prevButtonText,
1251          li : opts.$li
1252        }));
1253
1254      $(this.settings.tip_container).append($tip_content);
1255    },
1256
1257    show : function (init, is_prev) {
1258      var $timer = null;
1259
1260      // are we paused?
1261      if (this.settings.$li === undefined || ($.inArray(this.settings.$li.index(), this.settings.pause_after) === -1)) {
1262
1263        // don't go to the next li if the tour was paused
1264        if (this.settings.paused) {
1265          this.settings.paused = false;
1266        } else {
1267          this.set_li(init, is_prev);
1268        }
1269
1270        this.settings.attempts = 0;
1271
1272        if (this.settings.$li.length && this.settings.$target.length > 0) {
1273          if (init) { //run when we first start
1274            this.settings.pre_ride_callback(this.settings.$li.index(), this.settings.$next_tip);
1275            if (this.settings.modal) {
1276              this.show_modal();
1277            }
1278          }
1279
1280          this.settings.pre_step_callback(this.settings.$li.index(), this.settings.$next_tip);
1281
1282          if (this.settings.modal && this.settings.expose) {
1283            this.expose();
1284          }
1285
1286          this.settings.tip_settings = $.extend({}, this.settings, this.data_options(this.settings.$li));
1287
1288          this.settings.timer = parseInt(this.settings.timer, 10);
1289
1290          this.settings.tip_settings.tip_location_pattern = this.settings.tip_location_patterns[this.settings.tip_settings.tip_location];
1291
1292          // scroll and hide bg if not modal
1293          if (!/body/i.test(this.settings.$target.selector)) {
1294            var joyridemodalbg = $('.joyride-modal-bg');
1295            if (/pop/i.test(this.settings.tipAnimation)) {
1296                joyridemodalbg.hide();
1297            } else {
1298                joyridemodalbg.fadeOut(this.settings.tipAnimationFadeSpeed);
1299            }
1300            this.scroll_to();
1301          }
1302
1303          if (this.is_phone()) {
1304            this.pos_phone(true);
1305          } else {
1306            this.pos_default(true);
1307          }
1308
1309          $timer = this.settings.$next_tip.find('.joyride-timer-indicator');
1310
1311          if (/pop/i.test(this.settings.tip_animation)) {
1312
1313            $timer.width(0);
1314
1315            if (this.settings.timer > 0) {
1316
1317              this.settings.$next_tip.show();
1318
1319              setTimeout(function () {
1320                $timer.animate({
1321                  width : $timer.parent().width()
1322                }, this.settings.timer, 'linear');
1323              }.bind(this), this.settings.tip_animation_fade_speed);
1324
1325            } else {
1326              this.settings.$next_tip.show();
1327
1328            }
1329
1330          } else if (/fade/i.test(this.settings.tip_animation)) {
1331
1332            $timer.width(0);
1333
1334            if (this.settings.timer > 0) {
1335
1336              this.settings.$next_tip
1337                .fadeIn(this.settings.tip_animation_fade_speed)
1338                .show();
1339
1340              setTimeout(function () {
1341                $timer.animate({
1342                  width : $timer.parent().width()
1343                }, this.settings.timer, 'linear');
1344              }.bind(this), this.settings.tip_animation_fade_speed);
1345
1346            } else {
1347              this.settings.$next_tip.fadeIn(this.settings.tip_animation_fade_speed);
1348            }
1349          }
1350
1351          this.settings.$current_tip = this.settings.$next_tip;
1352
1353        // skip non-existant targets
1354        } else if (this.settings.$li && this.settings.$target.length < 1) {
1355
1356          this.show(init, is_prev);
1357
1358        } else {
1359
1360          this.end();
1361
1362        }
1363      } else {
1364
1365        this.settings.paused = true;
1366
1367      }
1368
1369    },
1370
1371    is_phone : function () {
1372      return matchMedia(Foundation.media_queries.small).matches &&
1373        !matchMedia(Foundation.media_queries.medium).matches;
1374    },
1375
1376    hide : function () {
1377      if (this.settings.modal && this.settings.expose) {
1378        this.un_expose();
1379      }
1380
1381      if (!this.settings.modal) {
1382        $('.joyride-modal-bg').hide();
1383      }
1384
1385      // Prevent scroll bouncing...wait to remove from layout
1386      this.settings.$current_tip.css('visibility', 'hidden');
1387      setTimeout($.proxy(function () {
1388        this.hide();
1389        this.css('visibility', 'visible');
1390      }, this.settings.$current_tip), 0);
1391      this.settings.post_step_callback(this.settings.$li.index(),
1392        this.settings.$current_tip);
1393    },
1394
1395    set_li : function (init, is_prev) {
1396      if (init) {
1397        this.settings.$li = this.settings.$tip_content.eq(this.settings.start_offset);
1398        this.set_next_tip();
1399        this.settings.$current_tip = this.settings.$next_tip;
1400      } else {
1401        if (is_prev) {
1402          this.settings.$li = this.settings.$li.prev();
1403        } else {
1404          this.settings.$li = this.settings.$li.next();
1405        }
1406        this.set_next_tip();
1407      }
1408
1409      this.set_target();
1410    },
1411
1412    set_next_tip : function () {
1413      this.settings.$next_tip = $('.joyride-tip-guide').eq(this.settings.$li.index());
1414      this.settings.$next_tip.data('closed', '');
1415    },
1416
1417    set_target : function () {
1418      var cl = this.settings.$li.attr(this.add_namespace('data-class')),
1419          id = this.settings.$li.attr(this.add_namespace('data-id')),
1420          $sel = function () {
1421            if (id) {
1422              return $(document.getElementById(id));
1423            } else if (cl) {
1424              return $('.' + cl).first();
1425            } else {
1426              return $('body');
1427            }
1428          };
1429
1430      this.settings.$target = $sel();
1431    },
1432
1433    scroll_to : function () {
1434      var window_half, tipOffset;
1435
1436      window_half = $(window).height() / 2;
1437      tipOffset = Math.ceil(this.settings.$target.offset().top - window_half + this.settings.$next_tip.outerHeight());
1438
1439      if (tipOffset != 0) {
1440        $('html, body').stop().animate({
1441          scrollTop : tipOffset
1442        }, this.settings.scroll_speed, 'swing');
1443      }
1444    },
1445
1446    paused : function () {
1447      return ($.inArray((this.settings.$li.index() + 1), this.settings.pause_after) === -1);
1448    },
1449
1450    restart : function () {
1451      this.hide();
1452      this.settings.$li = undefined;
1453      this.show('init');
1454    },
1455
1456    pos_default : function (init) {
1457      var $nub = this.settings.$next_tip.find('.joyride-nub'),
1458          nub_width = Math.ceil($nub.outerWidth() / 2),
1459          nub_height = Math.ceil($nub.outerHeight() / 2),
1460          toggle = init || false;
1461
1462      // tip must not be "display: none" to calculate position
1463      if (toggle) {
1464        this.settings.$next_tip.css('visibility', 'hidden');
1465        this.settings.$next_tip.show();
1466      }
1467
1468      if (!/body/i.test(this.settings.$target.selector)) {
1469          var topAdjustment = this.settings.tip_settings.tipAdjustmentY ? parseInt(this.settings.tip_settings.tipAdjustmentY) : 0,
1470              leftAdjustment = this.settings.tip_settings.tipAdjustmentX ? parseInt(this.settings.tip_settings.tipAdjustmentX) : 0;
1471
1472          if (this.bottom()) {
1473            if (this.rtl) {
1474              this.settings.$next_tip.css({
1475                top : (this.settings.$target.offset().top + nub_height + this.settings.$target.outerHeight() + topAdjustment),
1476                left : this.settings.$target.offset().left + this.settings.$target.outerWidth() - this.settings.$next_tip.outerWidth() + leftAdjustment});
1477            } else {
1478              this.settings.$next_tip.css({
1479                top : (this.settings.$target.offset().top + nub_height + this.settings.$target.outerHeight() + topAdjustment),
1480                left : this.settings.$target.offset().left + leftAdjustment});
1481            }
1482
1483            this.nub_position($nub, this.settings.tip_settings.nub_position, 'top');
1484
1485          } else if (this.top()) {
1486            if (this.rtl) {
1487              this.settings.$next_tip.css({
1488                top : (this.settings.$target.offset().top - this.settings.$next_tip.outerHeight() - nub_height + topAdjustment),
1489                left : this.settings.$target.offset().left + this.settings.$target.outerWidth() - this.settings.$next_tip.outerWidth()});
1490            } else {
1491              this.settings.$next_tip.css({
1492                top : (this.settings.$target.offset().top - this.settings.$next_tip.outerHeight() - nub_height + topAdjustment),
1493                left : this.settings.$target.offset().left + leftAdjustment});
1494            }
1495
1496            this.nub_position($nub, this.settings.tip_settings.nub_position, 'bottom');
1497
1498          } else if (this.right()) {
1499
1500            this.settings.$next_tip.css({
1501              top : this.settings.$target.offset().top + topAdjustment,
1502              left : (this.settings.$target.outerWidth() + this.settings.$target.offset().left + nub_width + leftAdjustment)});
1503
1504            this.nub_position($nub, this.settings.tip_settings.nub_position, 'left');
1505
1506          } else if (this.left()) {
1507
1508            this.settings.$next_tip.css({
1509              top : this.settings.$target.offset().top + topAdjustment,
1510              left : (this.settings.$target.offset().left - this.settings.$next_tip.outerWidth() - nub_width + leftAdjustment)});
1511
1512            this.nub_position($nub, this.settings.tip_settings.nub_position, 'right');
1513
1514          }
1515
1516          if (!this.visible(this.corners(this.settings.$next_tip)) && this.settings.attempts < this.settings.tip_settings.tip_location_pattern.length) {
1517
1518            $nub.removeClass('bottom')
1519              .removeClass('top')
1520              .removeClass('right')
1521              .removeClass('left');
1522
1523            this.settings.tip_settings.tip_location = this.settings.tip_settings.tip_location_pattern[this.settings.attempts];
1524
1525            this.settings.attempts++;
1526
1527            this.pos_default();
1528
1529          }
1530
1531      } else if (this.settings.$li.length) {
1532
1533        this.pos_modal($nub);
1534
1535      }
1536
1537      if (toggle) {
1538        this.settings.$next_tip.hide();
1539        this.settings.$next_tip.css('visibility', 'visible');
1540      }
1541
1542    },
1543
1544    pos_phone : function (init) {
1545      var tip_height = this.settings.$next_tip.outerHeight(),
1546          tip_offset = this.settings.$next_tip.offset(),
1547          target_height = this.settings.$target.outerHeight(),
1548          $nub = $('.joyride-nub', this.settings.$next_tip),
1549          nub_height = Math.ceil($nub.outerHeight() / 2),
1550          toggle = init || false;
1551
1552      $nub.removeClass('bottom')
1553        .removeClass('top')
1554        .removeClass('right')
1555        .removeClass('left');
1556
1557      if (toggle) {
1558        this.settings.$next_tip.css('visibility', 'hidden');
1559        this.settings.$next_tip.show();
1560      }
1561
1562      if (!/body/i.test(this.settings.$target.selector)) {
1563
1564        if (this.top()) {
1565
1566            this.settings.$next_tip.offset({top : this.settings.$target.offset().top - tip_height - nub_height});
1567            $nub.addClass('bottom');
1568
1569        } else {
1570
1571          this.settings.$next_tip.offset({top : this.settings.$target.offset().top + target_height + nub_height});
1572          $nub.addClass('top');
1573
1574        }
1575
1576      } else if (this.settings.$li.length) {
1577        this.pos_modal($nub);
1578      }
1579
1580      if (toggle) {
1581        this.settings.$next_tip.hide();
1582        this.settings.$next_tip.css('visibility', 'visible');
1583      }
1584    },
1585
1586    pos_modal : function ($nub) {
1587      this.center();
1588      $nub.hide();
1589
1590      this.show_modal();
1591    },
1592
1593    show_modal : function () {
1594      if (!this.settings.$next_tip.data('closed')) {
1595        var joyridemodalbg =  $('.joyride-modal-bg');
1596        if (joyridemodalbg.length < 1) {
1597          var joyridemodalbg = $(this.settings.template.modal);
1598          joyridemodalbg.appendTo('body');
1599        }
1600
1601        if (/pop/i.test(this.settings.tip_animation)) {
1602            joyridemodalbg.show();
1603        } else {
1604            joyridemodalbg.fadeIn(this.settings.tip_animation_fade_speed);
1605        }
1606      }
1607    },
1608
1609    expose : function () {
1610      var expose,
1611          exposeCover,
1612          el,
1613          origCSS,
1614          origClasses,
1615          randId = 'expose-' + this.random_str(6);
1616
1617      if (arguments.length > 0 && arguments[0] instanceof $) {
1618        el = arguments[0];
1619      } else if (this.settings.$target && !/body/i.test(this.settings.$target.selector)) {
1620        el = this.settings.$target;
1621      } else {
1622        return false;
1623      }
1624
1625      if (el.length < 1) {
1626        if (window.console) {
1627          console.error('element not valid', el);
1628        }
1629        return false;
1630      }
1631
1632      expose = $(this.settings.template.expose);
1633      this.settings.$body.append(expose);
1634      expose.css({
1635        top : el.offset().top,
1636        left : el.offset().left,
1637        width : el.outerWidth(true),
1638        height : el.outerHeight(true)
1639      });
1640
1641      exposeCover = $(this.settings.template.expose_cover);
1642
1643      origCSS = {
1644        zIndex : el.css('z-index'),
1645        position : el.css('position')
1646      };
1647
1648      origClasses = el.attr('class') == null ? '' : el.attr('class');
1649
1650      el.css('z-index', parseInt(expose.css('z-index')) + 1);
1651
1652      if (origCSS.position == 'static') {
1653        el.css('position', 'relative');
1654      }
1655
1656      el.data('expose-css', origCSS);
1657      el.data('orig-class', origClasses);
1658      el.attr('class', origClasses + ' ' + this.settings.expose_add_class);
1659
1660      exposeCover.css({
1661        top : el.offset().top,
1662        left : el.offset().left,
1663        width : el.outerWidth(true),
1664        height : el.outerHeight(true)
1665      });
1666
1667      if (this.settings.modal) {
1668        this.show_modal();
1669      }
1670
1671      this.settings.$body.append(exposeCover);
1672      expose.addClass(randId);
1673      exposeCover.addClass(randId);
1674      el.data('expose', randId);
1675      this.settings.post_expose_callback(this.settings.$li.index(), this.settings.$next_tip, el);
1676      this.add_exposed(el);
1677    },
1678
1679    un_expose : function () {
1680      var exposeId,
1681          el,
1682          expose,
1683          origCSS,
1684          origClasses,
1685          clearAll = false;
1686
1687      if (arguments.length > 0 && arguments[0] instanceof $) {
1688        el = arguments[0];
1689      } else if (this.settings.$target && !/body/i.test(this.settings.$target.selector)) {
1690        el = this.settings.$target;
1691      } else {
1692        return false;
1693      }
1694
1695      if (el.length < 1) {
1696        if (window.console) {
1697          console.error('element not valid', el);
1698        }
1699        return false;
1700      }
1701
1702      exposeId = el.data('expose');
1703      expose = $('.' + exposeId);
1704
1705      if (arguments.length > 1) {
1706        clearAll = arguments[1];
1707      }
1708
1709      if (clearAll === true) {
1710        $('.joyride-expose-wrapper,.joyride-expose-cover').remove();
1711      } else {
1712        expose.remove();
1713      }
1714
1715      origCSS = el.data('expose-css');
1716
1717      if (origCSS.zIndex == 'auto') {
1718        el.css('z-index', '');
1719      } else {
1720        el.css('z-index', origCSS.zIndex);
1721      }
1722
1723      if (origCSS.position != el.css('position')) {
1724        if (origCSS.position == 'static') {// this is default, no need to set it.
1725          el.css('position', '');
1726        } else {
1727          el.css('position', origCSS.position);
1728        }
1729      }
1730
1731      origClasses = el.data('orig-class');
1732      el.attr('class', origClasses);
1733      el.removeData('orig-classes');
1734
1735      el.removeData('expose');
1736      el.removeData('expose-z-index');
1737      this.remove_exposed(el);
1738    },
1739
1740    add_exposed : function (el) {
1741      this.settings.exposed = this.settings.exposed || [];
1742      if (el instanceof $ || typeof el === 'object') {
1743        this.settings.exposed.push(el[0]);
1744      } else if (typeof el == 'string') {
1745        this.settings.exposed.push(el);
1746      }
1747    },
1748
1749    remove_exposed : function (el) {
1750      var search, i;
1751      if (el instanceof $) {
1752        search = el[0]
1753      } else if (typeof el == 'string') {
1754        search = el;
1755      }
1756
1757      this.settings.exposed = this.settings.exposed || [];
1758      i = this.settings.exposed.length;
1759
1760      while (i--) {
1761        if (this.settings.exposed[i] == search) {
1762          this.settings.exposed.splice(i, 1);
1763          return;
1764        }
1765      }
1766    },
1767
1768    center : function () {
1769      var $w = $(window);
1770
1771      this.settings.$next_tip.css({
1772        top : ((($w.height() - this.settings.$next_tip.outerHeight()) / 2) + $w.scrollTop()),
1773        left : ((($w.width() - this.settings.$next_tip.outerWidth()) / 2) + $w.scrollLeft())
1774      });
1775
1776      return true;
1777    },
1778
1779    bottom : function () {
1780      return /bottom/i.test(this.settings.tip_settings.tip_location);
1781    },
1782
1783    top : function () {
1784      return /top/i.test(this.settings.tip_settings.tip_location);
1785    },
1786
1787    right : function () {
1788      return /right/i.test(this.settings.tip_settings.tip_location);
1789    },
1790
1791    left : function () {
1792      return /left/i.test(this.settings.tip_settings.tip_location);
1793    },
1794
1795    corners : function (el) {
1796      var w = $(window),
1797          window_half = w.height() / 2,
1798          //using this to calculate since scroll may not have finished yet.
1799          tipOffset = Math.ceil(this.settings.$target.offset().top - window_half + this.settings.$next_tip.outerHeight()),
1800          right = w.width() + w.scrollLeft(),
1801          offsetBottom =  w.height() + tipOffset,
1802          bottom = w.height() + w.scrollTop(),
1803          top = w.scrollTop();
1804
1805      if (tipOffset < top) {
1806        if (tipOffset < 0) {
1807          top = 0;
1808        } else {
1809          top = tipOffset;
1810        }
1811      }
1812
1813      if (offsetBottom > bottom) {
1814        bottom = offsetBottom;
1815      }
1816
1817      return [
1818        el.offset().top < top,
1819        right < el.offset().left + el.outerWidth(),
1820        bottom < el.offset().top + el.outerHeight(),
1821        w.scrollLeft() > el.offset().left
1822      ];
1823    },
1824
1825    visible : function (hidden_corners) {
1826      var i = hidden_corners.length;
1827
1828      while (i--) {
1829        if (hidden_corners[i]) {
1830          return false;
1831        }
1832      }
1833
1834      return true;
1835    },
1836
1837    nub_position : function (nub, pos, def) {
1838      if (pos === 'auto') {
1839        nub.addClass(def);
1840      } else {
1841        nub.addClass(pos);
1842      }
1843    },
1844
1845    startTimer : function () {
1846      if (this.settings.$li.length) {
1847        this.settings.automate = setTimeout(function () {
1848          this.hide();
1849          this.show();
1850          this.startTimer();
1851        }.bind(this), this.settings.timer);
1852      } else {
1853        clearTimeout(this.settings.automate);
1854      }
1855    },
1856
1857    end : function (abort) {
1858      if (this.settings.cookie_monster) {
1859        $.cookie(this.settings.cookie_name, 'ridden', {expires : this.settings.cookie_expires, domain : this.settings.cookie_domain});
1860      }
1861
1862      if (this.settings.timer > 0) {
1863        clearTimeout(this.settings.automate);
1864      }
1865
1866      if (this.settings.modal && this.settings.expose) {
1867        this.un_expose();
1868      }
1869
1870      // Unplug keystrokes listener
1871      $(this.scope).off('keyup.joyride')
1872
1873      this.settings.$next_tip.data('closed', true);
1874      this.settings.riding = false;
1875
1876      $('.joyride-modal-bg').hide();
1877      this.settings.$current_tip.hide();
1878
1879      if (typeof abort === 'undefined' || abort === false) {
1880        this.settings.post_step_callback(this.settings.$li.index(), this.settings.$current_tip);
1881        this.settings.post_ride_callback(this.settings.$li.index(), this.settings.$current_tip);
1882      }
1883
1884      $('.joyride-tip-guide').remove();
1885    },
1886
1887    off : function () {
1888      $(this.scope).off('.joyride');
1889      $(window).off('.joyride');
1890      $('.joyride-close-tip, .joyride-next-tip, .joyride-modal-bg').off('.joyride');
1891      $('.joyride-tip-guide, .joyride-modal-bg').remove();
1892      clearTimeout(this.settings.automate);
1893      this.settings = {};
1894    },
1895
1896    reflow : function () {}
1897  };
1898}(jQuery, window, window.document));
1899;(function ($, window, document, undefined) {
1900  'use strict';
1901
1902  Foundation.libs.equalizer = {
1903    name : 'equalizer',
1904
1905    version : '5.5.1',
1906
1907    settings : {
1908      use_tallest : true,
1909      before_height_change : $.noop,
1910      after_height_change : $.noop,
1911      equalize_on_stack : false
1912    },
1913
1914    init : function (scope, method, options) {
1915      Foundation.inherit(this, 'image_loaded');
1916      this.bindings(method, options);
1917      this.reflow();
1918    },
1919
1920    events : function () {
1921      this.S(window).off('.equalizer').on('resize.fndtn.equalizer', function (e) {
1922        this.reflow();
1923      }.bind(this));
1924    },
1925
1926    equalize : function (equalizer) {
1927      var isStacked = false,
1928          vals = equalizer.find('[' + this.attr_name() + '-watch]:visible'),
1929          settings = equalizer.data(this.attr_name(true) + '-init');
1930
1931      if (vals.length === 0) {
1932        return;
1933      }
1934      var firstTopOffset = vals.first().offset().top;
1935      settings.before_height_change();
1936      equalizer.trigger('before-height-change').trigger('before-height-change.fndth.equalizer');
1937      vals.height('inherit');
1938      vals.each(function () {
1939        var el = $(this);
1940        if (el.offset().top !== firstTopOffset) {
1941          isStacked = true;
1942        }
1943      });
1944
1945      if (settings.equalize_on_stack === false) {
1946        if (isStacked) {
1947          return;
1948        }
1949      };
1950
1951      var heights = vals.map(function () { return $(this).outerHeight(false) }).get();
1952
1953      if (settings.use_tallest) {
1954        var max = Math.max.apply(null, heights);
1955        vals.css('height', max);
1956      } else {
1957        var min = Math.min.apply(null, heights);
1958        vals.css('height', min);
1959      }
1960      settings.after_height_change();
1961      equalizer.trigger('after-height-change').trigger('after-height-change.fndtn.equalizer');
1962    },
1963
1964    reflow : function () {
1965      var self = this;
1966
1967      this.S('[' + this.attr_name() + ']', this.scope).each(function () {
1968        var $eq_target = $(this);
1969        self.image_loaded(self.S('img', this), function () {
1970          self.equalize($eq_target)
1971        });
1972      });
1973    }
1974  };
1975})(jQuery, window, window.document);
1976;(function ($, window, document, undefined) {
1977  'use strict';
1978
1979  Foundation.libs.dropdown = {
1980    name : 'dropdown',
1981
1982    version : '5.5.1',
1983
1984    settings : {
1985      active_class : 'open',
1986      disabled_class : 'disabled',
1987      mega_class : 'mega',
1988      align : 'bottom',
1989      is_hover : false,
1990      hover_timeout : 150,
1991      opened : function () {},
1992      closed : function () {}
1993    },
1994
1995    init : function (scope, method, options) {
1996      Foundation.inherit(this, 'throttle');
1997
1998      $.extend(true, this.settings, method, options);
1999      this.bindings(method, options);
2000    },
2001
2002    events : function (scope) {
2003      var self = this,
2004          S = self.S;
2005
2006      S(this.scope)
2007        .off('.dropdown')
2008        .on('click.fndtn.dropdown', '[' + this.attr_name() + ']', function (e) {
2009          var settings = S(this).data(self.attr_name(true) + '-init') || self.settings;
2010          if (!settings.is_hover || Modernizr.touch) {
2011            e.preventDefault();
2012            if (S(this).parent('[data-reveal-id]')) {
2013              e.stopPropagation();
2014            }
2015            self.toggle($(this));
2016          }
2017        })
2018        .on('mouseenter.fndtn.dropdown', '[' + this.attr_name() + '], [' + this.attr_name() + '-content]', function (e) {
2019          var $this = S(this),
2020              dropdown,
2021              target;
2022
2023          clearTimeout(self.timeout);
2024
2025          if ($this.data(self.data_attr())) {
2026            dropdown = S('#' + $this.data(self.data_attr()));
2027            target = $this;
2028          } else {
2029            dropdown = $this;
2030            target = S('[' + self.attr_name() + '="' + dropdown.attr('id') + '"]');
2031          }
2032
2033          var settings = target.data(self.attr_name(true) + '-init') || self.settings;
2034
2035          if (S(e.currentTarget).data(self.data_attr()) && settings.is_hover) {
2036            self.closeall.call(self);
2037          }
2038
2039          if (settings.is_hover) {
2040            self.open.apply(self, [dropdown, target]);
2041          }
2042        })
2043        .on('mouseleave.fndtn.dropdown', '[' + this.attr_name() + '], [' + this.attr_name() + '-content]', function (e) {
2044          var $this = S(this);
2045          var settings;
2046
2047          if ($this.data(self.data_attr())) {
2048              settings = $this.data(self.data_attr(true) + '-init') || self.settings;
2049          } else {
2050              var target   = S('[' + self.attr_name() + '="' + S(this).attr('id') + '"]'),
2051                  settings = target.data(self.attr_name(true) + '-init') || self.settings;
2052          }
2053
2054          self.timeout = setTimeout(function () {
2055            if ($this.data(self.data_attr())) {
2056              if (settings.is_hover) {
2057                self.close.call(self, S('#' + $this.data(self.data_attr())));
2058              }
2059            } else {
2060              if (settings.is_hover) {
2061                self.close.call(self, $this);
2062              }
2063            }
2064          }.bind(this), settings.hover_timeout);
2065        })
2066        .on('click.fndtn.dropdown', function (e) {
2067          var parent = S(e.target).closest('[' + self.attr_name() + '-content]');
2068          var links  = parent.find('a');
2069
2070          if (links.length > 0 && parent.attr('aria-autoclose') !== 'false') {
2071              self.close.call(self, S('[' + self.attr_name() + '-content]'));
2072          }
2073
2074          if (e.target !== document && !$.contains(document.documentElement, e.target)) {
2075            return;
2076          }
2077
2078          if (S(e.target).closest('[' + self.attr_name() + ']').length > 0) {
2079            return;
2080          }
2081
2082          if (!(S(e.target).data('revealId')) &&
2083            (parent.length > 0 && (S(e.target).is('[' + self.attr_name() + '-content]') ||
2084              $.contains(parent.first()[0], e.target)))) {
2085            e.stopPropagation();
2086            return;
2087          }
2088
2089          self.close.call(self, S('[' + self.attr_name() + '-content]'));
2090        })
2091        .on('opened.fndtn.dropdown', '[' + self.attr_name() + '-content]', function () {
2092          self.settings.opened.call(this);
2093        })
2094        .on('closed.fndtn.dropdown', '[' + self.attr_name() + '-content]', function () {
2095          self.settings.closed.call(this);
2096        });
2097
2098      S(window)
2099        .off('.dropdown')
2100        .on('resize.fndtn.dropdown', self.throttle(function () {
2101          self.resize.call(self);
2102        }, 50));
2103
2104      this.resize();
2105    },
2106
2107    close : function (dropdown) {
2108      var self = this;
2109      dropdown.each(function () {
2110        var original_target = $('[' + self.attr_name() + '=' + dropdown[0].id + ']') || $('aria-controls=' + dropdown[0].id + ']');
2111        original_target.attr('aria-expanded', 'false');
2112        if (self.S(this).hasClass(self.settings.active_class)) {
2113          self.S(this)
2114            .css(Foundation.rtl ? 'right' : 'left', '-99999px')
2115            .attr('aria-hidden', 'true')
2116            .removeClass(self.settings.active_class)
2117            .prev('[' + self.attr_name() + ']')
2118            .removeClass(self.settings.active_class)
2119            .removeData('target');
2120
2121          self.S(this).trigger('closed').trigger('closed.fndtn.dropdown', [dropdown]);
2122        }
2123      });
2124      dropdown.removeClass('f-open-' + this.attr_name(true));
2125    },
2126
2127    closeall : function () {
2128      var self = this;
2129      $.each(self.S('.f-open-' + this.attr_name(true)), function () {
2130        self.close.call(self, self.S(this));
2131      });
2132    },
2133
2134    open : function (dropdown, target) {
2135      this
2136        .css(dropdown
2137        .addClass(this.settings.active_class), target);
2138      dropdown.prev('[' + this.attr_name() + ']').addClass(this.settings.active_class);
2139      dropdown.data('target', target.get(0)).trigger('opened').trigger('opened.fndtn.dropdown', [dropdown, target]);
2140      dropdown.attr('aria-hidden', 'false');
2141      target.attr('aria-expanded', 'true');
2142      dropdown.focus();
2143      dropdown.addClass('f-open-' + this.attr_name(true));
2144    },
2145
2146    data_attr : function () {
2147      if (this.namespace.length > 0) {
2148        return this.namespace + '-' + this.name;
2149      }
2150
2151      return this.name;
2152    },
2153
2154    toggle : function (target) {
2155      if (target.hasClass(this.settings.disabled_class)) {
2156        return;
2157      }
2158      var dropdown = this.S('#' + target.data(this.data_attr()));
2159      if (dropdown.length === 0) {
2160        // No dropdown found, not continuing
2161        return;
2162      }
2163
2164      this.close.call(this, this.S('[' + this.attr_name() + '-content]').not(dropdown));
2165
2166      if (dropdown.hasClass(this.settings.active_class)) {
2167        this.close.call(this, dropdown);
2168        if (dropdown.data('target') !== target.get(0)) {
2169          this.open.call(this, dropdown, target);
2170        }
2171      } else {
2172        this.open.call(this, dropdown, target);
2173      }
2174    },
2175
2176    resize : function () {
2177      var dropdown = this.S('[' + this.attr_name() + '-content].open');
2178      var target = $(dropdown.data("target"));
2179
2180      if (dropdown.length && target.length) {
2181        this.css(dropdown, target);
2182      }
2183    },
2184
2185    css : function (dropdown, target) {
2186      var left_offset = Math.max((target.width() - dropdown.width()) / 2, 8),
2187          settings = target.data(this.attr_name(true) + '-init') || this.settings;
2188
2189      this.clear_idx();
2190
2191      if (this.small()) {
2192        var p = this.dirs.bottom.call(dropdown, target, settings);
2193
2194        dropdown.attr('style', '').removeClass('drop-left drop-right drop-top').css({
2195          position : 'absolute',
2196          width : '95%',
2197          'max-width' : 'none',
2198          top : p.top
2199        });
2200
2201        dropdown.css(Foundation.rtl ? 'right' : 'left', left_offset);
2202      } else {
2203
2204        this.style(dropdown, target, settings);
2205      }
2206
2207      return dropdown;
2208    },
2209
2210    style : function (dropdown, target, settings) {
2211      var css = $.extend({position : 'absolute'},
2212        this.dirs[settings.align].call(dropdown, target, settings));
2213
2214      dropdown.attr('style', '').css(css);
2215    },
2216
2217    // return CSS property object
2218    // `this` is the dropdown
2219    dirs : {
2220      // Calculate target offset
2221      _base : function (t) {
2222        var o_p = this.offsetParent(),
2223            o = o_p.offset(),
2224            p = t.offset();
2225
2226        p.top -= o.top;
2227        p.left -= o.left;
2228
2229        //set some flags on the p object to pass along
2230        p.missRight = false;
2231        p.missTop = false;
2232        p.missLeft = false;
2233        p.leftRightFlag = false;
2234
2235        //lets see if the panel will be off the screen
2236        //get the actual width of the page and store it
2237        var actualBodyWidth;
2238        if (document.getElementsByClassName('row')[0]) {
2239          actualBodyWidth = document.getElementsByClassName('row')[0].clientWidth;
2240        } else {
2241          actualBodyWidth = window.outerWidth;
2242        }
2243
2244        var actualMarginWidth = (window.outerWidth - actualBodyWidth) / 2;
2245        var actualBoundary = actualBodyWidth;
2246
2247        if (!this.hasClass('mega')) {
2248          //miss top
2249          if (t.offset().top <= this.outerHeight()) {
2250            p.missTop = true;
2251            actualBoundary = window.outerWidth - actualMarginWidth;
2252            p.leftRightFlag = true;
2253          }
2254
2255          //miss right
2256          if (t.offset().left + this.outerWidth() > t.offset().left + actualMarginWidth && t.offset().left - actualMarginWidth > this.outerWidth()) {
2257            p.missRight = true;
2258            p.missLeft = false;
2259          }
2260
2261          //miss left
2262          if (t.offset().left - this.outerWidth() <= 0) {
2263            p.missLeft = true;
2264            p.missRight = false;
2265          }
2266        }
2267
2268        return p;
2269      },
2270
2271      top : function (t, s) {
2272        var self = Foundation.libs.dropdown,
2273            p = self.dirs._base.call(this, t);
2274
2275        this.addClass('drop-top');
2276
2277        if (p.missTop == true) {
2278          p.top = p.top + t.outerHeight() + this.outerHeight();
2279          this.removeClass('drop-top');
2280        }
2281
2282        if (p.missRight == true) {
2283          p.left = p.left - this.outerWidth() + t.outerWidth();
2284        }
2285
2286        if (t.outerWidth() < this.outerWidth() || self.small() || this.hasClass(s.mega_menu)) {
2287          self.adjust_pip(this, t, s, p);
2288        }
2289
2290        if (Foundation.rtl) {
2291          return {left : p.left - this.outerWidth() + t.outerWidth(),
2292            top : p.top - this.outerHeight()};
2293        }
2294
2295        return {left : p.left, top : p.top - this.outerHeight()};
2296      },
2297
2298      bottom : function (t, s) {
2299        var self = Foundation.libs.dropdown,
2300            p = self.dirs._base.call(this, t);
2301
2302        if (p.missRight == true) {
2303          p.left = p.left - this.outerWidth() + t.outerWidth();
2304        }
2305
2306        if (t.outerWidth() < this.outerWidth() || self.small() || this.hasClass(s.mega_menu)) {
2307          self.adjust_pip(this, t, s, p);
2308        }
2309
2310        if (self.rtl) {
2311          return {left : p.left - this.outerWidth() + t.outerWidth(), top : p.top + t.outerHeight()};
2312        }
2313
2314        return {left : p.left, top : p.top + t.outerHeight()};
2315      },
2316
2317      left : function (t, s) {
2318        var p = Foundation.libs.dropdown.dirs._base.call(this, t);
2319
2320        this.addClass('drop-left');
2321
2322        if (p.missLeft == true) {
2323          p.left =  p.left + this.outerWidth();
2324          p.top = p.top + t.outerHeight();
2325          this.removeClass('drop-left');
2326        }
2327
2328        return {left : p.left - this.outerWidth(), top : p.top};
2329      },
2330
2331      right : function (t, s) {
2332        var p = Foundation.libs.dropdown.dirs._base.call(this, t);
2333
2334        this.addClass('drop-right');
2335
2336        if (p.missRight == true) {
2337          p.left = p.left - this.outerWidth();
2338          p.top = p.top + t.outerHeight();
2339          this.removeClass('drop-right');
2340        } else {
2341          p.triggeredRight = true;
2342        }
2343
2344        var self = Foundation.libs.dropdown;
2345
2346        if (t.outerWidth() < this.outerWidth() || self.small() || this.hasClass(s.mega_menu)) {
2347          self.adjust_pip(this, t, s, p);
2348        }
2349
2350        return {left : p.left + t.outerWidth(), top : p.top};
2351      }
2352    },
2353
2354    // Insert rule to style psuedo elements
2355    adjust_pip : function (dropdown, target, settings, position) {
2356      var sheet = Foundation.stylesheet,
2357          pip_offset_base = 8;
2358
2359      if (dropdown.hasClass(settings.mega_class)) {
2360        pip_offset_base = position.left + (target.outerWidth() / 2) - 8;
2361      } else if (this.small()) {
2362        pip_offset_base += position.left - 8;
2363      }
2364
2365      this.rule_idx = sheet.cssRules.length;
2366
2367      //default
2368      var sel_before = '.f-dropdown.open:before',
2369          sel_after  = '.f-dropdown.open:after',
2370          css_before = 'left: ' + pip_offset_base + 'px;',
2371          css_after  = 'left: ' + (pip_offset_base - 1) + 'px;';
2372
2373      if (position.missRight == true) {
2374        pip_offset_base = dropdown.outerWidth() - 23;
2375        sel_before = '.f-dropdown.open:before',
2376        sel_after  = '.f-dropdown.open:after',
2377        css_before = 'left: ' + pip_offset_base + 'px;',
2378        css_after  = 'left: ' + (pip_offset_base - 1) + 'px;';
2379      }
2380
2381      //just a case where right is fired, but its not missing right
2382      if (position.triggeredRight == true) {
2383        sel_before = '.f-dropdown.open:before',
2384        sel_after  = '.f-dropdown.open:after',
2385        css_before = 'left:-12px;',
2386        css_after  = 'left:-14px;';
2387      }
2388
2389      if (sheet.insertRule) {
2390        sheet.insertRule([sel_before, '{', css_before, '}'].join(' '), this.rule_idx);
2391        sheet.insertRule([sel_after, '{', css_after, '}'].join(' '), this.rule_idx + 1);
2392      } else {
2393        sheet.addRule(sel_before, css_before, this.rule_idx);
2394        sheet.addRule(sel_after, css_after, this.rule_idx + 1);
2395      }
2396    },
2397
2398    // Remove old dropdown rule index
2399    clear_idx : function () {
2400      var sheet = Foundation.stylesheet;
2401
2402      if (typeof this.rule_idx !== 'undefined') {
2403        sheet.deleteRule(this.rule_idx);
2404        sheet.deleteRule(this.rule_idx);
2405        delete this.rule_idx;
2406      }
2407    },
2408
2409    small : function () {
2410      return matchMedia(Foundation.media_queries.small).matches &&
2411        !matchMedia(Foundation.media_queries.medium).matches;
2412    },
2413
2414    off : function () {
2415      this.S(this.scope).off('.fndtn.dropdown');
2416      this.S('html, body').off('.fndtn.dropdown');
2417      this.S(window).off('.fndtn.dropdown');
2418      this.S('[data-dropdown-content]').off('.fndtn.dropdown');
2419    },
2420
2421    reflow : function () {}
2422  };
2423}(jQuery, window, window.document));
2424;(function ($, window, document, undefined) {
2425  'use strict';
2426
2427  Foundation.libs.clearing = {
2428    name : 'clearing',
2429
2430    version : '5.5.1',
2431
2432    settings : {
2433      templates : {
2434        viewing : '<a href="#" class="clearing-close">&times;</a>' +
2435          '<div class="visible-img" style="display: none"><div class="clearing-touch-label"></div><img src="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs%3D" alt="" />' +
2436          '<p class="clearing-caption"></p><a href="#" class="clearing-main-prev"><span></span></a>' +
2437          '<a href="#" class="clearing-main-next"><span></span></a></div>'
2438      },
2439
2440      // comma delimited list of selectors that, on click, will close clearing,
2441      // add 'div.clearing-blackout, div.visible-img' to close on background click
2442      close_selectors : '.clearing-close, div.clearing-blackout',
2443
2444      // Default to the entire li element.
2445      open_selectors : '',
2446
2447      // Image will be skipped in carousel.
2448      skip_selector : '',
2449
2450      touch_label : '',
2451
2452      // event initializers and locks
2453      init : false,
2454      locked : false
2455    },
2456
2457    init : function (scope, method, options) {
2458      var self = this;
2459      Foundation.inherit(this, 'throttle image_loaded');
2460
2461      this.bindings(method, options);
2462
2463      if (self.S(this.scope).is('[' + this.attr_name() + ']')) {
2464        this.assemble(self.S('li', this.scope));
2465      } else {
2466        self.S('[' + this.attr_name() + ']', this.scope).each(function () {
2467          self.assemble(self.S('li', this));
2468        });
2469      }
2470    },
2471
2472    events : function (scope) {
2473      var self = this,
2474          S = self.S,
2475          $scroll_container = $('.scroll-container');
2476
2477      if ($scroll_container.length > 0) {
2478        this.scope = $scroll_container;
2479      }
2480
2481      S(this.scope)
2482        .off('.clearing')
2483        .on('click.fndtn.clearing', 'ul[' + this.attr_name() + '] li ' + this.settings.open_selectors,
2484          function (e, current, target) {
2485            var current = current || S(this),
2486                target = target || current,
2487                next = current.next('li'),
2488                settings = current.closest('[' + self.attr_name() + ']').data(self.attr_name(true) + '-init'),
2489                image = S(e.target);
2490
2491            e.preventDefault();
2492
2493            if (!settings) {
2494              self.init();
2495              settings = current.closest('[' + self.attr_name() + ']').data(self.attr_name(true) + '-init');
2496            }
2497
2498            // if clearing is open and the current image is
2499            // clicked, go to the next image in sequence
2500            if (target.hasClass('visible') &&
2501              current[0] === target[0] &&
2502              next.length > 0 && self.is_open(current)) {
2503              target = next;
2504              image = S('img', target);
2505            }
2506
2507            // set current and target to the clicked li if not otherwise defined.
2508            self.open(image, current, target);
2509            self.update_paddles(target);
2510          })
2511
2512        .on('click.fndtn.clearing', '.clearing-main-next',
2513          function (e) { self.nav(e, 'next') })
2514        .on('click.fndtn.clearing', '.clearing-main-prev',
2515          function (e) { self.nav(e, 'prev') })
2516        .on('click.fndtn.clearing', this.settings.close_selectors,
2517          function (e) { Foundation.libs.clearing.close(e, this) });
2518
2519      $(document).on('keydown.fndtn.clearing',
2520          function (e) { self.keydown(e) });
2521
2522      S(window).off('.clearing').on('resize.fndtn.clearing',
2523        function () { self.resize() });
2524
2525      this.swipe_events(scope);
2526    },
2527
2528    swipe_events : function (scope) {
2529      var self = this,
2530      S = self.S;
2531
2532      S(this.scope)
2533        .on('touchstart.fndtn.clearing', '.visible-img', function (e) {
2534          if (!e.touches) { e = e.originalEvent; }
2535          var data = {
2536                start_page_x : e.touches[0].pageX,
2537                start_page_y : e.touches[0].pageY,
2538                start_time : (new Date()).getTime(),
2539                delta_x : 0,
2540                is_scrolling : undefined
2541              };
2542
2543          S(this).data('swipe-transition', data);
2544          e.stopPropagation();
2545        })
2546        .on('touchmove.fndtn.clearing', '.visible-img', function (e) {
2547          if (!e.touches) {
2548            e = e.originalEvent;
2549          }
2550          // Ignore pinch/zoom events
2551          if (e.touches.length > 1 || e.scale && e.scale !== 1) {
2552            return;
2553          }
2554
2555          var data = S(this).data('swipe-transition');
2556
2557          if (typeof data === 'undefined') {
2558            data = {};
2559          }
2560
2561          data.delta_x = e.touches[0].pageX - data.start_page_x;
2562
2563          if (Foundation.rtl) {
2564            data.delta_x = -data.delta_x;
2565          }
2566
2567          if (typeof data.is_scrolling === 'undefined') {
2568            data.is_scrolling = !!( data.is_scrolling || Math.abs(data.delta_x) < Math.abs(e.touches[0].pageY - data.start_page_y) );
2569          }
2570
2571          if (!data.is_scrolling && !data.active) {
2572            e.preventDefault();
2573            var direction = (data.delta_x < 0) ? 'next' : 'prev';
2574            data.active = true;
2575            self.nav(e, direction);
2576          }
2577        })
2578        .on('touchend.fndtn.clearing', '.visible-img', function (e) {
2579          S(this).data('swipe-transition', {});
2580          e.stopPropagation();
2581        });
2582    },
2583
2584    assemble : function ($li) {
2585      var $el = $li.parent();
2586
2587      if ($el.parent().hasClass('carousel')) {
2588        return;
2589      }
2590
2591      $el.after('<div id="foundationClearingHolder"></div>');
2592
2593      var grid = $el.detach(),
2594          grid_outerHTML = '';
2595
2596      if (grid[0] == null) {
2597        return;
2598      } else {
2599        grid_outerHTML = grid[0].outerHTML;
2600      }
2601
2602      var holder = this.S('#foundationClearingHolder'),
2603          settings = $el.data(this.attr_name(true) + '-init'),
2604          data = {
2605            grid : '<div class="carousel">' + grid_outerHTML + '</div>',
2606            viewing : settings.templates.viewing
2607          },
2608          wrapper = '<div class="clearing-assembled"><div>' + data.viewing +
2609            data.grid + '</div></div>',
2610          touch_label = this.settings.touch_label;
2611
2612      if (Modernizr.touch) {
2613        wrapper = $(wrapper).find('.clearing-touch-label').html(touch_label).end();
2614      }
2615
2616      holder.after(wrapper).remove();
2617    },
2618
2619    open : function ($image, current, target) {
2620      var self = this,
2621          body = $(document.body),
2622          root = target.closest('.clearing-assembled'),
2623          container = self.S('div', root).first(),
2624          visible_image = self.S('.visible-img', container),
2625          image = self.S('img', visible_image).not($image),
2626          label = self.S('.clearing-touch-label', container),
2627          error = false;
2628
2629      // Event to disable scrolling on touch devices when Clearing is activated
2630      $('body').on('touchmove', function (e) {
2631        e.preventDefault();
2632      });
2633
2634      image.error(function () {
2635        error = true;
2636      });
2637
2638      function startLoad() {
2639        setTimeout(function () {
2640          this.image_loaded(image, function () {
2641            if (image.outerWidth() === 1 && !error) {
2642              startLoad.call(this);
2643            } else {
2644              cb.call(this, image);
2645            }
2646          }.bind(this));
2647        }.bind(this), 100);
2648      }
2649
2650      function cb (image) {
2651        var $image = $(image);
2652        $image.css('visibility', 'visible');
2653        // toggle the gallery
2654        body.css('overflow', 'hidden');
2655        root.addClass('clearing-blackout');
2656        container.addClass('clearing-container');
2657        visible_image.show();
2658        this.fix_height(target)
2659          .caption(self.S('.clearing-caption', visible_image), self.S('img', target))
2660          .center_and_label(image, label)
2661          .shift(current, target, function () {
2662            target.closest('li').siblings().removeClass('visible');
2663            target.closest('li').addClass('visible');
2664          });
2665        visible_image.trigger('opened.fndtn.clearing')
2666      }
2667
2668      if (!this.locked()) {
2669        visible_image.trigger('open.fndtn.clearing');
2670        // set the image to the selected thumbnail
2671        image
2672          .attr('src', this.load($image))
2673          .css('visibility', 'hidden');
2674
2675        startLoad.call(this);
2676      }
2677    },
2678
2679    close : function (e, el) {
2680      e.preventDefault();
2681
2682      var root = (function (target) {
2683            if (/blackout/.test(target.selector)) {
2684              return target;
2685            } else {
2686              return target.closest('.clearing-blackout');
2687            }
2688          }($(el))),
2689          body = $(document.body), container, visible_image;
2690
2691      if (el === e.target && root) {
2692        body.css('overflow', '');
2693        container = $('div', root).first();
2694        visible_image = $('.visible-img', container);
2695        visible_image.trigger('close.fndtn.clearing');
2696        this.settings.prev_index = 0;
2697        $('ul[' + this.attr_name() + ']', root)
2698          .attr('style', '').closest('.clearing-blackout')
2699          .removeClass('clearing-blackout');
2700        container.removeClass('clearing-container');
2701        visible_image.hide();
2702        visible_image.trigger('closed.fndtn.clearing');
2703      }
2704
2705      // Event to re-enable scrolling on touch devices
2706      $('body').off('touchmove');
2707
2708      return false;
2709    },
2710
2711    is_open : function (current) {
2712      return current.parent().prop('style').length > 0;
2713    },
2714
2715    keydown : function (e) {
2716      var clearing = $('.clearing-blackout ul[' + this.attr_name() + ']'),
2717          NEXT_KEY = this.rtl ? 37 : 39,
2718          PREV_KEY = this.rtl ? 39 : 37,
2719          ESC_KEY = 27;
2720
2721      if (e.which === NEXT_KEY) {
2722        this.go(clearing, 'next');
2723      }
2724      if (e.which === PREV_KEY) {
2725        this.go(clearing, 'prev');
2726      }
2727      if (e.which === ESC_KEY) {
2728        this.S('a.clearing-close').trigger('click').trigger('click.fndtn.clearing');
2729      }
2730    },
2731
2732    nav : function (e, direction) {
2733      var clearing = $('ul[' + this.attr_name() + ']', '.clearing-blackout');
2734
2735      e.preventDefault();
2736      this.go(clearing, direction);
2737    },
2738
2739    resize : function () {
2740      var image = $('img', '.clearing-blackout .visible-img'),
2741          label = $('.clearing-touch-label', '.clearing-blackout');
2742
2743      if (image.length) {
2744        this.center_and_label(image, label);
2745        image.trigger('resized.fndtn.clearing')
2746      }
2747    },
2748
2749    // visual adjustments
2750    fix_height : function (target) {
2751      var lis = target.parent().children(),
2752          self = this;
2753
2754      lis.each(function () {
2755        var li = self.S(this),
2756            image = li.find('img');
2757
2758        if (li.height() > image.outerHeight()) {
2759          li.addClass('fix-height');
2760        }
2761      })
2762      .closest('ul')
2763      .width(lis.length * 100 + '%');
2764
2765      return this;
2766    },
2767
2768    update_paddles : function (target) {
2769      target = target.closest('li');
2770      var visible_image = target
2771        .closest('.carousel')
2772        .siblings('.visible-img');
2773
2774      if (target.next().length > 0) {
2775        this.S('.clearing-main-next', visible_image).removeClass('disabled');
2776      } else {
2777        this.S('.clearing-main-next', visible_image).addClass('disabled');
2778      }
2779
2780      if (target.prev().length > 0) {
2781        this.S('.clearing-main-prev', visible_image).removeClass('disabled');
2782      } else {
2783        this.S('.clearing-main-prev', visible_image).addClass('disabled');
2784      }
2785    },
2786
2787    center_and_label : function (target, label) {
2788      if (!this.rtl && label.length > 0) {
2789        label.css({
2790          marginLeft : -(label.outerWidth() / 2),
2791          marginTop : -(target.outerHeight() / 2)-label.outerHeight()-10
2792        });
2793      } else {
2794        label.css({
2795          marginRight : -(label.outerWidth() / 2),
2796          marginTop : -(target.outerHeight() / 2)-label.outerHeight()-10,
2797          left: 'auto',
2798          right: '50%'
2799        });
2800      }
2801      return this;
2802    },
2803
2804    // image loading and preloading
2805
2806    load : function ($image) {
2807      var href;
2808
2809      if ($image[0].nodeName === 'A') {
2810        href = $image.attr('href');
2811      } else {
2812        href = $image.closest('a').attr('href');
2813      }
2814
2815      this.preload($image);
2816
2817      if (href) {
2818        return href;
2819      }
2820      return $image.attr('src');
2821    },
2822
2823    preload : function ($image) {
2824      this
2825        .img($image.closest('li').next())
2826        .img($image.closest('li').prev());
2827    },
2828
2829    img : function (img) {
2830      if (img.length) {
2831        var new_img = new Image(),
2832            new_a = this.S('a', img);
2833
2834        if (new_a.length) {
2835          new_img.src = new_a.attr('href');
2836        } else {
2837          new_img.src = this.S('img', img).attr('src');
2838        }
2839      }
2840      return this;
2841    },
2842
2843    // image caption
2844
2845    caption : function (container, $image) {
2846      var caption = $image.attr('data-caption');
2847
2848      if (caption) {
2849        container
2850          .html(caption)
2851          .show();
2852      } else {
2853        container
2854          .text('')
2855          .hide();
2856      }
2857      return this;
2858    },
2859
2860    // directional methods
2861
2862    go : function ($ul, direction) {
2863      var current = this.S('.visible', $ul),
2864          target = current[direction]();
2865
2866      // Check for skip selector.
2867      if (this.settings.skip_selector && target.find(this.settings.skip_selector).length != 0) {
2868        target = target[direction]();
2869      }
2870
2871      if (target.length) {
2872        this.S('img', target)
2873          .trigger('click', [current, target]).trigger('click.fndtn.clearing', [current, target])
2874          .trigger('change.fndtn.clearing');
2875      }
2876    },
2877
2878    shift : function (current, target, callback) {
2879      var clearing = target.parent(),
2880          old_index = this.settings.prev_index || target.index(),
2881          direction = this.direction(clearing, current, target),
2882          dir = this.rtl ? 'right' : 'left',
2883          left = parseInt(clearing.css('left'), 10),
2884          width = target.outerWidth(),
2885          skip_shift;
2886
2887      var dir_obj = {};
2888
2889      // we use jQuery animate instead of CSS transitions because we
2890      // need a callback to unlock the next animation
2891      // needs support for RTL **
2892      if (target.index() !== old_index && !/skip/.test(direction)) {
2893        if (/left/.test(direction)) {
2894          this.lock();
2895          dir_obj[dir] = left + width;
2896          clearing.animate(dir_obj, 300, this.unlock());
2897        } else if (/right/.test(direction)) {
2898          this.lock();
2899          dir_obj[dir] = left - width;
2900          clearing.animate(dir_obj, 300, this.unlock());
2901        }
2902      } else if (/skip/.test(direction)) {
2903        // the target image is not adjacent to the current image, so
2904        // do we scroll right or not
2905        skip_shift = target.index() - this.settings.up_count;
2906        this.lock();
2907
2908        if (skip_shift > 0) {
2909          dir_obj[dir] = -(skip_shift * width);
2910          clearing.animate(dir_obj, 300, this.unlock());
2911        } else {
2912          dir_obj[dir] = 0;
2913          clearing.animate(dir_obj, 300, this.unlock());
2914        }
2915      }
2916
2917      callback();
2918    },
2919
2920    direction : function ($el, current, target) {
2921      var lis = this.S('li', $el),
2922          li_width = lis.outerWidth() + (lis.outerWidth() / 4),
2923          up_count = Math.floor(this.S('.clearing-container').outerWidth() / li_width) - 1,
2924          target_index = lis.index(target),
2925          response;
2926
2927      this.settings.up_count = up_count;
2928
2929      if (this.adjacent(this.settings.prev_index, target_index)) {
2930        if ((target_index > up_count) && target_index > this.settings.prev_index) {
2931          response = 'right';
2932        } else if ((target_index > up_count - 1) && target_index <= this.settings.prev_index) {
2933          response = 'left';
2934        } else {
2935          response = false;
2936        }
2937      } else {
2938        response = 'skip';
2939      }
2940
2941      this.settings.prev_index = target_index;
2942
2943      return response;
2944    },
2945
2946    adjacent : function (current_index, target_index) {
2947      for (var i = target_index + 1; i >= target_index - 1; i--) {
2948        if (i === current_index) {
2949          return true;
2950        }
2951      }
2952      return false;
2953    },
2954
2955    // lock management
2956
2957    lock : function () {
2958      this.settings.locked = true;
2959    },
2960
2961    unlock : function () {
2962      this.settings.locked = false;
2963    },
2964
2965    locked : function () {
2966      return this.settings.locked;
2967    },
2968
2969    off : function () {
2970      this.S(this.scope).off('.fndtn.clearing');
2971      this.S(window).off('.fndtn.clearing');
2972    },
2973
2974    reflow : function () {
2975      this.init();
2976    }
2977  };
2978
2979}(jQuery, window, window.document));
2980;(function ($, window, document, undefined) {
2981  'use strict';
2982
2983  var noop = function () {};
2984
2985  var Orbit = function (el, settings) {
2986    // Don't reinitialize plugin
2987    if (el.hasClass(settings.slides_container_class)) {
2988      return this;
2989    }
2990
2991    var self = this,
2992        container,
2993        slides_container = el,
2994        number_container,
2995        bullets_container,
2996        timer_container,
2997        idx = 0,
2998        animate,
2999        timer,
3000        locked = false,
3001        adjust_height_after = false;
3002
3003    self.slides = function () {
3004      return slides_container.children(settings.slide_selector);
3005    };
3006
3007    self.slides().first().addClass(settings.active_slide_class);
3008
3009    self.update_slide_number = function (index) {
3010      if (settings.slide_number) {
3011        number_container.find('span:first').text(parseInt(index) + 1);
3012        number_container.find('span:last').text(self.slides().length);
3013      }
3014      if (settings.bullets) {
3015        bullets_container.children().removeClass(settings.bullets_active_class);
3016        $(bullets_container.children().get(index)).addClass(settings.bullets_active_class);
3017      }
3018    };
3019
3020    self.update_active_link = function (index) {
3021      var link = $('[data-orbit-link="' + self.slides().eq(index).attr('data-orbit-slide') + '"]');
3022      link.siblings().removeClass(settings.bullets_active_class);
3023      link.addClass(settings.bullets_active_class);
3024    };
3025
3026    self.build_markup = function () {
3027      slides_container.wrap('<div class="' + settings.container_
3027class + '"></div>');
3028      container = slides_container.parent();
3029      slides_container.addClass(settings.slides_container_class);
3030
3031      if (settings.stack_on_small) {
3032        container.addClass(settings.stack_on_small_class);
3033      }
3034
3035      if (settings.navigation_arrows) {
3036        container.append($('<a href="#"><span></span></a>').addClass(settings.prev_class));
3037        container.append($('<a href="#"><span></span></a>').addClass(settings.next_class));
3038      }
3039
3040      if (settings.timer) {
3041        timer_container = $('<div>').addClass(settings.timer_container_class);
3042        timer_container.append('<span>');
3043        timer_container.append($('<div>').addClass(settings.timer_progress_class));
3044        timer_container.addClass(settings.timer_paused_class);
3045        container.append(timer_container);
3046      }
3047
3048      if (settings.slide_number) {
3049        number_container = $('<div>').addClass(settings.slide_number_class);
3050        number_container.append('<span></span> ' + settings.slide_number_text + ' <span></span>');
3051        container.append(number_container);
3052      }
3053
3054      if (settings.bullets) {
3055        bullets_container = $('<ol>').addClass(settings.bullets_container_class);
3056        container.append(bullets_container);
3057        bullets_container.wrap('<div class="orbit-bullets-container"></div>');
3058        self.slides().each(function (idx, el) {
3059          var bullet = $('<li>').attr('data-orbit-slide', idx).on('click', self.link_bullet);;
3060          bullets_container.append(bullet);
3061        });
3062      }
3063
3064    };
3065
3066    self._goto = function (next_idx, start_timer) {
3067      // if (locked) {return false;}
3068      if (next_idx === idx) {return false;}
3069      if (typeof timer === 'object') {timer.restart();}
3070      var slides = self.slides();
3071
3072      var dir = 'next';
3073      locked = true;
3074      if (next_idx < idx) {dir = 'prev';}
3075      if (next_idx >= slides.length) {
3076        if (!settings.circular) {
3077          return false;
3078        }
3079        next_idx = 0;
3080      } else if (next_idx < 0) {
3081        if (!settings.circular) {
3082          return false;
3083        }
3084        next_idx = slides.length - 1;
3085      }
3086
3087      var current = $(slides.get(idx));
3088      var next = $(slides.get(next_idx));
3089
3090      current.css('zIndex', 2);
3091      current.removeClass(settings.active_slide_class);
3092      next.css('zIndex', 4).addClass(settings.active_slide_class);
3093
3094      slides_container.trigger('before-slide-change.fndtn.orbit');
3095      settings.before_slide_change();
3096      self.update_active_link(next_idx);
3097
3098      var callback = function () {
3099        var unlock = function () {
3100          idx = next_idx;
3101          locked = false;
3102          if (start_timer === true) {timer = self.create_timer(); timer.start();}
3103          self.update_slide_number(idx);
3104          slides_container.trigger('after-slide-change.fndtn.orbit', [{slide_number : idx, total_slides : slides.length}]);
3105          settings.after_slide_change(idx, slides.length);
3106        };
3107        if (slides_container.outerHeight() != next.outerHeight() && settings.variable_height) {
3108          slides_container.animate({'height': next.outerHeight()}, 250, 'linear', unlock);
3109        } else {
3110          unlock();
3111        }
3112      };
3113
3114      if (slides.length === 1) {callback(); return false;}
3115
3116      var start_animation = function () {
3117        if (dir === 'next') {animate.next(current, next, callback);}
3118        if (dir === 'prev') {animate.prev(current, next, callback);}
3119      };
3120
3121      if (next.outerHeight() > slides_container.outerHeight() && settings.variable_height) {
3122        slides_container.animate({'height': next.outerHeight()}, 250, 'linear', start_animation);
3123      } else {
3124        start_animation();
3125      }
3126    };
3127
3128    self.next = function (e) {
3129      e.stopImmediatePropagation();
3130      e.preventDefault();
3131      self._goto(idx + 1);
3132    };
3133
3134    self.prev = function (e) {
3135      e.stopImmediatePropagation();
3136      e.preventDefault();
3137      self._goto(idx - 1);
3138    };
3139
3140    self.link_custom = function (e) {
3141      e.preventDefault();
3142      var link = $(this).attr('data-orbit-link');
3143      if ((typeof link === 'string') && (link = $.trim(link)) != '') {
3144        var slide = container.find('[data-orbit-slide=' + link + ']');
3145        if (slide.index() != -1) {self._goto(slide.index());}
3146      }
3147    };
3148
3149    self.link_bullet = function (e) {
3150      var index = $(this).attr('data-orbit-slide');
3151      if ((typeof index === 'string') && (index = $.trim(index)) != '') {
3152        if (isNaN(parseInt(index))) {
3153          var slide = container.find('[data-orbit-slide=' + index + ']');
3154          if (slide.index() != -1) {self._goto(slide.index() + 1);}
3155        } else {
3156          self._goto(parseInt(index));
3157        }
3158      }
3159
3160    }
3161
3162    self.timer_callback = function () {
3163      self._goto(idx + 1, true);
3164    }
3165
3166    self.compute_dimensions = function () {
3167      var current = $(self.slides().get(idx));
3168      var h = current.outerHeight();
3169      if (!settings.variable_height) {
3170        self.slides().each(function(){
3171          if ($(this).outerHeight() > h) { h = $(this).outerHeight(); }
3172        });
3173      }
3174      slides_container.height(h);
3175    };
3176
3177    self.create_timer = function () {
3178      var t = new Timer(
3179        container.find('.' + settings.timer_container_class),
3180        settings,
3181        self.timer_callback
3182      );
3183      return t;
3184    };
3185
3186    self.stop_timer = function () {
3187      if (typeof timer === 'object') {
3188        timer.stop();
3189      }
3190    };
3191
3192    self.toggle_timer = function () {
3193      var t = container.find('.' + settings.timer_container_class);
3194      if (t.hasClass(settings.timer_paused_class)) {
3195        if (typeof timer === 'undefined') {timer = self.create_timer();}
3196        timer.start();
3197      } else {
3198        if (typeof timer === 'object') {timer.stop();}
3199      }
3200    };
3201
3202    self.init = function () {
3203      self.build_markup();
3204      if (settings.timer) {
3205        timer = self.create_timer();
3206        Foundation.utils.image_loaded(this.slides().children('img'), timer.start);
3207      }
3208      animate = new FadeAnimation(settings, slides_container);
3209      if (settings.animation === 'slide') {
3210        animate = new SlideAnimation(settings, slides_container);
3211      }
3212
3213      container.on('click', '.' + settings.next_class, self.next);
3214      container.on('click', '.' + settings.prev_class, self.prev);
3215
3216      if (settings.next_on_click) {
3217        container.on('click', '.' + settings.slides_container_class + ' [data-orbit-slide]', self.link_bullet);
3218      }
3219
3220      container.on('click', self.toggle_timer);
3221      if (settings.swipe) {
3222        container.on('touchstart.fndtn.orbit', function (e) {
3223          if (!e.touches) {e = e.originalEvent;}
3224          var data = {
3225            start_page_x : e.touches[0].pageX,
3226            start_page_y : e.touches[0].pageY,
3227            start_time : (new Date()).getTime(),
3228            delta_x : 0,
3229            is_scrolling : undefined
3230          };
3231          container.data('swipe-transition', data);
3232          e.stopPropagation();
3233        })
3234        .on('touchmove.fndtn.orbit', function (e) {
3235          if (!e.touches) {
3236            e = e.originalEvent;
3237          }
3238          // Ignore pinch/zoom events
3239          if (e.touches.length > 1 || e.scale && e.scale !== 1) {
3240            return;
3241          }
3242
3243          var data = container.data('swipe-transition');
3244          if (typeof data === 'undefined') {data = {};}
3245
3246          data.delta_x = e.touches[0].pageX - data.start_page_x;
3247
3248          if ( typeof data.is_scrolling === 'undefined') {
3249            data.is_scrolling = !!( data.is_scrolling || Math.abs(data.delta_x) < Math.abs(e.touches[0].pageY - data.start_page_y) );
3250          }
3251
3252          if (!data.is_scrolling && !data.active) {
3253            e.preventDefault();
3254            var direction = (data.delta_x < 0) ? (idx + 1) : (idx - 1);
3255            data.active = true;
3256            self._goto(direction);
3257          }
3258        })
3259        .on('touchend.fndtn.orbit', function (e) {
3260          container.data('swipe-transition', {});
3261          e.stopPropagation();
3262        })
3263      }
3264      container.on('mouseenter.fndtn.orbit', function (e) {
3265        if (settings.timer && settings.pause_on_hover) {
3266          self.stop_timer();
3267        }
3268      })
3269      .on('mouseleave.fndtn.orbit', function (e) {
3270        if (settings.timer && settings.resume_on_mouseout) {
3271          timer.start();
3272        }
3273      });
3274
3275      $(document).on('click', '[data-orbit-link]', self.link_custom);
3276      $(window).on('load resize', self.compute_dimensions);
3277      Foundation.utils.image_loaded(this.slides().children('img'), self.compute_dimensions);
3278      Foundation.utils.image_loaded(this.slides().children('img'), function () {
3279        container.prev('.' + settings.preloader_class).css('display', 'none');
3280        self.update_slide_number(0);
3281        self.update_active_link(0);
3282        slides_container.trigger('ready.fndtn.orbit');
3283      });
3284    };
3285
3286    self.init();
3287  };
3288
3289  var Timer = function (el, settings, callback) {
3290    var self = this,
3291        duration = settings.timer_speed,
3292        progress = el.find('.' + settings.timer_progress_class),
3293        start,
3294        timeout,
3295        left = -1;
3296
3297    this.update_progress = function (w) {
3298      var new_progress = progress.clone();
3299      new_progress.attr('style', '');
3300      new_progress.css('width', w + '%');
3301      progress.replaceWith(new_progress);
3302      progress = new_progress;
3303    };
3304
3305    this.restart = function () {
3306      clearTimeout(timeout);
3307      el.addClass(settings.timer_paused_class);
3308      left = -1;
3309      self.update_progress(0);
3310    };
3311
3312    this.start = function () {
3313      if (!el.hasClass(settings.timer_paused_class)) {return true;}
3314      left = (left === -1) ? duration : left;
3315      el.removeClass(settings.timer_paused_class);
3316      start = new Date().getTime();
3317      progress.animate({'width' : '100%'}, left, 'linear');
3318      timeout = setTimeout(function () {
3319        self.restart();
3320        callback();
3321      }, left);
3322      el.trigger('timer-started.fndtn.orbit')
3323    };
3324
3325    this.stop = function () {
3326      if (el.hasClass(settings.timer_paused_class)) {return true;}
3327      clearTimeout(timeout);
3328      el.addClass(settings.timer_paused_class);
3329      var end = new Date().getTime();
3330      left = left - (end - start);
3331      var w = 100 - ((left / duration) * 100);
3332      self.update_progress(w);
3333      el.trigger('timer-stopped.fndtn.orbit');
3334    };
3335  };
3336
3337  var SlideAnimation = function (settings, container) {
3338    var duration = settings.animation_speed;
3339    var is_rtl = ($('html[dir=rtl]').length === 1);
3340    var margin = is_rtl ? 'marginRight' : 'marginLeft';
3341    var animMargin = {};
3342    animMargin[margin] = '0%';
3343
3344    this.next = function (current, next, callback) {
3345      current.animate({marginLeft : '-100%'}, duration);
3346      next.animate(animMargin, duration, function () {
3347        current.css(margin, '100%');
3348        callback();
3349      });
3350    };
3351
3352    this.prev = function (current, prev, callback) {
3353      current.animate({marginLeft : '100%'}, duration);
3354      prev.css(margin, '-100%');
3355      prev.animate(animMargin, duration, function () {
3356        current.css(margin, '100%');
3357        callback();
3358      });
3359    };
3360  };
3361
3362  var FadeAnimation = function (settings, container) {
3363    var duration = settings.animation_speed;
3364    var is_rtl = ($('html[dir=rtl]').length === 1);
3365    var margin = is_rtl ? 'marginRight' : 'marginLeft';
3366
3367    this.next = function (current, next, callback) {
3368      next.css({'margin' : '0%', 'opacity' : '0.01'});
3369      next.animate({'opacity' :'1'}, duration, 'linear', function () {
3370        current.css('margin', '100%');
3371        callback();
3372      });
3373    };
3374
3375    this.prev = function (current, prev, callback) {
3376      prev.css({'margin' : '0%', 'opacity' : '0.01'});
3377      prev.animate({'opacity' : '1'}, duration, 'linear', function () {
3378        current.css('margin', '100%');
3379        callback();
3380      });
3381    };
3382  };
3383
3384  Foundation.libs = Foundation.libs || {};
3385
3386  Foundation.libs.orbit = {
3387    name : 'orbit',
3388
3389    version : '5.5.1',
3390
3391    settings : {
3392      animation : 'slide',
3393      timer_speed : 10000,
3394      pause_on_hover : true,
3395      resume_on_mouseout : false,
3396      next_on_click : true,
3397      animation_speed : 500,
3398      stack_on_small : false,
3399      navigation_arrows : true,
3400      slide_number : true,
3401      slide_number_text : 'of',
3402      container_class : 'orbit-container',
3403      stack_on_small_class : 'orbit-stack-on-small',
3404      next_class : 'orbit-next',
3405      prev_class : 'orbit-prev',
3406      timer_container_class : 'orbit-timer',
3407      timer_paused_class : 'paused',
3408      timer_progress_class : 'orbit-progress',
3409      slides_container_class : 'orbit-slides-container',
3410      preloader_class : 'preloader',
3411      slide_selector : '*',
3412      bullets_container_class : 'orbit-bullets',
3413      bullets_active_class : 'active',
3414      slide_number_class : 'orbit-slide-number',
3415      caption_class : 'orbit-caption',
3416      active_slide_class : 'active',
3417      orbit_transition_class : 'orbit-transitioning',
3418      bullets : true,
3419      circular : true,
3420      timer : true,
3421      variable_height : false,
3422      swipe : true,
3423      before_slide_change : noop,
3424      after_slide_change : noop
3425    },
3426
3427    init : function (scope, method, options) {
3428      var self = this;
3429      this.bindings(method, options);
3430    },
3431
3432    events : function (instance) {
3433      var orbit_instance = new Orbit(this.S(instance), this.S(instance).data('orbit-init'));
3434      this.S(instance).data(this.name + '-instance', orbit_instance);
3435    },
3436
3437    reflow : function () {
3438      var self = this;
3439
3440      if (self.S(self.scope).is('[data-orbit]')) {
3441        var $el = self.S(self.scope);
3442        var instance = $el.data(self.name + '-instance');
3443        instance.compute_dimensions();
3444      } else {
3445        self.S('[data-orbit]', self.scope).each(function (idx, el) {
3446          var $el = self.S(el);
3447          var opts = self.data_options($el);
3448          var instance = $el.data(self.name + '-instance');
3449          instance.compute_dimensions();
3450        });
3451      }
3452    }
3453  };
3454
3455}(jQuery, window, window.document));
3456;(function ($, window, document, undefined) {
3457  'use strict';
3458
3459  Foundation.libs.offcanvas = {
3460    name : 'offcanvas',
3461
3462    version : '5.5.1',
3463
3464    settings : {
3465      open_method : 'move',
3466      close_on_click : false
3467    },
3468
3469    init : function (scope, method, options) {
3470      this.bindings(method, options);
3471    },
3472
3473    events : function () {
3474      var self = this,
3475          S = self.S,
3476          move_class = '',
3477          right_postfix = '',
3478          left_postfix = '';
3479
3480      if (this.settings.open_method === 'move') {
3481        move_class = 'move-';
3482        right_postfix = 'right';
3483        left_postfix = 'left';
3484      } else if (this.settings.open_method === 'overlap_single') {
3485        move_class = 'offcanvas-overlap-';
3486        right_postfix = 'right';
3487        left_postfix = 'left';
3488      } else if (this.settings.open_method === 'overlap') {
3489        move_class = 'offcanvas-overlap';
3490      }
3491
3492      S(this.scope).off('.offcanvas')
3493        .on('click.fndtn.offcanvas', '.left-off-canvas-toggle', function (e) {
3494          self.click_toggle_class(e, move_class + right_postfix);
3495          if (self.settings.open_method !== 'overlap') {
3496            S('.left-submenu').removeClass(move_class + right_postfix);
3497          }
3498          $('.left-off-canvas-toggle').attr('aria-expanded', 'true');
3499        })
3500        .on('click.fndtn.offcanvas', '.left-off-canvas-menu a', function (e) {
3501          var settings = self.get_settings(e);
3502          var parent = S(this).parent();
3503
3504          if (settings.close_on_click && !parent.hasClass('has-submenu') && !parent.hasClass('back')) {
3505            self.hide.call(self, move_class + right_postfix, self.get_wrapper(e));
3506            parent.parent().removeClass(move_class + right_postfix);
3507          } else if (S(this).parent().hasClass('has-submenu')) {
3508            e.preventDefault();
3509            S(this).siblings('.left-submenu').toggleClass(move_class + right_postfix);
3510          } else if (parent.hasClass('back')) {
3511            e.preventDefault();
3512            parent.parent().removeClass(move_class + right_postfix);
3513          }
3514          $('.left-off-canvas-toggle').attr('aria-expanded', 'true');
3515        })
3516        .on('click.fndtn.offcanvas', '.right-off-canvas-toggle', function (e) {
3517          self.click_toggle_class(e, move_class + left_postfix);
3518          if (self.settings.open_method !== 'overlap') {
3519            S('.right-submenu').removeClass(move_class + left_postfix);
3520          }
3521          $('.right-off-canvas-toggle').attr('aria-expanded', 'true');
3522        })
3523        .on('click.fndtn.offcanvas', '.right-off-canvas-menu a', function (e) {
3524          var settings = self.get_settings(e);
3525          var parent = S(this).parent();
3526
3527          if (settings.close_on_click && !parent.hasClass('has-submenu') && !parent.hasClass('back')) {
3528            self.hide.call(self, move_class + left_postfix, self.get_wrapper(e));
3529            parent.parent().removeClass(move_class + left_postfix);
3530          } else if (S(this).parent().hasClass('has-submenu')) {
3531            e.preventDefault();
3532            S(this).siblings('.right-submenu').toggleClass(move_class + left_postfix);
3533          } else if (parent.hasClass('back')) {
3534            e.preventDefault();
3535            parent.parent().removeClass(move_class + left_postfix);
3536          }
3537          $('.right-off-canvas-toggle').attr('aria-expanded', 'true');
3538        })
3539        .on('click.fndtn.offcanvas', '.exit-off-canvas', function (e) {
3540          self.click_remove_class(e, move_class + left_postfix);
3541          S('.right-submenu').removeClass(move_class + left_postfix);
3542          if (right_postfix) {
3543            self.click_remove_class(e, move_class + right_postfix);
3544            S('.left-submenu').removeClass(move_class + left_postfix);
3545          }
3546          $('.right-off-canvas-toggle').attr('aria-expanded', 'true');
3547        })
3548        .on('click.fndtn.offcanvas', '.exit-off-canvas', function (e) {
3549          self.click_remove_class(e, move_class + left_postfix);
3550          $('.left-off-canvas-toggle').attr('aria-expanded', 'false');
3551          if (right_postfix) {
3552            self.click_remove_class(e, move_class + right_postfix);
3553            $('.right-off-canvas-toggle').attr('aria-expanded', 'false');
3554          }
3555        });
3556    },
3557
3558    toggle : function (class_name, $off_canvas) {
3559      $off_canvas = $off_canvas || this.get_wrapper();
3560      if ($off_canvas.is('.' + class_name)) {
3561        this.hide(class_name, $off_canvas);
3562      } else {
3563        this.show(class_name, $off_canvas);
3564      }
3565    },
3566
3567    show : function (class_name, $off_canvas) {
3568      $off_canvas = $off_canvas || this.get_wrapper();
3569      $off_canvas.trigger('open').trigger('open.fndtn.offcanvas');
3570      $off_canvas.addClass(class_name);
3571    },
3572
3573    hide : function (class_name, $off_canvas) {
3574      $off_canvas = $off_canvas || this.get_wrapper();
3575      $off_canvas.trigger('close').trigger('close.fndtn.offcanvas');
3576      $off_canvas.removeClass(class_name);
3577    },
3578
3579    click_toggle_class : function (e, class_name) {
3580      e.preventDefault();
3581      var $off_canvas = this.get_wrapper(e);
3582      this.toggle(class_name, $off_canvas);
3583    },
3584
3585    click_remove_class : function (e, class_name) {
3586      e.preventDefault();
3587      var $off_canvas = this.get_wrapper(e);
3588      this.hide(class_name, $off_canvas);
3589    },
3590
3591    get_settings : function (e) {
3592      var offcanvas  = this.S(e.target).closest('[' + this.attr_name() + ']');
3593      return offcanvas.data(this.attr_name(true) + '-init') || this.settings;
3594    },
3595
3596    get_wrapper : function (e) {
3597      var $off_canvas = this.S(e ? e.target : this.scope).closest('.off-canvas-wrap');
3598
3599      if ($off_canvas.length === 0) {
3600        $off_canvas = this.S('.off-canvas-wrap');
3601      }
3602      return $off_canvas;
3603    },
3604
3605    reflow : function () {}
3606  };
3607}(jQuery, window, window.document));
3608;(function ($, window, document, undefined) {
3609  'use strict';
3610
3611  Foundation.libs.alert = {
3612    name : 'alert',
3613
3614    version : '5.5.1',
3615
3616    settings : {
3617      callback : function () {}
3618    },
3619
3620    init : function (scope, method, options) {
3621      this.bindings(method, options);
3622    },
3623
3624    events : function () {
3625      var self = this,
3626          S = this.S;
3627
3628      $(this.scope).off('.alert').on('click.fndtn.alert', '[' + this.attr_name() + '] .close', function (e) {
3629        var alertBox = S(this).closest('[' + self.attr_name() + ']'),
3630            settings = alertBox.data(self.attr_name(true) + '-init') || self.settings;
3631
3632        e.preventDefault();
3633        if (Modernizr.csstransitions) {
3634          alertBox.addClass('alert-close');
3635          alertBox.on('transitionend webkitTransitionEnd oTransitionEnd', function (e) {
3636            S(this).trigger('close').trigger('close.fndtn.alert').remove();
3637            settings.callback();
3638          });
3639        } else {
3640          alertBox.fadeOut(300, function () {
3641            S(this).trigger('close').trigger('close.fndtn.alert').remove();
3642            settings.callback();
3643          });
3644        }
3645      });
3646    },
3647
3648    reflow : function () {}
3649  };
3650}(jQuery, window, window.document));
3651;(function ($, window, document, undefined) {
3652  'use strict';
3653
3654  Foundation.libs.reveal = {
3655    name : 'reveal',
3656
3657    version : '5.5.1',
3658
3659    locked : false,
3660
3661    settings : {
3662      animation : 'fadeAndPop',
3663      animation_speed : 250,
3664      close_on_background_click : true,
3665      close_on_esc : true,
3666      dismiss_modal_class : 'close-reveal-modal',
3667      multiple_opened : false,
3668      bg_class : 'reveal-modal-bg',
3669      root_element : 'body',
3670      open : function(){},
3671      opened : function(){},
3672      close : function(){},
3673      closed : function(){},
3674      bg : $('.reveal-modal-bg'),
3675      css : {
3676        open : {
3677          'opacity' : 0,
3678          'visibility' : 'visible',
3679          'display' : 'block'
3680        },
3681        close : {
3682          'opacity' : 1,
3683          'visibility' : 'hidden',
3684          'display' : 'none'
3685        }
3686      }
3687    },
3688
3689    init : function (scope, method, options) {
3690      $.extend(true, this.settings, method, options);
3691      this.bindings(method, options);
3692    },
3693
3694    events : function (scope) {
3695      var self = this,
3696          S = self.S;
3697
3698      S(this.scope)
3699        .off('.reveal')
3700        .on('click.fndtn.reveal', '[' + this.add_namespace('data-reveal-id') + ']:not([disabled])', function (e) {
3701          e.preventDefault();
3702
3703          if (!self.locked) {
3704            var element = S(this),
3705                ajax = element.data(self.data_attr('reveal-ajax'));
3706
3707            self.locked = true;
3708
3709            if (typeof ajax === 'undefined') {
3710              self.open.call(self, element);
3711            } else {
3712              var url = ajax === true ? element.attr('href') : ajax;
3713
3714              self.open.call(self, element, {url : url});
3715            }
3716          }
3717        });
3718
3719      S(document)
3720        .on('click.fndtn.reveal', this.close_targets(), function (e) {
3721          e.preventDefault();
3722          if (!self.locked) {
3723            var settings = S('[' + self.attr_name() + '].open').data(self.attr_name(true) + '-init') || self.settings,
3724                bg_clicked = S(e.target)[0] === S('.' + settings.bg_class)[0];
3725
3726            if (bg_clicked) {
3727              if (settings.close_on_background_click) {
3728                e.stopPropagation();
3729              } else {
3730                return;
3731              }
3732            }
3733
3734            self.locked = true;
3735            self.close.call(self, bg_clicked ? S('[' + self.attr_name() + '].open') : S(this).closest('[' + self.attr_name() + ']'));
3736          }
3737        });
3738
3739      if (S('[' + self.attr_name() + ']', this.scope).length > 0) {
3740        S(this.scope)
3741          // .off('.reveal')
3742          .on('open.fndtn.reveal', this.settings.open)
3743          .on('opened.fndtn.reveal', this.settings.opened)
3744          .on('opened.fndtn.reveal', this.open_video)
3745          .on('close.fndtn.reveal', this.settings.close)
3746          .on('closed.fndtn.reveal', this.settings.closed)
3747          .on('closed.fndtn.reveal', this.close_video);
3748      } else {
3749        S(this.scope)
3750          // .off('.reveal')
3751          .on('open.fndtn.reveal', '[' + self.attr_name() + ']', this.settings.open)
3752          .on('opened.fndtn.reveal', '[' + self.attr_name() + ']', this.settings.opened)
3753          .on('opened.fndtn.reveal', '[' + self.attr_name() + ']', this.open_video)
3754          .on('close.fndtn.reveal', '[' + self.attr_name() + ']', this.settings.close)
3755          .on('closed.fndtn.reveal', '[' + self.attr_name() + ']', this.settings.closed)
3756          .on('closed.fndtn.reveal', '[' + self.attr_name() + ']', this.close_video);
3757      }
3758
3759      return true;
3760    },
3761
3762    // PATCH #3: turning on key up capture only when a reveal window is open
3763    key_up_on : function (scope) {
3764      var self = this;
3765
3766      // PATCH #1: fixing multiple keyup event trigger from single key press
3767      self.S('body').off('keyup.fndtn.reveal').on('keyup.fndtn.reveal', function ( event ) {
3768        var open_modal = self.S('[' + self.attr_name() + '].open'),
3769            settings = open_modal.data(self.attr_name(true) + '-init') || self.settings ;
3770        // PATCH #2: making sure that the close event can be called only while unlocked,
3771        //           so that multiple keyup.fndtn.reveal events don't prevent clean closing of the reveal window.
3772        if ( settings && event.which === 27  && settings.close_on_esc && !self.locked) { // 27 is the keycode for the Escape key
3773          self.close.call(self, open_modal);
3774        }
3775      });
3776
3777      return true;
3778    },
3779
3780    // PATCH #3: turning on key up capture only when a reveal window is open
3781    key_up_off : function (scope) {
3782      this.S('body').off('keyup.fndtn.reveal');
3783      return true;
3784    },
3785
3786    open : function (target, ajax_settings) {
3787      var self = this,
3788          modal;
3789
3790      if (target) {
3791        if (typeof target.selector !== 'undefined') {
3792          // Find the named node; only use the first one found, since the rest of the code assumes there's only one node
3793          modal = self.S('#' + target.data(self.data_attr('reveal-id'))).first();
3794        } else {
3795          modal = self.S(this.scope);
3796
3797          ajax_settings = target;
3798        }
3799      } else {
3800        modal = self.S(this.scope);
3801      }
3802
3803      var settings = modal.data(self.attr_name(true) + '-init');
3804      settings = settings || this.settings;
3805
3806      if (modal.hasClass('open') && target.attr('data-reveal-id') == modal.attr('id')) {
3807        return self.close(modal);
3808      }
3809
3810      if (!modal.hasClass('open')) {
3811        var open_modal = self.S('[' + self.attr_name() + '].open');
3812
3813        if (typeof modal.data('css-top') === 'undefined') {
3814          modal.data('css-top', parseInt(modal.css('top'), 10))
3815            .data('offset', this.cache_offset(modal));
3816        }
3817
3818        this.key_up_on(modal);    // PATCH #3: turning on key up capture only when a reveal window is open
3819
3820        modal.on('open.fndtn.reveal').trigger('open.fndtn.reveal');
3821
3822        if (open_modal.length < 1) {
3823          this.toggle_bg(modal, true);
3824        }
3825
3826        if (typeof ajax_settings === 'string') {
3827          ajax_settings = {
3828            url : ajax_settings
3829          };
3830        }
3831
3832        if (typeof ajax_settings === 'undefined' || !ajax_settings.url) {
3833          if (open_modal.length > 0) {
3834            if (settings.multiple_opened) {
3835              this.to_back(open_modal);
3836            } else {
3837              this.hide(open_modal, settings.css.close);
3838            }
3839          }
3840
3841          this.show(modal, settings.css.open);
3842        } else {
3843          var old_success = typeof ajax_settings.success !== 'undefined' ? ajax_settings.success : null;
3844
3845          $.extend(ajax_settings, {
3846            success : function (data, textStatus, jqXHR) {
3847              if ( $.isFunction(old_success) ) {
3848                var result = old_success(data, textStatus, jqXHR);
3849                if (typeof result == 'string') {
3850                  data = result;
3851                }
3852              }
3853
3854              modal.html(data);
3855              self.S(modal).foundation('section', 'reflow');
3856              self.S(modal).children().foundation();
3857
3858              if (open_modal.length > 0) {
3859                if (settings.multiple_opened) {
3860                  this.to_back(open_modal);
3861                } else {
3862                  this.hide(open_modal, settings.css.close);
3863                }
3864              }
3865              self.show(modal, settings.css.open);
3866            }
3867          });
3868
3869          $.ajax(ajax_settings);
3870        }
3871      }
3872      self.S(window).trigger('resize');
3873    },
3874
3875    close : function (modal) {
3876      var modal = modal && modal.length ? modal : this.S(this.scope),
3877          open_modals = this.S('[' + this.attr_name() + '].open'),
3878          settings = modal.data(this.attr_name(true) + '-init') || this.settings;
3879
3880      if (open_modals.length > 0) {
3881        this.locked = true;
3882        this.key_up_off(modal);   // PATCH #3: turning on key up capture only when a reveal window is open
3883        modal.trigger('close').trigger('close.fndtn.reveal');
3884        
3885        if ((settings.multiple_opened && open_modals.length === 1) || !sett
3885ings.multiple_opened || modal.length > 1) {
3886          this.toggle_bg(modal, false);
3887          this.to_front(modal);
3888        }
3889        
3890        if (settings.multiple_opened) {
3891          this.hide(modal, settings.css.close, settings);
3892          this.to_front($($.makeArray(open_modals).reverse()[1]));
3893        } else {
3894          this.hide(open_modals, settings.css.close, settings);
3895        }
3896      }
3897    },
3898
3899    close_targets : function () {
3900      var base = '.' + this.settings.dismiss_modal_class;
3901
3902      if (this.settings.close_on_background_click) {
3903        return base + ', .' + this.settings.bg_class;
3904      }
3905
3906      return base;
3907    },
3908
3909    toggle_bg : function (modal, state) {
3910      if (this.S('.' + this.settings.bg_class).length === 0) {
3911        this.settings.bg = $('<div />', {'class': this.settings.bg_class})
3912          .appendTo('body').hide();
3913      }
3914
3915      var visible = this.settings.bg.filter(':visible').length > 0;
3916      if ( state != visible ) {
3917        if ( state == undefined ? visible : !state ) {
3918          this.hide(this.settings.bg);
3919        } else {
3920          this.show(this.settings.bg);
3921        }
3922      }
3923    },
3924
3925    show : function (el, css) {
3926      // is modal
3927      if (css) {
3928        var settings = el.data(this.attr_name(true) + '-init') || this.settings,
3929            root_element = settings.root_element;
3930
3931        if (el.parent(root_element).length === 0) {
3932          var placeholder = el.wrap('<div style="display: none;" />').parent();
3933
3934          el.on('closed.fndtn.reveal.wrapped', function () {
3935            el.detach().appendTo(placeholder);
3936            el.unwrap().unbind('closed.fndtn.reveal.wrapped');
3937          });
3938
3939          el.detach().appendTo(root_element);
3940        }
3941
3942        var animData = getAnimationData(settings.animation);
3943        if (!animData.animate) {
3944          this.locked = false;
3945        }
3946        if (animData.pop) {
3947          css.top = $(window).scrollTop() - el.data('offset') + 'px';
3948          var end_css = {
3949            top: $(window).scrollTop() + el.data('css-top') + 'px',
3950            opacity: 1
3951          };
3952
3953          return setTimeout(function () {
3954            return el
3955              .css(css)
3956              .animate(end_css, settings.animation_speed, 'linear', function () {
3957                this.locked = false;
3958                el.trigger('opened').trigger('opened.fndtn.reveal');
3959              }.bind(this))
3960              .addClass('open');
3961          }.bind(this), settings.animation_speed / 2);
3962        }
3963
3964        if (animData.fade) {
3965          css.top = $(window).scrollTop() + el.data('css-top') + 'px';
3966          var end_css = {opacity: 1};
3967
3968          return setTimeout(function () {
3969            return el
3970              .css(css)
3971              .animate(end_css, settings.animation_speed, 'linear', function () {
3972                this.locked = false;
3973                el.trigger('opened').trigger('opened.fndtn.reveal');
3974              }.bind(this))
3975              .addClass('open');
3976          }.bind(this), settings.animation_speed / 2);
3977        }
3978
3979        return el.css(css).show().css({opacity : 1}).addClass('open').trigger('opened').trigger('opened.fndtn.reveal');
3980      }
3981
3982      var settings = this.settings;
3983
3984      // should we animate the background?
3985      if (getAnimationData(settings.animation).fade) {
3986        return el.fadeIn(settings.animation_speed / 2);
3987      }
3988
3989      this.locked = false;
3990
3991      return el.show();
3992    },
3993    
3994    to_back : function(el) {
3995      el.addClass('toback');
3996    },
3997    
3998    to_front : function(el) {
3999      el.removeClass('toback');
4000    },
4001
4002    hide : function (el, css) {
4003      // is modal
4004      if (css) {
4005        var settings = el.data(this.attr_name(true) + '-init');
4006        settings = settings || this.settings;
4007
4008        var animData = getAnimationData(settings.animation);
4009        if (!animData.animate) {
4010          this.locked = false;
4011        }
4012        if (animData.pop) {
4013          var end_css = {
4014            top: - $(window).scrollTop() - el.data('offset') + 'px',
4015            opacity: 0
4016          };
4017
4018          return setTimeout(function () {
4019            return el
4020              .animate(end_css, settings.animation_speed, 'linear', function () {
4021                this.locked = false;
4022                el.css(css).trigger('closed').trigger('closed.fndtn.reveal');
4023              }.bind(this))
4024              .removeClass('open');
4025          }.bind(this), settings.animation_speed / 2);
4026        }
4027
4028        if (animData.fade) {
4029          var end_css = {opacity : 0};
4030
4031          return setTimeout(function () {
4032            return el
4033              .animate(end_css, settings.animation_speed, 'linear', function () {
4034                this.locked = false;
4035                el.css(css).trigger('closed').trigger('closed.fndtn.reveal');
4036              }.bind(this))
4037              .removeClass('open');
4038          }.bind(this), settings.animation_speed / 2);
4039        }
4040
4041        return el.hide().css(css).removeClass('open').trigger('closed').trigger('closed.fndtn.reveal');
4042      }
4043
4044      var settings = this.settings;
4045
4046      // should we animate the background?
4047      if (getAnimationData(settings.animation).fade) {
4048        return el.fadeOut(settings.animation_speed / 2);
4049      }
4050
4051      return el.hide();
4052    },
4053
4054    close_video : function (e) {
4055      var video = $('.flex-video', e.target),
4056          iframe = $('iframe', video);
4057
4058      if (iframe.length > 0) {
4059        iframe.attr('data-src', iframe[0].src);
4060        iframe.attr('src', iframe.attr('src'));
4061        video.hide();
4062      }
4063    },
4064
4065    open_video : function (e) {
4066      var video = $('.flex-video', e.target),
4067          iframe = video.find('iframe');
4068
4069      if (iframe.length > 0) {
4070        var data_src = iframe.attr('data-src');
4071        if (typeof data_src === 'string') {
4072          iframe[0].src = iframe.attr('data-src');
4073        } else {
4074          var src = iframe[0].src;
4075          iframe[0].src = undefined;
4076          iframe[0].src = src;
4077        }
4078        video.show();
4079      }
4080    },
4081
4082    data_attr : function (str) {
4083      if (this.namespace.length > 0) {
4084        return this.namespace + '-' + str;
4085      }
4086
4087      return str;
4088    },
4089
4090    cache_offset : function (modal) {
4091      var offset = modal.show().height() + parseInt(modal.css('top'), 10);
4092
4093      modal.hide();
4094
4095      return offset;
4096    },
4097
4098    off : function () {
4099      $(this.scope).off('.fndtn.reveal');
4100    },
4101
4102    reflow : function () {}
4103  };
4104
4105  /*
4106   * getAnimationData('popAndFade') // {animate: true,  pop: true,  fade: true}
4107   * getAnimationData('fade')       // {animate: true,  pop: false, fade: true}
4108   * getAnimationData('pop')        // {animate: true,  pop: true,  fade: false}
4109   * getAnimationData('foo')        // {animate: false, pop: false, fade: false}
4110   * getAnimationData(null)         // {animate: false, pop: false, fade: false}
4111   */
4112  function getAnimationData(str) {
4113    var fade = /fade/i.test(str);
4114    var pop = /pop/i.test(str);
4115    return {
4116      animate : fade || pop,
4117      pop : pop,
4118      fade : fade
4119    };
4120  }
4121}(jQuery, window, window.document));
4122;(function ($, window, document, undefined) {
4123  'use strict';
4124
4125  Foundation.libs.interchange = {
4126    name : 'interchange',
4127
4128    version : '5.5.1',
4129
4130    cache : {},
4131
4132    images_loaded : false,
4133    nodes_loaded : false,
4134
4135    settings : {
4136      load_attr : 'interchange',
4137
4138      named_queries : {
4139        'default'     : 'only screen',
4140        'small'       : Foundation.media_queries['small'],
4141        'small-only'  : Foundation.media_queries['small-only'],
4142        'medium'      : Foundation.media_queries['medium'],
4143        'medium-only' : Foundation.media_queries['medium-only'],
4144        'large'       : Foundation.media_queries['large'],
4145        'large-only'  : Foundation.media_queries['large-only'],
4146        'xlarge'      : Foundation.media_queries['xlarge'],
4147        'xlarge-only' : Foundation.media_queries['xlarge-only'],
4148        'xxlarge'     : Foundation.media_queries['xxlarge'],
4149        'landscape'   : 'only screen and (orientation: landscape)',
4150        'portrait'    : 'only screen and (orientation: portrait)',
4151        'retina'      : 'only screen and (-webkit-min-device-pixel-ratio: 2),' +
4152          'only screen and (min--moz-device-pixel-ratio: 2),' +
4153          'only screen and (-o-min-device-pixel-ratio: 2/1),' +
4154          'only screen and (min-device-pixel-ratio: 2),' +
4155          'only screen and (min-resolution: 192dpi),' +
4156          'only screen and (min-resolution: 2dppx)'
4157      },
4158
4159      directives : {
4160        replace : function (el, path, trigger) {
4161          // The trigger argument, if called within the directive, fires
4162          // an event named after the directive on the element, passing
4163          // any parameters along to the event that you pass to trigger.
4164          //
4165          // ex. trigger(), trigger([a, b, c]), or trigger(a, b, c)
4166          //
4167          // This allows you to bind a callback like so:
4168          // $('#interchangeContainer').on('replace', function (e, a, b, c) {
4169          //   console.log($(this).html(), a, b, c);
4170          // });
4171
4172          if (/IMG/.test(el[0].nodeName)) {
4173            var orig_path = el[0].src;
4174
4175            if (new RegExp(path, 'i').test(orig_path)) {
4176              return;
4177            }
4178
4179            el[0].src = path;
4180
4181            return trigger(el[0].src);
4182          }
4183          var last_path = el.data(this.data_attr + '-last-path'),
4184              self = this;
4185
4186          if (last_path == path) {
4187            return;
4188          }
4189
4190          if (/\.(gif|jpg|jpeg|tiff|png)([?#].*)?/i.test(path)) {
4191            $(el).css('background-image', 'url(' + path + ')');
4192            el.data('interchange-last-path', path);
4193            return trigger(path);
4194          }
4195
4196          return $.get(path, function (response) {
4197            el.html(response);
4198            el.data(self.data_attr + '-last-path', path);
4199            trigger();
4200          });
4201
4202        }
4203      }
4204    },
4205
4206    init : function (scope, method, options) {
4207      Foundation.inherit(this, 'throttle random_str');
4208
4209      this.data_attr = this.set_data_attr();
4210      $.extend(true, this.settings, method, options);
4211      this.bindings(method, options);
4212      this.load('images');
4213      this.load('nodes');
4214    },
4215
4216    get_media_hash : function () {
4217        var mediaHash = '';
4218        for (var queryName in this.settings.named_queries ) {
4219            mediaHash += matchMedia(this.settings.named_queries[queryName]).matches.toString();
4220        }
4221        return mediaHash;
4222    },
4223
4224    events : function () {
4225      var self = this, prevMediaHash;
4226
4227      $(window)
4228        .off('.interchange')
4229        .on('resize.fndtn.interchange', self.throttle(function () {
4230            var currMediaHash = self.get_media_hash();
4231            if (currMediaHash !== prevMediaHash) {
4232                self.resize();
4233            }
4234            prevMediaHash = currMediaHash;
4235        }, 50));
4236
4237      return this;
4238    },
4239
4240    resize : function () {
4241      var cache = this.cache;
4242
4243      if (!this.images_loaded || !this.nodes_loaded) {
4244        setTimeout($.proxy(this.resize, this), 50);
4245        return;
4246      }
4247
4248      for (var uuid in cache) {
4249        if (cache.hasOwnProperty(uuid)) {
4250          var passed = this.results(uuid, cache[uuid]);
4251
4252          if (passed) {
4253            this.settings.directives[passed
4254              .scenario[1]].call(this, passed.el, passed.scenario[0], (function (passed) {
4255                if (arguments[0] instanceof Array) { 
4256                  var args = arguments[0];
4257                } else {
4258                  var args = Array.prototype.slice.call(arguments, 0);
4259                }
4260
4261                return function() {
4262                  passed.el.trigger(passed.scenario[1], args);
4263                }
4264              }(passed)));
4265          }
4266        }
4267      }
4268
4269    },
4270
4271    results : function (uuid, scenarios) {
4272      var count = scenarios.length;
4273
4274      if (count > 0) {
4275        var el = this.S('[' + this.add_namespace('data-uuid') + '="' + uuid + '"]');
4276
4277        while (count--) {
4278          var mq, rule = scenarios[count][2];
4279          if (this.settings.named_queries.hasOwnProperty(rule)) {
4280            mq = matchMedia(this.settings.named_queries[rule]);
4281          } else {
4282            mq = matchMedia(rule);
4283          }
4284          if (mq.matches) {
4285            return {el : el, scenario : scenarios[count]};
4286          }
4287        }
4288      }
4289
4290      return false;
4291    },
4292
4293    load : function (type, force_update) {
4294      if (typeof this['cached_' + type] === 'undefined' || force_update) {
4295        this['update_' + type]();
4296      }
4297
4298      return this['cached_' + type];
4299    },
4300
4301    update_images : function () {
4302      var images = this.S('img[' + this.data_attr + ']'),
4303          count = images.length,
4304          i = count,
4305          loaded_count = 0,
4306          data_attr = this.data_attr;
4307
4308      this.cache = {};
4309      this.cached_images = [];
4310      this.images_loaded = (count === 0);
4311
4312      while (i--) {
4313        loaded_count++;
4314        if (images[i]) {
4315          var str = images[i].getAttribute(data_attr) || '';
4316
4317          if (str.length > 0) {
4318            this.cached_images.push(images[i]);
4319          }
4320        }
4321
4322        if (loaded_count === count) {
4323          this.images_loaded = true;
4324          this.enhance('images');
4325        }
4326      }
4327
4328      return this;
4329    },
4330
4331    update_nodes : function () {
4332      var nodes = this.S('[' + this.data_attr + ']').not('img'),
4333          count = nodes.length,
4334          i = count,
4335          loaded_count = 0,
4336          data_attr = this.data_attr;
4337
4338      this.cached_nodes = [];
4339      this.nodes_loaded = (count === 0);
4340
4341      while (i--) {
4342        loaded_count++;
4343        var str = nodes[i].getAttribute(data_attr) || '';
4344
4345        if (str.length > 0) {
4346          this.cached_nodes.push(nodes[i]);
4347        }
4348
4349        if (loaded_count === count) {
4350          this.nodes_loaded = true;
4351          this.enhance('nodes');
4352        }
4353      }
4354
4355      return this;
4356    },
4357
4358    enhance : function (type) {
4359      var i = this['cached_' + type].length;
4360
4361      while (i--) {
4362        this.object($(this['cached_' + type][i]));
4363      }
4364
4365      return $(window).trigger('resize').trigger('resize.fndtn.interchange');
4366    },
4367
4368    convert_directive : function (directive) {
4369
4370      var trimmed = this.trim(directive);
4371
4372      if (trimmed.length > 0) {
4373        return trimmed;
4374      }
4375
4376      return 'replace';
4377    },
4378
4379    parse_scenario : function (scenario) {
4380      // This logic had to be made more complex since some users were using commas in the url path
4381      // So we cannot simply just split on a comma
4382      var directive_match = scenario[0].match(/(.+),\s*(\w+)\s*$/),
4383      media_query         = scenario[1];
4384
4385      if (directive_match) {
4386        var path  = directive_match[1],
4387        directive = directive_match[2];
4388      } else {
4389        var cached_split = scenario[0].split(/,\s*$/),
4390        path             = cached_split[0],
4391        directive        = '';
4392      }
4393
4394      return [this.trim(path), this.convert_directive(directive), this.trim(media_query)];
4395    },
4396
4397    object : function (el) {
4398      var raw_arr = this.parse_data_attr(el),
4399          scenarios = [],
4400          i = raw_arr.length;
4401
4402      if (i > 0) {
4403        while (i--) {
4404          var split = raw_arr[i].split(/\(([^\)]*?)(\))$/);
4405
4406          if (split.length > 1) {
4407            var params = this.parse_scenario(split);
4408            scenarios.push(params);
4409          }
4410        }
4411      }
4412
4413      return this.store(el, scenarios);
4414    },
4415
4416    store : function (el, scenarios) {
4417      var uuid = this.random_str(),
4418          current_uuid = el.data(this.add_namespace('uuid', true));
4419
4420      if (this.cache[current_uuid]) {
4421        return this.cache[current_uuid];
4422      }
4423
4424      el.attr(this.add_namespace('data-uuid'), uuid);
4425
4426      return this.cache[uuid] = scenarios;
4427    },
4428
4429    trim : function (str) {
4430
4431      if (typeof str === 'string') {
4432        return $.trim(str);
4433      }
4434
4435      return str;
4436    },
4437
4438    set_data_attr : function (init) {
4439      if (init) {
4440        if (this.namespace.length > 0) {
4441          return this.namespace + '-' + this.settings.load_attr;
4442        }
4443
4444        return this.settings.load_attr;
4445      }
4446
4447      if (this.namespace.length > 0) {
4448        return 'data-' + this.namespace + '-' + this.settings.load_attr;
4449      }
4450
4451      return 'data-' + this.settings.load_attr;
4452    },
4453
4454    parse_data_attr : function (el) {
4455      var raw = el.attr(this.attr_name()).split(/\[(.*?)\]/),
4456          i = raw.length,
4457          output = [];
4458
4459      while (i--) {
4460        if (raw[i].replace(/[\W\d]+/, '').length > 4) {
4461          output.push(raw[i]);
4462        }
4463      }
4464
4465      return output;
4466    },
4467
4468    reflow : function () {
4469      this.load('images', true);
4470      this.load('nodes', true);
4471    }
4472
4473  };
4474
4475}(jQuery, window, window.document));
4476;(function ($, window, document, undefined) {
4477  'use strict';
4478
4479  Foundation.libs['magellan-expedition'] = {
4480    name : 'magellan-expedition',
4481
4482    version : '5.5.1',
4483
4484    settings : {
4485      active_class : 'active',
4486      threshold : 0, // pixels from the top of the expedition for it to become fixes
4487      destination_threshold : 20, // pixels from the top of destination for it to be considered active
4488      throttle_delay : 30, // calculation throttling to increase framerate
4489      fixed_top : 0, // top distance in pixels assigend to the fixed element on scroll
4490      offset_by_height : true,  // whether to offset the destination by the expedition height. Usually you want this to be true, unless your expedition is on the side.
4491      duration : 700, // animation duration time
4492      easing : 'swing' // animation easing
4493    },
4494
4495    init : function (scope, method, options) {
4496      Foundation.inherit(this, 'throttle');
4497      this.bindings(method, options);
4498    },
4499
4500    events : function () {
4501      var self = this,
4502          S = self.S,
4503          settings = self.settings;
4504
4505      // initialize expedition offset
4506      self.set_expedition_position();
4507
4508      S(self.scope)
4509        .off('.magellan')
4510        .on('click.fndtn.magellan', '[' + self.add_namespace('data-magellan-arrival') + '] a[href^="#"]', function (e) {
4511          e.preventDefault();
4512          var expedition = $(this).closest('[' + self.attr_name() + ']'),
4513              settings = expedition.data('magellan-expedition-init'),
4514              hash = this.hash.split('#').join(''),
4515              target = $('a[name="' + hash + '"]');
4516
4517          if (target.length === 0) {
4518            target = $('#' + hash);
4519
4520          }
4521
4522          // Account for expedition height if fixed position
4523          var scroll_top = target.offset().top - settings.destination_threshold + 1;
4524          if (settings.offset_by_height) {
4525            scroll_top = scroll_top - expedition.outerHeight();
4526          }
4527
4528          $('html, body').stop().animate({
4529            'scrollTop' : scroll_top
4530          }, settings.duration, settings.easing, function () {
4531            if (history.pushState) {
4532              history.pushState(null, null, '#' + hash);
4533            } else {
4534              location.hash = '#' + hash;
4535            }
4536          });
4537        })
4538        .on('scroll.fndtn.magellan', self.throttle(this.check_for_arrivals.bind(this), settings.throttle_delay));
4539
4540      $(window)
4541        .on('resize.fndtn.magellan', self.throttle(this.set_expedition_position.bind(this), settings.throttle_delay));
4542    },
4543
4544    check_for_arrivals : function () {
4545      var self = this;
4546      self.update_arrivals();
4547      self.update_expedition_positions();
4548    },
4549
4550    set_expedition_position : function () {
4551      var self = this;
4552      $('[' + this.attr_name() + '=fixed]', self.scope).each(function (idx, el) {
4553        var expedition = $(this),
4554            settings = expedition.data('magellan-expedition-init'),
4555            styles = expedition.attr('styles'), // save styles
4556            top_offset, fixed_top;
4557
4558        expedition.attr('style', '');
4559        top_offset = expedition.offset().top + settings.threshold;
4560
4561        //set fixed-top by attribute
4562        fixed_top = parseInt(expedition.data('magellan-fixed-top'));
4563        if (!isNaN(fixed_top)) {
4564          self.settings.fixed_top = fixed_top;
4565        }
4566
4567        expedition.data(self.data_attr('magellan-top-offset'), top_offset);
4568        expedition.attr('style', styles);
4569      });
4570    },
4571
4572    update_expedition_positions : function () {
4573      var self = this,
4574          window_top_offset = $(window).scrollTop();
4575
4576      $('[' + this.attr_name() + '=fixed]', self.scope).each(function () {
4577        var expedition = $(this),
4578            settings = expedition.data('magellan-expedition-init'),
4579            styles = expedition.attr('style'), // save styles
4580            top_offset = expedition.data('magellan-top-offset');
4581
4582        //scroll to the top distance
4583        if (window_top_offset + self.settings.fixed_top >= top_offset) {
4584          // Placeholder allows height calculations to be consistent even when
4585          // appearing to switch between fixed/non-fixed placement
4586          var placeholder = expedition.prev('[' + self.add_namespace('data-magellan-expedition-clone') + ']');
4587          if (placeholder.length === 0) {
4588            placeholder = expedition.clone();
4589            placeholder.removeAttr(self.attr_name());
4590            placeholder.attr(self.add_namespace('data-magellan-expedition-clone'), '');
4591            expedition.before(placeholder);
4592          }
4593          expedition.css({position :'fixed', top : settings.fixed_top}).addClass('fixed');
4594        } else {
4595          expedition.prev('[' + self.add_namespace('data-magellan-expedition-clone') + ']').remove();
4596          expedition.attr('style', styles).css('position', '').css('top', '').removeClass('fixed');
4597        }
4598      });
4599    },
4600
4601    update_arrivals : function () {
4602      var self = this,
4603          window_top_offset = $(window).scrollTop();
4604
4605      $('[' + this.attr_name() + ']', self.scope).each(function () {
4606        var expedition = $(this),
4607            settings = expedition.data(self.attr_name(true) + '-init'),
4608            offsets = self.offsets(expedition, window_top_offset),
4609            arrivals = expedition.find('[' + self.add_namespace('data-magellan-arrival') + ']'),
4610            active_item = false;
4611        offsets.each(function (idx, item) {
4612          if (item.viewport_offset >= item.top_offset) {
4613            var arrivals = expedition.find('[' + self.add_namespace('data-magellan-arrival') + ']');
4614            arrivals.not(item.arrival).removeClass(settings.active_class);
4615            item.arrival.addClass(settings.active_class);
4616            active_item = true;
4617            return true;
4618          }
4619        });
4620
4621        if (!active_item) {
4622          arrivals.removeClass(settings.active_class);
4623        }
4624      });
4625    },
4626
4627    offsets : function (expedition, window_offset) {
4628      var self = this,
4629          settings = expedition.data(self.attr_name(true) + '-init'),
4630          viewport_offset = window_offset;
4631
4632      return expedition.find('[' + self.add_namespace('data-magellan-arrival') + ']').map(function (idx, el) {
4633        var name = $(this).data(self.data_attr('magellan-arrival')),
4634            dest = $('[' + self.add_namespace('data-magellan-destination') + '=' + name + ']');
4635        if (dest.length > 0) {
4636          var top_offset = dest.offset().top - settings.destination_threshold;
4637          if (settings.offset_by_height) {
4638            top_offset = top_offset - expedition.outerHeight();
4639          }
4640          top_offset = Math.floor(top_offset);
4641          return {
4642            destination : dest,
4643            arrival : $(this),
4644            top_offset : top_offset,
4645            viewport_offset : viewport_offset
4646          }
4647        }
4648      }).sort(function (a, b) {
4649        if (a.top_offset < b.top_offset) {
4650          return -1;
4651        }
4652        if (a.top_offset > b.top_offset) {
4653          return 1;
4654        }
4655        return 0;
4656      });
4657    },
4658
4659    data_attr : function (str) {
4660      if (this.namespace.length > 0) {
4661        return this.namespace + '-' + str;
4662      }
4663
4664      return str;
4665    },
4666
4667    off : function () {
4668      this.S(this.scope).off('.magellan');
4669      this.S(window).off('.magellan');
4670    },
4671
4672    reflow : function () {
4673      var self = this;
4674      // remove placeholder expeditions used for height calculation purposes
4675      $('[' + self.add_namespace('data-magellan-expedition-clone') + ']', self.scope).remove();
4676    }
4677  };
4678}(jQuery, window, window.document));
4679;(function ($, window, document, undefined) {
4680  'use strict';
4681
4682  Foundation.libs.accordion = {
4683    name : 'accordion',
4684
4685    version : '5.5.1',
4686
4687    settings : {
4688      content_class : 'content',
4689      active_class : 'active',
4690      multi_expand : false,
4691      toggleable : true,
4692      callback : function () {}
4693    },
4694
4695    init : function (scope, method, options) {
4696      this.bindings(method, options);
4697    },
4698
4699    events : function () {
4700      var self = this;
4701      var S = this.S;
4702      S(this.scope)
4703      .off('.fndtn.accordion')
4704      .on('click.fndtn.accordion', '[' + this.attr_name() + '] > .accordion-navigation > a', function (e) {
4705        var accordion = S(this).closest('[' + self.attr_name() + ']'),
4706            groupSelector = self.attr_name() + '=' + accordion.attr(self.attr_name()),
4707            settings = accordion.data(self.attr_name(true) + '-init') || self.settings,
4708            target = S('#' + this.href.split('#')[1]),
4709            aunts = $('> .accordion-navigation', accordion),
4710            siblings = aunts.children('.' + settings.content_class),
4711            active_content = siblings.filter('.' + settings.active_class);
4712
4713        e.preventDefault();
4714
4715        if (accordion.attr(self.attr_name())) {
4716          siblings = siblings.add('[' + groupSelector + '] dd > ' + '.' + settings.content_class);
4717          aunts = aunts.add('[' + groupSelector + '] .accordion-navigation');
4718        }
4719
4720        if (settings.toggleable && target.is(active_content)) {
4721          target.parent('.accordion-navigation').toggleClass(settings.active_class, false);
4722          target.toggleClass(settings.active_class, false);
4723          settings.callback(target);
4724          target.triggerHandler('toggled', [accordion]);
4725          accordion.triggerHandler('toggled', [target]);
4726          return;
4727        }
4728
4729        if (!settings.multi_expand) {
4730          siblings.removeClass(settings.active_class);
4731          aunts.removeClass(settings.active_class);
4732        }
4733
4734        target.addClass(settings.active_class).parent().addClass(settings.active_class);
4735        settings.callback(target);
4736        target.triggerHandler('toggled', [accordion]);
4737        accordion.triggerHandler('toggled', [target]);
4738      });
4739    },
4740
4741    off : function () {},
4742
4743    reflow : function () {}
4744  };
4745}(jQuery, window, window.document));
4746;(function ($, window, document, undefined) {
4747  'use strict';
4748
4749  Foundation.libs.topbar = {
4750    name : 'topbar',
4751
4752    version : '5.5.1',
4753
4754    settings : {
4755      index : 0,
4756      sticky_class : 'sticky',
4757      custom_back_text : true,
4758      back_text : 'Back',
4759      mobile_show_parent_link : true,
4760      is_hover : true,
4761      scrolltop : true, // jump to top when sticky nav menu toggle is clicked
4762      sticky_on : 'all'
4763    },
4764
4765    init : function (section, method, options) {
4766      Foundation.inherit(this, 'add_custom_rule register_media throttle');
4767      var self = this;
4768
4769      self.register_media('topbar', 'foundation-mq-topbar');
4770
4771      this.bindings(method, options);
4772
4773      self.S('[' + this.attr_name() + ']', this.scope).each(function () {
4774        var topbar = $(this),
4775            settings = topbar.data(self.attr_name(true) + '-init'),
4776            section = self.S('section, .top-bar-section', this);
4777        topbar.data('index', 0);
4778        var topbarContainer = topbar.parent();
4779        if (topbarContainer.hasClass('fixed') || self.is_sticky(topbar, topbarContainer, settings) ) {
4780          self.settings.sticky_class = settings.sticky_class;
4781          self.settings.sticky_topbar = topbar;
4782          topbar.data('height', topbarContainer.outerHeight());
4783          topbar.data('stickyoffset', topbarContainer.offset().top);
4784        } else {
4785          topbar.data('height', topbar.outerHeight());
4786        }
4787
4788        if (!settings.assembled) {
4789          self.assemble(topbar);
4790        }
4791
4792        if (settings.is_hover) {
4793          self.S('.has-dropdown', topbar).addClass('not-click');
4794        } else {
4795          self.S('.has-dropdown', topbar).removeClass('not-click');
4796        }
4797
4798        // Pad body when sticky (scrolled) or fixed.
4799        self.add_custom_rule('.f-topbar-fixed { padding-top: ' + topbar.data('height') + 'px }');
4800
4801        if (topbarContainer.hasClass('fixed')) {
4802          self.S('body').addClass('f-topbar-fixed');
4803        }
4804      });
4805
4806    },
4807
4808    is_sticky : function (topbar, topbarContainer, settings) {
4809      var sticky     = topbarContainer.hasClass(settings.sticky_class);
4810      var smallMatch = matchMedia(Foundation.media_queries.small).matches;
4811      var medMatch   = matchMedia(Foundation.media_queries.medium).matches;
4812      var lrgMatch   = matchMedia(Foundation.media_queries.large).matches;
4813      
4814       if (sticky && settings.sticky_on === 'all') {
4815          return true;
4816       }
4817       if (sticky && this.small() && settings.sticky_on.indexOf('small') !== -1) {
4818           if (smallMatch && !medMatch && !lrgMatch) { return true; }
4819       }
4820       if (sticky && this.medium() && settings.sticky_on.indexOf('medium') !== -1) {
4821           if (smallMatch && medMatch && !lrgMatch) { return true; }
4822       }
4823       if (sticky && this.large() && settings.sticky_on.indexOf('large') !== -1) {
4824           if (smallMatch && medMatch && lrgMatch) { return true; }
4825       }
4826
4827       // fix for iOS browsers
4828       if (sticky && navigator.userAgent.match(/(iPad|iPhone|iPod)/g)) {
4829        return true;
4830       }
4831       return false;
4832    },
4833
4834    toggle : function (toggleEl) {
4835      var self = this,
4836          topbar;
4837
4838      if (toggleEl) {
4839        topbar = self.S(toggleEl).closest('[' + this.attr_name() + ']');
4840      } else {
4841        topbar = self.S('[' + this.attr_name() + ']');
4842      }
4843
4844      var settings = topbar.data(this.attr_name(true) + '-init');
4845
4846      var section = self.S('section, .top-bar-section', topbar);
4847
4848      if (self.breakpoint()) {
4849        if (!self.rtl) {
4850          section.css({left : '0%'});
4851          $('>.name', section).css({left : '100%'});
4852        } else {
4853          section.css({right : '0%'});
4854          $('>.name', section).css({right : '100%'});
4855        }
4856
4857        self.S('li.moved', section).removeClass('moved');
4858        topbar.data('index', 0);
4859
4860        topbar
4861          .toggleClass('expanded')
4862          .css('height', '');
4863      }
4864
4865      if (settings.scrolltop) {
4866        if (!topbar.hasClass('expanded')) {
4867          if (topbar.hasClass('fixed')) {
4868            topbar.parent().addClass('fixed');
4869            topbar.removeClass('fixed');
4870            self.S('body').addClass('f-topbar-fixed');
4871          }
4872        } else if (topbar.parent().hasClass('fixed')) {
4873          if (settings.scrolltop) {
4874            topbar.parent().removeClass('fixed');
4875            topbar.addClass('fixed');
4876            self.S('body').removeClass('f-topbar-fixed');
4877
4878            window.scrollTo(0, 0);
4879          } else {
4880            topbar.parent().removeClass('expanded');
4881          }
4882        }
4883      } else {
4884        if (self.is_sticky(topbar, topbar.parent(), settings)) {
4885          topbar.parent().addClass('fixed');
4886        }
4887
4888        if (topbar.parent().hasClass('fixed')) {
4889          if (!topbar.hasClass('expanded')) {
4890            topbar.removeClass('fixed');
4891            topbar.parent().removeClass('expanded');
4892            self.update_sticky_positioning();
4893          } else {
4894            topbar.addClass('fixed');
4895            topbar.parent().addClass('expanded');
4896            self.S('body').addClass('f-topbar-fixed');
4897          }
4898        }
4899      }
4900    },
4901
4902    timer : null,
4903
4904    events : function (bar) {
4905      var self = this,
4906          S = this.S;
4907
4908      S(this.scope)
4909        .off('.topbar')
4910        .on('click.fndtn.topbar', '[' + this.attr_name() + '] .toggle-topbar', function (e) {
4911          e.preventDefault();
4912          self.toggle(this);
4913        })
4914        .on('click.fndtn.topbar', '.top-bar .top-bar-section li a[href^="#"],[' + this.attr_name() + '] .top-bar-section li a[href^="#"]', function (e) {
4915            var li = $(this).closest('li');
4916            if (self.breakpoint() && !li.hasClass('back') && !li.hasClass('has-dropdown')) {
4917              self.toggle();
4918            }
4919        })
4920        .on('click.fndtn.topbar', '[' + this.attr_name() + '] li.has-dropdown', function (e) {
4921          var li = S(this),
4922              target = S(e.target),
4923              topbar = li.closest('[' + self.attr_name() + ']'),
4924              settings = topbar.data(self.attr_name(true) + '-init');
4925
4926          if (target.data('revealId')) {
4927            self.toggle();
4928            return;
4929          }
4930
4931          if (self.breakpoint()) {
4932            return;
4933          }
4934
4935          if (settings.is_hover && !Modernizr.touch) {
4936            return;
4937          }
4938
4939          e.stopImmediatePropagation();
4940
4941          if (li.hasClass('hover')) {
4942            li
4943              .removeClass('hover')
4944              .find('li')
4945              .removeClass('hover');
4946
4947            li.parents('li.hover')
4948              .removeClass('hover');
4949          } else {
4950            li.addClass('hover');
4951
4952            $(li).siblings().removeClass('hover');
4953
4954            if (target[0].nodeName === 'A' && target.parent().hasClass('has-dropdown')) {
4955              e.preventDefault();
4956            }
4957          }
4958        })
4959        .on('click.fndtn.topbar', '[' + this.attr_name() + '] .has-dropdown>a', function (e) {
4960          if (self.breakpoint()) {
4961
4962            e.preventDefault();
4963
4964            var $this = S(this),
4965                topbar = $this.closest('[' + self.attr_name() + ']'),
4966                section = topbar.find('section, .top-bar-section'),
4967                dropdownHeight = $this.next('.dropdown').outerHeight(),
4968                $selectedLi = $this.closest('li');
4969
4970            topbar.data('index', topbar.data('index') + 1);
4971            $selectedLi.addClass('moved');
4972
4973            if (!self.rtl) {
4974              section.css({left : -(100 * topbar.data('index')) + '%'});
4975              section.find('>.name').css({left : 100 * topbar.data('index') + '%'});
4976            } else {
4977              section.css({right : -(100 * topbar.data('index')) + '%'});
4978              section.find('>.name').css({right : 100 * topbar.data('index') + '%'});
4979            }
4980
4981            topbar.css('height', $this.siblings('ul').outerHeight(true) + topbar.data('height'));
4982          }
4983        });
4984
4985      S(window).off('.topbar').on('resize.fndtn.topbar', self.throttle(function () {
4986          self.resize.call(self);
4987      }, 50)).trigger('resize').trigger('resize.fndtn.topbar').load(function () {
4988          // Ensure that the offset is calculated after all of the pages resources have loaded
4989          S(this).trigger('resize.fndtn.topbar');
4990      });
4991
4992      S('body').off('.topbar').on('click.fndtn.topbar', function (e) {
4993        var parent = S(e.target).closest('li').closest('li.hover');
4994
4995        if (parent.length > 0) {
4996          return;
4997        }
4998
4999        S('[' + self.attr_name() + '] li.hover').removeClass('hover');
5000      });
5001
5002      // Go up a level on Click
5003      S(this.scope).on('click.fndtn.topbar', '[' + this.attr_name() + '] .has-dropdown .back', function (e) {
5004        e.preventDefault();
5005
5006        var $this = S(this),
5007            topbar = $this.closest('[' + self.attr_name() + ']'),
5008            section = topbar.find('section, .top-bar-section'),
5009            settings = topbar.data(self.attr_name(true) + '-init'),
5010            $movedLi = $this.closest('li.moved'),
5011            $previousLevelUl = $movedLi.parent();
5012
5013        topbar.data('index', topbar.data('index') - 1);
5014
5015        if (!self.rtl) {
5016          section.css({left : -(100 * topbar.data('index')) + '%'});
5017          section.find('>.name').css({left : 100 * topbar.data('index') + '%'});
5018        } else {
5019          section.css({right : -(100 * topbar.data('index')) + '%'});
5020          section.find('>.name').css({right : 100 * topbar.data('index') + '%'});
5021        }
5022
5023        if (topbar.data('index') === 0) {
5024          topbar.css('height', '');
5025        } else {
5026          topbar.css('height', $previousLevelUl.outerHeight(true) + topbar.data('height'));
5027        }
5028
5029        setTimeout(function () {
5030          $movedLi.removeClass('moved');
5031        }, 300);
5032      });
5033
5034      // Show dropdown menus when their items are focused
5035      S(this.scope).find('.dropdown a')
5036        .focus(function () {
5037          $(this).parents('.has-dropdown').addClass('hover');
5038        })
5039        .blur(function () {
5040          $(this).parents('.has-dropdown').removeClass('hover');
5041        });
5042    },
5043
5044    resize : function () {
5045      var self = this;
5046      self.S('[' + this.attr_name() + ']').each(function () {
5047        var topbar = self.S(this),
5048            settings = topbar.data(self.attr_name(true) + '-init');
5049
5050        var stickyContainer = topbar.parent('.' + self.settings.sticky_class);
5051        var stickyOffset;
5052
5053        if (!self.breakpoint()) {
5054          var doToggle = topbar.hasClass('expanded');
5055          topbar
5056            .css('height', '')
5057            .removeClass('expanded')
5058            .find('li')
5059            .removeClass('hover');
5060
5061            if (doToggle) {
5062              self.toggle(topbar);
5063            }
5064        }
5065
5066        if (self.is_sticky(topbar, stickyContainer, settings)) {
5067          if (stickyContainer.hasClass('fixed')) {
5068            // Remove the fixed to allow for correct calculation of the offset.
5069            stickyContainer.removeClass('fixed');
5070
5071            stickyOffset = stickyContainer.offset().top;
5072            if (self.S(document.body).hasClass('f-topbar-fixed')) {
5073              stickyOffset -= topbar.data('height');
5074            }
5075
5076            topbar.data('stickyoffset', stickyOffset);
5077            stickyContainer.addClass('fixed');
5078          } else {
5079            stickyOffset = stickyContainer.offset().top;
5080            topbar.data('stickyoffset', stickyOffset);
5081          }
5082        }
5083
5084      });
5085    },
5086
5087    breakpoint : function () {
5088      return !matchMedia(Foundation.media_queries['topbar']).matches;
5089    },
5090
5091    small : function () {
5092      return matchMedia(Foundation.media_queries['small']).matches;
5093    },
5094
5095    medium : function () {
5096      return matchMedia(Foundation.media_queries['medium']).matches;
5097    },
5098
5099    large : function () {
5100      return matchMedia(Foundation.media_queries['large']).matches;
5101    },
5102
5103    assemble : function (topbar) {
5104      var self = this,
5105          settings = topbar.data(this.attr_name(true) + '-init'),
5106          section = self.S('section, .top-bar-section', topbar);
5107
5108      // Pull element out of the DOM for manipulation
5109      section.detach();
5110
5111      self.S('.has-dropdown>a', section).each(function () {
5112        var $link = self.S(this),
5113            $dropdown = $link.siblings('.dropdown'),
5114            url = $link.attr('href'),
5115            $titleLi;
5116
5117        if (!$dropdown.find('.title.back').length) {
5118
5119          if (settings.mobile_show_parent_link == true && url) {
5120            $titleLi = $('<li class="title back js-generated"><h5><a href="javascript:void(0)"></a></h5></li><li class="parent-link hide-for-large-up"><a class="parent-link js-generated" href="' + url + '">' + $link.html() +'</a></li>');
5121          } else {
5122            $titleLi = $('<li class="title back js-generated"><h5><a href="javascript:void(0)"></a></h5>');
5123          }
5124
5125          // Copy link to subnav
5126          if (settings.custom_back_text == true) {
5127            $('h5>
5127a', $titleLi).html(settings.back_text);
5128          } else {
5129            $('h5>a', $titleLi).html('&laquo; ' + $link.html());
5130          }
5131          $dropdown.prepend($titleLi);
5132        }
5133      });
5134
5135      // Put element back in the DOM
5136      section.appendTo(topbar);
5137
5138      // check for sticky
5139      this.sticky();
5140
5141      this.assembled(topbar);
5142    },
5143
5144    assembled : function (topbar) {
5145      topbar.data(this.attr_name(true), $.extend({}, topbar.data(this.attr_name(true)), {assembled : true}));
5146    },
5147
5148    height : function (ul) {
5149      var total = 0,
5150          self = this;
5151
5152      $('> li', ul).each(function () {
5153        total += self.S(this).outerHeight(true);
5154      });
5155
5156      return total;
5157    },
5158
5159    sticky : function () {
5160      var self = this;
5161
5162      this.S(window).on('scroll', function () {
5163        self.update_sticky_positioning();
5164      });
5165    },
5166
5167    update_sticky_positioning : function () {
5168      var klass = '.' + this.settings.sticky_class,
5169          $window = this.S(window),
5170          self = this;
5171
5172      if (self.settings.sticky_topbar && self.is_sticky(this.settings.sticky_topbar, this.settings.sticky_topbar.parent(), this.settings)) {
5173        var distance = this.settings.sticky_topbar.data('stickyoffset');
5174        if (!self.S(klass).hasClass('expanded')) {
5175          if ($window.scrollTop() > (distance)) {
5176            if (!self.S(klass).hasClass('fixed')) {
5177              self.S(klass).addClass('fixed');
5178              self.S('body').addClass('f-topbar-fixed');
5179            }
5180          } else if ($window.scrollTop() <= distance) {
5181            if (self.S(klass).hasClass('fixed')) {
5182              self.S(klass).removeClass('fixed');
5183              self.S('body').removeClass('f-topbar-fixed');
5184            }
5185          }
5186        }
5187      }
5188    },
5189
5190    off : function () {
5191      this.S(this.scope).off('.fndtn.topbar');
5192      this.S(window).off('.fndtn.topbar');
5193    },
5194
5195    reflow : function () {}
5196  };
5197}(jQuery, window, window.document));
5198;(function ($, window, document, undefined) {
5199  'use strict';
5200
5201  Foundation.libs.tab = {
5202    name : 'tab',
5203
5204    version : '5.5.1',
5205
5206    settings : {
5207      active_class : 'active',
5208      callback : function () {},
5209      deep_linking : false,
5210      scroll_to_content : true,
5211      is_hover : false
5212    },
5213
5214    default_tab_hashes : [],
5215
5216    init : function (scope, method, options) {
5217      var self = this,
5218          S = this.S;
5219
5220      this.bindings(method, options);
5221
5222      // store the initial href, which is used to allow correct behaviour of the
5223      // browser back button when deep linking is turned on.
5224      self.entry_location = window.location.href;
5225
5226      this.handle_location_hash_change();
5227
5228      // Store the default active tabs which will be referenced when the
5229      // location hash is absent, as in the case of navigating the tabs and
5230      // returning to the first viewing via the browser Back button.
5231      S('[' + this.attr_name() + '] > .active > a', this.scope).each(function () {
5232        self.default_tab_hashes.push(this.hash);
5233      });
5234    },
5235
5236    events : function () {
5237      var self = this,
5238          S = this.S;
5239
5240      var usual_tab_behavior =  function (e) {
5241          var settings = S(this).closest('[' + self.attr_name() + ']').data(self.attr_name(true) + '-init');
5242          if (!settings.is_hover || Modernizr.touch) {
5243            e.preventDefault();
5244            e.stopPropagation();
5245            self.toggle_active_tab(S(this).parent());
5246          }
5247        };
5248
5249      S(this.scope)
5250        .off('.tab')
5251        // Click event: tab title
5252        .on('focus.fndtn.tab', '[' + this.attr_name() + '] > * > a', usual_tab_behavior )
5253        .on('click.fndtn.tab', '[' + this.attr_name() + '] > * > a', usual_tab_behavior )
5254        // Hover event: tab title
5255        .on('mouseenter.fndtn.tab', '[' + this.attr_name() + '] > * > a', function (e) {
5256          var settings = S(this).closest('[' + self.attr_name() + ']').data(self.attr_name(true) + '-init');
5257          if (settings.is_hover) {
5258            self.toggle_active_tab(S(this).parent());
5259          }
5260        });
5261
5262      // Location hash change event
5263      S(window).on('hashchange.fndtn.tab', function (e) {
5264        e.preventDefault();
5265        self.handle_location_hash_change();
5266      });
5267    },
5268
5269    handle_location_hash_change : function () {
5270
5271      var self = this,
5272          S = this.S;
5273
5274      S('[' + this.attr_name() + ']', this.scope).each(function () {
5275        var settings = S(this).data(self.attr_name(true) + '-init');
5276        if (settings.deep_linking) {
5277          // Match the location hash to a label
5278          var hash;
5279          if (settings.scroll_to_content) {
5280            hash = self.scope.location.hash;
5281          } else {
5282            // prefix the hash to prevent anchor scrolling
5283            hash = self.scope.location.hash.replace('fndtn-', '');
5284          }
5285          if (hash != '') {
5286            // Check whether the location hash references a tab content div or
5287            // another element on the page (inside or outside the tab content div)
5288            var hash_element = S(hash);
5289            if (hash_element.hasClass('content') && hash_element.parent().hasClass('tabs-content')) {
5290              // Tab content div
5291              self.toggle_active_tab($('[' + self.attr_name() + '] > * > a[href=' + hash + ']').parent());
5292            } else {
5293              // Not the tab content div. If inside the tab content, find the
5294              // containing tab and toggle it as active.
5295              var hash_tab_container_id = hash_element.closest('.content').attr('id');
5296              if (hash_tab_container_id != undefined) {
5297                self.toggle_active_tab($('[' + self.attr_name() + '] > * > a[href=#' + hash_tab_container_id + ']').parent(), hash);
5298              }
5299            }
5300          } else {
5301            // Reference the default tab hashes which were initialized in the init function
5302            for (var ind = 0; ind < self.default_tab_hashes.length; ind++) {
5303              self.toggle_active_tab($('[' + self.attr_name() + '] > * > a[href=' + self.default_tab_hashes[ind] + ']').parent());
5304            }
5305          }
5306        }
5307       });
5308     },
5309
5310    toggle_active_tab : function (tab, location_hash) {
5311      var self = this,
5312          S = self.S,
5313          tabs = tab.closest('[' + this.attr_name() + ']'),
5314          tab_link = tab.find('a'),
5315          anchor = tab.children('a').first(),
5316          target_hash = '#' + anchor.attr('href').split('#')[1],
5317          target = S(target_hash),
5318          siblings = tab.siblings(),
5319          settings = tabs.data(this.attr_name(true) + '-init'),
5320          interpret_keyup_action = function (e) {
5321            // Light modification of Heydon Pickering's Practical ARIA Examples: http://heydonworks.com/practical_aria_examples/js/a11y.js
5322
5323            // define current, previous and next (possible) tabs
5324
5325            var $original = $(this);
5326            var $prev = $(this).parents('li').prev().children('[role="tab"]');
5327            var $next = $(this).parents('li').next().children('[role="tab"]');
5328            var $target;
5329
5330            // find the direction (prev or next)
5331
5332            switch (e.keyCode) {
5333              case 37:
5334                $target = $prev;
5335                break;
5336              case 39:
5337                $target = $next;
5338                break;
5339              default:
5340                $target = false
5341                  break;
5342            }
5343
5344            if ($target.length) {
5345              $original.attr({
5346                'tabindex' : '-1',
5347                'aria-selected' : null
5348              });
5349              $target.attr({
5350                'tabindex' : '0',
5351                'aria-selected' : true
5352              }).focus();
5353            }
5354
5355            // Hide panels
5356
5357            $('[role="tabpanel"]')
5358              .attr('aria-hidden', 'true');
5359
5360            // Show panel which corresponds to target
5361
5362            $('#' + $(document.activeElement).attr('href').substring(1))
5363              .attr('aria-hidden', null);
5364
5365          },
5366          go_to_hash = function(hash) {
5367            // This function allows correct behaviour of the browser's back button when deep linking is enabled. Without it
5368            // the user would get continually redirected to the default hash.
5369            var is_entry_location = window.location.href === self.entry_location,
5370                default_hash = settings.scroll_to_content ? self.default_tab_hashes[0] : is_entry_location ? window.location.hash :'fndtn-' + self.default_tab_hashes[0].replace('#', '')
5371
5372            if (!(is_entry_location && hash === default_hash)) {
5373              window.location.hash = hash;
5374            }
5375          };
5376
5377      // allow usage of data-tab-content attribute instead of href
5378      if (S(this).data(this.data_attr('tab-content'))) {
5379        target_hash = '#' + S(this).data(this.data_attr('tab-content')).split('#')[1];
5380        target = S(target_hash);
5381      }
5382
5383      if (settings.deep_linking) {
5384
5385        if (settings.scroll_to_content) {
5386
5387          // retain current hash to scroll to content
5388          go_to_hash(location_hash || target_hash);
5389
5390          if (location_hash == undefined || location_hash == target_hash) {
5391            tab.parent()[0].scrollIntoView();
5392          } else {
5393            S(target_hash)[0].scrollIntoView();
5394          }
5395        } else {
5396          // prefix the hashes so that the browser doesn't scroll down
5397          if (location_hash != undefined) {
5398            go_to_hash('fndtn-' + location_hash.replace('#', ''));
5399          } else {
5400            go_to_hash('fndtn-' + target_hash.replace('#', ''));
5401          }
5402        }
5403      }
5404
5405      // WARNING: The activation and deactivation of the tab content must
5406      // occur after the deep linking in order to properly refresh the browser
5407      // window (notably in Chrome).
5408      // Clean up multiple attr instances to done once
5409      tab.addClass(settings.active_class).triggerHandler('opened');
5410      tab_link.attr({'aria-selected' : 'true',  tabindex : 0});
5411      siblings.removeClass(settings.active_class)
5412      siblings.find('a').attr({'aria-selected' : 'false',  tabindex : -1});
5413      target.siblings().removeClass(settings.active_class).attr({'aria-hidden' : 'true',  tabindex : -1});
5414      target.addClass(settings.active_class).attr('aria-hidden', 'false').removeAttr('tabindex');
5415      settings.callback(tab);
5416      target.triggerHandler('toggled', [tab]);
5417      tabs.triggerHandler('toggled', [target]);
5418
5419      tab_link.off('keydown').on('keydown', interpret_keyup_action );
5420    },
5421
5422    data_attr : function (str) {
5423      if (this.namespace.length > 0) {
5424        return this.namespace + '-' + str;
5425      }
5426
5427      return str;
5428    },
5429
5430    off : function () {},
5431
5432    reflow : function () {}
5433  };
5434}(jQuery, window, window.document));
5435;(function ($, window, document, undefined) {
5436  'use strict';
5437
5438  Foundation.libs.abide = {
5439    name : 'abide',
5440
5441    version : '5.5.1',
5442
5443    settings : {
5444      live_validate : true,
5445      validate_on_blur : true,
5446      focus_on_invalid : true,
5447      error_labels : true, // labels with a for="inputId" will recieve an `error` class
5448      error_class : 'error',
5449      timeout : 1000,
5450      patterns : {
5451        alpha : /^[a-zA-Z]+$/,
5452        alpha_numeric : /^[a-zA-Z0-9]+$/,
5453        integer : /^[-+]?\d+$/,
5454        number : /^[-+]?\d*(?:[\.\,]\d+)?$/,
5455
5456        // amex, visa, diners
5457        card : /^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11})$/,
5458        cvv : /^([0-9]){3,4}$/,
5459
5460        // http://www.whatwg.org/specs/web-apps/current-work/multipage/states-of-the-type-attribute.html#valid-e-mail-address
5461        email : /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+$/,
5462
5463        url : /^(https?|ftp|file|ssh):\/\/(((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/,
5464        // abc.de
5465        domain : /^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,8}$/,
5466
5467        datetime : /^([0-2][0-9]{3})\-([0-1][0-9])\-([0-3][0-9])T([0-5][0-9])\:([0-5][0-9])\:([0-5][0-9])(Z|([\-\+]([0-1][0-9])\:00))$/,
5468        // YYYY-MM-DD
5469        date : /(?:19|20)[0-9]{2}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-9])|(?:(?!02)(?:0[1-9]|1[0-2])-(?:30))|(?:(?:0[13578]|1[02])-31))$/,
5470        // HH:MM:SS
5471        time : /^(0[0-9]|1[0-9]|2[0-3])(:[0-5][0-9]){2}$/,
5472        dateISO : /^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/,
5473        // MM/DD/YYYY
5474        month_day_year : /^(0[1-9]|1[012])[- \/.](0[1-9]|[12][0-9]|3[01])[- \/.]\d{4}$/,
5475        // DD/MM/YYYY
5476        day_month_year : /^(0[1-9]|[12][0-9]|3[01])[- \/.](0[1-9]|1[012])[- \/.]\d{4}$/,
5477
5478        // #FFF or #FFFFFF
5479        color : /^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/
5480      },
5481      validators : {
5482        equalTo : function (el, required, parent) {
5483          var from  = document.getElementById(el.getAttribute(this.add_namespace('data-equalto'))).value,
5484              to    = el.value,
5485              valid = (from === to);
5486
5487          return valid;
5488        }
5489      }
5490    },
5491
5492    timer : null,
5493
5494    init : function (scope, method, options) {
5495      this.bindings(method, options);
5496    },
5497
5498    events : function (scope) {
5499      var self = this,
5500          form = self.S(scope).attr('novalidate', 'novalidate'),
5501          settings = form.data(this.attr_name(true) + '-init') || {};
5502
5503      this.invalid_attr = this.add_namespace('data-invalid');
5504
5505      form
5506        .off('.abide')
5507        .on('submit.fndtn.abide validate.fndtn.abide', function (e) {
5508          var is_ajax = /ajax/i.test(self.S(this).attr(self.attr_name()));
5509          return self.validate(self.S(this).find('input, textarea, select').get(), e, is_ajax);
5510        })
5511        .on('reset', function () {
5512          return self.reset($(this));
5513        })
5514        .find('input, textarea, select')
5515          .off('.abide')
5516          .on('blur.fndtn.abide change.fndtn.abide', function (e) {
5517            if (settings.validate_on_blur === true) {
5518              self.validate([this], e);
5519            }
5520          })
5521          .on('keydown.fndtn.abide', function (e) {
5522            if (settings.live_validate === true && e.which != 9) {
5523              clearTimeout(self.timer);
5524              self.timer = setTimeout(function () {
5525                self.validate([this], e);
5526              }.bind(this), settings.timeout);
5527            }
5528          });
5529    },
5530
5531    reset : function (form) {
5532      form.removeAttr(this.invalid_attr);
5533      $(this.invalid_attr, form).removeAttr(this.invalid_attr);
5534      $('.' + this.settings.error_class, form).not('small').removeClass(this.settings.error_class);
5535    },
5536
5537    validate : function (els, e, is_ajax) {
5538      var validations = this.parse_patterns(els),
5539          validation_count = validations.length,
5540          form = this.S(els[0]).closest('form'),
5541          submit_event = /submit/.test(e.type);
5542
5543      // Has to count up to make sure the focus gets applied to the top error
5544      for (var i = 0; i < validation_count; i++) {
5545        if (!validations[i] && (submit_event || is_ajax)) {
5546          if (this.settings.focus_on_invalid) {
5547            els[i].focus();
5548          }
5549          form.trigger('invalid').trigger('invalid.fndtn.abide');
5550          this.S(els[i]).closest('form').attr(this.invalid_attr, '');
5551          return false;
5552        }
5553      }
5554
5555      if (submit_event || is_ajax) {
5556        form.trigger('valid').trigger('valid.fndtn.abide');
5557      }
5558
5559      form.removeAttr(this.invalid_attr);
5560
5561      if (is_ajax) {
5562        return false;
5563      }
5564
5565      return true;
5566    },
5567
5568    parse_patterns : function (els) {
5569      var i = els.length,
5570          el_patterns = [];
5571
5572      while (i--) {
5573        el_patterns.push(this.pattern(els[i]));
5574      }
5575
5576      return this.check_validation_and_apply_styles(el_patterns);
5577    },
5578
5579    pattern : function (el) {
5580      var type = el.getAttribute('type'),
5581          required = typeof el.getAttribute('required') === 'string';
5582
5583      var pattern = el.getAttribute('pattern') || '';
5584
5585      if (this.settings.patterns.hasOwnProperty(pattern) && pattern.length > 0) {
5586        return [el, this.settings.patterns[pattern], required];
5587      } else if (pattern.length > 0) {
5588        return [el, new RegExp(pattern), required];
5589      }
5590
5591      if (this.settings.patterns.hasOwnProperty(type)) {
5592        return [el, this.settings.patterns[type], required];
5593      }
5594
5595      pattern = /.*/;
5596
5597      return [el, pattern, required];
5598    },
5599
5600    // TODO: Break this up into smaller methods, getting hard to read.
5601    check_validation_and_apply_styles : function (el_patterns) {
5602      var i = el_patterns.length,
5603          validations = [],
5604          form = this.S(el_patterns[0][0]).closest('[data-' + this.attr_name(true) + ']'),
5605          settings = form.data(this.attr_name(true) + '-init') || {};
5606      while (i--) {
5607        var el = el_patterns[i][0],
5608            required = el_patterns[i][2],
5609            value = el.value.trim(),
5610            direct_parent = this.S(el).parent(),
5611            validator = el.getAttribute(this.add_namespace('data-abide-validator')),
5612            is_radio = el.type === 'radio',
5613            is_checkbox = el.type === 'checkbox',
5614            label = this.S('label[for="' + el.getAttribute('id') + '"]'),
5615            valid_length = (required) ? (el.value.length > 0) : true,
5616            el_validations = [];
5617
5618        var parent, valid;
5619
5620        // support old way to do equalTo validations
5621        if (el.getAttribute(this.add_namespace('data-equalto'))) { validator = 'equalTo' }
5622
5623        if (!direct_parent.is('label')) {
5624          parent = direct_parent;
5625        } else {
5626          parent = direct_parent.parent();
5627        }
5628
5629        if (validator) {
5630          valid = this.settings.validators[validator].apply(this, [el, required, parent]);
5631          el_validations.push(valid);
5632        }
5633
5634        if (is_radio && required) {
5635          el_validations.push(this.valid_radio(el, required));
5636        } else if (is_checkbox && required) {
5637          el_validations.push(this.valid_checkbox(el, required));
5638        } else {
5639
5640          if (el_patterns[i][1].test(value) && valid_length ||
5641            !required && el.value.length < 1 || $(el).attr('disabled')) {
5642            el_validations.push(true);
5643          } else {
5644            el_validations.push(false);
5645          }
5646
5647          el_validations = [el_validations.every(function (valid) {return valid;})];
5648
5649          if (el_validations[0]) {
5650            this.S(el).removeAttr(this.invalid_attr);
5651            el.setAttribute('aria-invalid', 'false');
5652            el.removeAttribute('aria-describedby');
5653            parent.removeClass(this.settings.error_class);
5654            if (label.length > 0 && this.settings.error_labels) {
5655              label.removeClass(this.settings.error_class).removeAttr('role');
5656            }
5657            $(el).triggerHandler('valid');
5658          } else {
5659            this.S(el).attr(this.invalid_attr, '');
5660            el.setAttribute('aria-invalid', 'true');
5661
5662            // Try to find the error associated with the input
5663            var errorElem = parent.find('small.' + this.settings.error_class, 'span.' + this.settings.error_class);
5664            var errorID = errorElem.length > 0 ? errorElem[0].id : '';
5665            if (errorID.length > 0) {
5666              el.setAttribute('aria-describedby', errorID);
5667            }
5668
5669            // el.setAttribute('aria-describedby', $(el).find('.error')[0].id);
5670            parent.addClass(this.settings.error_class);
5671            if (label.length > 0 && this.settings.error_labels) {
5672              label.addClass(this.settings.error_class).attr('role', 'alert');
5673            }
5674            $(el).triggerHandler('invalid');
5675          }
5676        }
5677        validations.push(el_validations[0]);
5678      }
5679      validations = [validations.every(function (valid) {return valid;})];
5680      return validations;
5681    },
5682
5683    valid_checkbox : function (el, required) {
5684      var el = this.S(el),
5685          valid = (el.is(':checked') || !required || el.get(0).getAttribute('disabled'));
5686
5687      if (valid) {
5688        el.removeAttr(this.invalid_attr).parent().removeClass(this.settings.error_class);
5689      } else {
5690        el.attr(this.invalid_attr, '').parent().addClass(this.settings.error_class);
5691      }
5692
5693      return valid;
5694    },
5695
5696    valid_radio : function (el, required) {
5697      var name = el.getAttribute('name'),
5698          group = this.S(el).closest('[data-' + this.attr_name(true) + ']').find("[name='" + name + "']"),
5699          count = group.length,
5700          valid = false,
5701          disabled = false;
5702
5703      // Has to count up to make sure the focus gets applied to the top error
5704        for (var i=0; i < count; i++) {
5705            if( group[i].getAttribute('disabled') ){
5706                disabled=true;
5707                valid=true;
5708            } else {
5709                if (group[i].checked){
5710                    valid = true;
5711                } else {
5712                    if( disabled ){
5713                        valid = false;
5714                    }
5715                }
5716            }
5717        }
5718
5719      // Has to count up to make sure the focus gets applied to the top error
5720      for (var i = 0; i < count; i++) {
5721        if (valid) {
5722          this.S(group[i]).removeAttr(this.invalid_attr).parent().removeClass(this.settings.error_class);
5723        } else {
5724          this.S(group[i]).attr(this.invalid_attr, '').parent().addClass(this.settings.error_class);
5725        }
5726      }
5727
5728      return valid;
5729    },
5730
5731    valid_equal : function (el, required, parent) {
5732      var from  = document.getElementById(el.getAttribute(this.add_namespace('data-equalto'))).value,
5733          to    = el.value,
5734          valid = (from === to);
5735
5736      if (valid) {
5737        this.S(el).removeAttr(this.invalid_attr);
5738        parent.removeClass(this.settings.error_class);
5739        if (label.length > 0 && settings.error_labels) {
5740          label.removeClass(this.settings.error_class);
5741        }
5742      } else {
5743        this.S(el).attr(this.invalid_attr, '');
5744        parent.addClass(this.settings.error_class);
5745        if (label.length > 0 && settings.error_labels) {
5746          label.addClass(this.settings.error_class);
5747        }
5748      }
5749
5750      return valid;
5751    },
5752
5753    valid_oneof : function (el, required, parent, doNotValidateOthers) {
5754      var el = this.S(el),
5755        others = this.S('[' + this.add_namespace('data-oneof') + ']'),
5756        valid = others.filter(':checked').length > 0;
5757
5758      if (valid) {
5759        el.removeAttr(this.invalid_attr).parent().removeClass(this.settings.error_class);
5760      } else {
5761        el.attr(this.invalid_attr, '').parent().addClass(this.settings.error_class);
5762      }
5763
5764      if (!doNotValidateOthers) {
5765        var _this = this;
5766        others.each(function () {
5767          _this.valid_oneof.call(_this, this, null, null, true);
5768        });
5769      }
5770
5771      return valid;
5772    }
5773  };
5774}(jQuery, window, window.document));
5775;(function ($, window, document, undefined) {
5776  'use strict';
5777
5778  Foundation.libs.tooltip = {
5779    name : 'tooltip',
5780
5781    version : '5.5.1',
5782
5783    settings : {
5784      additional_inheritable_classes : [],
5785      tooltip_class : '.tooltip',
5786      append_to : 'body',
5787      touch_close_text : 'Tap To Close',
5788      disable_for_touch : false,
5789      hover_delay : 200,
5790      show_on : 'all',
5791      tip_template : function (selector, content) {
5792        return '<span data-selector="' + selector + '" id="' + selector + '" class="'
5793          + Foundation.libs.tooltip.settings.tooltip_class.substring(1)
5794          + '" role="tooltip">' + content + '<span class="nub"></span></span>';
5795      }
5796    },
5797
5798    cache : {},
5799
5800    init : function (scope, method, options) {
5801      Foundation.inherit(this, 'random_str');
5802      this.bindings(method, options);
5803    },
5804
5805    should_show : function (target, tip) {
5806      var settings = $.extend({}, this.settings, this.data_options(target));
5807
5808      if (settings.show_on === 'all') {
5809        return true;
5810      } else if (this.small() && settings.show_on === 'small') {
5811        return true;
5812      } else if (this.medium() && settings.show_on === 'medium') {
5813        return true;
5814      } else if (this.large() && settings.show_on === 'large') {
5815        return true;
5816      }
5817      return false;
5818    },
5819
5820    medium : function () {
5821      return matchMedia(Foundation.media_queries['medium']).matches;
5822    },
5823
5824    large : function () {
5825      return matchMedia(Foundation.media_queries['large']).matches;
5826    },
5827
5828    events : function (instance) {
5829      var self = this,
5830          S = self.S;
5831
5832      self.create(this.S(instance));
5833
5834      $(this.scope)
5835        .off('.tooltip')
5836        .on('mouseenter.fndtn.tooltip mouseleave.fndtn.tooltip touchstart.fndtn.tooltip MSPointerDown.fndtn.tooltip',
5837          '[' + this.attr_name() + ']', function (e) {
5838          var $this = S(this),
5839              settings = $.extend({}, self.settings, self.data_options($this)),
5840              is_touch = false;
5841
5842          if (Modernizr.touch && /touchstart|MSPointerDown/i.test(e.type) && S(e.target).is('a')) {
5843            return false;
5844          }
5845
5846          if (/mouse/i.test(e.type) && self.ie_touch(e)) {
5847            return false;
5848          }
5849
5850          if ($this.hasClass('open')) {
5851            if (Modernizr.touch && /touchstart|MSPointerDown/i.test(e.type)) {
5852              e.preventDefault();
5853            }
5854            self.hide($this);
5855          } else {
5856            if (settings.disable_for_touch && Modernizr.touch && /touchstart|MSPointerDown/i.test(e.type)) {
5857              return;
5858            } else if (!settings.disable_for_touch && Modernizr.touch && /touchstart|MSPointerDown/i.test(e.type)) {
5859              e.preventDefault();
5860              S(settings.tooltip_class + '.open').hide();
5861              is_touch = true;
5862            }
5863
5864            if (/enter|over/i.test(e.type)) {
5865              this.timer = setTimeout(function () {
5866                var tip = self.showTip($this);
5867              }.bind(this), self.settings.hover_delay);
5868            } else if (e.type === 'mouseout' || e.type === 'mouseleave') {
5869              clearTimeout(this.timer);
5870              self.hide($this);
5871            } else {
5872              self.showTip($this);
5873            }
5874          }
5875        })
5876        .on('mouseleave.fndtn.tooltip touchstart.fndtn.tooltip MSPointerDown.fndtn.tooltip', '[' + this.attr_name() + '].open', function (e) {
5877          if (/mouse/i.test(e.type) && self.ie_touch(e)) {
5878            return false;
5879          }
5880
5881          if ($(this).data('tooltip-open-event-type') == 'touch' && e.type == 'mouseleave') {
5882            return;
5883          } else if ($(this).data('tooltip-open-event-type') == 'mouse' && /MSPointerDown|touchstart/i.test(e.type)) {
5884            self.convert_to_touch($(this));
5885          } else {
5886            self.hide($(this));
5887          }
5888        })
5889        .on('DOMNodeRemoved DOMAttrModified', '[' + this.attr_name() + ']:not(a)', function (e) {
5890          self.hide(S(this));
5891        });
5892    },
5893
5894    ie_touch : function (e) {
5895      // How do I distinguish between IE11 and Windows Phone 8?????
5896      return false;
5897    },
5898
5899    showTip : function ($target) {
5900      var $tip = this.getTip($target);
5901      if (this.should_show($target, $tip)) {
5902        return this.show($target);
5903      }
5904      return;
5905    },
5906
5907    getTip : function ($target) {
5908      var selector = this.selector($target),
5909          settings = $.extend({}, this.settings, this.data_options($target)),
5910          tip = null;
5911
5912      if (selector) {
5913        tip = this.S('span[data-selector="' + selector + '"]' + settings.tooltip_class);
5914      }
5915
5916      return (typeof tip === 'object') ? tip : false;
5917    },
5918
5919    selector : function ($target) {
5920      var id = $target.attr('id'),
5921          dataSelector = $target.attr(this.attr_name()) || $target.attr('data-selector');
5922
5923      if ((id && id.length < 1 || !id) && typeof dataSelector != 'string') {
5924        dataSelector = this.random_str(6);
5925        $target
5926          .attr('data-selector', dataSelector)
5927          .attr('aria-describedby', dataSelector);
5928      }
5929
5930      return (id && id.length > 0) ? id : dataSelector;
5931    },
5932
5933    create : function ($target) {
5934      var self = this,
5935          settings = $.extend({}, this.settings, this.data_options($target)),
5936          tip_template = this.settings.tip_template;
5937
5938      if (typeof settings.tip_template === 'string' && window.hasOwnProperty(settings.tip_template)) {
5939        tip_template = window[settings.tip_template];
5940      }
5941
5942      var $tip = $(tip_template(this.selector($target), $('<div></div>').html($target.attr('title')).html())),
5943          classes = this.inheritable_classes($target);
5944
5945      $tip.addClass(classes).appendTo(settings.append_to);
5946
5947      if (Modernizr.touch) {
5948        $tip.append('<span class="tap-to-close">' + settings.touch_close_text + '</span>');
5949        $tip.on('touchstart.fndtn.tooltip MSPointerDown.fndtn.tooltip', function (e) {
5950          self.hide($target);
5951        });
5952      }
5953
5954      $target.removeAttr('title').attr('title', '');
5955    },
5956
5957    reposition : function (target, tip, classes) {
5958      var width, nub, nubHeight, nubWidth, column, objPos;
5959
5960      tip.css('visibility', 'hidden').show();
5961
5962      width = target.data('width');
5963      nub = tip.children('.nub');
5964      nubHeight = nub.outerHeight();
5965      nubWidth = nub.outerHeight();
5966
5967      if (this.small()) {
5968        tip.css({'width' : '100%'});
5969      } else {
5970        tip.css({'width' : (width) ? width : 'auto'});
5971      }
5972
5973      objPos = function (obj, top, right, bottom, left, width) {
5974        return obj.css({
5975          'top' : (top) ? top : 'auto',
5976          'bottom' : (bottom) ? bottom : 'auto',
5977          'left' : (left) ? left : 'auto',
5978          'right' : (right) ? right : 'auto'
5979        }).end();
5980      };
5981
5982      objPos(tip, (target.offset().top + target.outerHeight() + 10), 'auto', 'auto', target.offset().left);
5983
5984      if (this.small()) {
5985        objPos(tip, (target.offset().top + target.outerHeight() + 10), 'auto', 'auto', 12.5, $(this.scope).width());
5986        tip.addClass('tip-override');
5987        objPos(nub, -nubHeight, 'auto', 'auto', target.offset().left);
5988      } else {
5989        var left = target.offset().left;
5990        if (Foundation.rtl) {
5991          nub.addClass('rtl');
5992          left = target.offset().left + target.outerWidth() - tip.outerWidth();
5993        }
5994        objPos(tip, (target.offset().top + target.outerHeight() + 10), 'auto', 'auto', left);
5995        tip.removeClass('tip-override');
5996        if (classes && classes.indexOf('tip-top') > -1) {
5997          if (Foundation.rtl) {
5998            nub.addClass('rtl');
5999          }
6000          objPos(tip, (target.offset().top - tip.outerHeight()), 'auto', 'auto', left)
6001            .removeClass('tip-override');
6002        } else if (classes && classes.indexOf('tip-left') > -1) {
6003          objPos(tip, (target.offset().top + (target.outerHeight() / 2) - (tip.outerHeight() / 2)), 'auto', 'auto', (target.offset().left - tip.outerWidth() - nubHeight))
6004            .removeClass('tip-override');
6005          nub.removeClass('rtl');
6006        } else if (classes && classes.indexOf('tip-right') > -1) {
6007          objPos(tip, (target.offset().top + (target.outerHeight() / 2) - (tip.outerHeight() / 2)), 'auto', 'auto', (target.offset().left + target.outerWidth() + nubHeight))
6008            .removeClass('tip-override');
6009          nub.removeClass('rtl');
6010        }
6011      }
6012
6013      tip.css('visibility', 'visible').hide();
6014    },
6015
6016    small : function () {
6017      return matchMedia(Foundation.media_queries.small).matches &&
6018        !matchMedia(Foundation.media_queries.medium).matches;
6019    },
6020
6021    inheritable_classes : function ($target) {
6022      var settings = $.extend({}, this.settings, this.data_options($target)),
6023          inheritables = ['tip-top', 'tip-left', 'tip-bottom', 'tip-right', 'radius', 'round'].concat(settings.additional_inheritable_classes),
6024          classes = $target.attr('class'),
6025          filtered = classes ? $.map(classes.split(' '), function (el, i) {
6026            if ($.inArray(el, inheritables) !== -1) {
6027              return el;
6028            }
6029          }).join(' ') : '';
6030
6031      return $.trim(filtered);
6032    },
6033
6034    convert_to_touch : function ($target) {
6035      var self = this,
6036          $tip = self.getTip($target),
6037          settings = $.extend({}, self.settings, self.data_options($target));
6038
6039      if ($tip.find('.tap-to-close').length === 0) {
6040        $tip.append('<span class="tap-to-close">' + settings.touch_close_text + '</span>');
6041        $tip.on('click.fndtn.tooltip.tapclose touchstart.fndtn.tooltip.tapclose MSPointerDown.fndtn.tooltip.tapclose', function (e) {
6042          self.hide($target);
6043        });
6044      }
6045
6046      $target.data('tooltip-open-event-type', 'touch');
6047    },
6048
6049    show : function ($target) {
6050      var $tip = this.getTip($target);
6051
6052      if ($target.data('tooltip-open-event-type') == 'touch') {
6053        this.convert_to_touch($target);
6054      }
6055
6056      this.reposition($target, $tip, $target.attr('class'));
6057      $target.addClass('open');
6058      $tip.fadeIn(150);
6059    },
6060
6061    hide : function ($target) {
6062      var $tip = this.getTip($target);
6063
6064      $tip.fadeOut(150, function () {
6065        $tip.find('.tap-to-close').remove();
6066        $tip.off('click.fndtn.tooltip.tapclose MSPointerDown.fndtn.tapclose');
6067        $target.removeClass('open');
6068      });
6069    },
6070
6071    off : function () {
6072      var self = this;
6073      this.S(this.scope).off('.fndtn.tooltip');
6074      this.S(this.settings.tooltip_class).each(function (i) {
6075        $('[' + self.attr_name() + ']').eq(i).attr('title', $(this).text());
6076      }).remove();
6077    },
6078
6079    reflow : function () {}
6080  };
6081}(jQuery, window, window.document));

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.