PageSourceSearch

https://www.chinaexploration.com/js/foundation.js

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