PageSourceSearch

https://www.thesearanchlodge.com/js/js_client_bundle.js?v=OO0x1Rj389-wjPdlzRuF9W4nlmI5uxovzpkZ3ChhMb81

js thesearanchlodge.com collected 2026-09-29 06:08:42 UTC 417,074 bytes, 8,854 lines download raw bytes

vendor: 4,229 bytes, lines 1-11
1/* Minification failed. Returning unminified contents.
2(2807,9-10): run-time error JS1010: Expected identifier: .
3(2807,9-10): run-time error JS1195: Expected expression: .
4(5538,15-16): run-time error JS1010: Expected identifier: .
5(5538,15-16): run-time error JS1195: Expected expression: .
6 */
7//     Underscore.js 1.8.3
8//     http://underscorejs.org
9//     (c) 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
10//     Underscore may be freely distributed under the MIT license.
11(function(){function n(n){function t(t,r,e,u,i,o){for(;i>=0&&o>i;i+=n){var a=u?u[i]:i;e=r(e,t[a],a,t)}return e}return function(r,e,u,i){e=b(e,i,4);var o=!k(r)&&m.keys(r),a=(o||r).length,c=n>0?0:a-1;return arguments.length<3&&(u=r[o?o[c]:c],c+=n),t(r,e,u,o,c,a)}}function t(n){return function(t,r,e){r=x(r,e);for(var u=O(t),i=n>0?0:u-1;i>=0&&u>i;i+=n)if(r(t[i],i,t))return i;return-1}}function r(n,t,r){return function(e,u,i){var o=0,a=O(e);if("number"==typeof i)n>0?o=i>=0?i:Math.max(i+a,o):a=i>=0?Math.min(i+1,a):i+a+1;else if(r&&i&&a)return i=r(e,u),e[i]===u?i:-1;if(u!==u)return i=t(l.call(e,o,a),m.isNaN),i>=0?i+o:-1;for(i=n>0?o:a-1;i>=0&&a>i;i+=n)if(e[i]===u)return i;return-1}}function e(n,t){var r=I.length,e=n.constructor,u=m.isFunction(e)&&e.prototype||a,i="constructor";for(m.has(n,i)&&!m.contains(t,i)&&t.push(i);r--;)i=I[r],i in n&&n[i]!==u[i]&&!m.contains(t,i)&&t.push(i)}var u=this,i=u._,o=Array.prototype,a=Object.prototype,c=Function.prototype,f=o.push,l=o.slice,s=a.toString,p=a.hasOwnProperty,h=Array.isArray,v=Object.keys,g=c.bind,y=Object.create,d=function(){},m=function(n){return n instanceof m?n:this instanceof m?void(this._wrapped=n):new m(n)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=m),exports._=m):u._=m,m.VERSION="1.8.3";var b=function(n,t,r){if(t===void 0)return n;switch(null==r?3:r){case 1:return function(r){return n.call(t,r)};case 2:return function(r,e){return n.call(t,r,e)};case 3:return function(r,e,u){return n.call(t,r,e,u)};case 4:return function(r,e,u,i){return n.call(t,r,e,u,i)}}return function(){return n.apply(t,arguments)}},x=function(n,t,r){return null==n?m.identity:m.isFunction(n)?b(n,t,r):m.isObject(n)?m.matcher(n):m.property(n)};m.iteratee=function(n,t){return x(n,t,1/0)};var _=function(n,t){return function(r){var e=arguments.length;if(2>e||null==r)return r;for(var u=1;e>u;u++)for(var i=arguments[u],o=n(i),a=o.length,c=0;a>c;c++){var f=o[c];t&&r[f]!==void 0||(r[f]=i[f])}return r}},j=function(n){if(!m.isObject(n))return{};if(y)return y(n);d.prototype=n;var t=new d;return d.prototype=null,t},w=function(n){return function(t){return null==t?void 0:t[n]}},A=Math.pow(2,53)-1,O=w("length"),k=function(n){var t=O(n);return"number"==typeof t&&t>=0&&A>=t};m.each=m.forEach=function(n,t,r){t=b(t,r);var e,u;if(k(n))for(e=0,u=n.length;u>e;e++)t(n[e],e,n);else{var i=m.keys(n);for(e=0,u=i.length;u>e;e++)t(n[i[e]],i[e],n)}return n},m.map=m.collect=function(n,t,r){t=x(t,r);for(var e=!k(n)&&m.keys(n),u=(e||n).length,i=Array(u),o=0;u>o;o++){var a=e?e[o]:o;i[o]=t(n[a],a,n)}return i},m.reduce=m.foldl=m.inject=n(1),m.reduceRight=m.foldr=n(-1),m.find=m.detect=function(n,t,r){var e;return e=k(n)?m.findIndex(n,t,r):m.findKey(n,t,r),e!==void 0&&e!==-1?n[e]:void 0},m.filter=m.select=function(n,t,r){var e=[];return t=x(t,r),m.each(n,function(n,r,u){t(n,r,u)&&e.push(n)}),e},m.reject=function(n,t,r){return m.filter(n,m.negate(x(t)),r)},m.every=m.all=function(n,t,r){t=x(t,r);for(var e=!k(n)&&m.keys(n),u=(e||n).length,i=0;u>i;i++){var o=e?e[i]:i;if(!t(n[o],o,n))return!1}return!0},m.some=m.any=function(n,t,r){t=x(t,r);for(var e=!k(n)&&m.keys(n),u=(e||n).length,i=0;u>i;i++){var o=e?e[i]:i;if(t(n[o],o,n))return!0}return!1},m.contains=m.includes=m.include=function(n,t,r,e){return k(n)||(n=m.values(n)),("number"!=typeof r||e)&&(r=0),m.indexOf(n,t,r)>=0},m.invoke=function(n,t){var r=l.call(arguments,2),e=m.isFunction(t);return m.map(n,function(n){var u=e?t:n[t];return null==u?u:u.apply(n,r)})},m.pluck=function(n,t){return m.map(n,m.property(t))},m.where=function(n,t){return m.filter(n,m.matcher(t))},m.findWhere=function(n,t){return m.find(n,m.matcher(t))},m.max=function(n,t,r){var e,u,i=-1/0,o=-1/0;
11if(null==t&&null!=n){n=k(n)?n:m.values(n);for(var a=0,c=n.length;c>a;a++)e=n[a],e>i&&(i=e)}else t=x(t,r),m.each(n,function(n,r,e){u=t(n,r,e),(u>o||u===-1/0&&i===-1/0)&&(i=n,o=u)});return i},m.min=function(n,t,r){var e,u,i=1/0,o=1/0;if(null==t&&null!=n){n=k(n)?n:m.values(n);for(var a=0,c=n.length;c>a;a++)e=n[a],i>e&&(i=e)}else t=x(t,r),m.each(n,function(n,r,e){u=t(n,r,e),(o>u||1/0===u&&1/0===i)&&(i=n,o=u)});return i},m.shuffle=function(n){for(var t,r=k(n)?n:m.values(n),e=r.length,u=Array(e),i=0;e>i;i++)t=m.random(0,i),t!==i&&(u[i]=u[t]),u[t]=r[i];return u},m.sample=function(n,t,r){return null==t||r?(k(n)||(n=m.values(n)),n[m.random(n.length-1)]):m.shuffle(n).slice(0,Math.max(0,t))},m.sortBy=function(n,t,r){return t=x(t,r),m.pluck(m.map(n,function(n,r,e){return{value:n,index:r,criteria:t(n,r,e)}}).sort(function(n,t){var r=n.criteria,e=t.criteria;if(r!==e){if(r>e||r===void 0)return 1;if(e>r||e===void 0)return-1}return n.index-t.index}),"value")};var F=function(n){return function(t,r,e){var u={};return r=x(r,e),m.each(t,function(e,i){var o=r(e,i,t);n(u,e,o)}),u}};m.groupBy=F(function(n,t,r){m.has(n,r)?n[r].push(t):n[r]=[t]}),m.indexBy=F(function(n,t,r){n[r]=t}),m.countBy=F(function(n,t,r){m.has(n,r)?n[r]++:n[r]=1}),m.toArray=function(n){return n?m.isArray(n)?l.call(n):k(n)?m.map(n,m.identity):m.values(n):[]},m.size=function(n){return null==n?0:k(n)?n.length:m.keys(n).length},m.partition=function(n,t,r){t=x(t,r);var e=[],u=[];return m.each(n,function(n,r,i){(t(n,r,i)?e:u).push(n)}),[e,u]},m.first=m.head=m.take=function(n,t,r){return null==n?void 0:null==t||r?n[0]:m.initial(n,n.length-t)},m.initial=function(n,t,r){return l.call(n,0,Math.max(0,n.length-(null==t||r?1:t)))},m.last=function(n,t,r){return null==n?void 0:null==t||r?n[n.length-1]:m.rest(n,Math.max(0,n.length-t))},m.rest=m.tail=m.drop=function(n,t,r){return l.call(n,null==t||r?1:t)},m.compact=function(n){return m.filter(n,m.identity)};var S=function(n,t,r,e){for(var u=[],i=0,o=e||0,a=O(n);a>o;o++){var c=n[o];if(k(c)&&(m.isArray(c)||m.isArguments(c))){t||(c=S(c,t,r));var f=0,l=c.length;for(u.length+=l;l>f;)u[i++]=c[f++]}else r||(u[i++]=c)}return u};m.flatten=function(n,t){return S(n,t,!1)},m.without=function(n){return m.difference(n,l.call(arguments,1))},m.uniq=m.unique=function(n,t,r,e){m.isBoolean(t)||(e=r,r=t,t=!1),null!=r&&(r=x(r,e));for(var u=[],i=[],o=0,a=O(n);a>o;o++){var c=n[o],f=r?r(c,o,n):c;t?(o&&i===f||u.push(c),i=f):r?m.contains(i,f)||(i.push(f),u.push(c)):m.contains(u,c)||u.push(c)}return u},m.union=function(){return m.uniq(S(arguments,!0,!0))},m.intersection=function(n){for(var t=[],r=arguments.length,e=0,u=O(n);u>e;e++){var i=n[e];if(!m.contains(t,i)){for(var o=1;r>o&&m.contains(arguments[o],i);o++);o===r&&t.push(i)}}return t},m.difference=function(n){var t=S(arguments,!0,!0,1);return m.filter(n,function(n){return!m.contains(t,n)})},m.zip=function(){return m.unzip(arguments)},m.unzip=function(n){for(var t=n&&m.max(n,O).length||0,r=Array(t),e=0;t>e;e++)r[e]=m.pluck(n,e);return r},m.object=function(n,t){for(var r={},e=0,u=O(n);u>e;e++)t?r[n[e]]=t[e]:r[n[e][0]]=n[e][1];return r},m.findIndex=t(1),m.findLastIndex=t(-1),m.sortedIndex=function(n,t,r,e){r=x(r,e,1);for(var u=r(t),i=0,o=O(n);o>i;){var a=Math.floor((i+o)/2);r(n[a])<u?i=a+1:o=a}return i},m.indexOf=r(1,m.findIndex,m.sortedIndex),m.lastIndexOf=r(-1,m.findLastIndex),m.range=function(n,t,r){null==t&&(t=n||0,n=0),r=r||1;for(var e=Math.max(Math.ceil((t-n)/r),0),u=Array(e),i=0;e>i;i++,n+=r)u[i]=n;return u};var E=function(n,t,r,e,u){if(!(e instanceof t))return n.apply(r,u);var i=j(n.prototype),o=n.apply(i,u);return m.isObject(o)?o:i};m.bind=function(n,t){if(g&&n.bind===g)return g.apply(n,l.call(arguments,1));if(!m.isFunction(n))throw new TypeError("Bind must be called on a function");var r=l.call(arguments,2),e=function(){return E(n,e,t,this,r.concat(l.call(arguments)))};return e},m.partial=function(n){var t=l.call(arguments,1),r=function(){for(var e=0,u=t.length,i=Array(u),o=0;u>o;o++)i[o]=t[o]===m?arguments[e++]:t[o];for(;e<arguments.length;)i.push(arguments[e++]);return E(n,r,this,this,i)};return r},m.bindAll=function(n){var t,r,e=arguments.length;if(1>=e)throw new Error("bindAll must be passed function names");for(t=1;e>t;t++)r=arguments[t],n[r]=m.bind(n[r],n);return n},m.memoize=function(n,t){var r=function(e){var u=r.cache,i=""+(t?t.apply(this,arguments):e);return m.has(u,i)||(u[i]=n.apply(this,arguments)),u[i]};return r.cache={},r},m.delay=function(n,t){var r=l.call(arguments,2);return setTimeout(function(){return n.apply(null,r)},t)},m.defer=m.partial(m.delay,m,1),m.throttle=function(n,t,r){var e,u,i,o=null,a=0;r||(r={});var c=function(){a=r.leading===!1?0:m.now(),o=null,i=n.apply(e,u),o||(e=u=null)};return function(){var f=m.now();a||r.leading!==!1||(a=f);var l=t-(f-a);return e=this,u=arguments,0>=l||l>t?(o&&(clearTimeout(o),o=null),a=f,i=n.apply(e,u),o||(e=u=null)):o||r.trailing===!1||(o=setTimeout(c,l)),i}},m.debounce=function(n,t,r){var e,u,i,o,a,c=function(){var f=m.now()-o;t>f&&f>=0?e=setTimeout(c,t-f):(e=null,r||(a=n.apply(i,u),e||(i=u=null)))};return function(){i=this,u=arguments,o=m.now();var f=r&&!e;return e||(e=setTimeout(c,t)),f&&(a=n.apply(i,u),i=u=null),a}},m.wrap=function(n,t){return m.partial(t,n)},m.negate=function(n){return function(){return!n.apply(this,arguments)}},m.compose=function(){var n=arguments,t=n.length-1;return function(){for(var r=t,e=n[t].apply(this,arguments);r--;)e=n[r].call(this,e);return e}},m.after=function(n,t){return function(){return--n<1?t.apply(this,arguments):void 0}},m.before=function(n,t){var r;return function(){return--n>0&&(r=t.apply(this,arguments)),1>=n&&(t=null),r}},m.once=m.partial(m.before,2);var M=!{toString:null}.propertyIsEnumerable("toString"),I=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleStr
11ing"];m.keys=function(n){if(!m.isObject(n))return[];if(v)return v(n);var t=[];for(var r in n)m.has(n,r)&&t.push(r);return M&&e(n,t),t},m.allKeys=function(n){if(!m.isObject(n))return[];var t=[];for(var r in n)t.push(r);return M&&e(n,t),t},m.values=function(n){for(var t=m.keys(n),r=t.length,e=Array(r),u=0;r>u;u++)e[u]=n[t[u]];return e},m.mapObject=function(n,t,r){t=x(t,r);for(var e,u=m.keys(n),i=u.length,o={},a=0;i>a;a++)e=u[a],o[e]=t(n[e],e,n);return o},m.pairs=function(n){for(var t=m.keys(n),r=t.length,e=Array(r),u=0;r>u;u++)e[u]=[t[u],n[t[u]]];return e},m.invert=function(n){for(var t={},r=m.keys(n),e=0,u=r.length;u>e;e++)t[n[r[e]]]=r[e];return t},m.functions=m.methods=function(n){var t=[];for(var r in n)m.isFunction(n[r])&&t.push(r);return t.sort()},m.extend=_(m.allKeys),m.extendOwn=m.assign=_(m.keys),m.findKey=function(n,t,r){t=x(t,r);for(var e,u=m.keys(n),i=0,o=u.length;o>i;i++)if(e=u[i],t(n[e],e,n))return e},m.pick=function(n,t,r){var e,u,i={},o=n;if(null==o)return i;m.isFunction(t)?(u=m.allKeys(o),e=b(t,r)):(u=S(arguments,!1,!1,1),e=function(n,t,r){return t in r},o=Object(o));for(var a=0,c=u.length;c>a;a++){var f=u[a],l=o[f];e(l,f,o)&&(i[f]=l)}return i},m.omit=function(n,t,r){if(m.isFunction(t))t=m.negate(t);else{var e=m.map(S(arguments,!1,!1,1),String);t=function(n,t){return!m.contains(e,t)}}return m.pick(n,t,r)},m.defaults=_(m.allKeys,!0),m.create=function(n,t){var r=j(n);return t&&m.extendOwn(r,t),r},m.clone=function(n){return m.isObject(n)?m.isArray(n)?n.slice():m.extend({},n):n},m.tap=function(n,t){return t(n),n},m.isMatch=function(n,t){var r=m.keys(t),e=r.length;if(null==n)return!e;for(var u=Object(n),i=0;e>i;i++){var o=r[i];if(t[o]!==u[o]||!(o in u))return!1}return!0};var N=function(n,t,r,e){if(n===t)return 0!==n||1/n===1/t;if(null==n||null==t)return n===t;n instanceof m&&(n=n._wrapped),t instanceof m&&(t=t._wrapped);var u=s.call(n);if(u!==s.call(t))return!1;switch(u){case"[object RegExp]":case"[object String]":return""+n==""+t;case"[object Number]":return+n!==+n?+t!==+t:0===+n?1/+n===1/t:+n===+t;case"[object Date]":case"[object Boolean]":return+n===+t}var i="[object Array]"===u;if(!i){if("object"!=typeof n||"object"!=typeof t)return!1;var o=n.constructor,a=t.constructor;if(o!==a&&!(m.isFunction(o)&&o instanceof o&&m.isFunction(a)&&a instanceof a)&&"constructor"in n&&"constructor"in t)return!1}r=r||[],e=e||[];for(var c=r.length;c--;)if(r[c]===n)return e[c]===t;if(r.push(n),e.push(t),i){if(c=n.length,c!==t.length)return!1;for(;c--;)if(!N(n[c],t[c],r,e))return!1}else{var f,l=m.keys(n);if(c=l.length,m.keys(t).length!==c)return!1;for(;c--;)if(f=l[c],!m.has(t,f)||!N(n[f],t[f],r,e))return!1}return r.pop(),e.pop(),!0};m.isEqual=function(n,t){return N(n,t)},m.isEmpty=function(n){return null==n?!0:k(n)&&(m.isArray(n)||m.isString(n)||m.isArguments(n))?0===n.length:0===m.keys(n).length},m.isElement=function(n){return!(!n||1!==n.nodeType)},m.isArray=h||function(n){return"[object Array]"===s.call(n)},m.isObject=function(n){var t=typeof n;return"function"===t||"object"===t&&!!n},m.each(["Arguments","Function","String","Number","Date","RegExp","Error"],function(n){m["is"+n]=function(t){return s.call(t)==="[object "+n+"]"}}),m.isArguments(arguments)||(m.isArguments=function(n){return m.has(n,"callee")}),"function"!=typeof/./&&"object"!=typeof Int8Array&&(m.isFunction=function(n){return"function"==typeof n||!1}),m.isFinite=function(n){return isFinite(n)&&!isNaN(parseFloat(n))},m.isNaN=function(n){return m.isNumber(n)&&n!==+n},m.isBoolean=function(n){return n===!0||n===!1||"[object Boolean]"===s.call(n)},m.isNull=function(n){return null===n},m.isUndefined=function(n){return n===void 0},m.has=function(n,t){return null!=n&&p.call(n,t)},m.noConflict=function(){return u._=i,this},m.identity=function(n){return n},m.constant=function(n){return function(){return n}},m.noop=function(){},m.property=w,m.propertyOf=function(n){return null==n?function(){}:function(t){return n[t]}},m.matcher=m.matches=function(n){return n=m.extendOwn({},n),function(t){return m.isMatch(t,n)}},m.times=function(n,t,r){var e=Array(Math.max(0,n));t=b(t,r,1);for(var u=0;n>u;u++)e[u]=t(u);return e},m.random=function(n,t){return null==t&&(t=n,n=0),n+Math.floor(Math.random()*(t-n+1))},m.now=Date.now||function(){return(new Date).getTime()};var B={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},T=m.invert(B),R=function(n){var t=function(t){return n[t]},r="(?:"+m.keys(n).join("|")+")",e=RegExp(r),u=RegExp(r,"g");return function(n){return n=null==n?"":""+n,e.test(n)?n.replace(u,t):n}};m.escape=R(B),m.unescape=R(T),m.result=function(n,t,r){var e=null==n?void 0:n[t];return e===void 0&&(e=r),m.isFunction(e)?e.call(n):e};var q=0;m.uniqueId=function(n){var t=++q+"";return n?n+t:t},m.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var K=/(.)^/,z={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},D=/\\|'|\r|\n|\u2028|\u2029/g,L=function(n){return"\\"+z[n]};m.template=function(n,t,r){!t&&r&&(t=r),t=m.defaults({},t,m.templateSettings);var e=RegExp([(t.escape||K).source,(t.interpolate||K).source,(t.evaluate||K).source].join("|")+"|$","g"),u=0,i="__p+='";n.replace(e,function(t,r,e,o,a){return i+=n.slice(u,a).replace(D,L),u=a+t.length,r?i+="'+\n((__t=("+r+"))==null?'':_.escape(__t))+\n'":e?i+="'+\n((__t=("+e+"))==null?'':__t)+\n'":o&&(i+="';\n"+o+"\n__p+='"),t}),i+="';\n",t.variable||(i="with(obj||{}){\n"+i+"}\n"),i="var __t,__p='',__j=Array.prototype.join,"+"print=function(){__p+=__j.call(arguments,'');};\n"+i+"return __p;\n";try{var o=new Function(t.variable||"obj","_",i)}catch(a){throw a.source=i,a}var c=function(n){return o.call(this,n,m)},f=t.variable||"obj";return c.source="function("+f+"){\n"+i+"}",c},m.chain=function(n){var t=m(n);return t._chain=!0,t};var P=function(n,t){return n._chain?m(t).chain():t};m.mixin=function(n){m.each(m.functions(n),function(t){var r=m[t]=n[t];m.prototype[t]=function(){var n=[this._wrapped];return f.apply(n,arguments),P(this,r.apply(m,n))}})},m.mixin(m),m.each(["pop","push","reverse","shift","sort","splice","unshift"],function(n){var t=o[n];m.prototype[n]=function(){var r=this._wrapped;return t.apply(r,arguments),"shift"!==n&&"splice"!==n||0!==r.length||delete r[0],P(this,r)}}),m.each(["concat","join","slice"],function(n){var t=o[n];m.prototype[n]=function(){return P(this,t.apply(this._wrapped,arguments))}}),m.prototype.value=function(){return this._wrapped},m.prototype.valueOf=m.prototype.toJSON=m.prototype.value,m.prototype.toString=function(){return""+this._wrapped},"function"==typeof define&&define.amd&&define("underscore",[],function(){return m})}).call(this);
12//# sourceMappingURL=underscore-min.map;
13/*! jQuery v3.3.1 | (c) JS Foundation and other contributors | jquery.org/license */�
vendor: 86,842 bytes, lines 13-14
13
14!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(e,t){"use strict";var n=[],r=e.document,i=Object.getPrototypeOf,o=n.slice,a=n.concat,s=n.push,u=n.indexOf,l={},c=l.toString,f=l.hasOwnProperty,p=f.toString,d=p.call(Object),h={},g=function e(t){return"function"==typeof t&&"number"!=typeof t.nodeType},y=function e(t){return null!=t&&t===t.window},v={type:!0,src:!0,noModule:!0};function m(e,t,n){var i,o=(t=t||r).createElement("script");if(o.text=e,n)for(i in v)n[i]&&(o[i]=n[i]);t.head.appendChild(o).parentNode.removeChild(o)}function x(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?l[c.call(e)]||"object":typeof e}var b="3.3.1",w=function(e,t){return new w.fn.init(e,t)},T=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;w.fn=w.prototype={jquery:"3.3.1",constructor:w,length:0,toArray:function(){return o.call(this)},get:function(e){return null==e?o.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=w.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return w.each(this,e)},map:function(e){return this.pushStack(w.map(this,function(t,n){return e.call(t,n,t)}))},slice:function(){return this.pushStack(o.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(n>=0&&n<t?[this[n]]:[])},end:function(){return this.prevObject||this.constructor()},push:s,sort:n.sort,splice:n.splice},w.extend=w.fn.extend=function(){var e,t,n,r,i,o,a=arguments[0]||{},s=1,u=arguments.length,l=!1;for("boolean"==typeof a&&(l=a,a=arguments[s]||{},s++),"object"==typeof a||g(a)||(a={}),s===u&&(a=this,s--);s<u;s++)if(null!=(e=arguments[s]))for(t in e)n=a[t],a!==(r=e[t])&&(l&&r&&(w.isPlainObject(r)||(i=Array.isArray(r)))?(i?(i=!1,o=n&&Array.isArray(n)?n:[]):o=n&&w.isPlainObject(n)?n:{},a[t]=w.extend(l,o,r)):void 0!==r&&(a[t]=r));return a},w.extend({expando:"jQuery"+("3.3.1"+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isPlainObject:function(e){var t,n;return!(!e||"[object Object]"!==c.call(e))&&(!(t=i(e))||"function"==typeof(n=f.call(t,"constructor")&&t.constructor)&&p.call(n)===d)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},globalEval:function(e){m(e)},each:function(e,t){var n,r=0;if(C(e)){for(n=e.length;r<n;r++)if(!1===t.call(e[r],r,e[r]))break}else for(r in e)if(!1===t.call(e[r],r,e[r]))break;return e},trim:function(e){return null==e?"":(e+"").replace(T,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(C(Object(e))?w.merge(n,"string"==typeof e?[e]:e):s.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:u.call(t,e,n)},merge:function(e,t){for(var n=+t.length,r=0,i=e.length;r<n;r++)e[i++]=t[r];return e.length=i,e},grep:function(e,t,n){for(var r,i=[],o=0,a=e.length,s=!n;o<a;o++)(r=!t(e[o],o))!==s&&i.push(e[o]);return i},map:function(e,t,n){var r,i,o=0,s=[];if(C(e))for(r=e.length;o<r;o++)null!=(i=t(e[o],o,n))&&s.push(i);else for(o in e)null!=(i=t(e[o],o,n))&&s.push(i);return a.apply([],s)},guid:1,support:h}),"function"==typeof Symbol&&(w.fn[Symbol.iterator]=n[Symbol.iterator]),w.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(e,t){l["[object "+t+"]"]=t.toLowerCase()});function C(e){var t=!!e&&"length"in e&&e.length,n=x(e);return!g(e)&&!y(e)&&("array"===n||0===t||"number"==typeof t&&t>0&&t-1 in e)}var E=function(e){var t,n,r,i,o,a,s,u,l,c,f,p,d,h,g,y,v,m,x,b="sizzle"+1*new Date,w=e.document,T=0,C=0,E=ae(),k=ae(),S=ae(),D=function(e,t){return e===t&&(f=!0),0},N={}.hasOwnProperty,A=[],j=A.pop,q=A.push,L=A.push,H=A.slice,O=function(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1},P="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",R="(?:\\\\.|[\\w-]|[^\0-\\xa0])+",I="\\["+M+"*("+R+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+R+"))|)"+M+"*\\]",W=":("+R+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+I+")*)|.*)\\)|)",$=new RegExp(M+"+","g"),B=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),F=new RegExp("^"+M+"*,"+M+"*"),_=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),z=new RegExp("="+M+"*([^\\]'\"]*?)"+M+"*\\]","g"),X=new RegExp(W),U=new RegExp("^"+R+"$"),V={ID:new RegExp("^#("+R+")"),CLASS:new RegExp("^\\.("+R+")"),TAG:new RegExp("^("+R+"|[*])"),ATTR:new RegExp("^"+I),PSEUDO:new RegExp("^"+W),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+P+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},G=/^(?:input|select|textarea|button)$/i,Y=/^h\d$/i,Q=/^[^{]+\{\s*\[native \w/,J=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,K=/[+~]/,Z=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),ee=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)},te=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ne=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},re=function(){p()},ie=me(function(e){return!0===e.disabled&&("form"in e||"label"in e)},{dir:"parentNode",next:"legend"});try{L.apply(A=H.call(w.childNodes),w.childNodes),A[w.childNodes.length].nodeType}catch(e){L={apply:A.length?function(e,t){q.apply(e,H.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function oe(e,t,r,i){var o,s,l,c,f,h,v,m=t&&t.ownerDocument,T=t?t.nodeType:9;if(r=r||[],"string"!=typeof e||!e||1!==T&&9!==T&&11!==T)return r;if(!i&&((t?t.ownerDocument||t:w)!==d&&p(t),t=t||d,g)){if(11!==T&&(f=J.exec(e)))if(o=f[1]){if(9===T){if(!(l=t.getElementById(o)))return r;if(l.id===o)return r.push(l),r}else if(m&&(l=m.getElementById(o))&&x(t,l)&&l.id===o)return r.push(l),r}else{if(f[2])return L.apply(r,t.getElementsByTagName(e)),r;if((o=f[3])&&n.getElementsByClassName&&t.getElementsByClassName)return L.apply(r,t.getElementsByClassName(o)),r}if(n.qsa&&!S[e+" "]&&(!y||!y.test(e))){if(1!==T)m=t,v=e;else if("object"!==t.nodeName.toLowerCase()){(c=t.getAttribute("id"))?c=c.replace(te,ne):t.setAttribute("id",c=b),s=(h=a(e)).length;while(s--)h[s]="#"+c+" "+ve(h[s]);v=h.join(","),m=K.test(e)&&ge(t.parentNode)||t}if(v)try{return L.apply(r,m.querySelectorAll(v)),r}catch(e){}finally{c===b&&t.removeAttribute("id")}}}return u(e.replace(B,"$1"),t,r,i)}function ae(){var e=[];function t(n,i){return e.push(n+" ")>r.cacheLength&&delete t[e.shift()],t[n+" "]=i}return t}function se(e){return e[b]=!0,e}function ue(e){var t=d.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function le(e,t){var n=e.split("|"),i=n.length;while(i--)r.attrHandle[n[i]]=t}function ce(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function fe(e){return function(t){return"input"===t.nodeName.toLowerCase()&&t.type===e}}function pe(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function de(e){return function(t){return"form"in t?t.parentNode&&!1===t.disabled?"label"in t?"label"in t.parentNode?t.parentNode.disabled===e:t.disabled===e:t.isDisabled===e||t.isDisabled!==!e&&ie(t)===e:t.disabled===e:"label"in t&&t.disabled===e}}function he(e){return se(function(t){return t=+t,se(function(n,r){var i,o=e([],n.length,t),a=o.length;while(a--)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}function ge(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}n=oe.support={},o=oe.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return!!t&&"HTML"!==t.nodeName},p=oe.setDocument=function(e){var t,i,a=e?e.ownerDocument||e:w;return a!==d&&9===a.nodeType&&a.documentElement?(d=a,h=d.documentElement,g=!o(d),w!==d&&(i=d.defaultView)&&i.top!==i&&(i.addEventListener?i.addEventListener("unload",re,!1):i.attachEvent&&i.attachEvent("onunload",re)),n.attributes=ue(function(e){return e.className="i",!e.getAttribute("className")}),n.getElementsByTagName=ue(function(e){return e.appendChild(d.createComment("")),!e.getElementsByTagName("*").length}),n.getElementsByClassName=Q.test(d.getElementsByClassName),n.getById=ue(function(e){return h.appendChild(e).id=b,!d.getElementsByName||!d.getElementsByName(b).length}),n.getById?(r.filter.ID=function(e){var t=e.replace(Z,ee);return function(e){return e.getAttribute("id")===t}},r.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&g){var n=t.getElementById(e);return n?[n]:[]}}):(r.filter.ID=function(e){var t=e.replace(Z,ee);return function(e){var n="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return n&&n.value===t}},r.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&g){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),r.find.TAG=n.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):n.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},r.find.CLASS=n.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&g)return t.getElementsByClassName(e)},v=[],y=[],(n.qsa=Q.test(d.querySelectorAll))&&(ue(function(e){h.appendChild(e).innerHTML="<a id='"+b+"'></a><select id='"+b+"-\r\\' msallowcapture=''><option selected=''></option></select>",e.querySelectorAll("[msallowcapture^='']").length&&y.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||y.push("\\["+M+"*(?:value|"+P+")"),e.querySelectorAll("[id~="+b+"-]").length||y.push("~="),e.querySelectorAll(":checked").length||y.push(":checked"),e.querySelectorAll("a#"+b+"+*").length||y.push(".#.+[+~]")}),ue(function(e){e.innerHTML="<a href='' disabled='disabled'></a><select disabled='disabled'><option/></select>";var t=d.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&y.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&y.push(":enabled",":disabled"),h.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&y.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),y.push(",.*:")})),(n.matchesSelector=Q.test(m=h.matches||h.webkitMatchesSelector||h.mozMatchesSelector||h.oMatchesSelector||h.msMatchesSelector))&&ue(function(e){n.disconnectedMatch=m.call(e,"*"),m.call(e,"[s!='']:x"),v.push("!=",W)}),y=y.length&&new RegExp(y.join("|")),v=v.length&&new RegExp(v.join("|")),t=Q.test(h.compareDocumentPosition),x=t||Q.test(h.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},D=t?function(e,t){if(e===t)return f=!0,0;var r=!e.compareDocumentPosition-!t.compareDocumentPosition;return r||(1&(r=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!n.sortDetached&&t.compareDocumentPosition(e)===r?e===d||e.ownerDocument===w&&x(w,e)?-1:t===d||t.ownerDocument===w&&x(w,t)?1:c?O(c,e)-O(c,t):0:4&r?-1:1)}:function(e,t){if(e===t)return f=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e===d?-1:t===d?1:i?-1:o?1:c?O(c,e)-O(c,t):0;if(i===o)return ce(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?ce(a[r],s[r]):a[r]===w?-1:s[r]===w?1:0},d):d},oe.matches=function(e,t){return oe(e,null,null,t)},oe.matchesSelector=function(e,t){if((e.ownerDocument||e)!==d&&p(e),t=t.replace(z,"='$1']"),n.matchesSelector&&g&&!S[t+" "]&&(!v||!v.test(t))&&(!y||!y.test(t)))try{var r=m.call(e,t);if(r||n.disconnectedMatch||e.document&&11!==e.document.nodeType)return r}catch(e){}return oe(t,d,null,[e]).length>0},oe.contains=function(e,t){return(e.ownerDocument||e)!==d&&p(e),x(e,t)},oe.attr=function(e,t){(e.ownerDocument||e)!==d&&p(e);var i=r.attrHandle[t.toLowerCase()],o=i&&N.call(r.attrHandle,t.toLowerCase())?i(e,t,!g):void 0;return void 0!==o?o:n.attributes||!g?e.getAttribute(t):(o=e.getAttributeNode(t))&&o.specified?o.value:null},oe.escape=function(e){return(e+"").replace(te,ne)},oe.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},oe.uniqueSort=function(e){var t,r=[],i=0,o=0;if(f=!n.detectDuplicates,c=!n.sortStable&&e.slice(0),e.sort(D),f){while(t=e[o++])t===e[o]&&(i=r.push(o));while(i--)e.splice(r[i],1)}return c=null,e},i=oe.getText=function(e){var t,n="",r=0,o=e.nodeType;if(o){if(1===o||9===o||11===o){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=i(e)}else if(3===o||4===o)return e.nodeValue}else while(t=e[r++])n+=i(t);return n},(r=oe.selectors={cacheLength:50,createPseudo:se,match:V,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(Z,ee),e[3]=(e[3]||e[4]||e[5]||"").replace(Z,ee),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||oe.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&oe.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return V.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=a(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(Z,ee).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=E[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&E(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=oe.attr(r,e);return null==i?"!="===t:!t||(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i.replace($," ")+" ").indexOf(n)>-1:"|="===t&&(i===n||i.slice(0,n.length+1)===n+"-"))}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,u){var l,c,f,p,d,h,g=o!==a?"nextSibling":"previousSibling",y=t.parentNode,v=s&&t.nodeName.toLowerCase(),m=!u&&!s,x=!1;if(y){if(o){while(g){p=t;while(p=p[g])if(s?p.nodeName.toLowerCase()===v:1===p.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?y.firstChild:y.lastChild],a&&m){x=(d=(l=(c=(f=(p=y)[b]||(p[b]={}))[p.uniqueID]||(f[p.uniqueID]={}))[e]||[])[0]===T&&l[1])&&l[2],p=d&&y.childNodes[d];while(p=++d&&p&&p[g]||(x=d=0)||h.pop())if(1===p.nodeType&&++x&&p===t){c[e]=[T,d,x];break}}else if(m&&(x=d=(l=(c=(f=(p=t)[b]||(p[b]={}))[p.uniqueID]||(f[p.uniqueID]={}))[e]||[])[0]===T&&l[1]),!1===x)while(p=++d&&p&&p[g]||(x=d=0)||h.pop())if((s?p.nodeName.toLowerCase()===v:1===p.nodeType)&&++x&&(m&&((c=(f=p[b]||(p[b]={}))[p.uniqueID]||(f[p.uniqueID]={}))[e]=[T,x]),p===t))break;return(x-=i)===r||x%r==0&&x/r>=0}}},PSEUDO:function(e,t){var n,i=r.pseudos[e]||r.setFilters[e.toLowerCase()]||oe.error("unsupported pseudo: "+e);return i[b]?i(t):i.length>1?(n=[e,e,"",t],r.setFilters.hasOwnProperty(e.toLowerCase())?se(function(e,n){var r,o=i(e,t),a=o.length;while(a--)e[r=O(e,o[a])]=!(n[r]=o[a])}):function(e){return i(e,0,n)}):i}},pseudos:{not:se(function(e){var t=[],n=[],r=s(e.replace(B,"$1"));return r[b]?se(function(e,t,n,i){var o,a=r(e,null,i,[]),s=e.length;while(s--)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),t[0]=null,!n.pop()}}),has:se(function(e){return function(t){return oe(e,t).length>0}}),contains:se(function(e){return e=e.replace(Z,ee),function(t){return(t.textContent||t.innerText||i(t)).indexOf(e)>-1}}),lang:se(function(e){return U.test(e||"")||oe.error("unsupported lang: "+e),e=e.replace(Z,ee).toLowerCase(),function(t){var n;do{if(n=g?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return(n=n.toLowerCase())===e||0===n.indexOf(e+"-")}while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===h},focus:function(e){return e===d.activeElement&&(!d.hasFocus||d.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:de(!1),disabled:de(!0),checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!r.pseudos.empty(e)},header:function(e){return Y.test(e.nodeName)},input:function(e){return G.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:he(function(){return[0]}),last:he(function(e,t){return[t-1]}),eq:he(function(e,t,n){return[n<0?n+t:n]}),even:he(function(e,t){for(var n=0;n<t;n+=2)e.push(n);return e}),odd:he(function(e,t){for(var n=1;n<t;n+=2)e.push(n);return e}),lt:he(function(e,t,n){for(var r=n<0?n+t:n;--r>=0;)e.push(r);return e}),gt:he(function(e,t,n){for(var r=n<0?n+t:n;++r<t;)e.push(r);return e})}}).pseudos.nth=r.pseudos.eq;for(t in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})r.pseudos[t]=fe(t);for(t in{submit:!0,reset:!0})r.pseudos[t]=pe(t);function ye(){}ye.prototype=r.filters=r.pseudos,r.setFilters=new ye,a=oe.tokenize=function(e,t){var n,i,o,a,s,u,l,c=k[e+" "];if(c)return t?0:c.slice(0);s=e,u=[],l=r.preFilter;while(s){n&&!(i=F.exec(s))||(i&&(s=s.slice(i[0].length)||s),u.push(o=[])),n=!1,(i=_.exec(s))&&(n=i.shift(),o.push({value:n,type:i[0].replace(B," ")}),s=s.slice(n.length));for(a in r.filter)!(i=V[a].exec(s))||l[a]&&!(i=l[a](i))||(n=i.shift(),o.push({value:n,type:a,matches:i}),s=s.slice(n.length));if(!n)break}return t?s.length:s?oe.error(e):k(e,u).slice(0)};function ve(e){for(var t=0,n=e.length,r="";t<n;t++)r+=e[t].value;return r}function me(e,t,n){var r=t.dir,i=t.next,o=i||r,a=n&&"parentNode"===o,s=C++;return t.first?function(t,n,i){while(t=t[r])if(1===t.nodeType||a)return e(t,n,i);return!1}:function(t,n,u){var l,c,f,p=[T,s];if(u){while(t=t[r])if((1===t.nodeType||a)&&e(t,n,u))return!0}else while(t=t[r])if(1===t.nodeType||a)if(f=t[b]||(t[b]={}),c=f[t.uniqueID]||(f[t.uniqueID]={}),i&&i===t.nodeName.toLowerCase())t=t[r]||t;else{if((l=c[o])&&l[0]===T&&l[1]===s)return p[2]=l[2];if(c[o]=p,p[2]=e(t,n,u))return!0}return!1}}function xe(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function be(e,t,n){for(var r=0,i=t.length;r<i;r++)oe(e,t[r],n);return n}function we(e,t,n,r,i){for(var o,a=[],s=0,u=e.length,l=null!=t;s<u;s++)(o=e[s])&&(n&&!n(o,r,i)||(a.push(o),l&&t.push(s)));return a}function Te(e,t,n,r,i,o){return r&&!r[b]&&(r=Te(r)),i&&!i[b]&&(i=Te(i,o)),se(function(o,a,s,u){var l,c,f,p=[],d=[],h=a.length,g=o||be(t||"*",s.nodeType?[s]:s,[]),y=!e||!o&&t?g:we(g,p,e,s,u),v=n?i||(o?e:h||r)?[]:a:y;if(n&&n(y,v,s,u),r){l=we(v,d),r(l,[],s,u),c=l.length;while(c--)(f=l[c])&&(v[d[c]]=!(y[d[c]]=f))}if(o){if(i||e){if(i){l=[],c=v.length;while(c--)(f=v[c])&&l.push(y[c]=f);i(null,v=[],l,u)}c=v.length;while(c--)(f=v[c])&&(l=i?O(o,f):p[c])>-1&&(o[l]=!(a[l]=f))}}else v=we(v===a?v.splice(h,v.length):v),i?i(null,a,v,u):L.apply(a,v)})}function Ce(e){for(var t,n,i,o=e.length,a=r.relative[e[0].type],s=a||r.relative[" "],u=a?1:0,c=me(function(e){return e===t},s,!0),f=me(function(e){return O(t,e)>-1},s,!0),p=[function(e,n,r){var i=!a&&(r||n!==l)||((t=n).nodeType?c(e,n,r):f(e,n,r));return t=null,i}];u<o;u++)if(n=r.relative[e[u].type])p=[me(xe(p),n)];else{if((n=r.filter[e[u].type].apply(null,e[u].matches))[b]){for(i=++u;i<o;i++)if(r.relative[e[i].type])break;return Te(u>1&&xe(p),u>1&&ve(e.slice(0,u-1).concat({value:" "===e[u-2].type?"*":""})).replace(B,"$1"),n,u<i&&Ce(e.slice(u,i)),i<o&&Ce(e=e.slice(i)),i<o&&ve(e))}p.push(n)}return xe(p)}function Ee(e,t){var n=t.length>0,i=e.length>0,o=function(o,a,s,u,c){var f,h,y,v=0,m="0",x=o&&[],b=[],w=l,C=o||i&&r.find.TAG("*",c),E=T+=null==w?1:Math.random()||.1,k=C.length;for(c&&(l=a===d||a||c);m!==k&&null!=(f=C[m]);m++){if(i&&f){h=0,a||f.ownerDocument===d||(p(f),s=!g);while(y=e[h++])if(y(f,a||d,s)){u.push(f);break}c&&(T=E)}n&&((f=!y&&f)&&v--,o&&x.push(f))}if(v+=m,n&&m!==v){h=0;while(y=t[h++])y(x,b,a,s);if(o){if(v>0)while(m--)x[m]||b[m]||(b[m]=j.call(u));b=we(b)}L.apply(u,b),c&&!o&&b.length>0&&v+t.length>1&&oe.uniqueSort(u)}return c&&(T=E,l=w),x};return n?se(o):o}return s=oe.compile=function(e,t){var n,r=[],i=[],o=S[e+" "];if(!o){t||(t=a(e)),n=t.length;while(n--)(o=Ce(t[n]))[b]?r.push(o):i.push(o);(o=S(e,Ee(i,r))).selector=e}return o},u=oe.select=function(e,t,n,i){var o,u,l,c,f,p="function"==typeof e&&e,d=!i&&a(e=p.selector||e);if(n=n||[],1===d.length){if((u=d[0]=d[0].slice(0)).length>2&&"ID"===(l=u[0]).type&&9===t.nodeType&&g&&r.relative[u[1].type]){if(!(t=(r.find.ID(l.matches[0].replace(Z,ee),t)||[])[0]))return n;p&&(t=t.parentNode),e=e.slice(u.shift().value.length)}o=V.needsContext.test(e)?0:u.length;while(o--){if(l=u[o],r.relative[c=l.type])break;if((f=r.find[c])&&(i=f(l.matches[0].replace(Z,ee),K.test(u[0].type)&&ge(t.parentNode)||t))){if(u.splice(o,1),!(e=i.length&&ve(u)))return L.apply(n,i),n;break}}}return(p||s(e,d))(i,t,!g,n,!t||K.test(e)&&ge(t.parentNode)||t),n},n.sortStable=b.split("").sort(D).join("")===b,n.detectDuplicates=!!f,p(),n.sortDetached=ue(function(e){return 1&e.compareDocumentPosition(d.createElement("fieldset"))}),ue(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||le("type|href|height|width",function(e,t,n){if(!n)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),n.attributes&&ue(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||le("value",function(e,t,n){if(!n&&"input"===e.nodeName.toLowerCase())return e.defaultValue}),ue(function(e){return null==e.getAttribute("disabled")})||le(P,function(e,t,n){var r;if(!n)return!0===e[t]?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null}),oe}(e);w.find=E,w.expr=E.selectors,w.expr[":"]=w.expr.pseudos,w.uniqueSort=w.unique=E.uniqueSort,w.text=E.getText,w.isXMLDoc=E.isXML,w.contains=E.contains,w.escapeSelector=E.escape;var k=function(e,t,n){var r=[],i=void 0!==n;while((e=e[t])&&9!==e.nodeType)if(1===e.nodeType){if(i&&w(e).is(n))break;r.push(e)}return r},S=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},D=w.expr.match.needsContext;function N(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()}var A=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function j(e,t,n){return g(t)?w.grep(e,function(e,r){return!!t.call(e,r,e)!==n}):t.nodeType?w.grep(e,function(e){return e===t!==n}):"string"!=typeof t?w.grep(e,function(e){return u.call(t,e)>-1!==n}):w.filter(t,e,n)}w.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?w.find.matchesSelector(r,e)?[r]:[]:w.find.matches(e,w.grep(t,function(e){return 1===e.nodeType}))},w.fn.extend({find:function(e){var t,n,r=this.length,i=this;if("string"!=typeof e)return this.pushStack(w(e).filter(function(){for(t=0;t<r;t++)if(w.contains(i[t],this))return!0}));for(n=this.pushStack([]),t=0;t<r;t++)w.find(e,i[t],n);return r>1?w.uniqueSort(n):n},filter:function(e){return this.pushStack(j(this,e||[],!1))},not:function(e){return this.pushStack(j(this,e||[],!0))},is:function(e){return!!j(this,"string"==typeof e&&D.test(e)?w(e):e||[],!1).length}});var q,L=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;(w.fn.init=function(e,t,n){var i,o;if(!e)return this;if(n=n||q,"string"==typeof e){if(!(i="<"===e[0]&&">"===e[e.length-1]&&e.length>=3?[null,e,null]:L.exec(e))||!i[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(i[1]){if(t=t instanceof w?t[0]:t,w.merge(this,w.parseHTML(i[1],t&&t.nodeType?t.ownerDocument||t:r,!0)),A.test(i[1])&&w.isPlainObject(t))for(i in t)g(this[i])?this[i](t[i]):this.attr(i,t[i]);return this}return(o=r.getElementById(i[2]))&&(this[0]=o,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):g(e)?void 0!==n.ready?n.ready(e):e(w):w.makeArray(e,this)}).prototype=w.fn,q=w(r);var H=/^(?:parents|prev(?:Until|All))/,O={children:!0,contents:!0,next:!0,prev:!0};w.fn.extend({has:function(e){var t=w(e,this),n=t.length;return this.filter(function(){for(var e=0;e<n;e++)if(w.contains(this,t[e]))return!0})},closest:function(e,t){var n,r=0,i=this.length,o=[],a="string"!=typeof e&&w(e);if(!D.test(e))for(;r<i;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(n.nodeType<11&&(a?a.index(n)>-1:1===n.nodeType&&w.find.matchesSelector(n,e))){o.push(n);break}return this.pushStack(o.length>1?w.uniqueSort(o):o)},index:function(e){return e?"string"==typeof e?u.call(w(e),this[0]):u.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(w.uniqueSort(w.merge(this.get(),w(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}});function P(e,t){while((e=e[t])&&1!==e.nodeType);return e}w.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return k(e,"parentNode")},parentsUntil:function(e,t,n){return k(e,"parentNode",n)},next:function(e){return P(e,"nextSibling")},prev:function(e){return P(e,"previousSibling")},nextAll:function(e){return k(e,"nextSibling")},prevAll:function(e){return k(e,"previousSibling")},nextUntil:function(e,t,n){return k(e,"nextSibling",n)},prevUntil:function(e,t,n){return k(e,"previousSibling",n)},siblings:function(e){return S((e.parentNode||{}).firstChild,e)},children:function(e){return S(e.firstChild)},contents:function(e){return N(e,"iframe")?e.contentDocument:(N(e,"template")&&(e=e.content||e),w.merge([],e.childNodes))}},function(e,t){w.fn[e]=function(n,r){var i=w.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=w.filter(r,i)),this.length>1&&(O[e]||w.uniqueSort(i),H.test(e)&&i.reverse()),this.pushStack(i)}});var M=/[^\x20\t\r\n\f]+/g;function R(e){var t={};return w.each(e.match(M)||[],function(e,n){t[n]=!0}),t}w.Callbacks=function(e){e="string"==typeof e?R(e):w.extend({},e);var t,n,r,i,o=[],a=[],s=-1,u=function(){for(i=i||e.once,r=t=!0;a.length;s=-1){n=a.shift();while(++s<o.length)!1===o[s].apply(n[0],n[1])&&e.stopOnFalse&&(s=o.length,n=!1)}e.memory||(n=!1),t=!1,i&&(o=n?[]:"")},l={add:function(){return o&&(n&&!t&&(s=o.length-1,a.push(n)),function t(n){w.each(n,function(n,r){g(r)?e.unique&&l.has(r)||o.push(r):r&&r.length&&"string"!==x(r)&&t(r)})}(arguments),n&&!t&&u()),this},remove:function(){return w.each(arguments,function(e,t){var n;while((n=w.inArray(t,o,n))>-1)o.splice(n,1),n<=s&&s--}),this},has:function(e){return e?w.inArray(e,o)>-1:o.length>0},empty:function(){return o&&(o=[]),this},disable:function(){return i=a=[],o=n="",this},disabled:function(){return!o},lock:function(){return i=a=[],n||t||(o=n=""),this},locked:function(){return!!i},fireWith:function(e,n){return i||(n=[e,(n=n||[]).slice?n.slice():n],a.push(n),t||u()),this},fire:function(){return l.fireWith(this,arguments),this},fired:function(){return!!r}};return l};function I(e){return e}function W(e){throw e}function $(e,t,n,r){var i;try{e&&g(i=e.promise)?i.call(e).done(t).fail(n):e&&g(i=e.then)?i.call(e,t,n):t.apply(void 0,[e].slice(r))}catch(e){n.apply(void 0,[e])}}w.extend({Deferred:function(t){var n=[["notify","progress",w.Callbacks("memory"),w.Callbacks("memory"),2],["resolve","done",w.Callbacks("once memory"),w.Callbacks("once memory"),0,"resolved"],["reject","fail",w.Callbacks("once memory"),w.Callbacks("once memory"),1,"rejected"]],r="pending",i={state:function(){return r},always:function(){return o.done(arguments).fail(arguments),this},"catch":function(e){return i.then(null,e)},pipe:function(){var e=arguments;return w.Deferred(function(t){w.each(n,function(n,r){var i=g(e[r[4]])&&e[r[4]];o[r[1]](function(){var e=i&&i.apply(this,arguments);e&&g(e.promise)?e.promise().progress(t.notify).done(t.resolve).fail(t.reject):t[r[0]+"With"](this,i?[e]:arguments)})}),e=null}).promise()},then:function(t,r,i){var o=0;function a(t,n,r,i){return function(){var s=this,u=arguments,l=function(){var e,l;if(!(t<o)){if((e=r.apply(s,u))===n.promise())throw new TypeError("Thenable self-resolution");l=e&&("object"==typeof e||"function"==typeof e)&&e.then,g(l)?i?l.call(e,a(o,n,I,i),a(o,n,W,i)):(o++,l.call(e,a(o,n,I,i),a(o,n,W,i),a(o,n,I,n.notifyWith))):(r!==I&&(s=void 0,u=[e]),(i||n.resolveWith)(s,u))}},c=i?l:function(){try{l()}catch(e){w.Deferred.exceptionHook&&w.Deferred.exceptionHook(e,c.stackTrace),t+1>=o&&(r!==W&&(s=void 0,u=[e]),n.rejectWith(s,u))}};t?c():(w.Deferred.getStackHook&&(c.stackTrace=w.Deferred.getStackHook()),e.setTimeout(c))}}return w.Deferred(function(e){n[0][3].add(a(0,e,g(i)?i:I,e.notifyWith)),n[1][3].add(a(0,e,g(t)?t:I)),n[2][3].add(a(0,e,g(r)?r:W))}).promise()},promise:function(e){return null!=e?w.extend(e,i):i}},o={};return w.each(n,function(e,t){var a=t[2],s=t[5];i[t[1]]=a.add,s&&a.add(function(){r=s},n[3-e][2].disable,n[3-e][3].disable,n[0][2].lock,n[0][3].lock),a.add(t[3].fire),o[t[0]]=function(){return o[t[0]+"With"](this===o?void 0:this,arguments),this},o[t[0]+"With"]=a.fireWith}),i.promise(o),t&&t.call(o,o),o},when:function(e){var t=arguments.length,n=t,r=Array(n),i=o.call(arguments),a=w.Deferred(),s=function(e){return function(n){r[e]=this,i[e]=arguments.length>1?o.call(arguments):n,--t||a.resolveWith(r,i)}};if(t<=1&&($(e,a.done(s(n)).resolve,a.reject,!t),"pending"===a.state()||g(i[n]&&i[n].then)))return a.then();while(n--)$(i[n],s(n),a.reject);return a.promise()}});var B=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;w.Deferred.exceptionHook=function(t,n){e.console&&e.console.warn&&t&&B.test(t.name)&&e.console.warn("jQuery.Deferred exception: "+t.message,t.stack,n)},w.readyException=function(t){e.setTimeout(function(){throw t})};var F=w.Deferred();w.fn.ready=function(e){return F.then(e)["catch"](function(e){w.readyException(e)}),this},w.extend({isReady:!1,readyWait:1,ready:function(e){(!0===e?--w.readyWait:w.isReady)||(w.isReady=!0,!0!==e&&--w.readyWait>0||F.resolveWith(r,[w]))}}),w.ready.then=F.then;function _(){r.removeEventListener("DOMContentLoaded",_),e.removeEventListener("load",_),w.ready()}"complete"===r.readyState||"loading"!==r.readyState&&!r.documentElement.doScroll?e.setTimeout(w.ready):(r.addEventListener("DOMContentLoaded",_),e.addEventListener("load",_));var z=function(e,t,n,r,i,o,a){var s=0,u=e.length,l=null==n;if("object"===x(n)){i=!0;for(s in n)z(e,t,s,n[s],!0,o,a)}else if(void 0!==r&&(i=!0,g(r)||(a=!0),l&&(a?(t.call(e,r),t=null):(l=t,t=function(e,t,n){return l.call(w(e),n)})),t))for(;s<u;s++)t(e[s],n,a?r:r.call(e[s],s,t(e[s],n)));return i?e:l?t.call(e):u?t(e[0],n):o},X=/^-ms-/,U=/-([a-z])/g;function V(e,t){return t.toUpperCase()}function G(e){return e.replace(X,"ms-").replace(U,V)}var Y=function(e){return 1===e.nodeType||9===e.nodeType||!+e.nodeType};function Q(){this.expando=w.expando+Q.uid++}Q.uid=1,Q.prototype={cache:function(e){var t=e[this.expando];return t||(t={},Y(e)&&(e.nodeType?e[this.expando]=t:Object.defineProperty(e,this.expando,{value:t,configurable:!0}))),t},set:function(e,t,n){var r,i=this.cache(e);if("string"==typeof t)i[G(t)]=n;else for(r in t)i[G(r)]=t[r];return i},get:function(e,t){return void 0===t?this.cache(e):e[this.expando]&&e[this.expando][G(t)]},access:function(e,t,n){return void 0===t||t&&"string"==typeof t&&void 0===n?this.get(e,t):(this.set(e,t,n),void 0!==n?n:t)},remove:function(e,t){var n,r=e[this.expando];if(void 0!==r){if(void 0!==t){n=(t=Array.isArray(t)?t.map(G):(t=G(t))in r?[t]:t.match(M)||[]).length;while(n--)delete r[t[n]]}(void 0===t||w.isEmptyObject(r))&&(e.nodeType?e[this.expando]=void 0:delete e[this.expando])}},hasData:function(e){var t=e[this.expando];return void 0!==t&&!w.isEmptyObject(t)}};var J=new Q,K=new Q,Z=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,ee=/[A-Z]/g;function te(e){return"true"===e||"false"!==e&&("null"===e?null:e===+e+""?+e:Z.test(e)?JSON.parse(e):e)}function ne(e,t,n){var r;if(void 0===n&&1===e.nodeType)if(r="data-"+t.replace(ee,"-$&").toLowerCase(),"string"==typeof(n=e.getAttribute(r))){try{n=te(n)}catch(e){}K.set(e,t,n)}else n=void 0;return n}w.extend({hasData:function(e){return K.hasData(e)||J.hasData(e)},data:function(e,t,n){return K.access(e,t,n)},removeData:function(e,t){K.remove(e,t)},_data:function(e,t,n){return J.access(e,t,n)},_removeData:function(e,t){J.remove(e,t)}}),w.fn.extend({data:function(e,t){var n,r,i,o=this[0],a=o&&o.attributes;if(void 0===e){if(this.length&&(i=K.get(o),1===o.nodeType&&!J.get(o,"hasDataAttrs"))){n=a.length;while(n--)a[n]&&0===(r=a[n].name).indexOf("data-")&&(r=G(r.slice(5)),ne(o,r,i[r]));J.set(o,"hasDataAttrs",!0)}return i}return"object"==typeof e?this.each(function(){K.set(this,e)}):z(this,function(t){var n;if(o&&void 0===t){if(void 0!==(n=K.get(o,e)))return n;if(void 0!==(n=ne(o,e)))return n}else this.each(function(){K.set(this,e,t)})},null,t,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){K.remove(this,e)})}}),w.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=J.get(e,t),n&&(!r||Array.isArray(n)?r=J.access(e,t,w.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=w.queue(e,t),r=n.length,i=n.shift(),o=w._queueHooks(e,t),a=function(){w.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return J.get(e,n)||J.access(e,n,{empty:w.Callbacks("once memory").add(function(){J.remove(e,[t+"queue",n])})})}}),w.fn.extend({queue:function(e,t){var n=2;return"string"!=typeof e&&(t=e,e="fx",n--),arguments.length<n?w.queue(this[0],e):void 0===t?this:this.each(function(){var n=w.queue(this,e,t);w._queueHooks(this,e),"fx"===e&&"inprogress"!==n[0]&&w.dequeue(this,e)})},dequeue:function(e){return this.each(function(){w.dequeue(this,e)})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,t){var n,r=1,i=w.Deferred(),o=this,a=this.length,s=function(){--r||i.resolveWith(o,[o])};"string"!=typeof e&&(t=e,e=void 0),e=e||"fx";while(a--)(n=J.get(o[a],e+"queueHooks"))&&n.empty&&(r++,n.empty.add(s));return s(),i.promise(t)}});var re=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,ie=new RegExp("^(?:([+-])=|)("+re+")([a-z%]*)$","i"),oe=["Top","Right","Bottom","Left"],ae=function(e,t){return"none"===(e=t||e).style.display||""===e.style.display&&w.contains(e.ownerDocument,e)&&"none"===w.css(e,"display")},se=function(e,t,n,r){var i,o,a={};for(o in t)a[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=a[o];return i};function ue(e,t,n,r){var i,o,a=20,s=r?function(){return r.cur()}:function(){return w.css(e,t,"")},u=s(),l=n&&n[3]||(w.cssNumber[t]?"":"px"),c=(w.cssNumber[t]||"px"!==l&&+u)&&ie.exec(w.css(e,t));if(c&&c[3]!==l){u/=2,l=l||c[3],c=+u||1;while(a--)w.style(e,t,c+l),(1-o)*(1-(o=s()/u||.5))<=0&&(a=0),c/=o;c*=2,w.style(e,t,c+l),n=n||[]}return n&&(c=+c||+u||0,i=n[1]?c+(n[1]+1)*n[2]:+n[2],r&&(r.unit=l,r.start=c,r.end=i)),i}var le={};function ce(e){var t,n=e.ownerDocument,r=e.nodeName,i=le[r];return i||(t=n.body.appendChild(n.createElement(r)),i=w.css(t,"display"),t.parentNode.removeChild(t),"none"===i&&(i="block"),le[r]=i,i)}function fe(e,t){for(var n,r,i=[],o=0,a=e.length;o<a;o++)(r=e[o]).style&&(n=r.style.display,t?("none"===n&&(i[o]=J.get(r,"display")||null,i[o]||(r.style.display="")),""===r.style.display&&ae(r)&&(i[o]=ce(r))):"none"!==n&&(i[o]="none",J.set(r,"display",n)));for(o=0;o<a;o++)null!=i[o]&&(e[o].style.display=i[o]);return e}w.fn.extend({show:function(){return fe(this,!0)},hide:function(){return fe(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){ae(this)?w(this).show():w(this).hide()})}});var pe=/^(?:checkbox|radio)$/i,de=/<([a-z][^\/\0>\x20\t\r\n\f]+)/i,he=/^$|^module$|\/(?:java|ecma)script/i,ge={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};ge.optgroup=ge.option,ge.tbody=ge.tfoot=ge.colgroup=ge.caption=ge.thead,ge.th=ge.td;function ye(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&N(e,t)?w.merge([e],n):n}function ve(e,t){for(var n=0,r=e.length;n<r;n++)J.set(e[n],"globalEval",!t||J.get(t[n],"globalEval"))}var me=/<|&#?\w+;/;function xe(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d<h;d++)if((o=e[d])||0===o)if("object"===x(o))w.merge(p,o.nodeType?[o]:o);else if(me.test(o)){a=a||f.appendChild(t.createElement("div")),s=(de.exec(o)||["",""])[1].toLowerCase(),u=ge[s]||ge._default,a.innerHTML=u[1]+w.htmlPrefilter(o)+u[2],c=u[0];while(c--)a=a.lastChild;w.merge(p,a.childNodes),(a=f.firstChild).textContent=""}else p.push(t.createTextNode(o));f.textContent="",d=0;while(o=p[d++])if(r&&w.inArray(o,r)>-1)i&&i.push(o);else if(l=w.contains(o.ownerDocument,o),a=ye(f.appendChild(o),"script"),l&&ve(a),n){c=0;while(o=a[c++])he.test(o.type||"")&&n.push(o)}return f}!function(){var e=r.createDocumentFragment().appendChild(r.createElement("div")),t=r.createElement("input");t.setAttribute("type","radio"),t.setAttribute("checked","checked"),t.setAttribute("name","t"),e.appendChild(t),h.checkClone=e.cloneNode(!0).cloneNode(!0).lastChild.checked,e.innerHTML="<textarea>x</textarea>",h.noCloneChecked=!!e.cloneNode(!0).lastChild.defaultValue}();var be=r.documentElement,we=/^key/,Te=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Ce=/^([^.]*)(?:\.(.+)|)/;function Ee(){return!0}function ke(){return!1}function Se(){try{return r.activeElement}catch(e){}}function De(e,t,n,r,i,o){var a,s;if("object"==typeof t){"string"!=typeof n&&(r=r||n,n=void 0);for(s in t)De(e,s,n,r,t[s],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),!1===i)i=ke;else if(!i)return e;return 1===o&&(a=i,(i=function(e){return w().off(e),a.apply(this,arguments)}).guid=a.guid||(a.guid=w.guid++)),e.each(function(){w.event.add(this,t,i,r,n)})}w.event={global:{},add:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,y=J.get(e);if(y){n.handler&&(n=(o=n).handler,i=o.selector),i&&w.find.matchesSelector(be,i),n.guid||(n.guid=w.guid++),(u=y.events)||(u=y.events={}),(a=y.handle)||(a=y.handle=function(t){return"undefined"!=typeof w&&w.event.triggered!==t.type?w.event.dispatch.apply(e,arguments):void 0}),l=(t=(t||"").match(M)||[""]).length;while(l--)d=g=(s=Ce.exec(t[l])||[])[1],h=(s[2]||"").split(".").sort(),d&&(f=w.event.special[d]||{},d=(i?f.delegateType:f.bindType)||d,f=w.event.special[d]||{},c=w.extend({type:d,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&w.expr.match.needsContext.test(i),namespace:h.join(".")},o),(p=u[d])||((p=u[d]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(e,r,h,a)||e.addEventListener&&e.addEventListener(d,a)),f.add&&(f.add.call(e,c),c.handler.guid||(c.handler.guid=n.guid)),i?p.splice(p.delegateCount++,0,c):p.push(c),w.event.global[d]=!0)}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,y=J.hasData(e)&&J.get(e);if(y&&(u=y.events)){l=(t=(t||"").match(M)||[""]).length;while(l--)if(s=Ce.exec(t[l])||[],d=g=s[1],h=(s[2]||"").split(".").sort(),d){f=w.event.special[d]||{},p=u[d=(r?f.delegateType:f.bindType)||d]||[],s=s[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=p.length;while(o--)c=p[o],!i&&g!==c.origType||n&&n.guid!==c.guid||s&&!s.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,f.remove&&f.remove.call(e,c));a&&!p.length&&(f.teardown&&!1!==f.teardown.call(e,h,y.handle)||w.removeEvent(e,d,y.handle),delete u[d])}else for(d in u)w.event.remove(e,d+t[l],n,r,!0);w.isEmptyObject(u)&&J.remove(e,"handle events")}},dispatch:function(e){var t=w.event.fix(e),n,r,i,o,a,s,u=new Array(arguments.length),l=(J.get(this,"events")||{})[t.type]||[],c=w.event.special[t.type]||{};for(u[0]=t,n=1;n<arguments.length;n++)u[n]=arguments[n];if(t.delegateTarget=this,!c.preDispatch||!1!==c.preDispatch.call(this,t)){s=w.event.handlers.call(this,t,l),n=0;while((o=s[n++])&&!t.isPropagationStopped()){t.currentTarget=o.elem,r=0;while((a=o.handlers[r++])&&!t.isImmediatePropagationStopped())t.rnamespace&&!t.rnamespace.test(a.namespace)||(t.handleObj=a,t.data=a.data,void 0!==(i=((w.event.special[a.origType]||{}).handle||a.handler).apply(o.elem,u))&&!1===(t.result=i)&&(t.preventDefault(),t.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,t),t.result}},handlers:function(e,t){var n,r,i,o,a,s=[],u=t.delegateCount,l=e.target;if(u&&l.nodeType&&!("click"===e.type&&e.button>=1))for(;l!==this;l=l.parentNode||this)if(1===l.nodeType&&("click"!==e.type||!0!==l.disabled)){for(o=[],a={},n=0;n<u;n++)void 0===a[i=(r=t[n]).selector+" "]&&(a[i]=r.needsContext?w(i,this).index(l)>-1:w.find(i,this,null,[l]).length),a[i]&&o.push(r);o.length&&s.push({elem:l,handlers:o})}return l=this,u<t.length&&s.push({elem:l,handlers:t.slice(u)}),s},addProp:function(e,t){Object.defineProperty(w.Event.prototype,e,{enumerable:!0,configurable:!0,get:g(t)?function(){if(this.originalEvent)return t(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[e]},set:function(t){Object.defineProperty(this,e,{enumerable:!0,configurable:!0,writable:!0,value:t})}})},fix:function(e){return e[w.expando]?e:new w.Event(e)},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==Se()&&this.focus)return this.focus(),!1},delegateType:"focusin"},blur:{trigger:function(){if(this===Se()&&this.blur)return this.blur(),!1},delegateType:"focusout"},click:{trigger:function(){if("checkbox"===this.type&&this.click&&N(this,"input"))return this.click(),!1},_default:function(e){return N(e.target,"a")}},beforeunload:{postDispatch:function(e){void 0!==e.result&&e.originalEvent&&(e.originalEvent.returnValue=e.result)}}}},w.removeEvent=function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n)},w.Event=function(e,t){if(!(this instanceof w.Event))return new w.Event(e,t);e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||void 0===e.defaultPrevented&&!1===e.returnValue?Ee:ke,this.target=e.target&&3===e.target.nodeType?e.target.parentNode:e.target,this.currentTarget=e.currentTarget,this.relatedTarget=e.relatedTarget):this.type=e,t&&w.extend(this,t),this.timeStamp=e&&e.timeStamp||Date.now(),this[w.expando]=!0},w.Event.prototype={constructor:w.Event,isDefaultPrevented:ke,isPropagationStopped:ke,isImmediatePropagationStopped:ke,isSimulated:!1,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=Ee,e&&!this.isSimulated&&e.preventDefault()},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=Ee,e&&!this.isSimulated&&e.stopPropagation()},stopImmediatePropagation:function(){var e=this.originalEvent;this.isImmediatePropagationStopped=Ee,e&&!this.isSimulated&&e.stopImmediatePropagation(),this.stopPropagation()}},w.each({altKey:!0,bubbles:!0,cancelable:!0,changedTouches:!0,ctrlKey:!0,detail:!0,eventPhase:!0,metaKey:!0,pageX:!0,pageY:!0,shiftKey:!0,view:!0,"char":!0,charCode:!0,key:!0,keyCode:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pointerId:!0,pointerType:!0,screenX:!0,screenY:!0,targetTouches:!0,toElement:!0,touches:!0,which:function(e){var t=e.button;return null==e.which&&we.test(e.type)?null!=e.charCode?e.charCode:e.keyCode:!e.which&&void 0!==t&&Te.test(e.type)?1&t?1:2&t?3:4&t?2:0:e.which}},w.event.addProp),w.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(e,t){w.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj;return i&&(i===r||w.contains(r,i))||(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),w.fn.extend({on:function(e,t,n,r){return De(this,e,t,n,r)},one:function(e,t,n,r){return De(this,e,t,n,r,1)},off:function(e,t,n){var r,i;if(e&&e.preventDefault&&e.handleObj)return r=e.handleObj,w(e.delegateTarget).off(r.namespace?r.origType+"."+r.namespace:r.origType,r.selector,r.handler),this;if("object"==typeof e){for(i in e)this.off(i,t,e[i]);return this}return!1!==t&&"function"!=typeof t||(n=t,t=void 0),!1===n&&(n=ke),this.each(function(){w.event.remove(this,e,n,t)})}});var Ne=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,Ae=/<script|<style|<link/i,je=/checked\s*(?:[^=]|=\s*.checked.)/i,qe=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;function Le(e,t){return N(e,"table")&&N(11!==t.nodeType?t:t.firstChild,"tr")?w(e).children("tbody")[0]||e:e}function He(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function Oe(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Pe(e,t){var n,r,i,o,a,s,u,l;if(1===t.nodeType){if(J.hasData(e)&&(o=J.access(e),a=J.set(t,o),l=o.events)){delete a.handle,a.events={};for(i in l)for(n=0,r=l[i].length;n<r;n++)w.event.add(t,i,l[i][n])}K.hasData(e)&&(s=K.access(e),u=w.extend({},s),K.set(t,u))}}function Me(e,t){var n=t.nodeName.toLowerCase();"input"===n&&pe.test(e.type)?t.checked=e.checked:"input"!==n&&"textarea"!==n||(t.defaultValue=e.defaultValue)}function Re(e,t,n,r){t=a.apply([],t);var i,o,s,u,l,c,f=0,p=e.length,d=p-1,y=t[0],v=g(y);if(v||p>1&&"string"==typeof y&&!h.checkClone&&je.test(y))return e.each(function(i){var o=e.eq(i);v&&(t[0]=y.call(this,i,o.html())),Re(o,t,n,r)});if(p&&(i=xe(t,e[0].ownerDocument,!1,e,r),o=i.firstChild,1===i.childNodes.length&&(i=o),o||r)){for(u=(s=w.map(ye(i,"script"),He)).length;f<p;f++)l=i,f!==d&&(l=w.clone(l,!0,!0),u&&w.merge(s,ye(l,"script"))),n.call(e[f],l,f);if(u)for(c=s[s.length-1].ownerDocument,w.map(s,Oe),f=0;f<u;f++)l=s[f],he.test(l.type||"")&&!J.access(l,"globalEval")&&w.contains(c,l)&&(l.src&&"module"!==(l.type||"").toLowerCase()?w._evalUrl&&w._evalUrl(l.src):m(l.textContent.replace(qe,""),c,l))}return e}function Ie(e,t,n){for(var r,i=t?w.filter(t,e):e,o=0;null!=(r=i[o]);o++)n||1!==r.nodeType||w.cleanData(ye(r)),r.parentNode&&(n&&w.contains(r.ownerDocument,r)&&ve(ye(r,"script")),r.parentNode.removeChild(r));return e}w.extend({htmlPrefilter:function(e){return e.replace(Ne,"<$1></$2>")},clone:function(e,t,n){var r,i,o,a,s=e.cloneNode(!0),u=w.contains(e.ownerDocument,e);if(!(h.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||w.isXMLDoc(e)))for(a=ye(s),r=0,i=(o=ye(e)).length;r<i;r++)Me(o[r],a[r]);if(t)if(n)for(o=o||ye(e),a=a||ye(s),r=0,i=o.length;r<i;r++)Pe(o[r],a[r]);else Pe(e,s);return(a=ye(s,"script")).length>0&&ve(a,!u&&ye(e,"script")),s},cleanData:function(e){for(var t,n,r,i=w.event.special,o=0;void 0!==(n=e[o]);o++)if(Y(n)){if(t=n[J.expando]){if(t.events)for(r in t.events)i[r]?w.event.remove(n,r):w.removeEvent(n,r,t.handle);n[J.expando]=void 0}n[K.expando]&&(n[K.expando]=void 0)}}}),w.fn.extend({detach:function(e){return Ie(this,e,!0)},remove:function(e){return Ie(this,e)},text:function(e){return z(this,function(e){return void 0===e?w.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)})},null,e,arguments.length)},append:function(){return Re(this,arguments,function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||Le(this,e).appendChild(e)})},prepend:function(){return Re(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Le(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return Re(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return Re(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(w.cleanData(ye(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return w.clone(this,e,t)})},html:function(e){return z(this,function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!Ae.test(e)&&!ge[(de.exec(e)||["",""])[1].toLowerCase()]){e=w.htmlPrefilter(e);try{for(;n<r;n++)1===(t=this[n]||{}).nodeType&&(w.cleanData(ye(t,!1)),t.innerHTML=e);t=0}catch(e){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=[];return Re(this,arguments,function(t){var n=this.parentNode;w.inArray(this,e)<0&&(w.cleanData(ye(this)),n&&n.replaceChild(t,this))},e)}}),w.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){w.fn[e]=function(e){for(var n,r=[],i=w(e),o=i.length-1,a=0;a<=o;a++)n=a===o?this:this.clone(!0),w(i[a])[t](n),s.apply(r,n.get());return this.pushStack(r)}});var We=new RegExp("^("+re+")(?!px)[a-z%]+$","i"),$e=function(t){var n=t.ownerDocument.defaultView;return n&&n.opener||(n=e),n.getComputedStyle(t)},Be=new RegExp(oe.join("|"),"i");!function(){function t(){if(c){l.style.cssText="position:absolute;left:-11111px;width:60px;margin-top:1px;padding:0;border:0",c.style.cssText="position:relative;display:block;box-sizing:border-box;overflow:scroll;margin:auto;border:1px;padding:1px;width:60%;top:1%",be.appendChild(l).appendChild(c);var t=e.getComputedStyle(c);i="1%"!==t.top,u=12===n(t.marginLeft),c.style.right="60%",s=36===n(t.right),o=36===n(t.width),c.style.position="absolute",a=36===c.offsetWidth||"absolute",be.removeChild(l),c=null}}function n(e){return Math.round(parseFloat(e))}var i,o,a,s,u,l=r.createElement("div"),c=r.createElement("div");c.style&&(c.style.backgroundClip="content-box",c.cloneNode(!0).style.backgroundClip="",h.clearCloneStyle="content-box"===c.style.backgroundClip,w.extend(h,{boxSizingReliable:function(){return t(),o},pixelBoxStyles:function(){return t(),s},pixelPosition:function(){return t(),i},reliableMarginLeft:function(){return t(),u},scrollboxSize:function(){return t(),a}}))}();function Fe(e,t,n){var r,i,o,a,s=e.style;return(n=n||$e(e))&&(""!==(a=n.getPropertyValue(t)||n[t])||w.contains(e.ownerDocument,e)||(a=w.style(e,t)),!h.pixelBoxStyles()&&We.test(a)&&Be.test(t)&&(r=s.width,i=s.minWidth,o=s.maxWidth,s.minWidth=s.maxWidth=s.width=a,a=n.width,s.width=r,s.minWidth=i,s.maxWidth=o)),void 0!==a?a+"":a}function _e(e,t){return{get:function(){if(!e())return(this.get=t).apply(this,arguments);delete this.get}}}var ze=/^(none|table(?!-c[ea]).+)/,Xe=/^--/,Ue={position:"absolute",visibility:"hidden",display:"block"},Ve={letterSpacing:"0",fontWeight:"400"},Ge=["Webkit","Moz","ms"],Ye=r.createElement("div").style;function Qe(e){if(e in Ye)return e;var t=e[0].toUpperCase()+e.slice(1),n=Ge.length;while(n--)if((e=Ge[n]+t)in Ye)return e}function Je(e){var t=w.cssProps[e];return t||(t=w.cssProps[e]=Qe(e)||e),t}function Ke(e,t,n){var r=ie.exec(t);return r?Math.max(0,r[2]-(n||0))+(r[3]||"px"):t}function Ze(e,t,n,r,i,o){var a="width"===t?1:0,s=0,u=0;if(n===(r?"border":"content"))return 0;for(;a<4;a+=2)"margin"===n&&(u+=w.css(e,n+oe[a],!0,i)),r?("content"===n&&(u-=w.css(e,"padding"+oe[a],!0,i)),"margin"!==n&&(u-=w.css(e,"border"+oe[a]+"Width",!0,i))):(u+=w.css(e,"padding"+oe[a],!0,i),"padding"!==n?u+=w.css(e,"border"+oe[a]+"Width",!0,i):s+=w.css(e,"border"+oe[a]+"Width",!0,i));return!r&&o>=0&&(u+=Math.max(0,Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-o-u-s-.5))),u}function et(e,t,n){var r=$e(e),i=Fe(e,t,r),o="border-box"===w.css(e,"boxSizing",!1,r),a=o;if(We.test(i)){if(!n)return i;i="auto"}return a=a&&(h.boxSizingReliable()||i===e.style[t]),("auto"===i||!parseFloat(i)&&"inline"===w.css(e,"display",!1,r))&&(i=e["offset"+t[0].toUpperCase()+t.slice(1)],a=!0),(i=parseFloat(i)||0)+Ze(e,t,n||(o?"border":"content"),a,r,i)+"px"}w.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Fe(e,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,a,s=G(t),u=Xe.test(t),l=e.style;if(u||(t=Je(s)),a=w.cssHooks[t]||w.cssHooks[s],void 0===n)return a&&"get"in a&&void 0!==(i=a.get(e,!1,r))?i:l[t];"string"==(o=typeof n)&&(i=ie.exec(n))&&i[1]&&(n=ue(e,t,i),o="number"),null!=n&&n===n&&("number"===o&&(n+=i&&i[3]||(w.cssNumber[s]?"":"px")),h.clearCloneStyle||""!==n||0!==t.indexOf("background")||(l[t]="inherit"),a&&"set"in a&&void 0===(n=a.set(e,n,r))||(u?l.setProperty(t,n):l[t]=n))}},css:function(e,t,n,r){var i,o,a,s=G(t);return Xe.test(t)||(t=Je(s)),(a=w.cssHooks[t]||w.cssHooks[s])&&"get"in a&&(i=a.get(e,!0,n)),void 0===i&&(i=Fe(e,t,r)),"normal"===i&&t in Ve&&(i=Ve[t]),""===n||n?(o=parseFloat(i),!0===n||isFinite(o)?o||0:i):i}}),w.each(["height","width"],function(e,t){w.cssHooks[t]={get:function(e,n,r){if(n)return!ze.test(w.css(e,"display"))||e.getClientRects().length&&e.getBoundingClientRect().width?et(e,t,r):se(e,Ue,function(){return et(e,t,r)})},set:function(e,n,r){var i,o=$e(e),a="border-box"===w.css(e,"boxSizing",!1,o),s=r&&Ze(e,t,r,a,o);return a&&h.scrollboxSize()===o.position&&(s-=Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-parseFloat(o[t])-Ze(e,t,"border",!1,o)-.5)),s&&(i=ie.exec(n))&&"px"!==(i[3]||"px")&&(e.style[t]=n,n=w.css(e,t)),Ke(e,n,s)}}}),w.cssHooks.marginLeft=_e(h.reliableMarginLeft,function(e,t){if(t)return(parseFloat(Fe(e,"marginLeft"))||e.getBoundingClientRect().left-se(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}))+"px"}),w.each({margin:"",padding:"",border:"Width"},function(e,t){w.cssHooks[e+t]={expand:function(n){for(var r=0,i={},o="string"==typeof n?n.split(" "):[n];r<4;r++)i[e+oe[r]+t]=o[r]||o[r-2]||o[0];return i}},"margin"!==e&&(w.cssHooks[e+t].set=Ke)}),w.fn.extend({css:function(e,t){return z(this,function(e,t,n){var r,i,o={},a=0;if(Array.isArray(t)){for(r=$e(e),i=t.length;a<i;a++)o[t[a]]=w.css(e,t[a],!1,r);return o}return void 0!==n?w.style(e,t,n):w.css(e,t)},e,t,arguments.length>1)}});function tt(e,t,n,r,i){return new tt.prototype.init(e,t,n,r,i)}w.Tween=tt,tt.prototype={constructor:tt,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||w.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(w.cssNumber[n]?"":"px")},cur:function(){var e=tt.propHooks[this.prop];return e&&e.get?e.get(this):tt.propHooks._default.get(this)},run:function(e){var t,n=tt.propHooks[this.prop];return this.options.duration?this.pos=t=w.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):tt.propHooks._default.set(this),this}},tt.prototype.init.prototype=tt.prototype,tt.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=w.css(e.elem,e.prop,""))&&"auto"!==t?t:0},set:function(e){w.fx.step[e.prop]?w.fx.step[e.prop](e):1!==e.elem.nodeType||null==e.elem.style[w.cssProps[e.prop]]&&!w.cssHooks[e.prop]?e.elem[e.prop]=e.now:w.style(e.elem,e.prop,e.now+e.unit)}}},tt.propHooks.scrollTop=tt.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},w.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},w.fx=tt.prototype.init,w.fx.step={};var nt,rt,it=/^(?:toggle|show|hide)$/,ot=/queueHooks$/;function at(){rt&&(!1===r.hidden&&e.requestAnimationFrame?e.requestAnimationFrame(at):e.setTimeout(at,w.fx.interval),w.fx.tick())}function st(){return e.setTimeout(function(){nt=void 0}),nt=Date.now()}function ut(e,t){var n,r=0,i={height:e};for(t=t?1:0;r<4;r+=2-t)i["margin"+(n=oe[r])]=i["padding"+n]=e;return t&&(i.opacity=i.width=e),i}function lt(e,t,n){for(var r,i=(pt.tweeners[t]||[]).concat(pt.tweeners["*"]),o=0,a=i.length;o<a;o++)if(r=i[o].call(n,t,e))return r}function ct(e,t,n){var r,i,o,a,s,u,l,c,f="width"in t||"height"in t,p=this,d={},h=e.style,g=e.nodeType&&ae(e),y=J.get(e,"fxshow");n.queue||(null==(a=w._queueHooks(e,"fx")).unqueued&&(a.unqueued=0,s=a.empty.fire,a.empty.fire=function(){a.unqueued||s()}),a.unqueued++,p.always(function(){p.always(function(){a.unqueued--,w.queue(e,"fx").length||a.empty.fire()})}));for(r in t)if(i=t[r],it.test(i)){if(delete t[r],o=o||"toggle"===i,i===(g?"hide":"show")){if("show"!==i||!y||void 0===y[r])continue;g=!0}d[r]=y&&y[r]||w.style(e,r)}if((u=!w.isEmptyObject(t))||!w.isEmptyObject(d)){f&&1===e.nodeType&&(n.overflow=[h.overflow,h.overflowX,h.overflowY],null==(l=y&&y.display)&&(l=J.get(e,"display")),"none"===(c=w.css(e,"display"))&&(l?c=l:(fe([e],!0),l=e.style.display||l,c=w.css(e,"display"),fe([e]))),("inline"===c||"inline-block"===c&&null!=l)&&"none"===w.css(e,"float")&&(u||(p.done(function(){h.display=l}),null==l&&(c=h.display,l="none"===c?"":c)),h.display="inline-block")),n.overflow&&(h.overflow="hidden",p.always(function(){h.overflow=n.overflow[0],h.overflowX=n.overflow[1],h.overflowY=n.overflow[2]})),u=!1;for(r in d)u||(y?"hidden"in y&&(g=y.hidden):y=J.access(e,"fxshow",{display:l}),o&&(y.hidden=!g),g&&fe([e],!0),p.done(function(){g||fe([e]),J.remove(e,"fxshow");for(r in d)w.style(e,r,d[r])})),u=lt(g?y[r]:0,r,p),r in y||(y[r]=u.start,g&&(u.end=u.start,u.start=0))}}function ft(e,t){var n,r,i,o,a;for(n in e)if(r=G(n),i=t[r],o=e[n],Array.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),(a=w.cssHooks[r])&&"expand"in a){o=a.expand(o),delete e[r];for(n in o)n in e||(e[n]=o[n],t[n]=i)}else t[r]=i}function pt(e,t,n){var r,i,o=0,a=pt.prefilters.length,s=w.Deferred().always(function(){delete u.elem}),u=function(){if(i)return!1;for(var t=nt||st(),n=Math.max(0,l.startTime+l.duration-t),r=1-(n/l.duration||0),o=0,a=l.tweens.length;o<a;o++)l.tweens[o].run(r);return s.notifyWith(e,[l,r,n]),r<1&&a?n:(a||s.notifyWith(e,[l,1,0]),s.resolveWith(e,[l]),!1)},l=s.promise({elem:e,props:w.extend({},t),opts:w.extend(!0,{specialEasing:{},easing:w.easing._default},n),originalProperties:t,originalOptions:n,startTime:nt||st(),duration:n.duration,tweens:[],createTween:function(t,n){var r=w.Tween(e,l.opts,t,n,l.opts.specialEasing[t]||l.opts.easing);return l.tweens.push(r),r},stop:function(t){var n=0,r=t?l.tweens.length:0;if(i)return this;for(i=!0;n<r;n++)l.tweens[n].run(1);return t?(s.notifyWith(e,[l,1,0]),s.resolveWith(e,[l,t])):s.rejectWith(e,[l,t]),this}}),c=l.props;for(ft(c,l.opts.specialEasing);o<a;o++)if(r=pt.prefilters[o].call(l,e,c,l.opts))return g(r.stop)&&(w._queueHooks(l.elem,l.opts.queue).stop=r.stop.bind(r)),r;return w.map(c,lt,l),g(l.opts.start)&&l.opts.start.call(e,l),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always),w.fx.timer(w.extend(u,{elem:e,anim:l,queue:l.opts.queue})),l}w.Animation=w.extend(pt,{tweeners:{"*":[function(e,t){var n=this.createTween(e,t);return ue(n.elem,e,ie.exec(t),n),n}]},tweener:function(e,t){g(e)?(t=e,e=["*"]):e=e.match(M);for(var n,r=0,i=e.length;r<i;r++)n=e[r],pt.tweeners[n]=pt.tweeners[n]||[],pt.tweeners[n].unshift(t)},prefilters:[ct],prefilter:function(e,t){t?pt.prefilters.unshift(e):pt.prefilters.push(e)}}),w.speed=function(e,t,n){var r=e&&"object"==typeof e?w.extend({},e):{complete:n||!n&&t||g(e)&&e,duration:e,easing:n&&t||t&&!g(t)&&t};return w.fx.off?r.duration=0:"number"!=typeof r.duration&&(r.duration in w.fx.speeds?r.duration=w.fx.speeds[r.duration]:r.duration=w.fx.speeds._default),null!=r.queue&&!0!==r.queue||(r.queue="fx"),r.old=r.complete,r.complete=function(){g(r.old)&&r.old.call(this),r.queue&&w.dequeue(this,r.queue)},r},w.fn.extend({fadeTo:function(e,t,n,r){return this.filter(ae).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=w.isEmptyObject(e),o=w.speed(t,n,r),a=function(){var t=pt(this,w.extend({},e),o);(i||J.get(this,"finish"))&&t.stop(!0)};return a.finish=a,i||!1===o.queue?this.each(a):this.queue(o.queue,a)},stop:function(e,t,n){var r=function(e){var t=e.stop;delete e.stop,t(n)};return"string"!=typeof e&&(n=t,t=e,e=void 0),t&&!1!==e&&this.queue(e||"fx",[]),this.each(function(){var t=!0,i=null!=e&&e+"queueHooks",o=w.timers,a=J.get(this);if(i)a[i]&&a[i].stop&&r(a[i]);else for(i in a)a[i]&&a[i].stop&&ot.test(i)&&r(a[i]);for(i=o.length;i--;)o[i].elem!==this||null!=e&&o[i].queue!==e||(o[i].anim.stop(n),t=!1,o.splice(i,1));!t&&n||w.dequeue(this,e)})},finish:function(e){return!1!==e&&(e=e||"fx"),this.each(function(){var t,n=J.get(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=w.timers,a=r?r.length:0;for(n.finish=!0,w.queue(this,e,[]),i&&i.stop&&i.stop.call(this,!0),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;t<a;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}}),w.each(["toggle","show","hide"],function(e,t){var n=w.fn[t];w.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(ut(t,!0),e,r,i)}}),w.each({slideDown:ut("show"),slideUp:ut("hide"),slideToggle:ut("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){w.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),w.timers=[],w.fx.tick=function(){var e,t=0,n=w.timers;for(nt=Date.now();t<n.length;t++)(e=n[t])()||n[t]!==e||n.splice(t--,1);n.length||w.fx.stop(),nt=void 0},w.fx.timer=function(e){w.timers.push(e),w.fx.start()},w.fx.interval=13,w.fx.start=function(){rt||(rt=!0,at())},w.fx.stop=function(){rt=null},w.fx.speeds={slow:600,fast:200,_default:400},w.fn.delay=function(t,n){return t=w.fx?w.fx.speeds[t]||t:t,n=n||"fx",this.queue(n,function(n,r){var i=e.setTimeout(n,t);r.stop=function(){e.clearTimeout(i)}})},function(){var e=r.createElement("input"),t=r.createElement("select").appendChild(r.createElement("option"));e.type="checkbox",h.checkOn=""!==e.value,h.optSelected=t.selected,(e=r.createElement("input")).value="t",e.type="radio",h.radioValue="t"===e.value}();var dt,ht=w.expr.attrHandle;w.fn.extend({attr:function(e,t){return z(this,w.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){w.removeAttr(this,e)})}}),w.extend({attr:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return"undefined"==typeof e.getAttribute?w.prop(e,t,n):(1===o&&w.isXMLDoc(e)||(i=w.attrHooks[t.toLowerCase()]||(w.expr.match.bool.test(t)?dt:void 0)),void 0!==n?null===n?void w.removeAttr(e,t):i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:(e.setAttribute(t,n+""),n):i&&"get"in i&&null!==(r=i.get(e,t))?r:null==(r=w.find.attr(e,t))?void 0:r)},attrHooks:{type:{set:function(e,t){if(!h.radioValue&&"radio"===t&&N(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r=0,i=t&&t.match(M);if(i&&1===e.nodeType)while(n=i[r++])e.removeAttribute(n)}}),dt={set:function(e,t,n){return!1===t?w.removeAttr(e,n):e.setAttribute(n,n),n}},w.each(w.expr.match.bool.source.match(/\w+/g),function(e,t){var n=ht[t]||w.find.attr;ht[t]=function(e,t,r){var i,o,a=t.toLowerCase();return r||(o=ht[a],ht[a]=i,i=null!=n(e,t,r)?a:null,ht[a]=o),i}});var gt=/^(?:input|select|textarea|button)$/i,yt=/^(?:a|area)$/i;w.fn.extend({prop:function(e,t){return z(this,w.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[w.propFix[e]||e]})}}),w.extend({prop:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&w.isXMLDoc(e)||(t=w.propFix[t]||t,i=w.propHooks[t]),void 0!==n?i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=w.find.attr(e,"tabindex");return t?parseInt(t,10):gt.test(e.nodeName)||yt.test(e.nodeName)&&e.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),h.optSelected||(w.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),w.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){w.propFix[this.toLowerCase()]=this});function vt(e){return(e.match(M)||[]).join(" ")}function mt(e){return e.getAttribute&&e.getAttribute("class")||""}function xt(e){return Array.isArray(e)?e:"string"==typeof e?e.match(M)||[]:[]}w.fn.extend({addClass:function(e){var t,n,r,i,o,a,s,u=0;if(g(e))return this.each(function(t){w(this).addClass(e.call(this,t,mt(this)))});if((t=xt(e)).length)while(n=this[u++])if(i=mt(n),r=1===n.nodeType&&" "+vt(i)+" "){a=0;while(o=t[a++])r.indexOf(" "+o+" ")<0&&(r+=o+" ");i!==(s=vt(r))&&n.setAttribute("class",s)}return this},removeClass:function(e){var t,n,r,i,o,a,s,u=0;if(g(e))return this.each(function(t){w(this).removeClass(e.call(this,t,mt(this)))});if(!arguments.length)return this.attr("class","");if((t=xt(e)).length)while(n=this[u++])if(i=mt(n),r=1===n.nodeType&&" "+vt(i)+" "){a=0;while(o=t[a++])while(r.indexOf(" "+o+" ")>-1)r=r.replace(" "+o+" "," ");i!==(s=vt(r))&&n.setAttribute("class",s)}return this},toggleClass:function(e,t){var n=typeof e,r="string"===n||Array.isArray(e);return"boolean"==typeof t&&r?t?this.addClass(e):this.removeClass(e):g(e)?this.each(function(n){w(this).toggleClass(e.call(this,n,mt(this),t),t)}):this.each(function(){var t,i,o,a;if(r){i=0,o=w(this),a=xt(e);while(t=a[i++])o.hasClass(t)?o.removeClass(t):o.addClass(t)}else void 0!==e&&"boolean"!==n||((t=mt(this))&&J.set(this,"__className__",t),this.setAttribute&&this.setAttribute("class",t||!1===e?"":J.get(this,"__className__")||""))})},hasClass:function(e){var t,n,r=0;t=" "+e+" ";while(n=this[r++])if(1===n.nodeType&&(" "+vt(mt(n))+" ").indexOf(t)>-1)return!0;return!1}});var bt=/\r/g;w.fn.extend({val:function(e){var t,n,r,i=this[0];{if(arguments.length)return r=g(e),this.each(function(n){var i;1===this.nodeType&&(null==(i=r?e.call(this,n,w(this).val()):e)?i="":"number"==typeof i?i+="":Array.isArray(i)&&(i=w.map(i,function(e){return null==e?"":e+""})),(t=w.valHooks[this.type]||w.valHooks[this.nodeName.toLowerCase()])&&"set"in t&&void 0!==t.set(this,i,"value")||(this.value=i))});if(i)return(t=w.valHooks[i.type]||w.valHooks[i.nodeName.toLowerCase()])&&"get"in t&&void 0!==(n=t.get(i,"value"))?n:"string"==typeof(n=i.value)?n.replace(bt,""):null==n?"":n}}}),w.extend({valHooks:{option:{get:function(e){var t=w.find.attr(e,"value");return null!=t?t:vt(w.text(e))}},select:{get:function(e){var t,n,r,i=e.options,o=e.selectedIndex,a="select-one"===e.type,s=a?null:[],u=a?o+1:i.length;for(r=o<0?u:a?o:0;r<u;r++)if(((n=i[r]).selected||r===o)&&!n.disabled&&(!n.parentNode.disabled||!N(n.parentNode,"optgroup"))){if(t=w(n).val(),a)return t;s.push(t)}return s},set:function(e,t){var n,r,i=e.options,o=w.makeArray(t),a=i.length;while(a--)((r=i[a]).selected=w.inArray(w.valHooks.option.get(r),o)>-1)&&(n=!0);return n||(e.selectedIndex=-1),o}}}}),w.each(["radio","checkbox"],function(){w.valHooks[this]={set:function(e,t){if(Array.isArray(t))return e.checked=w.inArray(w(e).val(),t)>-1}},h.checkOn||(w.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})}),h.focusin="onfocusin"in e;var wt=/^(?:focusinfocus|focusoutblur)$/,Tt=function(e){e.stopPropagation()};w.extend(w.event,{trigger:function(t,n,i,o){var a,s,u,l,c,p,d,h,v=[i||r],m=f.call(t,"type")?t.type:t,x=f.call(t,"namespace")?t.namespace.split("."):[];if(s=h=u=i=i||r,3!==i.nodeType&&8!==i.nodeType&&!wt.test(m+w.event.triggered)&&(m.indexOf(".")>-1&&(m=(x=m.split(".")).shift(),x.sort()),c=m.indexOf(":")<0&&"on"+m,t=t[w.expando]?t:new w.Event(m,"object"==typeof t&&t),t.isTrigger=o?2:3,t.namespace=x.join("."),t.rnamespace=t.namespace?new RegExp("(^|\\.)"+x.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,t.result=void 0,t.target||(t.target=i),n=null==n?[t]:w.makeArray(n,[t]),d=w.event.special[m]||{},o||!d.trigger||!1!==d.trigger.apply(i,n))){if(!o&&!d.noBubble&&!y(i)){for(l=d.delegateType||m,wt.test(l+m)||(s=s.parentNode);s;s=s.parentNode)v.push(s),u=s;u===(i.ownerDocument||r)&&v.push(u.defaultView||u.parentWindow||e)}a=0;while((s=v[a++])&&!t.isPropagationStopped())h=s,t.type=a>1?l:d.bindType||m,(p=(J.get(s,"events")||{})[t.type]&&J.get(s,"handle"))&&p.apply(s,n),(p=c&&s[c])&&p.apply&&Y(s)&&(t.result=p.apply(s,n),!1===t.result&&t.preventDefault());return t.type=m,o||t.isDefaultPrevented()||d._default&&!1!==d._default.apply(v.pop(),n)||!Y(i)||c&&g(i[m])&&!y(i)&&((u=i[c])&&(i[c]=null),w.event.triggered=m,t.isPropagationStopped()&&h.addEventListener(m,Tt),i[m](),t.isPropagationStopped()&&h.removeEventListener(m,Tt),w.event.triggered=void 0,u&&(i[c]=u)),t.result}},simulate:function(e,t,n){var r=w.extend(new w.Event,n,{type:e,isSimulated:!0});w.event.trigger(r,null,t)}}),w.fn.extend({trigger:function(e,t){return this.each(function(){w.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];if(n)return w.event.trigger(e,t,n,!0)}}),h.focusin||w.each({focus:"focusin",blur:"focusout"},function(e,t){var n=function(e){w.event.simulate(t,e.target,w.event.fix(e))};w.event.special[t]={setup:function(){var r=this.ownerDocument||this,i=J.access(r,t);i||r.addEventListener(e,n,!0),J.access(r,t,(i||0)+1)},teardown:function(){var r=this.ownerDocument||this,i=J.access(r,t)-1;i?J.access(r,t,i):(r.removeEventListener(e,n,!0),J.remove(r,t))}}});var Ct=e.location,Et=Date.now(),kt=/\?/;w.parseXML=function(t){var n;if(!t||"string"!=typeof t)return null;try{n=(new e.DOMParser).parseFromString(t,"text/xml")}catch(e){n=void 0}return n&&!n.getElementsByTagName("parsererror").length||w.error("Invalid XML: "+t),n};var St=/\[\]$/,Dt=/\r?\n/g,Nt=/^(?:submit|button|image|reset|file)$/i,At=/^(?:input|select|textarea|keygen)/i;function jt(e,t,n,r){var i;if(Array.isArray(t))w.each(t,function(t,i){n||St.test(e)?r(e,i):jt(e+"["+("object"==typeof i&&null!=i?t:"")+"]",i,n,r)});else if(n||"object"!==x(t))r(e,t);else for(i in t)jt(e+"["+i+"]",t[i],n,r)}w.param=function(e,t){var n,r=[],i=function(e,t){var n=g(t)?t():t;r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(null==n?"":n)};if(Array.isArray(e)||e.jquery&&!w.isPlainObject(e))w.each(e,function(){i(this.name,this.value)});else for(n in e)jt(n,e[n],t,i);return r.join("&")},w.fn.extend({serialize:function(){return w.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=w.prop(this,"elements");return e?w.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!w(this).is(":disabled")&&At.test(this.nodeName)&&!Nt.test(e)&&(this.checked||!pe.test(e))}).map(function(e,t){var n=w(this).val();return null==n?null:Array.isArray(n)?w.map(n,function(e){return{name:t.name,value:e.replace(Dt,"\r\n")}}):{name:t.name,value:n.replace(Dt,"\r\n")}}).get()}});var qt=/%20/g,Lt=/#.*$/,Ht=/([?&])_=[^&]*/,Ot=/^(.*?):[ \t]*([^\r\n]*)$/gm,Pt=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Mt=/^(?:GET|HEAD)$/,Rt=/^\/\//,It={},Wt={},$t="*/".concat("*"),Bt=r.createElement("a");Bt.href=Ct.href;function Ft(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(M)||[];if(g(n))while(r=o[i++])"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function _t(e,t,n,r){var i={},o=e===Wt;function a(s){var u;return i[s]=!0,w.each(e[s]||[],function(e,s){var l=s(t,n,r);return"string"!=typeof l||o||i[l]?o?!(u=l):void 0:(t.dataTypes.unshift(l),a(l),!1)}),u}return a(t.dataTypes[0])||!i["*"]&&a("*")}function zt(e,t){var n,r,i=w.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((i[n]?e:r||(r={}))[n]=t[n]);return r&&w.extend(!0,e,r),e}function Xt(e,t,n){var r,i,o,a,s=e.contents,u=e.dataTypes;while("*"===u[0])u.shift(),void 0===r&&(r=e.mimeType||t.getResponseHeader("Content-Type"));if(r)for(i in s)if(s[i]&&s[i].test(r)){u.unshift(i);break}if(u[0]in n)o=u[0];else{for(i in n){if(!u[0]||e.converters[i+" "+u[0]]){o=i;break}a||(a=i)}o=o||a}if(o)return o!==u[0]&&u.unshift(o),n[o]}function Ut(e,t,n,r){var i,o,a,s,u,l={},c=e.dataTypes.slice();if(c[1])for(a in e.converters)l[a.toLowerCase()]=e.converters[a];o=c.shift();while(o)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!u&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u=o,o=c.shift())if("*"===o)o=u;else if("*"!==u&&u!==o){if(!(a=l[u+" "+o]||l["* "+o]))for(i in l)if((s=i.split(" "))[1]===o&&(a=l[u+" "+s[0]]||l["* "+s[0]])){!0===a?a=l[i]:!0!==l[i]&&(o=s[0],c.unshift(s[1]));break}if(!0!==a)if(a&&e["throws"])t=a(t);else try{t=a(t)}catch(e){return{state:"parsererror",error:a?e:"No conversion from "+u+" to "+o}}}return{state:"success",data:t}}w.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Ct.href,type:"GET",isLocal:Pt.test(Ct.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":$t,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":w.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?zt(zt(e,w.ajaxSettings),t):zt(w.ajaxSettings,e)},ajaxPrefilter:Ft(It),ajaxTransport:Ft(Wt),ajax:function(t,n){"object"==typeof t&&(n=t,t=void 0),n=n||{};var i,o,a,s,u,l,c,f,p,d,h=w.ajaxSetup({},n),g=h.context||h,y=h.context&&(g.nodeType||g.jquery)?w(g):w.event,v=w.Deferred(),m=w.Callbacks("once memory"),x=h.statusCode||{},b={},T={},C="canceled",E={readyState:0,getResponseHeader:function(e){var t;if(c){if(!s){s={};while(t=Ot.exec(a))s[t[1].toLowerCase()]=t[2]}t=s[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return c?a:null},setRequestHeader:function(e,t){return null==c&&(e=T[e.toLowerCase()]=T[e.toLowerCase()]||e,b[e]=t),this},overrideMimeType:function(e){return null==c&&(h.mimeType=e),this},statusCode:function(e){var t;if(e)if(c)E.always(e[E.status]);else for(t in e)x[t]=[x[t],e[t]];return this},abort:function(e){var t=e||C;return i&&i.abort(t),k(0,t),this}};if(v.promise(E),h.url=((t||h.url||Ct.href)+"").replace(Rt,Ct.protocol+"//"),h.type=n.method||n.type||h.method||h.type,h.dataTypes=(h.dataType||"*").toLowerCase().match(M)||[""],null==h.crossDomain){l=r.createElement("a");try{l.href=h.url,l.href=l.href,h.crossDomain=Bt.protocol+"//"+Bt.host!=l.protocol+"//"+l.host}catch(e){h.crossDomain=!0}}if(h.data&&h.processData&&"string"!=typeof h.data&&(h.data=w.param(h.data,h.traditional)),_t(It,h,n,E),c)return E;(f=w.event&&h.global)&&0==w.active++&&w.event.trigger("ajaxStart"),h.type=h.type.toUpperCase(),h.hasContent=!Mt.test(h.type),o=h.url.replace(Lt,""),h.hasContent?h.data&&h.processData&&0===(h.contentType||"").indexOf("application/x-www-form-urlencoded")&&(h.data=h.data.replace(qt,"+")):(d=h.url.slice(o.length),h.data&&(h.processData||"string"==typeof h.data)&&(o+=(kt.test(o)?"&":"?")+h.data,delete h.data),!1===h.cache&&(o=o.replace(Ht,"$1"),d=(kt.test(o)?"&":"?")+"_="+Et+++d),h.url=o+d),h.ifModified&&(w.lastModified[o]&&E.setRequestHeader("If-Modified-Since",w.lastModified[o]),w.etag[o]&&E.setRequestHeader("If-None-Match",w.etag[o])),(h.data&&h.hasContent&&!1!==h.contentType||n.contentType)&&E.setRequestHeader("Content-Type",h.contentType),E.setRequestHeader("Accept",h.dataTypes[0]&&h.accepts[h.dataTypes[0]]?h.accepts[h.dataTypes[0]]+("*"!==h.dataTypes[0]?", "+$t+"; q=0.01":""):h.accepts["*"]);for(p in h.headers)E.setRequestHeader(p,h.headers[p]);if(h.beforeSend&&(!1===h.beforeSend.call(g,E,h)||c))return E.abort();if(C="abort",m.add(h.complete),E.done(h.success),E.fail(h.error),i=_t(Wt,h,n,E)){if(E.readyState=1,f&&y.trigger("ajaxSend",[E,h]),c)return E;h.async&&h.timeout>0&&(u=e.setTimeout(function(){E.abort("timeout")},h.timeout));try{c=!1,i.send(b,k)}catch(e){if(c)throw e;k(-1,e)}}else k(-1,"No Transport");function k(t,n,r,s){var l,p,d,b,T,C=n;c||(c=!0,u&&e.clearTimeout(u),i=void 0,a=s||"",E.readyState=t>0?4:0,l=t>=200&&t<300||304===t,r&&(b=Xt(h,E,r)),b=Ut(h,b,E,l),l?(h.ifModified&&((T=E.getResponseHeader("Last-Modified"))&&(w.lastModified[o]=T),(T=E.getResponseHeader("etag"))&&(w.etag[o]=T)),204===t||"HEAD"===h.type?C="nocontent":304===t?C="notmodified":(C=b.state,p=b.data,l=!(d=b.error))):(d=C,!t&&C||(C="error",t<0&&(t=0))),E.status=t,E.statusText=(n||C)+"",l?v.resolveWith(g,[p,C,E]):v.rejectWith(g,[E,C,d]),E.statusCode(x),x=void 0,f&&y.trigger(l?"ajaxSuccess":"ajaxError",[E,h,l?p:d]),m.fireWith(g,[E,C]),f&&(y.trigger("ajaxComplete",[E,h]),--w.active||w.event.trigger("ajaxStop")))}return E},getJSON:function(e,t,n){return w.get(e,t,n,"json")},getScript:function(e,t){return w.get(e,void 0,t,"script")}}),w.each(["get","post"],function(e,t){w[t]=function(e,n,r,i){return g(n)&&(i=i||r,r=n,n=void 0),w.ajax(w.extend({url:e,type:t,dataType:i,data:n,success:r},w.isPlainObject(e)&&e))}}),w._evalUrl=function(e){return w.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,"throws":!0})},w.fn.extend({wrapAll:function(e){var t;return this[0]&&(g(e)&&(e=e.call(this[0])),t=w(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstElementChild)e=e.firstElementChild;return e}).append(this)),this},wrapInner:function(e){return g(e)?this.each(function(t){w(this).wrapInner(e.call(this,t))}):this.each(function(){var t=w(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=g(e);return this.each(function(n){w(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(e){return this.parent(e).not("body").each(function(){w(this).replaceWith(this.childNodes)}),this}}),w.expr.pseudos.hidden=function(e){return!w.expr.pseudos.visible(e)},w.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},w.ajaxSettings.xhr=function(){try{return new e.XMLHttpRequest}catch(e){}};var Vt={0:200,1223:204},Gt=w.ajaxSettings.xhr();h.cors=!!Gt&&"withCredentials"in Gt,h.ajax=Gt=!!Gt,w.ajaxTransport(function(t){var n,r;if(h.cors||Gt&&!t.crossDomain)return{send:function(i,o){var a,s=t.xhr();if(s.open(t.type,t.url,t.async,t.username,t.password),t.xhrFields)for(a in t.xhrFields)s[a]=t.xhrFields[a];t.mimeType&&s.overrideMimeType&&s.overrideMimeType(t.mimeType),t.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");for(a in i)s.setRequestHeader(a,i[a]);n=function(e){return function(){n&&(n=r=s.onload=s.onerror=s.onabort=s.ontimeout=s.onreadystatechange=null,"abort"===e?s.abort():"error"===e?"number"!=typeof s.status?o(0,"error"):o(s.status,s.statusText):o(Vt[s.status]||s.status,s.statusText,"text"!==(s.responseType||"text")||"string"!=typeof s.responseText?{binary:s.response}:{text:s.responseText},s.getAllResponseHeaders()))}},s.onload=n(),r=s.onerror=s.ontimeout=n("error"),void 0!==s.onabort?s.onabort=r:s.onreadystatechange=function(){4===s.readyState&&e.setTimeout(function(){n&&r()})},n=n("abort");try{s.send(t.hasContent&&t.data||null)}catch(e){if(n)throw e}},abort:function(){n&&n()}}}),w.ajaxPrefilter(function(e){e.crossDomain&&(e.contents.script=!1)}),w.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return w.globalEval(e),e}}}),w.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),w.ajaxTransport("script",function(e){if(e.crossDomain){var t,n;return{send:function(i,o){t=w("<script>").prop({charset:e.scriptCharset,src:e.url}).on("load error",n=function(e){t.remove(),n=null,e&&o("error"===e.type?404:200,e.type)}),r.head.appendChild(t[0])},abort:function(){n&&n()}}}});var Yt=[],Qt=/(=)\?(?=&|$)|\?\?/;w.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Yt.pop()||w.expando+"_"+Et++;return this[e]=!0,e}}),w.ajaxPrefilter("json jsonp",function(t,n,r){var i,o,a,s=!1!==t.jsonp&&(Qt.test(t.url)?"url":"string"==typeof t.data&&0===(t.contentType||"").indexOf("application/x-www-form-urlencoded")&&Qt.test(t.data)&&"data");if(s||"jsonp"===t.dataTypes[0])return i=t.jsonpCallback=g(t.jsonpCallback)?t.jsonpCallback():t.jsonpCallback,s?t[s]=t[s].replace(Qt,"$1"+i):!1!==t.jsonp&&(t.url+=(kt.test(t.url)?"&":"?")+t.jsonp+"="+i),t.converters["script json"]=function(){return a||w.error(i+" was not called"),a[0]},t.dataTypes[0]="json",o=e[i],e[i]=function(){a=arguments},r.always(function(){void 0===o?w(e).removeProp(i):e[i]=o,t[i]&&(t.jsonpCallback=n.jsonpCallback,Yt.push(i)),a&&g(o)&&o(a[0]),a=o=void 0}),"script"}),h.createHTMLDocument=function(){var e=r.implementation.createHTMLDocument("").body;return e.innerHTML="<form></form><form></form>",2===e.childNodes.length}(),w.parseHTML=function(e,t,n){if("string"!=typeof e)return[];"boolean"==typeof t&&(n=t,t=!1);var i,o,a;return t||(h.createHTMLDocument?((i=(t=r.implementation.createHTMLDocument("")).createElement("base")).href=r.location.href,t.head.appendChild(i)):t=r),o=A.exec(e),a=!n&&[],o?[t.createElement(o[1])]:(o=xe([e],t,a),a&&a.length&&w(a).remove(),w.merge([],o.childNodes))},w.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return s>-1&&(r=vt(e.slice(s)),e=e.slice(0,s)),g(t)?(n=t,t=void 0):t&&"object"==typeof t&&(i="POST"),a.length>0&&w.ajax({url:e,type:i||"GET",dataType:"html",data:t}).done(function(e){o=arguments,a.html(r?w("<div>").append(w.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},w.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){w.fn[t]=function(e){return this.on(t,e)}}),w.expr.pseudos.animated=function(e){return w.grep(w.timers,function(t){return e===t.elem}).length},w.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l,c=w.css(e,"position"),f=w(e),p={};"static"===c&&(e.style.position="relative"),s=f.offset(),o=w.css(e,"top"),u=w.css(e,"left"),(l=("absolute"===c||"fixed"===c)&&(o+u).indexOf("auto")>-1)?(a=(r=f.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),g(t)&&(t=t.call(e,n,w.extend({},s))),null!=t.top&&(p.top=t.top-s.top+a),null!=t.left&&(p.left=t.left-s.left+i),"using"in t?t.using.call(e,p):f.css(p)}},w.fn.extend({offset:function(e){if(arguments.length)return void 0===e?this:this.each(function(t){w.offset.setOffset(this,e,t)});var t,n,r=this[0];if(r)return r.getClientRects().length?(t=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:t.top+n.pageYOffset,left:t.left+n.pageXOffset}):{top:0,left:0}},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===w.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===w.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=w(e).offset()).top+=w.css(e,"borderTopWidth",!0),i.left+=w.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-w.css(r,"marginTop",!0),left:t.left-i.left-w.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===w.css(e,"position"))e=e.offsetParent;return e||be})}}),w.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,t){var n="pageYOffset"===t;w.fn[e]=function(r){return z(this,function(e,r,i){var o;if(y(e)?o=e:9===e.nodeType&&(o=e.defaultView),void 0===i)return o?o[t]:e[r];o?o.scrollTo(n?o.pageXOffset:i,n?i:o.pageYOffset):e[r]=i},e,r,arguments.length)}}),w.each(["top","left"],function(e,t){w.cssHooks[t]=_e(h.pixelPosition,function(e,n){if(n)return n=Fe(e,t),We.test(n)?w(e).position()[t]+"px":n})}),w.each({Height:"height",Width:"width"},function(e,t){w.each({padding:"inner"+e,content:t,"":"outer"+e},function(n,r){w.fn[r]=function(i,o){var a=arguments.length&&(n||"boolean"!=typeof i),s=n||(!0===i||!0===o?"margin":"border");return z(this,function(t,n,i){var o;return y(t)?0===r.indexOf("outer")?t["inner"+e]:t.document.documentElement["client"+e]:9===t.nodeType?(o=t.documentElement,Math.max(t.body["scroll"+e],o["scroll"+e],t.body["offset"+e],o["offset"+e],o["client"+e])):void 0===i?w.css(t,n,s):w.style(t,n,i,s)},t,a?i:void 0,a)}})}),w.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,t){w.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),w.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),w.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)}}),w.proxy=function(e,t){var n,r,i;if("string"==typeof t&&(n=e[t],t=e,e=n),g(e))return r=o.call(arguments,2),i=function(){return e.apply(t||this,r.concat(o.call(arguments)))},i.guid=e.guid=e.guid||w.guid++,i},w.holdReady=function(e){e?w.readyWait++:w.ready(!0)},w.isArray=Array.isArray,w.parseJSON=JSON.parse,w.nodeName=N,w.isFunction=g,w.isWindow=y,w.camelCase=G,w.type=x,w.now=Date.now,w.isNumeric=function(e){var t=w.type(e);return("number"===t||"string"===t)&&!isNaN(e-parseFloat(e))},"function"==typeof define&&define.amd&&define("jquery",[],function(){return w});var Jt=e.jQuery,Kt=e.$;return w.noConflict=function(t){return e.$===w&&(e.$=Kt),t&&e.jQuery===w&&(e.jQuery=Jt),w},t||(e.jQuery=e.$=w),w});
14
15;
16/**
17 * jQuery Cookie plugin
18 *
19 * Copyright (c) 2010 Klaus Hartl (stilbuero.de)
20 * Dual licensed under the MIT and GPL licenses:
21 * http://www.opensource.org/licenses/mit-license.php
22 * http://www.gnu.org/licenses/gpl.html
23 *
24 */
25jQuery.cookie = function (key, value, options) {
26
27    // key and at least value given, set cookie...
28    if (arguments.length > 1 && String(value) !== "[object Object]") {
29        options = jQuery.extend({}, options);
30
31        if (value === null || value === undefined) {
32            options.expires = -1;
33        }
34
35        if (typeof options.expires === 'number') {
36            var days = options.expires, t = options.expires = new Date();
37            t.setDate(t.getDate() + days);
38        }
39
40        value = String(value);
41
42        return (document.cookie = [
43            encodeURIComponent(key), '=',
44            options.raw ? value : encodeURIComponent(value),
45            options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
46            options.path ? '; path=' + options.path : '',
47            options.domain ? '; domain=' + options.domain : '',
48            options.secure ? '; secure' : ''
49        ].join(''));
50    }
51
52    // key and possibly options given, get cookie...
53    options = value || {};
54    var result, decode = options.raw ? function (s) { return s; } : decodeURIComponent;
55    return (result = new RegExp('(?:^|; )' + encodeURIComponent(key) + '=([^;]*)').exec(document.cookie)) ? decode(result[1]) : null;
56};
57;
58/*! LAB.js (LABjs :: Loading And Blocking JavaScript)
59    v2.0.3 (c) Kyle Simpson
60    MIT License
61*/
62(function(o){var K=o.$LAB,y="UseLocalXHR",z="AlwaysPreserveOrder",u="AllowDuplicates",A="CacheBust",B="BasePath",C=/^[^?#]*\//.exec(location.href)[0],D=/^\w+\:\/\/\/?[^\/]+/.exec(C)[0],i=document.head||document.getElementsByTagName("head"),L=(o.opera&&Object.prototype.toString.call(o.opera)=="[object Opera]")||("MozAppearance"in document.documentElement.style),q=document.createElement("script"),E=typeof q.preload=="boolean",r=E||(q.readyState&&q.readyState=="uninitialized"),F=!r&&q.async===true,M=!r&&!F&&!L;function G(a){return Object.prototype.toString.call(a)=="[object Function]"}function H(a){return Object.prototype.toString.call(a)=="[object Array]"}function N(a,c){var b=/^\w+\:\/\//;if(/^\/\/\/?/.test(a)){a=location.protocol+a}else if(!b.test(a)&&a.charAt(0)!="/"){a=(c||"")+a}return b.test(a)?a:((a.charAt(0)=="/"?D:C)+a)}function s(a,c){for(var b in a){if(a.hasOwnProperty(b)){c[b]=a[b]}}return c}function O(a){var c=false;for(var b=0;b<a.scripts.length;b++){if(a.scripts[b].ready&&a.scripts[b].exec_trigger){c=true;a.scripts[b].exec_trigger();a.scripts[b].exec_trigger=null}}return c}function t(a,c,b,d){a.onload=a.onreadystatechange=function(){if((a.readyState&&a.readyState!="complete"&&a.readyState!="loaded")||c[b])return;a.onload=a.onreadystatechange=null;d()}}function I(a){a.ready=a.finished=true;for(var c=0;c<a.finished_listeners.length;c++){a.finished_listeners[c]()}a.ready_listeners=[];a.finished_listeners=[]}function P(d,f,e,g,h){setTimeout(function(){var a,c=f.real_src,b;if("item"in i){if(!i[0]){setTimeout(arguments.callee,25);return}i=i[0]}a=document.createElement("script");if(f.type)a.type=f.type;if(f.charset)a.charset=f.charset;if(h){if(r){e.elem=a;if(E){a.preload=true;a.onpreload=g}else{a.onreadystatechange=function(){if(a.readyState=="loaded")g()}}a.src=c}else if(h&&c.indexOf(D)==0&&d[y]){b=new XMLHttpRequest();b.onreadystatechange=function(){if(b.readyState==4){b.onreadystatechange=function(){};e.text=b.responseText+"\n//@ sourceURL="+c;g()}};b.open("GET",c);b.send()}else{a.type="text/cache-script";t(a,e,"ready",function(){i.removeChild(a);g()});a.src=c;i.insertBefore(a,i.firstChild)}}else if(F){a.async=false;t(a,e,"finished",g);a.src=c;i.insertBefore(a,i.firstChild)}else{t(a,e,"finished",g);a.src=c;i.insertBefore(a,i.firstChild)}},0)}function J(){var l={},Q=r||M,n=[],p={},m;l[y]=true;l[z]=false;l[u]=false;l[A]=false;l[B]="";function R(a,c,b){var d;function f(){if(d!=null){d=null;I(b)}}if(p[c.src].finished)return;if(!a[u])p[c.src].finished=true;d=b.elem||document.createElement("script");
62if(c.type)d.type=c.type;if(c.charset)d.charset=c.charset;t(d,b,"finished",f);if(b.elem){b.elem=null}else if(b.text){d.onload=d.onreadystatechange=null;d.text=b.text}else{d.src=c.real_src}i.insertBefore(d,i.firstChild);if(b.text){f()}}function S(c,b,d,f){var e,g,h=function(){b.ready_cb(b,function(){R(c,b,e)})},j=function(){b.finished_cb(b,d)};b.src=N(b.src,c[B]);b.real_src=b.src+(c[A]?((/\?.*$/.test(b.src)?"&_":"?_")+~~(Math.random()*1E9)+"="):"");if(!p[b.src])p[b.src]={items:[],finished:false};g=p[b.src].items;if(c[u]||g.length==0){e=g[g.length]={ready:false,finished:false,ready_listeners:[h],finished_listeners:[j]};P(c,b,e,((f)?function(){e.ready=true;for(var a=0;a<e.ready_listeners.length;a++){e.ready_listeners[a]()}e.ready_listeners=[]}:function(){I(e)}),f)}else{e=g[0];if(e.finished){j()}else{e.finished_listeners.push(j)}}}function v(){var e,g=s(l,{}),h=[],j=0,w=false,k;function T(a,c){a.ready=true;a.exec_trigger=c;x()}function U(a,c){a.ready=a.finished=true;a.exec_trigger=null;for(var b=0;b<c.scripts.length;b++){if(!c.scripts[b].finished)return}c.finished=true;x()}function x(){while(j<h.length){if(G(h[j])){try{h[j++]()}catch(err){}continue}else if(!h[j].finished){if(O(h[j]))continue;break}j++}if(j==h.length){w=false;k=false}}function V(){if(!k||!k.scripts){h.push(k={scripts:[],finished:true})}}e={script:function(){for(var f=0;f<arguments.length;f++){(function(a,c){var b;if(!H(a)){c=[a]}for(var d=0;d<c.length;d++){V();a=c[d];if(G(a))a=a();if(!a)continue;if(H(a)){b=[].slice.call(a);b.unshift(d,1);[].splice.apply(c,b);d--;continue}if(typeof a=="string")a={src:a};a=s(a,{ready:false,ready_cb:T,finished:false,finished_cb:U});k.finished=false;k.scripts.push(a);S(g,a,k,(Q&&w));w=true;if(g[z])e.wait()}})(arguments[f],arguments[f])}return e},wait:function(){if(arguments.length>0){for(var a=0;a<arguments.length;a++){h.push(arguments[a])}k=h[h.length-1]}else k=false;x();return e}};return{script:e.script,wait:e.wait,setOptions:function(a){s(a,g);return e}}}m={setGlobalDefaults:function(a){s(a,l);return m},setOptions:function(){return v().setOptions.apply(null,arguments)},script:function(){return v().script.apply(null,arguments)},wait:function(){return v().wait.apply(null,arguments)},queueScript:function(){n[n.length]={type:"script",args:[].slice.call(arguments)};return m},queueWait:function(){n[n.length]={type:"wait",args:[].slice.call(arguments)};return m},runQueue:function(){var a=m,c=n.length,b=c,d;for(;--b>=0;){d=n.shift();a=a[d.type].apply(null,d.args)}return a},noConflict:function(){o.$LAB=K;return m},sandbox:function(){return J()}};return m}o.$LAB=J();(function(a,c,b){if(document.readyState==null&&document[a]){document.readyState="loading";document[a](c,b=function(){document.removeEventListener(c,b,false);document.readyState="complete"},false)}})("addEventListener","DOMContentLoaded")})(this);;
63//Custom Event
64$(document).on('click submit', '[gaq]', function (e) {
65    //prevent both click and submit to happen at once
66    if (e.type.toLowerCase() == 'click' && this.nodeName.toLowerCase() == 'form') return;
67    var details = $(this).attr("gaq").replace(/\s*/g, '').split(",");
68    var type = title = '';
69    if (details.length > 0) type = details[0];
70    if (details.length > 1) title = details[1];
71    try {
72        dataLayer.push({
73            'event': 'custom',
74            'category': type,
75            'action': document.location.pathname,
76            'label': title
77        });
78    } catch (err) {
79        console.log('Custom Event', err);
80    }
81});;
82/*
83	Layout JS
84    - common scripts used throughout the site
85*/
86
87window.$HDMLAB = (window.$HDMLAB || $LAB); 
88
89function fullHeight() {
90    $('[data-type="fillHeight"]').each(function (idx, elem) {
91        var newHeight = $(window).height() * parseFloat($(elem).attr('data-height')) / 100;
92        $(elem).height(newHeight);
93    });
94}
95$(window).resize(fullHeight);
96fullHeight();
97
98window.$HDMLAB
99    .script("/js/vendors/site/jquery.ba-hashchange.min.js")
100    .wait(function () {
101        $(window).on('hashchange', function () {
102            $(window).trigger('hash-change', [location.hash]);
103        });
104    });
105
106// Fonts
107window.$HDMLAB
108    .script('/js/vendors/site/webfontloader.js')
109    .wait(function () {
110        WebFont.load({
111            google: {
112                families: ['Roboto:300,400,700', 'Roboto+Condensed:400,700']
113            },
114            //typekit: {
115            //	id: 'wvw7tmv'
116            //}
117        });
118    });
119
120/******** misc functions ***********/
121function debounce(func, wait, immediate) {
122    var timeout;
123    return function () {
124        var context = this, args = arguments;
125        var later = function () {
126            timeout = null;
127            if (!immediate) func.apply(context, args);
128        };
129        var callNow = immediate && !timeout;
130        clearTimeout(timeout);
131        timeout = setTimeout(later, wait);
132        if (callNow) func.apply(context, args);
133    };
134};
135
136//function preloadBackgroundImage($ele) {
137//    var $link = $ele.children('a');
138//    if ($link.length !== 0) {
139//        var imagePath = $link.attr('href');
140//        $('<img/>').on('load', function () {
141//            $ele.css('background-image', "url('" + this.src + "')").removeClass('preload-image');
142//        }).attr('src', imagePath);
143//    }
144//}
145
146/***** Lazy load *****/    
147window.$HDMLAB
148    .script('/js/bundle/site/intersection-observer.js')
149    .wait(function () {
150    
151    // Images
152    // Usage: <img data-lazy-src="/images/my-photo.jpg" alt="">    
153    const initLazyImages = function() {
154
155        const images = document.querySelectorAll('img[data-lazy-src]');
156        const imagesArray = Array.prototype.slice.call(images);
157
158        const lazyConfig = {
159            rootMargin: '0px 0px 0px 0px',
160            threshold: .05
161        };
162
163        let imgObserver = new IntersectionObserver(function(entries, self) {
164            entries.forEach(function(entry) {
165                if(entry.isIntersecting) {
166                    preloadImage(entry.target);
167                    self.unobserve(entry.target);
168                }
169            });
170        }, lazyConfig);
171
172        imagesArray.forEach(function(image) {
173            imgObserver.observe(image);
174        });
175
176        function preloadImage(img) {
177            let src = img.getAttribute('data-lazy-src');
178            if(!src) return;
179            img.src = src;
180
181            if(img.classList.contains('fancy')) {
182                img.classList.add('lazy-fade-in-fancy');            
183            } else {
184                img.classList.add('lazy-fade-in');            
185            }
186
187            // refresh polyfill
188            //objectFitPolyfill(); 
189
190            // cleanup
191            img.removeAttribute('data-lazy-src');
192        }	
193
194    };
195
196
197    // Background images
198    // Usage: <div data-lazy-bg="/images/my-photo.jpg"></div>
199    const initLazyBgImages = function() {	
200
201        const images = document.querySelectorAll('[data-lazy-bg]');
202        const imagesArray = Array.prototype.slice.call(images);
203
204        const lazyConfig = {
205            rootMargin: '0px 0px 0px 0px',
206            threshold: .05
207        };
208
209        let bgObserver = new IntersectionObserver(function(entries, self) {
210            entries.forEach(function(entry) {
211                if(entry.isIntersecting) {
212                    preloadImage(entry.target);
213                    self.unobserve(entry.target);
214                }
215            });
216        }, lazyConfig);
217
218        imagesArray.forEach(function(image) {
219            bgObserver.observe(image);
220        });
221
222        function preloadImage(img) {
223            let src = img.getAttribute('data-lazy-bg');
224            if(!src) return;
225            img.style.backgroundImage = 'url(' + src + ')';
226
227            // cleanup
228            img.removeAttribute('data-lazy-bg');
229        }
230
231    };
232
233    // init lazy load
234    initLazyImages();
235    initLazyBgImages();    
236	    
237});
238
239// Promisifying XMLHttpRequest
240// https://developers.google.com/web/fundamentals/primers/promises
241function get(url) {
242    // Return a new promise.
243    return new Promise(function(resolve, reject) {
244        // Do the usual XHR stuff
245        var req = new XMLHttpRequest();
246        req.open('GET', url);
247
248        req.onload = function() {
249            // This is called even on 404 etc so check the status
250            if (req.status == 200) {
251                // Resolve the promise with the response text
252                resolve(req.response);
253            } else {
254                // Otherwise reject with the status text
255                // which will hopefully be a meaningful error
256                reject(Error(req.statusText));
257            }
258        };
259
260        // Handle network errors
261        req.onerror = function() {
262            reject(Error("Network Error"));
263        };
264
265        // Make the request
266        req.send();
267    });
268}
269window.$HDMLAB
270    .script('/js/bundle/site/jquery.magnific-popup.js')
271    .wait(function () {
272
273        // video tour link
274        $('.js-tour-link').magnificPopup({
275            type: 'iframe',
276            midClick: true,
277        });
278
279        // image popup
280        $('.js-img-link').magnificPopup({
281            type: 'image',
282            midClick: true,
283            closeBtnInside: false
284        });        
285    });   
286
287// lazy load sliders
288// usage: loadSlider('.my-slider', initMySlider);
289function loadSlider(sliderClass, callbackFunc) {
290    // config
291    let config = {
292        rootMargin: '0px 0px 50px 0px',
293        threshold: 0
294    };
295
296    // element to observe
297    let slider = document.querySelector(sliderClass);
298
299    // set up the observer
300    let observer = new IntersectionObserver(function (entry, self) {
301        if (entry[0].isIntersecting) {
302            callbackFunc();
303            self.unobserve(entry[0].target);
304        }
305    }, config);
306
307    // begin observing
308    try {
309        observer.observe(slider);
310    } catch (err) {
311        console.log(err);
312    }
313}
314// ADA fix for external links
315function adaExternalLinks() {
316    const externalLinks = document.querySelectorAll('a[target="_blank"]');
317    
318    externalLinks.forEach(function(el, i) {						
319        let messageAppend = 'opens in a new tab';
320
321        // Check if link already has an aria label
322        if (el.getAttribute('aria-label')) {				
323            let currAriaLabel = el.ariaLabel;
324
325            //If doesn't already contain message
326            //(if don't check this, it will continue appending, especially with TinyMCE areas)
327            if (!currAriaLabel.includes(messageAppend)) {
328                let currAriaLabelMessage = currAriaLabel + ' - ' + messageAppend;
329                el.setAttribute('aria-label', currAriaLabelMessage);
330            }
331        } 
332        // Check if link has text
333        else if (el.textContent) { 				
334            let currLinkText = el.textContent;
335            let currAriaLabelMessage = currLinkText + ' - ' + messageAppend;
336            el.setAttribute('aria-label', currAriaLabelMessage);
337        } else {
338            el.setAttribute('aria-label', messageAppend);
339        }		
340        
341    });
342}
343
344adaExternalLinks();;
345var Widgets = Widgets || {};
346
347
348Widgets.Utility = (function ($) {
349    var instance;
350    function constructor() {
351
352        function _getZIndex() {
353            var zIndex = 0;
354            $(document.body).children().each(function () {
355                var index = parseInt($(this).css('z-index'));
356                if (!isNaN(index)&& index !=2147483647)
357                    zIndex = Math.max(zIndex, index);
358            });
359
360            //account for admin bar
361            //var adminPanel = $('.admin_panel');
362            //if (adminPanel.length != 0) {
363            //    var adminPanelIndex = parseInt($('.admin_panel').css('z-index'));
364            //    zIndex = zIndex + 1 >= adminPanelIndex ? adminPanelIndex - 2 : zIndex;
365            //}
366
367            return zIndex + 1;
368        }
369
370        function _whichTransitionEvent() {
371            var t,
372                el = document.createElement("fakeelement");
373
374            var transitions = {
375                "transition": "transitionend",
376                "OTransition": "oTransitionEnd",
377                "MozTransition": "transitionend",
378                "WebkitTransition": "webkitTransitionEnd"
379            };
380
381            for (t in transitions) {
382                if (el.style[t] !== undefined) {
383                    return transitions[t];
384                }
385            }
386        }
387
388        function _whichAnimationEvent() {
389            var t,
390                el = document.createElement("fakeelement");
391
392            var animations = {
393                "animation": "animationend",
394                "OAnimation": "oAnimationEnd",
395                "MozAnimation": "animationend",
396                "WebkitAnimation": "webkitAnimationEnd"
397            }
398
399            for (t in animations) {
400                if (el.style[t] !== undefined) {
401                    return animations[t];
402                }
403            }
404        }
405
406        function _getUniqueId() {
407            return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
408                var r = Math.random() * 16 | 0, v = c === 'x' ? r : (r & 0x3 | 0x8);
409                return v.toString(16);
410            });
411        }
412
413        //-----Public Functions------
414        return {
415            getZIndex: _getZIndex,
416            whichAnimationEvent: _whichAnimationEvent,
417            whichTransitionEvent: _whichTransitionEvent,
418            getUniqueId: _getUniqueId
419        }
420    }
421
422    return {
423        getInstance: function () {
424            if (!instance) { instance = constructor(); }
425            return instance;
426        }
427    };
428})(jQuery);
429Widgets.Utility = Widgets.Utility.getInstance();
430
431//Popup
432/*
433Usage:
434
435var popup = new Widgets.Popup({
436    container: ".content-id-or-class",
437    onshow: function (container) {
438        console.log('show: ', container);
439    },
440    onhide: function (container) {
441        console.log('hide: ', container);
442    }
443});
444
445popup.show();
446popup.close();
447*/
448Widgets.Popup = function (options) {
449
450    var _options = {
451        container: "",  //selector or element
452        animationClass: "", //separate with space
453        duration: 700,   //animate duration
454        onshow: "",
455        onhide: "",
456        modal: false,
457        adjustZIndex: 0,
458        closeOnBgClick: true,
459        zIndex: null   //use to overwrite auto zindex
460    };
461    
462    for (var o in options) if (typeof _options[o] !== undefined) _options[o] = options[o];
463
464    //clean up animationClass
465    _options.animationClass = _options.animationClass.replace(/\./, '');
466
467    var container = $(_options.container);
468    var containerParent = container.parent();
469    var isActive = false;
470    var isBusy = false;
471
472    if (container.length === 0)
473        return;
474
475    //var popup = $('.popup-outer');
476    //if (popup.length === 0) {
477        var popup = $('<div class="popup-outer" />');
478        $('body').append(popup);
479    //}
480
481    var close = $('<button class="ir popup-close">Close</button>');
482
483    $(document).off('keyup', _handleKeyup).on('keyup', _handleKeyup);
484    $(document).off('focusin.popup', _handleFocusin).on('focusin.popup', _handleFocusin);
485
486    function _handleFocusin(e) {
487        if (e.target !== container[0] && !$.contains(container[0], e.target)) {
488            close.focus();
489            return false;
490        }
491    }
492
493    function _handleKeyup(e) {
494        if (e.keyCode === 27) close.click();
495    }
496
497    function _getZIndex() {
498        var zIndex = 0;
499        $(document.body).children().each(function(){ 
500            var index = parseInt($(this).css('z-index'));
501            if(!isNaN(index) && index !=2147483647)
502                zIndex = Math.max(zIndex, index);
503        });
504        
505        //account for admin bar
506        var adminPanel = $('.admin_panel');
507        if (adminPanel.length !== 0) {
508            var adminPanelIndex = parseInt($('.admin_panel').css('z-index'));
509            zIndex = zIndex + 1 >= adminPanelIndex ? adminPanelIndex - 2 : zIndex;
510        }
511
512        return zIndex + 1 + _options.adjustZIndex;
513    }
514    
515    function _show() {
516        isBusy = true;
517        container.addClass('popup-inner ' + _options.animationClass).append(close);
518        popup.empty().append(container.detach().show());
519        popup.removeAttr('style').fadeIn('fast');
520
521        if (_options.zIndex !== null) 
522            popup.css('z-index', _options.zIndex);
523        else if (_options.modal)
524            popup.css('z-index', _getZIndex());
525        
526        setTimeout(function () {
527            container.addClass('active');
528        }, 0);
529
530        setTimeout(function () {
531            isBusy = false;
532        }, _options.duration);
533        
534        try {
535            if (typeof _options.onshow === "function")
536                _options.onshow(container);
537        } catch (err) { }
538
539        isActive = true;
540
541        close.off('click').click(function () {
542            var eleParent = $(this).parent();
543            closeWidget(eleParent);
544        });
545
546
547        if (_options.closeOnBgClick) {
548            popup.off('click').click(function () {
549                var ele = $(this);
550                closeWidget(ele.find(".popup-inner"));
551            });
552
553            popup.find('.popup-inner').off("click").click(function (e) {
554                e.stopImmediatePropagation();
555            });
556        }
557    }
558
559    function closeWidget(eleToClose){
560        eleToClose.removeClass('active');
561        popup.fadeOut(_options.duration);
562        isBusy = true;
563        setTimeout(_destroy, _options.duration);
564    }
565
566    function _destroy() {
567        container = popup.find('.popup-inner').detach();
568        container.removeClass('popup-inner ' + _options.animationClass).children('.popup-close').remove();
569        containerParent.append(container.removeAttr('style'));
570
571            try {
572                if (typeof _options.onhide === "function")
573                    _options.onhide(container);
574            } catch (err) { }
575
576            popup.remove();
577
578        isActive = false;
579        isBusy = false;
580    }
581
582    function _hide() {
583        if (isBusy) return;
584        close.click();
585    }
586
587    function _toggle() {
588        if (isBusy) return;
589
590        if (!isActive)
591            _show();
592        else
593            _hide();
594    }
595
596    return {
597        isActive: isActive,
598        toggle: _toggle,
599        show: _show,
600        hide: _hide,
601        destroy: _destroy   //same as hide but without animation
602    };
603}
604
605Widgets.LayerEvents = {
606    SHOW: 'Widgets.LayerEvents.SHOW',
607    HIDE: 'Widgets.LayerEvents.HIDE',
608    BEFORE_DESTROY: 'Widgets.LayerEvents.BEFORE_DESTROY',
609    AFTER_DESTROY: 'Widgets.LayerEvents.AFTER_DESTROY'
610};
611
612//TODO: instead of using duration to time the animation, use browser event for transition animation instead.
613//Bug: transitionend doesn't fire all the time for _destroy
614Widgets.LayerFactory = (function ($) {
615    var instance;
616    function constructor() {
617        var _vars = {
618            holder: $('.hdm-layer-holder'),
619            layers: []
620        };
621
622        function _createLayer(options) {
623            var rand = Math.random().toString().replace('.', '');
624            var layerElement = $('<div class="hdm-layer" id="hdm-layer-' + rand + '" />');
625            _vars.holder.append(layerElement);
626
627            options["layer"] = layerElement;
628
629            var layer = new Widgets.Layer(options);
630            layer.options = options;
631            _vars.layers.push(layer);
632            return layer;
633        }
634
635        function _removeLayer(e) {
636            if (_vars.layers.length === 0) return;
637
638            var layer = _vars.layers[_vars.layers.length - 1];
639            var onBeforeClose = layer.getOnBeforeClose();
640            if (layer.isCloseOnBgClick()) {
641                if (typeof onBeforeClose === 'function') {
642                    if (onBeforeClose()) layer.destroy(e);
643                }
644                else {
645                    layer.destroy(e);
646                }
647            }
648                
649        }
650
651        function _destroy() {
652            for (var k in _vars) {
653                _vars[k] = null;
654            }
655        }
656
657        (function init() {
658            if (_vars.holder.length === 0) {
659                _vars.holder = $('<div class="hdm-layer-holder" />');
660                $(document.body).append(_vars.holder);
661            }
662
663            $(document.body).on('click', '.hdm-layer-holder', _removeLayer);
664
665            $(document)
666                .on(Widgets.LayerEvents.SHOW, function () {
667                    _vars.holder.addClass('active');
668                    _vars.holder.css('z-index', Widgets.Utility.getZIndex()); //always put holder in focus if it's being used
669
670                    //set the layer below to be inactive
671                    if (_vars.layers.length > 1) {
672                        _vars.layers[_vars.layers.length - 2].hide();
673                    }
674                })
675                .on(Widgets.LayerEvents.BEFORE_DESTROY, function () {
676                    _vars.layers.pop();
677
678                    if (_vars.layers.length > 0) {
679                        _vars.layers[_vars.layers.length - 1].focus();
680                    }
681                    else {
682                        //_vars.holder.fadeOut(700, function () {
683                        //    _vars.holder.toggleClass('active', _vars.layers != 0).removeAttr('style');
684                        //});
685
686                        _vars.holder.toggleClass('active', _vars.layers !== 0);
687                        setTimeout(function () {
688                            _vars.holder.removeAttr('style');
689                        }, 900);
690                    }
691
692                })
693                .on(Widgets.LayerEvents.AFTER_DESTROY, function () {
694
695                });
696        })();
697
698        //-----Public Functions------
699        return {
700            createLayer: _createLayer
701        };
702    }
703
704    return {
705        getInstance: function () {
706            if (!instance) { instance = constructor(); }
707            return instance;
708        }
709    };
710})(jQuery);
711Widgets.LayerFactory = Widgets.LayerFactory.getInstance();
712
713Widgets.Layer = function (options) {
714    var _options = {
715        container: "",  //selector or element
716        close: "",
717        animationClass: "", //separate with space
718        duration: 500,   //animate duration
719        onShow: "",
720        onHide: "",
721        onActive: "",
722        onBeforeClose: null,
723        //modal: false,
724        //adjustZIndex: 0,
725        closeOnBgClick: false,
726        layer: null     //layer element
727    }
728    for (var o in options) if (typeof (_options[o]) !== "undefined") _options[o] = options[o];
729
730    var container = _options.container;
731
732    if (!_options.container instanceof jQuery)
733        container = $(_options.container);
734
735    var containerParent = container.parent();
736    var isActive = false;
737    var isBusy = false;
738
739    (function init() {
740
741        if (_options.close !== "") {
742            $(document.body).on('click', '#' + _options.layer.attr('id') + " " + _options.close, function (e) {
743                if (typeof _options.onBeforeClose === 'function') {
744                    if (_options.onBeforeClose()) _destroy(e);
745                }
746                else {
747                    _destroy(e);
748                }
749            });
750        }
751
752        if (_options.closeOnBgClick) {
753            $(document.body).on('click', '#' + _options.layer.attr('id'), function (e) {
754                var ele = $(this);
755                if (ele.hasClass('active')) {
756                    e.stopImmediatePropagation();
757                }
758            });
759        }
760    })();
761
762    function _focus() {
763        _options.layer.removeClass('inactive').addClass('active');
764        try {
765            if (typeof _options.onActive === "function")
766                _options.onActive(container);
767        } catch (err) { }
768    }
769
770    function _show() {
771        $(document).trigger(Widgets.LayerEvents.SHOW);
772
773        isBusy = true;
774
775        setTimeout(function () {
776            isBusy = false;
777        }, _options.duration);
778
779        //holder.addClass('active').children('.active').removeClass('active').addClass('inactive');    //toggle all active layers to be inactive
780        setTimeout(function () {
781            _options.layer.removeClass('inactive').append(container.detach().show()).addClass('active');
782        }, 1);
783
784        try {
785            if (typeof _options.onShow === "function")
786                _options.onShow(container);
787        } catch (err) { }
788
789        return this;
790    }
791
792    function _isCloseOnBgClick() {
793        return _options.closeOnBgClick;
794    }
795
796    function _getOnBeforeClose() {
797        return _options.onBeforeClose;
798    }
799
800    function _destroy(e) {
801        if (isBusy) {
802            return;
803        }
804        if (e) {
805            e.stopPropagation();
806        }
807
808        $(document).trigger(Widgets.LayerEvents.BEFORE_DESTROY);
809        isBusy = true;
810        _options.layer.removeClass('active');
811
812        setTimeout(function () {
813            container = _options.layer.children().detach();
814            //container.removeClass('popup-inner ' + _options.animationClass).children('.close').remove();
815            containerParent.append(container.removeAttr('style'));
816
817            try {
818                if (typeof _options.onHide === "function")
819                    _options.onHide(container);
820            } catch (err) { }
821
822            _options.layer.remove();
823
824            _reset();
825            $(document).trigger(Widgets.LayerEvents.AFTER_DESTROY);
826
827        }, _options.duration);
828    }
829
830    function _reset() {
831        for (var k in _options) {
832            _options[k] = null;
833        }
834        container = null;
835        containerParent = null;
836        isActive = false;
837        isBusy = false;
838    }
839
840    function _hide() {
841        _options.layer.removeClass('active').addClass('inactive');
842    }
843
844    return {
845        //isActive: isActive,
846        //container: _options.container,
847        isCloseOnBgClick: _isCloseOnBgClick,
848        getOnBeforeClose: _getOnBeforeClose,
849        focus: _focus,
850        show: _show,
851        hide: _hide,
852        destroy: _destroy
853    };
854};
855ImageUtility = {
856    getNewImage: function (container, src, imageWidth, imageHeight) {
857        if (!src || src === '') return;
858
859        var width = $(container).width();
860
861        if (width > 1440 && width <= 1600) width = 1600;
862        else if (width > 1280 && width <= 1440) width = 1440;
863        else if (width > 640 && width <= 1280) width = 1280;
864        else if (width <= 640) width = 640;
865        else return src;
866
867        if (width >= imageWidth) return src;
868
869        var height = Math.round((width / imageWidth) * imageHeight);
870        var path = width + 'x' + height + '/';
871
872        var temp = src.split('/');
873        var filename = src;
874        if (temp.length > 0)
875            filename = temp[temp.length - 1];
876
877        return src.replace(filename, path + filename);
878    },
879    preloadNewImage: function (container, ele, imageWidth, imageHeight) {
880        container = $(container);
881        var dataImage = ele.attr('data-image');
882        var newImagePath = ImageUtility.getNewImage(container, dataImage, imageWidth, imageHeight);
883        if (dataImage) {
884            $('<img/>').load(function () {
885                ele.css('background-image', 'url(' + newImagePath + ')');
886            }).error(function () {
887                ele.css('background-image', 'url(' + dataImage + ')');
888            }).attr('src', newImagePath);
889        }
890    },
891    preloadBackgroundImage: function ($ele) {
892        var $link = $ele.children('a');
893        if ($link.length !== 0) {
894            var imagePath = $link.attr('href');
895            $('<img/>').on('load', function () {
896                $ele.css('background-image', "url('" + this.src + "')").removeClass('preload-image');
897            }).attr('src', imagePath);
898        }
899    },
900    preloadImage: function ($ele) {
901        var $link = $ele.children('a');
902        if ($link.length !== 0) {
903            var imagePath = $link.attr('href');
904            $('<img/>').on('load', function () {
905                $ele.prepend('<img src="' + this.src + '" alt="" />').removeClass('preload-image');
906            }).attr('src', imagePath);
907        }
908    }
909};
910!function(){"use strict";if("object"==typeof window)if("IntersectionObserver"in window&&"IntersectionObserverEntry"in window&&"intersectionRatio"in window.IntersectionObserverEntry.prototype)"isIntersecting"in window.IntersectionObserverEntry.prototype||Object.defineProperty(window.IntersectionObserverEntry.prototype,"isIntersecting",{get:function(){return this.intersectionRatio>0}});else{var t=window.document,e=[];o.prototype.THROTTLE_TIMEOUT=100,o.prototype.POLL_INTERVAL=null,o.prototype.USE_MUTATION_OBSERVER=!0,o.prototype.observe=function(t){if(!this._observationTargets.some(function(e){return e.element==t})){if(!t||1!=t.nodeType)throw new Error("target must be an Element");this._registerInstance(),this._observationTargets.push({element:t,entry:null}),this._monitorIntersections(),this._checkForIntersections()}},o.prototype.unobserve=function(t){this._observationTargets=this._observationTargets.filter(function(e){return e.element!=t}),this._observationTargets.length||(this._unmonitorIntersections(),this._unregisterInstance())},o.prototype.disconnect=function(){this._observationTargets=[],this._unmonitorIntersections(),this._unregisterInstance()},o.prototype.takeRecords=function(){var t=this._queuedEntries.slice();return this._queuedEntries=[],t},o.prototype._initThresholds=function(t){var e=t||[0];return Array.isArray(e)||(e=[e]),e.sort().filter(function(t,e,n){if("number"!=typeof t||isNaN(t)||t<0||t>1)throw new Error("threshold must be a number between 0 and 1 inclusively");return t!==n[e-1]})},o.prototype._parseRootMargin=function(t){var e=(t||"0px").split(/\s+/).map(function(t){var e=/^(-?\d*\.?\d+)(px|%)$/.exec(t);if(!e)throw new Error("rootMargin must be specified in pixels or percent");return{value:parseFloat(e[1]),unit:e[2]}});return e[1]=e[1]||e[0],e[2]=e[2]||e[0],e[3]=e[3]||e[1],e},o.prototype._monitorIntersections=function(){this._monitoringIntersections||(this._monitoringIntersections=!0,this.POLL_INTERVAL?this._monitoringInterval=setInterval(this._checkForIntersections,this.POLL_INTERVAL):(i(window,"resize",this._checkForIntersections,!0),i(t,"scroll",this._checkForIntersections,!0),this.USE_MUTATION_OBSERVER&&"MutationObserver"in window&&(this._domObserver=new MutationObserver(this._checkForIntersections),this._domObserver.observe(t,{attributes:!0,childList:!0,characterData:!0,subtree:!0}))))},o.prototype._unmonitorIntersections=function(){this._monitoringIntersections&&(this._monitoringIntersections=!1,clearInterval(this._monitoringInterval),this._monitoringInterval=null,r(window,"resize",this._checkForIntersections,!0),r(t,"scroll",this._checkForIntersections,!0),this._domObserver&&(this._domObserver.disconnect(),this._domObserver=null))},o.prototype._checkForIntersections=function(){var t=this._rootIsInDom(),e=t?this._getRootRect():{top:0,bottom:0,left:0,right:0,width:0,height:0};
910this._observationTargets.forEach(function(o){var i=o.element,r=s(i),h=this._rootContainsTarget(i),c=o.entry,a=t&&h&&this._computeTargetAndRootIntersection(i,e),u=o.entry=new n({time:window.performance&&performance.now&&performance.now(),target:i,boundingClientRect:r,rootBounds:e,intersectionRect:a});c?t&&h?this._hasCrossedThreshold(c,u)&&this._queuedEntries.push(u):c&&c.isIntersecting&&this._queuedEntries.push(u):this._queuedEntries.push(u)},this),this._queuedEntries.length&&this._callback(this.takeRecords(),this)},o.prototype._computeTargetAndRootIntersection=function(e,n){if("none"!=window.getComputedStyle(e).display){for(var o,i,r,h,a,u,d,l,p=s(e),f=c(e),g=!1;!g;){var _=null,v=1==f.nodeType?window.getComputedStyle(f):{};if("none"==v.display)return;if(f==this.root||f==t?(g=!0,_=n):f!=t.body&&f!=t.documentElement&&"visible"!=v.overflow&&(_=s(f)),_&&(o=_,i=p,r=void 0,h=void 0,a=void 0,u=void 0,d=void 0,l=void 0,r=Math.max(o.top,i.top),h=Math.min(o.bottom,i.bottom),a=Math.max(o.left,i.left),u=Math.min(o.right,i.right),l=h-r,!(p=(d=u-a)>=0&&l>=0&&{top:r,bottom:h,left:a,right:u,width:d,height:l})))break;f=c(f)}return p}},o.prototype._getRootRect=function(){var e;if(this.root)e=s(this.root);else{var n=t.documentElement,o=t.body;e={top:0,left:0,right:n.clientWidth||o.clientWidth,width:n.clientWidth||o.clientWidth,bottom:n.clientHeight||o.clientHeight,height:n.clientHeight||o.clientHeight}}return this._expandRectByRootMargin(e)},o.prototype._expandRectByRootMargin=function(t){var e=this._rootMarginValues.map(function(e,n){return"px"==e.unit?e.value:e.value*(n%2?t.width:t.height)/100}),n={top:t.top-e[0],right:t.right+e[1],bottom:t.bottom+e[2],left:t.left-e[3]};return n.width=n.right-n.left,n.height=n.bottom-n.top,n},o.prototype._hasCrossedThreshold=function(t,e){var n=t&&t.isIntersecting?t.intersectionRatio||0:-1,o=e.isIntersecting?e.intersectionRatio||0:-1;if(n!==o)for(var i=0;i<this.thresholds.length;i++){var r=this.thresholds[i];if(r==n||r==o||r<n!=r<o)return!0}},o.prototype._rootIsInDom=function(){return!this.root||h(t,this.root)},o.prototype._rootContainsTarget=function(e){return h(this.root||t,e)},o.prototype._registerInstance=function(){e.indexOf(this)<0&&e.push(this)},o.prototype._unregisterInstance=function(){var t=e.indexOf(this);-1!=t&&e.splice(t,1)},window.IntersectionObserver=o,window.IntersectionObserverEntry=n}function n(t){this.time=t.time,this.target=t.target,this.rootBounds=t.rootBounds,this.boundingClientRect=t.boundingClientRect,this.intersectionRect=t.intersectionRect||{top:0,bottom:0,left:0,right:0,width:0,height:0},this.isIntersecting=!!t.intersectionRect;var e=this.boundingClientRect,n=e.width*e.height,o=this.intersectionRect,i=o.width*o.height;this.intersectionRatio=n?Number((i/n).toFixed(4)):this.isIntersecting?1:0}function o(t,e){var n,o,i,r=e||{};if("function"!=typeof t)throw new Error("callback must be a function");if(r.root&&1!=r.root.nodeType)throw new Error("root must be an Element");this._checkForIntersections=(n=this._checkForIntersections.bind(this),o=this.THROTTLE_TIMEOUT,i=null,function(){i||(i=setTimeout(function(){n(),i=null},o))}),this._callback=t,this._observationTargets=[],this._queuedEntries=[],this._rootMarginValues=this._parseRootMargin(r.rootMargin),this.thresholds=this._initThresholds(r.threshold),this.root=r.root||null,this.rootMargin=this._rootMarginValues.map(function(t){return t.value+t.unit}).join(" ")}function i(t,e,n,o){"function"==typeof t.addEventListener?t.addEventListener(e,n,o||!1):"function"==typeof t.attachEvent&&t.attachEvent("on"+e,n)}function r(t,e,n,o){"function"==typeof t.removeEventListener?t.removeEventListener(e,n,o||!1):"function"==typeof t.detatchEvent&&t.detatchEvent("on"+e,n)}function s(t){var e;try{e=t.getBoundingClientRect()}catch(t){}return e?(e.width&&e.height||(e={top:e.top,right:e.right,bottom:e.bottom,left:e.left,width:e.right-e.left,height:e.bottom-e.top}),e):{top:0,bottom:0,left:0,right:0,width:0,height:0}}function h(t,e){for(var n=e;n;){if(n==t)return!0;n=c(n)}return!1}function c(t){var e=t.parentNode;return e&&11==e.nodeType&&e.host?e.host:e&&e.assignedSlot?e.assignedSlot.parentNode:e}}();;
911/*! Magnific Popup - v1.1.0 - 2016-02-20
vendor: 39,639 bytes, lines 912-2615
912* http://dimsemenov.com/plugins/magnific-popup/
913* Copyright (c) 2016 Dmitry Semenov; */
914;(function (factory) { 
915if (typeof define === 'function' && define.amd) { 
916 // AMD. Register as an anonymous module. 
917 define(['jquery'], factory); 
918 } else if (typeof exports === 'object') { 
919 // Node/CommonJS 
920 factory(require('jquery')); 
921 } else { 
922 // Browser globals 
923 factory(window.jQuery || window.Zepto); 
924 } 
925 }(function($) { 
926
927/*>>core*/
928/**
929 * 
930 * Magnific Popup Core JS file
931 * 
932 */
933
934
935/**
936 * Private static constants
937 */
938var CLOSE_EVENT = 'Close',
939	BEFORE_CLOSE_EVENT = 'BeforeClose',
940	AFTER_CLOSE_EVENT = 'AfterClose',
941	BEFORE_APPEND_EVENT = 'BeforeAppend',
942	MARKUP_PARSE_EVENT = 'MarkupParse',
943	OPEN_EVENT = 'Open',
944	CHANGE_EVENT = 'Change',
945	NS = 'mfp',
946	EVENT_NS = '.' + NS,
947	READY_CLASS = 'mfp-ready',
948	REMOVING_CLASS = 'mfp-removing',
949	PREVENT_CLOSE_CLASS = 'mfp-prevent-close';
950
951
952/**
953 * Private vars 
954 */
955/*jshint -W079 */
956var mfp, // As we have only one instance of MagnificPopup object, we define it locally to not to use 'this'
957	MagnificPopup = function(){},
958	_isJQ = !!(window.jQuery),
959	_prevStatus,
960	_window = $(window),
961	_document,
962	_prevContentType,
963	_wrapClasses,
964	_currPopupType;
965
966
967/**
968 * Private functions
969 */
970var _mfpOn = function(name, f) {
971		mfp.ev.on(NS + name + EVENT_NS, f);
972	},
973	_getEl = function(className, appendTo, html, raw) {
974		var el = document.createElement('div');
975		el.className = 'mfp-'+className;
976		if(html) {
977			el.innerHTML = html;
978		}
979		if(!raw) {
980			el = $(el);
981			if(appendTo) {
982				el.appendTo(appendTo);
983			}
984		} else if(appendTo) {
985			appendTo.appendChild(el);
986		}
987		return el;
988	},
989	_mfpTrigger = function(e, data) {
990		mfp.ev.triggerHandler(NS + e, data);
991
992		if(mfp.st.callbacks) {
993			// converts "mfpEventName" to "eventName" callback and triggers it if it's present
994			e = e.charAt(0).toLowerCase() + e.slice(1);
995			if(mfp.st.callbacks[e]) {
996				mfp.st.callbacks[e].apply(mfp, $.isArray(data) ? data : [data]);
997			}
998		}
999	},
1000	_getCloseBtn = function(type) {
1001		if(type !== _currPopupType || !mfp.currTemplate.closeBtn) {
1002			mfp.currTemplate.closeBtn = $( mfp.st.closeMarkup.replace('%title%', mfp.st.tClose ) );
1003			_currPopupType = type;
1004		}
1005		return mfp.currTemplate.closeBtn;
1006	},
1007	// Initialize Magnific Popup only when called at least once
1008	_checkInstance = function() {
1009		if(!$.magnificPopup.instance) {
1010			/*jshint -W020 */
1011			mfp = new MagnificPopup();
1012			mfp.init();
1013			$.magnificPopup.instance = mfp;
1014		}
1015	},
1016	// CSS transition detection, http://stackoverflow.com/questions/7264899/detect-css-transitions-using-javascript-and-without-modernizr
1017	supportsTransitions = function() {
1018		var s = document.createElement('p').style, // 's' for style. better to create an element if body yet to exist
1019			v = ['ms','O','Moz','Webkit']; // 'v' for vendor
1020
1021		if( s['transition'] !== undefined ) {
1022			return true; 
1023		}
1024			
1025		while( v.length ) {
1026			if( v.pop() + 'Transition' in s ) {
1027				return true;
1028			}
1029		}
1030				
1031		return false;
1032	};
1033
1034
1035
1036/**
1037 * Public functions
1038 */
1039MagnificPopup.prototype = {
1040
1041	constructor: MagnificPopup,
1042
1043	/**
1044	 * Initializes Magnific Popup plugin. 
1045	 * This function is triggered only once when $.fn.magnificPopup or $.magnificPopup is executed
1046	 */
1047	init: function() {
1048		var appVersion = navigator.appVersion;
1049		mfp.isLowIE = mfp.isIE8 = document.all && !document.addEventListener;
1050		mfp.isAndroid = (/android/gi).test(appVersion);
1051		mfp.isIOS = (/iphone|ipad|ipod/gi).test(appVersion);
1052		mfp.supportsTransition = supportsTransitions();
1053
1054		// We disable fixed positioned lightbox on devices that don't handle it nicely.
1055		// If you know a better way of detecting this - let me know.
1056		mfp.probablyMobile = (mfp.isAndroid || mfp.isIOS || /(Opera Mini)|Kindle|webOS|BlackBerry|(Opera Mobi)|(Windows Phone)|IEMobile/i.test(navigator.userAgent) );
1057		_document = $(document);
1058
1059		mfp.popupsCache = {};
1060	},
1061
1062	/**
1063	 * Opens popup
1064	 * @param  data [description]
1065	 */
1066	open: function(data) {
1067
1068		var i;
1069
1070		if(data.isObj === false) { 
1071			// convert jQuery collection to array to avoid conflicts later
1072			mfp.items = data.items.toArray();
1073
1074			mfp.index = 0;
1075			var items = data.items,
1076				item;
1077			for(i = 0; i < items.length; i++) {
1078				item = items[i];
1079				if(item.parsed) {
1080					item = item.el[0];
1081				}
1082				if(item === data.el[0]) {
1083					mfp.index = i;
1084					break;
1085				}
1086			}
1087		} else {
1088			mfp.items = $.isArray(data.items) ? data.items : [data.items];
1089			mfp.index = data.index || 0;
1090		}
1091
1092		// if popup is already opened - we just update the content
1093		if(mfp.isOpen) {
1094			mfp.updateItemHTML();
1095			return;
1096		}
1097		
1098		mfp.types = []; 
1099		_wrapClasses = '';
1100		if(data.mainEl && data.mainEl.length) {
1101			mfp.ev = data.mainEl.eq(0);
1102		} else {
1103			mfp.ev = _document;
1104		}
1105
1106		if(data.key) {
1107			if(!mfp.popupsCache[data.key]) {
1108				mfp.popupsCache[data.key] = {};
1109			}
1110			mfp.currTemplate = mfp.popupsCache[data.key];
1111		} else {
1112			mfp.currTemplate = {};
1113		}
1114
1115
1116
1117		mfp.st = $.extend(true, {}, $.magnificPopup.defaults, data ); 
1118		mfp.fixedContentPos = mfp.st.fixedContentPos === 'auto' ? !mfp.probablyMobile : mfp.st.fixedContentPos;
1119
1120		if(mfp.st.modal) {
1121			mfp.st.closeOnContentClick = false;
1122			mfp.st.closeOnBgClick = false;
1123			mfp.st.showCloseBtn = false;
1124			mfp.st.enableEscapeKey = false;
1125		}
1126		
1127
1128		// Building markup
1129		// main containers are created only once
1130		if(!mfp.bgOverlay) {
1131
1132			// Dark overlay
1133			mfp.bgOverlay = _getEl('bg').on('click'+EVENT_NS, function() {
1134				mfp.close();
1135			});
1136
1137			mfp.wrap = _getEl('wrap').attr('tabindex', -1).on('click'+EVENT_NS, function(e) {
1138				if(mfp._checkIfClose(e.target)) {
1139					mfp.close();
1140				}
1141			});
1142
1143			mfp.container = _getEl('container', mfp.wrap);
1144		}
1145
1146		mfp.contentContainer = _getEl('content');
1147		if(mfp.st.preloader) {
1148			mfp.preloader = _getEl('preloader', mfp.container, mfp.st.tLoading);
1149		}
1150
1151
1152		// Initializing modules
1153		var modules = $.magnificPopup.modules;
1154		for(i = 0; i < modules.length; i++) {
1155			var n = modules[i];
1156			n = n.charAt(0).toUpperCase() + n.slice(1);
1157			mfp['init'+n].call(mfp);
1158		}
1159		_mfpTrigger('BeforeOpen');
1160
1161
1162		if(mfp.st.showCloseBtn) {
1163			// Close button
1164			if(!mfp.st.closeBtnInside) {
1165				mfp.wrap.append( _getCloseBtn() );
1166			} else {
1167				_mfpOn(MARKUP_PARSE_EVENT, function(e, template, values, item) {
1168					values.close_replaceWith = _getCloseBtn(item.type);
1169				});
1170				_wrapClasses += ' mfp-close-btn-in';
1171			}
1172		}
1173
1174		if(mfp.st.alignTop) {
1175			_wrapClasses += ' mfp-align-top';
1176		}
1177
1178	
1179
1180		if(mfp.fixedContentPos) {
1181			mfp.wrap.css({
1182				overflow: mfp.st.overflowY,
1183				overflowX: 'hidden',
1184				overflowY: mfp.st.overflowY
1185			});
1186		} else {
1187			mfp.wrap.css({ 
1188				top: _window.scrollTop(),
1189				position: 'absolute'
1190			});
1191		}
1192		if( mfp.st.fixedBgPos === false || (mfp.st.fixedBgPos === 'auto' && !mfp.fixedContentPos) ) {
1193			mfp.bgOverlay.css({
1194				height: _document.height(),
1195				position: 'absolute'
1196			});
1197		}
1198
1199		
1200
1201		if(mfp.st.enableEscapeKey) {
1202			// Close on ESC key
1203			_document.on('keyup' + EVENT_NS, function(e) {
1204				if(e.keyCode === 27) {
1205					mfp.close();
1206				}
1207			});
1208		}
1209
1210		_window.on('resize' + EVENT_NS, function() {
1211			mfp.updateSize();
1212		});
1213
1214
1215		if(!mfp.st.closeOnContentClick) {
1216			_wrapClasses += ' mfp-auto-cursor';
1217		}
1218		
1219		if(_wrapClasses)
1220			mfp.wrap.addClass(_wrapClasses);
1221
1222
1223		// this triggers recalculation of layout, so we get it once to not to trigger twice
1224		var windowHeight = mfp.wH = _window.height();
1225
1226		
1227		var windowStyles = {};
1228
1229		if( mfp.fixedContentPos ) {
1230            if(mfp._hasScrollBar(windowHeight)){
1231                var s = mfp._getScrollbarSize();
1232                if(s) {
1233                    windowStyles.marginRight = s;
1234                }
1235            }
1236        }
1237
1238		if(mfp.fixedContentPos) {
1239			if(!mfp.isIE7) {
1240				windowStyles.overflow = 'hidden';
1241			} else {
1242				// ie7 double-scroll bug
1243				$('body, html').css('overflow', 'hidden');
1244			}
1245		}
1246
1247		
1248		
1249		var classesToadd = mfp.st.mainClass;
1250		if(mfp.isIE7) {
1251			classesToadd += ' mfp-ie7';
1252		}
1253		if(classesToadd) {
1254			mfp._addClassToMFP( classesToadd );
1255		}
1256
1257		// add content
1258		mfp.updateItemHTML();
1259
1260		_mfpTrigger('BuildControls');
1261
1262		// remove scrollbar, add margin e.t.c
1263		$('html').css(windowStyles);
1264		
1265		// add everything to DOM
1266		mfp.bgOverlay.add(mfp.wrap).prependTo( mfp.st.prependTo || $(document.body) );
1267
1268		// Save last focused element
1269		mfp._lastFocusedEl = document.activeElement;
1270		
1271		// Wait for next cycle to allow CSS transition
1272		setTimeout(function() {
1273			
1274			if(mfp.content) {
1275				mfp._addClassToMFP(READY_CLASS);
1276				mfp._setFocus();
1277			} else {
1278				// if content is not defined (not loaded e.t.c) we add class only for BG
1279				mfp.bgOverlay.addClass(READY_CLASS);
1280			}
1281			
1282			// Trap the focus in popup
1283			_document.on('focusin' + EVENT_NS, mfp._onFocusIn);
1284
1285		}, 16);
1286
1287		mfp.isOpen = true;
1288		mfp.updateSize(windowHeight);
1289		_mfpTrigger(OPEN_EVENT);
1290
1291		return data;
1292	},
1293
1294	/**
1295	 * Closes the popup
1296	 */
1297	close: function() {
1298		if(!mfp.isOpen) return;
1299		_mfpTrigger(BEFORE_CLOSE_EVENT);
1300
1301		mfp.isOpen = false;
1302		// for CSS3 animation
1303		if(mfp.st.removalDelay && !mfp.isLowIE && mfp.supportsTransition )  {
1304			mfp._addClassToMFP(REMOVING_CLASS);
1305			setTimeout(function() {
1306				mfp._close();
1307			}, mfp.st.removalDelay);
1308		} else {
1309			mfp._close();
1310		}
1311	},
1312
1313	/**
1314	 * Helper for close() function
1315	 */
1316	_close: function() {
1317		_mfpTrigger(CLOSE_EVENT);
1318
1319		var classesToRemove = REMOVING_CLASS + ' ' + READY_CLASS + ' ';
1320
1321		mfp.bgOverlay.detach();
1322		mfp.wrap.detach();
1323		mfp.container.empty();
1324
1325		if(mfp.st.mainClass) {
1326			classesToRemove += mfp.st.mainClass + ' ';
1327		}
1328
1329		mfp._removeClassFromMFP(classesToRemove);
1330
1331		if(mfp.fixedContentPos) {
1332			var windowStyles = {marginRight: ''};
1333			if(mfp.isIE7) {
1334				$('body, html').css('overflow', '');
1335			} else {
1336				windowStyles.overflow = '';
1337			}
1338			$('html').css(windowStyles);
1339		}
1340		
1341		_document.off('keyup' + EVENT_NS + ' focusin' + EVENT_NS);
1342		mfp.ev.off(EVENT_NS);
1343
1344		// clean up DOM elements that aren't removed
1345		mfp.wrap.attr('class', 'mfp-wrap').removeAttr('style');
1346		mfp.bgOverlay.attr('class', 'mfp-bg');
1347		mfp.container.attr('class', 'mfp-container');
1348
1349		// remove close button from target element
1350		if(mfp.st.showCloseBtn &&
1351		(!mfp.st.closeBtnInside || mfp.currTemplate[mfp.currItem.type] === true)) {
1352			if(mfp.currTemplate.closeBtn)
1353				mfp.currTemplate.closeBtn.detach();
1354		}
1355
1356
1357		if(mfp.st.autoFocusLast && mfp._lastFocusedEl) {
1358			$(mfp._lastFocusedEl).focus(); // put tab focus back
1359		}
1360		mfp.currItem = null;	
1361		mfp.content = null;
1362		mfp.currTemplate = null;
1363		mfp.prevHeight = 0;
1364
1365		_mfpTrigger(AFTER_CLOSE_EVENT);
1366	},
1367	
1368	updateSize: function(winHeight) {
1369
1370		if(mfp.isIOS) {
1371			// fixes iOS nav bars https://github.com/dimsemenov/Magnific-Popup/issues/2
1372			var zoomLevel = document.documentElement.clientWidth / window.innerWidth;
1373			var height = window.innerHeight * zoomLevel;
1374			mfp.wrap.css('height', height);
1375			mfp.wH = height;
1376		} else {
1377			mfp.wH = winHeight || _window.height();
1378		}
1379		// Fixes #84: popup incorrectly positioned with position:relative on body
1380		if(!mfp.fixedContentPos) {
1381			mfp.wrap.css('height', mfp.wH);
1382		}
1383
1384		_mfpTrigger('Resize');
1385
1386	},
1387
1388	/**
1389	 * Set content of popup based on current index
1390	 */
1391	updateItemHTML: function() {
1392		var item = mfp.items[mfp.index];
1393
1394		// Detach and perform modifications
1395		mfp.contentContainer.detach();
1396
1397		if(mfp.content)
1398			mfp.content.detach();
1399
1400		if(!item.parsed) {
1401			item = mfp.parseEl( mfp.index );
1402		}
1403
1404		var type = item.type;
1405
1406		_mfpTrigger('BeforeChange', [mfp.currItem ? mfp.currItem.type : '', type]);
1407		// BeforeChange event works like so:
1408		// _mfpOn('BeforeChange', function(e, prevType, newType) { });
1409
1410		mfp.currItem = item;
1411
1412		if(!mfp.currTemplate[type]) {
1413			var markup = mfp.st[type] ? mfp.st[type].markup : false;
1414
1415			// allows to modify markup
1416			_mfpTrigger('FirstMarkupParse', markup);
1417
1418			if(markup) {
1419				mfp.currTemplate[type] = $(markup);
1420			} else {
1421				// if there is no markup found we just define that template is parsed
1422				mfp.currTemplate[type] = true;
1423			}
1424		}
1425
1426		if(_prevContentType && _prevContentType !== item.type) {
1427			mfp.container.removeClass('mfp-'+_prevContentType+'-holder');
1428		}
1429
1430		var newContent = mfp['get' + type.charAt(0).toUpperCase() + type.slice(1)](item, mfp.currTemplate[type]);
1431		mfp.appendContent(newContent, type);
1432
1433		item.preloaded = true;
1434
1435		_mfpTrigger(CHANGE_EVENT, item);
1436		_prevContentType = item.type;
1437
1438		// Append container back after its content changed
1439		mfp.container.prepend(mfp.contentContainer);
1440
1441		_mfpTrigger('AfterChange');
1442	},
1443
1444
1445	/**
1446	 * Set HTML content of popup
1447	 */
1448	appendContent: function(newContent, type) {
1449		mfp.content = newContent;
1450
1451		if(newContent) {
1452			if(mfp.st.showCloseBtn && mfp.st.closeBtnInside &&
1453				mfp.currTemplate[type] === true) {
1454				// if there is no markup, we just append close button element inside
1455				if(!mfp.content.find('.mfp-close').length) {
1456					mfp.content.append(_getCloseBtn());
1457				}
1458			} else {
1459				mfp.content = newContent;
1460			}
1461		} else {
1462			mfp.content = '';
1463		}
1464
1465		_mfpTrigger(BEFORE_APPEND_EVENT);
1466		mfp.container.addClass('mfp-'+type+'-holder');
1467
1468		mfp.contentContainer.append(mfp.content);
1469	},
1470
1471
1472	/**
1473	 * Creates Magnific Popup data object based on given data
1474	 * @param  {int} index Index of item to parse
1475	 */
1476	parseEl: function(index) {
1477		var item = mfp.items[index],
1478			type;
1479
1480		if(item.tagName) {
1481			item = { el: $(item) };
1482		} else {
1483			type = item.type;
1484			item = { data: item, src: item.src };
1485		}
1486
1487		if(item.el) {
1488			var types = mfp.types;
1489
1490			// check for 'mfp-TYPE' class
1491			for(var i = 0; i < types.length; i++) {
1492				if( item.el.hasClass('mfp-'+types[i]) ) {
1493					type = types[i];
1494					break;
1495				}
1496			}
1497
1498			item.src = item.el.attr('data-mfp-src');
1499			if(!item.src) {
1500				item.src = item.el.attr('href');
1501			}
1502		}
1503
1504		item.type = type || mfp.st.type || 'inline';
1505		item.index = index;
1506		item.parsed = true;
1507		mfp.items[index] = item;
1508		_mfpTrigger('ElementParse', item);
1509
1510		return mfp.items[index];
1511	},
1512
1513
1514	/**
1515	 * Initializes single popup or a group of popups
1516	 */
1517	addGroup: function(el, options) {
1518		var eHandler = function(e) {
1519			e.mfpEl = this;
1520			mfp._openClick(e, el, options);
1521		};
1522
1523		if(!options) {
1524			options = {};
1525		}
1526
1527		var eName = 'click.magnificPopup';
1528		options.mainEl = el;
1529
1530		if(options.items) {
1531			options.isObj = true;
1532			el.off(eName).on(eName, eHandler);
1533		} else {
1534			options.isObj = false;
1535			if(options.delegate) {
1536				el.off(eName).on(eName, options.delegate , eHandler);
1537			} else {
1538				options.items = el;
1539				el.off(eName).on(eName, eHandler);
1540			}
1541		}
1542	},
1543	_openClick: function(e, el, options) {
1544		var midClick = options.midClick !== undefined ? options.midClick : $.magnificPopup.defaults.midClick;
1545
1546
1547		if(!midClick && ( e.which === 2 || e.ctrlKey || e.metaKey || e.altKey || e.shiftKey ) ) {
1548			return;
1549		}
1550
1551		var disableOn = options.disableOn !== undefined ? options.disableOn : $.magnificPopup.defaults.disableOn;
1552
1553		if(disableOn) {
1554			if($.isFunction(disableOn)) {
1555				if( !disableOn.call(mfp) ) {
1556					return true;
1557				}
1558			} else { // else it's number
1559				if( _window.width() < disableOn ) {
1560					return true;
1561				}
1562			}
1563		}
1564
1565		if(e.type) {
1566			e.preventDefault();
1567
1568			// This will prevent popup from closing if element is inside and popup is already opened
1569			if(mfp.isOpen) {
1570				e.stopPropagation();
1571			}
1572		}
1573
1574		options.el = $(e.mfpEl);
1575		if(options.delegate) {
1576			options.items = el.find(options.delegate);
1577		}
1578		mfp.open(options);
1579	},
1580
1581
1582	/**
1583	 * Updates text on preloader
1584	 */
1585	updateStatus: function(status, text) {
1586
1587		if(mfp.preloader) {
1588			if(_prevStatus !== status) {
1589				mfp.container.removeClass('mfp-s-'+_prevStatus);
1590			}
1591
1592			if(!text && status === 'loading') {
1593				text = mfp.st.tLoading;
1594			}
1595
1596			var data = {
1597				status: status,
1598				text: text
1599			};
1600			// allows to modify status
1601			_mfpTrigger('UpdateStatus', data);
1602
1603			status = data.status;
1604			text = data.text;
1605
1606			mfp.preloader.html(text);
1607
1608			mfp.preloader.find('a').on('click', function(e) {
1609				e.stopImmediatePropagation();
1610			});
1611
1612			mfp.container.addClass('mfp-s-'+status);
1613			_prevStatus = status;
1614		}
1615	},
1616
1617
1618	/*
1619		"Private" helpers that aren't private at all
1620	 */
1621	// Check to close popup or not
1622	// "target" is an element that was clicked
1623	_checkIfClose: function(target) {
1624
1625		if($(target).hasClass(PREVENT_CLOSE_CLASS)) {
1626			return;
1627		}
1628
1629		var closeOnContent = mfp.st.closeOnContentClick;
1630		var closeOnBg = mfp.st.closeOnBgClick;
1631
1632		if(closeOnContent && closeOnBg) {
1633			return true;
1634		} else {
1635
1636			// We close the popup if click is on close button or on preloader. Or if there is no content.
1637			if(!mfp.content || $(target).hasClass('mfp-close') || (mfp.preloader && target === mfp.preloader[0]) ) {
1638				return true;
1639			}
1640
1641			// if click is outside the content
1642			if(  (target !== mfp.content[0] && !$.contains(mfp.content[0], target))  ) {
1643				if(closeOnBg) {
1644					// last check, if the clicked element is in DOM, (in case it's removed onclick)
1645					if( $.contains(document, target) ) {
1646						return true;
1647					}
1648				}
1649			} else if(closeOnContent) {
1650				return true;
1651			}
1652
1653		}
1654		return false;
1655	},
1656	_addClassToMFP: function(cName) {
1657		mfp.bgOverlay.addClass(cName);
1658		mfp.wrap.addClass(cName);
1659	},
1660	_removeClassFromMFP: function(cName) {
1661		this.bgOverlay.removeClass(cName);
1662		mfp.wrap.removeClass(cName);
1663	},
1664	_hasScrollBar: function(winHeight) {
1665		return (  (mfp.isIE7 ? _document.height() : document.body.scrollHeight) > (winHeight || _window.height()) );
1666	},
1667	_setFocus: function() {
1668		(mfp.st.focus ? mfp.content.find(mfp.st.focus).eq(0) : mfp.wrap).focus();
1669	},
1670	_onFocusIn: function(e) {
1671		if( e.target !== mfp.wrap[0] && !$.contains(mfp.wrap[0], e.target) ) {
1672			mfp._setFocus();
1673			return false;
1674		}
1675	},
1676	_parseMarkup: function(template, values, item) {
1677		var arr;
1678		if(item.data) {
1679			values = $.extend(item.data, values);
1680		}
1681		_mfpTrigger(MARKUP_PARSE_EVENT, [template, values, item] );
1682
1683		$.each(values, function(key, value) {
1684			if(value === undefined || value === false) {
1685				return true;
1686			}
1687			arr = key.split('_');
1688			if(arr.length > 1) {
1689				var el = template.find(EVENT_NS + '-'+arr[0]);
1690
1691				if(el.length > 0) {
1692					var attr = arr[1];
1693					if(attr === 'replaceWith') {
1694						if(el[0] !== value[0]) {
1695							el.replaceWith(value);
1696						}
1697					} else if(attr === 'img') {
1698						if(el.is('img')) {
1699							el.attr('src', value);
1700						} else {
1701							el.replaceWith( $('<img>').attr('src', value).attr('class', el.attr('class')) );
1702						}
1703					} else {
1704						el.attr(arr[1], value);
1705					}
1706				}
1707
1708			} else {
1709				template.find(EVENT_NS + '-'+key).html(value);
1710			}
1711		});
1712	},
1713
1714	_getScrollbarSize: function() {
1715		// thx David
1716		if(mfp.scrollbarSize === undefined) {
1717			var scrollDiv = document.createElement("div");
1718			scrollDiv.style.cssText = 'width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;';
1719			document.body.appendChild(scrollDiv);
1720			mfp.scrollbarSize = scrollDiv.offsetWidth - scrollDiv.clientWidth;
1721			document.body.removeChild(scrollDiv);
1722		}
1723		return mfp.scrollbarSize;
1724	}
1725
1726}; /* MagnificPopup core prototype end */
1727
1728
1729
1730
1731/**
1732 * Public static functions
1733 */
1734$.magnificPopup = {
1735	instance: null,
1736	proto: MagnificPopup.prototype,
1737	modules: [],
1738
1739	open: function(options, index) {
1740		_checkInstance();
1741
1742		if(!options) {
1743			options = {};
1744		} else {
1745			options = $.extend(true, {}, options);
1746		}
1747
1748		options.isObj = true;
1749		options.index = index || 0;
1750		return this.instance.open(options);
1751	},
1752
1753	close: function() {
1754		return $.magnificPopup.instance && $.magnificPopup.instance.close();
1755	},
1756
1757	registerModule: function(name, module) {
1758		if(module.options) {
1759			$.magnificPopup.defaults[name] = module.options;
1760		}
1761		$.extend(this.proto, module.proto);
1762		this.modules.push(name);
1763	},
1764
1765	defaults: {
1766
1767		// Info about options is in docs:
1768		// http://dimsemenov.com/plugins/magnific-popup/documentation.html#options
1769
1770		disableOn: 0,
1771
1772		key: null,
1773
1774		midClick: false,
1775
1776		mainClass: '',
1777
1778		preloader: true,
1779
1780		focus: '', // CSS selector of input to focus after popup is opened
1781
1782		closeOnContentClick: false,
1783
1784		closeOnBgClick: true,
1785
1786		closeBtnInside: true,
1787
1788		showCloseBtn: true,
1789
1790		enableEscapeKey: true,
1791
1792		modal: false,
1793
1794		alignTop: false,
1795
1796		removalDelay: 0,
1797
1798		prependTo: null,
1799
1800		fixedContentPos: 'auto',
1801
1802		fixedBgPos: 'auto',
1803
1804		overflowY: 'auto',
1805
1806		closeMarkup: '<button title="%title%" type="button" class="mfp-close">&#215;</button>',
1807
1808		tClose: 'Close (Esc)',
1809
1810		tLoading: 'Loading...',
1811
1812		autoFocusLast: true
1813
1814	}
1815};
1816
1817
1818
1819$.fn.magnificPopup = function(options) {
1820	_checkInstance();
1821
1822	var jqEl = $(this);
1823
1824	// We call some API method of first param is a string
1825	if (typeof options === "string" ) {
1826
1827		if(options === 'open') {
1828			var items,
1829				itemOpts = _isJQ ? jqEl.data('magnificPopup') : jqEl[0].magnificPopup,
1830				index = parseInt(arguments[1], 10) || 0;
1831
1832			if(itemOpts.items) {
1833				items = itemOpts.items[index];
1834			} else {
1835				items = jqEl;
1836				if(itemOpts.delegate) {
1837					items = items.find(itemOpts.delegate);
1838				}
1839				items = items.eq( index );
1840			}
1841			mfp._openClick({mfpEl:items}, jqEl, itemOpts);
1842		} else {
1843			if(mfp.isOpen)
1844				mfp[options].apply(mfp, Array.prototype.slice.call(arguments, 1));
1845		}
1846
1847	} else {
1848		// clone options obj
1849		options = $.extend(true, {}, options);
1850
1851		/*
1852		 * As Zepto doesn't support .data() method for objects
1853		 * and it works only in normal browsers
1854		 * we assign "options" object directly to the DOM element. FTW!
1855		 */
1856		if(_isJQ) {
1857			jqEl.data('magnificPopup', options);
1858		} else {
1859			jqEl[0].magnificPopup = options;
1860		}
1861
1862		mfp.addGroup(jqEl, options);
1863
1864	}
1865	return jqEl;
1866};
1867
1868/*>>core*/
1869
1870/*>>inline*/
1871
1872var INLINE_NS = 'inline',
1873	_hiddenClass,
1874	_inlinePlaceholder,
1875	_lastInlineElement,
1876	_putInlineElementsBack = function() {
1877		if(_lastInlineElement) {
1878			_inlinePlaceholder.after( _lastInlineElement.addClass(_hiddenClass) ).detach();
1879			_lastInlineElement = null;
1880		}
1881	};
1882
1883$.magnificPopup.registerModule(INLINE_NS, {
1884	options: {
1885		hiddenClass: 'hide', // will be appended with `mfp-` prefix
1886		markup: '',
1887		tNotFound: 'Content not found'
1888	},
1889	proto: {
1890
1891		initInline: function() {
1892			mfp.types.push(INLINE_NS);
1893
1894			_mfpOn(CLOSE_EVENT+'.'+INLINE_NS, function() {
1895				_putInlineElementsBack();
1896			});
1897		},
1898
1899		getInline: function(item, template) {
1900
1901			_putInlineElementsBack();
1902
1903			if(item.src) {
1904				var inlineSt = mfp.st.inline,
1905					el = $(item.src);
1906
1907				if(el.length) {
1908
1909					// If target element has parent - we replace it with placeholder and put it back after popup is closed
1910					var parent = el[0].parentNode;
1911					if(parent && parent.tagName) {
1912						if(!_inlinePlaceholder) {
1913							_hiddenClass = inlineSt.hiddenClass;
1914							_inlinePlaceholder = _getEl(_hiddenClass);
1915							_hiddenClass = 'mfp-'+_hiddenClass;
1916						}
1917						// replace target inline element with placeholder
1918						_lastInlineElement = el.after(_inlinePlaceholder).detach().removeClass(_hiddenClass);
1919					}
1920
1921					mfp.updateStatus('ready');
1922				} else {
1923					mfp.updateStatus('error', inlineSt.tNotFound);
1924					el = $('<div>');
1925				}
1926
1927				item.inlineElement = el;
1928				return el;
1929			}
1930
1931			mfp.updateStatus('ready');
1932			mfp._parseMarkup(template, {}, item);
1933			return template;
1934		}
1935	}
1936});
1937
1938/*>>inline*/
1939
1940/*>>ajax*/
1941var AJAX_NS = 'ajax',
1942	_ajaxCur,
1943	_removeAjaxCursor = function() {
1944		if(_ajaxCur) {
1945			$(document.body).removeClass(_ajaxCur);
1946		}
1947	},
1948	_destroyAjaxRequest = function() {
1949		_removeAjaxCursor();
1950		if(mfp.req) {
1951			mfp.req.abort();
1952		}
1953	};
1954
1955$.magnificPopup.registerModule(AJAX_NS, {
1956
1957	options: {
1958		settings: null,
1959		cursor: 'mfp-ajax-cur',
1960		tError: '<a href="%url%">The content</a> could not be loaded.'
1961	},
1962
1963	proto: {
1964		initAjax: function() {
1965			mfp.types.push(AJAX_NS);
1966			_ajaxCur = mfp.st.ajax.cursor;
1967
1968			_mfpOn(CLOSE_EVENT+'.'+AJAX_NS, _destroyAjaxRequest);
1969			_mfpOn('BeforeChange.' + AJAX_NS, _destroyAjaxRequest);
1970		},
1971		getAjax: function(item) {
1972
1973			if(_ajaxCur) {
1974				$(document.body).addClass(_ajaxCur);
1975			}
1976
1977			mfp.updateStatus('loading');
1978
1979			var opts = $.extend({
1980				url: item.src,
1981				success: function(data, textStatus, jqXHR) {
1982					var temp = {
1983						data:data,
1984						xhr:jqXHR
1985					};
1986
1987					_mfpTrigger('ParseAjax', temp);
1988
1989					mfp.appendContent( $(temp.data), AJAX_NS );
1990
1991					item.finished = true;
1992
1993					_removeAjaxCursor();
1994
1995					mfp._setFocus();
1996
1997					setTimeout(function() {
1998						mfp.wrap.addClass(READY_CLASS);
1999					}, 16);
2000
2001					mfp.updateStatus('ready');
2002
2003					_mfpTrigger('AjaxContentAdded');
2004				},
2005				error: function() {
2006					_removeAjaxCursor();
2007					item.finished = item.loadError = true;
2008					mfp.updateStatus('error', mfp.st.ajax.tError.replace('%url%', item.src));
2009				}
2010			}, mfp.st.ajax.settings);
2011
2012			mfp.req = $.ajax(opts);
2013
2014			return '';
2015		}
2016	}
2017});
2018
2019/*>>ajax*/
2020
2021/*>>image*/
2022var _imgInterval,
2023	_getTitle = function(item) {
2024		if(item.data && item.data.title !== undefined)
2025			return item.data.title;
2026
2027		var src = mfp.st.image.titleSrc;
2028
2029		if(src) {
2030			if($.isFunction(src)) {
2031				return src.call(mfp, item);
2032			} else if(item.el) {
2033				return item.el.attr(src) || '';
2034			}
2035		}
2036		return '';
2037	};
2038
2039$.magnificPopup.registerModule('image', {
2040
2041	options: {
2042		markup: '<div class="mfp-figure">'+
2043					'<div class="mfp-close"></div>'+
2044					'<figure>'+
2045						'<div class="mfp-img"></div>'+
2046						'<figcaption>'+
2047							'<div class="mfp-bottom-bar">'+
2048								'<div class="mfp-title"></div>'+
2049								'<div class="mfp-counter"></div>'+
2050							'</div>'+
2051						'</figcaption>'+
2052					'</figure>'+
2053				'</div>',
2054		cursor: 'mfp-zoom-out-cur',
2055		titleSrc: 'title',
2056		verticalFit: true,
2057		tError: '<a href="%url%">The image</a> could not be loaded.'
2058	},
2059
2060	proto: {
2061		initImage: function() {
2062			var imgSt = mfp.st.image,
2063				ns = '.image';
2064
2065			mfp.types.push('image');
2066
2067			_mfpOn(OPEN_EVENT+ns, function() {
2068				if(mfp.currItem.type === 'image' && imgSt.cursor) {
2069					$(document.body).addClass(imgSt.cursor);
2070				}
2071			});
2072
2073			_mfpOn(CLOSE_EVENT+ns, function() {
2074				if(imgSt.cursor) {
2075					$(document.body).removeClass(imgSt.cursor);
2076				}
2077				_window.off('resize' + EVENT_NS);
2078			});
2079
2080			_mfpOn('Resize'+ns, mfp.resizeImage);
2081			if(mfp.isLowIE) {
2082				_mfpOn('AfterChange', mfp.resizeImage);
2083			}
2084		},
2085		resizeImage: function() {
2086			var item = mfp.currItem;
2087			if(!item || !item.img) return;
2088
2089			if(mfp.st.image.verticalFit) {
2090				var decr = 0;
2091				// fix box-sizing in ie7/8
2092				if(mfp.isLowIE) {
2093					decr = parseInt(item.img.css('padding-top'), 10) + parseInt(item.img.css('padding-bottom'),10);
2094				}
2095				item.img.css('max-height', mfp.wH-decr);
2096			}
2097		},
2098		_onImageHasSize: function(item) {
2099			if(item.img) {
2100
2101				item.hasSize = true;
2102
2103				if(_imgInterval) {
2104					clearInterval(_imgInterval);
2105				}
2106
2107				item.isCheckingImgSize = false;
2108
2109				_mfpTrigger('ImageHasSize', item);
2110
2111				if(item.imgHidden) {
2112					if(mfp.content)
2113						mfp.content.removeClass('mfp-loading');
2114
2115					item.imgHidden = false;
2116				}
2117
2118			}
2119		},
2120
2121		/**
2122		 * Function that loops until the image has size to display elements that rely on it asap
2123		 */
2124		findImageSize: function(item) {
2125
2126			var counter = 0,
2127				img = item.img[0],
2128				mfpSetInterval = function(delay) {
2129
2130					if(_imgInterval) {
2131						clearInterval(_imgInterval);
2132					}
2133					// decelerating interval that checks for size of an image
2134					_imgInterval = setInterval(function() {
2135						if(img.naturalWidth > 0) {
2136							mfp._onImageHasSize(item);
2137							return;
2138						}
2139
2140						if(counter > 200) {
2141							clearInterval(_imgInterval);
2142						}
2143
2144						counter++;
2145						if(counter === 3) {
2146							mfpSetInterval(10);
2147						} else if(counter === 40) {
2148							mfpSetInterval(50);
2149						} else if(counter === 100) {
2150							mfpSetInterval(500);
2151						}
2152					}, delay);
2153				};
2154
2155			mfpSetInterval(1);
2156		},
2157
2158		getImage: function(item, template) {
2159
2160			var guard = 0,
2161
2162				// image load complete handler
2163				onLoadComplete = function() {
2164					if(item) {
2165						if (item.img[0].complete) {
2166							item.img.off('.mfploader');
2167
2168							if(item === mfp.currItem){
2169								mfp._onImageHasSize(item);
2170
2171								mfp.updateStatus('ready');
2172							}
2173
2174							item.hasSize = true;
2175							item.loaded = true;
2176
2177							_mfpTrigger('ImageLoadComplete');
2178
2179						}
2180						else {
2181							// if image complete check fails 200 times (20 sec), we assume that there was an error.
2182							guard++;
2183							if(guard < 200) {
2184								setTimeout(onLoadComplete,100);
2185							} else {
2186								onLoadError();
2187							}
2188						}
2189					}
2190				},
2191
2192				// image error handler
2193				onLoadError = function() {
2194					if(item) {
2195						item.img.off('.mfploader');
2196						if(item === mfp.currItem){
2197							mfp._onImageHasSize(item);
2198							mfp.updateStatus('error', imgSt.tError.replace('%url%', item.src) );
2199						}
2200
2201						item.hasSize = true;
2202						item.loaded = true;
2203						item.loadError = true;
2204					}
2205				},
2206				imgSt = mfp.st.image;
2207
2208
2209			var el = template.find('.mfp-img');
2210			if(el.length) {
2211				var img = document.createElement('img');
2212				img.className = 'mfp-img';
2213				if(item.el && item.el.find('img').length) {
2214					img.alt = item.el.find('img').attr('alt');
2215				}
2216				item.img = $(img).on('load.mfploader', onLoadComplete).on('error.mfploader', onLoadError);
2217				img.src = item.src;
2218
2219				// without clone() "error" event is not firing when IMG is replaced by new IMG
2220				// TODO: find a way to avoid such cloning
2221				if(el.is('img')) {
2222					item.img = item.img.clone();
2223				}
2224
2225				img = item.img[0];
2226				if(img.naturalWidth > 0) {
2227					item.hasSize = true;
2228				} else if(!img.width) {
2229					item.hasSize = false;
2230				}
2231			}
2232
2233			mfp._parseMarkup(template, {
2234				title: _getTitle(item),
2235				img_replaceWith: item.img
2236			}, item);
2237
2238			mfp.resizeImage();
2239
2240			if(item.hasSize) {
2241				if(_imgInterval) clearInterval(_imgInterval);
2242
2243				if(item.loadError) {
2244					template.addClass('mfp-loading');
2245					mfp.updateStatus('error', imgSt.tError.replace('%url%', item.src) );
2246				} else {
2247					template.removeClass('mfp-loading');
2248					mfp.updateStatus('ready');
2249				}
2250				return template;
2251			}
2252
2253			mfp.updateStatus('loading');
2254			item.loading = true;
2255
2256			if(!item.hasSize) {
2257				item.imgHidden = true;
2258				template.addClass('mfp-loading');
2259				mfp.findImageSize(item);
2260			}
2261
2262			return template;
2263		}
2264	}
2265});
2266
2267/*>>image*/
2268
2269/*>>zoom*/
2270var hasMozTransform,
2271	getHasMozTransform = function() {
2272		if(hasMozTransform === undefined) {
2273			hasMozTransform = document.createElement('p').style.MozTransform !== undefined;
2274		}
2275		return hasMozTransform;
2276	};
2277
2278$.magnificPopup.registerModule('zoom', {
2279
2280	options: {
2281		enabled: false,
2282		easing: 'ease-in-out',
2283		duration: 300,
2284		opener: function(element) {
2285			return element.is('img') ? element : element.find('img');
2286		}
2287	},
2288
2289	proto: {
2290
2291		initZoom: function() {
2292			var zoomSt = mfp.st.zoom,
2293				ns = '.zoom',
2294				image;
2295
2296			if(!zoomSt.enabled || !mfp.supportsTransition) {
2297				return;
2298			}
2299
2300			var duration = zoomSt.duration,
2301				getElToAnimate = function(image) {
2302					var newImg = image.clone().removeAttr('style').removeAttr('class').addClass('mfp-animated-image'),
2303						transition = 'all '+(zoomSt.duration/1000)+'s ' + zoomSt.easing,
2304						cssObj = {
2305							position: 'fixed',
2306							zIndex: 9999,
2307							left: 0,
2308							top: 0,
2309							'-webkit-backface-visibility': 'hidden'
2310						},
2311						t = 'transition';
2312
2313					cssObj['-webkit-'+t] = cssObj['-moz-'+t] = cssObj['-o-'+t] = cssObj[t] = transition;
2314
2315					newImg.css(cssObj);
2316					return newImg;
2317				},
2318				showMainContent = function() {
2319					mfp.content.css('visibility', 'visible');
2320				},
2321				openTimeout,
2322				animatedImg;
2323
2324			_mfpOn('BuildControls'+ns, function() {
2325				if(mfp._allowZoom()) {
2326
2327					clearTimeout(openTimeout);
2328					mfp.content.css('visibility', 'hidden');
2329
2330					// Basically, all code below does is clones existing image, puts in on top of the current one and animated it
2331
2332					image = mfp._getItemToZoom();
2333
2334					if(!image) {
2335						showMainContent();
2336						return;
2337					}
2338
2339					animatedImg = getElToAnimate(image);
2340
2341					animatedImg.css( mfp._getOffset() );
2342
2343					mfp.wrap.append(animatedImg);
2344
2345					openTimeout = setTimeout(function() {
2346						animatedImg.css( mfp._getOffset( true ) );
2347						openTimeout = setTimeout(function() {
2348
2349							showMainContent();
2350
2351							setTimeout(function() {
2352								animatedImg.remove();
2353								image = animatedImg = null;
2354								_mfpTrigger('ZoomAnimationEnded');
2355							}, 16); // avoid blink when switching images
2356
2357						}, duration); // this timeout equals animation duration
2358
2359					}, 16); // by adding this timeout we avoid short glitch at the beginning of animation
2360
2361
2362					// Lots of timeouts...
2363				}
2364			});
2365			_mfpOn(BEFORE_CLOSE_EVENT+ns, function() {
2366				if(mfp._allowZoom()) {
2367
2368					clearTimeout(openTimeout);
2369
2370					mfp.st.removalDelay = duration;
2371
2372					if(!image) {
2373						image = mfp._getItemToZoom();
2374						if(!image) {
2375							return;
2376						}
2377						animatedImg = getElToAnimate(image);
2378					}
2379
2380					animatedImg.css( mfp._getOffset(true) );
2381					mfp.wrap.append(animatedImg);
2382					mfp.content.css('visibility', 'hidden');
2383
2384					setTimeout(function() {
2385						animatedImg.css( mfp._getOffset() );
2386					}, 16);
2387				}
2388
2389			});
2390
2391			_mfpOn(CLOSE_EVENT+ns, function() {
2392				if(mfp._allowZoom()) {
2393					showMainContent();
2394					if(animatedImg) {
2395						animatedImg.remove();
2396					}
2397					image = null;
2398				}
2399			});
2400		},
2401
2402		_allowZoom: function() {
2403			return mfp.currItem.type === 'image';
2404		},
2405
2406		_getItemToZoom: function() {
2407			if(mfp.currItem.hasSize) {
2408				return mfp.currItem.img;
2409			} else {
2410				return false;
2411			}
2412		},
2413
2414		// Get element postion relative to viewport
2415		_getOffset: function(isLarge) {
2416			var el;
2417			if(isLarge) {
2418				el = mfp.currItem.img;
2419			} else {
2420				el = mfp.st.zoom.opener(mfp.currItem.el || mfp.currItem);
2421			}
2422
2423			var offset = el.offset();
2424			var paddingTop = parseInt(el.css('padding-top'),10);
2425			var paddingBottom = parseInt(el.css('padding-bottom'),10);
2426			offset.top -= ( $(window).scrollTop() - paddingTop );
2427
2428
2429			/*
2430
2431			Animating left + top + width/height looks glitchy in Firefox, but perfect in Chrome. And vice-versa.
2432
2433			 */
2434			var obj = {
2435				width: el.width(),
2436				// fix Zepto height+padding issue
2437				height: (_isJQ ? el.innerHeight() : el[0].offsetHeight) - paddingBottom - paddingTop
2438			};
2439
2440			// I hate to do this, but there is no another option
2441			if( getHasMozTransform() ) {
2442				obj['-moz-transform'] = obj['transform'] = 'translate(' + offset.left + 'px,' + offset.top + 'px)';
2443			} else {
2444				obj.left = offset.left;
2445				obj.top = offset.top;
2446			}
2447			return obj;
2448		}
2449
2450	}
2451});
2452
2453
2454
2455/*>>zoom*/
2456
2457/*>>iframe*/
2458
2459var IFRAME_NS = 'iframe',
2460	_emptyPage = '//about:blank',
2461
2462	_fixIframeBugs = function(isShowing) {
2463		if(mfp.currTemplate[IFRAME_NS]) {
2464			var el = mfp.currTemplate[IFRAME_NS].find('iframe');
2465			if(el.length) {
2466				// reset src after the popup is closed to avoid "video keeps playing after popup is closed" bug
2467				if(!isShowing) {
2468					el[0].src = _emptyPage;
2469				}
2470
2471				// IE8 black screen bug fix
2472				if(mfp.isIE8) {
2473					el.css('display', isShowing ? 'block' : 'none');
2474				}
2475			}
2476		}
2477	};
2478
2479$.magnificPopup.registerModule(IFRAME_NS, {
2480
2481	options: {
2482		markup: '<div class="mfp-iframe-scaler">'+
2483					'<div class="mfp-close"></div>'+
2484					'<iframe class="mfp-iframe" src="//about:blank" frameborder="0" allowfullscreen></iframe>'+
2485				'</div>',
2486
2487		srcAction: 'iframe_src',
2488
2489		// we don't care and support only one default type of URL by default
2490		patterns: {
2491			youtube: {
2492				index: 'youtube.com',
2493				id: 'v=',
2494				src: '//www.youtube.com/embed/%id%?autoplay=1'
2495			},
2496			vimeo: {
2497				index: 'vimeo.com/',
2498				id: '/',
2499				src: '//player.vimeo.com/video/%id%?autoplay=1'
2500			},
2501			gmaps: {
2502				index: '//maps.google.',
2503				src: '%id%&output=embed'
2504			}
2505		}
2506	},
2507
2508	proto: {
2509		initIframe: function() {
2510			mfp.types.push(IFRAME_NS);
2511
2512			_mfpOn('BeforeChange', function(e, prevType, newType) {
2513				if(prevType !== newType) {
2514					if(prevType === IFRAME_NS) {
2515						_fixIframeBugs(); // iframe if removed
2516					} else if(newType === IFRAME_NS) {
2517						_fixIframeBugs(true); // iframe is showing
2518					}
2519				}// else {
2520					// iframe source is switched, don't do anything
2521				//}
2522			});
2523
2524			_mfpOn(CLOSE_EVENT + '.' + IFRAME_NS, function() {
2525				_fixIframeBugs();
2526			});
2527		},
2528
2529		getIframe: function(item, template) {
2530			var embedSrc = item.src;
2531			var iframeSt = mfp.st.iframe;
2532
2533			$.each(iframeSt.patterns, function() {
2534				if(embedSrc.indexOf( this.index ) > -1) {
2535					if(this.id) {
2536						if(typeof this.id === 'string') {
2537							embedSrc = embedSrc.substr(embedSrc.lastIndexOf(this.id)+this.id.length, embedSrc.length);
2538						} else {
2539							embedSrc = this.id.call( this, embedSrc );
2540						}
2541					}
2542					embedSrc = this.src.replace('%id%', embedSrc );
2543					return false; // break;
2544				}
2545			});
2546
2547			var dataObj = {};
2548			if(iframeSt.srcAction) {
2549				dataObj[iframeSt.srcAction] = embedSrc;
2550			}
2551			mfp._parseMarkup(template, dataObj, item);
2552
2553			mfp.updateStatus('ready');
2554
2555			return template;
2556		}
2557	}
2558});
2559
2560
2561
2562/*>>iframe*/
2563
2564/*>>gallery*/
2565/**
2566 * Get looped index depending on number of slides
2567 */
2568var _getLoopedId = function(index) {
2569		var numSlides = mfp.items.length;
2570		if(index > numSlides - 1) {
2571			return index - numSlides;
2572		} else  if(index < 0) {
2573			return numSlides + index;
2574		}
2575		return index;
2576	},
2577	_replaceCurrTotal = function(text, curr, total) {
2578		return text.replace(/%curr%/gi, curr + 1).replace(/%total%/gi, total);
2579	};
2580
2581$.magnificPopup.registerModule('gallery', {
2582
2583	options: {
2584		enabled: false,
2585		arrowMarkup: '<button title="%title%" type="button" class="mfp-arrow mfp-arrow-%dir%"></button>',
2586		preload: [0,2],
2587		navigateByImgClick: true,
2588		arrows: true,
2589
2590		tPrev: 'Previous (Left arrow key)',
2591		tNext: 'Next (Right arrow key)',
2592		tCounter: '%curr% of %total%'
2593	},
2594
2595	proto: {
2596		initGallery: function() {
2597
2598			var gSt = mfp.st.gallery,
2599				ns = '.mfp-gallery';
2600
2601			mfp.direction = true; // true - next, false - prev
2602
2603			if(!gSt || !gSt.enabled ) return false;
2604
2605			_wrapClasses += ' mfp-gallery';
2606
2607			_mfpOn(OPEN_EVENT+ns, function() {
2608
2609				if(gSt.navigateByImgClick) {
2610					mfp.wrap.on('click'+ns, '.mfp-img', function() {
2611						if(mfp.items.length > 1) {
2612							mfp.next();
2613							return false;
2614						}
2615					});
2616				}
2617
2618				_document.on('keydown'+ns, function(e) {
2619					if (e.keyCode === 37) {
2620						mfp.prev();
2621					} else if (e.keyCode === 39) {
2622						mfp.next();
2623					}
2624				});
2625			});
2626
2627			_mfpOn('UpdateStatus'+ns, function(e, data) {
2628				if(data.text) {
2629					data.text = _replaceCurrTotal(data.text, mfp.currItem.index, mfp.items.length);
2630				}
2631			});
2632
2633			_mfpOn(MARKUP_PARSE_EVENT+ns, function(e, element, values, item) {
2634				var l = mfp.items.length;
2635				values.counter = l > 1 ? _replaceCurrTotal(gSt.tCounter, item.index, l) : '';
2636			});
2637
2638			_mfpOn('BuildControls' + ns, function() {
2639				if(mfp.items.length > 1 && gSt.arrows && !mfp.arrowLeft) {
2640					var markup = gSt.arrowMarkup,
2641						arrowLeft = mfp.arrowLeft = $( markup.replace(/%title%/gi, gSt.tPrev).replace(/%dir%/gi, 'left') ).addClass(PREVENT_CLOSE_CLASS),
2642						arrowRight = mfp.arrowRight = $( markup.replace(/%title%/gi, gSt.tNext).replace(/%dir%/gi, 'right') ).addClass(PREVENT_CLOSE_CLASS);
2643
2644					arrowLeft.click(function() {
2645						mfp.prev();
2646					});
2647					arrowRight.click(function() {
2648						mfp.next();
2649					});
2650
2651					mfp.container.append(arrowLeft.add(arrowRight));
2652				}
2653			});
2654
2655			_mfpOn(CHANGE_EVENT+ns, function() {
2656				if(mfp._preloadTimeout) clearTimeout(mfp._preloadTimeout);
2657
2658				mfp._preloadTimeout = setTimeout(function() {
2659					mfp.preloadNearbyImages();
2660					mfp._preloadTimeout = null;
2661				}, 16);
2662			});
2663
2664
2665			_mfpOn(CLOSE_EVENT+ns, function() {
2666				_document.off(ns);
2667				mfp.wrap.off('click'+ns);
2668				mfp.arrowRight = mfp.arrowLeft = null;
2669			});
2670
2671		},
2672		next: function() {
2673			mfp.direction = true;
2674			mfp.index = _getLoopedId(mfp.index + 1);
2675			mfp.updateItemHTML();
2676		},
2677		prev: function() {
2678			mfp.direction = false;
2679			mfp.index = _getLoopedId(mfp.index - 1);
2680			mfp.updateItemHTML();
2681		},
2682		goTo: function(newIndex) {
2683			mfp.direction = (newIndex >= mfp.index);
2684			mfp.index = newIndex;
2685			mfp.updateItemHTML();
2686		},
2687		preloadNearbyImages: function() {
2688			var p = mfp.st.gallery.preload,
2689				preloadBefore = Math.min(p[0], mfp.items.length),
2690				preloadAfter = Math.min(p[1], mfp.items.length),
2691				i;
2692
2693			for(i = 1; i <= (mfp.direction ? preloadAfter : preloadBefore); i++) {
2694				mfp._preloadItem(mfp.index+i);
2695			}
2696			for(i = 1; i <= (mfp.direction ? preloadBefore : preloadAfter); i++) {
2697				mfp._preloadItem(mfp.index-i);
2698			}
2699		},
2700		_preloadItem: function(index) {
2701			index = _getLoopedId(index);
2702
2703			if(mfp.items[index].preloaded) {
2704				return;
2705			}
2706
2707			var item = mfp.items[index];
2708			if(!item.parsed) {
2709				item = mfp.parseEl( index );
2710			}
2711
2712			_mfpTrigger('LazyLoad', item);
2713
2714			if(item.type === 'image') {
2715				item.img = $('<img class="mfp-img" />').on('load.mfploader', function() {
2716					item.hasSize = true;
2717				}).on('error.mfploader', function() {
2718					item.hasSize = true;
2719					item.loadError = true;
2720					_mfpTrigger('LazyLoadError', item);
2721				}).attr('src', item.src);
2722			}
2723
2724
2725			item.preloaded = true;
2726		}
2727	}
2728});
2729
2730/*>>gallery*/
2731
2732/*>>retina*/
2733
2734var RETINA_NS = 'retina';
2735
2736$.magnificPopup.registerModule(RETINA_NS, {
2737	options: {
2738		replaceSrc: function(item) {
2739			return item.src.replace(/\.\w+$/, function(m) { return '@2x' + m; });
2740		},
2741		ratio: 1 // Function or number.  Set to 1 to disable.
2742	},
2743	proto: {
2744		initRetina: function() {
2745			if(window.devicePixelRatio > 1) {
2746
2747				var st = mfp.st.retina,
2748					ratio = st.ratio;
2749
2750				ratio = !isNaN(ratio) ? ratio : ratio();
2751
2752				if(ratio > 1) {
2753					_mfpOn('ImageHasSize' + '.' + RETINA_NS, function(e, item) {
2754						item.img.css({
2755							'max-width': item.img[0].naturalWidth / ratio,
2756							'width': '100%'
2757						});
2758					});
2759					_mfpOn('ElementParse' + '.' + RETINA_NS, function(e, item) {
2760						item.src = st.replaceSrc(item, ratio);
2761					});
2762				}
2763			}
2764
2765		}
2766	}
2767});
2768
2769/*>>retina*/
2770 _checkInstance(); }));;
vendor: 95,406 bytes, lines 2771-5228
2771/*
2772== malihu jquery custom scrollbar plugin == 
2773Version: 3.1.5 
2774Plugin URI: http://manos.malihu.gr/jquery-custom-content-scroller 
2775Author: malihu
2776Author URI: http://manos.malihu.gr
2777License: MIT License (MIT)
2778*/
2779
2780/*
2781Copyright Manos Malihutsakis (email: [email protected])
2782
2783Permission is hereby granted, free of charge, to any person obtaining a copy
2784of this software and associated documentation files (the "Software"), to deal
2785in the Software without restriction, including without limitation the rights
2786to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2787copies of the Software, and to permit persons to whom the Software is
2788furnished to do so, subject to the following conditions:
2789
2790The above copyright notice and this permission notice shall be included in
2791all copies or substantial portions of the Software.
2792
2793THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2794IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2795FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2796AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2797LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2798OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2799THE SOFTWARE.
2800*/
2801
2802/*
2803The code below is fairly long, fully commented and should be normally used in development. 
2804For production, use either the minified jquery.mCustomScrollbar.min.js script or 
2805the production-ready jquery.mCustomScrollbar.concat.min.js which contains the plugin 
2806and dependencies (minified). 
2807*/
2808
2809(function(factory){
2810	if(typeof define==="function" && define.amd){
2811		define(["jquery"],factory);
2812	}else if(typeof module!=="undefined" && module.exports){
2813		module.exports=factory;
2814	}else{
2815		factory(jQuery,window,document);
2816	}
2817}(function($){
2818(function(init){
2819	var _rjs=typeof define==="function" && define.amd, /* RequireJS */
2820		_njs=typeof module !== "undefined" && module.exports, /* NodeJS */
2821		_dlp=("https:"==document.location.protocol) ? "https:" : "http:", /* location protocol */
2822		_url="cdnjs.cloudflare.com/ajax/libs/jquery-mousewheel/3.1.13/jquery.mousewheel.min.js";
2823	if(!_rjs){
2824		if(_njs){
2825			require("jquery-mousewheel")($);
2826		}else{
2827			/* load jquery-mousewheel plugin (via CDN) if it's not present or not loaded via RequireJS 
2828			(works when mCustomScrollbar fn is called on window load) */
2829			$.event.special.mousewheel || $("head").append(decodeURI("%3Cscript src="+_dlp+"//"+_url+"%3E%3C/script%3E"));
2830		}
2831	}
2832	init();
2833}(function(){
2834	
2835	/* 
2836	----------------------------------------
2837	PLUGIN NAMESPACE, PREFIX, DEFAULT SELECTOR(S) 
2838	----------------------------------------
2839	*/
2840	
2841	var pluginNS="mCustomScrollbar",
2842		pluginPfx="mCS",
2843		defaultSelector=".mCustomScrollbar",
2844	
2845	
2846		
2847	
2848	
2849	/* 
2850	----------------------------------------
2851	DEFAULT OPTIONS 
2852	----------------------------------------
2853	*/
2854	
2855		defaults={
2856			/*
2857			set element/content width/height programmatically 
2858			values: boolean, pixels, percentage 
2859				option						default
2860				-------------------------------------
2861				setWidth					false
2862				setHeight					false
2863			*/
2864			/*
2865			set the initial css top property of content  
2866			values: string (e.g. "-100px", "10%" etc.)
2867			*/
2868			setTop:0,
2869			/*
2870			set the initial css left property of content  
2871			values: string (e.g. "-100px", "10%" etc.)
2872			*/
2873			setLeft:0,
2874			/* 
2875			scrollbar axis (vertical and/or horizontal scrollbars) 
2876			values (string): "y", "x", "yx"
2877			*/
2878			axis:"y",
2879			/*
2880			position of scrollbar relative to content  
2881			values (string): "inside", "outside" ("outside" requires elements with position:relative)
2882			*/
2883			scrollbarPosition:"inside",
2884			/*
2885			scrolling inertia
2886			values: integer (milliseconds)
2887			*/
2888			scrollInertia:950,
2889			/* 
2890			auto-adjust scrollbar dragger length
2891			values: boolean
2892			*/
2893			autoDraggerLength:true,
2894			/*
2895			auto-hide scrollbar when idle 
2896			values: boolean
2897				option						default
2898				-------------------------------------
2899				autoHideScrollbar			false
2900			*/
2901			/*
2902			auto-expands scrollbar on mouse-over and dragging
2903			values: boolean
2904				option						default
2905				-------------------------------------
2906				autoExpandScrollbar			false
2907			*/
2908			/*
2909			always show scrollbar, even when there's nothing to scroll 
2910			values: integer (0=disable, 1=always show dragger rail and buttons, 2=always show dragger rail, dragger and buttons), boolean
2911			*/
2912			alwaysShowScrollbar:0,
2913			/*
2914			scrolling always snaps to a multiple of this number in pixels
2915			values: integer, array ([y,x])
2916				option						default
2917				-------------------------------------
2918				snapAmount					null
2919			*/
2920			/*
2921			when snapping, snap with this number in pixels as an offset 
2922			values: integer
2923			*/
2924			snapOffset:0,
2925			/* 
2926			mouse-wheel scrolling
2927			*/
2928			mouseWheel:{
2929				/* 
2930				enable mouse-wheel scrolling
2931				values: boolean
2932				*/
2933				enable:true,
2934				/* 
2935				scrolling amount in pixels
2936				values: "auto", integer 
2937				*/
2938				scrollAmount:"auto",
2939				/* 
2940				mouse-wheel scrolling axis 
2941				the default scrolling direction when both vertical and horizontal scrollbars are present 
2942				values (string): "y", "x" 
2943				*/
2944				axis:"y",
2945				/* 
2946				prevent the default behaviour which automatically scrolls the parent element(s) when end of scrolling is reached 
2947				values: boolean
2948					option						default
2949					-------------------------------------
2950					preventDefault				null
2951				*/
2952				/*
2953				the reported mouse-wheel delta value. The number of lines (translated to pixels) one wheel notch scrolls.  
2954				values: "auto", integer 
2955				"auto" uses the default OS/browser value 
2956				*/
2957				deltaFactor:"auto",
2958				/*
2959				normalize mouse-wheel delta to -1 or 1 (disables mouse-wheel acceleration) 
2960				values: boolean
2961					option						default
2962					-------------------------------------
2963					normalizeDelta				null
2964				*/
2965				/*
2966				invert mouse-wheel scrolling direction 
2967				values: boolean
2968					option						default
2969					-------------------------------------
2970					invert						null
2971				*/
2972				/*
2973				the tags that disable mouse-wheel when cursor is over them
2974				*/
2975				disableOver:["select","option","keygen","datalist","textarea"]
2976			},
2977			/* 
2978			scrollbar buttons
2979			*/
2980			scrollButtons:{ 
2981				/*
2982				enable scrollbar buttons
2983				values: boolean
2984					option						default
2985					-------------------------------------
2986					enable						null
2987				*/
2988				/*
2989				scrollbar buttons scrolling type 
2990				values (string): "stepless", "stepped"
2991				*/
2992				scrollType:"stepless",
2993				/*
2994				scrolling amount in pixels
2995				values: "auto", integer 
2996				*/
2997				scrollAmount:"auto"
2998				/*
2999				tabindex of the scrollbar buttons
3000				values: false, integer
3001					option						default
3002					-------------------------------------
3003					tabindex					null
3004				*/
3005			},
3006			/* 
3007			keyboard scrolling
3008			*/
3009			keyboard:{ 
3010				/*
3011				enable scrolling via keyboard
3012				values: boolean
3013				*/
3014				enable:true,
3015				/*
3016				keyboard scrolling type 
3017				values (string): "stepless", "stepped"
3018				*/
3019				scrollType:"stepless",
3020				/*
3021				scrolling amount in pixels
3022				values: "auto", integer 
3023				*/
3024				scrollAmount:"auto"
3025			},
3026			/*
3027			enable content touch-swipe scrolling 
3028			values: boolean, integer, string (number)
3029			integer values define the axis-specific minimum amount required for scrolling momentum
3030			*/
3031			contentTouchScroll:25,
3032			/*
3033			enable/disable document (default) touch-swipe scrolling 
3034			*/
3035			documentTouchScroll:true,
3036			/*
3037			advanced option parameters
3038			*/
3039			advanced:{
3040				/*
3041				auto-expand content horizontally (for "x" or "yx" axis) 
3042				values: boolean, integer (the value 2 forces the non scrollHeight/scrollWidth method, the value 3 forces the scrollHeight/scrollWidth method)
3043					option						default
3044					-------------------------------------
3045					autoExpandHorizontalScroll	null
3046				*/
3047				/*
3048				auto-scroll to elements with focus
3049				*/
3050				autoScrollOnFocus:"input,textarea,select,button,datalist,keygen,a[tabindex],area,object,[contenteditable='true']",
3051				/*
3052				auto-update scrollbars on content, element or viewport resize 
3053				should be true for fluid layouts/elements, adding/removing content dynamically, hiding/showing elements, content with images etc. 
3054				values: boolean
3055				*/
3056				updateOnContentResize:true,
3057				/*
3058				auto-update scrollbars each time each image inside the element is fully loaded 
3059				values: "auto", boolean
3060				*/
3061				updateOnImageLoad:"auto",
3062				/*
3063				auto-update scrollbars based on the amount and size changes of specific selectors 
3064				useful when you need to update the scrollbar(s) automatically, each time a type of element is added, removed or changes its size 
3065				values: boolean, string (e.g. "ul li" will auto-update scrollbars each time list-items inside the element are changed) 
3066				a value of true (boolean) will auto-update scrollbars each time any element is changed
3067					option						default
3068					-------------------------------------
3069					updateOnSelectorChange		null
3070				*/
3071				/*
3072				extra selectors that'll allow scrollbar dragging upon mousemove/up, pointermove/up, touchend etc. (e.g. "selector-1, selector-2")
3073					option						default
3074					-------------------------------------
3075					extraDraggableSelectors		null
3076				*/
3077				/*
3078				extra selectors that'll release scrollbar dragging upon mouseup, pointerup, touchend etc. (e.g. "selector-1, selector-2")
3079					option						default
3080					-------------------------------------
3081					releaseDraggableSelectors	null
3082				*/
3083				/*
3084				auto-update timeout 
3085				values: integer (milliseconds)
3086				*/
3087				autoUpdateTimeout:60
3088			},
3089			/* 
3090			scrollbar theme 
3091			values: string (see CSS/plugin URI for a list of ready-to-use themes)
3092			*/
3093			theme:"light",
3094			/*
3095			user defined callback functions
3096			*/
3097			callbacks:{
3098				/*
3099				Available callbacks: 
3100					callback					default
3101					-------------------------------------
3102					onCreate					null
3103					onInit						null
3104					onScrollStart				null
3105					onScroll					null
3106					onTotalScroll				null
3107					onTotalScrollBack			null
3108					whileScrolling				null
3109					onOverflowY					null
3110					onOverflowX					null
3111					onOverflowYNone				null
3112					onOverflowXNone				null
3113					onImageLoad					null
3114					onSelectorChange			null
3115					onBeforeUpdate				null
3116					onUpdate					null
3117				*/
3118				onTotalScrollOffset:0,
3119				onTotalScrollBackOffset:0,
3120				alwaysTriggerOffsets:true
3121			}
3122			/*
3123			add scrollbar(s) on all elements matching the current selector, now and in the future 
3124			values: boolean, string 
3125			string values: "on" (enable), "once" (disable after first invocation), "off" (disable)
3126			liveSelector values: string (selector)
3127				option						default
3128				-------------------------------------
3129				live						false
3130				liveSelector				null
3131			*/
3132		},
3133	
3134	
3135	
3136	
3137	
3138	/* 
3139	----------------------------------------
3140	VARS, CONSTANTS 
3141	----------------------------------------
3142	*/
3143	
3144		totalInstances=0, /* plugin instances amount */
3145		liveTimers={}, /* live option timers */
3146		oldIE=(window.attachEvent && !window.addEventListener) ? 1 : 0, /* detect IE < 9 */
3147		touchActive=false,touchable, /* global touch vars (for touch and pointer events) */
3148		/* general plugin classes */
3149		classes=[
3150			"mCSB_dragger_onDrag","mCSB_scrollTools_onDrag","mCS_img_loaded","mCS_disabled","mCS_destroyed","mCS_no_scrollbar",
3151			"mCS-autoHide","mCS-dir-rtl","mCS_no_scrollbar_y","mCS_no_scrollbar_x","mCS_y_hidden","mCS_x_hidden","mCSB_draggerContainer",
3152			"mCSB_buttonUp","mCSB_buttonDown","mCSB_buttonLeft","mCSB_buttonRight"
3153		],
3154		
3155	
3156	
3157	
3158	
3159	/* 
3160	----------------------------------------
3161	METHODS 
3162	----------------------------------------
3163	*/
3164	
3165		methods={
3166			
3167			/* 
3168			plugin initialization method 
3169			creates the scrollbar(s), plugin data object and options
3170			----------------------------------------
3171			*/
3172			
3173			init:function(options){
3174				
3175				var options=$.extend(true,{},defaults,options),
3176					selector=_selector.call(this); /* validate selector */
3177				
3178				/* 
3179				if live option is enabled, monitor for elements matching the current selector and 
3180				apply scrollbar(s) when found (now and in the future) 
3181				*/
3182				if(options.live){
3183					var liveSelector=options.liveSelector || this.selector || defaultSelector, /* live selector(s) */
3184						$liveSelector=$(liveSelector); /* live selector(s) as jquery object */
3185					if(options.live==="off"){
3186						/* 
3187						disable live if requested 
3188						usage: $(selector).mCustomScrollbar({live:"off"}); 
3189						*/
3190						removeLiveTimers(liveSelector);
3191						return;
3192					}
3193					liveTimers[liveSelector]=setTimeout(function(){
3194						/* call mCustomScrollbar fn on live selector(s) every half-second */
3195						$liveSelector.mCustomScrollbar(options);
3196						if(options.live==="once" && $liveSelector.length){
3197							/* disable live after first invocation */
3198							removeLiveTimers(liveSelector);
3199						}
3200					},500);
3201				}else{
3202					removeLiveTimers(liveSelector);
3203				}
3204				
3205				/* options backward compatibility (for versions < 3.0.0) and normalization */
3206				options.setWidth=(options.set_width) ? options.set_width : options.setWidth;
3207				options.setHeight=(options.set_height) ? options.set_height : options.setHeight;
3208				options.axis=(options.horizontalScroll) ? "x" : _findAxis(options.axis);
3209				options.scrollInertia=options.scrollInertia>0 && options.scrollInertia<17 ? 17 : options.scrollInertia;
3210				if(typeof options.mouseWheel!=="object" &&  options.mouseWheel==true){ /* old school mouseWheel option (non-object) */
3211					options.mouseWheel={enable:true,scrollAmount:"auto",axis:"y",preventDefault:false,deltaFactor:"auto",normalizeDelta:false,invert:false}
3212				}
3213				options.mouseWheel.scrollAmount=!options.mouseWheelPixels ? options.mouseWheel.scrollAmount : options.mouseWheelPixels;
3214				options.mouseWheel.normalizeDelta=!options.advanced.normalizeMouseWheelDelta ? options.mouseWheel.normalizeDelta : options.advanced.normalizeMouseWheelDelta;
3215				options.scrollButtons.scrollType=_findScrollButtonsType(options.scrollButtons.scrollType); 
3216				
3217				_theme(options); /* theme-specific options */
3218				
3219				/* plugin constructor */
3220				return $(selector).each(function(){
3221					
3222					var $this=$(this);
3223					
3224					if(!$this.data(pluginPfx)){ /* prevent multiple instantiations */
3225					
3226						/* store options and create objects in jquery data */
3227						$this.data(pluginPfx,{
3228							idx:++totalInstances, /* instance index */
3229							opt:options, /* options */
3230							scrollRatio:{y:null,x:null}, /* scrollbar to content ratio */
3231							overflowed:null, /* overflowed axis */
3232							contentReset:{y:null,x:null}, /* object to check when content resets */
3233							bindEvents:false, /* object to check if events are bound */
3234							tweenRunning:false, /* object to check if tween is running */
3235							sequential:{}, /* sequential scrolling object */
3236							langDir:$this.css("direction"), /* detect/store direction (ltr or rtl) */
3237							cbOffsets:null, /* object to check whether callback offsets always trigger */
3238							/* 
3239							object to check how scrolling events where last triggered 
3240							"internal" (default - triggered by this script), "external" (triggered by other scripts, e.g. via scrollTo method) 
3241							usage: object.data("mCS").trigger
3242							*/
3243							trigger:null,
3244							/* 
3245							object to check for changes in elements in order to call the update method automatically 
3246							*/
3247							poll:{size:{o:0,n:0},img:{o:0,n:0},change:{o:0,n:0}}
3248						});
3249						
3250						var d=$this.data(pluginPfx),o=d.opt,
3251							/* HTML data attributes */
3252							htmlDataAxis=$this.data("mcs-axis"),htmlDataSbPos=$this.data("mcs-scrollbar-position"),htmlDataTheme=$this.data("mcs-theme");
3253						 
3254						if(htmlDataAxis){o.axis=htmlDataAxis;} /* usage example: data-mcs-axis="y" */
3255						if(htmlDataSbPos){o.scrollbarPosition=htmlDataSbPos;} /* usage example: data-mcs-scrollbar-position="outside" */
3256						if(htmlDataTheme){ /* usage example: data-mcs-theme="minimal" */
3257							o.theme=htmlDataTheme;
3258							_theme(o); /* theme-specific options */
3259						}
3260						
3261						_pluginMarkup.call(this); /* add plugin markup */
3262						
3263						if(d && o.callbacks.onCreate && typeof o.callbacks.onCreate==="function"){o.callbacks.onCreate.call(this);} /* callbacks: onCreate */
3264						
3265						$("#mCSB_"+d.idx+"_container img:not(."+classes[2]+")").addClass(classes[2]); /* flag loaded images */
3266						
3267						methods.update.call(null,$this); /* call the update method */
3268					
3269					}
3270					
3271				});
3272				
3273			},
3274			/* ---------------------------------------- */
3275			
3276			
3277			
3278			/* 
3279			plugin update method 
3280			updates content and scrollbar(s) values, events and status 
3281			----------------------------------------
3282			usage: $(selector).mCustomScrollbar("update");
3283			*/
3284			
3285			update:function(el,cb){
3286				
3287				var selector=el || _selector.call(this); /* validate selector */
3288				
3289				return $(selector).each(function(){
3290					
3291					var $this=$(this);
3292					
3293					if($this.data(pluginPfx)){ /* check if plugin has initialized */
3294						
3295						var d=$this.data(pluginPfx),o=d.opt,
3296							mCSB_container=$("#mCSB_"+d.idx+"_container"),
3297							mCustomScrollBox=$("#mCSB_"+d.idx),
3298							mCSB_dragger=[$("#mCSB_"+d.idx+"_dragger_vertical"),$("#mCSB_"+d.idx+"_dragger_horizontal")];
3299						
3300						if(!mCSB_container.length){return;}
3301						
3302						if(d.tweenRunning){_stop($this);} /* stop any running tweens while updating */
3303						
3304						if(cb && d && o.callbacks.onBeforeUpdate && typeof o.callbacks.onBeforeUpdate==="function"){o.callbacks.onBeforeUpdate.call(this);} /* callbacks: onBeforeUpdate */
3305						
3306						/* if element was disabled or destroyed, remove class(es) */
3307						if($this.hasClass(classes[3])){$this.removeClass(classes[3]);}
3308						if($this.hasClass(classes[4])){$this.removeClass(classes[4]);}
3309						
3310						/* css flexbox fix, detect/set max-height */
3311						mCustomScrollBox.css("max-height","none");
3312						if(mCustomScrollBox.height()!==$this.height()){mCustomScrollBox.css("max-height",$this.height());}
3313						
3314						_expandContentHorizontally.call(this); /* expand content horizontally */
3315						
3316						if(o.axis!=="y" && !o.advanced.autoExpandHorizontalScroll){
3317							mCSB_container.css("width",_contentWidth(mCSB_container));
3318						}
3319						
3320						d.overflowed=_overflowed.call(this); /* determine if scrolling is required */
3321						
3322						_scrollbarVisibility.call(this); /* show/hide scrollbar(s) */
3323						
3324						/* auto-adjust scrollbar dragger length analogous to content */
3325						if(o.autoDraggerLength){_setDraggerLength.call(this);}
3326						
3327						_scrollRatio.call(this); /* calculate and store scrollbar to content ratio */
3328						
3329						_bindEvents.call(this); /* bind scrollbar events */
3330						
3331						/* reset scrolling position and/or events */
3332						var to=[Math.abs(mCSB_container[0].offsetTop),Math.abs(mCSB_container[0].offsetLeft)];
3333						if(o.axis!=="x"){ /* y/yx axis */
3334							if(!d.overflowed[0]){ /* y scrolling is not required */
3335								_resetContentPosition.call(this); /* reset content position */
3336								if(o.axis==="y"){
3337									_unbindEvents.call(this);
3338								}else if(o.axis==="yx" && d.overflowed[1]){
3339									_scrollTo($this,to[1].toString(),{dir:"x",dur:0,overwrite:"none"});
3340								}
3341							}else if(mCSB_dragger[0].height()>mCSB_dragger[0].parent().height()){
3342								_resetContentPosition.call(this); /* reset content position */
3343							}else{ /* y scrolling is required */
3344								_scrollTo($this,to[0].toString(),{dir:"y",dur:0,overwrite:"none"});
3345								d.contentReset.y=null;
3346							}
3347						}
3348						if(o.axis!=="y"){ /* x/yx axis */
3349							if(!d.overflowed[1]){ /* x scrolling is not required */
3350								_resetContentPosition.call(this); /* reset content position */
3351								if(o.axis==="x"){
3352									_unbindEvents.call(this);
3353								}else if(o.axis==="yx" && d.overflowed[0]){
3354									_scrollTo($this,to[0].toString(),{dir:"y",dur:0,overwrite:"none"});
3355								}
3356							}else if(mCSB_dragger[1].width()>mCSB_dragger[1].parent().width()){
3357								_resetContentPosition.call(this); /* reset content position */
3358							}else{ /* x scrolling is required */
3359								_scrollTo($this,to[1].toString(),{dir:"x",dur:0,overwrite:"none"});
3360								d.contentReset.x=null;
3361							}
3362						}
3363						
3364						/* callbacks: onImageLoad, onSelectorChange, onUpdate */
3365						if(cb && d){
3366							if(cb===2 && o.callbacks.onImageLoad && typeof o.callbacks.onImageLoad==="function"){
3367								o.callbacks.onImageLoad.call(this);
3368							}else if(cb===3 && o.callbacks.onSelectorChange && typeof o.callbacks.onSelectorChange==="function"){
3369								o.callbacks.onSelectorChange.call(this);
3370							}else if(o.callbacks.onUpdate && typeof o.callbacks.onUpdate==="function"){
3371								o.callbacks.onUpdate.call(this);
3372							}
3373						}
3374						
3375						_autoUpdate.call(this); /* initialize automatic updating (for dynamic content, fluid layouts etc.) */
3376						
3377					}
3378					
3379				});
3380				
3381			},
3382			/* ---------------------------------------- */
3383			
3384			
3385			
3386			/* 
3387			plugin scrollTo method 
3388			triggers a scrolling event to a specific value
3389			----------------------------------------
3390			usage: $(selector).mCustomScrollbar("scrollTo",value,options);
3391			*/
3392		
3393			scrollTo:function(val,options){
3394				
3395				/* prevent silly things like $(selector).mCustomScrollbar("scrollTo",undefined); */
3396				if(typeof val=="undefined" || val==null){return;}
3397				
3398				var selector=_selector.call(this); /* validate selector */
3399				
3400				return $(selector).each(function(){
3401					
3402					var $this=$(this);
3403					
3404					if($this.data(pluginPfx)){ /* check if plugin has initialized */
3405					
3406						var d=$this.data(pluginPfx),o=d.opt,
3407							/* method default options */
3408							methodDefaults={
3409								trigger:"external", /* method is by default triggered externally (e.g. from other scripts) */
3410								scrollInertia:o.scrollInertia, /* scrolling inertia (animation duration) */
3411								scrollEasing:"mcsEaseInOut", /* animation easing */
3412								moveDragger:false, /* move dragger instead of content */
3413								timeout:60, /* scroll-to delay */
3414								callbacks:true, /* enable/disable callbacks */
3415								onStart:true,
3416								onUpdate:true,
3417								onComplete:true
3418							},
3419							methodOptions=$.extend(true,{},methodDefaults,options),
3420							to=_arr.call(this,val),dur=methodOptions.scrollInertia>0 && methodOptions.scrollInertia<17 ? 17 : methodOptions.scrollInertia;
3421						
3422						/* translate yx values to actual scroll-to positions */
3423						to[0]=_to.call(this,to[0],"y");
3424						to[1]=_to.call(this,to[1],"x");
3425						
3426						/* 
3427						check if scroll-to value moves the dragger instead of content. 
3428						Only pixel values apply on dragger (e.g. 100, "100px", "-=100" etc.) 
3429						*/
3430						if(methodOptions.moveDragger){
3431							to[0]*=d.scrollRatio.y;
3432							to[1]*=d.scrollRatio.x;
3433						}
3434						
3435						methodOptions.dur=_isTabHidden() ? 0 : dur; //skip animations if browser tab is hidden
3436						
3437						setTimeout(function(){ 
3438							/* do the scrolling */
3439							if(to[0]!==null && typeof to[0]!=="undefined" && o.axis!=="x" && d.overflowed[0]){ /* scroll y */
3440								methodOptions.dir="y";
3441								methodOptions.overwrite="all";
3442								_scrollTo($this,to[0].toString(),methodOptions);
3443							}
3444							if(to[1]!==null && typeof to[1]!=="undefined" && o.axis!=="y" && d.overflowed[1]){ /* scroll x */
3445								methodOptions.dir="x";
3446								methodOptions.overwrite="none";
3447								_scrollTo($this,to[1].toString(),methodOptions);
3448							}
3449						},methodOptions.timeout);
3450						
3451					}
3452					
3453				});
3454				
3455			},
3456			/* ---------------------------------------- */
3457			
3458			
3459			
3460			/*
3461			plugin stop method 
3462			stops scrolling animation
3463			----------------------------------------
3464			usage: $(selector).mCustomScrollbar("stop");
3465			*/
3466			stop:function(){
3467				
3468				var selector=_selector.call(this); /* validate selector */
3469				
3470				return $(selector).each(function(){
3471					
3472					var $this=$(this);
3473					
3474					if($this.data(pluginPfx)){ /* check if plugin has initialized */
3475										
3476						_stop($this);
3477					
3478					}
3479					
3480				});
3481				
3482			},
3483			/* ---------------------------------------- */
3484			
3485			
3486			
3487			/*
3488			plugin disable method 
3489			temporarily disables the scrollbar(s) 
3490			----------------------------------------
3491			usage: $(selector).mCustomScrollbar("disable",reset); 
3492			reset (boolean): resets content position to 0 
3493			*/
3494			disable:function(r){
3495				
3496				var selector=_selector.call(this); /* validate selector */
3497				
3498				return $(selector).each(function(){
3499					
3500					var $this=$(this);
3501					
3502					if($this.data(pluginPfx)){ /* check if plugin has initialized */
3503						
3504						var d=$this.data(pluginPfx);
3505						
3506						_autoUpdate.call(this,"remove"); /* remove automatic updating */
3507						
3508						_unbindEvents.call(this); /* unbind events */
3509						
3510						if(r){_resetContentPosition.call(this);} /* reset content position */
3511						
3512						_scrollbarVisibility.call(this,true); /* show/hide scrollbar(s) */
3513						
3514						$this.addClass(classes[3]); /* add disable class */
3515					
3516					}
3517					
3518				});
3519				
3520			},
3521			/* ---------------------------------------- */
3522			
3523			
3524			
3525			/*
3526			plugin destroy method 
3527			completely removes the scrollbar(s) and returns the element to its original state
3528			----------------------------------------
3529			usage: $(selector).mCustomScrollbar("destroy"); 
3530			*/
3531			destroy:function(){
3532				
3533				var selector=_selector.call(this); /* validate selector */
3534				
3535				return $(selector).each(function(){
3536					
3537					var $this=$(this);
3538					
3539					if($this.data(pluginPfx)){ /* check if plugin has initialized */
3540					
3541						var d=$this.data(pluginPfx),o=d.opt,
3542							mCustomScrollBox=$("#mCSB_"+d.idx),
3543							mCSB_container=$("#mCSB_"+d.idx+"_container"),
3544							scrollbar=$(".mCSB_"+d.idx+"_scrollbar");
3545					
3546						if(o.live){removeLiveTimers(o.liveSelector || $(selector).selector);} /* remove live timers */
3547						
3548						_autoUpdate.call(this,"remove"); /* remove automatic updating */
3549						
3550						_unbindEvents.call(this); /* unbind events */
3551						
3552						_resetContentPosition.call(this); /* reset content position */
3553						
3554						$this.removeData(pluginPfx); /* remove plugin data object */
3555						
3556						_delete(this,"mcs"); /* delete callbacks object */
3557						
3558						/* remove plugin markup */
3559						scrollbar.remove(); /* remove scrollbar(s) first (those can be either inside or outside plugin's inner wrapper) */
3560						mCSB_container.find("img."+classes[2]).removeClass(classes[2]); /* remove loaded images flag */
3561						mCustomScrollBox.replaceWith(mCSB_container.contents()); /* replace plugin's inner wrapper with the original content */
3562						/* remove plugin classes from the element and add destroy class */
3563						$this.removeClass(pluginNS+" _"+pluginPfx+"_"+d.idx+" "+classes[6]+" "+classes[7]+" "+classes[5]+" "+classes[3]).addClass(classes[4]);
3564					
3565					}
3566					
3567				});
3568				
3569			}
3570			/* ---------------------------------------- */
3571			
3572		},
3573	
3574	
3575	
3576	
3577		
3578	/* 
3579	----------------------------------------
3580	FUNCTIONS
3581	----------------------------------------
3582	*/
3583	
3584		/* validates selector (if selector is invalid or undefined uses the default one) */
3585		_selector=function(){
3586			return (typeof $(this)!=="object" || $(this).length<1) ? defaultSelector : this;
3587		},
3588		/* -------------------- */
3589		
3590		
3591		/* changes options according to theme */
3592		_theme=function(obj){
3593			var fixedSizeScrollbarThemes=["rounded","rounded-dark","rounded-dots","rounded-dots-dark"],
3594				nonExpandedScrollbarThemes=["rounded-dots","rounded-dots-dark","3d","3d-dark","3d-thick","3d-thick-dark","inset","inset-dark","inset-2","inset-2-dark","inset-3","inset-3-dark"],
3595				disabledScrollButtonsThemes=["minimal","minimal-dark"],
3596				enabledAutoHideScrollbarThemes=["minimal","minimal-dark"],
3597				scrollbarPositionOutsideThemes=["minimal","minimal-dark"];
3598			obj.autoDraggerLength=$.inArray(obj.theme,fixedSizeScrollbarThemes) > -1 ? false : obj.autoDraggerLength;
3599			obj.autoExpandScrollbar=$.inArray(obj.theme,nonExpandedScrollbarThemes) > -1 ? false : obj.autoExpandScrollbar;
3600			obj.scrollButtons.enable=$.inArray(obj.theme,disabledScrollButtonsThemes) > -1 ? false : obj.scrollButtons.enable;
3601			obj.autoHideScrollbar=$.inArray(obj.theme,enabledAutoHideScrollbarThemes) > -1 ? true : obj.autoHideScrollbar;
3602			obj.scrollbarPosition=$.inArray(obj.theme,scrollbarPositionOutsideThemes) > -1 ? "outside" : obj.scrollbarPosition;
3603		},
3604		/* -------------------- */
3605		
3606		
3607		/* live option timers removal */
3608		removeLiveTimers=function(selector){
3609			if(liveTimers[selector]){
3610				clearTimeout(liveTimers[selector]);
3611				_delete(liveTimers,selector);
3612			}
3613		},
3614		/* -------------------- */
3615		
3616		
3617		/* normalizes axis option to valid values: "y", "x", "yx" */
3618		_findAxis=function(val){
3619			return (val==="yx" || val==="xy" || val==="auto") ? "yx" : (val==="x" || val==="horizontal") ? "x" : "y";
3620		},
3621		/* -------------------- */
3622		
3623		
3624		/* normalizes scrollButtons.scrollType option to valid values: "stepless", "stepped" */
3625		_findScrollButtonsType=function(val){
3626			return (val==="stepped" || val==="pixels" || val==="step" || val==="click") ? "stepped" : "stepless";
3627		},
3628		/* -------------------- */
3629		
3630		
3631		/* generates plugin markup */
3632		_pluginMarkup=function(){
3633			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
3634				expandClass=o.autoExpandScrollbar ? " "+classes[1]+"_expand" : "",
3635				scrollbar=["<div id='mCSB_"+d.idx+"_scrollbar_vertical' class='mCSB_scrollTools mCSB_"+d.idx+"_scrollbar mCS-"+o.theme+" mCSB_scrollTools_vertical"+expandClass+"'><div class='"+classes[12]+"'><div id='mCSB_"+d.idx+"_dragger_vertical' class='mCSB_dragger' style='position:absolute;'><div class='mCSB_dragger_bar' /></div><div class='mCSB_draggerRail' /></div></div>","<div id='mCSB_"+d.idx+"_scrollbar_horizontal' class='mCSB_scrollTools mCSB_"+d.idx+"_scrollbar mCS-"+o.theme+" mCSB_scrollTools_horizontal"+expandClass+"'><div class='"+classes[12]+"'><div id='mCSB_"+d.idx+"_dragger_horizontal' class='mCSB_dragger' style='position:absolute;'><div class='mCSB_dragger_bar' /></div><div class='mCSB_draggerRail' /></div></div>"],
3636				wrapperClass=o.axis==="yx" ? "mCSB_vertical_horizontal" : o.axis==="x" ? "mCSB_horizontal" : "mCSB_vertical",
3637				scrollbars=o.axis==="yx" ? scrollbar[0]+scrollbar[1] : o.axis==="x" ? scrollbar[1] : scrollbar[0],
3638				contentWrapper=o.axis==="yx" ? "<div id='mCSB_"+d.idx+"_container_wrapper' class='mCSB_container_wrapper' />" : "",
3639				autoHideClass=o.autoHideScrollbar ? " "+classes[6] : "",
3640				scrollbarDirClass=(o.axis!=="x" && d.langDir==="rtl") ? " "+classes[7] : "";
3641			if(o.setWidth){$this.css("width",o.setWidth);} /* set element width */
3642			if(o.setHeight){$this.css("height",o.setHeight);} /* set element height */
3643			o.setLeft=(o.axis!=="y" && d.langDir==="rtl") ? "989999px" : o.setLeft; /* adjust left position for rtl direction */
3644			$this.addClass(pluginNS+" _"+pluginPfx+"_"+d.idx+autoHideClass+scrollbarDirClass).wrapInner("<div id='mCSB_"+d.idx+"' class='mCustomScrollBox mCS-"+o.theme+" "+wrapperClass+"'><div id='mCSB_"+d.idx+"_container' class='mCSB_container' style='position:relative; top:"+o.setTop+"; left:"+o.setLeft+";' dir='"+d.langDir+"' /></div>");
3645			var mCustomScrollBox=$("#mCSB_"+d.idx),
3646				mCSB_container=$("#mCSB_"+d.idx+"_container");
3647			if(o.axis!=="y" && !o.advanced.autoExpandHorizontalScroll){
3648				mCSB_container.css("width",_contentWidth(mCSB_container));
3649			}
3650			if(o.scrollbarPosition==="outside"){
3651				if($this.css("position")==="static"){ /* requires elements with non-static position */
3652					$this.css("position","relative");
3653				}
3654				$this.css("overflow","visible");
3655				mCustomScrollBox.addClass("mCSB_outside").after(scrollbars);
3656			}else{
3657				mCustomScrollBox.addClass("mCSB_inside").append(scrollbars);
3658				mCSB_container.wrap(contentWrapper);
3659			}
3660			_scrollButtons.call(this); /* add scrollbar buttons */
3661			/* minimum dragger length */
3662			var mCSB_dragger=[$("#mCSB_"+d.idx+"_dragger_vertical"),$("#mCSB_"+d.idx+"_dragger_horizontal")];
3663			mCSB_dragger[0].css("min-height",mCSB_dragger[0].height());
3664			mCSB_dragger[1].css("min-width",mCSB_dragger[1].width());
3665		},
3666		/* -------------------- */
3667		
3668		
3669		/* calculates content width */
3670		_contentWidth=function(el){
3671			var val=[el[0].scrollWidth,Math.max.apply(Math,el.children().map(function(){return $(this).outerWidth(true);}).get())],w=el.parent().width();
3672			return val[0]>w ? val[0] : val[1]>w ? val[1] : "100%";
3673		},
3674		/* -------------------- */
3675		
3676		
3677		/* expands content horizontally */
3678		_expandContentHorizontally=function(){
3679			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
3680				mCSB_container=$("#mCSB_"+d.idx+"_container");
3681			if(o.advanced.autoExpandHorizontalScroll && o.axis!=="y"){
3682				/* calculate scrollWidth */
3683				mCSB_container.css({"width":"auto","min-width":0,"overflow-x":"scroll"});
3684				var w=Math.ceil(mCSB_container[0].scrollWidth);
3685				if(o.advanced.autoExpandHorizontalScroll===3 || (o.advanced.autoExpandHorizontalScroll!==2 && w>mCSB_container.parent().width())){
3686					mCSB_container.css({"width":w,"min-width":"100%","overflow-x":"inherit"});
3687				}else{
3688					/* 
3689					wrap content with an infinite width div and set its position to absolute and width to auto. 
3690					Setting width to auto before calculating the actual width is important! 
3691					We must let the browser set the width as browser zoom values are impossible to calculate.
3692					*/
3693					mCSB_container.css({"overflow-x":"inherit","position":"absolute"})
3694						.wrap("<div class='mCSB_h_wrapper' style='position:relative; left:0; width:999999px;' />")
3695						.css({ /* set actual width, original position and un-wrap */
3696							/* 
3697							get the exact width (with decimals) and then round-up. 
3698							Using jquery outerWidth() will round the width value which will mess up with inner elements that have non-integer width
3699							*/
3700							"width":(Math.ceil(mCSB_container[0].getBoundingClientRect().right+0.4)-Math.floor(mCSB_container[0].getBoundingClientRect().left)),
3701							"min-width":"100%",
3702							"position":"relative"
3703						}).unwrap();
3704				}
3705			}
3706		},
3707		/* -------------------- */
3708		
3709		
3710		/* adds scrollbar buttons */
3711		_scrollButtons=function(){
3712			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
3713				mCSB_scrollTools=$(".mCSB_"+d.idx+"_scrollbar:first"),
3714				tabindex=!_isNumeric(o.scrollButtons.tabindex) ? "" : "tabindex='"+o.scrollButtons.tabindex+"'",
3715				btnHTML=[
3716					"<a href='#' class='"+classes[13]+"' "+tabindex+" />",
3717					"<a href='#' class='"+classes[14]+"' "+tabindex+" />",
3718					"<a href='#' class='"+classes[15]+"' "+tabindex+" />",
3719					"<a href='#' class='"+classes[16]+"' "+tabindex+" />"
3720				],
3721				btn=[(o.axis==="x" ? btnHTML[2] : btnHTML[0]),(o.axis==="x" ? btnHTML[3] : btnHTML[1]),btnHTML[2],btnHTML[3]];
3722			if(o.scrollButtons.enable){
3723				mCSB_scrollTools.prepend(btn[0]).append(btn[1]).next(".mCSB_scrollTools").prepend(btn[2]).append(btn[3]);
3724			}
3725		},
3726		/* -------------------- */
3727		
3728		
3729		/* auto-adjusts scrollbar dragger length */
3730		_setDraggerLength=function(){
3731			var $this=$(this),d=$this.data(pluginPfx),
3732				mCustomScrollBox=$("#mCSB_"+d.idx),
3733				mCSB_container=$("#mCSB_"+d.idx+"_container"),
3734				mCSB_dragger=[$("#mCSB_"+d.idx+"_dragger_vertical"),$("#mCSB_"+d.idx+"_dragger_horizontal")],
3735				ratio=[mCustomScrollBox.height()/mCSB_container.outerHeight(false),mCustomScrollBox.width()/mCSB_container.outerWidth(false)],
3736				l=[
3737					parseInt(mCSB_dragger[0].css("min-height")),Math.round(ratio[0]*mCSB_dragger[0].parent().height()),
3738					parseInt(mCSB_dragger[1].css("min-width")),Math.round(ratio[1]*mCSB_dragger[1].parent().width())
3739				],
3740				h=oldIE && (l[1]<l[0]) ? l[0] : l[1],w=oldIE && (l[3]<l[2]) ? l[2] : l[3];
3741			mCSB_dragger[0].css({
3742				"height":h,"max-height":(mCSB_dragger[0].parent().height()-10)
3743			}).find(".mCSB_dragger_bar").css({"line-height":l[0]+"px"});
3744			mCSB_dragger[1].css({
3745				"width":w,"max-width":(mCSB_dragger[1].parent().width()-10)
3746			});
3747		},
3748		/* -------------------- */
3749		
3750		
3751		/* calculates scrollbar to content ratio */
3752		_scrollRatio=function(){
3753			var $this=$(this),d=$this.data(pluginPfx),
3754				mCustomScrollBox=$("#mCSB_"+d.idx),
3755				mCSB_container=$("#mCSB_"+d.idx+"_container"),
3756				mCSB_dragger=[$("#mCSB_"+d.idx+"_dragger_vertical"),$("#mCSB_"+d.idx+"_dragger_horizontal")],
3757				scrollAmount=[mCSB_container.outerHeight(false)-mCustomScrollBox.height(),mCSB_container.outerWidth(false)-mCustomScrollBox.width()],
3758				ratio=[
3759					scrollAmount[0]/(mCSB_dragger[0].parent().height()-mCSB_dragger[0].height()),
3760					scrollAmount[1]/(mCSB_dragger[1].parent().width()-mCSB_dragger[1].width())
3761				];
3762			d.scrollRatio={y:ratio[0],x:ratio[1]};
3763		},
3764		/* -------------------- */
3765		
3766		
3767		/* toggles scrolling classes */
3768		_onDragClasses=function(el,action,xpnd){
3769			var expandClass=xpnd ? classes[0]+"_expanded" : "",
3770				scrollbar=el.closest(".mCSB_scrollTools");
3771			if(action==="active"){
3772				el.toggleClass(classes[0]+" "+expandClass); scrollbar.toggleClass(classes[1]); 
3773				el[0]._draggable=el[0]._draggable ? 0 : 1;
3774			}else{
3775				if(!el[0]._draggable){
3776					if(action==="hide"){
3777						el.removeClass(classes[0]); scrollbar.removeClass(classes[1]);
3778					}else{
3779						el.addClass(classes[0]); scrollbar.addClass(classes[1]);
3780					}
3781				}
3782			}
3783		},
3784		/* -------------------- */
3785		
3786		
3787		/* checks if content overflows its container to determine if scrolling is required */
3788		_overflowed=function(){
3789			var $this=$(this),d=$this.data(pluginPfx),
3790				mCustomScrollBox=$("#mCSB_"+d.idx),
3791				mCSB_container=$("#mCSB_"+d.idx+"_container"),
3792				contentHeight=d.overflowed==null ? mCSB_container.height() : mCSB_container.outerHeight(false),
3793				contentWidth=d.overflowed==null ? mCSB_container.width() : mCSB_container.outerWidth(false),
3794				h=mCSB_container[0].scrollHeight,w=mCSB_container[0].scrollWidth;
3795			if(h>contentHeight){contentHeight=h;}
3796			if(w>contentWidth){contentWidth=w;}
3797			return [contentHeight>mCustomScrollBox.height(),contentWidth>mCustomScrollBox.width()];
3798		},
3799		/* -------------------- */
3800		
3801		
3802		/* resets content position to 0 */
3803		_resetContentPosition=function(){
3804			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
3805				mCustomScrollBox=$("#mCSB_"+d.idx),
3806				mCSB_container=$("#mCSB_"+d.idx+"_container"),
3807				mCSB_dragger=[$("#mCSB_"+d.idx+"_dragger_vertical"),$("#mCSB_"+d.idx+"_dragger_horizontal")];
3808			_stop($this); /* stop any current scrolling before resetting */
3809			if((o.axis!=="x" && !d.overflowed[0]) || (o.axis==="y" && d.overflowed[0])){ /* reset y */
3810				mCSB_dragger[0].add(mCSB_container).css("top",0);
3811				_scrollTo($this,"_resetY");
3812			}
3813			if((o.axis!=="y" && !d.overflowed[1]) || (o.axis==="x" && d.overflowed[1])){ /* reset x */
3814				var cx=dx=0;
3815				if(d.langDir==="rtl"){ /* adjust left position for rtl direction */
3816					cx=mCustomScrollBox.width()-mCSB_container.outerWidth(false);
3817					dx=Math.abs(cx/d.scrollRatio.x);
3818				}
3819				mCSB_container.css("left",cx);
3820				mCSB_dragger[1].css("left",dx);
3821				_scrollTo($this,"_resetX");
3822			}
3823		},
3824		/* -------------------- */
3825		
3826		
3827		/* binds scrollbar events */
3828		_bindEvents=function(){
3829			var $this=$(this),d=$this.data(pluginPfx),o=d.opt;
3830			if(!d.bindEvents){ /* check if events are already bound */
3831				_draggable.call(this);
3832				if(o.contentTouchScroll){_contentDraggable.call(this);}
3833				_selectable.call(this);
3834				if(o.mouseWheel.enable){ /* bind mousewheel fn when plugin is available */
3835					function _mwt(){
3836						mousewheelTimeout=setTimeout(function(){
3837							if(!$.event.special.mousewheel){
3838								_mwt();
3839							}else{
3840								clearTimeout(mousewheelTimeout);
3841								_mousewheel.call($this[0]);
3842							}
3843						},100);
3844					}
3845					var mousewheelTimeout;
3846					_mwt();
3847				}
3848				_draggerRail.call(this);
3849				_wrapperScroll.call(this);
3850				if(o.advanced.autoScrollOnFocus){_focus.call(this);}
3851				if(o.scrollButtons.enable){_buttons.call(this);}
3852				if(o.keyboard.enable){_keyboard.call(this);}
3853				d.bindEvents=true;
3854			}
3855		},
3856		/* -------------------- */
3857		
3858		
3859		/* unbinds scrollbar events */
3860		_unbindEvents=function(){
3861			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
3862				namespace=pluginPfx+"_"+d.idx,
3863				sb=".mCSB_"+d.idx+"_scrollbar",
3864				sel=$("#mCSB_"+d.idx+",#mCSB_"+d.idx+"_container,#mCSB_"+d.idx+"_container_wrapper,"+sb+" ."+classes[12]+",#mCSB_"+d.idx+"_dragger_vertical,#mCSB_"+d.idx+"_dragger_horizontal,"+sb+">a"),
3865				mCSB_container=$("#mCSB_"+d.idx+"_container");
3866			if(o.advanced.releaseDraggableSelectors){sel.add($(o.advanced.releaseDraggableSelectors));}
3867			if(o.advanced.extraDraggableSelectors){sel.add($(o.advanced.extraDraggableSelectors));}
3868			if(d.bindEvents){ /* check if events are bound */
3869				/* unbind namespaced events from document/selectors */
3870				$(document).add($(!_canAccessIFrame() || top.document)).unbind("."+namespace);
3871				sel.each(function(){
3872					$(this).unbind("."+namespace);
3873				});
3874				/* clear and delete timeouts/objects */
3875				clearTimeout($this[0]._focusTimeout); _delete($this[0],"_focusTimeout");
3876				clearTimeout(d.sequential.step); _delete(d.sequential,"step");
3877				clearTimeout(mCSB_container[0].onCompleteTimeout); _delete(mCSB_container[0],"onCompleteTimeout");
3878				d.bindEvents=false;
3879			}
3880		},
3881		/* -------------------- */
3882		
3883		
3884		/* toggles scrollbar visibility */
3885		_scrollbarVisibility=function(disabled){
3886			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
3887				contentWrapper=$("#mCSB_"+d.idx+"_container_wrapper"),
3888				content=contentWrapper.length ? contentWrapper : $("#mCSB_"+d.idx+"_container"),
3889				scrollbar=[$("#mCSB_"+d.idx+"_scrollbar_vertical"),$("#mCSB_"+d.idx+"_scrollbar_horizontal")],
3890				mCSB_dragger=[scrollbar[0].find(".mCSB_dragger"),scrollbar[1].find(".mCSB_dragger")];
3891			if(o.axis!=="x"){
3892				if(d.overflowed[0] && !disabled){
3893					scrollbar[0].add(mCSB_dragger[0]).add(scrollbar[0].children("a")).css("display","block");
3894					content.removeClass(classes[8]+" "+classes[10]);
3895				}else{
3896					if(o.alwaysShowScrollbar){
3897						if(o.alwaysShowScrollbar!==2){mCSB_dragger[0].css("display","none");}
3898						content.removeClass(classes[10]);
3899					}else{
3900						scrollbar[0].css("display","none");
3901						content.addClass(classes[10]);
3902					}
3903					content.addClass(classes[8]);
3904				}
3905			}
3906			if(o.axis!=="y"){
3907				if(d.overflowed[1] && !disabled){
3908					scrollbar[1].add(mCSB_dragger[1]).add(scrollbar[1].children("a")).css("display","block");
3909					content.removeClass(classes[9]+" "+classes[11]);
3910				}else{
3911					if(o.alwaysShowScrollbar){
3912						if(o.alwaysShowScrollbar!==2){mCSB_dragger[1].css("display","none");}
3913						content.removeClass(classes[11]);
3914					}else{
3915						scrollbar[1].css("display","none");
3916						content.addClass(classes[11]);
3917					}
3918					content.addClass(classes[9]);
3919				}
3920			}
3921			if(!d.overflowed[0] && !d.overflowed[1]){
3922				$this.addClass(classes[5]);
3923			}else{
3924				$this.removeClass(classes[5]);
3925			}
3926		},
3927		/* -------------------- */
3928		
3929		
3930		/* returns input coordinates of pointer, touch and mouse events (relative to document) */
3931		_coordinates=function(e){
3932			var t=e.type,o=e.target.ownerDocument!==document && frameElement!==null ? [$(frameElement).offset().top,$(frameElement).offset().left] : null,
3933				io=_canAccessIFrame() && e.target.ownerDocument!==top.document && frameElement!==null ? [$(e.view.frameElement).offset().top,$(e.view.frameElement).offset().left] : [0,0];
3934			switch(t){
3935				case "pointerdown": case "MSPointerDown": case "pointermove": case "MSPointerMove": case "pointerup": case "MSPointerUp":
3936					return o ? [e.originalEvent.pageY-o[0]+io[0],e.originalEvent.pageX-o[1]+io[1],false] : [e.originalEvent.pageY,e.originalEvent.pageX,false];
3937					break;
3938				case "touchstart": case "touchmove": case "touchend":
3939					var touch=e.originalEvent.touches[0] || e.originalEvent.changedTouches[0],
3940						touches=e.originalEvent.touches.length || e.originalEvent.changedTouches.length;
3941					return e.target.ownerDocument!==document ? [touch.screenY,touch.screenX,touches>1] : [touch.pageY,touch.pageX,touches>1];
3942					break;
3943				default:
3944					return o ? [e.pageY-o[0]+io[0],e.pageX-o[1]+io[1],false] : [e.pageY,e.pageX,false];
3945			}
3946		},
3947		/* -------------------- */
3948		
3949		
3950		/* 
3951		SCROLLBAR DRAG EVENTS
3952		scrolls content via scrollbar dragging 
3953		*/
3954		_draggable=function(){
3955			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
3956				namespace=pluginPfx+"_"+d.idx,
3957				draggerId=["mCSB_"+d.idx+"_dragger_vertical","mCSB_"+d.idx+"_dragger_horizontal"],
3958				mCSB_container=$("#mCSB_"+d.idx+"_container"),
3959				mCSB_dragger=$("#"+draggerId[0]+",#"+draggerId[1]),
3960				draggable,dragY,dragX,
3961				rds=o.advanced.releaseDraggableSelectors ? mCSB_dragger.add($(o.advanced.releaseDraggableSelectors)) : mCSB_dragger,
3962				eds=o.advanced.extraDraggableSelectors ? $(!_canAccessIFrame() || top.document).add($(o.advanced.extraDraggableSelectors)) : $(!_canAccessIFrame() || top.document);
3963			mCSB_dragger.bind("contextmenu."+namespace,function(e){
3964				e.preventDefault(); //prevent right click
3965			}).bind("mousedown."+namespace+" touchstart."+namespace+" pointerdown."+namespace+" MSPointerDown."+namespace,function(e){
3966				e.stopImmediatePropagation();
3967				e.preventDefault();
3968				if(!_mouseBtnLeft(e)){return;} /* left mouse button only */
3969				touchActive=true;
3970				if(oldIE){document.onselectstart=function(){return false;}} /* disable text selection for IE < 9 */
3971				_iframe.call(mCSB_container,false); /* enable scrollbar dragging over iframes by disabling their events */
3972				_stop($this);
3973				draggable=$(this);
3974				var offset=draggable.offset(),y=_coordinates(e)[0]-offset.top,x=_coordinates(e)[1]-offset.left,
3975					h=draggable.height()+offset.top,w=draggable.width()+offset.left;
3976				if(y<h && y>0 && x<w && x>0){
3977					dragY=y; 
3978					dragX=x;
3979				}
3980				_onDragClasses(draggable,"active",o.autoExpandScrollbar); 
3981			}).bind("touchmove."+namespace,function(e){
3982				e.stopImmediatePropagation();
3983				e.preventDefault();
3984				var offset=draggable.offset(),y=_coordinates(e)[0]-offset.top,x=_coordinates(e)[1]-offset.left;
3985				_drag(dragY,dragX,y,x);
3986			});
3987			$(document).add(eds).bind("mousemove."+namespace+" pointermove."+namespace+" MSPointerMove."+namespace,function(e){
3988				if(draggable){
3989					var offset=draggable.offset(),y=_coordinates(e)[0]-offset.top,x=_coordinates(e)[1]-offset.left;
3990					if(dragY===y && dragX===x){return;} /* has it really moved? */
3991					_drag(dragY,dragX,y,x);
3992				}
3993			}).add(rds).bind("mouseup."+namespace+" touchend."+namespace+" pointerup."+namespace+" MSPointerUp."+namespace,function(e){
3994				if(draggable){
3995					_onDragClasses(draggable,"active",o.autoExpandScrollbar); 
3996					draggable=null;
3997				}
3998				touchActive=false;
3999				if(oldIE){document.onselectstart=null;} /* enable text selection for IE < 9 */
4000				_iframe.call(mCSB_container,true); /* enable iframes events */
4001			});
4002			function _drag(dragY,dragX,y,x){
4003				mCSB_container[0].idleTimer=o.scrollInertia<233 ? 250 : 0;
4004				if(draggable.attr("id")===draggerId[1]){
4005					var dir="x",to=((draggable[0].offsetLeft-dragX)+x)*d.scrollRatio.x;
4006				}else{
4007					var dir="y",to=((draggable[0].offsetTop-dragY)+y)*d.scrollRatio.y;
4008				}
4009				_scrollTo($this,to.toString(),{dir:dir,drag:true});
4010			}
4011		},
4012		/* -------------------- */
4013		
4014		
4015		/* 
4016		TOUCH SWIPE EVENTS
4017		scrolls content via touch swipe 
4018		Emulates the native touch-swipe scrolling with momentum found in iOS, Android and WP devices 
4019		*/
4020		_contentDraggable=function(){
4021			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
4022				namespace=pluginPfx+"_"+d.idx,
4023				mCustomScrollBox=$("#mCSB_"+d.idx),
4024				mCSB_container=$("#mCSB_"+d.idx+"_container"),
4025				mCSB_dragger=[$("#mCSB_"+d.idx+"_dragger_vertical"),$("#mCSB_"+d.idx+"_dragger_horizontal")],
4026				draggable,dragY,dragX,touchStartY,touchStartX,touchMoveY=[],touchMoveX=[],startTime,runningTime,endTime,distance,speed,amount,
4027				durA=0,durB,overwrite=o.axis==="yx" ? "none" : "all",touchIntent=[],touchDrag,docDrag,
4028				iframe=mCSB_container.find("iframe"),
4029				events=[
4030					"touchstart."+namespace+" pointerdown."+namespace+" MSPointerDown."+namespace, //start
4031					"touchmove."+namespace+" pointermove."+namespace+" MSPointerMove."+namespace, //move
4032					"touchend."+namespace+" pointerup."+namespace+" MSPointerUp."+namespace //end
4033				],
4034				touchAction=document.body.style.touchAction!==undefined && document.body.style.touchAction!=="";
4035			mCSB_container.bind(events[0],function(e){
4036				_onTouchstart(e);
4037			}).bind(events[1],function(e){
4038				_onTouchmove(e);
4039			});
4040			mCustomScrollBox.bind(events[0],function(e){
4041				_onTouchstart2(e);
4042			}).bind(events[2],function(e){
4043				_onTouchend(e);
4044			});
4045			if(iframe.length){
4046				iframe.each(function(){
4047					$(this).bind("load",function(){
4048						/* bind events on accessible iframes */
4049						if(_canAccessIFrame(this)){
4050							$(this.contentDocument || this.contentWindow.document).bind(events[0],function(e){
4051								_onTouchstart(e);
4052								_onTouchstart2(e);
4053							}).bind(events[1],function(e){
4054								_onTouchmove(e);
4055							}).bind(events[2],function(e){
4056								_onTouchend(e);
4057							});
4058						}
4059					});
4060				});
4061			}
4062			function _onTouchstart(e){
4063				if(!_pointerTouch(e) || touchActive || _coordinates(e)[2]){touchable=0; return;}
4064				touchable=1; touchDrag=0; docDrag=0; draggable=1;
4065				$this.removeClass("mCS_touch_action");
4066				var offset=mCSB_container.offset();
4067				dragY=_coordinates(e)[0]-offset.top;
4068				dragX=_coordinates(e)[1]-offset.left;
4069				touchIntent=[_coordinates(e)[0],_coordinates(e)[1]];
4070			}
4071			function _onTouchmove(e){
4072				if(!_pointerTouch(e) || touchActive || _coordinates(e)[2]){return;}
4073				if(!o.documentTouchScroll){e.preventDefault();} 
4074				e.stopImmediatePropagation();
4075				if(docDrag && !touchDrag){return;}
4076				if(draggable){
4077					runningTime=_getTime();
4078					var offset=mCustomScrollBox.offset(),y=_coordinates(e)[0]-offset.top,x=_coordinates(e)[1]-offset.left,
4079						easing="mcsLinearOut";
4080					touchMoveY.push(y);
4081					touchMoveX.push(x);
4082					touchIntent[2]=Math.abs(_coordinates(e)[0]-touchIntent[0]); touchIntent[3]=Math.abs(_coordinates(e)[1]-touchIntent[1]);
4083					if(d.overflowed[0]){
4084						var limit=mCSB_dragger[0].parent().height()-mCSB_dragger[0].height(),
4085							prevent=((dragY-y)>0 && (y-dragY)>-(limit*d.scrollRatio.y) && (touchIntent[3]*2<touchIntent[2] || o.axis==="yx"));
4086					}
4087					if(d.overflowed[1]){
4088						var limitX=mCSB_dragger[1].parent().width()-mCSB_dragger[1].width(),
4089							preventX=((dragX-x)>0 && (x-dragX)>-(limitX*d.scrollRatio.x) && (touchIntent[2]*2<touchIntent[3] || o.axis==="yx"));
4090					}
4091					if(prevent || preventX){ /* prevent native document scrolling */
4092						if(!touchAction){e.preventDefault();} 
4093						touchDrag=1;
4094					}else{
4095						docDrag=1;
4096						$this.addClass("mCS_touch_action");
4097					}
4098					if(touchAction){e.preventDefault();} 
4099					amount=o.axis==="yx" ? [(dragY-y),(dragX-x)] : o.axis==="x" ? [null,(dragX-x)] : [(dragY-y),null];
4100					mCSB_container[0].idleTimer=250;
4101					if(d.overflowed[0]){_drag(amount[0],durA,easing,"y","all",true);}
4102					if(d.overflowed[1]){_drag(amount[1],durA,easing,"x",overwrite,true);}
4103				}
4104			}
4105			function _onTouchstart2(e){
4106				if(!_pointerTouch(e) || touchActive || _coordinates(e)[2]){touchable=0; return;}
4107				touchable=1;
4108				e.stopImmediatePropagation();
4109				_stop($this);
4110				startTime=_getTime();
4111				var offset=mCustomScrollBox.offset();
4112				touchStartY=_coordinates(e)[0]-offset.top;
4113				touchStartX=_coordinates(e)[1]-offset.left;
4114				touchMoveY=[]; touchMoveX=[];
4115			}
4116			function _onTouchend(e){
4117				if(!_pointerTouch(e) || touchActive || _coordinates(e)[2]){return;}
4118				draggable=0;
4119				e.stopImmediatePropagation();
4120				touchDrag=0; docDrag=0;
4121				endTime=_getTime();
4122				var offset=mCustomScrollBox.offset(),y=_coordinates(e)[0]-offset.top,x=_coordinates(e)[1]-offset.left;
4123				if((endTime-runningTime)>30){return;}
4124				speed=1000/(endTime-startTime);
4125				var easing="mcsEaseOut",slow=speed<2.5,
4126					diff=slow ? [touchMoveY[touchMoveY.length-2],touchMoveX[touchMoveX.length-2]] : [0,0];
4127				distance=slow ? [(y-diff[0]),(x-diff[1])] : [y-touchStartY,x-touchStartX];
4128				var absDistance=[Math.abs(distance[0]),Math.abs(distance[1])];
4129				speed=slow ? [Math.abs(distance[0]/4),Math.abs(distance[1]/4)] : [speed,speed];
4130				var a=[
4131					Math.abs(mCSB_container[0].offsetTop)-(distance[0]*_m((absDistance[0]/speed[0]),speed[0])),
4132					Math.abs(mCSB_container[0].offsetLeft)-(distance[1]*_m((absDistance[1]/speed[1]),speed[1]))
4133				];
4134				amount=o.axis==="yx" ? [a[0],a[1]] : o.axis==="x" ? [null,a[1]] : [a[0],null];
4135				durB=[(absDistance[0]*4)+o.scrollInertia,(absDistance[1]*4)+o.scrollInertia];
4136				var md=parseInt(o.contentTouchScroll) || 0; /* absolute minimum distance required */
4137				amount[0]=absDistance[0]>md ? amount[0] : 0;
4138				amount[1]=absDistance[1]>md ? amount[1] : 0;
4139				if(d.overflowed[0]){_drag(amount[0],durB[0],easing,"y",overwrite,false);}
4140				if(d.overflowed[1]){_drag(amount[1],durB[1],easing,"x",overwrite,false);}
4141			}
4142			function _m(ds,s){
4143				var r=[s*1.5,s*2,s/1.5,s/2];
4144				if(ds>90){
4145					return s>4 ? r[0] : r[3];
4146				}else if(ds>60){
4147					return s>3 ? r[3] : r[2];
4148				}else if(ds>30){
4149					return s>8 ? r[1] : s>6 ? r[0] : s>4 ? s : r[2];
4150				}else{
4151					return s>8 ? s : r[3];
4152				}
4153			}
4154			function _drag(amount,dur,easing,dir,overwrite,drag){
4155				if(!amount){return;}
4156				_scrollTo($this,amount.toString(),{dur:dur,scrollEasing:easing,dir:dir,overwrite:overwrite,drag:drag});
4157			}
4158		},
4159		/* -------------------- */
4160		
4161		
4162		/* 
4163		SELECT TEXT EVENTS 
4164		scrolls content when text is selected 
4165		*/
4166		_selectable=function(){
4167			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,seq=d.sequential,
4168				namespace=pluginPfx+"_"+d.idx,
4169				mCSB_container=$("#mCSB_"+d.idx+"_container"),
4170				wrapper=mCSB_container.parent(),
4171				action;
4172			mCSB_container.bind("mousedown."+namespace,function(e){
4173				if(touchable){return;}
4174				if(!action){action=1; touchActive=true;}
4175			}).add(document).bind("mousemove."+namespace,function(e){
4176				if(!touchable && action && _sel()){
4177					var offset=mCSB_container.offset(),
4178						y=_coordinates(e)[0]-offset.top+mCSB_container[0].offsetTop,x=_coordinates(e)[1]-offset.left+mCSB_container[0].offsetLeft;
4179					if(y>0 && y<wrapper.height() && x>0 && x<wrapper.width()){
4180						if(seq.step){_seq("off",null,"stepped");}
4181					}else{
4182						if(o.axis!=="x" && d.overflowed[0]){
4183							if(y<0){
4184								_seq("on",38);
4185							}else if(y>wrapper.height()){
4186								_seq("on",40);
4187							}
4188						}
4189						if(o.axis!=="y" && d.overflowed[1]){
4190							if(x<0){
4191								_seq("on",37);
4192							}else if(x>wrapper.width()){
4193								_seq("on",39);
4194							}
4195						}
4196					}
4197				}
4198			}).bind("mouseup."+namespace+" dragend."+namespace,function(e){
4199				if(touchable){return;}
4200				if(action){action=0; _seq("off",null);}
4201				touchActive=false;
4202			});
4203			function _sel(){
4204				return 	window.getSelection ? window.getSelection().toString() : 
4205						document.selection && document.selection.type!="Control" ? document.selection.createRange().text : 0;
4206			}
4207			function _seq(a,c,s){
4208				seq.type=s && action ? "stepped" : "stepless";
4209				seq.scrollAmount=10;
4210				_sequentialScroll($this,a,c,"mcsLinearOut",s ? 60 : null);
4211			}
4212		},
4213		/* -------------------- */
4214		
4215		
4216		/* 
4217		MOUSE WHEEL EVENT
4218		scrolls content via mouse-wheel 
4219		via mouse-wheel plugin (https://github.com/brandonaaron/jquery-mousewheel)
4220		*/
4221		_mousewheel=function(){
4222			if(!$(this).data(pluginPfx)){return;} /* Check if the scrollbar is ready to use mousewheel events (issue: #185) */
4223			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
4224				namespace=pluginPfx+"_"+d.idx,
4225				mCustomScrollBox=$("#mCSB_"+d.idx),
4226				mCSB_dragger=[$("#mCSB_"+d.idx+"_dragger_vertical"),$("#mCSB_"+d.idx+"_dragger_horizontal")],
4227				iframe=$("#mCSB_"+d.idx+"_container").find("iframe");
4228			if(iframe.length){
4229				iframe.each(function(){
4230					$(this).bind("load",function(){
4231						/* bind events on accessible iframes */
4232						if(_canAccessIFrame(this)){
4233							$(this.contentDocument || this.contentWindow.document).bind("mousewheel."+namespace,function(e,delta){
4234								_onMousewheel(e,delta);
4235							});
4236						}
4237					});
4238				});
4239			}
4240			mCustomScrollBox.bind("mousewheel."+namespace,function(e,delta){
4241				_onMousewheel(e,delta);
4242			});
4243			function _onMousewheel(e,delta){
4244				_stop($this);
4245				if(_disableMousewheel($this,e.target)){return;} /* disables mouse-wheel when hovering specific elements */
4246				var deltaFactor=o.mouseWheel.deltaFactor!=="auto" ? parseInt(o.mouseWheel.deltaFactor) : (oldIE && e.deltaFactor<100) ? 100 : e.deltaFactor || 100,
4247					dur=o.scrollInertia;
4248				if(o.axis==="x" || o.mouseWheel.axis==="x"){
4249					var dir="x",
4250						px=[Math.round(deltaFactor*d.scrollRatio.x),parseInt(o.mouseWheel.scrollAmount)],
4251						amount=o.mouseWheel.scrollAmount!=="auto" ? px[1] : px[0]>=mCustomScrollBox.width() ? mCustomScrollBox.width()*0.9 : px[0],
4252						contentPos=Math.abs($("#mCSB_"+d.idx+"_container")[0].offsetLeft),
4253						draggerPos=mCSB_dragger[1][0].offsetLeft,
4254						limit=mCSB_dragger[1].parent().width()-mCSB_dragger[1].width(),
4255						dlt=o.mouseWheel.axis==="y" ? (e.deltaY || delta) : e.deltaX;
4256				}else{
4257					var dir="y",
4258						px=[Math.round(deltaFactor*d.scrollRatio.y),parseInt(o.mouseWheel.scrollAmount)],
4259						amount=o.mouseWheel.scrollAmount!=="auto" ? px[1] : px[0]>=mCustomScrollBox.height() ? mCustomScrollBox.height()*0.9 : px[0],
4260						contentPos=Math.abs($("#mCSB_"+d.idx+"_container")[0].offsetTop),
4261						draggerPos=mCSB_dragger[0][0].offsetTop,
4262						limit=mCSB_dragger[0].parent().height()-mCSB_dragger[0].height(),
4263						dlt=e.deltaY || delta;
4264				}
4265				if((dir==="y" && !d.overflowed[0]) || (dir==="x" && !d.overflowed[1])){return;}
4266				if(o.mouseWheel.invert || e.webkitDirectionInvertedFromDevice){dlt=-dlt;}
4267				if(o.mouseWheel.normalizeDelta){dlt=dlt<0 ? -1 : 1;}
4268				if((dlt>0 && draggerPos!==0) || (dlt<0 && draggerPos!==limit) || o.mouseWheel.preventDefault){
4269					e.stopImmediatePropagation();
4270					e.preventDefault();
4271				}
4272				if(e.deltaFactor<5 && !o.mouseWheel.normalizeDelta){
4273					//very low deltaFactor values mean some kind of delta acceleration (e.g. osx trackpad), so adjusting scrolling accordingly
4274					amount=e.deltaFactor; dur=17;
4275				}
4276				_scrollTo($this,(contentPos-(dlt*amount)).toString(),{dir:dir,dur:dur});
4277			}
4278		},
4279		/* -------------------- */
4280		
4281		
4282		/* checks if iframe can be accessed */
4283		_canAccessIFrameCache=new Object(),
4284		_canAccessIFrame=function(iframe){
4285		    var result=false,cacheKey=false,html=null;
4286		    if(iframe===undefined){
4287				cacheKey="#empty";
4288		    }else if($(iframe).attr("id")!==undefined){
4289				cacheKey=$(iframe).attr("id");
4290		    }
4291			if(cacheKey!==false && _canAccessIFrameCache[cacheKey]!==undefined){
4292				return _canAccessIFrameCache[cacheKey];
4293			}
4294			if(!iframe){
4295				try{
4296					var doc=top.document;
4297					html=doc.body.innerHTML;
4298				}catch(err){/* do nothing */}
4299				result=(html!==null);
4300			}else{
4301				try{
4302					var doc=iframe.contentDocument || iframe.contentWindow.document;
4303					html=doc.body.innerHTML;
4304				}catch(err){/* do nothing */}
4305				result=(html!==null);
4306			}
4307			if(cacheKey!==false){_canAccessIFrameCache[cacheKey]=result;}
4308			return result;
4309		},
4310		/* -------------------- */
4311		
4312		
4313		/* switches iframe's pointer-events property (drag, mousewheel etc. over cross-domain iframes) */
4314		_iframe=function(evt){
4315			var el=this.find("iframe");
4316			if(!el.length){return;} /* check if content contains iframes */
4317			var val=!evt ? "none" : "auto";
4318			el.css("pointer-events",val); /* for IE11, iframe's display property should not be "block" */
4319		},
4320		/* -------------------- */
4321		
4322		
4323		/* disables mouse-wheel when hovering specific elements like select, datalist etc. */
4324		_disableMousewheel=function(el,target){
4325			var tag=target.nodeName.toLowerCase(),
4326				tags=el.data(pluginPfx).opt.mouseWheel.disableOver,
4327				/* elements that require focus */
4328				focusTags=["select","textarea"];
4329			return $.inArray(tag,tags) > -1 && !($.inArray(tag,focusTags) > -1 && !$(target).is(":focus"));
4330		},
4331		/* -------------------- */
4332		
4333		
4334		/* 
4335		DRAGGER RAIL CLICK EVENT
4336		scrolls content via dragger rail 
4337		*/
4338		_draggerRail=function(){
4339			var $this=$(this),d=$this.data(pluginPfx),
4340				namespace=pluginPfx+"_"+d.idx,
4341				mCSB_container=$("#mCSB_"+d.idx+"_container"),
4342				wrapper=mCSB_container.parent(),
4343				mCSB_draggerContainer=$(".mCSB_"+d.idx+"_scrollbar ."+classes[12]),
4344				clickable;
4345			mCSB_draggerContainer.bind("mousedown."+namespace+" touchstart."+namespace+" pointerdown."+namespace+" MSPointerDown."+namespace,function(e){
4346				touchActive=true;
4347				if(!$(e.target).hasClass("mCSB_dragger")){clickable=1;}
4348			}).bind("touchend."+namespace+" pointerup."+namespace+" MSPointerUp."+namespace,function(e){
4349				touchActive=false;
4350			}).bind("click."+namespace,function(e){
4351				if(!clickable){return;}
4352				clickable=0;
4353				if($(e.target).hasClass(classes[12]) || $(e.target).hasClass("mCSB_draggerRail")){
4354					_stop($this);
4355					var el=$(this),mCSB_dragger=el.find(".mCSB_dragger");
4356					if(el.parent(".mCSB_scrollTools_horizontal").length>0){
4357						if(!d.overflowed[1]){return;}
4358						var dir="x",
4359							clickDir=e.pageX>mCSB_dragger.offset().left ? -1 : 1,
4360							to=Math.abs(mCSB_container[0].offsetLeft)-(clickDir*(wrapper.width()*0.9));
4361					}else{
4362						if(!d.overflowed[0]){return;}
4363						var dir="y",
4364							clickDir=e.pageY>mCSB_dragger.offset().top ? -1 : 1,
4365							to=Math.abs(mCSB_container[0].offsetTop)-(clickDir*(wrapper.height()*0.9));
4366					}
4367					_scrollTo($this,to.toString(),{dir:dir,scrollEasing:"mcsEaseInOut"});
4368				}
4369			});
4370		},
4371		/* -------------------- */
4372		
4373		
4374		/* 
4375		FOCUS EVENT
4376		scrolls content via element focus (e.g. clicking an input, pressing TAB key etc.)
4377		*/
4378		_focus=function(){
4379			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
4380				namespace=pluginPfx+"_"+d.idx,
4381				mCSB_container=$("#mCSB_"+d.idx+"_container"),
4382				wrapper=mCSB_container.parent();
4383			mCSB_container.bind("focusin."+namespace,function(e){
4384				var el=$(document.activeElement),
4385					nested=mCSB_container.find(".mCustomScrollBox").length,
4386					dur=0;
4387				if(!el.is(o.advanced.autoScrollOnFocus)){return;}
4388				_stop($this);
4389				clearTimeout($this[0]._focusTimeout);
4390				$this[0]._focusTimer=nested ? (dur+17)*nested : 0;
4391				$this[0]._focusTimeout=setTimeout(function(){
4392					var	to=[_childPos(el)[0],_childPos(el)[1]],
4393						contentPos=[mCSB_container[0].offsetTop,mCSB_container[0].offsetLeft],
4394						isVisible=[
4395							(contentPos[0]+to[0]>=0 && contentPos[0]+to[0]<wrapper.height()-el.outerHeight(false)),
4396							(contentPos[1]+to[1]>=0 && contentPos[0]+to[1]<wrapper.width()-el.outerWidth(false))
4397						],
4398						overwrite=(o.axis==="yx" && !isVisible[0] && !isVisible[1]) ? "none" : "all";
4399					if(o.axis!=="x" && !isVisible[0]){
4400						_scrollTo($this,to[0].toString(),{dir:"y",scrollEasing:"mcsEaseInOut",overwrite:overwrite,dur:dur});
4401					}
4402					if(o.axis!=="y" && !isVisible[1]){
4403						_scrollTo($this,to[1].toString(),{dir:"x",scrollEasing:"mcsEaseInOut",overwrite:overwrite,dur:dur});
4404					}
4405				},$this[0]._focusTimer);
4406			});
4407		},
4408		/* -------------------- */
4409		
4410		
4411		/* sets content wrapper scrollTop/scrollLeft always to 0 */
4412		_wrapperScroll=function(){
4413			var $this=$(this),d=$this.data(pluginPfx),
4414				namespace=pluginPfx+"_"+d.idx,
4415				wrapper=$("#mCSB_"+d.idx+"_container").parent();
4416			wrapper.bind("scroll."+namespace,function(e){
4417				if(wrapper.scrollTop()!==0 || wrapper.scrollLeft()!==0){
4418					$(".mCSB_"+d.idx+"_scrollbar").css("visibility","hidden"); /* hide scrollbar(s) */
4419				}
4420			});
4421		},
4422		/* -------------------- */
4423		
4424		
4425		/* 
4426		BUTTONS EVENTS
4427		scrolls content via up, down, left and right buttons 
4428		*/
4429		_buttons=function(){
4430			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,seq=d.sequential,
4431				namespace=pluginPfx+"_"+d.idx,
4432				sel=".mCSB_"+d.idx+"_scrollbar",
4433				btn=$(sel+">a");
4434			btn.bind("contextmenu."+namespace,function(e){
4435				e.preventDefault(); //prevent right click
4436			}).bind("mousedown."+namespace+" touchstart."+namespace+" pointerdown."+namespace+" MSPointerDown."+namespace+" mouseup."+namespace+" touchend."+namespace+" pointerup."+namespace+" MSPointerUp."+namespace+" mouseout."+namespace+" pointerout."+namespace+" MSPointerOut."+namespace+" click."+namespace,function(e){
4437				e.preventDefault();
4438				if(!_mouseBtnLeft(e)){return;} /* left mouse button only */
4439				var btnClass=$(this).attr("class");
4440				seq.type=o.scrollButtons.scrollType;
4441				switch(e.type){
4442					case "mousedown": case "touchstart": case "pointerdown": case "MSPointerDown":
4443						if(seq.type==="stepped"){return;}
4444						touchActive=true;
4445						d.tweenRunning=false;
4446						_seq("on",btnClass);
4447						break;
4448					case "mouseup": case "touchend": case "pointerup": case "MSPointerUp":
4449					case "mouseout": case "pointerout": case "MSPointerOut":
4450						if(seq.type==="stepped"){return;}
4451						touchActive=false;
4452						if(seq.dir){_seq("off",btnClass);}
4453						break;
4454					case "click":
4455						if(seq.type!=="stepped" || d.tweenRunning){return;}
4456						_seq("on",btnClass);
4457						break;
4458				}
4459				function _seq(a,c){
4460					seq.scrollAmount=o.scrollButtons.scrollAmount;
4461					_sequentialScroll($this,a,c);
4462				}
4463			});
4464		},
4465		/* -------------------- */
4466		
4467		
4468		/* 
4469		KEYBOARD EVENTS
4470		scrolls content via keyboard 
4471		Keys: up arrow, down arrow, left arrow, right arrow, PgUp, PgDn, Home, End
4472		*/
4473		_keyboard=function(){
4474			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,seq=d.sequential,
4475				namespace=pluginPfx+"_"+d.idx,
4476				mCustomScrollBox=$("#mCSB_"+d.idx),
4477				mCSB_container=$("#mCSB_"+d.idx+"_container"),
4478				wrapper=mCSB_container.parent(),
4479				editables="input,textarea,select,datalist,keygen,[contenteditable='true']",
4480				iframe=mCSB_container.find("iframe"),
4481				events=["blur."+namespace+" keydown."+namespace+" keyup."+namespace];
4482			if(iframe.length){
4483				iframe.each(function(){
4484					$(this).bind("load",function(){
4485						/* bind events on accessible iframes */
4486						if(_canAccessIFrame(this)){
4487							$(this.contentDocument || this.contentWindow.document).bind(events[0],function(e){
4488								_onKeyboard(e);
4489							});
4490						}
4491					});
4492				});
4493			}
4494			mCustomScrollBox.attr("tabindex","0").bind(events[0],function(e){
4495				_onKeyboard(e);
4496			});
4497			function _onKeyboard(e){
4498				switch(e.type){
4499					case "blur":
4500						if(d.tweenRunning && seq.dir){_seq("off",null);}
4501						break;
4502					case "keydown": case "keyup":
4503						var code=e.keyCode ? e.keyCode : e.which,action="on";
4504						if((o.axis!=="x" && (code===38 || code===40)) || (o.axis!=="y" && (code===37 || code===39))){
4505							/* up (38), down (40), left (37), right (39) arrows */
4506							if(((code===38 || code===40) && !d.overflowed[0]) || ((code===37 || code===39) && !d.overflowed[1])){return;}
4507							if(e.type==="keyup"){action="off";}
4508							if(!$(document.activeElement).is(editables)){
4509								e.preventDefault();
4510								e.stopImmediatePropagation();
4511								_seq(action,code);
4512							}
4513						}else if(code===33 || code===34){
4514							/* PgUp (33), PgDn (34) */
4515							if(d.overflowed[0] || d.overflowed[1]){
4516								e.preventDefault();
4517								e.stopImmediatePropagation();
4518							}
4519							if(e.type==="keyup"){
4520								_stop($this);
4521								var keyboardDir=code===34 ? -1 : 1;
4522								if(o.axis==="x" || (o.axis==="yx" && d.overflowed[1] && !d.overflowed[0])){
4523									var dir="x",to=Math.abs(mCSB_container[0].offsetLeft)-(keyboardDir*(wrapper.width()*0.9));
4524								}else{
4525									var dir="y",to=Math.abs(mCSB_container[0].offsetTop)-(keyboardDir*(wrapper.height()*0.9));
4526								}
4527								_scrollTo($this,to.toString(),{dir:dir,scrollEasing:"mcsEaseInOut"});
4528							}
4529						}else if(code===35 || code===36){
4530							/* End (35), Home (36) */
4531							if(!$(document.activeElement).is(editables)){
4532								if(d.overflowed[0] || d.overflowed[1]){
4533									e.preventDefault();
4534									e.stopImmediatePropagation();
4535								}
4536								if(e.type==="keyup"){
4537									if(o.axis==="x" || (o.axis==="yx" && d.overflowed[1] && !d.overflowed[0])){
4538										var dir="x",to=code===35 ? Math.abs(wrapper.width()-mCSB_container.outerWidth(false)) : 0;
4539									}else{
4540										var dir="y",to=code===35 ? Math.abs(wrapper.height()-mCSB_container.outerHeight(false)) : 0;
4541									}
4542									_scrollTo($this,to.toString(),{dir:dir,scrollEasing:"mcsEaseInOut"});
4543								}
4544							}
4545						}
4546						break;
4547				}
4548				function _seq(a,c){
4549					seq.type=o.keyboard.scrollType;
4550					seq.scrollAmount=o.keyboard.scrollAmount;
4551					if(seq.type==="stepped" && d.tweenRunning){return;}
4552					_sequentialScroll($this,a,c);
4553				}
4554			}
4555		},
4556		/* -------------------- */
4557		
4558		
4559		/* scrolls content sequentially (used when scrolling via buttons, keyboard arrows etc.) */
4560		_sequentialScroll=function(el,action,trigger,e,s){
4561			var d=el.data(pluginPfx),o=d.opt,seq=d.sequential,
4562				mCSB_container=$("#mCSB_"+d.idx+"_container"),
4563				once=seq.type==="stepped" ? true : false,
4564				steplessSpeed=o.scrollInertia < 26 ? 26 : o.scrollInertia, /* 26/1.5=17 */
4565				steppedSpeed=o.scrollInertia < 1 ? 17 : o.scrollInertia;
4566			switch(action){
4567				case "on":
4568					seq.dir=[
4569						(trigger===classes[16] || trigger===classes[15] || trigger===39 || trigger===37 ? "x" : "y"),
4570						(trigger===classes[13] || trigger===classes[15] || trigger===38 || trigger===37 ? -1 : 1)
4571					];
4572					_stop(el);
4573					if(_isNumeric(trigger) && seq.type==="stepped"){return;}
4574					_on(once);
4575					break;
4576				case "off":
4577					_off();
4578					if(once || (d.tweenRunning && seq.dir)){
4579						_on(true);
4580					}
4581					break;
4582			}
4583			
4584			/* starts sequence */
4585			function _on(once){
4586				if(o.snapAmount){seq.scrollAmount=!(o.snapAmount instanceof Array) ? o.snapAmount : seq.dir[0]==="x" ? o.snapAmount[1] : o.snapAmount[0];} /* scrolling snapping */
4587				var c=seq.type!=="stepped", /* continuous scrolling */
4588					t=s ? s : !once ? 1000/60 : c ? steplessSpeed/1.5 : steppedSpeed, /* timer */
4589					m=!once ? 2.5 : c ? 7.5 : 40, /* multiplier */
4590					contentPos=[Math.abs(mCSB_container[0].offsetTop),Math.abs(mCSB_container[0].offsetLeft)],
4591					ratio=[d.scrollRatio.y>10 ? 10 : d.scrollRatio.y,d.scrollRatio.x>10 ? 10 : d.scrollRatio.x],
4592					amount=seq.dir[0]==="x" ? contentPos[1]+(seq.dir[1]*(ratio[1]*m)) : contentPos[0]+(seq.dir[1]*(ratio[0]*m)),
4593					px=seq.dir[0]==="x" ? contentPos[1]+(seq.dir[1]*parseInt(seq.scrollAmount)) : contentPos[0]+(seq.dir[1]*parseInt(seq.scrollAmount)),
4594					to=seq.scrollAmount!=="auto" ? px : amount,
4595					easing=e ? e : !once ? "mcsLinear" : c ? "mcsLinearOut" : "mcsEaseInOut",
4596					onComplete=!once ? false : true;
4597				if(once && t<17){
4598					to=seq.dir[0]==="x" ? contentPos[1] : contentPos[0];
4599				}
4600				_scrollTo(el,to.toString(),{dir:seq.dir[0],scrollEasing:easing,dur:t,onComplete:onComplete});
4601				if(once){
4602					seq.dir=false;
4603					return;
4604				}
4605				clearTimeout(seq.step);
4606				seq.step=setTimeout(function(){
4607					_on();
4608				},t);
4609			}
4610			/* stops sequence */
4611			function _off(){
4612				clearTimeout(seq.step);
4613				_delete(seq,"step");
4614				_stop(el);
4615			}
4616		},
4617		/* -------------------- */
4618		
4619		
4620		/* returns a yx array from value */
4621		_arr=function(val){
4622			var o=$(this).data(pluginPfx).opt,vals=[];
4623			if(typeof val==="function"){val=val();} /* check if the value is a single anonymous function */
4624			/* check if value is object or array, its length and create an array with yx values */
4625			if(!(val instanceof Array)){ /* object value (e.g. {y:"100",x:"100"}, 100 etc.) */
4626				vals[0]=val.y ? val.y : val.x || o.axis==="x" ? null : val;
4627				vals[1]=val.x ? val.x : val.y || o.axis==="y" ? null : val;
4628			}else{ /* array value (e.g. [100,100]) */
4629				vals=val.length>1 ? [val[0],val[1]] : o.axis==="x" ? [null,val[0]] : [val[0],null];
4630			}
4631			/* check if array values are anonymous functions */
4632			if(typeof vals[0]==="function"){vals[0]=vals[0]();}
4633			if(typeof vals[1]==="function"){vals[1]=vals[1]();}
4634			return vals;
4635		},
4636		/* -------------------- */
4637		
4638		
4639		/* translates values (e.g. "top", 100, "100px", "#id") to actual scroll-to positions */
4640		_to=function(val,dir){
4641			if(val==null || typeof val=="undefined"){return;}
4642			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
4643				mCSB_container=$("#mCSB_"+d.idx+"_container"),
4644				wrapper=mCSB_container.parent(),
4645				t=typeof val;
4646			if(!dir){dir=o.axis==="x" ? "x" : "y";}
4647			var contentLength=dir==="x" ? mCSB_container.outerWidth(false)-wrapper.width() : mCSB_container.outerHeight(false)-wrapper.height(),
4648				contentPos=dir==="x" ? mCSB_container[0].offsetLeft : mCSB_container[0].offsetTop,
4649				cssProp=dir==="x" ? "left" : "top";
4650			switch(t){
4651				case "function": /* this currently is not used. Consider removing it */
4652					return val();
4653					break;
4654				case "object": /* js/jquery object */
4655					var obj=val.jquery ? val : $(val);
4656					if(!obj.length){return;}
4657					return dir==="x" ? _childPos(obj)[1] : _childPos(obj)[0];
4658					break;
4659				case "string": case "number":
4660					if(_isNumeric(val)){ /* numeric value */
4661						return Math.abs(val);
4662					}else if(val.indexOf("%")!==-1){ /* percentage value */
4663						return Math.abs(contentLength*parseInt(val)/100);
4664					}else if(val.indexOf("-=")!==-1){ /* decrease value */
4665						return Math.abs(contentPos-parseInt(val.split("-=")[1]));
4666					}else if(val.indexOf("+=")!==-1){ /* inrease value */
4667						var p=(contentPos+parseInt(val.split("+=")[1]));
4668						return p>=0 ? 0 : Math.abs(p);
4669					}else if(val.indexOf("px")!==-1 && _isNumeric(val.split("px")[0])){ /* pixels string value (e.g. "100px") */
4670						return Math.abs(val.split("px")[0]);
4671					}else{
4672						if(val==="top" || val==="left"){ /* special strings */
4673							return 0;
4674						}else if(val==="bottom"){
4675							return Math.abs(wrapper.height()-mCSB_container.outerHeight(false));
4676						}else if(val==="right"){
4677							return Math.abs(wrapper.width()-mCSB_container.outerWidth(false));
4678						}else if(val==="first" || val==="last"){
4679							var obj=mCSB_container.find(":"+val);
4680							return dir==="x" ? _childPos(obj)[1] : _childPos(obj)[0];
4681						}else{
4682							if($(val).length){ /* jquery selector */
4683								return dir==="x" ? _childPos($(val))[1] : _childPos($(val))[0];
4684							}else{ /* other values (e.g. "100em") */
4685								mCSB_container.css(cssProp,val);
4686								methods.update.call(null,$this[0]);
4687								return;
4688							}
4689						}
4690					}
4691					break;
4692			}
4693		},
4694		/* -------------------- */
4695		
4696		
4697		/* calls the update method automatically */
4698		_autoUpdate=function(rem){
4699			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
4700				mCSB_container=$("#mCSB_"+d.idx+"_container");
4701			if(rem){
4702				/* 
4703				removes autoUpdate timer 
4704				usage: _autoUpdate.call(this,"remove");
4705				*/
4706				clearTimeout(mCSB_container[0].autoUpdate);
4707				_delete(mCSB_container[0],"autoUpdate");
4708				return;
4709			}
4710			upd();
4711			function upd(){
4712				clearTimeout(mCSB_container[0].autoUpdate);
4713				if($this.parents("html").length===0){
4714					/* check element in dom tree */
4715					$this=null;
4716					return;
4717				}
4718				mCSB_container[0].autoUpdate=setTimeout(function(){
4719					/* update on specific selector(s) length and size change */
4720					if(o.advanced.updateOnSelectorChange){
4721						d.poll.change.n=sizesSum();
4722						if(d.poll.change.n!==d.poll.change.o){
4723							d.poll.change.o=d.poll.change.n;
4724							doUpd(3);
4725							return;
4726						}
4727					}
4728					/* update on main element and scrollbar size changes */
4729					if(o.advanced.updateOnContentResize){
4730						d.poll.size.n=$this[0].scrollHeight+$this[0].scrollWidth+mCSB_container[0].offsetHeight+$this[0].offsetHeight+$this[0].offsetWidth;
4731						if(d.poll.size.n!==d.poll.size.o){
4732							d.poll.size.o=d.poll.size.n;
4733							doUpd(1);
4734							return;
4735						}
4736					}
4737					/* update on image load */
4738					if(o.advanced.updateOnImageLoad){
4739						if(!(o.advanced.updateOnImageLoad==="auto" && o.axis==="y")){ //by default, it doesn't run on vertical content
4740							d.poll.img.n=mCSB_container.find("img").length;
4741							if(d.poll.img.n!==d.poll.img.o){
4742								d.poll.img.o=d.poll.img.n;
4743								mCSB_container.find("img").each(function(){
4744									imgLoader(this);
4745								});
4746								return;
4747							}
4748						}
4749					}
4750					if(o.advanced.updateOnSelectorChange || o.advanced.updateOnContentResize || o.advanced.updateOnImageLoad){upd();}
4751				},o.advanced.autoUpdateTimeout);
4752			}
4753			/* a tiny image loader */
4754			function imgLoader(el){
4755				if($(el).hasClass(classes[2])){doUpd(); return;}
4756				var img=new Image();
4757				function createDelegate(contextObject,delegateMethod){
4758					return function(){return delegateMethod.apply(contextObject,arguments);}
4759				}
4760				function imgOnLoad(){
4761					this.onload=null;
4762					$(el).addClass(classes[2]);
4763					doUpd(2);
4764				}
4765				img.onload=createDelegate(img,imgOnLoad);
4766				img.src=el.src;
4767			}
4768			/* returns the total height and width sum of all elements matching the selector */
4769			function sizesSum(){
4770				if(o.advanced.updateOnSelectorChange===true){o.advanced.updateOnSelectorChange="*";}
4771				var total=0,sel=mCSB_container.find(o.advanced.updateOnSelectorChange);
4772				if(o.advanced.updateOnSelectorChange && sel.length>0){sel.each(function(){total+=this.offsetHeight+this.offsetWidth;});}
4773				return total;
4774			}
4775			/* calls the update method */
4776			function doUpd(cb){
4777				clearTimeout(mCSB_container[0].autoUpdate);
4778				methods.update.call(null,$this[0],cb);
4779			}
4780		},
4781		/* -------------------- */
4782		
4783		
4784		/* snaps scrolling to a multiple of a pixels number */
4785		_snapAmount=function(to,amount,offset){
4786			return (Math.round(to/amount)*amount-offset); 
4787		},
4788		/* -------------------- */
4789		
4790		
4791		/* stops content and scrollbar animations */
4792		_stop=function(el){
4793			var d=el.data(pluginPfx),
4794				sel=$("#mCSB_"+d.idx+"_container,#mCSB_"+d.idx+"_container_wrapper,#mCSB_"+d.idx+"_dragger_vertical,#mCSB_"+d.idx+"_dragger_horizontal");
4795			sel.each(function(){
4796				_stopTween.call(this);
4797			});
4798		},
4799		/* -------------------- */
4800		
4801		
4802		/* 
4803		ANIMATES CONTENT 
4804		This is where the actual scrolling happens
4805		*/
4806		_scrollTo=function(el,to,options){
4807			var d=el.data(pluginPfx),o=d.opt,
4808				defaults={
4809					trigger:"internal",
4810					dir:"y",
4811					scrollEasing:"mcsEaseOut",
4812					drag:false,
4813					dur:o.scrollInertia,
4814					overwrite:"all",
4815					callbacks:true,
4816					onStart:true,
4817					onUpdate:true,
4818					onComplete:true
4819				},
4820				options=$.extend(defaults,options),
4821				dur=[options.dur,(options.drag ? 0 : options.dur)],
4822				mCustomScrollBox=$("#mCSB_"+d.idx),
4823				mCSB_container=$("#mCSB_"+d.idx+"_container"),
4824				wrapper=mCSB_container.parent(),
4825				totalScrollOffsets=o.callbacks.onTotalScrollOffset ? _arr.call(el,o.callbacks.onTotalScrollOffset) : [0,0],
4826				totalScrollBackOffsets=o.callbacks.onTotalScrollBackOffset ? _arr.call(el,o.callbacks.onTotalScrollBackOffset) : [0,0];
4827			d.trigger=options.trigger;
4828			if(wrapper.scrollTop()!==0 || wrapper.scrollLeft()!==0){ /* always reset scrollTop/Left */
4829				$(".mCSB_"+d.idx+"_scrollbar").css("visibility","visible");
4830				wrapper.scrollTop(0).scrollLeft(0);
4831			}
4832			if(to==="_resetY" && !d.contentReset.y){
4833				/* callbacks: onOverflowYNone */
4834				if(_cb("onOverflowYNone")){o.callbacks.onOverflowYNone.call(el[0]);}
4835				d.contentReset.y=1;
4836			}
4837			if(to==="_resetX" && !d.contentReset.x){
4838				/* callbacks: onOverflowXNone */
4839				if(_cb("onOverflowXNone")){o.callbacks.onOverflowXNone.call(el[0]);}
4840				d.contentReset.x=1;
4841			}
4842			if(to==="_resetY" || to==="_resetX"){return;}
4843			if((d.contentReset.y || !el[0].mcs) && d.overflowed[0]){
4844				/* callbacks: onOverflowY */
4845				if(_cb("onOverflowY")){o.callbacks.onOverflowY.call(el[0]);}
4846				d.contentReset.x=null;
4847			}
4848			if((d.contentReset.x || !el[0].mcs) && d.overflowed[1]){
4849				/* callbacks: onOverflowX */
4850				if(_cb("onOverflowX")){o.callbacks.onOverflowX.call(el[0]);}
4851				d.contentReset.x=null;
4852			}
4853			if(o.snapAmount){ /* scrolling snapping */
4854				var snapAmount=!(o.snapAmount instanceof Array) ? o.snapAmount : options.dir==="x" ? o.snapAmount[1] : o.snapAmount[0];
4855				to=_snapAmount(to,snapAmount,o.snapOffset);
4856			}
4857			switch(options.dir){
4858				case "x":
4859					var mCSB_dragger=$("#mCSB_"+d.idx+"_dragger_horizontal"),
4860						property="left",
4861						contentPos=mCSB_container[0].offsetLeft,
4862						limit=[
4863							mCustomScrollBox.width()-mCSB_container.outerWidth(false),
4864							mCSB_dragger.parent().width()-mCSB_dragger.width()
4865						],
4866						scrollTo=[to,to===0 ? 0 : (to/d.scrollRatio.x)],
4867						tso=totalScrollOffsets[1],
4868						tsbo=totalScrollBackOffsets[1],
4869						totalScrollOffset=tso>0 ? tso/d.scrollRatio.x : 0,
4870						totalScrollBackOffset=tsbo>0 ? tsbo/d.scrollRatio.x : 0;
4871					break;
4872				case "y":
4873					var mCSB_dragger=$("#mCSB_"+d.idx+"_dragger_vertical"),
4874						property="top",
4875						contentPos=mCSB_container[0].offsetTop,
4876						limit=[
4877							mCustomScrollBox.height()-mCSB_container.outerHeight(false),
4878							mCSB_dragger.parent().height()-mCSB_dragger.height()
4879						],
4880						scrollTo=[to,to===0 ? 0 : (to/d.scrollRatio.y)],
4881						tso=totalScrollOffsets[0],
4882						tsbo=totalScrollBackOffsets[0],
4883						totalScrollOffset=tso>0 ? tso/d.scrollRatio.y : 0,
4884						totalScrollBackOffset=tsbo>0 ? tsbo/d.scrollRatio.y : 0;
4885					break;
4886			}
4887			if(scrollTo[1]<0 || (scrollTo[0]===0 && scrollTo[1]===0)){
4888				scrollTo=[0,0];
4889			}else if(scrollTo[1]>=limit[1]){
4890				scrollTo=[limit[0],limit[1]];
4891			}else{
4892				scrollTo[0]=-scrollTo[0];
4893			}
4894			if(!el[0].mcs){
4895				_mcs();  /* init mcs object (once) to make it available before callbacks */
4896				if(_cb("onInit")){o.callbacks.onInit.call(el[0]);} /* callbacks: onInit */
4897			}
4898			clearTimeout(mCSB_container[0].onCompleteTimeout);
4899			_tweenTo(mCSB_dragger[0],property,Math.round(scrollTo[1]),dur[1],options.scrollEasing);
4900			if(!d.tweenRunning && ((contentPos===0 && scrollTo[0]>=0) || (contentPos===limit[0] && scrollTo[0]<=limit[0]))){return;}
4901			_tweenTo(mCSB_container[0],property,Math.round(scrollTo[0]),dur[0],options.scrollEasing,options.overwrite,{
4902				onStart:function(){
4903					if(options.callbacks && options.onStart && !d.tweenRunning){
4904						/* callbacks: onScrollStart */
4905						if(_cb("onScrollStart")){_mcs(); o.callbacks.onScrollStart.call(el[0]);}
4906						d.tweenRunning=true;
4907						_onDragClasses(mCSB_dragger);
4908						d.cbOffsets=_cbOffsets();
4909					}
4910				},onUpdate:function(){
4911					if(options.callbacks && options.onUpdate){
4912						/* callbacks: whileScrolling */
4913						if(_cb("whileScrolling")){_mcs(); o.callbacks.whileScrolling.call(el[0]);}
4914					}
4915				},onComplete:function(){
4916					if(options.callbacks && options.onComplete){
4917						if(o.axis==="yx"){clearTimeout(mCSB_container[0].onCompleteTimeout);}
4918						var t=mCSB_container[0].idleTimer || 0;
4919						mCSB_container[0].onCompleteTimeout=setTimeout(function(){
4920							/* callbacks: onScroll, onTotalScroll, onTotalScrollBack */
4921							if(_cb("onScroll")){_mcs(); o.callbacks.onScroll.call(el[0]);}
4922							if(_cb("onTotalScroll") && scrollTo[1]>=limit[1]-totalScrollOffset && d.cbOffsets[0]){_mcs(); o.callbacks.onTotalScroll.call(el[0]);}
4923							if(_cb("onTotalScrollBack") && scrollTo[1]<=totalScrollBackOffset && d.cbOffsets[1]){_mcs(); o.callbacks.onTotalScrollBack.call(el[0]);}
4924							d.tweenRunning=false;
4925							mCSB_container[0].idleTimer=0;
4926							_onDragClasses(mCSB_dragger,"hide");
4927						},t);
4928					}
4929				}
4930			});
4931			/* checks if callback function exists */
4932			function _cb(cb){
4933				return d && o.callbacks[cb] && typeof o.callbacks[cb]==="function";
4934			}
4935			/* checks whether callback offsets always trigger */
4936			function _cbOffsets(){
4937				return [o.callbacks.alwaysTriggerOffsets || contentPos>=limit[0]+tso,o.callbacks.alwaysTriggerOffsets || contentPos<=-tsbo];
4938			}
4939			/* 
4940			populates object with useful values for the user 
4941			values: 
4942				content: this.mcs.content
4943				content top position: this.mcs.top 
4944				content left position: this.mcs.left 
4945				dragger top position: this.mcs.draggerTop 
4946				dragger left position: this.mcs.draggerLeft 
4947				scrolling y percentage: this.mcs.topPct 
4948				scrolling x percentage: this.mcs.leftPct 
4949				scrolling direction: this.mcs.direction
4950			*/
4951			function _mcs(){
4952				var cp=[mCSB_container[0].offsetTop,mCSB_container[0].offsetLeft], /* content position */
4953					dp=[mCSB_dragger[0].offsetTop,mCSB_dragger[0].offsetLeft], /* dragger position */
4954					cl=[mCSB_container.outerHeight(false),mCSB_container.outerWidth(false)], /* content length */
4955					pl=[mCustomScrollBox.height(),mCustomScrollBox.width()]; /* content parent length */
4956				el[0].mcs={
4957					content:mCSB_container, /* original content wrapper as jquery object */
4958					top:cp[0],left:cp[1],draggerTop:dp[0],draggerLeft:dp[1],
4959					topPct:Math.round((100*Math.abs(cp[0]))/(Math.abs(cl[0])-pl[0])),leftPct:Math.round((100*Math.abs(cp[1]))/(Math.abs(cl[1])-pl[1])),
4960					direction:options.dir
4961				};
4962				/* 
4963				this refers to the original element containing the scrollbar(s)
4964				usage: this.mcs.top, this.mcs.leftPct etc. 
4965				*/
4966			}
4967		},
4968		/* -------------------- */
4969		
4970		
4971		/* 
4972		CUSTOM JAVASCRIPT ANIMATION TWEEN 
4973		Lighter and faster than jquery animate() and css transitions 
4974		Animates top/left properties and includes easings 
4975		*/
4976		_tweenTo=function(el,prop,to,duration,easing,overwrite,callbacks){
4977			if(!el._mTween){el._mTween={top:{},left:{}};}
4978			var callbacks=callbacks || {},
4979				onStart=callbacks.onStart || function(){},onUpdate=callbacks.onUpdate || function(){},onComplete=callbacks.onComplete || function(){},
4980				startTime=_getTime(),_delay,progress=0,from=el.offsetTop,elStyle=el.style,_request,tobj=el._mTween[prop];
4981			if(prop==="left"){from=el.offsetLeft;}
4982			var diff=to-from;
4983			tobj.stop=0;
4984			if(overwrite!=="none"){_cancelTween();}
4985			_startTween();
4986			function _step(){
4987				if(tobj.stop){return;}
4988				if(!progress){onStart.call();}
4989				progress=_getTime()-startTime;
4990				_tween();
4991				if(progress>=tobj.time){
4992					tobj.time=(progress>tobj.time) ? progress+_delay-(progress-tobj.time) : progress+_delay-1;
4993					if(tobj.time<progress+1){tobj.time=progress+1;}
4994				}
4995				if(tobj.time<duration){tobj.id=_request(_step);}else{onComplete.call();}
4996			}
4997			function _tween(){
4998				if(duration>0){
4999					tobj.currVal=_ease(tobj.time,from,diff,duration,easing);
5000					elStyle[prop]=Math.round(tobj.currVal)+"px";
5001				}else{
5002					elStyle[prop]=to+"px";
5003				}
5004				onUpdate.call();
5005			}
5006			function _startTween(){
5007				_delay=1000/60;
5008				tobj.time=progress+_delay;
5009				_request=(!window.requestAnimationFrame) ? function(f){_tween(); return setTimeout(f,0.01);} : window.requestAnimationFrame;
5010				tobj.id=_request(_step);
5011			}
5012			function _cancelTween(){
5013				if(tobj.id==null){return;}
5014				if(!window.requestAnimationFrame){clearTimeout(tobj.id);
5015				}else{window.cancelAnimationFrame(tobj.id);}
5016				tobj.id=null;
5017			}
5018			function _ease(t,b,c,d,type){
5019				switch(type){
5020					case "linear": case "mcsLinear":
5021						return c*t/d + b;
5022						break;
5023					case "mcsLinearOut":
5024						t/=d; t--; return c * Math.sqrt(1 - t*t) + b;
5025						break;
5026					case "easeInOutSmooth":
5027						t/=d/2;
5028						if(t<1) return c/2*t*t + b;
5029						t--;
5030						return -c/2 * (t*(t-2) - 1) + b;
5031						break;
5032					case "easeInOutStrong":
5033						t/=d/2;
5034						if(t<1) return c/2 * Math.pow( 2, 10 * (t - 1) ) + b;
5035						t--;
5036						return c/2 * ( -Math.pow( 2, -10 * t) + 2 ) + b;
5037						break;
5038					case "easeInOut": case "mcsEaseInOut":
5039						t/=d/2;
5040						if(t<1) return c/2*t*t*t + b;
5041						t-=2;
5042						return c/2*(t*t*t + 2) + b;
5043						break;
5044					case "easeOutSmooth":
5045						t/=d; t--;
5046						return -c * (t*t*t*t - 1) + b;
5047						break;
5048					case "easeOutStrong":
5049						return c * ( -Math.pow( 2, -10 * t/d ) + 1 ) + b;
5050						break;
5051					case "easeOut": case "mcsEaseOut": default:
5052						var ts=(t/=d)*t,tc=ts*t;
5053						return b+c*(0.499999999999997*tc*ts + -2.5*ts*ts + 5.5*tc + -6.5*ts + 4*t);
5054				}
5055			}
5056		},
5057		/* -------------------- */
5058		
5059		
5060		/* returns current time */
5061		_getTime=function(){
5062			if(window.performance && window.performance.now){
5063				return window.performance.now();
5064			}else{
5065				if(window.performance && window.performance.webkitNow){
5066					return window.performance.webkitNow();
5067				}else{
5068					if(Date.now){return Date.now();}else{return new Date().getTime();}
5069				}
5070			}
5071		},
5072		/* -------------------- */
5073		
5074		
5075		/* stops a tween */
5076		_stopTween=function(){
5077			var el=this;
5078			if(!el._mTween){el._mTween={top:{},left:{}};}
5079			var props=["top","left"];
5080			for(var i=0; i<props.length; i++){
5081				var prop=props[i];
5082				if(el._mTween[prop].id){
5083					if(!window.requestAnimationFrame){clearTimeout(el._mTween[prop].id);
5084					}else{window.cancelAnimationFrame(el._mTween[prop].id);}
5085					el._mTween[prop].id=null;
5086					el._mTween[prop].stop=1;
5087				}
5088			}
5089		},
5090		/* -------------------- */
5091		
5092		
5093		/* deletes a property (avoiding the exception thrown by IE) */
5094		_delete=function(c,m){
5095			try{delete c[m];}catch(e){c[m]=null;}
5096		},
5097		/* -------------------- */
5098		
5099		
5100		/* detects left mouse button */
5101		_mouseBtnLeft=function(e){
5102			return !(e.which && e.which!==1);
5103		},
5104		/* -------------------- */
5105		
5106		
5107		/* detects if pointer type event is touch */
5108		_pointerTouch=function(e){
5109			var t=e.originalEvent.pointerType;
5110			return !(t && t!=="touch" && t!==2);
5111		},
5112		/* -------------------- */
5113		
5114		
5115		/* checks if value is numeric */
5116		_isNumeric=function(val){
5117			return !isNaN(parseFloat(val)) && isFinite(val);
5118		},
5119		/* -------------------- */
5120		
5121		
5122		/* returns element position according to content */
5123		_childPos=function(el){
5124			var p=el.parents(".mCSB_container");
5125			return [el.offset().top-p.offset().top,el.offset().left-p.offset().left];
5126		},
5127		/* -------------------- */
5128		
5129		
5130		/* checks if browser tab is hidden/inactive via Page Visibility API */
5131		_isTabHidden=function(){
5132			var prop=_getHiddenProp();
5133			if(!prop) return false;
5134			return document[prop];
5135			function _getHiddenProp(){
5136				var pfx=["webkit","moz","ms","o"];
5137				if("hidden" in document) return "hidden"; //natively supported
5138				for(var i=0; i<pfx.length; i++){ //prefixed
5139				    if((pfx[i]+"Hidden") in document) 
5140				        return pfx[i]+"Hidden";
5141				}
5142				return null; //not supported
5143			}
5144		};
5145		/* -------------------- */
5146		
5147	
5148	
5149	
5150	
5151	/* 
5152	----------------------------------------
5153	PLUGIN SETUP 
5154	----------------------------------------
5155	*/
5156	
5157	/* plugin constructor functions */
5158	$.fn[pluginNS]=function(method){ /* usage: $(selector).mCustomScrollbar(); */
5159		if(methods[method]){
5160			return methods[method].apply(this,Array.prototype.slice.call(arguments,1));
5161		}else if(typeof method==="object" || !method){
5162			return methods.init.apply(this,arguments);
5163		}else{
5164			$.error("Method "+method+" does not exist");
5165		}
5166	};
5167	$[pluginNS]=function(method){ /* usage: $.mCustomScrollbar(); */
5168		if(methods[method]){
5169			return methods[method].apply(this,Array.prototype.slice.call(arguments,1));
5170		}else if(typeof method==="object" || !method){
5171			return methods.init.apply(this,arguments);
5172		}else{
5173			$.error("Method "+method+" does not exist");
5174		}
5175	};
5176	
5177	/* 
5178	allow setting plugin default options. 
5179	usage: $.mCustomScrollbar.defaults.scrollInertia=500; 
5180	to apply any changed default options on default selectors (below), use inside document ready fn 
5181	e.g.: $(document).ready(function(){ $.mCustomScrollbar.defaults.scrollInertia=500; });
5182	*/
5183	$[pluginNS].defaults=defaults;
5184	
5185	/* 
5186	add window object (window.mCustomScrollbar) 
5187	usage: if(window.mCustomScrollbar){console.log("custom scrollbar plugin loaded");}
5188	*/
5189	window[pluginNS]=true;
5190	
5191	$(window).bind("load",function(){
5192		
5193		$(defaultSelector)[pluginNS](); /* add scrollbars automatically on default selector */
5194		
5195		/* extend jQuery expressions */
5196		$.extend($.expr[":"],{
5197			/* checks if element is within scrollable viewport */
5198			mcsInView:$.expr[":"].mcsInView || function(el){
5199				var $el=$(el),content=$el.parents(".mCSB_container"),wrapper,cPos;
5200				if(!content.length){return;}
5201				wrapper=content.parent();
5202				cPos=[content[0].offsetTop,content[0].offsetLeft];
5203				return 	cPos[0]+_childPos($el)[0]>=0 && cPos[0]+_childPos($el)[0]<wrapper.height()-$el.outerHeight(false) && 
5204						cPos[1]+_childPos($el)[1]>=0 && cPos[1]+_childPos($el)[1]<wrapper.width()-$el.outerWidth(false);
5205			},
5206			/* checks if element or part of element is in view of scrollable viewport */
5207			mcsInSight:$.expr[":"].mcsInSight || function(el,i,m){
5208				var $el=$(el),elD,content=$el.parents(".mCSB_container"),wrapperView,pos,wrapperViewPct,
5209					pctVals=m[3]==="exact" ? [[1,0],[1,0]] : [[0.9,0.1],[0.6,0.4]];
5210				if(!content.length){return;}
5211				elD=[$el.outerHeight(false),$el.outerWidth(false)];
5212				pos=[content[0].offsetTop+_childPos($el)[0],content[0].offsetLeft+_childPos($el)[1]];
5213				wrapperView=[content.parent()[0].offsetHeight,content.parent()[0].offsetWidth];
5214				wrapperViewPct=[elD[0]<wrapperView[0] ? pctVals[0] : pctVals[1],elD[1]<wrapperView[1] ? pctVals[0] : pctVals[1]];
5215				return 	pos[0]-(wrapperView[0]*wrapperViewPct[0][0])<0 && pos[0]+elD[0]-(wrapperView[0]*wrapperViewPct[0][1])>=0 && 
5216						pos[1]-(wrapperView[1]*wrapperViewPct[1][0])<0 && pos[1]+elD[1]-(wrapperView[1]*wrapperViewPct[1][1])>=0;
5217			},
5218			/* checks if element is overflowed having visible scrollbar(s) */
5219			mcsOverflow:$.expr[":"].mcsOverflow || function(el){
5220				var d=$(el).data(pluginPfx);
5221				if(!d){return;}
5222				return d.overflowed[0] || d.overflowed[1];
5223			}
5224		});
5225	
5226	});
5227
5228}))}));
5228;
vendor: 14,676 bytes, lines 5229-5232
5229/*! jQuery Validation Plugin - v1.19.5 - 7/1/2022
5230 * https://jqueryvalidation.org/
5231 * Copyright (c) 2022 Jörn Zaefferer; Licensed MIT */
5232!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof module&&module.exports?module.exports=a(require("jquery")):a(jQuery)}(function(a){a.extend(a.fn,{validate:function(b){if(!this.length)return void(b&&b.debug&&window.console&&console.warn("Nothing selected, can't validate, returning nothing."));var c=a.data(this[0],"validator");return c?c:(this.attr("novalidate","novalidate"),c=new a.validator(b,this[0]),a.data(this[0],"validator",c),c.settings.onsubmit&&(this.on("click.validate",":submit",function(b){c.submitButton=b.currentTarget,a(this).hasClass("cancel")&&(c.cancelSubmit=!0),void 0!==a(this).attr("formnovalidate")&&(c.cancelSubmit=!0)}),this.on("submit.validate",function(b){function d(){var d,e;return c.submitButton&&(c.settings.submitHandler||c.formSubmitted)&&(d=a("<input type='hidden'/>").attr("name",c.submitButton.name).val(a(c.submitButton).val()).appendTo(c.currentForm)),!(c.settings.submitHandler&&!c.settings.debug)||(e=c.settings.submitHandler.call(c,c.currentForm,b),d&&d.remove(),void 0!==e&&e)}return c.settings.debug&&b.preventDefault(),c.cancelSubmit?(c.cancelSubmit=!1,d()):c.form()?c.pendingRequest?(c.formSubmitted=!0,!1):d():(c.focusInvalid(),!1)})),c)},valid:function(){var b,c,d;return a(this[0]).is("form")?b=this.validate().form():(d=[],b=!0,c=a(this[0].form).validate(),this.each(function(){b=c.element(this)&&b,b||(d=d.concat(c.errorList))}),c.errorList=d),b},rules:function(b,c){var d,e,f,g,h,i,j=this[0],k="undefined"!=typeof this.attr("contenteditable")&&"false"!==this.attr("contenteditable");if(null!=j&&(!j.form&&k&&(j.form=this.closest("form")[0],j.name=this.attr("name")),null!=j.form)){if(b)switch(d=a.data(j.form,"validator").settings,e=d.rules,f=a.validator.staticRules(j),b){case"add":a.extend(f,a.validator.normalizeRule(c)),delete f.messages,e[j.name]=f,c.messages&&(d.messages[j.name]=a.extend(d.messages[j.name],c.messages));break;case"remove":return c?(i={},a.each(c.split(/\s/),function(a,b){i[b]=f[b],delete f[b]}),i):(delete e[j.name],f)}return g=a.validator.normalizeRules(a.extend({},a.validator.classRules(j),a.validator.attributeRules(j),a.validator.dataRules(j),a.validator.staticRules(j)),j),g.required&&(h=g.required,delete g.required,g=a.extend({required:h},g)),g.remote&&(h=g.remote,delete g.remote,g=a.extend(g,{remote:h})),g}}});var b=function(a){return a.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")};a.extend(a.expr.pseudos||a.expr[":"],{blank:function(c){return!b(""+a(c).val())},filled:function(c){var d=a(c).val();return null!==d&&!!b(""+d)},unchecked:function(b){return!a(b).prop("checked")}}),a.validator=function(b,c){this.settings=a.extend(!0,{},a.validator.defaults,b),this.currentForm=c,this.init()},a.validator.format=function(b,c){return 1===arguments.length?function(){var c=a.makeArray(arguments);return c.unshift(b),a.validator.format.apply(this,c)}:void 0===c?b:(arguments.length>2&&c.constructor!==Array&&(c=a.makeArray(arguments).slice(1)),c.constructor!==Array&&(c=[c]),a.each(c,function(a,c){b=b.replace(new RegExp("\\{"+a+"\\}","g"),function(){return c})}),b)},a.extend(a.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",pendingClass:"pending",validClass:"valid",errorElement:"label",focusCleanup:!1,focusInvalid:!0,errorContainer:a([]),errorLabelContainer:a([]),onsubmit:!0,ignore:":hidden",ignoreTitle:!1,onfocusin:function(a){this.lastActive=a,this.settings.focusCleanup&&(this.settings.unhighlight&&this.settings.unhighlight.call(this,a,this.settings.errorClass,this.settings.validClass),this.hideThese(this.errorsFor(a)))},onfocusout:function(a){this.checkable(a)||!(a.name in this.submitted)&&this.optional(a)||this.element(a)},onkeyup:function(b,c){var d=[16,17,18,20,35,36,37,38,39,40,45,144,225];9===c.which&&""===this.elementValue(b)||a.inArray(c.keyCode,d)!==-1||(b.name in this.submitted||b.name in this.invalid)&&this.element(b)},onclick:function(a){a.name in this.submitted?this.element(a):a.parentNode.name in this.submitted&&this.element(a.parentNode)},highlight:function(b,c,d){"radio"===b.type?this.findByName(b.name).addClass(c).removeClass(d):a(b).addClass(c).removeClass(d)},unhighlight:function(b,c,d){"radio"===b.type?this.findByName(b.name).removeClass(c).addClass(d):a(b).removeClass(c).addClass(d)}},setDefaults:function(b){a.extend(a.validator.defaults,b)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",equalTo:"Please enter the same value again.",maxlength:a.validator.format("Please enter no more than {0} characters."),minlength:a.validator.format("Please enter at least {0} characters."),rangelength:a.validator.format("Please enter a value between {0} and {1} characters long."),range:a.validator.format("Please enter a value between {0} and {1}."),max:a.validator.format("Please enter a value less than or equal to {0}."),min:a.validator.format("Please enter a value greater than or equal to {0}."),step:a.validator.format("Please enter a multiple of {0}.")},autoCreateRanges:!1,prototype:{init:function(){function b(b){var c="undefined"!=typeof a(this).attr("contenteditable")&&"false"!==a(this).attr("contenteditable");if(!this.form&&c&&(this.form=a(this).closest("form")[0],this.name=a(this).attr("name")),d===this.form){var e=a.data(this.form,"validator"),f="on"+b.type.replace(/^validate/,""),g=e.settings;g[f]&&!a(this).is(g.ignore)&&g[f].call(e,this,b)}}this.labelContainer=a(this.settings.errorLabelContainer),this.errorContext=this.labelContainer.length&&this.labelContainer||a(this.currentForm),this.containers=a(this.settings.errorContainer).add(this.settings.errorLabelContainer),this.submitted={},this.valueCache={},this.pendingRequest=0,this.pending={},this.invalid={},this.reset();var c,d=this.currentForm,e=this.groups={};a.each(this.settings.groups,function(b,c){"string"==typeof c&&(c=c.split(/\s/)),a.each(c,function(a,c){e[c]=b})}),c=this.settings.rules,a.each(c,function(b,d){c[b]=a.validator.normalizeRule(d)}),a(this.currentForm).on("focusin.validate focusout.validate keyup.validate",":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'], [type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], [type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'], [type='radio'], [type='checkbox'], [contenteditable], [type='button']",b).on("click.validate","select, option, [type='radio'], [type='checkbox']",b),this.settings.invalidHandler&&a(this.currentForm).on("invalid-form.validate",this.settings.invalidHandler)},form:function(){return this.checkForm(),a.extend(this.submitted,this.errorMap),this.invalid=a.extend({},this.errorMap),this.valid()||a(this.currentForm).triggerHandler("invalid-form",[this]),this.showErrors(),this.valid()},checkForm:function(){this.prepareForm();for(var a=0,b=this.currentElements=this.elements();b[a];a++)this.check(b[a]);return this.valid()},element:function(b){var c,d,e=this.clean(b),f=this.validationTargetFor(e),g=this,h=!0;return void 0===f?delete this.invalid[e.name]:(this.prepareElement(f),this.currentElements=a(f),d=this.groups[f.name],d&&a.each(this.groups,function(a,b){b===d&&a!==f.name&&(e=g.validationTargetFor(g.clean(g.findByName(a))),e&&e.name in g.invalid&&(g.currentElements.push(e),h=g.check(e)&&h))}),c=this.check(f)!==!1,h=h&&c,c?this.invalid[f.name]=!1:this.invalid[f.name]=!0,this.numberOfInvalids()||(this.toHide=this.toHide.add(this.containers)),this.showErrors(),a(b).attr("aria-invalid",!c)),h},showErrors:function(b){if(b){var c=this;a.extend(this.errorMap,b),this.errorList=a.map(this.errorMap,function(a,b){return{message:a,element:c.findByName(b)[0]}}),this.successList=a.grep(this.successList,function(a){return!(a.name in b)})}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){a.fn.resetForm&&a(this.currentForm).resetForm(),this.invalid={},this.submitted={},this.prepareForm(),this.hideErrors();var b=this.elements().removeData("previousValue").removeAttr("aria-invalid");this.resetElements(b)},resetElements:function(a){var b;if(this.settings.unhighlight)for(b=0;a[b];b++)this.settings.unhighlight.call(this,a[b],this.settings.errorClass,""),this.findByName(a[b].name).removeClass(this.settings.validClass);else a.removeClass(this.settings.errorClass).removeClass(this.settings.validClass)},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(a){var b,c=0;for(b in a)void 0!==a[b]&&null!==a[b]&&a[b]!==!1&&c++;return c},hideErrors:function(){this.hideThese(this.toHide)},hideThese:function(a){a.not(this.containers).text(""),this.addWrapper(a).hide()},valid:function(){return 0===this.size()},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid)try{a(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").trigger("focus").trigger("focusin")}catch(b){}},findLastActive:function(){var b=this.lastActive;return b&&1===a.grep(this.errorList,function(a){return a.element.name===b.name}).length&&b},elements:function(){var b=this,c={};return a(this.currentForm).find("input, select, textarea, [contenteditable]").not(":submit, :reset, :image, :disabled").not(this.settings.ignore).filter(function(){var d=this.name||a(this).attr("name"),e="undefined"!=typeof a(this).attr("contenteditable")&&"false"!==a(this).attr("contenteditable");return!d&&b.settings.debug&&window.console&&console.error("%o has no name assigned",this),e&&(this.form=a(this).closest("form")[0],this.name=d),this.form===b.currentForm&&(!(d in c||!b.objectLength(a(this).rules()))&&(c[d]=!0,!0))})},clean:function(b){return a(b)[0]},errors:function(){var b=this.settings.errorClass.split(" ").join(".");return a(this.settings.errorElement+"."+b,this.errorContext)},resetInternals:function(){this.successList=[],this.errorList=[],this.errorMap={},this.toShow=a([]),this.toHide=a([])},reset:function(){this.resetInternals(),this.currentElements=a([])},prepareForm:function(){this.reset(),this.toHide=this.errors().add(this.containers)},prepareElement:function(a){this.reset(),this.toHide=this.errorsFor(a)},elementValue:function(b){var c,d,e=a(b),f=b.type,g="undefined"!=typeof e.attr("contenteditable")&&"false"!==e.attr("contenteditable");return"radio"===f||"checkbox"===f?this.findByName(b.name).filter(":checked").val():"number"===f&&"undefined"!=typeof b.validity?b.validity.badInput?"NaN":e.val():(c=g?e.text():e.val(),"file"===f?"C:\\fakepath\\"===c.substr(0,12)?c.substr(12):(d=c.lastIndexOf("/"),d>=0?c.substr(d+1):(d=c.lastIndexOf("\\"),d>=0?c.substr(d+1):c)):"string"==typeof c?c.replace(/\r/g,""):c)},check:function(b){b=this.validationTargetFor(this.clean(b));var c,d,e,f,g=a(b).rules(),h=a.map(g,function(a,b){return b}).length,i=!1,j=this.elementValue(b);"function"==typeof g.normalizer?f=g.normalizer:"function"==typeof this.settings.normalizer&&(f=this.settings.normalizer),f&&(j=f.call(b,j),delete g.normalizer);for(d in g){e={method:d,parameters:g[d]};try{if(c=a.validator.methods[d].call(this,j,b,e.parameters),"dependency-mismatch"===c&&1===h){i=!0;continue}if(i=!1,"pending"===c)return void(this.toHide=this.toHide.not(this.errorsFor(b)));if(!c)return this.formatAndAdd(b,e),!1}catch(k){throw this.settings.debug&&window.console&&console.log("Exception occurred when checking element "+b.id+", check the '"+e.method+"' method.",k),k instanceof TypeError&&(k.message+=".  Exception occurred when checking element "+b.id+", check the '"+e.method+"' method."),k}}if(!i)return this.objectLength(g)&&this.successList.push(b),!0},customDataMessage:function(b,c){return a(b).data("msg"+c.charAt(0).toUpperCase()+c.substring(1).toLowerCase())||a(b).data("msg")},customMessage:function(a,b){var c=this.settings.messages[a];return c&&(c.constructor===String?c:c[b])},findDefined:function(){for(var a=0;a<arguments.length;a++)if(void 0!==arguments[a])return arguments[a]},defaultMessage:function(b,c){"string"==typeof c&&(c={method:c});var d=this.findDefined(this.customMessage(b.name,c.method),this.customDataMessage(b,c.method),!this.settings.ignoreTitle&&b.title||void 0,a.validator.messages[c.method],"<strong>Warning: No message defined for "+b.name+"</strong>"),e=/\$?\{(\d+)\}/g;return"function"==typeof d?d=d.call(this,c.parameters,b):e.test(d)&&(d=a.validator.format(d.replace(e,"{$1}"),c.parameters)),d},formatAndAdd:function(a,b){var c=this.defaultMessage(a,b);this.errorList.push({message:c,element:a,method:b.method}),this.errorMap[a.name]=c,this.submitted[a.name]=c},addWrapper:function(a){return this.settings.wrapper&&(a=a.add(a.parent(this.settings.wrapper))),a},defaultShowErrors:function(){var a,b,c;for(a=0;this.errorList[a];a++)c=this.errorList[a],this.settings.highlight&&this.settings.highlight.call(this,c.element,this.settings.errorClass,this.settings.validClass),this.showLabel(c.element,c.message);if(this.errorList.length&&(this.toShow=this.toShow.add(this.containers)),this.settings.success)for(a=0;this.successList[a];a++)this.showLabel(this.successList[a]);if(this.settings.unhighlight)for(a=0,b=this.validElements();b[a];a++)this.settings.unhighlight.call(this,b[a],this.settings.errorClass,this.settings.validClass);this.toHide=this.toHide.not(this.toShow),this.hideErrors(),this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return a(this.errorList).map(function(){return this.element})},showLabel:function(b,c){var d,e,f,g,h=this.errorsFor(b),i=this.idOrName(b),j=a(b).attr("aria-describedby");h.length?(h.removeClass(this.settings.validClass).addClass(this.settings.errorClass),h.html(c)):(h=a("<"+this.settings.errorElement+">").attr("id",i+"-error").addClass(this.settings.errorClass).html(c||""),d=h,this.settings.wrapper&&(d=h.hide().show().wrap("<"+this.settings.wrapper+"/>").parent()),this.labelContainer.length?this.labelContainer.append(d):this.settings.errorPlacement?this.settings.errorPlacement.call(this,d,a(b)):d.insertAfter(b),h.is("label")?h.attr("for",i):0===h.parents("label[for='"+this.escapeCssMeta(i)+"']").length&&(f=h.attr("id"),j?j.match(new RegExp("\\b"+this.escapeCssMeta(f)+"\\b"))||(j+=" "+f):j=f,a(b).attr("aria-describedby",j),e=this.groups[b.n
5232ame],e&&(g=this,a.each(g.groups,function(b,c){c===e&&a("[name='"+g.escapeCssMeta(b)+"']",g.currentForm).attr("aria-describedby",h.attr("id"))})))),!c&&this.settings.success&&(h.text(""),"string"==typeof this.settings.success?h.addClass(this.settings.success):this.settings.success(h,b)),this.toShow=this.toShow.add(h)},errorsFor:function(b){var c=this.escapeCssMeta(this.idOrName(b)),d=a(b).attr("aria-describedby"),e="label[for='"+c+"'], label[for='"+c+"'] *";return d&&(e=e+", #"+this.escapeCssMeta(d).replace(/\s+/g,", #")),this.errors().filter(e)},escapeCssMeta:function(a){return void 0===a?"":a.replace(/([\\!"#$%&'()*+,./:;<=>?@\[\]^`{|}~])/g,"\\$1")},idOrName:function(a){return this.groups[a.name]||(this.checkable(a)?a.name:a.id||a.name)},validationTargetFor:function(b){return this.checkable(b)&&(b=this.findByName(b.name)),a(b).not(this.settings.ignore)[0]},checkable:function(a){return/radio|checkbox/i.test(a.type)},findByName:function(b){return a(this.currentForm).find("[name='"+this.escapeCssMeta(b)+"']")},getLength:function(b,c){switch(c.nodeName.toLowerCase()){case"select":return a("option:selected",c).length;case"input":if(this.checkable(c))return this.findByName(c.name).filter(":checked").length}return b.length},depend:function(a,b){return!this.dependTypes[typeof a]||this.dependTypes[typeof a](a,b)},dependTypes:{"boolean":function(a){return a},string:function(b,c){return!!a(b,c.form).length},"function":function(a,b){return a(b)}},optional:function(b){var c=this.elementValue(b);
vendor: 9,066 bytes, lines 5232-5252
5232return!a.validator.methods.required.call(this,c,b)&&"dependency-mismatch"},startRequest:function(b){this.pending[b.name]||(this.pendingRequest++,a(b).addClass(this.settings.pendingClass),this.pending[b.name]=!0)},stopRequest:function(b,c){this.pendingRequest--,this.pendingRequest<0&&(this.pendingRequest=0),delete this.pending[b.name],a(b).removeClass(this.settings.pendingClass),c&&0===this.pendingRequest&&this.formSubmitted&&this.form()&&0===this.pendingRequest?(a(this.currentForm).trigger("submit"),this.submitButton&&a("input:hidden[name='"+this.submitButton.name+"']",this.currentForm).remove(),this.formSubmitted=!1):!c&&0===this.pendingRequest&&this.formSubmitted&&(a(this.currentForm).triggerHandler("invalid-form",[this]),this.formSubmitted=!1)},previousValue:function(b,c){return c="string"==typeof c&&c||"remote",a.data(b,"previousValue")||a.data(b,"previousValue",{old:null,valid:!0,message:this.defaultMessage(b,{method:c})})},destroy:function(){this.resetForm(),a(this.currentForm).off(".validate").removeData("validator").find(".validate-equalTo-blur").off(".validate-equalTo").removeClass("validate-equalTo-blur").find(".validate-lessThan-blur").off(".validate-lessThan").removeClass("validate-lessThan-blur").find(".validate-lessThanEqual-blur").off(".validate-lessThanEqual").removeClass("validate-lessThanEqual-blur").find(".validate-greaterThanEqual-blur").off(".validate-greaterThanEqual").removeClass("validate-greaterThanEqual-blur").find(".validate-greaterThan-blur").off(".validate-greaterThan").removeClass("validate-greaterThan-blur")}},classRuleSettings:{required:{required:!0},email:{email:!0},url:{url:!0},date:{date:!0},dateISO:{dateISO:!0},number:{number:!0},digits:{digits:!0},creditcard:{creditcard:!0}},addClassRules:function(b,c){b.constructor===String?this.classRuleSettings[b]=c:a.extend(this.classRuleSettings,b)},classRules:function(b){var c={},d=a(b).attr("class");return d&&a.each(d.split(" "),function(){this in a.validator.classRuleSettings&&a.extend(c,a.validator.classRuleSettings[this])}),c},normalizeAttributeRule:function(a,b,c,d){/min|max|step/.test(c)&&(null===b||/number|range|text/.test(b))&&(d=Number(d),isNaN(d)&&(d=void 0)),d||0===d?a[c]=d:b===c&&"range"!==b&&(a["date"===b?"dateISO":c]=!0)},attributeRules:function(b){var c,d,e={},f=a(b),g=b.getAttribute("type");for(c in a.validator.methods)"required"===c?(d=b.getAttribute(c),""===d&&(d=!0),d=!!d):d=f.attr(c),this.normalizeAttributeRule(e,g,c,d);return e.maxlength&&/-1|2147483647|524288/.test(e.maxlength)&&delete e.maxlength,e},dataRules:function(b){var c,d,e={},f=a(b),g=b.getAttribute("type");for(c in a.validator.methods)d=f.data("rule"+c.charAt(0).toUpperCase()+c.substring(1).toLowerCase()),""===d&&(d=!0),this.normalizeAttributeRule(e,g,c,d);return e},staticRules:function(b){var c={},d=a.data(b.form,"validator");return d.settings.rules&&(c=a.validator.normalizeRule(d.settings.rules[b.name])||{}),c},normalizeRules:function(b,c){return a.each(b,function(d,e){if(e===!1)return void delete b[d];if(e.param||e.depends){var f=!0;switch(typeof e.depends){case"string":f=!!a(e.depends,c.form).length;break;case"function":f=e.depends.call(c,c)}f?b[d]=void 0===e.param||e.param:(a.data(c.form,"validator").resetElements(a(c)),delete b[d])}}),a.each(b,function(a,d){b[a]="function"==typeof d&&"normalizer"!==a?d(c):d}),a.each(["minlength","maxlength"],function(){b[this]&&(b[this]=Number(b[this]))}),a.each(["rangelength","range"],function(){var a;b[this]&&(Array.isArray(b[this])?b[this]=[Number(b[this][0]),Number(b[this][1])]:"string"==typeof b[this]&&(a=b[this].replace(/[\[\]]/g,"").split(/[\s,]+/),b[this]=[Number(a[0]),Number(a[1])]))}),a.validator.autoCreateRanges&&(null!=b.min&&null!=b.max&&(b.range=[b.min,b.max],delete b.min,delete b.max),null!=b.minlength&&null!=b.maxlength&&(b.rangelength=[b.minlength,b.maxlength],delete b.minlength,delete b.maxlength)),b},normalizeRule:function(b){if("string"==typeof b){var c={};a.each(b.split(/\s/),function(){c[this]=!0}),b=c}return b},addMethod:function(b,c,d){a.validator.methods[b]=c,a.validator.messages[b]=void 0!==d?d:a.validator.messages[b],c.length<3&&a.validator.addClassRules(b,a.validator.normalizeRule(b))},methods:{required:function(b,c,d){if(!this.depend(d,c))return"dependency-mismatch";if("select"===c.nodeName.toLowerCase()){var e=a(c).val();return e&&e.length>0}return this.checkable(c)?this.getLength(b,c)>0:void 0!==b&&null!==b&&b.length>0},email:function(a,b){return this.optional(b)||/^[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])?)*$/.test(a)},url:function(a,b){return this.optional(b)||/^(?:(?:(?:https?|ftp):)?\/\/)(?:(?:[^\]\[?\/<~#`!@$^&*()+=}|:";',>{ ]|%[0-9A-Fa-f]{2})+(?::(?:[^\]\[?\/<~#`!@$^&*()+=}|:";',>{ ]|%[0-9A-Fa-f]{2})*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62})?[a-z0-9\u00a1-\uffff]\.)+(?:[a-z\u00a1-\uffff]{2,}\.?))(?::\d{2,5})?(?:[/?#]\S*)?$/i.test(a)},date:function(){var a=!1;return function(b,c){return a||(a=!0,this.settings.debug&&window.console&&console.warn("The `date` method is deprecated and will be removed in version '2.0.0'.\nPlease don't use it, since it relies on the Date constructor, which\nbehaves very differently across browsers and locales. Use `dateISO`\ninstead or one of the locale specific methods in `localizations/`\nand `additional-methods.js`.")),this.optional(c)||!/Invalid|NaN/.test(new Date(b).toString())}}(),dateISO:function(a,b){return this.optional(b)||/^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test(a)},number:function(a,b){return this.optional(b)||/^(?:-?\d+|-?\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(a)},digits:function(a,b){return this.optional(b)||/^\d+$/.test(a)},minlength:function(a,b,c){var d=Array.isArray(a)?a.length:this.getLength(a,b);return this.optional(b)||d>=c},maxlength:function(a,b,c){var d=Array.isArray(a)?a.length:this.getLength(a,b);return this.optional(b)||d<=c},rangelength:function(a,b,c){var d=Array.isArray(a)?a.length:this.getLength(a,b);return this.optional(b)||d>=c[0]&&d<=c[1]},min:function(a,b,c){return this.optional(b)||a>=c},max:function(a,b,c){return this.optional(b)||a<=c},range:function(a,b,c){return this.optional(b)||a>=c[0]&&a<=c[1]},step:function(b,c,d){var e,f=a(c).attr("type"),g="Step attribute on input type "+f+" is not supported.",h=["text","number","range"],i=new RegExp("\\b"+f+"\\b"),j=f&&!i.test(h.join()),k=function(a){var b=(""+a).match(/(?:\.(\d+))?$/);return b&&b[1]?b[1].length:0},l=function(a){return Math.round(a*Math.pow(10,e))},m=!0;if(j)throw new Error(g);return e=k(d),(k(b)>e||l(b)%l(d)!==0)&&(m=!1),this.optional(c)||m},equalTo:function(b,c,d){var e=a(d);return this.settings.onfocusout&&e.not(".validate-equalTo-blur").length&&e.addClass("validate-equalTo-blur").on("blur.validate-equalTo",function(){a(c).valid()}),b===e.val()},remote:function(b,c,d,e){if(this.optional(c))return"dependency-mismatch";e="string"==typeof e&&e||"remote";var f,g,h,i=this.previousValue(c,e);return this.settings.messages[c.name]||(this.settings.messages[c.name]={}),i.originalMessage=i.originalMessage||this.settings.messages[c.name][e],this.settings.messages[c.name][e]=i.message,d="string"==typeof d&&{url:d}||d,h=a.param(a.extend({data:b},d.data)),i.old===h?i.valid:(i.old=h,f=this,this.startRequest(c),g={},g[c.name]=b,a.ajax(a.extend(!0,{mode:"abort",port:"validate"+c.name,dataType:"json",data:g,context:f.currentForm,success:function(a){var d,g,h,j=a===!0||"true"===a;f.settings.messages[c.name][e]=i.originalMessage,j?(h=f.formSubmitted,f.resetInternals(),f.toHide=f.errorsFor(c),f.formSubmitted=h,f.successList.push(c),f.invalid[c.name]=!1,f.showErrors()):(d={},g=a||f.defaultMessage(c,{method:e,parameters:b}),d[c.name]=i.message=g,f.invalid[c.name]=!0,f.showErrors(d)),i.valid=j,f.stopRequest(c,j)}},d)),"pending")}}});var c,d={};return a.ajaxPrefilter?a.ajaxPrefilter(function(a,b,c){var e=a.port;"abort"===a.mode&&(d[e]&&d[e].abort(),d[e]=c)}):(c=a.ajax,a.ajax=function(b){var e=("mode"in b?b:a.ajaxSettings).mode,f=("port"in b?b:a.ajaxSettings).port;return"abort"===e?(d[f]&&d[f].abort(),d[f]=c.apply(this,arguments),d[f]):c.apply(this,arguments)}),a});;
5233/*----------------------------------------
5234 * objectFitPolyfill 2.1.1
5235 *
5236 * Made by Constance Chen
5237 * Released under the MIT license
5238 *
5239 * https://github.com/constancecchen/object-fit-polyfill
5240 *--------------------------------------*/
5241
5242(function(){
5243  "use strict";
5244
5245  // if the page is being rendered on the server, don't continue
5246  if (typeof window === "undefined") {
5247      return;
5248  }
5249
5250  // Workaround for Edge 16+, which only implemented object-fit for <img> tags
5251  // TODO: Keep an eye on Edge to determine which version has full final support
5252  var edgeVersion = window.navigator.userAgent.match(/Edge\/(\d{2})\./);
5253  var edgePartialSupport = (edgeVersion) ? (parseInt(edgeVersion[1], 10) >= 16) : false;
5254
5255  // If the browser does support object-fit, we don't need to continue
5256  if ("objectFit" in document.documentElement.style !== false && !edgePartialSupport) {
5257    window.objectFitPolyfill = function() { return false };
5258    return;
5259  }
5260
5261  /**
5262   * Check the container's parent element to make sure it will
5263   * correctly handle and clip absolutely positioned children
5264   *
5265   * @param {node} $container - parent element
5266   */
5267  var checkParentContainer = function($container) {
5268    var styles = window.getComputedStyle($container, null);
5269    var position = styles.getPropertyValue("position");
5270    var overflow = styles.getPropertyValue("overflow");
5271    var display = styles.getPropertyValue("display");
5272
5273    if (!position || position === "static") {
5274      $container.style.position = "relative";
5275    }
5276    if (overflow !== "hidden") {
5277      $container.style.overflow = "hidden";
5278    }
5279    // Guesstimating that people want the parent to act like full width/height wrapper here.
5280    // Mostly attempts to target <picture> elements, which default to inline.
5281    if (!display || display === "inline") {
5282      $container.style.display = "block";
5283    }
5284    if ($container.clientHeight === 0) {
5285      $container.style.height = "100%";
5286    }
5287
5288    // Add a CSS class hook, in case people need to override styles for any reason.
5289    if ($container.className.indexOf("object-fit-polyfill") === -1) {
5290      $container.className = $container.className + " object-fit-polyfill";
5291    }
5292  };
5293
5294  /**
5295   * Check for pre-set max-width/height, min-width/height,
5296   * positioning, or margins, which can mess up image calculations
5297   *
5298   * @param {node} $media - img/video element
5299   */
5300  var checkMediaProperties = function($media) {
5301    var styles = window.getComputedStyle($media, null);
5302    var constraints = {
5303      "max-width":  "none",
5304      "max-height": "none",
5305      "min-width":  "0px",
5306      "min-height": "0px",
5307      "top": "auto",
5308      "right": "auto",
5309      "bottom": "auto",
5310      "left": "auto",
5311      "margin-top": "0px",
5312      "margin-right": "0px",
5313      "margin-bottom": "0px",
5314      "margin-left": "0px",
5315    };
5316
5317    for (var property in constraints) {
5318      var constraint = styles.getPropertyValue(property);
5319
5320      if (constraint !== constraints[property]) {
5321        $media.style[property] = constraints[property];
5322      }
5323    }
5324  };
5325
5326  /**
5327   * Calculate & set object-position
5328   *
5329   * @param {string} axis - either "x" or "y"
5330   * @param {node} $media - img or video element
5331   * @param {string} objectPosition - e.g. "50% 50%", "top bottom"
5332   */
5333  var setPosition = function(axis, $media, objectPosition) {
5334    var position, other, start, end, side;
5335    objectPosition = objectPosition.split(" ");
5336
5337    if (objectPosition.length < 2) {
5338      objectPosition[1] = objectPosition[0];
5339    }
5340
5341    if (axis === "x") {
5342      position = objectPosition[0];
5343      other = objectPosition[1];
5344      start = "left";
5345      end = "right";
5346      side = $media.clientWidth;
5347    }
5348    else if (axis === "y") {
5349      position = objectPosition[1];
5350      other = objectPosition[0];
5351      start = "top";
5352      end = "bottom";
5353      side = $media.clientHeight;
5354    }
5355    else {
5356      return; // Neither x or y axis specified
5357    }
5358
5359    if (position === start || other === start) {
5360      $media.style[start] = "0";
5361      return;
5362    }
5363
5364    if (position === end || other === end) {
5365      $media.style[end] = "0";
5366      return;
5367    }
5368
5369    if (position === "center" || position === "50%") {
5370      $media.style[start] = "50%";
5371      $media.style["margin-" + start] = (side / -2) + "px";
5372      return;
5373    }
5374
5375    // Percentage values (e.g., 30% 10%)
5376    if (position.indexOf("%") >= 0) {
5377      position = parseInt(position);
5378
5379      if (position < 50) {
5380        $media.style[start] = position + "%";
5381        $media.style["margin-" + start] = side * (position / -100) + "px";
5382      }
5383      else {
5384        position = 100 - position;
5385        $media.style[end] = position + "%";
5386        $media.style["margin-" + end] = side * (position / -100) + "px";
5387      }
5388
5389      return;
5390    }
5391    // Length-based values (e.g. 10px / 10em)
5392    else {
5393      $media.style[start] = position;
5394    }
5395
5396  };
5397
5398  /**
5399   * Calculate & set object-fit
5400   *
5401   * @param {node} $media - img/video/picture element
5402   */
5403  var objectFit = function($media) {
5404    // Fallbacks, IE 10- data
5405    var fit = ($media.dataset) ? $media.dataset.objectFit : $media.getAttribute("data-object-fit");
5406    var position = ($media.dataset) ? $media.dataset.objectPosition : $media.getAttribute("data-object-position");
5407    fit = fit || "cover";
5408    position = position || "50% 50%";
5409
5410    // If necessary, make the parent container work with absolutely positioned elements
5411    var $container = $media.parentNode;
5412    checkParentContainer($container);
5413
5414    // Check for any pre-set CSS which could mess up image calculations
5415    checkMediaProperties($media);
5416
5417    // Mathematically figure out which side needs covering, and add CSS positioning & centering
5418    $media.style.position = "absolute";
5419    $media.style.height = "100%";
5420    $media.style.width = "auto";
5421
5422    if (fit === "scale-down") {
5423      $media.style.height = "auto";
5424
5425      if (
5426        $media.clientWidth < $container.clientWidth &&
5427        $media.clientHeight < $container.clientHeight
5428      ) {
5429        setPosition("x", $media, position);
5430        setPosition("y", $media, position);
5431      }
5432      else {
5433        fit = "contain";
5434        $media.style.height = "100%";
5435      }
5436    }
5437
5438    if (fit === "none") {
5439      $media.style.width = "auto";
5440      $media.style.height = "auto";
5441      setPosition("x", $media, position);
5442      setPosition("y", $media, position);
5443    }
5444    else if (
5445      fit === "cover"   && $media.clientWidth > $container.clientWidth ||
5446      fit === "contain" && $media.clientWidth < $container.clientWidth
5447    ) {
5448      $media.style.top = "0";
5449      $media.style.marginTop = "0";
5450      setPosition("x", $media, position);
5451    }
5452    else if (fit !== "scale-down") {
5453      $media.style.width = "100%";
5454      $media.style.height = "auto";
5455      $media.style.left = "0";
5456      $media.style.marginLeft = "0";
5457      setPosition("y", $media, position);
5458    }
5459  };
5460
5461  /**
5462   * Initialize plugin
5463   *
5464   * @param {node} media - Optional specific DOM node(s) to be polyfilled
5465   */
5466  var objectFitPolyfill = function(media) {
5467    if (typeof media === "undefined") {
5468      // If left blank, all media on the page will be polyfilled.
5469      media = document.querySelectorAll("[data-object-fit]");
5470    } else if (media && media.nodeName) {
5471      // If it's a single node, wrap it in an array so it works.
5472      media = [media];
5473    } else if (typeof media === "object" && media.length && media[0].nodeName) {
5474      // If it's an array of DOM nodes (e.g. a jQuery selector), it's fine as-is.
5475      media = media;
5476    } else {
5477      // Otherwise, if it's invalid or an incorrect type, return false to let people know.
5478      return false;
5479    }
5480
5481    for (var i = 0; i < media.length; i++) {
5482      if (!media[i].nodeName) { continue; }
5483
5484      var mediaType = media[i].nodeName.toLowerCase();
5485
5486      if (mediaType === "img" && !edgePartialSupport) {
5487        if (media[i].complete) {
5488          objectFit(media[i]);
5489        }
5490        else {
5491          media[i].addEventListener("load", function() {
5492            objectFit(this);
5493          });
5494        }
5495      }
5496      else if (mediaType === "video") {
5497        if (media[i].readyState > 0) {
5498          objectFit(media[i]);
5499        }
5500        else {
5501          media[i].addEventListener("loadedmetadata", function() {
5502            objectFit(this);
5503          });
5504        }
5505      }
5506    }
5507
5508    return true;
5509  };
5510
5511  document.addEventListener("DOMContentLoaded", function() {
5512    objectFitPolyfill();
5513  });
5514  window.addEventListener("resize", function() {
5515    objectFitPolyfill();
5516  });
5517
5518  window.objectFitPolyfill = objectFitPolyfill;
5519
5520})();
5521;
5522/*
5523     _ _      _       _
5524 ___| (_) ___| | __  (_)___
5525/ __| | |/ __| |/ /  | / __|
5526\__ \ | | (__|   < _ | \__ \
5527|___/_|_|\___|_|\_(_)/ |___/
5528                   |__/
5529
5530 Version: 1.7.1
5531  Author: Ken Wheeler
5532 Website: http://kenwheeler.github.io
5533    Docs: http://kenwheeler.github.io/slick
5534    Repo: http://github.com/kenwheeler/slick
5535  Issues: http://github.com/kenwheeler/slick/issues
5536
5537 */
5538/* global window, document, define, jQuery, setInterval, clearInterval */
5539;(function(factory) {
5540    'use strict';
5541    if (typeof define === 'function' && define.amd) {
5542        define(['jquery'], factory);
5543    } else if (typeof exports !== 'undefined') {
5544        module.exports = factory(require('jquery'));
5545    } else {
5546        factory(jQuery);
5547    }
5548
5549}(function($) {
5550    'use strict';
5551    var Slick = window.Slick || {};
5552
5553    Slick = (function() {
5554
5555        var instanceUid = 0;
5556
5557        function Slick(element, settings) {
5558
5559            var _ = this, dataSettings;
5560
5561            _.defaults = {
5562                accessibility: true,
5563                adaptiveHeight: false,
5564                appendArrows: $(element),
5565                appendDots: $(element),
5566                arrows: true,
5567                asNavFor: null,
5568                prevArrow: '<button class="slick-prev" aria-label="Previous" type="button">Previous</button>',
5569                nextArrow: '<button class="slick-next" aria-label="Next" type="button">Next</button>',
5570                autoplay: false,
5571                autoplaySpeed: 3000,
5572                centerMode: false,
5573                centerPadding: '50px',
5574                cssEase: 'ease',
5575                customPaging: function(slider, i) {
5576                    return $('<button type="button" />').text(i + 1);
5577                },
5578                dots: false,
5579                dotsClass: 'slick-dots',
5580                draggable: true,
5581                easing: 'linear',
5582                edgeFriction: 0.35,
5583                fade: false,
5584                focusOnSelect: false,
5585                focusOnChange: false,
5586                infinite: true,
5587                initialSlide: 0,
5588                lazyLoad: 'ondemand',
5589                mobileFirst: false,
5590                pauseOnHover: true,
5591                pauseOnFocus: true,
5592                pauseOnDotsHover: false,
5593                respondTo: 'window',
5594                responsive: null,
5595                rows: 1,
5596                rtl: false,
5597                slide: '',
5598                slidesPerRow: 1,
5599                slidesToShow: 1,
5600                slidesToScroll: 1,
5601                speed: 500,
5602                swipe: true,
5603                swipeToSlide: false,
5604                touchMove: true,
5605                touchThreshold: 5,
5606                useCSS: true,
5607                useTransform: true,
5608                variableWidth: false,
5609                vertical: false,
5610                verticalSwiping: false,
5611                waitForAnimate: true,
5612                zIndex: 1000
5613            };
5614
5615            _.initials = {
5616                animating: false,
5617                dragging: false,
5618                autoPlayTimer: null,
5619                currentDirection: 0,
5620                currentLeft: null,
5621                currentSlide: 0,
5622                direction: 1,
5623                $dots: null,
5624                listWidth: null,
5625                listHeight: null,
5626                loadIndex: 0,
5627                $nextArrow: null,
5628                $prevArrow: null,
5629                scrolling: false,
5630                slideCount: null,
5631                slideWidth: null,
5632                $slideTrack: null,
5633                $slides: null,
5634                sliding: false,
5635                slideOffset: 0,
5636                swipeLeft: null,
5637                swiping: false,
5638                $list: null,
5639                touchObject: {},
5640                transformsEnabled: false,
vendor: 84,746 bytes, lines 5641-8424
5641                unslicked: false
5642            };
5643
5644            $.extend(_, _.initials);
5645
5646            _.activeBreakpoint = null;
5647            _.animType = null;
5648            _.animProp = null;
5649            _.breakpoints = [];
5650            _.breakpointSettings = [];
5651            _.cssTransitions = false;
5652            _.focussed = false;
5653            _.interrupted = false;
5654            _.hidden = 'hidden';
5655            _.paused = true;
5656            _.positionProp = null;
5657            _.respondTo = null;
5658            _.rowCount = 1;
5659            _.shouldClick = true;
5660            _.$slider = $(element);
5661            _.$slidesCache = null;
5662            _.transformType = null;
5663            _.transitionType = null;
5664            _.visibilityChange = 'visibilitychange';
5665            _.windowWidth = 0;
5666            _.windowTimer = null;
5667
5668            dataSettings = $(element).data('slick') || {};
5669
5670            _.options = $.extend({}, _.defaults, settings, dataSettings);
5671
5672            _.currentSlide = _.options.initialSlide;
5673
5674            _.originalSettings = _.options;
5675
5676            if (typeof document.mozHidden !== 'undefined') {
5677                _.hidden = 'mozHidden';
5678                _.visibilityChange = 'mozvisibilitychange';
5679            } else if (typeof document.webkitHidden !== 'undefined') {
5680                _.hidden = 'webkitHidden';
5681                _.visibilityChange = 'webkitvisibilitychange';
5682            }
5683
5684            _.autoPlay = $.proxy(_.autoPlay, _);
5685            _.autoPlayClear = $.proxy(_.autoPlayClear, _);
5686            _.autoPlayIterator = $.proxy(_.autoPlayIterator, _);
5687            _.changeSlide = $.proxy(_.changeSlide, _);
5688            _.clickHandler = $.proxy(_.clickHandler, _);
5689            _.selectHandler = $.proxy(_.selectHandler, _);
5690            _.setPosition = $.proxy(_.setPosition, _);
5691            _.swipeHandler = $.proxy(_.swipeHandler, _);
5692            _.dragHandler = $.proxy(_.dragHandler, _);
5693            _.keyHandler = $.proxy(_.keyHandler, _);
5694
5695            _.instanceUid = instanceUid++;
5696
5697            // A simple way to check for HTML strings
5698            // Strict HTML recognition (must start with <)
5699            // Extracted from jQuery v1.11 source
5700            _.htmlExpr = /^(?:\s*(<[\w\W]+>)[^>]*)$/;
5701
5702
5703            _.registerBreakpoints();
5704            _.init(true);
5705
5706        }
5707
5708        return Slick;
5709
5710    }());
5711
5712    Slick.prototype.activateADA = function() {
5713        var _ = this;
5714
5715        _.$slideTrack.find('.slick-active').attr({
5716            'aria-hidden': 'false'
5717        }).find('a, input, button, select').attr({
5718            'tabindex': '0'
5719        });
5720
5721    };
5722
5723    Slick.prototype.addSlide = Slick.prototype.slickAdd = function(markup, index, addBefore) {
5724
5725        var _ = this;
5726
5727        if (typeof(index) === 'boolean') {
5728            addBefore = index;
5729            index = null;
5730        } else if (index < 0 || (index >= _.slideCount)) {
5731            return false;
5732        }
5733
5734        _.unload();
5735
5736        if (typeof(index) === 'number') {
5737            if (index === 0 && _.$slides.length === 0) {
5738                $(markup).appendTo(_.$slideTrack);
5739            } else if (addBefore) {
5740                $(markup).insertBefore(_.$slides.eq(index));
5741            } else {
5742                $(markup).insertAfter(_.$slides.eq(index));
5743            }
5744        } else {
5745            if (addBefore === true) {
5746                $(markup).prependTo(_.$slideTrack);
5747            } else {
5748                $(markup).appendTo(_.$slideTrack);
5749            }
5750        }
5751
5752        _.$slides = _.$slideTrack.children(this.options.slide);
5753
5754        _.$slideTrack.children(this.options.slide).detach();
5755
5756        _.$slideTrack.append(_.$slides);
5757
5758        _.$slides.each(function(index, element) {
5759            $(element).attr('data-slick-index', index);
5760        });
5761
5762        _.$slidesCache = _.$slides;
5763
5764        _.reinit();
5765
5766    };
5767
5768    Slick.prototype.animateHeight = function() {
5769        var _ = this;
5770        if (_.options.slidesToShow === 1 && _.options.adaptiveHeight === true && _.options.vertical === false) {
5771            var targetHeight = _.$slides.eq(_.currentSlide).outerHeight(true);
5772            _.$list.animate({
5773                height: targetHeight
5774            }, _.options.speed);
5775        }
5776    };
5777
5778    Slick.prototype.animateSlide = function(targetLeft, callback) {
5779
5780        var animProps = {},
5781            _ = this;
5782
5783        _.animateHeight();
5784
5785        if (_.options.rtl === true && _.options.vertical === false) {
5786            targetLeft = -targetLeft;
5787        }
5788        if (_.transformsEnabled === false) {
5789            if (_.options.vertical === false) {
5790                _.$slideTrack.animate({
5791                    left: targetLeft
5792                }, _.options.speed, _.options.easing, callback);
5793            } else {
5794                _.$slideTrack.animate({
5795                    top: targetLeft
5796                }, _.options.speed, _.options.easing, callback);
5797            }
5798
5799        } else {
5800
5801            if (_.cssTransitions === false) {
5802                if (_.options.rtl === true) {
5803                    _.currentLeft = -(_.currentLeft);
5804                }
5805                $({
5806                    animStart: _.currentLeft
5807                }).animate({
5808                    animStart: targetLeft
5809                }, {
5810                    duration: _.options.speed,
5811                    easing: _.options.easing,
5812                    step: function(now) {
5813                        now = Math.ceil(now);
5814                        if (_.options.vertical === false) {
5815                            animProps[_.animType] = 'translate(' +
5816                                now + 'px, 0px)';
5817                            _.$slideTrack.css(animProps);
5818                        } else {
5819                            animProps[_.animType] = 'translate(0px,' +
5820                                now + 'px)';
5821                            _.$slideTrack.css(animProps);
5822                        }
5823                    },
5824                    complete: function() {
5825                        if (callback) {
5826                            callback.call();
5827                        }
5828                    }
5829                });
5830
5831            } else {
5832
5833                _.applyTransition();
5834                targetLeft = Math.ceil(targetLeft);
5835
5836                if (_.options.vertical === false) {
5837                    animProps[_.animType] = 'translate3d(' + targetLeft + 'px, 0px, 0px)';
5838                } else {
5839                    animProps[_.animType] = 'translate3d(0px,' + targetLeft + 'px, 0px)';
5840                }
5841                _.$slideTrack.css(animProps);
5842
5843                if (callback) {
5844                    setTimeout(function() {
5845
5846                        _.disableTransition();
5847
5848                        callback.call();
5849                    }, _.options.speed);
5850                }
5851
5852            }
5853
5854        }
5855
5856    };
5857
5858    Slick.prototype.getNavTarget = function() {
5859
5860        var _ = this,
5861            asNavFor = _.options.asNavFor;
5862
5863        if ( asNavFor && asNavFor !== null ) {
5864            asNavFor = $(asNavFor).not(_.$slider);
5865        }
5866
5867        return asNavFor;
5868
5869    };
5870
5871    Slick.prototype.asNavFor = function(index) {
5872
5873        var _ = this,
5874            asNavFor = _.getNavTarget();
5875
5876        if ( asNavFor !== null && typeof asNavFor === 'object' ) {
5877            asNavFor.each(function() {
5878                var target = $(this).slick('getSlick');
5879                if(!target.unslicked) {
5880                    target.slideHandler(index, true);
5881                }
5882            });
5883        }
5884
5885    };
5886
5887    Slick.prototype.applyTransition = function(slide) {
5888
5889        var _ = this,
5890            transition = {};
5891
5892        if (_.options.fade === false) {
5893            transition[_.transitionType] = _.transformType + ' ' + _.options.speed + 'ms ' + _.options.cssEase;
5894        } else {
5895            transition[_.transitionType] = 'opacity ' + _.options.speed + 'ms ' + _.options.cssEase;
5896        }
5897
5898        if (_.options.fade === false) {
5899            _.$slideTrack.css(transition);
5900        } else {
5901            _.$slides.eq(slide).css(transition);
5902        }
5903
5904    };
5905
5906    Slick.prototype.autoPlay = function() {
5907
5908        var _ = this;
5909
5910        _.autoPlayClear();
5911
5912        if ( _.slideCount > _.options.slidesToShow ) {
5913            _.autoPlayTimer = setInterval( _.autoPlayIterator, _.options.autoplaySpeed );
5914        }
5915
5916    };
5917
5918    Slick.prototype.autoPlayClear = function() {
5919
5920        var _ = this;
5921
5922        if (_.autoPlayTimer) {
5923            clearInterval(_.autoPlayTimer);
5924        }
5925
5926    };
5927
5928    Slick.prototype.autoPlayIterator = function() {
5929
5930        var _ = this,
5931            slideTo = _.currentSlide + _.options.slidesToScroll;
5932
5933        if ( !_.paused && !_.interrupted && !_.focussed ) {
5934
5935            if ( _.options.infinite === false ) {
5936
5937                if ( _.direction === 1 && ( _.currentSlide + 1 ) === ( _.slideCount - 1 )) {
5938                    _.direction = 0;
5939                }
5940
5941                else if ( _.direction === 0 ) {
5942
5943                    slideTo = _.currentSlide - _.options.slidesToScroll;
5944
5945                    if ( _.currentSlide - 1 === 0 ) {
5946                        _.direction = 1;
5947                    }
5948
5949                }
5950
5951            }
5952
5953            _.slideHandler( slideTo );
5954
5955        }
5956
5957    };
5958
5959    Slick.prototype.buildArrows = function() {
5960
5961        var _ = this;
5962
5963        if (_.options.arrows === true ) {
5964
5965            _.$prevArrow = $(_.options.prevArrow).addClass('slick-arrow');
5966            _.$nextArrow = $(_.options.nextArrow).addClass('slick-arrow');
5967
5968            if( _.slideCount > _.options.slidesToShow ) {
5969
5970                _.$prevArrow.removeClass('slick-hidden').removeAttr('aria-hidden tabindex');
5971                _.$nextArrow.removeClass('slick-hidden').removeAttr('aria-hidden tabindex');
5972
5973                if (_.htmlExpr.test(_.options.prevArrow)) {
5974                    _.$prevArrow.prependTo(_.options.appendArrows);
5975                }
5976
5977                if (_.htmlExpr.test(_.options.nextArrow)) {
5978                    _.$nextArrow.appendTo(_.options.appendArrows);
5979                }
5980
5981                if (_.options.infinite !== true) {
5982                    _.$prevArrow
5983                        .addClass('slick-disabled')
5984                        .attr('aria-disabled', 'true');
5985                }
5986
5987            } else {
5988
5989                _.$prevArrow.add( _.$nextArrow )
5990
5991                    .addClass('slick-hidden')
5992                    .attr({
5993                        'aria-disabled': 'true',
5994                        'tabindex': '-1'
5995                    });
5996
5997            }
5998
5999        }
6000
6001    };
6002
6003    Slick.prototype.buildDots = function() {
6004
6005        var _ = this,
6006            i, dot;
6007
6008        if (_.options.dots === true) {
6009
6010            _.$slider.addClass('slick-dotted');
6011
6012            dot = $('<ul />').addClass(_.options.dotsClass);
6013
6014            for (i = 0; i <= _.getDotCount(); i += 1) {
6015                dot.append($('<li />').append(_.options.customPaging.call(this, _, i)));
6016            }
6017
6018            _.$dots = dot.appendTo(_.options.appendDots);
6019
6020            _.$dots.find('li').first().addClass('slick-active');
6021
6022        }
6023
6024    };
6025
6026    Slick.prototype.buildOut = function() {
6027
6028        var _ = this;
6029
6030        _.$slides =
6031            _.$slider
6032                .children( _.options.slide + ':not(.slick-cloned)')
6033                .addClass('slick-slide');
6034
6035        _.slideCount = _.$slides.length;
6036
6037        _.$slides.each(function(index, element) {
6038            $(element)
6039                .attr('data-slick-index', index)
6040                .data('originalStyling', $(element).attr('style') || '');
6041        });
6042
6043        _.$slider.addClass('slick-slider');
6044
6045        _.$slideTrack = (_.slideCount === 0) ?
6046            $('<div class="slick-track"/>').appendTo(_.$slider) :
6047            _.$slides.wrapAll('<div class="slick-track"/>').parent();
6048
6049        _.$list = _.$slideTrack.wrap(
6050            '<div class="slick-list"/>').parent();
6051        _.$slideTrack.css('opacity', 0);
6052
6053        if (_.options.centerMode === true || _.options.swipeToSlide === true) {
6054            _.options.slidesToScroll = 1;
6055        }
6056
6057        $('img[data-lazy]', _.$slider).not('[src]').addClass('slick-loading');
6058
6059        _.setupInfinite();
6060
6061        _.buildArrows();
6062
6063        _.buildDots();
6064
6065        _.updateDots();
6066
6067
6068        _.setSlideClasses(typeof _.currentSlide === 'number' ? _.currentSlide : 0);
6069
6070        if (_.options.draggable === true) {
6071            _.$list.addClass('draggable');
6072        }
6073
6074    };
6075
6076    Slick.prototype.buildRows = function() {
6077
6078        var _ = this, a, b, c, newSlides, numOfSlides, originalSlides,slidesPerSection;
6079
6080        newSlides = document.createDocumentFragment();
6081        originalSlides = _.$slider.children();
6082
6083        if(_.options.rows > 1) {
6084
6085            slidesPerSection = _.options.slidesPerRow * _.options.rows;
6086            numOfSlides = Math.ceil(
6087                originalSlides.length / slidesPerSection
6088            );
6089
6090            for(a = 0; a < numOfSlides; a++){
6091                var slide = document.createElement('div');
6092                for(b = 0; b < _.options.rows; b++) {
6093                    var row = document.createElement('div');
6094                    for(c = 0; c < _.options.slidesPerRow; c++) {
6095                        var target = (a * slidesPerSection + ((b * _.options.slidesPerRow) + c));
6096                        if (originalSlides.get(target)) {
6097                            row.appendChild(originalSlides.get(target));
6098                        }
6099                    }
6100                    slide.appendChild(row);
6101                }
6102                newSlides.appendChild(slide);
6103            }
6104
6105            _.$slider.empty().append(newSlides);
6106            _.$slider.children().children().children()
6107                .css({
6108                    'width':(100 / _.options.slidesPerRow) + '%',
6109                    'display': 'inline-block'
6110                });
6111
6112        }
6113
6114    };
6115
6116    Slick.prototype.checkResponsive = function(initial, forceUpdate) {
6117
6118        var _ = this,
6119            breakpoint, targetBreakpoint, respondToWidth, triggerBreakpoint = false;
6120        var sliderWidth = _.$slider.width();
6121        var windowWidth = window.innerWidth || $(window).width();
6122
6123        if (_.respondTo === 'window') {
6124            respondToWidth = windowWidth;
6125        } else if (_.respondTo === 'slider') {
6126            respondToWidth = sliderWidth;
6127        } else if (_.respondTo === 'min') {
6128            respondToWidth = Math.min(windowWidth, sliderWidth);
6129        }
6130
6131        if ( _.options.responsive &&
6132            _.options.responsive.length &&
6133            _.options.responsive !== null) {
6134
6135            targetBreakpoint = null;
6136
6137            for (breakpoint in _.breakpoints) {
6138                if (_.breakpoints.hasOwnProperty(breakpoint)) {
6139                    if (_.originalSettings.mobileFirst === false) {
6140                        if (respondToWidth < _.breakpoints[breakpoint]) {
6141                            targetBreakpoint = _.breakpoints[breakpoint];
6142                        }
6143                    } else {
6144                        if (respondToWidth > _.breakpoints[breakpoint]) {
6145                            targetBreakpoint = _.breakpoints[breakpoint];
6146                        }
6147                    }
6148                }
6149            }
6150
6151            if (targetBreakpoint !== null) {
6152                if (_.activeBreakpoint !== null) {
6153                    if (targetBreakpoint !== _.activeBreakpoint || forceUpdate) {
6154                        _.activeBreakpoint =
6155                            targetBreakpoint;
6156                        if (_.breakpointSettings[targetBreakpoint] === 'unslick') {
6157                            _.unslick(targetBreakpoint);
6158                        } else {
6159                            _.options = $.extend({}, _.originalSettings,
6160                                _.breakpointSettings[
6161                                    targetBreakpoint]);
6162                            if (initial === true) {
6163                                _.currentSlide = _.options.initialSlide;
6164                            }
6165                            _.refresh(initial);
6166                        }
6167                        triggerBreakpoint = targetBreakpoint;
6168                    }
6169                } else {
6170                    _.activeBreakpoint = targetBreakpoint;
6171                    if (_.breakpointSettings[targetBreakpoint] === 'unslick') {
6172                        _.unslick(targetBreakpoint);
6173                    } else {
6174                        _.options = $.extend({}, _.originalSettings,
6175                            _.breakpointSettings[
6176                                targetBreakpoint]);
6177                        if (initial === true) {
6178                            _.currentSlide = _.options.initialSlide;
6179                        }
6180                        _.refresh(initial);
6181                    }
6182                    triggerBreakpoint = targetBreakpoint;
6183                }
6184            } else {
6185                if (_.activeBreakpoint !== null) {
6186                    _.activeBreakpoint = null;
6187                    _.options = _.originalSettings;
6188                    if (initial === true) {
6189                        _.currentSlide = _.options.initialSlide;
6190                    }
6191                    _.refresh(initial);
6192                    triggerBreakpoint = targetBreakpoint;
6193                }
6194            }
6195
6196            // only trigger breakpoints during an actual break. not on initialize.
6197            if( !initial && triggerBreakpoint !== false ) {
6198                _.$slider.trigger('breakpoint', [_, triggerBreakpoint]);
6199            }
6200        }
6201
6202    };
6203
6204    Slick.prototype.changeSlide = function(event, dontAnimate) {
6205
6206        var _ = this,
6207            $target = $(event.currentTarget),
6208            indexOffset, slideOffset, unevenOffset;
6209
6210        // If target is a link, prevent default action.
6211        if($target.is('a')) {
6212            event.preventDefault();
6213        }
6214
6215        // If target is not the <li> element (ie: a child), find the <li>.
6216        if(!$target.is('li')) {
6217            $target = $target.closest('li');
6218        }
6219
6220        unevenOffset = (_.slideCount % _.options.slidesToScroll !== 0);
6221        indexOffset = unevenOffset ? 0 : (_.slideCount - _.currentSlide) % _.options.slidesToScroll;
6222
6223        switch (event.data.message) {
6224
6225            case 'previous':
6226                slideOffset = indexOffset === 0 ? _.options.slidesToScroll : _.options.slidesToShow - indexOffset;
6227                if (_.slideCount > _.options.slidesToShow) {
6228                    _.slideHandler(_.currentSlide - slideOffset, false, dontAnimate);
6229                }
6230                break;
6231
6232            case 'next':
6233                slideOffset = indexOffset === 0 ? _.options.slidesToScroll : indexOffset;
6234                if (_.slideCount > _.options.slidesToShow) {
6235                    _.slideHandler(_.currentSlide + slideOffset, false, dontAnimate);
6236                }
6237                break;
6238
6239            case 'index':
6240                var index = event.data.index === 0 ? 0 :
6241                    event.data.index || $target.index() * _.options.slidesToScroll;
6242
6243                _.slideHandler(_.checkNavigable(index), false, dontAnimate);
6244                $target.children().trigger('focus');
6245                break;
6246
6247            default:
6248                return;
6249        }
6250
6251    };
6252
6253    Slick.prototype.checkNavigable = function(index) {
6254
6255        var _ = this,
6256            navigables, prevNavigable;
6257
6258        navigables = _.getNavigableIndexes();
6259        prevNavigable = 0;
6260        if (index > navigables[navigables.length - 1]) {
6261            index = navigables[navigables.length - 1];
6262        } else {
6263            for (var n in navigables) {
6264                if (index < navigables[n]) {
6265                    index = prevNavigable;
6266                    break;
6267                }
6268                prevNavigable = navigables[n];
6269            }
6270        }
6271
6272        return index;
6273    };
6274
6275    Slick.prototype.cleanUpEvents = function() {
6276
6277        var _ = this;
6278
6279        if (_.options.dots && _.$dots !== null) {
6280
6281            $('li', _.$dots)
6282                .off('click.slick', _.changeSlide)
6283                .off('mouseenter.slick', $.proxy(_.interrupt, _, true))
6284                .off('mouseleave.slick', $.proxy(_.interrupt, _, false));
6285
6286            if (_.options.accessibility === true) {
6287                _.$dots.off('keydown.slick', _.keyHandler);
6288            }
6289        }
6290
6291        _.$slider.off('focus.slick blur.slick');
6292
6293        if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) {
6294            _.$prevArrow && _.$prevArrow.off('click.slick', _.changeSlide);
6295            _.$nextArrow && _.$nextArrow.off('click.slick', _.changeSlide);
6296
6297            if (_.options.accessibility === true) {
6298                _.$prevArrow && _.$prevArrow.off('keydown.slick', _.keyHandler);
6299                _.$nextArrow && _.$nextArrow.off('keydown.slick', _.keyHandler);
6300            }
6301        }
6302
6303        _.$list.off('touchstart.slick mousedown.slick', _.swipeHandler);
6304        _.$list.off('touchmove.slick mousemove.slick', _.swipeHandler);
6305        _.$list.off('touchend.slick mouseup.slick', _.swipeHandler);
6306        _.$list.off('touchcancel.slick mouseleave.slick', _.swipeHandler);
6307
6308        _.$list.off('click.slick', _.clickHandler);
6309
6310        $(document).off(_.visibilityChange, _.visibility);
6311
6312        _.cleanUpSlideEvents();
6313
6314        if (_.options.accessibility === true) {
6315            _.$list.off('keydown.slick', _.keyHandler);
6316        }
6317
6318        if (_.options.focusOnSelect === true) {
6319            $(_.$slideTrack).children().off('click.slick', _.selectHandler);
6320        }
6321
6322        $(window).off('orientationchange.slick.slick-' + _.instanceUid, _.orientationChange);
6323
6324        $(window).off('resize.slick.slick-' + _.instanceUid, _.resize);
6325
6326        $('[draggable!=true]', _.$slideTrack).off('dragstart', _.preventDefault);
6327
6328        $(window).off('load.slick.slick-' + _.instanceUid, _.setPosition);
6329
6330    };
6331
6332    Slick.prototype.cleanUpSlideEvents = function() {
6333
6334        var _ = this;
6335
6336        _.$list.off('mouseenter.slick', $.proxy(_.interrupt, _, true));
6337        _.$list.off('mouseleave.slick', $.proxy(_.interrupt, _, false));
6338
6339    };
6340
6341    Slick.prototype.cleanUpRows = function() {
6342
6343        var _ = this, originalSlides;
6344
6345        if(_.options.rows > 1) {
6346            originalSlides = _.$slides.children().children();
6347            originalSlides.removeAttr('style');
6348            _.$slider.empty().append(originalSlides);
6349        }
6350
6351    };
6352
6353    Slick.prototype.clickHandler = function(event) {
6354
6355        var _ = this;
6356
6357        if (_.shouldClick === false) {
6358            event.stopImmediatePropagation();
6359            event.stopPropagation();
6360            event.preventDefault();
6361        }
6362
6363    };
6364
6365    Slick.prototype.destroy = function(refresh) {
6366
6367        var _ = this;
6368
6369        _.autoPlayClear();
6370
6371        _.touchObject = {};
6372
6373        _.cleanUpEvents();
6374
6375        $('.slick-cloned', _.$slider).detach();
6376
6377        if (_.$dots) {
6378            _.$dots.remove();
6379        }
6380
6381        if ( _.$prevArrow && _.$prevArrow.length ) {
6382
6383            _.$prevArrow
6384                .removeClass('slick-disabled slick-arrow slick-hidden')
6385                .removeAttr('aria-hidden aria-disabled tabindex')
6386                .css('display','');
6387
6388            if ( _.htmlExpr.test( _.options.prevArrow )) {
6389                _.$prevArrow.remove();
6390            }
6391        }
6392
6393        if ( _.$nextArrow && _.$nextArrow.length ) {
6394
6395            _.$nextArrow
6396                .removeClass('slick-disabled slick-arrow slick-hidden')
6397                .removeAttr('aria-hidden aria-disabled tabindex')
6398                .css('display','');
6399
6400            if ( _.htmlExpr.test( _.options.nextArrow )) {
6401                _.$nextArrow.remove();
6402            }
6403        }
6404
6405
6406        if (_.$slides) {
6407
6408            _.$slides
6409                .removeClass('slick-slide slick-active slick-center slick-visible slick-current')
6410                .removeAttr('aria-hidden')
6411                .removeAttr('data-slick-index')
6412                .each(function(){
6413                    $(this).attr('style', $(this).data('originalStyling'));
6414                });
6415
6416            _.$slideTrack.children(this.options.slide).detach();
6417
6418            _.$slideTrack.detach();
6419
6420            _.$list.detach();
6421
6422            _.$slider.append(_.$slides);
6423        }
6424
6425        _.cleanUpRows();
6426
6427        _.$slider.removeClass('slick-slider');
6428        _.$slider.removeClass('slick-initialized');
6429        _.$slider.removeClass('slick-dotted');
6430
6431        _.unslicked = true;
6432
6433        if(!refresh) {
6434            _.$slider.trigger('destroy', [_]);
6435        }
6436
6437    };
6438
6439    Slick.prototype.disableTransition = function(slide) {
6440
6441        var _ = this,
6442            transition = {};
6443
6444        transition[_.transitionType] = '';
6445
6446        if (_.options.fade === false) {
6447            _.$slideTrack.css(transition);
6448        } else {
6449            _.$slides.eq(slide).css(transition);
6450        }
6451
6452    };
6453
6454    Slick.prototype.fadeSlide = function(slideIndex, callback) {
6455
6456        var _ = this;
6457
6458        if (_.cssTransitions === false) {
6459
6460            _.$slides.eq(slideIndex).css({
6461                zIndex: _.options.zIndex
6462            });
6463
6464            _.$slides.eq(slideIndex).animate({
6465                opacity: 1
6466            }, _.options.speed, _.options.easing, callback);
6467
6468        } else {
6469
6470            _.applyTransition(slideIndex);
6471
6472            _.$slides.eq(slideIndex).css({
6473                opacity: 1,
6474                zIndex: _.options.zIndex
6475            });
6476
6477            if (callback) {
6478                setTimeout(function() {
6479
6480                    _.disableTransition(slideIndex);
6481
6482                    callback.call();
6483                }, _.options.speed);
6484            }
6485
6486        }
6487
6488    };
6489
6490    Slick.prototype.fadeSlideOut = function(slideIndex) {
6491
6492        var _ = this;
6493
6494        if (_.cssTransitions === false) {
6495
6496            _.$slides.eq(slideIndex).animate({
6497                opacity: 0,
6498                zIndex: _.options.zIndex - 2
6499            }, _.options.speed, _.options.easing);
6500
6501        } else {
6502
6503            _.applyTransition(slideIndex);
6504
6505            _.$slides.eq(slideIndex).css({
6506                opacity: 0,
6507                zIndex: _.options.zIndex - 2
6508            });
6509
6510        }
6511
6512    };
6513
6514    Slick.prototype.filterSlides = Slick.prototype.slickFilter = function(filter) {
6515
6516        var _ = this;
6517
6518        if (filter !== null) {
6519
6520            _.$slidesCache = _.$slides;
6521
6522            _.unload();
6523
6524            _.$slideTrack.children(this.options.slide).detach();
6525
6526            _.$slidesCache.filter(filter).appendTo(_.$slideTrack);
6527
6528            _.reinit();
6529
6530        }
6531
6532    };
6533
6534    Slick.prototype.focusHandler = function() {
6535
6536        var _ = this;
6537
6538        _.$slider
6539            .off('focus.slick blur.slick')
6540            .on('focus.slick blur.slick', '*', function(event) {
6541
6542            event.stopImmediatePropagation();
6543            var $sf = $(this);
6544
6545            setTimeout(function() {
6546
6547                if( _.options.pauseOnFocus ) {
6548                    _.focussed = $sf.is(':focus');
6549                    _.autoPlay();
6550                }
6551
6552            }, 0);
6553
6554        });
6555    };
6556
6557    Slick.prototype.getCurrent = Slick.prototype.slickCurrentSlide = function() {
6558
6559        var _ = this;
6560        return _.currentSlide;
6561
6562    };
6563
6564    Slick.prototype.getDotCount = function() {
6565
6566        var _ = this;
6567
6568        var breakPoint = 0;
6569        var counter = 0;
6570        var pagerQty = 0;
6571
6572        if (_.options.infinite === true) {
6573            if (_.slideCount <= _.options.slidesToShow) {
6574                 ++pagerQty;
6575            } else {
6576                while (breakPoint < _.slideCount) {
6577                    ++pagerQty;
6578                    breakPoint = counter + _.options.slidesToScroll;
6579                    counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow;
6580                }
6581            }
6582        } else if (_.options.centerMode === true) {
6583            pagerQty = _.slideCount;
6584        } else if(!_.options.asNavFor) {
6585            pagerQty = 1 + Math.ceil((_.slideCount - _.options.slidesToShow) / _.options.slidesToScroll);
6586        }else {
6587            while (breakPoint < _.slideCount) {
6588                ++pagerQty;
6589                breakPoint = counter + _.options.slidesToScroll;
6590                counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow;
6591            }
6592        }
6593
6594        return pagerQty - 1;
6595
6596    };
6597
6598    Slick.prototype.getLeft = function(slideIndex) {
6599
6600        var _ = this,
6601            targetLeft,
6602            verticalHeight,
6603            verticalOffset = 0,
6604            targetSlide,
6605            coef;
6606
6607        _.slideOffset = 0;
6608        verticalHeight = _.$slides.first().outerHeight(true);
6609
6610        if (_.options.infinite === true) {
6611            if (_.slideCount > _.options.slidesToShow) {
6612                _.slideOffset = (_.slideWidth * _.options.slidesToShow) * -1;
6613                coef = -1
6614
6615                if (_.options.vertical === true && _.options.centerMode === true) {
6616                    if (_.options.slidesToShow === 2) {
6617                        coef = -1.5;
6618                    } else if (_.options.slidesToShow === 1) {
6619                        coef = -2
6620                    }
6621                }
6622                verticalOffset = (verticalHeight * _.options.slidesToShow) * coef;
6623            }
6624            if (_.slideCount % _.options.slidesToScroll !== 0) {
6625                if (slideIndex + _.options.slidesToScroll > _.slideCount && _.slideCount > _.options.slidesToShow) {
6626                    if (slideIndex > _.slideCount) {
6627                        _.slideOffset = ((_.options.slidesToShow - (slideIndex - _.slideCount)) * _.slideWidth) * -1;
6628                        verticalOffset = ((_.options.slidesToShow - (slideIndex - _.slideCount)) * verticalHeight) * -1;
6629                    } else {
6630                        _.slideOffset = ((_.slideCount % _.options.slidesToScroll) * _.slideWidth) * -1;
6631                        verticalOffset = ((_.slideCount % _.options.slidesToScroll) * verticalHeight) * -1;
6632                    }
6633                }
6634            }
6635        } else {
6636            if (slideIndex + _.options.slidesToShow > _.slideCount) {
6637                _.slideOffset = ((slideIndex + _.options.slidesToShow) - _.slideCount) * _.slideWidth;
6638                verticalOffset = ((slideIndex + _.options.slidesToShow) - _.slideCount) * verticalHeight;
6639            }
6640        }
6641
6642        if (_.slideCount <= _.options.slidesToShow) {
6643            _.slideOffset = 0;
6644            verticalOffset = 0;
6645        }
6646
6647        if (_.options.centerMode === true && _.slideCount <= _.options.slidesToShow) {
6648            _.slideOffset = ((_.slideWidth * Math.floor(_.options.slidesToShow)) / 2) - ((_.slideWidth * _.slideCount) / 2);
6649        } else if (_.options.centerMode === true && _.options.infinite === true) {
6650            _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2) - _.slideWidth;
6651        } else if (_.options.centerMode === true) {
6652            _.slideOffset = 0;
6653            _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2);
6654        }
6655
6656        if (_.options.vertical === false) {
6657            targetLeft = ((slideIndex * _.slideWidth) * -1) + _.slideOffset;
6658        } else {
6659            targetLeft = ((slideIndex * verticalHeight) * -1) + verticalOffset;
6660        }
6661
6662        if (_.options.variableWidth === true) {
6663
6664            if (_.slideCount <= _.options.slidesToShow || _.options.infinite === false) {
6665                targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex);
6666            } else {
6667                targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex + _.options.slidesToShow);
6668            }
6669
6670            if (_.options.rtl === true) {
6671                if (targetSlide[0]) {
6672                    targetLeft = (_.$slideTrack.width() - targetSlide[0].offsetLeft - targetSlide.width()) * -1;
6673                } else {
6674                    targetLeft =  0;
6675                }
6676            } else {
6677                targetLeft = targetSlide[0] ? targetSlide[0].offsetLeft * -1 : 0;
6678            }
6679
6680            if (_.options.centerMode === true) {
6681                if (_.slideCount <= _.options.slidesToShow || _.options.infinite === false) {
6682                    targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex);
6683                } else {
6684                    targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex + _.options.slidesToShow + 1);
6685                }
6686
6687                if (_.options.rtl === true) {
6688                    if (targetSlide[0]) {
6689                        targetLeft = (_.$slideTrack.width() - targetSlide[0].offsetLeft - targetSlide.width()) * -1;
6690                    } else {
6691                        targetLeft =  0;
6692                    }
6693                } else {
6694                    targetLeft = targetSlide[0] ? targetSlide[0].offsetLeft * -1 : 0;
6695                }
6696
6697                targetLeft += (_.$list.width() - targetSlide.outerWidth()) / 2;
6698            }
6699        }
6700
6701        return targetLeft;
6702
6703    };
6704
6705    Slick.prototype.getOption = Slick.prototype.slickGetOption = function(option) {
6706
6707        var _ = this;
6708
6709        return _.options[option];
6710
6711    };
6712
6713    Slick.prototype.getNavigableIndexes = function() {
6714
6715        var _ = this,
6716            breakPoint = 0,
6717            counter = 0,
6718            indexes = [],
6719            max;
6720
6721        if (_.options.infinite === false) {
6722            max = _.slideCount;
6723        } else {
6724            breakPoint = _.options.slidesToScroll * -1;
6725            counter = _.options.slidesToScroll * -1;
6726            max = _.slideCount * 2;
6727        }
6728
6729        while (breakPoint < max) {
6730            indexes.push(breakPoint);
6731            breakPoint = counter + _.options.slidesToScroll;
6732            counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow;
6733        }
6734
6735        return indexes;
6736
6737    };
6738
6739    Slick.prototype.getSlick = function() {
6740
6741        return this;
6742
6743    };
6744
6745    Slick.prototype.getSlideCount = function() {
6746
6747        var _ = this,
6748            slidesTraversed, swipedSlide, centerOffset;
6749
6750        centerOffset = _.options.centerMode === true ? _.slideWidth * Math.floor(_.options.slidesToShow / 2) : 0;
6751
6752        if (_.options.swipeToSlide === true) {
6753            _.$slideTrack.find('.slick-slide').each(function(index, slide) {
6754                if (slide.offsetLeft - centerOffset + ($(slide).outerWidth() / 2) > (_.swipeLeft * -1)) {
6755                    swipedSlide = slide;
6756                    return false;
6757                }
6758            });
6759
6760            slidesTraversed = Math.abs($(swipedSlide).attr('data-slick-index') - _.currentSlide) || 1;
6761
6762            return slidesTraversed;
6763
6764        } else {
6765            return _.options.slidesToScroll;
6766        }
6767
6768    };
6769
6770    Slick.prototype.goTo = Slick.prototype.slickGoTo = function(slide, dontAnimate) {
6771
6772        var _ = this;
6773
6774        _.changeSlide({
6775            data: {
6776                message: 'index',
6777                index: parseInt(slide)
6778            }
6779        }, dontAnimate);
6780
6781    };
6782
6783    Slick.prototype.init = function(creation) {
6784
6785        var _ = this;
6786
6787        if (!$(_.$slider).hasClass('slick-initialized')) {
6788
6789            $(_.$slider).addClass('slick-initialized');
6790
6791            _.buildRows();
6792            _.buildOut();
6793            _.setProps();
6794            _.startLoad();
6795            _.loadSlider();
6796            _.initializeEvents();
6797            _.updateArrows();
6798            _.updateDots();
6799            _.checkResponsive(true);
6800            _.focusHandler();
6801
6802        }
6803
6804        if (creation) {
6805            _.$slider.trigger('init', [_]);
6806        }
6807
6808        if (_.options.accessibility === true) {
6809            _.initADA();
6810        }
6811
6812        if ( _.options.autoplay ) {
6813
6814            _.paused = false;
6815            _.autoPlay();
6816
6817        }
6818
6819    };
6820
6821    Slick.prototype.initADA = function() {
6822        var _ = this,
6823                numDotGroups = Math.ceil(_.slideCount / _.options.slidesToShow),
6824                tabControlIndexes = _.getNavigableIndexes().filter(function(val) {
6825                    return (val >= 0) && (val < _.slideCount);
6826                });
6827
6828        _.$slides.add(_.$slideTrack.find('.slick-cloned')).attr({
6829            'aria-hidden': 'true',
6830            'tabindex': '-1'
6831        }).find('a, input, button, select').attr({
6832            'tabindex': '-1'
6833        });
6834
6835        if (_.$dots !== null) {
6836            _.$slides.not(_.$slideTrack.find('.slick-cloned')).each(function(i) {
6837                var slideControlIndex = tabControlIndexes.indexOf(i);
6838
6839                $(this).attr({
6840                    'role': 'tabpanel',
6841                    'id': 'slick-slide' + _.instanceUid + i,
6842                    'tabindex': -1
6843                });
6844
6845                if (slideControlIndex !== -1) {
6846                    $(this).attr({
6847                        'aria-describedby': 'slick-slide-control' + _.instanceUid + slideControlIndex
6848                    });
6849                }
6850            });
6851
6852            _.$dots.attr('role', 'tablist').find('li').each(function(i) {
6853                var mappedSlideIndex = tabControlIndexes[i];
6854
6855                $(this).attr({
6856                    'role': 'presentation'
6857                });
6858
6859                $(this).find('button').first().attr({
6860                    'role': 'tab',
6861                    'id': 'slick-slide-control' + _.instanceUid + i,
6862                    'aria-controls': 'slick-slide' + _.instanceUid + mappedSlideIndex,
6863                    'aria-label': (i + 1) + ' of ' + numDotGroups,
6864                    'aria-selected': null,
6865                    'tabindex': '-1'
6866                });
6867
6868            }).eq(_.currentSlide).find('button').attr({
6869                'aria-selected': 'true',
6870                'tabindex': '0'
6871            }).end();
6872        }
6873
6874        for (var i=_.currentSlide, max=i+_.options.slidesToShow; i < max; i++) {
6875            _.$slides.eq(i).attr('tabindex', 0);
6876        }
6877
6878        _.activateADA();
6879
6880    };
6881
6882    Slick.prototype.initArrowEvents = function() {
6883
6884        var _ = this;
6885
6886        if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) {
6887            _.$prevArrow
6888               .off('click.slick')
6889               .on('click.slick', {
6890                    message: 'previous'
6891               }, _.changeSlide);
6892            _.$nextArrow
6893               .off('click.slick')
6894               .on('click.slick', {
6895                    message: 'next'
6896               }, _.changeSlide);
6897
6898            if (_.options.accessibility === true) {
6899                _.$prevArrow.on('keydown.slick', _.keyHandler);
6900                _.$nextArrow.on('keydown.slick', _.keyHandler);
6901            }
6902        }
6903
6904    };
6905
6906    Slick.prototype.initDotEvents = function() {
6907
6908        var _ = this;
6909
6910        if (_.options.dots === true) {
6911            $('li', _.$dots).on('click.slick', {
6912                message: 'index'
6913            }, _.changeSlide);
6914
6915            if (_.options.accessibility === true) {
6916                _.$dots.on('keydown.slick', _.keyHandler);
6917            }
6918        }
6919
6920        if ( _.options.dots === true && _.options.pauseOnDotsHover === true ) {
6921
6922            $('li', _.$dots)
6923                .on('mouseenter.slick', $.proxy(_.interrupt, _, true))
6924                .on('mouseleave.slick', $.proxy(_.interrupt, _, false));
6925
6926        }
6927
6928    };
6929
6930    Slick.prototype.initSlideEvents = function() {
6931
6932        var _ = this;
6933
6934        if ( _.options.pauseOnHover ) {
6935
6936            _.$list.on('mouseenter.slick', $.proxy(_.interrupt, _, true));
6937            _.$list.on('mouseleave.slick', $.proxy(_.interrupt, _, false));
6938
6939        }
6940
6941    };
6942
6943    Slick.prototype.initializeEvents = function() {
6944
6945        var _ = this;
6946
6947        _.initArrowEvents();
6948
6949        _.initDotEvents();
6950        _.initSlideEvents();
6951
6952        _.$list.on('touchstart.slick mousedown.slick', {
6953            action: 'start'
6954        }, _.swipeHandler);
6955        _.$list.on('touchmove.slick mousemove.slick', {
6956            action: 'move'
6957        }, _.swipeHandler);
6958        _.$list.on('touchend.slick mouseup.slick', {
6959            action: 'end'
6960        }, _.swipeHandler);
6961        _.$list.on('touchcancel.slick mouseleave.slick', {
6962            action: 'end'
6963        }, _.swipeHandler);
6964
6965        _.$list.on('click.slick', _.clickHandler);
6966
6967        $(document).on(_.visibilityChange, $.proxy(_.visibility, _));
6968
6969        if (_.options.accessibility === true) {
6970            _.$list.on('keydown.slick', _.keyHandler);
6971        }
6972
6973        if (_.options.focusOnSelect === true) {
6974            $(_.$slideTrack).children().on('click.slick', _.selectHandler);
6975        }
6976
6977        $(window).on('orientationchange.slick.slick-' + _.instanceUid, $.proxy(_.orientationChange, _));
6978
6979        $(window).on('resize.slick.slick-' + _.instanceUid, $.proxy(_.resize, _));
6980
6981        $('[draggable!=true]', _.$slideTrack).on('dragstart', _.preventDefault);
6982
6983        $(window).on('load.slick.slick-' + _.instanceUid, _.setPosition);
6984        $(_.setPosition);
6985
6986    };
6987
6988    Slick.prototype.initUI = function() {
6989
6990        var _ = this;
6991
6992        if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) {
6993
6994            _.$prevArrow.show();
6995            _.$nextArrow.show();
6996
6997        }
6998
6999        if (_.options.dots === true && _.slideCount > _.options.slidesToShow) {
7000
7001            _.$dots.show();
7002
7003        }
7004
7005    };
7006
7007    Slick.prototype.keyHandler = function(event) {
7008
7009        var _ = this;
7010         //Dont slide if the cursor is inside the form fields and arrow keys are pressed
7011        if(!event.target.tagName.match('TEXTAREA|INPUT|SELECT')) {
7012            if (event.keyCode === 37 && _.options.accessibility === true) {
7013                _.changeSlide({
7014                    data: {
7015                        message: _.options.rtl === true ? 'next' :  'previous'
7016                    }
7017                });
7018            } else if (event.keyCode === 39 && _.options.accessibility === true) {
7019                _.changeSlide({
7020                    data: {
7021                        message: _.options.rtl === true ? 'previous' : 'next'
7022                    }
7023                });
7024            }
7025        }
7026
7027    };
7028
7029    Slick.prototype.lazyLoad = function() {
7030
7031        var _ = this,
7032            loadRange, cloneRange, rangeStart, rangeEnd;
7033
7034        function loadImages(imagesScope) {
7035
7036            $('img[data-lazy]', imagesScope).each(function() {
7037
7038                var image = $(this),
7039                    imageSource = $(this).attr('data-lazy'),
7040                    imageSrcSet = $(this).attr('data-srcset'),
7041                    imageSizes  = $(this).attr('data-sizes') || _.$slider.attr('data-sizes'),
7042                    imageToLoad = document.createElement('img');
7043
7044                imageToLoad.onload = function() {
7045
7046                    image
7047                        .animate({ opacity: 0 }, 100, function() {
7048
7049                            if (imageSrcSet) {
7050                                image
7051                                    .attr('srcset', imageSrcSet );
7052
7053                                if (imageSizes) {
7054                                    image
7055                                        .attr('sizes', imageSizes );
7056                                }
7057                            }
7058
7059                            image
7060                                .attr('src', imageSource)
7061                                .animate({ opacity: 1 }, 200, function() {
7062                                    image
7063                                        .removeAttr('data-lazy data-srcset data-sizes')
7064                                        .removeClass('slick-loading');
7065                                });
7066                            _.$slider.trigger('lazyLoaded', [_, image, imageSource]);
7067                        });
7068
7069                };
7070
7071                imageToLoad.onerror = function() {
7072
7073                    image
7074                        .removeAttr( 'data-lazy' )
7075                        .removeClass( 'slick-loading' )
7076                        .addClass( 'slick-lazyload-error' );
7077
7078                    _.$slider.trigger('lazyLoadError', [ _, image, imageSource ]);
7079
7080                };
7081
7082                imageToLoad.src = imageSource;
7083
7084            });
7085
7086        }
7087
7088        if (_.options.centerMode === true) {
7089            if (_.options.infinite === true) {
7090                rangeStart = _.currentSlide + (_.options.slidesToShow / 2 + 1);
7091                rangeEnd = rangeStart + _.options.slidesToShow + 2;
7092            } else {
7093                rangeStart = Math.max(0, _.currentSlide - (_.options.slidesToShow / 2 + 1));
7094                rangeEnd = 2 + (_.options.slidesToShow / 2 + 1) + _.currentSlide;
7095            }
7096        } else {
7097            rangeStart = _.options.infinite ? _.options.slidesToShow + _.currentSlide : _.currentSlide;
7098            rangeEnd = Math.ceil(rangeStart + _.options.slidesToShow);
7099            if (_.options.fade === true) {
7100                if (rangeStart > 0) rangeStart--;
7101                if (rangeEnd <= _.slideCount) rangeEnd++;
7102            }
7103        }
7104
7105        loadRange = _.$slider.find('.slick-slide').slice(rangeStart, rangeEnd);
7106
7107        if (_.options.lazyLoad === 'anticipated') {
7108            var prevSlide = rangeStart - 1,
7109                nextSlide = rangeEnd,
7110                $slides = _.$slider.find('.slick-slide');
7111
7112            for (var i = 0; i < _.options.slidesToScroll; i++) {
7113                if (prevSlide < 0) prevSlide = _.slideCount - 1;
7114                loadRange = loadRange.add($slides.eq(prevSlide));
7115                loadRange = loadRange.add($slides.eq(nextSlide));
7116                prevSlide--;
7117                nextSlide++;
7118            }
7119        }
7120
7121        loadImages(loadRange);
7122
7123        if (_.slideCount <= _.options.slidesToShow) {
7124            cloneRange = _.$slider.find('.slick-slide');
7125            loadImages(cloneRange);
7126        } else
7127        if (_.currentSlide >= _.slideCount - _.options.slidesToShow) {
7128            cloneRange = _.$slider.find('.slick-cloned').slice(0, _.options.slidesToShow);
7129            loadImages(cloneRange);
7130        } else if (_.currentSlide === 0) {
7131            cloneRange = _.$slider.find('.slick-cloned').slice(_.options.slidesToShow * -1);
7132            loadImages(cloneRange);
7133        }
7134
7135    };
7136
7137    Slick.prototype.loadSlider = function() {
7138
7139        var _ = this;
7140
7141        _.setPosition();
7142
7143        _.$slideTrack.css({
7144            opacity: 1
7145        });
7146
7147        _.$slider.removeClass('slick-loading');
7148
7149        _.initUI();
7150
7151        if (_.options.lazyLoad === 'progressive') {
7152            _.progressiveLazyLoad();
7153        }
7154
7155    };
7156
7157    Slick.prototype.next = Slick.prototype.slickNext = function() {
7158
7159        var _ = this;
7160
7161        _.changeSlide({
7162            data: {
7163                message: 'next'
7164            }
7165        });
7166
7167    };
7168
7169    Slick.prototype.orientationChange = function() {
7170
7171        var _ = this;
7172
7173        _.checkResponsive();
7174        _.setPosition();
7175
7176    };
7177
7178    Slick.prototype.pause = Slick.prototype.slickPause = function() {
7179
7180        var _ = this;
7181
7182        _.autoPlayClear();
7183        _.paused = true;
7184
7185    };
7186
7187    Slick.prototype.play = Slick.prototype.slickPlay = function() {
7188
7189        var _ = this;
7190
7191        _.autoPlay();
7192        _.options.autoplay = true;
7193        _.paused = false;
7194        _.focussed = false;
7195        _.interrupted = false;
7196
7197    };
7198
7199    Slick.prototype.postSlide = function(index) {
7200
7201        var _ = this;
7202
7203        if( !_.unslicked ) {
7204
7205            _.$slider.trigger('afterChange', [_, index]);
7206
7207            _.animating = false;
7208
7209            if (_.slideCount > _.options.slidesToShow) {
7210                _.setPosition();
7211            }
7212
7213            _.swipeLeft = null;
7214
7215            if ( _.options.autoplay ) {
7216                _.autoPlay();
7217            }
7218
7219            if (_.options.accessibility === true) {
7220                _.initADA();
7221                
7222                if (_.options.focusOnChange) {
7223                    var $currentSlide = $(_.$slides.get(_.currentSlide));
7224                    $currentSlide.attr('tabindex', 0).focus();
7225                }
7226            }
7227
7228        }
7229
7230    };
7231
7232    Slick.prototype.prev = Slick.prototype.slickPrev = function() {
7233
7234        var _ = this;
7235
7236        _.changeSlide({
7237            data: {
7238                message: 'previous'
7239            }
7240        });
7241
7242    };
7243
7244    Slick.prototype.preventDefault = function(event) {
7245
7246        event.preventDefault();
7247
7248    };
7249
7250    Slick.prototype.progressiveLazyLoad = function( tryCount ) {
7251
7252        tryCount = tryCount || 1;
7253
7254        var _ = this,
7255            $imgsToLoad = $( 'img[data-lazy]', _.$slider ),
7256            image,
7257            imageSource,
7258            imageSrcSet,
7259            imageSizes,
7260            imageToLoad;
7261
7262        if ( $imgsToLoad.length ) {
7263
7264            image = $imgsToLoad.first();
7265            imageSource = image.attr('data-lazy');
7266            imageSrcSet = image.attr('data-srcset');
7267            imageSizes  = image.attr('data-sizes') || _.$slider.attr('data-sizes');
7268            imageToLoad = document.createElement('img');
7269
7270            imageToLoad.onload = function() {
7271
7272                if (imageSrcSet) {
7273                    image
7274                        .attr('srcset', imageSrcSet );
7275
7276                    if (imageSizes) {
7277                        image
7278                            .attr('sizes', imageSizes );
7279                    }
7280                }
7281
7282                image
7283                    .attr( 'src', imageSource )
7284                    .removeAttr('data-lazy data-srcset data-sizes')
7285                    .removeClass('slick-loading');
7286
7287                if ( _.options.adaptiveHeight === true ) {
7288                    _.setPosition();
7289                }
7290
7291                _.$slider.trigger('lazyLoaded', [ _, image, imageSource ]);
7292                _.progressiveLazyLoad();
7293
7294            };
7295
7296            imageToLoad.onerror = function() {
7297
7298                if ( tryCount < 3 ) {
7299
7300                    /**
7301                     * try to load the image 3 times,
7302                     * leave a slight delay so we don't get
7303                     * servers blocking the request.
7304                     */
7305                    setTimeout( function() {
7306                        _.progressiveLazyLoad( tryCount + 1 );
7307                    }, 500 );
7308
7309                } else {
7310
7311                    image
7312                        .removeAttr( 'data-lazy' )
7313                        .removeClass( 'slick-loading' )
7314                        .addClass( 'slick-lazyload-error' );
7315
7316                    _.$slider.trigger('lazyLoadError', [ _, image, imageSource ]);
7317
7318                    _.progressiveLazyLoad();
7319
7320                }
7321
7322            };
7323
7324            imageToLoad.src = imageSource;
7325
7326        } else {
7327
7328            _.$slider.trigger('allImagesLoaded', [ _ ]);
7329
7330        }
7331
7332    };
7333
7334    Slick.prototype.refresh = function( initializing ) {
7335
7336        var _ = this, currentSlide, lastVisibleIndex;
7337
7338        lastVisibleIndex = _.slideCount - _.options.slidesToShow;
7339
7340        // in non-infinite sliders, we don't want to go past the
7341        // last visible index.
7342        if( !_.options.infinite && ( _.currentSlide > lastVisibleIndex )) {
7343            _.currentSlide = lastVisibleIndex;
7344        }
7345
7346        // if less slides than to show, go to start.
7347        if ( _.slideCount <= _.options.slidesToShow ) {
7348            _.currentSlide = 0;
7349
7350        }
7351
7352        currentSlide = _.currentSlide;
7353
7354        _.destroy(true);
7355
7356        $.extend(_, _.initials, { currentSlide: currentSlide });
7357
7358        _.init();
7359
7360        if( !initializing ) {
7361
7362            _.changeSlide({
7363                data: {
7364                    message: 'index',
7365                    index: currentSlide
7366                }
7367            }, false);
7368
7369        }
7370
7371    };
7372
7373    Slick.prototype.registerBreakpoints = function() {
7374
7375        var _ = this, breakpoint, currentBreakpoint, l,
7376            responsiveSettings = _.options.responsive || null;
7377
7378        if ( $.type(responsiveSettings) === 'array' && responsiveSettings.length ) {
7379
7380            _.respondTo = _.options.respondTo || 'window';
7381
7382            for ( breakpoint in responsiveSettings ) {
7383
7384                l = _.breakpoints.length-1;
7385
7386                if (responsiveSettings.hasOwnProperty(breakpoint)) {
7387                    currentBreakpoint = responsiveSettings[breakpoint].breakpoint;
7388
7389                    // loop through the breakpoints and cut out any existing
7390                    // ones with the same breakpoint number, we don't want dupes.
7391                    while( l >= 0 ) {
7392                        if( _.breakpoints[l] && _.breakpoints[l] === currentBreakpoint ) {
7393                            _.breakpoints.splice(l,1);
7394                        }
7395                        l--;
7396                    }
7397
7398                    _.breakpoints.push(currentBreakpoint);
7399                    _.breakpointSettings[currentBreakpoint] = responsiveSettings[breakpoint].settings;
7400
7401                }
7402
7403            }
7404
7405            _.breakpoints.sort(function(a, b) {
7406                return ( _.options.mobileFirst ) ? a-b : b-a;
7407            });
7408
7409        }
7410
7411    };
7412
7413    Slick.prototype.reinit = function() {
7414
7415        var _ = this;
7416
7417        _.$slides =
7418            _.$slideTrack
7419                .children(_.options.slide)
7420                .addClass('slick-slide');
7421
7422        _.slideCount = _.$slides.length;
7423
7424        if (_.currentSlide >= _.slideCount && _.currentSlide !== 0) {
7425            _.currentSlide = _.currentSlide - _.options.slidesToScroll;
7426        }
7427
7428        if (_.slideCount <= _.options.slidesToShow) {
7429            _.currentSlide = 0;
7430        }
7431
7432        _.registerBreakpoints();
7433
7434        _.setProps();
7435        _.setupInfinite();
7436        _.buildArrows();
7437        _.updateArrows();
7438        _.initArrowEvents();
7439        _.buildDots();
7440        _.updateDots();
7441        _.initDotEvents();
7442        _.cleanUpSlideEvents();
7443        _.initSlideEvents();
7444
7445        _.checkResponsive(false, true);
7446
7447        if (_.options.focusOnSelect === true) {
7448            $(_.$slideTrack).children().on('click.slick', _.selectHandler);
7449        }
7450
7451        _.setSlideClasses(typeof _.currentSlide === 'number' ? _.currentSlide : 0);
7452
7453        _.setPosition();
7454        _.focusHandler();
7455
7456        _.paused = !_.options.autoplay;
7457        _.autoPlay();
7458
7459        _.$slider.trigger('reInit', [_]);
7460
7461    };
7462
7463    Slick.prototype.resize = function() {
7464
7465        var _ = this;
7466
7467        if ($(window).width() !== _.windowWidth) {
7468            clearTimeout(_.windowDelay);
7469            _.windowDelay = window.setTimeout(function() {
7470                _.windowWidth = $(window).width();
7471                _.checkResponsive();
7472                if( !_.unslicked ) { _.setPosition(); }
7473            }, 50);
7474        }
7475    };
7476
7477    Slick.prototype.removeSlide = Slick.prototype.slickRemove = function(index, removeBefore, removeAll) {
7478
7479        var _ = this;
7480
7481        if (typeof(index) === 'boolean') {
7482            removeBefore = index;
7483            index = removeBefore === true ? 0 : _.slideCount - 1;
7484        } else {
7485            index = removeBefore === true ? --index : index;
7486        }
7487
7488        if (_.slideCount < 1 || index < 0 || index > _.slideCount - 1) {
7489            return false;
7490        }
7491
7492        _.unload();
7493
7494        if (removeAll === true) {
7495            _.$slideTrack.children().remove();
7496        } else {
7497            _.$slideTrack.children(this.options.slide).eq(index).remove();
7498        }
7499
7500        _.$slides = _.$slideTrack.children(this.options.slide);
7501
7502        _.$slideTrack.children(this.options.slide).detach();
7503
7504        _.$slideTrack.append(_.$slides);
7505
7506        _.$slidesCache = _.$slides;
7507
7508        _.reinit();
7509
7510    };
7511
7512    Slick.prototype.setCSS = function(position) {
7513
7514        var _ = this,
7515            positionProps = {},
7516            x, y;
7517
7518        if (_.options.rtl === true) {
7519            position = -position;
7520        }
7521        x = _.positionProp == 'left' ? Math.ceil(position) + 'px' : '0px';
7522        y = _.positionProp == 'top' ? Math.ceil(position) + 'px' : '0px';
7523
7524        positionProps[_.positionProp] = position;
7525
7526        if (_.transformsEnabled === false) {
7527            _.$slideTrack.css(positionProps);
7528        } else {
7529            positionProps = {};
7530            if (_.cssTransitions === false) {
7531                positionProps[_.animType] = 'translate(' + x + ', ' + y + ')';
7532                _.$slideTrack.css(positionProps);
7533            } else {
7534                positionProps[_.animType] = 'translate3d(' + x + ', ' + y + ', 0px)';
7535                _.$slideTrack.css(positionProps);
7536            }
7537        }
7538
7539    };
7540
7541    Slick.prototype.setDimensions = function() {
7542
7543        var _ = this;
7544
7545        if (_.options.vertical === false) {
7546            if (_.options.centerMode === true) {
7547                _.$list.css({
7548                    padding: ('0px ' + _.options.centerPadding)
7549                });
7550            }
7551        } else {
7552            _.$list.height(_.$slides.first().outerHeight(true) * _.options.slidesToShow);
7553            if (_.options.centerMode === true) {
7554                _.$list.css({
7555                    padding: (_.options.centerPadding + ' 0px')
7556                });
7557            }
7558        }
7559
7560        _.listWidth = _.$list.width();
7561        _.listHeight = _.$list.height();
7562
7563
7564        if (_.options.vertical === false && _.options.variableWidth === false) {
7565            _.slideWidth = Math.ceil(_.listWidth / _.options.slidesToShow);
7566            _.$slideTrack.width(Math.ceil((_.slideWidth * _.$slideTrack.children('.slick-slide').length)));
7567
7568        } else if (_.options.variableWidth === true) {
7569            _.$slideTrack.width(5000 * _.slideCount);
7570        } else {
7571            _.slideWidth = Math.ceil(_.listWidth);
7572            _.$slideTrack.height(Math.ceil((_.$slides.first().outerHeight(true) * _.$slideTrack.children('.slick-slide').length)));
7573        }
7574
7575        var offset = _.$slides.first().outerWidth(true) - _.$slides.first().width();
7576        if (_.options.variableWidth === false) _.$slideTrack.children('.slick-slide').width(_.slideWidth - offset);
7577
7578    };
7579
7580    Slick.prototype.setFade = function() {
7581
7582        var _ = this,
7583            targetLeft;
7584
7585        _.$slides.each(function(index, element) {
7586            targetLeft = (_.slideWidth * index) * -1;
7587            if (_.options.rtl === true) {
7588                $(element).css({
7589                    position: 'relative',
7590                    right: targetLeft,
7591                    top: 0,
7592                    zIndex: _.options.zIndex - 2,
7593                    opacity: 0
7594                });
7595            } else {
7596                $(element).css({
7597                    position: 'relative',
7598                    left: targetLeft,
7599                    top: 0,
7600                    zIndex: _.options.zIndex - 2,
7601                    opacity: 0
7602                });
7603            }
7604        });
7605
7606        _.$slides.eq(_.currentSlide).css({
7607            zIndex: _.options.zIndex - 1,
7608            opacity: 1
7609        });
7610
7611    };
7612
7613    Slick.prototype.setHeight = function() {
7614
7615        var _ = this;
7616
7617        if (_.options.slidesToShow === 1 && _.options.adaptiveHeight === true && _.options.vertical === false) {
7618            var targetHeight = _.$slides.eq(_.currentSlide).outerHeight(true);
7619            _.$list.css('height', targetHeight);
7620        }
7621
7622    };
7623
7624    Slick.prototype.setOption =
7625    Slick.prototype.slickSetOption = function() {
7626
7627        /**
7628         * accepts arguments in format of:
7629         *
7630         *  - for changing a single option's value:
7631         *     .slick("setOption", option, value, refresh )
7632         *
7633         *  - for changing a set of responsive options:
7634         *     .slick("setOption", 'responsive', [{}, ...], refresh )
7635         *
7636         *  - for updating multiple values at once (not responsive)
7637         *     .slick("setOption", { 'option': value, ... }, refresh )
7638         */
7639
7640        var _ = this, l, item, option, value, refresh = false, type;
7641
7642        if( $.type( arguments[0] ) === 'object' ) {
7643
7644            option =  arguments[0];
7645            refresh = arguments[1];
7646            type = 'multiple';
7647
7648        } else if ( $.type( arguments[0] ) === 'string' ) {
7649
7650            option =  arguments[0];
7651            value = arguments[1];
7652            refresh = arguments[2];
7653
7654            if ( arguments[0] === 'responsive' && $.type( arguments[1] ) === 'array' ) {
7655
7656                type = 'responsive';
7657
7658            } else if ( typeof arguments[1] !== 'undefined' ) {
7659
7660                type = 'single';
7661
7662            }
7663
7664        }
7665
7666        if ( type === 'single' ) {
7667
7668            _.options[option] = value;
7669
7670
7671        } else if ( type === 'multiple' ) {
7672
7673            $.each( option , function( opt, val ) {
7674
7675                _.options[opt] = val;
7676
7677            });
7678
7679
7680        } else if ( type === 'responsive' ) {
7681
7682            for ( item in value ) {
7683
7684                if( $.type( _.options.responsive ) !== 'array' ) {
7685
7686                    _.options.responsive = [ value[item] ];
7687
7688                } else {
7689
7690                    l = _.options.responsive.length-1;
7691
7692                    // loop through the responsive object and splice out duplicates.
7693                    while( l >= 0 ) {
7694
7695                        if( _.options.responsive[l].breakpoint === value[item].breakpoint ) {
7696
7697                            _.options.responsive.splice(l,1);
7698
7699                        }
7700
7701                        l--;
7702
7703                    }
7704
7705                    _.options.responsive.push( value[item] );
7706
7707                }
7708
7709            }
7710
7711        }
7712
7713        if ( refresh ) {
7714
7715            _.unload();
7716            _.reinit();
7717
7718        }
7719
7720    };
7721
7722    Slick.prototype.setPosition = function() {
7723
7724        var _ = this;
7725
7726        _.setDimensions();
7727
7728        _.setHeight();
7729
7730        if (_.options.fade === false) {
7731            _.setCSS(_.getLeft(_.currentSlide));
7732        } else {
7733            _.setFade();
7734        }
7735
7736        _.$slider.trigger('setPosition', [_]);
7737
7738    };
7739
7740    Slick.prototype.setProps = function() {
7741
7742        var _ = this,
7743            bodyStyle = document.body.style;
7744
7745        _.positionProp = _.options.vertical === true ? 'top' : 'left';
7746
7747        if (_.positionProp === 'top') {
7748            _.$slider.addClass('slick-vertical');
7749        } else {
7750            _.$slider.removeClass('slick-vertical');
7751        }
7752
7753        if (bodyStyle.WebkitTransition !== undefined ||
7754            bodyStyle.MozTransition !== undefined ||
7755            bodyStyle.msTransition !== undefined) {
7756            if (_.options.useCSS === true) {
7757                _.cssTransitions = true;
7758            }
7759        }
7760
7761        if ( _.options.fade ) {
7762            if ( typeof _.options.zIndex === 'number' ) {
7763                if( _.options.zIndex < 3 ) {
7764                    _.options.zIndex = 3;
7765                }
7766            } else {
7767                _.options.zIndex = _.defaults.zIndex;
7768            }
7769        }
7770
7771        if (bodyStyle.OTransform !== undefined) {
7772            _.animType = 'OTransform';
7773            _.transformType = '-o-transform';
7774            _.transitionType = 'OTransition';
7775            if (bodyStyle.perspectiveProperty === undefined && bodyStyle.webkitPerspective === undefined) _.animType = false;
7776        }
7777        if (bodyStyle.MozTransform !== undefined) {
7778            _.animType = 'MozTransform';
7779            _.transformType = '-moz-transform';
7780            _.transitionType = 'MozTransition';
7781            if (bodyStyle.perspectiveProperty === undefined && bodyStyle.MozPerspective === undefined) _.animType = false;
7782        }
7783        if (bodyStyle.webkitTransform !== undefined) {
7784            _.animType = 'webkitTransform';
7785            _.transformType = '-webkit-transform';
7786            _.transitionType = 'webkitTransition';
7787            if (bodyStyle.perspectiveProperty === undefined && bodyStyle.webkitPerspective === undefined) _.animType = false;
7788        }
7789        if (bodyStyle.msTransform !== undefined) {
7790            _.animType = 'msTransform';
7791            _.transformType = '-ms-transform';
7792            _.transitionType = 'msTransition';
7793            if (bodyStyle.msTransform === undefined) _.animType = false;
7794        }
7795        if (bodyStyle.transform !== undefined && _.animType !== false) {
7796            _.animType = 'transform';
7797            _.transformType = 'transform';
7798            _.transitionType = 'transition';
7799        }
7800        _.transformsEnabled = _.options.useTransform && (_.animType !== null && _.animType !== false);
7801    };
7802
7803
7804    Slick.prototype.setSlideClasses = function(index) {
7805
7806        var _ = this,
7807            centerOffset, allSlides, indexOffset, remainder;
7808
7809        allSlides = _.$slider
7810            .find('.slick-slide')
7811            .removeClass('slick-active slick-center slick-current')
7812            .attr('aria-hidden', 'true');
7813
7814        _.$slides
7815            .eq(index)
7816            .addClass('slick-current');
7817
7818        if (_.options.centerMode === true) {
7819
7820            var evenCoef = _.options.slidesToShow % 2 === 0 ? 1 : 0;
7821
7822            centerOffset = Math.floor(_.options.slidesToShow / 2);
7823
7824            if (_.options.infinite === true) {
7825
7826                if (index >= centerOffset && index <= (_.slideCount - 1) - centerOffset) {
7827                    _.$slides
7828                        .slice(index - centerOffset + evenCoef, index + centerOffset + 1)
7829                        .addClass('slick-active')
7830                        .attr('aria-hidden', 'false');
7831
7832                } else {
7833
7834                    indexOffset = _.options.slidesToShow + index;
7835                    allSlides
7836                        .slice(indexOffset - centerOffset + 1 + evenCoef, indexOffset + centerOffset + 2)
7837                        .addClass('slick-active')
7838                        .attr('aria-hidden', 'false');
7839
7840                }
7841
7842                if (index === 0) {
7843
7844                    allSlides
7845                        .eq(allSlides.length - 1 - _.options.slidesToShow)
7846                        .addClass('slick-center');
7847
7848                } else if (index === _.slideCount - 1) {
7849
7850                    allSlides
7851                        .eq(_.options.slidesToShow)
7852                        .addClass('slick-center');
7853
7854                }
7855
7856            }
7857
7858            _.$slides
7859                .eq(index)
7860                .addClass('slick-center');
7861
7862        } else {
7863
7864            if (index >= 0 && index <= (_.slideCount - _.options.slidesToShow)) {
7865
7866                _.$slides
7867                    .slice(index, index + _.options.slidesToShow)
7868                    .addClass('slick-active')
7869                    .attr('aria-hidden', 'false');
7870
7871            } else if (allSlides.length <= _.options.slidesToShow) {
7872
7873                allSlides
7874                    .addClass('slick-active')
7875                    .attr('aria-hidden', 'false');
7876
7877            } else {
7878
7879                remainder = _.slideCount % _.options.slidesToShow;
7880                indexOffset = _.options.infinite === true ? _.options.slidesToShow + index : index;
7881
7882                if (_.options.slidesToShow == _.options.slidesToScroll && (_.slideCount - index) < _.options.slidesToShow) {
7883
7884                    allSlides
7885                        .slice(indexOffset - (_.options.slidesToShow - remainder), indexOffset + remainder)
7886                        .addClass('slick-active')
7887                        .attr('aria-hidden', 'false');
7888
7889                } else {
7890
7891                    allSlides
7892                        .slice(indexOffset, indexOffset + _.options.slidesToShow)
7893                        .addClass('slick-active')
7894                        .attr('aria-hidden', 'false');
7895
7896                }
7897
7898            }
7899
7900        }
7901
7902        if (_.options.lazyLoad === 'ondemand' || _.options.lazyLoad === 'anticipated') {
7903            _.lazyLoad();
7904        }
7905    };
7906
7907    Slick.prototype.setupInfinite = function() {
7908
7909        var _ = this,
7910            i, slideIndex, infiniteCount;
7911
7912        if (_.options.fade === true) {
7913            _.options.centerMode = false;
7914        }
7915
7916        if (_.options.infinite === true && _.options.fade === false) {
7917
7918            slideIndex = null;
7919
7920            if (_.slideCount > _.options.slidesToShow) {
7921
7922                if (_.options.centerMode === true) {
7923                    infiniteCount = _.options.slidesToShow + 1;
7924                } else {
7925                    infiniteCount = _.options.slidesToShow;
7926                }
7927
7928                for (i = _.slideCount; i > (_.slideCount -
7929                        infiniteCount); i -= 1) {
7930                    slideIndex = i - 1;
7931                    $(_.$slides[slideIndex]).clone(true).attr('id', '')
7932                        .attr('data-slick-index', slideIndex - _.slideCount)
7933                        .prependTo(_.$slideTrack).addClass('slick-cloned');
7934                }
7935                for (i = 0; i < infiniteCount  + _.slideCount; i += 1) {
7936                    slideIndex = i;
7937                    $(_.$slides[slideIndex]).clone(true).attr('id', '')
7938                        .attr('data-slick-index', slideIndex + _.slideCount)
7939                        .appendTo(_.$slideTrack).addClass('slick-cloned');
7940                }
7941                _.$slideTrack.find('.slick-cloned').find('[id]').each(function() {
7942                    $(this).attr('id', '');
7943                });
7944
7945            }
7946
7947        }
7948
7949    };
7950
7951    Slick.prototype.interrupt = function( toggle ) {
7952
7953        var _ = this;
7954
7955        if( !toggle ) {
7956            _.autoPlay();
7957        }
7958        _.interrupted = toggle;
7959
7960    };
7961
7962    Slick.prototype.selectHandler = function(event) {
7963
7964        var _ = this;
7965
7966        var targetElement =
7967            $(event.target).is('.slick-slide') ?
7968                $(event.target) :
7969                $(event.target).parents('.slick-slide');
7970
7971        var index = parseInt(targetElement.attr('data-slick-index'));
7972
7973        if (!index) index = 0;
7974
7975        if (_.slideCount <= _.options.slidesToShow) {
7976
7977            _.slideHandler(index, false, true);
7978            return;
7979
7980        }
7981
7982        _.slideHandler(index);
7983
7984    };
7985
7986    Slick.prototype.slideHandler = function(index, sync, dontAnimate) {
7987
7988        var targetSlide, animSlide, oldSlide, slideLeft, targetLeft = null,
7989            _ = this, navTarget;
7990
7991        sync = sync || false;
7992
7993        if (_.animating === true && _.options.waitForAnimate === true) {
7994            return;
7995        }
7996
7997        if (_.options.fade === true && _.currentSlide === index) {
7998            return;
7999        }
8000
8001        if (sync === false) {
8002            _.asNavFor(index);
8003        }
8004
8005        targetSlide = index;
8006        targetLeft = _.getLeft(targetSlide);
8007        slideLeft = _.getLeft(_.currentSlide);
8008
8009        _.currentLeft = _.swipeLeft === null ? slideLeft : _.swipeLeft;
8010
8011        if (_.options.infinite === false && _.options.centerMode === false && (index < 0 || index > _.getDotCount() * _.options.slidesToScroll)) {
8012            if (_.options.fade === false) {
8013                targetSlide = _.currentSlide;
8014                if (dontAnimate !== true) {
8015                    _.animateSlide(slideLeft, function() {
8016                        _.postSlide(targetSlide);
8017                    });
8018                } else {
8019                    _.postSlide(targetSlide);
8020                }
8021            }
8022            return;
8023        } else if (_.options.infinite === false && _.options.centerMode === true && (index < 0 || index > (_.slideCount - _.options.slidesToScroll))) {
8024            if (_.options.fade === false) {
8025                targetSlide = _.currentSlide;
8026                if (dontAnimate !== true) {
8027                    _.animateSlide(slideLeft, function() {
8028                        _.postSlide(targetSlide);
8029                    });
8030                } else {
8031                    _.postSlide(targetSlide);
8032                }
8033            }
8034            return;
8035        }
8036
8037        if ( _.options.autoplay ) {
8038            clearInterval(_.autoPlayTimer);
8039        }
8040
8041        if (targetSlide < 0) {
8042            if (_.slideCount % _.options.slidesToScroll !== 0) {
8043                animSlide = _.slideCount - (_.slideCount % _.options.slidesToScroll);
8044            } else {
8045                animSlide = _.slideCount + targetSlide;
8046            }
8047        } else if (targetSlide >= _.slideCount) {
8048            if (_.slideCount % _.options.slidesToScroll !== 0) {
8049                animSlide = 0;
8050            } else {
8051                animSlide = targetSlide - _.slideCount;
8052            }
8053        } else {
8054            animSlide = targetSlide;
8055        }
8056
8057        _.animating = true;
8058
8059        _.$slider.trigger('beforeChange', [_, _.currentSlide, animSlide]);
8060
8061        oldSlide = _.currentSlide;
8062        _.currentSlide = animSlide;
8063
8064        _.setSlideClasses(_.currentSlide);
8065
8066        if ( _.options.asNavFor ) {
8067
8068            navTarget = _.getNavTarget();
8069            navTarget = navTarget.slick('getSlick');
8070
8071            if ( navTarget.slideCount <= navTarget.options.slidesToShow ) {
8072                navTarget.setSlideClasses(_.currentSlide);
8073            }
8074
8075        }
8076
8077        _.updateDots();
8078        _.updateArrows();
8079
8080        if (_.options.fade === true) {
8081            if (dontAnimate !== true) {
8082
8083                _.fadeSlideOut(oldSlide);
8084
8085                _.fadeSlide(animSlide, function() {
8086                    _.postSlide(animSlide);
8087                });
8088
8089            } else {
8090                _.postSlide(animSlide);
8091            }
8092            _.animateHeight();
8093            return;
8094        }
8095
8096        if (dontAnimate !== true) {
8097            _.animateSlide(targetLeft, function() {
8098                _.postSlide(animSlide);
8099            });
8100        } else {
8101            _.postSlide(animSlide);
8102        }
8103
8104    };
8105
8106    Slick.prototype.startLoad = function() {
8107
8108        var _ = this;
8109
8110        if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) {
8111
8112            _.$prevArrow.hide();
8113            _.$nextArrow.hide();
8114
8115        }
8116
8117        if (_.options.dots === true && _.slideCount > _.options.slidesToShow) {
8118
8119            _.$dots.hide();
8120
8121        }
8122
8123        _.$slider.addClass('slick-loading');
8124
8125    };
8126
8127    Slick.prototype.swipeDirection = function() {
8128
8129        var xDist, yDist, r, swipeAngle, _ = this;
8130
8131        xDist = _.touchObject.startX - _.touchObject.curX;
8132        yDist = _.touchObject.startY - _.touchObject.curY;
8133        r = Math.atan2(yDist, xDist);
8134
8135        swipeAngle = Math.round(r * 180 / Math.PI);
8136        if (swipeAngle < 0) {
8137            swipeAngle = 360 - Math.abs(swipeAngle);
8138        }
8139
8140        if ((swipeAngle <= 45) && (swipeAngle >= 0)) {
8141            return (_.options.rtl === false ? 'left' : 'right');
8142        }
8143        if ((swipeAngle <= 360) && (swipeAngle >= 315)) {
8144            return (_.options.rtl === false ? 'left' : 'right');
8145        }
8146        if ((swipeAngle >= 135) && (swipeAngle <= 225)) {
8147            return (_.options.rtl === false ? 'right' : 'left');
8148        }
8149        if (_.options.verticalSwiping === true) {
8150            if ((swipeAngle >= 35) && (swipeAngle <= 135)) {
8151                return 'down';
8152            } else {
8153                return 'up';
8154            }
8155        }
8156
8157        return 'vertical';
8158
8159    };
8160
8161    Slick.prototype.swipeEnd = function(event) {
8162
8163        var _ = this,
8164            slideCount,
8165            direction;
8166
8167        _.dragging = false;
8168        _.swiping = false;
8169
8170        if (_.scrolling) {
8171            _.scrolling = false;
8172            return false;
8173        }
8174
8175        _.interrupted = false;
8176        _.shouldClick = ( _.touchObject.swipeLength > 10 ) ? false : true;
8177
8178        if ( _.touchObject.curX === undefined ) {
8179            return false;
8180        }
8181
8182        if ( _.touchObject.edgeHit === true ) {
8183            _.$slider.trigger('edge', [_, _.swipeDirection() ]);
8184        }
8185
8186        if ( _.touchObject.swipeLength >= _.touchObject.minSwipe ) {
8187
8188            direction = _.swipeDirection();
8189
8190            switch ( direction ) {
8191
8192                case 'left':
8193                case 'down':
8194
8195                    slideCount =
8196                        _.options.swipeToSlide ?
8197                            _.checkNavigable( _.currentSlide + _.getSlideCount() ) :
8198                            _.currentSlide + _.getSlideCount();
8199
8200                    _.currentDirection = 0;
8201
8202                    break;
8203
8204                case 'right':
8205                case 'up':
8206
8207                    slideCount =
8208                        _.options.swipeToSlide ?
8209                            _.checkNavigable( _.currentSlide - _.getSlideCount() ) :
8210                            _.currentSlide - _.getSlideCount();
8211
8212                    _.currentDirection = 1;
8213
8214                    break;
8215
8216                default:
8217
8218
8219            }
8220
8221            if( direction != 'vertical' ) {
8222
8223                _.slideHandler( slideCount );
8224                _.touchObject = {};
8225                _.$slider.trigger('swipe', [_, direction ]);
8226
8227            }
8228
8229        } else {
8230
8231            if ( _.touchObject.startX !== _.touchObject.curX ) {
8232
8233                _.slideHandler( _.currentSlide );
8234                _.touchObject = {};
8235
8236            }
8237
8238        }
8239
8240    };
8241
8242    Slick.prototype.swipeHandler = function(event) {
8243
8244        var _ = this;
8245
8246        if ((_.options.swipe === false) || ('ontouchend' in document && _.options.swipe === false)) {
8247            return;
8248        } else if (_.options.draggable === false && event.type.indexOf('mouse') !== -1) {
8249            return;
8250        }
8251
8252        _.touchObject.fingerCount = event.originalEvent && event.originalEvent.touches !== undefined ?
8253            event.originalEvent.touches.length : 1;
8254
8255        _.touchObject.minSwipe = _.listWidth / _.options
8256            .touchThreshold;
8257
8258        if (_.options.verticalSwiping === true) {
8259            _.touchObject.minSwipe = _.listHeight / _.options
8260                .touchThreshold;
8261        }
8262
8263        switch (event.data.action) {
8264
8265            case 'start':
8266                _.swipeStart(event);
8267                break;
8268
8269            case 'move':
8270                _.swipeMove(event);
8271                break;
8272
8273            case 'end':
8274                _.swipeEnd(event);
8275                break;
8276
8277        }
8278
8279    };
8280
8281    Slick.prototype.swipeMove = function(event) {
8282
8283        var _ = this,
8284            edgeWasHit = false,
8285            curLeft, swipeDirection, swipeLength, positionOffset, touches, verticalSwipeLength;
8286
8287        touches = event.originalEvent !== undefined ? event.originalEvent.touches : null;
8288
8289        if (!_.dragging || _.scrolling || touches && touches.length !== 1) {
8290            return false;
8291        }
8292
8293        curLeft = _.getLeft(_.currentSlide);
8294
8295        _.touchObject.curX = touches !== undefined ? touches[0].pageX : event.clientX;
8296        _.touchObject.curY = touches !== undefined ? touches[0].pageY : event.clientY;
8297
8298        _.touchObject.swipeLength = Math.round(Math.sqrt(
8299            Math.pow(_.touchObject.curX - _.touchObject.startX, 2)));
8300
8301        verticalSwipeLength = Math.round(Math.sqrt(
8302            Math.pow(_.touchObject.curY - _.touchObject.startY, 2)));
8303
8304        if (!_.options.verticalSwiping && !_.swiping && verticalSwipeLength > 4) {
8305            _.scrolling = true;
8306            return false;
8307        }
8308
8309        if (_.options.verticalSwiping === true) {
8310            _.touchObject.swipeLength = verticalSwipeLength;
8311        }
8312
8313        swipeDirection = _.swipeDirection();
8314
8315        if (event.originalEvent !== undefined && _.touchObject.swipeLength > 4) {
8316            _.swiping = true;
8317            event.preventDefault();
8318        }
8319
8320        positionOffset = (_.options.rtl === false ? 1 : -1) * (_.touchObject.curX > _.touchObject.startX ? 1 : -1);
8321        if (_.options.verticalSwiping === true) {
8322            positionOffset = _.touchObject.curY > _.touchObject.startY ? 1 : -1;
8323        }
8324
8325
8326        swipeLength = _.touchObject.swipeLength;
8327
8328        _.touchObject.edgeHit = false;
8329
8330        if (_.options.infinite === false) {
8331            if ((_.currentSlide === 0 && swipeDirection === 'right') || (_.currentSlide >= _.getDotCount() && swipeDirection === 'left')) {
8332                swipeLength = _.touchObject.swipeLength * _.options.edgeFriction;
8333                _.touchObject.edgeHit = true;
8334            }
8335        }
8336
8337        if (_.options.vertical === false) {
8338            _.swipeLeft = curLeft + swipeLength * positionOffset;
8339        } else {
8340            _.swipeLeft = curLeft + (swipeLength * (_.$list.height() / _.listWidth)) * positionOffset;
8341        }
8342        if (_.options.verticalSwiping === true) {
8343            _.swipeLeft = curLeft + swipeLength * positionOffset;
8344        }
8345
8346        if (_.options.fade === true || _.options.touchMove === false) {
8347            return false;
8348        }
8349
8350        if (_.animating === true) {
8351            _.swipeLeft = null;
8352            return false;
8353        }
8354
8355        _.setCSS(_.swipeLeft);
8356
8357    };
8358
8359    Slick.prototype.swipeStart = function(event) {
8360
8361        var _ = this,
8362            touches;
8363
8364        _.interrupted = true;
8365
8366        if (_.touchObject.fingerCount !== 1 || _.slideCount <= _.options.slidesToShow) {
8367            _.touchObject = {};
8368            return false;
8369        }
8370
8371        if (event.originalEvent !== undefined && event.originalEvent.touches !== undefined) {
8372            touches = event.originalEvent.touches[0];
8373        }
8374
8375        _.touchObject.startX = _.touchObject.curX = touches !== undefined ? touches.pageX : event.clientX;
8376        _.touchObject.startY = _.touchObject.curY = touches !== undefined ? touches.pageY : event.clientY;
8377
8378        _.dragging = true;
8379
8380    };
8381
8382    Slick.prototype.unfilterSlides = Slick.prototype.slickUnfilter = function() {
8383
8384        var _ = this;
8385
8386        if (_.$slidesCache !== null) {
8387
8388            _.unload();
8389
8390            _.$slideTrack.children(this.options.slide).detach();
8391
8392            _.$slidesCache.appendTo(_.$slideTrack);
8393
8394            _.reinit();
8395
8396        }
8397
8398    };
8399
8400    Slick.prototype.unload = function() {
8401
8402        var _ = this;
8403
8404        $('.slick-cloned', _.$slider).remove();
8405
8406        if (_.$dots) {
8407            _.$dots.remove();
8408        }
8409
8410        if (_.$prevArrow && _.htmlExpr.test(_.options.prevArrow)) {
8411            _.$prevArrow.remove();
8412        }
8413
8414        if (_.$nextArrow && _.htmlExpr.test(_.options.nextArrow)) {
8415            _.$nextArrow.remove();
8416        }
8417
8418        _.$slides
8419            .removeClass('slick-slide slick-active slick-visible slick-current')
8420            .attr('aria-hidden', 'true')
8421            .css('width', '');
8422
8423    };
8424
8425    Slick.prototype.unslick = function(fromBreakpoint) {
8426
8427        var _ = this;
8428        _.$slider.trigger('unslick', [_, fromBreakpoint]);
8429        _.destroy();
8430
8431    };
8432
8433    Slick.prototype.updateArrows = function() {
8434
8435        var _ = this,
8436            centerOffset;
8437
8438        centerOffset = Math.floor(_.options.slidesToShow / 2);
8439
8440        if ( _.options.arrows === true &&
8441            _.slideCount > _.options.slidesToShow &&
8442            !_.options.infinite ) {
8443
8444            _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false');
8445            _.$nextArrow.removeClass('slick-disabled').attr('aria-disabled', 'false');
8446
8447            if (_.currentSlide === 0) {
8448
8449                _.$prevArrow.addClass('slick-disabled').attr('aria-disabled', 'true');
8450                _.$nextArrow.removeClass('slick-disabled').attr('aria-disabled', 'false');
8451
8452            } else if (_.currentSlide >= _.slideCount - _.options.slidesToShow && _.options.centerMode === false) {
8453
8454                _.$nextArrow.addClass('slick-disabled').attr('aria-disabled', 'true');
8455                _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false');
8456
8457            } else if (_.currentSlide >= _.slideCount - 1 && _.options.centerMode === true) {
8458
8459                _.$nextArrow.addClass('slick-disabled').attr('aria-disabled', 'true');
8460                _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false');
8461
8462            }
8463
8464        }
8465
8466    };
8467
8468    Slick.prototype.updateDots = function() {
8469
8470        var _ = this;
8471
8472        if (_.$dots !== null) {
8473
8474            _.$dots
8475                .find('li')
8476                    .removeClass('slick-active')
8477                    .end();
8478
8479            _.$dots
8480                .find('li')
8481                .eq(Math.floor(_.currentSlide / _.options.slidesToScroll))
8482                .addClass('slick-active');
8483
8484        }
8485
8486    };
8487
8488    Slick.prototype.visibility = function() {
8489
8490        var _ = this;
8491
8492        if ( _.options.autoplay ) {
8493
8494            if ( document[_.hidden] ) {
8495
8496                _.interrupted = true;
8497
8498            } else {
8499
8500                _.interrupted = false;
8501
8502            }
8503
8504        }
8505
8506    };
8507
8508    $.fn.slick = function() {
8509        var _ = this,
8510            opt = arguments[0],
8511            args = Array.prototype.slice.call(arguments, 1),
8512            l = _.length,
8513            i,
8514            ret;
8515        for (i = 0; i < l; i++) {
8516            if (typeof opt == 'object' || typeof opt == 'undefined')
8517                _[i].slick = new Slick(_[i], opt);
8518            else
8519                ret = _[i].slick[opt].apply(_[i].slick, args);
8520            if (typeof ret != 'undefined') return ret;
8521        }
8522        return _;
8523    };
8524
8525}));
8526;
8527function stringCheck(form, name, required, max, prettyName)
8528{
8529  var v = getValue(form,name);
8530  if ( !required && v == "" )
8531  {
8532      return true;
8533  }
8534  if ( required && v == "" )
8535  {
8536      alert("Please enter a value for " + prettyName);
8537      form[name].focus();
8538      return false;
8539  }
8540  if ( v.length > max )
8541  { 
8542      alert("Maximum value for " + prettyName + " is " + max + " characters.");
8543      form[name].focus();
8544      return false;
8545  }
8546  return true;
8547}
8548
8549function checkEmail(form, name, required, max, prettyName)
8550{
8551  var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
8552  var v = getValue(form,name);
8553  if ( !required && v == "" )
8554  {
8555      return true;
8556  }
8557  //stringCheck makes sure if required then it's there
8558  if ( !stringCheck(form,name, required, max, prettyName))
8559  {
8560     return false;
8561  }
8562  if (!filter.test(v))
8563  {
8564       alert(v + " does not appear to be a valid email address.")
8565       form[name].focus();
8566       return false;
8567  }
8568  return true;
8569}
8570/*use null for length if don't want it checked*/
8571function checkPhone(form, name, required, length, prettyName)
8572{
8573  var v = getValue(form,name);
8574  //if we dont need one...
8575  if ( !required && v == "" )
8576  {
8577      return true;
8578  }
8579  //stringCheck makes sure if required then it's there
8580  if ( !stringCheck(form,name, required, 50, prettyName))//we assume numbers not bigger than 50
8581  {
8582     return false;
8583  }
8584  
8585  var stripped = v.replace(/[\(\)\.\-\ ]/g, '');
8586  //strip out acceptable non-numeric characters
8587  if (isNaN(parseInt(stripped))) 
8588  {
8589      alert(prettyName + " appears to contain invalid characters.");
8590      form[name].focus();
8591      return false;
8592  }
8593  if ( length!=null )
8594  {
8595      if ( stripped.length<length )
8596      {
8597      	alert("The " + prettyName + " is not long enough.  Is the area code missing?");
8598        form[name].focus();
8599        return false;
8600      }
8601  }
8602  return true;
8603}
8604
8605/*use null for length if don't want it checked*/
8606function checkZip(form, name, required, length, prettyName)
8607{
8608  var v = getValue(form,name);
8609  //if we dont need one...
8610  if ( !required && v == "" )
8611  {
8612      return true;
8613  }
8614  //stringCheck makes sure if required then it's there
8615  if ( !stringCheck(form,name, required, 15, prettyName))//we assume numbers not bigger than 50
8616  {
8617     return false;
8618  }
8619  
8620  var stripped = v.replace(/[\(\)\.\-\ ]/g, '');
8621  //strip out acceptable non-numeric characters
8622  if (isNaN(parseInt(stripped))) 
8623  {
8624      alert(prettyName + " appears to contain invalid characters.");
8625      form[name].focus();
8626      return false;
8627  }
8628  if ( length!=null )
8629  {
8630      if ( stripped.length<length )
8631      {
8632      	alert("The " + prettyName + " is not long enough.");
8633        form[name].focus();
8634        return false;
8635      }
8636  }
8637  return true;
8638}
8639
8640function checkDropdown(form, name, prettyName) {
8641    
8642    if (form[name].selectedIndex == 0) 
8643    {
8644      	alert("Please make selection for " + prettyName);
8645        form[name].focus();
8646        return false;
8647    }    
8648    return true;
8649} 
8650
8651function checkRadio(form, name, prettyName)
8652{
8653    checked = false;
8654    for ( var j = 0; j< form[name].length; j++)
8655    {
8656        if (form[name][j].checked)
8657            checked = true;
8658    }
8659    if ( checked == false )
8660    {
8661      	alert("Please make selection for " + prettyName);
8662        //form[name].focus();
8663        return false;
8664    }
8665    return true;
8666}
8667
8668function checkLength(form, name, max, prettyName)
8669{
8670  if ( form[name].value.length > max )
8671  {
8672      alert(prettyName + " can contain at most " + max + " characters.");
8673      return false;
8674  }
8675  return true;
8676}
8677
8678function getValue(form, name)
8679{
8680    var v = form[name].value;
8681    if ( v==null )
8682    {
8683      alert(name + " does not appear to be form variable.  See admin.");
8684      return v;
8685    }
8686    else
8687      return trim(v);
8688}
8689
8690function trim(v)
8691{
8692  return v.replace(/^\s*|\s*$/g,"");
8693}
8694
8695
8696;
8697var HDM = (function ($) {
8698    var _createNs, _getNSString;
8699    /**
8700    * @method createNs
8701    *
8702    * @param (String) n  example "HDM.admin.wizard"
8703    * @param (Object) o  example { "HDM" : { "admin": {} } } rarely used
8704    * I think I got this from tinymce.
8705    * Note that each node has a reference to its parent and a name.  This makes 
8706    * constructing the namespace tree string more efficient.  Do I care?
8707    * Otherwise you have to right some recursive search for the path down the namespace
8708    * to the node.  That search could run into infinite loops and is quite the pain.
8709    */
8710    _createNs = function (n/*namespace*/, o/*starting place*/) {
8711        var i, v;
8712        o = o || window;
8713        n = n.split('.');
8714        for (i = 0; i < n.length; i++) {
8715            v = n[i];
8716            if (!o[v]) {
8717                o[v] = {"__name":v, "__parent": o};//we want to be able to go back up this tree as well
8718            }
8719            o = o[v];
8720        }
8721        return o; //return last namespace object created
8722    };
8723
8724    /**
8725    *  Gets a string representing a namespace
8726
8727    *  @param ns a namespace leaf object from the namespace.
8728    *         The admin part of this { "HDM":{ {"admin": {}} }}
8729       @part optional for convience
8730    */
8731    _getNSString = function (ns, part) {
8732        var nsString = "";
8733        while (ns) {
8734            nsString = ns.__name + (nsString !== ""?".":"") + nsString;
8735            ns = ns.__parent;
8736        }
8737        if (part) {
8738            nsString = nsString + "." + part;
8739        }
8740        return nsString;
8741    };
8742    return {
8743        createNs: _createNs,
8744        getNSString: _getNSString,
8745        __name: "HDM"
8746    };
8747}(jQuery));
8748
8749HDM.createNs("HDM.eventbus");
8750/*
8751A very simple event bus.
8752//a good refernce https://github.com/krasimir/EventBus/blob/master/src/EventBus.js
8753*/
8754HDM.eventbus.EventBus = (function () {
8755
8756    var _subscribe, _unsubscribe, _publish;
8757
8758    _subscribe = function (type, fn) {
8759        type = type || "any";
8760        if (typeof this.subscribers[type] === "undefined") {
8761            this.subscribers[type] = [];
8762        }
8763        this.subscribers[type].push(fn);
8764        return { "type":type, "function":fn };
8765    };
8766    _unsubscribe = function (type, fn) {
8767        type = type || "any";
8768        if (typeof this.subscribers[type] === "undefined") {
8769            this.subscribers[type] = [];
8770        }
8771        for (var i = 0; i < this.subscribers[type].length; i++) {
8772            if (this.subscribers[type][i] === fn) {
8773                this.subscribers[type].splice(i, 1);
8774            }
8775        }
8776    };
8777    _publish = function (type, data) {
8778        type = type || "any";
8779        if (!(type in this.subscribers)) {
8780            return; //no one subscribed
8781        }
8782        var who = this.subscribers[type];
8783        for (var i = 0; i < who.length; i++) {
8784            who[i](data);
8785        }
8786    };
8787    var Constr = function () {
8788        this.subscribers = {};
8789        return this;
8790    };
8791
8792    Constr.prototype = {
8793        subscribe: _subscribe,
8794        unsubscribe: _unsubscribe,
8795        publish: _publish
8796    };
8797    return Constr;
8798} ());
8799/*
8800*  pubsub is a wrapper around the event bus so that 
8801   event buses can be created, subscribed to, published to by anyone 
8802   regardless of whether the main publisher has set it up yet.
8803*/
8804HDM.pubsub = (function () {
8805    var pubsubs = {}, _subscribe, _unsubscribe, _publish, _getEventBus;
8806
8807    /*
8808      @param namespace is so we can have publishers have their own
8809             event bus.  Making it easier to avoid event name collisions
8810    */
8811    _subscribe = function (topic, fn, namespace) {
8812        var pubsub = _getEventBus(namespace);
8813        pubsub.subscribe(topic, fn);
8814        return { "type":topic, "function":fn, "namespace":namespace };
8815    };
8816    _unsubscribe = function (topic, fn, namespace) {
8817        var pubsub = _getEventBus(namespace);
8818        pubsub.unsubscribe(topic, fn);
8819    };
8820
8821    /*
8822      @param namespace is so we can have publishers have their own
8823             event bus.  Making it easier to avoid event name collisions
8824    */
8825    _publish = function (topic, data, namespace) {
8826        var pubsub = _getEventBus(namespace);
8827        pubsub.publish(topic, data);
8828    };
8829    /*
8830      @param namespace is a string.  For those that publish or subscribe to many events
8831             it can be easier to just get a handle to the EventBus associated with 
8832             that namespace and hold on to it.
8833    */
8834    _getEventBus = function (namespace) {
8835        if (!namespace) {
8836            namespace = "_default";
8837        }
8838        if (pubsubs[namespace]) {
8839            return pubsubs[namespace];
8840        }
8841        var eventBus = new HDM.eventbus.EventBus();
8842        pubsubs[namespace] = eventBus;
8843        return eventBus;
8844    };
8845    return {
8846        subscribe: _subscribe,
8847        publish: _publish,
8848        /* this is public so we can not have to specify namespace all over the place
8849        like in classes that use the pubsub often */
8850        getEventBus: _getEventBus
8851
8852    };
8853} ());;
8854_hdmq.loadComplete();;

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.