PageSourceSearch

https://www.premiumoutlets.co.jp/_assets_rev03/js/lib-sub.js

js premiumoutlets.co.jp collected 2026-10-02 02:28:23 UTC 140,924 bytes, 2,796 lines download raw bytes

1/*! jQuery Migrate v1.4.1 | (c) jQuery Foundation and other contributors | jquery.org/license */
2"undefined"==typeof jQuery.migrateMute&&(jQuery.migrateMute=!0),function(a,b,c){function d(c){var d=b.console;f[c]||(f[c]=!0,a.migrateWarnings.push(c),d&&d.warn&&!a.migrateMute&&(d.warn("JQMIGRATE: "+c),a.migrateTrace&&d.trace&&d.trace()))}function e(b,c,e,f){if(Object.defineProperty)try{return void Object.defineProperty(b,c,{configurable:!0,enumerable:!0,get:function(){return d(f),e},set:function(a){d(f),e=a}})}catch(g){}a._definePropertyBroken=!0,b[c]=e}a.migrateVersion="1.4.1";var f={};a.migrateWarnings=[],b.console&&b.console.log&&b.console.log("JQMIGRATE: Migrate is installed"+(a.migrateMute?"":" with logging active")+", version "+a.migrateVersion),a.migrateTrace===c&&(a.migrateTrace=!0),a.migrateReset=function(){f={},a.migrateWarnings.length=0},"BackCompat"===document.compatMode&&d("jQuery is not compatible with Quirks Mode");var g=a("<input/>",{size:1}).attr("size")&&a.attrFn,h=a.attr,i=a.attrHooks.value&&a.attrHooks.value.get||function(){return null},j=a.attrHooks.value&&a.attrHooks.value.set||function(){return c},k=/^(?:input|button)$/i,l=/^[238]$/,m=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,n=/^(?:checked|selected)$/i;e(a,"attrFn",g||{},"jQuery.attrFn is deprecated"),a.attr=function(b,e,f,i){var j=e.toLowerCase(),o=b&&b.nodeType;return i&&(h.length<4&&d("jQuery.fn.attr( props, pass ) is deprecated"),b&&!l.test(o)&&(g?e in g:a.isFunction(a.fn[e])))?a(b)[e](f):("type"===e&&f!==c&&k.test(b.nodeName)&&b.parentNode&&d("Can't change the 'type' of an input or button in IE 6/7/8"),!a.attrHooks[j]&&m.test(j)&&(a.attrHooks[j]={get:function(b,d){var e,f=a.prop(b,d);return f===!0||"boolean"!=typeof f&&(e=b.getAttributeNode(d))&&e.nodeValue!==!1?d.toLowerCase():c},set:function(b,c,d){var e;return c===!1?a.removeAttr(b,d):(e=a.propFix[d]||d,e in b&&(b[e]=!0),b.setAttribute(d,d.toLowerCase())),d}},n.test(j)&&d("jQuery.fn.attr('"+j+"') might use property instead of attribute")),h.call(a,b,e,f))},a.attrHooks.value={get:function(a,b){var c=(a.nodeName||"").toLowerCase();return"button"===c?i.apply(this,arguments):("input"!==c&&"option"!==c&&d("jQuery.fn.attr('value') no longer gets properties"),b in a?a.value:null)},set:function(a,b){var c=(a.nodeName||"").toLowerCase();return"button"===c?j.apply(this,arguments):("input"!==c&&"option"!==c&&d("jQuery.fn.attr('value', val) no longer sets properties"),void(a.value=b))}};var o,p,q=a.fn.init,r=a.find,s=a.parseJSON,t=/^\s*</,u=/\[(\s*[-\w]+\s*)([~|^$*]?=)\s*([-\w#]*?#[-\w#]*)\s*\]/,v=/\[(\s*[-\w]+\s*)([~|^$*]?=)\s*([-\w#]*?#[-\w#]*)\s*\]/g,w=/^([^<]*)(<[\w\W]+>)([^>]*)$/;a.fn.init=function(b,e,f){var g,h;return b&&"string"==typeof b&&!a.isPlainObject(e)&&(g=w.exec(a.trim(b)))&&g[0]&&(t.test(b)||d("$(html) HTML strings must start with '<' character"),g[3]&&d("$(html) HTML text after last tag is ignored"),"#"===g[0].charAt(0)&&(d("HTML string cannot start with a '#' character"),a.error("JQMIGRATE: Invalid selector string (XSS)")),e&&e.context&&e.context.nodeType&&(e=e.context),a.parseHTML)?q.call(this,a.parseHTML(g[2],e&&e.ownerDocument||e||document,!0),e,f):(h=q.apply(this,arguments),b&&b.selector!==c?(h.selector=b.selector,h.context=b.context):(h.selector="string"==typeof b?b:"",b&&(h.context=b.nodeType?b:e||document)),h)},a.fn.init.prototype=a.fn,a.find=function(a){var b=Array.prototype.slice.call(arguments);if("string"==typeof a&&u.test(a))try{document.querySelector(a)}catch(c){a=a.replace(v,function(a,b,c,d){return"["+b+c+'"'+d+'"]'});try{document.querySelector(a),d("Attribute selector with '#' must be quoted: "+b[0]),b[0]=a}catch(e){d("Attribute selector with '#' was not fixed: "+b[0])}}return r.apply(this,b)};var x;for(x in r)Object.prototype.hasOwnProperty.call(r,x)&&(a.find[x]=r[x]);a.parseJSON=function(a){return a?s.apply(this,arguments):(d("jQuery.parseJSON requires a valid JSON string"),null)},a.uaMatch=function(a){a=a.toLowerCase();var b=/(chrome)[ \/]([\w.]+)/.exec(a)||/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||a.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},a.browser||(o=a.uaMatch(navigator.userAgent),p={},o.browser&&(p[o.browser]=!0,p.version=o.version),p.chrome?p.webkit=!0:p.webkit&&(p.safari=!0),a.browser=p),e(a,"browser",a.browser,"jQuery.browser is deprecated"),a.boxModel=a.support.boxModel="CSS1Compat"===document.compatMode,e(a,"boxModel",a.boxModel,"jQuery.boxModel is deprecated"),e(
2a.support,"boxModel",a.support.boxModel,"jQuery.support.boxModel is deprecated"),a.sub=function(){function b(a,c){return new b.fn.init(a,c)}a.extend(!0,b,this),b.superclass=this,b.fn=b.prototype=this(),b.fn.constructor=b,b.sub=this.sub,b.fn.init=function(d,e){var f=a.fn.init.call(this,d,e,c);return f instanceof b?f:b(f)},b.fn.init.prototype=b.fn;var c=b(document);return d("jQuery.sub() is deprecated"),b},a.fn.size=function(){return d("jQuery.fn.size() is deprecated; use the .length property"),this.length};var y=!1;a.swap&&a.each(["height","width","reliableMarginRight"],function(b,c){var d=a.cssHooks[c]&&a.cssHooks[c].get;d&&(a.cssHooks[c].get=function(){var a;return y=!0,a=d.apply(this,arguments),y=!1,a})}),a.swap=function(a,b,c,e){var f,g,h={};y||d("jQuery.swap() is undocumented and deprecated");for(g in b)h[g]=a.style[g],a.style[g]=b[g];f=c.apply(a,e||[]);for(g in b)a.style[g]=h[g];return f},a.ajaxSetup({converters:{"text json":a.parseJSON}});var z=a.fn.data;a.fn.data=function(b){var e,f,g=this[0];return!g||"events"!==b||1!==arguments.length||(e=a.data(g,b),f=a._data(g,b),e!==c&&e!==f||f===c)?z.apply(this,arguments):(d("Use of jQuery.fn.data('events') is deprecated"),f)};var A=/\/(java|ecma)script/i;a.clean||(a.clean=function(b,c,e,f){c=c||document,c=!c.nodeType&&c[0]||c,c=c.ownerDocument||c,d("jQuery.clean() is deprecated");var g,h,i,j,k=[];if(a.merge(k,a.buildFragment(b,c).childNodes),e)for(i=function(a){return!a.type||A.test(a.type)?f?f.push(a.parentNode?a.parentNode.removeChild(a):a):e.appendChild(a):void 0},g=0;null!=(h=k[g]);g++)a.nodeName(h,"script")&&i(h)||(e.appendChild(h),"undefined"!=typeof h.getElementsByTagName&&(j=a.grep(a.merge([],h.getElementsByTagName("script")),i),k.splice.apply(k,[g+1,0].concat(j)),g+=j.length));return k});var B=a.event.add,C=a.event.remove,D=a.event.trigger,E=a.fn.toggle,F=a.fn.live,G=a.fn.die,H=a.fn.load,I="ajaxStart|ajaxStop|ajaxSend|ajaxComplete|ajaxError|ajaxSuccess",J=new RegExp("\\b(?:"+I+")\\b"),K=/(?:^|\s)hover(\.\S+|)\b/,L=function(b){return"string"!=typeof b||a.event.special.hover?b:(K.test(b)&&d("'hover' pseudo-event is deprecated, use 'mouseenter mouseleave'"),b&&b.replace(K,"mouseenter$1 mouseleave$1"))};a.event.props&&"attrChange"!==a.event.props[0]&&a.event.props.unshift("attrChange","attrName","relatedNode","srcElement"),a.event.dispatch&&e(a.event,"handle",a.event.dispatch,"jQuery.event.handle is undocumented and deprecated"),a.event.add=function(a,b,c,e,f){a!==document&&J.test(b)&&d("AJAX events should be attached to document: "+b),B.call(this,a,L(b||""),c,e,f)},a.event.remove=function(a,b,c,d,e){C.call(this,a,L(b)||"",c,d,e)},a.each(["load","unload","error"],function(b,c){a.fn[c]=function(){var a=Array.prototype.slice.call(arguments,0);return"load"===c&&"string"==typeof a[0]?H.apply(this,a):(d("jQuery.fn."+c+"() is deprecated"),a.splice(0,0,c),arguments.length?this.bind.apply(this,a):(this.triggerHandler.apply(this,a),this))}}),a.fn.toggle=function(b,c){if(!a.isFunction(b)||!a.isFunction(c))return E.apply(this,arguments);d("jQuery.fn.toggle(handler, handler...) is deprecated");var e=arguments,f=b.guid||a.guid++,g=0,h=function(c){var d=(a._data(this,"lastToggle"+b.guid)||0)%g;return a._data(this,"lastToggle"+b.guid,d+1),c.preventDefault(),e[d].apply(this,arguments)||!1};for(h.guid=f;g<e.length;)e[g++].guid=f;return this.click(h)},a.fn.live=function(b,c,e){return d("jQuery.fn.live() is deprecated"),F?F.apply(this,arguments):(a(this.context).on(b,this.selector,c,e),this)},a.fn.die=function(b,c){return d("jQuery.fn.die() is deprecated"),G?G.apply(this,arguments):(a(this.context).off(b,this.selector||"**",c),this)},a.event.trigger=function(a,b,c,e){return c||J.test(a)||d("Global events are undocumented and deprecated"),D.call(this,a,b,c||document,e)},a.each(I.split("|"),function(b,c){a.event.special[c]={setup:function(){var b=this;return b!==document&&(a.event.add(document,c+"."+a.guid,function(){a.event.trigger(c,Array.prototype.slice.call(arguments,1),b,!0)}),a._data(this,c,a.guid++)),!1},teardown:function(){return this!==document&&a.event.remove(document,c+"."+a._data(this,c)),!1}}}),a.event.special.ready={setup:function(){this===document&&d("'ready' event is deprecated")}};var M=a.fn.andSelf||a.fn.addBack,N=a.fn.find;if(a.fn.andSelf=function(){return d("jQuery.fn.andSelf() replaced by jQuery.fn.addBack()"),M.apply(this,arguments)},a.fn.find=function(a){var b=N.apply(this,arguments);return b.context=this.context,b.selector=this.selector?this.selector+" "+a:a,b},a.Callbacks){var O=a.Deferred,P=[["resolve","done",a.Callbacks("once memory"),a.Callbacks("once memory"),"resolved"],["reject","fail",a.Callbacks("once memory"),a.Callbacks("once memory"),"rejected"],["notify","progress",a.Callbacks("memory"),a.Callbacks("memory")]];a.Deferred=function(b){var c=O(),e=c.promise();return c.pipe=e.pipe=function(){var b=arguments;return d("deferred.pipe() is deprecated"),a.Deferred(function(d){a.each(P,function(f,g){var h=a.isFunction(b[f])&&b[f];c[g[1]](function(){var b=h&&h.apply(this,arguments);b&&a.isFunction(b.promise)?b.promise().done(d.resolve).fail(d.reject).progress(d.notify):d[g[0]+"With"](this===e?d.promise():this,h?[b]:arguments)})}),b=null}).promise()},c.isResolved=function(){return d("deferred.isResolved is deprecated"),"resolved"===c.state()},c.isRejected=function(){return d("deferred.isRejected is deprecated"),"rejected"===c.state()},b&&b.call(c,c),c}}}(jQuery,window);
3
4
5/*
6 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
7 *
8 * Uses the built in easing capabilities added In jQuery 1.1
9 * to offer multiple easing options
10 *
11 * TERMS OF USE - jQuery Easing
12 * 
13 * Open source under the BSD License. 
14 * 
15 * Copyright © 2008 George McGinley Smith
16 * All rights reserved.
17 * 
18 * Redistribution and use in source and binary forms, with or without modification, 
19 * are permitted provided that the following conditions are met:
20 * 
21 * Redistributions of source code must retain the above copyright notice, this list of 
22 * conditions and the following disclaimer.
23 * Redistributions in binary form must reproduce the above copyright notice, this list 
24 * of conditions and the following disclaimer in the documentation and/or other materials 
25 * provided with the distribution.
26 * 
27 * Neither the name of the author nor the names of contributors may be used to endorse 
28 * or promote products derived from this software without specific prior written permission.
29 * 
30 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
31 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
32 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
33 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
vendor: 5,091 bytes, lines 34-179
34 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
35 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
36 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
37 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
38 * OF THE POSSIBILITY OF SUCH DAMAGE. 
39 *
40*/
41
42// t: current time, b: begInnIng value, c: change In value, d: duration
43jQuery.easing['jswing'] = jQuery.easing['swing'];
44
45jQuery.extend( jQuery.easing,
46{
47	def: 'easeOutQuad',
48	swing: function (x, t, b, c, d) {
49		//alert(jQuery.easing.default);
50		return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
51	},
52	easeInQuad: function (x, t, b, c, d) {
53		return c*(t/=d)*t + b;
54	},
55	easeOutQuad: function (x, t, b, c, d) {
56		return -c *(t/=d)*(t-2) + b;
57	},
58	easeInOutQuad: function (x, t, b, c, d) {
59		if ((t/=d/2) < 1) return c/2*t*t + b;
60		return -c/2 * ((--t)*(t-2) - 1) + b;
61	},
62	easeInCubic: function (x, t, b, c, d) {
63		return c*(t/=d)*t*t + b;
64	},
65	easeOutCubic: function (x, t, b, c, d) {
66		return c*((t=t/d-1)*t*t + 1) + b;
67	},
68	easeInOutCubic: function (x, t, b, c, d) {
69		if ((t/=d/2) < 1) return c/2*t*t*t + b;
70		return c/2*((t-=2)*t*t + 2) + b;
71	},
72	easeInQuart: function (x, t, b, c, d) {
73		return c*(t/=d)*t*t*t + b;
74	},
75	easeOutQuart: function (x, t, b, c, d) {
76		return -c * ((t=t/d-1)*t*t*t - 1) + b;
77	},
78	easeInOutQuart: function (x, t, b, c, d) {
79		if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
80		return -c/2 * ((t-=2)*t*t*t - 2) + b;
81	},
82	easeInQuint: function (x, t, b, c, d) {
83		return c*(t/=d)*t*t*t*t + b;
84	},
85	easeOutQuint: function (x, t, b, c, d) {
86		return c*((t=t/d-1)*t*t*t*t + 1) + b;
87	},
88	easeInOutQuint: function (x, t, b, c, d) {
89		if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
90		return c/2*((t-=2)*t*t*t*t + 2) + b;
91	},
92	easeInSine: function (x, t, b, c, d) {
93		return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
94	},
95	easeOutSine: function (x, t, b, c, d) {
96		return c * Math.sin(t/d * (Math.PI/2)) + b;
97	},
98	easeInOutSine: function (x, t, b, c, d) {
99		return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
100	},
101	easeInExpo: function (x, t, b, c, d) {
102		return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
103	},
104	easeOutExpo: function (x, t, b, c, d) {
105		return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
106	},
107	easeInOutExpo: function (x, t, b, c, d) {
108		if (t==0) return b;
109		if (t==d) return b+c;
110		if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
111		return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
112	},
113	easeInCirc: function (x, t, b, c, d) {
114		return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
115	},
116	easeOutCirc: function (x, t, b, c, d) {
117		return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
118	},
119	easeInOutCirc: function (x, t, b, c, d) {
120		if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
121		return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
122	},
123	easeInElastic: function (x, t, b, c, d) {
124		var s=1.70158;var p=0;var a=c;
125		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
126		if (a < Math.abs(c)) { a=c; var s=p/4; }
127		else var s = p/(2*Math.PI) * Math.asin (c/a);
128		return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
129	},
130	easeOutElastic: function (x, t, b, c, d) {
131		var s=1.70158;var p=0;var a=c;
132		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
133		if (a < Math.abs(c)) { a=c; var s=p/4; }
134		else var s = p/(2*Math.PI) * Math.asin (c/a);
135		return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
136	},
137	easeInOutElastic: function (x, t, b, c, d) {
138		var s=1.70158;var p=0;var a=c;
139		if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
140		if (a < Math.abs(c)) { a=c; var s=p/4; }
141		else var s = p/(2*Math.PI) * Math.asin (c/a);
142		if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
143		return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
144	},
145	easeInBack: function (x, t, b, c, d, s) {
146		if (s == undefined) s = 1.70158;
147		return c*(t/=d)*t*((s+1)*t - s) + b;
148	},
149	easeOutBack: function (x, t, b, c, d, s) {
150		if (s == undefined) s = 1.70158;
151		return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
152	},
153	easeInOutBack: function (x, t, b, c, d, s) {
154		if (s == undefined) s = 1.70158; 
155		if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
156		return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
157	},
158	easeInBounce: function (x, t, b, c, d) {
159		return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
160	},
161	easeOutBounce: function (x, t, b, c, d) {
162		if ((t/=d) < (1/2.75)) {
163			return c*(7.5625*t*t) + b;
164		} else if (t < (2/2.75)) {
165			return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
166		} else if (t < (2.5/2.75)) {
167			return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
168		} else {
169			return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
170		}
171	},
172	easeInOutBounce: function (x, t, b, c, d) {
173		if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
174		return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
175	}
176});
177
178/*
179 *
180 * TERMS OF USE - EASING EQUATIONS
181 * 
182 * Open source under the BSD License. 
183 * 
184 * Copyright © 2001 Robert Penner
185 * All rights reserved.
186 * 
187 * Redistribution and use in source and binary forms, with or without modification, 
188 * are permitted provided that the following conditions are met:
189 * 
190 * Redistributions of source code must retain the above copyright notice, this list of 
191 * conditions and the following disclaimer.
192 * Redistributions in binary form must reproduce the above copyright notice, this list 
193 * of conditions and the following disclaimer in the documentation and/or other materials 
194 * provided with the distribution.
195 * 
196 * Neither the name of the author nor the names of contributors may be used to endorse 
197 * or promote products derived from this software without specific prior written permission.
198 * 
199 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
200 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
201 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
202 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
203 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
204 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
205 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
206 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
207 * OF THE POSSIBILITY OF SUCH DAMAGE. 
208 *
209 */
210/*
211 * simplyScroll 2 - a scroll-tastic jQuery plugin
212 *
213 * http://logicbox.net/jquery/simplyscroll/
214 *
215 * Copyright (c) 2009-2012 Will Kelly - http://logicbox.net
216 *
217 * Dual licensed under the MIT and GPL licenses.
218 *
219 * Version: 2.0.5 Last revised: 10/05/2012
220 *
221 */
222(function(c,j,i){c.fn.simplyScroll=function(a){return this.each(function(){new c.simplyScroll(this,a)})};var h={customClass:"simply-scroll",frameRate:24,speed:1,orientation:"horizontal",auto:!0,autoMode:"loop",manualMode:"end",direction:"forwards",pauseOnHover:!0,pauseOnTouch:!0,pauseButton:!1,startOnLoad:!1};c.simplyScroll=function(a,b){var g=this;this.o=c.extend({},h,b||{});this.isAuto=!1!==this.o.auto&&null!==this.o.autoMode.match(/^loop|bounce$/);this.isRTL=(this.isHorizontal=null!==this.o.orientation.match(/^horizontal|vertical$/)&&
223this.o.orientation==h.orientation)&&"rtl"==c("html").attr("dir");this.isForwards=!this.isAuto||this.isAuto&&(null!==this.o.direction.match(/^forwards|backwards$/)&&this.o.direction==h.direction)&&!this.isRTL;this.isLoop=this.isAuto&&"loop"==this.o.autoMode||!this.isAuto&&"loop"==this.o.manualMode;this.events=(this.supportsTouch="createTouch"in document)?{start:"touchstart MozTouchDown",move:"touchmove MozTouchMove",end:"touchend touchcancel MozTouchRelease"}:{start:"mouseenter",end:"mouseleave"};
224this.$list=c(a);var d=this.$list.children();this.$list.addClass("simply-scroll-list").wrap('<div class="simply-scroll-clip"></div>').parent().wrap('<div class="'+this.o.customClass+' simply-scroll-container"></div>');this.isAuto?this.o.pauseButton&&(this.$list.parent().parent().prepend('<div class="simply-scroll-btn simply-scroll-btn-pause"></div>'),this.o.pauseOnHover=!1):this.$list.parent().parent().prepend('<div class="simply-scroll-forward"></div>').prepend('<div class="simply-scroll-back"></div>');
225if(1<d.length){var f=!1,e=0;this.isHorizontal?(d.each(function(){e=e+c(this).outerWidth(true)}),f=d.eq(0).outerWidth(!0)*d.length!==e):(d.each(function(){e=e+c(this).outerHeight(true)}),f=d.eq(0).outerHeight(!0)*d.length!==e);f&&(this.$list=this.$list.wrap("<div></div>").parent().addClass("simply-scroll-list"),this.isHorizontal?this.$list.children().css({"float":"left",width:e+"px"}):this.$list.children().css({height:e+"px"}))}this.o.startOnLoad?c(j).load(function(){g.init()}):this.init()};c.simplyScroll.fn=
226c.simplyScroll.prototype={};c.simplyScroll.fn.extend=c.simplyScroll.extend=c.extend;c.simplyScroll.fn.extend({init:function(){this.$items=this.$list.children();this.$clip=this.$list.parent();this.$container=this.$clip.parent();this.$btnBack=c(".simply-scroll-back",this.$container);this.$btnForward=c(".simply-scroll-forward",this.$container);this.isHorizontal?(this.itemMax=this.$items.eq(0).outerWidth(!0),this.clipMax=this.$clip.width(),this.dimension="width",this.moveBackClass="simply-scroll-btn-left",
227this.moveForwardClass="simply-scroll-btn-right",this.scrollPos="Left"):(this.itemMax=this.$items.eq(0).outerHeight(!0),this.clipMax=this.$clip.height(),this.dimension="height",this.moveBackClass="simply-scroll-btn-up",this.moveForwardClass="simply-scroll-btn-down",this.scrollPos="Top");this.posMin=0;this.posMax=this.$items.length*this.itemMax;var a=Math.ceil(this.clipMax/this.itemMax);if(this.isAuto&&"loop"==this.o.autoMode)this.$list.css(this.dimension,this.posMax+this.itemMax*a+"px"),this.posMax+=
228this.clipMax-this.o.speed,this.isForwards?(this.$items.slice(0,a).clone(!0).appendTo(this.$list),this.resetPosition=0):(this.$items.slice(-a).clone(!0).prependTo(this.$list),this.resetPosition=this.$items.length*this.itemMax,this.isRTL&&(this.$clip[0].dir="ltr",this.$items.css("float","right")));else if(!this.isAuto&&"loop"==this.o.manualMode){this.posMax+=this.itemMax*a;this.$list.css(this.dimension,this.posMax+this.itemMax*a+"px");this.posMax+=this.clipMax-this.o.speed;this.$items.slice(0,a).clone(!0).appendTo(this.$list);
229this.$items.slice(-a).clone(!0).prependTo(this.$list);this.resetPositionForwards=this.resetPosition=a*this.itemMax;this.resetPositionBackwards=this.$items.length*this.itemMax;var b=this;this.$btnBack.bind(this.events.start,function(){b.isForwards=false;b.resetPosition=b.resetPositionBackwards});this.$btnForward.bind(this.events.start,function(){b.isForwards=true;b.resetPosition=b.resetPositionForwards})}else this.$list.css(this.dimension,this.posMax+"px"),this.isForwards?this.resetPosition=0:(this.resetPosition=
230this.$items.length*this.itemMax,this.isRTL&&(this.$clip[0].dir="ltr",this.$items.css("float","right")));this.resetPos();this.interval=null;this.intervalDelay=Math.floor(1E3/this.o.frameRate);if(this.isAuto||"end"!=this.o.manualMode)for(;0!==this.itemMax%this.o.speed;)if(this.o.speed--,0===this.o.speed){this.o.speed=1;break}b=this;this.trigger=null;this.funcMoveBack=function(a){a!==i&&a.preventDefault();b.trigger=!b.isAuto&&b.o.manualMode=="end"?this:null;b.isAuto?b.isForwards?b.moveBack():b.moveForward():
231b.moveBack()};this.funcMoveForward=function(a){a!==i&&a.preventDefault();b.trigger=!b.isAuto&&b.o.manualMode=="end"?this:null;b.isAuto?b.isForwards?b.moveForward():b.moveBack():b.moveForward()};this.funcMovePause=function(){b.movePause()};this.funcMoveStop=function(){b.moveStop()};this.funcMoveResume=function(){b.moveResume()};if(this.isAuto){this.paused=!1;var g=function(){if(b.paused===false){b.paused=true;b.funcMovePause()}else{b.paused=false;b.funcMoveResume()}return b.paused};this.supportsTouch&&
232this.$items.find("a").length&&(this.supportsTouch=!1);if(this.isAuto&&this.o.pauseOnHover&&!this.supportsTouch)this.$clip.bind(this.events.start,this.funcMovePause).bind(this.events.end,this.funcMoveResume);else if(this.isAuto&&this.o.pauseOnTouch&&!this.o.pauseButton&&this.supportsTouch){var d,f;this.$clip.bind(this.events.start,function(a){g();var c=a.originalEvent.touches[0];d=b.isHorizontal?c.pageX:c.pageY;f=b.$clip[0]["scroll"+b.scrollPos];a.stopPropagation();a.preventDefault()}).bind(this.events.move,
233function(a){a.stopPropagation();a.preventDefault();a=a.originalEvent.touches[0];a=d-(b.isHorizontal?a.pageX:a.pageY)+f;if(a<0)a=0;else if(a>b.posMax)a=b.posMax;b.$clip[0]["scroll"+b.scrollPos]=a;b.funcMovePause();b.paused=true})}else this.o.pauseButton&&(this.$btnPause=c(".simply-scroll-btn-pause",this.$container).bind("click",function(a){a.preventDefault();g()?c(this).addClass("active"):c(this).removeClass("active")}));this.funcMoveForward()}else this.$btnBack.addClass("simply-scroll-btn "+this.moveBackClass).bind(this.events.start,
234this.funcMoveBack).bind(this.events.end,this.funcMoveStop),this.$btnForward.addClass("simply-scroll-btn "+this.moveForwardClass).bind(this.events.start,this.funcMoveForward).bind(this.events.end,this.funcMoveStop),"end"==this.o.manualMode&&(!this.isRTL?this.$btnBack.addClass("disabled"):this.$btnForward.addClass("disabled"))},moveForward:function(){var a=this;this.movement="forward";null!==this.trigger&&this.$btnBack.removeClass("disabled");a.interval=setInterval(function(){a.$clip[0]["scroll"+a.scrollPos]<
235a.posMax-a.clipMax?a.$clip[0]["scroll"+a.scrollPos]+=a.o.speed:a.isLoop?a.resetPos():a.moveStop(a.movement)},a.intervalDelay)},moveBack:function(){var a=this;this.movement="back";null!==this.trigger&&this.$btnForward.removeClass("disabled");a.interval=setInterval(function(){a.$clip[0]["scroll"+a.scrollPos]>a.posMin?a.$clip[0]["scroll"+a.scrollPos]-=a.o.speed:a.isLoop?a.resetPos():a.moveStop(a.movement)},a.intervalDelay)},movePause:function(){clearInterval(this.interval)},moveStop:function(a){this.movePause();
236null!==this.trigger&&("undefined"!==typeof a&&c(this.trigger).addClass("disabled"),this.trigger=null);this.isAuto&&"bounce"==this.o.autoMode&&("forward"==a?this.moveBack():this.moveForward())},moveResume:function(){"forward"==this.movement?this.moveForward():this.moveBack()},resetPos:function(){this.$clip[0]["scroll"+this.scrollPos]=this.resetPosition}})})(jQuery,window);
237/*!
238 * jQuery hashchange event - v1.3 - 7/21/2010
239 * http://benalman.com/projects/jquery-hashchange-plugin/
240 * 
241 * Copyright (c) 2010 "Cowboy" Ben Alman
242 * Dual licensed under the MIT and GPL licenses.
243 * http://benalman.com/about/license/
244 */
245
246// Script: jQuery hashchange event
247//
248// *Version: 1.3, Last updated: 7/21/2010*
249// 
250// Project Home - http://benalman.com/projects/jquery-hashchange-plugin/
251// GitHub       - http://github.com/cowboy/jquery-hashchange/
252// Source       - http://github.com/cowboy/jquery-hashchange/raw/master/jquery.ba-hashchange.js
253// (Minified)   - http://github.com/cowboy/jquery-hashchange/raw/master/jquery.ba-hashchange.min.js (0.8
253kb gzipped)
254// 
255// About: License
256// 
257// Copyright (c) 2010 "Cowboy" Ben Alman,
258// Dual licensed under the MIT and GPL licenses.
259// http://benalman.com/about/license/
260// 
261// About: Examples
262// 
263// These working examples, complete with fully commented code, illustrate a few
264// ways in which this plugin can be used.
265// 
266// hashchange event - http://benalman.com/code/projects/jquery-hashchange/examples/hashchange/
267// document.domain - http://benalman.com/code/projects/jquery-hashchange/examples/document_domain/
268// 
269// About: Support and Testing
270// 
271// Information about what version or versions of jQuery this plugin has been
272// tested with, what browsers it has been tested in, and where the unit tests
273// reside (so you can test it yourself).
274// 
275// jQuery Versions - 1.2.6, 1.3.2, 1.4.1, 1.4.2
276// Browsers Tested - Internet Explorer 6-8, Firefox 2-4, Chrome 5-6, Safari 3.2-5,
277//                   Opera 9.6-10.60, iPhone 3.1, Android 1.6-2.2, BlackBerry 4.6-5.
278// Unit Tests      - http://benalman.com/code/projects/jquery-hashchange/unit/
279// 
280// About: Known issues
281// 
282// While this jQuery hashchange event implementation is quite stable and
283// robust, there are a few unfortunate browser bugs surrounding expected
284// hashchange event-based behaviors, independent of any JavaScript
285// window.onhashchange abstraction. See the following examples for more
286// information:
287// 
288// Chrome: Back Button - http://benalman.com/code/projects/jquery-hashchange/examples/bug-chrome-back-button/
289// Firefox: Remote XMLHttpRequest - http://benalman.com/code/projects/jquery-hashchange/examples/bug-firefox-remote-xhr/
290// WebKit: Back Button in an Iframe - http://benalman.com/code/projects/jquery-hashchange/examples/bug-webkit-hash-iframe/
291// Safari: Back Button from a different domain - http://benalman.com/code/projects/jquery-hashchange/examples/bug-safari-back-from-diff-domain/
292// 
293// Also note that should a browser natively support the window.onhashchange 
294// event, but not report that it does, the fallback polling loop will be used.
295// 
296// About: Release History
297// 
298// 1.3   - (7/21/2010) Reorganized IE6/7 Iframe code to make it more
299//         "removable" for mobile-only development. Added IE6/7 document.title
300//         support. Attempted to make Iframe as hidden as possible by using
301//         techniques from http://www.paciellogroup.com/blog/?p=604. Added 
302//         support for the "shortcut" format $(window).hashchange( fn ) and
303//         $(window).hashchange() like jQuery provides for built-in events.
304//         Renamed jQuery.hashchangeDelay to <jQuery.fn.hashchange.delay> and
305//         lowered its default value to 50. Added <jQuery.fn.hashchange.domain>
306//         and <jQuery.fn.hashchange.src> properties plus document-domain.html
307//         file to address access denied issues when setting document.domain in
308//         IE6/7.
309// 1.2   - (2/11/2010) Fixed a bug where coming back to a page using this plugin
310//         from a page on another domain would cause an error in Safari 4. Also,
311//         IE6/7 Iframe is now inserted after the body (this actually works),
312//         which prevents the page from scrolling when the event is first bound.
313//         Event can also now be bound before DOM ready, but it won't be usable
314//         before then in IE6/7.
315// 1.1   - (1/21/2010) Incorporated document.documentMode test to fix IE8 bug
316//         where browser version is incorrectly reported as 8.0, despite
317//         inclusion of the X-UA-Compatible IE=EmulateIE7 meta tag.
318// 1.0   - (1/9/2010) Initial Release. Broke out the jQuery BBQ event.special
319//         window.onhashchange functionality into a separate plugin for users
320//         who want just the basic event & back button support, without all the
321//         extra awesomeness that BBQ provides. This plugin will be included as
322//         part of jQuery BBQ, but also be available separately.
323
324(function($,window,undefined){
325  '$:nomunge'; // Used by YUI compressor.
326  
327  // Reused string.
328  var str_hashchange = 'hashchange',
329    
330    // Method / object references.
331    doc = document,
332    fake_onhashchange,
333    special = $.event.special,
334    
335    // Does the browser support window.onhashchange? Note that IE8 running in
336    // IE7 compatibility mode reports true for 'onhashchange' in window, even
337    // though the event isn't supported, so also test document.documentMode.
338    doc_mode = doc.documentMode,
339    supports_onhashchange = 'on' + str_hashchange in window && ( doc_mode === undefined || doc_mode > 7 );
340  
341  // Get location.hash (or what you'd expect location.hash to be) sans any
342  // leading #. Thanks for making this necessary, Firefox!
343  function get_fragment( url ) {
344    url = url || location.href;
345    return '#' + url.replace( /^[^#]*#?(.*)$/, '$1' );
346  };
347  
348  // Method: jQuery.fn.hashchange
349  // 
350  // Bind a handler to the window.onhashchange event or trigger all bound
351  // window.onhashchange event handlers. This behavior is consistent with
352  // jQuery's built-in event handlers.
353  // 
354  // Usage:
355  // 
356  // > jQuery(window).hashchange( [ handler ] );
357  // 
358  // Arguments:
359  // 
360  //  handler - (Function) Optional handler to be bound to the hashchange
361  //    event. This is a "shortcut" for the more verbose form:
362  //    jQuery(window).bind( 'hashchange', handler ). If handler is omitted,
363  //    all bound window.onhashchange event handlers will be triggered. This
364  //    is a shortcut for the more verbose
365  //    jQuery(window).trigger( 'hashchange' ). These forms are described in
366  //    the <hashchange event> section.
367  // 
368  // Returns:
369  // 
370  //  (jQuery) The initial jQuery collection of elements.
371  
372  // Allow the "shortcut" format $(elem).hashchange( fn ) for binding and
373  // $(elem).hashchange() for triggering, like jQuery does for built-in events.
374  $.fn[ str_hashchange ] = function( fn ) {
375    return fn ? this.bind( str_hashchange, fn ) : this.trigger( str_hashchange );
376  };
377  
378  // Property: jQuery.fn.hashchange.delay
379  // 
380  // The numeric interval (in milliseconds) at which the <hashchange event>
381  // polling loop executes. Defaults to 50.
382  
383  // Property: jQuery.fn.hashchange.domain
384  // 
385  // If you're setting document.domain in your JavaScript, and you want hash
386  // history to work in IE6/7, not only must this property be set, but you must
387  // also set document.domain BEFORE jQuery is loaded into the page. This
388  // property is only applicable if you are supporting IE6/7 (or IE8 operating
389  // in "IE7 compatibility" mode).
390  // 
391  // In addition, the <jQuery.fn.hashchange.src> property must be set to the
392  // path of the included "document-domain.html" file, which can be renamed or
393  // modified if necessary (note that the document.domain specified must be the
394  // same in both your main JavaScript as well as in this file).
395  // 
396  // Usage:
397  // 
398  // jQuery.fn.hashchange.domain = document.domain;
399  
400  // Property: jQuery.fn.hashchange.src
401  // 
402  // If, for some reason, you need to specify an Iframe src file (for example,
403  // when setting document.domain as in <jQuery.fn.hashchange.domain>), you can
404  // do so using this property. Note that when using this property, history
405  // won't be recorded in IE6/7 until the Iframe src file loads. This property
406  // is only applicable if you are supporting IE6/7 (or IE8 operating in "IE7
407  // compatibility" mode).
408  // 
409  // Usage:
410  // 
411  // jQuery.fn.hashchange.src = 'path/to/file.html';
412  
413  $.fn[ str_hashchange ].delay = 50;
414  /*
415  $.fn[ str_hashchange ].domain = null;
416  $.fn[ str_hashchange ].src = null;
417  */
418  
419  // Event: hashchange event
420  // 
421  // Fired when location.hash changes. In browsers that support it, the native
422  // HTML5 window.onhashchange event is used, otherwise a polling loop is
423  // initialized, running every <jQuery.fn.hashchange.delay> milliseconds to
424  // see if the hash has changed. In IE6/7 (and IE8 operating in "IE7
425  // compatibility" mode), a hidden Iframe is created to allow the back button
426  // and hash-based history to work.
427  // 
428  // Usage as described in <jQuery.fn.hashchange>:
429  // 
430  // > // Bind an event handler.
431  // > jQuery(window).hashchange( function(e) {
432  // >   var hash = location.hash;
433  // >   ...
434  // > });
435  // > 
436  // > // Manually trigger the event handler.
437  // > jQuery(window).hashchange();
438  // 
439  // A more verbose usage that allows for event namespacing:
440  // 
441  // > // Bind an event handler.
442  // > jQuery(window).bind( 'hashchange', function(e) {
443  // >   var hash = location.hash;
444  // >   ...
445  // > });
446  // > 
447  // > // Manually trigger the event handler.
448  // > jQuery(window).trigger( 'hashchange' );
449  // 
450  // Additional Notes:
451  // 
452  // * The polling loop and Iframe are not created until at least one handler
453  //   is actually bound to the 'hashchange' event.
454  // * If you need the bound handler(s) to execute immediately, in cases where
455  //   a location.hash exists on page load, via bookmark or page refresh for
456  //   example, use jQuery(window).hashchange() or the more verbose 
457  //   jQuery(window).trigger( 'hashchange' ).
458  // * The event can be bound before DOM ready, but since it won't be usable
459  //   before then in IE6/7 (due to the necessary Iframe), recommended usage is
460  //   to bind it inside a DOM ready handler.
461  
462  // Override existing $.event.special.hashchange methods (allowing this plugin
463  // to be defined after jQuery BBQ in BBQ's source code).
464  special[ str_hashchange ] = $.extend( special[ str_hashchange ], {
465    
466    // Called only when the first 'hashchange' event is bound to window.
467    setup: function() {
468      // If window.onhashchange is supported natively, there's nothing to do..
469      if ( supports_onhashchange ) { return false; }
470      
471      // Otherwise, we need to create our own. And we don't want to call this
472      // until the user binds to the event, just in case they never do, since it
473      // will create a polling loop and possibly even a hidden Iframe.
474      $( fake_onhashchange.start );
475    },
476    
477    // Called only when the last 'hashchange' event is unbound from window.
478    teardown: function() {
479      // If window.onhashchange is supported natively, there's nothing to do..
480      if ( supports_onhashchange ) { return false; }
481      
482      // Otherwise, we need to stop ours (if possible).
483      $( fake_onhashchange.stop );
484    }
485    
486  });
487  
488  // fake_onhashchange does all the work of triggering the window.onhashchange
489  // event for browsers that don't natively support it, including creating a
490  // polling loop to watch for hash changes and in IE 6/7 creating a hidden
491  // Iframe to enable back and forward.
492  fake_onhashchange = (function(){
493    var self = {},
494      timeout_id,
495      
496      // Remember the initial hash so it doesn't get triggered immediately.
497      last_hash = get_fragment(),
498      
499      fn_retval = function(val){ return val; },
500      history_set = fn_retval,
501      history_get = fn_retval;
502    
503    // Start the polling loop.
504    self.start = function() {
505      timeout_id || poll();
506    };
507    
508    // Stop the polling loop.
509    self.stop = function() {
510      timeout_id && clearTimeout( timeout_id );
511      timeout_id = undefined;
512    };
513    
514    // This polling loop checks every $.fn.hashchange.delay milliseconds to see
515    // if location.hash has changed, and triggers the 'hashchange' event on
516    // window when necessary.
517    function poll() {
518      var hash = get_fragment(),
519        history_hash = history_get( last_hash );
520      
521      if ( hash !== last_hash ) {
522        history_set( last_hash = hash, history_hash );
523        
524        $(window).trigger( str_hashchange );
525        
526      } else if ( history_hash !== last_hash ) {
527        location.href = location.href.replace( /#.*/, '' ) + history_hash;
528      }
529      
530      timeout_id = setTimeout( poll, $.fn[ str_hashchange ].delay );
531    };
532    
533    // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
534    // vvvvvvvvvvvvvvvvvvv REMOVE IF NOT SUPPORTING IE6/7/8 vvvvvvvvvvvvvvvvvvv
535    // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
536    $.support.msie && !supports_onhashchange && (function(){
537      // Not only do IE6/7 need the "magical" Iframe treatment, but so does IE8
538      // when running in "IE7 compatibility" mode.
539      
540      var iframe,
541        iframe_src;
542      
543      // When the event is bound and polling starts in IE 6/7, create a hidden
544      // Iframe for history handling.
545      self.start = function(){
546        if ( !iframe ) {
547          iframe_src = $.fn[ str_hashchange ].src;
548          iframe_src = iframe_src && iframe_src + get_fragment();
549          
550          // Create hidden Iframe. Attempt to make Iframe as hidden as possible
551          // by using techniques from http://www.paciellogroup.com/blog/?p=604.
552          iframe = $('<iframe tabindex="-1" title="empty"/>').hide()
553            
554            // When Iframe has completely loaded, initialize the history and
555            // start polling.
556            .one( 'load', function(){
557              iframe_src || history_set( get_fragment() );
558              poll();
559            })
560            
561            // Load Iframe src if specified, otherwise nothing.
562            .attr( 'src', iframe_src || 'javascript:0' )
563            
564            // Append Iframe after the end of the body to prevent unnecessary
565            // initial page scrolling (yes, this works).
566            .insertAfter( 'body' )[0].contentWindow;
567          
568          // Whenever `document.title` changes, update the Iframe's title to
569          // prettify the back/next history menu entries. Since IE sometimes
570          // errors with "Unspecified error" the very first time this is set
571          // (yes, very useful) wrap this with a try/catch block.
572          doc.onpropertychange = function(){
573            try {
574              if ( event.propertyName === 'title' ) {
575                iframe.document.title = doc.title;
576              }
577            } catch(e) {}
578          };
579          
580        }
581      };
582      
583      // Override the "stop" method since an IE6/7 Iframe was created. Even
584      // if there are no longer any bound event handlers, the polling loop
585      // is still necessary for back/next to work at all!
586      self.stop = fn_retval;
587      
588      // Get history by looking at the hidden Iframe's location.hash.
589      history_get = function() {
590        return get_fragment( iframe.location.href );
591      };
592      
593      // Set a new history item by opening and then closing the Iframe
594      // document, *then* setting its location.hash. If document.domain has
595      // been set, update that as well.
596      history_set = function( hash, history_hash ) {
597        var iframe_doc = iframe.document,
598          domain = $.fn[ str_hashchange ].domain;
599        
600        if ( hash !== history_hash ) {
601          // Update Iframe with any initial `document.title` that might be set.
602          iframe_doc.title = doc.title;
603          
604          // Opening the Iframe's document after it has been closed is what
605          // actually adds a history entry.
606          iframe_doc.open();
607          
608          // Set document.domain for the Iframe document as well, if necessary.
609          domain && iframe_doc.write( '<script>document.domain="' + domain + '"</script>' );
610          
611          iframe_doc.close();
612          
613          // Update the Iframe's hash, for great justice.
614          iframe.location.hash = hash;
615        }
616      };
617      
618    })();
619    // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
620    // ^^^^^^^^^^^^^^^^^^^ REMOVE IF NOT SUPPORTING IE6/7/8 ^^^^^^^^^^^^^^^^^^^
621    // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
622    
623    return self;
624  })();
625  
626})(jQuery,this);
627
628/*
629== malihu jquery custom scrollbar plugin == 
630Version: 3.0.4 
631Plugin URI: http://manos.malihu.gr/jquery-custom-content-scroller 
632Author: malihu
633Author URI: http://manos.malihu.gr
634License: MIT License (MIT)
635*/
636
637/*
638Copyright 2010 Manos Malihutsakis (email: [email protected])
639
640Permission is hereby granted, free of charge, to any person obtaining a copy
641of this software and associated documentation files (the "Software"), to deal
642in the Software without restriction, including without limitation the rights
643to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
644copies of the Software, and to permit persons to whom the Software is
645furnished to do so, subject to the following conditions:
646
647The above copyright notice and this permission notice shall be included in
648all copies or substantial portions of the Software.
649
650THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
651IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
652FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
653AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
654LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
655OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
656THE SOFTWARE.
657*/
658
659/*
660The code below is fairly long, fully commented and should be normally used in development. 
661For production, use either the minified jquery.mCustomScrollbar.min.js script or 
662the production-ready jquery.mCustomScrollbar.concat.min.js which contains the plugin 
663and dependencies (minified). 
664*/
665
666;(function(window,document,undefined){
667
668  /* plugin dependencies */
669  (function(init){
670    /* support for RequireJS */
671    if(typeof define==="function" && define.amd){
672      define(["jquery", "jquery-mousewheel"], init);
673    }else{
674      var _dlp=("https:"==document.location.protocol) ? "https:" : "http:"; /* dependency location protocol */
675      /* load jquery-mousewheel plugin (via CDN) if it's not present (works when mCustomScrollbar fn is called on window load) */
676      $.event.special.mousewheel || $("head").append(decodeURI("%3Cscript src="+_dlp+"//cdnjs.cloudflare.com/ajax/libs/jquery-mousewheel/3.1.11/jquery.mousewheel.min.js%3E%3C/script%3E"));
677      init(jQuery);
678    }
679  }
680  
681  (function($){
682    
683    /* 
684    ----------------------------------------
685    PLUGIN NAMESPACE, PREFIX, DEFAULT SELECTOR(S) 
686    ----------------------------------------
687    */
688    
689    var pluginNS="mCustomScrollbar",
690      pluginPfx="mCS",
691      defaultSelector=".mCustomScrollbar",
692    
693    
694      
695    
696    
697    /* 
698    ----------------------------------------
699    DEFAULT OPTIONS 
700    ----------------------------------------
701    */
702    
703      defaults={
704        /* 
705        set element/content width programmatically 
706        values: boolean, pixels, percentage 
707        */
708        setWidth:false,
709        /* 
710        set element/content height programmatically 
711        values: boolean, pixels, percentage 
712        */
713        setHeight:false,
714        /*
715        set the initial css top property of content  
716        values: string (e.g. "-100px", "10%" etc.)
717        */
718        setTop:0,
719        /*
720        set the initial css left property of content  
721        values: string (e.g. "-100px", "10%" etc.)
722        */
723        setLeft:0,
724        /* 
725        scrollbar axis (vertical and/or horizontal scrollbars) 
726        values (string): "y", "x", "yx"
727        */
728        axis:"y",
729        /*
730        position of scrollbar relative to content  
731        values (string): "inside", "outside" ("outside" requires elements with position:relative)
732        */
733        scrollbarPosition:"inside",
734        /*
735        scrolling inertia
736        values: integer (milliseconds)
737        */
738        scrollInertia:950,
739        /* 
740        auto-adjust scrollbar dragger length
741        values: boolean
742        */
743        autoDraggerLength:true,
744        /*
745        auto-hide scrollbar when idle 
746        values: boolean
747        */
748        autoHideScrollbar:false,
749        /*
750        auto-expands scrollbar on mouse-over and dragging
751        */
752        autoExpandScrollbar:false,
753        /*
754        always show scrollbar, even when there's nothing to scroll 
755        values: integer (0=disable, 1=always show dragger rail, 2=always show dragger rail, dragger and buttons), boolean
756        */
757        alwaysShowScrollbar:0,
758        /*
759        scrolling always snaps to a multiple of this number in pixels
760        values: integer
761        */
762        snapAmount:null,
763        /*
764        when snapping, snap with this number in pixels as an offset 
765        values: integer
766        */
767        snapOffset:0,
768        /* 
769        mouse-wheel scrolling
770        */
771        mouseWheel:{
772          /* 
773          enable mouse-wheel scrolling
774          values: boolean
775          */
776          enable:true,
777          /* 
778          scrolling amount in pixels
779          values: "auto", integer 
780          */
781          scrollAmount:"auto",
782          /* 
783          mouse-wheel scrolling axis 
784          the default scrolling direction when both vertical and horizontal scrollbars are present 
785          values (string): "y", "x" 
786          */
787          axis:"y",
788          /* 
789          prevent the default behaviour which automatically scrolls the parent element
789(s) 
790          when end of scrolling is reached 
791          values: boolean
792          */
793          preventDefault:false,
794          /*
795          the reported mouse-wheel delta value. The number of lines (translated to pixels) one wheel notch scrolls.  
796          values: "auto", integer 
797          "auto" uses the default OS/browser value 
798          */
799          deltaFactor:"auto",
800          /*
801          normalize mouse-wheel delta to -1 or 1 (disables mouse-wheel acceleration) 
802          values: boolean
803          */
804          normalizeDelta:false,
805          /*
806          invert mouse-wheel scrolling direction 
807          values: boolean
808          */
809          invert:false,
810          /*
811          the tags that disable mouse-wheel when cursor is over them
812          */
813          disableOver:["select","option","keygen","datalist","textarea"]
814        },
815        /* 
816        scrollbar buttons
817        */
818        scrollButtons:{ 
819          /*
820          enable scrollbar buttons
821          values: boolean
822          */
823          enable:false,
824          /*
825          scrollbar buttons scrolling type 
826          values (string): "stepless", "stepped"
827          */
828          scrollType:"stepless",
829          /*
830          scrolling amount in pixels
831          values: "auto", integer 
832          */
833          scrollAmount:"auto"
834        },
835        /* 
836        keyboard scrolling
837        */
838        keyboard:{ 
839          /*
840          enable scrolling via keyboard
841          values: boolean
842          */
843          enable:true,
844          /*
845          keyboard scrolling type 
846          values (string): "stepless", "stepped"
847          */
848          scrollType:"stepless",
849          /*
850          scrolling amount in pixels
851          values: "auto", integer 
852          */
853          scrollAmount:"auto"
854        },
855        /*
856        enable content touch-swipe scrolling 
857        values: boolean, integer, string (number)
858        integer values define the axis-specific minimum amount required for scrolling momentum
859        */
860        contentTouchScroll:25,
861        /*
862        advanced option parameters
863        */
864        advanced:{
865          /*
866          auto-expand content horizontally (for "x" or "yx" axis) 
867          values: boolean
868          */
869          autoExpandHorizontalScroll:false,
870          /*
871          auto-scroll to elements with focus
872          */
873          autoScrollOnFocus:"input,textarea,select,button,datalist,keygen,a[tabindex],area,object,[contenteditable='true']",
874          /*
875          auto-update scrollbars on content, element or viewport resize 
876          should be true for fluid layouts/elements, adding/removing content dynamically, hiding/showing elements, content with images etc. 
877          values: boolean
878          */
879          updateOnContentResize:true,
880          /*
881          auto-update scrollbars each time each image inside the element is fully loaded 
882          values: boolean
883          */
884          updateOnImageLoad:true,
885          /*
886          auto-update scrollbars based on the amount and size changes of specific selectors 
887          useful when you need to update the scrollbar(s) automatically, each time a type of element is added, removed or changes its size 
888          values: boolean, string (e.g. "ul li" will auto-update scrollbars each time list-items inside the element are changed) 
889          a value of true (boolean) will auto-update scrollbars each time any element is changed
890          */
891          updateOnSelectorChange:false
892        },
893        /* 
894        scrollbar theme 
895        values: string 
896        ready-to-use themes: "light", "dark", "light-2", "dark-2", "light-3", "dark-3", "light-thick", "dark-thick", "light-thin", "dark-thin", 
897        "rounded", "rounded-dark", "rounded-dots", "rounded-dots-dark", "3d", "3d-dark", "3d-thick", "3d-thick-dark", "minimal", "minimal-dark", 
898        "inset", "inset-dark", "inset-2", "inset-2-dark", "inset-3", "inset-3-dark"
899        */
900        theme:"light",
901        /*
902        user defined callback functions
903        */
904        callbacks:{
905          /*
906          function to call when a scroll event starts 
907          values (function): function(){}
908          */
909          onScrollStart:false,
910          /*
911          function to call when a scroll event is complete 
912          values (function): function(){}
913          */
914          onScroll:false,
915          /*
916          function to call when a scroll event is complete and content is scrolled all the way to the end (bottom/right)
917          values (function): function(){}
918          */
919          onTotalScroll:false,
920          /*
921          function to call when a scroll event is complete and content is scrolled back to the beginning (top/left)
922          values (function): function(){}
923          */
924          onTotalScrollBack:false,
925          /*
926          function to call when a scroll event is running 
927          values (function): function(){}
928          */
929          whileScrolling:false,
930          /*
931          onTotalScroll offset value
932          values: integer (pixels)
933          */
934          onTotalScrollOffset:0,
935          /*
936          onTotalScrollBack offset value
937          values: integer (pixels)
938          */
939          onTotalScrollBackOffset:0,
940          /*
941          callback offsets will trigger even if content is already scrolled to the end or beginning
942          values: boolean
943          */
944          alwaysTriggerOffsets:true,
945          /*
946          function to call when content becomes long enough and vertical scrollbar is added
947          values (function): function(){}
948          */
949          onOverflowY:false,
950          /*
951          function to call when content becomes wide enough and horizontal scrollbar is added
952          values (function): function(){}
953          */
954          onOverflowX:false,
955          /*
956          function to call when content becomes short enough and vertical scrollbar is removed
957          values (function): function(){}
958          */
959          onOverflowYNone:false,
960          /*
961          function to call when content becomes narrow enough and horizontal scrollbar is removed
962          values (function): function(){}
963          */
964          onOverflowXNone:false
965        },
966        /*
967        add scrollbar(s) on all elements matching the current selector, now and in the future 
968        values: boolean, string 
969        string values: "on" (enable), "once" (disable after first invocation), "off" (disable)
970        */
971        live:false,
972        /*
973        the matching set of elements (instead of the current selector) to add scrollbar(s), now and in the future
974        values: string (selector)
975        */
976        liveSelector:null
977      },
978    
979    
980    
981    
982    
983    /* 
984    ----------------------------------------
985    VARS, CONSTANTS 
986    ----------------------------------------
987    */
988    
989      totalInstances=0, /* plugin instances amount */
990      liveTimers={}, /* live option timers */
991      /* live option timers removal */
992      removeLiveTimers=function(selector){
993        if(liveTimers[selector]){
994          clearTimeout(liveTimers[selector]);
995          functions._delete.call(null,liveTimers[selector]);
996        }
997      },
998      oldIE=(window.attachEvent && !window.addEventListener) ? 1 : 0, /* detect IE < 9 */
999      touchActive=false, /* global touch state (for touch and pointer events) */
1000      
1001    
1002    
1003    
1004    
1005    /* 
1006    ----------------------------------------
1007    METHODS 
1008    ----------------------------------------
1009    */
1010    
1011      methods={
1012        
1013        /* 
1014        plugin initialization method 
1015        creates the scrollbar(s), plugin data object and options
1016        ----------------------------------------
1017        */
1018        
1019        init:function(options){
1020          
1021          var options=$.extend(true,{},defaults,options),
1022            selector=functions._selector.call(this); /* validate selector */
1023          
1024          /* 
1025          if live option is enabled, monitor for elements matching the current selector and 
1026          apply scrollbar(s) when found (now and in the future) 
1027          */
1028          if(options.live){
1029            var liveSelector=options.liveSelector || this.selector || defaultSelector, /* live selector(s) */
1030              $liveSelector=$(liveSelector); /* live selector(s) as jquery object */
1031            if(options.live==="off"){
1032              /* 
1033              disable live if requested 
1034              usage: $(selector).mCustomScrollbar({live:"off"}); 
1035              */
1036              removeLiveTimers(liveSelector);
1037              return;
1038            }
1039            liveTimers[liveSelector]=setTimeout(function(){
1040              /* call mCustomScrollbar fn on live selector(s) every half-second */
1041              $liveSelector.mCustomScrollbar(options);
1042              if(options.live==="once" && $liveSelector.length){
1043                /* disable live after first invocation */
1044                removeLiveTimers(liveSelector);
1045              }
1046            },500);
1047          }else{
1048            removeLiveTimers(liveSelector);
1049          }
1050          
1051          /* options backward compatibility (for versions < 3.0.0) and normalization */
1052          options.setWidth=(options.set_width) ? options.set_width : options.setWidth;
1053          options.setHeight=(options.set_height) ? options.set_height : options.setHeight;
1054          options.axis=(options.horizontalScroll) ? "x" : functions._findAxis.call(null,options.axis);
1055          options.scrollInertia=options.scrollInertia>0 && options.scrollInertia<17 ? 17 : options.scrollInertia;
1056          if(typeof options.mouseWheel!=="object" &&  options.mouseWheel==true){ /* old school mouseWheel option (non-object) */
1057            options.mouseWheel={enable:true,scrollAmount:"auto",axis:"y",preventDefault:false,deltaFactor:"auto",normalizeDelta:false,invert:false}
1058          }
1059          options.mouseWheel.scrollAmount=!options.mouseWheelPixels ? options.mouseWheel.scrollAmount : options.mouseWheelPixels;
1060          options.mouseWheel.normalizeDelta=!options.advanced.normalizeMouseWheelDelta ? options.mouseWheel.normalizeDelta : options.advanced.normalizeMouseWheelDelta;
1061          options.scrollButtons.scrollType=functions._findScrollButtonsType.call(null,options.scrollButtons.scrollType); 
1062          
1063          functions._theme.call(null,options); /* theme-specific options */
1064          
1065          /* plugin constructor */
1066          return $(selector).each(function(){
1067            
1068            var $this=$(this);
1069            
1070            if(!$this.data(pluginPfx)){ /* prevent multiple instantiations */
1071            
1072              /* store options and create objects in jquery data */
1073              $this.data(pluginPfx,{
1074                idx:++totalInstances, /* instance index */
1075                opt:options, /* options */
1076                scrollRatio:{y:null,x:null}, /* scrollbar to content ratio */
1077                overflowed:null, /* overflowed axis */
1078                contentReset:{y:null,x:null}, /* object to check when content resets */
1079                bindEvents:false, /* object to check if events are bound */
1080                tweenRunning:false, /* object to check if tween is running */
1081                sequential:{}, /* sequential scrolling object */
1082                langDir:$this.css("direction"), /* detect/store direction (ltr or rtl) */
1083                cbOffsets:null, /* object to check whether callback offsets always trigger */
1084                /* 
1085                object to check how scrolling events where last triggered 
1086                "internal" (default - triggered by this script), "external" (triggered by other scripts, e.g. via scrollTo method) 
1087                usage: object.data("mCS").trigger
1088                */
1089                trigger:null
1090              });
1091              
1092              /* HTML data attributes */
1093              var o=$this.data(pluginPfx).opt,
1094                htmlDataAxis=$this.data("mcs-axis"),htmlDataSbPos=$this.data("mcs-scrollbar-position"),htmlDataTheme=$this.data("mcs-theme");
1095              if(htmlDataAxis){o.axis=htmlDataAxis;} /* usage example: data-mcs-axis="y" */
1096              if(htmlDataSbPos){o.scrollbarPosition=htmlDataSbPos;} /* usage example: data-mcs-scrollbar-position="outside" */
1097              if(htmlDataTheme){ /* usage example: data-mcs-theme="minimal" */
1098                o.theme=htmlDataTheme;
1099                functions._theme.call(null,o); /* theme-specific options */
1100              }
1101              
1102              functions._pluginMarkup.call(this); /* add plugin markup */
1103              
1104              methods.update.call(null,$this); /* call the update method */
1105            
1106            }
1107            
1108          });
1109          
1110        },
1111        /* ---------------------------------------- */
1112        
1113        
1114        
1115        /* 
1116        plugin update method 
1117        updates content and scrollbar(s) values, events and status 
1118        ----------------------------------------
1119        usage: $(selector).mCustomScrollbar("update");
1120        */
1121        
1122        update:function(el){
1123          
1124          var selector=el || functions._selector.call(this); /* validate selector */
1125          
1126          return $(selector).each(function(){
1127            
1128            var $this=$(this);
1129            
1130            if($this.data(pluginPfx)){ /* check if plugin has initialized */
1131              
1132              var d=$this.data(pluginPfx),o=d.opt,
1133                mCSB_container=$("#mCSB_"+d.idx+"_container"),
1134                mCSB_dragger=[$("#mCSB_"+d.idx+"_dragger_vertical"),$("#mCSB_"+d.idx+"_dragger_horizontal")];
1135              
1136              if(!mCSB_container.length){return;}
1137              
1138              if(d.tweenRunning){functions._stop.call(null,$this);} /* stop any running tweens while updating */
1139              
1140              /* if element was disabled or destroyed, remove class(es) */
1141              if($this.hasClass("mCS_disabled")){$this.removeClass("mCS_disabled");}
1142              if($this.hasClass("mCS_destroyed")){$this.removeClass("mCS_destroyed");}
1143              
1144              functions._maxHeight.call(this); /* detect/set css max-height value */
1145              
1146              functions._expandContentHorizontally.call(this); /* expand content horizontally */
1147              
1148              if(o.axis!=="y" && !o.advanced.autoExpandHorizontalScroll){
1149                mCSB_container.css("width",functions._contentWidth(mCSB_container.children()));
1150              }
1151              
1152              d.overflowed=functions._overflowed.call(this); /* determine if scrolling is required */
1153              
1154              functions._scrollbarVisibility.call(this); /* show/hide scrollbar(s) */
1155              
1156              /* auto-adjust scrollbar dragger length analogous to content */
1157              if(o.autoDraggerLength){functions._setDraggerLength.call(this);}
1158              
1159              functions._scrollRatio.call(this); /* calculate and store scrollbar to content ratio */
1160              
1161              functions._bindEvents.call(this); /* bind scrollbar events */
1162              
1163              /* reset scrolling position and/or events */
1164              var to=[Math.abs(mCSB_container[0].offsetTop),Math.abs(mCSB_container[0].offsetLeft)];
1165              if(o.axis!=="x"){ /* y/yx axis */
1166                if(!d.overflowed[0]){ /* y scrolling is not required */
1167                  functions._resetContentPosition.call(this); /* reset content position */
1168                  if(o.axis==="y"){
1169                    functions._unbindEvents.call(this);
1170                  }else if(o.axis==="yx" && d.overflowed[1]){
1171                    functions._scrollTo.call(this,$this,to[1].toString(),{dir:"x",dur:0,overwrite:"none"});
1172                  }
1173                }else if(mCSB_dragger[0].height()>mCSB_dragger[0].parent().height()){
1174                  functions._resetContentPosition.call(this); /* reset content position */
1175                }
1175else{ /* y scrolling is required */
1176                  functions._scrollTo.call(this,$this,to[0].toString(),{dir:"y",dur:0,overwrite:"none"});
1177                  d.contentReset.y=null;
1178                }
1179              }
1180              if(o.axis!=="y"){ /* x/yx axis */
1181                if(!d.overflowed[1]){ /* x scrolling is not required */
1182                  functions._resetContentPosition.call(this); /* reset content position */
1183                  if(o.axis==="x"){
1184                    functions._unbindEvents.call(this);
1185                  }else if(o.axis==="yx" && d.overflowed[0]){
1186                    functions._scrollTo.call(this,$this,to[0].toString(),{dir:"y",dur:0,overwrite:"none"});
1187                  }
1188                }else if(mCSB_dragger[1].width()>mCSB_dragger[1].parent().width()){
1189                  functions._resetContentPosition.call(this); /* reset content position */
1190                }else{ /* x scrolling is required */
1191                  functions._scrollTo.call(this,$this,to[1].toString(),{dir:"x",dur:0,overwrite:"none"});
1192                  d.contentReset.x=null;
1193                }
1194              }
1195              
1196              functions._autoUpdate.call(this); /* initialize automatic updating (for dynamic content, fluid layouts etc.) */
1197              
1198            }
1199            
1200          });
1201          
1202        },
1203        /* ---------------------------------------- */
1204        
1205        
1206        
1207        /* 
1208        plugin scrollTo method 
1209        triggers a scrolling event to a specific value
1210        ----------------------------------------
1211        usage: $(selector).mCustomScrollbar("scrollTo",value,options);
1212        */
1213      
1214        scrollTo:function(val,options){
1215          
1216          /* prevent silly things like $(selector).mCustomScrollbar("scrollTo",undefined); */
1217          if(typeof val=="undefined" || val==null){return;}
1218          
1219          var selector=functions._selector.call(this); /* validate selector */
1220          
1221          return $(selector).each(function(){
1222            
1223            var $this=$(this);
1224            
1225            if($this.data(pluginPfx)){ /* check if plugin has initialized */
1226            
1227              var d=$this.data(pluginPfx),o=d.opt,
1228                /* method default options */
1229                methodDefaults={
1230                  trigger:"external", /* method is by default triggered externally (e.g. from other scripts) */
1231                  scrollInertia:o.scrollInertia, /* scrolling inertia (animation duration) */
1232                  scrollEasing:"mcsEaseInOut", /* animation easing */
1233                  moveDragger:false, /* move dragger instead of content */
1234                  timeout:60, /* scroll-to delay */
1235                  callbacks:true, /* enable/disable callbacks */
1236                  onStart:true,
1237                  onUpdate:true,
1238                  onComplete:true
1239                },
1240                methodOptions=$.extend(true,{},methodDefaults,options),
1241                to=functions._arr.call(this,val),dur=methodOptions.scrollInertia>0 && methodOptions.scrollInertia<17 ? 17 : methodOptions.scrollInertia;
1242              
1243              /* translate yx values to actual scroll-to positions */
1244              to[0]=functions._to.call(this,to[0],"y");
1245              to[1]=functions._to.call(this,to[1],"x");
1246              
1247              /* 
1248              check if scroll-to value moves the dragger instead of content. 
1249              Only pixel values apply on dragger (e.g. 100, "100px", "-=100" etc.) 
1250              */
1251              if(methodOptions.moveDragger){
1252                to[0]*=d.scrollRatio.y;
1253                to[1]*=d.scrollRatio.x;
1254              }
1255              
1256              methodOptions.dur=dur;
1257              
1258              setTimeout(function(){ 
1259                /* do the scrolling */
1260                if(to[0]!==null && typeof to[0]!=="undefined" && o.axis!=="x" && d.overflowed[0]){ /* scroll y */
1261                  methodOptions.dir="y";
1262                  methodOptions.overwrite="all";
1263                  functions._scrollTo.call(this,$this,to[0].toString(),methodOptions);
1264                }
1265                if(to[1]!==null && typeof to[1]!=="undefined" && o.axis!=="y" && d.overflowed[1]){ /* scroll x */
1266                  methodOptions.dir="x";
1267                  methodOptions.overwrite="none";
1268                  functions._scrollTo.call(this,$this,to[1].toString(),methodOptions);
1269                }
1270              },methodOptions.timeout);
1271              
1272            }
1273            
1274          });
1275          
1276        },
1277        /* ---------------------------------------- */
1278        
1279        
1280        
1281        /*
1282        plugin stop method 
1283        stops scrolling animation
1284        ----------------------------------------
1285        usage: $(selector).mCustomScrollbar("stop");
1286        */
1287        stop:function(){
1288          
1289          var selector=functions._selector.call(this); /* validate selector */
1290          
1291          return $(selector).each(function(){
1292            
1293            var $this=$(this);
1294            
1295            if($this.data(pluginPfx)){ /* check if plugin has initialized */
1296                      
1297              functions._stop.call(null,$this);
1298            
1299            }
1300            
1301          });
1302          
1303        },
1304        /* ---------------------------------------- */
1305        
1306        
1307        
1308        /*
1309        plugin disable method 
1310        temporarily disables the scrollbar(s) 
1311        ----------------------------------------
1312        usage: $(selector).mCustomScrollbar("disable",reset); 
1313        reset (boolean): resets content position to 0 
1314        */
1315        disable:function(r){
1316          
1317          var selector=functions._selector.call(this); /* validate selector */
1318          
1319          return $(selector).each(function(){
1320            
1321            var $this=$(this);
1322            
1323            if($this.data(pluginPfx)){ /* check if plugin has initialized */
1324              
1325              var d=$this.data(pluginPfx),o=d.opt;
1326              
1327              functions._autoUpdate.call(this,"remove"); /* remove automatic updating */
1328              
1329              functions._unbindEvents.call(this); /* unbind events */
1330              
1331              if(r){functions._resetContentPosition.call(this);} /* reset content position */
1332              
1333              functions._scrollbarVisibility.call(this,true); /* show/hide scrollbar(s) */
1334              
1335              $this.addClass("mCS_disabled"); /* add disable class */
1336            
1337            }
1338            
1339          });
1340          
1341        },
1342        /* ---------------------------------------- */
1343        
1344        
1345        
1346        /*
1347        plugin destroy method 
1348        completely removes the scrollbar(s) and returns the element to its original state
1349        ----------------------------------------
1350        usage: $(selector).mCustomScrollbar("destroy"); 
1351        */
1352        destroy:function(){
1353          
1354          var selector=functions._selector.call(this); /* validate selector */
1355          
1356          return $(selector).each(function(){
1357            
1358            var $this=$(this);
1359            
1360            if($this.data(pluginPfx)){ /* check if plugin has initialized */
1361            
1362              var d=$this.data(pluginPfx),o=d.opt,
1363                mCustomScrollBox=$("#mCSB_"+d.idx),
1364                mCSB_container=$("#mCSB_"+d.idx+"_container"),
1365                scrollbar=$(".mCSB_"+d.idx+"_scrollbar");
1366            
1367              if(o.live){removeLiveTimers(selector);} /* remove live timer */
1368              
1369              functions._autoUpdate.call(this,"remove"); /* remove automatic updating */
1370              
1371              functions._unbindEvents.call(this); /* unbind events */
1372              
1373              functions._resetContentPosition.call(this); /* reset content position */
1374              
1375              $this.removeData(pluginPfx); /* remove plugin data object */
1376              
1377              functions._delete.call(null,this.mcs); /* delete callbacks object */
1378              
1379              /* remove plugin markup */
1380              scrollbar.remove(); /* remove scrollbar(s) first (those can be either inside or outside plugin's inner wrapper) */
1381              mCustomScrollBox.replaceWith(mCSB_container.contents()); /* replace plugin's inner wrapper with the original content */
1382              /* remove plugin classes from the element and add destroy class */
1383              $this.removeClass(pluginNS+" _"+pluginPfx+"_"+d.idx+" m
1383CS-autoHide mCS-dir-rtl mCS_no_scrollbar mCS_disabled").addClass("mCS_destroyed");
1384            
1385            }
1386            
1387          });
1388          
1389        }
1390        /* ---------------------------------------- */
1391        
1392      },
1393    
1394    
1395    
1396    
1397      
1398    /* 
1399    ----------------------------------------
1400    FUNCTIONS
1401    ----------------------------------------
1402    */
1403    
1404      functions={
1405        
1406        /* validates selector (if selector is invalid or undefined uses the default one) */
1407        _selector:function(){
1408          return (typeof $(this)!=="object" || $(this).length<1) ? defaultSelector : this;
1409        },
1410        /* -------------------- */
1411        
1412        /* changes options according to theme */
1413        _theme:function(obj){
1414          var fixedSizeScrollbarThemes=["rounded","rounded-dark","rounded-dots","rounded-dots-dark"],
1415            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"],
1416            disabledScrollButtonsThemes=["minimal","minimal-dark"],
1417            enabledAutoHideScrollbarThemes=["minimal","minimal-dark"],
1418            scrollbarPositionOutsideThemes=["minimal","minimal-dark"];
1419          obj.autoDraggerLength=$.inArray(obj.theme,fixedSizeScrollbarThemes) > -1 ? false : obj.autoDraggerLength;
1420          obj.autoExpandScrollbar=$.inArray(obj.theme,nonExpandedScrollbarThemes) > -1 ? false : obj.autoExpandScrollbar;
1421          obj.scrollButtons.enable=$.inArray(obj.theme,disabledScrollButtonsThemes) > -1 ? false : obj.scrollButtons.enable;
1422          obj.autoHideScrollbar=$.inArray(obj.theme,enabledAutoHideScrollbarThemes) > -1 ? true : obj.autoHideScrollbar;
1423          obj.scrollbarPosition=$.inArray(obj.theme,scrollbarPositionOutsideThemes) > -1 ? "outside" : obj.scrollbarPosition;
1424        },
1425        /* -------------------- */
1426        
1427        
1428        /* normalizes axis option to valid values: "y", "x", "yx" */
1429        _findAxis:function(val){
1430          return (val==="yx" || val==="xy" || val==="auto") ? "yx" : (val==="x" || val==="horizontal") ? "x" : "y";
1431        },
1432        /* -------------------- */
1433        
1434        
1435        /* normalizes scrollButtons.scrollType option to valid values: "stepless", "stepped" */
1436        _findScrollButtonsType:function(val){
1437          return (val==="stepped" || val==="pixels" || val==="step" || val==="click") ? "stepped" : "stepless";
1438        },
1439        /* -------------------- */
1440        
1441        
1442        /* generates plugin markup */
1443        _pluginMarkup:function(){
1444          var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
1445            expandClass=o.autoExpandScrollbar ? " mCSB_scrollTools_onDrag_expand" : "",
1446            scrollbar=["<div id='mCSB_"+d.idx+"_scrollbar_vertical' class='mCSB_scrollTools mCSB_"+d.idx+"_scrollbar mCS-"+o.theme+" mCSB_scrollTools_vertical"+expandClass+"'><div class='mCSB_draggerContainer'><div id='mCSB_"+d.idx+"_dragger_vertical' class='mCSB_dragger' style='position:absolute;' oncontextmenu='return false;'><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='mCSB_draggerContainer'><div id='mCSB_"+d.idx+"_dragger_horizontal' class='mCSB_dragger' style='position:absolute;' oncontextmenu='return false;'><div class='mCSB_dragger_bar' /></div><div class='mCSB_draggerRail' /></div></div>"],
1447            wrapperClass=o.axis==="yx" ? "mCSB_vertical_horizontal" : o.axis==="x" ? "mCSB_horizontal" : "mCSB_vertical",
1448            scrollbars=o.axis==="yx" ? scrollbar[0]+scrollbar[1] : o.axis==="x" ? scrollbar[1] : scrollbar[0],
1449            contentWrapper=o.axis==="yx" ? "<div id='mCSB_"+d.idx+"_container_wrapper' class='mCSB_container_wrapper' />" : "",
1450            autoHideClass=o.autoHideScrollbar ? " mCS-autoHide" : "",
1451            scrollbarDirClass=(o.axis!=="x" && d.langDir==="rtl") ? " mCS-dir-rtl" : "";
1452          if(o.setWidth){$this.css("width",o.setWidth);} /* set element width */
1453          if(o.setHeight){$this.css("height",o.setHeight);} /* set element height */
1454          o.setLeft=(o.axis!=="y" && d.langDir==="rtl") ? "989999px" : o.setLeft; /* adjust left position for rtl direction */
1455          $this.addClass(pluginNS+" _"+pluginPfx+"_"+d.idx+autoHideClass+scrollbarDirClass).wrapInner("<div id='m
1455CSB_"+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>");
1456          var mCustomScrollBox=$("#mCSB_"+d.idx),
1457            mCSB_container=$("#mCSB_"+d.idx+"_container");
1458          if(o.axis!=="y" && !o.advanced.autoExpandHorizontalScroll){
1459            mCSB_container.css("width",functions._contentWidth(mCSB_container.children()));
1460          }
1461          if(o.scrollbarPosition==="outside"){
1462            if($this.css("position")==="static"){ /* requires elements with non-static position */
1463              $this.css("position","relative");
1464            }
1465            $this.css("overflow","visible");
1466            mCustomScrollBox.addClass("mCSB_outside").after(scrollbars);
1467          }else{
1468            mCustomScrollBox.addClass("mCSB_inside").append(scrollbars);
1469            mCSB_container.wrap(contentWrapper);
1470          }
1471          functions._scrollButtons.call(this); /* add scrollbar buttons */
1472          /* minimum dragger length */
1473          var mCSB_dragger=[$("#mCSB_"+d.idx+"_dragger_vertical"),$("#mCSB_"+d.idx+"_dragger_horizontal")];
1474          mCSB_dragger[0].css("min-height",mCSB_dragger[0].height());
1475          mCSB_dragger[1].css("min-width",mCSB_dragger[1].width());
1476        },
1477        /* -------------------- */
1478        
1479        
1480        /* calculates content width */
1481        _contentWidth:function(el){
1482          return Math.max.apply(Math,el.map(function(){return $(this).outerWidth(true);}).get());
1483        },
1484        /* -------------------- */
1485        
1486        
1487        /* expands content horizontally */
1488        _expandContentHorizontally:function(){
1489          var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
1490            mCSB_container=$("#mCSB_"+d.idx+"_container");
1491          if(o.advanced.autoExpandHorizontalScroll && o.axis!=="y"){
1492            /* 
1493            wrap content with an infinite width div and set its position to absolute and width to auto. 
1494            Setting width to auto before calculating the actual width is important! 
1495            We must let the browser set the width as browser zoom values are impossible to calculate.
1496            */
1497            mCSB_container.css({"position":"absolute","width":"auto"})
1498              .wrap("<div class='mCSB_h_wrapper' style='position:relative; left:0; width:999999px;' />")
1499              .css({ /* set actual width, original position and un-wrap */
1500                /* 
1501                get the exact width (with decimals) and then round-up. 
1502                Using jquery outerWidth() will round the width value which will mess up with inner elements that have non-integer width
1503                */
1504                "width":(Math.ceil(mCSB_container[0].getBoundingClientRect().right+0.4)-Math.floor(mCSB_container[0].getBoundingClientRect().left)),
1505                "position":"relative"
1506              }).unwrap();
1507          }
1508        },
1509        /* -------------------- */
1510        
1511        
1512        /* adds scrollbar buttons */
1513        _scrollButtons:function(){
1514          var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
1515            mCSB_scrollTools=$(".mCSB_"+d.idx+"_scrollbar:first"),
1516            btnHTML=[
1517              "<a href='#' class='mCSB_buttonUp' oncontextmenu='return false;' />","<a href='#' class='mCSB_buttonDown' oncontextmenu='return false;' />",
1518              "<a href='#' class='mCSB_buttonLeft' oncontextmenu='return false;' />","<a href='#' class='mCSB_buttonRight' oncontextmenu='return false;' />"
1519            ],
1520            btn=[(o.axis==="x" ? btnHTML[2] : btnHTML[0]),(o.axis==="x" ? btnHTML[3] : btnHTML[1]),btnHTML[2],btnHTML[3]];
1521          if(o.scrollButtons.enable){
1522            mCSB_scrollTools.prepend(btn[0]).append(btn[1]).next(".mCSB_scrollTools").prepend(btn[2]).append(btn[3]);
1523          }
1524        },
1525        /* -------------------- */
1526        
1527        
1528        /* detects/sets css max-height value */
1529        _maxHeight:function(){
1530          var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
1531            mCustomScrollBox=$("#mCSB_"+d.idx),
1532            mh=$this.css("max-height"),pct=mh.indexOf("%")!==-1,
1533            bs=$this.css("box-sizing");
1534          if(mh!=="none"){
1535            var val=pct ? $this.parent().height()*parseInt(mh)/100 : parseInt(mh);
1536            /* if element's css box-sizing is "border-box", subtract any paddings and/or borders from max-height value */
1537            if(bs==="border-box"){val-=(($this.innerHeight()-$this.height())+($this.outerHeight()-$this.innerHeight()));}
1538            mCustomScrollBox.css("max-height",Math.round(val));
1539          }
1540        },
1541        /* -------------------- */
1542        
1543        
1544        /* auto-adjusts scrollbar dragger length */
1545        _setDraggerLength:function(){
1546          var $this=$(this),d=$this.data(pluginPfx),
1547            mCustomScrollBox=$("#mCSB_"+d.idx),
1548            mCSB_container=$("#mCSB_"+d.idx+"_container"),
1549            mCSB_dragger=[$("#mCSB_"+d.idx+"_dragger_vertical"),$("#mCSB_"+d.idx+"_dragger_horizontal")],
1550            ratio=[mCustomScrollBox.height()/mCSB_container.outerHeight(false),mCustomScrollBox.width()/mCSB_container.outerWidth(false)],
1551            l=[
1552              parseInt(mCSB_dragger[0].css("min-height")),Math.round(ratio[0]*mCSB_dragger[0].parent().height()),
1553              parseInt(mCSB_dragger[1].css("min-width")),Math.round(ratio[1]*mCSB_dragger[1].parent().width())
1554            ],
1555            h=oldIE && (l[1]<l[0]) ? l[0] : l[1],w=oldIE && (l[3]<l[2]) ? l[2] : l[3];
1556          mCSB_dragger[0].css({
1557            "height":h,"max-height":(mCSB_dragger[0].parent().height()-10)
1558          }).find(".mCSB_dragger_bar").css({"line-height":l[0]+"px"});
1559          mCSB_dragger[1].css({
1560            "width":w,"max-width":(mCSB_dragger[1].parent().width()-10)
1561          });
1562        },
1563        /* -------------------- */
1564        
1565        
1566        /* calculates scrollbar to content ratio */
1567        _scrollRatio:function(){
1568          var $this=$(this),d=$this.data(pluginPfx),
1569            mCustomScrollBox=$("#mCSB_"+d.idx),
1570            mCSB_container=$("#mCSB_"+d.idx+"_container"),
1571            mCSB_dragger=[$("#mCSB_"+d.idx+"_dragger_vertical"),$("#mCSB_"+d.idx+"_dragger_horizontal")],
1572            scrollAmount=[mCSB_container.outerHeight(false)-mCustomScrollBox.height(),mCSB_container.outerWidth(false)-mCustomScrollBox.width()],
1573            ratio=[
1574              scrollAmount[0]/(mCSB_dragger[0].parent().height()-mCSB_dragger[0].height()),
1575              scrollAmount[1]/(mCSB_dragger[1].parent().width()-mCSB_dragger[1].width())
1576            ];
1577          d.scrollRatio={y:ratio[0],x:ratio[1]};
1578        },
1579        /* -------------------- */
1580        
1581        
1582        /* toggles scrolling classes */
1583        _onDragClasses:function(el,action,xpnd){
1584          var expandClass=xpnd ? "mCSB_dragger_onDrag_expanded" : "",classes=["mCSB_dragger_onDrag","mCSB_scrollTools_onDrag"],
1585            scrollbar=el.closest(".mCSB_scrollTools");
1586          if(action==="active"){
1587            el.toggleClass(classes[0]+" "+expandClass); scrollbar.toggleClass(classes[1]); 
1588            el[0]._draggable=el[0]._draggable ? 0 : 1;
1589          }else{
1590            if(!el[0]._draggable){
1591              if(action==="hide"){
1592                el.removeClass(classes[0]); scrollbar.removeClass(classes[1]);
1593              }else{
1594                el.addClass(classes[0]); scrollbar.addClass(classes[1]);
1595              }
1596            }
1597          }
1598        },
1599        /* -------------------- */
1600        
1601        
1602        /* checks if content overflows its container to determine if scrolling is required */
1603        _overflowed:function(){
1604          var $this=$(this),d=$this.data(pluginPfx),
1605            mCustomScrollBox=$("#mCSB_"+d.idx),
1606            mCSB_container=$("#mCSB_"+d.idx+"_container"),
1607            contentHeight=d.overflowed==null ? mCSB_container.height() : mCSB_container.outerHeight(false),
1608            contentWidth=d.overflowed==null ? mCSB_container.width() : mCSB_container.outerWidth(false);
1609          return [contentHeight>mCustomScrollBox.height(),contentWidth>mCustomScrollBox.width()];
1610        },
1611        /* -------------------- */
1612        
1613        
1614        /* resets content position to 0 */
1615        _resetContentPosition:function(){
1616          var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
1617            mCustomScrollBox=$("#mCSB_"+d.idx),
1618            mCSB_container=$("#mCSB_"+d.idx+"_container"),
1619            mCSB_dragger=[$("#mCSB_"+d.idx+"_dragger_vertical"),$("#mCSB_"+d.idx+"_dragger_horizontal")];
1620          functions._stop($this); /* stop any current scrolling before resetting */
1621          if((o.axis!=="x" && !d.overflowed[0]) || (o.axis==="y" && d.overflowed[0])){ /* reset y */
1622            mCSB_dragger[0].add(mCSB_container).css("top",0);
1623            functions._scrollTo($this,"_resetY");
1624          }
1625          if((o.axis!=="y" && !d.overflowed[1]) || (o.axis==="x" && d.overflowed[1])){ /* reset x */
1626            var cx=dx=0;
1627            if(d.langDir==="rtl"){ /* adjust left position for rtl direction */
1628              cx=mCustomScrollBox.width()-mCSB_container.outerWidth(false);
1629              dx=Math.abs(cx/d.scrollRatio.x);
1630            }
1631            mCSB_container.css("left",cx);
1632            mCSB_dragger[1].css("left",dx);
1633            functions._scrollTo($this,"_resetX");
1634          }
1635        },
1636        /* -------------------- */
1637        
1638        
1639        /* binds scrollbar events */
1640        _bindEvents:function(){
1641          var $this=$(this),d=$this.data(pluginPfx),o=d.opt;
1642          if(!d.bindEvents){ /* check if events are already bound */
1643            functions._draggable.call(this);
1644            if(o.contentTouchScroll){functions._contentDraggable.call(this);}
1645            if(o.mouseWheel.enable){ /* bind mousewheel fn when plugin is available */
1646              function _mwt(){
1647                mousewheelTimeout=setTimeout(function(){
1648                  if(!$.event.special.mousewheel){
1649                    _mwt();
1650                  }else{
1651                    clearTimeout(mousewheelTimeout);
1652                    functions._mousewheel.call($this[0]);
1653                  }
1654                },1000);
1655              }
1656              var mousewheelTimeout;
1657              _mwt();
1658            }
1659            functions._draggerRail.call(this);
1660            functions._wrapperScroll.call(this);
1661            if(o.advanced.autoScrollOnFocus){functions._focus.call(this);}
1662            if(o.scrollButtons.enable){functions._buttons.call(this);}
1663            if(o.keyboard.enable){functions._keyboard.call(this);}
1664            d.bindEvents=true;
1665          }
1666        },
1667        /* -------------------- */
1668        
1669        
1670        /* unbinds scrollbar events */
1671        _unbindEvents:function(){
1672          var $this=$(this),d=$this.data(pluginPfx),
1673            namespace=pluginPfx+"_"+d.idx,
1674            sb=".mCSB_"+d.idx+"_scrollbar",
1675            sel=$("#mCSB_"+d.idx+",#mCSB_"+d.idx+"_container,#mCSB_"+d.idx+"_container_wrapper,"+sb+" .mCSB_draggerContainer,#mCSB_"+d.idx+"_dragger_vertical,#mCSB_"+d.idx+"_dragger_horizontal,"+sb+">a"),
1676            mCSB_container=$("#mCSB_"+d.idx+"_container");
1677          if(d.bindEvents){ /* check if events are bound */
1678            /* unbind namespaced events from document/selectors */
1679            $(document).unbind("."+namespace);
1680            sel.each(function(){
1681              $(this).unbind("."+namespace);
1682            });
1683            /* clear and delete timeouts/objects */
1684            clearTimeout($this[0]._focusTimeout); functions._delete.call(null,$this[0]._focusTimeout);
1685            clearTimeout(d.sequential.step); functions._delete.call(null,d.sequential.step);
1686            clearTimeout(mCSB_container[0].onCompleteTimeout); functions._delete.call(null,mCSB_container[0].onCompleteTimeout);
1687            d.bindEvents=false;
1688          }
1689        },
1690        /* -------------------- */
1691        
1692        
1693        /* toggles scrollbar visibility */
1694        _scrollbarVisibility:function(disabled){
1695          var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
1696            contentWrapper=$("#mCSB_"+d.idx+"_container_wrapper"),
1697            content=contentWrapper.length ? contentWrapper : $("#mCSB_"+d.idx+"_container"),
1698            scrollbar=[$("#mCSB_"+d.idx+"_scrollbar_vertical"),$("#mCSB_"+d.idx+"_scrollbar_horizontal")],
1699            mCSB_dragger=[scrollbar[0].find(".mCSB_dragger"),scrollbar[1].find(".mCSB_dragger")];
1700          if(o.axis!=="x"){
1701            if(d.overflowed[0] && !disabled){
1702              scrollbar[0].add(mCSB_dragger[0]).add(scrollbar[0].children("a")).css("display","block");
1703              content.removeClass("mCS_no_scrollbar_y mCS_y_hidden");
1704            }else{
1705              if(o.alwaysShowScrollbar){
1706                if(o.alwaysShowScrollbar!==2){mCSB_dragger[0].add(scrollbar[0].children("a")).css("display","none");}
1707                content.removeClass("mCS_y_hidden");
1708              }else{
1709                scrollbar[0].css("display","none");
1710                content.addClass("mCS_y_hidden");
1711              }
1712              content.addClass("mCS_no_scrollbar_y");
1713            }
1714          }
1715          if(o.axis!=="y"){
1716            if(d.overflowed[1] && !disabled){
1717              scrollbar[1].add(mCSB_dragger[1]).add(scrollbar[1].children("a")).css("display","block");
1718              content.removeClass("mCS_no_scrollbar_x mCS_x_hidden");
1719            }else{
1720              if(o.alwaysShowScrollbar){
1721                if(o.alwaysShowScrollbar!==2){mCSB_dragger[1].add(scrollbar[1].children("a")).css("display","none");}
1722                content.removeClass("mCS_x_hidden");
1723              }else{
1724                scrollbar[1].css("display","none");
1725                content.addClass("mCS_x_hidden");
1726              }
1727              content.addClass("mCS_no_scrollbar_x");
1728            }
1729          }
1730          if(!d.overflowed[0] && !d.overflowed[1]){
1731            $this.addClass("mCS_no_scrollbar");
1732          }else{
1733            $this.removeClass("mCS_no_scrollbar");
1734          }
1735        },
1736        /* -------------------- */
1737        
1738        
1739        /* returns input coordinates of pointer, touch and mouse events (relative to document) */
1740        _coordinates:function(e){
1741          var t=e.type;
1742          switch(t){
1743            case "pointerdown": case "MSPointerDown": case "pointermove": case "MSPointerMove": case "pointerup": case "MSPointerUp":
1744              return [e.originalEvent.pageY,e.originalEvent.pageX];
1745              break;
1746            case "touchstart": case "touchmove": case "touchend":
1747              var touch=e.originalEvent.touches[0] || e.originalEvent.changedTouches[0];
1748              return [touch.pageY,touch.pageX];
1749              break;
1750            default:
1751              return [e.pageY,e.pageX];
1752          }
1753        },
1754        /* -------------------- */
1755        
1756        
1757        /* 
1758        SCROLLBAR DRAG EVENTS
1759        scrolls content via scrollbar dragging 
1760        */
1761        _draggable:function(){
1762          var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
1763            namespace=pluginPfx+"_"+d.idx,
1764            draggerId=["mCSB_"+d.idx+"_dragger_vertical","mCSB_"+d.idx+"_dragger_horizontal"],
1765            mCSB_container=$("#mCSB_"+d.idx+"_container"),
1766            mCSB_dragger=$("#"+draggerId[0]+",#"+draggerId[1]),
1767            draggable,dragY,dragX;
1768          mCSB_dragger.bind("mousedown."+namespace+" touchstart."+namespace+" pointerdown."+namespace+" MSPointerDown."+namespace,function(e){
1769            e.stopImmediatePropagation();
1770            e.preventDefault();
1771            if(!functions._mouseBtnLeft(e)){return;} /* left mouse button only */
1772            touchActive=true;
1773            if(oldIE){document.onselectstart=function(){return false;}} /* disable text selection for IE < 9 */
1774            _iframe(false); /* enable scrollbar dragging over iframes by disabling their events */
1775            functions._stop($this);
1776            draggable=$(this);
1777            var offset=draggable.offset(),y=functions._coordinates(e)[0]-offset.top,x=functions._coordinates(e)[1]-offset.left,
1778              h=draggable.height()+offset.top,w=draggable.width()+offset.left;
1779            if(y<h && y>0 && x<w && x>0){
1780              dragY=y; 
1781              dragX=x;
1782            }
1783            functions._onDragClasses(draggable,"active",o.autoExpandScrollbar); 
1784          }).bind("touchmove."+namespace,function(e){
1785            e.stopImmediatePropagation();
1786            e.preventDefault();
1787            var offset=draggable.offset(),y=functions._coordinates(e)[0]-offset.top,x=functions._coordinates(e)[1]-offset.left;
1788            _drag(dragY,dragX,y,x);
1789          });
1790          $(document).bind("mousemove."+namespace+" pointermove."+namespace+" MSPointerMove."+namespace,function(e){
1791            if(draggable){
1792              var offset=draggable.offset(),y=functions._coordinates(e)[0]-offset.top,x=functions._coordinates(e)[1]-offset.left;
1793              if(dragY===y){return;} /* has it really moved? */
1794              _drag(dragY,dragX,y,x);
1795            }
1796          }).add(mCSB_dragger).bind("mouseup."+namespace+" touchend."+namespace+" pointerup."+namespace+" MSPointerUp."+namespace,function(e){
1797            if(draggable){
1798              functions._onDragClasses(draggable,"active",o.autoExpandScrollbar); 
1799              draggable=null;
1800            }
1801            touchActive=false;
1802            if(oldIE){document.onselectstart=null;} /* enable text selection for IE < 9 */
1803            _iframe(true); /* enable iframes events */
1804          });
1805          function _iframe(evt){
1806            var el=mCSB_container.find("iframe");
1807            if(!el.length){return;} /* check if content contains iframes */
1808            var val=!evt ? "none" : "auto";
1809            el.css("pointer-events",val); /* for IE11, iframe's display property should not be "block" */
1810          }
1811          function _drag(dragY,dragX,y,x){
1812            mCSB_container[0].idleTimer=o.scrollInertia<233 ? 250 : 0;
1813            if(draggable.attr("id")===draggerId[1]){
1814              var dir="x",to=((draggable[0].offsetLeft-dragX)+x)*d.scrollRatio.x;
1815            }else{
1816              var dir="y",to=((draggable[0].offsetTop-dragY)+y)*d.scrollRatio.y;
1817            }
1818            functions._scrollTo($this,to.toString(),{dir:dir,drag:true});
1819          }
1820        },
1821        /* -------------------- */
1822        
1823        
1824        /* 
1825        TOUCH SWIPE EVENTS
1826        scrolls content via touch swipe 
1827        Emulates the native touch-swipe scrolling with momentum found in iOS, Android and WP devices 
1828        */
1829        _contentDraggable:function(){
1830          var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
1831            namespace=pluginPfx+"_"+d.idx,
1832            mCustomScrollBox=$("#mCSB_"+d.idx),
1833            mCSB_container=$("#mCSB_"+d.idx+"_container"),
1834            mCSB_dragger=[$("#mCSB_"+d.idx+"_dragger_vertical"),$("#mCSB_"+d.idx+"_dragger_horizontal")],
1835            dragY,dragX,touchStartY,touchStartX,touchMoveY=[],touchMoveX=[],startTime,runningTime,endTime,distance,speed,amount,
vendor: 15,572 bytes, lines 1836-2134
1836            durA=0,durB,overwrite=o.axis==="yx" ? "none" : "all";
1837          mCSB_container.bind("touchstart."+namespace+" pointerdown."+namespace+" MSPointerDown."+namespace,function(e){
1838            if(!functions._pointerTouch(e) || touchActive){return;}
1839            var offset=mCSB_container.offset();
1840            dragY=functions._coordinates(e)[0]-offset.top;
1841            dragX=functions._coordinates(e)[1]-offset.left;
1842          }).bind("touchmove."+namespace+" pointermove."+namespace+" MSPointerMove."+namespace,function(e){
1843            if(!functions._pointerTouch(e) || touchActive){return;}
1844            e.stopImmediatePropagation();
1845            runningTime=functions._getTime();
1846            var offset=mCustomScrollBox.offset(),y=functions._coordinates(e)[0]-offset.top,x=functions._coordinates(e)[1]-offset.left,
1847              easing="mcsLinearOut";
1848            touchMoveY.push(y);
1849            touchMoveX.push(x);
1850            if(d.overflowed[0]){
1851              var limit=mCSB_dragger[0].parent().height()-mCSB_dragger[0].height(),
1852                prevent=((dragY-y)>0 && (y-dragY)>-(limit*d.scrollRatio.y));
1853            }
1854            if(d.overflowed[1]){
1855              var limitX=mCSB_dragger[1].parent().width()-mCSB_dragger[1].width(),
1856                preventX=((dragX-x)>0 && (x-dragX)>-(limitX*d.scrollRatio.x));
1857            }
1858            if(prevent || preventX){e.preventDefault();} /* prevent native document scrolling */
1859            amount=o.axis==="yx" ? [(dragY-y),(dragX-x)] : o.axis==="x" ? [null,(dragX-x)] : [(dragY-y),null];
1860            mCSB_container[0].idleTimer=250;
1861            if(d.overflowed[0]){_drag(amount[0],durA,easing,"y","all",true);}
1862            if(d.overflowed[1]){_drag(amount[1],durA,easing,"x",overwrite,true);}
1863          });
1864          mCustomScrollBox.bind("touchstart."+namespace+" pointerdown."+namespace+" MSPointerDown."+namespace,function(e){
1865            if(!functions._pointerTouch(e) || touchActive){return;}
1866            e.stopImmediatePropagation();
1867            functions._stop($this);
1868            startTime=functions._getTime();
1869            var offset=mCustomScrollBox.offset();
1870            touchStartY=functions._coordinates(e)[0]-offset.top;
1871            touchStartX=functions._coordinates(e)[1]-offset.left;
1872            touchMoveY=[]; touchMoveX=[];
1873          }).bind("touchend."+namespace+" pointerup."+namespace+" MSPointerUp."+namespace,function(e){
1874            if(!functions._pointerTouch(e) || touchActive){return;}
1875            e.stopImmediatePropagation();
1876            endTime=functions._getTime();
1877            var offset=mCustomScrollBox.offset(),y=functions._coordinates(e)[0]-offset.top,x=functions._coordinates(e)[1]-offset.left;
1878            if((endTime-runningTime)>30){return;}
1879            speed=1000/(endTime-startTime);
1880            var easing="mcsEaseOut",slow=speed<2.5,
1881              diff=slow ? [touchMoveY[touchMoveY.length-2],touchMoveX[touchMoveX.length-2]] : [0,0];
1882            distance=slow ? [(y-diff[0]),(x-diff[1])] : [y-touchStartY,x-touchStartX];
1883            var absDistance=[Math.abs(distance[0]),Math.abs(distance[1])];
1884            speed=slow ? [Math.abs(distance[0]/4),Math.abs(distance[1]/4)] : [speed,speed];
1885            var a=[
1886              Math.abs(mCSB_container[0].offsetTop)-(distance[0]*_m((absDistance[0]/speed[0]),speed[0])),
1887              Math.abs(mCSB_container[0].offsetLeft)-(distance[1]*_m((absDistance[1]/speed[1]),speed[1]))
1888            ];
1889            amount=o.axis==="yx" ? [a[0],a[1]] : o.axis==="x" ? [null,a[1]] : [a[0],null];
1890            durB=[(absDistance[0]*4)+o.scrollInertia,(absDistance[1]*4)+o.scrollInertia];
1891            var md=parseInt(o.contentTouchScroll) || 0; /* absolute minimum distance required */
1892            amount[0]=absDistance[0]>md ? amount[0] : 0;
1893            amount[1]=absDistance[1]>md ? amount[1] : 0;
1894            if(d.overflowed[0]){_drag(amount[0],durB[0],easing,"y",overwrite,false);}
1895            if(d.overflowed[1]){_drag(amount[1],durB[1],easing,"x",overwrite,false);}
1896          });
1897          function _m(ds,s){
1898            var r=[s*1.5,s*2,s/1.5,s/2];
1899            if(ds>90){
1900              return s>4 ? r[0] : r[3];
1901            }else if(ds>60){
1902              return s>3 ? r[3] : r[2];
1903            }else if(ds>30){
1904              return s>8 ? r[1] : s>6 ? r[0] : s>4 ? s : r[2];
1905            }else{
1906              return s>8 ? s : r[3];
1907            }
1908          }
1909          function _drag(amount,dur,easing,dir,overwrite,drag){
1910            if(!amount){return;}
1911            functions._scrollTo($this,amount.toString(),{dur:dur,scrollEasing:easing,dir:dir,overwrite:overwrite,drag:drag});
1912          }
1913        },
1914        /* -------------------- */
1915        
1916        
1917        /* 
1918        MOUSE WHEEL EVENT
1919        scrolls content via mouse-wheel 
1920        via mouse-wheel plugin (https://github.com/brandonaaron/jquery-mousewheel)
1921        */
1922        _mousewheel:function(){
1923          var $this=$(this),d=$this.data(pluginPfx);
1924          if(d){ /* Check if the scrollbar is ready to use mousewheel events (issue: #185) */
1925            var o=d.opt,
1926              namespace=pluginPfx+"_"+d.idx,
1927              mCustomScrollBox=$("#mCSB_"+d.idx),
1928              mCSB_dragger=[$("#mCSB_"+d.idx+"_dragger_vertical"),$("#mCSB_"+d.idx+"_dragger_horizontal")],
1929              iframe=$("#mCSB_"+d.idx+"_container").find("iframe"),
1930              el=mCustomScrollBox /* mousewheel element selector */;
1931            /* check for cross domain iframes and bind mousewheel event on them in addition to default mousewheel element selector */
1932            if(iframe.length){
1933              iframe.each(function(){
1934                var iFobj=this;
1935                if(_canAccessIFrame(iFobj)){ /* check if iframe can be accessed */
1936                  el=el.add($(iFobj).contents().find("body"));
1937                }
1938              });
1939            }
1940            el.bind("mousewheel."+namespace,function(e,delta){
1941              functions._stop($this);
1942              if(functions._disableMousewheel($this,e.target)){return;} /* disables mouse-wheel when hovering specific elements */
1943              var deltaFactor=o.mouseWheel.deltaFactor!=="auto" ? parseInt(o.mouseWheel.deltaFactor) : (oldIE && e.deltaFactor<100) ? 100 : e.deltaFactor || 100;
1944              if(o.axis==="x" || o.mouseWheel.axis==="x"){
1945                var dir="x",
1946                  px=[Math.round(deltaFactor*d.scrollRatio.x),parseInt(o.mouseWheel.scrollAmount)],
1947                  amount=o.mouseWheel.scrollAmount!=="auto" ? px[1] : px[0]>=mCustomScrollBox.width() ? mCustomScrollBox.width()*0.9 : px[0],
1948                  contentPos=Math.abs($("#mCSB_"+d.idx+"_container")[0].offsetLeft),
1949                  draggerPos=mCSB_dragger[1][0].offsetLeft,
1950                  limit=mCSB_dragger[1].parent().width()-mCSB_dragger[1].width(),
1951                  dlt=e.deltaX || e.deltaY || delta;
1952              }else{
1953                var dir="y",
1954                  px=[Math.round(deltaFactor*d.scrollRatio.y),parseInt(o.mouseWheel.scrollAmount)],
1955                  amount=o.mouseWheel.scrollAmount!=="auto" ? px[1] : px[0]>=mCustomScrollBox.height() ? mCustomScrollBox.height()*0.9 : px[0],
1956                  contentPos=Math.abs($("#mCSB_"+d.idx+"_container")[0].offsetTop),
1957                  draggerPos=mCSB_dragger[0][0].offsetTop,
1958                  limit=mCSB_dragger[0].parent().height()-mCSB_dragger[0].height(),
1959                  dlt=e.deltaY || delta;
1960              }
1961              if((dir==="y" && !d.overflowed[0]) || (dir==="x" && !d.overflowed[1])){return;}
1962              if(o.mouseWheel.invert){dlt=-dlt;}
1963              if(o.mouseWheel.normalizeDelta){dlt=dlt<0 ? -1 : 1;}
1964              if((dlt>0 && draggerPos!==0) || (dlt<0 && draggerPos!==limit) || o.mouseWheel.preventDefault){
1965                e.stopImmediatePropagation();
1966                e.preventDefault();
1967              }
1968              functions._scrollTo($this,(contentPos-(dlt*amount)).toString(),{dir:dir});
1969            });
1970          }
1971          /* check if iframe can be accessed */
1972          function _canAccessIFrame(iframe){
1973            var html=null;
1974            try{
1975              var doc=iframe.contentDocument || iframe.contentWindow.document;
1976              html=doc.body.innerHTML;
1977            }catch(err){/* do nothing */}
1978            return(html!==null);
1979          }
1980        },
1981        /* -------------------- */
1982        
1983        
1984        /* disables mouse-wheel when hovering specific elements like select, datalist etc. */
1985        _disableMousewheel:function(el,target){
1986          var tag=target.nodeName.toLowerCase(),
1987            tags=el.data(pluginPfx).opt.mouseWheel.disableOver,
1988            /* elements that require focus */
1989            focusTags=["select","textarea"];
1990          return $.inArray(tag,tags) > -1 && !($.inArray(tag,focusTags) > -1 && !$(target).is(":focus"));
1991        },
1992        /* -------------------- */
1993        
1994        
1995        /* 
1996        DRAGGER RAIL CLICK EVENT
1997        scrolls content via dragger rail 
1998        */
1999        _draggerRail:function(){
2000          var $this=$(this),d=$this.data(pluginPfx),
2001            namespace=pluginPfx+"_"+d.idx,
2002            mCSB_container=$("#mCSB_"+d.idx+"_container"),
2003            wrapper=mCSB_container.parent(),
2004            mCSB_draggerContainer=$(".mCSB_"+d.idx+"_scrollbar .mCSB_draggerContainer");
2005          mCSB_draggerContainer.bind("touchstart."+namespace+" pointerdown."+namespace+" MSPointerDown."+namespace,function(e){
2006            touchActive=true;
2007          }).bind("touchend."+namespace+" pointerup."+namespace+" MSPointerUp."+namespace,function(e){
2008            touchActive=false;
2009          }).bind("click."+namespace,function(e){
2010            if($(e.target).hasClass("mCSB_draggerContainer") || $(e.target).hasClass("mCSB_draggerRail")){
2011              functions._stop($this);
2012              var el=$(this),mCSB_dragger=el.find(".mCSB_dragger");
2013              if(el.parent(".mCSB_scrollTools_horizontal").length>0){
2014                if(!d.overflowed[1]){return;}
2015                var dir="x",
2016                  clickDir=e.pageX>mCSB_dragger.offset().left ? -1 : 1,
2017                  to=Math.abs(mCSB_container[0].offsetLeft)-(clickDir*(wrapper.width()*0.9));
2018              }else{
2019                if(!d.overflowed[0]){return;}
2020                var dir="y",
2021                  clickDir=e.pageY>mCSB_dragger.offset().top ? -1 : 1,
2022                  to=Math.abs(mCSB_container[0].offsetTop)-(clickDir*(wrapper.height()*0.9));
2023              }
2024              functions._scrollTo($this,to.toString(),{dir:dir,scrollEasing:"mcsEaseInOut"});
2025            }
2026          });
2027        },
2028        /* -------------------- */
2029        
2030        
2031        /* 
2032        FOCUS EVENT
2033        scrolls content via element focus (e.g. clicking an input, pressing TAB key etc.)
2034        */
2035        _focus:function(){
2036          var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
2037            namespace=pluginPfx+"_"+d.idx,
2038            mCSB_container=$("#mCSB_"+d.idx+"_container"),
2039            wrapper=mCSB_container.parent();
2040          mCSB_container.bind("focusin."+namespace,function(e){
2041            var el=$(document.activeElement),
2042              nested=mCSB_container.find(".mCustomScrollBox").length,
2043              dur=0;
2044            if(!el.is(o.advanced.autoScrollOnFocus)){return;}
2045            functions._stop($this);
2046            clearTimeout($this[0]._focusTimeout);
2047            $this[0]._focusTimer=nested ? (dur+17)*nested : 0;
2048            $this[0]._focusTimeout=setTimeout(function(){
2049              var	to=[el.offset().top-mCSB_container.offset().top,el.offset().left-mCSB_container.offset().left],
2050                contentPos=[mCSB_container[0].offsetTop,mCSB_container[0].offsetLeft],
2051                isVisible=[
2052                  (contentPos[0]+to[0]>=0 && contentPos[0]+to[0]<wrapper.height()-el.outerHeight(false)),
2053                  (contentPos[1]+to[1]>=0 && contentPos[0]+to[1]<wrapper.width()-el.outerWidth(false))
2054                ],
2055                overwrite=(o.axis==="yx" && !isVisible[0] && !isVisible[1]) ? "none" : "all";
2056              if(o.axis!=="x" && !isVisible[0]){
2057                functions._scrollTo($this,to[0].toString(),{dir:"y",scrollEasing:"mcsEaseInOut",overwrite:overwrite,dur:dur});
2058              }
2059              if(o.axis!=="y" && !isVisible[1]){
2060                functions._scrollTo($this,to[1].toString(),{dir:"x",scrollEasing:"mcsEaseInOut",overwrite:overwrite,dur:dur});
2061              }
2062            },$this[0]._focusTimer);
2063          });
2064        },
2065        /* -------------------- */
2066        
2067        
2068        /* sets content wrapper scrollTop/scrollLeft always to 0 */
2069        _wrapperScroll:function(){
2070          var $this=$(this),d=$this.data(pluginPfx),
2071            namespace=pluginPfx+"_"+d.idx,
2072            wrapper=$("#mCSB_"+d.idx+"_container").parent();
2073          wrapper.bind("scroll."+namespace,function(e){
2074            wrapper.scrollTop(0).scrollLeft(0);
2075          });
2076        },
2077        /* -------------------- */
2078        
2079        
2080        /* 
2081        BUTTONS EVENTS
2082        scrolls content via up, down, left and right buttons 
2083        */
2084        _buttons:function(){
2085          var $this=$(this),d=$this.data(pluginPfx),o=d.opt,seq=d.sequential,
2086            namespace=pluginPfx+"_"+d.idx,
2087            mCSB_container=$("#mCSB_"+d.idx+"_container"),
2088            sel=".mCSB_"+d.idx+"_scrollbar",
2089            btn=$(sel+">a");
2090          btn.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){
2091            e.preventDefault();
2092            if(!functions._mouseBtnLeft(e)){return;} /* left mouse button only */
2093            var btnClass=$(this).attr("class");
2094            seq.type=o.scrollButtons.scrollType;
2095            switch(e.type){
2096              case "mousedown": case "touchstart": case "pointerdown": case "MSPointerDown":
2097                if(seq.type==="stepped"){return;}
2098                touchActive=true;
2099                d.tweenRunning=false;
2100                _seq("on",btnClass);
2101                break;
2102              case "mouseup": case "touchend": case "pointerup": case "MSPointerUp":
2103              case "mouseout": case "pointerout": case "MSPointerOut":
2104                if(seq.type==="stepped"){return;}
2105                touchActive=false;
2106                if(seq.dir){_seq("off",btnClass);}
2107                break;
2108              case "click":
2109                if(seq.type!=="stepped" || d.tweenRunning){return;}
2110                _seq("on",btnClass);
2111                break;
2112            }
2113            function _seq(a,c){
2114              seq.scrollAmount=o.snapAmount || o.scrollButtons.scrollAmount;
2115              functions._sequentialScroll.call(this,$this,a,c);
2116            }
2117          });
2118        },
2119        /* -------------------- */
2120        
2121        
2122        /* 
2123        KEYBOARD EVENTS
2124        scrolls content via keyboard 
2125        Keys: up arrow, down arrow, left arrow, right arrow, PgUp, PgDn, Home, End
2126        */
2127        _keyboard:function(){
2128          var $this=$(this),d=$this.data(pluginPfx),o=d.opt,seq=d.sequential,
2129            namespace=pluginPfx+"_"+d.idx,
2130            mCustomScrollBox=$("#mCSB_"+d.idx),
2131            mCSB_container=$("#mCSB_"+d.idx+"_container"),
2132            wrapper=mCSB_container.parent(),
2133            editables="input,textarea,select,datalist,keygen,[contenteditable='true']";
2134          mCustomScrollBox.attr("tabindex","0").bind("blur."+namespace+" key
2134down."+namespace+" keyup."+namespace,function(e){
2135            switch(e.type){
2136              case "blur":
2137                if(d.tweenRunning && seq.dir){_seq("off",null);}
2138                break;
2139              case "keydown": case "keyup":
2140                var code=e.keyCode ? e.keyCode : e.which,action="on";
2141                if((o.axis!=="x" && (code===38 || code===40)) || (o.axis!=="y" && (code===37 || code===39))){
2142                  /* up (38), down (40), left (37), right (39) arrows */
2143                  if(((code===38 || code===40) && !d.overflowed[0]) || ((code===37 || code===39) && !d.overflowed[1])){return;}
2144                  if(e.type==="keyup"){action="off";}
2145                  if(!$(document.activeElement).is(editables)){
2146                    e.preventDefault();
2147                    e.stopImmediatePropagation();
2148                    _seq(action,code);
2149                  }
2150                }else if(code===33 || code===34){
2151                  /* PgUp (33), PgDn (34) */
2152                  if(d.overflowed[0] || d.overflowed[1]){
2153                    e.preventDefault();
2154                    e.stopImmediatePropagation();
2155                  }
2156                  if(e.type==="keyup"){
2157                    functions._stop($this);
2158                    var keyboardDir=code===34 ? -1 : 1;
2159                    if(o.axis==="x" || (o.axis==="yx" && d.overflowed[1] && !d.overflowed[0])){
2160                      var dir="x",to=Math.abs(mCSB_container[0].offsetLeft)-(keyboardDir*(wrapper.width()*0.9));
2161                    }else{
2162                      var dir="y",to=Math.abs(mCSB_container[0].offsetTop)-(keyboardDir*(wrapper.height()*0.9));
2163                    }
2164                    functions._scrollTo($this,to.toString(),{dir:dir,scrollEasing:"mcsEaseInOut"});
2165                  }
2166                }else if(code===35 || code===36){
2167                  /* End (35), Home (36) */
2168                  if(!$(document.activeElement).is(editables)){
2169                    if(d.overflowed[0] || d.overflowed[1]){
2170                      e.preventDefault();
2171                      e.stopImmediatePropagation();
2172                    }
2173                    if(e.type==="keyup"){
2174                      if(o.axis==="x" || (o.axis==="yx" && d.overflowed[1] && !d.overflowed[0])){
2175                        var dir="x",to=code===35 ? Math.abs(wrapper.width()-mCSB_container.outerWidth(false)) : 0;
2176                      }else{
2177                        var dir="y",to=code===35 ? Math.abs(wrapper.height()-mCSB_container.outerHeight(false)) : 0;
2178                      }
2179                      functions._scrollTo($this,to.toString(),{dir:dir,scrollEasing:"mcsEaseInOut"});
2180                    }
2181                  }
2182                }
2183                break;
2184            }
2185            function _seq(a,c){
2186              seq.type=o.keyboard.scrollType;
2187              seq.scrollAmount=o.snapAmount || o.keyboard.scrollAmount;
2188              if(seq.type==="stepped" && d.tweenRunning){return;}
2189              functions._sequentialScroll.call(this,$this,a,c);
2190            }
2191          });
2192        },
2193        /* -------------------- */
2194        
2195        
2196        /* scrolls content sequentially (used when scrolling via buttons, keyboard arrows etc.) */
2197        _sequentialScroll:function(el,action,trigger){
2198          var d=el.data(pluginPfx),o=d.opt,seq=d.sequential,
2199            mCSB_container=$("#mCSB_"+d.idx+"_container"),
2200            once=seq.type==="stepped" ? true : false;
2201          switch(action){
2202            case "on":
2203              seq.dir=[
2204                (trigger==="mCSB_buttonRight" || trigger==="mCSB_buttonLeft" || trigger===39 || trigger===37 ? "x" : "y"),
2205                (trigger==="mCSB_buttonUp" || trigger==="mCSB_buttonLeft" || trigger===38 || trigger===37 ? -1 : 1)
2206              ];
2207              functions._stop(el);
2208              if(functions._isNumeric(trigger) && seq.type==="stepped"){return;}
2209              _start(once);
2210              break;
2211            case "off":
2212              _stop();
2213              if(once || (d.tweenRunning && seq.dir)){
2214                _start(true);
2215              }
2216              break;
2217          }
2218          /* starts sequence */
2219          function _start(once){
2220            var c=seq.type!=="stepped", /* continuous scrolling */
2221              t=!once ? 1000/60 : c ? o.scrollInertia/1.5 : o.scrollInertia, /* timer */
2222              m=!once ? 2.5 : c ? 7.5 : 40, /* multiplier */
2223              contentPos=[Math.abs(mCSB_container[0].offsetTop),Math.abs(mCSB_container[0].offsetLeft)],
2224              ratio=[d.scrollRatio.y>10 ? 10 : d.scrollRatio.y,d.scrollRatio.x>10 ? 10 : d.scrollRatio.x],
2225              amount=seq.dir[0]==="x" ? contentPos[1]+(seq.dir[1]*(ratio[1]*m)) : contentPos[0]+(seq.dir[1]*(ratio[0]*m)),
2226              px=seq.dir[0]==="x" ? contentPos[1]+(seq.dir[1]*parseInt(seq.scrollAmount)) : contentPos[0]+(seq.dir[1]*parseInt(seq.scrollAmount)),
2227              to=seq.scrollAmount!=="auto" ? px : amount,
2228              easing=!once ? "mcsLinear" : c ? "mcsLinearOut" : "mcsEaseInOut",
2229              onComplete=!once ? false : true;
2230            if(once && t<17){
2231              to=seq.dir[0]==="x" ? contentPos[1] : contentPos[0];
2232            }
2233            functions._scrollTo(el,to.toString(),{dir:seq.dir[0],scrollEasing:easing,dur:t,onComplete:onComplete});
2234            if(once){
2235              seq.dir=false;
2236              return;
2237            }
2238            clearTimeout(seq.step);
2239            seq.step=setTimeout(function(){
2240              _start();
2241            },t);
2242          }
2243          /* stops sequence */
2244          function _stop(){
2245            clearTimeout(seq.step);
2246            functions._stop(el);
2247          }
2248        },
2249        /* -------------------- */
2250        
2251        
2252        /* returns a yx array from value */
2253        _arr:function(val){
2254          var o=$(this).data(pluginPfx).opt,vals=[];
2255          if(typeof val==="function"){val=val();} /* check if the value is a single anonymous function */
2256          /* check if value is object or array, its length and create an array with yx values */
2257          if(!(val instanceof Array)){ /* object value (e.g. {y:"100",x:"100"}, 100 etc.) */
2258            vals[0]=val.y ? val.y : val.x || o.axis==="x" ? null : val;
2259            vals[1]=val.x ? val.x : val.y || o.axis==="y" ? null : val;
2260          }else{ /* array value (e.g. [100,100]) */
2261            vals=val.length>1 ? [val[0],val[1]] : o.axis==="x" ? [null,val[0]] : [val[0],null];
2262          }
2263          /* check if array values are anonymous functions */
2264          if(typeof vals[0]==="function"){vals[0]=vals[0]();}
2265          if(typeof vals[1]==="function"){vals[1]=vals[1]();}
2266          return vals;
2267        },
2268        /* -------------------- */
2269        
2270        
2271        /* translates values (e.g. "top", 100, "100px", "#id") to actual scroll-to positions */
2272        _to:function(val,dir){
2273          if(val==null || typeof val=="undefined"){return;}
2274          var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
2275            mCSB_container=$("#mCSB_"+d.idx+"_container"),
2276            wrapper=mCSB_container.parent(),
2277            t=typeof val;
2278          if(!dir){dir=o.axis==="x" ? "x" : "y";}
2279          var contentLength=dir==="x" ? mCSB_container.outerWidth(false) : mCSB_container.outerHeight(false),
2280            contentOffset=dir==="x" ? mCSB_container.offset().left : mCSB_container.offset().top,
2281            contentPos=dir==="x" ? mCSB_container[0].offsetLeft : mCSB_container[0].offsetTop,
2282            cssProp=dir==="x" ? "left" : "top";
2283          switch(t){
2284            case "function": /* this currently is not used. Consider removing it */
2285              return val();
2286              break;
2287            case "object":
2288              if(val.nodeType){ /* DOM */
2289                var objOffset=dir==="x" ? $(val).offset().left : $(val).offset().top;
2290              }else if(val.jquery){ /* jquery object */
2291                if(!val.length){return;}
2292                var objOffset=dir==="x" ? val.offset().left : val.offset().top;
2293              }
2294              return objOffset-contentOffset;
2295              break;
2296            case "string": case "number":
2297              if(functions._isNumeric.call(null,val)){ /* numeric value */
2298                return Math.abs(val);
2299              }else if(val.indexOf("%")!==-1){ /* percentage value */
2300                return Math.abs(contentLength*parseInt(val)/100);
2301              }else if(val.indexOf("-=")!==-1){ /* decrease value */
2302                return Math.abs(contentPos-parseInt(val.split("-=")[1]));
2303              }else if(val.indexOf("+=")!==-1){ /* inrease value */
2304                var p=(contentPos+parseInt(val.split("+=")[1]));
2305                return p>=0 ? 0 : Math.abs(p);
2306              }else if(val.indexOf("px")!==-1 && functions._isNumeric.call(null,val.split("px")[0])){ /* pixels string value (e.g. "100px") */
2307                return Math.abs(val.split("px")[0]);
2308              }else{
2309                if(val==="top" || val==="left"){ /* special strings */
2310                  return 0;
2311                }else if(val==="bottom"){
2312                  return Math.abs(wrapper.height()-mCSB_container.outerHeight(false));
2313                }else if(val==="right"){
2314                  return Math.abs(wrapper.width()-mCSB_container.outerWidth(false));
2315                }else if(val==="first" || val==="last"){
2316                  var obj=mCSB_container.find(":"+val),
2317                    objOffset=dir==="x" ? $(obj).offset().left : $(obj).offset().top;
2318                  return objOffset-contentOffset;
2319                }else{
2320                  if($(val).length){ /* jquery selector */
2321                    var objOffset=dir==="x" ? $(val).offset().left : $(val).offset().top;
2322                    return objOffset-contentOffset;
2323                  }else{ /* other values (e.g. "100em") */
2324                    mCSB_container.css(cssProp,val);
2325                    methods.update.call(null,$this[0]);
2326                    return;
2327                  }
2328                }
2329              }
2330              break;
2331          }
2332        },
2333        /* -------------------- */
2334        
2335        
2336        /* calls the update method automatically */
2337        _autoUpdate:function(rem){
2338          var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
2339            mCSB_container=$("#mCSB_"+d.idx+"_container");
2340          if(rem){
2341            /* 
2342            removes autoUpdate timer 
2343            usage: functions._autoUpdate.call(this,"remove");
2344            */
2345            clearTimeout(mCSB_container[0].autoUpdate);
2346            functions._delete.call(null,mCSB_container[0].autoUpdate);
2347            return;
2348          }
2349          var	wrapper=mCSB_container.parent(),
2350            scrollbar=[$("#mCSB_"+d.idx+"_scrollbar_vertical"),$("#mCSB_"+d.idx+"_scrollbar_horizontal")],
2351            scrollbarSize=function(){return [
2352              scrollbar[0].is(":visible") ? scrollbar[0].outerHeight(true) : 0, /* returns y-scrollbar height */
2353              scrollbar[1].is(":visible") ? scrollbar[1].outerWidth(true) : 0 /* returns x-scrollbar width */
2354            ]},
2355            oldSelSize=sizesSum(),newSelSize,
2356            os=[mCSB_container.outerHeight(false),mCSB_container.outerWidth(false),wrapper.height(),wrapper.width(),scrollbarSize()[0],scrollbarSize()[1]],ns,
2357            oldImgsLen=imgSum(),newImgsLen;
2358          upd();
2359          function upd(){
2360            clearTimeout(mCSB_container[0].autoUpdate);
2361            mCSB_container[0].autoUpdate=setTimeout(function(){
2362              /* update on specific selector(s) length and size change */
2363              if(o.advanced.updateOnSelectorChange){
2364                newSelSize=sizesSum();
2365                if(newSelSize!==oldSelSize){
2366                  doUpd();
2367                  oldSelSize=newSelSize;
2368                  return;
2369                }
2370              }
2371              /* update on main element and scrollbar size changes */
2372              if(o.advanced.updateOnContentResize){
2373                ns=[mCSB_container.outerHeight(false),mCSB_container.outerWidth(false),wrapper.height(),wrapper.width(),scrollbarSize()[0],scrollbarSize()[1]];
2374                if(ns[0]!==os[0] || ns[1]!==os[1] || ns[2]!==os[2] || ns[3]!==os[3] || ns[4]!==os[4] || ns[5]!==os[5]){
2375                  doUpd();
2376                  os=ns;
2377                }
2378              }
2379              /* update on image load */
2380              if(o.advanced.updateOnImageLoad){
2381                newImgsLen=imgSum();
2382                if(newImgsLen!==oldImgsLen){
2383                  mCSB_container.find("img").each(function(){
2384                    imgLoader(this.src);
2385                  });
2386                  oldImgsLen=newImgsLen;
2387                }
2388              }
2389              if(o.advanced.updateOnSelectorChange || o.advanced.updateOnContentResize || o.advanced.updateOnImageLoad){upd();}
2390            },60);
2391          }
2392          /* returns images amount */
2393          function imgSum(){
2394            var total=0
2395            if(o.advanced.updateOnImageLoad){total=mCSB_container.find("img").length;}
2396            return total;
2397          }
2398          /* a tiny image loader */
2399          function imgLoader(src){
2400            var img=new Image();
2401            function createDelegate(contextObject,delegateMethod){
2402              return function(){return delegateMethod.apply(contextObject,arguments);}
2403            }
2404            function imgOnLoad(){
2405              this.onload=null;
2406              doUpd();
2407            }
2408            img.onload=createDelegate(img,imgOnLoad);
2409            img.src=src;
2410          }
2411          /* returns the total height and width sum of all elements matching the selector */
2412          function sizesSum(){
2413            if(o.advanced.updateOnSelectorChange===true){o.advanced.updateOnSelectorChange="*";}
2414            var total=0,sel=mCSB_container.find(o.advanced.updateOnSelectorChange);
2415            if(o.advanced.updateOnSelectorChange && sel.length>0){sel.each(function(){total+=$(this).height()+$(this).width();});}
2416            return total;
2417          }
2418          /* calls the update method */
2419          function doUpd(){
2420            clearTimeout(mCSB_container[0].autoUpdate); 
2421            methods.update.call(null,$this[0]);
2422          }
2423        },
2424        /* -------------------- */
2425        
2426        
2427        /* snaps scrolling to a multiple of a pixels number */
2428        _snapAmount:function(to,amount,offset){
2429          return (Math.round(to/amount)*amount-offset); 
2430        },
2431        /* -------------------- */
2432        
2433        
2434        /* stops content and scrollbar animations */
2435        _stop:function(el){
2436          var d=el.data(pluginPfx),
2437            sel=$("#mCSB_"+d.idx+"_container,#mCSB_"+d.idx+"_container_wrapper,#mCSB_"+d.idx+"_dragger_vertical,#mCSB_"+d.idx+"_dragger_horizontal");
2438          sel.each(function(){
2439            functions._stopTween.call(this);
2440          });
2441        },
2442        /* -------------------- */
2443        
2444        
2445        /* 
2446        ANIMATES CONTENT 
2447        This is where the actual scrolling happens
2448        */
2449        _scrollTo:function(el,to,options){
2450          var d=el.data(pluginPfx),o=d.opt,
2451            defaults={
2452              trigger:"internal",
2453              dir:"y",
2454              scrollEasing:"mcsEaseOut",
2455              drag:false,
2456              dur:o.scrollInertia,
2457              overwrite:"all",
2458              callbacks:true,
2459              onStart:true,
2460              onUpdate:true,
2461              onComplete:true
2462            },
2463            options=$.extend(defaults,options),
2464            dur=[options.dur,(options.drag ? 0 : options.dur)],
2465            mCustomScrollBox=$("#mCSB_"+d.idx),
2466            mCSB_container=$("#mCSB_"+d.idx+"_container"),
2467            totalScrollOffsets=o.callbacks.onTotalScrollOffset ? functions._arr.call(el,o.callbacks.onTotalScrollOffset) : [0,0],
2468            totalScrollBackOffsets=o.callbacks.onTotalScrollBackOffset ? functions._arr.call(el,o.callbacks.onTotalScrollBackOffset) 
vendor: 12,598 bytes, lines 2468-2761
2468: [0,0];
2469          d.trigger=options.trigger;
2470          if(to==="_resetY" && !d.contentReset.y){
2471            /* callbacks: onOverflowYNone */
2472            if(_cb("onOverflowYNone")){o.callbacks.onOverflowYNone.call(el[0]);}
2473            d.contentReset.y=1;
2474          }
2475          if(to==="_resetX" && !d.contentReset.x){
2476            /* callbacks: onOverflowXNone */
2477            if(_cb("onOverflowXNone")){o.callbacks.onOverflowXNone.call(el[0]);}
2478            d.contentReset.x=1;
2479          }
2480          if(to==="_resetY" || to==="_resetX"){return;}
2481          if((d.contentReset.y || !el[0].mcs) && d.overflowed[0]){
2482            /* callbacks: onOverflowY */
2483            if(_cb("onOverflowY")){o.callbacks.onOverflowY.call(el[0]);}
2484            d.contentReset.x=null;
2485          }
2486          if((d.contentReset.x || !el[0].mcs) && d.overflowed[1]){
2487            /* callbacks: onOverflowX */
2488            if(_cb("onOverflowX")){o.callbacks.onOverflowX.call(el[0]);}
2489            d.contentReset.x=null;
2490          }
2491          if(o.snapAmount){to=functions._snapAmount(to,o.snapAmount,o.snapOffset);} /* scrolling snapping */
2492          switch(options.dir){
2493            case "x":
2494              var mCSB_dragger=$("#mCSB_"+d.idx+"_dragger_horizontal"),
2495                property="left",
2496                contentPos=mCSB_container[0].offsetLeft,
2497                limit=[
2498                  mCustomScrollBox.width()-mCSB_container.outerWidth(false),
2499                  mCSB_dragger.parent().width()-mCSB_dragger.width()
2500                ],
2501                scrollTo=[to,to===0 ? 0 : (to/d.scrollRatio.x)],
2502                tso=totalScrollOffsets[1],
2503                tsbo=totalScrollBackOffsets[1],
2504                totalScrollOffset=tso>0 ? tso/d.scrollRatio.x : 0,
2505                totalScrollBackOffset=tsbo>0 ? tsbo/d.scrollRatio.x : 0;
2506              break;
2507            case "y":
2508              var mCSB_dragger=$("#mCSB_"+d.idx+"_dragger_vertical"),
2509                property="top",
2510                contentPos=mCSB_container[0].offsetTop,
2511                limit=[
2512                  mCustomScrollBox.height()-mCSB_container.outerHeight(false),
2513                  mCSB_dragger.parent().height()-mCSB_dragger.height()
2514                ],
2515                scrollTo=[to,to===0 ? 0 : (to/d.scrollRatio.y)],
2516                tso=totalScrollOffsets[0],
2517                tsbo=totalScrollBackOffsets[0],
2518                totalScrollOffset=tso>0 ? tso/d.scrollRatio.y : 0,
2519                totalScrollBackOffset=tsbo>0 ? tsbo/d.scrollRatio.y : 0;
2520              break;
2521          }
2522          if(scrollTo[1]<0 || (scrollTo[0]===0 && scrollTo[1]===0)){
2523            scrollTo=[0,0];
2524          }else if(scrollTo[1]>=limit[1]){
2525            scrollTo=[limit[0],limit[1]];
2526          }else{
2527            scrollTo[0]=-scrollTo[0];
2528          }
2529          if(!el[0].mcs){_mcs();} /* init mcs object (once) to make it available before callbacks */
2530          clearTimeout(mCSB_container[0].onCompleteTimeout);
2531          if(!d.tweenRunning && ((contentPos===0 && scrollTo[0]>=0) || (contentPos===limit[0] && scrollTo[0]<=limit[0]))){return;}
2532          functions._tweenTo.call(null,mCSB_dragger[0],property,Math.round(scrollTo[1]),dur[1],options.scrollEasing);
2533          functions._tweenTo.call(null,mCSB_container[0],property,Math.round(scrollTo[0]),dur[0],options.scrollEasing,options.overwrite,{
2534            onStart:function(){
2535              if(options.callbacks && options.onStart && !d.tweenRunning){
2536                /* callbacks: onScrollStart */
2537                if(_cb("onScrollStart")){_mcs(); o.callbacks.onScrollStart.call(el[0]);}
2538                d.tweenRunning=true;
2539                functions._onDragClasses(mCSB_dragger);
2540                d.cbOffsets=_cbOffsets();
2541              }
2542            },onUpdate:function(){
2543              if(options.callbacks && options.onUpdate){
2544                /* callbacks: whileScrolling */
2545                if(_cb("whileScrolling")){_mcs(); o.callbacks.whileScrolling.call(el[0]);}
2546              }
2547            },onComplete:function(){
2548              if(options.callbacks && options.onComplete){
2549                if(o.axis==="yx"){clearTimeout(mCSB_container[0].onCompleteTimeout);}
2550                var t=mCSB_container[0].idleTimer || 0;
2551                mCSB_container[0].onCompleteTimeout=setTimeout(function(){
2552                  /* callbacks: onScroll, onTotalScroll, onTotalScrollBack */
2553                  if(_cb("onScroll")){_mcs(); o.callbacks.onScroll.call(el[0]);}
2554                  if(_cb("onTotalScroll") && scrollTo[1]>=limit[1]-totalScrollOffset && d.cbOffsets[0]){_mcs(); o.callbacks.onTotalScroll.call(el[0]);}
2555                  if(_cb("onTotalScrollBack") && scrollTo[1]<=totalScrollBackOffset && d.cbOffsets[1]){_mcs(); o.callbacks.onTotalScrollBack.call(el[0]);}
2556                  d.tweenRunning=false;
2557                  mCSB_container[0].idleTimer=0;
2558                  functions._onDragClasses(mCSB_dragger,"hide");
2559                },t);
2560              }
2561            }
2562          });
2563          /* checks if callback function exists */
2564          function _cb(cb){
2565            return d && o.callbacks[cb] && typeof o.callbacks[cb]==="function";
2566          }
2567          /* checks whether callback offsets always trigger */
2568          function _cbOffsets(){
2569            return [o.callbacks.alwaysTriggerOffsets || contentPos>=limit[0]+tso,o.callbacks.alwaysTriggerOffsets || contentPos<=-tsbo];
2570          }
2571          /* 
2572          populates object with useful values for the user 
2573          values: 
2574            content: this.mcs.content
2575            content top position: this.mcs.top 
2576            content left position: this.mcs.left 
2577            dragger top position: this.mcs.draggerTop 
2578            dragger left position: this.mcs.draggerLeft 
2579            scrolling y percentage: this.mcs.topPct 
2580            scrolling x percentage: this.mcs.leftPct 
2581            scrolling direction: this.mcs.direction
2582          */
2583          function _mcs(){
2584            var cp=[mCSB_container[0].offsetTop,mCSB_container[0].offsetLeft], /* content position */
2585              dp=[mCSB_dragger[0].offsetTop,mCSB_dragger[0].offsetLeft], /* dragger position */
2586              cl=[mCSB_container.outerHeight(false),mCSB_container.outerWidth(false)], /* content length */
2587              pl=[mCustomScrollBox.height(),mCustomScrollBox.width()]; /* content parent length */
2588            el[0].mcs={
2589              content:mCSB_container, /* original content wrapper as jquery object */
2590              top:cp[0],left:cp[1],draggerTop:dp[0],draggerLeft:dp[1],
2591              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])),
2592              direction:options.dir
2593            };
2594            /* 
2595            this refers to the original element containing the scrollbar(s)
2596            usage: this.mcs.top, this.mcs.leftPct etc. 
2597            */
2598          }
2599        },
2600        /* -------------------- */
2601        
2602        
2603        /* 
2604        CUSTOM JAVASCRIPT ANIMATION TWEEN 
2605        Lighter and faster than jquery animate() and css transitions 
2606        Animates top/left properties and includes easings 
2607        */
2608        _tweenTo:function(el,prop,to,duration,easing,overwrite,callbacks){
2609          var callbacks=callbacks || {},
2610            onStart=callbacks.onStart || function(){},onUpdate=callbacks.onUpdate || function(){},onComplete=callbacks.onComplete || function(){},
2611            startTime=functions._getTime(),_delay,progress=0,from=el.offsetTop,elStyle=el.style,_request;
2612          if(prop==="left"){from=el.offsetLeft;}
2613          var diff=to-from;
2614          el._mcsstop=0;
2615          if(overwrite!=="none"){_cancelTween();}
2616          _startTween();
2617          function _step(){
2618            if(el._mcsstop){return;}
2619            if(!progress){onStart.call();}
2620            progress=functions._getTime()-startTime;
2621            _tween();
2622            if(progress>=el._mcstime){
2623              el._mcstime=(progress>el._mcstime) ? progress+_delay-(progress- el._mcstime) : progress+_delay-1;
2624              if(el._mcstime<progress+1){el._mcstime=progress+1;}
2625            }
2626            if(el._mcstime<duration){el._mcsid=_request(_step);}else{onComplete.call();}
2627          }
2628          function _tween(){
2629            if(duration>0){
2630              el._mcscurrVal=_ease(el._mcstime,from,diff,duration,easing);
2631              elStyle[prop]=Math.round(el._mcscurrVal)+"px";
2632            }else{
2633              elStyle[prop]=to+"px";
2634            }
2635            onUpdate.call();
2636          }
2637          function _startTween(){
2638            _delay=1000/60;
2639            el._mcstime=progress+_delay;
2640            _request=(!window.requestAnimationFrame) ? function(f){_tween(); return setTimeout(f,0.01);} : window.requestAnimationFrame;
2641            el._mcsid=_request(_step);
2642          }
2643          function _cancelTween(){
2644            if(el._mcsid==null){return;}
2645            if(!window.requestAnimationFrame){clearTimeout(el._mcsid);
2646            }else{window.cancelAnimationFrame(el._mcsid);}
2647            el._mcsid=null;
2648          }
2649          function _ease(t,b,c,d,type){
2650            switch(type){
2651              case "linear": case "mcsLinear":
2652                return c*t/d + b;
2653                break;
2654              case "mcsLinearOut":
2655                t/=d; t--; return c * Math.sqrt(1 - t*t) + b;
2656                break;
2657              case "easeInOutSmooth":
2658                t/=d/2;
2659                if(t<1) return c/2*t*t + b;
2660                t--;
2661                return -c/2 * (t*(t-2) - 1) + b;
2662                break;
2663              case "easeInOutStrong":
2664                t/=d/2;
2665                if(t<1) return c/2 * Math.pow( 2, 10 * (t - 1) ) + b;
2666                t--;
2667                return c/2 * ( -Math.pow( 2, -10 * t) + 2 ) + b;
2668                break;
2669              case "easeInOut": case "mcsEaseInOut":
2670                t/=d/2;
2671                if(t<1) return c/2*t*t*t + b;
2672                t-=2;
2673                return c/2*(t*t*t + 2) + b;
2674                break;
2675              case "easeOutSmooth":
2676                t/=d; t--;
2677                return -c * (t*t*t*t - 1) + b;
2678                break;
2679              case "easeOutStrong":
2680                return c * ( -Math.pow( 2, -10 * t/d ) + 1 ) + b;
2681                break;
2682              case "easeOut": case "mcsEaseOut": default:
2683                var ts=(t/=d)*t,tc=ts*t;
2684                return b+c*(0.499999999999997*tc*ts + -2.5*ts*ts + 5.5*tc + -6.5*ts + 4*t);
2685            }
2686          }
2687        },
2688        /* -------------------- */
2689        
2690        
2691        /* returns current time */
2692        _getTime:function(){
2693          if(window.performance && window.performance.now){
2694            return window.performance.now();
2695          }else{
2696            if(window.performance && window.performance.webkitNow){
2697              return window.performance.webkitNow();
2698            }else{
2699              if(Date.now){return Date.now();}else{return new Date().getTime();}
2700            }
2701          }
2702        },
2703        /* -------------------- */
2704        
2705        
2706        /* stops a tween */
2707        _stopTween:function(){
2708          var el=this;
2709          if(el._mcsid==null){return;}
2710          if(!window.requestAnimationFrame){clearTimeout(el._mcsid);
2711          }else{window.cancelAnimationFrame(el._mcsid);}
2712          el._mcsid=null;
2713          el._mcsstop=1;
2714        },
2715        /* -------------------- */
2716        
2717        
2718        /* deletes a property (avoiding the exception thrown by IE) */
2719        _delete:function(p){
2720          try{delete p;}catch(e){p=null;}
2721        },
2722        /* -------------------- */
2723        
2724        
2725        /* detects left mouse button */
2726        _mouseBtnLeft:function(e){
2727          return !(e.which && e.which!==1);
2728        },
2729        /* -------------------- */
2730        
2731        
2732        /* detects if pointer type event is touch */
2733        _pointerTouch:function(e){
2734          var t=e.originalEvent.pointerType;
2735          return !(t && t!=="touch" && t!==2);
2736        },
2737        /* -------------------- */
2738        
2739        
2740        /* checks if value is numeric */
2741        _isNumeric:function(val){
2742          return !isNaN(parseFloat(val)) && isFinite(val);
2743        }
2744        /* -------------------- */
2745        
2746      };
2747      
2748    
2749    
2750    
2751    
2752    /* 
2753    ----------------------------------------
2754    PLUGIN SETUP 
2755    ----------------------------------------
2756    */
2757    
2758    /* plugin constructor functions */
2759    $.fn[pluginNS]=function(method){ /* usage: $(selector).mCustomScrollbar(); */
2760      if(methods[method]){
2761        return methods[method].apply(this,Array.prototype.slice.call(arguments,1
2761));
2762      }else if(typeof method==="object" || !method){
2763        return methods.init.apply(this,arguments);
2764      }else{
2765        $.error("Method "+method+" does not exist");
2766      }
2767    };
2768    $[pluginNS]=function(method){ /* usage: $.mCustomScrollbar(); */
2769      if(methods[method]){
2770        return methods[method].apply(this,Array.prototype.slice.call(arguments,1));
2771      }else if(typeof method==="object" || !method){
2772        return methods.init.apply(this,arguments);
2773      }else{
2774        $.error("Method "+method+" does not exist");
2775      }
2776    };
2777    
2778    /* 
2779    allow setting plugin default options. 
2780    usage: $.mCustomScrollbar.defaults.scrollInertia=500; 
2781    to apply any changed default options on default selectors (below), use inside document ready fn 
2782    e.g.: $(document).ready(function(){ $.mCustomScrollbar.defaults.scrollInertia=500; });
2783    */
2784    $[pluginNS].defaults=defaults;
2785    
2786    /* 
2787    add window object (window.mCustomScrollbar) 
2788    usage: if(window.mCustomScrollbar){console.log("custom scrollbar plugin loaded");}
2789    */
2790    window[pluginNS]=true;
2791    
2792    $(window).load(function(){
2793      $(defaultSelector)[pluginNS](); /* add scrollbars automatically on default selector */
2794    });
2795  
2796  }))}(window,document));

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