PageSourceSearch

https://lkg.ru/bitrix/cache/js/s1/aspro_max/template_96f2c8496bebf…3d66f47dfc1f362f10b_v1.js?17778733661541851

js lkg.ru collected 2026-10-08 03:28:06 UTC 1,541,851 bytes, 37,768 lines download raw bytes

1
2; /* Start:"a:4:{s:4:"full";s:62:"/bitrix/templates/aspro_max/js/lazysizes.min.js?17164655377057";s:6:"source";s:47:"/bitrix/templates/aspro_max/js/lazysizes.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
3/*! lazysizes - v5.1.1 */
4!function(a,b){var c=b(a,a.document);a.lazySizes=c,"object"==typeof module&&module.exports&&(module.exports=c)}("undefined"!=typeof window?window:{},function(a,b){"use strict";var c,d;if(function(){var b,c={lazyClass:"lazyload",loadedClass:"lazyloaded",loadingClass:"lazyloading",preloadClass:"lazypreload",errorClass:"lazyerror",autosizesClass:"lazyautosizes",srcAttr:"data-src",srcsetAttr:"data-srcset",sizesAttr:"data-sizes",minSize:40,customMedia:{},init:!0,expFactor:1.5,hFac:.8,loadMode:2,loadHidden:!0,ricTimeout:0,throttleDelay:125};d=a.lazySizesConfig||a.lazysizesConfig||{};for(b in c)b in d||(d[b]=c[b])}(),!b||!b.getElementsByClassName)return{init:function(){},cfg:d,noSupport:!0};var e=b.documentElement,f=a.Date,g=a.HTMLPictureElement,h="addEventListener",i="getAttribute",j=a[h],k=a.setTimeout,l=a.requestAnimationFrame||k,m=a.requestIdleCallback,n=/^picture$/i,o=["load","error","lazyincluded","_lazyloaded"],p={},q=Array.prototype.forEach,r=function(a,b){return p[b]||(p[b]=new RegExp("(\\s|^)"+b+"(\\s|$)")),p[b].test(a[i]("class")||"")&&p[b]},s=function(a,b){r(a,b)||a.setAttribute("class",(a[i]("class")||"").trim()+" "+b)},t=function(a,b){var c;(c=r(a,b))&&a.setAttribute("class",(a[i]("class")||"").replace(c," "))},u=function(a,b,c){var d=c?h:"removeEventListener";c&&u(a,b),o.forEach(function(c){a[d](c,b)})},v=function(a,d,e,f,g){var h=b.createEvent("Event");return e||(e={}),e.instance=c,h.initEvent(d,!f,!g),h.detail=e,a.dispatchEvent(h),h},w=function(b,c){var e;!g&&(e=a.picturefill||d.pf)?(c&&c.src&&!b[i]("srcset")&&b.setAttribute("srcset",c.src),e({reevaluate:!0,elements:[b]})):c&&c.src&&(b.src=c.src)},x=function(a,b){return(getComputedStyle(a,null)||{})[b]},y=function(a,b,c){for(c=c||a.offsetWidth;c<d.minSize&&b&&!a._lazysizesWidth;)c=b.offsetWidth,b=b.parentNode;return c},z=function(){var a,c,d=[],e=[],f=d,g=function(){var b=f;for(f=d.length?e:d,a=!0,c=!1;b.length;)b.shift()();a=!1},h=function(d,e){a&&!e?d.apply(this,arguments):(f.push(d),c||(c=!0,(b.hidden?k:l)(g)))};return h._lsFlush=g,h}(),A=function(a,b){return b?function(){z(a)}:function(){var b=this,c=arguments;z(function(){a.apply(b,c)})}},B=function(a){var b,c=0,e=d.throttleDelay,g=d.ricTimeout,h=function(){b=!1,c=f.now(),a()},i=m&&g>49?function(){m(h,{timeout:g}),g!==d.ricTimeout&&(g=d.ricTimeout)}:A(function(){k(h)},!0);return function(a){var d;(a=!0===a)&&(g=33),b||(b=!0,d=e-(f.now()-c),d<0&&(d=0),a||d<9?i():k(i,d))}},C=function(a){var b,c,d=99,e=function(){b=null,a()},g=function(){var a=f.now()-c;a<d?k(g,d-a):(m||e)(e)};return function(){c=f.now(),b||(b=k(g,d))}},D=function(){var g,l,m,o,p,y,D,F,G,H,I,J,K=/^img$/i,L=/^iframe$/i,M="onscroll"in a&&!/(gle|ing)bot/.test(navigator.userAgent),N=0,O=0,P=0,Q=-1,R=function(a){P--,(!a||P<0||!a.target)&&(P=0)},S=function(a){return null==J&&(J="hidden"==x(b.body,"visibility")),J||"hidden"!=x(a.parentNode,"visibility")&&"hidden"!=x(a,"visibility")},T=function(a,c){var d,f=a,g=S(a);for(F-=c,I+=c,G-=c,H+=c;g&&(f=f.offsetParent)&&f!=b.body&&f!=e;)(g=(x(f,"opacity")||1)>0)&&"visible"!=x(f,"overflow")&&(d=f.getBoundingClientRect(),g=H>d.left&&G<d.right&&I>d.top-1&&F<d.bottom+1);return g},U=function(){var a,f,h,j,k,m,n,p,q,r,s,t,u=c.elements;if((o=d.loadMode)&&P<8&&(a=u.length)){for(f=0,Q++;f<a;f++)if(u[f]&&!u[f]._lazyRace)if(!M||c.prematureUnveil&&c.prematureUnveil(u[f]))aa(u[f]);else if((p=u[f][i]("data-expand"))&&(m=1*p)||(m=O),r||(r=!d.expand||d.expand<1?e.clientHeight>500&&e.clientWidth>500?500:370:d.expand,c._defEx=r,s=r*d.expFactor,t=d.hFac,J=null,O<s&&P<1&&Q>2&&o>2&&!b.hidden?(O=s,Q=0):O=o>1&&Q>1&&P<6?r:N),q!==m&&(y=innerWidth+m*t,D=innerHeight+m,n=-1*m,q=m),h=u[f].getBoundingClientRect(),(I=h.bottom)>=n&&(F=h.top)<=D&&(H=h.right)>=n*t&&(G=h.left)<=y&&(I||H||G||F)&&(d.loadHidden||S(u[f]))&&(l&&P<3&&!p&&(o<3||Q<4)||T(u[f],m))){if(aa(u[f]),k=!0,P>9)break}else!k&&l&&!j&&P<4&&Q<4&&o>
42&&(g[0]||d.preloadAfterLoad)&&(g[0]||!p&&(I||H||G||F||"auto"!=u[f][i](d.sizesAttr)))&&(j=g[0]||u[f]);j&&!k&&aa(j)}},V=B(U),W=function(a){var b=a.target;if(b._lazyCache)return void delete b._lazyCache;R(a),s(b,d.loadedClass),t(b,d.loadingClass),u(b,Y),v(b,"lazyloaded")},X=A(W),Y=function(a){X({target:a.target})},Z=function(a,b){try{a.contentWindow.location.replace(b)}catch(c){a.src=b}},$=function(a){var b,c=a[i](d.srcsetAttr);(b=d.customMedia[a[i]("data-media")||a[i]("media")])&&a.setAttribute("media",b),c&&a.setAttribute("srcset",c)},_=A(function(a,b,c,e,f){var g,h,j,l,o,p;(o=v(a,"lazybeforeunveil",b)).defaultPrevented||(e&&(c?s(a,d.autosizesClass):a.setAttribute("sizes",e)),h=a[i](d.srcsetAttr),g=a[i](d.srcAttr),f&&(j=a.parentNode,l=j&&n.test(j.nodeName||"")),p=b.firesLoad||"src"in a&&(h||g||l),o={target:a},s(a,d.loadingClass),p&&(clearTimeout(m),m=k(R,2500),u(a,Y,!0)),l&&q.call(j.getElementsByTagName("source"),$),h?a.setAttribute("srcset",h):g&&!l&&(L.test(a.nodeName)?Z(a,g):a.src=g),f&&(h||l)&&w(a,{src:g})),a._lazyRace&&delete a._lazyRace,t(a,d.lazyClass),z(function(){var b=a.complete&&a.naturalWidth>1;p&&!b||(b&&s(a,"ls-is-cached"),W(o),a._lazyCache=!0,k(function(){"_lazyCache"in a&&delete a._lazyCache},9)),"lazy"==a.loading&&P--},!0)}),aa=function(a){if(!a._lazyRace){var b,c=K.test(a.nodeName),e=c&&(a[i](d.sizesAttr)||a[i]("sizes")),f="auto"==e;(!f&&l||!c||!a[i]("src")&&!a.srcset||a.complete||r(a,d.errorClass)||!r(a,d.lazyClass))&&(b=v(a,"lazyunveilread").detail,f&&E.updateElem(a,!0,a.offsetWidth),a._lazyRace=!0,P++,_(a,b,f,e,c))}},ba=C(function(){d.loadMode=3,V()}),ca=function(){3==d.loadMode&&(d.loadMode=2),ba()},da=function(){if(!l){if(f.now()-p<999)return void k(da,999);l=!0,d.loadMode=3,V(),j("scroll",ca,!0)}};return{_:function(){p=f.now(),c.elements=b.getElementsByClassName(d.lazyClass),g=b.getElementsByClassName(d.lazyClass+" "+d.preloadClass),j("scroll",V,!0),j("resize",V,!0),a.MutationObserver?new MutationObserver(V).observe(e,{childList:!0,subtree:!0,attributes:!0}):(e[h]("DOMNodeInserted",V,!0),e[h]("DOMAttrModified",V,!0),setInterval(V,999)),j("hashchange",V,!0),["focus","mouseover","click","load","transitionend","animationend"].forEach(function(a){b[h](a,V,!0)}),/d$|^c/.test(b.readyState)?da():(j("load",da),b[h]("DOMContentLoaded",V),k(da,2e4)),c.elements.length?(U(),z._lsFlush()):V()},checkElems:V,unveil:aa,_aLSL:ca}}(),E=function(){var a,c=A(function(a,b,c,d){var e,f,g;if(a._lazysizesWidth=d,d+="px",a.setAttribute("sizes",d),n.test(b.nodeName||""))for(e=b.getElementsByTagName("source"),f=0,g=e.length;f<g;f++)e[f].setAttribute("sizes",d);c.detail.dataAttr||w(a,c.detail)}),e=function(a,b,d){var e,f=a.parentNode;f&&(d=y(a,f,d),e=v(a,"lazybeforesizes",{width:d,dataAttr:!!b}),e.defaultPrevented||(d=e.detail.width)&&d!==a._lazysizesWidth&&c(a,f,e,d))},f=function(){var b,c=a.length;if(c)for(b=0;b<c;b++)e(a[b])},g=C(f);return{_:function(){a=b.getElementsByClassName(d.autosizesClass),j("resize",g)},checkElems:g,updateElem:e}}(),F=function(){!F.i&&b.getElementsByClassName&&(F.i=!0,E._(),D._())};return k(function(){d.init&&F()}),c={cfg:d,autoSizer:E,loader:D,init:F,uP:w,aC:s,rC:t,hC:r,fire:v,gW:y,rAF:z}});
5/* End */
6;
7; /* Start:"a:4:{s:4:"full";s:67:"/bitrix/templates/aspro_max/js/ls.unveilhooks.min.js?17164655371467";s:6:"source";s:52:"/bitrix/templates/aspro_max/js/ls.unveilhooks.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
8/*! lazysizes - v4.0.3 */
9!function(a,b){var c=function(){b(a.lazySizes),a.removeEventListener("lazyunveilread",c,!0)};b=b.bind(null,a,a.document),"object"==typeof module&&module.exports?b(require("lazysizes")):a.lazySizes?c():a.addEventListener("lazyunveilread",c,!0)}(window,function(a,b,c){"use strict";function d(a,c){if(!g[a]){var d=b.createElement(c?"link":"script"),e=b.getElementsByTagName("script")[0];c?(d.rel="stylesheet",d.href=a):d.src=a,g[a]=!0,g[d.src||d.href]=!0,e.parentNode.insertBefore(d,e)}}var e,f,g={};b.addEventListener&&(f=/\(|\)|\s|'/,e=function(a,c){var d=b.createElement("img");d.onload=function(){d.onload=null,d.onerror=null,d=null,c()},d.onerror=d.onload,d.src=a,d&&d.complete&&d.onload&&d.onload()}
9,addEventListener("lazybeforeunveil",function(a){if(a.detail.instance==c){var b,g,h,i;a.defaultPrevented||("none"==a.target.preload&&(a.target.preload="auto"),b=a.target.getAttribute("data-link"),b&&d(b,!0),b=a.target.getAttribute("data-script"),b&&d(b),b=a.target.getAttribute("data-require"),b&&(c.cfg.requireJs?c.cfg.requireJs([b]):d(b)),h=a.target.getAttribute("data-bg"),h&&(a.detail.firesLoad=!0,g=function(){a.target.style.backgroundImage="url("+(f.test(h)?JSON.stringify(h):h)+")",a.detail.firesLoad=!1,c.fire(a.target,"_lazyloaded",{},!0,!0)},e(h,g)),i=a.target.getAttribute("data-poster"),i&&(a.detail.firesLoad=!0,g=function(){a.target.poster=i,a.detail.firesLoad=!1,c.fire(a.target,"_lazyloaded",{},!0,!0)},e(i,g)))}},!1))});
10/* End */
11;
12; /* Start:"a:4:{s:4:"full";s:66:"/bitrix/templates/aspro_max/js/jquery.actual.min.js?17164655371251";s:6:"source";s:51:"/bitrix/templates/aspro_max/js/jquery.actual.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
13/*! Copyright 2012, Ben Lin (http://dreamerslab.com/)
14 * Licensed under the MIT License (LICENSE.txt).
15 *
16 * Version: 1.0.18
17 *
18 * Requires: jQuery >= 1.2.3
19 */
20(function(a){if(typeof define==="function"&&define.amd){define(["jquery"],a);
21}else{a(jQuery);}}(function(a){a.fn.addBack=a.fn.addBack||a.fn.andSelf;a.fn.extend({actual:function(b,l){if(!this[b]){throw'$.actual => The jQuery method "'+b+'" you called does not exist';
22}var f={absolute:false,clone:false,includeMargin:false,display:"block"};var i=a.extend(f,l);var e=this.eq(0);var h,j;if(i.clone===true){h=function(){var m="position: absolute !important; top: -1000 !important; ";
23e=e.clone().attr("style",m).appendTo("body");};j=function(){e.remove();};}else{var g=[];var d="";var c;h=function(){c=e.parents().addBack().filter(":hidden");
24d+="visibility: hidden !important; display: "+i.display+" !important; ";if(i.absolute===true){d+="position: absolute !important; ";}c.each(function(){var m=a(this);
25var n=m.attr("style");g.push(n);m.attr("style",n?n+";"+d:d);});};j=function(){c.each(function(m){var o=a(this);var n=g[m];if(n===undefined){o.removeAttr("style");
26}else{o.attr("style",n);}});};}h();var k=/(outer)/.test(b)?e[b](i.includeMargin):e[b]();j();return k;}});}));
27/* End */
28;
29; /* Start:"a:4:{s:4:"full";s:72:"/bitrix/templates/aspro_max/vendor/js/jquery.bxslider.js?171646553766080";s:6:"source";s:56:"/bitrix/templates/aspro_max/vendor/js/jquery.bxslider.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
30/**
31 * bxSlider v4.2.12
32 * Copyright 2013-2015 Steven Wanderski
33 * Written while drinking Belgian ales and listening to jazz
34 * Licensed under MIT (http://opensource.org/licenses/MIT)
35 */
36
37;(function($) {
38
39  var defaults = {
40
41    // GENERAL
42    mode: 'horizontal',
43    slideSelector: '',
44    infiniteLoop: true,
45    hideControlOnEnd: false,
46    speed: 500,
47    easing: null,
48    slideMargin: 0,
49    startSlide: 0,
50    randomStart: false,
51    captions: false,
52    ticker: false,
53    tickerHover: false,
54    adaptiveHeight: false,
55    adaptiveHeightSpeed: 500,
56    video: false,
57    useCSS: true,
58    preloadImages: 'visible',
59    responsive: true,
60    slideZIndex: 50,
61    wrapperClass: 'bx-wrapper',
62
63    // TOUCH
64    touchEnabled: true,
65    swipeThreshold: 50,
66    oneToOneTouch: true,
67    preventDefaultSwipeX: true,
68    preventDefaultSwipeY: false,
69
70    // ACCESSIBILITY
71    ariaLive: true,
72    ariaHidden: true,
73
74    // KEYBOARD
75    keyboardEnabled: false,
76
77    // PAGER
78    pager: true,
79    pagerType: 'full',
80    pagerShortSeparator: ' / ',
81    pagerSelector: null,
82    buildPager: null,
83    pagerCustom: null,
84
85    // CONTROLS
86    controls: true,
87    nextText: 'Next',
88    prevText: 'Prev',
89    nextSelector: null,
90    prevSelector: null,
91    autoControls: false,
92    startText: 'Start',
93    stopText: 'Stop',
94    autoControlsCombine: false,
95    autoControlsSelector: null,
96
97    // AUTO
98    auto: false,
99    pause: 4000,
100    autoStart: true,
101    autoDirection: 'next',
102    stopAutoOnClick: false,
103    autoHover: false,
104    autoDelay: 0,
105    autoSlideForOnePage: false,
106
107    // CAROUSEL
108    minSlides: 1,
109    maxSlides: 1,
110    moveSlides: 0,
111    slideWidth: 0,
112    shrinkItems: false,
113
114    // CALLBACKS
115    onSliderLoad: function() { return true; },
116    onSlideBefore: function() { return true; },
117    onSlideAfter: function() { return true; },
118    onSlideNext: function() { return true; },
119    onSlidePrev: function() { return true; },
120    onSliderResize: function() { return true; },
121	onAutoChange: function() { return true; } //calls when auto slides starts and stops
122  };
123
124  $.fn.bxSlider = function(options) {
125
126    if (this.length === 0) {
127      return this;
128    }
129
130    // support multiple elements
131    if (this.length > 1) {
132      this.each(function() {
133        $(this).bxSlider(options);
134      });
135      return this;
136    }
137
138    // create a namespace to be used throughout the plugin
139    var slider = {},
140    // set a reference to our slider element
141    el = this,
142    // get the original window dimens (thanks a lot IE)
143    windowWidth = $(window).width(),
144    windowHeight = $(window).height();
145
146    // Return if slider is already initialized
147    if ($(el).data('bxSlider')) { return; }
148
149    /**
150     * ===================================================================================
151     * = PRIVATE FUNCTIONS
152     * ===================================================================================
153     */
154
155    /**
156     * Initializes namespace settings to be used throughout plugin
157     */
158    var init = function() {
159      // Return if slider is already initialized
160      if ($(el).data('bxSlider')) { return; }
161      // merge user-supplied options with the defaults
162      slider.settings = $.extend({}, defaults, options);
163      // parse slideWidth setting
164      slider.settings.slideWidth = parseInt(slider.settings.slideWidth);
165      // store the original children
166      slider.children = el.children(slider.settings.slideSelector);
167      // check if actual number of slides is less than minSlides / maxSlides
168      if (slider.children.length < slider.settings.minSlides) { slider.settings.minSlides = slider.children.length; }
169      if (slider.children.length < slider.settings.maxSlides) { slider.settings.maxSlides = slider.children.length; }
170      // if random start, set the startSlide setting to random number
171      if (slider.settings.randomStart) { slider.settings.startSlide = Math.floor(Math.random() * slider.children.length); }
172      // store active slide information
173      slider.active = { index: slider.settings.startSlide };
vendor: 8,753 bytes, lines 174-352
174      // store if the slider is in carousel mode (displaying / moving multiple slides)
175      slider.carousel = slider.settings.minSlides > 1 || slider.settings.maxSlides > 1 ? true : false;
176      // if carousel, force preloadImages = 'all'
177      if (slider.carousel) { slider.settings.preloadImages = 'all'; }
178      // calculate the min / max width thresholds based on min / max number of slides
179      // used to setup and update carousel slides dimensions
180      slider.minThreshold = (slider.settings.minSlides * slider.settings.slideWidth) + ((slider.settings.minSlides - 1) * slider.settings.slideMargin);
181      slider.maxThreshold = (slider.settings.maxSlides * slider.settings.slideWidth) + ((slider.settings.maxSlides - 1) * slider.settings.slideMargin);
182      // store the current state of the slider (if currently animating, working is true)
183      slider.working = false;
184      // initialize the controls object
185      slider.controls = {};
186      // initialize an auto interval
187      slider.interval = null;
188      // determine which property to use for transitions
189      slider.animProp = slider.settings.mode === 'vertical' ? 'top' : 'left';
190      // determine if hardware acceleration can be used
191      slider.usingCSS = slider.settings.useCSS && slider.settings.mode !== 'fade' && (function() {
192        // create our test div element
193        var div = document.createElement('div'),
194        // css transition properties
195        props = ['WebkitPerspective', 'MozPerspective', 'OPerspective', 'msPerspective'];
196        // test for each property
197        for (var i = 0; i < props.length; i++) {
198          if (div.style[props[i]] !== undefined) {
199            slider.cssPrefix = props[i].replace('Perspective', '').toLowerCase();
200            slider.animProp = '-' + slider.cssPrefix + '-transform';
201            return true;
202          }
203        }
204        return false;
205      }());
206      // if vertical mode always make maxSlides and minSlides equal
207      if (slider.settings.mode === 'vertical') { slider.settings.maxSlides = slider.settings.minSlides; }
208      // save original style data
209      el.data('origStyle', el.attr('style'));
210      el.children(slider.settings.slideSelector).each(function() {
211        $(this).data('origStyle', $(this).attr('style'));
212      });
213
214      // perform all DOM / CSS modifications
215      setup();
216    };
217
218    /**
219     * Performs all DOM and CSS modifications
220     */
221    var setup = function() {
222      var preloadSelector = slider.children.eq(slider.settings.startSlide); // set the default preload selector (visible)
223
224      // wrap el in a wrapper
225      el.wrap('<div class="' + slider.settings.wrapperClass + '"><div class="bx-viewport"></div></div>');
226      // store a namespace reference to .bx-viewport
227      slider.viewport = el.parent();
228
229      // add aria-live if the setting is enabled and ticker mode is disabled
230      if (slider.settings.ariaLive && !slider.settings.ticker) {
231        slider.viewport.attr('aria-live', 'polite');
232      }
233      // add a loading div to display while images are loading
234      slider.loader = $('<div class="bx-loading" />');
235      slider.viewport.prepend(slider.loader);
236      // set el to a massive width, to hold any needed slides
237      // also strip any margin and padding from el
238      el.css({
239        width: slider.settings.mode === 'horizontal' ? (slider.children.length * 1000 + 215) + '%' : 'auto',
240        position: 'relative'
241      });
242      // if using CSS, add the easing property
243      if (slider.usingCSS && slider.settings.easing) {
244        el.css('-' + slider.cssPrefix + '-transition-timing-function', slider.settings.easing);
245      // if not using CSS and no easing value was supplied, use the default JS animation easing (swing)
246      } else if (!slider.settings.easing) {
247        slider.settings.easing = 'swing';
248      }
249      // make modifications to the viewport (.bx-viewport)
250      slider.viewport.css({
251        width: '100%',
252        overflow: 'hidden',
253        position: 'relative'
254      });
255      slider.viewport.parent().css({
256        maxWidth: getViewportMaxWidth()
257      });
258      // apply css to all slider children
259      slider.children.css({
260        // the float attribute is a reserved word in compressors like YUI compressor and need to be quoted #48
261        'float': slider.settings.mode === 'horizontal' ? 'left' : 'none',
262        listStyle: 'none',
263        position: 'relative'
264      });
265      // apply the calculated width after the float is applied to prevent scrollbar interference
266      slider.children.css('width', getSlideWidth());
267      // if slideMargin is supplied, add the css
268      if (slider.settings.mode === 'horizontal' && slider.settings.slideMargin > 0) { slider.children.css('marginRight', slider.settings.slideMargin); }
269      if (slider.settings.mode === 'vertical' && slider.settings.slideMargin > 0) { slider.children.css('marginBottom', slider.settings.slideMargin); }
270      // if "fade" mode, add positioning and z-index CSS
271      if (slider.settings.mode === 'fade') {
272        slider.children.css({
273          position: 'absolute',
274          zIndex: 0,
275          display: 'none'
276        });
277        // prepare the z-index on the showing element
278        slider.children.eq(slider.settings.startSlide).css({zIndex: slider.settings.slideZIndex, display: 'block'});
279      }
280      // create an element to contain all slider controls (pager, start / stop, etc)
281      slider.controls.el = $('<div class="bx-controls" />');
282      // if captions are requested, add them
283      if (slider.settings.captions) { appendCaptions(); }
284      // check if startSlide is last slide
285      slider.active.last = slider.settings.startSlide === getPagerQty() - 1;
286      // if video is true, set up the fitVids plugin
287      if (slider.settings.video) { el.fitVids(); }
288      if (slider.settings.preloadImages === 'all' || slider.settings.ticker) { preloadSelector = slider.children; }
289      // only check for control addition if not in "ticker" mode
290      if (!slider.settings.ticker) {
291        // if controls are requested, add them
292        if (slider.settings.controls) { appendControls(); }
293        // if auto is true, and auto controls are requested, add them
294        if (slider.settings.auto && slider.settings.autoControls) { appendControlsAuto(); }
295        // if pager is requested, add it
296        if (slider.settings.pager) { appendPager(); }
297        // if any control option is requested, add the controls wrapper
298        if (slider.settings.controls || slider.settings.autoControls || slider.settings.pager) { slider.viewport.after(slider.controls.el); }
299      // if ticker mode, do not allow a pager
300      } else {
301        slider.settings.pager = false;
302      }
303      loadElements(preloadSelector, start);
304    };
305
306    var loadElements = function(selector, callback) {
307      var total = selector.find('img:not([src=""]), iframe').length,
308      count = 0;
309      if (total === 0) {
310        callback();
311        return;
312      }
313      selector.find('img:not([src=""]), iframe').each(function() {
314        $(this).one('load error', function() {
315          if (++count === total) { callback(); }
316        }).each(function() {
317          if (this.complete || this.src == '') { $(this).trigger('load'); }
318        });
319      });
320    };
321
322    /**
323     * Start the slider
324     */
325    var start = function() {
326      // if infinite loop, prepare additional slides
327      if (slider.settings.infiniteLoop && slider.settings.mode !== 'fade' && !slider.settings.ticker) {
328        var slice    = slider.settings.mode === 'vertical' ? slider.settings.minSlides : slider.settings.maxSlides,
329        sliceAppend  = slider.children.slice(0, slice).clone(true).addClass('bx-clone'),
330        slicePrepend = slider.children.slice(-slice).clone(true).addClass('bx-clone');
331        if (slider.settings.ariaHidden) {
332          sliceAppend.attr('aria-hidden', true);
333          slicePrepend.attr('aria-hidden', true);
334        }
335        el.append(sliceAppend).prepend(slicePrepend);
336      }
337      // remove the loading DOM element
338      slider.loader.remove();
339      // set the left / top position of "el"
340      setSlidePosition();
341      // if "vertical" mode, always use adaptiveHeight to prevent odd behavior
342      if (slider.settings.mode === 'vertical') { slider.settings.adaptiveHeight = true; }
343      // set the viewport height
344      slider.viewport.height(getViewportHeight());
345      // make sure everything is positioned just right (same as a window resize)
346      el.redrawSlider();
347      // onSliderLoad callback
348      slider.settings.onSliderLoad.call(el, slider.active.index);
349      // slider has been fully initialized
350      slider.initialized = true;
351      // bind the resize call to the window
352      if (slider.settings.responsive) { $(window).bind
vendor: 11,109 bytes, lines 352-592
352('resize', resizeWindow); }
353      // if auto is true and has more than 1 page, start the show
354      if (slider.settings.auto && slider.settings.autoStart && (getPagerQty() > 1 || slider.settings.autoSlideForOnePage)) { initAuto(); }
355      // if ticker is true, start the ticker
356      if (slider.settings.ticker) { initTicker(); }
357      // if pager is requested, make the appropriate pager link active
358      if (slider.settings.pager) { updatePagerActive(slider.settings.startSlide); }
359      // check for any updates to the controls (like hideControlOnEnd updates)
360      if (slider.settings.controls) { updateDirectionControls(); }
361      // if touchEnabled is true, setup the touch events
362      if (slider.settings.touchEnabled && !slider.settings.ticker) { initTouch(); }
363      // if keyboardEnabled is true, setup the keyboard events
364      if (slider.settings.keyboardEnabled && !slider.settings.ticker) {
365        $(document).keydown(keyPress);
366      }
367    };
368
369    /**
370     * Returns the calculated height of the viewport, used to determine either adaptiveHeight or the maxHeight value
371     */
372    var getViewportHeight = function() {
373      var height = 0;
374      // first determine which children (slides) should be used in our height calculation
375      var children = $();
376      // if mode is not "vertical" and adaptiveHeight is false, include all children
377      if (slider.settings.mode !== 'vertical' && !slider.settings.adaptiveHeight) {
378        children = slider.children;
379      } else {
380        // if not carousel, return the single active child
381        if (!slider.carousel) {
382          children = slider.children.eq(slider.active.index);
383        // if carousel, return a slice of children
384        } else {
385          // get the individual slide index
386          var currentIndex = slider.settings.moveSlides === 1 ? slider.active.index : slider.active.index * getMoveBy();
387          // add the current slide to the children
388          children = slider.children.eq(currentIndex);
389          // cycle through the remaining "showing" slides
390          for (i = 1; i <= slider.settings.maxSlides - 1; i++) {
391            // if looped back to the start
392            if (currentIndex + i >= slider.children.length) {
393              children = children.add(slider.children.eq(i - 1));
394            } else {
395              children = children.add(slider.children.eq(currentIndex + i));
396            }
397          }
398        }
399      }
400      // if "vertical" mode, calculate the sum of the heights of the children
401      if (slider.settings.mode === 'vertical') {
402        children.each(function(index) {
403          height += $(this).outerHeight();
404        });
405        // add user-supplied margins
406        if (slider.settings.slideMargin > 0) {
407          height += slider.settings.slideMargin * (slider.settings.minSlides - 1);
408        }
409      // if not "vertical" mode, calculate the max height of the children
410      } else {
411        height = Math.max.apply(Math, children.map(function() {
412          return $(this).outerHeight(false);
413        }).get());
414      }
415
416      if (slider.viewport.css('box-sizing') === 'border-box') {
417        height += parseFloat(slider.viewport.css('padding-top')) + parseFloat(slider.viewport.css('padding-bottom')) +
418              parseFloat(slider.viewport.css('border-top-width')) + parseFloat(slider.viewport.css('border-bottom-width'));
419      } else if (slider.viewport.css('box-sizing') === 'padding-box') {
420        height += parseFloat(slider.viewport.css('padding-top')) + parseFloat(slider.viewport.css('padding-bottom'));
421      }
422
423      return height;
424    };
425
426    /**
427     * Returns the calculated width to be used for the outer wrapper / viewport
428     */
429    var getViewportMaxWidth = function() {
430      var width = '100%';
431      if (slider.settings.slideWidth > 0) {
432        if (slider.settings.mode === 'horizontal') {
433          width = (slider.settings.maxSlides * slider.settings.slideWidth) + ((slider.settings.maxSlides - 1) * slider.settings.slideMargin);
434        } else {
435          width = slider.settings.slideWidth;
436        }
437      }
438      return width;
439    };
440
441    /**
442     * Returns the calculated width to be applied to each slide
443     */
444    var getSlideWidth = function() {
445      var newElWidth = slider.settings.slideWidth, // start with any user-supplied slide width
446      wrapWidth      = slider.viewport.width();    // get the current viewport width
447      // if slide width was not supplied, or is larger than the viewport use the viewport width
448      if (slider.settings.slideWidth === 0 ||
449        (slider.settings.slideWidth > wrapWidth && !slider.carousel) ||
450        slider.settings.mode === 'vertical') {
451        newElWidth = wrapWidth;
452      // if carousel, use the thresholds to determine the width
453      } else if (slider.settings.maxSlides > 1 && slider.settings.mode === 'horizontal') {
454        if (wrapWidth > slider.maxThreshold) {
455          return newElWidth;
456        } else if (wrapWidth < slider.minThreshold) {
457          newElWidth = (wrapWidth - (slider.settings.slideMargin * (slider.settings.minSlides - 1))) / slider.settings.minSlides;
458        } else if (slider.settings.shrinkItems) {
459          newElWidth = Math.floor((wrapWidth + slider.settings.slideMargin) / (Math.ceil((wrapWidth + slider.settings.slideMargin) / (newElWidth + slider.settings.slideMargin))) - slider.settings.slideMargin);
460        }
461      }
462      return newElWidth;
463    };
464
465    /**
466     * Returns the number of slides currently visible in the viewport (includes partially visible slides)
467     */
468    var getNumberSlidesShowing = function() {
469      var slidesShowing = 1,
470      childWidth = null;
471      if (slider.settings.mode === 'horizontal' && slider.settings.slideWidth > 0) {
472        // if viewport is smaller than minThreshold, return minSlides
473        if (slider.viewport.width() < slider.minThreshold) {
474          slidesShowing = slider.settings.minSlides;
475        // if viewport is larger than maxThreshold, return maxSlides
476        } else if (slider.viewport.width() > slider.maxThreshold) {
477          slidesShowing = slider.settings.maxSlides;
478        // if viewport is between min / max thresholds, divide viewport width by first child width
479        } else {
480          childWidth = slider.children.first().width() + slider.settings.slideMargin;
481          slidesShowing = Math.floor((slider.viewport.width() +
482            slider.settings.slideMargin) / childWidth) || 1;
483        }
484      // if "vertical" mode, slides showing will always be minSlides
485      } else if (slider.settings.mode === 'vertical') {
486        slidesShowing = slider.settings.minSlides;
487      }
488      return slidesShowing;
489    };
490
491    /**
492     * Returns the number of pages (one full viewport of slides is one "page")
493     */
494    var getPagerQty = function() {
495      var pagerQty = 0,
496      breakPoint = 0,
497      counter = 0;
498      // if moveSlides is specified by the user
499      if (slider.settings.moveSlides > 0) {
500        if (slider.settings.infiniteLoop) {
501          pagerQty = Math.ceil(slider.children.length / getMoveBy());
502        } else {
503          // when breakpoint goes above children length, counter is the number of pages
504          while (breakPoint < slider.children.length) {
505            ++pagerQty;
506            breakPoint = counter + getNumberSlidesShowing();
507            counter += slider.settings.moveSlides <= getNumberSlidesShowing() ? slider.settings.moveSlides : getNumberSlidesShowing();
508          }
509		  return counter;
510        }
511      // if moveSlides is 0 (auto) divide children length by sides showing, then round up
512      } else {
513        pagerQty = Math.ceil(slider.children.length / getNumberSlidesShowing());
514      }
515      return pagerQty;
516    };
517
518    /**
519     * Returns the number of individual slides by which to shift the slider
520     */
521    var getMoveBy = function() {
522      // if moveSlides was set by the user and moveSlides is less than number of slides showing
523      if (slider.settings.moveSlides > 0 && slider.settings.moveSlides <= getNumberSlidesShowing()) {
524        return slider.settings.moveSlides;
525      }
526      // if moveSlides is 0 (auto)
527      return getNumberSlidesShowing();
528    };
529
530    /**
531     * Sets the slider's (el) left or top position
532     */
533    var setSlidePosition = function() {
534      var position, lastChild, lastShowingIndex;
535      // if last slide, not infinite loop, and number of children is larger than specified maxSlides
536      if (slider.children.length > slider.settings.maxSlides && slider.active.last && !slider.settings.infiniteLoop) {
537        if (slider.settings.mode === 'horizontal') {
538          // get the last child's position
539          lastChild = slider.children.last();
540          position = lastChild.position();
541          // set the left position
542          setPositionProperty(-(position.left - (slider.viewport.width() - lastChild.outerWidth())), 'reset', 0);
543        } else if (slider.settings.mode === 'vertical') {
544          // get the last showing index's position
545          lastShowingIndex = slider.children.length - slider.settings.minSlides;
546          position = slider.children.eq(lastShowingIndex).position();
547          // set the top position
548          setPositionProperty(-position.top, 'reset', 0);
549        }
550      // if not last slide
551      } else {
552        // get the position of the first showing slide
553        position = slider.children.eq(slider.active.index * getMoveBy()).position();
554        // check for last slide
555        if (slider.active.index === getPagerQty() - 1) { slider.active.last = true; }
556        // set the respective position
557        if (position !== undefined) {
558          if (slider.settings.mode === 'horizontal') { setPositionProperty(-position.left, 'reset', 0); }
559          else if (slider.settings.mode === 'vertical') { setPositionProperty(-position.top, 'reset', 0); }
560        }
561      }
562    };
563
564    /**
565     * Sets the el's animating property position (which in turn will sometimes animate el).
566     * If using CSS, sets the transform property. If not using CSS, sets the top / left property.
567     *
568     * @param value (int)
569     *  - the animating property's value
570     *
571     * @param type (string) 'slide', 'reset', 'ticker'
572     *  - the type of instance for which the function is being
573     *
574     * @param duration (int)
575     *  - the amount of time (in ms) the transition should occupy
576     *
577     * @param params (array) optional
578     *  - an optional parameter containing any variables that need to be passed in
579     */
580    var setPositionProperty = function(value, type, duration, params) {
581      var animateObj, propValue;
582      // use CSS transform
583      if (slider.usingCSS) {
584        // determine the translate3d value
585        propValue = slider.settings.mode === 'vertical' ? 'translate3d(0, ' + value + 'px, 0)' : 'translate3d(' + value + 'px, 0, 0)';
586        // add the CSS transition-duration
587        el.css('-' + slider.cssPrefix + '-transition-duration', duration / 1000 + 's');
588        if (type === 'slide') {
589          // set the property value
590          el.css(slider.animProp, propValue);
591          if (duration !== 0) {
592            // 
vendor: 6,125 bytes, lines 592-730
592bind a callback method - executes when CSS transition completes
593            el.bind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd', function(e) {
594              //make sure it's the correct one
595              if (!$(e.target).is(el)) { return; }
596              // unbind the callback
597              el.unbind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd');
598              updateAfterSlideTransition();
599            });
600          } else { //duration = 0
601            updateAfterSlideTransition();
602          }
603        } else if (type === 'reset') {
604          el.css(slider.animProp, propValue);
605        } else if (type === 'ticker') {
606          // make the transition use 'linear'
607          el.css('-' + slider.cssPrefix + '-transition-timing-function', 'linear');
608          el.css(slider.animProp, propValue);
609          if (duration !== 0) {
610            el.bind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd', function(e) {
611              //make sure it's the correct one
612              if (!$(e.target).is(el)) { return; }
613              // unbind the callback
614              el.unbind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd');
615              // reset the position
616              setPositionProperty(params.resetValue, 'reset', 0);
617              // start the loop again
618              tickerLoop();
619            });
620          } else { //duration = 0
621            setPositionProperty(params.resetValue, 'reset', 0);
622            tickerLoop();
623          }
624        }
625      // use JS animate
626      } else {
627        animateObj = {};
628        animateObj[slider.animProp] = value;
629        if (type === 'slide') {
630          el.animate(animateObj, duration, slider.settings.easing, function() {
631            updateAfterSlideTransition();
632          });
633        } else if (type === 'reset') {
634          el.css(slider.animProp, value);
635        } else if (type === 'ticker') {
636          el.animate(animateObj, duration, 'linear', function() {
637            setPositionProperty(params.resetValue, 'reset', 0);
638            // run the recursive loop after animation
639            tickerLoop();
640          });
641        }
642      }
643    };
644
645    /**
646     * Populates the pager with proper amount of pages
647     */
648    var populatePager = function() {
649      var pagerHtml = '',
650      linkContent = '',
651      pagerQty = getPagerQty();
652      // loop through each pager item
653      for (var i = 0; i < pagerQty; i++) {
654        linkContent = '';
655        // if a buildPager function is supplied, use it to get pager link value, else use index + 1
656        if (slider.settings.buildPager && $.isFunction(slider.settings.buildPager) || slider.settings.pagerCustom) {
657          linkContent = slider.settings.buildPager(i);
658          slider.pagerEl.addClass('bx-custom-pager');
659        } else {
660          linkContent = i + 1;
661          slider.pagerEl.addClass('bx-default-pager');
662        }
663        // var linkContent = slider.settings.buildPager && $.isFunction(slider.settings.buildPager) ? slider.settings.buildPager(i) : i + 1;
664        // add the markup to the string
665        pagerHtml += '<div class="bx-pager-item"><a href="" data-slide-index="' + i + '" class="bx-pager-link">' + linkContent + '</a></div>';
666      }
667      // populate the pager element with pager links
668      slider.pagerEl.html(pagerHtml);
669    };
670
671    /**
672     * Appends the pager to the controls element
673     */
674    var appendPager = function() {
675      if (!slider.settings.pagerCustom) {
676        // create the pager DOM element
677        slider.pagerEl = $('<div class="bx-pager" />');
678        // if a pager selector was supplied, populate it with the pager
679        if (slider.settings.pagerSelector) {
680          $(slider.settings.pagerSelector).html(slider.pagerEl);
681        // if no pager selector was supplied, add it after the wrapper
682        } else {
683          slider.controls.el.addClass('bx-has-pager').append(slider.pagerEl);
684        }
685        // populate the pager
686        populatePager();
687      } else {
688        slider.pagerEl = $(slider.settings.pagerCustom);
689      }
690      // assign the pager click binding
691      slider.pagerEl.on('click touchend', 'a', clickPagerBind);
692    };
693
694    /**
695     * Appends prev / next controls to the controls element
696     */
697    var appendControls = function() {
698      slider.controls.next = $('<a class="bx-next" href="">' + slider.settings.nextText + '</a>');
699      slider.controls.prev = $('<a class="bx-prev" href="">' + slider.settings.prevText + '</a>');
700      // bind click actions to the controls
701      slider.controls.next.bind('click touchend', clickNextBind);
702      slider.controls.prev.bind('click touchend', clickPrevBind);
703      // if nextSelector was supplied, populate it
704      if (slider.settings.nextSelector) {
705        $(slider.settings.nextSelector).append(slider.controls.next);
706      }
707      // if prevSelector was supplied, populate it
708      if (slider.settings.prevSelector) {
709        $(slider.settings.prevSelector).append(slider.controls.prev);
710      }
711      // if no custom selectors were supplied
712      if (!slider.settings.nextSelector && !slider.settings.prevSelector) {
713        // add the controls to the DOM
714        slider.controls.directionEl = $('<div class="bx-controls-direction" />');
715        // add the control elements to the directionEl
716        slider.controls.directionEl.append(slider.controls.prev).append(slider.controls.next);
717        // slider.viewport.append(slider.controls.directionEl);
718        slider.controls.el.addClass('bx-has-controls-direction').append(slider.controls.directionEl);
719      }
720    };
721
722    /**
723     * Appends start / stop auto controls to the controls element
724     */
725    var appendControlsAuto = function() {
726      slider.controls.start = $('<div class="bx-controls-auto-item"><a class="bx-start" href="">' + slider.settings.startText + '</a></div>');
727      slider.controls.stop = $('<div class="bx-controls-auto-item"><a class="bx-stop" href="">' + slider.settings.stopText + '</a></div>');
728      // add the controls to the DOM
729      slider.controls.autoEl = $('<div class="bx-controls-auto" />');
730      // bind
vendor: 7,523 bytes, lines 730-938
730 click actions to the controls
731      slider.controls.autoEl.on('click', '.bx-start', clickStartBind);
732      slider.controls.autoEl.on('click', '.bx-stop', clickStopBind);
733      // if autoControlsCombine, insert only the "start" control
734      if (slider.settings.autoControlsCombine) {
735        slider.controls.autoEl.append(slider.controls.start);
736      // if autoControlsCombine is false, insert both controls
737      } else {
738        slider.controls.autoEl.append(slider.controls.start).append(slider.controls.stop);
739      }
740      // if auto controls selector was supplied, populate it with the controls
741      if (slider.settings.autoControlsSelector) {
742        $(slider.settings.autoControlsSelector).html(slider.controls.autoEl);
743      // if auto controls selector was not supplied, add it after the wrapper
744      } else {
745        slider.controls.el.addClass('bx-has-controls-auto').append(slider.controls.autoEl);
746      }
747      // update the auto controls
748      updateAutoControls(slider.settings.autoStart ? 'stop' : 'start');
749    };
750
751    /**
752     * Appends image captions to the DOM
753     */
754    var appendCaptions = function() {
755      // cycle through each child
756      slider.children.each(function(index) {
757        // get the image title attribute
758        var title = $(this).find('img:first').attr('title');
759        // append the caption
760        if (title !== undefined && ('' + title).length) {
761          $(this).append('<div class="bx-caption"><span>' + title + '</span></div>');
762        }
763      });
764    };
765
766    /**
767     * Click next binding
768     *
769     * @param e (event)
770     *  - DOM event object
771     */
772    var clickNextBind = function(e) {
773      e.preventDefault();
774      if (slider.controls.el.hasClass('disabled')) { return; }
775      // if auto show is running, stop it
776      if (slider.settings.auto && slider.settings.stopAutoOnClick) { el.stopAuto(); }
777      el.goToNextSlide();
778    };
779
780    /**
781     * Click prev binding
782     *
783     * @param e (event)
784     *  - DOM event object
785     */
786    var clickPrevBind = function(e) {
787      e.preventDefault();
788      if (slider.controls.el.hasClass('disabled')) { return; }
789      // if auto show is running, stop it
790      if (slider.settings.auto && slider.settings.stopAutoOnClick) { el.stopAuto(); }
791      el.goToPrevSlide();
792    };
793
794    /**
795     * Click start binding
796     *
797     * @param e (event)
798     *  - DOM event object
799     */
800    var clickStartBind = function(e) {
801      el.startAuto();
802      e.preventDefault();
803    };
804
805    /**
806     * Click stop binding
807     *
808     * @param e (event)
809     *  - DOM event object
810     */
811    var clickStopBind = function(e) {
812      el.stopAuto();
813      e.preventDefault();
814    };
815
816    /**
817     * Click pager binding
818     *
819     * @param e (event)
820     *  - DOM event object
821     */
822    var clickPagerBind = function(e) {
823      var pagerLink, pagerIndex;
824      e.preventDefault();
825      if (slider.controls.el.hasClass('disabled')) {
826        return;
827      }
828      // if auto show is running, stop it
829      if (slider.settings.auto  && slider.settings.stopAutoOnClick) { el.stopAuto(); }
830      pagerLink = $(e.currentTarget);
831      if (pagerLink.attr('data-slide-index') !== undefined) {
832        pagerIndex = parseInt(pagerLink.attr('data-slide-index'));
833        // if clicked pager link is not active, continue with the goToSlide call
834        if (pagerIndex !== slider.active.index) { el.goToSlide(pagerIndex); }
835      }
836    };
837
838    /**
839     * Updates the pager links with an active class
840     *
841     * @param slideIndex (int)
842     *  - index of slide to make active
843     */
844    var updatePagerActive = function(slideIndex) {
845      // if "short" pager type
846      var len = slider.children.length; // nb of children
847      if (slider.settings.pagerType === 'short') {
848        if (slider.settings.maxSlides > 1) {
849          len = Math.ceil(slider.children.length / slider.settings.maxSlides);
850        }
851        slider.pagerEl.html((slideIndex + 1) + slider.settings.pagerShortSeparator + len);
852        return;
853      }
854      // remove all pager active classes
855      slider.pagerEl.find('a').removeClass('active');
856      // apply the active class for all pagers
857      slider.pagerEl.each(function(i, el) { $(el).find('a').eq(slideIndex).addClass('active'); });
858    };
859
860    /**
861     * Performs needed actions after a slide transition
862     */
863    var updateAfterSlideTransition = function() {
864      // if infinite loop is true
865      if (slider.settings.infiniteLoop) {
866        var position = '';
867        // first slide
868        if (slider.active.index === 0) {
869          // set the new position
870          position = slider.children.eq(0).position();
871        // carousel, last slide
872        } else if (slider.active.index === getPagerQty() - 1 && slider.carousel) {
873          position = slider.children.eq((getPagerQty() - 1) * getMoveBy()).position();
874        // last slide
875        } else if (slider.active.index === slider.children.length - 1) {
876          position = slider.children.eq(slider.children.length - 1).position();
877        }
878        if (position) {
879          if (slider.settings.mode === 'horizontal') { setPositionProperty(-position.left, 'reset', 0); }
880          else if (slider.settings.mode === 'vertical') { setPositionProperty(-position.top, 'reset', 0); }
881        }
882      }
883      // declare that the transition is complete
884      slider.working = false;
885      // onSlideAfter callback
886      slider.settings.onSlideAfter.call(el, slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index);
887    };
888
889    /**
890     * Updates the auto controls state (either active, or combined switch)
891     *
892     * @param state (string) "start", "stop"
893     *  - the new state of the auto show
894     */
895    var updateAutoControls = function(state) {
896      // if autoControlsCombine is true, replace the current control with the new state
897      if (slider.settings.autoControlsCombine) {
898        slider.controls.autoEl.html(slider.controls[state]);
899      // if autoControlsCombine is false, apply the "active" class to the appropriate control
900      } else {
901        slider.controls.autoEl.find('a').removeClass('active');
902        slider.controls.autoEl.find('a:not(.bx-' + state + ')').addClass('active');
903      }
904    };
905
906    /**
907     * Updates the direction controls (checks if either should be hidden)
908     */
909    var updateDirectionControls = function() {
910      if (getPagerQty() === 1) {
911        slider.controls.prev.addClass('disabled');
912        slider.controls.next.addClass('disabled');
913      } else if (!slider.settings.infiniteLoop && slider.settings.hideControlOnEnd) {
914        // if first slide
915        if (slider.active.index === 0) {
916          slider.controls.prev.addClass('disabled');
917          slider.controls.next.removeClass('disabled');
918        // if last slide
919        } else if (slider.active.index === getPagerQty() - 1) {
920          slider.controls.next.addClass('disabled');
921          slider.controls.prev.removeClass('disabled');
922        // if any slide in the middle
923        } else {
924          slider.controls.prev.removeClass('disabled');
925          slider.controls.next.removeClass('disabled');
926        }
927      }
928    };
929	/* auto start and stop functions */
930	var windowFocusHandler = function() { el.startAuto(); };
931	var windowBlurHandler = function() { el.stopAuto(); };
932    /**
933     * Initializes the auto process
934     */
935    var initAuto = function() {
936      // if autoDelay was supplied, launch the auto show using a setTimeout() call
937      if (slider.settings.autoDelay > 0) {
938        
938var timeout =
vendor: 6,544 bytes, lines 938-1104
938 setTimeout(el.startAuto, slider.settings.autoDelay);
939      // if autoDelay was not supplied, start the auto show normally
940      } else {
941        el.startAuto();
942
943        //add focus and blur events to ensure its running if timeout gets paused
944        $(window).focus(windowFocusHandler).blur(windowBlurHandler);
945      }
946      // if autoHover is requested
947      if (slider.settings.autoHover) {
948        // on el hover
949        el.hover(function() {
950          // if the auto show is currently playing (has an active interval)
951          if (slider.interval) {
952            // stop the auto show and pass true argument which will prevent control update
953            el.stopAuto(true);
954            // create a new autoPaused value which will be used by the relative "mouseout" event
955            slider.autoPaused = true;
956          }
957        }, function() {
958          // if the autoPaused value was created be the prior "mouseover" event
959          if (slider.autoPaused) {
960            // start the auto show and pass true argument which will prevent control update
961            el.startAuto(true);
962            // reset the autoPaused value
963            slider.autoPaused = null;
964          }
965        });
966      }
967    };
968
969    /**
970     * Initializes the ticker process
971     */
972    var initTicker = function() {
973      var startPosition = 0,
974      position, transform, value, idx, ratio, property, newSpeed, totalDimens;
975      // if autoDirection is "next", append a clone of the entire slider
976      if (slider.settings.autoDirection === 'next') {
977        el.append(slider.children.clone().addClass('bx-clone'));
978      // if autoDirection is "prev", prepend a clone of the entire slider, and set the left position
979      } else {
980        el.prepend(slider.children.clone().addClass('bx-clone'));
981        position = slider.children.first().position();
982        startPosition = slider.settings.mode === 'horizontal' ? -position.left : -position.top;
983      }
984      setPositionProperty(startPosition, 'reset', 0);
985      // do not allow controls in ticker mode
986      slider.settings.pager = false;
987      slider.settings.controls = false;
988      slider.settings.autoControls = false;
989      // if autoHover is requested
990      if (slider.settings.tickerHover) {
991        if (slider.usingCSS) {
992          idx = slider.settings.mode === 'horizontal' ? 4 : 5;
993          slider.viewport.hover(function() {
994            transform = el.css('-' + slider.cssPrefix + '-transform');
995            value = parseFloat(transform.split(',')[idx]);
996            setPositionProperty(value, 'reset', 0);
997          }, function() {
998            totalDimens = 0;
999            slider.children.each(function(index) {
1000              totalDimens += slider.settings.mode === 'horizontal' ? $(this).outerWidth(true) : $(this).outerHeight(true);
1001            });
1002            // calculate the speed ratio (used to determine the new speed to finish the paused animation)
1003            ratio = slider.settings.speed / totalDimens;
1004            // determine which property to use
1005            property = slider.settings.mode === 'horizontal' ? 'left' : 'top';
1006            // calculate the new speed
1007            newSpeed = ratio * (totalDimens - (Math.abs(parseInt(value))));
1008            tickerLoop(newSpeed);
1009          });
1010        } else {
1011          // on el hover
1012          slider.viewport.hover(function() {
1013            el.stop();
1014          }, function() {
1015            // calculate the total width of children (used to calculate the speed ratio)
1016            totalDimens = 0;
1017            slider.children.each(function(index) {
1018              totalDimens += slider.settings.mode === 'horizontal' ? $(this).outerWidth(true) : $(this).outerHeight(true);
1019            });
1020            // calculate the speed ratio (used to determine the new speed to finish the paused animation)
1021            ratio = slider.settings.speed / totalDimens;
1022            // determine which property to use
1023            property = slider.settings.mode === 'horizontal' ? 'left' : 'top';
1024            // calculate the new speed
1025            newSpeed = ratio * (totalDimens - (Math.abs(parseInt(el.css(property)))));
1026            tickerLoop(newSpeed);
1027          });
1028        }
1029      }
1030      // start the ticker loop
1031      tickerLoop();
1032    };
1033
1034    /**
1035     * Runs a continuous loop, news ticker-style
1036     */
1037    var tickerLoop = function(resumeSpeed) {
1038      var speed = resumeSpeed ? resumeSpeed : slider.settings.speed,
1039      position = {left: 0, top: 0},
1040      reset = {left: 0, top: 0},
1041      animateProperty, resetValue, params;
1042
1043      // if "next" animate left position to last child, then reset left to 0
1044      if (slider.settings.autoDirection === 'next') {
1045        position = el.find('.bx-clone').first().position();
1046      // if "prev" animate left position to 0, then reset left to first non-clone child
1047      } else {
1048        reset = slider.children.first().position();
1049      }
1050      animateProperty = slider.settings.mode === 'horizontal' ? -position.left : -position.top;
1051      resetValue = slider.settings.mode === 'horizontal' ? -reset.left : -reset.top;
1052      params = {resetValue: resetValue};
1053      setPositionProperty(animateProperty, 'ticker', speed, params);
1054    };
1055
1056    /**
1057     * Check if el is on screen
1058     */
1059    var isOnScreen = function(el) {
1060      var win = $(window),
1061      viewport = {
1062        top: win.scrollTop(),
1063        left: win.scrollLeft()
1064      },
1065      bounds = el.offset();
1066
1067      viewport.right = viewport.left + win.width();
1068      viewport.bottom = viewport.top + win.height();
1069      bounds.right = bounds.left + el.outerWidth();
1070      bounds.bottom = bounds.top + el.outerHeight();
1071
1072      return (!(viewport.right < bounds.left || viewport.left > bounds.right || viewport.bottom < bounds.top || viewport.top > bounds.bottom));
1073    };
1074
1075    /**
1076     * Initializes keyboard events
1077     */
1078    var keyPress = function(e) {
1079      var activeElementTag = document.activeElement.tagName.toLowerCase(),
1080      tagFilters = 'input|textarea',
1081      p = new RegExp(activeElementTag,['i']),
1082      result = p.exec(tagFilters);
1083
1084      if (result == null && isOnScreen(el)) {
1085        if (e.keyCode === 39) {
1086          clickNextBind(e);
1087          return false;
1088        } else if (e.keyCode === 37) {
1089          clickPrevBind(e);
1090          return false;
1091        }
1092      }
1093    };
1094
1095    /**
1096     * Initializes touch events
1097     */
1098    var initTouch = function() {
1099      // initialize object to contain all touch values
1100      slider.touch = {
1101        start: {x: 0, y: 0},
1102        end: {x: 0, y: 0}
1103      };
1104      slider.viewport.
vendor: 6,703 bytes, lines 1104-1266
1104bind('touchstart MSPointerDown pointerdown', onTouchStart);
1105
1106      //for browsers that have implemented pointer events and fire a click after
1107      //every pointerup regardless of whether pointerup is on same screen location as pointerdown or not
1108      slider.viewport.on('click', '.bxslider a', function(e) {
1109        if (slider.viewport.hasClass('click-disabled')) {
1110          e.preventDefault();
1111          slider.viewport.removeClass('click-disabled');
1112        }
1113      });
1114    };
1115
1116    /**
1117     * Event handler for "touchstart"
1118     *
1119     * @param e (event)
1120     *  - DOM event object
1121     */
1122    var onTouchStart = function(e) {
1123      //disable slider controls while user is interacting with slides to avoid slider freeze that happens on touch devices when a slide swipe happens immediately after interacting with slider controls
1124      slider.controls.el.addClass('disabled');
1125
1126      if (slider.working) {
1127        e.preventDefault();
1128        slider.controls.el.removeClass('disabled');
1129      } else {
1130        // record the original position when touch starts
1131        slider.touch.originalPos = el.position();
1132        var orig = e.originalEvent,
1133        touchPoints = (typeof orig.changedTouches !== 'undefined') ? orig.changedTouches : [orig];
1134        // record the starting touch x, y coordinates
1135        slider.touch.start.x = touchPoints[0].pageX;
1136        slider.touch.start.y = touchPoints[0].pageY;
1137
1138        var chromePointerEvents = typeof PointerEvent === 'function'; if (chromePointerEvents) { if (orig.pointerId === undefined) { return; } }
1139        if (slider.viewport.get(0).setPointerCapture) {
1140          slider.pointerId = orig.pointerId;
1141          slider.viewport.get(0).setPointerCapture(slider.pointerId);
1142        }
1143        // bind a "touchmove" event to the viewport
1144        slider.viewport.bind('touchmove MSPointerMove pointermove', onTouchMove);
1145        // bind a "touchend" event to the viewport
1146        slider.viewport.bind('touchend MSPointerUp pointerup', onTouchEnd);
1147        slider.viewport.bind('MSPointerCancel pointercancel', onPointerCancel);
1148      }
1149    };
1150
1151    /**
1152     * Cancel Pointer for Windows Phone
1153     *
1154     * @param e (event)
1155     *  - DOM event object
1156     */
1157    var onPointerCancel = function(e) {
1158      /* onPointerCancel handler is needed to deal with situations when a touchend
1159      doesn't fire after a touchstart (this happens on windows phones only) */
1160      setPositionProperty(slider.touch.originalPos.left, 'reset', 0);
1161
1162      //remove handlers
1163      slider.controls.el.removeClass('disabled');
1164      slider.viewport.unbind('MSPointerCancel pointercancel', onPointerCancel);
1165      slider.viewport.unbind('touchmove MSPointerMove pointermove', onTouchMove);
1166      slider.viewport.unbind('touchend MSPointerUp pointerup', onTouchEnd);
1167      if (slider.viewport.get(0).releasePointerCapture) {
1168        slider.viewport.get(0).releasePointerCapture(slider.pointerId);
1169      }
1170    };
1171
1172    /**
1173     * Event handler for "touchmove"
1174     *
1175     * @param e (event)
1176     *  - DOM event object
1177     */
1178    var onTouchMove = function(e) {
1179      var orig = e.originalEvent,
1180      touchPoints = (typeof orig.changedTouches !== 'undefined') ? orig.changedTouches : [orig],
1181      // if scrolling on y axis, do not prevent default
1182      xMovement = Math.abs(touchPoints[0].pageX - slider.touch.start.x),
1183      yMovement = Math.abs(touchPoints[0].pageY - slider.touch.start.y),
1184      value = 0,
1185      change = 0;
1186
1187      // x axis swipe
1188      if ((xMovement * 3) > yMovement && slider.settings.preventDefaultSwipeX) {
1189        e.preventDefault();
1190      // y axis swipe
1191      } else if ((yMovement * 3) > xMovement && slider.settings.preventDefaultSwipeY) {
1192        e.preventDefault();
1193      }
1194      if (slider.settings.mode !== 'fade' && slider.settings.oneToOneTouch) {
1195        // if horizontal, drag along x axis
1196        if (slider.settings.mode === 'horizontal') {
1197          change = touchPoints[0].pageX - slider.touch.start.x;
1198          value = slider.touch.originalPos.left + change;
1199        // if vertical, drag along y axis
1200        } else {
1201          change = touchPoints[0].pageY - slider.touch.start.y;
1202          value = slider.touch.originalPos.top + change;
1203        }
1204        setPositionProperty(value, 'reset', 0);
1205      }
1206    };
1207
1208    /**
1209     * Event handler for "touchend"
1210     *
1211     * @param e (event)
1212     *  - DOM event object
1213     */
1214    var onTouchEnd = function(e) {
1215      slider.viewport.unbind('touchmove MSPointerMove pointermove', onTouchMove);
1216      //enable slider controls as soon as user stops interacing with slides
1217      slider.controls.el.removeClass('disabled');
1218      var orig    = e.originalEvent,
1219      touchPoints = (typeof orig.changedTouches !== 'undefined') ? orig.changedTouches : [orig],
1220      value       = 0,
1221      distance    = 0;
1222      // record end x, y positions
1223      slider.touch.end.x = touchPoints[0].pageX;
1224      slider.touch.end.y = touchPoints[0].pageY;
1225      // if fade mode, check if absolute x distance clears the threshold
1226      if (slider.settings.mode === 'fade') {
1227        distance = Math.abs(slider.touch.start.x - slider.touch.end.x);
1228        if (distance >= slider.settings.swipeThreshold) {
1229          if (slider.touch.start.x > slider.touch.end.x) {
1230            el.goToNextSlide();
1231          } else {
1232            el.goToPrevSlide();
1233          }
1234          el.stopAuto();
1235        }
1236      // not fade mode
1237      } else {
1238        // calculate distance and el's animate property
1239        if (slider.settings.mode === 'horizontal') {
1240          distance = slider.touch.end.x - slider.touch.start.x;
1241          value = slider.touch.originalPos.left;
1242        } else {
1243          distance = slider.touch.end.y - slider.touch.start.y;
1244          value = slider.touch.originalPos.top;
1245        }
1246        // if not infinite loop and first / last slide, do not attempt a slide transition
1247        if (!slider.settings.infiniteLoop && ((slider.active.index === 0 && distance > 0) || (slider.active.last && distance < 0))) {
1248          setPositionProperty(value, 'reset', 200);
1249        } else {
1250          // check if distance clears threshold
1251          if (Math.abs(distance) >= slider.settings.swipeThreshold) {
1252            if (distance < 0) {
1253              el.goToNextSlide();
1254            } else {
1255              el.goToPrevSlide();
1256            }
1257            el.stopAuto();
1258          } else {
1259            // el.animate(property, 200);
1260            setPositionProperty(value, 'reset', 200);
1261          }
1262        }
1263      }
1264      slider.viewport.unbind('touchend MSPointerUp pointerup', onTouchEnd);
1265      if (slider.viewport.get(0).releasePointerCapture) {
1266        slider.viewport.get(0).releasePointerCapture(slider.pointerId
vendor: 9,203 bytes, lines 1266-1473
1266);
1267      }
1268    };
1269
1270    /**
1271     * Window resize event callback
1272     */
1273    var resizeWindow = function(e) {
1274      // don't do anything if slider isn't initialized.
1275      if (!slider.initialized) { return; }
1276      // Delay if slider working.
1277      if (slider.working) {
1278        window.setTimeout(resizeWindow, 10);
1279      } else {
1280        // get the new window dimens (again, thank you IE)
1281        var windowWidthNew = $(window).width(),
1282        windowHeightNew = $(window).height();
1283        // make sure that it is a true window resize
1284        // *we must check this because our dinosaur friend IE fires a window resize event when certain DOM elements
1285        // are resized. Can you just die already?*
1286        if (windowWidth !== windowWidthNew || windowHeight !== windowHeightNew) {
1287          // set the new window dimens
1288          windowWidth = windowWidthNew;
1289          windowHeight = windowHeightNew;
1290          // update all dynamic elements
1291          el.redrawSlider();
1292          // Call user resize handler
1293          slider.settings.onSliderResize.call(el, slider.active.index);
1294        }
1295      }
1296    };
1297
1298    /**
1299     * Adds an aria-hidden=true attribute to each element
1300     *
1301     * @param startVisibleIndex (int)
1302     *  - the first visible element's index
1303     */
1304    var applyAriaHiddenAttributes = function(startVisibleIndex) {
1305      var numberOfSlidesShowing = getNumberSlidesShowing();
1306      // only apply attributes if the setting is enabled and not in ticker mode
1307      if (slider.settings.ariaHidden && !slider.settings.ticker) {
1308        // add aria-hidden=true to all elements
1309        slider.children.attr('aria-hidden', 'true');
1310        // get the visible elements and change to aria-hidden=false
1311        slider.children.slice(startVisibleIndex, startVisibleIndex + numberOfSlidesShowing).attr('aria-hidden', 'false');
1312      }
1313    };
1314
1315    /**
1316     * Returns index according to present page range
1317     *
1318     * @param slideOndex (int)
1319     *  - the desired slide index
1320     */
1321    var setSlideIndex = function(slideIndex) {
1322      if (slideIndex < 0) {
1323        if (slider.settings.infiniteLoop) {
1324          return getPagerQty() - 1;
1325        }else {
1326          //we don't go to undefined slides
1327          return slider.active.index;
1328        }
1329      // if slideIndex is greater than children length, set active index to 0 (this happens during infinite loop)
1330      } else if (slideIndex >= getPagerQty()) {
1331        if (slider.settings.infiniteLoop) {
1332          return 0;
1333        } else {
1334          //we don't move to undefined pages
1335          return slider.active.index;
1336        }
1337      // set active index to requested slide
1338      } else {
1339        return slideIndex;
1340      }
1341    };
1342
1343    /**
1344     * ===================================================================================
1345     * = PUBLIC FUNCTIONS
1346     * ===================================================================================
1347     */
1348
1349    /**
1350     * Performs slide transition to the specified slide
1351     *
1352     * @param slideIndex (int)
1353     *  - the destination slide's index (zero-based)
1354     *
1355     * @param direction (string)
1356     *  - INTERNAL USE ONLY - the direction of travel ("prev" / "next")
1357     */
1358    el.goToSlide = function(slideIndex, direction) {
1359      // onSlideBefore, onSlideNext, onSlidePrev callbacks
1360      // Allow transition canceling based on returned value
1361      var performTransition = true,
1362      moveBy = 0,
1363      position = {left: 0, top: 0},
1364      lastChild = null,
1365      lastShowingIndex, eq, value, requestEl;
1366      // store the old index
1367      slider.oldIndex = slider.active.index;
1368      //set new index
1369      slider.active.index = setSlideIndex(slideIndex);
1370
1371      // if plugin is currently in motion, ignore request
1372      if (slider.working || slider.active.index === slider.oldIndex) { return; }
1373      // declare that plugin is in motion
1374      slider.working = true;
1375
1376      performTransition = slider.settings.onSlideBefore.call(el, slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index);
1377
1378      // If transitions canceled, reset and return
1379      if (typeof (performTransition) !== 'undefined' && !performTransition) {
1380        slider.active.index = slider.oldIndex; // restore old index
1381        slider.working = false; // is not in motion
1382        return;
1383      }
1384
1385      if (direction === 'next') {
1386        // Prevent canceling in future functions or lack there-of from negating previous commands to cancel
1387        if (!slider.settings.onSlideNext.call(el, slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index)) {
1388          performTransition = false;
1389        }
1390      } else if (direction === 'prev') {
1391        // Prevent canceling in future functions or lack there-of from negating previous commands to cancel
1392        if (!slider.settings.onSlidePrev.call(el, slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index)) {
1393          performTransition = false;
1394        }
1395      }
1396
1397      // check if last slide
1398      slider.active.last = slider.active.index >= getPagerQty() - 1;
1399      // update the pager with active class
1400      if (slider.settings.pager || slider.settings.pagerCustom) { updatePagerActive(slider.active.index); }
1401      // // check for direction control update
1402      if (slider.settings.controls) { updateDirectionControls(); }
1403      // if slider is set to mode: "fade"
1404      if (slider.settings.mode === 'fade') {
1405        // if adaptiveHeight is true and next height is different from current height, animate to the new height
1406        if (slider.settings.adaptiveHeight && slider.viewport.height() !== getViewportHeight()) {
1407          slider.viewport.animate({height: getViewportHeight()}, slider.settings.adaptiveHeightSpeed);
1408        }
1409        // fade out the visible child and reset its z-index value
1410        slider.children.filter(':visible').fadeOut(slider.settings.speed).css({zIndex: 0});
1411        // fade in the newly requested slide
1412        slider.children.eq(slider.active.index).css('zIndex', slider.settings.slideZIndex + 1).fadeIn(slider.settings.speed, function() {
1413          $(this).css('zIndex', slider.settings.slideZIndex);
1414          updateAfterSlideTransition();
1415        });
1416      // slider mode is not "fade"
1417      } else {
1418        // if adaptiveHeight is true and next height is different from current height, animate to the new height
1419        if (slider.settings.adaptiveHeight && slider.viewport.height() !== getViewportHeight()) {
1420          slider.viewport.animate({height: getViewportHeight()}, slider.settings.adaptiveHeightSpeed);
1421        }
1422        // if carousel and not infinite loop
1423        if (!slider.settings.infiniteLoop && slider.carousel && slider.active.last) {
1424          if (slider.settings.mode === 'horizontal') {
1425            // get the last child position
1426            lastChild = slider.children.eq(slider.children.length - 1);
1427            position = lastChild.position();
1428            // calculate the position of the last slide
1429            moveBy = slider.viewport.width() - lastChild.outerWidth();
1430          } else {
1431            // get last showing index position
1432            lastShowingIndex = slider.children.length - slider.settings.minSlides;
1433            position = slider.children.eq(lastShowingIndex).position();
1434          }
1435          // horizontal carousel, going previous while on first slide (infiniteLoop mode)
1436        } else if (slider.carousel && slider.active.last && direction === 'prev') {
1437          // get the last child position
1438          eq = slider.settings.moveSlides === 1 ? slider.settings.maxSlides - getMoveBy() : ((getPagerQty() - 1) * getMoveBy()) - (slider.children.length - slider.settings.maxSlides);
1439          lastChild = el.children('.bx-clone').eq(eq);
1440          position = lastChild.position();
1441        // if infinite loop and "Next" is clicked on the last slide
1442        } else if (direction === 'next' && slider.active.index === 0) {
1443          // get the last clone position
1444          position = el.find('> .bx-clone').eq(slider.settings.maxSlides).position();
1445          slider.active.last = false;
1446        // normal non-zero requests
1447        } else if (slideIndex >= 0) {
1448          //parseInt is applied to allow floats for slides/page
1449          requestEl = slideIndex * parseInt(getMoveBy());
1450          position = slider.children.eq(requestEl).position();
1451        }
1452
1453        /* If the position doesn't exist
1454         * (e.g. if you destroy the slider on a next click),
1455         * it doesn't throw an error.
1456         */
1457        if (typeof (position) !== 'undefined') {
1458          value = slider.settings.mode === 'horizontal' ? -(position.left - moveBy) : -position.top;
1459          // plugin values to be animated
1460          setPositionProperty(value, 'slide', slider.settings.speed);
1461        }
1462        slider.working = false;
1463      }
1464      if (slider.settings.ariaHidden) { applyAriaHiddenAttributes(slider.active.index * getMoveBy()); }
1465    };
1466
1467    /**
1468     * Transitions to the next slide in the show
1469     */
1470    el.goToNextSlide = function() {
1471      // if infiniteLoop is false and last page is showing, disregard call
1472      if (!slider.settings.infiniteLoop && slider.active.last) { return; }
1473	  if (slider.working ==
vendor: 3,105 bytes, lines 1473-1573
1473 true){ return ;}
1474      var pagerIndex = parseInt(slider.active.index) + 1;
1475      el.goToSlide(pagerIndex, 'next');
1476    };
1477
1478    /**
1479     * Transitions to the prev slide in the show
1480     */
1481    el.goToPrevSlide = function() {
1482      // if infiniteLoop is false and last page is showing, disregard call
1483      if (!slider.settings.infiniteLoop && slider.active.index === 0) { return; }
1484	  if (slider.working == true){ return ;}
1485      var pagerIndex = parseInt(slider.active.index) - 1;
1486      el.goToSlide(pagerIndex, 'prev');
1487    };
1488
1489    /**
1490     * Starts the auto show
1491     *
1492     * @param preventControlUpdate (boolean)
1493     *  - if true, auto controls state will not be updated
1494     */
1495    el.startAuto = function(preventControlUpdate) {
1496      // if an interval already exists, disregard call
1497      if (slider.interval) { return; }
1498      // create an interval
1499      slider.interval = setInterval(function() {
1500        if (slider.settings.autoDirection === 'next') {
1501          el.goToNextSlide();
1502        } else {
1503          el.goToPrevSlide();
1504        }
1505      }, slider.settings.pause);
1506	  //allback for when the auto rotate status changes
1507	  slider.settings.onAutoChange.call(el, true);
1508      // if auto controls are displayed and preventControlUpdate is not true
1509      if (slider.settings.autoControls && preventControlUpdate !== true) { updateAutoControls('stop'); }
1510    };
1511
1512    /**
1513     * Stops the auto show
1514     *
1515     * @param preventControlUpdate (boolean)
1516     *  - if true, auto controls state will not be updated
1517     */
1518    el.stopAuto = function(preventControlUpdate) {
1519      // if no interval exists, disregard call
1520      if (!slider.interval) { return; }
1521      // clear the interval
1522      clearInterval(slider.interval);
1523      slider.interval = null;
1524	  //allback for when the auto rotate status changes
1525	  slider.settings.onAutoChange.call(el, false);
1526      // if auto controls are displayed and preventControlUpdate is not true
1527      if (slider.settings.autoControls && preventControlUpdate !== true) { updateAutoControls('start'); }
1528    };
1529
1530    /**
1531     * Returns current slide index (zero-based)
1532     */
1533    el.getCurrentSlide = function() {
1534      return slider.active.index;
1535    };
1536
1537    /**
1538     * Returns current slide element
1539     */
1540    el.getCurrentSlideElement = function() {
1541      return slider.children.eq(slider.active.index);
1542    };
1543
1544    /**
1545     * Returns a slide element
1546     * @param index (int)
1547     *  - The index (zero-based) of the element you want returned.
1548     */
1549    el.getSlideElement = function(index) {
1550      return slider.children.eq(index);
1551    };
1552
1553    /**
1554     * Returns number of slides in show
1555     */
1556    el.getSlideCount = function() {
1557      return slider.children.length;
1558    };
1559
1560    /**
1561     * Return slider.working variable
1562     */
1563    el.isWorking = function() {
1564      return slider.working;
1565    };
1566
1567    /**
1568     * Update all dynamic slider elements
1569     */
1570    el.redrawSlider = function() {
1571      // resize all children in ratio to new screen size
1572      slider.children.add(el.find('.bx-clone')).outerWidth(getSlideWidth());
1573      // adjust the height
1574      slider.viewport.css('height', getViewportHeight());
1575      // update the slide position
1576      if (!slider.settings.ticker) { setSlidePosition(); }
1577      // if active.last was true before the screen resize, we want
1578      // to keep it last no matter what screen size we end on
1579      if (slider.active.last) { slider.active.index = getPagerQty() - 1; }
1580      // if the active index (page) no longer exists due to the resize, simply set the index as last
1581      if (slider.active.index >= getPagerQty()) { slider.active.last = true; }
1582      // if a pager is being displayed and a custom pager is not being used, update it
1583      if (slider.settings.pager && !slider.settings.pagerCustom) {
1584        populatePager();
1585        updatePagerActive(slider.active.index);
1586      }
1587      if (slider.settings.ariaHidden) { applyAriaHiddenAttributes(slider.active.index * getMoveBy()); }
1588    };
1589
1590    /**
1591     * Destroy the current instance of the slider (revert everything back to original state)
1592     */
1593    el.destroySlider = function() {
1594      // don't do anything if slider has already been destroyed
1595      if (!slider.initialized) { return; }
1596      slider.initialized = false;
1597      $('.bx-clone', this).remove();
1598      slider.children.each(function() {
1599        if ($(this).data('origStyle') !== undefined) {
1600          $(this).attr('style', $(this).data('origStyle'));
1601        } else {
1602          $(this).removeAttr('style');
1603        }
1604      });
1605      if ($(this).data('origStyle') !== undefined) {
1606        this.attr('style', $(this).data('origStyle'));
1607      } else {
1608        $(this).removeAttr('style');
1609      }
1610      $(this).unwrap().unwrap();
1611      if (slider.controls.el) { slider.controls.el.remove(); }
1612      if (slider.controls.next) { slider.controls.next.remove(); }
1613      if (slider.controls.prev) { slider.controls.prev.remove(); }
1614      if (slider.pagerEl && slider.settings.controls && !slider.settings.pagerCustom) { slider.pagerEl.remove(); }
1615      $('.bx-caption', this).remove();
1616      if (slider.controls.autoEl) { slider.controls.autoEl.remove(); }
1617      clearInterval(slider.interval);
1618      if (slider.settings.responsive) { $(window).unbind('resize', resizeWindow); }
1619      if (slider.settings.keyboardEnabled) { $(document).unbind('keydown', keyPress); }
1620      //remove self reference in data
1621      $(this).removeData('bxSlider');
1622	  // remove global window handlers
1623	  $(window).off('blur', windowBlurHandler).off('focus', windowFocusHandler);
1624    };
1625
1626    /**
1627     * Reload the slider (revert all DOM changes, and re-initialize)
1628     */
1629    el.reloadSlider = function(settings) {
1630      if (settings !== undefined) { options = settings; }
1631      el.destroySlider();
1632      init();
1633      //store reference to self in order to access public functions later
1634      $(el).data('bxSlider', this);
1635    };
1636
1637    init();
1638
1639    $(el).data('bxSlider', this);
1640
1641    // returns the current jQuery object
1642    return this;
1643  };
1644
1645})(jQuery);
1646
1647/* End */
1648;
1649; /* Start:"a:4:{s:4:"full";s:57:"/bitrix/templates/aspro_max/js/jqModal.js?171646553710972";s:6:"source";s:41:"/bitrix/templates/aspro_max/js/jqModal.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
1650/*
1651 * jqModal - Minimalist Modaling with jQuery
1652 *
1653 * Copyright (c) 2007-2014 Brice Burgess @iceburg_net
1654 * Dual licensed under the MIT and GPL licenses:
1655 *   http://www.opensource.org/licenses/mit-license.php
1656 *   http://www.gnu.org/licenses/gpl.html
1657 *
1658 * $Version: 1.0.2 (2014.04.10 +r19)
1659 * Requires: jQuery 1.2.3+
1660 */
1661
1662(function($) {
1663
1664	/**
1665	 * Initialize a set of elements as "modals". Modals typically are popup dialogs,
1666	 * notices, modal windows, &c.
1667	 *
1668	 * @name jqm
1669	 * @param options user defined options, augments defaults.
1670	 * @type jQuery
1671	 * @cat Plugins/jqModal
1672	 */
1673
1674	$.fn.jqm=function(options){
1675
1676		var o = $.extend({}, $.jqm.params, options);
1677
1678		return this.each(function(){
1679			var e = $(this),
1680				jqm = $(this).data('jqm');
1681
1682			if(!jqm) jqm = {ID: I++};
1683
1684			// add/extend options to modal and mark as initialized
1685			e.data('jqm',$.extend(o,jqm)).addClass('jqm-init');
1686
1687			// ... Attach events to trigger showing of this modal
1688			o.trigger&&$(this).jqmAddTrigger(o.trigger);
1689		});
1690	};
1691
1692
1693	/**
1694	 * Matching modals will have their jqmShow() method fired by attaching a
1695	 *   onClick event to elements matching `trigger`.
1696	 *
1697	 * @name jqmAddTrigger
1698	 * @param trigger a selector String, jQuery collection of elements, or a DOM element.
1699	 */
1700	$.fn.jqmAddTrigger=function(trigger){
1701		return this.each(function(){
1702			if(!addTrigger($(this), 'jqmShow', trigger))
1703				err("jqmAddTrigger must be called on initialized modals")
1704		});
1705	};
1706
1707
1708	/**
1709	 * Matching modals will have their jqmHide() method fired by attaching an
1710	 *   onClick event to elements matching `trigger`.
1711	 *
1712	 * @name jqmAddClose
1713	 * @param trigger a selector String, jQuery collection of elements, or a DOM element.
1714	 */
1715	$.fn.jqmAddClose=function(trigger){
1716		return this.each(function(){
1717			if(!addTrigger($(this), 'jqmHide', trigger))
1718				err("jqmAddClose must be called on initialized modals")
1719		});
1720	};
1721
1722
1723	/**
1724	 * Open matching modals (if not shown)
1725	 */
1726	$.fn.jqmShow=function(trigger){
1727		return this.each(function(){ !this._jqmShown&&show($(this), trigger); });
1728	};
1729
1730	/**
1731	 * Close matching modals
1732	 */
1733	$.fn.jqmHide=function(trigger){
1734		return this.each(function(){ this._jqmShown&&hide($(this), trigger); });
1735	};
1736
1737
1738	// utility functions
1739
1740	var
1741		err = function(msg){
1742			if(window.console && window.console.error) window.console.error(msg);
1743
1744
1745	}, show = function(e, t){
1746		/**
1747		 * e = modal element (as jQuery object)
1748		 * t = triggering element
1749		 *
1750		 * o = options
1751		 * z = z-index of modal
1752		 * v = overlay element (as jQuery object)
1753		 * h = hash (for jqModal <= r15 compatibility)
1754		 */
1755
1756		var o = e.data('jqm'),
1757			t = t || window.event,
1758			z = (parseInt(e.css('z-index'))),
1759			z = (z > 0) ? z : 3000;
1760
1761		if(o.noOverlay === undefined || (o.noOverlay !== undefined && !o.noOverlay) ) {
1762			var	v = $('<div></div>').addClass(o.overlayClass).css({height:'100%',width:'100%',position:'fixed',left:0,top:0,'z-index':z-1,opacity:o.overlay/100});
1763		} else {
1764			var	v = $('');
1765		}
1766		
1767			// maintain legacy "hash" construct
1768			h = {w: e, c: o, o: v, t: t};
1769
1770		e.css('z-index',z);
1771
1772		if(o.ajax){
1773			var target = o.target || e,
1774				url = o.ajax;
1775
1776			target = (typeof target == 'string') ? $(target,e) : $(target);
1777			if(url.substr(0,1) == '@') url = $(t).attr(url.substring(1));
1778
1779			 // Load the Ajax Content (and once loaded);
1780			   // Fire the onLoad callback (if exists),
1781			   // Attach closing events to elements inside the modal that match the closingClass,
1782			   // and Execute the jqModal default Open Callback
1783			target.html(o.ajaxText).load(url,function(){
1784				o.onLoad && o.onLoad.call(this,h);
1785				open(h);
1786			});
1787		}
1788		else { open(h); }
1789
1790	}, hide = function(e, t){
1791		/**
1792		 * e = modal element (as jQuery object)
1793		 * t = triggering element
1794		 *
1795		 * o = options
1796		 * h = hash (for jqModal <= r15 compatibility)
1797		 */
1798
1799		var o = e.data('jqm'),
1800			t = t || window.event,
1801
1802		// maintain legacy "hash" construct
1803		h = {w: e, c: o, o: e.data('jqmv'), t: t};
1804
1805		close(h);
1806
1807	}, onShow = function(hash){
1808		// onShow callback. Responsible for showing a modal and overlay.
1809		//  return false to stop opening modal.
1810
1811		// hash object;
1812	    //  w: (jQuery object) The modal element
1813	    //  c: (object) The modal's options object
1814	    //  o: (jQuery object) The overlay element
1815	    //  t: (DOM object) The triggering element
1816
1817		// display the overlay (prepend to body) if not disabled
1818
1819		// prevent double click
1820		if( hash.w[0]._jqmShown )
1821			return false;
1822		
1823		if(hash.c.overlay > 0)
1824			hash.o.prependTo('#popup_iframe_wrapper');
1825
1826		// make modal visible
1827		hash.w.show();
1828
1829		// call focusFunc (attempts to focus on first input in modal)
1830		$.jqm.focusFunc(hash.w);
1831
1832		return true;
1833
1834
1835	}, onHide = function(hash){
1836		// onHide callback. Responsible for hiding a modal and overlay.
1837		//  return false to stop closing modal.
1838
1839		// hash object;
1840	    //  w: (jQuery object) The modal element
1841	    //  c: (object) The modal's options object
1842	    //  o: (jQuery object) The overlay element
1843	    //  t: (DOM object) The triggering element
1844
1845		// hide modal and if overlay, remove overlay.
1846		hash.w.hide() && hash.o && hash.o.remove();
1847
1848		return true;
1849
1850
1851	},  addTrigger = function(e, key, trigger){
1852		// addTrigger: Adds a jqmShow or jqmHide (key) for a modal (e)
1853		//  all elements that match trigger string (trigger)\
1854
1855		// return false if e is not an initialized modal element
1856		if(!e.data('jqm')) return false;
1857
1858		return $(trigger).each(function(){
1859			// register modal to trigger elements
1860			this[key] = this[key] || [];
1861			this[key].push(e);
1862
1863		}).click(function(){
1864
1865			var trigger = this;
1866
1867			// foreadh modal registered to this trigger, call jqmShow ||
1868			//   jqmHide (key) on modal passing trigger element (e)
1869			$.each(this[key], function(i, e){ e[key](trigger); });
1870
1871			// stop trigger click event from bubbling
1872			return false;
1873		});
1874
1875
1876	},  open = function(h){
1877		// open: executes the onOpen callback + performs common tasks if successful
1878
1879		// transform legacy hash into new var shortcuts
1880		 var e = h.w,
1881		 	v = h.o,
1882		 	o = h.c;
1883
1884		// execute onShow callback
1885		if(o.onShow(h) !== false){
1886			// mark modal as shown
1887			e[0]._jqmShown = true;
1888
1889			// if modal dialog
1890			//
1891			// Bind the Keep Focus Function [F] if no other Modals are open (!A[0]) +
1892			// Add this modal to the opened modals stack (A) for nested modal support
1893			//
1894			// else, close dialog when overlay is clicked
1895			if(o.modal){ !A[0]&&F('bind'); A.push(e); }
1896            else e.jqmAddClose(v);
1897
1898			//  Attach closing events to elements inside the modal that match the closingClass
1899			o.closeClass&&e.jqmAddClose($('.' + o.closeClass,e));
1900
1901			// IF toTop is true and overlay exists;
1902			//  Add placeholder element <span id="jqmP#ID_of_modal"/> before modal to
1903			//  remember it's position in the DOM and move it to a child of the body tag (after overlay)
1904			o.toTop&&v&&e.before('<span id="jqmP'+o.ID+'"></span>').insertAfter(v);
1905
1906			// remember overlay (for closing function)
1907			e.data('jqmv',v);
1908		}
1909
1910
1911	},  close = function(h){
1912		// close: executes the onHide callback + performs common tasks if successful
1913
1914		// transform legacy hash into new var shortcuts
1915		 var e = h.w,
1916		 	v = h.o,
1917		 	o = h.c;
1918
1919		// execute onShow callback
1920		if(o.onHide(h) !== false){
1921			// mark modal as !shown
1922			e[0]._jqmShown = false;
1923
1924			 // If modal, remove from modal stack.
1925			 // If no modals in modal stack, unbind the Keep Focus Function
1926			 if(o.modal){A.pop();!A[0]&&F('unbind');}
1927
1928			 // IF toTop was passed and an overlay exists;
1929			 //  Move modal back to its "remembered" position.
1930			 o.toTop&&v&&$('#jqmP'+o.ID).after(e).remove();
1931		}
1932
1933
1934	},  F = function(t){
1935		// F: The Keep Focus Function (for modal: true dialos)
1936		// Binds or Unbinds (t) the Focus Examination Function (X) to keypresses and clicks
1937
1938		$(document)[t]("keypress keydown mousedown",X);
1939
1940
1941	}, X = function(e){
1942		// X: The Focus Examination Function (for modal: true dialogs)
1943
1944		var modal = $(e.target).data('jqm') || $(e.target).parents('.jqm-init:first').data('jqm'),
1945			activeModal = A[A.length-1].data('jqm');
1946
1947		// allow bubbling if event target is within active modal dialog
1948		if(modal && modal.ID == activeModal.ID) return true;
1949
1950		// else, trigger focusFunc (focus on first input element and halt bubbling)
1951		return $.jqm.focusFunc(activeModal);
1952	},
1953
1954	I = 0,   // modal ID increment (for nested modals)
1955	A = [];  // array of active modals (used to lock interactivity to appropriate modal)
1956
1957
1958	// $.jqm, overridable defaults
1959	$.jqm = {
1960		/**
1961		 *  default options
1962		 *
1963		 * (Integer)   overlay      - [0-100] Translucency percentage (opacity) of the body covering overlay. Set to 0 for NO overlay, and up to 100 for a 100% opaque overlay.
1964		 * (String)    overlayClass - Applied to the body covering overlay. Useful for controlling overlay look (tint, background-image, &c) with CSS.
1965		 * (String)    closeClass   - Children of the modal element matching `closeClass` will fire the onHide event (to close the modal).
1966		 * (Mixed)     trigger      - Matching elements will fire the onShow event (to display the modal). Trigger can be a selector String, a jQuery collection of elements, a DOM element, or a False boolean.
1967		 * (String)    ajax         - URL to load content from via an AJAX request. False to disable ajax. If ajax begins with a "@", the URL is extracted from the attribute of the triggering element (e.g. use '@data-url' for; <a href="#" class="jqModal" data-url="modal.html">...)
1968		 * (Mixed)     target       - Children of the modal element to load the ajax response into. If false, modal content will be overwritten by ajax response. Useful for retaining modal design.
1969		 *                            Target may be a selector string, jQuery collection of elements, or a DOM element -- and MUST exist as a child of the modal element.
1970		 * (String)    ajaxText     - Text shown while waiting for ajax return. Replaces HTML content of `target` element.
1971		 * (Boolean)   modal        - If true, user interactivity will be locked to the modal window until closed.
1972		 * (Boolean)   toTop        - If true, modal will be posistioned as a first child of the BODY element when opened, and its DOM posistion restored when closed. Useful for overcoming z-Index container issues.
1973		 * (Function)  onShow       - User defined callback function fired when modal opened.
1974		 * (Function)  onHide       - User defined callback function fired when modal closed.
1975		 * (Function)  onLoad       - User defined callback function fired when ajax content loads.
1976		 */
1977		params: {
1978			overlay: 50,
1979			overlayClass: 'jqmOverlay',
1980			closeClass: 'jqmClose',
1981			trigger: '.jqModal',
1982			ajax: false,
1983			target: false,
1984			ajaxText: '',
1985			modal: false,
1986			toTop: false,
1987			onShow: onShow,
1988			onHide: onHide,
1989			onLoad: false
1990		},
1991
1992		// focusFunc is fired when a modal is shown, or when interaction occurs outside
1993		// a modal enabled dialog. Passed the modal element.
1994		focusFunc: function(e) { $(':input:visible:first',e).focus(); return false; }
1995	};
1996
1997})( jQuery );
1998/* End */
1999;
2000; /* Start:"a:4:{s:4:"full";s:66:"/bitrix/templates/aspro_max/vendor/js/bootstrap.js?171646553727908";s:6:"source";s:50:"/bitrix/templates/aspro_max/vendor/js/bootstrap.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
2001/*!
2002 * Bootstrap v3.0.0
2003 *
2004 * Copyright 2013 Twitter, Inc
2005 * Licensed under the Apache License v2.0
2006 * http://www.apache.org/licenses/LICENSE-2.0
2007 *
2008 * Designed and built with all the love in the world @twitter by @mdo and @fat.
2009 */
2010
2011+function(a){"use strict";var b='[data-dismiss="alert"]',c=function(c){a(c).on("click",b,this.close)};c.prototype.close=function(b){function f(){e.trigger("closed.bs.alert").remove()}var c=a(this),d=c.attr("data-target");d||(d=c.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,""));var e=a(d);b&&b.preventDefault(),e.length||(e=c.hasClass("alert")?c:c.parent()),e.trigger(b=a.Event("close.bs.alert"));if(b.isDefaultPrevented())return;e.removeClass("in"),a.support.transition&&e.hasClass("fade")?e.one(a.support.transition.end,f).emulateTransitionEnd(150):f()};var d=a.fn.alert;a.fn.alert=function(b){return this.each(function(){var d=a(this),e=d.data("bs.alert");e||d.data("bs.alert",e=new c(this)),typeof b=="string"&&e[b].call(
2011d)})},a.fn.alert.Constructor=c,a.fn.alert.noConflict=function(){return a.fn.alert=d,this},a(document).on("click.bs.alert.data-api",b,c.prototype.close)}(window.jQuery),+function(a){"use strict";var b=function(c,d){this.$element=a(c),this.options=a.extend({},b.DEFAULTS,d)};b.DEFAULTS={loadingText:"loading..."},b.prototype.setState=function(a){var b="disabled",c=this.$element,d=c.is("input")?"val":"html",e=c.data();a+="Text",e.resetText||c.data("resetText",c[d]()),c[d](e[a]||this.options[a]),setTimeout(function(){a=="loadingText"?c.addClass(b).attr(b,b):c.removeClass(b).removeAttr(b)},0)},b.prototype.toggle=function(){var a=this.$element.closest('[data-toggle="buttons"]');if(a.length){var b=this.$element.find("input").prop("checked",!this.$element.hasClass("active")).trigger("change");b.prop("type")==="radio"&&a.find(".active").removeClass("active")}this.$element.toggleClass("active")};var c=a.fn.button;a.fn.button=function(c){return this.each(function(){var d=a(this),e=d.data("bs.button"),f=typeof c=="object"&&c;e||d.data("bs.button",e=new b(this,f)),c=="toggle"?e.toggle():c&&e.setState(c)})},a.fn.button.Constructor=b,a.fn.button.noConflict=function(){return a.fn.button=c,this},a(document).on("click.bs.button.data-api","[data-toggle^=button]",function(b){var c=a(b.target);c.hasClass("btn")||(c=c.closest(".btn")),c.button("toggle"),b.preventDefault()})}(window.jQuery),+function(a){"use strict";var b=function(b,c){this.$element=a(b),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=this.sliding=this.interval=this.$active=this.$items=null,this.options.pause=="hover"&&this.$element.on("mouseenter",a.proxy(this.pause,this)).on("mouseleave",a.proxy(this.cycle,this))};b.DEFAULTS={interval:5e3,pause:"hover",wrap:!0},b.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},b.prototype.getActiveIndex=function(){return this.$active=this.$element.find(".item.active"),this.$items=this.$active.parent().children(),this.$items.index(this.$active)},b.prototype.to=function(b){var c=this,d=this.getActiveIndex();if(b>this.$items.length-1||b<0)return;return this.sliding?this.$element.one("slid",function(){c.to(b)}):d==b?this.pause().cycle():this.slide(b>d?"next":"prev",a(this.$items[b]))},b.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition.end&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},b.prototype.next=function(){if(this.sliding)return;return this.slide("next")},b.prototype.prev=function(){if(this.sliding)return;return this.slide("prev")},b.prototype.slide=function(b,c){var d=this.$element.find(".item.active"),e=c||d[b](),f=this.interval,g=b=="next"?"left":"right",h=b=="next"?"first":"last",i=this;if(!e.length){if(!this.options.wrap)return;e=this.$element.find(".item")[h]()}this.sliding=!0,f&&this.pause();var j=a.Event("slide.bs.carousel",{relatedTarget:e[0],direction:g});if(e.hasClass("active"))return;this.$indicators.length&&(this.$indicators.find(".active").removeClass("active"),this.$element.one("slid",function(){var b=a(i.$indicators.children()[i.getActiveIndex()]);b&&b.addClass("active")}));if(a.support.transition&&this.$element.hasClass("slide")){this.$element.trigger(j);if(j.isDefaultPrevented())return;e.addClass(b),e[0].offsetWidth,d.addClass(g),e.addClass(g),d.one(a.support.transition.end,function(){e.removeClass([b,g].join(" ")).addClass("active"),d.removeClass(["active",g].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger("slid")},0)}).emulateTransitionEnd(600)}else{this.$element.trigger(j);if(j.isDefaultPrevented())return;d.removeClass("active"),e.addClass("active"),this.sliding=!1,this.$element.trigger("slid")}return f&&this.cycle(),this};var c=a.fn.carousel;a.fn.carousel=function(c){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},b.DEFAULTS,d.data(),typeof c=="object"&&c),g=typeof c=="string"?c:f.slide;e||d.data("bs.carousel",e=new b(this,f)),typeof c=="number"?e.to(c):g?e[g]():f.interval&&e.pause().cycle()})},a.fn.carousel.Constructor=b,a.fn.carousel.noConflict=function(){return a.fn.carousel=c,this}
2011,a(document).on("click.bs.carousel.data-api","[data-slide], [data-slide-to]",function(b){var c=a(this),d,e=a(c.attr("data-target")||(d=c.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,"")),f=a.extend({},e.data(),c.data()),g=c.attr("data-slide-to");g&&(f.interval=!1),e.carousel(f),(g=c.attr("data-slide-to"))&&e.data("bs.carousel").to(g),b.preventDefault()}),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var b=a(this);b.carousel(b.data())})})}(window.jQuery),+function(a){function e(){a(b).remove(),a(c).each(function(b){var c=f(a(this));if(!c.hasClass("open"))return;c.trigger(b=a.Event("hide.bs.dropdown"));if(b.isDefaultPrevented())return;c.removeClass("open").trigger("hidden.bs.dropdown")})}function f(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}"use strict";var b=".dropdown-backdrop",c="[data-toggle=dropdown]",d=function(b){var c=a(b).on("click.bs.dropdown",this.toggle)};d.prototype.toggle=function(b){var c=a(this);if(c.is(".disabled, :disabled"))return;var d=f(c),g=d.hasClass("open");e();if(!g){"ontouchstart"in document.documentElement&&!d.closest(".navbar-nav").length&&a('<div class="dropdown-backdrop"/>').insertAfter(a(this)).on("click",e),d.trigger(b=a.Event("show.bs.dropdown"));if(b.isDefaultPrevented())return;d.toggleClass("open").trigger("shown.bs.dropdown"),c.focus()}return!1},d.prototype.keydown=function(b){if(!/(38|40|27)/.test(b.keyCode))return;var d=a(this);b.preventDefault(),b.stopPropagation();if(d.is(".disabled, :disabled"))return;var e=f(d),g=e.hasClass("open");if(!g||g&&b.keyCode==27)return b.which==27&&e.find(c).focus(),d.click();var h=a("[role=menu] li:not(.divider):visible a",e);if(!h.length)return;var i=h.index(h.filter(":focus"));b.keyCode==38&&i>0&&i--,b.keyCode==40&&i<h.length-1&&i++,~i||(i=0),h.eq(i).focus()};var g=a.fn.dropdown;a.fn.dropdown=function(b){return this.each(function(){var c=a(this),e=c.data("dropdown");e||c.data("dropdown",e=new d(this)),typeof b=="string"&&e[b].call(c)})},a.fn.dropdown.Constructor=d,a.fn.dropdown.noConflict=function(){return a.fn.dropdown=g,this},a(document).on("click.bs.dropdown.data-api",e).on("click.bs.dropdown.data-api",".dropdown form",function(a){a.stopPropagation()}).on("click.bs.dropdown.data-api",c,d.prototype.toggle).on("keydown.bs.dropdown.data-api",c+", [role=menu]",d.prototype.keydown)}(window.jQuery),+function(a){"use strict";var b=function(b,c){this.options=c,this.$element=a(b),this.$backdrop=this.isShown=null,this.options.remote&&this.$element.load(this.options.remote)};b.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},b.prototype.toggle=function(a){return this[this.isShown?"hide":"show"](a)},b.prototype.show=function(b){var c=this,d=a.Event("show.bs.modal",{relatedTarget:b});this.$element.trigger(d);if(this.isShown||d.isDefaultPrevented())return;this.isShown=!0,this.escape(),this.$element.on("click.dismiss.modal",'[data-dismiss="modal"]',a.proxy(this.hide,this)),this.backdrop(function(){var d=a.support.transition&&c.$element.hasClass("fade");c.$element.parent().length||c.$element.appendTo(document.body),c.$element.show(),d&&c.$element[0].offsetWidth,c.$element.addClass("in").attr("aria-hidden",!1),c.enforceFocus();var e=a.Event("shown.bs.modal",{relatedTarget:b});d?c.$element.find(".modal-dialog").one(a.support.transition.end,function(){c.$element.focus().trigger(e)}).emulateTransitionEnd(300):c.$element.focus().trigger(e)})},b.prototype.hide=function(b){b&&b.preventDefault(),b=a.Event("hide.bs.modal"),this.$element.trigger(b);if(!this.isShown||b.isDefaultPrevented())return;this.isShown=!1,this.escape(),a(document).off("focusin.bs.modal"),this.$element.removeClass("in").attr("aria-hidden",!0).off("click.dismiss.modal"),a.support.transition&&this.$element.hasClass("fade")?this.$element.one(a.support.transition.end,a.proxy(this.hideModal,this)).emulateTransitionEnd(300):this.hideModal()},b.prototype.enforceFocus=function(){a(document).off("focusin.bs.modal").on("focusin.bs.modal",a.proxy(function(a){this.$element[0]!==a.target&&!this.$element.has(a.target).length&&this.$element.focus()},this))},b.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keyup.dismiss.bs.modal",a.proxy(function(a){a.which==27&&this.hide()},this)):this.isShown||this.$element.off("keyup.dismiss.bs.modal")},b.prototype.hideModal=function(){var a=this;this.$element.hide(),this.backdrop(function(){a.removeBackdrop(),a.$element.trigger("hidden.bs.modal")})},b.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},b.prototype.backdrop=function(b){var c=this,d=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var e=a.support.transition&&d;this.$backdrop=a('<div class="modal-backdrop '+d+'" />').appendTo(document.body),this.$element.on("click.dismiss.modal",a.proxy(function(a){if
2011(a.target!==a.currentTarget)return;this.options.backdrop=="static"?this.$element[0].focus.call(this.$element[0]):this.hide.call(this)},this)),e&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in");if(!b)return;e?this.$backdrop.one(a.support.transition.end,b).emulateTransitionEnd(150):b()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(a.support.transition.end,b).emulateTransitionEnd(150):b()):b&&b()};var c=a.fn.modal;a.fn.modal=function(c,d){return this.each(function(){var e=a(this),f=e.data("bs.modal"),g=a.extend({},b.DEFAULTS,e.data(),typeof c=="object"&&c);f||e.data("bs.modal",f=new b(this,g)),typeof c=="string"?f[c](d):g.show&&f.show(d)})},a.fn.modal.Constructor=b,a.fn.modal.noConflict=function(){return a.fn.modal=c,this},a(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(b){var c=a(this),d=c.attr("href"),e=a(c.attr("data-target")||d&&d.replace(/.*(?=#[^\s]+$)/,"")),f=e.data("modal")?"toggle":a.extend({remote:!/#/.test(d)&&d},e.data(),c.data());b.preventDefault(),e.modal(f,this).one("hide",function(){c.is(":visible")&&c.focus()})}),a(document).on("show.bs.modal",".modal",function(){a(document.body).addClass("modal-open")}).on("hidden.bs.modal",".modal",function(){a(document.body).removeClass("modal-open")})}(window.jQuery),+function(a){"use strict";var b=function(a,b){this.type=this.options=this.enabled=this.timeout=this.hoverState=this.$element=null,this.init("tooltip",a,b)};b.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1},b.prototype.init=function(b,c,d){this.enabled=!0,this.type=b,this.$element=a(c),this.options=this.getOptions(d);var e=this.options.trigger.split(" ");for(var f=e.length;f--;){var g=e[f];if(g=="click")this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this));else if(g!="manual"){var h=g=="hover"?"mouseenter":"focus",i=g=="hover"?"mouseleave":"blur";this.$element.on(h+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(i+"."+this.type,this.options.selector,a.proxy(this.leave,this))}}this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},b.prototype.getDefaults=function(){return b.DEFAULTS},b.prototype.getOptions=function(b){return b=a.extend({},this.getDefaults(),this.$element.data(),b),b.delay&&typeof b.delay=="number"&&(b.delay={show:b.delay,hide:b.delay}),b},b.prototype.getDelegateOptions=function(){var b={},c=this.getDefaults();return this._options&&a.each(this._options,function(a,d){c[a]!=d&&(b[a]=d)}),b},b.prototype.enter=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type);clearTimeout(c.timeout),c.hoverState="in";if(!c.options.delay||!c.options.delay.show)return c.show();c.timeout=setTimeout(function(){c.hoverState=="in"&&c.show()},c.options.delay.show)},b.prototype.leave=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type);clearTimeout(c.timeout),c.hoverState="out";if(!c.options.delay||!c.options.delay.hide)return c.hide();c.timeout=setTimeout(function(){c.hoverState=="out"&&c.hide()},c.options.delay.hide)},b.prototype.show=function(){var b=a.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(b);if(b.isDefaultPrevented())return;var c=this.tip();this.setContent(),this.options.animation&&c.addClass("fade");var d=typeof this.options.placement=="function"?this.options.placement.call(this,c[0],this.$element[0]):this.options.placement,e=/\s?auto?\s?/i,f=e.test(d);f&&(d=d.replace(e,"")||"top"),c.detach().css({top:0,left:0,display:"block"}).addClass(d),this.options.container?c.appendTo(this.options.container):c.insertAfter(this.$element);var g=this.getPosition(),h=c[0].offsetWidth,i=c[0].offsetHeight;if(f){var j=this.$element.parent(),k=d,l=document.documentElement.scrollTop||document.body.scrollTop,m=this.options.container=="body"?window.innerWidth:j.outerWidth(),n=this.options.container=="body"?window.innerHeight:j.outerHeight(),o=this.options.container=="body"?0:j.offset().left;d=d=="bottom"&&g.top+g.height+i-l>n?"top":d=="top"&&g.top-l-i<0?"bottom":d=="right"&&g.right+h>
2011m?"left":d=="left"&&g.left-h<o?"right":d,c.removeClass(k).addClass(d)}var p=this.getCalculatedOffset(d,g,h,i);this.applyPlacement(p,d),this.$element.trigger("shown.bs."+this.type)}},b.prototype.applyPlacement=function(a,b){var c,d=this.tip(),e=d[0].offsetWidth,f=d[0].offsetHeight,g=parseInt(d.css("margin-top"),10),h=parseInt(d.css("margin-left"),10);isNaN(g)&&(g=0),isNaN(h)&&(h=0),a.top=a.top+g,a.left=a.left+h,d.offset(a).addClass("in");var i=d[0].offsetWidth,j=d[0].offsetHeight;b=="top"&&j!=f&&(c=!0,a.top=a.top+f-j);if(/bottom|top/.test(b)){var k=0;a.left<0&&(k=a.left*-2,a.left=0,d.offset(a),i=d[0].offsetWidth,j=d[0].offsetHeight),this.replaceArrow(k-e+i,i,"left")}else this.replaceArrow(j-f,j,"top");c&&d.offset(a)},b.prototype.replaceArrow=function(a,b,c){this.arrow().css(c,a?50*(1-a/b)+"%":"")},b.prototype.setContent=function(){var a=this.tip(),b=this.getTitle();a.find(".tooltip-inner")[this.options.html?"html":"text"](b),a.removeClass("fade in top bottom left right")},b.prototype.hide=function(){function e(){b.hoverState!="in"&&c.detach()}var b=this,c=this.tip(),d=a.Event("hide.bs."+this.type);this.$element.trigger(d);if(d.isDefaultPrevented())return;return c.removeClass("in"),a.support.transition&&this.$tip.hasClass("fade")?c.one(a.support.transition.end,e).emulateTransitionEnd(150):e(),this.$element.trigger("hidden.bs."+this.type),this},b.prototype.fixTitle=function(){var a=this.$element;(a.attr("title")||typeof a.attr("data-original-title")!="string")&&a.attr("data-original-title",a.attr("title")||"").attr("title","")},b.prototype.hasContent=function(){return this.getTitle()},b.prototype.getPosition=function(){var b=this.$element[0];return a.extend({},typeof b.getBoundingClientRect=="function"?b.getBoundingClientRect():{width:b.offsetWidth,height:b.offsetHeight},this.$element.offset())},b.prototype.getCalculatedOffset=function(a,b,c,d){return a=="bottom"?{top:b.top+b.height,left:b.left+b.width/2-c/2}:a=="top"?{top:b.top-d,left:b.left+b.width/2-c/2}:a=="left"?{top:b.top+b.height/2-d/2,left:b.left-c}:{top:b.top+b.height/2-d/2,left:b.left+b.width}},b.prototype.getTitle=function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||(typeof c.title=="function"?c.title.call(b[0]):c.title),a},b.prototype.tip=function(){return this.$tip=this.$tip||a(this.options.template)},b.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},b.prototype.validate=function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},b.prototype.enable=function(){this.enabled=!0},b.prototype.disable=function(){this.enabled=!1},b.prototype.toggleEnabled=function(){this.enabled=!this.enabled},b.prototype.toggle=function(b){var c=b?a(b.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type):this;c.tip().hasClass("in")?c.leave(c):c.enter(c)},b.prototype.destroy=function(){this.hide().$element.off("."+this.type).removeData("bs."+this.type)};var c=a.fn.tooltip;a.fn.tooltip=function(c){return this.each(function(){var d=a(this),e=d.data("bs.tooltip"),f=typeof c=="object"&&c;e||d.data("bs.tooltip",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.tooltip.Constructor=b,a.fn.tooltip.noConflict=function(){return a.fn.tooltip=c,this}}(window.jQuery),+function(a){"use strict";var b=function(a,b){this.init("popover",a,b)};if(!a.fn.tooltip)throw new Error("Popover requires tooltip.js");b.DEFAULTS=a.extend({},a.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:'<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),b.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),b.prototype.constructor=b,b.prototype.getDefaults=function(){return b.DEFAULTS},b.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content")[this.options.html?"html":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},b.prototype.hasContent=function(){return this.getTitle()||this.getContent()},b.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||(typeof b.content=="function"?b.content.call(a[0]):b.content)},b.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")},b.prototype.tip=function(){return this.$tip||(this.$tip=a(this.options.template)),this.$tip};var c=a.fn.popover;a.fn.popover=function(c){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f=typeof c=="object"&&c;e||d.data("bs.popover",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.popover.Constructor=b,a.fn.popover.noConflict=function(){return a.fn.popover=c,this}}(window.jQuery),+function(a){"use strict";var b=function(b){this.element=a(b)};b.prototype.show=function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.data("target");d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,""));if(b.parent("li").hasClass("active"))return;var e=c.find(".active:last a")[0],f=a.Event("show.bs.tab",{relatedTarget:e});b.trigger(f);if(f.isDefaultPrevented())return;var g=a(d);this.activate(b.parent("li"),c),this.activate(g,g.parent(),function(){b.trigger({type:"shown.bs.tab",relatedTarget:e})})},b.prototype.activate=function(b,c,d){function g(){e.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),b.addClass("active"),f?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu")&&b.closest("li.dropdown").addClass("active"),d&&d()}var e=c.find("> .active"),f=d&&a.support.transition&&e.hasClass("fade");f?e.one(a.support.transition.end,g).emulateTransitionEnd(150):g(),e.removeClass("in")};var c=a.fn.tab;a.fn.tab=function(c){return this.each(function(){var d=a(this),e=d.data("bs.tab");e||d.data("bs.tab",e=new b(this)),typeof c=="string"&&e[c]()})},a.fn.tab.Constructor=b,a.fn.tab.noConflict=function(){return a.fn.tab=c,this},a(document).on("click.bs.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(b){b.preventDefault(),a(this).tab("show")})}(window.jQuery),+function(a){"use strict";var b=function(c,d){this.options=a.extend({},b.DEFAULTS,d),this.$window=a(window).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(c),this.affixed=this.unpin=null,this.checkPosition()};b.RESET="affix affix-top affix-bottom",b.DEFAULTS={offset:0},b.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},b.prototype.checkPosition=function(){if(!this.$element.is(":visible"))return;var c=a(document).height(),d=this.$window.scrollTop(),e=this.$element.offset(),f=this.options.offset,g=f.top,h=f.bottom;typeof f!="object"&&(h=g=f),typeof g=="function"&&(g=f.top()),typeof h=="function"&&(h=f.bottom());var i=this.unpin!=null&&d+this.unpin<=e.top?!1:h!=null&&e.top+this.$element.height()>=c-h?"bottom":g!=null&&d<=g?"top":!1;if(this.affixed===i)return;this.unpin&&this.$element.css("top",""),this.affixed=i,this.unpin=i=="bottom"?e.top-d:null,this.$element.removeClass(b.RESET).addClass("affix"+(i?"-"+i:"")),i=="bottom"&&this.$element.offset({top:document.body.offsetHeight-h-this.$element.height()})};var c=a.fn.affix;a.fn.affix=function(c){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f=typeof c=="object"&&c;
vendor: 6,111 bytes, lines 2011-2021
2011e||d.data("bs.affix",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.affix.Constructor=b,a.fn.affix.noConflict=function(){return a.fn.affix=c,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var b=a(this),c=b.data();c.offset=c.offset||{},c.offsetBottom&&(c.offset.bottom=c.offsetBottom),c.offsetTop&&(c.offset.top=c.offsetTop),b.affix(c)})})}(window.jQuery),+function(a){"use strict";var b=function(c,d){this.$element=a(c),this.options=a.extend({},b.DEFAULTS,d),this.transitioning=null,this.options.parent&&(this.$parent=a(this.options.parent)),this.options.toggle&&this.toggle()};b.DEFAULTS={toggle:!0},b.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},b.prototype.show=function(){if(this.transitioning||this.$element.hasClass("in"))return;var b=a.Event("show.bs.collapse");this.$element.trigger(b);if(b.isDefaultPrevented())return;var c=this.$parent&&this.$parent.find("> .panel > .in");if(c&&c.length){var d=c.data("bs.collapse");if(d&&d.transitioning)return;c.collapse("hide"),d||c.data("bs.collapse",null)}var e=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[e](0),this.transitioning=1;var f=function(){this.$element.removeClass("collapsing").addClass("in")[e]("auto"),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return f.call(this);var g=a.camelCase(["scroll",e].join("-"));this.$element.one(a.support.transition.end,a.proxy(f,this)).emulateTransitionEnd(350)[e](this.$element[0][g])},b.prototype.hide=function(){if(this.transitioning||!this.$element.hasClass("in"))return;var b=a.Event("hide.bs.collapse");this.$element.trigger(b);if(b.isDefaultPrevented())return;var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse").removeClass("in"),this.transitioning=1;var d=function(){this.transitioning=0,this.$element.trigger("hidden.bs.collapse").removeClass("collapsing").addClass("collapse")};if(!a.support.transition)return d.call(this);this.$element[c](0).one(a.support.transition.end,a.proxy(d,this)).emulateTransitionEnd(350)},b.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()};var c=a.fn.collapse;a.fn.collapse=function(c){return this.each(function(){var d=a(this),e=d.data("bs.collapse"),f=a.extend({},b.DEFAULTS,d.data(),typeof c=="object"&&c);e||d.data("bs.collapse",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.collapse.Constructor=b,a.fn.collapse.noConflict=function(){return a.fn.collapse=c,this},a(document).on("click.bs.collapse.data-api","[data-toggle=collapse]",function(b){var c=a(this),d,e=c.attr("data-target")||b.preventDefault()||(d=c.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""),f=a(e),g=f.data("bs.collapse"),h=g?"toggle":c.data(),i=c.attr("data-parent"),j=i&&a(i);if(!g||!g.transitioning)j&&j.find('[data-toggle=collapse][data-parent="'+i+'"]').not(c).addClass("collapsed"),c[f.hasClass("in")?"addClass":"removeClass"]("collapsed");f.collapse(h)})}(window.jQuery),+function(a){function b(c,d){var e,f=a.proxy(this.process,this);this.$element=a(c).is("body")?a(window):a(c),this.$body=a("body"),this.$scrollElement=this.$element.on("scroll.bs.scroll-spy.data-api",f),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||(e=a(c).attr("href"))&&e.replace(/.*(?=#[^\s]+$)/,"")||"")+" .nav li > a",this.offsets=a([]),this.targets=a([]),this.activeTarget=null,this.refresh(),this.process()}"use strict",b.DEFAULTS={offset:10},b.prototype.refresh=function(){var b=this.$element[0]==window?"offset":"position";this.offsets=a([]),this.targets=a([]);var c=this,d=this.$body.find(this.selector).map(function(){var d=a(this),e=d.data("target")||d.attr("href"),f=/^#\w/.test(e)&&a(e);return f&&f.length&&[[f[b]().top+(!a.isWindow(c.$scrollElement.get(0))&&c.$scrollElement.scrollTop()),e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){c.offsets.push(this[0]),c.targets.push(this[1])})},b.prototype.process=function(){var a=this.$scrollElement.scrollTop()+this.options.offset,b=this.$scrollElement[0].scrollHeight||this.$body[0].scrollHeight,c=b-this.$scrollElement.height(),d=this.offsets,e=this.targets,f=this.activeTarget,g;if(a>=c)return f!=(g=e.last()[0])&&this.activate(g);for(g=d.length;g--;)f!=e[g]&&a>=d[g]&&(!d[g+1]||a<=d[g+1])&&this.activate(e[g])},b.prototype.activate=function(b){this.activeTarget=b,a(this.selector).parents(".active").removeClass("active");var c=this.selector+'[data-target="'+b+'"],'+this.selector+'[href="'+b+'"]',d=a(c).parents("li").addClass("active");d.parent(".dropdown-menu").length&&(d=d.closest("li.dropdown").addClass("active")),d.trigger("activate")};var c=a.fn.scrollspy;a.fn.scrollspy=function(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f=typeof c=="object"&&c;e||d.data("bs.scrollspy",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.scrollspy.Constructor=b,a.fn.scrollspy.noConflict=function(){return a.fn.scrollspy=c,this},a(window).on("load",function(){a('[data-spy="scroll"]').each(function(){var b=a(this);b.scrollspy(b.data())})})}(window.jQuery),+function(a){function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(a.style[c]!==undefined)return{end:b[c]}}"use strict",a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one(a.support.transition.end,function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b()})}(window.jQuery)
2012/* End */
2013;
2014; /* Start:"a:4:{s:4:"full";s:69:"/bitrix/templates/aspro_max/vendor/js/jquery.appear.js?17164655373188";s:6:"source";s:54:"/bitrix/templates/aspro_max/vendor/js/jquery.appear.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
2015/*
2016 * jQuery.appear
2017 * https://github.com/bas2k/jquery.appear/
2018 * http://code.google.com/p/jquery-appear/
2019 *
2020 * Copyright (c) 2009 Michael Hixson
2021 * Copyright (c) 2012 Alexander Brovikov
2022 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
2023 */
2024(function($) {
2025	$.fn.appear = function(fn, options) {
2026
2027		var settings = $.extend({
2028
2029			//arbitrary data to pass to fn
2030			data: undefined,
2031
2032			//call fn only on the first appear?
2033			one: true,
2034
2035			// X & Y accuracy
2036			accX: 0,
2037			accY: 0
2038
2039		}, options);
2040
2041		return this.each(function() {
2042
2043			var t = $(this);
2044
2045			//whether the element is currently visible
2046			t.appeared = false;
2047
2048			if (!fn) {
2049
2050				//trigger the custom event
2051				t.trigger('appear', settings.data);
2052				return;
2053			}
2054
2055			var w = $(window);
2056
2057			//fires the appear event when appropriate
2058			var check = function() {
2059
2060				//is the element hidden?
2061				if (!t.is(':visible')) {
2062
2063					//it became hidden
2064					t.appeared = false;
2065					return;
2066				}
2067
2068				//is the element inside the visible window?
2069				var a = w.scrollLeft();
2070				var b = w.scrollTop();
2071				var o = t.offset();
2072				var x = o.left;
2073				var y = o.top;
2074
2075				var ax = settings.accX;
2076				var ay = settings.accY;
2077				var th = t.height();
2078				var wh = w.height();
2079				var tw = t.width();
2080				var ww = w.width();
2081
2082				if (y + th + ay >= b &&
2083					y <= b + wh + ay &&
2084					x + tw + ax >= a &&
2085					x <= a + ww + ax) {
2086
2087					//trigger the custom event
2088					if (!t.appeared) t.trigger('appear', settings.data);
2089
2090				} else {
2091
2092					//it scrolled out of view
2093					t.appeared = false;
2094				}
2095			};
2096
2097			//create a modified fn with some additional logic
2098			var modifiedFn = function() {
2099
2100				//mark the element as visible
2101				t.appeared = true;
2102
2103				//is this supposed to happen only once?
2104				if (settings.one) {
2105
2106					//remove the check
2107					w.unbind('scroll', check);
2108					var i = $.inArray(check, $.fn.appear.checks);
2109					if (i >= 0) $.fn.appear.checks.splice(i, 1);
2110				}
2111
2112				//trigger the original fn
2113				fn.apply(this, arguments);
2114			};
2115
2116			//bind the modified fn to the element
2117			if (settings.one) t.one('appear', settings.data, modifiedFn);
2118			else t.bind('appear', settings.data, modifiedFn);
2119
2120			//check whenever the window scrolls
2121			w.scroll(check);
2122
2123			//check whenever the dom changes
2124			$.fn.appear.checks.push(check);
2125
2126			//check now
2127			(check)();
2128		});
2129	};
2130
2131	//keep a queue of appearance checks
2132	$.extend($.fn.appear, {
2133
2134		checks: [],
2135		timeout: null,
2136
2137		//process the queue
2138		checkAll: function() {
2139			var length = $.fn.appear.checks.length;
2140			if (length > 0) while (length--) ($.fn.appear.checks[length])();
2141		},
2142
2143		//check the queue asynchronously
2144		run: function() {
2145			if ($.fn.appear.timeout) clearTimeout($.fn.appear.timeout);
2146			$.fn.appear.timeout = setTimeout($.fn.appear.checkAll, 20);
2147		}
2148	});
2149
2150	//run checks when these methods are called
2151	$.each(['append', 'prepend', 'after', 'before', 'attr',
2152		'removeAttr', 'addClass', 'removeClass', 'toggleClass',
2153		'remove', 'css', 'show', 'hide'], function(i, n) {
2154		var old = $.fn[n];
2155		if (old) {
2156			$.fn[n] = function() {
2157				var r = old.apply(this, arguments);
2158				$.fn.appear.run();
2159				return r;
2160			}
2161		}
2162	});
2163
2164})(jQuery);
2165/* End */
2166;
2167; /* Start:"a:4:{s:4:"full";s:62:"/bitrix/templates/aspro_max/vendor/js/ripple.js?17164655374702";s:6:"source";s:47:"/bitrix/templates/aspro_max/vendor/js/ripple.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
2168;(function($, document, Math){
2169    $.ripple = function(selector, options) {
2170
2171        var self = this;
2172
2173        var _log = self.log = function() {
2174            if(self.defaults.debug && console && console.log) {
2175                console.log.apply(console, arguments);
2176            }
2177        };
2178
2179        self.selector = selector;
2180        self.defaults = {
2181            debug: false,
2182            on: 'mousedown',
2183
2184            opacity: 0.4,
2185            color: "auto",
2186            multi: false,
2187
2188            duration: 0.7,
2189            rate: function(pxPerSecond) {
2190                return pxPerSecond;
2191            },
2192
2193            easing: 'linear'
2194        };
2195
2196        self.defaults = $.extend({}, self.defaults, options);
2197
2198        var Trigger = function(e) {
2199
2200            var $this = $(this);
2201            var $ripple;
2202            var settings;
2203
2204            $this.addClass('has-ripple');
2205
2206            // This instances settings
2207            settings = $.extend({}, self.defaults, $this.data());
2208
2209            // Create the ripple element
2210            if ( settings.multi || (!settings.multi && $this.find(".ripple").length === 0) ) {
2211                $ripple = $("<span></span>").addClass("ripple");
2212                $ripple.appendTo($this);
2213
2214                _log('Create: Ripple');
2215
2216                // Set ripple size
2217                if (!$ripple.height() && !$ripple.width()) {
2218                    var size = Math.max($this.outerWidth(), $this.outerHeight());
2219                    $ripple.css({
2220                        height: size,
2221                        width: size
2222                    });
2223                    _log('Set: Ripple size');
2224                }
2225
2226                // Give the user the ability to change the rate of the animation
2227                // based on element width
2228                if(settings.rate && typeof settings.rate == "function") {
2229
2230                    // rate = pixels per second
2231                    var rate = Math.round( $ripple.width() / settings.duration );
2232
2233                    // new amount of pixels per second
2234                    var filteredRate = settings.rate(rate);
2235
2236                    // Determine the new duration for the animation
2237                    var newDuration = ( $ripple.width() / filteredRate);
2238
2239                    // Set the new duration if it has not changed
2240                    if(settings.duration.toFixed(2) !== newDuration.toFixed(2)) {
2241                        _log('Update: Ripple Duration', {
2242                            from: settings.duration,
2243                            to: newDuration
2244                        });
2245                        settings.duration = newDuration;
2246                    }
2247                }
2248
2249                // Set the color and opacity
2250                var color = (settings.color == "auto") ? $this.css('color') : settings.color;
2251                var css = {
2252                    animationDuration: (settings.duration).toString() + 's',
2253                    animationTimingFunction: settings.easing,
2254                    background: color,
2255                    opacity: settings.opacity
2256                };
2257
2258                _log('Set: Ripple CSS', css);
2259                $ripple.css(css);
2260            }
2261
2262            // Ensure we always have the ripple element
2263            if(!settings.multi) {
2264                _log('Set: Ripple Element');
2265                $ripple = $this.find(".ripple");
2266            }
2267
2268            // Kill animation
2269            _log('Destroy: Ripple Animation');
2270            $ripple.removeClass("ripple-animate");
2271
2272
2273            // Retrieve coordinates
2274            var x = e.pageX - $this.offset().left - $ripple.width() / 2;
2275            var y = e.pageY - $this.offset().top - $ripple.height() / 2;
2276
2277            /**
2278             * We want to delete the ripple elements if we allow multiple so we dont sacrifice any page
2279             * performance. We don't do this on single ripples because once it has rendered, we only
2280             * need to trigger paints thereafter.
2281             */
2282            if(settings.multi) {
2283                _log('Set: Ripple animationend event');
2284                $ripple.one('animationend webkitAnimationEnd oanimationend MSAnimationEnd', function() {
2285                    _log('Note: Ripple animation ended');
2286                    _log('Destroy: Ripple');
2287                    $(this).remove();
2288                });
2289            }
2290
2291            // Set position and animate
2292            _log('Set: Ripple location');
2293            _log('Set: Ripple animation');
2294            $ripple.css({
2295                top: y + 'px',
2296                left: x + 'px'
2297            }).addClass("ripple-animate");
2298        };
2299
2300        $(document).on(self.defaults.on, self.selector, Trigger);
2301    };
2302})(jQuery, document, Math);
2303
2304/* End */
2305;
2306; /* Start:"a:4:{s:4:"full";s:74:"/bitrix/templates/aspro_max/vendor/js/velocity/velocity.js?171646553744791";s:6:"source";s:58:"/bitrix/templates/aspro_max/vendor/js/velocity/velocity.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
2307/*! VelocityJS.org (1.5.0). (C) 2014 Julian Shapiro. MIT @license: en.wikipedia.org/wiki/MIT_License */
2308/*! VelocityJS.org jQuery Shim (1.0.1). (C) 2014 The jQuery Foundation. MIT @license: en.wikipedia.org/wiki/MIT_License. */
2309!function(a){"use strict";function b(a){var b=a.length,d=c.type(a);return"function"!==d&&!c.isWindow(a)&&(!(1!==a.nodeType||!b)||("array"===d||0===b||"number"==typeof b&&b>0&&b-1 in a))}if(!a.jQuery){var c=function(a,b){return new c.fn.init(a,b)};c.isWindow=function(a){return a&&a===a.window},c.type=function(a){return a?"object"==typeof a||"function"==typeof a?e[g.call(a)]||"object":typeof a:a+""},c.isArray=Array.isArray||function(a){return"array"===c.type(a)},c.isPlainObject=function(a){var b;if(!a||"object"!==c.type(a)||a.nodeType||c.isWindow(a))return!1;try{if(a.constructor&&!f.call(a,"constructor")&&!f.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(d){return!1}for(b in a);return b===undefined||f.call(a,b)},c.each=function(a,c,d){var e=0,f=a.length,g=b(a);if(d){if(g)for(;e<f&&c.apply(a[e],d)!==!1;e++);else for(e in a)if(a.hasOwnProperty(e)&&c.apply(a[e],d)===!1)break}else if(g)for(;e<f&&c.call(a[e],e,a[e])!==!1;e++);else for(e in a)if(a.hasOwnProperty(e)&&c.call(a[e],e,a[e])===!1)break;return a},c.data=function(a,b,e){if(e===undefined){var f=a[c.expando],g=f&&d[f];if(b===undefined)return g;if(g&&b in g)return g[b]}else if(b!==undefined){var h=a[c.expando]||(a[c.expando]=++c.uuid);return d[h]=d[h]||{},d[h][b]=e,e}},c.removeData=function(a,b){var e=a[c.expando],f=e&&d[e];f&&(b?c.each(b,function(a,b){delete f[b]}):delete d[e])},c.extend=function(){var a,b,d,e,f,g,h=arguments[0]||{},i=1,j=arguments.length,k=!1;for("boolean"==typeof h&&(k=h,h=arguments[i]||{},i++),"object"!=typeof h&&"function"!==c.type(h)&&(h={}),i===j&&(h=this,i--);i<j;i++)if(f=arguments[i])for(e in f)f.hasOwnProperty(e)&&(a=h[e],d=f[e],h!==d&&(k&&d&&(c.isPlainObject(d)||(b=c.isArray(d)))?(b?(b=!1,g=a&&c.isArray(a)?a:[]):g=a&&c.isPlainObject(a)?a:{}
vendor: 30,293 bytes, lines 2309-2310
2309,h[e]=c.extend(k,g,d)):d!==undefined&&(h[e]=d)));return h},c.queue=function(a,d,e){if(a){d=(d||"fx")+"queue";var f=c.data(a,d);return e?(!f||c.isArray(e)?f=c.data(a,d,function(a,c){var d=c||[];return a&&(b(Object(a))?function(a,b){for(var c=+b.length,d=0,e=a.length;d<c;)a[e++]=b[d++];if(c!==c)for(;b[d]!==undefined;)a[e++]=b[d++];a.length=e,a}(d,"string"==typeof a?[a]:a):[].push.call(d,a)),d}(e)):f.push(e),f):f||[]}},c.dequeue=function(a,b){c.each(a.nodeType?[a]:a,function(a,d){b=b||"fx";var e=c.queue(d,b),f=e.shift();"inprogress"===f&&(f=e.shift()),f&&("fx"===b&&e.unshift("inprogress"),f.call(d,function(){c.dequeue(d,b)}))})},c.fn=c.prototype={init:function(a){if(a.nodeType)return this[0]=a,this;throw new Error("Not a DOM node.")},offset:function(){var b=this[0].getBoundingClientRect?this[0].getBoundingClientRect():{top:0,left:0};return{top:b.top+(a.pageYOffset||document.scrollTop||0)-(document.clientTop||0),left:b.left+(a.pageXOffset||document.scrollLeft||0)-(document.clientLeft||0)}},position:function(){var a=this[0],b=function(a){for(var b=a.offsetParent;b&&"html"!==b.nodeName.toLowerCase()&&b.style&&"static"===b.style.position;)b=b.offsetParent;return b||document}(a),d=this.offset(),e=/^(?:body|html)$/i.test(b.nodeName)?{top:0,left:0}:c(b).offset();return d.top-=parseFloat(a.style.marginTop)||0,d.left-=parseFloat(a.style.marginLeft)||0,b.style&&(e.top+=parseFloat(b.style.borderTopWidth)||0,e.left+=parseFloat(b.style.borderLeftWidth)||0),{top:d.top-e.top,left:d.left-e.left}}};var d={};c.expando="velocity"+(new Date).getTime(),c.uuid=0;for(var e={},f=e.hasOwnProperty,g=e.toString,h="Boolean Number String Function Array Date RegExp Object Error".split(" "),i=0;i<h.length;i++)e["[object "+h[i]+"]"]=h[i].toLowerCase();c.fn.init.prototype=c.fn,a.Velocity={Utilities:c}}}(window),function(a){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=a():"function"==typeof define&&define.amd?define(a):a()}(function(){"use strict";return function(a,b,c,d){function e(a){for(var b=-1,c=a?a.length:0,d=[];++b<c;){var e=a[b];e&&d.push(e)}return d}function f(a){return u.isWrapped(a)?a=s.call(a):u.isNode(a)&&(a=[a]),a}function g(a){var b=o.data(a,"velocity");return null===b?d:b}function h(a,b){var c=g(a);c&&c.delayTimer&&!c.delayPaused&&(c.delayRemaining=c.delay-b+c.delayBegin,c.delayPaused=!0,clearTimeout(c.delayTimer.setTimeout))}function i(a,b){var c=g(a);c&&c.delayTimer&&c.delayPaused&&(c.delayPaused=!1,c.delayTimer.setTimeout=setTimeout(c.delayTimer.next,c.delayRemaining))}function j(a){return function(b){return Math.round(b*a)*(1/a)}}function k(a,c,d,e){function f(a,b){return 1-3*b+3*a}function g(a,b){return 3*b-6*a}function h(a){return 3*a}function i(a,b,c){return((f(b,c)*a+g(b,c))*a+h(b))*a}function j(a,b,c){return 3*f(b,c)*a*a+2*g(b,c)*a+h(b)}function k(b,c){for(var e=0;e<p;++e){var f=j(c,a,d);if(0===f)return c;c-=(i(c,a,d)-b)/f}return c}function l(){for(var b=0;b<t;++b)x[b]=i(b*u,a,d)}function m(b,c,e){var f,g,h=0;do{g=c+(e-c)/2,f=i(g,a,d)-b,f>0?e=g:c=g}while(Math.abs(f)>r&&++h<s);return g}function n(b){for(var c=0,e=1,f=t-1;e!==f&&x[e]<=b;++e)c+=u;--e;var g=(b-x[e])/(x[e+1]-x[e]),h=c+g*u,i=j(h,a,d);return i>=q?k(b,h):0===i?h:m(b,c,c+u)}function o(){y=!0,a===c&&d===e||l()}var p=4,q=.001,r=1e-7,s=10,t=11,u=1/(t-1),v="Float32Array"in b;if(4!==arguments.length)return!1;for(var w=0;w<4;++w)if("number"!=typeof arguments[w]||isNaN(arguments[w])||!isFinite(arguments[w]))return!1;a=Math.min(a,1),d=Math.min(d,1),a=Math.max(a,0),d=Math.max(d,0);var x=v?new Float32Array(t):new Array(t),y=!1,z=function(b){return y||o(),a===c&&d===e?b:0===b?0:1===b?1:i(n(b),c,e)};z.getControlPoints=function(){return[{x:a,y:c},{x:d,y:e}]};var A="generateBezier("+[a,c,d,e]+")";return z.toString=function(){return A},z}function l(a,b){var c=a;return u.isString(a)?y.Easings[a]||(c=!1):c=u.isArray(a)&&1===a.length?j.apply(null,a):u.isArray(a)&&2===a.length?z.apply(null,a.concat([b])):!(!u.isArray(a)||4!==a.length)&&k.apply(null,a),c===!1&&(c=y.Easings[y.defaults.easing]?y.defaults.easing:x),c}function m(a){if(a){var b=y.timestamp&&a!==!0?a:r.now(),c=y.State.calls.length;c>1e4&&(y.State.calls=e(y.State.calls),c=y.State.calls.length);for(var f=0;f<c;f++)if(y.State.calls[f]){var h=y.State.calls[f],i=h[0],j=h[2],k=h[3],l=!!k,q=null,s=h[5],t=h[6];if(k||(k=y.State.calls[f][3]=b-16),s){if(s.resume!==!0)continue;k=h[3]=Math.round(b-t-16),h[5]=null}t=h[6]=b-k;for(var v=Math.min(t/j.duration,1),w=0,x=i.length;w<x;w++){var z=i[w],B=z.element;if(g(B)){var D=!1;if(j.display!==d&&null!==j.display&&"none"!==j.display){if("flex"===j.display){var E=["-webkit-box","-moz-box","-ms-flexbox","-webkit-flex"];o.each(E,function(a,b){A.setPropertyValue(B,"display",b)})}A.setPropertyValue(B,"display",j.display)}j.visibility!==d&&"hidden"!==j.visibility&&A.setPropertyValue(B,"visibility",j.visibility);for(var F in z)if(z.hasOwnProperty(F)&&"element"!==F){var G,H=z[F],I=u.isString(H.easing)?y.Easings[H.easing]:H.easing;if(u.isString(H.pattern)){var J=1===v?function(a,b,c){var d=H.endValue[b];return c?Math.round(d):d}:function(a,b,c){var d=H.startValue[b],e=H.endValue[b]-d,f=d+e*I(v,j,e);return c?Math.round(f):f};G=H.pattern.replace(/{(\d+)(!)?}/g,J)}else if(1===v)G=H.endValue;else{var K=H.endValue-H.startValue;G=H.startValue+K*I(v,j,K)}if(!l&&G===H.currentValue)continue;if(H.currentValue=G,"tween"===F)q=G;else{var L;if(A.Hooks.registered[F]){L=A.Hooks.getRoot(F);var M=g(B).rootPropertyValueCache[L];M&&(H.rootPropertyValue=M)}var N=A.setPropertyValue(B,F,H.currentValue+(p<9&&0===parseFloat(G)?"":H.unitType),H.rootPropertyValue,H.scrollData);A.Hooks.registered[F]&&(A.Normalizations.registered[L]?g(B).rootPropertyValueCache[L]=A.Normalizations.registered[L]("extract",null,N[1]):g(B).rootPropertyValueCache[L]=N[1]),"transform"===N[0]&&(D=!0)}}j.mobileHA&&g(B).transformCache.translate3d===d&&(g(B).transformCache.translate3d="(0px, 0px, 0px)",D=!0),D&&A.flushTransformCache(B)}}j.display!==d&&"none"!==j.display&&(y.State.calls[f][2].display=!1),j.visibility!==d&&"hidden"!==j.visibility&&(y.State.calls[f][2].visibility=!1),j.progress&&j.progress.call(h[1],h[1],v,Math.max(0,k+j.duration-b),k,q),1===v&&n(f)}}y.State.isTicking&&C(m)}function n(a,b){if(!y.State.calls[a])return!1;for(var c=y.State.calls[a][0],e=y.State.calls[a][1],f=y.State.calls[a][2],h=y.State.calls[a][4],i=!1,j=0,k=c.length;j<k;j++){var l=c[j].element;b||f.loop||("none"===f.display&&A.setPropertyValue(l,"display",f.display),"hidden"===f.visibility&&A.setPropertyValue(l,"visibility",f.visibility));var m=g(l);if(f.loop!==!0&&(o.queue(l)[1]===d||!/\.velocityQueueEntryFlag/i.test(o.queue(l)[1]))&&m){m.isAnimating=!1,m.rootPropertyValueCache={};var n=!1;o.each(A.Lists.transforms3D,function(a,b){var c=/^scale/.test(b)?1:0,e=m.transformCache[b];m.transformCache[b]!==d&&new RegExp("^\\("+c+"[^.]").test(e)&&(n=!0,delete m.transformCache[b])}),f.mobileHA&&(n=!0,delete m.transformCache.translate3d),n&&A.flushTransformCache(l),A.Values.removeClass(l,"velocity-animating")}if(!b&&f.complete&&!f.loop&&j===k-1)try{f.complete.call(e,e)}catch(r){setTimeout(function(){throw r},1)}h&&f.loop!==!0&&h(e),m&&f.loop===!0&&!b&&(o.each(m.tweensContainer,function(a,b){if(/^rotate/.test(a)&&(parseFloat(b.startValue)-parseFloat(b.endValue))%360==0){var c=b.startValue;b.startValue=b.endValue,b.endValue=c}/^backgroundPosition/.test(a)&&100===parseFloat(b.endValue)&&"%"===b.unitType&&(b.endValue=0,b.startValue=100)}),y(l,"reverse",{loop:!0,delay:f.delay})),f.queue!==!1&&o.dequeue(l,f.queue)}y.State.calls[a]=!1;for(var p=0,q=y.State.calls.length;p<q;p++)if(y.State.calls[p]!==!1){i=!0;break}i===!1&&(y.State.isTicking=!1,delete y.State.calls,y.State.calls=[])}var o,p=function(){if(c.documentMode)return c.documentMode;for(var a=7;a>4;a--){var b=c.createElement("div");if(b.innerHTML="<!--[if IE "+a+"]><span></span><![endif]-->",b.getElementsByTagName("span").length)return b=null,a}return d}(),q=function(){var a=0;return b.webkitRequestAnimationFrame||b.mozRequestAnimationFrame||function(b){var c,d=(new Date).getTime();return c=Math.max(0,16-(d-a)),a=d+c,setTimeout(function(){b(d+c)},c)}}(),r=function(){var a=b.performance||{};if("function"!=typeof a.now){var c=a.timing&&a.timing.navigationStart?a.timing.navigationStart:(new Date).getTime();a.now=function(){return(new Date).getTime()-c}}return a}(),s=function(){var a=Array.prototype.slice;try{return a.call(c.documentElement),a}catch(b){return function(b,c){var d=this.length;if("number"!=typeof b&&(b=0),"number"!=typeof c&&(c=d),this.slice)return a.call(this,b,c);var e,f=[],g=b>=0?b:Math.max(0,d+b),h=c<0?d+c:Math.min(c,d),i=h-g;if(i>0)if(f=new Array(i),this.charAt)for(e=0;e<i;e++)f[e]=this.charAt(g+e);else for(e=0;e<i;e++)f[e]=this[g+e];return f}}}(),t=function(){return Array.prototype.includes?function(a,b){return a.includes(b)}:Array.prototype.indexOf?function(a,b){return a.indexOf(b)>=0}:function(a,b){for(var c=0;c<a.length;c++)if(a[c]===b)return!0;return!1}},u={isNumber:function(a){return"number"==typeof a},isString:function(a){return"string"==typeof a},isArray:Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)},isFunction:function(a){return"[object Function]"===Object.prototype.toString.call(a)},isNode:function(a){return a&&a.nodeType},isWrapped:function(a){return a&&a!==b&&u.isNumber(a.length)&&!u.isString(a)&&!u.isFunction(a)&&!u.isNode(a)&&(0===a.length||u.isNode(a[0]))},isSVG:function(a){return b.SVGElement&&a instanceof b.SVGElement},isEmptyObject:function(a){for(var b in a)if(a.hasOwnProperty(b))return!1;return!0}},v=!1;if(a.fn&&a.fn.jquery?(o=a,v=!0):o=b.Velocity.Utilities,p<=8&&!v)throw new Error("Velocity: IE8 and below require jQuery to be loaded before Velocity.");if(p<=7)return void(jQuery.fn.velocity=jQuery.fn.animate);var w=400,x="swing",y={State:{isMobile:/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),isAndroid:/Android/i.test(navigator.userAgent),isGingerbread:/Android 2\.3\.[3-7]/i.test(navigator.userAgent),isChrome:b.chrome,isFirefox:/Firefox/i.test(navigator.userAgent),prefixElement:c.createElement("div"),prefixMatches:{},scrollAnchor:null,scrollPropertyLeft:null,scrollPropertyTop:null,isTicking:!1,calls:[],delayedElements:{count:0}},CSS:{},Utilities:o,Redirects:{},Easings:{},Promise:b.Promise,defaults:{queue:"",duration:w,easing:x,begin:d,complete:d,progress:d,display:d,visibility:d,loop:!1,delay:!1,mobileHA:!0,_cacheValues:!0,promiseRejectEmpty:!0},init:function(a){o.data(a,"velocity",{isSVG:u.isSVG(a),isAnimating:!1,computedStyle:null,tweensContainer:null,rootPropertyValueCache:{},transformCache:{}})},hook:null,mock:!1,version:{major:1,minor:5,patch:0},debug:!1,timestamp:!0,pauseAll:function(a){var b=(new Date).getTime();o.each(y.State.calls,function(b,c){if(c){if(a!==d&&(c[2].queue!==a||c[2].queue===!1))return!0;c[5]={resume:!1}}}),o.each(y.State.delayedElements,function(a,c){c&&h(c,b)})},resumeAll:function(a){var b=(new Date).getTime();o.each(y.State.calls,function(b,c){if(c){if(a!==d&&(c[2].queue!==a||c[2].queue===!1))return!0;c[5]&&(c[5].resume=!0)}}),o.each(y.State.delayedElements,function(a,c){c&&i(c,b)})}};b.pageYOffset!==d?(y.State.scrollAnchor=b,y.State.scrollPropertyLeft="pageXOffset",y.State.scrollPropertyTop="pageYOffset"):(y.State.scrollAnchor=c.documentElement||c.body.parentNode||c.body,y.State.scrollPropertyLeft="scrollLeft",y.State.scrollPropertyTop="scrollTop");var z=function(){function a(a){return-a.tension*a.x-a.friction*a.v}function b(b,c,d){var e={x:b.x+d.dx*c,v:b.v+d.dv*c,tension:b.tension,friction:b.friction};return{dx:e.v,dv:a(e)}}function c(c,d){var e={dx:c.v,dv:a(c)},f=b(c,.5*d,e),g=b(c,.5*d,f),h=b(c,d,g),i=1/6*(e.dx+2*(f.dx+g.dx)+h.dx),j=1/6*(e.dv+2*(f.dv+g.dv)+h.dv);return c.x=c.x+i*d,c.v=c.v+j*d,c}return function d(a,b,e){var f,g,h,i={x:-1,v:0,tension:null,friction:null},j=[0],k=0;for(a=parseFloat(a)||500,b=parseFloat(b)||20,e=e||null,i.tension=a,i.friction=b,f=null!==e,f?(k=d(a,b),g=k/e*.016):g=.016;;)if(h=c(h||i,g),j.push(1+h.x),k+=16,!(Math.abs(h.x)>1e-4&&Math.abs(h.v)>1e-4))break;return f?function(a){return j[a*(j.length-1)|0]}:k}}();y.Easings={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2},spring:function(a){return 1-Math.cos(4.5*a*Math.PI)*Math.exp(6*-a)}},o.each([["ease",[.25,.1,.25,1]],["ease-in",[.42,0,1,1]],["ease-out",[0,0,.58,1]],["ease-in-out",[.42,0,.58,1]],["easeInSine",[.47,0,.745,.715]],["easeOutSine",[.39,.575,.565,1]],["easeInOutSine",[.445,.05,.55,.95]],["easeInQuad",[.55,.085,.68,.53]],["easeOutQuad",[.25,.46,.45,.94]],["easeInOutQuad",[.455,.03,.515,.955]],["easeInCubic",[.55,.055,.675,.19]],["easeOutCubic",[.215,.61,.355,1]],["easeInOutCubic",[.645,.045,.355,1]],["easeInQuart",[.895,.03,.685,.22]],["easeOutQuart",[.165,.84,.44,1]],["easeInOutQuart",[.77,0,.175,1]],["easeInQuint",[.755,.05,.855,.06]],["easeOutQuint",[.23,1,.32,1]],["easeInOutQuint",[.86,0,.07,1]],["easeInExpo",[.95,.05,.795,.035]],["easeOutExpo",[.19,1,.22,1]],["easeInOutExpo",[1,0,0,1]],["easeInCirc",[.6,.04,.98,.335]],["easeOutCirc",[.075,.82,.165,1]],["easeInOutCirc",[.785,.135,.15,.86]]],function(a,b){y.Easings[b[0]]=k.apply(null,b[1])});var A=y.CSS={RegEx:{isHex:/^#([A-f\d]{3}){1,2}$/i,valueUnwrap:/^[A-z]+\((.*)\)$/i,wrappedValueAlreadyExtracted:/[0-9.]+ [0-9.]+ [0-9.]+( [0-9.]+)?/,valueSplit:/([A-z]+\(.+\))|(([A-z0-9#-.]+?)(?=\s|$))/gi},Lists:{colors:["fill","stroke","stopColor","color","backgroundColor","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor","outlineColor"],transformsBase:["translateX","translateY","scale","scaleX","scaleY","skewX","skewY","rotateZ"],transforms3D:["transformPerspective","translateZ","scaleZ","rotateX","rotateY"],units:["%","em","ex","ch","rem","vw","vh","vmin","vmax","cm","mm","Q","in","pc","pt","px","deg","grad","rad","turn","s","ms"],colorNames:{aliceblue:"240,248,255",antiquewhite:"250,235,215",aquamarine:"127,255,212",aqua:"0,255,255",azure:"240,255,255",beige:"245,245,220",bisque:"255,228,196",black:"0,0,0",blanchedalmond:"255,235,205",blueviolet:"138,43,226",blue:"0,0,255",brown:"165,42,42",burlywood:"222,184,135",cadetblue:"95,158,160",chartreuse:"127,255,0",chocolate:"210,105,30",coral:"255,127,80",cornflowerblue:"100,149,237",cornsilk:"255,248,220",crimson:"220,20,60",cyan:"0,255,255",darkblue:"0,0,139",darkcyan:"0,139,139",darkgoldenrod:"184,134,11",darkgray:"169,169,169",darkgrey:"169,169,169",darkgreen:"0,100,0",darkkhaki:"189,183,107",darkmagenta:"139,0,139",darkolivegreen:"85,107,47",darkorange:"255,140,0",darkorchid:"153,50,204",darkred:"139,0,0",darksalmon:"233,150,122",darkseagreen:"143,188,143",darkslateblue:"72,61,139",darkslategray:"47,79,79",darkturquoise:"0,206,209",darkviolet:"148,0,211",deeppink:"255,20,147",deepskyblue:"0,191,255",dimgray:"105,105,105",dimgrey:"105,105,105",dodgerblue:"30,144,255",firebrick:"178,34,34",floralwhite:"255,250,240",forestgreen:"34,139,34",fuchsia:"255,0,255",gainsboro:"220,220,220",ghostwhite:"248,248,255",gold:"255,215,0",goldenrod:"218,165,32",gray:"128,128,128",grey:"128,128,128",greenyellow:"173,255,47",green:"0,128,0",honeydew:"240,255,240",hotpink:"255,105,180",indianred:"205,92,92",indigo:"75,0,130",ivory:"255,255,240",khaki:"240,230,140",lavenderblush:"255,240,245",lavender:"230,230,250",lawngreen:"124,252,0",lemonchiffon:"255,250,205",lightblue:"173,216,230",lightcoral:"240,128,128",lightcyan:"224,255,255",lightgoldenrodyellow:"250,250,210",lightgray:"211,211,211",lightgrey:"211,211,211",lightgreen:"144,238,144",lightpink:"255,182,193",lightsalmon:"255,160,122",lightseagreen:"32,178,170",lightskyblue:"135,206,250",lightslategray:"119,136,153",lightsteelblue:"176,196,222",lightyellow:"255,255,224",limegreen:"50,205,50",lime:"0,255,0",linen:"250,240,230",magenta:"255,0,255",maroon:"128,0,0",mediumaquamarine:"102,205,170",mediumblue:"0,0,205",mediumorchid:"186,85,211",mediumpurple:"147,112,219",mediumseagreen:"60,179,113",mediumslateblue:"123,104,238",mediumspringgreen:"0,250,154",mediumturquoise:"72,209,204",mediumvioletred:"199,21,133",midnightblue:"25,25,112",mintcream:"245,255,250",mistyrose:"255,228,225",moccasin:"255,228,181",navajowhite:"255,222,173",navy:"0,0,128",oldlace:"253,245,230",olivedrab:"107,142,35",olive:"128,128,0",orangered:"255,69,0",orange:"255,165,0",orchid:"218,112,214",palegoldenrod:"238,232,170",palegreen:"152,251,152",paleturquoise:"175,238,238",palevioletred:"219,112,147",papayawhip:"255,239,213",peachpuff:"255,218,185",peru:"205,133,63",pink:"255,192,203",plum:"221,160,221",powderblue:"176,224,230",purple:"128,0,128",red:"255,0,0",rosybrown:"188,143,143",royalblue:"65,105,225",saddlebrown:"139,69,19",salmon:"250,128,114",sandybrown:"244,164,96",seagreen:"46,139,87",seashell:"255,245,238",sienna:"160,82,45",silver:"192,192,192",skyblue:"135,206,235",slateblue:"106,90,205",slategray:"112,128,144",snow:"255,250,250",springgreen:"0,255,127",steelblue:"70,130,180",tan:"210,180,140",teal:"0,128,128",thistle:"216,191,216",tomato:"255,99,71",turquoise:"64,224,208",violet:"238,130,238",wheat:"245,222,179",whitesmoke:"245,245,245",white:"255,255,255",yellowgreen:"154,205,50",yellow:"255,255,0"}},Hooks:{templates:{textShadow:["Color X Y Blur","black 0px 0px 0px"],boxShadow:["Color X Y Blur Spread","black 0px 0px 0px 0px"],clip:["Top Right Bottom Left","0px 0px 0px 0px"],backgroundPosition:["X Y","0% 0%"],transformOrigin:["X Y Z","50% 50% 0px"],perspectiveOrigin:["X Y","50% 50%"]},registered:{},register:function(){for(var a=0;a<A.Lists.colors.length;a++){var b="color"===A.Lists.colors[a]?"0 0 0 1":"255 255 255 1";A.Hooks.templates[A.Lists.colors[a]]=["Red Green Blue Alpha",b]}var c,d,e;if(p)for(c in A.Hooks.templates)if(A.Hooks.templates.hasOwnProperty(c)){d=A.Hooks.templates[c],e=d[0].split(" ");var f=d[1].match(A.RegEx.valueSplit);"Color"===e[0]&&(e.push(e.shift()),f.push(f.shift()),A.Hooks.templates[c]=[e.join(" "),f.join(" ")])}for(c in A.Hooks.templates)if(A.Hooks.templates.hasOwnProperty(c)){d=A.Hooks.templates[c],e=d[0].split(" ");for(var g in e)if(e.hasOwnProperty(g)){var h=c+e[g],i=g;A.Hooks.registered[h]=[c,i]}}},getRoot:function(a){var b=A.Hooks.registered[a];return b?b[0]:a},getUnit:function(a,b){var c=(a.substr(b||0,5).match(/^[a-z%]+/)||[])[0]||"";return c&&t(A.Lists.units,c)?c:""},fixColors:function(a){return a.replace(/(rgba?\(\s*)?(\b[a-z]+\b)/g,function(a,b,c){return A.Lists.colorNames.hasOwnProperty(c)?(b?b:"rgba(")+A.Lists.colorNames[c]+(b?"":",1)"):b+c})},cleanRootPropertyValue:function(a,b){return A.RegEx.valueUnwrap.test(b)&&(b=b.match(A.RegEx.valueUnwrap)[1]),A.Values.isCSSNullValue(b)&&(b=A.Hooks.templates[a][1]),b},extractValue:function(a,b){var c=A.Hooks.registered[a];if(c){var d=c[0],e=c[1];return b=A.Hooks.cleanRootPropertyValue(d,b),b.toString().match(A.RegEx.valueSplit)[e]}return b},injectValue:function(a,b,c){var d=A.Hooks.registered[a];if(d){var e,f=d[0],g=d[1];return c=A.Hooks.cleanRootPropertyValue(f,c),e=c.toString().match(A.RegEx.valueSplit),e[g]=b,e.join(" ")}return c}},Normalizations:{registered:{clip:function(a,b,c){switch(a){case"name":return"clip";case"extract":var d;return A.RegEx.wrappedValueAlreadyExtracted.test(c)?d=c:(d=c.toString().match(A.RegEx.valueUnwrap),d=d?d[1].replace(/,(\s+)?/g," "):c),d;case"inject":return"rect("+c+")"}},blur:function(a,b,c){switch(a){case"name":return y.State.isFirefox?"filter":"-webkit-filter";case"extract":var d=parseFloat(c);if(!d&&0!==d){var e=c.toString().match(/blur\(([0-9]+[A-z]+)\)/i);d=e?e[1]:0}return d;case"inject":return parseFloat(c)?"blur("+c+")":"none"}},opacity:function(a,b,c){if(p<=8)switch(a){case"name":return"filter";case"extract":var d=c.toString().match(/alpha\(opacity=(.*)\)/i);return c=d?d[1]/100:1;case"inject":return b.style.zoom=1,parseFloat(c)>=1?"":"alpha(opacity="+parseInt(100*parseFloat(c),10)+")"}else switch(a){case"name":return"opacity";case"extract":return c;case"inject":return c}}},register:function(){function a(a,b,c){if("border-box"===A.getPropertyValue(b,"boxSizing").toString().toLowerCase()===(c||!1)){var d,e,f=0,g="width"===a?["Left","Right"]:["Top","Bottom"],h=["padding"+g[0],"padding"+g[1],"border"+g[0]+"Width","border"+g[1]+"Width"];for(d=0;d<h.length;d++)e=parseFloat(A.getPropertyValue(b,h[d])),isNaN(e)||(f+=e);return c?-f:f}return 0}function b(b,c){return function(d,e,f){switch(d){case"name":return b;case"extract":return parseFloat(f)+a(b,e,c);case"inject":return parseFloat(f)-a(b,e,c)+"px"}}}p&&!(p>9)||y.State.isGingerbread||(A.Lists.transformsBase=A.Lists.transformsBase.concat(A.Lists.transforms3D));for(var c=0;c<A.Lists.transformsBase.length;c++)!function(){var a=A.Lists.transformsBase[c];A.Normalizations.registered[a]=function(b,c,e){switch(b){case"name":return"transform";case"extract":return g(c)===d||g(c).transformCache[a]===d?/^scale/i.test(a)?1:0:g(c).transformCache[a].replace(/[()]/g,"");case"inject":var f=!1;switch(a.substr(0,a.length-1)){case"translate":f=!/(%|px|em|rem|vw|vh|\d)$/i.test(e);break;case"scal":case"scale":y.State.isAndroid&&g(c).transformCache[a]===d&&e<1&&(e=1),f=!/(\d)$/i.test(e);break;case"skew":f=!/(deg|\d)$/i.test(e);break;case"rotate":f=!/(deg|\d)$/i.test(e)}return f||(g(c).transformCache[a]="("+e+")"),g(c).transformCache[a]}}}();for(var e=0;e<A.Lists.colors.length;e++)!function(){var a=A.Lists.colors[e];A.Normalizations.registered[a]=function(b,c,e){switch(b){case"name":return a;case"extract":var f;if(A.RegEx.wrappedValueAlreadyExtracted.test(e))f=e;else{var g,h={black:"rgb(0, 0, 0)",blue:"rgb(0, 0, 255)",gray:"rgb(128, 128, 128)",green:"rgb(0, 128, 0)",red:"rgb(255, 0, 0)",white:"rgb(255, 255, 255)"};/^[A-z]+$/i.test(e)?g=h[e]!==d?h[e]:h.black:A.RegEx.isHex.test(e)?g="rgb("+A.Values.hexToRgb(e).join(" ")+")":/^rgba?\(/i.test(e)||(g=h.black),f=(g||e).toString().match(A.RegEx.valueUnwrap)[1].replace(/,(\s+)?/g," ")}return(!p||p>8)&&3===f.split(" ").length&&(f+=" 1"),f;case"inject":return/^rgb/.test(e)?e:(p<=8?4===e.split(" ").length&&(e=e.split(/\s+/).slice(0,3).join(" ")):3===e.split(" ").length&&(e+=" 1"),(p<=8?"rgb":"rgba")+"("+e.replace(/\s+/g,",").replace(/\.(\d)+(?=,)/g,"")+")")}}}();A.Normalizations.registered.innerWidth=b("width",!0),A.Normalizations.registered.innerHeight=b("height",!0),A.Normalizations.registered.outerWidth=b("width"),A.Normalizations.registered.outerHeight=b("height")}},Names:{camelCase:function(a){return a.replace(/-(\w)/g,function(a,b){return b.toUpperCase()})},SVGAttribute:function(a){var b="width|height|x|y|cx|cy|r|rx|ry|x1|x2|y1|y2";return(p||y.State.isAndroid&&!y.State.isChrome)&&(b+="|transform"),new RegExp("^("+b+")$","i").test(a)},prefixCheck:function(a){if(y.State.prefixMatches[a])return[y.State.prefixMatches[a],!0];for(var b=["","Webkit","Moz","ms","O"],c=0,d=b.length;c<d;c++){var e;if(e=0===c?a:b[c]+a.replace(/^\w/,function(a){return a.toUpperCase()}),u.isString(y.State.prefixElement.style[e]))return y.State.prefixMatches[a]=e,[e,!0]}return[a,!1]}},Values:{hexToRgb:function(a){var b,c=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i;return a=a.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,function(a,b,c,d){return b+b+c+c+d+d}),b=c.exec(a),b?[parseInt(b[1],16),parseInt(b[2],16),parseInt(b[3],16)]:[0,0,0]},isCSSNullValue:function(a){return!a||/^(none|auto|transparent|(rgba\(0, ?0, ?0, ?0\)))$/i.test(a)},getUnitType:function(a){return/^(rotate|skew)/i.test(a)?"deg":/(^(scale|scaleX|scaleY|scaleZ|alpha|flexGrow|flexHeight|zIndex|fontWeight)$)|((opacity|red|green|blue|alpha)$)/i.test(a)?"":"px"},getDisplayType:function(a){var b=a&&a.tagName.toString().toLowerCase();return/^(b|big|i|small|tt|abbr|acronym|cite|code|dfn|em|kbd|strong|samp|var|a|bdo|br|img|map|object|q|script|span|sub|sup|button|input|label|select|textarea)$/i.test(b)?"inline":/^(li)$/i.test(b)?"list-item":/^(tr)$/i.test(b)?"table-row":/^(table)$/i.test(b)?"table":/^(tbody)$/i.test(b)?"table-row-group":"block"},addClass:function(a,b){if(a)if(a.classList)a.classList.add(b);else if(u.isString(a.className))a.className+=(a.className.length?" ":"")+b;else{var c=a.getAttribute(p<=7?"className":"class")||"";a.setAttribute("class",c+(c?" ":"")+b)}},removeClass:function(a,b){if(a)if(a.classList)a.classList.remove(b);else if(u.isString(a.className))a.className=a.className.toString().replace(new RegExp("(^|\\s)"+b.split(" ").join("|")+"(\\s|$)","gi")," ");else{var c=a.getAttribute(p<=7?"className":"class")||"";a.setAttribute("class",c.replace(new RegExp("(^|s)"+b.split(" ").join("|")+"(s|$)","gi")," "))}}},getPropertyValue:function(a,c,e,f){function h(a,c){var e=0;if(p<=8)e=o.css(a,c);else{var i=!1;/^(width|height)$/.test(c)&&0===A.getPropertyValue(a,"display")&&(i=!0,A.setPropertyValue(a,"display",A.Values.getDisplayType(a)));var j=function(){i&&A.setPropertyValue(a,"display","none")};if(!f){if("height"===c&&"border-box"!==A.getPropertyValue(a,"boxSizing").toString().toLowerCase()){var k=a.offsetHeight-(parseFloat(A.getPropertyValue(a,"borderTopWidth"))||0)-(parseFloat(A.getPropertyValue(a,"borderBottomWidth"))||0)-(parseFloat(A.getPropertyValue(a,"paddingTop"))||0)-(parseFloat(A.getPropertyValue(a,"paddingBottom"))||0);return j(),k}if("width"===c&&"border-box"!==A.getPropertyValue(a,"boxSizing").toString().toLowerCase()){var l=a.offsetWidth-(parseFloat(A.getPropertyValue(a,"borderLeftWidth"))||0)-(parseFloat(A.getPropertyValue(a,"borderRightWidth"))||0)-(parseFloat(A.getPropertyValue(a,"paddingLeft"))||0)-(parseFloat(A.getPropertyValue(a,"paddingRight"))||0);return j(),l}}var m;m=g(a)===d?b.getComputedStyle(a,null):g(a).computedStyle?g(a).computedStyle:g(a).computedStyle=b.getComputedStyle(a,null),"borderColor"===c&&(c="borderTopColor"),e=9===p&&"filter"===c?m.getPropertyValue(c):m[c],""!==e&&null!==e||(e=a.style[c]),j()}if("auto"===e&&/^(top|right|bottom|left)$/i.test(c)){var n=h(a,"position");("fixed"===n||"absolute"===n&&/top|left/i.test(c))&&(e=o(a).position()[c]+"px")}return e}var i;if(A.Hooks.registered[c]){var j=c,k=A.Hooks.getRoot(j);e===d&&(e=A.getPropertyValue(a,A.Names.prefixCheck(k)[0])),A.Normalizations.registered[k]&&(e=A.Normalizations.registered[k]("extract",a,e)),i=A.Hooks.extractValue(j,e)}else if(A.Normalizations.registered[c]){var l,m;l=A.Normalizations.registered[c]("name",a),"transform"!==l&&(m=h(a,A.Names.prefixCheck(l)[0]),A.Values.isCSSNullValue(m)&&A.Hooks.templates[c]&&(m=A.Hooks.templates[c][1])),i=A.Normalizations.registered[c]("extract",a,m)}if(!/^[\d-]/.test(i)){var n=g(a);if(n&&n.isSVG&&A.Names.SVGAttribute(c))if(/^(height|width)$/i.test(c))try{i=a.getBBox()[c]}catch(q){i=0}else i=a.getAttribute(c);else i=h(a,A.Names.prefixCheck(c)[0])}return A.Values.isCSSNullValue(i)&&(i=0),y.debug>=2&&console.log("Get "+c+": "+i),i},setPropertyValue:function(a,c,d,e,f){var h=c;if("scroll"===c)f.container?f.container["scroll"+f.direction]=d:"Left"===f.direction?b.scrollTo(d,f.alternateValue):b.scrollTo(f.alternateValue,d);else if(A.Normalizations.registered[c]&&"transform"===A.Normalizations.registered[c]("name",a))A.Normalizations.registered[c]("inject",a,d),h="transform",d=g(a).transformCache[c];else{if(A.Hooks.registered[c]){var i=c,j=A.Hooks.getRoot(c);e=e||A.getPropertyValue(a,j),d=A.Hooks.injectValue(i,d,e),c=j}if(A.Normalizations.registered[c]&&(d=A.Normalizations.registered[c]("inject",a,d),c=A.Normalizations.registered[c]("name",a)),h=A.Names.prefixCheck(c)[0],p<=8)try{a.style[h]=d}catch(l){y.debug&&console.log("Browser does not support ["+d+"] for ["+h+"]")}else{var k=g(a);k&&k.isSVG&&A.Names.SVGAttribute(c)?a.setAttribute(c,d):a.style[h]=d}y.debug>=2&&console.log("Set "+c+" ("+h+"): "+d)}return[h,d]},flushTransformCache:function(a){var b="",c=g(a);if((p||y.State.isAndroid&&!y.State.isChrome)&&c&&c.isSVG){var d=function(b){return parseFloat(A.getPropertyValue(a,b))},e={translate:[d("translateX"),d("translateY")],skewX:[d("skewX")],skewY:[d("skewY")],scale:1!==d("scale")?[d("scale"),d("scale")]:[d("scaleX"),d("scaleY")],rotate:[d("rotateZ"),0,0]};o.each(g(a).transformCache,function(a){/^translate/i.test(a)?a="translate":/^scale/i.test(a)?a="scale":/^rotate/i.test(a)&&(a="rotate"),e[a]&&(b+=a+"("+e[a].join(" ")+") ",delete e[a])})}else{var f,h;o.each(g(a).transformCache,function(c){if(f=g(a).transformCache[c],"transformPerspective"===c)return h=f,!0;9===p&&"rotateZ"===c&&(c="rotate"),b+=c+f+" "}),h&&(b="perspective"+h+" "+b)}A.setPropertyValue(a,"transform",b)}};A.Hooks.register(),A.Normalizations.register(),y.hook=function(a,b,c){var e;return a=f(a),o.each(a,function(a,f){if(g(f)===d&&y.init(f),c===d)e===d&&(e=A.getPropertyValue(f,b));else{var h=A.setPropertyValue(f,b,c);"transform"===h[0]&&y.CSS.flushTransformCache(f),e=h}}),e};var B=function(){function a(){return k?z.promise||null:p}function e(a,e){function f(f){var k,n;if(i.begin&&0===D)try{i.begin.call(r,r)}catch(V){setTimeout(function(){throw V},1)}if("scroll"===G){var p,q,w,x=/^x$/i.test(i.axis)?"Left":"Top",B=parseFloat(i.offset)||0;i.container?u.isWrapped(i.container)||u.isNode(i.container)?(i.container=i.container[0]||i.container,p=i.container["scroll"+x],w=p+o(a).position()[x.toLowerCase()]+B):i.container=null:(p=y.State.scrollAnchor[y.State["scrollProperty"+x]],q=y.State.scrollAnchor[y.State["scrollProperty"+("Left"===x?"Top":"Left")]],w=o(a).offset()[x.toLowerCase()]+B),j={scroll:{rootPropertyValue:!1,startValue:p,currentValue:p,endValue:w,unitType:"",easing:i.easing,scrollData:{container:i.container,direction:x,alternateValue:q}},element:a},y.debug&&console.log("tweensContainer (scroll): ",j.scroll,a)}else if("reverse"===G){if(!(k=g(a)))return;if(!k.tweensContainer)return void o.dequeue(a,i.queue);"none"===k.opts.display&&(k.opts.display="auto"),"hidden"===k.opts.visibility&&(k.opts.visibility="visible"),k.opts.loop=!1,k.opts.begin=null,k.opts.complete=null,v.easing||delete i.easing,v.duration||delete i.duration,i=o.extend({},k.opts,i),n=o.extend(!0,{},k?k.tweensContainer:null);for(var E in n)if(n.hasOwnProperty(E)&&"element"!==E){var F=n[E].startValue;n[E].startValue=n[E].currentValue=n[E].endValue,n[E].endValue=F,u.isEmptyObject(v)||(n[E].easing=i.easing),y.debug&&console.log("reverse tweensContainer ("+E+"): "+JSON.stringify(n[E]),a)}j=n}else if("start"===G){k=g(a),k&&k.tweensContainer&&k.isAnimating===!0&&(n=k.tweensContainer);var H=function(e,f){var g,l=A.Hooks.getRoot(e),m=!1,p=f[0],q=f[1],r=f[2]
2310;if(!(k&&k.isSVG||"tween"===l||A.Names.prefixCheck(l)[1]!==!1
vendor: 5,506 bytes, line 2310
2310||A.Normalizations.registered[l]!==d))return void(y.debug&&console.log("Skipping ["+l+"] due to a lack of browser support."));(i.display!==d&&null!==i.display&&"none"!==i.display||i.visibility!==d&&"hidden"!==i.visibility)&&/opacity|filter/.test(e)&&!r&&0!==p&&(r=0),i._cacheValues&&n&&n[e]?(r===d&&(r=n[e].endValue+n[e].unitType),m=k.rootPropertyValueCache[l]):A.Hooks.registered[e]?r===d?(m=A.getPropertyValue(a,l),r=A.getPropertyValue(a,e,m)):m=A.Hooks.templates[l][1]:r===d&&(r=A.getPropertyValue(a,e));var s,t,v,w=!1,x=function(a,b){var c,d;return d=(b||"0").toString().toLowerCase().replace(/[%A-z]+$/,function(a){return c=a,""}),c||(c=A.Values.getUnitType(a)),[d,c]};if(r!==p&&u.isString(r)&&u.isString(p)){g="";var z=0,B=0,C=[],D=[],E=0,F=0,G=0;for(r=A.Hooks.fixColors(r),p=A.Hooks.fixColors(p);z<r.length&&B<p.length;){var H=r[z],I=p[B];if(/[\d\.-]/.test(H)&&/[\d\.-]/.test(I)){for(var J=H,K=I,L=".",N=".";++z<r.length;){if((H=r[z])===L)L="..";else if(!/\d/.test(H))break;J+=H}for(;++B<p.length;){if((I=p[B])===N)N="..";else if(!/\d/.test(I))break;K+=I}var O=A.Hooks.getUnit(r,z),P=A.Hooks.getUnit(p,B);if(z+=O.length,B+=P.length,O===P)J===K?g+=J+O:(g+="{"+C.length+(F?"!":"")+"}"+O,C.push(parseFloat(J)),D.push(parseFloat(K)));else{var Q=parseFloat(J),R=parseFloat(K);g+=(E<5?"calc":"")+"("+(Q?"{"+C.length+(F?"!":"")+"}":"0")+O+" + "+(R?"{"+(C.length+(Q?1:0))+(F?"!":"")+"}":"0")+P+")",Q&&(C.push(Q),D.push(0)),R&&(C.push(0),D.push(R))}}else{if(H!==I){E=0;break}g+=H,z++,B++,0===E&&"c"===H||1===E&&"a"===H||2===E&&"l"===H||3===E&&"c"===H||E>=4&&"("===H?E++:(E&&E<5||E>=4&&")"===H&&--E<5)&&(E=0),0===F&&"r"===H||1===F&&"g"===H||2===F&&"b"===H||3===F&&"a"===H||F>=3&&"("===H?(3===F&&"a"===H&&(G=1),F++):G&&","===H?++G>3&&(F=G=0):(G&&F<(G?5:4)||F>=(G?4:3)&&")"===H&&--F<(G?5:4))&&(F=G=0)}}z===r.length&&B===p.length||(y.debug&&console.error('Trying to pattern match mis-matched strings ["'+p+'", "'+r+'"]'),g=d),g&&(C.length?(y.debug&&console.log('Pattern found "'+g+'" -> ',C,D,"["+r+","+p+"]"),r=C,p=D,t=v=""):g=d)}g||(s=x(e,r),r=s[0],v=s[1],s=x(e,p),p=s[0].replace(/^([+-\/*])=/,function(a,b){return w=b,""}),t=s[1],r=parseFloat(r)||0,p=parseFloat(p)||0,"%"===t&&(/^(fontSize|lineHeight)$/.test(e)?(p/=100,t="em"):/^scale/.test(e)?(p/=100,t=""):/(Red|Green|Blue)$/i.test(e)&&(p=p/100*255,t="")));if(/[\/*]/.test(w))t=v;else if(v!==t&&0!==r)if(0===p)t=v;else{h=h||function(){var d={myParent:a.parentNode||c.body,position:A.getPropertyValue(a,"position"),fontSize:A.getPropertyValue(a,"fontSize")},e=d.position===M.lastPosition&&d.myParent===M.lastParent,f=d.fontSize===M.lastFontSize;M.lastParent=d.myParent,M.lastPosition=d.position,M.lastFontSize=d.fontSize;var g={};if(f&&e)g.emToPx=M.lastEmToPx,g.percentToPxWidth=M.lastPercentToPxWidth,g.percentToPxHeight=M.lastPercentToPxHeight;else{var h=k&&k.isSVG?c.createElementNS("http://www.w3.org/2000/svg","rect"):c.createElement("div");y.init(h),d.myParent.appendChild(h),o.each(["overflow","overflowX","overflowY"],function(a,b){y.CSS.setPropertyValue(h,b,"hidden")}),y.CSS.setPropertyValue(h,"position",d.position),y.CSS.setPropertyValue(h,"fontSize",d.fontSize),y.CSS.setPropertyValue(h,"boxSizing","content-box"),o.each(["minWidth","maxWidth","width","minHeight","maxHeight","height"],function(a,b){y.CSS.setPropertyValue(h,b,"100%")}),y.CSS.setPropertyValue(h,"paddingLeft","100em"),g.percentToPxWidth=M.lastPercentToPxWidth=(parseFloat(A.getPropertyValue(h,"width",null,!0))||1)/100,g.percentToPxHeight=M.lastPercentToPxHeight=(parseFloat(A.getPropertyValue(h,"height",null,!0))||1)/100,g.emToPx=M.lastEmToPx=(parseFloat(A.getPropertyValue(h,"paddingLeft"))||1)/100,d.myParent.removeChild(h)}return null===M.remToPx&&(M.remToPx=parseFloat(A.getPropertyValue(c.body,"fontSize"))||16),null===M.vwToPx&&(M.vwToPx=parseFloat(b.innerWidth)/100,M.vhToPx=parseFloat(b.innerHeight)/100),g.remToPx=M.remToPx,g.vwToPx=M.vwToPx,g.vhToPx=M.vhToPx,y.debug>=1&&console.log("Unit ratios: "+JSON.stringify(g),a),g}();var S=/margin|padding|left|right|width|text|word|letter/i.test(e)||/X$/.test(e)||"x"===e?"x":"y";switch(v){case"%":r*="x"===S?h.percentToPxWidth:h.percentToPxHeight;break;case"px":break;default:r*=h[v+"ToPx"]}switch(t){case"%":r*=1/("x"===S?h.percentToPxWidth:h.percentToPxHeight);break;case"px":break;default:r*=1/h[t+"ToPx"]}}switch(w){case"+":p=r+p;break;case"-":p=r-p;break;case"*":p*=r;break;case"/":p=r/p}j[e]={rootPropertyValue:m,startValue:r,currentValue:r,endValue:p,unitType:t,easing:q},g&&(j[e].pattern=g),y.debug&&console.log("tweensContainer ("+e+"): "+JSON.stringify(j[e]),a)};for(var I in s)if(s.hasOwnProperty(I)){var J=A.Names.camelCase(I),K=function(b,c){var d,f,g;return u.isFunction(b)&&(b=b.call(a,e,C)),u.isArray(b)?(d=b[0],!u.isArray(b[1])&&/^[\d-]/.test(b[1])||u.isFunction(b[1])||A.RegEx.isHex.test(b[1])?g=b[1]:u.isString(b[1])&&!A.RegEx.isHex.test(b[1])&&y.Easings[b[1]]||u.isArray(b[1])?(f=c?b[1]:l(b[1],i.duration),g=b[2]):g=b[1]||b[2]):d=b,c||(f=f||i.easing),u.isFunction(d)&&(d=d.call(a,e,C)),u.isFunction(g)&&(g=g.call(a,e,C)),[d||0,f,g]}(s[I]);if(t(A.Lists.colors,J)){var L=K[0],O=K[1],P=K[2];if(A.RegEx.isHex.test(L)){for(var Q=["Red","Green","Blue"],R=A.Values.hexToRgb(L),S=P?A.Values.hexToRgb(P):d,T=0;T<Q.length;T++){var U=[R[T]];O&&U.push(O),S!==d&&U.push(S[T]),H(J+Q[T],U)}continue}}H(J,K)}j.element=a}j.element&&(A.Values.addClass(a,"velocity-animating"),N.push(j),k=g(a),k&&(""===i.queue&&(k.tweensContainer=j,k.opts=i),k.isAnimating=!0),D===C-1?(y.State.calls.push([N,r,i,null,z.resolver,null,0]),
vendor: 7,144 bytes, lines 2310-2313
2310y.State.isTicking===!1&&(y.State.isTicking=!0,m())):D++)}var h,i=o.extend({},y.defaults,v),j={};switch(g(a)===d&&y.init(a),parseFloat(i.delay)&&i.queue!==!1&&o.queue(a,i.queue,function(b){y.velocityQueueEntryFlag=!0;var c=y.State.delayedElements.count++;y.State.delayedElements[c]=a;var d=function(a){return function(){y.State.delayedElements[a]=!1,b()}}(c);g(a).delayBegin=(new Date).getTime(),g(a).delay=parseFloat(i.delay),g(a).delayTimer={setTimeout:setTimeout(b,parseFloat(i.delay)),next:d}}),i.duration.toString().toLowerCase()){case"fast":i.duration=200;break;case"normal":i.duration=w;break;case"slow":i.duration=600;break;default:i.duration=parseFloat(i.duration)||1}if(y.mock!==!1&&(y.mock===!0?i.duration=i.delay=1:(i.duration*=parseFloat(y.mock)||1,i.delay*=parseFloat(y.mock)||1)),i.easing=l(i.easing,i.duration),i.begin&&!u.isFunction(i.begin)&&(i.begin=null),i.progress&&!u.isFunction(i.progress)&&(i.progress=null),i.complete&&!u.isFunction(i.complete)&&(i.complete=null),i.display!==d&&null!==i.display&&(i.display=i.display.toString().toLowerCase(),"auto"===i.display&&(i.display=y.CSS.Values.getDisplayType(a))),i.visibility!==d&&null!==i.visibility&&(i.visibility=i.visibility.toString().toLowerCase()),i.mobileHA=i.mobileHA&&y.State.isMobile&&!y.State.isGingerbread,i.queue===!1)if(i.delay){var k=y.State.delayedElements.count++;y.State.delayedElements[k]=a;var n=function(a){return function(){y.State.delayedElements[a]=!1,f()}}(k);g(a).delayBegin=(new Date).getTime(),g(a).delay=parseFloat(i.delay),g(a).delayTimer={setTimeout:setTimeout(f,parseFloat(i.delay)),next:n}}else f();else o.queue(a,i.queue,function(a,b){if(b===!0)return z.promise&&z.resolver(r),!0;y.velocityQueueEntryFlag=!0,f(a)});""!==i.queue&&"fx"!==i.queue||"inprogress"===o.queue(a)[0]||o.dequeue(a)}var j,k,p,q,r,s,v,x=arguments[0]&&(arguments[0].p||o.isPlainObject(arguments[0].properties)&&!arguments[0].properties.names||u.isString(arguments[0].properties));u.isWrapped(this)?(k=!1,q=0,r=this,p=this):(k=!0,q=1,r=x?arguments[0].elements||arguments[0].e:arguments[0]);var z={promise:null,resolver:null,rejecter:null};if(k&&y.Promise&&(z.promise=new y.Promise(function(a,b){z.resolver=a,z.rejecter=b})),x?(s=arguments[0].properties||arguments[0].p,v=arguments[0].options||arguments[0].o):(s=arguments[q],v=arguments[q+1]),!(r=f(r)))return void(z.promise&&(s&&v&&v.promiseRejectEmpty===!1?z.resolver():z.rejecter()));var C=r.length,D=0;if(!/^(stop|finish|finishAll|pause|resume)$/i.test(s)&&!o.isPlainObject(v)){var E=q+1;v={};for(var F=E;F<arguments.length;F++)u.isArray(arguments[F])||!/^(fast|normal|slow)$/i.test(arguments[F])&&!/^\d/.test(arguments[F])?u.isString(arguments[F])||u.isArray(arguments[F])?v.easing=arguments[F]:u.isFunction(arguments[F])&&(v.complete=arguments[F]):v.duration=arguments[F]}var G;switch(s){case"scroll":G="scroll";break;case"reverse":G="reverse";break;case"pause":var H=(new Date).getTime();return o.each(r,function(a,b){h(b,H)}),o.each(y.State.calls,function(a,b){var c=!1;b&&o.each(b[1],function(a,e){var f=v===d?"":v;return f!==!0&&b[2].queue!==f&&(v!==d||b[2].queue!==!1)||(o.each(r,function(a,d){if(d===e)return b[5]={resume:!1},c=!0,!1}),!c&&void 0)})}),a();case"resume":return o.each(r,function(a,b){i(b,H)}),o.each(y.State.calls,function(a,b){var c=!1;b&&o.each(b[1],function(a,e){var f=v===d?"":v;return f!==!0&&b[2].queue!==f&&(v!==d||b[2].queue!==!1)||(!b[5]||(o.each(r,function(a,d){if(d===e)return b[5].resume=!0,c=!0,!1}),!c&&void 0))})}),a();case"finish":case"finishAll":case"stop":o.each(r,function(a,b){g(b)&&g(b).delayTimer&&(clearTimeout(g(b).delayTimer.setTimeout),g(b).delayTimer.next&&g(b).delayTimer.next(),delete g(b).delayTimer),"finishAll"!==s||v!==!0&&!u.isString(v)||(o.each(o.queue(b,u.isString(v)?v:""),function(a,b){u.isFunction(b)&&b()}),o.queue(b,u.isString(v)?v:"",[]))});var I=[];return o.each(y.State.calls,function(a,b){b&&o.each(b[1],function(c,e){var f=v===d?"":v;if(f!==!0&&b[2].queue!==f&&(v!==d||b[2].queue!==!1))return!0;o.each(r,function(c,d){if(d===e)if((v===!0||u.isString(v))&&(o.each(o.queue(d,u.isString(v)?v:""),function(a,b){u.isFunction(b)&&b(null,!0)}),o.queue(d,u.isString(v)?v:"",[])),"stop"===s){var h=g(d);h&&h.tweensContainer&&f!==!1&&o.each(h.tweensContainer,function(a,b){b.endValue=b.currentValue}),I.push(a)}else"finish"!==s&&"finishAll"!==s||(b[2].duration=1)})})}),"stop"===s&&(o.each(I,function(a,b){n(b,!0)}),z.promise&&z.resolver(r)),a();default:if(!o.isPlainObject(s)||u.isEmptyObject(s)){if(u.isString(s)&&y.Redirects[s]){j=o.extend({},v);var J=j.duration,K=j.delay||0;return j.backwards===!0&&(r=o.extend(!0,[],r).reverse()),o.each(r,function(a,b){parseFloat(j.stagger)?j.delay=K+parseFloat(j.stagger)*a:u.isFunction(j.stagger)&&(j.delay=K+j.stagger.call(b,a,C)),j.drag&&(j.duration=parseFloat(J)||(/^(callout|transition)/.test(s)?1e3:w),j.duration=Math.max(j.duration*(j.backwards?1-a/C:(a+1)/C),.75*j.duration,200)),y.Redirects[s].call(b,b,j||{},a,C,r,z.promise?z:d)}),a()}var L="Velocity: First argument ("+s+") was not a property map, a known action, or a registered redirect. Aborting.";return z.promise?z.rejecter(new Error(L)):b.console&&console.log(L),a()}G="start"}var M={lastParent:null,lastPosition:null,lastFontSize:null,lastPercentToPxWidth:null,lastPercentToPxHeight:null,lastEmToPx:null,remToPx:null,vwToPx:null,vhToPx:null},N=[];o.each(r,function(a,b){u.isNode(b)&&e(b,a)}),j=o.extend({},y.defaults,v),j.loop=parseInt(j.loop,10);var O=2*j.loop-1;if(j.loop)for(var P=0;P<O;P++){var Q={delay:j.delay,progress:j.progress};P===O-1&&(Q.display=j.display,Q.visibility=j.visibility,Q.complete=j.complete),B(r,"reverse",Q)}return a()};y=o.extend(B,y),y.animate=B;var C=b.requestAnimationFrame||q;if(!y.State.isMobile&&c.hidden!==d){var D=function(){c.hidden?(C=function(a){return setTimeout(function(){a(!0)},16)},m()):C=b.requestAnimationFrame||q};D(),c.addEventListener("visibilitychange",D)}return a.Velocity=y,a!==b&&(a.fn.velocity=B,a.fn.velocity.defaults=y.defaults),o.each(["Down","Up"],function(a,b){y.Redirects["slide"+b]=function(a,c,e,f,g,h){var i=o.extend({},c),j=i.begin,k=i.complete,l={},m={height:"",marginTop:"",marginBottom:"",paddingTop:"",paddingBottom:""};i.display===d&&(i.display="Down"===b?"inline"===y.CSS.Values.getDisplayType(a)?"inline-block":"block":"none"),i.begin=function(){0===e&&j&&j.call(g,g);for(var c in m)if(m.hasOwnProperty(c)){l[c]=a.style[c];var d=A.getPropertyValue(a,c);m[c]="Down"===b?[d,0]:[0,d]}l.overflow=a.style.overflow,a.style.overflow="hidden"},i.complete=function(){for(var b in l)l.hasOwnProperty(b)&&(a.style[b]=l[b]);e===f-1&&(k&&k.call(g,g),h&&h.resolver(g))},y(a,m,i)}}),o.each(["In","Out"],function(a,b){y.Redirects["fade"+b]=function(a,c,e,f,g,h){var i=o.extend({},c),j=i.complete,k={opacity:"In"===b?1:0};0!==e&&(i.begin=null),i.complete=e!==f-1?null:function(){j&&j.call(g,g),h&&h.resolver(g)},i.display===d&&(i.display="In"===b?"auto":"none"),y(this,k,i)}}),y}(window.jQuery||window.Zepto||window,window,window?window.document:undefined)});
2311/* End */
2312;
2313; /* Start:"a:4:{s:4:"full";s:77:"/bitrix/templates/aspro_max/vendor/js/velocity/velocity.ui.js?171646553713257";s:6:"source";
vendor: 13,499 bytes, lines 2313-2318
2313s:61:"/bitrix/templates/aspro_max/vendor/js/velocity/velocity.ui.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
2314/* VelocityJS.org UI Pack (5.0.4). (C) 2014 Julian Shapiro. MIT @license: en.wikipedia.org/wiki/MIT_License. Portions copyright Daniel Eden, Christian Pucci. */
2315!function(t){"function"==typeof require&&"object"==typeof exports?module.exports=t():"function"==typeof define&&define.amd?define(["velocity"],t):t()}(function(){return function(t,a,e,r){function n(t,a){var e=[];return t&&a?($.each([t,a],function(t,a){var r=[];$.each(a,function(t,a){for(;a.toString().length<5;)a="0"+a;r.push(a)}),e.push(r.join(""))}),parseFloat(e[0])>parseFloat(e[1])):!1}if(!t.Velocity||!t.Velocity.Utilities)return void(a.console&&console.log("Velocity UI Pack: Velocity must be loaded first. Aborting."));var i=t.Velocity,$=i.Utilities,s=i.version,o={major:1,minor:1,patch:0};if(n(o,s)){var l="Velocity UI Pack: You need to update Velocity (jquery.velocity.js) to a newer version. Visit http://github.com/julianshapiro/velocity.";throw alert(l),new Error(l)}i.RegisterEffect=i.RegisterUI=function(t,a){function e(t,a,e,r){var n=0,s;$.each(t.nodeType?[t]:t,function(t,a){r&&(e+=t*r),s=a.parentNode,$.each(["height","paddingTop","paddingBottom","marginTop","marginBottom"],function(t,e){n+=parseFloat(i.CSS.getPropertyValue(a,e))})}),i.animate(s,{height:("In"===a?"+":"-")+"="+n},{queue:!1,easing:"ease-in-out",duration:e*("In"===a?.6:1)})}return i.Redirects[t]=function(n,s,o,l,c,u){function f(){s.display!==r&&"none"!==s.display||!/Out$/.test(t)||$.each(c.nodeType?[c]:c,function(t,a){i.CSS.setPropertyValue(a,"display","none")}),s.complete&&s.complete.call(c,c),u&&u.resolver(c||n)}var p=o===l-1;a.defaultDuration="function"==typeof a.defaultDuration?a.defaultDuration.call(c,c):parseFloat(a.defaultDuration);for(var d=0;d<a.calls.length;d++){var g=a.calls[d],y=g[0],m=s.duration||a.defaultDuration||1e3,X=g[1],Y=g[2]||{},O={};if(O.duration=m*(X||1),O.queue=s.queue||"",O.easing=Y.easing||"ease",O.delay=parseFloat(Y.delay)||0,O._cacheValues=Y._cacheValues||!0,0===d){if(O.delay+=parseFloat(s.delay)||0,0===o&&(O.begin=function(){s.begin&&s.begin.call(c,c);var a=t.match(/(In|Out)$/);a&&"In"===a[0]&&y.opacity!==r&&$.each(c.nodeType?[c]:c,function(t,a){i.CSS.setPropertyValue(a,"opacity",0)}),s.animateParentHeight&&a&&e(c,a[0],m+O.delay,s.stagger)}),null!==s.display)if(s.display!==r&&"none"!==s.display)O.display=s.display;else if(/In$/.test(t)){var v=i.CSS.Values.getDisplayType(n);O.display="inline"===v?"inline-block":v}s.visibility&&"hidden"!==s.visibility&&(O.visibility=s.visibility)}d===a.calls.length-1&&(O.complete=function(){if(a.reset){for(var t in a.reset){var e=a.reset[t];i.CSS.Hooks.registered[t]!==r||"string"!=typeof e&&"number"!=typeof e||(a.reset[t]=[a.reset[t],a.reset[t]])}var s={duration:0,queue:!1};p&&(s.complete=f),i.animate(n,a.reset,s)}else p&&f()},"hidden"===s.visibility&&(O.visibility=s.visibility)),i.animate(n,y,O)}},i},i.RegisterEffect.packagedEffects={"callout.bounce":{defaultDuration:550,calls:[[{translateY:-30},.25],[{translateY:0},.125],[{translateY:-15},.125],[{translateY:0},.25]]},"callout.shake":{defaultDuration:800,calls:[[{translateX:-11},.125],[{translateX:11},.125],[{translateX:-11},.125],[{translateX:11},.125],[{translateX:-11},.125],[{translateX:11},.125],[{translateX:-11},.125],[{translateX:0},.125]]},"callout.flash":{defaultDuration:1100,calls:[[{opacity:[0,"easeInOutQuad",1]},.25],[{opacity:[1,"easeInOutQuad"]},.25],[{opacity:[0,"easeInOutQuad"]},.25],[{opacity:[1,"easeInOutQuad"]},.25]]},"callout.pulse":{defaultDuration:825,calls:[[{scaleX:1.1,scaleY:1.1},.5,{easing:"easeInExpo"}],[{scaleX:1,scaleY:1},.5]]},"callout.swing":{defaultDuration:950,calls:[[{rotateZ:15},.2],[{rotateZ:-10},.2],[{rotateZ:5},.2],[{rotateZ:-5},.2],[{rotateZ:0},.2]]},"callout.tada":{defaultDuration:1e3,calls:[[{scaleX:.9,scaleY:.9,rotateZ:-3},.1],[{scaleX:1.1,scaleY:1.1,rotateZ:3},.1],[{scaleX:1.1,scaleY:1.1,rotateZ:-3},.1],["reverse",.125],["reverse",.125],["reverse",.125],["reverse",.125],["reverse",.125],[{scaleX:1,scaleY:1,rotateZ:0},.2]]},"transition.fadeIn":{defaultDuration:500,calls:[[{opacity:[1,0]}]]},"transition.fadeOut":{defaultDuration:500,calls:[[{opacity:[0,1]}]]},"transition.flipXIn":{defaultDuration:700,calls:[[{opacity:[1,0],transformPerspective:[800,800],rotateY:[0,-55]}]],reset:{transformPerspective:0}},"transition.flipXOut":{defaultDuration:700,calls:[[{opacity:[0,1],transformPerspective:[800,800],rotateY:55}]],reset:{transformPerspective:0,rotateY:0}},"transition.flipYIn":{defaultDuration:800,calls:[[{opacity:[1,0],transformPerspective:[800,800],rotateX:[0,-45]}]],reset:{transformPerspective:0}},"transition.flipYOut":{defaultDuration:800,calls:[[{opacity:[0,1],transformPerspective:[800,800],rotateX:25}]],reset:{transformPerspective:0,rotateX:0}},"transition.flipBounceXIn":{defaultDuration:900,calls:[[{opacity:[.725,0],transformPerspective:[400,400],rotateY:[-10,90]},.5],[{opacity:.8,rotateY:10},.25],[{opacity:1,rotateY:0},.25]],reset:{transformPerspective:0}},"transition.flipBounceXOut":{defaultDuration:800,calls:[[{opacity:[.9,1],transformPerspective:[400,400],rotateY:-10},.5],[{opacity:0,rotateY:90},.5]],reset:{transformPerspective:0,rotateY:0}},"transition.flipBounceYIn":{defaultDuration:850,calls:[[{opacity:[.725,0],transformPerspective:[400,400],rotateX:[-10,90]},.5],[{opacity:.8,rotateX:10},.25],[{opacity:1,rotateX:0},.25]],reset:{transformPerspective:0}},"transition.flipBounceYOut":{defaultDuration:800,calls:[[{opacity:[.9,1],transformPerspective:[400,400],rotateX:-15},.5],[{opacity:0,rotateX:90},.5]],reset:{transformPerspective:0,rotateX:0}},"transition.swoopIn":{defaultDuration:850,calls:[[{opacity:[1,0],transformOriginX:["100%","50%"],transformOriginY:["100%","100%"],scaleX:[1,0],scaleY:[1,0],translateX:[0,-700],translateZ:0}]],reset:{transformOriginX:"50%",transformOriginY:"50%"}},"transition.swoopOut":{defaultDuration:850,calls:[[{opacity:[0,1],transformOriginX:["50%","100%"],transformOriginY:["100%","100%"],scaleX:0,scaleY:0,translateX:-700,translateZ:0}]],reset:{transformOriginX:"50%",transformOriginY:"50%",scaleX:1,scaleY:1,translateX:0}},"transition.whirlIn":{defaultDuration:850,calls:[[{opacity:[1,0],transformOriginX:["50%","50%"],transformOriginY:["50%","50%"],scaleX:[1,0],scaleY:[1,0],rotateY:[0,160]},1,{easing:"easeInOutSine"}]]},"transition.whirlOut":{defaultDuration:750,calls:[[{opacity:[0,"easeInOutQuint",1],transformOriginX:["50%","50%"],transformOriginY:["50%","50%"],scaleX:0,scaleY:0,rotateY:160},1,{easing:"swing"}]],reset:{scaleX:1,scaleY:1,rotateY:0}},"transition.shrinkIn":{defaultDuration:750,calls:[[{opacity:[1,0],transformOriginX:["50%","50%"],transformOriginY:["50%","50%"],scaleX:[1,1.5],scaleY:[1,1.5],translateZ:0}]]},"transition.shrinkOut":{defaultDuration:600,calls:[[{opacity:[0,1],transformOriginX:["50%","50%"],transformOriginY:["50%","50%"],scaleX:1.3,scaleY:1.3,translateZ:0}]],reset:{scaleX:1,scaleY:1}},"transition.expandIn":{defaultDuration:700,calls:[[{opacity:[1,0],transformOriginX:["50%","50%"],transformOriginY:["50%","50%"],scaleX:[1,.625],scaleY:[1,.625],translateZ:0}]]},"transition.expandOut":{defaultDuration:700,calls:[[{opacity:[0,1],transformOriginX:["50%","50%"],transformOriginY:["50%","50%"],scaleX:.5,scaleY:.5,translateZ:0}]],reset:{scaleX:1,scaleY:1}},"transition.bounceIn":{defaultDuration:800,calls:[[{opacity:[1,0],scaleX:[1.05,.3],scaleY:[1.05,.3]},.4],[{scaleX:.9,scaleY:.9,translateZ:0},.2],[{scaleX:1,scaleY:1},.5]]},"transition.bounceOut":{defaultDuration:800,calls:[[{scaleX:.95,scaleY:.95},.35],[{scaleX:1.1,scaleY:1.1,translateZ:0},.35],[{opacity:[0,1],scaleX:.3,scaleY:.3},.3]],reset:{scaleX:1,scaleY:1}},"transition.bounceUpIn":{defaultDuration:800,calls:[[{opacity:[1,0],translateY:[-30,1e3]},.6,{easing:"easeOutCirc"}],[{translateY:10},.2],[{translateY:0},.2]]},"transition.bounceUpOut":{defaultDuration:1e3,calls:[[{translateY:20},.2],[{opacity:[0,"easeInCirc",1],translateY:-1e3},.8]],reset:{translateY:0}},"transition.bounceDownIn":{defaultDuration:800,calls:[[{opacity:[1,0],translateY:[30,-1e3]},.6,{easing:"easeOutCirc"}],[{translateY:-10},.2],[{translateY:0},.2]]},"transition.bounceDownOut":{defaultDuration:1e3,calls:[[{translateY:-20},.2],[{opacity:[0,"easeInCirc",1],translateY:1e3},.8]],reset:{translateY:0}},"transition.bounceLeftIn":{defaultDuration:750,calls:[[{opacity:[1,0],translateX:[30,-1250]},.6,{easing:"easeOutCirc"}],[{translateX:-10},.2],[{translateX:0},.2]]},"transition.bounceLeftOut":{defaultDuration:750,calls:[[{translateX:30},.2],[{opacity:[0,"easeInCirc",1],translateX:-1250},.8]],reset:{translateX:0}},"transition.bounceRightIn":{defaultDuration:750,calls:[[{opacity:[1,0],translateX:[-30,1250]},.6,{easing:"easeOutCirc"}],[{translateX:10},.2],[{translateX:0},.2]]},"transition.bounceRightOut":{defaultDuration:750,calls:[[{translateX:-30},.2],[{opacity:[0,"easeInCirc",1],translateX:1250},.8]],reset:{translateX:0}},"transition.slideUpIn":{defaultDuration:900,calls:[[{opacity:[1,0],translateY:[0,20],translateZ:0}]]},"transition.slideUpOut":{defaultDuration:900,calls:[[{opacity:[0,1],translateY:-20,translateZ:0}]],reset:{translateY:0}},"transition.slideDownIn":{defaultDuration:900,calls:[[{opacity:[1,0],translateY:[0,-20],translateZ:0}]]},"transition.slideDownOut":{defaultDuration:900,calls:[[{opacity:[0,1],translateY:20,translateZ:0}]],reset:{translateY:0}},"transition.slideLeftIn":{defaultDuration:1e3,calls:[[{opacity:[1,0],translateX:[0,-20],translateZ:0}]]},"transition.slideLeftOut":{defaultDuration:1050,calls:[[{opacity:[0,1],translateX:-20,translateZ:0}]],reset:{translateX:0}},"transition.slideRightIn":{defaultDuration:1e3,calls:[[{opacity:[1,0],translateX:[0,20],translateZ:0}]]},"transition.slideRightOut":{defaultDuration:1050,calls:[[{opacity:[0,1],translateX:20,translateZ:0}]],reset:{translateX:0}},"transition.slideUpBigIn":{defaultDuration:850,calls:[[{opacity:[1,0],translateY:[0,75],translateZ:0}]]},"transition.slideUpBigOut":{defaultDuration:800,calls:[[{opacity:[0,1],translateY:-75,translateZ:0}]],reset:{translateY:0}},"transition.slideDownBigIn":{defaultDuration:850,calls:[[{opacity:[1,0],translateY:[0,-75],translateZ:0}]]},"transition.slideDownBigOut":{defaultDuration:800,calls:[[{opacity:[0,1],translateY:75,translateZ:0}]],reset:{translateY:0}},"transition.slideLeftBigIn":{defaultDuration:800,calls:[[{opacity:[1,0],translateX:[0,-75],translateZ:0}]]},"transition.slideLeftBigOut":{defaultDuration:750,calls:[[{opacity:[0,1],translateX:-75,translateZ:0}]],reset:{translateX:0}},"transition.slideRightBigIn":{defaultDuration:800,calls:[[{opacity:[1,0],translateX:[0,75],translateZ:0}]]},"transition.slideRightBigOut":{defaultDuration:750,calls:[[{opacity:[0,1],translateX:75,translateZ:0}]],reset:{translateX:0}},"transition.perspectiveUpIn":{defaultDuration:800,calls:[[{opacity:[1,0],transformPerspective:[800,800],transformOriginX:[0,0],transformOriginY:["100%","100%"],rotateX:[0,-180]}]],reset:{transformPerspective:0,transformOriginX:"50%",transformOriginY:"50%"}},"transition.perspectiveUpOut":{defaultDuration:850,calls:[[{opacity:[0,1],transformPerspective:[800,800],transformOriginX:[0,0],transformOriginY:["100%","100%"],rotateX:-180}]],reset:{transformPerspective:0,transformOriginX:"50%",transformOriginY:"50%",rotateX:0}},"transition.perspectiveDownIn":{defaultDuration:800,calls:[[{opacity:[1,0],transformPerspective:[800,800],transformOriginX:[0,0],transformOriginY:[0,0],rotateX:[0,180]}]],reset:{transformPerspective:0,transformOriginX:"50%",transformOriginY:"50%"}},"transition.perspectiveDownOut":{defaultDuration:850,calls:[[{opacity:[0,1],transformPerspective:[800,800],transformOriginX:[0,0],transformOriginY:[0,0],rotateX:180}]],reset:{transformPerspective:0,transformOriginX:"50%",transformOriginY:"50%",rotateX:0}},"transition.perspectiveLeftIn":{defaultDuration:950,calls:[[{opacity:[1,0],transformPerspective:[2e3,2e3],transformOriginX:[0,0],transformOriginY:[0,0],rotateY:[0,-180]}]],reset:{transformPerspective:0,transformOriginX:"50%",transformOriginY:"50%"}},"transition.perspectiveLeftOut":{defaultDuration:950,calls:[[{opacity:[0,1],transformPerspective:[2e3,2e3],transformOriginX:[0,0],transformOriginY:[0,0],rotateY:-180}]],reset:{transformPerspective:0,transformOriginX:"50%",transformOriginY:"50%",rotateY:0}},"transition.perspectiveRightIn":{defaultDuration:950,calls:[[{opacity:[1,0],transformPerspective:[2e3,2e3],transformOriginX:["100%","100%"],transformOriginY:[0,0],rotateY:[0,180]}]],reset:{transformPerspective:0,transformOriginX:"50%",transformOriginY:"50%"}},"transition.perspectiveRightOut":{defaultDuration:950,calls:[[{opacity:[0,1],transformPerspective:[2e3,2e3],transformOriginX:["100%","100%"],transformOriginY:[0,0],rotateY:180}]],reset:{transformPerspective:0,transformOriginX:"50%",transformOriginY:"50%",rotateY:0}}};for(var c in i.RegisterEffect.packagedEffects)i.RegisterEffect(c,i.RegisterEffect.packagedEffects[c]);i.RunSequence=function(t){var a=$.extend(!0,[],t);a.length>1&&($.each(a.reverse(),function(t,e){var r=a[t+1];if(r){var n=e.o||e.options,s=r.o||r.options,o=n&&n.sequenceQueue===!1?"begin":"complete",l=s&&s[o],c={};c[o]=function(){var t=r.e||r.elements,a=t.nodeType?[t]:t;l&&l.call(a,a),i(e)},r.o?r.o=$.extend({},s,c):r.options=$.extend({},s,c)}}),a.reverse()),i(a[0])}}(window.jQuery||window.Zepto||window,window,document)});
2316/* End */
2317;
2318; /* Start:"a:4:{s:4:"full";s:72:"/bitrix/templates/aspro_max/vendor/js/jquery.menu-aim.js?171646553712787";s:6:"source";
vendor: 12,931 bytes, lines 2318-2655
2318s:56:"/bitrix/templates/aspro_max/vendor/js/jquery.menu-aim.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
2319/**
2320 * menu-aim is a jQuery plugin for dropdown menus that can differentiate
2321 * between a user trying hover over a dropdown item vs trying to navigate into
2322 * a submenu's contents.
2323 *
2324 * menu-aim assumes that you have are using a menu with submenus that expand
2325 * to the menu's right. It will fire events when the user's mouse enters a new
2326 * dropdown item *and* when that item is being intentionally hovered over.
2327 *
2328 * __________________________
2329 * | Monkeys  >|   Gorilla  |
2330 * | Gorillas >|   Content  |
2331 * | Chimps   >|   Here     |
2332 * |___________|____________|
2333 *
2334 * In the above example, "Gorillas" is selected and its submenu content is
2335 * being shown on the right. Imagine that the user's cursor is hovering over
2336 * "Gorillas." When they move their mouse into the "Gorilla Content" area, they
2337 * may briefly hover over "Chimps." This shouldn't close the "Gorilla Content"
2338 * area.
2339 *
2340 * This problem is normally solved using timeouts and delays. menu-aim tries to
2341 * solve this by detecting the direction of the user's mouse movement. This can
2342 * make for quicker transitions when navigating up and down the menu. The
2343 * experience is hopefully similar to amazon.com/'s "Shop by Department"
2344 * dropdown.
2345 *
2346 * Use like so:
2347 *
2348 *      $("#menu").menuAim({
2349 *          activate: $.noop,  // fired on row activation
2350 *          deactivate: $.noop  // fired on row deactivation
2351 *      });
2352 *
2353 *  ...to receive events when a menu's row has been purposefully (de)activated.
2354 *
2355 * The following options can be passed to menuAim. All functions execute with
2356 * the relevant row's HTML element as the execution context ('this'):
2357 *
2358 *      .menuAim({
2359 *          // Function to call when a row is purposefully activated. Use this
2360 *          // to show a submenu's content for the activated row.
2361 *          activate: function() {},
2362 *
2363 *          // Function to call when a row is deactivated.
2364 *          deactivate: function() {},
2365 *
2366 *          // Function to call when mouse enters a menu row. Entering a row
2367 *          // does not mean the row has been activated, as the user may be
2368 *          // mousing over to a submenu.
2369 *          enter: function() {},
2370 *
2371 *          // Function to call when mouse exits a menu row.
2372 *          exit: function() {},
2373 *
2374 *          // Selector for identifying which elements in the menu are rows
2375 *          // that can trigger the above events. Defaults to "> li".
2376 *          rowSelector: "> li",
2377 *
2378 *          // You may have some menu rows that aren't submenus and therefore
2379 *          // shouldn't ever need to "activate." If so, filter submenu rows w/
2380 *          // this selector. Defaults to "*" (all elements).
2381 *          submenuSelector: "*",
2382 *
2383 *          // Direction the submenu opens relative to the main menu. Can be
2384 *          // left, right, above, or below. Defaults to "right".
2385 *          submenuDirection: "right"
2386 *      });
2387 *
2388 * https://github.com/kamens/jQuery-menu-aim
2389*/
2390(function($) {
2391
2392    $.fn.menuAim = function(opts) {
2393        // Initialize menu-aim for all elements in jQuery collection
2394        this.each(function() {
2395            init.call(this, opts);
2396        });
2397
2398        return this;
2399    };
2400
2401    function init(opts) {
2402        var $menu = $(this),
2403            activeRow = null,
2404            mouseLocs = [],
2405            lastDelayLoc = null,
2406            timeoutId = null,
2407            options = $.extend({
2408                firstActiveRow: false,
2409                rowSelector: "> li",
2410                submenuSelector: "*",
2411                submenuDirection: "right",
2412                tolerance: 5,  // bigger = more forgivey when entering submenu
2413                enter: $.noop,
2414                exit: $.noop,
2415                activate: $.noop,
2416                deactivate: $.noop,
2417                exitMenu: $.noop
2418            }, opts);
2419
2420        var MOUSE_LOCS_TRACKED = 3,  // number of past mouse locations to track
2421            DELAY = 3000;  // ms delay when user appears to be entering submenu
2422
2423        /**
2424         * Keep track of the last few locations of the mouse.
2425         */
2426        var mousemoveDocument = function(e) {
2427                mouseLocs.push({x: e.pageX, y: e.pageY});
2428
2429                if (mouseLocs.length > MOUSE_LOCS_TRACKED) {
2430                    mouseLocs.shift();
2431                }
2432            };
2433
2434        /**
2435         * Cancel possible row activations when leaving the menu entirely
2436         */
2437        var mouseleaveMenu = function() {
2438                if (timeoutId) {
2439                    clearTimeout(timeoutId);
2440                }
2441
2442                // If exitMenu is supplied and returns true, deactivate the
2443                // currently active row on menu exit.
2444                if (options.exitMenu(this)) {
2445                    if (activeRow) {
2446                        options.deactivate(activeRow);
2447                    }
2448
2449                    activeRow = null;
2450                }
2451            };
2452
2453        /**
2454         * Trigger a possible row activation whenever entering a new row.
2455         */
2456        var mouseenterRow = function() {
2457                if (timeoutId) {
2458                    // Cancel any previous activation delays
2459                    clearTimeout(timeoutId);
2460                }
2461
2462                options.enter(this);
2463                possiblyActivate(this);
2464            },
2465            mouseleaveRow = function() {
2466                options.exit(this);
2467            };
2468
2469        /*
2470         * Immediately activate a row if the user clicks on it.
2471         */
2472        var clickRow = function() {
2473                activate(this);
2474            };
2475
2476        /**
2477         * Activate a menu row.
2478         */
2479        var activate = function(row) {
2480                if (row == activeRow) {
2481                    return;
2482                }
2483
2484                if (activeRow) {
2485                    options.deactivate(activeRow);
2486                }
2487
2488                options.activate(row);
2489                activeRow = row;
2490            };
2491
2492        /**
2493         * Possibly activate a menu row. If mouse movement indicates that we
2494         * shouldn't activate yet because user may be trying to enter
2495         * a submenu's content, then delay and check again later.
2496         */
2497        var possiblyActivate = function(row) {
2498                var delay = activationDelay();
2499
2500                if (delay) {
2501                    timeoutId = setTimeout(function() {
2502                        possiblyActivate(row);
2503                    }, delay);
2504                } else {
2505                    activate(row);
2506                }
2507            };
2508
2509        /**
2510         * Return the amount of time that should be used as a delay before the
2511         * currently hovered row is activated.
2512         *
2513         * Returns 0 if the activation should happen immediately. Otherwise,
2514         * returns the number of milliseconds that should be delayed before
2515         * checking again to see if the row should be activated.
2516         */
2517        var activationDelay = function() {
2518                if (!activeRow || !$(activeRow).is(options.submenuSelector)) {
2519                    // If there is no other submenu row already active, then
2520                    // go ahead and activate immediately.
2521                    return 0;
2522                }
2523
2524                var offset = $menu.offset(),
2525                    upperLeft = {
2526                        x: offset.left,
2527                        y: offset.top - options.tolerance
2528                    },
2529                    upperRight = {
2530                        x: offset.left + $menu.outerWidth(),
2531                        y: upperLeft.y
2532                    },
2533                    lowerLeft = {
2534                        x: offset.left,
2535                        y: offset.top + $menu.outerHeight() + options.tolerance
2536                    },
2537                    lowerRight = {
2538                        x: offset.left + $menu.outerWidth(),
2539                        y: lowerLeft.y
2540                    },
2541                    loc = mouseLocs[mouseLocs.length - 1],
2542                    prevLoc = mouseLocs[0];
2543
2544                if (!loc) {
2545                    return 0;
2546                }
2547
2548                if (!prevLoc) {
2549                    prevLoc = loc;
2550                }
2551
2552                if (prevLoc.x < offset.left || prevLoc.x > lowerRight.x ||
2553                    prevLoc.y < offset.top || prevLoc.y > lowerRight.y) {
2554                    // If the previous mouse location was outside of the entire
2555                    // menu's bounds, immediately activate.
2556                    return 0;
2557                }
2558
2559                if (lastDelayLoc &&
2560                        loc.x == lastDelayLoc.x && loc.y == lastDelayLoc.y) {
2561                    // If the mouse hasn't moved since the last time we checked
2562                    // for activation status, immediately activate.
2563                    return 0;
2564                }
2565
2566                // Detect if the user is moving towards the currently activated
2567                // submenu.
2568                //
2569                // If the mouse is heading relatively clearly towards
2570                // the submenu's content, we should wait and give the user more
2571                // time before activating a new row. If the mouse is heading
2572                // elsewhere, we can immediately activate a new row.
2573                //
2574                // We detect this by calculating the slope formed between the
2575                // current mouse location and the upper/lower right points of
2576                // the menu. We do the same for the previous mouse location.
2577                // If the current mouse location's slopes are
2578                // increasing/decreasing appropriately compared to the
2579                // previous's, we know the user is moving toward the submenu.
2580                //
2581                // Note that since the y-axis increases as the cursor moves
2582                // down the screen, we are looking for the slope between the
2583                // cursor and the upper right corner to decrease over time, not
2584                // increase (somewhat counterintuitively).
2585                function slope(a, b) {
2586                    return (b.y - a.y) / (b.x - a.x);
2587                };
2588
2589                var decreasingCorner = upperRight,
2590                    increasingCorner = lowerRight;
2591
2592                // Our expectations for decreasing or increasing slope values
2593                // depends on which direction the submenu opens relative to the
2594                // main menu. By default, if the menu opens on the right, we
2595                // expect the slope between the cursor and the upper right
2596                // corner to decrease over time, as explained above. If the
2597                // submenu opens in a different direction, we change our slope
2598                // expectations.
2599                if (options.submenuDirection == "left") {
2600                    decreasingCorner = lowerLeft;
2601                    increasingCorner = upperLeft;
2602                } else if (options.submenuDirection == "below") {
2603                    decreasingCorner = lowerRight;
2604                    increasingCorner = lowerLeft;
2605                } else if (options.submenuDirection == "above") {
2606                    decreasingCorner = upperLeft;
2607                    increasingCorner = upperRight;
2608                }
2609
2610                var decreasingSlope = slope(loc, decreasingCorner),
2611                    increasingSlope = slope(loc, increasingCorner),
2612                    prevDecreasingSlope = slope(prevLoc, decreasingCorner),
2613                    prevIncreasingSlope = slope(prevLoc, increasingCorner);
2614
2615                if (decreasingSlope < prevDecreasingSlope &&
2616                        increasingSlope > prevIncreasingSlope) {
2617                    // Mouse is moving from previous location towards the
2618                    // currently activated submenu. Delay before activating a
2619                    // new menu row, because user may be moving into submenu.
2620                    lastDelayLoc = loc;
2621                    return DELAY;
2622                }
2623
2624                lastDelayLoc = null;
2625                return 0;
2626            };
2627
2628        /**
2629         * Hook up initial menu events
2630         */
2631        $menu
2632            .mouseleave(mouseleaveMenu)
2633            .find(options.rowSelector)
2634                .mouseenter(mouseenterRow)
2635                .mouseleave(mouseleaveRow)
2636                .click(clickRow);
2637
2638        // sets the first active row
2639        if ('firstActiveRow' in options) {
2640            if(!$menu.find(options.rowSelector).hasClass('active')) {
2641                if (options.firstActiveRow === true) {
2642                    activate($menu.find(options.rowSelector).eq(0));
2643                } else {
2644                    activate(options.firstActiveRow);
2645                }
2646            }
2647        }
2648        $(document).mousemove(mousemoveDocument);
2649    };
2650})(jQuery);
2651
2652
2653/* End */
2654;
2655; /* Start:"a:4:{s:4:"full";
2655s:56:"/bitrix/templates/aspro_max/js/browser.js?17164655371032";s:6:"source";s:41:"/bitrix/templates/aspro_max/js/browser.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
2656var matched, browser;
2657
2658jQuery.uaMatch = function( ua ) {
2659    ua = ua.toLowerCase();
2660
2661    var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
2662        /(webkit)[ \/]([\w.]+)/.exec( ua ) ||
2663        /(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
2664        /(msie)[\s?]([\w.]+)/.exec( ua ) ||       
2665        /(trident)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
2666        ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
2667        [];
2668
2669    return {
2670        browser: match[ 1 ] || "",
2671        version: match[ 2 ] || "0"
2672    };
2673};
2674
2675matched = jQuery.uaMatch( navigator.userAgent );
2676//IE 11+ fix (Trident) 
2677matched.browser = matched.browser == 'trident' ? 'msie' : matched.browser;
2678browser = {};
2679
2680if ( matched.browser ) {
2681    browser[ matched.browser ] = true;
2682    browser.version = matched.version;
2683}
2684
2685// Chrome is Webkit, but Webkit is also Safari.
2686if ( browser.chrome ) {
2687    browser.webkit = true;
2688} else if ( browser.webkit ) {
2689    browser.safari = true;
2690}
2691
2692jQuery.browser = browser;
2693/* End */
2694;
2695; /* Start:"a:4:{s:4:"full";s:66:"/bitrix/templates/aspro_max/js/jquery.fancybox.js?1716465537160667";s:6:"source";s:49:"/bitrix/templates/aspro_max/js/jquery.fancybox.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
2696// ==================================================
2697// fancyBox v3.5.7
2698//
2699// Licensed GPLv3 for open source use
2700// or fancyBox Commercial License for commercial use
2701//
2702// http://fancyapps.com/fancybox/
2703// Copyright 2019 fancyApps
2704//
2705// ==================================================
2706(function (window, document, $, undefined) {
2707  "use strict";
2708
2709  window.console = window.console || {
2710    info: function (stuff) {}
2711  };
2712
2713  // If there's no jQuery, fancyBox can't work
2714  // =========================================
2715
2716  if (!$) {
2717    return;
2718  }
2719
2720  // Check if fancyBox is already initialized
2721  // ========================================
2722
2723  if ($.fn.fancybox) {
2724    console.info("fancyBox already initialized");
2725
2726    return;
2727  }
2728
2729  // Private default settings
2730  // ========================
2731
2732  var defaults = {
2733    // Close existing modals
2734    // Set this to false if you do not need to stack multiple instances
2735    closeExisting: false,
2736
2737    // Enable infinite gallery navigation
2738    loop: false,
2739
2740    // Horizontal space between slides
2741    gutter: 50,
2742
2743    // Enable keyboard navigation
2744    keyboard: true,
2745
2746    // Should allow caption to overlap the content
2747    preventCaptionOverlap: true,
2748
2749    // Should display navigation arrows at the screen edges
2750    arrows: true,
2751
2752    // Should display counter at the top left corner
2753    infobar: true,
2754
2755    // Should display close button (using `btnTpl.smallBtn` template) over the content
2756    // Can be true, false, "auto"
2757    // If "auto" - will be automatically enabled for "html", "inline" or "ajax" items
2758    smallBtn: "auto",
2759
2760    // Should display toolbar (buttons at the top)
2761    // Can be true, false, "auto"
2762    // If "auto" - will be automatically hidden if "smallBtn" is enabled
2763    toolbar: "auto",
2764
2765    // What buttons should appear in the top right corner.
2766    // Buttons will be created using templates from `btnTpl` option
2767    // and they will be placed into toolbar (class="fancybox-toolbar"` element)
2768    buttons: [
2769      "zoom",
2770      //"share",
2771      "slideShow",
2772      //"fullScreen",
2773      //"download",
2774      "thumbs",
2775      "close"
2776    ],
2777
2778    // Detect "idle" time in seconds
2779    idleTime: 3,
2780
2781    // Disable right-click and use simple image protection for images
2782    protect: false,
2783
2784    // Shortcut to make content "modal" - disable keyboard navigtion, hide buttons, etc
2785    modal: false,
2786
2787    image: {
2788      // Wait for images to load before displaying
2789      //   true  - wait for image to load and then display;
2790      //   false - display thumbnail and load the full-sized image over top,
2791      //           requires predefined image dimensions (`data-width` and `data-height` attributes)
2792      preload: false
2793    },
2794
2795    ajax: {
2796      // Object containing settings for ajax request
2797      settings: {
2798        // This helps to indicate that request comes from the modal
2799        // Feel free to change naming
2800        data: {
2801          fancybox: true
2802        }
2803      }
2804    },
2805
2806    iframe: {
2807      // Iframe template
2808      tpl: '<iframe id="fancybox-frame{rnd}" name="fancybox-frame{rnd}" class="fancybox-iframe" allowfullscreen="allowfullscreen" allow="autoplay; fullscreen" src=""></iframe>',
2809
2810      // Preload iframe before displaying it
2811      // This allows to calculate iframe content width and height
2812      // (note: Due to "Same Origin Policy", you can't get cross domain data).
2813      preload: true,
2814
2815      // Custom CSS styling for iframe wrapping element
2816      // You can use this to set custom iframe dimensions
2817      css: {},
2818
2819      // Iframe tag attributes
2820      attr: {
2821        scrolling: "auto"
2822      }
2823    },
2824
2825    // For HTML5 video only
2826    video: {
2827      tpl: '<video class="fancybox-video" controls controlsList="nodownload" poster="{{poster}}">' +
2828        '<source src="{{src}}" type="{{format}}" />' +
2829        'Sorry, your browser doesn\'t support embedded videos, <a href="{{src}}">download</a> and watch with your favorite video player!' +
2830        "</video>",
2831      format: "", // custom video format
2832      autoStart: true
2833    },
2834
2835    // Default content type if cannot be detected automatically
2836    defaultType: "image",
2837
2838    // Open/close animation type
2839    // Possible values:
2840    //   false            - disable
2841    //   "zoom"           - zoom images from/to thumbnail
2842    //   "fade"
2843    //   "zoom-in-out"
2844    //
2845    animationEffect: "zoom",
2846
2847    // Duration in ms for open/close animation
2848    animationDuration: 366,
2849
2850    // Should image change opacity while zooming
2851    // If opacity is "auto", then opacity will be changed if image and thumbnail have different aspect ratios
2852    zoomOpacity: "auto",
2853
2854    // Transition effect between slides
2855    //
2856    // Possible values:
2857    //   false            - disable
2858    //   "fade'
2859    //   "slide'
2860    //   "circular'
2861    //   "tube'
2862    //   "zoom-in-out'
2863    //   "rotate'
2864    //
2865    transitionEffect: "fade",
2866
2867    // Duration in ms for transition animation
2868    transitionDuration: 366,
2869
2870    // Custom CSS class for slide element
2871    slideClass: "",
2872
2873    // Custom CSS class for layout
2874    baseClass: "",
2875
2876    // Base template for layout
2877    baseTpl: '<div class="fancybox-container" role="dialog" tabindex="-1">' +
2878      '<div class="fancybox-bg"></div>' +
2879      '<div class="fancybox-inner">' +
2880      '<div class="fancybox-infobar"><span data-fancybox-index></span>&nbsp;/&nbsp;<span data-fancybox-count></span></div>' +
2881      '<div class="fancybox-toolbar">{{buttons}}</div>' +
2882      '<div class="fancybox-navigation">{{arrows}}</div>' +
2883      '<div class="fancybox-stage"></div>' +
2884      '<div class="fancybox-caption"><div class="fancybox-caption__body"></div></div>' +
2885      "</div>" +
2886      "</div>",
2887
2888    // Loading indicator template
2889    spinnerTpl: '<div class="fancybox-loading"></div>',
2890
2891    // Error message template
2892    errorTpl: '<div class="fancybox-error"><p>{{ERROR}}</p></div>',
2893
2894    btnTpl: {
2895      download: '<a download data-fancybox-download class="fancybox-button fancybox-button--download" title="{{DOWNLOAD}}" href="javascript:;">' +
2896        '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
vendor: 154,718 bytes, lines 2896-8330
2896<path d="M18.62 17.09V19H5.38v-1.91zm-2.97-6.96L17 11.45l-5 4.87-5-4.87 1.36-1.32 2.68 2.64V5h1.92v7.77z"/></svg>' +
2897        "</a>",
2898
2899      zoom: '<button data-fancybox-zoom class="fancybox-button fancybox-button--zoom" title="{{ZOOM}}">' +
2900        '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18.7 17.3l-3-3a5.9 5.9 0 0 0-.6-7.6 5.9 5.9 0 0 0-8.4 0 5.9 5.9 0 0 0 0 8.4 5.9 5.9 0 0 0 7.7.7l3 3a1 1 0 0 0 1.3 0c.4-.5.4-1 0-1.5zM8.1 13.8a4 4 0 0 1 0-5.7 4 4 0 0 1 5.7 0 4 4 0 0 1 0 5.7 4 4 0 0 1-5.7 0z"/></svg>' +
2901        "</button>",
2902
2903      close: '<button data-fancybox-close class="fancybox-button fancybox-button--close" title="{{CLOSE}}">' +
2904        '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 10.6L6.6 5.2 5.2 6.6l5.4 5.4-5.4 5.4 1.4 1.4 5.4-5.4 5.4 5.4 1.4-1.4-5.4-5.4 5.4-5.4-1.4-1.4-5.4 5.4z"/></svg>' +
2905        "</button>",
2906
2907      // Arrows
2908      arrowLeft: '<button data-fancybox-prev class="fancybox-button fancybox-button--arrow_left" title="{{PREV}}">' +
2909        '<div><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11.28 15.7l-1.34 1.37L5 12l4.94-5.07 1.34 1.38-2.68 2.72H19v1.94H8.6z"/></svg></div>' +
2910        "</button>",
2911
2912      arrowRight: '<button data-fancybox-next class="fancybox-button fancybox-button--arrow_right" title="{{NEXT}}">' +
2913        '<div><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15.4 12.97l-2.68 2.72 1.34 1.38L19 12l-4.94-5.07-1.34 1.38 2.68 2.72H5v1.94z"/></svg></div>' +
2914        "</button>",
2915
2916      // This small close button will be appended to your html/inline/ajax content by default,
2917      // if "smallBtn" option is not set to false
2918      smallBtn: '<button type="button" data-fancybox-close class="fancybox-button fancybox-close-small" title="{{CLOSE}}">' +
2919        '<svg xmlns="http://www.w3.org/2000/svg" version="1" viewBox="0 0 24 24"><path d="M13 12l5-5-1-1-5 5-5-5-1 1 5 5-5 5 1 1 5-5 5 5 1-1z"/></svg>' +
2920        "</button>"
2921    },
2922
2923    // Container is injected into this element
2924    parentEl: "body",
2925
2926    // Hide browser vertical scrollbars; use at your own risk
2927    hideScrollbar: true,
2928
2929    // Focus handling
2930    // ==============
2931
2932    // Try to focus on the first focusable element after opening
2933    autoFocus: true,
2934
2935    // Put focus back to active element after closing
2936    backFocus: true,
2937
2938    // Do not let user to focus on element outside modal content
2939    trapFocus: true,
2940
2941    // Module specific options
2942    // =======================
2943
2944    fullScreen: {
2945      autoStart: false
2946    },
2947
2948    // Set `touch: false` to disable panning/swiping
2949    touch: {
2950      vertical: true, // Allow to drag content vertically
2951      momentum: true // Continue movement after releasing mouse/touch when panning
2952    },
2953
2954    // Hash value when initializing manually,
2955    // set `false` to disable hash change
2956    hash: null,
2957
2958    // Customize or add new media types
2959    // Example:
2960    /*
2961      media : {
2962        youtube : {
2963          params : {
2964            autoplay : 0
2965          }
2966        }
2967      }
2968    */
2969    media: {},
2970
2971    slideShow: {
2972      autoStart: false,
2973      speed: 3000
2974    },
2975
2976    thumbs: {
2977      autoStart: false, // Display thumbnails on opening
2978      hideOnClose: true, // Hide thumbnail grid when closing animation starts
2979      parentEl: ".fancybox-container", // Container is injected into this element
2980      axis: "y" // Vertical (y) or horizontal (x) scrolling
2981    },
2982
2983    // Use mousewheel to navigate gallery
2984    // If 'auto' - enabled for images only
2985    wheel: "auto",
2986
2987    // Callbacks
2988    //==========
2989
2990    // See Documentation/API/Events for more information
2991    // Example:
2992    /*
2993      afterShow: function( instance, current ) {
2994        console.info( 'Clicked element:' );
2995        console.info( current.opts.$orig );
2996      }
2997    */
2998
2999    onInit: $.noop, // When instance has been initialized
3000
3001    beforeLoad: $.noop, // Before the content of a slide is being loaded
3002    afterLoad: $.noop, // When the content of a slide is done loading
3003
3004    beforeShow: $.noop, // Before open animation starts
3005    afterShow: $.noop, // When content is done loading and animating
3006
3007    beforeClose: $.noop, // Before the instance attempts to close. Return false to cancel the close.
3008    afterClose: $.noop, // After instance has been closed
3009
3010    onActivate: $.noop, // When instance is brought to front
3011    onDeactivate: $.noop, // When other instance has been activated
3012
3013    // Interaction
3014    // ===========
3015
3016    // Use options below to customize taken action when user clicks or double clicks on the fancyBox area,
3017    // each option can be string or method that returns value.
3018    //
3019    // Possible values:
3020    //   "close"           - close instance
3021    //   "next"            - move to next gallery item
3022    //   "nextOrClose"     - move to next gallery item or close if gallery has only one item
3023    //   "toggleControls"  - show/hide controls
3024    //   "zoom"            - zoom image (if loaded)
3025    //   false             - do nothing
3026
3027    // Clicked on the content
3028    clickContent: function (current, event) {
3029      return current.type === "image" ? "zoom" : false;
3030    },
3031
3032    // Clicked on the slide
3033    clickSlide: "close",
3034
3035    // Clicked on the background (backdrop) element;
3036    // if you have not changed the layout, then most likely you need to use `clickSlide` option
3037    clickOutside: "close",
3038
3039    // Same as previous two, but for double click
3040    dblclickContent: false,
3041    dblclickSlide: false,
3042    dblclickOutside: false,
3043
3044    // Custom options when mobile device is detected
3045    // =============================================
3046
3047    mobile: {
3048      preventCaptionOverlap: false,
3049      idleTime: false,
3050      clickContent: function (current, event) {
3051        return current.type === "image" ? "toggleControls" : false;
3052      },
3053      clickSlide: function (current, event) {
3054        return current.type === "image" ? "toggleControls" : "close";
3055      },
3056      dblclickContent: function (current, event) {
3057        return current.type === "image" ? "zoom" : false;
3058      },
3059      dblclickSlide: function (current, event) {
3060        return current.type === "image" ? "zoom" : false;
3061      }
3062    },
3063
3064    // Internationalization
3065    // ====================
3066
3067    lang: "en",
3068    i18n: {
3069      en: {
3070        CLOSE: "Close",
3071        NEXT: "Next",
3072        PREV: "Previous",
3073        ERROR: "The requested content cannot be loaded. <br/> Please try again later.",
3074        PLAY_START: "Start slideshow",
3075        PLAY_STOP: "Pause slideshow",
3076        FULL_SCREEN: "Full screen",
3077        THUMBS: "Thumbnails",
3078        DOWNLOAD: "Download",
3079        SHARE: "Share",
3080        ZOOM: "Zoom"
3081      },
3082      de: {
3083        CLOSE: "Schlie&szlig;en",
3084        NEXT: "Weiter",
3085        PREV: "Zur&uuml;ck",
3086        ERROR: "Die angeforderten Daten konnten nicht geladen werden. <br/> Bitte versuchen Sie es sp&auml;ter nochmal.",
3087        PLAY_START: "Diaschau starten",
3088        PLAY_STOP: "Diaschau beenden",
3089        FULL_SCREEN: "Vollbild",
3090        THUMBS: "Vorschaubilder",
3091        DOWNLOAD: "Herunterladen",
3092        SHARE: "Teilen",
3093        ZOOM: "Vergr&ouml;&szlig;ern"
3094      }
3095    }
3096  };
3097
3098  // Few useful variables and methods
3099  // ================================
3100
3101  var $W = $(window);
3102  var $D = $(document);
3103
3104  var called = 0;
3105
3106  // Check if an object is a jQuery object and not a native JavaScript object
3107  // ========================================================================
3108  var isQuery = function (obj) {
3109    return obj && obj.hasOwnProperty && obj instanceof $;
3110  };
3111
3112  // Handle multiple browsers for "requestAnimationFrame" and "cancelAnimationFrame"
3113  // ===============================================================================
3114  var requestAFrame = (function () {
3115    return (
3116      window.requestAnimationFrame ||
3117      window.webkitRequestAnimationFrame ||
3118      window.mozRequestAnimationFrame ||
3119      window.oRequestAnimationFrame ||
3120      // if all else fails, use setTimeout
3121      function (callback) {
3122        return window.setTimeout(callback, 1000 / 60);
3123      }
3124    );
3125  })();
3126
3127  var cancelAFrame = (function () {
3128    return (
3129      window.cancelAnimationFrame ||
3130      window.webkitCancelAnimationFrame ||
3131      window.mozCancelAnimationFrame ||
3132      window.oCancelAnimationFrame ||
3133      function (id) {
3134        window.clearTimeout(id);
3135      }
3136    );
3137  })();
3138
3139  // Detect the supported transition-end event property name
3140  // =======================================================
3141  var transitionEnd = (function () {
3142    var el = document.createElement("fakeelement"),
3143      t;
3144
3145    var transitions = {
3146      transition: "transitionend",
3147      OTransition: "oTransitionEnd",
3148      MozTransition: "transitionend",
3149      WebkitTransition: "webkitTransitionEnd"
3150    };
3151
3152    for (t in transitions) {
3153      if (el.style[t] !== undefined) {
3154        return transitions[t];
3155      }
3156    }
3157
3158    return "transitionend";
3159  })();
3160
3161  // Force redraw on an element.
3162  // This helps in cases where the browser doesn't redraw an updated element properly
3163  // ================================================================================
3164  var forceRedraw = function ($el) {
3165    return $el && $el.length && $el[0].offsetHeight;
3166  };
3167
3168  // Exclude array (`buttons`) options from deep merging
3169  // ===================================================
3170  var mergeOpts = function (opts1, opts2) {
3171    var rez = $.extend(true, {}, opts1, opts2);
3172
3173    $.each(opts2, function (key, value) {
3174      if ($.isArray(value)) {
3175        rez[key] = value;
3176      }
3177    });
3178
3179    return rez;
3180  };
3181
3182  // How much of an element is visible in viewport
3183  // =============================================
3184
3185  var inViewport = function (elem) {
3186    var elemCenter, rez;
3187
3188    if (!elem || elem.ownerDocument !== document) {
3189      return false;
3190    }
3191
3192    $(".fancybox-container").css("pointer-events", "none");
3193
3194    elemCenter = {
3195      x: elem.getBoundingClientRect().left + elem.offsetWidth / 2,
3196      y: elem.getBoundingClientRect().top + elem.offsetHeight / 2
3197    };
3198
3199    rez = document.elementFromPoint(elemCenter.x, elemCenter.y) === elem;
3200
3201    $(".fancybox-container").css("pointer-events", "");
3202
3203    return rez;
3204  };
3205
3206  // Class definition
3207  // ================
3208
3209  var FancyBox = function (content, opts, index) {
3210    var self = this;
3211
3212    self.opts = mergeOpts({
3213      index: index
3214    }, $.fancybox.defaults);
3215
3216    if ($.isPlainObject(opts)) {
3217      self.opts = mergeOpts(self.opts, opts);
3218    }
3219
3220    if ($.fancybox.isMobile) {
3221      self.opts = mergeOpts(self.opts, self.opts.mobile);
3222    }
3223
3224    self.id = self.opts.id || ++called;
3225
3226    self.currIndex = parseInt(self.opts.index, 10) || 0;
3227    self.prevIndex = null;
3228
3229    self.prevPos = null;
3230    self.currPos = 0;
3231
3232    self.firstRun = true;
3233
3234    // All group items
3235    self.group = [];
3236
3237    // Existing slides (for current, next and previous gallery items)
3238    self.slides = {};
3239
3240    // Create group elements
3241    self.addContent(content);
3242
3243    if (!self.group.length) {
3244      return;
3245    }
3246
3247    self.init();
3248  };
3249
3250  $.extend(FancyBox.prototype, {
3251    // Create DOM structure
3252    // ====================
3253
3254    init: function () {
3255      var self = this,
3256        firstItem = self.group[self.currIndex],
3257        firstItemOpts = firstItem.opts,
3258        $container,
3259        buttonStr;
3260
3261      if (firstItemOpts.closeExisting) {
3262        $.fancybox.close(true);
3263      }
3264
3265      // Hide scrollbars
3266      // ===============
3267
3268      $("body").addClass("fancybox-active");
3269
3270      if (
3271        !$.fancybox.getInstance() &&
3272        firstItemOpts.hideScrollbar !== false &&
3273        !$.fancybox.isMobile &&
3274        document.body.scrollHeight > window.innerHeight
3275      ) {
3276        $("head").append(
3277          '<style id="fancybox-style-noscroll" type="text/css">.compensate-for-scrollbar{margin-right:' +
3278          (window.innerWidth - document.documentElement.clientWidth) +
3279          "px;}</style>"
3280        );
3281
3282        $("body").addClass("compensate-for-scrollbar");
3283      }
3284
3285      // Build html markup and set references
3286      // ====================================
3287
3288      // Build html code for buttons and insert into main template
3289      buttonStr = "";
3290
3291      $.each(firstItemOpts.buttons, function (index, value) {
3292        buttonStr += firstItemOpts.btnTpl[value] || "";
3293      });
3294
3295      // Create markup from base template, it will be initially hidden to
3296      // avoid unnecessary work like painting while initializing is not complete
3297      $container = $(
3298          self.translate(
3299            self,
3300            firstItemOpts.baseTpl
3301            .replace("{{buttons}}", buttonStr)
3302            .replace("{{arrows}}", firstItemOpts.btnTpl.arrowLeft + firstItemOpts.btnTpl.arrowRight)
3303          )
3304        )
3305        .attr("id", "fancybox-container-" + self.id)
3306        .addClass(firstItemOpts.baseClass)
3307        .data("FancyBox", self)
3308        .appendTo(firstItemOpts.parentEl);
3309
3310      // Create object holding references to jQuery wrapped nodes
3311      self.$refs = {
3312        container: $container
3313      };
3314
3315      ["bg", "inner", "infobar", "toolbar", "stage", "caption", "navigation"].forEach(function (item) {
3316        self.$refs[item] = $container.find(".fancybox-" + item);
3317      });
3318
3319      self.trigger("onInit");
3320
3321      // Enable events, deactive previous instances
3322      self.activate();
3323
3324      // Build slides, load and reveal content
3325      self.jumpTo(self.currIndex);
3326    },
3327
3328    // Simple i18n support - replaces object keys found in template
3329    // with corresponding values
3330    // ============================================================
3331
3332    translate: function (obj, str) {
3333      var arr = obj.opts.i18n[obj.opts.lang] || obj.opts.i18n.en;
3334
3335      return str.replace(/\{\{(\w+)\}\}/g, function (match, n) {
3336        return arr[n] === undefined ? match : arr[n];
3337      });
3338    },
3339
3340    // Populate current group with fresh content
3341    // Check if each object has valid type and content
3342    // ===============================================
3343
3344    addContent: function (content) {
3345      var self = this,
3346        items = $.makeArray(content),
3347        thumbs;
3348
3349      $.each(items, function (i, item) {
3350        var obj = {},
3351          opts = {},
3352          $item,
3353          type,
3354          found,
3355          src,
3356          srcParts;
3357
3358        // Step 1 - Make sure we have an object
3359        // ====================================
3360
3361        if ($.isPlainObject(item)) {
3362          // We probably have manual usage here, something like
3363          // $.fancybox.open( [ { src : "image.jpg", type : "image" } ] )
3364
3365          obj = item;
3366          opts = item.opts || item;
3367        } else if ($.type(item) === "object" && $(item).length) {
3368          // Here we probably have jQuery collection returned by some selector
3369          $item = $(item);
3370
3371          // Support attributes like `data-options='{"touch" : false}'` and `data-touch='false'`
3372          opts = $item.data() || {};
3373          opts = $.extend(true, {}, opts, opts.options);
3374
3375          // Here we store clicked element
3376          opts.$orig = $item;
3377
3378          obj.src = self.opts.src || opts.src || $item.attr("href");
3379
3380          // Assume that simple syntax is used, for example:
3381          //   `$.fancybox.open( $("#test"), {} );`
3382          if (!obj.type && !obj.src) {
3383            obj.type = "inline";
3384            obj.src = item;
3385          }
3386        } else {
3387          // Assume we have a simple html code, for example:
3388          //   $.fancybox.open( '<div><h1>Hi!</h1></div>' );
3389          obj = {
3390            type: "html",
3391            src: item + ""
3392          };
3393        }
3394
3395        // Each gallery object has full collection of options
3396        obj.opts = $.extend(true, {}, self.opts, opts);
3397
3398        // Do not merge buttons array
3399        if ($.isArray(opts.buttons)) {
3400          obj.opts.buttons = opts.buttons;
3401        }
3402
3403        if ($.fancybox.isMobile && obj.opts.mobile) {
3404          obj.opts = mergeOpts(obj.opts, obj.opts.mobile);
3405        }
3406
3407        // Step 2 - Make sure we have content type, if not - try to guess
3408        // ==============================================================
3409
3410        type = obj.type || obj.opts.type;
3411        src = obj.src || "";
3412
3413        if (!type && src) {
3414          if ((found = src.match(/\.(mp4|mov|ogv|webm)((\?|#).*)?$/i))) {
3415            type = "video";
3416
3417            if (!obj.opts.video.format) {
3418              obj.opts.video.format = "video/" + (found[1] === "ogv" ? "ogg" : found[1]);
3419            }
3420          } else if (src.match(/(^data:image\/[a-z0-9+\/=]*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg|ico)((\?|#).*)?$)/i)) {
3421            type = "image";
3422          } else if (src.match(/\.(pdf)((\?|#).*)?$/i)) {
3423            type = "iframe";
3424            obj = $.extend(true, obj, {
3425              contentType: "pdf",
3426              opts: {
3427                iframe: {
3428                  preload: false
3429                }
3430              }
3431            });
3432          } else if (src.charAt(0) === "#") {
3433            type = "inline";
3434          }
3435        }
3436
3437        if (type) {
3438          obj.type = type;
3439        } else {
3440          self.trigger("objectNeedsType", obj);
3441        }
3442
3443        if (!obj.contentType) {
3444          obj.contentType = $.inArray(obj.type, ["html", "inline", "ajax"]) > -1 ? "html" : obj.type;
3445        }
3446
3447        // Step 3 - Some adjustments
3448        // =========================
3449
3450        obj.index = self.group.length;
3451
3452        if (obj.opts.smallBtn == "auto") {
3453          obj.opts.smallBtn = $.inArray(obj.type, ["html", "inline", "ajax"]) > -1;
3454        }
3455
3456        if (obj.opts.toolbar === "auto") {
3457          obj.opts.toolbar = !obj.opts.smallBtn;
3458        }
3459
3460        // Find thumbnail image, check if exists and if is in the viewport
3461        obj.$thumb = obj.opts.$thumb || null;
3462
3463        if (obj.opts.$trigger && obj.index === self.opts.index) {
3464          obj.$thumb = obj.opts.$trigger.find("img:first");
3465
3466          if (obj.$thumb.length) {
3467            obj.opts.$orig = obj.opts.$trigger;
3468          }
3469        }
3470
3471        if (!(obj.$thumb && obj.$thumb.length) && obj.opts.$orig) {
3472          obj.$thumb = obj.opts.$orig.find("img:first");
3473        }
3474
3475        if (obj.$thumb && !obj.$thumb.length) {
3476          obj.$thumb = null;
3477        }
3478
3479        obj.thumb = obj.opts.thumb || (obj.$thumb ? obj.$thumb[0].src : null);
3480
3481        // "caption" is a "special" option, it can be used to customize caption per gallery item
3482        if ($.type(obj.opts.caption) === "function") {
3483          obj.opts.caption = obj.opts.caption.apply(item, [self, obj]);
3484        }
3485
3486        if ($.type(self.opts.caption) === "function") {
3487          obj.opts.caption = self.opts.caption.apply(item, [self, obj]);
3488        }
3489
3490        // Make sure we have caption as a string or jQuery object
3491        if (!(obj.opts.caption instanceof $)) {
3492          obj.opts.caption = obj.opts.caption === undefined ? "" : obj.opts.caption + "";
3493        }
3494
3495        // Check if url contains "filter" used to filter the content
3496        // Example: "ajax.html #something"
3497        if (obj.type === "ajax") {
3498          srcParts = src.split(/\s+/, 2);
3499
3500          if (srcParts.length > 1) {
3501            obj.src = srcParts.shift();
3502
3503            obj.opts.filter = srcParts.shift();
3504          }
3505        }
3506
3507        // Hide all buttons and disable interactivity for modal items
3508        if (obj.opts.modal) {
3509          obj.opts = $.extend(true, obj.opts, {
3510            trapFocus: true,
3511            // Remove buttons
3512            infobar: 0,
3513            toolbar: 0,
3514
3515            smallBtn: 0,
3516
3517            // Disable keyboard navigation
3518            keyboard: 0,
3519
3520            // Disable some modules
3521            slideShow: 0,
3522            fullScreen: 0,
3523            thumbs: 0,
3524            touch: 0,
3525
3526            // Disable click event handlers
3527            clickContent: false,
3528            clickSlide: false,
3529            clickOutside: false,
3530            dblclickContent: false,
3531            dblclickSlide: false,
3532            dblclickOutside: false
3533          });
3534        }
3535
3536        // Step 4 - Add processed object to group
3537        // ======================================
3538
3539        self.group.push(obj);
3540      });
3541
3542      // Update controls if gallery is already opened
3543      if (Object.keys(self.slides).length) {
3544        self.updateControls();
3545
3546        // Update thumbnails, if needed
3547        thumbs = self.Thumbs;
3548
3549        if (thumbs && thumbs.isActive) {
3550          thumbs.create();
3551
3552          thumbs.focus();
3553        }
3554      }
3555    },
3556
3557    // Attach an event handler functions for:
3558    //   - navigation buttons
3559    //   - browser scrolling, resizing;
3560    //   - focusing
3561    //   - keyboard
3562    //   - detecting inactivity
3563    // ======================================
3564
3565    addEvents: function () {
3566      var self = this;
3567
3568      self.removeEvents();
3569
3570      // Make navigation elements clickable
3571      // ==================================
3572
3573      self.$refs.container
3574        .on("click.fb-close", "[data-fancybox-close]", function (e) {
3575          e.stopPropagation();
3576          e.preventDefault();
3577
3578          self.close(e);
3579        })
3580        .on("touchstart.fb-prev click.fb-prev", "[data-fancybox-prev]", function (e) {
3581          e.stopPropagation();
3582          e.preventDefault();
3583
3584          self.previous();
3585        })
3586        .on("touchstart.fb-next click.fb-next", "[data-fancybox-next]", function (e) {
3587          e.stopPropagation();
3588          e.preventDefault();
3589
3590          self.next();
3591        })
3592        .on("click.fb", "[data-fancybox-zoom]", function (e) {
3593          // Click handler for zoom button
3594          self[self.isScaledDown() ? "scaleToActual" : "scaleToFit"]();
3595        });
3596
3597      // Handle page scrolling and browser resizing
3598      // ==========================================
3599
3600      $W.on("orientationchange.fb resize.fb", function (e) {
3601        if (e && e.originalEvent && e.originalEvent.type === "resize") {
3602          if (self.requestId) {
3603            cancelAFrame(self.requestId);
3604          }
3605
3606          self.requestId = requestAFrame(function () {
3607            self.update(e);
3608          });
3609        } else {
3610          if (self.current && self.current.type === "iframe") {
3611            self.$refs.stage.hide();
3612          }
3613
3614          setTimeout(
3615            function () {
3616              self.$refs.stage.show();
3617
3618              self.update(e);
3619            },
3620            $.fancybox.isMobile ? 600 : 250
3621          );
3622        }
3623      });
3624
3625      $D.on("keydown.fb", function (e) {
3626        var instance = $.fancybox ? $.fancybox.getInstance() : null,
3627          current = instance.current,
3628          keycode = e.keyCode || e.which;
3629
3630        // Trap keyboard focus inside of the modal
3631        // =======================================
3632
3633        if (keycode == 9) {
3634          if (current.opts.trapFocus) {
3635            self.focus(e);
3636          }
3637
3638          return;
3639        }
3640
3641        // Enable keyboard navigation
3642        // ==========================
3643
3644        if (!current.opts.keyboard || e.ctrlKey || e.altKey || e.shiftKey || $(e.target).is("input,textarea,video,audio,select")) {
3645          return;
3646        }
3647
3648        // Backspace and Esc keys
3649        if (keycode === 8 || keycode === 27) {
3650          e.preventDefault();
3651
3652          self.close(e);
3653
3654          return;
3655        }
3656
3657        // Left arrow and Up arrow
3658        if (keycode === 37 || keycode === 38) {
3659          e.preventDefault();
3660
3661          self.previous();
3662
3663          return;
3664        }
3665
3666        // Righ arrow and Down arrow
3667        if (keycode === 39 || keycode === 40) {
3668          e.preventDefault();
3669
3670          self.next();
3671
3672          return;
3673        }
3674
3675        self.trigger("afterKeydown", e, keycode);
3676      });
3677
3678      // Hide controls after some inactivity period
3679      if (self.group[self.currIndex].opts.idleTime) {
3680        self.idleSecondsCounter = 0;
3681
3682        $D.on(
3683          "mousemove.fb-idle mouseleave.fb-idle mousedown.fb-idle touchstart.fb-idle touchmove.fb-idle scroll.fb-idle keydown.fb-idle",
3684          function (e) {
3685            self.idleSecondsCounter = 0;
3686
3687            if (self.isIdle) {
3688              self.showControls();
3689            }
3690
3691            self.isIdle = false;
3692          }
3693        );
3694
3695        self.idleInterval = window.setInterval(function () {
3696          self.idleSecondsCounter++;
3697
3698          if (self.idleSecondsCounter >= self.group[self.currIndex].opts.idleTime && !self.isDragging) {
3699            self.isIdle = true;
3700            self.idleSecondsCounter = 0;
3701
3702            self.hideControls();
3703          }
3704        }, 1000);
3705      }
3706    },
3707
3708    // Remove events added by the core
3709    // ===============================
3710
3711    removeEvents: function () {
3712      var self = this;
3713
3714      $W.off("orientationchange.fb resize.fb");
3715      $D.off("keydown.fb .fb-idle");
3716
3717      this.$refs.container.off(".fb-close .fb-prev .fb-next");
3718
3719      if (self.idleInterval) {
3720        window.clearInterval(self.idleInterval);
3721
3722        self.idleInterval = null;
3723      }
3724    },
3725
3726    // Change to previous gallery item
3727    // ===============================
3728
3729    previous: function (duration) {
3730      return this.jumpTo(this.currPos - 1, duration);
3731    },
3732
3733    // Change to next gallery item
3734    // ===========================
3735
3736    next: function (duration) {
3737      return this.jumpTo(this.currPos + 1, duration);
3738    },
3739
3740    // Switch to selected gallery item
3741    // ===============================
3742
3743    jumpTo: function (pos, duration) {
3744      var self = this,
3745        groupLen = self.group.length,
3746        firstRun,
3747        isMoved,
3748        loop,
3749        current,
3750        previous,
3751        slidePos,
3752        stagePos,
3753        prop,
3754        diff;
3755
3756      if (self.isDragging || self.isClosing || (self.isAnimating && self.firstRun)) {
3757        return;
3758      }
3759
3760      // Should loop?
3761      pos = parseInt(pos, 10);
3762      loop = self.current ? self.current.opts.loop : self.opts.loop;
3763
3764      if (!loop && (pos < 0 || pos >= groupLen)) {
3765        return false;
3766      }
3767
3768      // Check if opening for the first time; this helps to speed things up
3769      firstRun = self.firstRun = !Object.keys(self.slides).length;
3770
3771      // Create slides
3772      previous = self.current;
3773
3774      self.prevIndex = self.currIndex;
3775      self.prevPos = self.currPos;
3776
3777      current = self.createSlide(pos);
3778
3779      if (groupLen > 1) {
3780        if (loop || current.index < groupLen - 1) {
3781          self.createSlide(pos + 1);
3782        }
3783
3784        if (loop || current.index > 0) {
3785          self.createSlide(pos - 1);
3786        }
3787      }
3788
3789      self.current = current;
3790      self.currIndex = current.index;
3791      self.currPos = current.pos;
3792
3793      self.trigger("beforeShow", firstRun);
3794
3795      self.updateControls();
3796
3797      // Validate duration length
3798      current.forcedDuration = undefined;
3799
3800      if ($.isNumeric(duration)) {
3801        current.forcedDuration = duration;
3802      } else {
3803        duration = current.opts[firstRun ? "animationDuration" : "transitionDuration"];
3804      }
3805
3806      duration = parseInt(duration, 10);
3807
3808      // Check if user has swiped the slides or if still animating
3809      isMoved = self.isMoved(current);
3810
3811      // Make sure current slide is visible
3812      current.$slide.addClass("fancybox-slide--current");
3813
3814      // Fresh start - reveal container, current slide and start loading content
3815      if (firstRun) {
3816        if (current.opts.animationEffect && duration) {
3817          self.$refs.container.css("transition-duration", duration + "ms");
3818        }
3819
3820        self.$refs.container.addClass("fancybox-is-open").trigger("focus");
3821
3822        // Attempt to load content into slide
3823        // This will later call `afterLoad` -> `revealContent`
3824        self.loadSlide(current);
3825
3826        self.preload("image");
3827
3828        return;
3829      }
3830
3831      // Get actual slide/stage positions (before cleaning up)
3832      slidePos = $.fancybox.getTranslate(previous.$slide);
3833      stagePos = $.fancybox.getTranslate(self.$refs.stage);
3834
3835      // Clean up all slides
3836      $.each(self.slides, function (index, slide) {
3837        $.fancybox.stop(slide.$slide, true);
3838      });
3839
3840      if (previous.pos !== current.pos) {
3841        previous.isComplete = false;
3842      }
3843
3844      previous.$slide.removeClass("fancybox-slide--complete fancybox-slide--current");
3845
3846      // If slides are out of place, then animate them to correct position
3847      if (isMoved) {
3848        // Calculate horizontal swipe distance
3849        diff = slidePos.left - (previous.pos * slidePos.width + previous.pos * previous.opts.gutter);
3850
3851        $.each(self.slides, function (index, slide) {
3852          slide.$slide.removeClass("fancybox-animated").removeClass(function (index, className) {
3853            return (className.match(/(^|\s)fancybox-fx-\S+/g) || []).join(" ");
3854          });
3855
3856          // Make sure that each slide is in equal distance
3857          // This is mostly needed for freshly added slides, because they are not yet positioned
3858          var leftPos = slide.pos * slidePos.width + slide.pos * slide.opts.gutter;
3859
3860          $.fancybox.setTranslate(slide.$slide, {
3861            top: 0,
3862            left: leftPos - stagePos.left + diff
3863          });
3864
3865          if (slide.pos !== current.pos) {
3866            slide.$slide.addClass("fancybox-slide--" + (slide.pos > current.pos ? "next" : "previous"));
3867          }
3868
3869          // Redraw to make sure that transition will start
3870          forceRedraw(slide.$slide);
3871
3872          // Animate the slide
3873          $.fancybox.animate(
3874            slide.$slide, {
3875              top: 0,
3876              left: (slide.pos - current.pos) * slidePos.width + (slide.pos - current.pos) * slide.opts.gutter
3877            },
3878            duration,
3879            function () {
3880              slide.$slide
3881                .css({
3882                  transform: "",
3883                  opacity: ""
3884                })
3885                .removeClass("fancybox-slide--next fancybox-slide--previous");
3886
3887              if (slide.pos === self.currPos) {
3888                self.complete();
3889              }
3890            }
3891          );
3892        });
3893      } else if (duration && current.opts.transitionEffect) {
3894        // Set transition effect for previously active slide
3895        prop = "fancybox-animated fancybox-fx-" + current.opts.transitionEffect;
3896
3897        previous.$slide.addClass("fancybox-slide--" + (previous.pos > current.pos ? "next" : "previous"));
3898
3899        $.fancybox.animate(
3900          previous.$slide,
3901          prop,
3902          duration,
3903          function () {
3904            previous.$slide.removeClass(prop).removeClass("fancybox-slide--next fancybox-slide--previous");
3905          },
3906          false
3907        );
3908      }
3909
3910      if (current.isLoaded) {
3911        self.revealContent(current);
3912      } else {
3913        self.loadSlide(current);
3914      }
3915
3916      self.preload("image");
3917    },
3918
3919    // Create new "slide" element
3920    // These are gallery items  that are actually added to DOM
3921    // =======================================================
3922
3923    createSlide: function (pos) {
3924      var self = this,
3925        $slide,
3926        index;
3927
3928      index = pos % self.group.length;
3929      index = index < 0 ? self.group.length + index : index;
3930
3931      if (!self.slides[pos] && self.group[index]) {
3932        $slide = $('<div class="fancybox-slide"></div>').appendTo(self.$refs.stage);
3933
3934        self.slides[pos] = $.extend(true, {}, self.group[index], {
3935          pos: pos,
3936          $slide: $slide,
3937          isLoaded: false
3938        });
3939
3940        self.updateSlide(self.slides[pos]);
3941      }
3942
3943      return self.slides[pos];
3944    },
3945
3946    // Scale image to the actual size of the image;
3947    // x and y values should be relative to the slide
3948    // ==============================================
3949
3950    scaleToActual: function (x, y, duration) {
3951      var self = this,
3952        current = self.current,
3953        $content = current.$content,
3954        canvasWidth = $.fancybox.getTranslate(current.$slide).width,
3955        canvasHeight = $.fancybox.getTranslate(current.$slide).height,
3956        newImgWidth = current.width,
3957        newImgHeight = current.height,
3958        imgPos,
3959        posX,
3960        posY,
3961        scaleX,
3962        scaleY;
3963
3964      if (self.isAnimating || self.isMoved() || !$content || !(current.type == "image" && current.isLoaded && !current.hasError)) {
3965        return;
3966      }
3967
3968      self.isAnimating = true;
3969
3970      $.fancybox.stop($content);
3971
3972      x = x === undefined ? canvasWidth * 0.5 : x;
3973      y = y === undefined ? canvasHeight * 0.5 : y;
3974
3975      imgPos = $.fancybox.getTranslate($content);
3976
3977      imgPos.top -= $.fancybox.getTranslate(current.$slide).top;
3978      imgPos.left -= $.fancybox.getTranslate(current.$slide).left;
3979
3980      scaleX = newImgWidth / imgPos.width;
3981      scaleY = newImgHeight / imgPos.height;
3982
3983      // Get center position for original image
3984      posX = canvasWidth * 0.5 - newImgWidth * 0.5;
3985      posY = canvasHeight * 0.5 - newImgHeight * 0.5;
3986
3987      // Make sure image does not move away from edges
3988      if (newImgWidth > canvasWidth) {
3989        posX = imgPos.left * scaleX - (x * scaleX - x);
3990
3991        if (posX > 0) {
3992          posX = 0;
3993        }
3994
3995        if (posX < canvasWidth - newImgWidth) {
3996          posX = canvasWidth - newImgWidth;
3997        }
3998      }
3999
4000      if (newImgHeight > canvasHeight) {
4001        posY = imgPos.top * scaleY - (y * scaleY - y);
4002
4003        if (posY > 0) {
4004          posY = 0;
4005        }
4006
4007        if (posY < canvasHeight - newImgHeight) {
4008          posY = canvasHeight - newImgHeight;
4009        }
4010      }
4011
4012      self.updateCursor(newImgWidth, newImgHeight);
4013
4014      $.fancybox.animate(
4015        $content, {
4016          top: posY,
4017          left: posX,
4018          scaleX: scaleX,
4019          scaleY: scaleY
4020        },
4021        duration || 366,
4022        function () {
4023          self.isAnimating = false;
4024        }
4025      );
4026
4027      // Stop slideshow
4028      if (self.SlideShow && self.SlideShow.isActive) {
4029        self.SlideShow.stop();
4030      }
4031    },
4032
4033    // Scale image to fit inside parent element
4034    // ========================================
4035
4036    scaleToFit: function (duration) {
4037      var self = this,
4038        current = self.current,
4039        $content = current.$content,
4040        end;
4041
4042      if (self.isAnimating || self.isMoved() || !$content || !(current.type == "image" && current.isLoaded && !current.hasError)) {
4043        return;
4044      }
4045
4046      self.isAnimating = true;
4047
4048      $.fancybox.stop($content);
4049
4050      end = self.getFitPos(current);
4051
4052      self.updateCursor(end.width, end.height);
4053
4054      $.fancybox.animate(
4055        $content, {
4056          top: end.top,
4057          left: end.left,
4058          scaleX: end.width / $content.width(),
4059          scaleY: end.height / $content.height()
4060        },
4061        duration || 366,
4062        function () {
4063          self.isAnimating = false;
4064        }
4065      );
4066    },
4067
4068    // Calculate image size to fit inside viewport
4069    // ===========================================
4070
4071    getFitPos: function (slide) {
4072      var self = this,
4073        $content = slide.$content,
4074        $slide = slide.$slide,
4075        width = slide.width || slide.opts.width,
4076        height = slide.height || slide.opts.height,
4077        maxWidth,
4078        maxHeight,
4079        minRatio,
4080        aspectRatio,
4081        rez = {};
4082
4083      if (!slide.isLoaded || !$content || !$content.length) {
4084        return false;
4085      }
4086
4087      maxWidth = $.fancybox.getTranslate(self.$refs.stage).width;
4088      maxHeight = $.fancybox.getTranslate(self.$refs.stage).height;
4089
4090      maxWidth -=
4091        parseFloat($slide.css("paddingLeft")) +
4092        parseFloat($slide.css("paddingRight")) +
4093        parseFloat($content.css("marginLeft")) +
4094        parseFloat($content.css("marginRight"));
4095
4096      maxHeight -=
4097        parseFloat($slide.css("paddingTop")) +
4098        parseFloat($slide.css("paddingBottom")) +
4099        parseFloat($content.css("marginTop")) +
4100        parseFloat($content.css("marginBottom"));
4101
4102      if (!width || !height) {
4103        width = maxWidth;
4104        height = maxHeight;
4105      }
4106
4107      minRatio = Math.min(1, maxWidth / width, maxHeight / height);
4108
4109      width = minRatio * width;
4110      height = minRatio * height;
4111
4112      // Adjust width/height to precisely fit into container
4113      if (width > maxWidth - 0.5) {
4114        width = maxWidth;
4115      }
4116
4117      if (height > maxHeight - 0.5) {
4118        height = maxHeight;
4119      }
4120
4121      if (slide.type === "image") {
4122        rez.top = Math.floor((maxHeight - height) * 0.5) + parseFloat($slide.css("paddingTop"));
4123        rez.left = Math.floor((maxWidth - width) * 0.5) + parseFloat($slide.css("paddingLeft"));
4124      } else if (slide.contentType === "video") {
4125        // Force aspect ratio for the video
4126        // "I say the whole world must learn of our peaceful ways… by force!"
4127        aspectRatio = slide.opts.width && slide.opts.height ? width / height : slide.opts.ratio || 16 / 9;
4128
4129        if (height > width / aspectRatio) {
4130          height = width / aspectRatio;
4131        } else if (width > height * aspectRatio) {
4132          width = height * aspectRatio;
4133        }
4134      }
4135
4136      rez.width = width;
4137      rez.height = height;
4138
4139      return rez;
4140    },
4141
4142    // Update content size and position for all slides
4143    // ==============================================
4144
4145    update: function (e) {
4146      var self = this;
4147
4148      $.each(self.slides, function (key, slide) {
4149        self.updateSlide(slide, e);
4150      });
4151    },
4152
4153    // Update slide content position and size
4154    // ======================================
4155
4156    updateSlide: function (slide, e) {
4157      var self = this,
4158        $content = slide && slide.$content,
4159        width = slide.width || slide.opts.width,
4160        height = slide.height || slide.opts.height,
4161        $slide = slide.$slide;
4162
4163      // First, prevent caption overlap, if needed
4164      self.adjustCaption(slide);
4165
4166      // Then resize content to fit inside the slide
4167      if ($content && (width || height || slide.contentType === "video") && !slide.hasError) {
4168        $.fancybox.stop($content);
4169
4170        $.fancybox.setTranslate($content, self.getFitPos(slide));
4171
4172        if (slide.pos === self.currPos) {
4173          self.isAnimating = false;
4174
4175          self.updateCursor();
4176        }
4177      }
4178
4179      // Then some adjustments
4180      self.adjustLayout(slide);
4181
4182      if ($slide.length) {
4183        $slide.trigger("refresh");
4184
4185        if (slide.pos === self.currPos) {
4186          self.$refs.toolbar
4187            .add(self.$refs.navigation.find(".fancybox-button--arrow_right"))
4188            .toggleClass("compensate-for-scrollbar", $slide.get(0).scrollHeight > $slide.get(0).clientHeight);
4189        }
4190      }
4191
4192      self.trigger("onUpdate", slide, e);
4193    },
4194
4195    // Horizontally center slide
4196    // =========================
4197
4198    centerSlide: function (duration) {
4199      var self = this,
4200        current = self.current,
4201        $slide = current.$slide;
4202
4203      if (self.isClosing || !current) {
4204        return;
4205      }
4206
4207      $slide.siblings().css({
4208        transform: "",
4209        opacity: ""
4210      });
4211
4212      $slide
4213        .parent()
4214        .children()
4215        .removeClass("fancybox-slide--previous fancybox-slide--next");
4216
4217      $.fancybox.animate(
4218        $slide, {
4219          top: 0,
4220          left: 0,
4221          opacity: 1
4222        },
4223        duration === undefined ? 0 : duration,
4224        function () {
4225          // Clean up
4226          $slide.css({
4227            transform: "",
4228            opacity: ""
4229          });
4230
4231          if (!current.isComplete) {
4232            self.complete();
4233          }
4234        },
4235        false
4236      );
4237    },
4238
4239    // Check if current slide is moved (swiped)
4240    // ========================================
4241
4242    isMoved: function (slide) {
4243      var current = slide || this.current,
4244        slidePos,
4245        stagePos;
4246
4247      if (!current) {
4248        return false;
4249      }
4250
4251      stagePos = $.fancybox.getTranslate(this.$refs.stage);
4252      slidePos = $.fancybox.getTranslate(current.$slide);
4253
4254      return (
4255        !current.$slide.hasClass("fancybox-animated") &&
4256        (Math.abs(slidePos.top - stagePos.top) > 0.5 || Math.abs(slidePos.left - stagePos.left) > 0.5)
4257      );
4258    },
4259
4260    // Update cursor style depending if content can be zoomed
4261    // ======================================================
4262
4263    updateCursor: function (nextWidth, nextHeight) {
4264      var self = this,
4265        current = self.current,
4266        $container = self.$refs.container,
4267        canPan,
4268        isZoomable;
4269
4270      if (!current || self.isClosing || !self.Guestures) {
4271        return;
4272      }
4273
4274      $container.removeClass("fancybox-is-zoomable fancybox-can-zoomIn fancybox-can-zoomOut fancybox-can-swipe fancybox-can-pan");
4275
4276      canPan = self.canPan(nextWidth, nextHeight);
4277
4278      isZoomable = canPan ? true : self.isZoomable();
4279
4280      $container.toggleClass("fancybox-is-zoomable", isZoomable);
4281
4282      $("[data-fancybox-zoom]").prop("disabled", !isZoomable);
4283
4284      if (canPan) {
4285        $container.addClass("fancybox-can-pan");
4286      } else if (
4287        isZoomable &&
4288        (current.opts.clickContent === "zoom" || ($.isFunction(current.opts.clickContent) && current.opts.clickContent(current) == "zoom"))
4289      ) {
4290        $container.addClass("fancybox-can-zoomIn");
4291      } else if (current.opts.touch && (current.opts.touch.vertical || self.group.length > 1) && current.contentType !== "video") {
4292        $container.addClass("fancybox-can-swipe");
4293      }
4294    },
4295
4296    // Check if current slide is zoomable
4297    // ==================================
4298
4299    isZoomable: function () {
4300      var self = this,
4301        current = self.current,
4302        fitPos;
4303
4304      // Assume that slide is zoomable if:
4305      //   - image is still loading
4306      //   - actual size of the image is smaller than available area
4307      if (current && !self.isClosing && current.type === "image" && !current.hasError) {
4308        if (!current.isLoaded) {
4309          return true;
4310        }
4311
4312        fitPos = self.getFitPos(current);
4313
4314        if (fitPos && (current.width > fitPos.width || current.height > fitPos.height)) {
4315          return true;
4316        }
4317      }
4318
4319      return false;
4320    },
4321
4322    // Check if current image dimensions are smaller than actual
4323    // =========================================================
4324
4325    isScaledDown: function (nextWidth, nextHeight) {
4326      var self = this,
4327        rez = false,
4328        current = self.current,
4329        $content = current.$content;
4330
4331      if (nextWidth !== undefined && nextHeight !== undefined) {
4332        rez = nextWidth < current.width && nextHeight < current.height;
4333      } else if ($content) {
4334        rez = $.fancybox.getTranslate($content);
4335        rez = rez.width < current.width && rez.height < current.height;
4336      }
4337
4338      return rez;
4339    },
4340
4341    // Check if image dimensions exceed parent element
4342    // ===============================================
4343
4344    canPan: function (nextWidth, nextHeight) {
4345      var self = this,
4346        current = self.current,
4347        pos = null,
4348        rez = false;
4349
4350      if (current.type === "image" && (current.isComplete || (nextWidth && nextHeight)) && !current.hasError) {
4351        rez = self.getFitPos(current);
4352
4353        if (nextWidth !== undefined && nextHeight !== undefined) {
4354          pos = {
4355            width: nextWidth,
4356            height: nextHeight
4357          };
4358        } else if (current.isComplete) {
4359          pos = $.fancybox.getTranslate(current.$content);
4360        }
4361
4362        if (pos && rez) {
4363          rez = Math.abs(pos.width - rez.width) > 1.5 || Math.abs(pos.height - rez.height) > 1.5;
4364        }
4365      }
4366
4367      return rez;
4368    },
4369
4370    // Load content into the slide
4371    // ===========================
4372
4373    loadSlide: function (slide) {
4374      var self = this,
4375        type,
4376        $slide,
4377        ajaxLoad;
4378
4379      if (slide.isLoading || slide.isLoaded) {
4380        return;
4381      }
4382
4383      slide.isLoading = true;
4384
4385      if (self.trigger("beforeLoad", slide) === false) {
4386        slide.isLoading = false;
4387
4388        return false;
4389      }
4390
4391      type = slide.type;
4392      $slide = slide.$slide;
4393
4394      $slide
4395        .off("refresh")
4396        .trigger("onReset")
4397        .addClass(slide.opts.slideClass);
4398
4399      // Create content depending on the type
4400      switch (type) {
4401        case "image":
4402          self.setImage(slide);
4403
4404          break;
4405
4406        case "iframe":
4407          self.setIframe(slide);
4408
4409          break;
4410
4411        case "html":
4412          self.setContent(slide, slide.src || slide.content);
4413
4414          break;
4415
4416        case "video":
4417          self.setContent(
4418            slide,
4419            slide.opts.video.tpl
4420            .replace(/\{\{src\}\}/gi, slide.src)
4421            .replace("{{format}}", slide.opts.videoFormat || slide.opts.video.format || "")
4422            .replace("{{poster}}", slide.thumb || "")
4423          );
4424
4425          break;
4426
4427        case "inline":
4428          if ($(slide.src).length) {
4429            self.setContent(slide, $(slide.src));
4430          } else {
4431            self.setError(slide);
4432          }
4433
4434          break;
4435
4436        case "ajax":
4437          self.showLoading(slide);
4438
4439          ajaxLoad = $.ajax(
4440            $.extend({}, slide.opts.ajax.settings, {
4441              url: slide.src,
4442              success: function (data, textStatus) {
4443                if (textStatus === "success") {
4444                  self.setContent(slide, data);
4445                }
4446              },
4447              error: function (jqXHR, textStatus) {
4448                if (jqXHR && textStatus !== "abort") {
4449                  self.setError(slide);
4450                }
4451              }
4452            })
4453          );
4454
4455          $slide.one("onReset", function () {
4456            ajaxLoad.abort();
4457          });
4458
4459          break;
4460
4461        default:
4462          self.setError(slide);
4463
4464          break;
4465      }
4466
4467      return true;
4468    },
4469
4470    // Use thumbnail image, if possible
4471    // ================================
4472
4473    setImage: function (slide) {
4474      var self = this,
4475        ghost;
4476
4477      // Check if need to show loading icon
4478      setTimeout(function () {
4479        var $img = slide.$image;
4480
4481        if (!self.isClosing && slide.isLoading && (!$img || !$img.length || !$img[0].complete) && !slide.hasError) {
4482          self.showLoading(slide);
4483        }
4484      }, 50);
4485
4486      //Check if image has srcset
4487      self.checkSrcset(slide);
4488
4489      // This will be wrapper containing both ghost and actual image
4490      slide.$content = $('<div class="fancybox-content"></div>')
4491        .addClass("fancybox-is-hidden")
4492        .appendTo(slide.$slide.addClass("fancybox-slide--image"));
4493
4494      // If we have a thumbnail, we can display it while actual image is loading
4495      // Users will not stare at black screen and actual image will appear gradually
4496      if (slide.opts.preload !== false && slide.opts.width && slide.opts.height && slide.thumb) {
4497        slide.width = slide.opts.width;
4498        slide.height = slide.opts.height;
4499
4500        ghost = document.createElement("img");
4501
4502        ghost.onerror = function () {
4503          $(this).remove();
4504
4505          slide.$ghost = null;
4506        };
4507
4508        ghost.onload = function () {
4509          self.afterLoad(slide);
4510        };
4511
4512        slide.$ghost = $(ghost)
4513          .addClass("fancybox-image")
4514          .appendTo(slide.$content)
4515          .attr("src", slide.thumb);
4516      }
4517
4518      // Start loading actual image
4519      self.setBigImage(slide);
4520    },
4521
4522    // Check if image has srcset and get the source
4523    // ============================================
4524    checkSrcset: function (slide) {
4525      var srcset = slide.opts.srcset || slide.opts.image.srcset,
4526        found,
4527        temp,
4528        pxRatio,
4529        windowWidth;
4530
4531      // If we have "srcset", then we need to find first matching "src" value.
4532      // This is necessary, because when you set an src attribute, the browser will preload the image
4533      // before any javascript or even CSS is applied.
4534      if (srcset) {
4535        pxRatio = window.devicePixelRatio || 1;
4536        windowWidth = window.innerWidth * pxRatio;
4537
4538        temp = srcset.split(",").map(function (el) {
4539          var ret = {};
4540
4541          el.trim()
4542            .split(/\s+/)
4543            .forEach(function (el, i) {
4544              var value = parseInt(el.substring(0, el.length - 1), 10);
4545
4546              if (i === 0) {
4547                return (ret.url = el);
4548              }
4549
4550              if (value) {
4551                ret.value = value;
4552                ret.postfix = el[el.length - 1];
4553              }
4554            });
4555
4556          return ret;
4557        });
4558
4559        // Sort by value
4560        temp.sort(function (a, b) {
4561          return a.value - b.value;
4562        });
4563
4564        // Ok, now we have an array of all srcset values
4565        for (var j = 0; j < temp.length; j++) {
4566          var el = temp[j];
4567
4568          if ((el.postfix === "w" && el.value >= windowWidth) || (el.postfix === "x" && el.value >= pxRatio)) {
4569            found = el;
4570            break;
4571          }
4572        }
4573
4574        // If not found, take the last one
4575        if (!found && temp.length) {
4576          found = temp[temp.length - 1];
4577        }
4578
4579        if (found) {
4580          slide.src = found.url;
4581
4582          // If we have default width/height values, we can calculate height for matching source
4583          if (slide.width && slide.height && found.postfix == "w") {
4584            slide.height = (slide.width / slide.height) * found.value;
4585            slide.width = found.value;
4586          }
4587
4588          slide.opts.srcset = srcset;
4589        }
4590      }
4591    },
4592
4593    // Create full-size image
4594    // ======================
4595
4596    setBigImage: function (slide) {
4597      var self = this,
4598        img = document.createElement("img"),
4599        $img = $(img);
4600
4601      slide.$image = $img
4602        .one("error", function () {
4603          self.setError(slide);
4604        })
4605        .one("load", function () {
4606          var sizes;
4607
4608          if (!slide.$ghost) {
4609            self.resolveImageSlideSize(slide, this.naturalWidth, this.naturalHeight);
4610
4611            self.afterLoad(slide);
4612          }
4613
4614          if (self.isClosing) {
4615            return;
4616          }
4617
4618          if (slide.opts.srcset) {
4619            sizes = slide.opts.sizes;
4620
4621            if (!sizes || sizes === "auto") {
4622              sizes =
4623                (slide.width / slide.height > 1 && $W.width() / $W.height() > 1 ? "100" : Math.round((slide.width / slide.height) * 100)) +
4624                "vw";
4625            }
4626
4627            $img.attr("sizes", sizes).attr("srcset", slide.opts.srcset);
4628          }
4629
4630          // Hide temporary image after some delay
4631          if (slide.$ghost) {
4632            setTimeout(function () {
4633              if (slide.$ghost && !self.isClosing) {
4634                slide.$ghost.hide();
4635              }
4636            }, Math.min(300, Math.max(1000, slide.height / 1600)));
4637          }
4638
4639          self.hideLoading(slide);
4640        })
4641        .addClass("fancybox-image")
4642        .attr("src", slide.src)
4643        .appendTo(slide.$content);
4644
4645      if ((img.complete || img.readyState == "complete") && $img.naturalWidth && $img.naturalHeight) {
4646        $img.trigger("load");
4647      } else if (img.error) {
4648        $img.trigger("error");
4649      }
4650    },
4651
4652    // Computes the slide size from image size and maxWidth/maxHeight
4653    // ==============================================================
4654
4655    resolveImageSlideSize: function (slide, imgWidth, imgHeight) {
4656      var maxWidth = parseInt(slide.opts.width, 10),
4657        maxHeight = parseInt(slide.opts.height, 10);
4658
4659      // Sets the default values from the image
4660      slide.width = imgWidth;
4661      slide.height = imgHeight;
4662
4663      if (maxWidth > 0) {
4664        slide.width = maxWidth;
4665        slide.height = Math.floor((maxWidth * imgHeight) / imgWidth);
4666      }
4667
4668      if (maxHeight > 0) {
4669        slide.width = Math.floor((maxHeight * imgWidth) / imgHeight);
4670        slide.height = maxHeight;
4671      }
4672    },
4673
4674    // Create iframe wrapper, iframe and bindings
4675    // ==========================================
4676
4677    setIframe: function (slide) {
4678      var self = this,
4679        opts = slide.opts.iframe,
4680        $slide = slide.$slide,
4681        $iframe;
4682
4683      slide.$content = $('<div class="fancybox-content' + (opts.preload ? " fancybox-is-hidden" : "") + '"></div>')
4684        .css(opts.css)
4685        .appendTo($slide);
4686
4687      $slide.addClass("fancybox-slide--" + slide.contentType);
4688
4689      slide.$iframe = $iframe = $(opts.tpl.replace(/\{rnd\}/g, new Date().getTime()))
4690        .attr(opts.attr)
4691        .appendTo(slide.$content);
4692
4693      if (opts.preload) {
4694        self.showLoading(slide);
4695
4696        // Unfortunately, it is not always possible to determine if iframe is successfully loaded
4697        // (due to browser security policy)
4698
4699        $iframe.on("load.fb error.fb", function (e) {
4700          this.isReady = 1;
4701
4702          slide.$slide.trigger("refresh");
4703
4704          self.afterLoad(slide);
4705        });
4706
4707        // Recalculate iframe content size
4708        // ===============================
4709
4710        $slide.on("refresh.fb", function () {
4711          var $content = slide.$content,
4712            frameWidth = opts.css.width,
4713            frameHeight = opts.css.height,
4714            $contents,
4715            $body;
4716
4717          if ($iframe[0].isReady !== 1) {
4718            return;
4719          }
4720
4721          try {
4722            $contents = $iframe.contents();
4723            $body = $contents.find("body");
4724          } catch (ignore) {}
4725
4726          // Calculate content dimensions, if it is accessible
4727          if ($body && $body.length && $body.children().length) {
4728            // Avoid scrolling to top (if multiple instances)
4729            $slide.css("overflow", "visible");
4730
4731            $content.css({
4732              width: "100%",
4733              "max-width": "100%",
4734              height: "9999px"
4735            });
4736
4737            if (frameWidth === undefined) {
4738              frameWidth = Math.ceil(Math.max($body[0].clientWidth, $body.outerWidth(true)));
4739            }
4740
4741            $content.css("width", frameWidth ? frameWidth : "").css("max-width", "");
4742
4743            if (frameHeight === undefined) {
4744              frameHeight = Math.ceil(Math.max($body[0].clientHeight, $body.outerHeight(true)));
4745            }
4746
4747            $content.css("height", frameHeight ? frameHeight : "");
4748
4749            $slide.css("overflow", "auto");
4750          }
4751
4752          $content.removeClass("fancybox-is-hidden");
4753        });
4754      } else {
4755        self.afterLoad(slide);
4756      }
4757
4758      $iframe.attr("src", slide.src);
4759
4760      // Remove iframe if closing or changing gallery item
4761      $slide.one("onReset", function () {
4762        // This helps IE not to throw errors when closing
4763        try {
4764          $(this)
4765            .find("iframe")
4766            .hide()
4767            .unbind()
4768            .attr("src", "//about:blank");
4769        } catch (ignore) {}
4770
4771        $(this)
4772          .off("refresh.fb")
4773          .empty();
4774
4775        slide.isLoaded = false;
4776        slide.isRevealed = false;
4777      });
4778    },
4779
4780    // Wrap and append content to the slide
4781    // ======================================
4782
4783    setContent: function (slide, content) {
4784      var self = this;
4785
4786      if (self.isClosing) {
4787        return;
4788      }
4789
4790      self.hideLoading(slide);
4791
4792      if (slide.$content) {
4793        $.fancybox.stop(slide.$content);
4794      }
4795
4796      slide.$slide.empty();
4797
4798      // If content is a jQuery object, then it will be moved to the slide.
4799      // The placeholder is created so we will know where to put it back.
4800      if (isQuery(content) && content.parent().length) {
4801        // Make sure content is not already moved to fancyBox
4802        if (content.hasClass("fancybox-content") || content.parent().hasClass("fancybox-content")) {
4803          content.parents(".fancybox-slide").trigger("onReset");
4804        }
4805
4806        // Create temporary element marking original place of the content
4807        slide.$placeholder = $("<div>")
4808          .hide()
4809          .insertAfter(content);
4810
4811        // Make sure content is visible
4812        content.css("display", "inline-block");
4813      } else if (!slide.hasError) {
4814        // If content is just a plain text, try to convert it to html
4815        if ($.type(content) === "string") {
4816          content = $("<div>")
4817            .append($.trim(content))
4818            .contents();
4819        }
4820
4821        // If "filter" option is provided, then filter content
4822        if (slide.opts.filter) {
4823          content = $("<div>")
4824            .html(content)
4825            .find(slide.opts.filter);
4826        }
4827      }
4828
4829      slide.$slide.one("onReset", function () {
4830        // Pause all html5 video/audio
4831        $(this)
4832          .find("video,audio")
4833          .trigger("pause");
4834
4835        // Put content back
4836        if (slide.$placeholder) {
4837          slide.$placeholder.after(content.removeClass("fancybox-content").hide()).remove();
4838
4839          slide.$placeholder = null;
4840        }
4841
4842        // Remove custom close button
4843        if (slide.$smallBtn) {
4844          slide.$smallBtn.remove();
4845
4846          slide.$smallBtn = null;
4847        }
4848
4849        // Remove content and mark slide as not loaded
4850        if (!slide.hasError) {
4851          $(this).empty();
4852
4853          slide.isLoaded = false;
4854          slide.isRevealed = false;
4855        }
4856      });
4857
4858      $(content).appendTo(slide.$slide);
4859
4860      if ($(content).is("video,audio")) {
4861        $(content).addClass("fancybox-video");
4862
4863        $(content).wrap("<div></div>");
4864
4865        slide.contentType = "video";
4866
4867        slide.opts.width = slide.opts.width || $(content).attr("width");
4868        slide.opts.height = slide.opts.height || $(content).attr("height");
4869      }
4870
4871      slide.$content = slide.$slide
4872        .children()
4873        .filter("div,form,main,video,audio,article,.fancybox-content")
4874        .first();
4875
4876      slide.$content.siblings().hide();
4877
4878      // Re-check if there is a valid content
4879      // (in some cases, ajax response can contain various elements or plain text)
4880      if (!slide.$content.length) {
4881        slide.$content = slide.$slide
4882          .wrapInner("<div></div>")
4883          .children()
4884          .first();
4885      }
4886
4887      slide.$content.addClass("fancybox-content");
4888
4889      slide.$slide.addClass("fancybox-slide--" + slide.contentType);
4890
4891      self.afterLoad(slide);
4892    },
4893
4894    // Display error message
4895    // =====================
4896
4897    setError: function (slide) {
4898      slide.hasError = true;
4899
4900      slide.$slide
4901        .trigger("onReset")
4902        .removeClass("fancybox-slide--" + slide.contentType)
4903        .addClass("fancybox-slide--error");
4904
4905      slide.contentType = "html";
4906
4907      this.setContent(slide, this.translate(slide, slide.opts.errorTpl));
4908
4909      if (slide.pos === this.currPos) {
4910        this.isAnimating = false;
4911      }
4912    },
4913
4914    // Show loading icon inside the slide
4915    // ==================================
4916
4917    showLoading: function (slide) {
4918      var self = this;
4919
4920      slide = slide || self.current;
4921
4922      if (slide && !slide.$spinner) {
4923        slide.$spinner = $(self.translate(self, self.opts.spinnerTpl))
4924          .appendTo(slide.$slide)
4925          .hide()
4926          .fadeIn("fast");
4927      }
4928    },
4929
4930    // Remove loading icon from the slide
4931    // ==================================
4932
4933    hideLoading: function (slide) {
4934      var self = this;
4935
4936      slide = slide || self.current;
4937
4938      if (slide && slide.$spinner) {
4939        slide.$spinner.stop().remove();
4940
4941        delete slide.$spinner;
4942      }
4943    },
4944
4945    // Adjustments after slide content has been loaded
4946    // ===============================================
4947
4948    afterLoad: function (slide) {
4949      var self = this;
4950
4951      if (self.isClosing) {
4952        return;
4953      }
4954
4955      slide.isLoading = false;
4956      slide.isLoaded = true;
4957
4958      self.trigger("afterLoad", slide);
4959
4960      self.hideLoading(slide);
4961
4962      // Add small close button
4963      if (slide.opts.smallBtn && (!slide.$smallBtn || !slide.$smallBtn.length)) {
4964        slide.$smallBtn = $(self.translate(slide, slide.opts.btnTpl.smallBtn)).appendTo(slide.$content);
4965      }
4966
4967      // Disable right click
4968      if (slide.opts.protect && slide.$content && !slide.hasError) {
4969        slide.$content.on("contextmenu.fb", function (e) {
4970          if (e.button == 2) {
4971            e.preventDefault();
4972          }
4973
4974          return true;
4975        });
4976
4977        // Add fake element on top of the image
4978        // This makes a bit harder for user to select image
4979        if (slide.type === "image") {
4980          $('<div class="fancybox-spaceball"></div>').appendTo(slide.$content);
4981        }
4982      }
4983
4984      self.adjustCaption(slide);
4985
4986      self.adjustLayout(slide);
4987
4988      if (slide.pos === self.currPos) {
4989        self.updateCursor();
4990      }
4991
4992      self.revealContent(slide);
4993    },
4994
4995    // Prevent caption overlap,
4996    // fix css inconsistency across browsers
4997    // =====================================
4998
4999    adjustCaption: function (slide) {
5000      var self = this,
5001        current = slide || self.current,
5002        caption = current.opts.caption,
5003        preventOverlap = current.opts.preventCaptionOverlap,
5004        $caption = self.$refs.caption,
5005        $clone,
5006        captionH = false;
5007
5008      $caption.toggleClass("fancybox-caption--separate", preventOverlap);
5009
5010      if (preventOverlap && caption && caption.length) {
5011        if (current.pos !== self.currPos) {
5012          $clone = $caption.clone().appendTo($caption.parent());
5013
5014          $clone
5015            .children()
5016            .eq(0)
5017            .empty()
5018            .html(caption);
5019
5020          captionH = $clone.outerHeight(true);
5021
5022          $clone.empty().remove();
5023        } else if (self.$caption) {
5024          captionH = self.$caption.outerHeight(true);
5025        }
5026
5027        current.$slide.css("padding-bottom", captionH || "");
5028      }
5029    },
5030
5031    // Simple hack to fix inconsistency across browsers, described here (affects Edge, too):
5032    // https://bugzilla.mozilla.org/show_bug.cgi?id=748518
5033    // ====================================================================================
5034
5035    adjustLayout: function (slide) {
5036      var self = this,
5037        current = slide || self.current,
5038        scrollHeight,
5039        marginBottom,
5040        inlinePadding,
5041        actualPadding;
5042
5043      if (current.isLoaded && current.opts.disableLayoutFix !== true) {
5044        current.$content.css("margin-bottom", "");
5045
5046        // If we would always set margin-bottom for the content,
5047        // then it would potentially break vertical align
5048        if (current.$content.outerHeight() > current.$slide.height() + 0.5) {
5049          inlinePadding = current.$slide[0].style["padding-bottom"];
5050          actualPadding = current.$slide.css("padding-bottom");
5051
5052          if (parseFloat(actualPadding) > 0) {
5053            scrollHeight = current.$slide[0].scrollHeight;
5054
5055            current.$slide.css("padding-bottom", 0);
5056
5057            if (Math.abs(scrollHeight - current.$slide[0].scrollHeight) < 1) {
5058              marginBottom = actualPadding;
5059            }
5060
5061            current.$slide.css("padding-bottom", inlinePadding);
5062          }
5063        }
5064
5065        current.$content.css("margin-bottom", marginBottom);
5066      }
5067    },
5068
5069    // Make content visible
5070    // This method is called right after content has been loaded or
5071    // user navigates gallery and transition should start
5072    // ============================================================
5073
5074    revealContent: function (slide) {
5075      var self = this,
5076        $slide = slide.$slide,
5077        end = false,
5078        start = false,
5079        isMoved = self.isMoved(slide),
5080        isRevealed = slide.isRevealed,
5081        effect,
5082        effectClassName,
5083        duration,
5084        opacity;
5085
5086      slide.isRevealed = true;
5087
5088      effect = slide.opts[self.firstRun ? "animationEffect" : "transitionEffect"];
5089      duration = slide.opts[self.firstRun ? "animationDuration" : "transitionDuration"];
5090
5091      duration = parseInt(slide.forcedDuration === undefined ? duration : slide.forcedDuration, 10);
5092
5093      if (isMoved || slide.pos !== self.currPos || !duration) {
5094        effect = false;
5095      }
5096
5097      // Check if can zoom
5098      if (effect === "zoom") {
5099        if (slide.pos === self.currPos && duration && slide.type === "image" && !slide.hasError && (start = self.getThumbPos(slide))) {
5100          end = self.getFitPos(slide);
5101        } else {
5102          effect = "fade";
5103        }
5104      }
5105
5106      // Zoom animation
5107      // ==============
5108      if (effect === "zoom") {
5109        self.isAnimating = true;
5110
5111        end.scaleX = end.width / start.width;
5112        end.scaleY = end.height / start.height;
5113
5114        // Check if we need to animate opacity
5115        opacity = slide.opts.zoomOpacity;
5116
5117        if (opacity == "auto") {
5118          opacity = Math.abs(slide.width / slide.height - start.width / start.height) > 0.1;
5119        }
5120
5121        if (opacity) {
5122          start.opacity = 0.1;
5123          end.opacity = 1;
5124        }
5125
5126        // Draw image at start position
5127        $.fancybox.setTranslate(slide.$content.removeClass("fancybox-is-hidden"), start);
5128
5129        forceRedraw(slide.$content);
5130
5131        // Start animation
5132        $.fancybox.animate(slide.$content, end, duration, function () {
5133          self.isAnimating = false;
5134
5135          self.complete();
5136        });
5137
5138        return;
5139      }
5140
5141      self.updateSlide(slide);
5142
5143      // Simply show content if no effect
5144      // ================================
5145      if (!effect) {
5146        slide.$content.removeClass("fancybox-is-hidden");
5147
5148        if (!isRevealed && isMoved && slide.type === "image" && !slide.hasError) {
5149          slide.$content.hide().fadeIn("fast");
5150        }
5151
5152        if (slide.pos === self.currPos) {
5153          self.complete();
5154        }
5155
5156        return;
5157      }
5158
5159      // Prepare for CSS transiton
5160      // =========================
5161      $.fancybox.stop($slide);
5162
5163      //effectClassName = "fancybox-animated fancybox-slide--" + (slide.pos >= self.prevPos ? "next" : "previous") + " fancybox-fx-" + effect;
5164      effectClassName = "fancybox-slide--" + (slide.pos >= self.prevPos ? "next" : "previous") + " fancybox-animated fancybox-fx-" + effect;
5165
5166      $slide.addClass(effectClassName).removeClass("fancybox-slide--current"); //.addClass(effectClassName);
5167
5168      slide.$content.removeClass("fancybox-is-hidden");
5169
5170      // Force reflow
5171      forceRedraw($slide);
5172
5173      if (slide.type !== "image") {
5174        slide.$content.hide().show(0);
5175      }
5176
5177      $.fancybox.animate(
5178        $slide,
5179        "fancybox-slide--current",
5180        duration,
5181        function () {
5182          $slide.removeClass(effectClassName).css({
5183            transform: "",
5184            opacity: ""
5185          });
5186
5187          if (slide.pos === self.currPos) {
5188            self.complete();
5189          }
5190        },
5191        true
5192      );
5193    },
5194
5195    // Check if we can and have to zoom from thumbnail
5196    //================================================
5197
5198    getThumbPos: function (slide) {
5199      var rez = false,
5200        $thumb = slide.$thumb,
5201        thumbPos,
5202        btw,
5203        brw,
5204        bbw,
5205        blw;
5206
5207      if (!$thumb || !inViewport($thumb[0])) {
5208        return false;
5209      }
5210
5211      thumbPos = $.fancybox.getTranslate($thumb);
5212
5213      btw = parseFloat($thumb.css("border-top-width") || 0);
5214      brw = parseFloat($thumb.css("border-right-width") || 0);
5215      bbw = parseFloat($thumb.css("border-bottom-width") || 0);
5216      blw = parseFloat($thumb.css("border-left-width") || 0);
5217
5218      rez = {
5219        top: thumbPos.top + btw,
5220        left: thumbPos.left + blw,
5221        width: thumbPos.width - brw - blw,
5222        height: thumbPos.height - btw - bbw,
5223        scaleX: 1,
5224        scaleY: 1
5225      };
5226
5227      return thumbPos.width > 0 && thumbPos.height > 0 ? rez : false;
5228    },
5229
5230    // Final adjustments after current gallery item is moved to position
5231    // and it`s content is loaded
5232    // ==================================================================
5233
5234    complete: function () {
5235      var self = this,
5236        current = self.current,
5237        slides = {},
5238        $el;
5239
5240      if (self.isMoved() || !current.isLoaded) {
5241        return;
5242      }
5243
5244      if (!current.isComplete) {
5245        current.isComplete = true;
5246
5247        current.$slide.siblings().trigger("onReset");
5248
5249        self.preload("inline");
5250
5251        // Trigger any CSS transiton inside the slide
5252        forceRedraw(current.$slide);
5253
5254        current.$slide.addClass("fancybox-slide--complete");
5255
5256        // Remove unnecessary slides
5257        $.each(self.slides, function (key, slide) {
5258          if (slide.pos >= self.currPos - 1 && slide.pos <= self.currPos + 1) {
5259            slides[slide.pos] = slide;
5260          } else if (slide) {
5261            $.fancybox.stop(slide.$slide);
5262
5263            slide.$slide.off().remove();
5264          }
5265        });
5266
5267        self.slides = slides;
5268      }
5269
5270      self.isAnimating = false;
5271
5272      self.updateCursor();
5273
5274      self.trigger("afterShow");
5275
5276      // Autoplay first html5 video/audio
5277      if (!!current.opts.video.autoStart) {
5278        current.$slide
5279          .find("video,audio")
5280          .filter(":visible:first")
5281          .trigger("play")
5282          .one("ended", function () {
5283            if (Document.exitFullscreen) {
5284              Document.exitFullscreen();
5285            } else if (this.webkitExitFullscreen) {
5286              this.webkitExitFullscreen();
5287            }
5288
5289            self.next();
5290          });
5291      }
5292
5293      // Try to focus on the first focusable element
5294      if (current.opts.autoFocus && current.contentType === "html") {
5295        // Look for the first input with autofocus attribute
5296        $el = current.$content.find("input[autofocus]:enabled:visible:first");
5297
5298        if ($el.length) {
5299          $el.trigger("focus");
5300        } else {
5301          self.focus(null, true);
5302        }
5303      }
5304
5305      // Avoid jumping
5306      current.$slide.scrollTop(0).scrollLeft(0);
5307    },
5308
5309    // Preload next and previous slides
5310    // ================================
5311
5312    preload: function (type) {
5313      var self = this,
5314        prev,
5315        next;
5316
5317      if (self.group.length < 2) {
5318        return;
5319      }
5320
5321      next = self.slides[self.currPos + 1];
5322      prev = self.slides[self.currPos - 1];
5323
5324      if (prev && prev.type === type) {
5325        self.loadSlide(prev);
5326      }
5327
5328      if (next && next.type === type) {
5329        self.loadSlide(next);
5330      }
5331    },
5332
5333    // Try to find and focus on the first focusable element
5334    // ====================================================
5335
5336    focus: function (e, firstRun) {
5337      var self = this,
5338        focusableStr = [
5339          "a[href]",
5340          "area[href]",
5341          'input:not([disabled]):not([type="hidden"]):not([aria-hidden])',
5342          "select:not([disabled]):not([aria-hidden])",
5343          "textarea:not([disabled]):not([aria-hidden])",
5344          "button:not([disabled]):not([aria-hidden])",
5345          "iframe",
5346          "object",
5347          "embed",
5348          "video",
5349          "audio",
5350          "[contenteditable]",
5351          '[tabindex]:not([tabindex^="-"])'
5352        ].join(","),
5353        focusableItems,
5354        focusedItemIndex;
5355
5356      if (self.isClosing) {
5357        return;
5358      }
5359
5360      if (e || !self.current || !self.current.isComplete) {
5361        // Focus on any element inside fancybox
5362        focusableItems = self.$refs.container.find("*:visible");
5363      } else {
5364        // Focus inside current slide
5365        focusableItems = self.current.$slide.find("*:visible" + (firstRun ? ":not(.fancybox-close-small)" : ""));
5366      }
5367
5368      focusableItems = focusableItems.filter(focusableStr).filter(function () {
5369        return $(this).css("visibility") !== "hidden" && !$(this).hasClass("disabled");
5370      });
5371
5372      if (focusableItems.length) {
5373        focusedItemIndex = focusableItems.index(document.activeElement);
5374
5375        if (e && e.shiftKey) {
5376          // Back tab
5377          if (focusedItemIndex < 0 || focusedItemIndex == 0) {
5378            e.preventDefault();
5379
5380            focusableItems.eq(focusableItems.length - 1).trigger("focus");
5381          }
5382        } else {
5383          // Outside or Forward tab
5384          if (focusedItemIndex < 0 || focusedItemIndex == focusableItems.length - 1) {
5385            if (e) {
5386              e.preventDefault();
5387            }
5388
5389            focusableItems.eq(0).trigger("focus");
5390          }
5391        }
5392      } else {
5393        self.$refs.container.trigger("focus");
5394      }
5395    },
5396
5397    // Activates current instance - brings container to the front and enables keyboard,
5398    // notifies other instances about deactivating
5399    // =================================================================================
5400
5401    activate: function () {
5402      var self = this;
5403
5404      // Deactivate all instances
5405      $(".fancybox-container").each(function () {
5406        var instance = $(this).data("FancyBox");
5407
5408        // Skip self and closing instances
5409        if (instance && instance.id !== self.id && !instance.isClosing) {
5410          instance.trigger("onDeactivate");
5411
5412          instance.removeEvents();
5413
5414          instance.isVisible = false;
5415        }
5416      });
5417
5418      self.isVisible = true;
5419
5420      if (self.current || self.isIdle) {
5421        self.update();
5422
5423        self.updateControls();
5424      }
5425
5426      self.trigger("onActivate");
5427
5428      self.addEvents();
5429    },
5430
5431    // Start closing procedure
5432    // This will start "zoom-out" animation if needed and clean everything up afterwards
5433    // =================================================================================
5434
5435    close: function (e, d) {
5436      var self = this,
5437        current = self.current,
5438        effect,
5439        duration,
5440        $content,
5441        domRect,
5442        opacity,
5443        start,
5444        end;
5445
5446      var done = function () {
5447        self.cleanUp(e);
5448      };
5449
5450      if (self.isClosing) {
5451        return false;
5452      }
5453
5454      self.isClosing = true;
5455
5456      // If beforeClose callback prevents closing, make sure content is centered
5457      if (self.trigger("beforeClose", e) === false) {
5458        self.isClosing = false;
5459
5460        requestAFrame(function () {
5461          self.update();
5462        });
5463
5464        return false;
5465      }
5466
5467      // Remove all events
5468      // If there are multiple instances, they will be set again by "activate" method
5469      self.removeEvents();
5470
5471      $content = current.$content;
5472      effect = current.opts.animationEffect;
5473      duration = $.isNumeric(d) ? d : effect ? current.opts.animationDuration : 0;
5474
5475      current.$slide.removeClass("fancybox-slide--complete fancybox-slide--next fancybox-slide--previous fancybox-animated");
5476
5477      if (e !== true) {
5478        $.fancybox.stop(current.$slide);
5479      } else {
5480        effect = false;
5481      }
5482
5483      // Remove other slides
5484      current.$slide
5485        .siblings()
5486        .trigger("onReset")
5487        .remove();
5488
5489      // Trigger animations
5490      if (duration) {
5491        self.$refs.container
5492          .removeClass("fancybox-is-open")
5493          .addClass("fancybox-is-closing")
5494          .css("transition-duration", duration + "ms");
5495      }
5496
5497      // Clean up
5498      self.hideLoading(current);
5499
5500      self.hideControls(true);
5501
5502      self.updateCursor();
5503
5504      // Check if possible to zoom-out
5505      if (
5506        effect === "zoom" &&
5507        !($content && duration && current.type === "image" && !self.isMoved() && !current.hasError && (end = self.getThumbPos(current)))
5508      ) {
5509        effect = "fade";
5510      }
5511
5512      if (effect === "zoom") {
5513        $.fancybox.stop($content);
5514
5515        domRect = $.fancybox.getTranslate($content);
5516
5517        start = {
5518          top: domRect.top,
5519          left: domRect.left,
5520          scaleX: domRect.width / end.width,
5521          scaleY: domRect.height / end.height,
5522          width: end.width,
5523          height: end.height
5524        };
5525
5526        // Check if we need to animate opacity
5527        opacity = current.opts.zoomOpacity;
5528
5529        if (opacity == "auto") {
5530          opacity = Math.abs(current.width / current.height - end.width / end.height) > 0.1;
5531        }
5532
5533        if (opacity) {
5534          end.opacity = 0;
5535        }
5536
5537        $.fancybox.setTranslate($content, start);
5538
5539        forceRedraw($content);
5540
5541        $.fancybox.animate($content, end, duration, done);
5542
5543        return true;
5544      }
5545
5546      if (effect && duration) {
5547        $.fancybox.animate(
5548          current.$slide.addClass("fancybox-slide--previous").removeClass("fancybox-slide--current"),
5549          "fancybox-animated fancybox-fx-" + effect,
5550          duration,
5551          done
5552        );
5553      } else {
5554        // If skip animation
5555        if (e === true) {
5556          setTimeout(done, duration);
5557        } else {
5558          done();
5559        }
5560      }
5561
5562      return true;
5563    },
5564
5565    // Final adjustments after removing the instance
5566    // =============================================
5567
5568    cleanUp: function (e) {
5569      var self = this,
5570        instance,
5571        $focus = self.current.opts.$orig,
5572        x,
5573        y;
5574
5575      self.current.$slide.trigger("onReset");
5576
5577      self.$refs.container.empty().remove();
5578
5579      self.trigger("afterClose", e);
5580
5581      // Place back focus
5582      if (!!self.current.opts.backFocus) {
5583        if (!$focus || !$focus.length || !$focus.is(":visible")) {
5584          $focus = self.$trigger;
5585        }
5586
5587        if ($focus && $focus.length) {
5588          x = window.scrollX;
5589          y = window.scrollY;
5590
5591          $focus.trigger("focus");
5592
5593          $("html, body")
5594            .scrollTop(y)
5595            .scrollLeft(x);
5596        }
5597      }
5598
5599      self.current = null;
5600
5601      // Check if there are other instances
5602      instance = $.fancybox.getInstance();
5603
5604      if (instance) {
5605        instance.activate();
5606      } else {
5607        $("body").removeClass("fancybox-active compensate-for-scrollbar");
5608
5609        $("#fancybox-style-noscroll").remove();
5610      }
5611    },
5612
5613    // Call callback and trigger an event
5614    // ==================================
5615
5616    trigger: function (name, slide) {
5617      var args = Array.prototype.slice.call(arguments, 1),
5618        self = this,
5619        obj = slide && slide.opts ? slide : self.current,
5620        rez;
5621
5622      if (obj) {
5623        args.unshift(obj);
5624      } else {
5625        obj = self;
5626      }
5627
5628      args.unshift(self);
5629
5630      if ($.isFunction(obj.opts[name])) {
5631        rez = obj.opts[name].apply(obj, args);
5632      }
5633
5634      if (rez === false) {
5635        return rez;
5636      }
5637
5638      if (name === "afterClose" || !self.$refs) {
5639        $D.trigger(name + ".fb", args);
5640      } else {
5641        self.$refs.container.trigger(name + ".fb", args);
5642      }
5643    },
5644
5645    // Update infobar values, navigation button states and reveal caption
5646    // ==================================================================
5647
5648    updateControls: function () {
5649      var self = this,
5650        current = self.current,
5651        index = current.index,
5652        $container = self.$refs.container,
5653        $caption = self.$refs.caption,
5654        caption = current.opts.caption;
5655
5656      // Recalculate content dimensions
5657      current.$slide.trigger("refresh");
5658
5659      // Set caption
5660      if (caption && caption.length) {
5661        self.$caption = $caption;
5662
5663        $caption
5664          .children()
5665          .eq(0)
5666          .html(caption);
5667      } else {
5668        self.$caption = null;
5669      }
5670
5671      if (!self.hasHiddenControls && !self.isIdle) {
5672        self.showControls();
5673      }
5674
5675      // Update info and navigation elements
5676      $container.find("[data-fancybox-count]").html(self.group.length);
5677      $container.find("[data-fancybox-index]").html(index + 1);
5678
5679      $container.find("[data-fancybox-prev]").prop("disabled", !current.opts.loop && index <= 0);
5680      $container.find("[data-fancybox-next]").prop("disabled", !current.opts.loop && index >= self.group.length - 1);
5681
5682      if (current.type === "image") {
5683        // Re-enable buttons; update download button source
5684        $container
5685          .find("[data-fancybox-zoom]")
5686          .show()
5687          .end()
5688          .find("[data-fancybox-download]")
5689          .attr("href", current.opts.image.src || current.src)
5690          .show();
5691      } else if (current.opts.toolbar) {
5692        $container.find("[data-fancybox-download],[data-fancybox-zoom]").hide();
5693      }
5694
5695      // Make sure focus is not on disabled button/element
5696      if ($(document.activeElement).is(":hidden,[disabled]")) {
5697        self.$refs.container.trigger("focus");
5698      }
5699    },
5700
5701    // Hide toolbar and caption
5702    // ========================
5703
5704    hideControls: function (andCaption) {
5705      var self = this,
5706        arr = ["infobar", "toolbar", "nav"];
5707
5708      if (andCaption || !self.current.opts.preventCaptionOverlap) {
5709        arr.push("caption");
5710      }
5711
5712      this.$refs.container.removeClass(
5713        arr
5714        .map(function (i) {
5715          return "fancybox-show-" + i;
5716        })
5717        .join(" ")
5718      );
5719
5720      this.hasHiddenControls = true;
5721    },
5722
5723    showControls: function () {
5724      var self = this,
5725        opts = self.current ? self.current.opts : self.opts,
5726        $container = self.$refs.container;
5727
5728      self.hasHiddenControls = false;
5729      self.idleSecondsCounter = 0;
5730
5731      $container
5732        .toggleClass("fancybox-show-toolbar", !!(opts.toolbar && opts.buttons))
5733        .toggleClass("fancybox-show-infobar", !!(opts.infobar && self.group.length > 1))
5734        .toggleClass("fancybox-show-caption", !!self.$caption)
5735        .toggleClass("fancybox-show-nav", !!(opts.arrows && self.group.length > 1))
5736        .toggleClass("fancybox-is-modal", !!opts.modal);
5737    },
5738
5739    // Toggle toolbar and caption
5740    // ==========================
5741
5742    toggleControls: function () {
5743      if (this.hasHiddenControls) {
5744        this.showControls();
5745      } else {
5746        this.hideControls();
5747      }
5748    }
5749  });
5750
5751  $.fancybox = {
5752    version: "3.5.7",
5753    defaults: defaults,
5754
5755    // Get current instance and execute a command.
5756    //
5757    // Examples of usage:
5758    //
5759    //   $instance = $.fancybox.getInstance();
5760    //   $.fancybox.getInstance().jumpTo( 1 );
5761    //   $.fancybox.getInstance( 'jumpTo', 1 );
5762    //   $.fancybox.getInstance( function() {
5763    //       console.info( this.currIndex );
5764    //   });
5765    // ======================================================
5766
5767    getInstance: function (command) {
5768      var instance = $('.fancybox-container:not(".fancybox-is-closing"):last').data("FancyBox"),
5769        args = Array.prototype.slice.call(arguments, 1);
5770
5771      if (instance instanceof FancyBox) {
5772        if ($.type(command) === "string") {
5773          instance[command].apply(instance, args);
5774        } else if ($.type(command) === "function") {
5775          command.apply(instance, args);
5776        }
5777
5778        return instance;
5779      }
5780
5781      return false;
5782    },
5783
5784    // Create new instance
5785    // ===================
5786
5787    open: function (items, opts, index) {
5788      return new FancyBox(items, opts, index);
5789    },
5790
5791    // Close current or all instances
5792    // ==============================
5793
5794    close: function (all) {
5795      var instance = this.getInstance();
5796
5797      if (instance) {
5798        instance.close();
5799
5800        // Try to find and close next instance
5801        if (all === true) {
5802          this.close(all);
5803        }
5804      }
5805    },
5806
5807    // Close all instances and unbind all events
5808    // =========================================
5809
5810    destroy: function () {
5811      this.close(true);
5812
5813      $D.add("body").off("click.fb-start", "**");
5814    },
5815
5816    // Try to detect mobile devices
5817    // ============================
5818
5819    isMobile: /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),
5820
5821    // Detect if 'translate3d' support is available
5822    // ============================================
5823
5824    use3d: (function () {
5825      var div = document.createElement("div");
5826
5827      return (
5828        window.getComputedStyle &&
5829        window.getComputedStyle(div) &&
5830        window.getComputedStyle(div).getPropertyValue("transform") &&
5831        !(document.documentMode && document.documentMode < 11)
5832      );
5833    })(),
5834
5835    // Helper function to get current visual state of an element
5836    // returns array[ top, left, horizontal-scale, vertical-scale, opacity ]
5837    // =====================================================================
5838
5839    getTranslate: function ($el) {
5840      var domRect;
5841
5842      if (!$el || !$el.length) {
5843        return false;
5844      }
5845
5846      domRect = $el[0].getBoundingClientRect();
5847
5848      return {
5849        top: domRect.top || 0,
5850        left: domRect.left || 0,
5851        width: domRect.width,
5852        height: domRect.height,
5853        opacity: parseFloat($el.css("opacity"))
5854      };
5855    },
5856
5857    // Shortcut for setting "translate3d" properties for element
5858    // Can set be used to set opacity, too
5859    // ========================================================
5860
5861    setTranslate: function ($el, props) {
5862      var str = "",
5863        css = {};
5864
5865      if (!$el || !props) {
5866        return;
5867      }
5868
5869      if (props.left !== undefined || props.top !== undefined) {
5870        str =
5871          (props.left === undefined ? $el.position().left : props.left) +
5872          "px, " +
5873          (props.top === undefined ? $el.position().top : props.top) +
5874          "px";
5875
5876        if (this.use3d) {
5877          str = "translate3d(" + str + ", 0px)";
5878        } else {
5879          str = "translate(" + str + ")";
5880        }
5881      }
5882
5883      if (props.scaleX !== undefined && props.scaleY !== undefined) {
5884        str += " scale(" + props.scaleX + ", " + props.scaleY + ")";
5885      } else if (props.scaleX !== undefined) {
5886        str += " scaleX(" + props.scaleX + ")";
5887      }
5888
5889      if (str.length) {
5890        css.transform = str;
5891      }
5892
5893      if (props.opacity !== undefined) {
5894        css.opacity = props.opacity;
5895      }
5896
5897      if (props.width !== undefined) {
5898        css.width = props.width;
5899      }
5900
5901      if (props.height !== undefined) {
5902        css.height = props.height;
5903      }
5904
5905      return $el.css(css);
5906    },
5907
5908    // Simple CSS transition handler
5909    // =============================
5910
5911    animate: function ($el, to, duration, callback, leaveAnimationName) {
5912      var self = this,
5913        from;
5914
5915      if ($.isFunction(duration)) {
5916        callback = duration;
5917        duration = null;
5918      }
5919
5920      self.stop($el);
5921
5922      from = self.getTranslate($el);
5923
5924      $el.on(transitionEnd, function (e) {
5925        // Skip events from child elements and z-index change
5926        if (e && e.originalEvent && (!$el.is(e.originalEvent.target) || e.originalEvent.propertyName == "z-index")) {
5927          return;
5928        }
5929
5930        self.stop($el);
5931
5932        if ($.isNumeric(duration)) {
5933          $el.css("transition-duration", "");
5934        }
5935
5936        if ($.isPlainObject(to)) {
5937          if (to.scaleX !== undefined && to.scaleY !== undefined) {
5938            self.setTranslate($el, {
5939              top: to.top,
5940              left: to.left,
5941              width: from.width * to.scaleX,
5942              height: from.height * to.scaleY,
5943              scaleX: 1,
5944              scaleY: 1
5945            });
5946          }
5947        } else if (leaveAnimationName !== true) {
5948          $el.removeClass(to);
5949        }
5950
5951        if ($.isFunction(callback)) {
5952          callback(e);
5953        }
5954      });
5955
5956      if ($.isNumeric(duration)) {
5957        $el.css("transition-duration", duration + "ms");
5958      }
5959
5960      // Start animation by changing CSS properties or class name
5961      if ($.isPlainObject(to)) {
5962        if (to.scaleX !== undefined && to.scaleY !== undefined) {
5963          delete to.width;
5964          delete to.height;
5965
5966          if ($el.parent().hasClass("fancybox-slide--image")) {
5967            $el.parent().addClass("fancybox-is-scaling");
5968          }
5969        }
5970
5971        $.fancybox.setTranslate($el, to);
5972      } else {
5973        $el.addClass(to);
5974      }
5975
5976      // Make sure that `transitionend` callback gets fired
5977      $el.data(
5978        "timer",
5979        setTimeout(function () {
5980          $el.trigger(transitionEnd);
5981        }, duration + 33)
5982      );
5983    },
5984
5985    stop: function ($el, callCallback) {
5986      if ($el && $el.length) {
5987        clearTimeout($el.data("timer"));
5988
5989        if (callCallback) {
5990          $el.trigger(transitionEnd);
5991        }
5992
5993        $el.off(transitionEnd).css("transition-duration", "");
5994
5995        $el.parent().removeClass("fancybox-is-scaling");
5996      }
5997    }
5998  };
5999
6000  // Default click handler for "fancyboxed" links
6001  // ============================================
6002
6003  function _run(e, opts) {
6004    var items = [],
6005      index = 0,
6006      $target,
6007      value,
6008      instance;
6009
6010    // Avoid opening multiple times
6011    if (e && e.isDefaultPrevented()) {
6012      return;
6013    }
6014
6015    e.preventDefault();
6016
6017    opts = opts || {};
6018
6019    if (e && e.data) {
6020      opts = mergeOpts(e.data.options, opts);
6021    }
6022
6023    $target = opts.$target || $(e.currentTarget).trigger("blur");
6024    instance = $.fancybox.getInstance();
6025
6026    if (instance && instance.$trigger && instance.$trigger.is($target)) {
6027      return;
6028    }
6029
6030    if (opts.selector) {
6031      items = $(opts.selector);
6032    } else {
6033      // Get all related items and find index for clicked one
6034      value = $target.attr("data-fancybox") || "";
6035
6036      if (value) {
6037        items = e.data ? e.data.items : [];
6038        items = items.length ? items.filter('[data-fancybox="' + value + '"]') : $('[data-fancybox="' + value + '"]');
6039      } else {
6040        items = [$target];
6041      }
6042    }
6043
6044    index = $(items).index($target);
6045
6046    // Sometimes current item can not be found
6047    if (index < 0) {
6048      index = 0;
6049    }
6050
6051    instance = $.fancybox.open(items, opts, index);
6052
6053    // Save last active element
6054    instance.$trigger = $target;
6055  }
6056
6057  // Create a jQuery plugin
6058  // ======================
6059
6060  $.fn.fancybox = function (options) {
6061    var selector;
6062
6063    options = options || {};
6064    selector = options.selector || false;
6065
6066    if (selector) {
6067      // Use body element instead of document so it executes first
6068      $("body")
6069        .off("click.fb-start", selector)
6070        .on("click.fb-start", selector, {
6071          options: options
6072        }, _run);
6073    } else {
6074      this.off("click.fb-start").on(
6075        "click.fb-start", {
6076          items: this,
6077          options: options
6078        },
6079        _run
6080      );
6081    }
6082
6083    return this;
6084  };
6085
6086  // Self initializing plugin for all elements having `data-fancybox` attribute
6087  // ==========================================================================
6088
6089  $D.on("click.fb-start", "[data-fancybox]", _run);
6090
6091  // Enable "trigger elements"
6092  // =========================
6093
6094  $D.on("click.fb-start", "[data-fancybox-trigger]", function (e) {
6095    $('[data-fancybox="' + $(this).attr("data-fancybox-trigger") + '"]')
6096      .eq($(this).attr("data-fancybox-index") || 0)
6097      .trigger("click.fb-start", {
6098        $trigger: $(this)
6099      });
6100  });
6101
6102  // Track focus event for better accessibility styling
6103  // ==================================================
6104  (function () {
6105    var buttonStr = ".fancybox-button",
6106      focusStr = "fancybox-focus",
6107      $pressed = null;
6108
6109    $D.on("mousedown mouseup focus blur", buttonStr, function (e) {
6110      switch (e.type) {
6111        case "mousedown":
6112          $pressed = $(this);
6113          break;
6114        case "mouseup":
6115          $pressed = null;
6116          break;
6117        case "focusin":
6118          $(buttonStr).removeClass(focusStr);
6119
6120          if (!$(this).is($pressed) && !$(this).is("[disabled]")) {
6121            $(this).addClass(focusStr);
6122          }
6123          break;
6124        case "focusout":
6125          $(buttonStr).removeClass(focusStr);
6126          break;
6127      }
6128    });
6129  })();
6130})(window, document, jQuery);
6131// ==========================================================================
6132//
6133// Media
6134// Adds additional media type support
6135//
6136// ==========================================================================
6137(function ($) {
6138  "use strict";
6139
6140  // Object containing properties for each media type
6141  var defaults = {
6142    youtube: {
6143      matcher: /(youtube\.com|youtu\.be|youtube\-nocookie\.com)\/(watch\?(.*&)?v=|v\/|u\/|embed\/?)?(videoseries\?list=(.*)|[\w-]{11}|\?listType=(.*)&list=(.*))(.*)/i,
6144      params: {
6145        autoplay: 1,
6146        autohide: 1,
6147        fs: 1,
6148        rel: 0,
6149        hd: 1,
6150        wmode: "transparent",
6151        enablejsapi: 1,
6152        html5: 1
6153      },
6154      paramPlace: 8,
6155      type: "iframe",
6156      url: "https://www.youtube-nocookie.com/embed/$4",
6157      thumb: "https://img.youtube.com/vi/$4/hqdefault.jpg"
6158    },
6159
6160    vimeo: {
6161      matcher: /^.+vimeo.com\/(.*\/)?([\d]+)(.*)?/,
6162      params: {
6163        autoplay: 1,
6164        hd: 1,
6165        show_title: 1,
6166        show_byline: 1,
6167        show_portrait: 0,
6168        fullscreen: 1
6169      },
6170      paramPlace: 3,
6171      type: "iframe",
6172      url: "//player.vimeo.com/video/$2"
6173    },
6174
6175    instagram: {
6176      matcher: /(instagr\.am|instagram\.com)\/p\/([a-zA-Z0-9_\-]+)\/?/i,
6177      type: "image",
6178      url: "//$1/p/$2/media/?size=l"
6179    },
6180
6181    // Examples:
6182    // http://maps.google.com/?ll=48.857995,2.294297&spn=0.007666,0.021136&t=m&z=16
6183    // https://www.google.com/maps/@37.7852006,-122.4146355,14.65z
6184    // https://www.google.com/maps/@52.2111123,2.9237542,6.61z?hl=en
6185    // https://www.google.com/maps/place/Googleplex/@37.4220041,-122.0833494,17z/data=!4m5!3m4!1s0x0:0x6c296c66619367e0!8m2!3d37.4219998!4d-122.0840572
6186    gmap_place: {
6187      matcher: /(maps\.)?google\.([a-z]{2,3}(\.[a-z]{2})?)\/(((maps\/(place\/(.*)\/)?\@(.*),(\d+.?\d+?)z))|(\?ll=))(.*)?/i,
6188      type: "iframe",
6189      url: function (rez) {
6190        return (
6191          "//maps.google." +
6192          rez[2] +
6193          "/?ll=" +
6194          (rez[9] ? rez[9] + "&z=" + Math.floor(rez[10]) + (rez[12] ? rez[12].replace(/^\//, "&") : "") : rez[12] + "").replace(/\?/, "&") +
6195          "&output=" +
6196          (rez[12] && rez[12].indexOf("layer=c") > 0 ? "svembed" : "embed")
6197        );
6198      }
6199    },
6200
6201    // Examples:
6202    // https://www.google.com/maps/search/Empire+State+Building/
6203    // https://www.google.com/maps/search/?api=1&query=centurylink+field
6204    // https://www.google.com/maps/search/?api=1&query=47.5951518,-122.3316393
6205    gmap_search: {
6206      matcher: /(maps\.)?google\.([a-z]{2,3}(\.[a-z]{2})?)\/(maps\/search\/)(.*)/i,
6207      type: "iframe",
6208      url: function (rez) {
6209        return "//maps.google." + rez[2] + "/maps?q=" + rez[5].replace("query=", "q=").replace("api=1", "") + "&output=embed";
6210      }
6211    }
6212  };
6213
6214  // Formats matching url to final form
6215  var format = function (url, rez, params) {
6216    if (!url) {
6217      return;
6218    }
6219
6220    params = params || "";
6221
6222    if ($.type(params) === "object") {
6223      params = $.param(params, true);
6224    }
6225
6226    $.each(rez, function (key, value) {
6227      url = url.replace("$" + key, value || "");
6228    });
6229
6230    if (params.length) {
6231      url += (url.indexOf("?") > 0 ? "&" : "?") + params;
6232    }
6233
6234    return url;
6235  };
6236
6237  $(document).on("objectNeedsType.fb", function (e, instance, item) {
6238    var url = item.src || "",
6239      type = false,
6240      media,
6241      thumb,
6242      rez,
6243      params,
6244      urlParams,
6245      paramObj,
6246      provider;
6247
6248    media = $.extend(true, {}, defaults, item.opts.media);
6249
6250    // Look for any matching media type
6251    $.each(media, function (providerName, providerOpts) {
6252      rez = url.match(providerOpts.matcher);
6253
6254      if (!rez) {
6255        return;
6256      }
6257
6258      type = providerOpts.type;
6259      provider = providerName;
6260      paramObj = {};
6261
6262      if (providerOpts.paramPlace && rez[providerOpts.paramPlace]) {
6263        urlParams = rez[providerOpts.paramPlace];
6264
6265        if (urlParams[0] == "?") {
6266          urlParams = urlParams.substring(1);
6267        }
6268
6269        urlParams = urlParams.split("&");
6270
6271        for (var m = 0; m < urlParams.length; ++m) {
6272          var p = urlParams[m].split("=", 2);
6273
6274          if (p.length == 2) {
6275            paramObj[p[0]] = decodeURIComponent(p[1].replace(/\+/g, " "));
6276          }
6277        }
6278      }
6279
6280      params = $.extend(true, {}, providerOpts.params, item.opts[providerName], paramObj);
6281
6282      url =
6283        $.type(providerOpts.url) === "function" ? providerOpts.url.call(this, rez, params, item) : format(providerOpts.url, rez, params);
6284
6285      thumb =
6286        $.type(providerOpts.thumb) === "function" ? providerOpts.thumb.call(this, rez, params, item) : format(providerOpts.thumb, rez);
6287
6288      if (providerName === "youtube") {
6289        url = url.replace(/&t=((\d+)m)?(\d+)s/, function (match, p1, m, s) {
6290          return "&start=" + ((m ? parseInt(m, 10) * 60 : 0) + parseInt(s, 10));
6291        });
6292      } else if (providerName === "vimeo") {
6293        url = url.replace("&%23", "#");
6294      }
6295
6296      return false;
6297    });
6298
6299    // If it is found, then change content type and update the url
6300
6301    if (type) {
6302      if (!item.opts.thumb && !(item.opts.$thumb && item.opts.$thumb.length)) {
6303        item.opts.thumb = thumb;
6304      }
6305
6306      if (type === "iframe") {
6307        item.opts = $.extend(true, item.opts, {
6308          iframe: {
6309            preload: false,
6310            attr: {
6311              scrolling: "no"
6312            }
6313          }
6314        });
6315      }
6316
6317      $.extend(item, {
6318        type: type,
6319        src: url,
6320        origSrc: item.src,
6321        contentSource: provider,
6322        contentType: type === "image" ? "image" : provider == "gmap_place" || provider == "gmap_search" ? "map" : "video"
6323      });
6324    } else if (url) {
6325      item.type = item.opts.defaultType;
6326    }
6327  });
6328
6329  // Load YouTube/Video API on request to detect when video finished playing
6330  var VideoAPILoader = {
6331    youtube: {
6332      src: "https://www.youtube.com/iframe_api",
6333      class: "YT",
6334      loading: false,
6335      loaded: false
6336    },
6337
6338    vimeo: {
6339      src: "https://player.vimeo.com/api/player.js",
6340      class: "Vimeo",
6341      loading: false,
6342      loaded: false
6343    },
6344
6345    load: function (vendor) {
6346      var _this = this,
6347        script;
6348
6349      if (this[vendor].loaded) {
6350        setTimeout(function () {
6351          _this.done(vendor);
6352        });
6353        return;
6354      }
6355
6356      if (this[vendor].loading) {
6357        return;
6358      }
6359
6360      this[vendor].loading = true;
6361
6362      script = document.createElement("script");
6363      script.type = "text/javascript";
6364      script.src = this[vendor].src;
6365
6366      if (vendor === "youtube") {
6367        window.onYouTubeIframeAPIReady = function () {
6368          _this[vendor].loaded = true;
6369          _this.done(vendor);
6370        };
6371      } else {
6372        script.onload = function () {
6373          _this[vendor].loaded = true;
6374          _this.done(vendor);
6375        };
6376      }
6377
6378      document.body.appendChild(script);
6379    },
6380    done: function (vendor) {
6381      var instance, $el, player;
6382
6383      if (vendor === "youtube") {
6384        delete window.onYouTubeIframeAPIReady;
6385      }
6386
6387      instance = $.fancybox.getInstance();
6388
6389      if (instance) {
6390        $el = instance.current.$content.find("iframe");
6391
6392        if (vendor === "youtube" && YT !== undefined && YT) {
6393          player = new YT.Player($el.attr("id"), {
6394            events: {
6395              onStateChange: function (e) {
6396                if (e.data == 0) {
6397                  instance.next();
6398                }
6399              }
6400            }
6401          });
6402        } else if (vendor === "vimeo" && Vimeo !== undefined && Vimeo) {
6403          player = new Vimeo.Player($el);
6404
6405          player.on("ended", function () {
6406            instance.next();
6407          });
6408        }
6409      }
6410    }
6411  };
6412
6413  $(document).on({
6414    "afterShow.fb": function (e, instance, current) {
6415      if (instance.group.length > 1 && (current.contentSource === "youtube" || current.contentSource === "vimeo")) {
6416        VideoAPILoader.load(current.contentSource);
6417      }
6418    }
6419  });
6420})(jQuery);
6421// ==========================================================================
6422//
6423// Guestures
6424// Adds touch guestures, handles click and tap events
6425//
6426// ==========================================================================
6427(function (window, document, $) {
6428  "use strict";
6429
6430  var requestAFrame = (function () {
6431    return (
6432      window.requestAnimationFrame ||
6433      window.webkitRequestAnimationFrame ||
6434      window.mozRequestAnimationFrame ||
6435      window.oRequestAnimationFrame ||
6436      // if all else fails, use setTimeout
6437      function (callback) {
6438        return window.setTimeout(callback, 1000 / 60);
6439      }
6440    );
6441  })();
6442
6443  var cancelAFrame = (function () {
6444    return (
6445      window.cancelAnimationFrame ||
6446      window.webkitCancelAnimationFrame ||
6447      window.mozCancelAnimationFrame ||
6448      window.oCancelAnimationFrame ||
6449      function (id) {
6450        window.clearTimeout(id);
6451      }
6452    );
6453  })();
6454
6455  var getPointerXY = function (e) {
6456    var result = [];
6457
6458    e = e.originalEvent || e || window.e;
6459    e = e.touches && e.touches.length ? e.touches : e.changedTouches && e.changedTouches.length ? e.changedTouches : [e];
6460
6461    for (var key in e) {
6462      if (e[key].pageX) {
6463        result.push({
6464          x: e[key].pageX,
6465          y: e[key].pageY
6466        });
6467      } else if (e[key].clientX) {
6468        result.push({
6469          x: e[key].clientX,
6470          y: e[key].clientY
6471        });
6472      }
6473    }
6474
6475    return result;
6476  };
6477
6478  var distance = function (point2, point1, what) {
6479    if (!point1 || !point2) {
6480      return 0;
6481    }
6482
6483    if (what === "x") {
6484      return point2.x - point1.x;
6485    } else if (what === "y") {
6486      return point2.y - point1.y;
6487    }
6488
6489    return Math.sqrt(Math.pow(point2.x - point1.x, 2) + Math.pow(point2.y - point1.y, 2));
6490  };
6491
6492  var isClickable = function ($el) {
6493    if (
6494      $el.is('a,area,button,[role="button"],input,label,select,summary,textarea,video,audio,iframe') ||
6495      $.isFunction($el.get(0).onclick) ||
6496      $el.data("selectable")
6497    ) {
6498      return true;
6499    }
6500
6501    // Check for attributes like data-fancybox-next or data-fancybox-close
6502    for (var i = 0, atts = $el[0].attributes, n = atts.length; i < n; i++) {
6503      if (atts[i].nodeName.substr(0, 14) === "data-fancybox-") {
6504        return true;
6505      }
6506    }
6507
6508    return false;
6509  };
6510
6511  var hasScrollbars = function (el) {
6512    var overflowY = window.getComputedStyle(el)["overflow-y"],
6513      overflowX = window.getComputedStyle(el)["overflow-x"],
6514      vertical = (overflowY === "scroll" || overflowY === "auto") && el.scrollHeight > el.clientHeight,
6515      horizontal = (overflowX === "scroll" || overflowX === "auto") && el.scrollWidth > el.clientWidth;
6516
6517    return vertical || horizontal;
6518  };
6519
6520  var isScrollable = function ($el) {
6521    var rez = false;
6522
6523    while (true) {
6524      rez = hasScrollbars($el.get(0));
6525
6526      if (rez) {
6527        break;
6528      }
6529
6530      $el = $el.parent();
6531
6532      if (!$el.length || $el.hasClass("fancybox-stage") || $el.is("body")) {
6533        break;
6534      }
6535    }
6536
6537    return rez;
6538  };
6539
6540  var Guestures = function (instance) {
6541    var self = this;
6542
6543    self.instance = instance;
6544
6545    self.$bg = instance.$refs.bg;
6546    self.$stage = instance.$refs.stage;
6547    self.$container = instance.$refs.container;
6548
6549    self.destroy();
6550
6551    self.$container.on("touchstart.fb.touch mousedown.fb.touch", $.proxy(self, "ontouchstart"));
6552  };
6553
6554  Guestures.prototype.destroy = function () {
6555    var self = this;
6556
6557    self.$container.off(".fb.touch");
6558
6559    $(document).off(".fb.touch");
6560
6561    if (self.requestId) {
6562      cancelAFrame(self.requestId);
6563      self.requestId = null;
6564    }
6565
6566    if (self.tapped) {
6567      clearTimeout(self.tapped);
6568      self.tapped = null;
6569    }
6570  };
6571
6572  Guestures.prototype.ontouchstart = function (e) {
6573    var self = this,
6574      $target = $(e.target),
6575      instance = self.instance,
6576      current = instance.current,
6577      $slide = current.$slide,
6578      $content = current.$content,
6579      isTouchDevice = e.type == "touchstart";
6580
6581    // Do not respond to both (touch and mouse) events
6582    if (isTouchDevice) {
6583      self.$container.off("mousedown.fb.touch");
6584    }
6585
6586    // Ignore right click
6587    if (e.originalEvent && e.originalEvent.button == 2) {
6588      return;
6589    }
6590
6591    // Ignore taping on links, buttons, input elements
6592    if (!$slide.length || !$target.length || isClickable($target) || isClickable($target.parent())) {
6593      return;
6594    }
6595    // Ignore clicks on the scrollbar
6596    if (!$target.is("img") && e.originalEvent.clientX > $target[0].clientWidth + $target.offset().left) {
6597      return;
6598    }
6599
6600    // Ignore clicks while zooming or closing
6601    if (!current || instance.isAnimating || current.$slide.hasClass("fancybox-animated")) {
6602      e.stopPropagation();
6603      e.preventDefault();
6604
6605      return;
6606    }
6607
6608    self.realPoints = self.startPoints = getPointerXY(e);
6609
6610    if (!self.startPoints.length) {
6611      return;
6612    }
6613
6614    // Allow other scripts to catch touch event if "touch" is set to false
6615    if (current.touch) {
6616      e.stopPropagation();
6617    }
6618
6619    self.startEvent = e;
6620
6621    self.canTap = true;
6622    self.$target = $target;
6623    self.$content = $content;
6624    self.opts = current.opts.touch;
6625
6626    self.isPanning = false;
6627    self.isSwiping = false;
6628    self.isZooming = false;
6629    self.isScrolling = false;
6630    self.canPan = instance.canPan();
6631
6632    self.startTime = new Date().getTime();
6633    self.distanceX = self.distanceY = self.distance = 0;
6634
6635    self.canvasWidth = Math.round($slide[0].clientWidth);
6636    self.canvasHeight = Math.round($slide[0].clientHeight);
6637
6638    self.contentLastPos = null;
6639    self.contentStartPos = $.fancybox.getTranslate(self.$content) || {
6640      top: 0,
6641      left: 0
6642    };
6643    self.sliderStartPos = $.fancybox.getTranslate($slide);
6644
6645    // Since position will be absolute, but we need to make it relative to the stage
6646    self.stagePos = $.fancybox.getTranslate(instance.$refs.stage);
6647
6648    self.sliderStartPos.top -= self.stagePos.top;
6649    self.sliderStartPos.left -= self.stagePos.left;
6650
6651    self.contentStartPos.top -= self.stagePos.top;
6652    self.contentStartPos.left -= self.stagePos.left;
6653
6654    $(document)
6655      .off(".fb.touch")
6656      .on(isTouchDevice ? "touchend.fb.touch touchcancel.fb.touch" : "mouseup.fb.touch mouseleave.fb.touch", $.proxy(self, "ontouchend"))
6657      .on(isTouchDevice ? "touchmove.fb.touch" : "mousemove.fb.touch", $.proxy(self, "ontouchmove"));
6658
6659    if ($.fancybox.isMobile) {
6660      document.addEventListener("scroll", self.onscroll, true);
6661    }
6662
6663    // Skip if clicked outside the sliding area
6664    if (!(self.opts || self.canPan) || !($target.is(self.$stage) || self.$stage.find($target).length)) {
6665      if ($target.is(".fancybox-image")) {
6666        e.preventDefault();
6667      }
6668
6669      if (!($.fancybox.isMobile && $target.parents(".fancybox-caption").length)) {
6670        return;
6671      }
6672    }
6673
6674    self.isScrollable = isScrollable($target) || isScrollable($target.parent());
6675
6676    // Check if element is scrollable and try to prevent default behavior (scrolling)
6677    if (!($.fancybox.isMobile && self.isScrollable)) {
6678      e.preventDefault();
6679    }
6680
6681    // One finger or mouse click - swipe or pan an image
6682    if (self.startPoints.length === 1 || current.hasError) {
6683      if (self.canPan) {
6684        $.fancybox.stop(self.$content);
6685
6686        self.isPanning = true;
6687      } else {
6688        self.isSwiping = true;
6689      }
6690
6691      self.$container.addClass("fancybox-is-grabbing");
6692    }
6693
6694    // Two fingers - zoom image
6695    if (self.startPoints.length === 2 && current.type === "image" && (current.isLoaded || current.$ghost)) {
6696      self.canTap = false;
6697      self.isSwiping = false;
6698      self.isPanning = false;
6699
6700      self.isZooming = true;
6701
6702      $.fancybox.stop(self.$content);
6703
6704      self.centerPointStartX = (self.startPoints[0].x + self.startPoints[1].x) * 0.5 - $(window).scrollLeft();
6705      self.centerPointStartY = (self.startPoints[0].y + self.startPoints[1].y) * 0.5 - $(window).scrollTop();
6706
6707      self.percentageOfImageAtPinchPointX = (self.centerPointStartX - self.contentStartPos.left) / self.contentStartPos.width;
6708      self.percentageOfImageAtPinchPointY = (self.centerPointStartY - self.contentStartPos.top) / self.contentStartPos.height;
6709
6710      self.startDistanceBetweenFingers = distance(self.startPoints[0], self.startPoints[1]);
6711    }
6712  };
6713
6714  Guestures.prototype.onscroll = function (e) {
6715    var self = this;
6716
6717    self.isScrolling = true;
6718
6719    document.removeEventListener("scroll", self.onscroll, true);
6720  };
6721
6722  Guestures.prototype.ontouchmove = function (e) {
6723    var self = this;
6724
6725    // Make sure user has not released over iframe or disabled element
6726    if (e.originalEvent.buttons !== undefined && e.originalEvent.buttons === 0) {
6727      self.ontouchend(e);
6728      return;
6729    }
6730
6731    if (self.isScrolling) {
6732      self.canTap = false;
6733      return;
6734    }
6735
6736    self.newPoints = getPointerXY(e);
6737
6738    if (!(self.opts || self.canPan) || !self.newPoints.length || !self.newPoints.length) {
6739      return;
6740    }
6741
6742    if (!(self.isSwiping && self.isSwiping === true)) {
6743      e.preventDefault();
6744    }
6745
6746    self.distanceX = distance(self.newPoints[0], self.startPoints[0], "x");
6747    self.distanceY = distance(self.newPoints[0], self.startPoints[0], "y");
6748
6749    self.distance = distance(self.newPoints[0], self.startPoints[0]);
6750
6751    // Skip false ontouchmove events (Chrome)
6752    if (self.distance > 0) {
6753      if (self.isSwiping) {
6754        self.onSwipe(e);
6755      } else if (self.isPanning) {
6756        self.onPan();
6757      } else if (self.isZooming) {
6758        self.onZoom();
6759      }
6760    }
6761  };
6762
6763  Guestures.prototype.onSwipe = function (e) {
6764    var self = this,
6765      instance = self.instance,
6766      swiping = self.isSwiping,
6767      left = self.sliderStartPos.left || 0,
6768      angle;
6769
6770    // If direction is not yet determined
6771    if (swiping === true) {
6772      // We need at least 10px distance to correctly calculate an angle
6773      if (Math.abs(self.distance) > 10) {
6774        self.canTap = false;
6775
6776        if (instance.group.length < 2 && self.opts.vertical) {
6777          self.isSwiping = "y";
6778        } else if (instance.isDragging || self.opts.vertical === false || (self.opts.vertical === "auto" && $(window).width() > 800)) {
6779          self.isSwiping = "x";
6780        } else {
6781          angle = Math.abs((Math.atan2(self.distanceY, self.distanceX) * 180) / Math.PI);
6782
6783          self.isSwiping = angle > 45 && angle < 135 ? "y" : "x";
6784        }
6785
6786        if (self.isSwiping === "y" && $.fancybox.isMobile && self.isScrollable) {
6787          self.isScrolling = true;
6788
6789          return;
6790        }
6791
6792        instance.isDragging = self.isSwiping;
6793
6794        // Reset points to avoid jumping, because we dropped first swipes to calculate the angle
6795        self.startPoints = self.newPoints;
6796
6797        $.each(instance.slides, function (index, slide) {
6798          var slidePos, stagePos;
6799
6800          $.fancybox.stop(slide.$slide);
6801
6802          slidePos = $.fancybox.getTranslate(slide.$slide);
6803          stagePos = $.fancybox.getTranslate(instance.$refs.stage);
6804
6805          slide.$slide
6806            .css({
6807              transform: "",
6808              opacity: "",
6809              "transition-duration": ""
6810            })
6811            .removeClass("fancybox-animated")
6812            .removeClass(function (index, className) {
6813              return (className.match(/(^|\s)fancybox-fx-\S+/g) || []).join(" ");
6814            });
6815
6816          if (slide.pos === instance.current.pos) {
6817            self.sliderStartPos.top = slidePos.top - stagePos.top;
6818            self.sliderStartPos.left = slidePos.left - stagePos.left;
6819          }
6820
6821          $.fancybox.setTranslate(slide.$slide, {
6822            top: slidePos.top - stagePos.top,
6823            left: slidePos.left - stagePos.left
6824          });
6825        });
6826
6827        // Stop slideshow
6828        if (instance.SlideShow && instance.SlideShow.isActive) {
6829          instance.SlideShow.stop();
6830        }
6831      }
6832
6833      return;
6834    }
6835
6836    // Sticky edges
6837    if (swiping == "x") {
6838      if (
6839        self.distanceX > 0 &&
6840        (self.instance.group.length < 2 || (self.instance.current.index === 0 && !self.instance.current.opts.loop))
6841      ) {
6842        left = left + Math.pow(self.distanceX, 0.8);
6843      } else if (
6844        self.distanceX < 0 &&
6845        (self.instance.group.length < 2 ||
6846          (self.instance.current.index === self.instance.group.length - 1 && !self.instance.current.opts.loop))
6847      ) {
6848        left = left - Math.pow(-self.distanceX, 0.8);
6849      } else {
6850        left = left + self.distanceX;
6851      }
6852    }
6853
6854    self.sliderLastPos = {
6855      top: swiping == "x" ? 0 : self.sliderStartPos.top + self.distanceY,
6856      left: left
6857    };
6858
6859    if (self.requestId) {
6860      cancelAFrame(self.requestId);
6861
6862      self.requestId = null;
6863    }
6864
6865    self.requestId = requestAFrame(function () {
6866      if (self.sliderLastPos) {
6867        $.each(self.instance.slides, function (index, slide) {
6868          var pos = slide.pos - self.instance.currPos;
6869
6870          $.fancybox.setTranslate(slide.$slide, {
6871            top: self.sliderLastPos.top,
6872            left: self.sliderLastPos.left + pos * self.canvasWidth + pos * slide.opts.gutter
6873          });
6874        });
6875
6876        self.$container.addClass("fancybox-is-sliding");
6877      }
6878    });
6879  };
6880
6881  Guestures.prototype.onPan = function () {
6882    var self = this;
6883
6884    // Prevent accidental movement (sometimes, when tapping casually, finger can move a bit)
6885    if (distance(self.newPoints[0], self.realPoints[0]) < ($.fancybox.isMobile ? 10 : 5)) {
6886      self.startPoints = self.newPoints;
6887      return;
6888    }
6889
6890    self.canTap = false;
6891
6892    self.contentLastPos = self.limitMovement();
6893
6894    if (self.requestId) {
6895      cancelAFrame(self.requestId);
6896    }
6897
6898    self.requestId = requestAFrame(function () {
6899      $.fancybox.setTranslate(self.$content, self.contentLastPos);
6900    });
6901  };
6902
6903  // Make panning sticky to the edges
6904  Guestures.prototype.limitMovement = function () {
6905    var self = this;
6906
6907    var canvasWidth = self.canvasWidth;
6908    var canvasHeight = self.canvasHeight;
6909
6910    var distanceX = self.distanceX;
6911    var distanceY = self.distanceY;
6912
6913    var contentStartPos = self.contentStartPos;
6914
6915    var currentOffsetX = contentStartPos.left;
6916    var currentOffsetY = contentStartPos.top;
6917
6918    var currentWidth = contentStartPos.width;
6919    var currentHeight = contentStartPos.height;
6920
6921    var minTranslateX, minTranslateY, maxTranslateX, maxTranslateY, newOffsetX, newOffsetY;
6922
6923    if (currentWidth > canvasWidth) {
6924      newOffsetX = currentOffsetX + distanceX;
6925    } else {
6926      newOffsetX = currentOffsetX;
6927    }
6928
6929    newOffsetY = currentOffsetY + distanceY;
6930
6931    // Slow down proportionally to traveled distance
6932    minTranslateX = Math.max(0, canvasWidth * 0.5 - currentWidth * 0.5);
6933    minTranslateY = Math.max(0, canvasHeight * 0.5 - currentHeight * 0.5);
6934
6935    maxTranslateX = Math.min(canvasWidth - currentWidth, canvasWidth * 0.5 - currentWidth * 0.5);
6936    maxTranslateY = Math.min(canvasHeight - currentHeight, canvasHeight * 0.5 - currentHeight * 0.5);
6937
6938    //   ->
6939    if (distanceX > 0 && newOffsetX > minTranslateX) {
6940      newOffsetX = minTranslateX - 1 + Math.pow(-minTranslateX + currentOffsetX + distanceX, 0.8) || 0;
6941    }
6942
6943    //    <-
6944    if (distanceX < 0 && newOffsetX < maxTranslateX) {
6945      newOffsetX = maxTranslateX + 1 - Math.pow(maxTranslateX - currentOffsetX - distanceX, 0.8) || 0;
6946    }
6947
6948    //   \/
6949    if (distanceY > 0 && newOffsetY > minTranslateY) {
6950      newOffsetY = minTranslateY - 1 + Math.pow(-minTranslateY + currentOffsetY + distanceY, 0.8) || 0;
6951    }
6952
6953    //   /\
6954    if (distanceY < 0 && newOffsetY < maxTranslateY) {
6955      newOffsetY = maxTranslateY + 1 - Math.pow(maxTranslateY - currentOffsetY - distanceY, 0.8) || 0;
6956    }
6957
6958    return {
6959      top: newOffsetY,
6960      left: newOffsetX
6961    };
6962  };
6963
6964  Guestures.prototype.limitPosition = function (newOffsetX, newOffsetY, newWidth, newHeight) {
6965    var self = this;
6966
6967    var canvasWidth = self.canvasWidth;
6968    var canvasHeight = self.canvasHeight;
6969
6970    if (newWidth > canvasWidth) {
6971      newOffsetX = newOffsetX > 0 ? 0 : newOffsetX;
6972      newOffsetX = newOffsetX < canvasWidth - newWidth ? canvasWidth - newWidth : newOffsetX;
6973    } else {
6974      // Center horizontally
6975      newOffsetX = Math.max(0, canvasWidth / 2 - newWidth / 2);
6976    }
6977
6978    if (newHeight > canvasHeight) {
6979      newOffsetY = newOffsetY > 0 ? 0 : newOffsetY;
6980      newOffsetY = newOffsetY < canvasHeight - newHeight ? canvasHeight - newHeight : newOffsetY;
6981    } else {
6982      // Center vertically
6983      newOffsetY = Math.max(0, canvasHeight / 2 - newHeight / 2);
6984    }
6985
6986    return {
6987      top: newOffsetY,
6988      left: newOffsetX
6989    };
6990  };
6991
6992  Guestures.prototype.onZoom = function () {
6993    var self = this;
6994
6995    // Calculate current distance between points to get pinch ratio and new width and height
6996    var contentStartPos = self.contentStartPos;
6997
6998    var currentWidth = contentStartPos.width;
6999    var currentHeight = contentStartPos.height;
7000
7001    var currentOffsetX = contentStartPos.left;
7002    var currentOffsetY = contentStartPos.top;
7003
7004    var endDistanceBetweenFingers = distance(self.newPoints[0], self.newPoints[1]);
7005
7006    var pinchRatio = endDistanceBetweenFingers / self.startDistanceBetweenFingers;
7007
7008    var newWidth = Math.floor(currentWidth * pinchRatio);
7009    var newHeight = Math.floor(currentHeight * pinchRatio);
7010
7011    // This is the translation due to pinch-zooming
7012    var translateFromZoomingX = (currentWidth - newWidth) * self.percentageOfImageAtPinchPointX;
7013    var translateFromZoomingY = (currentHeight - newHeight) * self.percentageOfImageAtPinchPointY;
7014
7015    // Point between the two touches
7016    var centerPointEndX = (self.newPoints[0].x + self.newPoints[1].x) / 2 - $(window).scrollLeft();
7017    var centerPointEndY = (self.newPoints[0].y + self.newPoints[1].y) / 2 - $(window).scrollTop();
7018
7019    // And this is the translation due to translation of the centerpoint
7020    // between the two fingers
7021    var translateFromTranslatingX = centerPointEndX - self.centerPointStartX;
7022    var translateFromTranslatingY = centerPointEndY - self.centerPointStartY;
7023
7024    // The new offset is the old/current one plus the total translation
7025    var newOffsetX = currentOffsetX + (translateFromZoomingX + translateFromTranslatingX);
7026    var newOffsetY = currentOffsetY + (translateFromZoomingY + translateFromTranslatingY);
7027
7028    var newPos = {
7029      top: newOffsetY,
7030      left: newOffsetX,
7031      scaleX: pinchRatio,
7032      scaleY: pinchRatio
7033    };
7034
7035    self.canTap = false;
7036
7037    self.newWidth = newWidth;
7038    self.newHeight = newHeight;
7039
7040    self.contentLastPos = newPos;
7041
7042    if (self.requestId) {
7043      cancelAFrame(self.requestId);
7044    }
7045
7046    self.requestId = requestAFrame(function () {
7047      $.fancybox.setTranslate(self.$content, self.contentLastPos);
7048    });
7049  };
7050
7051  Guestures.prototype.ontouchend = function (e) {
7052    var self = this;
7053
7054    var swiping = self.isSwiping;
7055    var panning = self.isPanning;
7056    var zooming = self.isZooming;
7057    var scrolling = self.isScrolling;
7058
7059    self.endPoints = getPointerXY(e);
7060    self.dMs = Math.max(new Date().getTime() - self.startTime, 1);
7061
7062    self.$container.removeClass("fancybox-is-grabbing");
7063
7064    $(document).off(".fb.touch");
7065
7066    document.removeEventListener("scroll", self.onscroll, true);
7067
7068    if (self.requestId) {
7069      cancelAFrame(self.requestId);
7070
7071      self.requestId = null;
7072    }
7073
7074    self.isSwiping = false;
7075    self.isPanning = false;
7076    self.isZooming = false;
7077    self.isScrolling = false;
7078
7079    self.instance.isDragging = false;
7080
7081    if (self.canTap) {
7082      return self.onTap(e);
7083    }
7084
7085    self.speed = 100;
7086
7087    // Speed in px/ms
7088    self.velocityX = (self.distanceX / self.dMs) * 0.5;
7089    self.velocityY = (self.distanceY / self.dMs) * 0.5;
7090
7091    if (panning) {
7092      self.endPanning();
7093    } else if (zooming) {
7094      self.endZooming();
7095    } else {
7096      self.endSwiping(swiping, scrolling);
7097    }
7098
7099    return;
7100  };
7101
7102  Guestures.prototype.endSwiping = function (swiping, scrolling) {
7103    var self = this,
7104      ret = false,
7105      len = self.instance.group.length,
7106      distanceX = Math.abs(self.distanceX),
7107      canAdvance = swiping == "x" && len > 1 && ((self.dMs > 130 && distanceX > 10) || distanceX > 50),
7108      speedX = 300;
7109
7110    self.sliderLastPos = null;
7111
7112    // Close if swiped vertically / navigate if horizontally
7113    if (swiping == "y" && !scrolling && Math.abs(self.distanceY) > 50) {
7114      // Continue vertical movement
7115      $.fancybox.animate(
7116        self.instance.current.$slide, {
7117          top: self.sliderStartPos.top + self.distanceY + self.velocityY * 150,
7118          opacity: 0
7119        },
7120        200
7121      );
7122      ret = self.instance.close(true, 250);
7123    } else if (canAdvance && self.distanceX > 0) {
7124      ret = self.instance.previous(speedX);
7125    } else if (canAdvance && self.distanceX < 0) {
7126      ret = self.instance.next(speedX);
7127    }
7128
7129    if (ret === false && (swiping == "x" || swiping == "y")) {
7130      self.instance.centerSlide(200);
7131    }
7132
7133    self.$container.removeClass("fancybox-is-sliding");
7134  };
7135
7136  // Limit panning from edges
7137  // ========================
7138  Guestures.prototype.endPanning = function () {
7139    var self = this,
7140      newOffsetX,
7141      newOffsetY,
7142      newPos;
7143
7144    if (!self.contentLastPos) {
7145      return;
7146    }
7147
7148    if (self.opts.momentum === false || self.dMs > 350) {
7149      newOffsetX = self.contentLastPos.left;
7150      newOffsetY = self.contentLastPos.top;
7151    } else {
7152      // Continue movement
7153      newOffsetX = self.contentLastPos.left + self.velocityX * 500;
7154      newOffsetY = self.contentLastPos.top + self.velocityY * 500;
7155    }
7156
7157    newPos = self.limitPosition(newOffsetX, newOffsetY, self.contentStartPos.width, self.contentStartPos.height);
7158
7159    newPos.width = self.contentStartPos.width;
7160    newPos.height = self.contentStartPos.height;
7161
7162    $.fancybox.animate(self.$content, newPos, 366);
7163  };
7164
7165  Guestures.prototype.endZooming = function () {
7166    var self = this;
7167
7168    var current = self.instance.current;
7169
7170    var newOffsetX, newOffsetY, newPos, reset;
7171
7172    var newWidth = self.newWidth;
7173    var newHeight = self.newHeight;
7174
7175    if (!self.contentLastPos) {
7176      return;
7177    }
7178
7179    newOffsetX = self.contentLastPos.left;
7180    newOffsetY = self.contentLastPos.top;
7181
7182    reset = {
7183      top: newOffsetY,
7184      left: newOffsetX,
7185      width: newWidth,
7186      height: newHeight,
7187      scaleX: 1,
7188      scaleY: 1
7189    };
7190
7191    // Reset scalex/scaleY values; this helps for perfomance and does not break animation
7192    $.fancybox.setTranslate(self.$content, reset);
7193
7194    if (newWidth < self.canvasWidth && newHeight < self.canvasHeight) {
7195      self.instance.scaleToFit(150);
7196    } else if (newWidth > current.width || newHeight > current.height) {
7197      self.instance.scaleToActual(self.centerPointStartX, self.centerPointStartY, 150);
7198    } else {
7199      newPos = self.limitPosition(newOffsetX, newOffsetY, newWidth, newHeight);
7200
7201      $.fancybox.animate(self.$content, newPos, 150);
7202    }
7203  };
7204
7205  Guestures.prototype.onTap = function (e) {
7206    var self = this;
7207    var $target = $(e.target);
7208
7209    var instance = self.instance;
7210    var current = instance.current;
7211
7212    var endPoints = (e && getPointerXY(e)) || self.startPoints;
7213
7214    var tapX = endPoints[0] ? endPoints[0].x - $(window).scrollLeft() - self.stagePos.left : 0;
7215    var tapY = endPoints[0] ? endPoints[0].y - $(window).scrollTop() - self.stagePos.top : 0;
7216
7217    var where;
7218
7219    var process = function (prefix) {
7220      var action = current.opts[prefix];
7221
7222      if ($.isFunction(action)) {
7223        action = action.apply(instance, [current, e]);
7224      }
7225
7226      if (!action) {
7227        return;
7228      }
7229
7230      switch (action) {
7231        case "close":
7232          instance.close(self.startEvent);
7233
7234          break;
7235
7236        case "toggleControls":
7237          instance.toggleControls();
7238
7239          break;
7240
7241        case "next":
7242          instance.next();
7243
7244          break;
7245
7246        case "nextOrClose":
7247          if (instance.group.length > 1) {
7248            instance.next();
7249          } else {
7250            instance.close(self.startEvent);
7251          }
7252
7253          break;
7254
7255        case "zoom":
7256          if (current.type == "image" && (current.isLoaded || current.$ghost)) {
7257            if (instance.canPan()) {
7258              instance.scaleToFit();
7259            } else if (instance.isScaledDown()) {
7260              instance.scaleToActual(tapX, tapY);
7261            } else if (instance.group.length < 2) {
7262              instance.close(self.startEvent);
7263            }
7264          }
7265
7266          break;
7267      }
7268    };
7269
7270    // Ignore right click
7271    if (e.originalEvent && e.originalEvent.button == 2) {
7272      return;
7273    }
7274
7275    // Skip if clicked on the scrollbar
7276    if (!$target.is("img") && tapX > $target[0].clientWidth + $target.offset().left) {
7277      return;
7278    }
7279
7280    // Check where is clicked
7281    if ($target.is(".fancybox-bg,.fancybox-inner,.fancybox-outer,.fancybox-container")) {
7282      where = "Outside";
7283    } else if ($target.is(".fancybox-slide")) {
7284      where = "Slide";
7285    } else if (
7286      instance.current.$content &&
7287      instance.current.$content
7288      .find($target)
7289      .addBack()
7290      .filter($target).length
7291    ) {
7292      where = "Content";
7293    } else {
7294      return;
7295    }
7296
7297    // Check if this is a double tap
7298    if (self.tapped) {
7299      // Stop previously created single tap
7300      clearTimeout(self.tapped);
7301      self.tapped = null;
7302
7303      // Skip if distance between taps is too big
7304      if (Math.abs(tapX - self.tapX) > 50 || Math.abs(tapY - self.tapY) > 50) {
7305        return this;
7306      }
7307
7308      // OK, now we assume that this is a double-tap
7309      process("dblclick" + where);
7310    } else {
7311      // Single tap will be processed if user has not clicked second time within 300ms
7312      // or there is no need to wait for double-tap
7313      self.tapX = tapX;
7314      self.tapY = tapY;
7315
7316      if (current.opts["dblclick" + where] && current.opts["dblclick" + where] !== current.opts["click" + where]) {
7317        self.tapped = setTimeout(function () {
7318          self.tapped = null;
7319
7320          if (!instance.isAnimating) {
7321            process("click" + where);
7322          }
7323        }, 500);
7324      } else {
7325        process("click" + where);
7326      }
7327    }
7328
7329    return this;
7330  };
7331
7332  $(document)
7333    .on("onActivate.fb", function (e, instance) {
7334      if (instance && !instance.Guestures) {
7335        instance.Guestures = new Guestures(instance);
7336      }
7337    })
7338    .on("beforeClose.fb", function (e, instance) {
7339      if (instance && instance.Guestures) {
7340        instance.Guestures.destroy();
7341      }
7342    });
7343})(window, document, jQuery);
7344// ==========================================================================
7345//
7346// SlideShow
7347// Enables slideshow functionality
7348//
7349// Example of usage:
7350// $.fancybox.getInstance().SlideShow.start()
7351//
7352// ==========================================================================
7353(function (document, $) {
7354  "use strict";
7355
7356  $.extend(true, $.fancybox.defaults, {
7357    btnTpl: {
7358      slideShow: '<button data-fancybox-play class="fancybox-button fancybox-button--play" title="{{PLAY_START}}">' +
7359        '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M6.5 5.4v13.2l11-6.6z"/></svg>' +
7360        '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8.33 5.75h2.2v12.5h-2.2V5.75zm5.15 0h2.2v12.5h-2.2V5.75z"/></svg>' +
7361        "</button>"
7362    },
7363    slideShow: {
7364      autoStart: false,
7365      speed: 3000,
7366      progress: true
7367    }
7368  });
7369
7370  var SlideShow = function (instance) {
7371    this.instance = instance;
7372    this.init();
7373  };
7374
7375  $.extend(SlideShow.prototype, {
7376    timer: null,
7377    isActive: false,
7378    $button: null,
7379
7380    init: function () {
7381      var self = this,
7382        instance = self.instance,
7383        opts = instance.group[instance.currIndex].opts.slideShow;
7384
7385      self.$button = instance.$refs.toolbar.find("[data-fancybox-play]").on("click", function () {
7386        self.toggle();
7387      });
7388
7389      if (instance.group.length < 2 || !opts) {
7390        self.$button.hide();
7391      } else if (opts.progress) {
7392        self.$progress = $('<div class="fancybox-progress"></div>').appendTo(instance.$refs.inner);
7393      }
7394    },
7395
7396    set: function (force) {
7397      var self = this,
7398        instance = self.instance,
7399        current = instance.current;
7400
7401      // Check if reached last element
7402      if (current && (force === true || current.opts.loop || instance.currIndex < instance.group.length - 1)) {
7403        if (self.isActive && current.contentType !== "video") {
7404          if (self.$progress) {
7405            $.fancybox.animate(self.$progress.show(), {
7406              scaleX: 1
7407            }, current.opts.slideShow.speed);
7408          }
7409
7410          self.timer = setTimeout(function () {
7411            if (!instance.current.opts.loop && instance.current.index == instance.group.length - 1) {
7412              instance.jumpTo(0);
7413            } else {
7414              instance.next();
7415            }
7416          }, current.opts.slideShow.speed);
7417        }
7418      } else {
7419        self.stop();
7420        instance.idleSecondsCounter = 0;
7421        instance.showControls();
7422      }
7423    },
7424
7425    clear: function () {
7426      var self = this;
7427
7428      clearTimeout(self.timer);
7429
7430      self.timer = null;
7431
7432      if (self.$progress) {
7433        self.$progress.removeAttr("style").hide();
7434      }
7435    },
7436
7437    start: function () {
7438      var self = this,
7439        current = self.instance.current;
7440
7441      if (current) {
7442        self.$button
7443          .attr("title", (current.opts.i18n[current.opts.lang] || current.opts.i18n.en).PLAY_STOP)
7444          .removeClass("fancybox-button--play")
7445          .addClass("fancybox-button--pause");
7446
7447        self.isActive = true;
7448
7449        if (current.isComplete) {
7450          self.set(true);
7451        }
7452
7453        self.instance.trigger("onSlideShowChange", true);
7454      }
7455    },
7456
7457    stop: function () {
7458      var self = this,
7459        current = self.instance.current;
7460
7461      self.clear();
7462
7463      self.$button
7464        .attr("title", (current.opts.i18n[current.opts.lang] || current.opts.i18n.en).PLAY_START)
7465        .removeClass("fancybox-button--pause")
7466        .addClass("fancybox-button--play");
7467
7468      self.isActive = false;
7469
7470      self.instance.trigger("onSlideShowChange", false);
7471
7472      if (self.$progress) {
7473        self.$progress.removeAttr("style").hide();
7474      }
7475    },
7476
7477    toggle: function () {
7478      var self = this;
7479
7480      if (self.isActive) {
7481        self.stop();
7482      } else {
7483        self.start();
7484      }
7485    }
7486  });
7487
7488  $(document).on({
7489    "onInit.fb": function (e, instance) {
7490      if (instance && !instance.SlideShow) {
7491        instance.SlideShow = new SlideShow(instance);
7492      }
7493    },
7494
7495    "beforeShow.fb": function (e, instance, current, firstRun) {
7496      var SlideShow = instance && instance.SlideShow;
7497
7498      if (firstRun) {
7499        if (SlideShow && current.opts.slideShow.autoStart) {
7500          SlideShow.start();
7501        }
7502      } else if (SlideShow && SlideShow.isActive) {
7503        SlideShow.clear();
7504      }
7505    },
7506
7507    "afterShow.fb": function (e, instance, current) {
7508      var SlideShow = instance && instance.SlideShow;
7509
7510      if (SlideShow && SlideShow.isActive) {
7511        SlideShow.set();
7512      }
7513    },
7514
7515    "afterKeydown.fb": function (e, instance, current, keypress, keycode) {
7516      var SlideShow = instance && instance.SlideShow;
7517
7518      // "P" or Spacebar
7519      if (SlideShow && current.opts.slideShow && (keycode === 80 || keycode === 32) && !$(document.activeElement).is("button,a,input")) {
7520        keypress.preventDefault();
7521
7522        SlideShow.toggle();
7523      }
7524    },
7525
7526    "beforeClose.fb onDeactivate.fb": function (e, instance) {
7527      var SlideShow = instance && instance.SlideShow;
7528
7529      if (SlideShow) {
7530        SlideShow.stop();
7531      }
7532    }
7533  });
7534
7535  // Page Visibility API to pause slideshow when window is not active
7536  $(document).on("visibilitychange", function () {
7537    var instance = $.fancybox.getInstance(),
7538      SlideShow = instance && instance.SlideShow;
7539
7540    if (SlideShow && SlideShow.isActive) {
7541      if (document.hidden) {
7542        SlideShow.clear();
7543      } else {
7544        SlideShow.set();
7545      }
7546    }
7547  });
7548})(document, jQuery);
7549// ==========================================================================
7550//
7551// FullScreen
7552// Adds fullscreen functionality
7553//
7554// ==========================================================================
7555(function (document, $) {
7556  "use strict";
7557
7558  // Collection of methods supported by user browser
7559  var fn = (function () {
7560    var fnMap = [
7561      ["requestFullscreen", "exitFullscreen", "fullscreenElement", "fullscreenEnabled", "fullscreenchange", "fullscreenerror"],
7562      // new WebKit
7563      [
7564        "webkitRequestFullscreen",
7565        "webkitExitFullscreen",
7566        "webkitFullscreenElement",
7567        "webkitFullscreenEnabled",
7568        "webkitfullscreenchange",
7569        "webkitfullscreenerror"
7570      ],
7571      // old WebKit (Safari 5.1)
7572      [
7573        "webkitRequestFullScreen",
7574        "webkitCancelFullScreen",
7575        "webkitCurrentFullScreenElement",
7576        "webkitCancelFullScreen",
7577        "webkitfullscreenchange",
7578        "webkitfullscreenerror"
7579      ],
7580      [
7581        "mozRequestFullScreen",
7582        "mozCancelFullScreen",
7583        "mozFullScreenElement",
7584        "mozFullScreenEnabled",
7585        "mozfullscreenchange",
7586        "mozfullscreenerror"
7587      ],
7588      ["msRequestFullscreen", "msExitFullscreen", "msFullscreenElement", "msFullscreenEnabled", "MSFullscreenChange", "MSFullscreenError"]
7589    ];
7590
7591    var ret = {};
7592
7593    for (var i = 0; i < fnMap.length; i++) {
7594      var val = fnMap[i];
7595
7596      if (val && val[1] in document) {
7597        for (var j = 0; j < val.length; j++) {
7598          ret[fnMap[0][j]] = val[j];
7599        }
7600
7601        return ret;
7602      }
7603    }
7604
7605    return false;
7606  })();
7607
7608  if (fn) {
7609    var FullScreen = {
7610      request: function (elem) {
7611        elem = elem || document.documentElement;
7612
7613        elem[fn.requestFullscreen](elem.ALLOW_KEYBOARD_INPUT);
7614      },
7615      exit: function () {
7616        document[fn.exitFullscreen]();
7617      },
7618      toggle: function (elem) {
7619        elem = elem || document.documentElement;
7620
7621        if (this.isFullscreen()) {
7622          this.exit();
7623        } else {
7624          this.request(elem);
7625        }
7626      },
7627      isFullscreen: function () {
7628        return Boolean(document[fn.fullscreenElement]);
7629      },
7630      enabled: function () {
7631        return Boolean(document[fn.fullscreenEnabled]);
7632      }
7633    };
7634
7635    $.extend(true, $.fancybox.defaults, {
7636      btnTpl: {
7637        fullScreen: '<button data-fancybox-fullscreen class="fancybox-button fancybox-button--fsenter" title="{{FULL_SCREEN}}">' +
7638          '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"/></svg>' +
7639          '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M5 16h3v3h2v-5H5zm3-8H5v2h5V5H8zm6 11h2v-3h3v-2h-5zm2-11V5h-2v5h5V8z"/></svg>' +
7640          "</button>"
7641      },
7642      fullScreen: {
7643        autoStart: false
7644      }
7645    });
7646
7647    $(document).on(fn.fullscreenchange, function () {
7648      var isFullscreen = FullScreen.isFullscreen(),
7649        instance = $.fancybox.getInstance();
7650
7651      if (instance) {
7652        // If image is zooming, then force to stop and reposition properly
7653        if (instance.current && instance.current.type === "image" && instance.isAnimating) {
7654          instance.isAnimating = false;
7655
7656          instance.update(true, true, 0);
7657
7658          if (!instance.isComplete) {
7659            instance.complete();
7660          }
7661        }
7662
7663        instance.trigger("onFullscreenChange", isFullscreen);
7664
7665        instance.$refs.container.toggleClass("fancybox-is-fullscreen", isFullscreen);
7666
7667        instance.$refs.toolbar
7668          .find("[data-fancybox-fullscreen]")
7669          .toggleClass("fancybox-button--fsenter", !isFullscreen)
7670          .toggleClass("fancybox-button--fsexit", isFullscreen);
7671      }
7672    });
7673  }
7674
7675  $(document).on({
7676    "onInit.fb": function (e, instance) {
7677      var $container;
7678
7679      if (!fn) {
7680        instance.$refs.toolbar.find("[data-fancybox-fullscreen]").remove();
7681
7682        return;
7683      }
7684
7685      if (instance && instance.group[instance.currIndex].opts.fullScreen) {
7686        $container = instance.$refs.container;
7687
7688        $container.on("click.fb-fullscreen", "[data-fancybox-fullscreen]", function (e) {
7689          e.stopPropagation();
7690          e.preventDefault();
7691
7692          FullScreen.toggle();
7693        });
7694
7695        if (instance.opts.fullScreen && instance.opts.fullScreen.autoStart === true) {
7696          FullScreen.request();
7697        }
7698
7699        // Expose API
7700        instance.FullScreen = FullScreen;
7701      } else if (instance) {
7702        instance.$refs.toolbar.find("[data-fancybox-fullscreen]").hide();
7703      }
7704    },
7705
7706    "afterKeydown.fb": function (e, instance, current, keypress, keycode) {
7707      // "F"
7708      if (instance && instance.FullScreen && keycode === 70) {
7709        keypress.preventDefault();
7710
7711        instance.FullScreen.toggle();
7712      }
7713    },
7714
7715    "beforeClose.fb": function (e, instance) {
7716      if (instance && instance.FullScreen && instance.$refs.container.hasClass("fancybox-is-fullscreen")) {
7717        FullScreen.exit();
7718      }
7719    }
7720  });
7721})(document, jQuery);
7722// ==========================================================================
7723//
7724// Thumbs
7725// Displays thumbnails in a grid
7726//
7727// ==========================================================================
7728(function (document, $) {
7729  "use strict";
7730
7731  var CLASS = "fancybox-thumbs",
7732    CLASS_ACTIVE = CLASS + "-active";
7733
7734  // Make sure there are default values
7735  $.fancybox.defaults = $.extend(
7736    true, {
7737      btnTpl: {
7738        thumbs: '<button data-fancybox-thumbs class="fancybox-button fancybox-button--thumbs" title="{{THUMBS}}">' +
7739          '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14.59 14.59h3.76v3.76h-3.76v-3.76zm-4.47 0h3.76v3.76h-3.76v-3.76zm-4.47 0h3.76v3.76H5.65v-3.76zm8.94-4.47h3.76v3.76h-3.76v-3.76zm-4.47 0h3.76v3.76h-3.76v-3.76zm-4.47 0h3.76v3.76H5.65v-3.76zm8.94-4.47h3.76v3.76h-3.76V5.65zm-4.47 0h3.76v3.76h-3.76V5.65zm-4.47 0h3.76v3.76H5.65V5.65z"/></svg>' +
7740          "</button>"
7741      },
7742      thumbs: {
7743        autoStart: false, // Display thumbnails on opening
7744        hideOnClose: true, // Hide thumbnail grid when closing animation starts
7745        parentEl: ".fancybox-container", // Container is injected into this element
7746        axis: "y" // Vertical (y) or horizontal (x) scrolling
7747      }
7748    },
7749    $.fancybox.defaults
7750  );
7751
7752  var FancyThumbs = function (instance) {
7753    this.init(instance);
7754  };
7755
7756  $.extend(FancyThumbs.prototype, {
7757    $button: null,
7758    $grid: null,
7759    $list: null,
7760    isVisible: false,
7761    isActive: false,
7762
7763    init: function (instance) {
7764      var self = this,
7765        group = instance.group,
7766        enabled = 0;
7767
7768      self.instance = instance;
7769      self.opts = group[instance.currIndex].opts.thumbs;
7770
7771      instance.Thumbs = self;
7772
7773      self.$button = instance.$refs.toolbar.find("[data-fancybox-thumbs]");
7774
7775      // Enable thumbs if at least two group items have thumbnails
7776      for (var i = 0, len = group.length; i < len; i++) {
7777        if (group[i].thumb) {
7778          enabled++;
7779        }
7780
7781        if (enabled > 1) {
7782          break;
7783        }
7784      }
7785
7786      if (enabled > 1 && !!self.opts) {
7787        self.$button.removeAttr("style").on("click", function () {
7788          self.toggle();
7789        });
7790
7791        self.isActive = true;
7792      } else {
7793        self.$button.hide();
7794      }
7795    },
7796
7797    create: function () {
7798      var self = this,
7799        instance = self.instance,
7800        parentEl = self.opts.parentEl,
7801        list = [],
7802        src;
7803
7804      if (!self.$grid) {
7805        // Create main element
7806        self.$grid = $('<div class="' + CLASS + " " + CLASS + "-" + self.opts.axis + '"></div>').appendTo(
7807          instance.$refs.container
7808          .find(parentEl)
7809          .addBack()
7810          .filter(parentEl)
7811        );
7812
7813        // Add "click" event that performs gallery navigation
7814        self.$grid.on("click", "a", function () {
7815          instance.jumpTo($(this).attr("data-index"));
7816        });
7817      }
7818
7819      // Build the list
7820      if (!self.$list) {
7821        self.$list = $('<div class="' + CLASS + '__list">').appendTo(self.$grid);
7822      }
7823
7824      $.each(instance.group, function (i, item) {
7825        src = item.thumb;
7826
7827        if (!src && item.type === "image") {
7828          src = item.src;
7829        }
7830
7831        list.push(
7832          '<a href="javascript:;" tabindex="0" data-index="' +
7833          i +
7834          '"' +
7835          (src && src.length ? ' style="background-image:url(' + src + ')"' : 'class="fancybox-thumbs-missing"') +
7836          "></a>"
7837        );
7838      });
7839
7840      self.$list[0].innerHTML = list.join("");
7841
7842      if (self.opts.axis === "x") {
7843        // Set fixed width for list element to enable horizontal scrolling
7844        self.$list.width(
7845          parseInt(self.$grid.css("padding-right"), 10) +
7846          instance.group.length *
7847          self.$list
7848          .children()
7849          .eq(0)
7850          .outerWidth(true)
7851        );
7852      }
7853    },
7854
7855    focus: function (duration) {
7856      var self = this,
7857        $list = self.$list,
7858        $grid = self.$grid,
7859        thumb,
7860        thumbPos;
7861
7862      if (!self.instance.current) {
7863        return;
7864      }
7865
7866      thumb = $list
7867        .children()
7868        .removeClass(CLASS_ACTIVE)
7869        .filter('[data-index="' + self.instance.current.index + '"]')
7870        .addClass(CLASS_ACTIVE);
7871
7872      thumbPos = thumb.position();
7873
7874      // Check if need to scroll to make current thumb visible
7875      if (self.opts.axis === "y" && (thumbPos.top < 0 || thumbPos.top > $list.height() - thumb.outerHeight())) {
7876        $list.stop().animate({
7877            scrollTop: $list.scrollTop() + thumbPos.top
7878          },
7879          duration
7880        );
7881      } else if (
7882        self.opts.axis === "x" &&
7883        (thumbPos.left < $grid.scrollLeft() || thumbPos.left > $grid.scrollLeft() + ($grid.width() - thumb.outerWidth()))
7884      ) {
7885        $list
7886          .parent()
7887          .stop()
7888          .animate({
7889              scrollLeft: thumbPos.left
7890            },
7891            duration
7892          );
7893      }
7894    },
7895
7896    update: function () {
7897      var that = this;
7898      that.instance.$refs.container.toggleClass("fancybox-show-thumbs", this.isVisible);
7899
7900      if (that.isVisible) {
7901        if (!that.$grid) {
7902          that.create();
7903        }
7904
7905        that.instance.trigger("onThumbsShow");
7906
7907        that.focus(0);
7908      } else if (that.$grid) {
7909        that.instance.trigger("onThumbsHide");
7910      }
7911
7912      // Update content position
7913      that.instance.update();
7914    },
7915
7916    hide: function () {
7917      this.isVisible = false;
7918      this.update();
7919    },
7920
7921    show: function () {
7922      this.isVisible = true;
7923      this.update();
7924    },
7925
7926    toggle: function () {
7927      this.isVisible = !this.isVisible;
7928      this.update();
7929    }
7930  });
7931
7932  $(document).on({
7933    "onInit.fb": function (e, instance) {
7934      var Thumbs;
7935
7936      if (instance && !instance.Thumbs) {
7937        Thumbs = new FancyThumbs(instance);
7938
7939        if (Thumbs.isActive && Thumbs.opts.autoStart === true) {
7940          Thumbs.show();
7941        }
7942      }
7943    },
7944
7945    "beforeShow.fb": function (e, instance, item, firstRun) {
7946      var Thumbs = instance && instance.Thumbs;
7947
7948      if (Thumbs && Thumbs.isVisible) {
7949        Thumbs.focus(firstRun ? 0 : 250);
7950      }
7951    },
7952
7953    "afterKeydown.fb": function (e, instance, current, keypress, keycode) {
7954      var Thumbs = instance && instance.Thumbs;
7955
7956      // "G"
7957      if (Thumbs && Thumbs.isActive && keycode === 71) {
7958        keypress.preventDefault();
7959
7960        Thumbs.toggle();
7961      }
7962    },
7963
7964    "beforeClose.fb": function (e, instance) {
7965      var Thumbs = instance && instance.Thumbs;
7966
7967      if (Thumbs && Thumbs.isVisible && Thumbs.opts.hideOnClose !== false) {
7968        Thumbs.$grid.hide();
7969      }
7970    }
7971  });
7972})(document, jQuery);
7973//// ==========================================================================
7974//
7975// Share
7976// Displays simple form for sharing current url
7977//
7978// ==========================================================================
7979(function (document, $) {
7980  "use strict";
7981
7982  $.extend(true, $.fancybox.defaults, {
7983    btnTpl: {
7984      share: '<button data-fancybox-share class="fancybox-button fancybox-button--share" title="{{SHARE}}">' +
7985        '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M2.55 19c1.4-8.4 9.1-9.8 11.9-9.8V5l7 7-7 6.3v-3.5c-2.8 0-10.5 2.1-11.9 4.2z"/></svg>' +
7986        "</button>"
7987    },
7988    share: {
7989      url: function (instance, item) {
7990        return (
7991          (!instance.currentHash && !(item.type === "inline" || item.type === "html") ? item.origSrc || item.src : false) || window.location
7992        );
7993      },
7994      tpl: '<div class="fancybox-share">' +
7995        "<h1>{{SHARE}}</h1>" +
7996        "<p>" +
7997        '<a class="fancybox-share__button fancybox-share__button--fb" href="https://www.facebook.com/sharer/sharer.php?u={{url}}">' +
7998        '<svg viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"><path d="m287 456v-299c0-21 6-35 35-35h38v-63c-7-1-29-3-55-3-54 0-91 33-91 94v306m143-254h-205v72h196" /></svg>' +
7999        "<span>Facebook</span>" +
8000        "</a>" +
8001        '<a class="fancybox-share__button fancybox-share__button--tw" href="https://twitter.com/intent/tweet?url={{url}}&text={{descr}}">' +
8002        '<svg viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"><path d="m456 133c-14 7-31 11-47 13 17-10 30-27 37-46-15 10-34 16-52 20-61-62-157-7-141 75-68-3-129-35-169-85-22 37-11 86 26 109-13 0-26-4-37-9 0 39 28 72 65 80-12 3-25 4-37 2 10 33 41 57 77 57-42 30-77 38-122 34 170 111 378-32 359-208 16-11 30-25 41-42z" /></svg>' +
8003        "<span>Twitter</span>" +
8004        "</a>" +
8005        '<a class="fancybox-share__button fancybox-share__button--pt" href="https://www.pinterest.com/pin/create/button/?url={{url}}&description={{descr}}&media={{media}}">' +
8006        '<svg viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"><path d="m265 56c-109 0-164 78-164 144 0 39 15 74 47 87 5 2 10 0 12-5l4-19c2-6 1-8-3-13-9-11-15-25-15-45 0-58 43-110 113-110 62 0 96 38 96 88 0 67-30 122-73 122-24 0-42-19-36-44 6-29 20-60 20-81 0-19-10-35-31-35-25 0-44 26-44 60 0 21 7 36 7 36l-30 125c-8 37-1 83 0 87 0 3 4 4 5 2 2-3 32-39 42-75l16-64c8 16 31 29 56 29 74 0 124-67 124-157 0-69-58-132-146-132z" fill="#fff"/></svg>' +
8007        "<span>Pinterest</span>" +
8008        "</a>" +
8009        "</p>" +
8010        '<p><input class="fancybox-share__input" type="text" value="{{url_raw}}" onclick="select()" /></p>' +
8011        "</div>"
8012    }
8013  });
8014
8015  function escapeHtml(string) {
8016    var entityMap = {
8017      "&": "&amp;",
8018      "<": "&lt;",
8019      ">": "&gt;",
8020      '"': "&quot;",
8021      "'": "&#39;",
8022      "/": "&#x2F;",
8023      "`": "&#x60;",
8024      "=": "&#x3D;"
8025    };
8026
8027    return String(string).replace(/[&<>"'`=\/]/g, function (s) {
8028      return entityMap[s];
8029    });
8030  }
8031
8032  $(document).on("click", "[data-fancybox-share]", function () {
8033    var instance = $.fancybox.getInstance(),
8034      current = instance.current || null,
8035      url,
8036      tpl;
8037
8038    if (!current) {
8039      return;
8040    }
8041
8042    if ($.type(current.opts.share.url) === "function") {
8043      url = current.opts.share.url.apply(current, [instance, current]);
8044    }
8045
8046    tpl = current.opts.share.tpl
8047      .replace(/\{\{media\}\}/g, current.type === "image" ? encodeURIComponent(current.src) : "")
8048      .replace(/\{\{url\}\}/g, encodeURIComponent(url))
8049      .replace(/\{\{url_raw\}\}/g, escapeHtml(url))
8050      .replace(/\{\{descr\}\}/g, instance.$caption ? encodeURIComponent(instance.$caption.text()) : "");
8051
8052    $.fancybox.open({
8053      src: instance.translate(instance, tpl),
8054      type: "html",
8055      opts: {
8056        touch: false,
8057        animationEffect: false,
8058        afterLoad: function (shareInstance, shareCurrent) {
8059          // Close self if parent instance is closing
8060          instance.$refs.container.one("beforeClose.fb", function () {
8061            shareInstance.close(null, 0);
8062          });
8063
8064          // Opening links in a popup window
8065          shareCurrent.$content.find(".fancybox-share__button").click(function () {
8066            window.open(this.href, "Share", "width=550, height=450");
8067            return false;
8068          });
8069        },
8070        mobile: {
8071          autoFocus: false
8072        }
8073      }
8074    });
8075  });
8076})(document, jQuery);
8077// ==========================================================================
8078//
8079// Hash
8080// Enables linking to each modal
8081//
8082// ==========================================================================
8083(function (window, document, $) {
8084  "use strict";
8085
8086  // Simple $.escapeSelector polyfill (for jQuery prior v3)
8087  if (!$.escapeSelector) {
8088    $.escapeSelector = function (sel) {
8089      var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g;
8090      var fcssescape = function (ch, asCodePoint) {
8091        if (asCodePoint) {
8092          // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
8093          if (ch === "\0") {
8094            return "\uFFFD";
8095          }
8096
8097          // Control characters and (dependent upon position) numbers get escaped as code points
8098          return ch.slice(0, -1) + "\\" + ch.charCodeAt(ch.length - 1).toString(16) + " ";
8099        }
8100
8101        // Other potentially-special ASCII characters get backslash-escaped
8102        return "\\" + ch;
8103      };
8104
8105      return (sel + "").replace(rcssescape, fcssescape);
8106    };
8107  }
8108
8109  // Get info about gallery name and current index from url
8110  function parseUrl() {
8111    var hash = window.location.hash.substr(1),
8112      rez = hash.split("-"),
8113      index = rez.length > 1 && /^\+?\d+$/.test(rez[rez.length - 1]) ? parseInt(rez.pop(-1), 10) || 1 : 1,
8114      gallery = rez.join("-");
8115
8116    return {
8117      hash: hash,
8118      /* Index is starting from 1 */
8119      index: index < 1 ? 1 : index,
8120      gallery: gallery
8121    };
8122  }
8123
8124  // Trigger click evnt on links to open new fancyBox instance
8125  function triggerFromUrl(url) {
8126    if (url.gallery !== "") {
8127      // If we can find element matching 'data-fancybox' atribute,
8128      // then triggering click event should start fancyBox
8129      $("[data-fancybox='" + $.escapeSelector(url.gallery) + "']")
8130        .eq(url.index - 1)
8131        .focus()
8132        .trigger("click.fb-start");
8133    }
8134  }
8135
8136  // Get gallery name from current instance
8137  function getGalleryID(instance) {
8138    var opts, ret;
8139
8140    if (!instance) {
8141      return false;
8142    }
8143
8144    opts = instance.current ? instance.current.opts : instance.opts;
8145    ret = opts.hash || (opts.$orig ? opts.$orig.data("fancybox") || opts.$orig.data("fancybox-trigger") : "");
8146
8147    return ret === "" ? false : ret;
8148  }
8149
8150  // Start when DOM becomes ready
8151  $(function () {
8152    // Check if user has disabled this module
8153    if ($.fancybox.defaults.hash === false) {
8154      return;
8155    }
8156
8157    // Update hash when opening/closing fancyBox
8158    $(document).on({
8159      "onInit.fb": function (e, instance) {
8160        var url, gallery;
8161
8162        if (instance.group[instance.currIndex].opts.hash === false) {
8163          return;
8164        }
8165
8166        url = parseUrl();
8167        gallery = getGalleryID(instance);
8168
8169        // Make sure gallery start index matches index from hash
8170        if (gallery && url.gallery && gallery == url.gallery) {
8171          instance.currIndex = url.index - 1;
8172        }
8173      },
8174
8175      "beforeShow.fb": function (e, instance, current, firstRun) {
8176        var gallery;
8177
8178        if (!current || current.opts.hash === false) {
8179          return;
8180        }
8181
8182        // Check if need to update window hash
8183        gallery = getGalleryID(instance);
8184
8185        if (!gallery) {
8186          return;
8187        }
8188
8189        // Variable containing last hash value set by fancyBox
8190        // It will be used to determine if fancyBox needs to close after hash change is detected
8191        instance.currentHash = gallery + (instance.group.length > 1 ? "-" + (current.index + 1) : "");
8192
8193        // If current hash is the same (this instance most likely is opened by hashchange), then do nothing
8194        if (window.location.hash === "#" + instance.currentHash) {
8195          return;
8196        }
8197
8198        if (firstRun && !instance.origHash) {
8199          instance.origHash = window.location.hash;
8200        }
8201
8202        if (instance.hashTimer) {
8203          clearTimeout(instance.hashTimer);
8204        }
8205
8206        // Update hash
8207        instance.hashTimer = setTimeout(function () {
8208          if ("replaceState" in window.history) {
8209            window.history[firstRun ? "pushState" : "replaceState"]({},
8210              document.title,
8211              window.location.pathname + window.location.search + "#" + instance.currentHash
8212            );
8213
8214            if (firstRun) {
8215              instance.hasCreatedHistory = true;
8216            }
8217          } else {
8218            window.location.hash = instance.currentHash;
8219          }
8220
8221          instance.hashTimer = null;
8222        }, 300);
8223      },
8224
8225      "beforeClose.fb": function (e, instance, current) {
8226        if (!current || current.opts.hash === false) {
8227          return;
8228        }
8229
8230        clearTimeout(instance.hashTimer);
8231
8232        // Goto previous history entry
8233        if (instance.currentHash && instance.hasCreatedHistory) {
8234          window.history.back();
8235        } else if (instance.currentHash) {
8236          if ("replaceState" in window.history) {
8237            window.history.replaceState({}, document.title, window.location.pathname + window.location.search + (instance.origHash || ""));
8238          } else {
8239            window.location.hash = instance.origHash;
8240          }
8241        }
8242
8243        instance.currentHash = null;
8244      }
8245    });
8246
8247    // Check if need to start/close after url has changed
8248    $(window).on("hashchange.fb", function () {
8249      var url = parseUrl(),
8250        fb = null;
8251
8252      // Find last fancyBox instance that has "hash"
8253      $.each(
8254        $(".fancybox-container")
8255        .get()
8256        .reverse(),
8257        function (index, value) {
8258          var tmp = $(value).data("FancyBox");
8259
8260          if (tmp && tmp.currentHash) {
8261            fb = tmp;
8262            return false;
8263          }
8264        }
8265      );
8266
8267      if (fb) {
8268        // Now, compare hash values
8269        if (fb.currentHash !== url.gallery + "-" + url.index && !(url.index === 1 && fb.currentHash == url.gallery)) {
8270          fb.currentHash = null;
8271
8272          fb.close();
8273        }
8274      } else if (url.gallery !== "") {
8275        triggerFromUrl(url);
8276      }
8277    });
8278
8279    // Check current hash and trigger click event on matching element to start fancyBox, if needed
8280    setTimeout(function () {
8281      if (!$.fancybox.getInstance()) {
8282        triggerFromUrl(parseUrl());
8283      }
8284    }, 50);
8285  });
8286})(window, document, jQuery);
8287// ==========================================================================
8288//
8289// Wheel
8290// Basic mouse weheel support for gallery navigation
8291//
8292// ==========================================================================
8293(function (document, $) {
8294  "use strict";
8295
8296  var prevTime = new Date().getTime();
8297
8298  $(document).on({
8299    "onInit.fb": function (e, instance, current) {
8300      instance.$refs.stage.on("mousewheel DOMMouseScroll wheel MozMousePixelScroll", function (e) {
8301        var current = instance.current,
8302          currTime = new Date().getTime();
8303
8304        if (instance.group.length < 2 || current.opts.wheel === false || (current.opts.wheel === "auto" && current.type !== "image")) {
8305          return;
8306        }
8307
8308        e.preventDefault();
8309        e.stopPropagation();
8310
8311        if (current.$slide.hasClass("fancybox-animated")) {
8312          return;
8313        }
8314
8315        e = e.originalEvent || e;
8316
8317        if (currTime - prevTime < 250) {
8318          return;
8319        }
8320
8321        prevTime = currTime;
8322
8323        instance[(-e.deltaY || -e.deltaX || e.wheelDelta || -e.detail) < 0 ? "next" : "previous"]();
8324      });
8325    }
8326  });
8327})(document, jQuery);
8328/* End */
8329;
8330; /* Start:"a:4:{s:4:"full";s:67:"/bitrix/templates/aspro_max/js/jquery.flexslider.js?171646553759389";s:6:"source";
8330s:51:"/bitrix/templates/aspro_max/js/jquery.flexslider.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
8331/*
8332 * jQuery FlexSlider v2.6.3
8333 * Copyright 2012 WooThemes
8334 * Contributing Author: Tyler Smith
8335 */
8336;
8337(function ($) {
8338
8339  var focused = true;
8340
8341  // Turns a mouse event into a touch event
8342  function toTouchEvent(e) {
8343    var touch = {
8344      identifier: 0,
8345      target: e.target,
8346      screenX: e.screenX,
8347      screenY: e.screenY,
8348      clientX: e.clientX,
8349      clientY: e.clientY,
8350      pageX: e.pageX,
8351      pageY: e.pageY
8352    }
8353    var touchEvent = {
8354      touches: [touch],
8355      targetTouches: [touch],
8356      changedTouches: [touch],
8357      altKey: e.altKey,
8358      metaKey: e.metaKey,
8359      ctrlKey: e.ctrlKey,
8360      shiftKey: e.shiftKey,
8361      target: e.target,
8362      preventDefault: e.preventDefault.bind(e),
8363      type: e.type === 'mousedown' ? 'touchstart' : e.type === 'mousemove' ? 'touchmove' : e.type === 'mouseup' ? 'touchend' : e.type,
8364      timeStamp: e.timeStamp || Date.now()
8365    }
8366    return touchEvent
8367  }
8368
8369  //FlexSlider: Object Instance
8370  $.flexslider = function(el, options) {
8371    var slider = $(el);
8372
8373    // making variables public
8374    slider.vars = $.extend({}, $.flexslider.defaults, options);
8375
8376    var namespace = slider.vars.namespace,
8377        msGesture = window.navigator && window.navigator.msPointerEnabled && window.MSGesture,
8378        // touch = (( "ontouchstart" in window ) || msGesture || window.DocumentTouch && document instanceof DocumentTouch) && slider.vars.touch,
8379        touch = /*(( "ontouchstart" in window ) || msGesture || window.DocumentTouch && document instanceof DocumentTouch) &&*/ slider.vars.touch,
8380        // depricating this idea, as devices are being released with both of these events
8381        eventType = "click touchend MSPointerUp keyup",
8382        watchedEvent = "",
8383        watchedEventClearTimer,
8384        vertical = slider.vars.direction === "vertical",
8385        reverse = slider.vars.reverse,
8386        carousel = (slider.vars.itemWidth > 0),
8387        fade = slider.vars.animation === "fade",
8388        asNav = slider.vars.asNavFor !== "",
8389        methods = {};
8390
8391    // Store a reference to the slider object
8392    $.data(el, "flexslider", slider);
8393
8394    // Private slider methods
8395    methods = {
8396      init: function() {
8397        slider.animating = false;
8398        // Get current slide and make sure it is a number
8399        slider.currentSlide = parseInt( ( slider.vars.startAt ? slider.vars.startAt : 0), 10 );
8400        if ( isNaN( slider.currentSlide ) ) { slider.currentSlide = 0; }
8401        slider.animatingTo = slider.currentSlide;
8402        slider.atEnd = (slider.currentSlide === 0 || slider.currentSlide === slider.last);
8403        slider.containerSelector = slider.vars.selector.substr(0,slider.vars.selector.search(' '));
8404        slider.slides = $(slider.vars.selector, slider);
8405        slider.container = $(slider.containerSelector, slider);
8406        slider.count = slider.slides.length;
8407        // SYNC:
8408        slider.syncExists = $(slider.vars.sync).length > 0;
8409        // SLIDE:
8410        if (slider.vars.animation === "slide") { slider.vars.animation = "swing"; }
8411        slider.prop = (vertical) ? "top" : "marginLeft";
8412        slider.args = {};
8413        // SLIDESHOW:
8414        slider.manualPause = false;
8415        slider.stopped = false;
8416        //PAUSE WHEN INVISIBLE
8417        slider.started = false;
8418        slider.startTimeout = null;
8419        // TOUCH/USECSS:
8420        slider.transitions = !slider.vars.video && !fade && slider.vars.useCSS && (function() {
8421          var obj = document.createElement('div'),
8422              props = ['perspectiveProperty', 'WebkitPerspective', 'MozPerspective', 'OPerspective', 'msPerspective'];
8423          for (var i in props) {
8424            if ( obj.style[ props[i] ] !== undefined ) {
8425              slider.pfx = props[i].replace('Perspective','').toLowerCase();
8426              slider.prop = "-" + slider.pfx + "-transform";
8427              return true;
8428            }
8429          }
8430          return false;
8431        }());
8432        slider.ensureAnimationEnd = '';
8433        // CONTROLSCONTAINER:
vendor: 5,736 bytes, lines 8434-8562
8434        if (slider.vars.controlsContainer !== "") slider.controlsContainer = $(slider.vars.controlsContainer).length > 0 && $(slider.vars.controlsContainer);
8435        // MANUAL:
8436        if (slider.vars.manualControls !== "") slider.manualControls = $(slider.vars.manualControls).length > 0 && $(slider.vars.manualControls);
8437
8438        // CUSTOM DIRECTION NAV:
8439        if (slider.vars.customDirectionNav !== "") slider.customDirectionNav = $(slider.vars.customDirectionNav).length === 2 && $(slider.vars.customDirectionNav);
8440
8441        // RANDOMIZE:
8442        if (slider.vars.randomize) {
8443          slider.slides.sort(function() { return (Math.round(Math.random())-0.5); });
8444          slider.container.empty().append(slider.slides);
8445        }
8446
8447        slider.doMath();
8448
8449        // INIT
8450        slider.setup("init");
8451
8452        // CONTROLNAV:
8453        if (slider.vars.controlNav) { methods.controlNav.setup(); }
8454
8455        // DIRECTIONNAV:
8456        if (slider.vars.directionNav) { methods.directionNav.setup(); }
8457
8458        // KEYBOARD:
8459        if (slider.vars.keyboard && ($(slider.containerSelector).length === 1 || slider.vars.multipleKeyboard)) {
8460          $(document).bind('keyup', function(event) {
8461            var keycode = event.keyCode;
8462            if (!slider.animating && (keycode === 39 || keycode === 37)) {
8463              var target = (keycode === 39) ? slider.getTarget('next') :
8464                           (keycode === 37) ? slider.getTarget('prev') : false;
8465              slider.flexAnimate(target, slider.vars.pauseOnAction);
8466            }
8467          });
8468        }
8469        // MOUSEWHEEL:
8470        if (slider.vars.mousewheel) {
8471          slider.bind('mousewheel', function(event, delta, deltaX, deltaY) {
8472            event.preventDefault();
8473            var target = (delta < 0) ? slider.getTarget('next') : slider.getTarget('prev');
8474            slider.flexAnimate(target, slider.vars.pauseOnAction);
8475          });
8476        }
8477
8478        // PAUSEPLAY
8479        if (slider.vars.pausePlay) { methods.pausePlay.setup(); }
8480
8481        //PAUSE WHEN INVISIBLE
8482        if (slider.vars.slideshow && slider.vars.pauseInvisible) { methods.pauseInvisible.init(); }
8483
8484        // SLIDSESHOW
8485        if (slider.vars.slideshow) {
8486          if (slider.vars.pauseOnHover) {
8487            slider.hover(function() {
8488              if (!slider.manualPlay && !slider.manualPause) { slider.pause(); }
8489            }, function() {
8490              if (!slider.manualPause && !slider.manualPlay && !slider.stopped) { slider.play(); }
8491            });
8492          }
8493          // initialize animation
8494          //If we're visible, or we don't use PageVisibility API
8495          if(!slider.vars.pauseInvisible || !methods.pauseInvisible.isHidden()) {
8496            (slider.vars.initDelay > 0) ? slider.startTimeout = setTimeout(slider.play, slider.vars.initDelay) : slider.play();
8497          }
8498        }
8499
8500        // ASNAV:
8501        if (asNav) { methods.asNav.setup(); }
8502
8503        // TOUCH
8504        if (touch && slider.vars.touch) { methods.touch(); }
8505
8506        // FADE&&SMOOTHHEIGHT || SLIDE:
8507        if (!fade || (fade && slider.vars.smoothHeight)) { $(window).bind("resize orientationchange", methods.resize); }
8508
8509        slider.find("img").attr("draggable", "false");
8510
8511        // API: start() Callback
8512        setTimeout(function(){
8513          slider.vars.start(slider);
8514        }, 200);
8515      },
8516      asNav: {
8517        setup: function() {
8518          slider.asNav = true;
8519          slider.animatingTo = Math.floor(slider.currentSlide/slider.move);
8520          slider.currentItem = slider.currentSlide;
8521          slider.slides.removeClass(namespace + "active-slide").eq(slider.currentItem).addClass(namespace + "active-slide");
8522          if(!msGesture){
8523              slider.slides.on(eventType, function(e){
8524                e.preventDefault();
8525                var $slide = $(this),
8526                    target = $slide.index();
8527                var posFromLeft = $slide.offset().left - $(slider).scrollLeft(); // Find position of slide relative to left of slider container
8528                if( posFromLeft <= 0 && $slide.hasClass( namespace + 'active-slide' ) ) {
8529                  slider.flexAnimate(slider.getTarget("prev"), true);
8530                } else if (!$(slider.vars.asNavFor).data('flexslider').animating && !$slide.hasClass(namespace + "active-slide")) {
8531                  slider.direction = (slider.currentItem < target) ? "next" : "prev";
8532                  slider.flexAnimate(target, slider.vars.pauseOnAction, false, true, true);
8533                }
8534              });
8535          }else{
8536              el._slider = slider;
8537              slider.slides.each(function (){
8538                  var that = this;
8539                  that._gesture = new MSGesture();
8540                  that._gesture.target = that;
8541                  that.addEventListener("MSPointerDown", function (e){
8542                      e.preventDefault();
8543                      if(e.currentTarget._gesture) {
8544                        e.currentTarget._gesture.addPointer(e.pointerId);
8545                      }
8546                  }, false);
8547                  that.addEventListener("MSGestureTap", function (e){
8548                      e.preventDefault();
8549                      var $slide = $(this),
8550                          target = $slide.index();
8551                      if (!$(slider.vars.asNavFor).data('flexslider').animating && !$slide.hasClass('active')) {
8552                          slider.direction = (slider.currentItem < target) ? "next" : "prev";
8553                          slider.flexAnimate(target, slider.vars.pauseOnAction, false, true, true);
8554                      }
8555                  });
8556              });
8557          }
8558        }
8559      },
8560      controlNav: {
8561        setup: function() {
8562          if (!slider.manualControls) {
8563            methods.controlNav.setupPaging();
8564          } else { // MANUALCONTROLS:
8565            methods.controlNav.setupManual();
8566          }
8567        },
8568        setupPaging: function() {
8569          var type = (slider.vars.controlNav === "thumbnails") ? 'control-thumbs' : 'control-paging',
8570              j = 1,
8571              item,
8572              slide;
8573
8574          slider.controlNavScaffold = $('<ol class="'+ namespace + 'control-nav ' + namespace + type + '"></ol>');
8575
8576          if (slider.pagingCount > 1) {
8577            for (var i = 0; i < slider.pagingCount; i++) {
8578              slide = slider.slides.eq(i);
8579              if ( undefined === slide.attr( 'data-thumb-alt' ) ) { slide.attr( 'data-thumb-alt', '' ); }
8580              var altText = ( '' !== slide.attr( 'data-thumb-alt' ) ) ? altText = ' alt="' + slide.attr( 'data-thumb-alt' ) + '"' : '';
8581              item = (slider.vars.controlNav === "thumbnails") ? '<img src="' + slide.attr( 'data-thumb' ) + '"' + altText + '/>' : '<a href="#">' + j + '</a>';
8582              if ( 'thumbnails' === slider.vars.controlNav && true === slider.vars.thumbCaptions ) {
8583                var captn = slide.attr( 'data-thumbcaption' );
8584                if ( '' !== captn && undefined !== captn ) { item += '<span class="' + namespace + 'caption">' + captn + '</span>'; }
8585              }
8586              slider.controlNavScaffold.append('<li>' + item + '</li>');
8587              j++;
8588            }
8589          }
8590
8591          // CONTROLSCONTAINER:
8592          (slider.controlsContainer) ? $(slider.controlsContainer).append(slider.controlNavScaffold) : slider.append(slider.controlNavScaffold);
8593          methods.controlNav.set();
8594
8595          methods.controlNav.active();
8596
8597          slider.controlNavScaffold.delegate('a, img', eventType, function(event) {
8598            event.preventDefault();
8599
8600            if (watchedEvent === "" || watchedEvent === event.type) {
8601              var $this = $(this),
8602                  target = slider.controlNav.index($this);
8603
8604              if (!$this.hasClass(namespace + 'active')) {
8605                slider.direction = (target > slider.currentSlide) ? "next" : "prev";
8606                slider.flexAnimate(target, slider.vars.pauseOnAction);
8607              }
8608            }
8609
8610            // setup flags to prevent event duplication
8611            if (watchedEvent === "") {
8612              watchedEvent = event.type;
8613            }
8614            methods.setToClearWatchedEvent();
8615
8616          });
8617        },
8618        setupManual: function() {
8619          slider.controlNav = slider.manualControls;
8620          methods.controlNav.active();
8621
8622          slider.controlNav.bind(eventType, function(event) {
8623            event.preventDefault();
8624
8625            if (watchedEvent === "" || watchedEvent === event.type) {
8626              var $this = $(this),
8627                  target = slider.controlNav.index($this);
8628
8629              if (!$this.hasClass(namespace + 'active')) {
8630                (target > slider.currentSlide) ? slider.direction = "next" : slider.direction = "prev";
8631                slider.flexAnimate(target, slider.vars.pauseOnAction);
8632              }
8633            }
8634
8635            // setup flags to prevent event duplication
8636            if (watchedEvent === "") {
8637              watchedEvent = event.type;
8638            }
8639            methods.setToClearWatchedEvent();
8640          });
8641        },
8642        set: function() {
8643          var selector = (slider.vars.controlNav === "thumbnails") ? 'img' : 'a';
8644          slider.controlNav = $('.' + namespace + 'control-nav li ' + selector, (slider.controlsContainer) ? slider.controlsContainer : slider);
8645        },
8646        active: function() {
8647          slider.controlNav.removeClass(namespace + "active").eq(slider.animatingTo).addClass(namespace + "active");
8648        },
8649        update: function(action, pos) {
8650          if (slider.pagingCount > 1 && action === "add") {
8651            slider.controlNavScaffold.append($('<li><a href="#">' + slider.count + '</a></li>'));
8652          } else if (slider.pagingCount === 1) {
8653            slider.controlNavScaffold.find('li').remove();
8654          } else {
8655            slider.controlNav.eq(pos).closest('li').remove();
8656          }
8657          methods.controlNav.set();
8658          (slider.pagingCount > 1 && slider.pagingCount !== slider.controlNav.length) ? slider.update(pos, action) : methods.controlNav.active();
8659        }
8660      },
8661      directionNav: {
8662        setup: function() {
8663          var directionNavScaffold = $('<ul class="' + namespace + 'direction-nav"><li class="' + namespace + 'nav-prev"><a class="' + namespace + 'prev" href="#">
8663' + slider.vars.prevText + '</a></li><li class="' + namespace + 'nav-next"><a class="' + namespace + 'next" href="#">' + slider.vars.nextText + '</a></li></ul>');
8664
8665          // CUSTOM DIRECTION NAV:
8666          if (slider.customDirectionNav) {
8667            slider.directionNav = slider.customDirectionNav;
8668          // CONTROLSCONTAINER:
8669          } else if (slider.controlsContainer) {
8670            $(slider.controlsContainer).append(directionNavScaffold);
8671            slider.directionNav = $('.' + namespace + 'direction-nav li a', slider.controlsContainer);
8672          } else {
8673            slider.append(directionNavScaffold);
8674            slider.directionNav = $('.' + namespace + 'direction-nav li a', slider);
8675          }
8676
8677          methods.directionNav.update();
8678
8679          slider.directionNav.bind(eventType, function(event) {
8680            event.preventDefault();
8681            var target;
8682
8683            if (watchedEvent === "" || watchedEvent === event.type) {
8684              target = ($(this).hasClass(namespace + 'next')) ? slider.getTarget('next') : slider.getTarget('prev');
8685              slider.flexAnimate(target, slider.vars.pauseOnAction);
8686            }
8687
8688            // setup flags to prevent event duplication
8689            if (watchedEvent === "") {
8690              watchedEvent = event.type;
8691            }
8692            methods.setToClearWatchedEvent();
8693          });
8694        },
8695        update: function() {
8696          var disabledClass = namespace + 'disabled';
8697          if (slider.pagingCount === 1 || slider.pagingCount < 1) {
8698            slider.directionNav.addClass(disabledClass).attr('tabindex', '-1');
8699            slider.directionNav.parent().addClass(disabledClass);
8700          } else if (!slider.vars.animationLoop) {
8701            if (slider.animatingTo === 0) {
8702              slider.directionNav.removeClass(disabledClass).filter('.' + namespace + "prev").addClass(disabledClass).attr('tabindex', '-1');
8703        slider.directionNav.parent().removeClass(disabledClass);
8704        slider.directionNav.filter('.' + namespace + "prev").parent().addClass(disabledClass);
8705            } else if (slider.animatingTo === slider.last) {
8706              slider.directionNav.removeClass(disabledClass).filter('.' + namespace + "next").addClass(disabledClass).attr('tabindex', '-1');
8707        slider.directionNav.parent().removeClass(disabledClass);
8708        slider.directionNav.filter('.' + namespace + "next").parent().addClass(disabledClass);
8709            } else {
8710              slider.directionNav.removeClass(disabledClass).removeAttr('tabindex');
8711        slider.directionNav.parent().removeClass(disabledClass);
8712            }
8713          } else {
8714            slider.directionNav.removeClass(disabledClass).removeAttr('tabindex');
8715      slider.directionNav.parent().removeClass(disabledClass);
8716          }
8717        }
8718      },
8719      pausePlay: {
8720        setup: function() {
8721          var pausePlayScaffold = $('<div class="' + namespace + 'pauseplay"><a href="#"></a></div>');
8722
8723          // CONTROLSCONTAINER:
8724          if (slider.controlsContainer) {
8725            slider.controlsContainer.append(pausePlayScaffold);
8726            slider.pausePlay = $('.' + namespace + 'pauseplay a', slider.controlsContainer);
8727          } else {
8728            slider.append(pausePlayScaffold);
8729            slider.pausePlay = $('.' + namespace + 'pauseplay a', slider);
8730          }
8731
8732          methods.pausePlay.update((slider.vars.slideshow) ? namespace + 'pause' : namespace + 'play');
8733
8734          slider.pausePlay.bind(eventType, function(event) {
8735            event.preventDefault();
8736
8737            if (watchedEvent === "" || watchedEvent === event.type) {
8738              if ($(this).hasClass(namespace + 'pause')) {
8739                slider.manualPause = true;
8740                slider.manualPlay = false;
8741                slider.pause();
8742              } else {
8743                slider.manualPause = false;
8744                slider.manualPlay = true;
8745                slider.play();
8746              }
8747            }
8748
8749            // setup flags to prevent event duplication
8750            if (watchedEvent === "") {
8751              watchedEvent = event.type;
8752            }
8753            methods.setToClearWatchedEvent();
8754          });
8755        },
8756        update: function(state) {
8757          (state === "play") ? slider.pausePlay.removeClass(namespace + 'pause').addClass(namespace + 'play').html(slider.vars.playText) : slider.pausePlay.removeClass(namespace + 'play').addClass(namespace + 'pause').html(slider.vars.pauseText);
8758        }
8759      },
8760      touch: function() {
8761        var startX,
8762          startY,
8763          offset,
8764          cwidth,
8765          dx,
8766          startT,
8767          onTouchStart,
8768          onTouchMove,
8769          onTouchEnd,
8770          onMouseStart,
8771          onMouseMove,
8772          onMouseEnd,
8773          scrolling = false,
8774          localX = 0,
8775          localY = 0,
8776          accDx = 0,
8777          simulateTouch = slider.vars.simulateTouch;
8778
8779        if(!msGesture){
8780            onTouchStart = function(e) {
8781               var links = (('touches' in e) && $(e.target)[0].nodeName == "A");
8782
8783              if (slider.animating) {
8784                e.preventDefault();
8785              } else if ( ( window.navigator.msPointerEnabled ) || e.touches.length === 1 ) {
8786                slider.pause();
8787                // CAROUSEL:
8788                cwidth = (vertical) ? slider.h : slider.w;
8789                startT = Number(new Date());
8790                // CAROUSEL:
8791
8792                // Local vars for X and Y points.
8793                localX = e.touches[0].pageX;
8794                localY = e.touches[0].pageY;
8795
8796                offset = (carousel && reverse && slider.animatingTo === slider.last) ? 0 :
8797                         (carousel && reverse) ? slider.limit - (((slider.itemW + slider.vars.itemMargin) * 
8797slider.move) * slider.animatingTo) :
8798                         (carousel && slider.currentSlide === slider.last) ? slider.limit :
8799                         (carousel) ? ((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.currentSlide :
8800                         (reverse) ? (slider.last - slider.currentSlide + slider.cloneOffset) * cwidth : (slider.currentSlide + slider.cloneOffset) * cwidth;
8801                startX = (vertical) ? localY : localX;
8802                startY = (vertical) ? localX : localY;
8803
8804                el.addEventListener('touchmove', onTouchMove, false);
8805                el.addEventListener('touchend', onTouchEnd, false);
8806
8807                if (simulateTouch && !links) {
8808                  el.addEventListener('mousemove', onMouseMove, false);
8809                  el.addEventListener('mouseup', onMouseEnd, false);
8810                }
8811              }
8812            };
8813
8814            onTouchMove = function(e) {
8815              // Local vars for X and Y points.
8816
8817              localX = e.touches[0].pageX;
8818              localY = e.touches[0].pageY;
8819
8820              dx = (vertical) ? startX - localY : startX - localX;
8821              scrolling = (vertical) ? (Math.abs(dx) < Math.abs(localX - startY)) : (Math.abs(dx) < Math.abs(localY - startY));
8822
8823              var fxms = 500;
8824
8825              if ( ! scrolling || Number( new Date() ) - startT > fxms ) {
8826                e.preventDefault();
8827                if (!fade && slider.transitions) {
8828                  if (!slider.vars.animationLoop) {
8829                    dx = dx/((slider.currentSlide === 0 && dx < 0 || slider.currentSlide === slider.last && dx > 0) ? (Math.abs(dx)/cwidth+2) : 1);
8830                  }
8831                  slider.setProps(offset + dx, "setTouch");
8832                }
8833              }
8834            };
8835
8836            onTouchEnd = function(e) {
8837              var links = (('touches' in e) && $(e.target)[0].nodeName == "A");
8838              
8839              // finish the touch by undoing the touch session
8840              el.removeEventListener('touchmove', onTouchMove, false);
8841              
8842              if (simulateTouch && !links) {
8843                el.removeEventListener('mousemove', onMouseMove, false);
8844              }
8845
8846              if (slider.animatingTo === slider.currentSlide && !scrolling && !(dx === null)) {
8847                var updateDx = (reverse) ? -dx : dx,
8848                    target = (updateDx > 0) ? slider.getTarget('next') : slider.getTarget('prev');
8849
8850                if (slider.canAdvance(target) && (Number(new Date()) - startT < 550 && Math.abs(updateDx) > 50 || Math.abs(updateDx) > cwidth/2)) {
8851                  slider.flexAnimate(target, slider.vars.pauseOnAction);
8852                } else {
8853                  if (!fade) { slider.flexAnimate(slider.currentSlide, slider.vars.pauseOnAction, true); }
8854                }
8855              }
8856              el.removeEventListener('touchend', onTouchEnd, false);
8857
8858              if (simulateTouch && !links) {
8859                el.removeEventListener('mouseup', onMouseEnd, false);
8860              }
8861
8862              startX = null;
8863              startY = null;
8864              dx = null;
8865              offset = null;
8866            };
8867
8868            onMouseStart = function(e) {
8869              onTouchStart.call(this, toTouchEvent(e));
8870            };
8871
8872            onMouseMove = function(e) {
8873              onTouchMove.call(this, toTouchEvent(e));
8874            };
8875
8876            onMouseEnd = function(e) {
8877              onTouchEnd.call(this, toTouchEvent(e));
8878            };
8879
8880            el.addEventListener('touchstart', onTouchStart, false);
8881
8882             if (simulateTouch) {
8883              el.addEventListener('mousedown', onMouseStart, false);
8884            }
8885        }else{
8886            el.style.msTouchAction = "none";
8887            el._gesture = new MSGesture();
8888            el._gesture.target = el;
8889            el.addEventListener("MSPointerDown", onMSPointerDown, false);
8890            el._slider = slider;
8891            el.addEventListener("MSGestureChange", onMSGestureChange, false);
8892            el.addEventListener("MSGestureEnd", onMSGestureEnd, false);
8893
8894            function onMSPointerDown(e){
8895                e.stopPropagation();
8896                if (slider.animating) {
8897                    e.preventDefault();
8898                }else{
8899                    slider.pause();
8900                    el._gesture.addPointer(e.pointerId);
8901                    accDx = 0;
8902                    cwidth = (vertical) ? slider.h : slider.w;
8903                    startT = Number(new Date());
8904                    // CAROUSEL:
8905
8906                    offset = (carousel && reverse && slider.animatingTo === slider.last) ? 0 :
8907                        (carousel && reverse) ? slider.limit - (((slider.itemW + slider.vars.itemMargin) * 
vendor: 6,270 bytes, lines 8907-9059
8907slider.move) * slider.animatingTo) :
8908                            (carousel && slider.currentSlide === slider.last) ? slider.limit :
8909                                (carousel) ? ((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.currentSlide :
8910                                    (reverse) ? (slider.last - slider.currentSlide + slider.cloneOffset) * cwidth : (slider.currentSlide + slider.cloneOffset) * cwidth;
8911                }
8912            }
8913
8914            function onMSGestureChange(e) {
8915                e.stopPropagation();
8916                var slider = e.target._slider;
8917                if(!slider){
8918                    return;
8919                }
8920                var transX = -e.translationX,
8921                    transY = -e.translationY;
8922
8923                //Accumulate translations.
8924                accDx = accDx + ((vertical) ? transY : transX);
8925                dx = accDx;
8926                scrolling = (vertical) ? (Math.abs(accDx) < Math.abs(-transX)) : (Math.abs(accDx) < Math.abs(-transY));
8927
8928                if(e.detail === e.MSGESTURE_FLAG_INERTIA){
8929                    setImmediate(function (){
8930                        el._gesture.stop();
8931                    });
8932
8933                    return;
8934                }
8935
8936                if (!scrolling || Number(new Date()) - startT > 500) {
8937                    e.preventDefault();
8938                    if (!fade && slider.transitions) {
8939                        if (!slider.vars.animationLoop) {
8940                            dx = accDx / ((slider.currentSlide === 0 && accDx < 0 || slider.currentSlide === slider.last && accDx > 0) ? (Math.abs(accDx) / cwidth + 2) : 1);
8941                        }
8942                        slider.setProps(offset + dx, "setTouch");
8943                    }
8944                }
8945            }
8946
8947            function onMSGestureEnd(e) {
8948                e.stopPropagation();
8949                var slider = e.target._slider;
8950                if(!slider){
8951                    return;
8952                }
8953                if (slider.animatingTo === slider.currentSlide && !scrolling && !(dx === null)) {
8954                    var updateDx = (reverse) ? -dx : dx,
8955                        target = (updateDx > 0) ? slider.getTarget('next') : slider.getTarget('prev');
8956
8957                    if (slider.canAdvance(target) && (Number(new Date()) - startT < 550 && Math.abs(updateDx) > 50 || Math.abs(updateDx) > cwidth/2)) {
8958                        slider.flexAnimate(target, slider.vars.pauseOnAction);
8959                    } else {
8960                        if (!fade) { slider.flexAnimate(slider.currentSlide, slider.vars.pauseOnAction, true); }
8961                    }
8962                }
8963
8964                startX = null;
8965                startY = null;
8966                dx = null;
8967                offset = null;
8968                accDx = 0;
8969            }
8970        }
8971      },
8972      resize: function() {
8973        if (!slider.animating && slider.is(':visible')) {
8974          // aspro fix start
8975          if(slider.vars.autoHeight !== undefined && slider.vars.autoHeight) {
8976            slider.viewport.find('li').css('height', '');
8977          }
8978          // aspro fix end
8979          if (!carousel) { slider.doMath(); }
8980
8981          if (fade) {
8982            // SMOOTH HEIGHT:
8983            methods.smoothHeight();
8984          } else if (carousel) { //CAROUSEL:
8985            slider.slides.width(slider.computedW);
8986
8987            slider.update(slider.pagingCount);
8988            // slider.setProps();
8989          }
8990          else if (vertical) { //VERTICAL:
8991            slider.viewport.height(slider.h);
8992            slider.setProps(slider.h, "setTotal");
8993            // aspro fix start
8994            slider.viewport.find('li').css('height', slider.h);
8995            // aspro fix end
8996          } else {
8997            // SMOOTH HEIGHT:
8998            if (slider.vars.smoothHeight) { methods.smoothHeight(); }
8999            slider.newSlides.width(slider.computedW);
9000            slider.setProps(slider.computedW, "setTotal");
9001          }
9002        }
9003      },
9004      smoothHeight: function(dur) {
9005        if (!vertical || fade) {
9006          var $obj = (fade) ? slider : slider.viewport;
9007          (dur) ? $obj.animate({"height": slider.slides.eq(slider.animatingTo).innerHeight()}, dur) : $obj.innerHeight(slider.slides.eq(slider.animatingTo).innerHeight());
9008        }
9009      },
9010      sync: function(action) {
9011        var $obj = $(slider.vars.sync).data("flexslider"),
9012            target = slider.animatingTo;
9013
9014        switch (action) {
9015          case "animate": $obj.flexAnimate(target, slider.vars.pauseOnAction, false, true); break;
9016          case "play": if (!$obj.playing && !$obj.asNav) { $obj.play(); } break;
9017          case "pause": $obj.pause(); break;
9018        }
9019      },
9020      uniqueID: function($clone) {
9021        // Append _clone to current level and children elements with id attributes
9022        $clone.filter( '[id]' ).add($clone.find( '[id]' )).each(function() {
9023          var $this = $(this);
9024          $this.attr( 'id', $this.attr( 'id' ) + '_clone' );
9025        });
9026        return $clone;
9027      },
9028      pauseInvisible: {
9029        visProp: null,
9030        init: function() {
9031          var visProp = methods.pauseInvisible.getHiddenProp();
9032          if (visProp) {
9033            var evtname = visProp.replace(/[H|h]idden/,'') + 'visibilitychange';
9034            document.addEventListener(evtname, function() {
9035              if (methods.pauseInvisible.isHidden()) {
9036                if(slider.startTimeout) {
9037                  clearTimeout(slider.startTimeout); //If clock is ticking, stop timer and prevent from starting while invisible
9038                } else {
9039                  slider.pause(); //Or just pause
9040                }
9041              }
9042              else {
9043                if(slider.started) {
9044                  slider.play(); //Initiated before, just play
9045                } else {
9046                  if (slider.vars.initDelay > 0) {
9047                    setTimeout(slider.play, slider.vars.initDelay);
9048                  } else {
9049                    slider.play(); //Didn't init before: simply init or wait for it
9050                  }
9051                }
9052              }
9053            });
9054          }
9055        },
9056        isHidden: function() {
9057          var prop = methods.pauseInvisible.getHiddenProp();
9058          if (!prop) {
9059            return false;
9060          }
9061          return document[prop];
9062        },
9063        getHiddenProp: function() {
9064          var prefixes = ['webkit','moz','ms','o'];
9065          // if 'hidden' is natively supported just return it
9066          if ('hidden' in document) {
9067            return 'hidden';
9068          }
9069          // otherwise loop over all the known prefixes until we find one
9070          for ( var i = 0; i < prefixes.length; i++ ) {
9071              if ((prefixes[i] + 'Hidden') in document) {
9072                return prefixes[i] + 'Hidden';
9073              }
9074          }
9075          // otherwise it's not supported
9076          return null;
9077        }
9078      },
9079      setToClearWatchedEvent: function() {
9080        clearTimeout(watchedEventClearTimer);
9081        watchedEventClearTimer = setTimeout(function() {
9082          watchedEvent = "";
9083        }, 3000);
9084      }
9085    };
9086
9087    // public methods
9088    slider.flexAnimate = function(target, pause, override, withSync, fromNav) {
9089      if (!slider.vars.animationLoop && target !== slider.currentSlide) {
9090        slider.direction = (target > slider.currentSlide) ? "next" : "prev";
9091      }
9092
9093      if (asNav && slider.pagingCount === 1) slider.direction = (slider.currentItem < target) ? "next" : "prev";
9094
9095      if (!slider.animating && (slider.canAdvance(target, fromNav) || override)/* && slider.is(":visible")*/) {
9096        if (asNav && withSync) {
9097          var master = $(slider.vars.asNavFor).data('flexslider');
9098          slider.atEnd = target === 0 || target === slider.count - 1;
9099          master.flexAnimate(target, true, false, true, fromNav);
9100          slider.direction = (slider.currentItem < target) ? "next" : "prev";
9101          master.direction = slider.direction;
9102
9103          // ++ added by kach
9104          slider.currentItem = target;
9105          slider.slides.removeClass(namespace + "active-slide").eq(target).addClass(namespace + "active-slide");
9106          var newtarget = Math.floor((target + 1)/slider.visible) > 0 ? (Math.floor((target + 1 - slider.visible) / slider.move)) : 0;
9107          if(newtarget != slider.currentSlide){
9108            target = newtarget;
9109          }
9110          else{
9111            return false;
9112          }
9113          // ++
9114
9115          // -- removed by kach
9116          /*
9117          if (Math.ceil((target + 1)/slider.visible) - 1 !== slider.currentSlide && target !== 0) {
9118            slider.currentItem = target;
9119            slider.slides.removeClass(namespace + "active-slide").eq(target).addClass(namespace + "active-slide");
9120            target = Math.floor(target/slider.visible);
9121          } else {
9122            slider.currentItem = target;
9123            slider.slides.removeClass(namespace + "active-slide").eq(target).addClass(namespace + "active-slide");
9124            return false;
9125          }*/
9126          
9127          // --
9128        }
9129
9130        slider.animating = true;
9131        slider.animatingTo = target;
9132
9133        // SLIDESHOW:
9134        if (pause) { slider.pause(); }
9135
9136        // API: before() animation Callback
9137        slider.vars.before(slider);
9138
9139        // SYNC:
9140        if (slider.syncExists && !fromNav) { methods.sync("animate"); }
9141
9142        // CONTROLNAV
9143        if (slider.vars.controlNav) { methods.controlNav.active(); }
9144
9145        // !CAROUSEL:
9146        // CANDIDATE: slide active class (for add/remove slide)
9147        if (!carousel) { slider.slides.removeClass(namespace + 'active-slide').eq(target).addClass(namespace + 'active-slide'); }
9148
9149        // INFINITE LOOP:
9150        // CANDIDATE: atEnd
9151        slider.atEnd = target === 0 || target === slider.last;
9152
9153        // DIRECTIONNAV:
9154        if (slider.vars.directionNav) { methods.directionNav.update(); }
9155
9156        if (target === slider.last) {
9157          // API: end() of cycle Callback
9158          slider.vars.end(slider);
9159          // SLIDESHOW && !INFINITE LOOP:
9160          if (!slider.vars.animationLoop) { slider.pause(); }
9161        }
9162
9163        // SLIDE:
9164        if (!fade) {
9165          var dimension = (vertical) ? slider.slides.filter(':first').height() : slider.computedW,
9166              margin, slideString, calcNext;
9167
9168          // INFINITE LOOP / REVERSE:
9169          if (carousel) {
9170            margin = slider.vars.itemMargin;
vendor: 16,214 bytes, lines 9171-9539
9171            calcNext = ((slider.itemW + margin) * slider.move) * slider.animatingTo;
9172            slideString = (calcNext > slider.limit && slider.visible !== 1) ? slider.limit : calcNext;
9173          } else if (slider.currentSlide === 0 && target === slider.count - 1 && slider.vars.animationLoop && slider.direction !== "next") {
9174            slideString = (reverse) ? (slider.count + slider.cloneOffset) * dimension : 0;
9175          } else if (slider.currentSlide === slider.last && target === 0 && slider.vars.animationLoop && slider.direction !== "prev") {
9176            slideString = (reverse) ? 0 : (slider.count + 1) * dimension;
9177          } else {
9178            slideString = (reverse) ? ((slider.count - 1) - target + slider.cloneOffset) * dimension : (target + slider.cloneOffset) * dimension;
9179          }
9180          slider.setProps(slideString, "", slider.vars.animationSpeed);
9181          if (slider.transitions) {
9182            if (!slider.vars.animationLoop || !slider.atEnd) {
9183              slider.animating = false;
9184              slider.currentSlide = slider.animatingTo;
9185            }
9186
9187            // Unbind previous transitionEnd events and re-bind new transitionEnd event
9188            slider.container.unbind("webkitTransitionEnd transitionend");
9189            slider.container.bind("webkitTransitionEnd transitionend", function() {
9190              clearTimeout(slider.ensureAnimationEnd);
9191              slider.wrapup(dimension);
9192            });
9193
9194            // Insurance for the ever-so-fickle transitionEnd event
9195            clearTimeout(slider.ensureAnimationEnd);
9196            slider.ensureAnimationEnd = setTimeout(function() {
9197              slider.wrapup(dimension);
9198            }, slider.vars.animationSpeed + 100);
9199
9200          } else {
9201            slider.container.animate(slider.args, slider.vars.animationSpeed, slider.vars.easing, function(){
9202              slider.wrapup(dimension);
9203            });
9204          }
9205        } else { // FADE:
9206          if (!touch) {
9207            slider.slides.eq(slider.currentSlide).css({"zIndex": 1}).animate({"opacity": 0}, slider.vars.animationSpeed, slider.vars.easing);
9208            slider.slides.eq(target).css({"zIndex": 2}).animate({"opacity": 1}, slider.vars.animationSpeed, slider.vars.easing, slider.wrapup);
9209          } else {
9210            slider.slides.eq(slider.currentSlide).css({ "opacity": 0, "zIndex": 1 });
9211            slider.slides.eq(target).css({ "opacity": 1, "zIndex": 2 });
9212            slider.wrapup(dimension);
9213          }
9214        }
9215        // SMOOTH HEIGHT:
9216        if (slider.vars.smoothHeight) { methods.smoothHeight(slider.vars.animationSpeed); }
9217      }
9218    };
9219    slider.wrapup = function(dimension) {
9220      // SLIDE:
9221      if (!fade && !carousel) {
9222        if (slider.currentSlide === 0 && slider.animatingTo === slider.last && slider.vars.animationLoop) {
9223          slider.setProps(dimension, "jumpEnd");
9224        } else if (slider.currentSlide === slider.last && slider.animatingTo === 0 && slider.vars.animationLoop) {
9225          slider.setProps(dimension, "jumpStart");
9226        }
9227      }
9228      slider.animating = false;
9229      slider.currentSlide = slider.animatingTo;
9230      // API: after() animation Callback
9231      slider.vars.after(slider);
9232    };
9233
9234    // SLIDESHOW:
9235    slider.animateSlides = function() {
9236      if (!slider.animating && focused ) { slider.flexAnimate(slider.getTarget("next")); }
9237    };
9238    // SLIDESHOW:
9239    slider.pause = function() {
9240      clearInterval(slider.animatedSlides);
9241      slider.animatedSlides = null;
9242      slider.playing = false;
9243      // PAUSEPLAY:
9244      if (slider.vars.pausePlay) { methods.pausePlay.update("play"); }
9245      // SYNC:
9246      if (slider.syncExists) { methods.sync("pause"); }
9247    };
9248    // SLIDESHOW:
9249    slider.play = function() {
9250      if (slider.playing) { clearInterval(slider.animatedSlides); }
9251      slider.animatedSlides = slider.animatedSlides || setInterval(slider.animateSlides, slider.vars.slideshowSpeed);
9252      slider.started = slider.playing = true;
9253      // PAUSEPLAY:
9254      if (slider.vars.pausePlay) { methods.pausePlay.update("pause"); }
9255      // SYNC:
9256      if (slider.syncExists) { methods.sync("play"); }
9257    };
9258    slider.smoothHeight = function(){
9259      methods.smoothHeight();
9260    };
9261    // STOP:
9262    slider.stop = function () {
9263      slider.pause();
9264      slider.stopped = true;
9265    };
9266    slider.canAdvance = function(target, fromNav) {
9267      // ASNAV:
9268      var last = (asNav) ? slider.pagingCount - 1 : slider.last;
9269      return (fromNav) ? true :
9270             (asNav && slider.currentItem === slider.count - 1 && target === 0 && slider.direction === "prev") ? true :
9271             (asNav && slider.currentItem === 0 && target === slider.pagingCount - 1 && slider.direction !== "next") ? false :
9272             (target === slider.currentSlide && !asNav) ? false :
9273             (slider.vars.animationLoop) ? true :
9274             (slider.atEnd && slider.currentSlide === 0 && target === last && slider.direction !== "next") ? false :
9275             (slider.atEnd && slider.currentSlide === last && target === 0 && slider.direction === "next") ? false :
9276             true;
9277    };
9278    slider.getTarget = function(dir) {
9279      slider.direction = dir;
9280      if (dir === "next") {
9281        return (slider.currentSlide === slider.last) ? 0 : slider.currentSlide + 1;
9282      } else {
9283        return (slider.currentSlide === 0) ? slider.last : slider.currentSlide - 1;
9284      }
9285    };
9286
9287    // SLIDE:
9288    slider.setProps = function(pos, special, dur) {
9289      var target = (function() {
9290        var posCheck = (pos) ? pos : ((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.animatingTo,
9291            posCalc = (function() {
9292              if (carousel) {
9293                return (special === "setTouch") ? pos :
9294                       (reverse && slider.animatingTo === slider.last) ? 0 :
9295                       (reverse) ? slider.limit - (((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.animatingTo) :
9296                       (slider.animatingTo === slider.last) ? slider.limit : posCheck;
9297              } else {
9298                switch (special) {
9299                  case "setTotal": return (reverse) ? ((slider.count - 1) - slider.currentSlide + slider.cloneOffset) * pos : (slider.currentSlide + slider.cloneOffset) * pos;
9300                  case "setTouch": return (reverse) ? pos : pos;
9301                  case "jumpEnd": return (reverse) ? pos : slider.count * pos;
9302                  case "jumpStart": return (reverse) ? slider.count * pos : pos;
9303                  default: return pos;
9304                }
9305              }
9306            }());
9307
9308            return (posCalc * -1) + "px";
9309          }());
9310
9311
9312
9313      if (slider.transitions) {
9314        target = (vertical) ? "translate3d(0," + target + ",0)" : "translate3d(" + target + ",0,0)";
9315        dur = (dur !== undefined) ? (dur/1000) + "s" : "0s";
9316        slider.container.css("-" + slider.pfx + "-transition-duration", dur);
9317         slider.container.css("transition-duration", dur);
9318      }
9319
9320      slider.args[slider.prop] = target;
9321      if (slider.transitions || dur === undefined) { slider.container.css(slider.args); }
9322
9323      slider.container.css('transform',target);
9324    };
9325
9326    slider.setup = function(type) {
9327      // SLIDE:
9328      if (!fade) {
9329        var sliderOffset, arr;
9330
9331        if (type === "init") {
9332          slider.viewport = $('<div class="' + namespace + 'viewport"></div>').css({"overflow": "hidden", "position": "relative"}).appendTo(slider).append(slider.container);
9333          // INFINITE LOOP:
9334          slider.cloneCount = 0;
9335          slider.cloneOffset = 0;
9336          // REVERSE:
9337          if (reverse) {
9338            arr = $.makeArray(slider.slides).reverse();
9339            slider.slides = $(arr);
9340            slider.container.empty().append(slider.slides);
9341          }
9342        }
9343        // INFINITE LOOP && !CAROUSEL:
9344        if (slider.vars.animationLoop && !carousel) {
9345          slider.cloneCount = 2;
9346          slider.cloneOffset = 1;
9347          // aspro fix start
9348          slider.viewport.find('li').css('height', slider.h);
9349          // aspro fix end
9350          // clear out old clones
9351          if (type !== "init") { slider.container.find('.clone').remove(); }
9352          slider.container.append(methods.uniqueID(slider.slides.first().clone().addClass('clone')).attr('aria-hidden', 'true'))
9353                          .prepend(methods.uniqueID(slider.slides.last().clone().addClass('clone')).attr('aria-hidden', 'true'));
9354        }
9355        slider.newSlides = $(slider.vars.selector, slider);
9356
9357        sliderOffset = (reverse) ? slider.count - 1 - slider.currentSlide + slider.cloneOffset : slider.currentSlide + slider.cloneOffset;
9358        // VERTICAL:
9359        if (vertical && !carousel) {
9360          slider.container.height((slider.count + slider.cloneCount) * 200 + "%").css("position", "absolute").width("100%");
9361          setTimeout(function(){
9362            slider.newSlides.css({"display": "block"});
9363            slider.doMath();
9364            slider.viewport.height(slider.h);
9365            slider.setProps(sliderOffset * slider.h, "init");
9366          }, (type === "init") ? 100 : 0);
9367        } else {
9368          slider.container.width((slider.count + slider.cloneCount) * 200 + "%");
9369          slider.setProps(sliderOffset * slider.computedW, "init");
9370          setTimeout(function(){
9371            slider.doMath();
9372            slider.newSlides.css({"width": slider.computedW, "marginRight" : slider.computedM, "float": "left", "display": "block"});
9373            // SMOOTH HEIGHT:
9374            if (slider.vars.smoothHeight) { methods.smoothHeight(); }
9375          }, (type === "init") ? 100 : 0);
9376        }
9377      } else { // FADE:
9378        slider.slides.css({"width": "100%", "float": "left", "marginRight": "-100%", "position": "relative"});
9379        if (type === "init") {
9380          if (!touch) {
9381            //slider.slides.eq(slider.currentSlide).fadeIn(slider.vars.animationSpeed, slider.vars.easing);
9382            if (slider.vars.fadeFirstSlide == false) {
9383              slider.slides.css({ "opacity": 0, "display": "block", "zIndex": 1 }).eq(slider.currentSlide).css({"zIndex": 2}).css({"opacity": 1});
9384            } else {
9385              slider.slides.css({ "opacity": 0, "display": "block", "zIndex": 1 }).eq(slider.currentSlide).css({"zIndex": 2}).animate({"opacity": 1},slider.vars.animationSpeed,slider.vars.easing);
9386            }
9387          } else {
9388            slider.slides.css({ "opacity": 0, "display": "block", "webkitTransition": "opacity " + slider.vars.animationSpeed / 1000 + "s ease", "zIndex": 1 }).eq(slider.currentSlide).css({ "opacity": 1, "zIndex": 2});
9389          }
9390        }
9391        // SMOOTH HEIGHT:
9392        if (slider.vars.smoothHeight) { methods.smoothHeight(); }
9393      }
9394      // !CAROUSEL:
9395      // CANDIDATE: active slide
9396      if (!carousel) { slider.slides.removeClass(namespace + "active-slide").eq(slider.currentSlide).addClass(namespace + "active-slide"); }
9397
9398      //FlexSlider: init() Callback
9399      slider.vars.init(slider);
9400    };
9401
9402    slider.doMath = function() {
9403      var slide = slider.slides.first(),
9404          slideMargin = slider.vars.itemMargin,
9405          minItems = slider.vars.minItems,
9406          maxItems = slider.vars.maxItems;
9407
9408      slider.w = (slider.viewport===undefined) ? slider.width() : slider.viewport.width();
9409      slider.h = slide.height();
9410      // aspro fix start
9411      var height = 0;
9412      if(vertical) {
9413        slider.slides.each(function(i, el) {
9414          var elHeight = $(el).height();
9415          if(elHeight > height){
9416            height = elHeight;
9417          }
9418        });
9419        slider.h = height;
9420      }
9421      // aspro fix end
9422      slider.boxPadding = slide.outerWidth() - slide.width();
9423
9424      // CAROUSEL:
9425      if (carousel) {
9426        slider.itemT = slider.vars.itemWidth + slideMargin;
9427        slider.itemM = slideMargin;
9428        slider.minW = (minItems) ? minItems * slider.itemT : slider.w;
9429        slider.maxW = (maxItems) ? (maxItems * slider.itemT) - slideMargin : slider.w;
9430        slider.itemW = (slider.minW > slider.w) ? (slider.w - (slideMargin * (minItems - 1)))/minItems :
9431                       (slider.maxW < slider.w) ? (slider.w - (slideMargin * (maxItems - 1)))/maxItems :
9432                       (slider.vars.itemWidth > slider.w) ? slider.w : slider.vars.itemWidth;
9433
9434        slider.visible = Math.floor(slider.w / slider.itemW); // -- removed by kach
9435        // slider.visible = Math.floor((slider.itemT > slider.itemW ? slider.w + slider.itemM : slider.w)/(slider.itemT > slider.itemW ? slider.itemT : slider.itemW)); // ++ added by kach
9436        slider.move = (slider.vars.move > 0 && slider.vars.move < slider.visible ) ? slider.vars.move : slider.visible;
9437        slider.pagingCount = Math.ceil(((slider.count - slider.visible)/slider.move) + 1);
9438
9439        slider.last =  slider.pagingCount - 1;
9440        slider.limit = (slider.pagingCount === 1) ? 0 :
9441                       (slider.vars.itemWidth > slider.w) ? (slider.itemW * (slider.count - 1)) + (slideMargin * (slider.count - 1)) : ((slider.itemW + slideMargin) * slider.count) - slider.w - slideMargin;
9442      } else {
9443        slider.itemW = slider.w;
9444        slider.itemM = slideMargin;
9445        slider.pagingCount = slider.count;
9446        slider.last = slider.count - 1;
9447      }
9448      slider.computedW = slider.itemW - slider.boxPadding;
9449      slider.computedM = slider.itemM;
9450    };
9451
9452    slider.update = function(pos, action) {
9453      slider.doMath();
9454
9455      // update currentSlide and slider.animatingTo if necessary
9456      if (!carousel) {
9457        if (pos < slider.currentSlide) {
9458          slider.currentSlide += 1;
9459        } else if (pos <= slider.currentSlide && pos !== 0) {
9460          slider.currentSlide -= 1;
9461        }
9462        slider.animatingTo = slider.currentSlide;
9463      }
9464
9465      // update controlNav
9466      if (slider.vars.controlNav && !slider.manualControls) {
9467        if ((action === "add" && !carousel) || slider.pagingCount > slider.controlNav.length) {
9468          methods.controlNav.update("add");
9469        } else if ((action === "remove" && !carousel) || slider.pagingCount < slider.controlNav.length) {
9470          /*if (carousel && slider.currentSlide > slider.last) {
9471            slider.currentSlide -= 1;
9472            slider.animatingTo -= 1;
9473          }*/
9474          methods.controlNav.update("remove", slider.last);
9475        }
9476      }
9477      // update directionNav
9478      if (slider.vars.directionNav) { methods.directionNav.update(); }
9479
9480    };
9481
9482    slider.addSlide = function(obj, pos) {
9483      var $obj = $(obj);
9484
9485      slider.count += 1;
9486      slider.last = slider.count - 1;
9487
9488      // append new slide
9489      if (vertical && reverse) {
9490        (pos !== undefined) ? slider.slides.eq(slider.count - pos).after($obj) : slider.container.prepend($obj);
9491      } else {
9492        (pos !== undefined) ? slider.slides.eq(pos).before($obj) : slider.container.append($obj);
9493      }
9494
9495      // update currentSlide, animatingTo, controlNav, and directionNav
9496      slider.update(pos, "add");
9497
9498      // update slider.slides
9499      slider.slides = $(slider.vars.selector + ':not(.clone)', slider);
9500      // re-setup the slider to accomdate new slide
9501      slider.setup();
9502
9503      //FlexSlider: added() Callback
9504      slider.vars.added(slider);
9505    };
9506    slider.removeSlide = function(obj) {
9507      var pos = (isNaN(obj)) ? slider.slides.index($(obj)) : obj;
9508
9509      // update count
9510      slider.count -= 1;
9511      slider.last = slider.count - 1;
9512
9513      // remove slide
9514      if (isNaN(obj)) {
9515        $(obj, slider.slides).remove();
9516      } else {
9517        (vertical && reverse) ? slider.slides.eq(slider.last).remove() : slider.slides.eq(obj).remove();
9518      }
9519
9520      // update currentSlide, animatingTo, controlNav, and directionNav
9521      slider.doMath();
9522      slider.update(pos, "remove");
9523
9524      // update slider.slides
9525      slider.slides = $(slider.vars.selector + ':not(.clone)', slider);
9526      // re-setup the slider to accomdate new slide
9527      slider.setup();
9528
9529      // FlexSlider: removed() Callback
9530      slider.vars.removed(slider);
9531    };
9532
9533    //FlexSlider: Initialize
9534    methods.init();
9535  };
9536
9537  // Ensure the slider isn't focussed if the window loses focus.
9538  $( window ).blur( function ( e ) {
9539    focused = false;
9540  }).focus( function ( e ) {
9541    focused = true;
9542  });
9543
9544  //FlexSlider: Default Settings
9545  $.flexslider.defaults = {
9546    namespace: "flex-",             //{NEW} String: Prefix string attached to the class of every element generated by the plugin
9547    selector: ".slides > li",       //{NEW} Selector: Must match a simple pattern. '{container} > {slide}' -- Ignore pattern at your own peril
9548    animation: "fade",              //String: Select your animation type, "fade" or "slide"
9549    easing: "swing",                //{NEW} String: Determines the easing method used in jQuery transitions. jQuery easing plugin is supported!
9550    direction: "horizontal",        //String: Select the sliding direction, "horizontal" or "vertical"
9551    reverse: false,                 //{NEW} Boolean: Reverse the animation direction
9552    animationLoop: true,            //Boolean: Should the animation loop? If false, directionNav will received "disable" classes at either end
9553    smoothHeight: false,            //{NEW} Boolean: Allow height of the slider to animate smoothly in horizontal mode
9554    startAt: 0,                     //Integer: The slide that the slider should start on. Array notation (0 = first slide)
9555    slideshow: true,                //Boolean: Animate slider automatically
9556    slideshowSpeed: 7000,           //Integer: Set the speed of the slideshow cycling, in milliseconds
9557    animationSpeed: 600,            //Integer: Set the speed of animations, in milliseconds
9558    initDelay: 0,                   //{NEW} Integer: Set an initialization delay, in milliseconds
9559    randomize: false,               //Boolean: Randomize slide order
9560    fadeFirstSlide: true,           //Boolean: Fade in the first slide when animation type is "fade"
9561    thumbCaptions: false,           //Boolean: Whether or not to put captions on thumbnails when using the "thumbnails" controlNav.
9562
9563    // Usability features
9564    pauseOnAction: true,            //Boolean: Pause the slideshow when interacting with control elements, highly recommended.
9565    pauseOnHover: false,            //Boolean: Pause the slideshow when hovering over slider, then resume when no longer hovering
9566    pauseInvisible: true,           //{NEW} Boolean: Pause the slideshow when tab is invisible, resume when visible. Provides better UX, lower CPU usage.
9567    useCSS: true,                   //{NEW} Boolean: Slider will use CSS3 transitions if available
9568    touch: true,                    //{NEW} Boolean: Allow touch swipe navigation of the slider on touch-enabled devices
9569    video: false,                   //{NEW} Boolean: If using video in the slider, will prevent CSS3 3D Transforms to avoid graphical glitches
9570    simulateTouch: false,           //{NEW} Boolean: Allow mouse swipe navigation of the slider. Requires touch to be true
9571
9572    // Primary Controls
9573    controlNav: true,               //Boolean: Create navigation for paging control of each slide? Note: Leave true for manualControls usage
9574    directionNav: true,             //Boolean: Create navigation for previous/next navigation? (true/false)
9575    prevText: "Previous",           //String: Set the text for the "previous" directionNav item
9576    nextText: "Next",               //String: Set the text for the "next" directionNav item
9577
9578    // Secondary Navigation
9579    keyboard: true,                 //Boolean: Allow slider navigating via keyboard left/right keys
9580    multipleKeyboard: false,        //{NEW} Boolean: Allow keyboard navigation to affect multiple sliders. Default behavior cuts out keyboard navigation with more than one slider present.
9581    mousewheel: false,              //{UPDATED} Boolean: Requires jquery.mousewheel.js (https://github.com/brandonaaron/jquery-mousewheel) - Allows slider navigating via mousewheel
9582    pausePlay: false,               //Boolean: Create pause/play dynamic element
9583    pauseText: "Pause",             //String: Set the text for the "pause" pausePlay item
9584    playText: "Play",               //String: Set the text for the "play" pausePlay item
9585
9586    // Special properties
9587    controlsContainer: "",          //{UPDATED} jQuery Object/Selector: Declare which container the navigation elements should be appended too. Default container is the FlexSlider element. Example use would be $(".flexslider-container"). Property is ignored if given element is not found.
9588    manualControls: "",             //{UPDATED} jQuery Object/Selector: Declare custom control navigation. Examples would be $(".flex-control-nav li") or "#tabs-nav li img", etc. The number of elements in your controlNav should match the number of slides/tabs.
9589    customDirectionNav: "",         //{NEW}
9589 jQuery Object/Selector: Custom prev / next button. Must be two jQuery elements. In order to make the events work they have to have the classes "prev" and "next" (plus namespace)
9590    sync: "",                       //{NEW} Selector: Mirror the actions performed on this slider with another slider. Use with care.
9591    asNavFor: "",                   //{NEW} Selector: Internal property exposed for turning the slider into a thumbnail navigation for another slider
9592
9593    // Carousel Options
9594    itemWidth: 0,                   //{NEW} Integer: Box-model width of individual carousel items, including horizontal borders and padding.
9595    itemMargin: 0,                  //{NEW} Integer: Margin between carousel items.
9596    minItems: 1,                    //{NEW} Integer: Minimum number of carousel items that should be visible. Items will resize fluidly when below this.
9597    maxItems: 0,                    //{NEW} Integer: Maxmimum number of carousel items that should be visible. Items will resize fluidly when above this limit.
9598    move: 0,                        //{NEW} Integer: Number of carousel items that should move on animation. If 0, slider will move all visible items.
9599    allowOneSlide: true,           //{NEW} Boolean: Whether or not to allow a slider comprised of a single slide
9600
9601    // Callback API
9602    start: function(){},            //Callback: function(slider) - Fires when the slider loads the first slide
9603    before: function(){},           //Callback: function(slider) - Fires asynchronously with each slider animation
9604    after: function(){},            //Callback: function(slider) - Fires after each slider animation completes
9605    end: function(){},              //Callback: function(slider) - Fires when the slider reaches the last slide (asynchronous)
9606    added: function(){},            //{NEW} Callback: function(slider) - Fires after a slide is added
9607    removed: function(){},           //{NEW} Callback: function(slider) - Fires after a slide is removed
9608    init: function() {}             //{NEW} Callback: function(slider) - Fires after the slider is initially setup
9609  };
9610
9611  //FlexSlider: Plugin Function
9612  $.fn.flexslider = function(options) {
9613    if (options === undefined) { options = {}; }
9614
9615    if (typeof options === "object") {
9616      return this.each(function() {
9617        var $this = $(this),
9618            selector = (options.selector) ? options.selector : ".slides > li",
9619            $slides = $this.find(selector);
9620
9621      if ( ( $slides.length === 1 && options.allowOneSlide === false ) || $slides.length === 0 ) {
9622          $slides.fadeIn(400);
9623          if (options.start) { options.start($this); }
9624        } else if ($this.data('flexslider') === undefined) {
9625          new $.flexslider(this, options);
9626        }
9627      });
9628    } else {
9629      // Helper strings to quickly perform functions on the slider
9630      var $slider = $(this).data('flexslider');
9631      switch (options) {
9632        case "play": $slider.play(); break;
9633        case "pause": $slider.pause(); break;
9634        case "stop": $slider.stop(); break;
9635        case "next": $slider.flexAnimate($slider.getTarget("next"), true); break;
9636        case "prev":
9637        case "previous": $slider.flexAnimate($slider.getTarget("prev"), true); break;
9638        default: if (typeof options === "number") { $slider.flexAnimate(options, true); }
9639      }
9640    }
9641  };
9642})(jQuery);
9643
9644/* End */
9645;
9646; /* Start:"a:4:{s:4:"full";s:67:"/bitrix/templates/aspro_max/js/jquery.uniform.min.js?17164655378308";s:6:"source";s:52:"/bitrix/templates/aspro_max/js/jquery.uniform.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
9647(function(e,t){"use strict";function n(e){var t=Array.prototype.slice.call(arguments,1);return e.prop?e.prop.apply(e,t):e.attr.apply(e,t)}function s(e,t,n){var s,a;for(s in n)n.hasOwnProperty(s)&&(a=s.replace(/ |$/g,t.eventNamespace),e.bind(a,n[s]))}function a(e,t,n){s(e,n,{focus:function(){t.addClass(n.focusClass)},blur:function(){t.removeClass(n.focusClass),t.removeClass(n.activeClass)},mouseenter:function(){t.addClass(n.hoverClass)},mouseleave:function(){t.removeClass(n.hoverClass),t.removeClass(n.activeClass)},"mousedown touchbegin":function(){e.is(":disabled")||t.addClass(n.activeClass)},"mouseup touchend":function(){t.removeClass(n.activeClass)}})}function i(e,t){e.removeClass(t.hoverClass+" "+t.focusClass+" "+t.activeClass)}function r(e,t,n){n?e.addClass(t):e.removeClass(t)}function l(e,t,n){var s="checked",a=t.is(":"+s);t.prop?t.prop(s,a):a?t.attr(s,s):t.removeAttr(s),r(e,n.checkedClass,a)}function u(e,t,n){r(e,n.disabledClass,t.is(":disabled"))}function o(e,t,n){switch(n){case"after":return e.after(t),e.next();case"before":return e.before(t),e.prev();case"wrap":return e.wrap(t),e.parent()}return null}function c(t,s,a){var i,r,l;return a||(a={}),a=e.extend({bind:{},divClass:null,divWrap:"wrap",spanClass:null,spanHtml:null,spanWrap:"wrap"},a),i=e("<div />"),r=e("<span />"),s.autoHide&&t.is(":hidden")&&"none"===t.css("display")&&i.hide(),a.divClass&&i.addClass(a.divClass),s.wrapperClass&&i.addClass(s.wrapperClass),a.spanClass&&r.addClass(a.spanClass),l=n(t,"id"),s.useID&&l&&n(i,"id",s.idPrefix+"-"+l),a.spanHtml&&r.html(a.spanHtml),i=o(t,i,a.divWrap),r=o(t,r,a.spanWrap),u(i,t,s),{div:i,span:r}}function d(t,n){var s;return n.wrapperClass?(s=e("<span />").addClass(n.wrapperClass),s=o(t,s,"wrap")):null}function f(){var t,n,s,a;return a="rgb(120,2,153)",n=e('<div style="width:0;height:0;color:'+a+'">'),e("body").append(n),s=n.get(0),t=window.getComputedStyle?window.getComputedStyle(s,"").color:(s.currentStyle||s.style||{}).color,n.remove(),t.replace(/ /g,"")!==a}function p(t){return t?e("<span />").text(t).html():""}function m(){return navigator.cpuClass&&!navigator.product}function v(){return window.XMLHttpRequest!==void 0?!0:!1}function h(e){var t;return e[0].multiple?!0:(t=n(e,"size"),!t||1>=t?!1:!0)}function C(){return!1}function w(e,t){var n="none";s(e,t,{"selectstart dragstart mousedown":C}),e.css({MozUserSelect:n,msUserSelect:n,webkitUserSelect:n,userSelect:n})}function b(e,t,n){var s=e.val();""===s?s=n.fileDefaultHtml:(s=s.split(/[\/\\]+/),s=s[s.length-1]),t.text(s)}function y(e,t,n){var s,a;for(s=[],e.each(function(){var e;
vendor: 4,406 bytes, line 9647
9647for(e in t)Object.prototype.hasOwnProperty.call(t,e)&&(s.push({el:this,name:e,old:this.style[e]}),this.style[e]=t[e])}),n();s.length;)a=s.pop(),a.el.style[a.name]=a.old}function g(e,t){var n;n=e.parents(),n.push(e[0]),n=n.not(":visible"),y(n,{visibility:"hidden",display:"block",position:"absolute"},t)}function k(e,t){return function(){e.unwrap().unwrap().unbind(t.eventNamespace)}}var H=!0,x=!1,A=[{match:function(e){return e.is("a, button, :submit, :reset, input[type='button']")},apply:function(e,t){var r,l,o,d,f;return l=t.submitDefaultHtml,e.is(":reset")&&(l=t.resetDefaultHtml),d=e.is("a, button")?function(){return e.html()||l}:function(){return p(n(e,"value"))||l},o=c(e,t,{divClass:t.buttonClass,spanHtml:d()}),r=o.div,a(e,r,t),f=!1,s(r,t,{"click touchend":function(){var t,s,a,i;f||e.is(":disabled")||(f=!0,e[0].dispatchEvent?(t=document.createEvent("MouseEvents"),t.initEvent("click",!0,!0),s=e[0].dispatchEvent(t),e.is("a")&&s&&(a=n(e,"target"),i=n(e,"href"),a&&"_self"!==a?window.open(i,a):document.location.href=i)):e.click(),f=!1)}}),w(r,t),{remove:function(){return r.after(e),r.remove(),e.unbind(t.eventNamespace),e},update:function(){i(r,t),u(r,e,t),e.detach(),o.span.html(d()).append(e)}}}},{match:function(e){return e.is(":checkbox")},apply:function(e,t){var n,r,o;return n=c(e,t,{divClass:t.checkboxClass}),r=n.div,o=n.span,a(e,r,t),s(e,t,{"click touchend":function(){l(o,e,t)}}),l(o,e,t),{remove:k(e,t),update:function(){i(r,t),o.removeClass(t.checkedClass),l(o,e,t),u(r,e,t)}}}},{match:function(e){return e.is(":file")},apply:function(t,r){function l(){b(t,p,r)}var d,f,p,v;return d=c(t,r,{divClass:r.fileClass,spanClass:r.fileButtonClass,spanHtml:r.fileButtonHtml,spanWrap:"after"}),f=d.div,v=d.span,p=e("<span />").html(r.fileDefaultHtml),p.addClass(r.filenameClass),p=o(t,p,"after"),n(t,"size")||n(t,"size",f.width()/10),a(t,f,r),l(),m()?s(t,r,{click:function(){t.trigger("change"),setTimeout(l,0)}}):s(t,r,{change:l}),w(p,r),w(v,r),{remove:function(){return p.remove(),v.remove(),t.unwrap().unbind(r.eventNamespace)},update:function(){i(f,r),b(t,p,r),u(f,t,r)}}}},{match:function(e){if(e.is("input")){var t=(" "+n(e,"type")+" ").toLowerCase(),s=" color date datetime datetime-local email month number password search tel text time url week ";return s.indexOf(t)>=0}return!1},apply:function(e,t){var s,i;return s=n(e,"type"),e.addClass(t.inputClass),i=d(e,t),a(e,e,t),t.inputAddTypeAsClass&&e.addClass(s),{remove:function(){e.removeClass(t.inputClass),t.inputAddTypeAsClass&&e.removeClass(s),i&&e.unwrap()},update:C}}},{match:function(e){return e.is(":radio")},apply:function(t,r){var o,d,f;return o=c(t,r,{divClass:r.radioClass}),d=o.div,f=o.span,a(t,d,r),s(t,r,{"click touchend":function(){e.uniform.update(e(':radio[name="'+n(t,"name")+'"]'))}}),l(f,t,r),{remove:k(t,r),update:function(){i(d,r),l(f,t,r),u(d,t,r)}}}},{match:function(e){return e.is("select")&&!h(e)?!0:!1},apply:function(t,n){var r,l,o,d;return n.selectAutoWidth&&g(t,function(){d=t.width()}),r=c(t,n,{divClass:n.selectClass,spanHtml:(t.find(":selected:first")||t.find("option:first")).html(),spanWrap:"before"}),l=r.div,o=r.span,n.selectAutoWidth?g(t,function(){y(e([o[0],l[0]]),{display:"block"},function(){var e;e=o.outerWidth()-o.width(),l.width(d+e),o.width(d)})}):l.addClass("fixedWidth"),a(t,l,n),s(t,n,{change:function(){o.html(t.find(":selected").html()),l.removeClass(n.activeClass)},"click touchend":function(){var e=t.find(":selected").html();o.html()!==e&&t.trigger("change")},keyup:function(){o.html(t.find(":selected").html())}}),w(o,n),{remove:function(){return o.remove(),t.unwrap().unbind(n.eventNamespace),t},update:function(){n.selectAutoWidth?(e.uniform.restore(t),t.uniform(n)):(i(l,n),o.html(t.find(":selected").html()),u(l,t,n))}}}},{match:function(e){return e.is("select")&&h(e)?!0:!1},apply:function(e,t){var n;return e.addClass(t.selectMultiClass),n=d(e,t),a(e,e,t),{remove:function(){e.removeClass(t.selectMultiClass),n&&e.unwrap()},update:C}}},{match:function(e){return e.is("textarea")},apply:function(e,t){var n;return e.addClass(t.textareaClass),n=d(e,t),a(e,e,t),{remove:function(){e.removeClass(t.textareaClass),n&&e.unwrap()},update:C}}}];m()&&!v()&&(H=!1),e.uniform={defaults:{activeClass:"active",autoHide:!0,buttonClass:"button",checkboxClass:"checker",checkedClass:"checked",disabledClass:"disabled",eventNamespace:".uniform",fileButtonClass:"action",fileButtonHtml:"Cho
9647ose File",fileClass:"uploader",fileDefaultHtml:"No file selected",filenameClass:"filename",focusClass:"focus",hoverClass:"hover",idPrefix:"uniform",inputAddTypeAsClass:!0,inputClass:"uniform-input",radioClass:"radio",resetDefaultHtml:"Reset",resetSelector:!1,selectAutoWidth:!0,selectClass:"selector",selectMultiClass:"uniform-multiselect",submitDefaultHtml:"Submit",textareaClass:"uniform",useID:!0,wrapperClass:null},elements:[]},e.fn.uniform=function(t){var n=this;return t=e.extend({},e.uniform.defaults,t),x||(x=!0,f()&&(H=!1)),H?(t.resetSelector&&e(t.resetSelector).mouseup(function(){window.setTimeout(function(){e.uniform.update(n)},10)}),this.each(function(){var n,s,a,i=e(this);if(i.data("uniformed"))return e.uniform.update(i),void 0;for(n=0;A.length>n;n+=1)if(s=A[n],s.match(i,t))return a=s.apply(i,t),i.data("uniformed",a),e.uniform.elements.push(i.get(0)),void 0})):this},e.uniform.restore=e.fn.uniform.restore=function(n){n===t&&(n=e.uniform.elements),e(n).each(function(){var t,n,s=e(this);n=s.data("uniformed"),n&&(n.remove(),t=e.inArray(this,e.uniform.elements),t>=0&&e.uniform.elements.splice(t,1),s.removeData("uniformed"))})},e.uniform.update=e.fn.uniform.update=function(n){n===t&&(n=e.uniform.elements),e(n).each(function(){var t,n=e(this);t=n.data("uniformed"),t&&t.update(n,t.options)})}})(jQuery);
9648/* End */
9649;
9650; /* Start:"a:4:{s:4:"full";s:82:"/bitrix/templates/aspro_max/vendor/js/carousel/owl/owl.carousel.js?171646553789992";s:6:"source";s:66:"/bitrix/templates/aspro_max/vendor/js/carousel/owl/owl.carousel.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
vendor: 23,216 bytes, lines 9651-10597
9651/**
9652 * Owl Carousel v2.3.4
9653 * Copyright 2013-2018 David Deutsch
9654 * Licensed under: SEE LICENSE IN https://github.com/OwlCarousel2/OwlCarousel2/blob/master/LICENSE
9655 */
9656/**
9657 * Owl carousel
9658 * @version 2.3.4
9659 * @author Bartosz Wojciechowski
9660 * @author David Deutsch
9661 * @license The MIT License (MIT)
9662 * @todo Lazy Load Icon
9663 * @todo prevent animationend bubling
9664 * @todo itemsScaleUp
9665 * @todo Test Zepto
9666 * @todo stagePadding calculate wrong active classes
9667 */
9668;(function($, window, document, undefined) {
9669
9670	/**
9671	 * Creates a carousel.
9672	 * @class The Owl Carousel.
9673	 * @public
9674	 * @param {HTMLElement|jQuery} element - The element to create the carousel for.
9675	 * @param {Object} [options] - The options
9676	 */
9677	function Owl(element, options) {
9678
9679		/**
9680		 * Current settings for the carousel.
9681		 * @public
9682		 */
9683		this.settings = null;
9684
9685		/**
9686		 * Current options set by the caller including defaults.
9687		 * @public
9688		 */
9689		this.options = $.extend({}, Owl.Defaults, options);
9690
9691		/**
9692		 * Plugin element.
9693		 * @public
9694		 */
9695		this.$element = $(element);
9696
9697		/**
9698		 * Proxied event handlers.
9699		 * @protected
9700		 */
9701		this._handlers = {};
9702
9703		/**
9704		 * References to the running plugins of this carousel.
9705		 * @protected
9706		 */
9707		this._plugins = {};
9708
9709		/**
9710		 * Currently suppressed events to prevent them from being retriggered.
9711		 * @protected
9712		 */
9713		this._supress = {};
9714
9715		/**
9716		 * Absolute current position.
9717		 * @protected
9718		 */
9719		this._current = null;
9720
9721		/**
9722		 * Animation speed in milliseconds.
9723		 * @protected
9724		 */
9725		this._speed = null;
9726
9727		/**
9728		 * Coordinates of all items in pixel.
9729		 * @todo The name of this member is missleading.
9730		 * @protected
9731		 */
9732		this._coordinates = [];
9733
9734		/**
9735		 * Current breakpoint.
9736		 * @todo Real media queries would be nice.
9737		 * @protected
9738		 */
9739		this._breakpoint = null;
9740
9741		/**
9742		 * Current width of the plugin element.
9743		 */
9744		this._width = null;
9745
9746		/**
9747		 * All real items.
9748		 * @protected
9749		 */
9750		this._items = [];
9751
9752		/**
9753		 * All cloned items.
9754		 * @protected
9755		 */
9756		this._clones = [];
9757
9758		/**
9759		 * Merge values of all items.
9760		 * @todo Maybe this could be part of a plugin.
9761		 * @protected
9762		 */
9763		this._mergers = [];
9764
9765		/**
9766		 * Widths of all items.
9767		 */
9768		this._widths = [];
9769
9770		/**
9771		 * Invalidated parts within the update process.
9772		 * @protected
9773		 */
9774		this._invalidated = {};
9775
9776		/**
9777		 * Ordered list of workers for the update process.
9778		 * @protected
9779		 */
9780		this._pipe = [];
9781
9782		/**
9783		 * Current state information for the drag operation.
9784		 * @todo #261
9785		 * @protected
9786		 */
9787		this._drag = {
9788			time: null,
9789			target: null,
9790			pointer: null,
9791			stage: {
9792				start: null,
9793				current: null
9794			},
9795			direction: null
9796		};
9797
9798		/**
9799		 * Current state information and their tags.
9800		 * @type {Object}
9801		 * @protected
9802		 */
9803		this._states = {
9804			current: {},
9805			tags: {
9806				'initializing': [ 'busy' ],
9807				'animating': [ 'busy' ],
9808				'dragging': [ 'interacting' ]
9809			}
9810		};
9811
9812		$.each([ 'onResize', 'onThrottledResize' ], $.proxy(function(i, handler) {
9813			this._handlers[handler] = $.proxy(this[handler], this);
9814		}, this));
9815
9816		$.each(Owl.Plugins, $.proxy(function(key, plugin) {
9817			this._plugins[key.charAt(0).toLowerCase() + key.slice(1)]
9818				= new plugin(this);
9819		}, this));
9820
9821		$.each(Owl.Workers, $.proxy(function(priority, worker) {
9822			this._pipe.push({
9823				'filter': worker.filter,
9824				'run': $.proxy(worker.run, this)
9825			});
9826		}, this));
9827
9828		this.setup();
9829		this.initialize();
9830	}
9831
9832	/**
9833	 * Default options for the carousel.
9834	 * @public
9835	 */
9836	Owl.Defaults = {
9837		items: 3,
9838		loop: false,
9839		center: false,
9840		rewind: false,
9841		checkVisibility: true,
9842
9843		mouseDrag: true,
9844		touchDrag: true,
9845		pullDrag: true,
9846		freeDrag: false,
9847
9848		margin: 0,
9849		stagePadding: 0,
9850
9851		merge: false,
9852		mergeFit: true,
9853		autoWidth: false,
9854
9855		startPosition: 0,
9856		rtl: false,
9857
9858		smartSpeed: 250,
9859		fluidSpeed: false,
9860		dragEndSpeed: false,
9861
9862		responsive: {},
9863		responsiveRefreshRate: 200,
9864		responsiveBaseElement: window,
9865
9866		fallbackEasing: 'swing',
9867		slideTransition: '',
9868
9869		info: false,
9870
9871		nestedItemSelector: false,
9872		itemElement: 'div',
9873		stageElement: 'div',
9874
9875		refreshClass: 'owl-refresh',
9876		loadedClass: 'owl-loaded',
9877		loadingClass: 'owl-loading',
9878		rtlClass: 'owl-rtl',
9879		responsiveClass: 'owl-responsive',
9880		dragClass: 'owl-drag',
9881		itemClass: 'owl-item',
9882		stageClass: 'owl-stage',
9883		stageOuterClass: 'owl-stage-outer',
9884		grabClass: 'owl-grab'
9885	};
9886
9887	/**
9888	 * Enumeration for width.
9889	 * @public
9890	 * @readonly
9891	 * @enum {String}
9892	 */
9893	Owl.Width = {
9894		Default: 'default',
9895		Inner: 'inner',
9896		Outer: 'outer'
9897	};
9898
9899	/**
9900	 * Enumeration for types.
9901	 * @public
9902	 * @readonly
9903	 * @enum {String}
9904	 */
9905	Owl.Type = {
9906		Event: 'event',
9907		State: 'state'
9908	};
9909
9910	/**
9911	 * Contains all registered plugins.
9912	 * @public
9913	 */
9914	Owl.Plugins = {};
9915
9916	/**
9917	 * List of workers involved in the update process.
9918	 */
9919	Owl.Workers = [ {
9920		filter: [ 'width', 'settings' ],
9921		run: function() {
9922			this._width = this.$element.width();
9923		}
9924	}, {
9925		filter: [ 'width', 'items', 'settings' ],
9926		run: function(cache) {
9927			cache.current = this._items && this._items[this.relative(this._current)];
9928		}
9929	}, {
9930		filter: [ 'items', 'settings' ],
9931		run: function() {
9932			this.$stage.children('.cloned').remove();
9933		}
9934	}, {
9935		filter: [ 'width', 'items', 'settings' ],
9936		run: function(cache) {
9937			var margin = this.settings.margin || '',
9938				grid = !this.settings.autoWidth,
9939				rtl = this.settings.rtl,
9940				css = {
9941					'width': 'auto',
9942					'margin-left': rtl ? margin : '',
9943					'margin-right': rtl ? '' : margin
9944				};
9945
9946			!grid && this.$stage.children().css(css);
9947
9948			cache.css = css;
9949		}
9950	}, {
9951		filter: [ 'width', 'items', 'settings' ],
9952		run: function(cache) {
9953			var width = (this.width() / this.settings.items).toFixed(3) - this.settings.margin,
9954				merge = null,
9955				iterator = this._items.length,
9956				grid = !this.settings.autoWidth,
9957				widths = [];
9958
9959			cache.items = {
9960				merge: false,
9961				width: width
9962			};
9963
9964			while (iterator--) {
9965				merge = this._mergers[iterator];
9966				merge = this.settings.mergeFit && Math.min(merge, this.settings.items) || merge;
9967
9968				cache.items.merge = merge > 1 || cache.items.merge;
9969
9970				widths[iterator] = !grid ? this._items[iterator].width() : width * merge;
9971			}
9972
9973			this._widths = widths;
9974		}
9975	}, {
9976		filter: [ 'items', 'settings' ],
9977		run: function() {
9978			var clones = [],
9979				items = this._items,
9980				settings = this.settings,
9981				// TODO: Should be computed from number of min width items in stage
9982				view = Math.max(settings.items * 2, 4),
9983				size = Math.ceil(items.length / 2) * 2,
9984				repeat = settings.loop && items.length ? settings.rewind ? view : Math.max(view, size) : 0,
9985				append = '',
9986				prepend = '';
9987
9988			repeat /= 2;
9989
9990			while (repeat > 0) {
9991				// Switch to only using appended clones
9992				clones.push(this.normalize(clones.length / 2, true));
9993				append = append + items[clones[clones.length - 1]][0].outerHTML;
9994				clones.push(this.normalize(items.length - 1 - (clones.length - 1) / 2, true));
9995				prepend = items[clones[clones.length - 1]][0].outerHTML + prepend;
9996				repeat -= 1;
9997			}
9998
9999			this._clones = clones;
10000
10001			$(append).addClass('cloned').appendTo(this.$stage);
10002			$(prepend).addClass('cloned').prependTo(this.$stage);
10003		}
10004	}, {
10005		filter: [ 'width', 'items', 'settings' ],
10006		run: function() {
10007			var rtl = this.settings.rtl ? 1 : -1,
10008				size = this._clones.length + this._items.length,
10009				iterator = -1,
10010				previous = 0,
10011				current = 0,
10012				coordinates = [];
10013
10014			while (++iterator < size) {
10015				previous = coordinates[iterator - 1] || 0;
10016				current = this._widths[this.relative(iterator)] + this.settings.margin;
10017				coordinates.push(previous + current * rtl);
10018			}
10019
10020			this._coordinates = coordinates;
10021		}
10022	}, {
10023		filter: [ 'width', 'items', 'settings' ],
10024		run: function() {
10025			var padding = this.settings.stagePadding,
10026				coordinates = this._coordinates,
10027				css = {
10028					'width': Math.ceil(Math.abs(coordinates[coordinates.length - 1])) + padding * 2,
10029					'padding-left': padding || '',
10030					'padding-right': padding || ''
10031				};
10032
10033			this.$stage.css(css);
10034		}
10035	}, {
10036		filter: [ 'width', 'items', 'settings' ],
10037		run: function(cache) {
10038			var iterator = this._coordinates.length,
10039				grid = !this.settings.autoWidth,
10040				items = this.$stage.children();
10041
10042			if (grid && cache.items.merge) {
10043				while (iterator--) {
10044					cache.css.width = this._widths[this.relative(iterator)];
10045					items.eq(iterator).css(cache.css);
10046				}
10047			} else if (grid) {
10048				cache.css.width = cache.items.width;
10049				items.css(cache.css);
10050			}
10051		}
10052	}, {
10053		filter: [ 'items' ],
10054		run: function() {
10055			this._coordinates.length < 1 && this.$stage.removeAttr('style');
10056		}
10057	}, {
10058		filter: [ 'width', 'items', 'settings' ],
10059		run: function(cache) {
10060			cache.current = cache.current ? this.$stage.children().index(cache.current) : 0;
10061			cache.current = Math.max(this.minimum(), Math.min(this.maximum(), cache.current));
10062			this.reset(cache.current);
10063		}
10064	}, {
10065		filter: [ 'position' ],
10066		run: function() {
10067			this.animate(this.coordinates(this._current));
10068		}
10069	}, {
10070		filter: [ 'width', 'position', 'items', 'settings' ],
10071		run: function() {
10072			var rtl = this.settings.rtl ? 1 : -1,
10073				padding = this.settings.stagePadding * 2,
10074				begin = this.coordinates(this.current()) + padding,
10075				end = begin + this.width() * rtl,
10076				inner, outer, matches = [], i, n;
10077
10078			for (i = 0, n = this._coordinates.length; i < n; i++) {
10079				inner = this._coordinates[i - 1] || 0;
10080				outer = Math.abs(this._coordinates[i]) + padding * rtl;
10081
10082				if ((this.op(inner, '<=', begin) && (this.op(inner, '>', end)))
10083					|| (this.op(outer, '<', begin) && this.op(outer, '>', end))) {
10084					matches.push(i);
10085				}
10086			}
10087
10088			this.$stage.children('.active').removeClass('active');
10089			this.$stage.children(':eq(' + matches.join('), :eq(') + ')').addClass('active');
10090
10091			this.$stage.children('.center').removeClass('center');
10092			if (this.settings.center) {
10093				this.$stage.children().eq(this.current()).addClass('center');
10094			}
10095		}
10096	} ];
10097
10098	/**
10099	 * Create the stage DOM element
10100	 */
10101	Owl.prototype.initializeStage = function() {
10102		this.$stage = this.$element.find('.' + this.settings.stageClass);
10103
10104		// if the stage is already in the DOM, grab it and skip stage initialization
10105		if (this.$stage.length) {
10106			return;
10107		}
10108
10109		this.$element.addClass(this.options.loadingClass);
10110
10111		// create stage
10112		this.$stage = $('<' + this.settings.stageElement + '>', {
10113			"class": this.settings.stageClass
10114		}).wrap( $( '<div/>', {
10115			"class": this.settings.stageOuterClass
10116		}));
10117
10118		// append stage
10119		this.$element.append(this.$stage.parent());
10120	};
10121
10122	/**
10123	 * Create item DOM elements
10124	 */
10125	Owl.prototype.initializeItems = function() {
10126		var $items = this.$element.find('.owl-item');
10127
10128		// if the items are already in the DOM, grab them and skip item initialization
10129		if ($items.length) {
10130			this._items = $items.get().map(function(item) {
10131				return $(item);
10132			});
10133
10134			this._mergers = this._items.map(function() {
10135				return 1;
10136			});
10137
10138			this.refresh();
10139
10140			return;
10141		}
10142
10143		// append content
10144		this.replace(this.$element.children().not(this.$stage.parent()));
10145
10146		// check visibility
10147		if (this.isVisible()) {
10148			// update view
10149			this.refresh();
10150		} else {
10151			// invalidate width
10152			this.invalidate('width');
10153		}
10154
10155		this.$element
10156			.removeClass(this.options.loadingClass)
10157			.addClass(this.options.loadedClass);
10158	};
10159
10160	/**
10161	 * Initializes the carousel.
10162	 * @protected
10163	 */
10164	Owl.prototype.initialize = function() {
10165		this.enter('initializing');
10166		this.trigger('initialize');
10167
10168		this.$element.toggleClass(this.settings.rtlClass, this.settings.rtl);
10169
10170		if (this.settings.autoWidth && !this.is('pre-loading')) {
10171			var imgs, nestedSelector, width;
10172			imgs = this.$element.find('img');
10173			nestedSelector = this.settings.nestedItemSelector ? '.' + this.settings.nestedItemSelector : undefined;
10174			width = this.$element.children(nestedSelector).width();
10175
10176			if (imgs.length && width <= 0) {
10177				this.preloadAutoWidthImages(imgs);
10178			}
10179		}
10180
10181		this.initializeStage();
10182		this.initializeItems();
10183
10184		// register event handlers
10185		this.registerEventHandlers();
10186
10187		this.leave('initializing');
10188		this.trigger('initialized');
10189	};
10190
10191	/**
10192	 * @returns {Boolean} visibility of $element
10193	 *                    if you know the carousel will always be visible you can set `checkVisibility` to `false` to
10194	 *                    prevent the expensive browser layout forced reflow the $element.is(':visible') does
10195	 */
10196	Owl.prototype.isVisible = function() {
10197		return this.settings.checkVisibility
10198			? this.$element.is(':visible')
10199			: true;
10200	};
10201
10202	/**
10203	 * Setups the current settings.
10204	 * @todo Remove responsive classes. Why should adaptive designs be brought into IE8?
10205	 * @todo Support for media queries by using `matchMedia` would be nice.
10206	 * @public
10207	 */
10208	Owl.prototype.setup = function() {
10209		var viewport = this.viewport(),
10210			overwrites = this.options.responsive,
10211			match = -1,
10212			settings = null;
10213
10214		if (!overwrites) {
10215			settings = $.extend({}, this.options);
10216		} else {
10217			$.each(overwrites, function(breakpoint) {
10218				if (breakpoint <= viewport && breakpoint > match) {
10219					match = Number(breakpoint);
10220				}
10221			});
10222
10223			settings = $.extend({}, this.options, overwrites[match]);
10224			if (typeof settings.stagePadding === 'function') {
10225				settings.stagePadding = settings.stagePadding();
10226			}
10227			delete settings.responsive;
10228
10229			// responsive class
10230			if (settings.responsiveClass) {
10231				this.$element.attr('class',
10232					this.$element.attr('class').replace(new RegExp('(' + this.options.responsiveClass + '-)\\S+\\s', 'g'), '$1' + match)
10233				);
10234			}
10235		}
10236
10237		this.trigger('change', { property: { name: 'settings', value: settings } });
10238		this._breakpoint = match;
10239		this.settings = settings;
10240		this.invalidate('settings');
10241		this.trigger('changed', { property: { name: 'settings', value: this.settings } });
10242	};
10243
10244	/**
10245	 * Updates option logic if necessery.
10246	 * @protected
10247	 */
10248	Owl.prototype.optionsLogic = function() {
10249		if (this.settings.autoWidth) {
10250			this.settings.stagePadding = false;
10251			this.settings.merge = false;
10252		}
10253	};
10254
10255	/**
10256	 * Prepares an item before add.
10257	 * @todo Rename event parameter `content` to `item`.
10258	 * @protected
10259	 * @returns {jQuery|HTMLElement} - The item container.
10260	 */
10261	Owl.prototype.prepare = function(item) {
10262		var event = this.trigger('prepare', { content: item });
10263
10264		if (!event.data) {
10265			event.data = $('<' + this.settings.itemElement + '/>')
10266				.addClass(this.options.itemClass).append(item)
10267		}
10268
10269		this.trigger('prepared', { content: event.data });
10270
10271		return event.data;
10272	};
10273
10274	/**
10275	 * Updates the view.
10276	 * @public
10277	 */
10278	Owl.prototype.update = function() {
10279		var i = 0,
10280			n = this._pipe.length,
10281			filter = $.proxy(function(p) { return this[p] }, this._invalidated),
10282			cache = {};
10283
10284		while (i < n) {
10285			if (this._invalidated.all || $.grep(this._pipe[i].filter, filter).length > 0) {
10286				this._pipe[i].run(cache);
10287			}
10288			i++;
10289		}
10290
10291		this._invalidated = {};
10292
10293		!this.is('valid') && this.enter('valid');
10294	};
10295
10296	/**
10297	 * Gets the width of the view.
10298	 * @public
10299	 * @param {Owl.Width} [dimension=Owl.Width.Default] - The dimension to return.
10300	 * @returns {Number} - The width of the view in pixel.
10301	 */
10302	Owl.prototype.width = function(dimension) {
10303		dimension = dimension || Owl.Width.Default;
10304		switch (dimension) {
10305			case Owl.Width.Inner:
10306			case Owl.Width.Outer:
10307				return this._width;
10308			default:
10309				return this._width - this.settings.stagePadding * 2 + this.settings.margin;
10310		}
10311	};
10312
10313	/**
10314	 * Refreshes the carousel primarily for adaptive purposes.
10315	 * @public
10316	 */
10317	Owl.prototype.refresh = function() {
10318		this.enter('refreshing');
10319		this.trigger('refresh');
10320
10321		this.setup();
10322
10323		this.optionsLogic();
10324
10325		this.$element.addClass(this.options.refreshClass);
10326
10327		this.update();
10328
10329		this.$element.removeClass(this.options.refreshClass);
10330
10331		this.leave('refreshing');
10332		this.trigger('refreshed');
10333	};
10334
10335	/**
10336	 * Checks window `resize` event.
10337	 * @protected
10338	 */
10339	Owl.prototype.onThrottledResize = function() {
10340		window.clearTimeout(this.resizeTimer);
10341		this.resizeTimer = window.setTimeout(this._handlers.onResize, this.settings.responsiveRefreshRate);
10342	};
10343
10344	/**
10345	 * Checks window `resize` event.
10346	 * @protected
10347	 */
10348	Owl.prototype.onResize = function() {
10349		if (!this._items.length) {
10350			return false;
10351		}
10352
10353		if (this._width === this.$element.width()) {
10354			return false;
10355		}
10356
10357		if (!this.isVisible()) {
10358			return false;
10359		}
10360
10361		this.enter('resizing');
10362
10363		if (this.trigger('resize').isDefaultPrevented()) {
10364			this.leave('resizing');
10365			return false;
10366		}
10367
10368		this.invalidate('width');
10369
10370		this.refresh();
10371
10372		this.leave('resizing');
10373		this.trigger('resized');
10374	};
10375
10376	/**
10377	 * Registers event handlers.
10378	 * @todo Check `msPointerEnabled`
10379	 * @todo #261
10380	 * @protected
10381	 */
10382	Owl.prototype.registerEventHandlers = function() {
10383		if ($.support.transition) {
10384			this.$stage.on($.support.transition.end + '.owl.core', $.proxy(this.onTransitionEnd, this));
10385		}
10386
10387		if (this.settings.responsive !== false) {
10388			this.on(window, 'resize', this._handlers.onThrottledResize);
10389		}
10390
10391		if (this.settings.mouseDrag) {
10392			this.$element.addClass(this.options.dragClass);
10393			this.$stage.on('mousedown.owl.core', $.proxy(this.onDragStart, this));
10394			this.$stage.on('dragstart.owl.core selectstart.owl.core', function() { return false });
10395		}
10396
10397		if (this.settings.touchDrag){
10398			this.$stage.on('touchstart.owl.core', $.proxy(this.onDragStart, this));
10399			this.$stage.on('touchcancel.owl.core', $.proxy(this.onDragEnd, this));
10400		}
10401	};
10402
10403	/**
10404	 * Handles `touchstart` and `mousedown` events.
10405	 * @todo Horizontal swipe threshold as option
10406	 * @todo #261
10407	 * @protected
10408	 * @param {Event} event - The event arguments.
10409	 */
10410	Owl.prototype.onDragStart = function(event) {
10411		var stage = null;
10412
10413		if (event.which === 3) {
10414			return;
10415		}
10416
10417		if ($.support.transform) {
10418			stage = this.$stage.css('transform').replace(/.*\(|\)| /g, '').split(',');
10419			stage = {
10420				x: stage[stage.length === 16 ? 12 : 4],
10421				y: stage[stage.length === 16 ? 13 : 5]
10422			};
10423		} else {
10424			stage = this.$stage.position();
10425			stage = {
10426				x: this.settings.rtl ?
10427					stage.left + this.$stage.width() - this.width() + this.settings.margin :
10428					stage.left,
10429				y: stage.top
10430			};
10431		}
10432
10433		if (this.is('animating')) {
10434			$.support.transform ? this.animate(stage.x) : this.$stage.stop()
10435			this.invalidate('position');
10436		}
10437
10438		this.$element.toggleClass(this.options.grabClass, event.type === 'mousedown');
10439
10440		this.speed(0);
10441
10442		this._drag.time = new Date().getTime();
10443		this._drag.target = $(event.target);
10444		this._drag.stage.start = stage;
10445		this._drag.stage.current = stage;
10446		this._drag.pointer = this.pointer(event);
10447
10448		$(document).on('mouseup.owl.core touchend.owl.core', $.proxy(this.onDragEnd, this));
10449
10450		$(document).one('mousemove.owl.core touchmove.owl.core', $.proxy(function(event) {
10451			var delta = this.difference(this._drag.pointer, this.pointer(event));
10452
10453			$(document).on('mousemove.owl.core touchmove.owl.core', $.proxy(this.onDragMove, this));
10454
10455			if (Math.abs(delta.x) < Math.abs(delta.y) && this.is('valid')) {
10456				return;
10457			}
10458
10459			event.preventDefault();
10460
10461			this.enter('dragging');
10462			this.trigger('drag');
10463		}, this));
10464	};
10465
10466	/**
10467	 * Handles the `touchmove` and `mousemove` events.
10468	 * @todo #261
10469	 * @protected
10470	 * @param {Event} event - The event arguments.
10471	 */
10472	Owl.prototype.onDragMove = function(event) {
10473		var minimum = null,
10474			maximum = null,
10475			pull = null,
10476			delta = this.difference(this._drag.pointer, this.pointer(event)),
10477			stage = this.difference(this._drag.stage.start, delta);
10478
10479		if (!this.is('dragging')) {
10480			return;
10481		}
10482
10483		event.preventDefault();
10484
10485		if (this.settings.loop) {
10486			minimum = this.coordinates(this.minimum());
10487			maximum = this.coordinates(this.maximum() + 1) - minimum;
10488			stage.x = (((stage.x - minimum) % maximum + maximum) % maximum) + minimum;
10489		} else {
10490			minimum = this.settings.rtl ? this.coordinates(this.maximum()) : this.coordinates(this.minimum());
10491			maximum = this.settings.rtl ? this.coordinates(this.minimum()) : this.coordinates(this.maximum());
10492			pull = this.settings.pullDrag ? -1 * delta.x / 5 : 0;
10493			stage.x = Math.max(Math.min(stage.x, minimum + pull), maximum + pull);
10494		}
10495
10496		this._drag.stage.current = stage;
10497
10498		this.animate(stage.x);
10499	};
10500
10501	/**
10502	 * Handles the `touchend` and `mouseup` events.
10503	 * @todo #261
10504	 * @todo Threshold for click event
10505	 * @protected
10506	 * @param {Event} event - The event arguments.
10507	 */
10508	Owl.prototype.onDragEnd = function(event) {
10509		var delta = this.difference(this._drag.pointer, this.pointer(event)),
10510			stage = this._drag.stage.current,
10511			direction = delta.x > 0 ^ this.settings.rtl ? 'left' : 'right';
10512
10513		$(document).off('.owl.core');
10514
10515		this.$element.removeClass(this.options.grabClass);
10516
10517		if (delta.x !== 0 && this.is('dragging') || !this.is('valid')) {
10518			this.speed(this.settings.dragEndSpeed || this.settings.smartSpeed);
10519			this.current(this.closest(stage.x, delta.x !== 0 ? direction : this._drag.direction));
10520			this.invalidate('position');
10521			this.update();
10522
10523			this._drag.direction = direction;
10524
10525			if (Math.abs(delta.x) > 3 || new Date().getTime() - this._drag.time > 300) {
10526				this._drag.target.one('click.owl.core', function() { return false; });
10527			}
10528		}
10529
10530		if (!this.is('dragging')) {
10531			return;
10532		}
10533
10534		this.leave('dragging');
10535		this.trigger('dragged');
10536	};
10537
10538	/**
10539	 * Gets absolute position of the closest item for a coordinate.
10540	 * @todo Setting `freeDrag` makes `closest` not reusable. See #165.
10541	 * @protected
10542	 * @param {Number} coordinate - The coordinate in pixel.
10543	 * @param {String} direction - The direction to check for the closest item. Ether `left` or `right`.
10544	 * @return {Number} - The absolute position of the closest item.
10545	 */
10546	Owl.prototype.closest = function(coordinate, direction) {
10547		var position = -1,
10548			pull = 30,
10549			width = this.width(),
10550			coordinates = this.coordinates();
10551
10552		if (!this.settings.freeDrag) {
10553			// check closest item
10554			$.each(coordinates, $.proxy(function(index, value) {
10555				// on a left pull, check on current index
10556				if (direction === 'left' && coordinate > value - pull && coordinate < value + pull) {
10557					position = index;
10558				// on a right pull, check on previous index
10559				// to do so, subtract width from value and set position = index + 1
10560				} else if (direction === 'right' && coordinate > value - width - pull && coordinate < value - width + pull) {
10561					position = index + 1;
10562				} else if (this.op(coordinate, '<', value)
10563					&& this.op(coordinate, '>', coordinates[index + 1] !== undefined ? coordinates[index + 1] : value - width)) {
10564					position = direction === 'left' ? index + 1 : index;
10565				}
10566				return position === -1;
10567			}, this));
10568		}
10569
10570		if (!this.settings.loop) {
10571			// non loop boundries
10572			if (this.op(coordinate, '>', coordinates[this.minimum()])) {
10573				position = coordinate = this.minimum();
10574			} else if (this.op(coordinate, '<', coordinates[this.maximum()])) {
10575				position = coordinate = this.maximum();
10576			}
10577		}
10578
10579		return position;
10580	};
10581
10582	/**
10583	 * Animates the stage.
10584	 * @todo #270
10585	 * @public
10586	 * @param {Number} coordinate - The coordinate in pixels.
10587	 */
10588	Owl.prototype.animate = function(coordinate) {
10589		var animate = this.speed() > 0;
10590
10591		this.is('animating') && this.onTransitionEnd();
10592
10593		if (animate) {
10594			this.enter('animating');
10595			this.trigger('translate');
10596		}
10597
vendor: 10,524 bytes, lines 10598-10965
10598		if ($.support.transform3d && $.support.transition) {
10599			this.$stage.css({
10600				transform: 'translate3d(' + coordinate + 'px,0px,0px)',
10601				transition: (this.speed() / 1000) + 's' + (
10602					this.settings.slideTransition ? ' ' + this.settings.slideTransition : ''
10603				)
10604			});
10605		} else if (animate) {
10606			this.$stage.animate({
10607				left: coordinate + 'px'
10608			}, this.speed(), this.settings.fallbackEasing, $.proxy(this.onTransitionEnd, this));
10609		} else {
10610			this.$stage.css({
10611				left: coordinate + 'px'
10612			});
10613		}
10614	};
10615
10616	/**
10617	 * Checks whether the carousel is in a specific state or not.
10618	 * @param {String} state - The state to check.
10619	 * @returns {Boolean} - The flag which indicates if the carousel is busy.
10620	 */
10621	Owl.prototype.is = function(state) {
10622		return this._states.current[state] && this._states.current[state] > 0;
10623	};
10624
10625	/**
10626	 * Sets the absolute position of the current item.
10627	 * @public
10628	 * @param {Number} [position] - The new absolute position or nothing to leave it unchanged.
10629	 * @returns {Number} - The absolute position of the current item.
10630	 */
10631	Owl.prototype.current = function(position) {
10632		if (position === undefined) {
10633			return this._current;
10634		}
10635
10636		if (this._items.length === 0) {
10637			return undefined;
10638		}
10639
10640		position = this.normalize(position);
10641
10642		if (this._current !== position) {
10643			var event = this.trigger('change', { property: { name: 'position', value: position } });
10644
10645			if (event.data !== undefined) {
10646				position = this.normalize(event.data);
10647			}
10648
10649			this._current = position;
10650
10651			this.invalidate('position');
10652
10653			this.trigger('changed', { property: { name: 'position', value: this._current } });
10654		}
10655
10656		return this._current;
10657	};
10658
10659	/**
10660	 * Invalidates the given part of the update routine.
10661	 * @param {String} [part] - The part to invalidate.
10662	 * @returns {Array.<String>} - The invalidated parts.
10663	 */
10664	Owl.prototype.invalidate = function(part) {
10665		if ($.type(part) === 'string') {
10666			this._invalidated[part] = true;
10667			this.is('valid') && this.leave('valid');
10668		}
10669		return $.map(this._invalidated, function(v, i) { return i });
10670	};
10671
10672	/**
10673	 * Resets the absolute position of the current item.
10674	 * @public
10675	 * @param {Number} position - The absolute position of the new item.
10676	 */
10677	Owl.prototype.reset = function(position) {
10678		position = this.normalize(position);
10679
10680		if (position === undefined) {
10681			return;
10682		}
10683
10684		this._speed = 0;
10685		this._current = position;
10686
10687		this.suppress([ 'translate', 'translated' ]);
10688
10689		this.animate(this.coordinates(position));
10690
10691		this.release([ 'translate', 'translated' ]);
10692	};
10693
10694	/**
10695	 * Normalizes an absolute or a relative position of an item.
10696	 * @public
10697	 * @param {Number} position - The absolute or relative position to normalize.
10698	 * @param {Boolean} [relative=false] - Whether the given position is relative or not.
10699	 * @returns {Number} - The normalized position.
10700	 */
10701	Owl.prototype.normalize = function(position, relative) {
10702		var n = this._items.length,
10703			m = relative ? 0 : this._clones.length;
10704
10705		if (!this.isNumeric(position) || n < 1) {
10706			position = undefined;
10707		} else if (position < 0 || position >= n + m) {
10708			position = ((position - m / 2) % n + n) % n + m / 2;
10709		}
10710
10711		return position;
10712	};
10713
10714	/**
10715	 * Converts an absolute position of an item into a relative one.
10716	 * @public
10717	 * @param {Number} position - The absolute position to convert.
10718	 * @returns {Number} - The converted position.
10719	 */
10720	Owl.prototype.relative = function(position) {
10721		position -= this._clones.length / 2;
10722		return this.normalize(position, true);
10723	};
10724
10725	/**
10726	 * Gets the maximum position for the current item.
10727	 * @public
10728	 * @param {Boolean} [relative=false] - Whether to return an absolute position or a relative position.
10729	 * @returns {Number}
10730	 */
10731	Owl.prototype.maximum = function(relative) {
10732		var settings = this.settings,
10733			maximum = this._coordinates.length,
10734			iterator,
10735			reciprocalItemsWidth,
10736			elementWidth;
10737
10738		if (settings.loop) {
10739			maximum = this._clones.length / 2 + this._items.length - 1;
10740		} else if (settings.autoWidth || settings.merge) {
10741			iterator = this._items.length;
10742			if (iterator) {
10743				reciprocalItemsWidth = this._items[--iterator].width();
10744				elementWidth = this.$element.width();
10745				while (iterator--) {
10746					reciprocalItemsWidth += this._items[iterator].width() + this.settings.margin;
10747					if (reciprocalItemsWidth > elementWidth) {
10748						break;
10749					}
10750				}
10751			}
10752			maximum = iterator + 1;
10753		} else if (settings.center) {
10754			maximum = this._items.length - 1;
10755		} else {
10756			maximum = this._items.length - settings.items;
10757		}
10758
10759		if (relative) {
10760			maximum -= this._clones.length / 2;
10761		}
10762
10763		return Math.max(maximum, 0);
10764	};
10765
10766	/**
10767	 * Gets the minimum position for the current item.
10768	 * @public
10769	 * @param {Boolean} [relative=false] - Whether to return an absolute position or a relative position.
10770	 * @returns {Number}
10771	 */
10772	Owl.prototype.minimum = function(relative) {
10773		return relative ? 0 : this._clones.length / 2;
10774	};
10775
10776	/**
10777	 * Gets an item at the specified relative position.
10778	 * @public
10779	 * @param {Number} [position] - The relative position of the item.
10780	 * @return {jQuery|Array.<jQuery>} - The item at the given position or all items if no position was given.
10781	 */
10782	Owl.prototype.items = function(position) {
10783		if (position === undefined) {
10784			return this._items.slice();
10785		}
10786
10787		position = this.normalize(position, true);
10788		return this._items[position];
10789	};
10790
10791	/**
10792	 * Gets an item at the specified relative position.
10793	 * @public
10794	 * @param {Number} [position] - The relative position of the item.
10795	 * @return {jQuery|Array.<jQuery>} - The item at the given position or all items if no position was given.
10796	 */
10797	Owl.prototype.mergers = function(position) {
10798		if (position === undefined) {
10799			return this._mergers.slice();
10800		}
10801
10802		position = this.normalize(position, true);
10803		return this._mergers[position];
10804	};
10805
10806	/**
10807	 * Gets the absolute positions of clones for an item.
10808	 * @public
10809	 * @param {Number} [position] - The relative position of the item.
10810	 * @returns {Array.<Number>} - The absolute positions of clones for the item or all if no position was given.
10811	 */
10812	Owl.prototype.clones = function(position) {
10813		var odd = this._clones.length / 2,
10814			even = odd + this._items.length,
10815			map = function(index) { return index % 2 === 0 ? even + index / 2 : odd - (index + 1) / 2 };
10816
10817		if (position === undefined) {
10818			return $.map(this._clones, function(v, i) { return map(i) });
10819		}
10820
10821		return $.map(this._clones, function(v, i) { return v === position ? map(i) : null });
10822	};
10823
10824	/**
10825	 * Sets the current animation speed.
10826	 * @public
10827	 * @param {Number} [speed] - The animation speed in milliseconds or nothing to leave it unchanged.
10828	 * @returns {Number} - The current animation speed in milliseconds.
10829	 */
10830	Owl.prototype.speed = function(speed) {
10831		if (speed !== undefined) {
10832			this._speed = speed;
10833		}
10834
10835		return this._speed;
10836	};
10837
10838	/**
10839	 * Gets the coordinate of an item.
10840	 * @todo The name of this method is missleanding.
10841	 * @public
10842	 * @param {Number} position - The absolute position of the item within `minimum()` and `maximum()`.
10843	 * @returns {Number|Array.<Number>} - The coordinate of the item in pixel or all coordinates.
10844	 */
10845	Owl.prototype.coordinates = function(position) {
10846		var multiplier = 1,
10847			newPosition = position - 1,
10848			coordinate;
10849
10850		if (position === undefined) {
10851			return $.map(this._coordinates, $.proxy(function(coordinate, index) {
10852				return this.coordinates(index);
10853			}, this));
10854		}
10855
10856		if (this.settings.center) {
10857			if (this.settings.rtl) {
10858				multiplier = -1;
10859				newPosition = position + 1;
10860			}
10861
10862			coordinate = this._coordinates[position];
10863			coordinate += (this.width() - coordinate + (this._coordinates[newPosition] || 0)) / 2 * multiplier;
10864		} else {
10865			coordinate = this._coordinates[newPosition] || 0;
10866		}
10867
10868		coordinate = Math.ceil(coordinate);
10869
10870		return coordinate;
10871	};
10872
10873	/**
10874	 * Calculates the speed for a translation.
10875	 * @protected
10876	 * @param {Number} from - The absolute position of the start item.
10877	 * @param {Number} to - The absolute position of the target item.
10878	 * @param {Number} [factor=undefined] - The time factor in milliseconds.
10879	 * @returns {Number} - The time in milliseconds for the translation.
10880	 */
10881	Owl.prototype.duration = function(from, to, factor) {
10882		if (factor === 0) {
10883			return 0;
10884		}
10885
10886		return Math.min(Math.max(Math.abs(to - from), 1), 6) * Math.abs((factor || this.settings.smartSpeed));
10887	};
10888
10889	/**
10890	 * Slides to the specified item.
10891	 * @public
10892	 * @param {Number} position - The position of the item.
10893	 * @param {Number} [speed] - The time in milliseconds for the transition.
10894	 */
10895	Owl.prototype.to = function(position, speed) {
10896		var current = this.current(),
10897			revert = null,
10898			distance = position - this.relative(current),
10899			direction = (distance > 0) - (distance < 0),
10900			items = this._items.length,
10901			minimum = this.minimum(),
10902			maximum = this.maximum();
10903
10904		if (this.settings.loop) {
10905			if (!this.settings.rewind && Math.abs(distance) > items / 2) {
10906				distance += direction * -1 * items;
10907			}
10908
10909			position = current + distance;
10910			revert = ((position - minimum) % items + items) % items + minimum;
10911
10912			if (revert !== position && revert - distance <= maximum && revert - distance > 0) {
10913				current = revert - distance;
10914				position = revert;
10915				this.reset(current);
10916			}
10917		} else if (this.settings.rewind) {
10918			maximum += 1;
10919			position = (position % maximum + maximum) % maximum;
10920		} else {
10921			position = Math.max(minimum, Math.min(maximum, position));
10922		}
10923
10924		this.speed(this.duration(current, position, speed));
10925		this.current(position);
10926
10927		if (this.isVisible()) {
10928			this.update();
10929		}
10930	};
10931
10932	/**
10933	 * Slides to the next item.
10934	 * @public
10935	 * @param {Number} [speed] - The time in milliseconds for the transition.
10936	 */
10937	Owl.prototype.next = function(speed) {
10938		speed = speed || false;
10939		this.to(this.relative(this.current()) + 1, speed);
10940	};
10941
10942	/**
10943	 * Slides to the previous item.
10944	 * @public
10945	 * @param {Number} [speed] - The time in milliseconds for the transition.
10946	 */
10947	Owl.prototype.prev = function(speed) {
10948		speed = speed || false;
10949		this.to(this.relative(this.current()) - 1, speed);
10950	};
10951
10952	/**
10953	 * Handles the end of an animation.
10954	 * @protected
10955	 * @param {Event} event - The event arguments.
10956	 */
10957	Owl.prototype.onTransitionEnd = function(event) {
10958
10959		// if css2 animation then event object is undefined
10960		if (event !== undefined) {
10961			event.stopPropagation();
10962
10963			// Catch only owl-stage transitionEnd event
10964			if ((event.target || event.srcElement || event.originalTarget) !== this.$stage.get(0)) {
10965				return false;
vendor: 22,957 bytes, lines 10966-11814
10966			}
10967		}
10968
10969		this.leave('animating');
10970		this.trigger('translated');
10971	};
10972
10973	/**
10974	 * Gets viewport width.
10975	 * @protected
10976	 * @return {Number} - The width in pixel.
10977	 */
10978	Owl.prototype.viewport = function() {
10979		var width;
10980		if (this.options.responsiveBaseElement !== window) {
10981			width = $(this.options.responsiveBaseElement).width();
10982		} else if (window.innerWidth) {
10983			width = window.innerWidth;
10984		} else if (document.documentElement && document.documentElement.clientWidth) {
10985			width = document.documentElement.clientWidth;
10986		} else {
10987			console.warn('Can not detect viewport width.');
10988		}
10989		return width;
10990	};
10991
10992	/**
10993	 * Replaces the current content.
10994	 * @public
10995	 * @param {HTMLElement|jQuery|String} content - The new content.
10996	 */
10997	Owl.prototype.replace = function(content) {
10998		this.$stage.empty();
10999		this._items = [];
11000
11001		if (content) {
11002			content = (content instanceof jQuery) ? content : $(content);
11003		}
11004
11005		if (this.settings.nestedItemSelector) {
11006			content = content.find('.' + this.settings.nestedItemSelector);
11007		}
11008
11009		content.filter(function() {
11010			return this.nodeType === 1;
11011		}).each($.proxy(function(index, item) {
11012			item = this.prepare(item);
11013			this.$stage.append(item);
11014			this._items.push(item);
11015			this._mergers.push(item.find('[data-merge]').addBack('[data-merge]').attr('data-merge') * 1 || 1);
11016		}, this));
11017
11018		this.reset(this.isNumeric(this.settings.startPosition) ? this.settings.startPosition : 0);
11019
11020		this.invalidate('items');
11021	};
11022
11023	/**
11024	 * Adds an item.
11025	 * @todo Use `item` instead of `content` for the event arguments.
11026	 * @public
11027	 * @param {HTMLElement|jQuery|String} content - The item content to add.
11028	 * @param {Number} [position] - The relative position at which to insert the item otherwise the item will be added to the end.
11029	 */
11030	Owl.prototype.add = function(content, position) {
11031		var current = this.relative(this._current);
11032
11033		position = position === undefined ? this._items.length : this.normalize(position, true);
11034		content = content instanceof jQuery ? content : $(content);
11035
11036		this.trigger('add', { content: content, position: position });
11037
11038		content = this.prepare(content);
11039
11040		if (this._items.length === 0 || position === this._items.length) {
11041			this._items.length === 0 && this.$stage.append(content);
11042			this._items.length !== 0 && this._items[position - 1].after(content);
11043			this._items.push(content);
11044			this._mergers.push(content.find('[data-merge]').addBack('[data-merge]').attr('data-merge') * 1 || 1);
11045		} else {
11046			this._items[position].before(content);
11047			this._items.splice(position, 0, content);
11048			this._mergers.splice(position, 0, content.find('[data-merge]').addBack('[data-merge]').attr('data-merge') * 1 || 1);
11049		}
11050
11051		this._items[current] && this.reset(this._items[current].index());
11052
11053		this.invalidate('items');
11054
11055		this.trigger('added', { content: content, position: position });
11056	};
11057
11058	/**
11059	 * Removes an item by its position.
11060	 * @todo Use `item` instead of `content` for the event arguments.
11061	 * @public
11062	 * @param {Number} position - The relative position of the item to remove.
11063	 */
11064	Owl.prototype.remove = function(position) {
11065		position = this.normalize(position, true);
11066
11067		if (position === undefined) {
11068			return;
11069		}
11070
11071		this.trigger('remove', { content: this._items[position], position: position });
11072
11073		this._items[position].remove();
11074		this._items.splice(position, 1);
11075		this._mergers.splice(position, 1);
11076
11077		this.invalidate('items');
11078
11079		this.trigger('removed', { content: null, position: position });
11080	};
11081
11082	/**
11083	 * Preloads images with auto width.
11084	 * @todo Replace by a more generic approach
11085	 * @protected
11086	 */
11087	Owl.prototype.preloadAutoWidthImages = function(images) {
11088		images.each($.proxy(function(i, element) {
11089			this.enter('pre-loading');
11090			element = $(element);
11091			$(new Image()).one('load', $.proxy(function(e) {
11092				element.attr('src', e.target.src);
11093				element.css('opacity', 1);
11094				this.leave('pre-loading');
11095				!this.is('pre-loading') && !this.is('initializing') && this.refresh();
11096			}, this)).attr('src', element.attr('src') || element.attr('data-src') || element.attr('data-src-retina'));
11097		}, this));
11098	};
11099
11100	/**
11101	 * Destroys the carousel.
11102	 * @public
11103	 */
11104	Owl.prototype.destroy = function() {
11105
11106		this.$element.off('.owl.core');
11107		this.$stage.off('.owl.core');
11108		$(document).off('.owl.core');
11109
11110		if (this.settings.responsive !== false) {
11111			window.clearTimeout(this.resizeTimer);
11112			this.off(window, 'resize', this._handlers.onThrottledResize);
11113		}
11114
11115		for (var i in this._plugins) {
11116			this._plugins[i].destroy();
11117		}
11118
11119		this.$stage.children('.cloned').remove();
11120
11121		this.$stage.unwrap();
11122		this.$stage.children().contents().unwrap();
11123		this.$stage.children().unwrap();
11124		this.$stage.remove();
11125		this.$element
11126			.removeClass(this.options.refreshClass)
11127			.removeClass(this.options.loadingClass)
11128			.removeClass(this.options.loadedClass)
11129			.removeClass(this.options.rtlClass)
11130			.removeClass(this.options.dragClass)
11131			.removeClass(this.options.grabClass)
11132			.attr('class', this.$element.attr('class').replace(new RegExp(this.options.responsiveClass + '-\\S+\\s', 'g'), ''))
11133			.removeData('owl.carousel');
11134	};
11135
11136	/**
11137	 * Operators to calculate right-to-left and left-to-right.
11138	 * @protected
11139	 * @param {Number} [a] - The left side operand.
11140	 * @param {String} [o] - The operator.
11141	 * @param {Number} [b] - The right side operand.
11142	 */
11143	Owl.prototype.op = function(a, o, b) {
11144		var rtl = this.settings.rtl;
11145		switch (o) {
11146			case '<':
11147				return rtl ? a > b : a < b;
11148			case '>':
11149				return rtl ? a < b : a > b;
11150			case '>=':
11151				return rtl ? a <= b : a >= b;
11152			case '<=':
11153				return rtl ? a >= b : a <= b;
11154			default:
11155				break;
11156		}
11157	};
11158
11159	/**
11160	 * Attaches to an internal event.
11161	 * @protected
11162	 * @param {HTMLElement} element - The event source.
11163	 * @param {String} event - The event name.
11164	 * @param {Function} listener - The event handler to attach.
11165	 * @param {Boolean} capture - Wether the event should be handled at the capturing phase or not.
11166	 */
11167	Owl.prototype.on = function(element, event, listener, capture) {
11168		if (element.addEventListener) {
11169			element.addEventListener(event, listener, capture);
11170		} else if (element.attachEvent) {
11171			element.attachEvent('on' + event, listener);
11172		}
11173	};
11174
11175	/**
11176	 * Detaches from an internal event.
11177	 * @protected
11178	 * @param {HTMLElement} element - The event source.
11179	 * @param {String} event - The event name.
11180	 * @param {Function} listener - The attached event handler to detach.
11181	 * @param {Boolean} capture - Wether the attached event handler was registered as a capturing listener or not.
11182	 */
11183	Owl.prototype.off = function(element, event, listener, capture) {
11184		if (element.removeEventListener) {
11185			element.removeEventListener(event, listener, capture);
11186		} else if (element.detachEvent) {
11187			element.detachEvent('on' + event, listener);
11188		}
11189	};
11190
11191	/**
11192	 * Triggers a public event.
11193	 * @todo Remove `status`, `relatedTarget` should be used instead.
11194	 * @protected
11195	 * @param {String} name - The event name.
11196	 * @param {*} [data=null] - The event data.
11197	 * @param {String} [namespace=carousel] - The event namespace.
11198	 * @param {String} [state] - The state which is associated with the event.
11199	 * @param {Boolean} [enter=false] - Indicates if the call enters the specified state or not.
11200	 * @returns {Event} - The event arguments.
11201	 */
11202	Owl.prototype.trigger = function(name, data, namespace, state, enter) {
11203		var status = {
11204			item: { count: this._items.length, index: this.current() }
11205		}, handler = $.camelCase(
11206			$.grep([ 'on', name, namespace ], function(v) { return v })
11207				.join('-').toLowerCase()
11208		), event = $.Event(
11209			[ name, 'owl', namespace || 'carousel' ].join('.').toLowerCase(),
11210			$.extend({ relatedTarget: this }, status, data)
11211		);
11212
11213		if (!this._supress[name]) {
11214			$.each(this._plugins, function(name, plugin) {
11215				if (plugin.onTrigger) {
11216					plugin.onTrigger(event);
11217				}
11218			});
11219
11220			this.register({ type: Owl.Type.Event, name: name });
11221			this.$element.trigger(event);
11222
11223			if (this.settings && typeof this.settings[handler] === 'function') {
11224				this.settings[handler].call(this, event);
11225			}
11226		}
11227
11228		return event;
11229	};
11230
11231	/**
11232	 * Enters a state.
11233	 * @param name - The state name.
11234	 */
11235	Owl.prototype.enter = function(name) {
11236		$.each([ name ].concat(this._states.tags[name] || []), $.proxy(function(i, name) {
11237			if (this._states.current[name] === undefined) {
11238				this._states.current[name] = 0;
11239			}
11240
11241			this._states.current[name]++;
11242		}, this));
11243	};
11244
11245	/**
11246	 * Leaves a state.
11247	 * @param name - The state name.
11248	 */
11249	Owl.prototype.leave = function(name) {
11250		$.each([ name ].concat(this._states.tags[name] || []), $.proxy(function(i, name) {
11251			this._states.current[name]--;
11252		}, this));
11253	};
11254
11255	/**
11256	 * Registers an event or state.
11257	 * @public
11258	 * @param {Object} object - The event or state to register.
11259	 */
11260	Owl.prototype.register = function(object) {
11261		if (object.type === Owl.Type.Event) {
11262			if (!$.event.special[object.name]) {
11263				$.event.special[object.name] = {};
11264			}
11265
11266			if (!$.event.special[object.name].owl) {
11267				var _default = $.event.special[object.name]._default;
11268				$.event.special[object.name]._default = function(e) {
11269					if (_default && _default.apply && (!e.namespace || e.namespace.indexOf('owl') === -1)) {
11270						return _default.apply(this, arguments);
11271					}
11272					return e.namespace && e.namespace.indexOf('owl') > -1;
11273				};
11274				$.event.special[object.name].owl = true;
11275			}
11276		} else if (object.type === Owl.Type.State) {
11277			if (!this._states.tags[object.name]) {
11278				this._states.tags[object.name] = object.tags;
11279			} else {
11280				this._states.tags[object.name] = this._states.tags[object.name].concat(object.tags);
11281			}
11282
11283			this._states.tags[object.name] = $.grep(this._states.tags[object.name], $.proxy(function(tag, i) {
11284				return $.inArray(tag, this._states.tags[object.name]) === i;
11285			}, this));
11286		}
11287	};
11288
11289	/**
11290	 * Suppresses events.
11291	 * @protected
11292	 * @param {Array.<String>} events - The events to suppress.
11293	 */
11294	Owl.prototype.suppress = function(events) {
11295		$.each(events, $.proxy(function(index, event) {
11296			this._supress[event] = true;
11297		}, this));
11298	};
11299
11300	/**
11301	 * Releases suppressed events.
11302	 * @protected
11303	 * @param {Array.<String>} events - The events to release.
11304	 */
11305	Owl.prototype.release = function(events) {
11306		$.each(events, $.proxy(function(index, event) {
11307			delete this._supress[event];
11308		}, this));
11309	};
11310
11311	/**
11312	 * Gets unified pointer coordinates from event.
11313	 * @todo #261
11314	 * @protected
11315	 * @param {Event} - The `mousedown` or `touchstart` event.
11316	 * @returns {Object} - Contains `x` and `y` coordinates of current pointer position.
11317	 */
11318	Owl.prototype.pointer = function(event) {
11319		var result = { x: null, y: null };
11320
11321		event = event.originalEvent || event || window.event;
11322
11323		event = event.touches && event.touches.length ?
11324			event.touches[0] : event.changedTouches && event.changedTouches.length ?
11325				event.changedTouches[0] : event;
11326
11327		if (event.pageX) {
11328			result.x = event.pageX;
11329			result.y = event.pageY;
11330		} else {
11331			result.x = event.clientX;
11332			result.y = event.clientY;
11333		}
11334
11335		return result;
11336	};
11337
11338	/**
11339	 * Determines if the input is a Number or something that can be coerced to a Number
11340	 * @protected
11341	 * @param {Number|String|Object|Array|Boolean|RegExp|Function|Symbol} - The input to be tested
11342	 * @returns {Boolean} - An indication if the input is a Number or can be coerced to a Number
11343	 */
11344	Owl.prototype.isNumeric = function(number) {
11345		return !isNaN(parseFloat(number));
11346	};
11347
11348	/**
11349	 * Gets the difference of two vectors.
11350	 * @todo #261
11351	 * @protected
11352	 * @param {Object} - The first vector.
11353	 * @param {Object} - The second vector.
11354	 * @returns {Object} - The difference.
11355	 */
11356	Owl.prototype.difference = function(first, second) {
11357		return {
11358			x: first.x - second.x,
11359			y: first.y - second.y
11360		};
11361	};
11362
11363	/**
11364	 * The jQuery Plugin for the Owl Carousel
11365	 * @todo Navigation plugin `next` and `prev`
11366	 * @public
11367	 */
11368	$.fn.owlCarousel = function(option) {
11369		var args = Array.prototype.slice.call(arguments, 1);
11370
11371		return this.each(function() {
11372			var $this = $(this),
11373				data = $this.data('owl.carousel');
11374
11375			if (!data) {
11376				data = new Owl(this, typeof option == 'object' && option);
11377				$this.data('owl.carousel', data);
11378
11379				$.each([
11380					'next', 'prev', 'to', 'destroy', 'refresh', 'replace', 'add', 'remove'
11381				], function(i, event) {
11382					data.register({ type: Owl.Type.Event, name: event });
11383					data.$element.on(event + '.owl.carousel.core', $.proxy(function(e) {
11384						if (e.namespace && e.relatedTarget !== this) {
11385							this.suppress([ event ]);
11386							data[event].apply(this, [].slice.call(arguments, 1));
11387							this.release([ event ]);
11388						}
11389					}, data));
11390				});
11391			}
11392
11393			if (typeof option == 'string' && option.charAt(0) !== '_') {
11394				data[option].apply(data, args);
11395			}
11396		});
11397	};
11398
11399	/**
11400	 * The constructor for the jQuery Plugin
11401	 * @public
11402	 */
11403	$.fn.owlCarousel.Constructor = Owl;
11404
11405})(window.Zepto || window.jQuery, window, document);
11406
11407/**
11408 * AutoRefresh Plugin
11409 * @version 2.3.4
11410 * @author Artus Kolanowski
11411 * @author David Deutsch
11412 * @license The MIT License (MIT)
11413 */
11414;(function($, window, document, undefined) {
11415
11416	/**
11417	 * Creates the auto refresh plugin.
11418	 * @class The Auto Refresh Plugin
11419	 * @param {Owl} carousel - The Owl Carousel
11420	 */
11421	var AutoRefresh = function(carousel) {
11422		/**
11423		 * Reference to the core.
11424		 * @protected
11425		 * @type {Owl}
11426		 */
11427		this._core = carousel;
11428
11429		/**
11430		 * Refresh interval.
11431		 * @protected
11432		 * @type {number}
11433		 */
11434		this._interval = null;
11435
11436		/**
11437		 * Whether the element is currently visible or not.
11438		 * @protected
11439		 * @type {Boolean}
11440		 */
11441		this._visible = null;
11442
11443		/**
11444		 * All event handlers.
11445		 * @protected
11446		 * @type {Object}
11447		 */
11448		this._handlers = {
11449			'initialized.owl.carousel': $.proxy(function(e) {
11450				if (e.namespace && this._core.settings.autoRefresh) {
11451					this.watch();
11452				}
11453			}, this)
11454		};
11455
11456		// set default options
11457		this._core.options = $.extend({}, AutoRefresh.Defaults, this._core.options);
11458
11459		// register event handlers
11460		this._core.$element.on(this._handlers);
11461	};
11462
11463	/**
11464	 * Default options.
11465	 * @public
11466	 */
11467	AutoRefresh.Defaults = {
11468		autoRefresh: true,
11469		autoRefreshInterval: 500
11470	};
11471
11472	/**
11473	 * Watches the element.
11474	 */
11475	AutoRefresh.prototype.watch = function() {
11476		if (this._interval) {
11477			return;
11478		}
11479
11480		this._visible = this._core.isVisible();
11481		this._interval = window.setInterval($.proxy(this.refresh, this), this._core.settings.autoRefreshInterval);
11482	};
11483
11484	/**
11485	 * Refreshes the element.
11486	 */
11487	AutoRefresh.prototype.refresh = function() {
11488		if (this._core.isVisible() === this._visible) {
11489			return;
11490		}
11491
11492		this._visible = !this._visible;
11493
11494		this._core.$element.toggleClass('owl-hidden', !this._visible);
11495
11496		this._visible && (this._core.invalidate('width') && this._core.refresh());
11497	};
11498
11499	/**
11500	 * Destroys the plugin.
11501	 */
11502	AutoRefresh.prototype.destroy = function() {
11503		var handler, property;
11504
11505		window.clearInterval(this._interval);
11506
11507		for (handler in this._handlers) {
11508			this._core.$element.off(handler, this._handlers[handler]);
11509		}
11510		for (property in Object.getOwnPropertyNames(this)) {
11511			typeof this[property] != 'function' && (this[property] = null);
11512		}
11513	};
11514
11515	$.fn.owlCarousel.Constructor.Plugins.AutoRefresh = AutoRefresh;
11516
11517})(window.Zepto || window.jQuery, window, document);
11518
11519/**
11520 * Lazy Plugin
11521 * @version 2.3.4
11522 * @author Bartosz Wojciechowski
11523 * @author David Deutsch
11524 * @license The MIT License (MIT)
11525 */
11526;(function($, window, document, undefined) {
11527
11528	/**
11529	 * Creates the lazy plugin.
11530	 * @class The Lazy Plugin
11531	 * @param {Owl} carousel - The Owl Carousel
11532	 */
11533	var Lazy = function(carousel) {
11534
11535		/**
11536		 * Reference to the core.
11537		 * @protected
11538		 * @type {Owl}
11539		 */
11540		this._core = carousel;
11541
11542		/**
11543		 * Already loaded items.
11544		 * @protected
11545		 * @type {Array.<jQuery>}
11546		 */
11547		this._loaded = [];
11548
11549		/**
11550		 * Event handlers.
11551		 * @protected
11552		 * @type {Object}
11553		 */
11554		this._handlers = {
11555			'initialized.owl.carousel change.owl.carousel resized.owl.carousel': $.proxy(function(e) {
11556				if (!e.namespace) {
11557					return;
11558				}
11559
11560				if (!this._core.settings || !this._core.settings.lazyLoad) {
11561					return;
11562				}
11563
11564				if ((e.property && e.property.name == 'position') || e.type == 'initialized') {
11565					var settings = this._core.settings,
11566						n = (settings.center && Math.ceil(settings.items / 2) || settings.items),
11567						i = ((settings.center && n * -1) || 0),
11568						position = (e.property && e.property.value !== undefined ? e.property.value : this._core.current()) + i,
11569						clones = this._core.clones().length,
11570						load = $.proxy(function(i, v) { this.load(v) }, this);
11571					//TODO: Need documentation for this new option
11572					if (settings.lazyLoadEager > 0) {
11573						n += settings.lazyLoadEager;
11574						// If the carousel is looping also preload images that are to the "left"
11575						if (settings.loop) {
11576              position -= settings.lazyLoadEager;
11577              n++;
11578            }
11579					}
11580
11581					while (i++ < n) {
11582						this.load(clones / 2 + this._core.relative(position));
11583						clones && $.each(this._core.clones(this._core.relative(position)), load);
11584						position++;
11585					}
11586				}
11587			}, this)
11588		};
11589
11590		// set the default options
11591		this._core.options = $.extend({}, Lazy.Defaults, this._core.options);
11592
11593		// register event handler
11594		this._core.$element.on(this._handlers);
11595	};
11596
11597	/**
11598	 * Default options.
11599	 * @public
11600	 */
11601	Lazy.Defaults = {
11602		lazyLoad: false,
11603		lazyLoadEager: 0
11604	};
11605
11606	/**
11607	 * Loads all resources of an item at the specified position.
11608	 * @param {Number} position - The absolute position of the item.
11609	 * @protected
11610	 */
11611	Lazy.prototype.load = function(position) {
11612		var $item = this._core.$stage.children().eq(position),
11613			$elements = $item && $item.find('.owl-lazy');
11614
11615		if (!$elements || $.inArray($item.get(0), this._loaded) > -1) {
11616			return;
11617		}
11618
11619		$elements.each($.proxy(function(index, element) {
11620			var $element = $(element), image,
11621                url = (window.devicePixelRatio > 1 && $element.attr('data-src-retina')) || $element.attr('data-src') || $element.attr('data-srcset');
11622
11623			this._core.trigger('load', { element: $element, url: url }, 'lazy');
11624
11625			if ($element.is('img')) {
11626				$element.one('load.owl.lazy', $.proxy(function() {
11627					$element.css('opacity', 1);
11628					this._core.trigger('loaded', { element: $element, url: url }, 'lazy');
11629				}, this)).attr('src', url);
11630            } else if ($element.is('source')) {
11631                $element.one('load.owl.lazy', $.proxy(function() {
11632                    this._core.trigger('loaded', { element: $element, url: url }, 'lazy');
11633                }, this)).attr('srcset', url);
11634			} else {
11635				image = new Image();
11636				image.onload = $.proxy(function() {
11637					$element.css({
11638						'background-image': 'url("' + url + '")',
11639						'opacity': '1'
11640					});
11641					this._core.trigger('loaded', { element: $element, url: url }, 'lazy');
11642				}, this);
11643				image.src = url;
11644			}
11645		}, this));
11646
11647		this._loaded.push($item.get(0));
11648	};
11649
11650	/**
11651	 * Destroys the plugin.
11652	 * @public
11653	 */
11654	Lazy.prototype.destroy = function() {
11655		var handler, property;
11656
11657		for (handler in this.handlers) {
11658			this._core.$element.off(handler, this.handlers[handler]);
11659		}
11660		for (property in Object.getOwnPropertyNames(this)) {
11661			typeof this[property] != 'function' && (this[property] = null);
11662		}
11663	};
11664
11665	$.fn.owlCarousel.Constructor.Plugins.Lazy = Lazy;
11666
11667})(window.Zepto || window.jQuery, window, document);
11668
11669/**
11670 * AutoHeight Plugin
11671 * @version 2.3.4
11672 * @author Bartosz Wojciechowski
11673 * @author David Deutsch
11674 * @license The MIT License (MIT)
11675 */
11676;(function($, window, document, undefined) {
11677
11678	/**
11679	 * Creates the auto height plugin.
11680	 * @class The Auto Height Plugin
11681	 * @param {Owl} carousel - The Owl Carousel
11682	 */
11683	var AutoHeight = function(carousel) {
11684		/**
11685		 * Reference to the core.
11686		 * @protected
11687		 * @type {Owl}
11688		 */
11689		this._core = carousel;
11690
11691		this._previousHeight = null;
11692
11693		/**
11694		 * All event handlers.
11695		 * @protected
11696		 * @type {Object}
11697		 */
11698		this._handlers = {
11699			'initialized.owl.carousel refreshed.owl.carousel': $.proxy(function(e) {
11700				if (e.namespace && this._core.settings.autoHeight) {
11701					this.update();
11702				}
11703			}, this),
11704			'changed.owl.carousel': $.proxy(function(e) {
11705				if (e.namespace && this._core.settings.autoHeight && e.property.name === 'position'){
11706					this.update();
11707				}
11708			}, this),
11709			'loaded.owl.lazy': $.proxy(function(e) {
11710				if (e.namespace && this._core.settings.autoHeight
11711					&& e.element.closest('.' + this._core.settings.itemClass).index() === this._core.current()) {
11712					this.update();
11713				}
11714			}, this)
11715		};
11716
11717		// set default options
11718		this._core.options = $.extend({}, AutoHeight.Defaults, this._core.options);
11719
11720		// register event handlers
11721		this._core.$element.on(this._handlers);
11722		this._intervalId = null;
11723		var refThis = this;
11724
11725		// These changes have been taken from a PR by gavrochelegnou proposed in #1575
11726		// and have been made compatible with the latest jQuery version
11727		$(window).on('load', function() {
11728			if (refThis._core.settings.autoHeight) {
11729				refThis.update();
11730			}
11731		});
11732
11733		// Autoresize the height of the carousel when window is resized
11734		// When carousel has images, the height is dependent on the width
11735		// and should also change on resize
11736		$(window).resize(function() {
11737			if (refThis._core.settings.autoHeight) {
11738				if (refThis._intervalId != null) {
11739					clearTimeout(refThis._intervalId);
11740				}
11741
11742				refThis._intervalId = setTimeout(function() {
11743					refThis.update();
11744				}, 250);
11745			}
11746		});
11747
11748	};
11749
11750	/**
11751	 * Default options.
11752	 * @public
11753	 */
11754	AutoHeight.Defaults = {
11755		autoHeight: false,
11756		autoHeightClass: 'owl-height'
11757	};
11758
11759	/**
11760	 * Updates the view.
11761	 */
11762	AutoHeight.prototype.update = function() {
11763		var start = this._core._current,
11764			end = start + this._core.settings.items,
11765			lazyLoadEnabled = this._core.settings.lazyLoad,
11766			visible = this._core.$stage.children().toArray().slice(start, end),
11767			heights = [],
11768			maxheight = 0;
11769
11770		$.each(visible, function(index, item) {
11771			heights.push($(item).height());
11772		});
11773
11774		maxheight = Math.max.apply(null, heights);
11775
11776		if (maxheight <= 1 && lazyLoadEnabled && this._previousHeight) {
11777			maxheight = this._previousHeight;
11778		}
11779
11780		this._previousHeight = maxheight;
11781
11782		this._core.$stage.parent()
11783			.height(maxheight)
11784			.addClass(this._core.settings.autoHeightClass);
11785	};
11786
11787	AutoHeight.prototype.destroy = function() {
11788		var handler, property;
11789
11790		for (handler in this._handlers) {
11791			this._core.$element.off(handler, this._handlers[handler]);
11792		}
11793		for (property in Object.getOwnPropertyNames(this)) {
11794			typeof this[property] !== 'function' && (this[property] = null);
11795		}
11796	};
11797
11798	$.fn.owlCarousel.Constructor.Plugins.AutoHeight = AutoHeight;
11799
11800})(window.Zepto || window.jQuery, window, document);
11801
11802/**
11803 * Video Plugin
11804 * @version 2.3.4
11805 * @author Bartosz Wojciechowski
11806 * @author David Deutsch
11807 * @license The MIT License (MIT)
11808 */
11809;(function($, window, document, undefined) {
11810
11811	/**
11812	 * Creates the video plugin.
11813	 * @class The Video Plugin
11814	 * @param {Owl} carousel - The Owl Carousel
vendor: 5,347 bytes, lines 11815-12012
11815	 */
11816	var Video = function(carousel) {
11817		/**
11818		 * Reference to the core.
11819		 * @protected
11820		 * @type {Owl}
11821		 */
11822		this._core = carousel;
11823
11824		/**
11825		 * Cache all video URLs.
11826		 * @protected
11827		 * @type {Object}
11828		 */
11829		this._videos = {};
11830
11831		/**
11832		 * Current playing item.
11833		 * @protected
11834		 * @type {jQuery}
11835		 */
11836		this._playing = null;
11837
11838		/**
11839		 * All event handlers.
11840		 * @todo The cloned content removale is too late
11841		 * @protected
11842		 * @type {Object}
11843		 */
11844		this._handlers = {
11845			'initialized.owl.carousel': $.proxy(function(e) {
11846				if (e.namespace) {
11847					this._core.register({ type: 'state', name: 'playing', tags: [ 'interacting' ] });
11848				}
11849			}, this),
11850			'resize.owl.carousel': $.proxy(function(e) {
11851				if (e.namespace && this._core.settings.video && this.isInFullScreen()) {
11852					e.preventDefault();
11853				}
11854			}, this),
11855			'refreshed.owl.carousel': $.proxy(function(e) {
11856				if (e.namespace && this._core.is('resizing')) {
11857					this._core.$stage.find('.cloned .owl-video-frame').remove();
11858				}
11859			}, this),
11860			'changed.owl.carousel': $.proxy(function(e) {
11861				if (e.namespace && e.property.name === 'position' && this._playing) {
11862					this.stop();
11863				}
11864			}, this),
11865			'prepared.owl.carousel': $.proxy(function(e) {
11866				if (!e.namespace) {
11867					return;
11868				}
11869
11870				var $element = $(e.content).find('.owl-video');
11871
11872				if ($element.length) {
11873					$element.css('display', 'none');
11874					this.fetch($element, $(e.content));
11875				}
11876			}, this)
11877		};
11878
11879		// set default options
11880		this._core.options = $.extend({}, Video.Defaults, this._core.options);
11881
11882		// register event handlers
11883		this._core.$element.on(this._handlers);
11884
11885		this._core.$element.on('click.owl.video', '.owl-video-play-icon', $.proxy(function(e) {
11886			this.play(e);
11887		}, this));
11888	};
11889
11890	/**
11891	 * Default options.
11892	 * @public
11893	 */
11894	Video.Defaults = {
11895		video: false,
11896		videoHeight: false,
11897		videoWidth: false
11898	};
11899
11900	/**
11901	 * Gets the video ID and the type (YouTube/Vimeo/vzaar only).
11902	 * @protected
11903	 * @param {jQuery} target - The target containing the video data.
11904	 * @param {jQuery} item - The item containing the video.
11905	 */
11906	Video.prototype.fetch = function(target, item) {
11907			var type = (function() {
11908					if (target.attr('data-vimeo-id')) {
11909						return 'vimeo';
11910					} else if (target.attr('data-vzaar-id')) {
11911						return 'vzaar'
11912					} else {
11913						return 'youtube';
11914					}
11915				})(),
11916				id = target.attr('data-vimeo-id') || target.attr('data-youtube-id') || target.attr('data-vzaar-id'),
11917				width = target.attr('data-width') || this._core.settings.videoWidth,
11918				height = target.attr('data-height') || this._core.settings.videoHeight,
11919				url = target.attr('href');
11920
11921		if (url) {
11922
11923			/*
11924					Parses the id's out of the following urls (and probably more):
11925					https://www.youtube.com/watch?v=:id
11926					https://youtu.be/:id
11927					https://vimeo.com/:id
11928					https://vimeo.com/channels/:channel/:id
11929					https://vimeo.com/groups/:group/videos/:id
11930					https://app.vzaar.com/videos/:id
11931
11932					Visual example: https://regexper.com/#(http%3A%7Chttps%3A%7C)%5C%2F%5C%2F(player.%7Cwww.%7Capp.)%3F(vimeo%5C.com%7Cyoutu(be%5C.com%7C%5C.be%7Cbe%5C.googleapis%5C.com)%7Cvzaar%5C.com)%5C%2F(video%5C%2F%7Cvideos%5C%2F%7Cembed%5C%2F%7Cchannels%5C%2F.%2B%5C%2F%7Cgroups%5C%2F.%2B%5C%2F%7Cwatch%5C%3Fv%3D%7Cv%5C%2F)%3F(%5BA-Za-z0-9._%25-%5D*)(%5C%26%5CS%2B)%3F
11933			*/
11934
11935			id = url.match(/(http:|https:|)\/\/(player.|www.|app.)?(vimeo\.com|youtu(be\.com|\.be|be\.googleapis\.com|be\-nocookie\.com)|vzaar\.com)\/(video\/|videos\/|embed\/|channels\/.+\/|groups\/.+\/|watch\?v=|v\/)?([A-Za-z0-9._%-]*)(\&\S+)?/);
11936
11937			if (id[3].indexOf('youtu') > -1) {
11938				type = 'youtube';
11939			} else if (id[3].indexOf('vimeo') > -1) {
11940				type = 'vimeo';
11941			} else if (id[3].indexOf('vzaar') > -1) {
11942				type = 'vzaar';
11943			} else {
11944				throw new Error('Video URL not supported.');
11945			}
11946			id = id[6];
11947		} else {
11948			throw new Error('Missing video URL.');
11949		}
11950
11951		this._videos[url] = {
11952			type: type,
11953			id: id,
11954			width: width,
11955			height: height
11956		};
11957
11958		item.attr('data-video', url);
11959
11960		this.thumbnail(target, this._videos[url]);
11961	};
11962
11963	/**
11964	 * Creates video thumbnail.
11965	 * @protected
11966	 * @param {jQuery} target - The target containing the video data.
11967	 * @param {Object} info - The video info object.
11968	 * @see `fetch`
11969	 */
11970	Video.prototype.thumbnail = function(target, video) {
11971		var tnLink,
11972			icon,
11973			path,
11974			dimensions = video.width && video.height ? 'width:' + video.width + 'px;height:' + video.height + 'px;' : '',
11975			customTn = target.find('img'),
11976			srcType = 'src',
11977			lazyClass = '',
11978			settings = this._core.settings,
11979			create = function(path) {
11980				icon = '<div class="owl-video-play-icon"></div>';
11981
11982				if (settings.lazyLoad) {
11983					tnLink = $('<div/>',{
11984						"class": 'owl-video-tn ' + lazyClass,
11985						"srcType": path
11986					});
11987				} else {
11988					tnLink = $( '<div/>', {
11989						"class": "owl-video-tn",
11990						"style": 'opacity:1;background-image:url(' + path + ')'
11991					});
11992				}
11993				target.after(tnLink);
11994				target.after(icon);
11995			};
11996
11997		// wrap video content into owl-video-wrapper div
11998		target.wrap( $( '<div/>', {
11999			"class": "owl-video-wrapper",
12000			"style": dimensions
12001		}));
12002
12003		if (this._core.settings.lazyLoad) {
12004			srcType = 'data-src';
12005			lazyClass = 'owl-lazy';
12006		}
12007
12008		// custom thumbnail
12009		if (customTn.length) {
12010			create(customTn.attr(srcType));
12011			customTn.remove();
12012			return false;
vendor: 15,908 bytes, lines 12013-12650
12013		}
12014
12015		if (video.type === 'youtube') {
12016			path = "//img.youtube.com/vi/" + video.id + "/hqdefault.jpg";
12017			create(path);
12018		} else if (video.type === 'vimeo') {
12019			$.ajax({
12020				type: 'GET',
12021				url: '//vimeo.com/api/v2/video/' + video.id + '.json',
12022				jsonp: 'callback',
12023				dataType: 'jsonp',
12024				success: function(data) {
12025					path = data[0].thumbnail_large;
12026					create(path);
12027				}
12028			});
12029		} else if (video.type === 'vzaar') {
12030			$.ajax({
12031				type: 'GET',
12032				url: '//vzaar.com/api/videos/' + video.id + '.json',
12033				jsonp: 'callback',
12034				dataType: 'jsonp',
12035				success: function(data) {
12036					path = data.framegrab_url;
12037					create(path);
12038				}
12039			});
12040		}
12041	};
12042
12043	/**
12044	 * Stops the current video.
12045	 * @public
12046	 */
12047	Video.prototype.stop = function() {
12048		this._core.trigger('stop', null, 'video');
12049		this._playing.find('.owl-video-frame').remove();
12050		this._playing.removeClass('owl-video-playing');
12051		this._playing = null;
12052		this._core.leave('playing');
12053		this._core.trigger('stopped', null, 'video');
12054	};
12055
12056	/**
12057	 * Starts the current video.
12058	 * @public
12059	 * @param {Event} event - The event arguments.
12060	 */
12061	Video.prototype.play = function(event) {
12062		var target = $(event.target),
12063			item = target.closest('.' + this._core.settings.itemClass),
12064			video = this._videos[item.attr('data-video')],
12065			width = video.width || '100%',
12066			height = video.height || this._core.$stage.height(),
12067			html,
12068			iframe;
12069
12070		if (this._playing) {
12071			return;
12072		}
12073
12074		this._core.enter('playing');
12075		this._core.trigger('play', null, 'video');
12076
12077		item = this._core.items(this._core.relative(item.index()));
12078
12079		this._core.reset(item.index());
12080
12081		html = $( '<iframe frameborder="0" allowfullscreen mozallowfullscreen webkitAllowFullScreen ></iframe>' );
12082		html.attr( 'height', height );
12083		html.attr( 'width', width );
12084		if (video.type === 'youtube') {
12085			html.attr( 'src', '//www.youtube.com/embed/' + video.id + '?autoplay=1&rel=0&v=' + video.id );
12086		} else if (video.type === 'vimeo') {
12087			html.attr( 'src', '//player.vimeo.com/video/' + video.id + '?autoplay=1' );
12088		} else if (video.type === 'vzaar') {
12089			html.attr( 'src', '//view.vzaar.com/' + video.id + '/player?autoplay=true' );
12090		}
12091
12092		iframe = $(html).wrap( '<div class="owl-video-frame" />' ).insertAfter(item.find('.owl-video'));
12093
12094		this._playing = item.addClass('owl-video-playing');
12095	};
12096
12097	/**
12098	 * Checks whether an video is currently in full screen mode or not.
12099	 * @todo Bad style because looks like a readonly method but changes members.
12100	 * @protected
12101	 * @returns {Boolean}
12102	 */
12103	Video.prototype.isInFullScreen = function() {
12104		var element = document.fullscreenElement || document.mozFullScreenElement ||
12105				document.webkitFullscreenElement;
12106
12107		return element && $(element).parent().hasClass('owl-video-frame');
12108	};
12109
12110	/**
12111	 * Destroys the plugin.
12112	 */
12113	Video.prototype.destroy = function() {
12114		var handler, property;
12115
12116		this._core.$element.off('click.owl.video');
12117
12118		for (handler in this._handlers) {
12119			this._core.$element.off(handler, this._handlers[handler]);
12120		}
12121		for (property in Object.getOwnPropertyNames(this)) {
12122			typeof this[property] != 'function' && (this[property] = null);
12123		}
12124	};
12125
12126	$.fn.owlCarousel.Constructor.Plugins.Video = Video;
12127
12128})(window.Zepto || window.jQuery, window, document);
12129
12130/**
12131 * Animate Plugin
12132 * @version 2.3.4
12133 * @author Bartosz Wojciechowski
12134 * @author David Deutsch
12135 * @license The MIT License (MIT)
12136 */
12137;(function($, window, document, undefined) {
12138
12139	/**
12140	 * Creates the animate plugin.
12141	 * @class The Navigation Plugin
12142	 * @param {Owl} scope - The Owl Carousel
12143	 */
12144	var Animate = function(scope) {
12145		this.core = scope;
12146		this.core.options = $.extend({}, Animate.Defaults, this.core.options);
12147		this.swapping = true;
12148		this.previous = undefined;
12149		this.next = undefined;
12150
12151		this.handlers = {
12152			'change.owl.carousel': $.proxy(function(e) {
12153				if (e.namespace && e.property.name == 'position') {
12154					this.previous = this.core.current();
12155					this.next = e.property.value;
12156				}
12157			}, this),
12158			'drag.owl.carousel dragged.owl.carousel translated.owl.carousel': $.proxy(function(e) {
12159				if (e.namespace) {
12160					this.swapping = e.type == 'translated';
12161				}
12162			}, this),
12163			'translate.owl.carousel': $.proxy(function(e) {
12164				if (e.namespace && this.swapping && (this.core.options.animateOut || this.core.options.animateIn)) {
12165					this.swap();
12166				}
12167			}, this)
12168		};
12169
12170		this.core.$element.on(this.handlers);
12171	};
12172
12173	/**
12174	 * Default options.
12175	 * @public
12176	 */
12177	Animate.Defaults = {
12178		animateOut: false,
12179		animateIn: false
12180	};
12181
12182	/**
12183	 * Toggles the animation classes whenever an translations starts.
12184	 * @protected
12185	 * @returns {Boolean|undefined}
12186	 */
12187	Animate.prototype.swap = function() {
12188
12189		if (this.core.settings.items !== 1) {
12190			return;
12191		}
12192
12193		if (!$.support.animation || !$.support.transition) {
12194			return;
12195		}
12196
12197		this.core.speed(0);
12198
12199		var left,
12200			clear = $.proxy(this.clear, this),
12201			previous = this.core.$stage.children().eq(this.previous),
12202			next = this.core.$stage.children().eq(this.next),
12203			incoming = this.core.settings.animateIn,
12204			outgoing = this.core.settings.animateOut;
12205
12206		if (this.core.current() === this.previous) {
12207			return;
12208		}
12209
12210		if (outgoing) {
12211			left = this.core.coordinates(this.previous) - this.core.coordinates(this.next);
12212			previous.one($.support.animation.end, clear)
12213				.css( { 'left': left + 'px' } )
12214				.addClass('animated owl-animated-out')
12215				.addClass(outgoing);
12216		}
12217
12218		if (incoming) {
12219			next.one($.support.animation.end, clear)
12220				.addClass('animated owl-animated-in')
12221				.addClass(incoming);
12222		}
12223	};
12224
12225	Animate.prototype.clear = function(e) {
12226		$(e.target).css( { 'left': '' } )
12227			.removeClass('animated owl-animated-out owl-animated-in')
12228			.removeClass(this.core.settings.animateIn)
12229			.removeClass(this.core.settings.animateOut);
12230		this.core.onTransitionEnd();
12231	};
12232
12233	/**
12234	 * Destroys the plugin.
12235	 * @public
12236	 */
12237	Animate.prototype.destroy = function() {
12238		var handler, property;
12239
12240		for (handler in this.handlers) {
12241			this.core.$element.off(handler, this.handlers[handler]);
12242		}
12243		for (property in Object.getOwnPropertyNames(this)) {
12244			typeof this[property] != 'function' && (this[property] = null);
12245		}
12246	};
12247
12248	$.fn.owlCarousel.Constructor.Plugins.Animate = Animate;
12249
12250})(window.Zepto || window.jQuery, window, document);
12251
12252/**
12253 * Autoplay Plugin
12254 * @version 2.3.4
12255 * @author Bartosz Wojciechowski
12256 * @author Artus Kolanowski
12257 * @author David Deutsch
12258 * @author Tom De Caluwé
12259 * @license The MIT License (MIT)
12260 */
12261;(function($, window, document, undefined) {
12262
12263	/**
12264	 * Creates the autoplay plugin.
12265	 * @class The Autoplay Plugin
12266	 * @param {Owl} scope - The Owl Carousel
12267	 */
12268	var Autoplay = function(carousel) {
12269		/**
12270		 * Reference to the core.
12271		 * @protected
12272		 * @type {Owl}
12273		 */
12274		this._core = carousel;
12275
12276		/**
12277		 * The autoplay timeout id.
12278		 * @type {Number}
12279		 */
12280		this._call = null;
12281
12282		/**
12283		 * Depending on the state of the plugin, this variable contains either
12284		 * the start time of the timer or the current timer value if it's
12285		 * paused. Since we start in a paused state we initialize the timer
12286		 * value.
12287		 * @type {Number}
12288		 */
12289		this._time = 0;
12290
12291		/**
12292		 * Stores the timeout currently used.
12293		 * @type {Number}
12294		 */
12295		this._timeout = 0;
12296
12297		/**
12298		 * Indicates whenever the autoplay is paused.
12299		 * @type {Boolean}
12300		 */
12301		this._paused = true;
12302
12303		/**
12304		 * All event handlers.
12305		 * @protected
12306		 * @type {Object}
12307		 */
12308		this._handlers = {
12309			'changed.owl.carousel': $.proxy(function(e) {
12310				if (e.namespace && e.property.name === 'settings') {
12311					if (this._core.settings.autoplay) {
12312						this.play();
12313					} else {
12314						this.stop();
12315					}
12316				} else if (e.namespace && e.property.name === 'position' && this._paused) {
12317					// Reset the timer. This code is triggered when the position
12318					// of the carousel was changed through user interaction.
12319					this._time = 0;
12320				}
12321			}, this),
12322			'initialized.owl.carousel': $.proxy(function(e) {
12323				if (e.namespace && this._core.settings.autoplay) {
12324					this.play();
12325				}
12326			}, this),
12327			'play.owl.autoplay': $.proxy(function(e, t, s) {
12328				if (e.namespace) {
12329					this.play(t, s);
12330				}
12331			}, this),
12332			'stop.owl.autoplay': $.proxy(function(e) {
12333				if (e.namespace) {
12334					this.stop();
12335				}
12336			}, this),
12337			'mouseover.owl.autoplay': $.proxy(function() {
12338				if (this._core.settings.autoplayHoverPause && this._core.is('rotating')) {
12339					this.pause();
12340				}
12341			}, this),
12342			'mouseleave.owl.autoplay': $.proxy(function() {
12343				if (this._core.settings.autoplayHoverPause && this._core.is('rotating')) {
12344					this.play();
12345				}
12346			}, this),
12347			'touchstart.owl.core': $.proxy(function() {
12348				if (this._core.settings.autoplayHoverPause && this._core.is('rotating')) {
12349					this.pause();
12350				}
12351			}, this),
12352			'touchend.owl.core': $.proxy(function() {
12353				if (this._core.settings.autoplayHoverPause) {
12354					this.play();
12355				}
12356			}, this)
12357		};
12358
12359		// register event handlers
12360		this._core.$element.on(this._handlers);
12361
12362		// set default options
12363		this._core.options = $.extend({}, Autoplay.Defaults, this._core.options);
12364	};
12365
12366	/**
12367	 * Default options.
12368	 * @public
12369	 */
12370	Autoplay.Defaults = {
12371		autoplay: false,
12372		autoplayTimeout: 5000,
12373		autoplayHoverPause: false,
12374		autoplaySpeed: false
12375	};
12376
12377	/**
12378	 * Transition to the next slide and set a timeout for the next transition.
12379	 * @private
12380	 * @param {Number} [speed] - The animation speed for the animations.
12381	 */
12382	Autoplay.prototype._next = function(speed) {
12383		this._call = window.setTimeout(
12384			$.proxy(this._next, this, speed),
12385			this._timeout * (Math.round(this.read() / this._timeout) + 1) - this.read()
12386		);
12387
12388		if (this._core.is('interacting') || document.hidden) {
12389			return;
12390		}
12391		this._core.next(speed || this._core.settings.autoplaySpeed);
12392	}
12393
12394	/**
12395	 * Reads the current timer value when the timer is playing.
12396	 * @public
12397	 */
12398	Autoplay.prototype.read = function() {
12399		return new Date().getTime() - this._time;
12400	};
12401
12402	/**
12403	 * Starts the autoplay.
12404	 * @public
12405	 * @param {Number} [timeout] - The interval before the next animation starts.
12406	 * @param {Number} [speed] - The animation speed for the animations.
12407	 */
12408	Autoplay.prototype.play = function(timeout, speed) {
12409		var elapsed;
12410
12411		if (!this._core.is('rotating')) {
12412			this._core.enter('rotating');
12413		}
12414
12415		timeout = timeout || this._core.settings.autoplayTimeout;
12416
12417		// Calculate the elapsed time since the last transition. If the carousel
12418		// wasn't playing this calculation will yield zero.
12419		elapsed = Math.min(this._time % (this._timeout || timeout), timeout);
12420
12421		if (this._paused) {
12422			// Start the clock.
12423			this._time = this.read();
12424			this._paused = false;
12425		} else {
12426			// Clear the active timeout to allow replacement.
12427			window.clearTimeout(this._call);
12428		}
12429
12430		// Adjust the origin of the timer to match the new timeout value.
12431		this._time += this.read() % timeout - elapsed;
12432
12433		this._timeout = timeout;
12434		this._call = window.setTimeout($.proxy(this._next, this, speed), timeout - elapsed);
12435	};
12436
12437	/**
12438	 * Stops the autoplay.
12439	 * @public
12440	 */
12441	Autoplay.prototype.stop = function() {
12442		if (this._core.is('rotating')) {
12443			// Reset the clock.
12444			this._time = 0;
12445			this._paused = true;
12446
12447			window.clearTimeout(this._call);
12448			this._core.leave('rotating');
12449		}
12450	};
12451
12452	/**
12453	 * Pauses the autoplay.
12454	 * @public
12455	 */
12456	Autoplay.prototype.pause = function() {
12457		if (this._core.is('rotating') && !this._paused) {
12458			// Pause the clock.
12459			this._time = this.read();
12460			this._paused = true;
12461
12462			window.clearTimeout(this._call);
12463		}
12464	};
12465
12466	/**
12467	 * Destroys the plugin.
12468	 */
12469	Autoplay.prototype.destroy = function() {
12470		var handler, property;
12471
12472		this.stop();
12473
12474		for (handler in this._handlers) {
12475			this._core.$element.off(handler, this._handlers[handler]);
12476		}
12477		for (property in Object.getOwnPropertyNames(this)) {
12478			typeof this[property] != 'function' && (this[property] = null);
12479		}
12480	};
12481
12482	$.fn.owlCarousel.Constructor.Plugins.autoplay = Autoplay;
12483
12484})(window.Zepto || window.jQuery, window, document);
12485
12486/**
12487 * Navigation Plugin
12488 * @version 2.3.4
12489 * @author Artus Kolanowski
12490 * @author David Deutsch
12491 * @license The MIT License (MIT)
12492 */
12493;(function($, window, document, undefined) {
12494	'use strict';
12495
12496	/**
12497	 * Creates the navigation plugin.
12498	 * @class The Navigation Plugin
12499	 * @param {Owl} carousel - The Owl Carousel.
12500	 */
12501	var Navigation = function(carousel) {
12502		/**
12503		 * Reference to the core.
12504		 * @protected
12505		 * @type {Owl}
12506		 */
12507		this._core = carousel;
12508
12509		/**
12510		 * Indicates whether the plugin is initialized or not.
12511		 * @protected
12512		 * @type {Boolean}
12513		 */
12514		this._initialized = false;
12515
12516		/**
12517		 * The current paging indexes.
12518		 * @protected
12519		 * @type {Array}
12520		 */
12521		this._pages = [];
12522
12523		/**
12524		 * All DOM elements of the user interface.
12525		 * @protected
12526		 * @type {Object}
12527		 */
12528		this._controls = {};
12529
12530		/**
12531		 * Markup for an indicator.
12532		 * @protected
12533		 * @type {Array.<String>}
12534		 */
12535		this._templates = [];
12536
12537		/**
12538		 * The carousel element.
12539		 * @type {jQuery}
12540		 */
12541		this.$element = this._core.$element;
12542
12543		/**
12544		 * Overridden methods of the carousel.
12545		 * @protected
12546		 * @type {Object}
12547		 */
12548		this._overrides = {
12549			next: this._core.next,
12550			prev: this._core.prev,
12551			to: this._core.to
12552		};
12553
12554		/**
12555		 * All event handlers.
12556		 * @protected
12557		 * @type {Object}
12558		 */
12559		this._handlers = {
12560			'prepared.owl.carousel': $.proxy(function(e) {
12561				if (e.namespace && this._core.settings.dotsData) {
12562					this._templates.push('<div class="' + this._core.settings.dotClass + '">' +
12563						$(e.content).find('[data-dot]').addBack('[data-dot]').attr('data-dot') + '</div>');
12564				}
12565			}, this),
12566			'added.owl.carousel': $.proxy(function(e) {
12567				if (e.namespace && this._core.settings.dotsData) {
12568					this._templates.splice(e.position, 0, this._templates.pop());
12569				}
12570			}, this),
12571			'remove.owl.carousel': $.proxy(function(e) {
12572				if (e.namespace && this._core.settings.dotsData) {
12573					this._templates.splice(e.position, 1);
12574				}
12575			}, this),
12576			'changed.owl.carousel': $.proxy(function(e) {
12577				if (e.namespace && e.property.name == 'position') {
12578					this.draw();
12579				}
12580			}, this),
12581			'initialized.owl.carousel': $.proxy(function(e) {
12582				if (e.namespace && !this._initialized) {
12583					this._core.trigger('initialize', null, 'navigation');
12584					this.initialize();
12585					this.update();
12586					this.draw();
12587					this._initialized = true;
12588					this._core.trigger('initialized', null, 'navigation');
12589				}
12590			}, this),
12591			'refreshed.owl.carousel': $.proxy(function(e) {
12592				if (e.namespace && this._initialized) {
12593					this._core.trigger('refresh', null, 'navigation');
12594					this.update();
12595					this.draw();
12596					this._core.trigger('refreshed', null, 'navigation');
12597				}
12598			}, this)
12599		};
12600
12601		// set default options
12602		this._core.options = $.extend({}, Navigation.Defaults, this._core.options);
12603
12604		// register event handlers
12605		this.$element.on(this._handlers);
12606	};
12607
12608	/**
12609	 * Default options.
12610	 * @public
12611	 * @todo Rename `slideBy` to `navBy`
12612	 */
12613	Navigation.Defaults = {
12614		nav: false,
12615		navText: [
12616			'<span aria-label="' + 'Previous' + '">&#x2039;</span>',
12617			'<span aria-label="' + 'Next' + '">&#x203a;</span>'
12618		],
12619		navSpeed: false,
12620		navElement: 'button type="button" role="presentation"',
12621		navContainer: false,
12622		navContainerClass: 'owl-nav',
12623		navClass: [
12624			'owl-prev',
12625			'owl-next'
12626		],
12627		slideBy: 1,
12628		dotClass: 'owl-dot',
12629		dotsClass: 'owl-dots',
12630		dots: true,
12631		dotsEach: false,
12632		dotsData: false,
12633		dotsSpeed: false,
12634		dotsContainer: false
12635	};
12636
12637	/**
12638	 * Initializes the layout of the plugin and extends the carousel.
12639	 * @protected
12640	 */
12641	Navigation.prototype.initialize = function() {
12642		var override,
12643			settings = this._core.settings;
12644
12645		// create DOM structure for relative navigation
12646		this._controls.$relative = (settings.navContainer ? $(settings.navContainer)
12647			: $('<div>').addClass(settings.navContainerClass).appendTo(this.$element)).addClass('disabled');
12648
12649		this._controls.$previous = $('<' + settings.navElement + '>')
12650			.addClass(settings.navClass[0])
vendor: 4,756 bytes, lines 12651-12812
12651			.html(settings.navText[0])
12652			.prependTo(this._controls.$relative)
12653			.on('click', $.proxy(function(e) {
12654				this.prev(settings.navSpeed);
12655			}, this));
12656		this._controls.$next = $('<' + settings.navElement + '>')
12657			.addClass(settings.navClass[1])
12658			.html(settings.navText[1])
12659			.appendTo(this._controls.$relative)
12660			.on('click', $.proxy(function(e) {
12661				this.next(settings.navSpeed);
12662			}, this));
12663
12664		// create DOM structure for absolute navigation
12665		if (!settings.dotsData) {
12666			this._templates = [ $('<button role="button">')
12667				.addClass(settings.dotClass)
12668				.append($('<span>'))
12669				.prop('outerHTML') ];
12670		}
12671
12672		this._controls.$absolute = (settings.dotsContainer ? $(settings.dotsContainer)
12673			: $('<div>').addClass(settings.dotsClass).appendTo(this.$element)).addClass('disabled');
12674
12675		this._controls.$absolute.on('click', 'button', $.proxy(function(e) {
12676			var index = $(e.target).parent().is(this._controls.$absolute)
12677				? $(e.target).index() : $(e.target).parent().index();
12678
12679			e.preventDefault();
12680
12681			this.to(index, settings.dotsSpeed);
12682		}, this));
12683
12684		/*$el.on('focusin', function() {
12685			$(document).off(".carousel");
12686
12687			$(document).on('keydown.carousel', function(e) {
12688				if(e.keyCode == 37) {
12689					$el.trigger('prev.owl')
12690				}
12691				if(e.keyCode == 39) {
12692					$el.trigger('next.owl')
12693				}
12694			});
12695		});*/
12696
12697		// override public methods of the carousel
12698		for (override in this._overrides) {
12699			this._core[override] = $.proxy(this[override], this);
12700		}
12701	};
12702
12703	/**
12704	 * Destroys the plugin.
12705	 * @protected
12706	 */
12707	Navigation.prototype.destroy = function() {
12708		var handler, control, property, override, settings;
12709		settings = this._core.settings;
12710
12711		for (handler in this._handlers) {
12712			this.$element.off(handler, this._handlers[handler]);
12713		}
12714		for (control in this._controls) {
12715			if (control === '$relative' && settings.navContainer) {
12716				this._controls[control].html('');
12717			} else {
12718				this._controls[control].remove();
12719			}
12720		}
12721		for (override in this.overides) {
12722			this._core[override] = this._overrides[override];
12723		}
12724		for (property in Object.getOwnPropertyNames(this)) {
12725			typeof this[property] != 'function' && (this[property] = null);
12726		}
12727	};
12728
12729	/**
12730	 * Updates the internal state.
12731	 * @protected
12732	 */
12733	Navigation.prototype.update = function() {
12734		var i, j, k,
12735			lower = this._core.clones().length / 2,
12736			upper = lower + this._core.items().length,
12737			maximum = this._core.maximum(true),
12738			settings = this._core.settings,
12739			size = settings.center || settings.autoWidth || settings.dotsData
12740				? 1 : settings.dotsEach || settings.items;
12741
12742		if (settings.slideBy !== 'page') {
12743			settings.slideBy = Math.min(settings.slideBy, settings.items);
12744		}
12745
12746		if (settings.dots || settings.slideBy == 'page') {
12747			this._pages = [];
12748
12749			for (i = lower, j = 0, k = 0; i < upper; i++) {
12750				if (j >= size || j === 0) {
12751					this._pages.push({
12752						start: Math.min(maximum, i - lower),
12753						end: i - lower + size - 1
12754					});
12755					if (Math.min(maximum, i - lower) === maximum) {
12756						break;
12757					}
12758					j = 0, ++k;
12759				}
12760				j += this._core.mergers(this._core.relative(i));
12761			}
12762		}
12763	};
12764
12765	/**
12766	 * Draws the user interface.
12767	 * @todo The option `dotsData` wont work.
12768	 * @protected
12769	 */
12770	Navigation.prototype.draw = function() {
12771		var difference,
12772			settings = this._core.settings,
12773			disabled = this._core.items().length <= settings.items,
12774			index = this._core.relative(this._core.current()),
12775			loop = settings.loop || settings.rewind;
12776
12777		this._controls.$relative.toggleClass('disabled', !settings.nav || disabled);
12778
12779		if (settings.nav) {
12780			this._controls.$previous.toggleClass('disabled', !loop && index <= this._core.minimum(true));
12781			this._controls.$next.toggleClass('disabled', !loop && index >= this._core.maximum(true));
12782		}
12783
12784		this._controls.$absolute.toggleClass('disabled', !settings.dots || disabled);
12785
12786		if (settings.dots) {
12787			difference = this._pages.length - this._controls.$absolute.children().length;
12788
12789			if (settings.dotsData && difference !== 0) {
12790				this._controls.$absolute.html(this._templates.join(''));
12791			} else if (difference > 0) {
12792				this._controls.$absolute.append(new Array(difference + 1).join(this._templates[0]));
12793			} else if (difference < 0) {
12794				this._controls.$absolute.children().slice(difference).remove();
12795			}
12796
12797			this._controls.$absolute.find('.active').removeClass('active');
12798			this._controls.$absolute.children().eq($.inArray(this.current(), this._pages)).addClass('active');
12799		}
12800	};
12801
12802	/**
12803	 * Extends event data.
12804	 * @protected
12805	 * @param {Event} event - The event object which gets thrown.
12806	 */
12807	Navigation.prototype.onTrigger = function(event) {
12808		var settings = this._core.settings;
12809
12810		event.page = {
12811			index: $.inArray(this.current(), this._pages),
12812			count: this._pages.length,
vendor: 7,284 bytes, lines 12813-13098
12813			size: settings && (settings.center || settings.autoWidth || settings.dotsData
12814				? 1 : settings.dotsEach || settings.items)
12815		};
12816	};
12817
12818	/**
12819	 * Gets the current page position of the carousel.
12820	 * @protected
12821	 * @returns {Number}
12822	 */
12823	Navigation.prototype.current = function() {
12824		var current = this._core.relative(this._core.current());
12825		return $.grep(this._pages, $.proxy(function(page, index) {
12826			return page.start <= current && page.end >= current;
12827		}, this)).pop();
12828	};
12829
12830	/**
12831	 * Gets the current succesor/predecessor position.
12832	 * @protected
12833	 * @returns {Number}
12834	 */
12835	Navigation.prototype.getPosition = function(successor) {
12836		var position, length,
12837			settings = this._core.settings;
12838
12839		if (settings.slideBy == 'page') {
12840			position = $.inArray(this.current(), this._pages);
12841			length = this._pages.length;
12842			successor ? ++position : --position;
12843			position = this._pages[((position % length) + length) % length].start;
12844		} else {
12845			position = this._core.relative(this._core.current());
12846			length = this._core.items().length;
12847			successor ? position += settings.slideBy : position -= settings.slideBy;
12848		}
12849
12850		return position;
12851	};
12852
12853	/**
12854	 * Slides to the next item or page.
12855	 * @public
12856	 * @param {Number} [speed=false] - The time in milliseconds for the transition.
12857	 */
12858	Navigation.prototype.next = function(speed) {
12859		$.proxy(this._overrides.to, this._core)(this.getPosition(true), speed);
12860	};
12861
12862	/**
12863	 * Slides to the previous item or page.
12864	 * @public
12865	 * @param {Number} [speed=false] - The time in milliseconds for the transition.
12866	 */
12867	Navigation.prototype.prev = function(speed) {
12868		$.proxy(this._overrides.to, this._core)(this.getPosition(false), speed);
12869	};
12870
12871	/**
12872	 * Slides to the specified item or page.
12873	 * @public
12874	 * @param {Number} position - The position of the item or page.
12875	 * @param {Number} [speed] - The time in milliseconds for the transition.
12876	 * @param {Boolean} [standard=false] - Whether to use the standard behaviour or not.
12877	 */
12878	Navigation.prototype.to = function(position, speed, standard) {
12879		var length;
12880
12881		if (!standard && this._pages.length) {
12882			length = this._pages.length;
12883			$.proxy(this._overrides.to, this._core)(this._pages[((position % length) + length) % length].start, speed);
12884		} else {
12885			$.proxy(this._overrides.to, this._core)(position, speed);
12886		}
12887	};
12888
12889	$.fn.owlCarousel.Constructor.Plugins.Navigation = Navigation;
12890
12891})(window.Zepto || window.jQuery, window, document);
12892
12893/**
12894 * Hash Plugin
12895 * @version 2.3.4
12896 * @author Artus Kolanowski
12897 * @author David Deutsch
12898 * @license The MIT License (MIT)
12899 */
12900;(function($, window, document, undefined) {
12901	'use strict';
12902
12903	/**
12904	 * Creates the hash plugin.
12905	 * @class The Hash Plugin
12906	 * @param {Owl} carousel - The Owl Carousel
12907	 */
12908	var Hash = function(carousel) {
12909		/**
12910		 * Reference to the core.
12911		 * @protected
12912		 * @type {Owl}
12913		 */
12914		this._core = carousel;
12915
12916		/**
12917		 * Hash index for the items.
12918		 * @protected
12919		 * @type {Object}
12920		 */
12921		this._hashes = {};
12922
12923		/**
12924		 * The carousel element.
12925		 * @type {jQuery}
12926		 */
12927		this.$element = this._core.$element;
12928
12929		/**
12930		 * All event handlers.
12931		 * @protected
12932		 * @type {Object}
12933		 */
12934		this._handlers = {
12935			'initialized.owl.carousel': $.proxy(function(e) {
12936				if (e.namespace && this._core.settings.startPosition === 'URLHash') {
12937					$(window).trigger('hashchange.owl.navigation');
12938				}
12939			}, this),
12940			'prepared.owl.carousel': $.proxy(function(e) {
12941				if (e.namespace) {
12942					var hash = $(e.content).find('[data-hash]').addBack('[data-hash]').attr('data-hash');
12943
12944					if (!hash) {
12945						return;
12946					}
12947
12948					this._hashes[hash] = e.content;
12949				}
12950			}, this),
12951			'changed.owl.carousel': $.proxy(function(e) {
12952				if (e.namespace && e.property.name === 'position') {
12953					var current = this._core.items(this._core.relative(this._core.current())),
12954						hash = $.map(this._hashes, function(item, hash) {
12955							return item === current ? hash : null;
12956						}).join();
12957
12958					if (!hash || window.location.hash.slice(1) === hash) {
12959						return;
12960					}
12961
12962					window.location.hash = hash;
12963				}
12964			}, this)
12965		};
12966
12967		// set default options
12968		this._core.options = $.extend({}, Hash.Defaults, this._core.options);
12969
12970		// register the event handlers
12971		this.$element.on(this._handlers);
12972
12973		// register event listener for hash navigation
12974		$(window).on('hashchange.owl.navigation', $.proxy(function(e) {
12975			var hash = window.location.hash.substring(1),
12976				items = this._core.$stage.children(),
12977				position = this._hashes[hash] && items.index(this._hashes[hash]);
12978
12979			if (position === undefined || position === this._core.current()) {
12980				return;
12981			}
12982
12983			this._core.to(this._core.relative(position), false, true);
12984		}, this));
12985	};
12986
12987	/**
12988	 * Default options.
12989	 * @public
12990	 */
12991	Hash.Defaults = {
12992		URLhashListener: false
12993	};
12994
12995	/**
12996	 * Destroys the plugin.
12997	 * @public
12998	 */
12999	Hash.prototype.destroy = function() {
13000		var handler, property;
13001
13002		$(window).off('hashchange.owl.navigation');
13003
13004		for (handler in this._handlers) {
13005			this._core.$element.off(handler, this._handlers[handler]);
13006		}
13007		for (property in Object.getOwnPropertyNames(this)) {
13008			typeof this[property] != 'function' && (this[property] = null);
13009		}
13010	};
13011
13012	$.fn.owlCarousel.Constructor.Plugins.Hash = Hash;
13013
13014})(window.Zepto || window.jQuery, window, document);
13015
13016/**
13017 * Support Plugin
13018 *
13019 * @version 2.3.4
13020 * @author Vivid Planet Software GmbH
13021 * @author Artus Kolanowski
13022 * @author David Deutsch
13023 * @license The MIT License (MIT)
13024 */
13025;(function($, window, document, undefined) {
13026
13027	var style = $('<support>').get(0).style,
13028		prefixes = 'Webkit Moz O ms'.split(' '),
13029		events = {
13030			transition: {
13031				end: {
13032					WebkitTransition: 'webkitTransitionEnd',
13033					MozTransition: 'transitionend',
13034					OTransition: 'oTransitionEnd',
13035					transition: 'transitionend'
13036				}
13037			},
13038			animation: {
13039				end: {
13040					WebkitAnimation: 'webkitAnimationEnd',
13041					MozAnimation: 'animationend',
13042					OAnimation: 'oAnimationEnd',
13043					animation: 'animationend'
13044				}
13045			}
13046		},
13047		tests = {
13048			csstransforms: function() {
13049				return !!test('transform');
13050			},
13051			csstransforms3d: function() {
13052				return !!test('perspective');
13053			},
13054			csstransitions: function() {
13055				return !!test('transition');
13056			},
13057			cssanimations: function() {
13058				return !!test('animation');
13059			}
13060		};
13061
13062	function test(property, prefixed) {
13063		var result = false,
13064			upper = property.charAt(0).toUpperCase() + property.slice(1);
13065
13066		$.each((property + ' ' + prefixes.join(upper + ' ') + upper).split(' '), function(i, property) {
13067			if (style[property] !== undefined) {
13068				result = prefixed ? property : true;
13069				return false;
13070			}
13071		});
13072
13073		return result;
13074	}
13075
13076	function prefixed(property) {
13077		return test(property, true);
13078	}
13079
13080	if (tests.csstransitions()) {
13081		/* jshint -W053 */
13082		$.support.transition = new String(prefixed('transition'))
13083		$.support.transition.end = events.transition.end[ $.support.transition ];
13084	}
13085
13086	if (tests.cssanimations()) {
13087		/* jshint -W053 */
13088		$.support.animation = new String(prefixed('animation'))
13089		$.support.animation.end = events.animation.end[ $.support.animation ];
13090	}
13091
13092	if (tests.csstransforms()) {
13093		/* jshint -W053 */
13094		$.support.transform = new String(prefixed('transform'));
13095		$.support.transform3d = tests.csstransforms3d();
13096	}
13097
13098})(window.Zepto || window.jQuery, window, document);
13099
13100/* End */
13101;
13102; /* Start:"a:4:{s:4:"full";s:67:"/bitrix/templates/aspro_max/vendor/js/moment.min.js?171646553734436";s:6:"source";s:51:"/bitrix/templates/aspro_max/vendor/js/moment.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
13103//! moment.js
13104//! version : 2.10.3
13105//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
13106//! license : MIT
13107//! momentjs.com
13108!function(a,b){"object"==typeof exports&&"undefined"!=typeof module?module.exports=b():"function"==typeof define&&define.amd?define(b):a.moment=b()}(this,function(){"use strict";function a(){return Dc.apply(null,arguments)}function b(a){Dc=a}function c(a){return"[object Array]"===Object.prototype.toString.call(a)}function d(a){return a instanceof Date||"[object Date]"===Object.prototype.toString.call(a)}function e(a,b){var c,d=[];for(c=0;c<a.length;++c)d.push(b(a[c],c));return d}function f(a,b){return Object.prototype.hasOwnProperty.call(a,b)}function g(a,b){for(var c in b)f(b,c)&&(a[c]=b[c]);return f(b,"toString")&&(a.toString=b.toString),f(b,"valueOf")&&(a.valueOf=b.valueOf),a}function h(a,b,c,d){return za(a,b,c,d,!0).utc()}function i(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1}}function j(a){return null==a._pf&&(a._pf=i()),a._pf}function k(a){if(null==a._isValid){var b=j(a);a._isValid=!isNaN(a._d.getTime())&&b.overflow<0&&!b.empty&&!b.invalidMonth&&!b.nullInput&&!b.invalidFormat&&!b.userInvalidated,a._strict&&(a._isValid=a._isValid&&0===b.charsLeftOver&&0===b.unusedTokens.length&&void 0===b.bigHour)}return a._isValid}function l(a){var b=h(0/0);return null!=a?g(j(b),a):j(b).userInvalidated=!0,b}function m(a,b){var c,d,e;if("undefined"!=typeof b._isAMomentObject&&(a._isAMomentObject=b._isAMomentObject),"undefined"!=typeof b._i&&(a._i=b._i),"undefined"!=typeof b._f&&(a._f=b._f),"undefined"!=typeof b._l&&(a._l=b._l),"undefined"!=typeof b._strict&&(a._strict=b._strict),"undefined"!=typeof b._tzm&&(a._tzm=b._tzm),"undefined"!=typeof b._isUTC&&(a._isUTC=b._isUTC),"undefined"!=typeof b._offset&&(a._offset=b._offset),"undefined"!=typeof b._pf&&(a._pf=j(b)),"undefined"!=typeof b._locale&&(a._locale=b._locale),Fc.length>0)for(c in Fc)d=Fc[c],e=b[d],"undefined"!=typeof e&&(a[d]=e);return a}function n(b){m(this,b),this._d=new Date(+b._d),Gc===!1&&(Gc=!0,a.updateOffset(this),Gc=!1)}function o(a){return a instanceof n||null!=a&&null!=a._isAMomentObject}function p(a){var b=+a,c=0;return 0!==b&&isFinite(b)&&(c=b>=0?Math.floor(b):Math.ceil(b)),c}function q(a,b,c){var d,e=Math.min(a.length,b.length),f=Math.abs(a.length-b.length),g=0;for(d=0;e>d;d++)(c&&a[d]!==b[d]||!c&&p(a[d])!==p(b[d]))&&g++;return g+f}function r(){}function s(a){return a?a.toLowerCase().replace("_","-"):a}function t(a){for(var b,c,d,e,f=0;f<a.length;){for(e=s(a[f]).split("-"),b=e.length,c=s(a[f+1]),c=c?c.split("-"):null;b>0;){if(d=u(e.slice(0,b).join("-")))return d;if(c&&c.length>=b&&q(e,c,!0)>=b-1)break;b--}f++}return null}function u(a){var b=null;if(!Hc[a]&&"undefined"!=typeof module&&module&&module.exports)try{b=Ec._abbr,require("./locale/"+a),v(b)}catch(c){}return Hc[a]}function v(a,b){var c;return a&&(c="undefined"==typeof b?x(a):w(a,b),c&&(Ec=c)),Ec._abbr}function w(a,b){return null!==b?(b.abbr=a,Hc[a]||(Hc[a]=new r),Hc[a].set(b),v(a),Hc[a]):(delete Hc[a],null)}function x(a){var b;if(a&&a._locale&&a._locale._abbr&&(a=a._locale._abbr),!a)return Ec;if(!c(a)){if(b=u(a))return b;a=[a]}return t(a)}function y(a,b){var c=a.toLowerCase();Ic[c]=Ic[c+"s"]=Ic[b]=a}function z(a){return"string"==typeof a?Ic[a]||Ic[a.toLowerCase()]:void 0}function A(a){var b,c,d={};for(c in a)f(a,c)&&(b=z(c),b&&(d[b]=a[c]));return d}function B(b,c){return function(d){return null!=d?(D(this,b,d),a.updateOffset(this,c),this):C(this,b)}}function C(a,b){return a._d["get"+(a._isUTC?"UTC":"")+b]()}function D(a,b,c){return a._d["set"+(a._isUTC?"UTC":"")+b](c)}function E(a,b){var c;if("object"==typeof a)for(c in a)this.set(c,a[c]);else if(a=z(a),"function"==typeof this[a])return this[a](b);return this}function F(a,b,c){for(var d=""+Math.abs(a),e=a>=0;d.length<b;)d="0"+d;return(e?c?"+":"":"-")+d}function G(a,b,c,d){var e=d;"string"==typeof d&&(e=function(){return this[d]()}),a&&(Mc[a]=e),b&&(Mc[b[0]]=function(){return F(e.apply(this,arguments),b[1],b[2])}),c&&(Mc[c]=function(){return this.localeData().ordinal(e.apply(this,arguments),a)})}function H(a){return a.match(/\[[\s\S]/)?a.replace(/^\[|\]$/g,""):a.replace(/\\/g,"")}function I(a){var b,c,d=a.match(Jc);for(b=0,c=d.length;c>b;b++)Mc[d[b]]?d[b]=Mc[d[b]]:d[b]=H(d[b]);return function(e){var f="";for(b=0;c>b;b++)f+=d[b]instanceof Function?d[b].call(e,a):d[b];return f}}function J(a,b){return a.isValid()?(b=K(b,a.localeData()),Lc[b]||(Lc[b]=I(b)),Lc[b](a)):a.localeData().invalidDate()}function K(a,b){function c(a){return b.longDateFormat(a)||a}var d=5;for(Kc.lastIndex=0;d>=0&&Kc.test(a);)a=a.replace(Kc,c),Kc.lastIndex=0,d-=1;return a}function L(a,b,c){_c[a]="function"==typeof b?b:function(a){return a&&c?c:b}}function M(a,b){return f(_c,a)?_c[a](b._strict,b._locale):new RegExp(N(a))}function N(a){return a.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(a,b,c,d,e){return b||c||d||e}).replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function O(a,b){var c,d=b;
13108for("string"==typeof a&&(a=[a]),"number"==typeof b&&(d=function(a,c){c[b]=p(a)}),c=0;c<a.length;c++)ad[a[c]]=d}function P(a,b){O(a,function(a,c,d,e){d._w=d._w||{},b(a,d._w,d,e)})}function Q(a,b,c){null!=b&&f(ad,a)&&ad[a](b,c._a,c,a)}function R(a,b){return new Date(Date.UTC(a,b+1,0)).getUTCDate()}function S(a){return this._months[a.month()]}function T(a){return this._monthsShort[a.month()]}function U(a,b,c){var d,e,f;for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),d=0;12>d;d++){if(e=h([2e3,d]),c&&!this._longMonthsParse[d]&&(this._longMonthsParse[d]=new RegExp("^"+this.months(e,"").replace(".","")+"$","i"),this._shortMonthsParse[d]=new RegExp("^"+this.monthsShort(e,"").replace(".","")+"$","i")),c||this._monthsParse[d]||(f="^"+this.months(e,"")+"|^"+this.monthsShort(e,""),this._monthsParse[d]=new RegExp(f.replace(".",""),"i")),c&&"MMMM"===b&&this._longMonthsParse[d].test(a))return d;if(c&&"MMM"===b&&this._shortMonthsParse[d].test(a))return d;if(!c&&this._monthsParse[d].test(a))return d}}function V(a,b){var c;return"string"==typeof b&&(b=a.localeData().monthsParse(b),"number"!=typeof b)?a:(c=Math.min(a.date(),R(a.year(),b)),a._d["set"+(a._isUTC?"UTC":"")+"Month"](b,c),a)}function W(b){return null!=b?(V(this,b),a.updateOffset(this,!0),this):C(this,"Month")}function X(){return R(this.year(),this.month())}function Y(a){var b,c=a._a;return c&&-2===j(a).overflow&&(b=c[cd]<0||c[cd]>11?cd:c[dd]<1||c[dd]>R(c[bd],c[cd])?dd:c[ed]<0||c[ed]>24||24===c[ed]&&(0!==c[fd]||0!==c[gd]||0!==c[hd])?ed:c[fd]<0||c[fd]>59?fd:c[gd]<0||c[gd]>59?gd:c[hd]<0||c[hd]>999?hd:-1,j(a)._overflowDayOfYear&&(bd>b||b>dd)&&(b=dd),j(a).overflow=b),a}function Z(b){a.suppressDeprecationWarnings===!1&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+b)}function $(a,b){var c=!0,d=a+"\n"+(new Error).stack;return g(function(){return c&&(Z(d),c=!1),b.apply(this,arguments)},b)}function _(a,b){kd[a]||(Z(b),kd[a]=!0)}function aa(a){var b,c,d=a._i,e=ld.exec(d);if(e){for(j(a).iso=!0,b=0,c=md.length;c>b;b++)if(md[b][1].exec(d)){a._f=md[b][0]+(e[6]||" ");break}for(b=0,c=nd.length;c>b;b++)if(nd[b][1].exec(d)){a._f+=nd[b][0];break}d.match(Yc)&&(a._f+="Z"),ta(a)}else a._isValid=!1}function ba(b){var c=od.exec(b._i);return null!==c?void(b._d=new Date(+c[1])):(aa(b),void(b._isValid===!1&&(delete b._isValid,a.createFromInputFallback(b))))}function ca(a,b,c,d,e,f,g){var h=new Date(a,b,c,d,e,f,g);return 1970>a&&h.setFullYear(a),h}function da(a){var b=new Date(Date.UTC.apply(null,arguments));return 1970>a&&b.setUTCFullYear(a),b}function ea(a){return fa(a)?366:365}function fa(a){return a%4===0&&a%100!==0||a%400===0}function ga(){return fa(this.year())}function ha(a,b,c){var d,e=c-b,f=c-a.day();return f>e&&(f-=7),e-7>f&&(f+=7),d=Aa(a).add(f,"d"),{week:Math.ceil(d.dayOfYear()/7),year:d.year()}}function ia(a){return ha(a,this._week.dow,this._week.doy).week}function ja(){return this._week.dow}function ka(){return this._week.doy}function la(a){var b=this.localeData().week(this);return null==a?b:this.add(7*(a-b),"d")}function ma(a){var b=ha(this,1,4).week;return null==a?b:this.add(7*(a-b),"d")}function na(a,b,c,d,e){var f,g,h=da(a,0,1).getUTCDay();return h=0===h?7:h,c=null!=c?c:e,f=e-h+(h>d?7:0)-(e>h?7:0),g=7*(b-1)+(c-e)+f+1,{year:g>0?a:a-1,dayOfYear:g>0?g:ea(a-1)+g}}function oa(a){var b=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==a?b:this.add(a-b,"d")}function pa(a,b,c){return null!=a?a:null!=b?b:c}function qa(a){var b=new Date;return a._useUTC?[b.getUTCFullYear(),b.getUTCMonth(),b.getUTCDate()]:[b.getFullYear(),b.getMonth(),b.getDate()]}function ra(a){var b,c,d,e,f=[];if(!a._d){for(d=qa(a),a._w&&null==a._a[dd]&&null==a._a[cd]&&sa(a),a._dayOfYear&&(e=pa(a._a[bd],d[bd]),a._dayOfYear>ea(e)&&(j(a)._overflowDayOfYear=!0),c=da(e,0,a._dayOfYear),a._a[cd]=c.getUTCMonth(),a._a[dd]=c.getUTCDate()),b=0;3>b&&null==a._a[b];++b)a._a[b]=f[b]=d[b];for(;7>b;b++)a._a[b]=f[b]=null==a._a[b]?2===b?1:0:a._a[b];24===a._a[ed]&&0===a._a[fd]&&0===a._a[gd]&&0===a._a[hd]&&(a._nextDay=!0,a._a[ed]=0),a._d=(a._useUTC?da:ca).apply(null,f),null!=a._tzm&&a._d.setUTCMinutes(a._d.getUTCMinutes()-a._tzm),a._nextDay&&(a._a[ed]=24)}}function sa(a){var b,c,d,e,f,g,h;b=a._w,null!=b.GG||null!=b.W||null!=b.E?(f=1,g=4,c=pa(b.GG,a._a[bd],ha(Aa(),1,4).year),d=pa(b.W,1),e=pa(b.E,1)):(f=a._locale._week.dow,g=
vendor: 5,451 bytes, line 13108
13108a._locale._week.doy,c=pa(b.gg,a._a[bd],ha(Aa(),f,g).year),d=pa(b.w,1),null!=b.d?(e=b.d,f>e&&++d):e=null!=b.e?b.e+f:f),h=na(c,d,e,g,f),a._a[bd]=h.year,a._dayOfYear=h.dayOfYear}function ta(b){if(b._f===a.ISO_8601)return void aa(b);b._a=[],j(b).empty=!0;var c,d,e,f,g,h=""+b._i,i=h.length,k=0;for(e=K(b._f,b._locale).match(Jc)||[],c=0;c<e.length;c++)f=e[c],d=(h.match(M(f,b))||[])[0],d&&(g=h.substr(0,h.indexOf(d)),g.length>0&&j(b).unusedInput.push(g),h=h.slice(h.indexOf(d)+d.length),k+=d.length),Mc[f]?(d?j(b).empty=!1:j(b).unusedTokens.push(f),Q(f,d,b)):b._strict&&!d&&j(b).unusedTokens.push(f);j(b).charsLeftOver=i-k,h.length>0&&j(b).unusedInput.push(h),j(b).bigHour===!0&&b._a[ed]<=12&&b._a[ed]>0&&(j(b).bigHour=void 0),b._a[ed]=ua(b._locale,b._a[ed],b._meridiem),ra(b),Y(b)}function ua(a,b,c){var d;return null==c?b:null!=a.meridiemHour?a.meridiemHour(b,c):null!=a.isPM?(d=a.isPM(c),d&&12>b&&(b+=12),d||12!==b||(b=0),b):b}function va(a){var b,c,d,e,f;if(0===a._f.length)return j(a).invalidFormat=!0,void(a._d=new Date(0/0));for(e=0;e<a._f.length;e++)f=0,b=m({},a),null!=a._useUTC&&(b._useUTC=a._useUTC),b._f=a._f[e],ta(b),k(b)&&(f+=j(b).charsLeftOver,f+=10*j(b).unusedTokens.length,j(b).score=f,(null==d||d>f)&&(d=f,c=b));g(a,c||b)}function wa(a){if(!a._d){var b=A(a._i);a._a=[b.year,b.month,b.day||b.date,b.hour,b.minute,b.second,b.millisecond],ra(a)}}function xa(a){var b,e=a._i,f=a._f;return a._locale=a._locale||x(a._l),null===e||void 0===f&&""===e?l({nullInput:!0}):("string"==typeof e&&(a._i=e=a._locale.preparse(e)),o(e)?new n(Y(e)):(c(f)?va(a):f?ta(a):d(e)?a._d=e:ya(a),b=new n(Y(a)),b._nextDay&&(b.add(1,"d"),b._nextDay=void 0),b))}function ya(b){var f=b._i;void 0===f?b._d=new Date:d(f)?b._d=new Date(+f):"string"==typeof f?ba(b):c(f)?(b._a=e(f.slice(0),function(a){return parseInt(a,10)}),ra(b)):"object"==typeof f?wa(b):"number"==typeof f?b._d=new Date(f):a.createFromInputFallback(b)}function za(a,b,c,d,e){var f={};return"boolean"==typeof c&&(d=c,c=void 0),f._isAMomentObject=!0,f._useUTC=f._isUTC=e,f._l=c,f._i=a,f._f=b,f._strict=d,xa(f)}function Aa(a,b,c,d){return za(a,b,c,d,!1)}function Ba(a,b){var d,e;if(1===b.length&&c(b[0])&&(b=b[0]),!b.length)return Aa();for(d=b[0],e=1;e<b.length;++e)b[e][a](d)&&(d=b[e]);return d}function Ca(){var a=[].slice.call(arguments,0);return Ba("isBefore",a)}function Da(){var a=[].slice.call(arguments,0);return Ba("isAfter",a)}function Ea(a){var b=A(a),c=b.year||0,d=b.quarter||0,e=b.month||0,f=b.week||0,g=b.day||0,h=b.hour||0,i=b.minute||0,j=b.second||0,k=b.millisecond||0;this._milliseconds=+k+1e3*j+6e4*i+36e5*h,this._days=+g+7*f,this._months=+e+3*d+12*c,this._data={},this._locale=x(),this._bubble()}function Fa(a){return a instanceof Ea}function Ga(a,b){G(a,0,0,function(){var a=this.utcOffset(),c="+";return 0>a&&(a=-a,c="-"),c+F(~~(a/60),2)+b+F(~~a%60,2)})}function Ha(a){var b=(a||"").match(Yc)||[],c=b[b.length-1]||[],d=(c+"").match(td)||["-",0,0],e=+(60*d[1])+p(d[2]);return"+"===d[0]?e:-e}function Ia(b,c){var e,f;return c._isUTC?(e=c.clone(),f=(o(b)||d(b)?+b:+Aa(b))-+e,e._d.setTime(+e._d+f),a.updateOffset(e,!1),e):Aa(b).local();return c._isUTC?Aa(b).zone(c._offset||0):Aa(b).local()}function Ja(a){return 15*-Math.round(a._d.getTimezoneOffset()/15)}function Ka(b,c){var d,e=this._offset||0;return null!=b?("string"==typeof b&&(b=Ha(b)),Math.abs(b)<16&&(b=60*b),!this._isUTC&&c&&(d=Ja(this)),this._offset=b,this._isUTC=!0,null!=d&&this.add(d,"m"),e!==b&&(!c||this._changeInProgress?$a(this,Va(b-e,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,a.updateOffset(this,!0),this._changeInProgress=null)),this):this._isUTC?e:Ja(this)}function La(a,b){return null!=a?("string"!=typeof a&&(a=-a),this.utcOffset(a,b),this):-this.utcOffset()}function Ma(a){return this.utcOffset(0,a)}function Na(a){return this._isUTC&&(this.utcOffset(0,a),this._isUTC=!1,a&&this.subtract(Ja(this),"m")),this}function Oa(){return this._tzm?this.utcOffset(this._tzm):"string"==typeof this._i&&this.utcOffset(Ha(this._i)),this}function Pa(a){return a=a?Aa(a).utcOffset():0,(this.utcOffset()-a)%60===0}function Qa(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function Ra(){if(this._a){var a=this._isUTC?h(this._a):Aa(this._a);return this.isValid()&&q(this._a,a.toArray())>0}return!1}function Sa(){return!this._isUTC}function Ta(){return this._isUTC}function Ua(){return this._isUTC&&0===this._offset}function Va(a,b){var c,d,e,g=a,h=null;return Fa(a)?g={ms:a._milliseconds,d:a._days,M:a._months}:"number"==typeof a?(g={},b?g[b]=a:g.milliseconds=a):(h=ud.exec(a))?(c="-"===h[1]?-1:1,g={y:0,d:p(h[dd])*c,h:p(h[ed])*c,m:p(h[fd])*c,s:p(h[gd])*c,ms:p(h[hd])*c}):(h=vd.exec(a))?(c="-"===h[1]?-1:1,g={y:Wa(h[2],c),M:Wa(h[3],c),d:Wa(h[4],c),h:Wa(h[5],c),m:Wa(h[6],c),s:Wa(h[7],c),w:Wa(h[8],c)}):null==g?g={}:"object"==typeof g&&("from"in g||"to"in g)&&(e=Ya(Aa(g.from),Aa(g.to)),g={},g.ms=e.milliseconds,g.M=e.months),d=new Ea(g),Fa(a)&&f(a,"_locale")&&(d._locale=a._locale),d}function Wa(a,b){var c=a&&parseFloat(a.replace(",","."));return(isNaN(c)?0:c)*b}function Xa(a,b){var c={milliseconds:0,months:0};return c.months=b.month()-a.month()+12*(b.year()-a.year()),a.clone().add(c.months,"M").isAfter(b)&&--c.months,c.milliseconds=+b-+a.clone().add(c.months,"M"),c}function Ya(a,b){var c;return b=Ia(b,a),a.isBefore(b)?c=Xa(a,b):(c=Xa(b,a),c.milliseconds=-c.milliseconds,c.months=-c.months),c}function Za(a,b){return function(c,d){var e,f;
13108return null===d||isNaN(+d)||(_(b,"moment()."+b+"(period, number) is deprecated. Please use moment()."+b+"(number, period)."),f=c,c=d,d=f),c="string"==typeof c?+c:c,e=Va(c,d),$a(this,e,a),this}}function $a(b,c,d,e){var f=c._milliseconds,g=c._days,h=c._months;e=null==e?!0:e,f&&b._d.setTime(+b._d+f*d),g&&D(b,"Date",C(b,"Date")+g*d),h&&V(b,C(b,"Month")+h*d),e&&a.updateOffset(b,g||h)}function _a(a){var b=a||Aa(),c=Ia(b,this).startOf("day"),d=this.diff(c,"days",!0),e=-6>d?"sameElse":-1>d?"lastWeek":0>d?"lastDay":1>d?"sameDay":2>d?"nextDay":7>d?"nextWeek":"sameElse";return this.format(this.localeData().calendar(e,this,Aa(b)))}function ab(){return new n(this)}function bb(a,b){var c;return b=z("undefined"!=typeof b?b:"millisecond"),"millisecond"===b?(a=o(a)?a:Aa(a),+this>+a):(c=o(a)?+a:+Aa(a),c<+this.clone().startOf(b))}function cb(a,b){var c;return b=z("undefined"!=typeof b?b:"millisecond"),"millisecond"===b?(a=o(a)?a:Aa(a),+a>+this):(c=o(a)?+a:+Aa(a),+this.clone().endOf(b)<c)}function db(a,b,c){return this.isAfter(a,c)&&this.isBefore(b,c)}function eb(a,b){var c;return b=z(b||"millisecond"),"millisecond"===b?(a=o(a)?a:Aa(a),+this===+a):(c=+Aa(a),+this.clone().startOf(b)<=c&&c<=+this.clone().endOf(b))}function fb(a){return 0>a?Math.ceil(a):Math.floor(a)}function gb(a,b,c){var d,e,f=Ia(a,this),g=6e4*(f.utcOffset()-this.utcOffset());return b=z(b),"year"===b||"month"===b||"quarter"===b?(e=hb(this,f),"quarter"===b?e/=3:"year"===b&&(e/=12)):(d=this-f,e="second"===b?d/1e3:"minute"===b?d/6e4:"hour"===b?d/36e5:"day"===b?(d-g)/864e5:"week"===b?(d-g)/6048e5:d),c?e:fb(e)}function hb(a,b){var c,d,e=12*(b.year()-a.year())+(b.month()-a.month()),f=a.clone().add(e,"months");return 0>b-f?(c=a.clone().add(e-1,"months"),d=(b-f)/(f-c)):(c=a.clone().add(e+1,"months"),d=(b-f)/(c-f)),-(e+d)}function ib(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function jb(){var a=this.clone().utc();return 0<a.year()&&a.year()<=9999?"function"==typeof Date.prototype.toISOString?this.toDate().toISOString():J(a,"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]"):J(a,"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]")}function kb(b){var c=J(this,b||a.defaultFormat);return this.localeData().postformat(c)}function lb(a,b){return this.isValid()?Va({to:this,from:a}).locale(this.locale()).humanize(!b):this.localeData().invalidDate()}function mb(a){return this.from(Aa(),a)}function nb(a,b){return this.isValid()?Va({from:this,to:a}).locale(this.locale()).humanize(!b):this.localeData().invalidDate()}function ob(a){return this.to(Aa(),a)}function pb(a){var b;return void 0===a?this._locale._abbr:(b=x(a),null!=b&&(this._locale=b),this)}function qb(){return this._locale}function rb(a){switch(a=z(a)){case"year":this.month(0);case"quarter":case"month":this.date(1);case"week":case"isoWeek":case"day":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return"week"===a&&this.weekday(0),"isoWeek"===a&&this.isoWeekday(1),"quarter"===a&&this.month(3*Math.floor(this.month()/3)),this}function sb(a){return a=z(a),void 0===a||"millisecond"===a?this:this.startOf(a).add(1,"isoWeek"===a?"week":a).subtract(1,"ms")}function tb(){return+this._d-6e4*(this._offset||0)}function ub(){return Math.floor(+this/1e3)}function vb(){return this._offset?new Date(+this):this._d}function wb(){var a=this;return[a.year(),a.month(),a.date(),a.hour(),a.minute(),a.second(),a.millisecond()]}function xb(){return k(this)}function yb(){return g({},j(this))}function zb(){return j(this).overflow}function Ab(a,b){G(0,[a,a.length],0,b)}function Bb(a,b,c){return ha(Aa([a,11,31+b-c]),b,c).week}function Cb(a){var b=ha(this,this.localeData()._week.dow,this.localeData()._week.doy).year;return null==a?b:this.add(a-b,"y")}function Db(a){var b=ha(this,1,4).year;return null==a?b:this.add(a-b,"y")}function Eb(){return Bb(this.year(),1,4)}function Fb(){var a=this.localeData()._week;return Bb(this.year(),a.dow,a.doy)}function Gb(a){return null==a?Math.ceil((this.month()+1)/3):this.month(3*(a-1)+this.month()%3)}function Hb(a,b){if("string"==typeof a)if(isNaN(a)){if(a=b.weekdaysParse(a),"number"!=typeof a)return null}else a=parseInt(a,10);return a}function Ib(a){return this._weekdays[a.day()]}function Jb(a){return this._weekdaysShort[a.day()]}function Kb(a){return this._weekdaysMin[a.day()]}
13108function Lb(a){var b,c,d;for(this._weekdaysParse||(this._weekdaysParse=[]),b=0;7>b;b++)if(this._weekdaysParse[b]||(c=Aa([2e3,1]).day(b),d="^"+this.weekdays(c,"")+"|^"+this.weekdaysShort(c,"")+"|^"+this.weekdaysMin(c,""),this._weekdaysParse[b]=new RegExp(d.replace(".",""),"i")),this._weekdaysParse[b].test(a))return b}function Mb(a){var b=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=a?(a=Hb(a,this.localeData()),this.add(a-b,"d")):b}function Nb(a){var b=(this.day()+7-this.localeData()._week.dow)%7;return null==a?b:this.add(a-b,"d")}function Ob(a){return null==a?this.day()||7:this.day(this.day()%7?a:a-7)}function Pb(a,b){G(a,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),b)})}function Qb(a,b){return b._meridiemParse}function Rb(a){return"p"===(a+"").toLowerCase().charAt(0)}function Sb(a,b,c){return a>11?c?"pm":"PM":c?"am":"AM"}function Tb(a){G(0,[a,3],0,"millisecond")}function Ub(){return this._isUTC?"UTC":""}function Vb(){return this._isUTC?"Coordinated Universal Time":""}function Wb(a){return Aa(1e3*a)}function Xb(){return Aa.apply(null,arguments).parseZone()}function Yb(a,b,c){var d=this._calendar[a];return"function"==typeof d?d.call(b,c):d}function Zb(a){var b=this._longDateFormat[a];return!b&&this._longDateFormat[a.toUpperCase()]&&(b=this._longDateFormat[a.toUpperCase()].replace(/MMMM|MM|DD|dddd/g,function(a){return a.slice(1)}),this._longDateFormat[a]=b),b}function $b(){return this._invalidDate}function _b(a){return this._ordinal.replace("%d",a)}function ac(a){return a}function bc(a,b,c,d){var e=this._relativeTime[c];return"function"==typeof e?e(a,b,c,d):e.replace(/%d/i,a)}function cc(a,b){var c=this._relativeTime[a>0?"future":"past"];return"function"==typeof c?c(b):c.replace(/%s/i,b)}function dc(a){var b,c;for(c in a)b=a[c],"function"==typeof b?this[c]=b:this["_"+c]=b;this._ordinalParseLenient=new RegExp(this._ordinalParse.source+"|"+/\d{1,2}/.source)}function ec(a,b,c,d){var e=x(),f=h().set(d,b);return e[c](f,a)}function fc(a,b,c,d,e){if("number"==typeof a&&(b=a,a=void 0),a=a||"",null!=b)return ec(a,b,c,e);var f,g=[];for(f=0;d>f;f++)g[f]=ec(a,f,c,e);return g}function gc(a,b){return fc(a,b,"months",12,"month")}function hc(a,b){return fc(a,b,"monthsShort",12,"month")}function ic(a,b){return fc(a,b,"weekdays",7,"day")}function jc(a,b){return fc(a,b,"weekdaysShort",7,"day")}function kc(a,b){return fc(a,b,"weekdaysMin",7,"day")}function lc(){var a=this._data;return this._milliseconds=Rd(this._milliseconds),this._days=Rd(this._days),this._months=Rd(this._months),a.milliseconds=Rd(a.milliseconds),a.seconds=Rd(a.seconds),a.minutes=Rd(a.minutes),a.hours=Rd(a.hours),a.months=Rd(a.months),a.years=Rd(a.years),this}function mc(a,b,c,d){var e=Va(b,c);return a._milliseconds+=d*e._milliseconds,a._days+=d*e._days,a._months+=d*e._months,a._bubble()}function nc(a,b){return mc(this,a,b,1)}function oc(a,b){return mc(this,a,b,-1)}function pc(){var a,b,c,d=this._milliseconds,e=this._days,f=this._months,g=this._data,h=0;return g.milliseconds=d%1e3,a=fb(d/1e3),g.seconds=a%60,b=fb(a/60),g.minutes=b%60,c=fb(b/60),g.hours=c%24,e+=fb(c/24),h=fb(qc(e)),e-=fb(rc(h)),f+=fb(e/30),e%=30,h+=fb(f/12),f%=12,g.days=e,g.months=f,g.years=h,this}function qc(a){return 400*a/146097}function rc(a){return 146097*a/400}function sc(a){var b,c,d=this._milliseconds;if(a=z(a),"month"===a||"year"===a)return b=this._days+d/864e5,c=this._months+12*qc(b),"month"===a?c:c/12;switch(b=this._days+Math.round(rc(this._months/12)),a){case"week":return b/7+d/6048e5;case"day":return b+d/864e5;case"hour":return 24*b+d/36e5;case"minute":return 1440*b+d/6e4;case"second":return 86400*b+d/1e3;case"millisecond":return Math.floor(864e5*b)+d;default:throw new Error("Unknown unit "+a)}}function tc(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*p(this._months/12)}function uc(a){return function(){return this.as(a)}}function vc(a){return a=z(a),this[a+"s"]()}function wc(a){return function(){return this._data[a]}}function xc(){return fb(this.days()/7)}function yc(a,b,c,d,e){return e.relativeTime(b||1,!!c,a,d)}function zc(a,b,c){var d=Va(a).abs(),e=fe(d.as("s")),f=fe(d.as("m")),g=fe(d.as("h")),h=fe(d.as("d")),i=fe(d.as("M")),j=fe(d.as("y")),k=e<ge.s&&["s",e]||1===f&&["m"]||f<ge.m&&["mm",f]||1===g&&["h"]||g<ge.h&&["hh",g]||1===h&&["d"]||h<ge.d&&["dd",h]||1===i&&["M"]||i<ge.M&&["MM",i]||1===j&&["y"]||["yy",j];return k[2]=b,k[3]=+a>0,k[4]=c,yc.apply(null,k)}function Ac(a,b){return void 0===ge[a]?!1:void 0===b?ge[a]:(ge[a]=b,!0)}function Bc(a){var b=this.localeData(),c=zc(this,!a,b);return a&&(c=b.pastFuture(+this,c)),b.postformat(c)}function Cc(){var a=he(this.years()),b=he(this.months()),c=he(this.days()),d=he(this.hours()),e=he(this.minutes()),f=he(this.seconds()+this.milliseconds()/1e3),g=this.asSeconds();return g?(0>g?"-":"")+"P"+(a?a+"Y":"")+(b?b+"M":"")+(c?c+"D":"")+(d||e||f?"T":"")+(d?d+"H":"")+(e?e+"M":"")+(f?f+"S":""):"P0D"}var Dc,Ec,Fc=a.momentProperties=[],Gc=!1,Hc={},Ic={},Jc=/(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Q|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,4}
13108|x|X|zz?|ZZ?|.)/g,Kc=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,Lc={},Mc={},Nc=/\d/,Oc=/\d\d/,Pc=/\d{3}/,Qc=/\d{4}/,Rc=/[+-]?\d{6}/,Sc=/\d\d?/,Tc=/\d{1,3}/,Uc=/\d{1,4}/,Vc=/[+-]?\d{1,6}/,Wc=/\d+/,Xc=/[+-]?\d+/,Yc=/Z|[+-]\d\d:?\d\d/gi,Zc=/[+-]?\d+(\.\d{1,3})?/,$c=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,_c={},ad={},bd=0,cd=1,dd=2,ed=3,fd=4,gd=5,hd=6;G("M",["MM",2],"Mo",function(){return this.month()+1}),G("MMM",0,0,function(a){return this.localeData().monthsShort(this,a)}),G("MMMM",0,0,function(a){return this.localeData().months(this,a)}),y("month","M"),L("M",Sc),L("MM",Sc,Oc),L("MMM",$c),L("MMMM",$c),O(["M","MM"],function(a,b){b[cd]=p(a)-1}),O(["MMM","MMMM"],function(a,b,c,d){var e=c._locale.monthsParse(a,d,c._strict);null!=e?b[cd]=e:j(c).invalidMonth=a});var id="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),jd="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),kd={};a.suppressDeprecationWarnings=!1;var ld=/^\s*(?:[+-]\d{6}|\d{4})-(?:(\d\d-\d\d)|(W\d\d$)|(W\d\d-\d)|(\d\d\d))((T| )(\d\d(:\d\d(:\d\d(\.\d+)?)?)?)?([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,md=[["YYYYYY-MM-DD",/[+-]\d{6}-\d{2}-\d{2}/],["YYYY-MM-DD",/\d{4}-\d{2}-\d{2}/],["GGGG-[W]WW-E",/\d{4}-W\d{2}-\d/],["GGGG-[W]WW",/\d{4}-W\d{2}/],["YYYY-DDD",/\d{4}-\d{3}/]],nd=[["HH:mm:ss.SSSS",/(T| )\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss",/(T| )\d\d:\d\d:\d\d/],["HH:mm",/(T| )\d\d:\d\d/],["HH",/(T| )\d\d/]],od=/^\/?Date\((\-?\d+)/i;a.createFromInputFallback=$("moment construction falls back to js Date. This is discouraged and will be removed in upcoming major release. Please refer to https://github.com/moment/moment/issues/1407 for more info.",function(a){a._d=new Date(a._i+(a._useUTC?" UTC":""))}),G(0,["YY",2],0,function(){return this.year()%100}),G(0,["YYYY",4],0,"year"),G(0,["YYYYY",5],0,"year"),G(0,["YYYYYY",6,!0],0,"year"),y("year","y"),L("Y",Xc),L("YY",Sc,Oc),L("YYYY",Uc,Qc),L("YYYYY",Vc,Rc),L("YYYYYY",Vc,Rc),O(["YYYY","YYYYY","YYYYYY"],bd),O("YY",function(b,c){c[bd]=a.parseTwoDigitYear(b)}),a.parseTwoDigitYear=function(a){return p(a)+(p(a)>68?1900:2e3)};var pd=B("FullYear",!1);G("w",["ww",2],"wo","week"),G("W",["WW",2],"Wo","isoWeek"),y("week","w"),y("isoWeek","W"),L("w",Sc),L("ww",Sc,Oc),L("W",Sc),L("WW",Sc,Oc),P(["w","ww","W","WW"],function(a,b,c,d){b[d.substr(0,1)]=p(a)});var qd={dow:0,doy:6};G("DDD",["DDDD",3],"DDDo","dayOfYear"),y("dayOfYear","DDD"),L("DDD",Tc),L("DDDD",Pc),O(["DDD","DDDD"],function(a,b,c){c._dayOfYear=p(a)}),a.ISO_8601=function(){};var rd=$("moment().min is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548",function(){var a=Aa.apply(null,arguments);return this>a?this:a}),sd=$("moment().max is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548",function(){var a=Aa.apply(null,arguments);return a>this?this:a});Ga("Z",":"),Ga("ZZ",""),L("Z",Yc),L("ZZ",Yc),O(["Z","ZZ"],function(a,b,c){c._useUTC=!0,c._tzm=Ha(a)});var td=/([\+\-]|\d\d)/gi;a.updateOffset=function(){};var ud=/(\-)?(?:(\d*)\.)?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?)?/,vd=/^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/;Va.fn=Ea.prototype;var wd=Za(1,"add"),xd=Za(-1,"subtract");a.defaultFormat="YYYY-MM-DDTHH:mm:ssZ";var yd=$("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(a){return void 0===a?this.localeData():this.locale(a)});G(0,["gg",2],0,function(){return this.weekYear()%100}),G(0,["GG",2],0,function(){return this.isoWeekYear()%100}),Ab("gggg","weekYear"),Ab("ggggg","weekYear"),Ab("GGGG","isoWeekYear"),Ab("GGGGG","isoWeekYear"),y("weekYear","gg"),y("isoWeekYear","GG"),L("G",Xc),L("g",Xc),L("GG",Sc,Oc),L("gg",Sc,Oc),L("GGGG",Uc,Qc),L("gggg",Uc,Qc),L("GGGGG",Vc,Rc),L("ggggg",Vc,Rc),P(["gggg","ggggg","GGGG","GGGGG"],function(a,b,c,d){b[d.substr(0,2)]=p(a)}),P(["gg","GG"],function(b,c,d,e){c[e]=a.parseTwoDigitYear(b)}),G("Q",0,0,"quarter"),y("quarter","Q"),L("Q",Nc),O("Q",function(a,b){b[cd]=3*(p(a)-1)}),G("D",["DD",2],"Do","date"),y("date","D"),L("D",Sc),L("DD",Sc,Oc),L("Do",function(a,b){return a?b._ordinalParse:b._ordinalParseLenient}),O(["D","DD"],dd),O("Do",function(a,b){b[dd]=p(a.match(Sc)[0],10)});var zd=B("Date",!0);G("d",0,"do","day"),G("dd",0,0,function(a){return this.localeData().weekdaysMin(this,a)}),G("ddd",0,0,function(a){return this.localeData().weekdaysShort(this,a)}),G("dddd",0,0,function(a){return this.localeData().weekdays(this,a)}),G("e",0,0,"weekday"),G("E",0,0,"isoWeekday"),y("day","d"),y("weekday","e"),y("isoWeekday","E"),L("d",Sc),L("e",Sc),L("E",Sc),L("dd",$c),L("ddd",$c),L("dddd",$c),P(["dd","ddd","dddd"],function(a,b,c){var d=c._locale.weekdaysParse(a);null!=d?b.d=d:j(c).invalidWeekday=a}),P(["d","e","E"],function(a,b,c,d){b[d]=p(a)});var Ad="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Bd="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),Cd="Su_Mo_Tu_We_Th_Fr_Sa".split("_");G("H",["HH",2],0,"hour"),G("h",["hh",2],0,function(){return this.hours()%12||12}),Pb("a",!0),Pb("A",!1),y("hour","h"),L("a",Qb),L("A",Qb),L("H",Sc),L("h",Sc),L("HH",Sc,Oc),L("hh",Sc,Oc),O(["H","HH"],ed),O(["a","A"],function(a,b,c){c._isPm=c._locale.isPM(a),c._meridiem=a}),O(["h","hh"],function(a,b,c){b[ed]=p(a),j(c).bigHour=!0});var Dd=/[ap]\.?m?\.?/i,Ed=B("Hours",!0);G("m",["mm",2],0,"minute"),y("minute","m"),L("m",Sc),L("mm",Sc,Oc),O(["m","mm"],fd);var Fd=B("Minutes",!1);G("s",["ss",2],0,"second"),y("second","s"),L("s",Sc),L("ss",Sc,Oc),O(["s","ss"],gd);var Gd=B("Seconds",!1);G("S",0,0,function(){return~~(this.millisecond()/100)}),G(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),Tb("SSS"),Tb("SSSS"),y("millisecond","ms"),L("S",Tc,Nc),L("SS",Tc,Oc),L("SSS",Tc,Pc),L("SSSS",Wc),O(["S","SS","SSS","SSSS"],function(a,b){b[hd]=p(1e3*("0."+a))});var Hd=B("Milliseconds",!1);G("z",0,0,"zoneAbbr"),G("zz",0,0,"zoneName");var Id=n.prototype;Id.add=wd,Id.calendar=_a,Id.clone=ab,Id.diff=gb,Id.endOf=sb,Id.format=kb,Id.from=lb,Id.fromNow=mb,Id.to=nb,Id.toNow=ob,Id.get=E,Id.invalidAt=zb,Id.isAfter=bb,Id.isBefore=cb,Id.isBetween=db,Id.isSame=eb,Id.isValid=xb,Id.lang=yd,Id.locale=pb,Id.localeData=qb,Id.max=sd,Id.min=rd,Id.parsingFlags=yb,Id.set=E,Id.startOf=rb,Id.subtract=
13108xd,Id.toArray=wb,Id.toDate=vb,Id.toISOString=jb,Id.toJSON=jb,Id.toString=ib,Id.unix=ub,Id.valueOf=tb,Id.year=pd,Id.isLeapYear=ga,Id.weekYear=Cb,Id.isoWeekYear=Db,Id.quarter=Id.quarters=Gb,Id.month=W,Id.daysInMonth=X,Id.week=Id.weeks=la,Id.isoWeek=Id.isoWeeks=ma,Id.weeksInYear=Fb,Id.isoWeeksInYear=Eb,Id.date=zd,Id.day=Id.days=Mb,Id.weekday=Nb,Id.isoWeekday=Ob,Id.dayOfYear=oa,Id.hour=Id.hours=Ed,Id.minute=Id.minutes=Fd,Id.second=Id.seconds=Gd,Id.millisecond=Id.milliseconds=Hd,Id.utcOffset=Ka,Id.utc=Ma,Id.local=Na,Id.parseZone=Oa,Id.hasAlignedHourOffset=Pa,Id.isDST=Qa,Id.isDSTShifted=Ra,Id.isLocal=Sa,Id.isUtcOffset=Ta,Id.isUtc=Ua,Id.isUTC=Ua,Id.zoneAbbr=Ub,Id.zoneName=Vb,Id.dates=$("dates accessor is deprecated. Use date instead.",zd),Id.months=$("months accessor is deprecated. Use month instead",W),Id.years=$("years accessor is deprecated. Use year instead",pd),Id.zone=$("moment().zone is deprecated, use moment().utcOffset instead. https://github.com/moment/moment/issues/1779",La);var Jd=Id,Kd={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},Ld={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY LT",LLLL:"dddd, MMMM D, YYYY LT"},Md="Invalid date",Nd="%d",Od=/\d{1,2}/,Pd={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",
13109hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},Qd=r.prototype;Qd._calendar=Kd,Qd.calendar=Yb,Qd._longDateFormat=Ld,Qd.longDateFormat=Zb,Qd._invalidDate=Md,Qd.invalidDate=$b,Qd._ordinal=Nd,Qd.ordinal=_b,Qd._ordinalParse=Od,Qd.preparse=ac,Qd.postformat=ac,Qd._relativeTime=Pd,Qd.relativeTime=bc,Qd.pastFuture=cc,Qd.set=dc,Qd.months=S,Qd._months=id,Qd.monthsShort=T,Qd._monthsShort=jd,Qd.monthsParse=U,Qd.week=ia,Qd._week=qd,Qd.firstDayOfYear=ka,Qd.firstDayOfWeek=ja,Qd.weekdays=Ib,Qd._weekdays=Ad,Qd.weekdaysMin=Kb,Qd._weekdaysMin=Cd,Qd.weekdaysShort=Jb,Qd._weekdaysShort=Bd,Qd.weekdaysParse=Lb,Qd.isPM=Rb,Qd._meridiemParse=Dd,Qd.meridiem=Sb,v("en",{ordinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(a){var b=a%10,c=1===p(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c}}),a.lang=$("moment.lang is deprecated. Use moment.locale instead.",v),a.langData=$("moment.langData is deprecated. Use moment.localeData instead.",x);var Rd=Math.abs,Sd=uc("ms"),Td=uc("s"),Ud=uc("m"),Vd=uc("h"),Wd=uc("d"),Xd=uc("w"),Yd=uc("M"),Zd=uc("y"),$d=wc("milliseconds"),_d=wc("seconds"),ae=wc("minutes"),be=wc("hours"),ce=wc("days"),de=wc("months"),ee=wc("years"),fe=Math.round,ge={s:45,m:45,h:22,d:26,M:11},he=Math.abs,ie=Ea.prototype;ie.abs=lc,ie.add=nc,ie.subtract=oc,ie.as=sc,ie.asMilliseconds=Sd,ie.asSeconds=Td,ie.asMinutes=Ud,ie.asHours=Vd,ie.asDays=Wd,ie.asWeeks=Xd,ie.asMonths=Yd,ie.asYears=Zd,ie.valueOf=tc,ie._bubble=pc,ie.get=vc,ie.milliseconds=$d,ie.seconds=_d,ie.minutes=ae,ie.hours=be,ie.days=ce,ie.weeks=xc,ie.months=de,ie.years=ee,ie.humanize=Bc,ie.toISOString=Cc,ie.toString=Cc,ie.toJSON=Cc,ie.locale=pb,ie.localeData=qb,ie.toIsoString=$("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",Cc),ie.lang=yd,G("X",0,0,"unix"),G("x",0,0,"valueOf"),L("x",Xc),L("X",Zc),O("X",function(a,b,c){c._d=new Date(1e3*parseFloat(a,10))}),O("x",function(a,b,c){c._d=new Date(p(a))}),a.version="2.10.3",b(Aa),a.fn=Jd,a.min=Ca,a.max=Da,a.utc=h,a.unix=Wb,a.months=gc,a.isDate=d,a.locale=v,a.invalid=l,a.duration=Va,a.isMoment=o,a.weekdays=ic,a.parseZone=Xb,a.localeData=x,a.isDuration=Fa,a.monthsShort=hc,a.weekdaysMin=kc,a.defineLocale=w,a.weekdaysShort=jc,a.normalizeUnits=z,a.relativeTimeThreshold=Ac;var je=a;return je});
13110/* End */
13111;
13112; /* Start:"a:4:{s:4:"full";s:66:"/bitrix/templates/aspro_max/vendor/js/footable.js?1716465537275478";s:6:"source";s:49:"/bitrix/templates/aspro_max/vendor/js/footable.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
13113/*
13114* FooTable v3 - FooTable is a jQuery plugin that aims to make HTML tables on smaller devices look awesome.
13115* @version 3.1.5
13116* @link http://fooplugins.com
13117* @copyright Steven Usher & Brad Vincent 2015
13118* @license Released under the GPLv3 license.
13119*/
13120(function($, F){
13121	// add in console we use in case it's missing
13122	window.console = window.console || { log:function(){}, error:function(){} };
13123
13124	/**
13125	 * The jQuery plugin initializer.
13126	 * @function jQuery.fn.footable
13127	 * @param {(object|FooTable.Defaults)} [options] - The options to initialize the plugin with.
13128	 * @param {function} [ready] - A callback function to execute for each initialized plugin.
13129	 * @returns {jQuery}
13130	 */
13131	$.fn.footable = function (options, ready) {
13132		options = options || {};
13133		// make sure we only work with tables
13134		return this.filter('table').each(function (i, tbl) {
13135			F.init(tbl, options, ready);
13136		});
13137	};
13138
13139	var debug_defaults = {
13140		events: []
13141	};
13142	F.__debug__ = JSON.parse(localStorage.getItem('footable_debug')) || false;
13143	F.__debug_options__ = JSON.parse(localStorage.getItem('footable_debug_options')) || debug_defaults;
13144
13145	/**
13146	 * Gets or sets the internal debug variable which enables some additional logging to the console.
13147	 * When enabled this value is stored in the localStorage so it can persist across page reloads.
13148	 * @param {boolean} value - Whether or not to enable additional logging.
13149	 * @param {object} [options] - Any debug specific options.
13150	 * @returns {(boolean|undefined)}
13151	 */
13152	F.debug = function(value, options){
13153		if (!F.is.boolean(value)) return F.__debug__;
13154		F.__debug__ = value;
13155		if (F.__debug__){
13156			localStorage.setItem('footable_debug', JSON.stringify(F.__debug__));
13157			F.__debug_options__ = $.extend(true, {}, debug_defaults, options || {});
13158			if (F.is.hash(options)){
13159				localStorage.setItem('footable_debug_options', JSON.stringify(F.__debug_options__));
13160			}
13161		} else {
13162			localStorage.removeItem('footable_debug');
13163			localStorage.removeItem('footable_debug_options');
13164		}
13165	};
13166
13167	/**
13168	 * Gets the FooTable instance of the supplied table if one exists.
13169	 * @param {(jQuery|jQuery.selector|HTMLTableElement)} table - The jQuery table object, selector or the HTMLTableElement to retrieve FooTable from.
13170	 * @returns {(FooTable.Table|undefined)}
13171	 */
13172	F.get = function(table){
13173		return $(table).first().data('__FooTable__');
13174	};
13175
13176	/**
13177	 * Initializes a new instance of FooTable on the supplied table.
13178	 * @param {(jQuery|jQuery.selector|HTMLTableElement)} table - The jQuery table object, selector or the HTMLTableElement to initialize FooTable on.
13179	 * @param {object} options - The options to initialize FooTable with.
13180	 * @param {function} [ready] - A callback function to execute once the plugin is initialized.
13181	 * @returns {FooTable.Table}
13182	 */
13183	F.init = function(table, options, ready){
13184		var ft = F.get(table);
13185		if (ft instanceof F.Table) ft.destroy();
13186		return new F.Table(table, options, ready);
13187	};
13188
13189	/**
13190	 * Gets the FooTable.Row instance for the supplied element.
13191	 * @param {(jQuery|jQuery.selector|HTMLTableElement)} element - A jQuery object, selector or the HTMLElement of an element to retrieve the FooTable.Row for.
13192	 * @returns {FooTable.Row}
13193	 */
13194	F.getRow = function(element){
13195		// to get the FooTable.Row object simply walk up the DOM, find the TR and grab the __FooTableRow__ data value
13196		var $row = $(element).closest('tr');
13197		// if this is a detail row get the previous row in the table to get the main TR element
13198		if ($row.hasClass('footable-detail-row')){
13199			$row = $row.prev();
13200		}
13201		// grab the row object
13202		return $row.data('__FooTableRow__');
13203	};
13204
13205	// The below are external type definitions mainly used as pointers to jQuery docs for important information
13206	/**
13207	 * jQuery is a fast, small, and feature-rich JavaScript library. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API
13208	 * that works across a multitude of browsers. With a combination of versatility and extensibility, jQuery has changed the way that millions of people write JavaScript.
13209	 * @name jQuery
13210	 * @constructor
13211	 * @returns {jQuery}
13212	 * @see {@link http://api.jquery.com/}
13213	 */
13214
13215	/**
13216	 * This object provides a subset of the methods of the Deferred object (then, done, fail, always, pipe, and state) to prevent users from changing the state of the Deferred.
13217	 * @typedef {object} jQuery.Promise
13218	 * @see {@link http://api.jquery.com/Types/#Promise}
13219	 */
13220
13221	/**
13222	 * As of jQuery 1.5, the Deferred object provides a way to register multiple callbacks into self-managed callback queues, invoke callback queues as appropriate,
13223	 * and relay the success or failure state of any synchronous or asynchronous function.
13224	 * @typedef {object} jQuery.Deferred
13225	 * @see {@link http://api.jquery.com/Types/#Deferred}
13226	 */
13227
13228	/**
13229	 * jQuery's event system normalizes the event object according to W3C standards. The event object is guaranteed to be passed to the event handler. Most properties from
13230	 * the original event are copied over and normalized to the new event object.
13231	 * @typedef {object} jQuery.Event
13232	 * @see {@link http://api.jquery.com/category/events/event-object/}
13233	 */
13234
13235	/**
13236	 * Provides a way to execute callback functions based on one or more objects, usually Deferred objects that represent asynchronous events.
13237	 * @memberof jQuery
13238	 * @function when
13239	 * @param {...jQuery.Deferred} deferreds - Any number of deferred objects to wait for.
13240	 * @returns {jQuery.Promise}
13241	 * @see {@link http://api.jquery.com/jQuery.when/}
13242	 */
13243
13244	/**
13245	 * The jQuery.fn namespace used to register plugins with jQuery.
13246	 * @memberof jQuery
13247	 * @namespace fn
13248	 * @see {@link http://learn.jquery.com/plugins/basic-plugin-creation/}
13249	 */
13250})(
13251	jQuery,
13252	/**
13253	 * The core FooTable namespace containing all the plugin code.
13254	 * @namespace
13255	 */
13256	FooTable = window.FooTable || {}
13257);
13258(function(F){
13259	var returnTrue = function(){ return true; };
13260
13261	/**
13262	 * This namespace contains commonly used array utility methods.
13263	 * @namespace {object} FooTable.arr
13264	 */
13265	F.arr = {};
13266
13267	/**
13268	 * Iterates over each item in the supplied array and performs the supplied function passing in the current item as the first argument.
13269	 * @memberof FooTable.arr
13270	 * @function each
13271	 * @param {Array} array - The array to iterate
13272	 * @param {function} func - The function to execute for each item. The first argument supplied to this function is the current item and the second is the current index.
13273	 */
13274	F.arr.each = function (array, func) {
13275		if (!F.is.array(array) || !F.is.fn(func)) return;
13276		for (var i = 0, len = array.length; i < len; i++) {
13277			if (func(array[i], i) === false) break;
13278		}
13279	};
13280
13281	/**
13282	 * Get all items in the supplied array that optionally matches the supplied where function. If no items are found an empty array is returned.
13283	 * @memberof FooTable.arr
13284	 * @function get
13285	 * @param {Array} array - The array to get items from.
13286	 * @param {function} where - This function must return a boolean value, true includes the item in the result array.
13287	 * @returns {Array}
13288	 */
13289	F.arr.get = function (array, where) {
13290		var result = [];
13291		if (!F.is.array(array)) return result;
13292		if (!F.is.fn(where)) return array;
13293		for (var i = 0, len = array.length; i < len; i++) {
13294			if (where(array[i], i)) result.push(array[i]);
13295		}
13296		return result;
13297	};
13298
13299	/**
13300	 * Get a boolean value indicating if any item exists in the supplied array that optionally matches the supplied where function.
13301	 * @memberof FooTable.arr
13302	 * @function any
13303	 * @param {Array} array - The array to check.
13304	 * @param {function} [where] - [Optional] This function must return a boolean value, true indicates that the current item is a valid match.
13305	 * @returns {boolean}
13306	 */
13307	F.arr.any = function (array, where) {
13308		if (!F.is.array(array)) return false;
13309		where = F.is.fn(where) ? where : returnTrue;
13310		for (var i = 0, len = array.length; i < len; i++) {
13311			if (where(array[i], i)) return true;
13312		}
13313		return false;
13314	};
13315
13316	/**
13317	 * Checks if the supplied value exists in the array.
13318	 * @memberof FooTable.arr
13319	 * @function contains
13320	 * @param {Array} array - The array to check.
13321	 * @param {*} value - The value to check for.
13322	 * @returns {boolean}
13323	 */
13324	F.arr.contains = function(array, value){
13325		if (!F.is.array(array) || F.is.undef(value)) return false;
13326		for (var i = 0, len = array.length; i < len; i++) {
13327			if (array[i] == value) return true;
13328		}
13329		return false;
13330	};
13331
13332	/**
13333	 * Get the first item in the supplied array that optionally matches the supplied where function. If no item is found null is returned.
13334	 * @memberof FooTable.arr
13335	 * @function first
13336	 * @param {Array} array - The array to get the item from.
13337	 * @param {function} [where] - [Optional] This function must return a boolean value, true indicates that the current item can be returned.
13338	 * @returns {(*|null)}
13339	 */
13340	F.arr.first = function (array, where) {
13341		if (!F.is.array(array)) return null;
13342		where = F.is.fn(where) ? where : returnTrue;
13343		for (var i = 0, len = array.length; i < len; i++) {
13344			if (where(array[i], i)) return array[i];
13345		}
13346		return null;
13347	};
13348
13349	/**
13350	 * Creates a new array from the results of the supplied getter function. If no items are found an empty array is returned, to exclude an item from the results return null.
13351	 * @memberof FooTable.arr
13352	 * @function map
13353	 * @param {Array} array - The array to iterate.
13354	 * @param {function} getter - This function must return either a new value or null.
13355	 * The first argument is the result being returned at this point in the iteration. The second argument is the current item being iterated.
13356	 * @returns {(*|null)}
13357	 */
13358	F.arr.map = function (array, getter) {
13359		var result = [], returned = null;
13360		if (!F.is.array(array) || !F.is.fn(getter)) return result;
13361		for (var i = 0, len = array.length; i < len; i++) {
13362			if ((returned = getter(array[i], i)) != null) result.push(returned);
13363		}
13364		return result;
13365	};
13366
13367	/**
13368	 * Removes items from the array matching the supplied where function. All removed items are returned in a new array.
13369	 * @memberof FooTable.arr
13370	 * @function remove
13371	 * @param {Array} array - The array to iterate and remove items from.
13372	 * @param {function} where - This function must return a boolean value, true includes the item in the result array.
13373	 * @returns {*}
13374	 */
13375	F.arr.remove = function (array, where) {
13376		var remove = [], removed = [];
13377		if (!F.is.array(array) || !F.is.fn(where)) return removed;
13378		var i = 0, len = array.length;
13379		for (; i < len; i++) {
13380			if (where(array[i], i, removed)){
13381				remove.push(i);
13382				removed.push(array[i]);
13383			}
13384		}
13385		// sort the indexes to be removed from largest to smallest
13386		remove.sort(function(a, b){ return b - a; });
13387		i = 0; len = remove.length;
13388		for(; i < len; i++){
13389			var index = remove[i] - i;
13390			array.splice(index, 1);
13391		}
13392		return removed;
13393	};
13394
13395	/**
13396	 * Deletes a single item from the array. The item if removed is returned.
13397	 * @memberof FooTable.arr
13398	 * @function delete
13399	 * @param {Array} array - The array to iterate and delete the item from.
13400	 * @param {*} item - The item to find and delete.
13401	 * @returns {(*|null)}
13402	 */
13403	F.arr.delete = function(array, item){
13404		var remove = -1, removed = null;
13405		if (!F.is.array(array) || F.is.undef(item)) return removed;
13406		var i = 0, len = array.length;
13407		for (; i < len; i++) {
13408			if (array[i] == item){
13409				remove = i;
13410				removed = array[i];
13411				break;
13412			}
13413		}
13414		if (remove != -1) array.splice(remove, 1);
13415		return removed;
13416	};
13417
13418	/**
13419	 * Replaces a single item in the array with a new one.
13420	 * @memberof FooTable.arr
13421	 * @function replace
13422	 * @param {Array} array - The array to iterate and replace the item in.
13423	 * @param {*} oldItem - The item to be replaced.
13424	 * @param {*} newItem - The item to be inserted.
13425	 */
13426	F.arr.replace = function(array, oldItem, newItem){
13427		var index = array.indexOf(oldItem);
13428		if (index !== -1) array[index] = newItem;
13429	};
13430
13431})(FooTable);
13432(function (F) {
13433
13434	/**
13435	 * This namespace contains commonly used 'is' type methods that return boolean values.
13436	 * @namespace FooTable.is
13437	 */
13438	F.is = {};
13439
13440	/**
13441	 * Checks if the type of the value is the same as that supplied.
13442	 * @memberof FooTable.is
13443	 * @function type
13444	 * @param {*} value - The value to check the type of.
13445	 * @param {string} type - The type to check for.
13446	 * @returns {boolean}
13447	 */
13448	F.is.type = function (value, type) {
13449		return typeof value === type;
13450	};
13451
13452	/**
13453	 * Checks if the value is defined.
13454	 * @memberof FooTable.is
13455	 * @function defined
13456	 * @param {*} value - The value to check is defined.
13457	 * @returns {boolean}
13458	 */
13459	F.is.defined = function (value) {
13460		return typeof value !== 'undefined';
13461	};
13462
13463	/**
13464	 * Checks if the value is undefined.
13465	 * @memberof FooTable.is
13466	 * @function undef
13467	 * @param {*} value - The value to check is undefined.
13468	 * @returns {boolean}
13469	 */
13470	F.is.undef = function (value) {
13471		return typeof value === 'undefined';
13472	};
13473
13474	/**
13475	 * Checks if the value is an array.
13476	 * @memberof FooTable.is
13477	 * @function array
13478	 * @param {*} value - The value to check.
13479	 * @returns {boolean}
13480	 */
13481	F.is.array = function (value) {
13482		return '[object Array]' === Object.prototype.toString.call(value);
13483	};
13484
13485	/**
13486	 * Checks if the value is a date.
13487	 * @memberof FooTable.is
13488	 * @function date
13489	 * @param {*} value - The value to check.
13490	 * @returns {boolean}
13491	 */
13492	F.is.date = function (value) {
13493		return '[object Date]' === Object.prototype.toString.call(value) && !isNaN(value.getTime());
13494	};
13495
13496	/**
13497	 * Checks if the value is a boolean.
13498	 * @memberof FooTable.is
13499	 * @function boolean
13500	 * @param {*} value - The value to check.
13501	 * @returns {boolean}
13502	 */
13503	F.is.boolean = function (value) {
13504		return '[object Boolean]' === Object.prototype.toString.call(value);
13505	};
13506
13507	/**
13508	 * Checks if the value is a string.
13509	 * @memberof FooTable.is
13510	 * @function string
13511	 * @param {*} value - The value to check.
13512	 * @returns {boolean}
13513	 */
13514	F.is.string = function (value) {
13515		return '[object String]' === Object.prototype.toString.call(value);
13516	};
13517
13518	/**
13519	 * Checks if the value is a number.
13520	 * @memberof FooTable.is
13521	 * @function number
13522	 * @param {*} value - The value to check.
13523	 * @returns {boolean}
13524	 */
13525	F.is.number = function (value) {
13526		return '[object Number]' === Object.prototype.toString.call(value) && !isNaN(value);
13527	};
13528
13529	/**
13530	 * Checks if the value is a function.
13531	 * @memberof FooTable.is
13532	 * @function fn
13533	 * @param {*} value - The value to check.
13534	 * @returns {boolean}
13535	 */
13536	F.is.fn = function (value) {
13537		return (F.is.defined(window) && value === window.alert) || '[object Function]' === Object.prototype.toString.call(value);
13538	};
13539
13540	/**
13541	 * Checks if the value is an error.
13542	 * @memberof FooTable.is
13543	 * @function error
13544	 * @param {*} value - The value to check.
13545	 * @returns {boolean}
13546	 */
13547	F.is.error = function (value) {
13548		return '[object Error]' === Object.prototype.toString.call(value);
13549	};
13550
13551	/**
13552	 * Checks if the value is an object.
13553	 * @memberof FooTable.is
13554	 * @function object
13555	 * @param {*} value - The value to check.
13556	 * @returns {boolean}
13557	 */
13558	F.is.object = function (value) {
13559		return '[object Object]' === Object.prototype.toString.call(value);
13560	};
13561
13562	/**
13563	 * Checks if the value is a hash.
13564	 * @memberof FooTable.is
13565	 * @function hash
13566	 * @param {*} value - The value to check.
13567	 * @returns {boolean}
13568	 */
13569	F.is.hash = function (value) {
13570		return F.is.object(value) && value.constructor === Object && !value.nodeType && !value.setInterval;
13571	};
13572
13573	/**
13574	 * Checks if the supplied object is an HTMLElement
13575	 * @memberof FooTable.is
13576	 * @function element
13577	 * @param {object} obj - The object to check.
13578	 * @returns {boolean}
13579	 */
13580	F.is.element = function (obj) {
13581		return typeof HTMLElement === 'object'
13582			? obj instanceof HTMLElement
13583			: obj && typeof obj === 'object' && obj !== null && obj.nodeType === 1 && typeof obj.nodeName === 'string';
13584	};
13585
13586	/**
13587	 * This is a simple check to determine if an object is a jQuery promise object. It simply checks the object has a "then" and "promise" function defined.
13588	 * The promise object is created as an object literal inside of jQuery.Deferred.
13589	 * It has no prototype, nor any other truly unique properties that could be used to distinguish it.
13590	 * This method should be a little more accurate than the internal jQuery one that simply checks for a "promise" method.
13591	 * @memberof FooTable.is
13592	 * @function promise
13593	 * @param {object} obj - The object to check.
13594	 * @returns {boolean}
13595	 */
13596	F.is.promise = function(obj){
13597		return F.is.object(obj) && F.is.fn(obj.then) && F.is.fn(obj.promise);
13598	};
13599
13600	/**
13601	 * Checks if the supplied object is an instance of a jQuery object.
13602	 * @memberof FooTable.is
13603	 * @function jq
13604	 * @param {object} obj - The object to check.
13605	 * @returns {boolean}
13606	 */
13607	F.is.jq = function(obj){
13608		return F.is.defined(window.jQuery) && obj instanceof jQuery && obj.length > 0;
13609	};
13610
13611	/**
13612	 * Checks if the supplied object is a moment.js date object.
13613	 * @memberof FooTable.is
13614	 * @function moment
13615	 * @param {object} obj - The object to check.
13616	 * @returns {boolean}
13617	 */
13618	F.is.moment = function(obj){
13619		return F.is.defined(window.moment) && F.is.object(obj) && F.is.boolean(obj._isAMomentObject)
13620	};
13621
13622	/**
13623	 * Checks if the supplied value is an object and if it is empty.
13624	 * @memberof FooTable.is
13625	 * @function emptyObject
13626	 * @param {*} value - The value to check.
13627	 * @returns {boolean}
13628	 */
13629	F.is.emptyObject = function(value){
13630		if (!F.is.hash(value)) return false;
13631		for(var prop in value) {
13632			if(value.hasOwnProperty(prop))
13633				return false;
13634		}
13635		return true;
13636	};
13637
13638	/**
13639	 * Checks if the supplied value is an array and if it is empty.
13640	 * @memberof FooTable.is
13641	 * @function emptyArray
13642	 * @param {*} value - The value to check.
13643	 * @returns {boolean}
13644	 */
13645	F.is.emptyArray = function(value){
13646		return F.is.array(value) ? value.length === 0 : true;
13647	};
13648
13649	/**
13650	 * Checks if the supplied value is a string and if it is empty.
13651	 * @memberof FooTable.is
13652	 * @function emptyString
13653	 * @param {*} value - The value to check.
13654	 * @returns {boolean}
13655	 */
13656	F.is.emptyString = function(value){
13657		return F.is.string(value) ? value.length === 0 : true;
13658	};
13659
13660})(FooTable);
13661(function (F) {
13662	/**
13663	 * This namespace contains commonly used string utility methods.
13664	 * @namespace FooTable.str
13665	 */
13666	F.str = {};
13667
13668	/**
13669	 * Checks if the supplied string contains the given substring.
13670	 * @memberof FooTable.str
13671	 * @function contains
13672	 * @param {string} str - The string to check.
13673	 * @param {string} contains - The string to check for.
13674	 * @param {boolean} [ignoreCase=false] - Whether or not to ignore casing when performing the check.
13675	 * @returns {boolean}
13676	 */
13677	F.str.contains = function (str, contains, ignoreCase) {
13678		if (F.is.emptyString(str) || F.is.emptyString(contains)) return false;
13679		return contains.length <= str.length
13680			&& (ignoreCase ? str.toUpperCase().indexOf(contains.toUpperCase()) : str.indexOf(contains)) !== -1;
13681	};
13682
13683	/**
13684	 * Checks if the supplied string contains the exact given substring.
13685	 * @memberof FooTable.str
13686	 * @function contains
13687	 * @param {string} str - The string to check.
13688	 * @param {string} contains - The string to check for.
13689	 * @param {boolean} [ignoreCase=false] - Whether or not to ignore casing when performing the check.
13690	 * @returns {boolean}
13691	 */
13692	F.str.containsExact = function (str, contains, ignoreCase) {
13693		if (F.is.emptyString(str) || F.is.emptyString(contains) || contains.length > str.length) return false;
13694		return new RegExp('\\b'+ F.str.escapeRegExp(contains)+'\\b', ignoreCase ? 'i' : '').test(str);
13695	};
13696
13697	/**
13698	 * Checks if the supplied string contains the given word.
13699	 * @memberof FooTable.str
13700	 * @function containsWord
13701	 * @param {string} str - The string to check.
13702	 * @param {string} word - The word to check for.
13703	 * @param {boolean} [ignoreCase=false] - Whether or not to ignore casing when performing the check.
13704	 * @returns {boolean}
13705	 */
13706	F.str.containsWord = function(str, word, ignoreCase){
13707		if (F.is.emptyString(str) || F.is.emptyString(word) || str.length < word.length)
13708			return false;
13709		var parts = str.split(/\W/);
13710		for (var i = 0, len = parts.length; i < len; i++){
13711			if (ignoreCase ? parts[i].toUpperCase() == word.toUpperCase() : parts[i] == word) return true;
13712		}
13713		return false;
13714	};
13715
13716	/**
13717	 * Returns the remainder of a string split on the first index of the given substring.
13718	 * @memberof FooTable.str
13719	 * @function from
13720	 * @param {string} str - The string to split.
13721	 * @param {string} from - The substring to split on.
13722	 * @returns {string}
13723	 */
13724	F.str.from = function (str, from) {
13725		if (F.is.emptyString(str)) return str;
13726		return F.str.contains(str, from) ? str.substring(str.indexOf(from) + 1) : str;
13727	};
13728
13729	/**
13730	 * Checks if a string starts with the supplied prefix.
13731	 * @memberof FooTable.str
13732	 * @function startsWith
13733	 * @param {string} str - The string to check.
13734	 * @param {string} prefix - The prefix to check for.
13735	 * @returns {boolean}
13736	 */
13737	F.str.startsWith = function (str, prefix) {
13738		if (F.is.emptyString(str)) return str == prefix;
13739		return str.slice(0, prefix.length) == prefix;
13740	};
13741
13742	/**
13743	 * Takes the supplied string and converts it to camel case.
13744	 * @memberof FooTable.str
13745	 * @function toCamelCase
13746	 * @param {string} str - The string to camel case.
13747	 * @returns {string}
13748	 */
13749	F.str.toCamelCase = function (str) {
13750		if (F.is.emptyString(str)) return str;
13751		if (str.toUpperCase() === str) return str.toLowerCase();
13752		return str.replace(/^([A-Z])|[-\s_](\w)/g, function (match, p1, p2) {
13753			if (F.is.string(p2)) return p2.toUpperCase();
13754			return p1.toLowerCase();
13755		});
13756	};
13757
13758	/**
13759	 * Generates a random string 9 characters long using the optional prefix if supplied.
13760	 * @memberof FooTable.str
13761	 * @function random
13762	 * @param {string} [prefix] - The prefix to append to the 9 random characters.
13763	 * @returns {string}
13764	 */
13765	F.str.random = function(prefix){
13766		prefix = F.is.emptyString(prefix) ? '' : prefix;
13767		return prefix + Math.random().toString(36).substr(2, 9);
13768	};
13769
13770	/**
13771	 * Escapes a string for use in a regular expression.
13772	 * @memberof FooTable.str
13773	 * @function escapeRegExp
13774	 * @param {string} str - The string to escape.
13775	 * @returns {string}
13776	 */
13777	F.str.escapeRegExp = function(str){
13778		if (F.is.emptyString(str)) return str;
13779		return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
13780	};
13781
13782})(FooTable);
13783(function (F) {
13784	"use strict";
13785
13786	if (!Object.create) {
13787		Object.create = (function () {
13788			var Object = function () {};
13789			return function (prototype) {
13790				if (arguments.length > 1)
13791					throw Error('Second argument not supported');
13792
13793				if (!F.is.object(prototype))
13794					throw TypeError('Argument must be an object');
13795
13796				Object.prototype = prototype;
13797				var result = new Object();
13798				Object.prototype = null;
13799				return result;
13800			};
13801		})();
13802	}
13803
13804	/**
13805	 * This base implementation does nothing except provide access to the {@link FooTable.Class#extend} method.
13806	 * @constructs FooTable.Class
13807	 * @classdesc This class is based off of John Resig's [Simple JavaScript Inheritance]{@link http://ejohn.org/blog/simple-javascript-inheritance} but it has been updated to be ES 5.1
13808	 * compatible by implementing an [Object.create polyfill]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create#Polyfill}
13809	 * for older browsers.
13810	 * @see {@link http://ejohn.org/blog/simple-javascript-inheritance}
13811	 * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create#Polyfill}
13812	 * @returns {FooTable.Class}
13813	 */
13814	function Class() {}
13815
13816	var __extendable__ = /xyz/.test(function () {xyz;}) ? /\b_super\b/ : /.*/;
13817
13818	// this._super() within the context of the new function is a pointer to the original function
13819	// except if the hook param is specified then the this._super variable is the result of the original function
13820	Class.__extend__ = function(proto, name, func, original){
13821		// to all who venture here, here be dragons!
13822		proto[name] = F.is.fn(original) && __extendable__.test(func) ?
13823			(function (name, fn) {
13824				return function () {
13825					var tmp, ret;
13826					tmp = this._super;
13827					this._super = original;
13828					ret = fn.apply(this, arguments);
13829					this._super = tmp;
13830					return ret;
13831				};
13832			})(name, func) : func;
13833	};
13834
13835	/**
13836	 * Creates a new class that inherits from this class which in turn allows itself to be extended or if a name and function is supplied extends only that specific function on the class.
13837	 * @param {(object|string)} arg1 - An object containing any new methods/members to implement or the name of the method to extend.
13838	 * @param {function} arg2 - If the first argument is a method name then this is the new function to replace it with.
13839	 * @returns {FooTable.Class} A new class that inherits from the base class.
13840	 * @example <caption>The below shows an example of how to implement inheritance using this method.</caption>
13841	 * var Person = FooTable.Class.extend({
13842	 *   construct: function(isDancing){
13843	 *     this.dancing = isDancing;
13844	 *   },
13845	 *   dance: function(){
13846	 *     return this.dancing;
13847	 *   }
13848	 * });
13849	 *
13850	 * var Ninja = Person.extend({
13851	 *   construct: function(){
13852	 *     this._super( false );
13853	 *   },
13854	 *   dance: function(){
13855	 *     // Call the inherited version of dance()
13856	 *     return this._super();
13857	 *   },
13858	 *   swingSword: function(){
13859	 *     return true;
13860	 *   }
13861	 * });
13862	 *
13863	 * var p = new Person(true);
13864	 * p.dance(); // => true
13865	 *
13866	 * var n = new Ninja();
13867	 * n.dance(); // => false
13868	 * n.swingSword(); // => true
13869	 *
13870	 * // Should all be true
13871	 * p instanceof Person && p instanceof FooTable.Class &&
13872	 * n instanceof Ninja && n instanceof Person && n instanceof FooTable.Class
13873	 */
13874	Class.extend = function (arg1 , arg2) {
13875		var args = Array.prototype.slice.call(arguments);
13876		arg1 = args.shift();
13877		arg2 = args.shift();
13878
13879		function __extend__(proto, name, func, original){
13880			// to all who venture here, here be dragons!
13881			proto[name] = F.is.fn(original) && __extendable__.test(func) ?
13882				(function (name, fn, ofn) {
13883					return function () {
13884						var tmp, ret;
13885						tmp = this._super;
13886						this._super = ofn;
13887						ret = fn.apply(this, arguments);
13888						this._super = tmp;
13889						return ret;
13890					};
13891				})(name, func, original) : func;
13892		}
13893
13894		if (F.is.hash(arg1)){
13895			var proto = Object.create(this.prototype),
13896				_super = this.prototype;
13897			for (var name in arg1) {
13898				if (name === '__ctor__') continue;
13899				__extend__(proto, name, arg1[name], _super[name]);
13900			}
13901			var obj = F.is.fn(proto.__ctor__) ? proto.__ctor__ : function () {
13902				if (!F.is.fn(this.construct))
13903					throw new SyntaxError('FooTable class objects must be constructed with the "new" keyword.');
13904				this.construct.apply(this, arguments);
13905			};
13906			proto.construct = F.is.fn(proto.construct) ? proto.construct : function(){};
13907			obj.prototype = proto;
13908			proto.constructor = obj;
13909			obj.extend = Class.extend;
13910			return obj;
13911		} else if (F.is.string(arg1) && F.is.fn(arg2)) {
13912			__extend__(this.prototype, arg1, arg2, this.prototype[arg1]);
13913		}
13914	};
13915
13916	F.Class = Class;
13917
13918	F.ClassFactory = F.Class.extend(/** @lends FooTable.ClassFactory */{
13919		/**
13920		 * This is a simple factory for {@link FooTable.Class} objects allowing them to be registered using a friendly name
13921		 * and then new instances can be created using this friendly name.
13922		 * @constructs
13923		 * @extends FooTable.Class
13924		 * @returns {FooTable.ClassFactory}
13925		 * @this FooTable.ClassFactory
13926		 */
13927		construct: function(){
13928			/**
13929			 * An object containing all registered classes.
13930			 * @type {{}}
13931			 */
13932			this.registered = {};
13933		},
13934		/**
13935		 * Checks if the factory contains a class registered using the supplied name.
13936		 * @instance
13937		 * @param {string} name - The name of the class to check.
13938		 * @returns {boolean}
13939		 * @this FooTable.ClassFactory
13940		 */
13941		contains: function(name){
13942			return F.is.defined(this.registered[name]);
13943		},
13944		/**
13945		 * Gets an array of all registered names.
13946		 * @instance
13947		 * @returns {Array.<string>}
13948		 * @this FooTable.ClassFactory
13949		 */
13950		names: function(){
13951			var names = [], name;
13952			for (name in this.registered){
13953				if (!this.registered.hasOwnProperty(name)) continue;
13954				names.push(name);
13955			}
13956			return names;
13957		},
13958		/**
13959		 * Registers a class object using the supplied friendly name and priority. The priority is only taken into account when loading all registered classes
13960		 * using the {@link FooTable.ClassFactory#load} method.
13961		 * @instance
13962		 * @param {string} name - The friendly name of the class.
13963		 * @param {function} klass - The class to register.
13964		 * @param {number} priority - This determines the order that the class is created when using the {@link FooTable.ClassFactory#load} method, higher values are loaded first.
13965		 * @this FooTable.ClassFactory
13966		 */
13967		register: function(name, klass, priority){
13968			if (!F.is.string(name) || !F.is.fn(klass)) return;
13969			var current = this.registered[name];
13970			this.registered[name] = {
13971				name: name,
13972				klass: klass,
13973				priority: F.is.number(priority) ? priority : (F.is.defined(current) ? current.priority : 0)
13974			};
13975		},
13976		/**
13977		 * Creates new instances of all registered classes using there priority and the supplied arguments to return them in an array.
13978		 * @instance
13979		 * @param {object} subs - An object containing classes to substitute on load.
13980		 * @param {*} arg1 - The first argument to supply when creating new instances of all registered classes.
13981		 * @param {*} [argN...] - Any number of additional arguments to supply when creating new instances of all registered classes.
13982		 * @returns {Array.<FooTable.Class>}
13983		 * @this FooTable.ClassFactory
13984		 */
13985		load: function(subs, arg1, argN){
13986			var self = this, args = Array.prototype.slice.call(arguments), reg = [], loaded = [], name, klass;
13987			subs = args.shift() || {};
13988			for (name in self.registered){
13989				if (!self.registered.hasOwnProperty(name)) continue;
13990				var component = self.registered[name];
13991				if (subs.hasOwnProperty(name)){
13992					klass = subs[name];
13993					if (F.is.string(klass)) klass = F.getFnPointer(subs[name]);
13994					if (F.is.fn(klass)){
13995						component = {name: name, klass: klass, priority: self.registered[name].priority};
13996					}
13997				}
13998				reg.push(component);
13999			}
14000			for (name in subs){
14001				if (!subs.hasOwnProperty(name) || self.registered.hasOwnProperty(name)) continue;
14002				klass = subs[name];
14003				if (F.is.string(klass)) klass = F.getFnPointer(subs[name]);
14004				if (F.is.fn(klass)){
14005					reg.push({name: name, klass: klass, priority: 0});
14006				}
14007			}
14008			reg.sort(function(a, b){ return b.priority - a.priority; });
14009			F.arr.each(reg, function(r){
14010				if (F.is.fn(r.klass)){
14011					loaded.push(self._make(r.klass, args));
14012				}
14013			});
14014			return loaded;
14015		},
14016		/**
14017		 * Create a new instance of a single class using the supplied name and arguments.
14018		 * @instance
14019		 * @param {string} name - The name of the class to create.
14020		 * @param {*} arg1 - The first argument to supply to the new instance.
14021		 * @param {*} [argN...] - Any number of additional arguments to supply to the new instance.
14022		 * @returns {FooTable.Class}
14023		 * @this FooTable.ClassFactory
14024		 */
14025		make: function(name, arg1, argN){
14026			var self = this, args = Array.prototype.slice.call(arguments), reg;
14027			name = args.shift();
14028			reg = self.registered[name];
14029			if (F.is.fn(reg.klass)){
14030				return self._make(reg.klass, args);
14031			}
14032			return null;
14033		},
14034		/**
14035		 * This in effect lets us use the "apply" method on a function using the "new" keyword.
14036		 * @instance
14037		 * @private
14038		 * @param {function} klass
14039		 * @param args
14040		 * @returns {FooTable.Class}
14041		 * @this FooTable.ClassFactory
14042		 */
14043		_make: function(klass, args){
14044			function Class() {
14045				return klass.apply(this, args);
14046			}
14047			Class.prototype = klass.prototype;
14048			return new Class();
14049		}
14050	});
14051
14052})(FooTable);
14053(function($, F){
14054
14055	/**
14056	 * Converts the supplied cssText string into JSON object.
14057	 * @param {string} cssText - The cssText to convert to a JSON object.
14058	 * @returns {object}
14059	 */
14060	F.css2json = function(cssText){
14061		if (F.is.emptyString(cssText)) return {};
14062		var json = {}, props = cssText.split(';'), pair, key, value;
14063		for (var i = 0, i_len = props.length; i < i_len; i++){
14064			if (F.is.emptyString(props[i])) continue;
14065			pair = props[i].split(':');
14066			if (F.is.emptyString(pair[0]) || F.is.emptyString(pair[1])) continue;
14067			key = F.str.toCamelCase($.trim(pair[0]));
14068			value = $.trim(pair[1]);
14069			json[key] = value;
14070		}
14071		return json;
14072	};
14073
14074	/**
14075	 * Attempts to retrieve a function pointer using the given name.
14076	 * @param {string} functionName - The name of the function to fetch a pointer to.
14077	 * @returns {(function|object|null)}
14078	 */
14079	F.getFnPointer = function(functionName){
14080		if (F.is.emptyString(functionName)) return null;
14081		var pointer = window,
14082			parts = functionName.split('.');
14083		F.arr.each(parts, function(part){
14084			if (pointer[part]) pointer = pointer[part];
14085		});
14086		return F.is.fn(pointer) ? pointer : null;
14087	};
14088
14089	/**
14090	 * Checks the value for function properties such as the {@link FooTable.Column#formatter} option which could also be specified using just the name
14091	 * and attempts to return the correct function pointer or null if none was found matching the value.
14092	 * @param {FooTable.Class} self - The class to use as the 'this' keyword within the context of the function.
14093	 * @param {(function|string)} value - The actual function or the name of the function for the property.
14094	 * @param {function} [def] - A default function to return if none is found.
14095	 * @returns {(function|null)}
14096	 */
14097	F.checkFnValue = function(self, value, def){
14098		def = F.is.fn(def) ? def : null;
14099		function wrap(t, fn, d){
14100			if (!F.is.fn(fn)) return d;
14101			return function(){
14102				return fn.apply(t, arguments);
14103			};
14104		}
14105		return F.is.fn(value) ? wrap(self, value, def) : (F.is.type(value, 'string') ? wrap(self, F.getFnPointer(value), def) : def);
14106	};
14107
14108})(jQuery, FooTable);
14109(function($, F){
14110
14111	F.Cell = F.Class.extend(/** @lends FooTable.Cell */{
14112		/**
14113		 * The cell class containing all the properties for cells.
14114		 * @constructs
14115		 * @extends FooTable.Class
14116		 * @param {FooTable.Table} table -  The root {@link FooTable.Table} this cell belongs to.
14117		 * @param {FooTable.Row} row - The parent {@link FooTable.Row} this cell belongs to.
14118		 * @param {FooTable.Column} column - The {@link FooTable.Column} this cell falls under.
14119		 * @param {(*|HTMLElement|jQuery)} valueOrElement - Either the value or the element for the cell.
14120		 * @returns {FooTable.Cell}
14121		 * @this FooTable.Cell
14122		 */
14123		construct: function (table, row, column, valueOrElement) {
14124			/**
14125			 * The root {@link FooTable.Table} for the cell.
14126			 * @instance
14127			 * @readonly
14128			 * @type {FooTable.Table}
14129			 */
14130			this.ft = table;
14131			/**
14132			 * The parent {@link FooTable.Row} for the cell.
14133			 * @instance
14134			 * @readonly
14135			 * @type {FooTable.Row}
14136			 */
14137			this.row = row;
14138			/**
14139			 * The {@link FooTable.Column} this cell falls under.
14140			 * @instance
14141			 * @readonly
14142			 * @type {FooTable.Column}
14143			 */
14144			this.column = column;
14145			this.created = false;
14146			this.define(valueOrElement);
14147		},
14148		/**
14149		 * This is supplied either the value or the cell element/jQuery object if it exists.
14150		 * If supplied the element we need set the $el property and parse the value from it.
14151		 * @instance
14152		 * @protected
14153		 * @param {(*|jQuery)} valueOrElement - The value or element to define the cell.
14154		 * @this FooTable.Cell
14155		 */
14156		define: function(valueOrElement){
14157			/**
14158			 * The jQuery table cell object this instance wraps.
14159			 * @instance
14160			 * @type {jQuery}
14161			 */
14162			this.$el = F.is.element(valueOrElement) || F.is.jq(valueOrElement) ? $(valueOrElement) : null;
14163			/**
14164			 * The jQuery row object that represents this cell in the details table.
14165			 * @type {jQuery}
14166			 */
14167			this.$detail = null;
14168
14169			var hasOptions = F.is.hash(valueOrElement) && F.is.hash(valueOrElement.options) && F.is.defined(valueOrElement.value);
14170
14171			/**
14172			 * The value of the cell.
14173			 * @instance
14174			 * @type {*}
14175			 */
14176			this.value = this.column.parser.call(this.column, F.is.jq(this.$el) ? this.$el : (hasOptions ? valueOrElement.value : valueOrElement), this.ft.o);
14177
14178			/**
14179			 * Contains any options for the cell. These are the options supplied through the plugin constructor as part of the row object itself.
14180			 * @type {object}
14181			 */
14182			this.o = $.extend(true, {
14183				classes: null,
14184				style: null
14185			}, hasOptions ? valueOrElement.options : {});
14186			/**
14187			 * An array of CSS classes for the cell.
14188			 * @instance
14189			 * @protected
14190			 * @type {Array.<string>}
14191			 */
14192			this.classes = F.is.jq(this.$el) && this.$el.attr('class') ? this.$el.attr('class').match(/\S+/g) : (F.is.array(this.o.classes) ? this.o.classes : (F.is.string(this.o.classes) ? this.o.classes.match(/\S+/g) : []));
14193			/**
14194			 * The inline styles for the cell.
14195			 * @instance
14196			 * @protected
14197			 * @type {object}
14198			 */
14199			this.style = F.is.jq(this.$el) && this.$el.attr('style') ? F.css2json(this.$el.attr('style')) : (F.is.hash(this.o.style) ? this.o.style : (F.is.string(this.o.style) ? F.css2json(this.o.style) : {}));
14200		},
14201		/**
14202		 * After the cell has been defined this ensures that the $el and #detail properties are jQuery objects by either creating or updating them.
14203		 * @instance
14204		 * @protected
14205		 * @this FooTable.Cell
14206		 */
14207		$create: function(){
14208			if (this.created) return;
14209			/*if(F.is.jq(this.$el))
14210			{*/
14211			(this.$el = F.is.jq(this.$el) ? this.$el : $('<td/>'))
14212				.data('value', this.value)
14213				.contents().detach().end()
14214				.append(this.format(this.value));
14215
14216			this._setClasses(this.$el);
14217			this._setStyle(this.$el);
14218
14219			this.$detail = $('<tr/>').addClass(this.row.classes.join(' '))
14220				.data('__FooTableCell__', this)
14221				.append($('<th/>'))
14222				.append($('<td/>'));
14223			// }
14224			this.created = true;
14225		},
14226		/**
14227		 * Collapses this cell and displays it in the details row.
14228		 * @instance
14229		 * @protected
14230		 */
14231		collapse: function(){
14232			if (!this.created) return;
14233			this.$detail.children('th').html(this.column.title);
14234			this.$el.clone()
14235				.attr('id', this.$el.attr('id') ? this.$el.attr('id') + '-detail' : undefined)
14236				.css('display', 'table-cell')
14237				.html('')
14238				.append(this.$el.contents().detach())
14239				.replaceAll(this.$detail.children('td').first());
14240
14241			if (!F.is.jq(this.$detail.parent()))
14242				this.$detail.appendTo(this.row.$details.find('.footable-details > tbody'));
14243		},
14244		/**
14245		 * Restores this cell from a detail row back into the normal row.
14246		 * @instance
14247		 * @protected
14248		 */
14249		restore: function(){
14250			if (!this.created) return;
14251			if (F.is.jq(this.$detail.parent())){
14252				var $cell = this.$detail.children('td').first();
14253				this.$el
14254					.attr('class', $cell.attr('class'))
14255					.attr('style', $cell.attr('style'))
14256					.css('display', (this.column.hidden || !this.column.visible) ? 'none' : 'table-cell')
14257					.append($cell.contents().detach());
14258			}
14259			this.$detail.detach();
14260		},
14261		/**
14262		 * Helper method to call this cell's column parser function supplying the required parameters.
14263		 * @instance
14264		 * @protected
14265		 * @returns {*}
14266		 * @see FooTable.Column#parser
14267		 * @this FooTable.Cell
14268		 */
14269		parse: function(){
14270			return this.column.parser.call(this.column, this.$el, this.ft.o);
14271		},
14272		/**
14273		 * Helper method to call this cell's column formatter function using the supplied value and any additional required parameters.
14274		 * @instance
14275		 * @protected
14276		 * @param {*} value - The value to format.
14277		 * @returns {(string|HTMLElement|jQuery)}
14278		 * @see FooTable.Column#formatter
14279		 * @this FooTable.Cell
14280		 */
14281		format: function(value){
14282			return this.column.formatter.call(this.column, value, this.ft.o, this.row.value);
14283		},
14284		/**
14285		 * Allows easy access to getting or setting the cell's value. If the value is set all associated properties are also updated along with the actual element.
14286		 * Using this method also allows us to supply an object containing options and the value for the cell.
14287		 * @instance
14288		 * @param {*} [value] - The value to set for the cell. If not supplied the current value of the cell is returned.
14289		 * @param {boolean} [redraw=true] - Whether or not to redraw the row once the value has been set.
14290		 * @param {boolean} [redrawSelf=true] - Whether or not to redraw the cell itself once the value has been set, if `false` this will override the supplied `redraw` value and prevent the row from redrawing as well.
14291		 * @returns {(*|undefined)}
14292		 * @this FooTable.Cell
14293		 */
14294		val: function(value, redraw, redrawSelf){
14295			if (F.is.undef(value)){
14296				// get
14297				return this.value;
14298			}
14299			// set
14300			var self = this, hasOptions = F.is.hash(value) && F.is.hash(value.options) && F.is.defined(value.value);
14301			this.o = $.extend(true, {
14302				classes: self.classes,
14303				style: self.style
14304			}, hasOptions ? value.options : {});
14305
14306			this.value = hasOptions ? value.value : value;
14307			this.classes = F.is.array(this.o.classes) ? this.o.classes : (F.is.string(this.o.classes) ? this.o.classes.match(/\S+/g) : []);
14308			this.style = F.is.hash(this.o.style) ? this.o.style : (F.is.string(this.o.style) ? F.css2json(this.o.style) : {});
14309
14310			redrawSelf = F.is.boolean(redrawSelf) ? redrawSelf : true;
14311			if (this.created && redrawSelf){
14312				this.$el.data('value', this.value).empty();
14313
14314				var $detail = this.$detail.children('td').first().empty(),
14315					$target = F.is.jq(this.$detail.parent()) ? $detail : this.$el;
14316
14317				$target.append(this.format(this.value));
14318
14319				this._setClasses($target);
14320				this._setStyle($target);
14321
14322				if (F.is.boolean(redraw) ? redraw : true) this.row.draw();
14323			}
14324		},
14325		_setClasses: function($el){
14326			var hasColClasses = !F.is.emptyArray(this.column.classes),
14327				hasClasses = !F.is.emptyArray(this.classes),
14328				classes = null;
14329			$el.removeAttr('class');
14330			if (!hasColClasses && !hasClasses) return;
14331			if (hasColClasses && hasClasses){
14332				classes = this.classes.concat(this.column.classes).join(' ');
14333			} else if (hasColClasses) {
14334				classes = this.column.classes.join(' ');
14335			} else if (hasClasses){
14336				classes = this.classes.join(' ');
14337			}
14338			if (!F.is.emptyString(classes)){
14339				$el.addClass(classes);
14340			}
14341		},
14342		_setStyle: function($el){
14343			var hasColStyle = !F.is.emptyObject(this.column.style),
14344				hasStyle = !F.is.emptyObject(this.style),
14345				style = null;
14346			$el.removeAttr('style');
14347			if (!hasColStyle && !hasStyle) return;
14348			if (hasColStyle && hasStyle){
14349				style = $.extend({}, this.column.style, this.style);
14350			} else if (hasColStyle) {
14351				style = this.column.style;
14352			} else if (hasStyle){
14353				style = this.style;
14354			}
14355			if (F.is.hash(style)){
14356				$el.css(style);
14357			}
14358		}
14359	});
14360
14361})(jQuery, FooTable);
14362(function($, F){
14363
14364	F.Column = F.Class.extend(/** @lends FooTable.Column */{
14365		/**
14366		 * The column class containing all the properties for columns. All members marked as "readonly" should not be used when defining {@link FooTable.Defaults#columns}.
14367		 * @constructs
14368		 * @extends FooTable.Class
14369		 * @param {FooTable.Table} instance -  The parent {@link FooTable.Table} this component belongs to.
14370		 * @param {object} definition - An object containing all the properties to set for the column.
14371		 * @param {string} [type] - The type of column, "text" by default.
14372		 * @returns {FooTable.Column}
14373		 * @this FooTable.Column
14374		 */
14375		construct: function(instance, definition, type){
14376			/**
14377			 * The root {@link FooTable.Table} for the column.
14378			 * @instance
14379			 * @readonly
14380			 * @type {FooTable.Table}
14381			 */
14382			this.ft = instance;
14383			/**
14384			 * The type of data displayed by the column.
14385			 * @instance
14386			 * @readonly
14387			 * @type {string}
14388			 */
14389			this.type = F.is.emptyString(type) ? 'text' : type;
14390			/**
14391			 * Whether or not the column was parsed from a standard table row containing data instead of from an actual header row.
14392			 * @instance
14393			 * @readonly
14394			 * @type {boolean}
14395			 */
14396			this.virtual = F.is.boolean(definition.virtual) ? definition.virtual : false;
14397			/**
14398			 * The jQuery cell object for the column header.
14399			 * @instance
14400			 * @readonly
14401			 * @type {jQuery}
14402			 */
14403			this.$el = F.is.jq(definition.$el) ? definition.$el : null;
14404			/**
14405			 * The index of the column in the table. This is set by the plugin during initialization.
14406			 * @instance
14407			 * @readonly
14408			 * @type {number}
14409			 * @default -1
14410			 */
14411			this.index = F.is.number(definition.index) ? definition.index : -1;
14412			/**
14413			 * Whether or not this in an internal only column.
14414			 * @instance
14415			 * @readonly
14416			 * @type {boolean}
14417			 * @description Internal columns or there cells will not be returned when calling methods such as `FooTable.Row#val`.
14418			 */
14419			this.internal = false;
14420			this.define(definition);
14421			this.$create();
14422		},
14423		/**
14424		 * This is supplied the column definition in the form of a simple object created by merging options supplied via the plugin constructor with those parsed from the DOM.
14425		 * @instance
14426		 * @protected
14427		 * @param {object} definition - The object containing the column definition.
14428		 * @this FooTable.Column
14429		 */
14430		define: function(definition){
14431			/**
14432			 * Whether or not this column is hidden from view and appears in the details row.
14433			 * @type {boolean}
14434			 * @default false
14435			 */
14436			this.hidden = F.is.boolean(definition.hidden) ? definition.hidden : false;
14437			/**
14438			 * Whether or not this column is completely hidden from view and will not appear in the details row.
14439			 * @type {boolean}
14440			 * @default true
14441			 */
14442			this.visible = F.is.boolean(definition.visible) ? definition.visible : true;
14443
14444			/**
14445			 * The name of the column. This name must correspond to the property name of the JSON row data.
14446			 * @type {string}
14447			 * @default null
14448			 */
14449			this.name = F.is.string(definition.name) ? definition.name : null;
14450			if (this.name == null) this.name = 'col'+(definition.index+1);
14451			/**
14452			 * The title to display in the column header, this can be HTML.
14453			 * @type {string}
14454			 * @default null
14455			 */
14456			this.title = F.is.string(definition.title) ? definition.title : null;
14457			if (!this.virtual && this.title == null && F.is.jq(this.$el)) this.title = this.$el.html();
14458			if (this.title == null) this.title = 'Column '+(definition.index+1);
14459			/**
14460			 * The styles to apply to all cells in this column.
14461			 * @type {object}
14462			 */
14463			this.style = F.is.hash(definition.style) ? definition.style : (F.is.string(definition.style) ? F.css2json(definition.style) : {});
14464			/**
14465			 * The classes to apply to all cells in this column.
14466			 * @type {Array.<string>}
14467			 */
14468			this.classes = F.is.array(definition.classes) ? definition.classes : (F.is.string(definition.classes) ? definition.classes.match(/\S+/g) : []);
14469
14470			// override any default functions ensuring when they are executed "this" within the context of the function points to the instance of this object.
14471			this.parser = F.checkFnValue(this, definition.parser, this.parser);
14472			this.formatter = F.checkFnValue(this, definition.formatter, this.formatter);
14473		},
14474		/**
14475		 * After the column has been defined this ensures that the $el property is a jQuery object by either creating or updating the current value.
14476		 * @instance
14477		 * @protected
14478		 * @this FooTable.Column
14479		 */
14480		$create: function(){
14481			(this.$el = !this.virtual && F.is.jq(this.$el) ? this.$el : $('<th/>')).html(this.title).addClass(this.classes.join(' ')).css(this.style);
14482		},
14483		/**
14484		 * This is supplied either the cell value or jQuery object to parse. Any value can be returned from this method and will be provided to the {@link FooTable.Column#format} function
14485		 * to generate the cell contents.
14486		 * @instance
14487		 * @protected
14488		 * @param {(*|jQuery)} valueOrElement - The value or jQuery cell object.
14489		 * @returns {string}
14490		 * @this FooTable.Column
14491		 */
14492		parser: function(valueOrElement){
14493			if (F.is.element(valueOrElement) || F.is.jq(valueOrElement)){ // use jQuery to get the value
14494				var data = $(valueOrElement).data('value');
14495				return F.is.defined(data) ? data : $(valueOrElement).html();
14496			}
14497			if (F.is.defined(valueOrElement) && valueOrElement != null) return valueOrElement+''; // use the native toString of the value
14498			return null; // otherwise we have no value so return null
14499		},
14500		/**
14501		 * This is supplied the value retrieved from the {@link FooTable.Column#parse} function and must return a string, HTMLElement or jQuery object.
14502		 * The return value from this function is what is displayed in the cell in the table.
14503		 * @instance
14504		 * @protected
14505		 * @param {string} value - The value to format.
14506		 * @param {object} options - The current plugin options.
14507		 * @param {object} rowData - An object containing the current row data.
14508		 * @returns {(string|HTMLElement|jQuery)}
14509		 * @this FooTable.Column
14510		 */
14511		formatter: function(value, options, rowData){
14512			return value == null ? '' : value;
14513		},
14514		/**
14515		 * Creates a cell for this column from the supplied {@link FooTable.Row} object. This allows different column types to return different types of cells.
14516		 * @instance
14517		 * @protected
14518		 * @param {FooTable.Row} row - The row to create the cell from.
14519		 * @returns {FooTable.Cell}
14520		 * @this FooTable.Column
14521		 */
14522		createCell: function(row){
14523			var element = F.is.jq(row.$el) ? row.$el.children('td,th').get(this.index) : null,
14524				data = F.is.hash(row.value) ? row.value[this.name] : null;
14525			return new F.Cell(this.ft, row, this, element || data);
14526		}
14527	});
14528
14529	F.columns = new F.ClassFactory();
14530
14531	F.columns.register('text', F.Column);
14532
14533})(jQuery, FooTable);
14534(function ($, F) {
14535
14536	F.Component = F.Class.extend(/** @lends FooTable.Component */{
14537		/**
14538		 * The base class for all FooTable components.
14539		 * @constructs
14540		 * @extends FooTable.Class
14541		 * @param {FooTable.Table} instance - The parent {@link FooTable.Table} object for the component.
14542		 * @param {boolean} enabled - Whether or not the component is enabled.
14543		 * @throws {TypeError} The instance parameter must be an instance of {@link FooTable.Table}.
14544		 * @returns {FooTable.Component}
14545		 */
14546		construct: function (instance, enabled) {
14547			if (!(instance instanceof F.Table))
14548				throw new TypeError('The instance parameter must be an instance of FooTable.Table.');
14549
14550			/**
14551			 * The parent {@link FooTable.Table} for the component.
14552			 * @type {FooTable.Table}
14553			 */
14554			this.ft = instance;
14555			/**
14556			 * Whether or not this component is enabled. Disabled components only have there preinit method called allowing for this value to be overridden.
14557			 * @type {boolean}
14558			 */
14559			this.enabled = F.is.boolean(enabled) ? enabled : false;
14560		},
14561		/**
14562		 * The preinit method is called during the parent {@link FooTable.Table} constructor call.
14563		 * @param {object} data - The jQuery.data() object of the root table.
14564		 * @instance
14565		 * @protected
14566		 * @function
14567		 */
14568		preinit: function(data){},
14569		/**
14570		 * The init method is called during the parent {@link FooTable.Table} constructor call.
14571		 * @instance
14572		 * @protected
14573		 * @function
14574		 */
14575		init: function(){},
14576		/**
14577		 * This method is called from the {@link FooTable.Table#destroy} method.
14578		 * @instance
14579		 * @protected
14580		 * @function
14581		 */
14582		destroy: function(){},
14583		/**
14584		 * This method is called from the {@link FooTable.Table#draw} method.
14585		 * @instance
14586		 * @protected
14587		 * @function
14588		 */
14589		predraw: function(){},
14590		/**
14591		 * This method is called from the {@link FooTable.Table#draw} method.
14592		 * @instance
14593		 * @protected
14594		 * @function
14595		 */
14596		draw: function(){},
14597		/**
14598		 * This method is called from the {@link FooTable.Table#draw} method.
14599		 * @instance
14600		 * @protected
14601		 * @function
14602		 */
14603		postdraw: function(){}
14604	});
14605
14606	F.components = new F.ClassFactory();
14607
14608})(jQuery, FooTable);
14609(function ($, F) {
14610	/**
14611	 * Contains all the available options for the FooTable plugin.
14612	 * @name FooTable.Defaults
14613	 * @function
14614	 * @constructor
14615	 * @returns {FooTable.Defaults}
14616	 */
14617	F.Defaults = function () {
14618		/**
14619		 * Whether or not events raised using the {@link FooTable.Table#raise} method are propagated up the DOM. By default this is set to false and all events bubble up the DOM as per usual
14620		 * however the reason for this option is if we have nested tables. If false the parent table would receive all the events raised by it's children and any handlers bound to both the
14621		 * parent and child would be triggered which is not the desired behavior.
14622		 * @type {boolean}
14623		 * @default false
14624		 */
14625		this.stopPropagation = false;
14626		/**
14627		 * An object in which the string keys represent one or more space-separated event types and optional namespaces, and the values represent a handler function to be called for the event(s).
14628		 * @type {object.<string, function>}
14629		 * @default NULL
14630		 * @example <caption>
14630This example shows how to pass an object containing the events and handlers.</caption>
14631		 * "on": {
14632		 * 	"click": function(e){
14633		 * 		// bind a custom click event to do something whenever the table is clicked
14634		 * 	},
14635		 * 	"init.ft.table": function(e, ft){
14636		 * 		// bind to the FooTable initialize event to do something
14637		 * 	}
14638		 * }
14639		 */
14640		this.on = null;
14641	};
14642
14643	/**
14644	 * Contains all the default options for the plugin.
14645	 * @type {FooTable.Defaults}
14646	 */
14647	F.defaults = new F.Defaults();
14648
14649})(jQuery, FooTable);
14650(function($, F){
14651
14652	F.Row = F.Class.extend(/** @lends FooTable.Row */{
14653		/**
14654		 * The row class containing all the properties for a row and its' cells.
14655		 * @constructs
14656		 * @extends FooTable.Class
14657		 * @param {FooTable.Table} table -  The parent {@link FooTable.Table} this component belongs to.
14658		 * @param {Array.<FooTable.Column>} columns - The array of {@link FooTable.Column} for this row.
14659		 * @param {(*|HTMLElement|jQuery)} dataOrElement - Either the data for the row (create) or the element (parse) for the row.
14660		 * @returns {FooTable.Row}
14661		 */
14662		construct: function (table, columns, dataOrElement) {
14663			/**
14664			 * The {@link FooTable.Table} for the row.
14665			 * @type {FooTable.Table}
14666			 */
14667			this.ft = table;
14668			/**
14669			 * The array of {@link FooTable.Column} for this row.
14670			 * @type {Array.<FooTable.Column>}
14671			 */
14672			this.columns = columns;
14673
14674			this.created = false;
14675			this.define(dataOrElement);
14676		},
14677		/**
14678		 * This is supplied either the object containing the values for the row or the row element/jQuery object if it exists.
14679		 * If supplied the element we need to set the $el property and parse the cells from it using the column index.
14680		 * If we have an object we parse the cells from it using the column name.
14681		 * @param {(object|jQuery)} dataOrElement - The row object or element to define the row.
14682		 */
14683		define: function(dataOrElement){
14684			/**
14685			 * The jQuery table row object this instance wraps.
14686			 * @instance
14687			 * @protected
14688			 * @type {jQuery}
14689			 */
14690			this.$el = F.is.element(dataOrElement) || F.is.jq(dataOrElement) ? $(dataOrElement) : null;
14691			/**
14692			 * The jQuery toggle element for the row.
14693			 * @instance
14694			 * @protected
14695			 * @type {jQuery}
14696			 */
14697			this.$toggle = $('<span/>', {'class': 'footable-toggle fooicon fooicon-plus'});
14698
14699			var isObj = F.is.hash(dataOrElement),
14700				hasOptions = isObj && F.is.hash(dataOrElement.options) && F.is.hash(dataOrElement.value);
14701
14702			/**
14703			 * The value of the row.
14704			 * @instance
14705			 * @protected
14706			 * @type {Object}
14707			 */
14708			this.value = isObj ? (hasOptions ? dataOrElement.value : dataOrElement) : null;
14709
14710			/**
14711			 * Contains any options for the row.
14712			 * @type {object}
14713			 */
14714			this.o = $.extend(true, {
14715				expanded: false,
14716				classes: null,
14717				style: null
14718			}, hasOptions ? dataOrElement.options : {});
14719
14720			/**
14721			 * Whether or not this row is expanded and will display it's detail row when there are any hidden columns.
14722			 * @instance
14723			 * @protected
14724			 * @type {boolean}
14725			 */
14726			this.expanded = F.is.jq(this.$el) ? (this.$el.data('expanded') || this.o.expanded) : this.o.expanded;
14727			/**
14728			 * An array of CSS classes for the row.
14729			 * @instance
14730			 * @protected
14731			 * @type {Array.<string>}
14732			 */
14733			this.classes = F.is.jq(this.$el) && this.$el.attr('class') ? this.$el.attr('class').match(/\S+/g) : (F.is.array(this.o.classes) ? this.o.classes : (F.is.string(this.o.classes) ? this.o.classes.match(/\S+/g) : []));
14734			/**
14735			 * The inline styles for the row.
14736			 * @instance
14737			 * @protected
14738			 * @type {object}
14739			 */
14740			this.style = F.is.jq(this.$el) && this.$el.attr('style') ? F.css2json(this.$el.attr('style')) : (F.is.hash(this.o.style) ? this.o.style : (F.is.string(this.o.style) ? F.css2json(this.o.style) : {}));
14741
14742			/**
14743			 * The cells array. This is populated before the call to the {@link FooTable.Row#$create} method.
14744			 * @instance
14745			 * @type {Array.<FooTable.Cell>}
14746			 */
14747			this.cells = this.createCells();
14748
14749			// this ensures the value contains the parsed cell values and not the supplied values
14750			var self = this;
14751			self.value = {};
14752			F.arr.each(self.cells, function(cell){
14753				self.value[cell.column.name] = cell.val();
14754			});
14755		},
14756		/**
14757		 * After the row has been defined this ensures that the $el property is a jQuery object by either creating or updating the current value.
14758		 * @instance
14759		 * @protected
14760		 * @this FooTable.Row
14761		 */
14762		$create: function(){
14763			if (this.created) return;
14764			(this.$el = F.is.jq(this.$el) ? this.$el : $('<tr/>'))
14765				.data('__FooTableRow__', this);
14766
14767			this._setClasses(this.$el);
14768			this._setStyle(this.$el);
14769
14770			if (this.ft.rows.toggleColumn == 'last') this.$toggle.addClass('last-column');
14771
14772			this.$details = $('<tr/>', { 'class': 'footable-detail-row' })
14773				.append($('<td/>', { colspan: this.ft.columns.visibleColspan })
14774					.append($('<table/>', { 'class': 'footable-details ' + this.ft.classes.join(' ') })
14775						.append('<tbody/>')));
14776
14777			var self = this;
14778			F.arr.each(self.cells, function(cell){
14779				if (!cell.created) cell.$create();
14780				self.$el.append(cell.$el);
14781			});
14782			self.$el.off('click.ft.row').on('click.ft.row', { self: self }, self._onToggle);
14783			this.created = true;
14784		},
14785		/**
14786		 * This is called during the construct method and uses the current column definitions to create an array of {@link FooTable.Cell} objects for the row.
14787		 * @instance
14788		 * @protected
14789		 * @returns {Array.<FooTable.Cell>}
14790		 * @this FooTable.Row
14791		 */
14792		createCells: function(){
14793			var self = this;
14794			return F.arr.map(self.columns, function(col){
14795				return col.createCell(self);
14796			});
14797		},
14798		/**
14799		 * Allows easy access to getting or setting the row's data. If the data is set all associated properties are also updated along with the actual element.
14800		 * Using this method also allows us to supply an object containing options and the data for the row at the same time.
14801		 * @instance
14802		 * @param {object} [data] - The data to set for the row. If not supplied the current value of the row is returned.
14803		 * @param {boolean} [redraw=true] - Whether or not to redraw the table once the value has been set.
14804		 * @param {boolean} [redrawSelf=true] - Whether or not to redraw the row itself once the value has been set, if `false` this will override the supplied `redraw` value and prevent the table from redrawing as well.
14805		 * @returns {(*|undefined)}
14806		 */
14807		val: function(data, redraw, redrawSelf){
14808			var self = this;
14809			if (!F.is.hash(data)){
14810				// get - check the value property and build it from the cells if required.
14811				if (!F.is.hash(this.value) || F.is.emptyObject(this.value)){
14812					this.value = {};
14813					F.arr.each(this.cells, function(cell){
14814						if (!cell.column.internal){
14815							self.value[cell.column.name] = cell.val();
14816						}
14817					});
14818				}
14819				return this.value;
14820			}
14821			// set
14822			this.collapse(false);
14823			var isObj = F.is.hash(data),
14824				hasOptions = isObj && F.is.hash(data.options) && F.is.hash(data.value);
14825
14826			this.o = $.extend(true, {
14827				expanded: self.expanded,
14828				classes: self.classes,
14829				style: self.style
14830			}, hasOptions ? data.options : {});
14831
14832			this.expanded = this.o.expanded;
14833			this.classes = F.is.array(this.o.classes) ? this.o.classes : (F.is.string(this.o.classes) ? this.o.classes.match(/\S+/g) : []);
14834			this.style = F.is.hash(this.o.style) ? this.o.style : (F.is.string(this.o.style) ? F.css2json(this.o.style) : {});
14835			if (isObj) {
14836				if ( hasOptions ) data = data.value;
14837				if (F.is.hash(this.value)){
14838					for (var prop in data) {
14839						if (!data.hasOwnProperty(prop)) continue;
14840						this.value[prop] = data[prop];
14841					}
14842				} else {
14843					this.value = data;
14844				}
14845			} else {
14846				this.value = null;
14847			}
14848
14849			redrawSelf = F.is.boolean(redrawSelf) ? redrawSelf : true;
14850			F.arr.each(this.cells, function(cell){
14851				if (!cell.column.internal && F.is.defined(self.value[cell.column.name])){
14852					cell.val(self.value[cell.column.name], false, redrawSelf);
14853				}
14854			});
14855
14856			if (this.created && redrawSelf){
14857				this._setClasses(this.$el);
14858				this._setStyle(this.$el);
14859				if (F.is.boolean(redraw) ? redraw : true) this.draw();
14860			}
14861		},
14862		_setClasses: function($el){
14863			var hasClasses = !F.is.emptyArray(this.classes),
14864				classes = null;
14865			$el.removeAttr('class');
14866			if (!hasClasses) return;
14867			else classes = this.classes.join(' ');
14868			if (!F.is.emptyString(classes)){
14869				$el.addClass(classes);
14870			}
14871		},
14872		_setStyle: function($el){
14873			var hasStyle = !F.is.emptyObject(this.style),
14874				style = null;
14875			$el.removeAttr('style');
14876			if (!hasStyle) return;
14877			else style = this.style;
14878			if (F.is.hash(style)){
14879				$el.css(style);
14880			}
14881		},
14882		/**
14883		 * Sets the current row to an expanded state displaying any hidden columns in a detail row just below it.
14884		 * @instance
14885		 * @fires FooTable.Row#"expand.ft.row"
14886		 */
14887		expand: function(){
14888			if (!this.created) return;
14889			var self = this;
14890			/**
14891			 * The expand.ft.row event is raised before the the row is expanded.
14892			 * Calling preventDefault on this event will stop the row being expanded.
14893			 * @event FooTable.Row#"expand.ft.row"
14894			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
14895			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
14896			 * @param {FooTable.Row} row - The row about to be expanded.
14897			 */
14898			self.ft.raise('expand.ft.row',[self]).then(function(){
14899				self.__hidden__ = F.arr.map(self.cells, function(cell){
14900					return cell.column.hidden && cell.column.visible ? cell : null;
14901				});
14902
14903				if (self.__hidden__.length > 0){
14904					self.$details.insertAfter(self.$el)
14905						.children('td').first()
14906						.attr('colspan', self.ft.columns.visibleColspan);
14907
14908					F.arr.each(self.__hidden__, function(cell){
14909						cell.collapse();
14910					});
14911				}
14912				self.$el.attr('data-expanded', true);
14913				self.$toggle.removeClass('fooicon-plus').addClass('fooicon-minus');
14914				self.expanded = true;
14915				self.ft.raise('expanded.ft.row', [self]);
14916			});
14917		},
14918		/**
14919		 * Sets the current row to a collapsed state removing the detail row if it exists.
14920		 * @instance
14921		 * @param {boolean} [setExpanded] - Whether or not to set the {@link FooTable.Row#expanded} property to false.
14922		 * @fires FooTable.Row#"collapse.ft.row"
14923		 */
14924		collapse: function(setExpanded){
14925			if (!this.created) return;
14926			var self = this;
14927			/**
14928			 * The collapse.ft.row event is raised before the the row is collapsed.
14929			 * Calling preventDefault on this event will stop the row being collapsed.
14930			 * @event FooTable.Row#"collapse.ft.row"
14931			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
14932			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
14933			 * @param {FooTable.Row} row - The row about to be expanded.
14934			 */
14935			self.ft.raise('collapse.ft.row',[self]).then(function(){
14936				F.arr.each(self.__hidden__, function(cell){
14937					cell.restore();
14938				});
14939				self.$details.detach();
14940				self.$el.removeAttr('data-expanded');
14941				self.$toggle.removeClass('fooicon-minus').addClass('fooicon-plus');
14942				if (F.is.boolean(setExpanded) ? setExpanded : true) self.expanded = false;
14943				self.ft.raise('collapsed.ft.row', [self]);
14944			});
14945		},
14946		/**
14947		 * Prior to drawing this moves the details contents back to there original cells and detaches the toggle element from the row.
14948		 * @instance
14949		 * @param {boolean} [detach] - Whether or not to detach the row.
14950		 * @this FooTable.Row
14951		 */
14952		predraw: function(detach){
14953			if (this.created){
14954				if (this.expanded){
14955					this.collapse(false);
14956				}
14957				this.$toggle.detach();
14958				detach = F.is.boolean(detach) ? detach : true;
14959				if (detach) this.$el.detach();
14960			}
14961		},
14962		/**
14963		 * Draws the current row and cells.
14964		 * @instance
14965		 * @this FooTable.Row
14966		 */
14967		draw: function($parent){
14968			if (!this.created) this.$create();
14969			if (F.is.jq($parent)) $parent.append(this.$el);
14970			var self = this;
14971			F.arr.each(self.cells, function(cell){
14972				cell.$el.css('display', (cell.column.hidden || !cell.column.visible  ? 'none' : 'table-cell'));
14973				if (self.ft.rows.showToggle && self.ft.columns.hasHidden){
14974					if ((self.ft.rows.toggleColumn == 'first' && cell.column.index == self.ft.columns.firstVisibleIndex)
14975						|| (self.ft.rows.toggleColumn == 'last' && cell.column.index == self.ft.columns.lastVisibleIndex)) {
14976						cell.$el.prepend(self.$toggle);
14977					}
14978				}
14979				cell.$el.add(cell.column.$el).removeClass('footable-first-visible footable-last-visible');
14980				if (cell.column.index == self.ft.columns.firstVisibleIndex){
14981					cell.$el.add(cell.column.$el).addClass('footable-first-visible');
14982				}
14983				if (cell.column.index == self.ft.columns.lastVisibleIndex){
14984					cell.$el.add(cell.column.$el).addClass('footable-last-visible');
14985				}
14986			});
14987			if (this.expanded){
14988				this.expand();
14989			}
14990		},
14991		/**
14992		 * Toggles the row between it's expanded and collapsed state if there are hidden columns.
14993		 * @instance
14994		 * @this FooTable.Row
14995		 */
14996		toggle: function(){
14997			if (this.created && this.ft.columns.hasHidden){
14998				if (this.expanded) this.collapse();
14999				else this.expand();
15000			}
15001		},
15002		/**
15003		 * Handles the toggle click event for rows.
15004		 * @instance
15005		 * @param {jQuery.Event} e - The jQuery.Event object for the click event.
15006		 * @private
15007		 * @this jQuery
15008		 */
15009		_onToggle: function (e) {
15010			var self = e.data.self;
15011			// only execute the toggle if the event.target is one of the approved initiators
15012			if ($(e.target).is(self.ft.rows.toggleSelector)){
15013				self.toggle();
15014			}
15015		}
15016	});
15017
15018})(jQuery, FooTable);
15019
15020(function ($, F) {
15021
15022	/**
15023	 * An array of all currently loaded instances of the plugin.
15024	 * @protected
15025	 * @readonly
15026	 * @type {Array.<FooTable.Table>}
15027	 */
15028	F.instances = [];
15029
15030	F.Table = F.Class.extend(/** @lends FooTable.Table */{
15031		/**
15032		 * This class is the core of the plugin and drives the logic of all components.
15033		 * @constructs
15034		 * @this FooTable.Table
15035		 * @extends FooTable.Class
15036		 * @param {(HTMLTableElement|jQuery)} element - The element or jQuery table object to bind the plugin to.
15037		 * @param {object} options - The options to initialize the plugin with.
15038		 * @param {function} [ready] - A callback function to execute once the plugin is initialized.
15039		 * @returns {FooTable.Table}
15040		 */
15041		construct: function (element, options, ready) {
15042			//BEGIN MEMBERS
15043			/**
15044			 * The timeout ID for the resize event.
15045			 * @instance
15046			 * @private
15047			 * @type {?number}
15048			 */
15049			this._resizeTimeout = null;
15050			/**
15051			 * The ID of the FooTable instance.
15052			 * @instance
15053			 * @type {number}
15054			 */
15055			this.id = F.instances.push(this);
15056			/**
15057			 * Whether or not the plugin and all components and add-ons are fully initialized.
15058			 * @instance
15059			 * @type {boolean}
15060			 */
15061			this.initialized = false;
15062			/**
15063			 * The jQuery table object the plugin is bound to.
15064			 * @instance
15065			 * @type {jQuery}
15066			 */
15067			this.$el = (F.is.jq(element) ? element : $(element)).first(); // ensure one table, one instance
15068			/**
15069			 * A loader jQuery instance
15070			 * @instance
15071			 * @type {jQuery}
15072			 */
15073			this.$loader = $('<div/>', { 'class': 'footable-loader' }).append($('<span/>', {'class': 'fooicon fooicon-loader'}));
15074			/**
15075			 * The options for the plugin. This is a merge of user defined options and the default options.
15076			 * @instance
15077			 * @type {object}
15078			 */
15079			this.o = $.extend(true, {}, F.defaults, options);
15080			/**
15081			 * The jQuery data object for the table at initialization.
15082			 * @instance
15083			 * @type {object}
15084			 */
15085			this.data = this.$el.data() || {};
15086			/**
15087			 * An array of all CSS classes on the table that do not start with "footable".
15088			 * @instance
15089			 * @protected
15090			 * @type {Array.<string>}
15091			 */
15092			this.classes = [];
15093			/**
15094			 * All components for this instance of the plugin. These are executed in the order they appear in the array for the initialize phase and in reverse order for the destroy phase of the plugin.
15095			 * @instance
15096			 * @protected
15097			 * @type {object}
15098			 * @prop {Array.<FooTable.Component>} internal - The internal components for the plugin. These are executed either before all other components in the initialize phase or after them in the destroy phase of the plugin.
15099			 * @prop {Array.<FooTable.Component>} core - The core components for the plugin. These are executed either after the internal components in the initialize phase or before them in the destroy phase of the plugin.
15100			 * @prop {Array.<FooTable.Component>} custom - The custom components for the plugin. These are executed either after the core components in the initialize phase or before them in the destroy phase of the plugin.
15101			 */
15102			this.components = F.components.load((F.is.hash(this.data.components) ? this.data.components : this.o.components), this);
15103			/**
15104			 * The breakpoints component for this instance of the plugin.
15105			 * @instance
15106			 * @type {FooTable.Breakpoints}
15107			 */
15108			this.breakpoints = this.use(FooTable.Breakpoints);
15109			/**
15110			 * The columns component for this instance of the plugin.
15111			 * @instance
15112			 * @type {FooTable.Columns}
15113			 */
15114			this.columns = this.use(FooTable.Columns);
15115			/**
15116			 * The rows component for this instance of the plugin.
15117			 * @instance
15118			 * @type {FooTable.Rows}
15119			 */
15120			this.rows = this.use(FooTable.Rows);
15121
15122			//END MEMBERS
15123			this._construct(ready);
15124		},
15125		/**
15126		 * Once all properties are set this performs the actual initialization of the plugin calling the {@link FooTable.Table#_preinit} and
15127		 * {@link FooTable.Table#_init} methods as well as raising the {@link FooTable.Table#"ready.ft.table"} event.
15128		 * @this FooTable.Table
15129		 * @instance
15130		 * @param {function} [ready] - A callback function to execute once the plugin is initialized.
15131		 * @private
15132		 * @returns {jQuery.Promise}
15133		 * @fires FooTable.Table#"ready.ft.table"
15134		 */
15135		_construct: function(ready){
15136			var self = this;
15137			return this._preinit().then(function(){
15138				return self._init().then(function(){
15139					/**
15140					 * The ready.ft.table event is raised after the plugin has been initialized and the table drawn.
15141					 * Calling preventDefault on this event will stop the ready callback being executed.
15142					 * @event FooTable.Table#"ready.ft.table"
15143					 * @param {jQuery.Event} e - The jQuery.Event object for the event.
15144					 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
15145					 */
15146					return self.raise('ready.ft.table').then(function(){
15147						if (F.is.fn(ready)) ready.call(self, self);
15148					});
15149				});
15150			}).always(function(arg){
15151				self.$el.show();
15152				if (F.is.error(arg)){
15153					console.error('FooTable: unhandled error thrown during initialization.', arg);
15154				}
15155			});
15156		},
15157		/**
15158		 * The preinit method is called prior to the plugins actual initialization and provides itself and it's components an opportunity to parse any additional option values.
15159		 * @instance
15160		 * @private
15161		 * @returns {jQuery.Promise}
15162		 * @fires FooTable.Table#"preinit.ft.table"
15163		 */
15164		_preinit: function(){
15165			var self = this;
15166			/**
15167			 * The preinit.ft.table event is raised before any components.
15168			 * Calling preventDefault on this event will disable the entire plugin.
15169			 * @event FooTable.Table#"preinit.ft.table"
15170			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
15171			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
15172			 * @param {object} data - The jQuery data object from the root table element.
15173			 */
15174			return this.raise('preinit.ft.table', [self.data]).then(function(){
15175				var classes = (self.$el.attr('class') || '').match(/\S+/g) || [];
15176
15177				self.o.ajax = F.checkFnValue(self, self.data.ajax, self.o.ajax);
15178				self.o.stopPropagation = F.is.boolean(self.data.stopPropagation)
15179					? self.data.stopPropagation
15180					: self.o.stopPropagation;
15181
15182				for (var i = 0, len = classes.length; i < len; i++){
15183					if (!F.str.startsWith(classes[i], 'footable')) self.classes.push(classes[i]);
15184				}
15185
15186				self.$el.hide().after(self.$loader);
15187				return self.execute(false, false, 'preinit', self.data);
15188			});
15189		},
15190		/**
15191		 * Initializes this instance of the plugin and calls the callback function if one is supplied once complete.
15192		 * @this FooTable.Table
15193		 * @instance
15194		 * @private
15195		 * @return {jQuery.Promise}
15196		 * @fires FooTable.Table#"init.ft.table"
15197		 */
15198		_init: function(){
15199			var self = this;
15200			/**
15201			 * The init.ft.table event is raised before any components are initialized.
15202			 * Calling preventDefault on this event will disable the entire plugin.
15203			 * @event FooTable.Table#"init.ft.table"
15204			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
15205			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
15206			 */
15207			return self.raise('init.ft.table').then(function(){
15208				var $thead = self.$el.children('thead'),
15209					$tbody = self.$el.children('tbody'),
15210					$tfoot = self.$el.children('tfoot');
15211				self.$el.addClass('footable footable-' + self.id);
15212				if (F.is.hash(self.o.on)) self.$el.on(self.o.on);
15213				if ($tfoot.length == 0) self.$el.append($tfoot = $('<tfoot/>'));
15214				if ($tbody.length == 0) self.$el.append('<tbody/>');
15215				if ($thead.length == 0) self.$el.prepend($thead = $('<thead/>'));
15216				return self.execute(false, true, 'init').then(function(){
15217					self.$el.data('__FooTable__', self);
15218					if ($tfoot.children('tr').length == 0) $tfoot.remove();
15219					if ($thead.children('tr').length == 0) $thead.remove();
15220
15221					/**
15222					 * The postinit.ft.table event is raised after any components are initialized but before the table is
15223					 * drawn for the first time.
15224					 * Calling preventDefault on this event will disable the initial drawing of the table.
15225					 * @event FooTable.Table#"postinit.ft.table"
15226					 * @param {jQuery.Event} e - The jQuery.Event object for the event.
15227					 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
15228					 */
15229					return self.raise('postinit.ft.table').then(function(){
15230						return self.draw();
15231					}).always(function(){
15232						$(window).off('resize.ft'+self.id, self._onWindowResize)
15233							.on('resize.ft'+self.id, { self: self }, self._onWindowResize);
15234						self.initialized = true;
15235					});
15236				});
15237			});
15238		},
15239		/**
15240		 * Destroys this plugin removing it from the table.
15241		 * @this FooTable.Table
15242		 * @instance
15243		 * @fires FooTable.Table#"destroy.ft.table"
15244		 */
15245		destroy: function () {
15246			var self = this;
15247			/**
15248			 * The destroy.ft.table event is called before all core components.
15249			 * Calling preventDefault on this event will prevent the entire plugin from being destroyed.
15250			 * @event FooTable.Table#"destroy.ft.table"
15251			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
15252			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
15253			 */
15254			return self.raise('destroy.ft.table').then(function(){
15255				return self.execute(true, true, 'destroy').then(function () {
15256					self.$el.removeData('__FooTable__').removeClass('footable-' + self.id);
15257					if (F.is.hash(self.o.on)) self.$el.off(self.o.on);
15258					$(window).off('resize.ft'+self.id, self._onWindowResize);
15259					self.initialized = false;
15260					F.instances[self.id] = null;
15261				});
15262			}).fail(function(err){
15263				if (F.is.error(err)){
15264					console.error('FooTable: unhandled error thrown while destroying the plugin.', err);
15265				}
15266			});
15267		},
15268		/**
15269		 * Raises an event on this instance supplying the args array as additional parameters to the handlers.
15270		 * @this FooTable.Table
15271		 * @instance
15272		 * @param {string} eventName - The name of the event to raise, this can include namespaces.
15273		 * @param {Array} [args] - An array containing additional parameters to be passed to any boun
15273d handlers.
15274		 * @returns {jQuery.Event}
15275		 */
15276		raise: function(eventName, args){
15277			var self = this,
15278				debug = F.__debug__ && (F.is.emptyArray(F.__debug_options__.events) || F.arr.any(F.__debug_options__.events, function(name){ return F.str.contains(eventName, name); }));
15279			args = args || [];
15280			args.unshift(this);
15281			return $.Deferred(function(d){
15282				var evt = $.Event(eventName);
15283				if (self.o.stopPropagation == true){
15284					self.$el.one(eventName, function (e) {e.stopPropagation();});
15285				}
15286				if (debug) console.log('FooTable:'+eventName+': ', args);
15287				self.$el.trigger(evt, args);
15288				if (evt.isDefaultPrevented()){
15289					if (debug) console.log('FooTable: default prevented for the "'+eventName+'" event.');
15290					d.reject(evt);
15291				}	else d.resolve(evt);
15292			});
15293		},
15294		/**
15295		 * Attempts to retrieve the instance of the supplied component type for this instance.
15296		 * @this FooTable.Table
15297		 * @instance
15298		 * @param {object} type - The content type to retrieve for this instance.
15299		 * @returns {(*|null)}
15300		 */
15301		use: function(type){
15302			for (var i = 0, len = this.components.length; i < len; i++){
15303				if (this.components[i] instanceof type) return this.components[i];
15304			}
15305			return null;
15306		},
15307		/**
15308		 * Performs the drawing of the table.
15309		 * @this FooTable.Table
15310		 * @instance
15311		 * @protected
15312		 * @returns {jQuery.Promise}
15313		 * @fires FooTable.Table#"predraw.ft.table"
15314		 * @fires FooTable.Table#"draw.ft.table"
15315		 * @fires FooTable.Table#"postdraw.ft.table"
15316		 */
15317		draw: function () {
15318			var self = this;
15319
15320			// Clone the current table and insert it into the original's place
15321			var $elCopy = self.$el.clone().insertBefore(self.$el);
15322
15323			// Detach `self.$el` from the DOM, retaining its event handlers
15324			self.$el.detach();
15325
15326			// when drawing the order that the components are executed is important so chain the methods but use promises to retain async safety.
15327			return self.execute(false, true, 'predraw').then(function(){
15328				/**
15329				 * The predraw.ft.table event is raised after all core components and add-ons have executed there predraw functions but before they execute there draw functions.
15330				 * @event FooTable.Table#"predraw.ft.table"
15331				 * @param {jQuery.Event} e - The jQuery.Event object for the event.
15332				 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
15333				 */
15334				return self.raise('predraw.ft.table').then(function(){
15335					return self.execute(false, true, 'draw').then(function(){
15336						/**
15337						 * The draw.ft.table event is raised after all core components and add-ons have executed there draw functions.
15338						 * @event FooTable.Table#"draw.ft.table"
15339						 * @param {jQuery.Event} e - The jQuery.Event object for the event.
15340						 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
15341						 */
15342						return self.raise('draw.ft.table').then(function(){
15343							return self.execute(false, true, 'postdraw').then(function(){
15344								/**
15345								 * The postdraw.ft.table event is raised after all core components and add-ons have executed there postdraw functions.
15346								 * @event FooTable.Table#"postdraw.ft.table"
15347								 * @param {jQuery.Event} e - The jQuery.Event object for the event.
15348								 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
15349								 */
15350								return self.raise('postdraw.ft.table');
15351							});
15352						});
15353					});
15354				});
15355			}).fail(function(err){
15356				if (F.is.error(err)){
15357					console.error('FooTable: unhandled error thrown during a draw operation.', err);
15358				}
15359			}).always(function(){
15360				// Replace the copy that we added above with the modified `self.$el`
15361				$elCopy.replaceWith(self.$el);
15362				self.$loader.remove();
15363			});
15364		},
15365		/**
15366		 * Executes the specified method with the optional number of parameters on all components and waits for the promise from each to be resolved before executing the next.
15367		 * @this FooTable.Table
15368		 * @instance
15369		 * @protected
15370		 * @param {boolean} reverse - Whether or not to execute the component methods in the reverse order to what they were registered in.
15371		 * @param {boolean} enabled - Whether or not to execute the method on enabled components only.
15372		 * @param {string} methodName - The name of the method to execute.
15373		 * @param {*} [param1] - The first parameter for the method.
15374		 * @param {...*} [paramN] - Any number of additional parameters for the method.
15375		 * @returns {jQuery.Promise}
15376		 */
15377		execute: function(reverse, enabled, methodName, param1, paramN){
15378			var self = this, args = Array.prototype.slice.call(arguments);
15379			reverse = args.shift();
15380			enabled = args.shift();
15381			var components = enabled ? F.arr.get(self.components, function(c){ return c.enabled; }) : self.components.slice(0);
15382			args.unshift(reverse ? components.reverse() : components);
15383			return self._execute.apply(self, args);
15384		},
15385		/**
15386		 * Executes the specified method with the optional number of parameters on all supplied components waiting for the result of each before executing the next.
15387		 * @this FooTable.Table
15388		 * @instance
15389		 * @private
15390		 * @param {Array.<FooTable.Component>} components - The components to call the method on.
15391		 * @param {string} methodName - The name of the method to execute
15392		 * @param {*} [param1] - The first parameter for the method.
15393		 * @param {...*} [paramN] - Any additional parameters for the method.
15394		 * @returns {jQuery.Promise}
15395		 */
15396		_execute: function(components, methodName, param1, paramN){
15397			if (!components || !components.length) return $.when();
15398			var self = this, args = Array.prototype.slice.call(arguments),
15399				component;
15400			components = args.shift();
15401			methodName = args.shift();
15402			component = components.shift();
15403
15404			if (!F.is.fn(component[methodName]))
15405				return self._execute.apply(self, [components, methodName].concat(args));
15406
15407			return $.Deferred(function(d){
15408				try {
15409					var result = component[methodName].apply(component, args);
15410					if (F.is.promise(result)){
15411						return result.then(d.resolve, d.reject);
15412					} else {
15413						d.resolve(result);
15414					}
15415				} catch (err) {
15416					d.reject(err);
15417				}
15418			}).then(function(){
15419				return self._execute.apply(self, [components, methodName].concat(args));
15420			});
15421		},
15422		/**
15423		 * Listens to the window resize event and performs a check to see if the breakpoint has changed.
15424		 * @this window
15425		 * @instance
15426		 * @private
15427		 * @fires FooTable.Table#"resize.ft.table"
15428		 */
15429		_onWindowResize: function (e) {
15430			var self = e.data.self;
15431			if (self._resizeTimeout != null) { clearTimeout(self._resizeTimeout); }
15432			self._resizeTimeout = setTimeout(function () {
15433				self._resizeTimeout = null;
15434				/**
15435				 * The resize event is raised a short time after window resize operations cease.
15436				 * @event FooTable.Table#"resize.ft.table"
15437				 * @param {jQuery.Event} e - The jQuery.Event object for the event.
15438				 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
15439				 */
15440				self.raise('resize.ft.table').then(function(){
15441					self.breakpoints.check();
15442				});
15443			}, 300);
15444		}
15445	});
15446
15447})(jQuery, FooTable);
15448(function($, F){
15449
15450	F.ArrayColumn = F.Column.extend(/** @lends FooTable.ArrayColumn */{
15451		/**
15452		 * @summary A column to handle Array values.
15453		 * @constructs
15454		 * @extends FooTable.Column
15455		 * @param {FooTable.Table} instance -  The parent {@link FooTable.Table} this column belongs to.
15456		 * @param {object} definition - An object containing all the properties to set for the column.
15457		 */
15458		construct: function(instance, definition) {
15459			this._super(instance, definition, 'array');
15460		},
15461		/**
15462		 * @summary Parses the supplied value or element to retrieve a column value.
15463		 * @description This is supplied either the cell value or jQuery object to parse. This method will return either the Array containing the values or null.
15464		 * @instance
15465		 * @protected
15466		 * @param {(*|jQuery)} valueOrElement - The value or jQuery cell object.
15467		 * @returns {(array|null)}
15468		 */
15469		parser: function(valueOrElement){
15470			if (F.is.element(valueOrElement) || F.is.jq(valueOrElement)){ // use jQuery to get the value
15471				var $el = $(valueOrElement), data = $el.data('value'); // .data() will automatically convert a JSON string to an array
15472				if (F.is.array(data)) return data;
15473				data = $el.html();
15474				try {
15475					data = JSON.parse(data);
15476				} catch(err) {
15477					data = null;
15478				}
15479				return F.is.array(data) ? data : null; // if we have an array return it
15480			}
15481			if (F.is.array(valueOrElement)) return valueOrElement; // if we have an array return it
15482			return null; // otherwise we have no value so return null
15483		},
15484		/**
15485		 * @summary Formats the column value and creates the HTML seen within a cell.
15486		 * @description This is supplied the value retrieved from the {@link FooTable.ArrayColumn#parser} function and must return a string, HTMLElement or jQuery object.
15487		 * The return value from this function is what is displayed in the cell in the table.
15488		 * @instance
15489		 * @protected
15490		 * @param {?Array} value - The value to format.
15491		 * @param {object} options - The current plugin options.
15492		 * @param {object} rowData - An object containing the current row data.
15493		 * @returns {(string|HTMLElement|jQuery)}
15494		 */
15495		formatter: function(value, options, rowData){
15496			return F.is.array(value) ? JSON.stringify(value) : '';
15497		}
15498	});
15499
15500	F.columns.register('array', F.ArrayColumn);
15501
15502})(jQuery, FooTable);
15503(function($, F){
15504
15505	if (F.is.undef(window.moment)){
15506		// The DateColumn requires moment.js to parse and format date values. Goto http://momentjs.com/ to get it.
15507		return;
15508	}
15509
15510	F.DateColumn = F.Column.extend(/** @lends FooTable.DateColumn */{
15511		/**
15512		 * The date column class is used to handle date values. This column is dependent on [moment.js]{@link http://momentjs.com/} to provide date parsing and formatting functionality.
15513		 * @constructs
15514		 * @extends FooTable.Column
15515		 * @param {FooTable.Table} instance -  The parent {@link FooTable.Table} this column belongs to.
15516		 * @param {object} definition - An object containing all the properties to set for the column.
15517		 * @returns {FooTable.DateColumn}
15518		 */
15519		construct: function(instance, definition){
15520			this._super(instance, definition, 'date');
15521			/**
15522			 * The format string to use when parsing and formatting dates.
15523			 * @instance
15524			 * @type {string}
15525			 */
15526			this.formatString = F.is.string(definition.formatString) ? definition.formatString : 'MM-DD-YYYY';
15527		},
15528		/**
15529		 * This is supplied either the cell value or jQuery object to parse. Any value can be returned from this method and will be provided to the {@link FooTable.DateColumn#format} function
15530		 * to generate the cell contents.
15531		 * @instance
15532		 * @protected
15533		 * @param {(*|jQuery)} valueOrElement - The value or jQuery cell object.
15534		 * @returns {(moment|null)}
15535		 * @this FooTable.DateColumn
15536		 */
15537		parser: function(valueOrElement){
15538			if (F.is.element(valueOrElement) || F.is.jq(valueOrElement)){
15539				var data = $(valueOrElement).data('value');
15540				valueOrElement = F.is.defined(data) ? data : $(valueOrElement).text();
15541				if (F.is.string(valueOrElement)) valueOrElement = isNaN(valueOrElement) ? valueOrElement : +valueOrElement;
15542			}
15543			if (F.is.date(valueOrElement)) return moment(valueOrElement);
15544			if (F.is.object(valueOrElement) && F.is.boolean(valueOrElement._isAMomentObject)) return valueOrElement;
15545			if (F.is.string(valueOrElement)){
15546				// if it looks like a number convert it and do nothing else otherwise create a new moment using the string value and formatString
15547				if (isNaN(valueOrElement)){
15548					return moment(valueOrElement, this.formatString);
15549				} else {
15550					valueOrElement = +valueOrElement;
15551				}
15552			}
15553			if (F.is.number(valueOrElement)){
15554				return moment(valueOrElement);
15555			}
15556			return null;
15557		},
15558		/**
15559		 * This is supplied the value retrieved from the {@link FooTable.DateColumn#parser} function and must return a string, HTMLElement or jQuery object.
15560		 * The return value from this function is what is displayed in the cell in the table.
15561		 * @instance
15562		 * @protected
15563		 * @param {*} value - The value to format.
15564		 * @param {object} options - The current plugin options.
15565		 * @param {object} rowData - An object containing the current row data.
15566		 * @returns {(string|HTMLElement|jQuery)}
15567		 * @this FooTable.DateColumn
15568		 */
15569		formatter: function(value, options, rowData){
15570			return F.is.object(value) && F.is.boolean(value._isAMomentObject) && value.isValid() ? value.format(this.formatString) : '';
15571		},
15572		/**
15573		 * This is supplied either the cell value or jQuery object to parse. A string value must be returned from this method and will be used during filtering operations.
15574		 * @param {(*|jQuery)} valueOrElement - The value or jQuery cell object.
15575		 * @returns {string}
15576		 * @this FooTable.DateColumn
15577		 */
15578		filterValue: function(valueOrElement){
15579			// if we have an element or a jQuery object use jQuery to get the value
15580			if (F.is.element(valueOrElement) || F.is.jq(valueOrElement)) valueOrElement = $(valueOrElement).data('filterValue') || $(valueOrElement).text();
15581			// if options are supplied with the value
15582			if (F.is.hash(valueOrElement) && F.is.hash(valueOrElement.options)){
15583				if (F.is.string(valueOrElement.options.filterValue)) valueOrElement = valueOrElement.options.filterValue;
15584				if (F.is.defined(valueOrElement.value)) valueOrElement = valueOrElement.value;
15585			}
15586			// if the value is a moment object just return the formatted value
15587			if (F.is.object(valueOrElement) && F.is.boolean(valueOrElement._isAMomentObject)) return valueOrElement.format(this.formatString);
15588			// if its a string
15589			if (F.is.string(valueOrElement)){
15590				// if its not a number return it
15591				if (isNaN(valueOrElement)){
15592					return valueOrElement;
15593				} else { // otherwise convert it and carry on
15594					valueOrElement = +valueOrElement;
15595				}
15596			}
15597			// if the value is a number or date convert to a moment object and return the formatted result.
15598			if (F.is.number(valueOrElement) || F.is.date(valueOrElement)){
15599				return moment(valueOrElement).format(this.formatString);
15600			}
15601			// try use the native toString of the value if its not undefined or null
15602			if (F.is.defined(valueOrElement) && valueOrElement != null) return valueOrElement+'';
15603			return ''; // otherwise we have no value so return an empty string
15604		}
15605	});
15606
15607	F.columns.register('date', F.DateColumn);
15608
15609})(jQuery, FooTable);
15610
15611(function($, F){
15612
15613	F.HTMLColumn = F.Column.extend(/** @lends FooTable.HTMLColumn */{
15614		/**
15615		 * The HTML column class is used to handle any raw HTML columns.
15616		 * @constructs
15617		 * @extends FooTable.Column
15618		 * @param {FooTable.Table} instance -  The parent {@link FooTable.Table} this column belongs to.
15619		 * @param {object} definition - An object containing all the properties to set for the column.
15620		 * @returns {FooTable.HTMLColumn}
15621		 */
15622		construct: function(instance, definition){
15623			this._super(instance, definition, 'html');
15624		},
15625		/**
15626		 * This is supplied either the cell value or jQuery object to parse. Any value can be returned from this method and will be provided to the {@link FooTable.HTMLColumn#format} function
15627		 * to generate the cell contents.
15628		 * @instance
15629		 * @protected
15630		 * @param {(*|jQuery)} valueOrElement - The value or jQuery cell object.
15631		 * @returns {(jQuery|null)}
15632		 * @this FooTable.HTMLColumn
15633		 */
15634		parser: function(valueOrElement){
15635			if (F.is.string(valueOrElement)) valueOrElement = $($.trim(valueOrElement));
15636			if (F.is.element(valueOrElement)) valueOrElement = $(valueOrElement);
15637			if (F.is.jq(valueOrElement)){
15638				var tagName = valueOrElement.prop('tagName').toLowerCase();
15639				if (tagName == 'td' || tagName == 'th'){
15640					var data = valueOrElement.data('value');
15641					return F.is.defined(data) ? data : valueOrElement.contents();
15642				}
15643				return valueOrElement;
15644			}
15645			return null;
15646		}
15647	});
15648
15649	F.columns.register('html', F.HTMLColumn);
15650
15651})(jQuery, FooTable);
15652(function($, F){
15653
15654	F.NumberColumn = F.Column.extend(/** @lends FooTable.NumberColumn */{
15655		/**
15656		 * The number column class is used to handle simple number columns.
15657		 * @constructs
15658		 * @extends FooTable.Column
15659		 * @param {FooTable.Table} instance -  The parent {@link FooTable.Table} this column belongs to.
15660		 * @param {object} definition - An object containing all the properties to set for the column.
15661		 * @returns {FooTable.NumberColumn}
15662		 */
15663		construct: function(instance, definition){
15664			this._super(instance, definition, 'number');
15665			this.decimalSeparator = F.is.string(definition.decimalSeparator) ? definition.decimalSeparator : '.';
15666			this.thousandSeparator = F.is.string(definition.thousandSeparator) ? definition.thousandSeparator : ',';
15667			this.decimalSeparatorRegex = new RegExp(F.str.escapeRegExp(this.decimalSeparator), 'g');
15668			this.thousandSeparatorRegex = new RegExp(F.str.escapeRegExp(this.thousandSeparator), 'g');
15669			this.cleanRegex = new RegExp('[^\-0-9' + F.str.escapeRegExp(this.decimalSeparator) + ']', 'g');
15670		},
15671		/**
15672		 * This is supplied either the cell value or jQuery object to parse. Any value can be returned from this method and will be provided to the {@link FooTable.Column#formatter} function
15673		 * to generate the cell contents.
15674		 * @instance
15675		 * @protected
15676		 * @param {(*|jQuery)} valueOrElement - The value or jQuery cell object.
15677		 * @returns {(number|null)}
15678		 * @this FooTable.NumberColumn
15679		 */
15680		parser: function(valueOrElement){
15681			if (F.is.element(valueOrElement) || F.is.jq(valueOrElement)){
15682				var data = $(valueOrElement).data('value');
15683				valueOrElement = F.is.defined(data) ? data : $(valueOrElement).text().replace(this.cleanRegex, '');
15684			}
15685			if (F.is.string(valueOrElement)){
15686				valueOrElement = valueOrElement.replace(this.thousandSeparatorRegex, '').replace(this.decimalSeparatorRegex, '.');
15687				valueOrElement = parseFloat(valueOrElement);
15688			}
15689			if (F.is.number(valueOrElement)) return valueOrElement;
15690			return null;
15691		},
15692		/**
15693		 * This is supplied the value retrieved from the {@link FooTable.NumberColumn#parse} function and must return a string, HTMLElement or jQuery object.
15694		 * The return value from this function is what is displayed in the cell in the table.
15695		 * @instance
15696		 * @protected
15697		 * @param {number} value - The value to format.
15698		 * @param {object} options - The current plugin options.
15699		 * @param {object} rowData - An object containing the current row data.
15700		 * @returns {(string|HTMLElement|jQuery)}
15701		 * @this FooTable.NumberColumn
15702		 */
15703		formatter: function(value, options, rowData){
15704			if (value == null) return '';
15705			var s = (value + '').split('.');
15706			if (s.length == 2 && s[0].length > 3) {
15707				s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, this.thousandSeparator);
15708			}
15709			return s.join(this.decimalSeparator);
15710		}
15711	});
15712
15713	F.columns.register('number', F.NumberColumn);
15714
15715})(jQuery, FooTable);
15716(function($, F){
15717
15718	F.ObjectColumn = F.Column.extend(/** @lends FooTable.ObjectColumn */{
15719		/**
15720		 * @summary A column to handle Object values.
15721		 * @constructs
15722		 * @extends FooTable.Column
15723		 * @param {FooTable.Table} instance -  The parent {@link FooTable.Table} this column belongs to.
15724		 * @param {object} definition - An object containing all the properties to set for the column.
15725		 */
15726		construct: function(instance, definition) {
15727			this._super(instance, definition, 'object');
15728		},
15729		/**
15730		 * @summary Parses the supplied value or element to retrieve a column value.
15731		 * @description This is supplied either the cell value or jQuery object to parse. This method will return either the Object containing the values or null.
15732		 * @instance
15733		 * @protected
15734		 * @param {(*|jQuery)} valueOrElement - The value or jQuery cell object.
15735		 * @returns {(object|null)}
15736		 */
15737		parser: function(valueOrElement){
15738			if (F.is.element(valueOrElement) || F.is.jq(valueOrElement)){ // use jQuery to get the value
15739				var $el = $(valueOrElement), data = $el.data('value'); // .data() will automatically convert a JSON string to an object
15740				if (F.is.object(data)) return data;
15741				data = $el.html();
15742				try {
15743					data = JSON.parse(data);
15744				} catch(err) {
15745					data = null;
15746				}
15747				return F.is.object(data) ? data : null; // if we have an object return it
15748			}
15749			if (F.is.object(valueOrElement)) return valueOrElement; // if we have an object return it
15750			return null; // otherwise we have no value so return null
15751		},
15752		/**
15753		 * @summary Formats the column value and creates the HTML seen within a cell.
15754		 * @description This is supplied the value retrieved from the {@link FooTable.ObjectColumn#parser} function and must return a string, HTMLElement or jQuery object.
15755		 * The return value from this function is what is displayed in the cell in the table.
15756		 * @instance
15757		 * @protected
15758		 * @param {*} value - The value to format.
15759		 * @param {object} options - The current plugin options.
15760		 * @param {object} rowData - An object containing the current row data.
15761		 * @returns {(string|HTMLElement|jQuery)}
15762		 */
15763		formatter: function(value, options, rowData){
15764			return F.is.object(value) ? JSON.stringify(value) : '';
15765		}
15766	});
15767
15768	F.columns.register('object', F.ObjectColumn);
15769
15770})(jQuery, FooTable);
15771(function($, F){
15772
15773	F.Breakpoint = F.Class.extend(/** @lends FooTable.Breakpoint */{
15774		/**
15775		 * The breakpoint class containing the name and maximum width for the breakpoint.
15776		 * @constructs
15777		 * @extends FooTable.Class
15778		 * @param {string} name - The name of the breakpoint. Must contain no spaces or special characters.
15779		 * @param {number} width - The width of the breakpoint in pixels.
15780		 * @returns {FooTable.Breakpoint}
15781		 */
15782		construct: function(name, width){
15783			/**
15784			 * The name of the breakpoint.
15785			 * @type {string}
15786			 */
15787			this.name = name;
15788			/**
15789			 * The maximum width of the breakpoint in pixels.
15790			 * @type {number}
15791			 */
15792			this.width = width;
15793		}
15794	});
15795
15796})(jQuery, FooTable);
15797(function($, F){
15798	F.Breakpoints = F.Component.extend(/** @lends FooTable.Breakpoints */{
15799		/**
15800		 * Contains the logic to calculate and apply breakpoints for the plugin.
15801		 * @constructs
15802		 * @extends FooTable.Component
15803		 * @param {FooTable.Table} table -  The parent {@link FooTable.Table} this component belongs to.
15804		 * @returns {FooTable.Breakpoints}
15805		 */
15806		construct: function(table){
15807			// call the base class constructor
15808			this._super(table, true);
15809
15810			/* PROTECTED */
15811			/**
15812			 * This provides a shortcut to the {@link FooTable.Table#options} object.
15813			 * @protected
15814			 * @type {FooTable.Table#options}
15815			 */
15816			this.o = table.o;
15817
15818			/* PUBLIC */
15819			/**
15820			 * The current breakpoint.
15821			 * @type {FooTable.Breakpoint}
15822			 */
15823			this.current = null;
15824			/**
15825			 * An array of {@link FooTable.Breakpoint} objects created from parsing the options.
15826			 * @type {Array.<FooTable.Breakpoint>}
15827			 */
15828			this.array = [];
15829			/**
15830			 * Whether or not breakpoints cascade. When set to true all breakpoints larger than the current will be hidden along with it.
15831			 * @type {boolean}
15832			 */
15833			this.cascade = this.o.cascade;
15834			/**
15835			 * Whether or not to calculate breakpoints on the width of the parent element rather than the viewport.
15836			 * @type {boolean}
15837			 */
15838			this.useParentWidth = this.o.useParentWidth;
15839			/**
15840			 * This value is updated each time the current breakpoint changes and contains a space delimited string of the names of the current breakpoint and all those smaller than it.
15841			 * @type {string}
15842			 */
15843			this.hidden = null;
15844
15845			/* PRIVATE */
15846			/**
15847			 * This value is set once when the {@link FooTable.Breakpoints#array} is generated and contains a space delimited string of all the breakpoint class names.
15848			 * @type {string}
15849			 * @private
15850			 */
15851			this._classNames = '';
15852
15853			// check if a function was supplied to override the default getWidth
15854			this.getWidth = F.checkFnValue(this, this.o.getWidth, this.getWidth);
15855		},
15856
15857		/* PROTECTED */
15858		/**
15859		 * Checks the supplied data and options for the breakpoints component.
15860		 * @instance
15861		 * @protected
15862		 * @param {object} data - The jQuery data object from the parent table.
15863		 * @fires FooTable.Breakpoints#"preinit.ft.breakpoints"
15864		 */
15865		preinit: function(data){
15866			var self = this;
15867			/**
15868			 * The preinit.ft.breakpoints event is raised before any UI is created and provides the tables jQuery data object for additional options parsing.
15869			 * Calling preventDefault on this event will disable the entire plugin.
15870			 * @event FooTable.Breakpoints#"preinit.ft.breakpoints"
15871			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
15872			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
15873			 * @param {object} data - The jQuery data object of the table raising the event.
15874			 */
15875			return this.ft.raise('preinit.ft.breakpoints', [data]).then(function(){
15876				self.cascade = F.is.boolean(data.cascade) ? data.cascade : self.cascade;
15877				self.o.breakpoints = F.is.hash(data.breakpoints) ? data.breakpoints : self.o.breakpoints;
15878				self.getWidth = F.checkFnValue(self, data.getWidth, self.getWidth);
15879				if (self.o.breakpoints == null) self.o.breakpoints = { "xs": 480, "sm": 768, "md": 992, "lg": 1200 };
15880				// Create a nice friendly array to work with out of the breakpoints object.
15881				for (var name in self.o.breakpoints) {
15882					if (!self.o.breakpoints.hasOwnProperty(name)) continue;
15883					self.array.push(new F.Breakpoint(name, self.o.breakpoints[name]));
15884					self._classNames += 'breakpoint-' + name + ' ';
15885				}
15886				// Sort the breakpoints so the largest is checked first
15887				self.array.sort(function (a, b) {
15888					return b.width - a.width;
15889				});
15890			});
15891		},
15892		/**
15893		 * Initializes the class parsing the options into a sorted array of {@link FooTable.Breakpoint} objects.
15894		 * @instance
15895		 * @protected
15896		 * @fires FooTable.Breakpoints#"init.ft.breakpoints"
15897		 */
15898		init: function(){
15899			var self = this;
15900			/**
15901			 * The init.ft.breakpoints event is raised before any UI is generated.
15902			 * Calling preventDefault on this event will disable the entire plugin.
15903			 * @event FooTable.Breakpoints#"init.ft.breakpoints"
15904			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
15905			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
15906			 */
15907			return this.ft.raise('init.ft.breakpoints').then(function(){
15908				self.current = self.get();
15909			});
15910		},
15911		/**
15912		 * Whenever the table is drawn this ensures the correct breakpoint class is applied to the table.
15913		 * @instance
15914		 * @protected
15915		 */
15916		draw: function(){
15917			this.ft.$el.removeClass(this._classNames).addClass('breakpoint-' + this.current.name);
15918		},
15919
15920		/* PUBLIC */
15921		/**
15922		 * Calculates the current breakpoint from the {@link FooTable.Breakpoints#array} and sets the {@link FooTable.Breakpoints#current} property.
15923		 * @instance
15924		 * @returns {FooTable.Breakpoint}
15925		 */
15926		calculate: function(){
15927			var self = this, current = null, hidden = [], breakpoint, prev = null, width = self.getWidth();
15928			for (var i = 0, len = self.array.length; i < len; i++) {
15929				breakpoint = self.array[i];
15930				// if the width is smaller than the smallest breakpoint set the smallest as the current.
15931				// if the width is larger than the largest breakpoint set the largest as the current.
15932				// otherwise if the width is somewhere in between check all breakpoints testing if the width
15933				// is greater than the current but smaller than the previous.
15934				if ((!current && i == len -1)
15935					|| (width >= breakpoint.width && (prev instanceof F.Breakpoint ? width < prev.width : true))) {
15936					current = breakpoint;
15937				}
15938				if (!current) hidden.push(breakpoint.name);
15939				prev = breakpoint;
15940			}
15941			hidden.push(current.name);
15942			self.hidden = hidden.join(' ');
15943			return current;
15944		},
15945		/**
15946		 * Supplied a columns breakpoints this returns a boolean value indicating whether or not the column is visible.
15947		 * @param {string} breakpoints - A space separated string of breakpoint names.
15948		 * @returns {boolean}
15949		 */
15950		visible: function(breakpoints){
15951			if (F.is.emptyString(breakpoints)) return true;
15952			if (breakpoints === 'all') return false;
15953			var parts = breakpoints.split(' '), i = 0, len = parts.length;
15954			for (; i < len; i++){
15955				if (this.cascade ? F.str.containsWord(this.hidden, parts[i]) : parts[i] == this.current.name) return false;
15956			}
15957			return true;
15958		},
15959		/**
15960		 * Performs a check between the current breakpoint and the previous breakpoint and performs a redraw if they differ.
15961		 * @instance
15962		 * @fires FooTable.Breakpoints#"before.ft.breakpoints"
15963		 * @fires FooTable.Breakpoints#"after.ft.breakpoints"
15964		 */
15965		check: function(){
15966			var self = this, bp = self.get();
15967			if (!(bp instanceof F.Breakpoint)
15968				|| bp == self.current)
15969				return;
15970
15971			/**
15972			 * The before.ft.breakpoints event is raised if the breakpoint has changed but before the UI is redrawn and is supplied both the current breakpoint
15973			 * and the next "new" one that is about to be applied.
15974			 * Calling preventDefault on this event will prevent the next breakpoint from being applied.
15975			 * @event FooTable.Breakpoints#"before.ft.breakpoints"
15976			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
15977			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
15978			 * @param {FooTable.Breakpoint} current - The current breakpoint.
15979			 * @param {FooTable.Breakpoint} next - The breakpoint that is about to be applied.
15980			 */
15981			self.ft.raise('before.ft.breakpoints', [self.current, bp]).then(function(){
15982				var previous = self.current;
15983				self.current = bp;
15984				return self.ft.draw().then(function(){
15985					/**
15986					 * The after.ft.breakpoints event is raised after the breakpoint has changed and the UI is redrawn and is supplied both the "new" current breakpoint
15987					 * and the previous one that was replaced.
15988					 * @event FooTable.Breakpoints#"after.ft.breakpoints"
15989					 * @param {jQuery.Event} e - The jQuery.Event object for the event.
15990					 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
15991					 * @param {FooTable.Breakpoint} current - The current breakpoint.
15992					 * @param {FooTable.Breakpoint} previous - The breakpoint that was just replaced.
15993					 */
15994					self.ft.raise('after.ft.breakpoints', [self.current, previous]);
15995				});
15996			});
15997		},
15998		/**
15999		 * Attempts to return a {@link FooTable.Breakpoint} instance when passed a {@link FooTable.Breakpoint},
16000		 * the {@link FooTable.Breakpoint#name}
16000 string or if nothing is supplied the current breakpoint.
16001		 * @instance
16002		 * @param {(FooTable.Breakpoint|string|number)} [breakpoint] - The breakpoint to retrieve.
16003		 * @returns {FooTable.Breakpoint}
16004		 */
16005		get: function(breakpoint){
16006			if (F.is.undef(breakpoint)) return this.calculate();
16007			if (breakpoint instanceof F.Breakpoint) return breakpoint;
16008			if (F.is.string(breakpoint)) return F.arr.first(this.array, function (bp) { return bp.name == breakpoint; });
16009			if (F.is.number(breakpoint)) return breakpoint >= 0 && breakpoint < this.array.length ? this.array[breakpoint] : null;
16010			return null;
16011		},
16012		/**
16013		 * Gets the width used to determine breakpoints whether it be from the viewport, parent or a custom function.
16014		 * @instance
16015		 * @returns {number}
16016		 */
16017		getWidth: function(){
16018			if (F.is.fn(this.o.getWidth)) return this.o.getWidth(this.ft);
16019			if (this.useParentWidth == true) return this.getParentWidth();
16020			return this.getViewportWidth();
16021		},
16022		/**
16023		 * Gets the tables direct parents width.
16024		 * @instance
16025		 * @returns {number}
16026		 */
16027		getParentWidth: function(){
16028			return this.ft.$el.parent().width();
16029		},
16030		/**
16031		 * Gets the current viewport width.
16032		 * @instance
16033		 * @returns {number}
16034		 */
16035		getViewportWidth: function(){
16036			return Math.max(document.documentElement.clientWidth, window.innerWidth, 0);
16037		}
16038	});
16039
16040	F.components.register('breakpoints', F.Breakpoints, 1000);
16041
16042})(jQuery, FooTable);
16043(function(F){
16044	/**
16045	 * A space delimited string of breakpoint names that specify when the column will be hidden. You can also specify "all" to make a column permanently display in an expandable detail row.
16046	 * @type {string}
16047	 * @default null
16048	 * @example <caption>The below shows how this value would be set</caption>
16049	 * breakpoints: "md"
16050	 */
16051	F.Column.prototype.breakpoints = null;
16052
16053	F.Column.prototype.__breakpoints_define__ = function(definition){
16054		this.breakpoints = F.is.emptyString(definition.breakpoints) ? null : definition.breakpoints;
16055	};
16056
16057	F.Column.extend('define', function(definition){
16058		this._super(definition);
16059		this.__breakpoints_define__(definition);
16060	});
16061})(FooTable);
16062(function(F){
16063	/**
16064	 * An object containing the breakpoints for the plugin.
16065	 * @type {object.<string, number>}
16066	 * @default { "xs": 480, "sm": 768, "md": 992, "lg": 1200 }
16067	 */
16068	F.Defaults.prototype.breakpoints = null;
16069
16070	/**
16071	 * Whether or not breakpoints cascade. When set to true all breakpoints larger than the current will also be hidden along with it.
16072	 * @type {boolean}
16073	 * @default false
16074	 */
16075	F.Defaults.prototype.cascade = false;
16076
16077	/**
16078	 * Whether or not to calculate breakpoints on the width of the parent element rather than the viewport.
16079	 * @type {boolean}
16080	 * @default false
16081	 */
16082	F.Defaults.prototype.useParentWidth = false;
16083
16084	/**
16085	 * A function used to override the default getWidth function with a custom one.
16086	 * @type {function}
16087	 * @default null
16088	 * @example <caption>The below shows what the default getWidth function would look like.</caption>
16089	 * getWidth: function(instance){
16090	 * 	if (instance.o.useParentWidth == true) return instance.$el.parent().width();
16091	 * 	return instance.breakpoints.getViewportWidth();
16092	 * }
16093	 */
16094	F.Defaults.prototype.getWidth = null;
16095})(FooTable);
16096(function($, F){
16097	F.Columns = F.Component.extend(/** @lends FooTable.Columns */{
16098		/**
16099		 * The columns class contains all the logic for handling columns.
16100		 * @constructs
16101		 * @extends FooTable.Component
16102		 * @param {FooTable.Table} table -  The parent {@link FooTable.Table} this component belongs to.
16103		 * @returns {FooTable.Columns}
16104		 */
16105		construct: function(table){
16106			// call the base class constructor
16107			this._super(table, true);
16108
16109			/* PROTECTED */
16110			/**
16111			 * This provides a shortcut to the {@link FooTable.Table#options} object.
16112			 * @protected
16113			 * @type {FooTable.Table#options}
16114			 */
16115			this.o = table.o;
16116
16117			/* PUBLIC */
16118			/**
16119			 * An array of {@link FooTable.Column} objects created from parsing the options and/or DOM.
16120			 * @type {Array.<FooTable.Column>}
16121			 */
16122			this.array = [];
16123			/**
16124			 * The jQuery header row object.
16125			 * @type {jQuery}
16126			 */
16127			this.$header = null;
16128			/**
16129			 * Whether or not to display the header row.
16130			 * @type {boolean}
16131			 */
16132			this.showHeader = table.o.showHeader;
16133
16134			this._fromHTML = F.is.emptyArray(table.o.columns) && !F.is.promise(table.o.columns);
16135		},
16136
16137		/* PROTECTED */
16138		/**
16139		 * This parses the columns from either the tables rows or the supplied options.
16140		 * @instance
16141		 * @protected
16142		 * @param {object} data - The tables jQuery data object.
16143		 * @returns {jQuery.Promise}
16144		 * @this FooTable.Columns
16145		 */
16146		parse: function(data){
16147			var self = this;
16148			return $.Deferred(function(d){
16149				function merge(cols1, cols2){
16150					var merged = [];
16151					// check if either of the arrays is empty as it can save us having to merge them by index.
16152					if (cols1.length == 0 || cols2.length == 0){
16153						merged = cols1.concat(cols2);
16154					} else {
16155						// at this point we have two arrays of column definitions, we now need to merge them based on there index properties
16156						// first figure out the highest column index provided so we can loop that many times to merge all c
16156olumns and provide
16157						// defaults where nothing was specified (fill in the gaps in the array as it were).
16158						var highest = 0;
16159						F.arr.each(cols1.concat(cols2), function(c){
16160							if (c.index > highest) highest = c.index;
16161						});
16162						highest++;
16163						for (var i = 0, cols1_c, cols2_c; i < highest; i++){
16164							cols1_c = {};
16165							F.arr.each(cols1, function(c){
16166								if (c.index == i){
16167									cols1_c = c;
16168									return false;
16169								}
16170							});
16171							cols2_c = {};
16172							F.arr.each(cols2, function(c){
16173								if (c.index == i){
16174									cols2_c = c;
16175									return false;
16176								}
16177							});
16178							merged.push($.extend(true, {}, cols1_c, cols2_c));
16179						}
16180					}
16181					return merged;
16182				}
16183
16184				var json = [], html = [];
16185				// get the column options from the content
16186				var $header = self.ft.$el.find('tr.footable-header, thead > tr:last:has([data-breakpoints]), tbody > tr:first:has([data-breakpoints]), thead > tr:last, tbody > tr:first').first(), $cell, cdata;
16187				if ($header.length > 0){
16188					var virtual = $header.parent().is('tbody') && $header.children().length == $header.children('td').length;
16189					if (!virtual) self.$header = $header.addClass('footable-header');
16190					$header.children('td,th').each(function(i, cell){
16191						$cell = $(cell);
16192						cdata = $cell.data();
16193						cdata.index = i;
16194						cdata.$el = $cell;
16195						cdata.virtual = virtual;
16196						html.push(cdata);
16197					});
16198					if (virtual) self.showHeader = false;
16199				}
16200				// get the supplied column options
16201				if (F.is.array(self.o.columns) && !F.is.emptyArray(self.o.columns)){
16202					F.arr.each(self.o.columns, function(c, i){
16203						c.index = i;
16204						json.push(c);
16205					});
16206					self.parseFinalize(d, merge(json, html));
16207				} else if (F.is.promise(self.o.columns)){
16208					self.o.columns.then(function(cols){
16209						F.arr.each(cols, function(c, i){
16210							c.index = i;
16211							json.push(c);
16212						});
16213						self.parseFinalize(d, merge(json, html));
16214					}, function(xhr){
16215						d.reject(Error('Columns ajax request error: ' + xhr.status + ' (' + xhr.statusText + ')'));
16216					});
16217				} else {
16218					self.parseFinalize(d, merge(json, html));
16219				}
16220			});
16221		},
16222		/**
16223		 * Used to finalize the parsing of columns it is supplied the parse deferred object which must be resolved with an array of {@link FooTable.Column} objects
16224		 * or rejected with an error.
16225		 * @instance
16226		 * @protected
16227		 * @param {jQuery.Deferred} deferred - The deferred object used for parsing.
16228		 * @param {Array.<object>} cols - An array of all merged column definitions.
16229		 */
16230		parseFinalize: function(deferred, cols){
16231			// we now have a merged array of all column definitions supplied to the plugin, time to make the objects.
16232			var self = this, columns = [], column;
16233			F.arr.each(cols, function(def){
16234				// if we have a column registered using the definition type then create an instance of that column otherwise just create a default text column.
16235				if (column = F.columns.contains(def.type) ? F.columns.make(def.type, self.ft, def) : new F.Column(self.ft, def))
16236					columns.push(column);
16237			});
16238			if (F.is.emptyArray(columns)){
16239				deferred.reject(Error("No columns supplied."));
16240			} else {
16241				// make sure to sort by the column index as the merge process may have mixed them up
16242				columns.sort(function(a, b){ return a.index - b.index; });
16243				deferred.resolve(columns);
16244			}
16245		},
16246		/**
16247		 * The columns preinit method is used to parse and check the column options supplied from both static content and through the constructor.
16248		 * @instance
16249		 * @protected
16250		 * @param {object} data - The jQuery data object from the root table element.
16251		 * @this FooTable.Columns
16252		 */
16253		preinit: function(data){
16254			var self = this;
16255			/**
16256			 * The preinit.ft.columns event is raised before any UI is created and provides the tables jQuery data object for additional options parsing.
16257			 * Calling preventDefault on this event will disable the entire plugin.
16258			 * @event FooTable.Columns#"preinit.ft.columns"
16259			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
16260			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
16261			 * @param {object} data - The jQuery data object of the table raising the event.
16262			 */
16263			return self.ft.raise('preinit.ft.columns', [data]).then(function(){
16264				return self.parse(data).then(function(columns){
16265					self.array = columns;
16266					self.showHeader = F.is.boolean(data.showHeader) ? data.showHeader : self.showHeader;
16267				});
16268			});
16269		},
16270		/**
16271		 * Initializes the columns creating the table header if required.
16272		 * @instance
16273		 * @protected
16274		 * @fires FooTable.Columns#"init.ft.columns"
16275		 * @this FooTable.Columns
16276		 */
16277		init: function(){
16278			var self = this;
16279			/**
16280			 * The init.ft.columns event is raised after the header row is created/parsed for c
16280olumn data.
16281			 * @event FooTable.Columns#"init.ft.columns"
16282			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
16283			 * @param {FooTable.Table} instance - The instance of the plugin raising the event.
16284			 * @param {Array.<FooTable.Column>} columns - The array of {@link FooTable.Column} objects parsed from the options and/or DOM.
16285			 */
16286			return this.ft.raise('init.ft.columns', [ self.array ]).then(function(){
16287				self.$create();
16288			});
16289		},
16290		/**
16291		 * Destroys the columns component removing any UI generated from the table.
16292		 * @instance
16293		 * @protected
16294		 * @fires FooTable.Columns#"destroy.ft.columns"
16295		 */
16296		destroy: function(){
16297			/**
16298			 * The destroy.ft.columns event is raised before its UI is removed.
16299			 * Calling preventDefault on this event will prevent the component from being destroyed.
16300			 * @event FooTable.Columns#"destroy.ft.columns"
16301			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
16302			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
16303			 */
16304			var self = this;
16305			this.ft.raise('destroy.ft.columns').then(function(){
16306				if (!self._fromHTML) self.$header.remove();
16307			});
16308		},
16309		/**
16310		 * The predraw method called from within the {@link FooTable.Table#draw} method.
16311		 * @instance
16312		 * @protected
16313		 * @this FooTable.Columns
16314		 */
16315		predraw: function(){
16316			var self = this, first = true;
16317			self.visibleColspan = 0;
16318			self.firstVisibleIndex = 0;
16319			self.lastVisibleIndex = 0;
16320			self.hasHidden = false;
16321			F.arr.each(self.array, function(col){
16322				col.hidden = !self.ft.breakpoints.visible(col.breakpoints);
16323				if (!col.hidden && col.visible){
16324					if (first){
16325						self.firstVisibleIndex = col.index;
16326						first = false;
16327					}
16328					self.lastVisibleIndex = col.index;
16329					self.visibleColspan++;
16330				}
16331				if (col.hidden) self.hasHidden = true;
16332			});
16333			self.ft.$el.toggleClass('breakpoint', self.hasHidden);
16334		},
16335		/**
16336		 * Performs the actual drawing of the columns, hiding or displaying them depending on there breakpoints.
16337		 * @instance
16338		 * @protected
16339		 * @this FooTable.Columns
16340		 */
16341		draw: function(){
16342			F.arr.each(this.array, function(col){
16343				col.$el.css('display', (col.hidden || !col.visible  ? 'none' : 'table-cell'));
16344			});
16345			if (!this.showHeader && F.is.jq(this.$header.parent())){
16346				this.$header.detach();
16347			}
16348		},
16349		/**
16350		 * Creates the header row for the table from the parsed column definitions.
16351		 * @instance
16352		 * @protected
16353		 * @this FooTable.Columns
16354		 */
16355		$create: function(){
16356			var self = this;
16357			self.$header = F.is.jq(self.$header) ? self.$header : $('<tr/>', {'class': 'footable-header'});
16358			self.$header.children('th,td').detach();
16359			F.arr.each(self.array, function(col){
16360				self.$header.append(col.$el);
16361			});
16362			if (self.showHeader && !F.is.jq(self.$header.parent())){
16363				self.ft.$el.children('thead').append(self.$header);
16364			}
16365		},
16366		/**
16367		 * Attempts to return a {@link FooTable.Column} instance when passed the {@link FooTable.Column} instance, the {@link FooTable.Column#name} string or the {@link FooTable.Column#index} number.
16368		 * If supplied a function this will return an array by iterating all columns passing the index and column itself to the supplied callback as arguments.
16369		 * Returning true in the callback will include the column in the result.
16370		 * @instance
16371		 * @param {(FooTable.Column|string|number|function)} column - The column to retrieve.
16372		 * @returns {(Array.<FooTable.Column>|FooTable.Column|null)} The column if one is found otherwise it returns NULL.
16373		 * @example <caption>This example shows retrieving a column by name assuming a column called "id" exists. The <code>columns</code> object is an instance of {@link FooTable.Columns}.</caption>
16374		 * var column = columns.get('id');
16375		 * if (column instanceof FooTable.Column){
16376		 * 	// found the "id" column
16377		 * } else {
16378		 * 	// no column with a name of "id" exists
16379		 * }
16380		 * // to get an array of all hidden columns
16381		 * var columns = columns.get(function(col){
16382		 *  return col.hidden;
16383		 * });
16384		 */
16385		get: function(column){
16386			if (column instanceof F.Column) return column;
16387			if (F.is.string(column)) return F.arr.first(this.array, function (col) { return col.name == column; });
16388			if (F.is.number(column)) return F.arr.first(this.array, function (col) { return col.index == column; });
16389			if (F.is.fn(column)) return F.arr.get(this.array, column);
16390			return null;
16391		},
16392		/**
16393		 * Takes an array of column names, index's or actual {@link FooTable.Column} and ensures that an array of only {@link FooTable.Column} is returned.
16394		 * @instance
16395		 * @param {(Array.<string>|Array.<number>|Array.<FooTable.Column>)} columns - The array of column names, index's or {@link FooTable.Column} to check.
16396		 * @returns {Array.<FooTable.Column>}
16397		 */
16398		ensure: function(columns){
16399			var self = this, result = [];
16400			if (!F.is.array(columns)) return result;
16401			F.arr.each(columns, function(name){
16402				result.push(self.get(name));
16403			});
16404			return result;
16405		}
16406	});
16407
16408	F.components.register('columns', F.Columns, 900);
16409
16410})(jQuery, FooTable);
16411(function(F){
16412	/**
16413	 * An array containing the column options or a jQuery promise that resolves returning the columns. The index of the definitions must match the index of each column as it should appear in the table. For more information on the options available see the {@link FooTable.Column} object.
16414	 * @type {(Array.<object>|jQuery.Promise)}
16415	 * @default []
16416	 * @example <caption>The below shows column definitions for a row defined as <code>{ id: Number, name: String, age: Number }</code>. The ID column has a fixed width, the table is initially sorted on the Name column and the Age column will be hidden on phones.</caption>
16417	 * columns: [
16418	 * 	{ name: 'id', title: 'ID', type: 'number' },
16419	 *	{ name: 'name', title: 'Name', sorted: true, direction: 'ASC' }
16420	 *	{ name: 'age', title: 'Age', type: 'number', breakpoints: 'xs' }
16421	 * ]
16422	 */
16423	F.Defaults.prototype.columns = [];
16424
16425	/**
16426	 * Specifies whether or not the column headers should be displayed.
16427	 * @type {boolean}
16428	 * @default true
16429	 */
16430	F.Defaults.prototype.showHeader = true;
16431})(FooTable);
16432(function ($, F) {
16433	F.Rows = F.Component.extend(/** @lends FooTable.Rows */{
16434		/**
16435		 * The rows class contains all the logic for handling rows.
16436		 * @constructs
16437		 * @extends FooTable.Component
16438		 * @param {FooTable.Table} table -  The parent {@link FooTable.Table} this component belongs to.
16439		 * @returns {FooTable.Rows}
16440		 */
16441		construct: function (table) {
16442			// call the base class constructor
16443			this._super(table, true);
16444
16445			/**
16446			 * This provides a shortcut to the {@link FooTable.Table#options} object.
16447			 * @instance
16448			 * @protected
16449			 * @type {FooTable.Table#options}
16450			 */
16451			this.o = table.o;
16452			/**
16453			 * The current working array of {@link FooTable.Row} objects.
16454			 * @instance
16455			 * @protected
16456			 * @type {Array.<FooTable.Row>}
16457			 * @default []
16458			 */
16459			this.array = [];
16460			/**
16461			 * The base array of rows parsed from either the DOM or the constructor options.
16462			 * The {@link FooTable.Rows#current} member is populated with a shallow clone of this array
16463			 * during the predraw operation before any core or custom components are executed.
16464			 * @instance
16465			 * @protected
16466			 * @type {Array.<FooTable.Row>}
16467			 * @default []
16468			 */
16469			this.all = [];
16470			/**
16471			 * Whether or not to display a toggle in each row when it contains hidden columns.
16472			 * @type {boolean}
16473			 * @default true
16474			 */
16475			this.showToggle = table.o.showToggle;
16476			/**
16477			 * The CSS selector used to filter row click events. If the event.target property matches the selector the row will be toggled.
16478			 * @type {string}
16479			 * @default "tr,td,.footable-toggle"
16480			 */
16481			this.toggleSelector = table.o.toggleSelector;
16482			/**
16483			 * Specifies which column the row toggle is appended to. Supports only two values; "first" and "last"
16484			 * @type {string}
16485			 */
16486			this.toggleColumn = table.o.toggleColumn;
16487			/**
16488			 * The text to display when the table has no rows.
16489			 * @type {string}
16490			 */
16491			this.emptyString = table.o.empty;
16492			/**
16493			 * Whether or not the first rows details are expanded by default when displayed on a device that hides any columns.
16494			 * @type {boolean}
16495			 */
16496			this.expandFirst = table.o.expandFirst;
16497			/**
16498			 * Whether or not all row details are expanded by default when displayed on a device that hides any columns.
16499			 * @type {boolean}
16500			 */
16501			this.expandAll = table.o.expandAll;
16502			/**
16503			 * The jQuery object that contains the empty row control.
16504			 * @type {jQuery}
16505			 */
16506			this.$empty = null;
16507			this._fromHTML = F.is.emptyArray(table.o.rows) && !F.is.promise(table.o.rows);
16508		},
16509		/**
16510		 * This parses the rows from either the tables rows or the supplied options.
16511		 * @instance
16512		 * @protected
16513		 * @returns {jQuery.Promise}
16514		 */
16515		parse: function(){
16516			var self = this;
16517			return $.Deferred(function(d){
16518				var $rows = self.ft.$el.children('tbody').children('tr');
16519				if (F.is.array(self.o.rows) && self.o.rows.length > 0){
16520					self.parseFinalize(d, self.o.rows);
16521				} else if (F.is.promise(self.o.rows)){
16522					self.o.rows.then(function(rows){
16523						self.parseFinalize(d, rows);
16524					}, function(xhr){
16525						d.reject(Error('Rows ajax request error: ' + xhr.status + ' (' + xhr.statusText + ')'));
16526					});
16527				} else if (F.is.jq($rows)){
16528					self.parseFinalize(d, $rows);
16529					$rows.detach();
16530				} else {
16531					self.parseFinalize(d, []);
16532				}
16533			});
16534		},
16535		/**
16536		 * Used to finalize the parsing of rows it is supplied the parse deferred object which must be resolved with an array of {@link FooTable.Row} objects
16537		 * or rejected with an error.
16538		 * @instance
16539		 * @protected
16540		 * @param {jQuery.Deferred} deferred - The deferred object used for parsing.
16541		 * @param {(Array.<object>|jQuery)} rows - An array of row values and options or the jQuery object containing all rows.
16542		 */
16543		parseFinalize: function(deferred, rows){
16544			var self = this, result = $.map(rows, function(r){
16545				return new F.Row(self.ft, self.ft.columns.array, r);
16546			});
16547			deferred.resolve(result);
16548		},
16549		/**
16550		 * The columns preinit method is used to parse and check the column options supplied from both static content and through the constructor.
16551		 * @instance
16552		 * @protected
16553		 * @param {object} data - The jQuery data object from the root table element.
16554		 * @fires FooTable.Rows#"preinit.ft.rows"
16555		 */
16556		preinit: function(data){
16557			var self = this;
16558			/**
16559			 * The preinit.ft.rows event is raised before any UI is created and provides the tables jQuery data object for additional options parsing.
16560			 * Calling preventDefault on this event will disable the entire plugin.
16561			 * @event FooTable.Rows#"preinit.ft.rows"
16562			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
16563			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
16564			 * @param {object} data - The jQuery data object of the table raising the event.
16565			 */
16566			return self.ft.raise('preinit.ft.rows', [data]).then(function(){
16567				return self.parse().then(function(rows){
16568					self.all = rows;
16569					self.array = self.all.slice(0);
16570					self.showToggle = F.is.boolean(data.showToggle) ? data.showToggle : self.showToggle;
16571					self.toggleSelector = F.is.string(data.toggleSelector) ? data.toggleSelector : self.toggleSelector;
16572					self.toggleColumn = F.is.string(data.toggleColumn) ? data.toggleColumn : self.toggleColumn;
16573					if (self.toggleColumn != "first" && self.toggleColumn != "last") self.toggleColumn = "first";
16574					self.emptyString = F.is.string(data.empty) ? data.empty : self.emptyString;
16575					self.expandFirst = F.is.boolean(data.expandFirst) ? data.expandFirst : self.expandFirst;
16576					self.expandAll = F.is.boolean(data.expandAll) ? data.expandAll : self.expandAll;
16577				});
16578			});
16579		},
16580		/**
16581		 * Initializes the rows class using the supplied table and options.
16582		 * @instance
16583		 * @protected
16584		 * @fires FooTable.Rows#"init.ft.rows"
16585		 */
16586		init: function () {
16587			var self = this;
16588			/**
16589			 * The init.ft.rows event is raised after the the rows are parsed from either the DOM or the options.
16590			 * Calling preventDefault on this event will disable the entire plugin.
16591			 * @event FooTable.Rows#"init.ft.rows"
16592			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
16593			 * @param {FooTable.Table} instance - The instance of the plugin raising the event.
16594			 * @param {Array.<FooTable.Row>} rows - The array of {@link FooTable.Row} objects parsed from the DOM or the options.
16595			 */
16596			return self.ft.raise('init.ft.rows', [self.all]).then(function(){
16597				self.$create();
16598			});
16599		},
16600		/**
16601		 * Destroys the rows component removing any UI generated from the table.
16602		 * @instance
16603		 * @protected
16604		 * @fires FooTable.Rows#"destroy.ft.rows"
16605		 */
16606		destroy: function(){
16607			/**
16608			 * The destroy.ft.rows event is raised before its UI is removed.
16609			 * Calling preventDefault on this event will prevent the component from being destroyed.
16610			 * @event FooTable.Rows#"destroy.ft.rows"
16611			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
16612			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
16613			 */
16614			var self = this;
16615			this.ft.raise('destroy.ft.rows').then(function(){
16616				F.arr.each(self.array, function(row){
16617					row.predraw(!self._fromHTML);
16618				});
16619				self.all = self.array = [];
16620			});
16621		},
16622		/**
16623		 * Performs the predraw operations that are required including creating the shallow clone of the {@link FooTable.Rows#array} to work with.
16624		 * @instance
16625		 * @protected
16626		 */
16627		predraw: function(){
16628			F.arr.each(this.array, function(row){
16629				row.predraw();
16630			});
16631			this.array = this.all.slice(0);
16632		},
16633		$create: function(){
16634			this.$empty = $('<tr/>', { 'class': 'footable-empty' }).append($('<td/>').text(this.emptyString));
16635		},
16636		/**
16637		 * Performs the actual drawing of the table rows.
16638		 * @instance
16639		 * @protected
16640		 */
16641		draw: function(){
16642			var self = this, $tbody = self.ft.$el.children('tbody'), first = true;
16643			// if we have rows
16644			if (self.array.length > 0){
16645				self.$empty.detach();
16646				// loop through them appending to the tbody and then drawing
16647				F.arr.each(self.array, function(row){
16648					if ((self.expandFirst && first) || self.expandAll){
16649						row.expanded = true;
16650						first = false;
16651					}
16652					row.draw($tbody);
16653				});
16654			} else {
16655				// otherwise display the $empty row
16656				self.$empty.children('td').attr('colspan', self.ft.columns.visibleColspan);
16657				$tbody.append(self.$empty);
16658			}
16659		},
16660		/**
16661		 * Loads a JSON array of row objects into the table
16662		 * @instance
16663		 * @param {Array.<object>} data - An array of row objects to load.
16664		 * @param {boolean} [append=false] - Whether or not to append the new rows to the current rows array or to replace them entirely.
16665		 */
16666		load: function(data, append){
16667			var self = this, rows = $.map(data, function(r){
16668				return new F.Row(self.ft, self.ft.columns.array, r);
16669			});
16670			F.arr.each(this.array, function(row){
16671				row.predraw();
16672			});
16673			this.all = (F.is.boolean(append) ? append : false) ? this.all.concat(rows) : rows;
16674			this.array = this.all.slice(0);
16675			this.ft.draw();
16676		},
16677		/**
16678		 * Expands all visible rows.
16679		 * @instance
16680		 */
16681		expand: function(){
16682			F.arr.each(this.array, function(row){
16683				row.expand();
16684			});
16685		},
16686		/**
16687		 * Collapses all visible rows.
16688		 * @instance
16689		 */
16690		collapse: function(){
16691			F.arr.each(this.array, function(row){
16692				row.collapse();
16693			});
16694		}
16695	});
16696
16697	F.components.register('rows', F.Rows, 800);
16698
16699})(jQuery, FooTable);
16700(function(F){
16701	/**
16702	 * An array of JSON objects containing the row data or a jQuery promise that resolves returning the row data.
16703	 * @type {(Array.<object>|jQuery.Promise)}
16704	 * @default []
16705	 */
16706	F.Defaults.prototype.rows = [];
16707
16708	/**
16709	 * A string to display when there are no rows in the table.
16710	 * @type {string}
16711	 * @default "No results"
16712	 */
16713	F.Defaults.prototype.empty = 'No results';
16714
16715	/**
16716	 * Whether or not the toggle is appended to each row.
16717	 * @type {boolean}
16718	 * @default true
16719	 */
16720	F.Defaults.prototype.showToggle = true;
16721
16722	/**
16723	 * The CSS selector used to filter row click events. If the event.target property matches the selector the row will be toggled.
16724	 * @type {string}
16725	 * @default "tr,td,.footable-toggle"
16726	 */
16727	F.Defaults.prototype.toggleSelector = 'tr,td,.footable-toggle';
16728
16729	/**
16730	 * Specifies which column to display the row toggle in. The only supported values are "first" or "last".
16731	 * @type {string}
16732	 * @default "first"
16733	 */
16734	F.Defaults.prototype.toggleColumn = 'first';
16735
16736	/**
16737	 * Whether or not the first rows details are expanded by default when displayed on a device that hides any columns.
16738	 * @type {boolean}
16739	 */
16740	F.Defaults.prototype.expandFirst = false;
16741
16742	/**
16743	 * Whether or not all row details are expanded by default when displayed on a device that hides any columns.
16744	 * @type {boolean}
16745	 */
16746	F.Defaults.prototype.expandAll = false;
16747})(FooTable);
16748(function(F){
16749	/**
16750	 * Loads a JSON array of row objects into the table
16751	 * @param {Array.<object>} data - An array of row objects to load.
16752	 * @param {boolean} [append=false] - Whether or not to append the new rows to the current rows array or to replace them entirely.
16753	 */
16754	F.Table.prototype.loadRows = function(data, append){
16755		this.rows.load(data, append);
16756	};
16757})(FooTable);
16758(function(F){
16759	F.Filter = F.Class.extend(/** @lends FooTable.Filter */{
16760		/**
16761		 * The filter object contains the query to filter by and the columns to apply it to.
16762		 * @constructs
16763		 * @extends FooTable.Class
16764		 * @param {string} name - The name for the filter.
16765		 * @param {(string|FooTable.Query)} query - The query for the filter.
16766		 * @param {Array.<FooTable.Column>} columns - The columns to apply the query to.
16767		 * @param {string} [space="AND"] - How the query treats space chars.
16768		 * @param {boolean} [connectors=true] - Whether or not to replace phrase connectors (+.-_) with spaces.
16769		 * @param {boolean} [ignoreCase=true] - Whether or not ignore case when matching.
16770		 * @param {boolean} [hidden=true] - Whether or not this is a hidden filter.
16771		 * @returns {FooTable.Filter}
16772		 */
16773		construct: function(name, query, columns, space, connectors, ignoreCase, hidden){
16774			/**
16775			 * The name of the filter.
16776			 * @instance
16777			 * @type {string}
16778			 */
16779			this.name = name;
16780			/**
16781			 * A string specifying how the filter treats space characters. Can be either "OR" or "AND".
16782			 * @instance
16783			 * @type {string}
16784			 */
16785			this.space = F.is.string(space) && (space == 'OR' || space == 'AND') ? space : 'AND';
16786			/**
16787			 * Whether or not to replace phrase connectors (+.-_) with spaces before executing the query.
16788			 * @instance
16789			 * @type {boolean}
16790			 */
16791			this.connectors = F.is.boolean(connectors) ? connectors : true;
16792			/**
16793			 * Whether or not ignore case when matching.
16794			 * @instance
16795			 * @type {boolean}
16796			 */
16797			this.ignoreCase = F.is.boolean(ignoreCase) ? ignoreCase : true;
16798			/**
16799			 * Whether or not this is a hidden filter.
16800			 * @instance
16801			 * @type {boolean}
16802			 */
16803			this.hidden = F.is.boolean(hidden) ? hidden : false;
16804			/**
16805			 * The query for the filter.
16806			 * @instance
16807			 * @type {(string|FooTable.Query)}
16808			 */
16809			this.query = query instanceof F.Query ? query : new F.Query(query, this.space, this.connectors, this.ignoreCase);
16810			/**
16811			 * The columns to apply the query to.
16812			 * @instance
16813			 * @type {Array.<FooTable.Column>}
16814			 */
16815			this.columns = columns;
16816		},
16817		/**
16818		 * Checks if the current filter matches the supplied string.
16819		 * If the current query property is a string it will be auto converted to a {@link FooTable.Query} object to perform the match.
16820		 * @instance
16821		 * @param {string} str - The string to check.
16822		 * @returns {boolean}
16823		 */
16824		match: function(str){
16825			if (!F.is.string(str)) return false;
16826			if (F.is.string(this.query)){
16827				this.query = new F.Query(this.query, this.space, this.connectors, this.ignoreCase);
16828			}
16829			return this.query instanceof F.Query ? this.query.match(str) : false;
16830		},
16831		/**
16832		 * Checks if the current filter matches the supplied {@link FooTable.Row}.
16833		 * @instance
16834		 * @param {FooTable.Row} row - The row to check.
16835		 * @returns {boolean}
16836		 */
16837		matchRow: function(row){
16838			var self = this, text = F.arr.map(row.cells, function(cell){
16839				return F.arr.contains(self.columns, cell.column) ? cell.filterValue : null;
16840			}).join(' ');
16841			return self.match(text);
16842		}
16843	});
16844
16845})(FooTable);
16846(function ($, F) {
16847	F.Filtering = F.Component.extend(/** @lends FooTable.Filtering */{
16848		/**
16849		 * The filtering component adds a search input and column selector dropdown to the table allowing users to filter the using space delimited queries.
16850		 * @constructs
16851		 * @extends FooTable.Component
16852		 * @param {FooTable.Table} table - The parent {@link FooTable.Table} object for the component.
16853		 * @returns {FooTable.Filtering}
16854		 */
16855		construct: function (table) {
16856			// call the constructor of the base class
16857			this._super(table, table.o.filtering.enabled);
16858
16859			/* PUBLIC */
16860			/**
16861			 * The filters to apply to the current {@link FooTable.Rows#array}.
16862			 * @instance
16863			 * @type {Array.<FooTable.Filter>}
16864			 */
16865			this.filters = table.o.filtering.filters;
16866			/**
16867			 * The delay in milliseconds before the query is auto applied after a change.
16868			 * @instance
16869			 * @type {number}
16870			 */
16871			this.delay = table.o.filtering.delay;
16872			/**
16873			 * The minimum number of characters allowed in the search input before it is auto applied.
16874			 * @instance
16875			 * @type {number}
16876			 */
16877			this.min = table.o.filtering.min;
16878			/**
16879			 * Specifies how whitespace in a filter query is handled.
16880			 * @instance
16881			 * @type {string}
16882			 */
16883			this.space = table.o.filtering.space;
16884			/**
16885			 * Whether or not to replace phrase connectors (+.-_) with spaces before executing the query.
16886			 * @instance
16887			 * @type {boolean}
16888			 */
16889			this.connectors = table.o.filtering.connectors;
16890			/**
16891			 * Whether or not ignore case when matching.
16892			 * @instance
16893			 * @type {boolean}
16894			 */
16895			this.ignoreCase = table.o.filtering.ignoreCase;
16896			/**
16897			 * Whether or not search queries are treated as phrases when matching.
16898			 * @instance
16899			 * @type {boolean}
16900			 */
16901			this.exactMatch = table.o.filtering.exactMatch;
16902			/**
16903			 * The placeholder text to display within the search $input.
16904			 * @instance
16905			 * @type {string}
16906			 */
16907			this.placeholder = table.o.filtering.placeholder;
16908			/**
16909			 * The title to display at the top of the search input column select.
16910			 * @type {string}
16911			 */
16912			this.dropdownTitle = table.o.filtering.dropdownTitle;
16913			/**
16914			 * The position of the $search input within the filtering rows cell.
16915			 * @type {string}
16916			 */
16917			this.position = table.o.filtering.position;
16918			/**
16919			 * Whether or not to focus the search input after the search/clear button is clicked or after auto applying the search input query.
16920			 * @type {boolean}
16921			 */
16922			this.focus = table.o.filtering.focus;
16923			/**
16924			 * A selector specifying where to place the filtering components form, if null the form is displayed within a row in the head of the table.
16925			 * @type {string}
16926			 */
16927			this.container = table.o.filtering.container;
16928			/**
16929			 * The jQuery object of the element containing the entire filtering form.
16930			 * @instance
16931			 * @type {jQuery}
16932			 */
16933			this.$container = null;
16934			/**
16935			 * The jQuery row object that contains all the filtering specific elements.
16936			 * @instance
16937			 * @type {jQuery}
16938			 */
16939			this.$row = null;
16940			/**
16941			 * The jQuery cell object that contains the search input and column selector.
16942			 * @instance
16943			 * @type {jQuery}
16944			 */
16945			this.$cell = null;
16946			/**
16947			 * The jQuery form object of the form that contains the search input and column selector.
16948			 * @instance
16949			 * @type {jQuery}
16950			 */
16951			this.$form = null;
16952			/**
16953			 * The jQuery object of the column selector dropdown.
16954			 * @instance
16955			 * @type {jQuery}
16956			 */
16957			this.$dropdown = null;
16958			/**
16959			 * The jQuery object of the search input.
16960			 * @instance
16961			 * @type {jQuery}
16962			 */
16963			this.$input = null;
16964			/**
16965			 * The jQuery object of the search button.
16966			 * @instance
16967			 * @type {jQuery}
16968			 */
16969			this.$button = null;
16970
16971			/* PRIVATE */
16972			/**
16973			 * The timeout ID for the filter changed event.
16974			 * @instance
16975			 * @private
16976			 * @type {?number}
16977			 */
16978			this._filterTimeout = null;
16979			/**
16980			 * The regular expression used to check for encapsulating quotations.
16981			 * @instance
16982			 * @private
16983			 * @type {RegExp}
16984			 */
16985			this._exactRegExp = /^"(.*?)"$/;
16986		},
16987
16988		/* PROTECTED */
16989		/**
16990		 * Checks the supplied data and options for the filtering component.
16991		 * @instance
16992		 * @protected
16993		 * @param {object} data - The jQuery data object from the parent table.
16994		 * @fires FooTable.Filtering#"preinit.ft.filtering"
16995		 */
16996		preinit: function(data){
16997			var self = this;
16998			/**
16999			 * The preinit.ft.filtering event is raised before the UI is created and provides the tables jQuery data object for additional options parsing.
17000			 * Calling preventDefault on this event will disable the component.
17001			 * @event FooTable.Filtering#"preinit.ft.filtering"
17002			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
17003			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
17004			 * @param {object} data - The jQuery data object of the table raising the event.
17005			 */
17006			return self.ft.raise('preinit.ft.filtering').then(function(){
17007				// first check if filtering is enabled via the class being applied
17008				if (self.ft.$el.hasClass('footable-filtering'))
17009					self.enabled = true;
17010				// then check if the data-filtering-enabled attribute has been set
17011				self.enabled = F.is.boolean(data.filtering)
17012					? data.filtering
17013					: self.enabled;
17014
17015				// if filtering is not enabled exit early as we don't need to do anything else
17016				if (!self.enabled) return;
17017
17018				self.space = F.is.string(data.filterSpace)
17019					? data.filterSpace
17020					: self.space;
17021
17022				self.min = F.is.number(data.filterMin)
17023					? data.filterMin
17024					: self.min;
17025
17026				self.connectors = F.is.boolean(data.filterConnectors)
17027					? data.filterConnectors
17028					: self.connectors;
17029
17030				self.ignoreCase = F.is.boolean(data.filterIgnoreCase)
17031					? data.filterIgnoreCase
17032					: self.ignoreCase;
17033
17034				self.exactMatch = F.is.boolean(data.filterExactMatch)
17035					? data.filterExactMatch
17036					: self.exactMatch;
17037
17038				self.focus = F.is.boolean(data.filterFocus)
17039					? data.filterFocus
17040					: self.focus;
17041
17042				self.delay = F.is.number(data.filterDelay)
17043					? data.filterDelay
17044					: self.delay;
17045
17046				self.placeholder = F.is.string(data.filterPlaceholder)
17047					? data.filterPlaceholder
17048					: self.placeholder;
17049
17050				self.dropdownTitle = F.is.string(data.filterDropdownTitle)
17051					? data.filterDropdownTitle
17052					: self.dropdownTitle;
17053
17054				self.container = F.is.string(data.filterContainer)
17055					? data.filterContainer
17056					: self.container;
17057
17058				self.filters = F.is.array(data.filterFilters)
17059					? self.ensure(data.filterFilters)
17060					: self.ensure(self.filters);
17061
17062				if (self.ft.$el.hasClass('footable-filtering-left'))
17063					self.position = 'left';
17064				if (self.ft.$el.hasClass('footable-filtering-center'))
17065					self.position = 'center';
17066				if (self.ft.$el.hasClass('footable-filtering-right'))
17067					self.position = 'right';
17068
17069				self.position = F.is.string(data.filterPosition)
17070					? data.filterPosition
17071					: self.position;
17072			},function(){
17073				self.enabled = false;
17074			});
17075		},
17076		/**
17077		 * Initializes the filtering component for the plugin.
17078		 * @instance
17079		 * @protected
17080		 * @fires FooTable.Filtering#"init.ft.filtering"
17081		 */
17082		init: function () {
17083			var self = this;
17084			/**
17085			 * The init.ft.filtering event is raised before its UI is generated.
17086			 * Calling preventDefault on this event will disable the component.
17087			 * @event FooTable.Filtering#"init.ft.filtering"
17088			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
17089			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
17090			 */
17091			return self.ft.raise('init.ft.filtering').then(function(){
17092				self.$create();
17093			}, function(){
17094				self.enabled = false;
17095			});
17096		},
17097		/**
17098		 * Destroys the filtering component removing any UI from the table.
17099		 * @instance
17100		 * @protected
17101		 * @fires FooTable.Filtering#"destroy.ft.filtering"
17102		 */
17103		destroy: function () {
17104			var self = this;
17105			/**
17106			 * The destroy.ft.filtering event is raised before its UI is removed.
17107			 * Calling preventDefault on this event will prevent the component from being destroyed.
17108			 * @event FooTable.Filtering#"destroy.ft.filtering"
17109			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
17110			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
17111			 */
17112			return self.ft.raise('destroy.ft.filtering').then(function(){
17113				self.ft.$el.removeClass('footable-filtering')
17114					.find('thead > tr.footable-filtering').remove();
17115			});
17116		},
17117		/**
17118		 * Creates the filtering UI from the current options setting the various jQuery properties of this component.
17119		 * @instance
17120		 * @protected
17121		 * @this FooTable.Filtering
17122		 */
17123		$create: function () {
17124			var self = this;
17125			// generate the cell that actually contains all the UI.
17126			var $form_grp = $('<div/>', {'class': 'form-group footable-filtering-search'})
17127					.append($('<label/>', {'class': 'sr-only', text: 'Search'})),
17128				$input_grp = $('<div/>', {'class': 'input-group'}).appendTo($form_grp),
17129				$input_grp_btn = $('<div/>', {'class': 'input-group-btn'}),
17130				$dropdown_toggle = $('<button/>', {type: 'button', 'class': 'btn btn-default dropdown-toggle'})
17131					.on('click', { self: self }, self._onDropdownToggleClicked)
17132					.append($('<span/>', {'class': 'caret'})),
17133				position;
17134
17135			switch (self.position){
17136				case 'left': position = 'footable-filtering-left'; break;
17137				case 'center': position = 'footable-filtering-center'; break;
17138				default: position = 'footable-filtering-right'; break;
17139			}
17140			self.ft.$el.addClass('footable-filtering').addClass(position);
17141
17142			self.$container = self.container === null ? $() : $(self.container).first();
17143			if (!self.$container.length){
17144				// add it to a row and then populate it with the search input and column selector dropdown.
17145				self.$row = $('<tr/>', {'class': 'footable-filtering'}).prependTo(self.ft.$el.children('thead'));
17146				self.$cell = $('<th/>').attr('colspan', self.ft.columns.visibleColspan).appendTo(self.$row);
17147				self.$container = self.$cell;
17148			} else {
17149				self.$container.addClass('footable-filtering-external').addClass(position);
17150			}
17151			self.$form = $('<form/>', {'class': 'form-inline'}).append($form_grp).appendTo(self.$container);
17152
17153			self.$input = $('<input/>', {type: 'text', 'class': 'form-control', placeholder: self.placeholder});
17154
17155			self.$button = $('<button/>', {type: 'button', 'class': 'btn btn-primary'})
17156				.on('click', { self: self }, self._onSearchButtonClicked)
17157				.append($('<span/>', {'class': 'fooicon fooicon-search'}));
17158
17159			self.$dropdown = $('<ul/>', {'class': 'dropdown-menu dropdown-menu-right'});
17160			if (!F.is.emptyString(self.dropdownTitle)){
17161				self.$dropdown.append($('<li/>', {'class': 'dropdown-header','text': self.dropdownTitle}));
17162			}
17163			self.$dropdown.append(
17164				F.arr.map(self.ft.columns.array, function (col) {
17165					return col.filterable ? $('<li/>').append(
17166						$('<a/>', {'class': 'checkbox'}).append(
17167							$('<label/>', {html: col.title}).prepend(
17168								$('<input/>', {type: 'checkbox', checked: true}).data('__FooTableColumn__', col)
17169							)
17170						)
17171					) : null;
17172				})
17173			);
17174
17175			if (self.delay > 0){
17176				self.$input.on('keypress keyup paste', { self: self }, self._onSearchInputChanged);
17177				self.$dropdown.on('click', 'input[type="checkbox"]', {self: self}, self._onSearchColumnClicked);
17178			}
17179
17180			$input_grp_btn.append(self.$button, $dropdown_toggle, self.$dropdown);
17181			$input_grp.append(self.$input, $input_grp_btn);
17182		},
17183		/**
17184		 * Performs the filtering of rows before they are appended to the page.
17185		 * @instance
17186		 * @protected
17187		 */
17188		predraw: function(){
17189			if (F.is.emptyArray(this.filters))
17190				return;
17191
17192			var self = this;
17193			self.ft.rows.array = $.grep(self.ft.rows.array, function(r){
17194				return r.filtered(self.filters);
17195			});
17196		},
17197		/**
17198		 * As the rows are drawn by the {@link FooTable.Rows#draw}
17198 method this simply updates the colspan for the UI.
17199		 * @instance
17200		 * @protected
17201		 */
17202		draw: function(){
17203			if (F.is.jq(this.$cell)){
17204				this.$cell.attr('colspan', this.ft.columns.visibleColspan);
17205			}
17206			var search = this.find('search');
17207			if (search instanceof F.Filter){
17208				var query = search.query.val();
17209				if (this.exactMatch && this._exactRegExp.test(query)){
17210					query = query.replace(this._exactRegExp, '$1');
17211				}
17212				this.$input.val(query);
17213			} else {
17214				this.$input.val(null);
17215			}
17216			this.setButton(!F.arr.any(this.filters, function(f){ return !f.hidden; }));
17217		},
17218
17219		/* PUBLIC */
17220		/**
17221		 * Adds or updates the filter using the supplied name, query and columns.
17222		 * @instance
17223		 * @param {(string|FooTable.Filter|object)} nameOrFilter - The name for the filter or the actual filter object itself.
17224		 * @param {(string|FooTable.Query)} [query] - The query for the filter. This is only optional when the first parameter is a filter object.
17225		 * @param {(Array.<number>|Array.<string>|Array.<FooTable.Column>)} [columns] - The columns to apply the filter to.
17226		 * 	If not supplied the filter will be applied to all selected columns in the search input dropdown.
17227		 * @param {boolean} [ignoreCase=true] - Whether or not ignore case when matching.
17228		 * @param {boolean} [connectors=true] - Whether or not to replace phrase connectors (+.-_) with spaces.
17229		 * @param {string} [space="AND"] - How the query treats space chars.
17230		 * @param {boolean} [hidden=true] - Whether or not this is a hidden filter.
17231		 */
17232		addFilter: function(nameOrFilter, query, columns, ignoreCase, connectors, space, hidden){
17233			var f = this.createFilter(nameOrFilter, query, columns, ignoreCase, connectors, space, hidden);
17234			if (f instanceof F.Filter){
17235				this.removeFilter(f.name);
17236				this.filters.push(f);
17237			}
17238		},
17239		/**
17240		 * Removes the filter using the supplied name if it exists.
17241		 * @instance
17242		 * @param {string} name - The name of the filter to remove.
17243		 */
17244		removeFilter: function(name){
17245			F.arr.remove(this.filters, function(f){ return f.name == name; });
17246		},
17247		/**
17248		 * Performs the required steps to handle filtering including the raising of the {@link FooTable.Filtering#"before.ft.filtering"} and {@link FooTable.Filtering#"after.ft.filtering"} events.
17249		 * @instance
17250		 * @param {boolean} [focus=false] - Whether or not to set the focus to the input once filtering is complete.
17251		 * @returns {jQuery.Promise}
17252		 * @fires FooTable.Filtering#"before.ft.filtering"
17253		 * @fires FooTable.Filtering#"after.ft.filtering"
17254		 */
17255		filter: function(focus){
17256			var self = this;
17257			self.filters = self.ensure(self.filters);
17258			/**
17259			 * The before.ft.filtering event is raised before a filter is applied and allows listeners to modify the filter or cancel it completely by calling preventDefault on the jQuery.Event object.
17260			 * @event FooTable.Filtering#"before.ft.filtering"
17261			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
17262			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
17263			 * @param {Array.<FooTable.Filter>} filters - The filters that are about to be applied.
17264			 */
17265			return self.ft.raise('before.ft.filtering', [self.filters]).then(function(){
17266				self.filters = self.ensure(self.filters);
17267				if (focus){
17268					var start = self.$input.prop('selectionStart'),
17269						end = self.$input.prop('selectionEnd');
17270				}
17271				return self.ft.draw().then(function(){
17272					if (focus){
17273						self.$input.focus().prop({
17274							selectionStart: start,
17275							selectionEnd: end
17276						});
17277					}
17278					/**
17279					 * The after.ft.filtering event is raised after a filter has been applied.
17280					 * @event FooTable.Filtering#"after.ft.filtering"
17281					 * @param {jQuery.Event} e - The jQuery.Event object for the event.
17282					 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
17283					 * @param {FooTable.Filter} filter - The filters that were applied.
17284					 */
17285					self.ft.raise('after.ft.filtering', [self.filters]);
17286				});
17287			});
17288		},
17289		/**
17290		 * Removes the current search filter.
17291		 * @instance
17292		 * @returns {jQuery.Promise}
17293		 * @fires FooTable.Filtering#"before.ft.filtering"
17294		 * @fires FooTable.Filtering#"after.ft.filtering"
17295		 */
17296		clear: function(){
17297			this.filters = F.arr.get(this.filters, function(f){ return f.hidden; });
17298			return this.filter(this.focus);
17299		},
17300		/**
17301		 * Toggles the button icon between the search and clear icons based on the supplied value.
17302		 * @instance
17303		 * @param {boolean} search - Whether or not to display the search icon.
17304		 */
17305		setButton: function(search){
17306			if (!search){
17307				this.$button.children('.fooicon').removeClass('fooicon-search').addClass('fooicon-remove');
17308			} else {
17309				this.$button.children('.fooicon').removeClass('fooicon-remove').addClass('fooicon-search');
17310			}
17311		},
17312		/**
17313		 * Finds a filter by name.
17314		 * @param {string} name - The name of the filter to find.
17315		 * @returns {(FooTable.Filter|null)}
17316		 */
17317		find: function(name){
17318			return F.arr.first(this.filters, function(f){ return f.name == name; });
17319		},
17320		/**
17321		 * Gets an array of {@link FooTable.Column} to apply the search filter to. This also doubles as the default columns for filters which do not specify any columns.
17322		 * @instance
17323		 * @returns {Array.<FooTable.Column>}
17324		 */
17325		columns: function(){
17326			if (F.is.jq(this.$dropdown)){
17327				// if we have a dropdown containing the column names get the selected columns from there
17328				return this.$dropdown.find('input:checked').map(function(){
17329					return $(this).data('__FooTableColumn__');
17330				}).get();
17331			} else {
17332				// otherwise find all columns that are set to be filterable.
17333				return this.ft.columns.get(function(c){ return c.filterable; });
17334			}
17335		},
17336		/**
17337		 * Takes an array of plain objects containing the filter values or actual {@link FooTable.Filter} objects and ensures that an array of only {@link FooTable.Filter} is returned.
17338		 * If supplied a plain object that object must contain a name, query and columns properties which are used to create a new {@link FooTable.Filter}.
17339		 * @instance
17340		 * @param {({name: string, query: (string|FooTable.Query), columns: (Array.<string>|Array.<number>|Array.<FooTable.Column>)}|Array.<FooTable.Filter>)} filters - The array of filters to check.
17341		 * @returns {Array.<FooTable.Filter>}
17342		 */
17343		ensure: function(filters){
17344			var self = this, parsed = [], filterable = self.columns();
17345			if (!F.is.emptyArray(filters)){
17346				F.arr.each(filters, function(f){
17347					f = self._ensure(f, filterable);
17348					if (f instanceof F.Filter) parsed.push(f);
17349				});
17350			}
17351			return parsed;
17352		},
17353
17354		/**
17355		 * Creates a new filter using the supplied object or individual parameters to populate it.
17356		 * @instance
17357		 * @param {(string|FooTable.Filter|object)} nameOrObject - The name for the filter or the actual filter object itself.
17358		 * @param {(string|FooTable.Query)} [query] - The query for the filter. This is only optional when the first parameter is a filter object.
17359		 * @param {(Array.<number>|Array.<string>|Array.<FooTable.Column>)} [columns] - The columns to apply the filter to.
17360		 * 	If not supplied the filter will be applied to all selected columns in the search input dropdown.
17361		 * @param {boolean} [ignoreCase=true] - Whether or not ignore case when matching.
17362		 * @param {boolean} [connectors=true] - Whether or not to replace phrase connectors (+.-_) with spaces.
17363		 * @param {string} [space="AND"] - How the query treats space chars.
17364		 * @param {boolean} [hidden=true] - Whether or not this is a hidden filter.
17365		 * @returns {*}
17366		 */
17367		createFilter: function(nameOrObject, query, columns, ignoreCase, connectors, space, hidden){
17368			if (F.is.string(nameOrObject)){
17369				nameOrObject = {name: nameOrObject, query: query, columns: columns, ignoreCase: ignoreCase, connectors: connectors, space: space, hidden: hidden};
17370			}
17371			return this._ensure(nameOrObject, this.columns());
17372		},
17373
17374		/* PRIVATE */
17375		_ensure: function(filter, selectedColumns){
17376			if ((F.is.hash(filter) || filter instanceof F.Filter) && !F.is.emptyString(filter.name) && (!F.is.emptyString(filter.query) || filter.query instanceof F.Query)){
17377				filter.columns = F.is.emptyArray(filter.columns) ? selectedColumns : this.ft.columns.ensure(filter.columns);
17378				filter.ignoreCase = F.is.boolean(filter.ignoreCase) ? filter.ignoreCase : this.ignoreCase;
17379				filter.connectors = F.is.boolean(filter.connectors) ? filter.connectors : this.connectors;
17380				filter.hidden = F.is.boolean(filter.hidden) ? filter.hidden : false;
17381				filter.space = F.is.string(filter.space) && (filter.space === 'AND' || filter.space === 'OR') ? filter.space : this.space;
17382				filter.query = F.is.string(filter.query) ? new F.Query(filter.query, filter.space, filter.connectors, filter.ignoreCase) : filter.query;
17383				return (filter instanceof F.Filter)
17384					? filter
17385					: new F.Filter(filter.name, filter.query, filter.columns, filter.space, filter.connectors, filter.ignoreCase, filter.hidden);
17386			}
17387			return null;
17388		},
17389		/**
17390		 * Handles the change event for the {@link FooTable.Filtering#$input}.
17391		 * @instance
17392		 * @private
17393		 * @param {jQuery.Event} e - The event object for the event.
17394		 */
17395		_onSearchInputChanged: function (e) {
17396			var self = e.data.self;
17397			var alpha = e.type == 'keypress' && !F.is.emptyString(String.fromCharCode(e.charCode)),
17398				ctrl = e.type == 'keyup' && (e.which == 8 || e.which == 46),
17399				paste = e.type == 'paste'; // backspace & delete
17400
17401			// if alphanumeric characters or specific control characters
17402			if(alpha || ctrl || paste) {
17403				if (e.which == 13) e.preventDefault();
17404				if (self._filterTimeout != null) clearTimeout(self._filterTimeout);
17405				self._filterTimeout = setTimeout(function(){
17406					self._filterTimeout = null;
17407					var query = self.$input.val();
17408					if (query.length >= self.min){
17409						if (self.exactMatch && !self._exactRegExp.test(query)){
17410							query = '"' + query + '"';
17411						}
17412						self.addFilter('search', query);
17413						self.filter(self.focus);
17414					} else if (F.is.emptyString(query)){
17415						self.clear();
17416					}
17417				}, self.delay);
17418			}
17419		},
17420		/**
17421		 * Handles the click event for the {@link FooTable.Filtering#$button}.
17422		 * @instance
17423		 * @private
17424		 * @param {jQuery.Event} e - The event object for the event.
17425		 */
17426		_onSearchButtonClicked: function (e) {
17427			e.preventDefault();
17428			var self = e.data.self;
17429			if (self._filterTimeout != null) clearTimeout(self._filterTimeout);
17430			var $icon = self.$button.children('.fooicon');
17431			if ($icon.hasClass('fooicon-remove')) self.clear();
17432			else {
17433				var query = self.$input.val();
17434				if (query.length >= self.min){
17435					if (self.exactMatch && !self._exactRegExp.test(query)){
17436						query = '"' + query + '"';
17437					}
17438					self.addFilter('search', query);
17439					self.filter(self.focus);
17440				}
17441			}
17442		},
17443		/**
17444		 * Handles the click event for the column checkboxes in the {@link FooTable.Filtering#$dropdown}.
17445		 * @instance
17446		 * @private
17447		 * @param {jQuery.Event} e - The event object for the event.
17448		 */
17449		_onSearchColumnClicked: function (e) {
17450			var self = e.data.self;
17451			if (self._filterTimeout != null) clearTimeout(self._filterTimeout);
17452			self._filterTimeout = setTimeout(function(){
17453				self._filterTimeout = null;
17454				var $icon = self.$button.children('.fooicon');
17455				if ($icon.hasClass('fooicon-remove')){
17456					$icon.removeClass('fooicon-remove').addClass('fooicon-search');
17457					self.addFilter('search', self.$input.val());
17458					self.filter();
17459				}
17460			}, self.delay);
17461		},
17462		/**
17463		 * Handles the click event for the {@link FooTable.Filtering#$dropdown} toggle.
17464		 * @instance
17465		 * @private
17466		 * @param {jQuery.Event} e - The event object for the event.
17467		 */
17468		_onDropdownToggleClicked: function (e) {
17469			e.preventDefault();
17470			e.stopPropagation();
17471			var self = e.data.self;
17472			self.$dropdown.parent().toggleClass('open');
17473			if (self.$dropdown.parent().hasClass('open')) $(document).on('click.footable', { self: self }, self._onDocumentClicked);
17474			else $(document).off('click.footable', self._onDocumentClicked);
17475		},
17476		/**
17477		 * Checks all click events when the dropdown is visible and closes the menu if the target is not the dropdown.
17478		 * @instance
17479		 * @private
17480		 * @param {jQuery.Event} e - The event object for the event.
17481		 */
17482		_onDocumentClicked: function(e){
17483			if ($(e.target).closest('.dropdown-menu').length == 0){
17484				e.preventDefault();
17485				var self = e.data.self;
17486				self.$dropdown.parent().removeClass('open');
17487				$(document).off('click.footable', self._onDocumentClicked);
17488			}
17489		}
17490	});
17491
17492	F.components.register('filtering', F.Filtering, 500);
17493
17494})(jQuery, FooTable);
17495
17496(function(F){
17497	F.Query = F.Class.extend(/** @lends FooTable.Query */{
17498		/**
17499		 * The query object is used to parse and test the filtering component's queries
17500		 * @constructs
17501		 * @extends FooTable.Class
17502		 * @param {string} query - The string value of the query.
17503		 * @param {string} [space="AND"] - How the query treats whitespace.
17504		 * @param {boolean} [connectors=true] - Whether or not to replace phrase connectors (+.-_) with spaces.
17505		 * @param {boolean} [ignoreCase=true] - Whether or not ignore case when matching.
17506		 * @returns {FooTable.Query}
17507		 */
17508		construct: function(query, space, connectors, ignoreCase){
17509			/* PRIVATE */
17510			/**
17511			 * Holds the previous value of the query and is used internally in the {@link FooTable.Query#val} method.
17512			 * @type {string}
17513			 * @private
17514			 */
17515			this._original = null;
17516			/**
17517			 * Holds the value for the query. Access to this variable is provided through the {@link FooTable.Query#val} method.
17518			 * @type {string}
17519			 * @private
17520			 */
17521			this._value = null;
17522			/* PUBLIC */
17523			/**
17524			 * A string specifying how the query treats whitespace. Can be either "OR" or "AND".
17525			 * @type {string}
17526			 */
17527			this.space = F.is.string(space) && (space == 'OR' || space == 'AND') ? space : 'AND';
17528			/**
17529			 * Whether or not to replace phrase connectors (+.-_) with spaces before executing the query.
17530			 * @instance
17531			 * @type {boolean}
17532			 */
17533			this.connectors = F.is.boolean(connectors) ? connectors : true;
17534			/**
17535			 * Whether or not ignore case when matching.
17536			 * @instance
17537			 * @type {boolean}
17538			 */
17539			this.ignoreCase = F.is.boolean(ignoreCase) ? ignoreCase : true;
17540			/**
17541			 * The left side of the query if one exists. OR takes precedence over AND.
17542			 * @type {FooTable.Query}
17543			 * @example <caption>The below shows what is meant by the "left" side of a query</caption>
17544			 * query = "Dave AND Mary" - "Dave" is the left side of the query.
17545			 * query = "Dave AND Mary OR John" - "Dave and Mary" is the left side of the query.
17546			 */
17547			this.left = null;
17548			/**
17549			 * The right side of the query if one exists. OR takes precedence over AND.
17550			 * @type {FooTable.Query}
17551			 * @example <caption>The below shows what is meant by the "right" side of a query</caption>
17552			 * query = "Dave AND Mary" - "Mary" is the right side of the query.
17553			 * query = "Dave AND Mary OR John" - "John" is the right side of the query.
17554			 */
17555			this.right = null;
17556			/**
17557			 * The parsed parts of the query. This contains the information used to actually perform a match against a string.
17558			 * @type {Array}
17559			 */
17560			this.parts = [];
17561			/**
17562			 * The type of operand to apply to the results of the individual parts of the query.
17563			 * @type {string}
17564			 */
17565			this.operator = null;
17566			this.val(query);
17567		},
17568		/**
17569		 * Gets or sets the value for the query. During set the value is parsed setting all properties as required.
17570		 * @param {string} [value] - If supplied the value to set for this query.
17571		 * @returns {(string|undefined)}
17572		 */
17573		val: function(value){
17574			// get
17575			if (F.is.emptyString(value)) return this._value;
17576
17577			// set
17578			if (F.is.emptyString(this._original)) this._original = value;
17579			else if (this._original == value) return;
17580
17581			this._value = value;
17582			this._parse();
17583		},
17584		/**
17585		 * Tests the supplied string against the query.
17586		 * @param {string} str - The string to test.
17587		 * @returns {boolean}
17588		 */
17589		match: function(str){
17590			if (F.is.emptyString(this.operator) || this.operator === 'OR')
17591				return this._left(str, false) || this._match(str, false) || this._right(str, false);
17592			if (this.operator === 'AND')
17593				return this._left(str, true) && this._match(str, true) && this._right(str, true);
17594		},
17595		/**
17596		 * Matches this queries parts array against the supplied string.
17597		 * @param {string} str - The string to test.
17598		 * @param {boolean} def - The default value to return based on the operand.
17599		 * @returns {boolean}
17600		 * @private
17601		 */
17602		_match: function(str, def){
17603			var self = this, result = false, empty = F.is.emptyString(str);
17604			if (F.is.emptyArray(self.parts) && self.left instanceof F.Query) return def;
17605			if (F.is.emptyArray(self.parts)) return result;
17606			if (self.space === 'OR'){
17607				// with OR we give the str every part to test and if any match it is a success, we do exit early if a negated match occurs
17608				F.arr.each(self.parts, function(p){
17609					if (p.empty && empty){
17610						result = true;
17611						if (p.negate){
17612							result = false;
17613							return result;
17614						}
17615					} else {
17616						var match = (p.exact ? F.str.containsExact : F.str.contains)(str, p.query, self.ignoreCase);
17617						if (match && !p.negate) result = true;
17618						if (match && p.negate) {
17619							result = false;
17620							return result;
17621						}
17622					}
17623				});
17624			} else {
17625				// otherwise with AND we check until the first failure and then exit
17626				result = true;
17627				F.arr.each(self.parts, function(p){
17628					if (p.empty){
17629						if ((!empty && !p.negate) || (empty && p.negate)) result = false;
17630						return result;
17631					} else {
17632						var match = (p.exact ? F.str.containsExact : F.str.contains)(str, p.query, self.ignoreCase);
17633						if ((!match && !p.negate) || (match && p.negate)) result = false;
17634						return result;
17635					}
17636				});
17637			}
17638			return result;
17639		},
17640		/**
17641		 * Matches the left side of the query if one exists with the supplied string.
17642		 * @param {string} str - The string to test.
17643		 * @param {boolean} def - The default value to return based on the operand.
17644		 * @returns {boolean}
17645		 * @private
17646		 */
17647		_left: function(str, def){
17648			return (this.left instanceof F.Query) ? this.left.match(str) : def;
17649		},
17650		/**
17651		 * Matches the right side of the query if one exists with the supplied string.
17652		 * @param {string} str - The string to test.
17653		 * @param {boolean} def - The default value to return based on the operand.
17654		 * @returns {boolean}
17655		 * @private
17656		 */
17657		_right: function(str, def){
17658			return (this.right instanceof F.Query) ? this.right.match(str) : def;
17659		},
17660		/**
17661		 * Parses the private {@link FooTable.Query#_value} property and populates the object.
17662		 * @private
17663		 */
17664		_parse: function(){
17665			if (F.is.emptyString(this._value)) return;
17666			// OR takes precedence so test for it first
17667			if (/\sOR\s/.test(this._value)){
17668				// we have an OR so split the value on the first occurrence of OR to get the left and right sides of the statement
17669				this.operator = 'OR';
17670				var or = this._value.split(/(?:\sOR\s)(.*)?/);
17671				this.left = new F.Query(or[0], this.space, this.connectors, this.ignoreCase);
17672				this.right = new F.Query(or[1], this.space, this.connectors, this.ignoreCase);
17673			} else if (/\sAND\s/.test(this._value)) {
17674				// there are no more OR's so start with AND
17675				this.operator = 'AND';
17676				var and = this._value.split(/(?:\sAND\s)(.*)?/);
17677				this.left = new F.Query(and[0], this.space, this.connectors, this.ignoreCase);
17678				this.right = new F.Query(and[1], this.space, this.connectors, this.ignoreCase);
17679			} else {
17680				// we have no more statements to parse so set the parts array by parsing each part of the remaining query
17681				var self = this;
17682				this.parts = F.arr.map(this._value.match(/(?:[^\s"]+|"[^"]*")+/g), function(str){
17683					return self._part(str);
17684				});
17685			}
17686		},
17687		/**
17688		 * Parses a single part of a query into an object to use during matching.
17689		 * @param {string} str - The string representation of the part.
17690		 * @returns {{query: string, negate: boolean, phrase: boolean, exact: boolean}}
17691		 * @private
17692		 */
17693		_part: function(str){
17694			var p = {
17695				query: str,
17696				negate: false,
17697				phrase: false,
17698				exact: false,
17699				empty: false
17700			};
17701			// support for NEGATE operand - (minus sign). Remove this first so we can get onto phrase checking
17702			if (F.str.startsWith(p.query, '-')){
17703				p.query = F.str.from(p.query, '-');
17704				p.negate = true;
17705			}
17706			// support for PHRASES (exact matches)
17707			if (/^"(.*?)"$/.test(p.query)){ // if surrounded in quotes strip them and nothing else
17708				p.query = p.query.replace(/^"(.*?)"$/, '$1');
17709				p.phrase = true;
17710				p.exact = true;
17711			} else if (this.connectors && /(?:\w)+?([-_\+\.])(?:\w)+?/.test(p.query)) { // otherwise replace supported phrase connectors (-_+.) with spaces
17712				p.query = p.query.replace(/(?:\w)+?([-_\+\.])(?:\w)+?/g, function(match, p1){
17713					return match.replace(p1, ' ');
17714				});
17715				p.phrase = true;
17716			}
17717			p.empty = p.phrase && F.is.emptyString(p.query);
17718			return p;
17719		}
17720	});
17721
17722})(FooTable);
17723(function(F){
17724
17725	/**
17726	 * The value used by the filtering component during filter operations. Must be a string and can be set using the data-filter-value attribute on the cell itself.
17727	 * If this is not supplied it is set to the result of the toString method called on the value for the cell. Added by the {@link FooTable.Filtering} component.
17728	 * @type {string}
17729	 * @default null
17730	 */
17731	F.Cell.prototype.filterValue = null;
17732
17733	// this is used to define the filtering specific properties on cell creation
17734	F.Cell.prototype.__filtering_define__ = function(valueOrElement){
17735		this.filterValue = this.column.filterValue.call(this.column, valueOrElement);
17736	};
17737
17738	// this is used to update the filterValue property whenever the cell value is changed
17739	F.Cell.prototype.__filtering_val__ = function(value){
17740		if (F.is.defined(value)){
17741			// set only
17742			this.filterValue = this.column.filterValue.call(this.column, value);
17743		}
17744	};
17745
17746	// overrides the public define method and replaces it with our own
17747	F.Cell.extend('define', function(valueOrElement){
17748		this._super(valueOrElement);
17749		this.__filtering_define__(valueOrElement);
17750	});
17751	// overrides the public val method and replaces it with our own
17752	F.Cell.extend('val', function(value, redraw, redrawSelf){
17753		var val = this._super(value, redraw, redrawSelf);
17754		this.__filtering_val__(value);
17755		return val;
17756	});
17757})(FooTable);
17758(function($, F){
17759	/**
17760	 * Whether or not the column can be used during filtering. Added by the {@link FooTable.Filtering} component.
17761	 * @type {boolean}
17762	 * @default true
17763	 */
17764	F.Column.prototype.filterable = true;
17765
17766	/**
17767	 * This is supplied either the cell value or jQuery object to parse. A str
17767ing value must be returned from this method and will be used during filtering operations.
17768	 * @param {(*|jQuery)} valueOrElement - The value or jQuery cell object.
17769	 * @returns {string}
17770	 * @this FooTable.Column
17771	 */
17772	F.Column.prototype.filterValue = function(valueOrElement){
17773		// if we have an element or a jQuery object use jQuery to get the value
17774		if (F.is.element(valueOrElement) || F.is.jq(valueOrElement)){
17775			var data = $(valueOrElement).data('filterValue');
17776			return F.is.defined(data) ? ''+data : $(valueOrElement).text();
17777		}
17778		// if options are supplied with the value
17779		if (F.is.hash(valueOrElement) && F.is.hash(valueOrElement.options)){
17780			if (F.is.string(valueOrElement.options.filterValue)) return valueOrElement.options.filterValue;
17781			if (F.is.defined(valueOrElement.value)) valueOrElement = valueOrElement.value;
17782		}
17783		if (F.is.defined(valueOrElement) && valueOrElement != null) return valueOrElement+''; // use the native toString of the value
17784		return ''; // otherwise we have no value so return an empty string
17785	};
17786
17787	// this is used to define the filtering specific properties on column creation
17788	F.Column.prototype.__filtering_define__ = function(definition){
17789		this.filterable = F.is.boolean(definition.filterable) ? definition.filterable : this.filterable;
17790		this.filterValue = F.checkFnValue(this, definition.filterValue, this.filterValue);
17791	};
17792
17793	// overrides the public define method and replaces it with our own
17794	F.Column.extend('define', function(definition){
17795		this._super(definition); // call the base so we don't have to redefine any previously set properties
17796		this.__filtering_define__(definition); // then call our own
17797	});
17798})(jQuery, FooTable);
17799(function(F){
17800	/**
17801	 * An object containing the filtering options for the plugin. Added by the {@link FooTable.Filtering} component.
17802	 * @type {object}
17803	 * @prop {boolean} enabled=false - Whether or not to allow filtering on the table.
17804	 * @prop {({name: string, query: (string|FooTable.Query), columns: (Array.<string>|Array.<number>|Array.<FooTable.Column>)}|Array.<FooTable.Filter>)} filters - The filters to apply to the current {@link FooTable.Rows#array}.
17805	 * @prop {number} delay=1200 - The delay in milliseconds before the query is auto applied after a change (any value equal to or less than zero will disable this).
17806	 * @prop {number} min=1 - The minimum number of characters allowed in the search input before it is auto applied.
17807	 * @prop {string} space="AND" - Specifies how whitespace in a filter query is handled.
17808	 * @prop {string} placeholder="Search" - The string used as the placeholder for the search input.
17809	 * @prop {string} dropdownTitle=null - The title to display at the top of the search input column select.
17810	 * @prop {string} position="right" - The string used to specify the alignment of the search input.
17811	 * @prop {string} connectors=true - Whether or not to replace phrase connectors (+.-_) with space before executing the query.
17812	 * @prop {boolean} ignoreCase=true - Whether or not ignore case when matching.
17813	 * @prop {boolean} exactMatch=false - Whether or not search queries are treated as phrases when matching.
17814	 * @prop {boolean} focus=true - Whether or not to focus the search input after the search/clear button is clicked or after auto applying the search input query.
17815	 * @prop {string} container=null - A selector specifying where to place the filtering components form, if null the form is displayed within a row in the head of the table.
17816	 */
17817	F.Defaults.prototype.filtering = {
17818		enabled: false,
17819		filters: [],
17820		delay: 1200,
17821		min: 1,
17822		space: 'AND',
17823		placeholder: 'Search',
17824		dropdownTitle: null,
17825		position: 'right',
17826		connectors: true,
17827		ignoreCase: true,
17828		exactMatch: false,
17829		focus: true,
17830		container: null
17831	};
17832})(FooTable);
17833(function(F){
17834	/**
17835	 * Checks if the row is filtered using the supplied filters.
17836	 * @this FooTable.Row
17837	 * @param {Array.<FooTable.Filter>} filters - The filters to apply.
17838	 * @returns {boolean}
17839	 */
17840	F.Row.prototype.filtered = function(filters){
17841		var result = true, self = this;
17842		F.arr.each(filters, function(f){
17843			if ((result = f.matchRow(self)) == false) return false;
17844		});
17845		return result;
17846	};
17847})(FooTable);
17848(function($, F){
17849
17850	F.Sorter = F.Class.extend(/** @lends FooTable.Sorter */{
17851		/**
17852		 * The sorter object contains the column and direction to sort by.
17853		 * @constructs
17854		 * @extends FooTable.Class
17855		 * @param {FooTable.Column} column - The column to sort.
17856		 * @param {string} direction - The direction to sort by.
17857		 * @returns {FooTable.Sorter}
17858		 */
17859		construct: function(column, direction){
17860			/**
17861			 * The column to sort.
17862			 * @type {FooTable.Column}
17863			 */
17864			this.column = column;
17865			/**
17866			 * The direction to sort by.
17867			 * @type {string}
17868			 */
17869			this.direction = direction;
17870		}
17871	});
17872
17873})(jQuery, FooTable);
17874(function ($, F) {
17875	F.Sorting = F.Component.extend(/** @lends FooTable.Sorting */{
17876		/**
17877		 * The sorting component adds a small sort button to specified column headers allowing users to sort those columns in the table.
17878		 * @constructs
17879		 * @extends FooTable.Component
17880		 * @param {FooTable.Table} table - The parent {@link FooTable.Table} object for the component.
17881		 * @returns {FooTable.Sorting}
17882		 */
17883		construct: function (table) {
17884			// call the constructor of the base class
17885			this._super(table, table.o.sorting.enabled);
17886
17887			/* PROTECTED */
17888			/**
17889			 * This provides a shortcut to the {@link FooTable.Table#options}.[sorting]{@link FooTable.Defaults#sorting} object.
17890			 * @instance
17891			 * @protected
17892			 * @type {object}
17893			 */
17894			this.o = table.o.sorting;
17895			/**
17896			 * The current sorted column.
17897			 * @instance
17898			 * @type {FooTable.Column}
17899			 */
17900			this.column = null;
17901			/**
17902			 * Whether or not to allow sorting to occur, should be set using the {@link FooTable.Sorting#toggleAllowed} method.
17903			 * @instance
17904			 * @type {boolean}
17905			 */
17906			this.allowed = true;
17907			/**
17908			 * The initial sort state of the table, this value is used for determining if the sorting has occurred or to reset the state to default.
17909			 * @instance
17910			 * @type {{isset: boolean, rows: Array.<FooTable.Row>, column: string, direction: ?string}}
17911			 */
17912			this.initial = null;
17913		},
17914
17915		/* PROTECTED */
17916		/**
17917		 * Checks the supplied data and options for the sorting component.
17918		 * @instance
17919		 * @protected
17920		 * @param {object} data - The jQuery data object from the parent table.
17921		 * @fires FooTable.Sorting#"preinit.ft.sorting"
17922		 * @this FooTable.Sorting
17923		 */
17924		preinit: function(data){
17925			var self = this;
17926			/**
17927			 * The preinit.ft.sorting event is raised before the UI is created and provides the tables jQuery data object for additional options parsing.
17928			 * Calling preventDefault on this event will disable the component.
17929			 * @event FooTable.Sorting#"preinit.ft.sorting"
17930			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
17931			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
17932			 * @param {object} data - The jQuery data object of the table raising the event.
17933			 */
17934			this.ft.raise('preinit.ft.sorting', [data]).then(function(){
17935				if (self.ft.$el.hasClass('footable-sorting'))
17936					self.enabled = true;
17937				self.enabled = F.is.boolean(data.sorting)
17938					? data.sorting
17939					: self.enabled;
17940				if (!self.enabled) return;
17941				self.column = F.arr.first(self.ft.columns.array, function(col){ return col.sorted; });
17942			}, function(){
17943				self.enabled = false;
17944			});
17945		},
17946		/**
17947		 * Initializes the sorting component for the plugin using the supplied table and options.
17948		 * @instance
17949		 * @protected
17950		 * @fires FooTable.Sorting#"init.ft.sorting"
17951		 * @this FooTable.Sorting
17952		 */
17953		init: function () {
17954			/**
17955			 * The init.ft.sorting event is raised before its UI is generated.
17956			 * Calling preventDefault on this event will disable the component.
17957			 * @event FooTable.Sorting#"init.ft.sorting"
17958			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
17959			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
17960			 */
17961			var self = this;
17962			this.ft.raise('init.ft.sorting').then(function(){
17963				if (!self.initial){
17964					var isset = !!self.column;
17965					self.initial = {
17966						isset: isset,
17967						// grab a shallow copy of the rows array prior to sorting - allows us to reset without an initial sort
17968						rows: self.ft.rows.all.slice(0),
17969						// if there is a sorted column store its name and direction
17970						column: isset ? self.column.name : null,
17971						direction: isset ? self.column.direction : null
17972					}
17973				}
17974				F.arr.each(self.ft.columns.array, function(col){
17975					if (col.sortable){
17976						col.$el.addClass('footable-sortable').append($('<span/>', {'class': 'fooicon fooicon-sort'}));
17977					}
17978				});
17979				self.ft.$el.on('click.footable', '.footable-sortable', { self: self }, self._onSortClicked);
17980			}, function(){
17981				self.enabled = false;
17982			});
17983		},
17984		/**
17985		 * Destroys the sorting component removing any UI generated from the table.
17986		 * @instance
17987		 * @protected
17988		 * @fires FooTable.Sorting#"destroy.ft.sorting"
17989		 */
17990		destroy: function () {
17991			/**
17992			 * The destroy.ft.sorting event is raised before its UI is removed.
17993			 * Calling preventDefault on this event will prevent the component from being destroyed.
17994			 * @event FooTable.Sorting#"destroy.ft.sorting"
17995			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
17996			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
17997			 */
17998			var self = this;
17999			this.ft.raise('destroy.ft.paging').then(function(){
18000				self.ft.$el.off('click.footable', '.footable-sortable', self._onSortClicked);
18001				self.ft.$el.children('thead').children('tr.footable-header')
18002					.children('.footable-sortable').removeClass('footable-sortable footable-asc footable-desc')
18003					.find('span.fooicon').remove();
18004			});
18005		},
18006		/**
18007		 * Performs the actual sorting against the {@link FooTable.Rows#current} array.
18008		 * @instance
18009		 * @protected
18010		 */
18011		predraw: function () {
18012			if (!this.column) return;
18013			var self = this, col = self.column;
18014			self.ft.rows.array.sort(function (a, b) {
18015				return col.direction == 'DESC'
18016						? col.sorter(b.cells[col.index].sortValue, a.cells[col.index].sortValue)
18017						: col.sorter(a.cells[col.index].sortValue, b.cells[col.index].sortValue);
18018			});
18019		},
18020		/**
18021		 * Updates the sorting UI setting the state of the sort buttons.
18022		 * @instance
18023		 * @protected
18024		 */
18025		draw: function () {
18026			if (!this.column) return;
18027			var self = this,
18028				$sortable = self.ft.$el.find('thead > tr > .footable-sortable'),
18029				$active = self.column.$el;
18030
18031			$sortable.removeClass('footable-asc footable-desc').children('.fooicon').removeClass('fooicon-sort fooicon-sort-asc fooicon-sort-desc');
18032			$sortable.not($active).children('.fooicon').addClass('fooicon-sort');
18033			$active.addClass(self.column.direction == 'DESC' ? 'footable-desc' : 'footable-asc')
18034				.children('.fooicon').addClass(self.column.direction == 'DESC' ? 'fooicon-sort-desc' : 'fooicon-sort-asc');
18035		},
18036
18037		/* PUBLIC */
18038		/**
18039		 * Sets the sorting options and calls the {@link FooTable.Table#draw} method to perform the actual sorting.
18040		 * @instance
18041		 * @param {(string|number|FooTable.Column)} column - The column name, index or the actual {@link FooTable.Column} object to sort by.
18042		 * @param {string} [direction="ASC"] - The direction to sort by, either ASC or DESC.
18043		 * @returns {jQuery.Promise}
18044		 * @fires FooTable.Sorting#"before.ft.sorting"
18045		 * @fires FooTable.Sorting#"after.ft.sorting"
18046		 */
18047		sort: function(column, direction){
18048			return this._sort(column, direction);
18049		},
18050		/**
18051		 * Toggles whether or not sorting is currently allowed.
18052		 * @param {boolean} [state] - You can optionally specify the state you want it to be, if not supplied the current value is flipped.
18053		 */
18054		toggleAllowed: function(state){
18055			state = F.is.boolean(state) ? state : !this.allowed;
18056			this.allowed = state;
18057			this.ft.$el.toggleClass('footable-sorting-disabled', !this.allowed);
18058		},
18059		/**
18060		 * Checks whether any sorting has occurred for the table.
18061		 * @returns {boolean}
18062		 */
18063		hasChanged: function(){
18064			return !(!this.initial || !this.column ||
18065				(this.column.name === this.initial.column &&
18066					(this.column.direction === this.initial.direction || (this.initial.direction === null && this.column.direction === 'ASC')))
18067			);
18068		},
18069		/**
18070		 * Resets the table sorting to the initial state recorded in the components init method.
18071		 */
18072		reset: function(){
18073			if (!!this.initial){
18074				if (this.initial.isset){
18075					// if the initial value specified a column, sort by it
18076					this.sort(this.initial.column, this.initial.direction);
18077				} else {
18078					// if there was no initial column then we need to reset the rows to there original order
18079					if (!!this.column){
18080						// if there is a currently sorted column remove the asc/desc classes and set it to null.
18081						this.column.$el.removeClass('footable-asc footable-desc');
18082						this.column = null;
18083					}
18084					// replace the current all rows array with the one stored in the initial value
18085					this.ft.rows.all = this.initial.rows;
18086					// force the table to redraw itself using the updated rows array
18087					this.ft.draw();
18088				}
18089			}
18090		},
18091
18092		/* PRIVATE */
18093		/**
18094		 * Performs the required steps to handle sorting including the raising of the {@link FooTable.Sorting#"before.ft.sorting"} and {@link FooTable.Sorting#"after.ft.sorting"} events.
18095		 * @instance
18096		 * @private
18097		 * @param {(string|number|FooTable.Column)} column - The column name, index or the actual {@link FooTable.Column} object to sort by.
18098		 * @param {string} [direction="ASC"] - The direction to sort by, either ASC or DESC.
18099		 * @returns {jQuery.Promise}
18100		 * @fires FooTable.Sorting#"before.ft.sorting"
18101		 * @fires FooTable.Sorting#"after.ft.sorting"
18102		 */
18103		_sort: function(column, direction){
18104			if (!this.allowed) return $.Deferred().reject('sorting disabled');
18105			var self = this;
18106			var sorter = new F.Sorter(self.ft.columns.get(column), F.Sorting.dir(direction));
18107			/**
18108			 * The before.ft.sorting event is raised before a sort is applied and allows listeners to modify the sorter or cancel it completely by calling preventDefault on the jQuery.Event object.
18109			 * @event FooTable.Sorting#"before.ft.sorting"
18110			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
18111			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
18112			 * @param {FooTable.Sorter} sorter - The sorter that is about to be applied.
18113			 */
18114			return self.ft.raise('before.ft.sorting', [sorter]).then(function(){
18115				F.arr.each(self.ft.columns.array, function(col){
18116					if (col != self.column) col.direction = null;
18117				});
18118				self.column = self.ft.columns.get(sorter.column);
18119				if (self.column) self.column.direction = F.Sorting.dir(sorter.direction);
18120				return self.ft.draw().then(function(){
18121					/**
18122					 * The after.ft.sorting event is raised after a sorter has been applied.
18123					 * @event FooTable.Sorting#"after.ft.sorting"
18124					 * @param {jQuery.Event} e - The jQuery.Event object for the event.
18125					 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
18126					 * @param {FooTable.Sorter} sorter - The sorter that has been applied.
18127					 */
18128					self.ft.raise('after.ft.sorting', [sorter]);
18129				});
18130			});
18131		},
18132		/**
18133		 * Handles the sort button clicked event.
18134		 * @instance
18135		 * @private
18136		 * @param {jQuery.Event} e - The event object for the event.
18137		 */
18138		_onSortClicked: function (e) {
18139			var self = e.data.self, $header = $(this).closest('th,td'),
18140				direction = $header.is('.footable-asc, .footable-desc')
18141					? ($header.hasClass('footable-desc') ? 'ASC' : 'DESC')
18142					: 'ASC';
18143			self._sort($header.index(), direction);
18144		}
18145	});
18146
18147	/**
18148	 * Checks the supplied string is a valid direction and if not returns ASC as default.
18149	 * @static
18150	 * @protected
18151	 * @param {string} str - The string to check.
18152	 */
18153	F.Sorting.dir = function(str){
18154		return F.is.string(str) && (str == 'ASC' || str == 'DESC') ? str : 'ASC';
18155	};
18156
18157	F.components.register('sorting', F.Sorting, 600);
18158
18159})(jQuery, FooTable);
18160(function(F){
18161
18162	/**
18163	 * The value used by the sorting component during sort operations. Can be set using the data-sort-value attribute on the cell itself.
18164	 * If this is not supplied it is set to the result of the toString method called on the value for the cell. Added by the {@link FooTable.Sorting} component.
18165	 * @type {string}
18166	 * @default null
18167	 */
18168	F.Cell.prototype.sortValue = null;
18169
18170	// this is used to define the sorting specific properties on cell creation
18171	F.Cell.prototype.__sorting_define__ = function(valueOrElement){
18172		this.sortValue = this.column.sortValue.call(this.column, valueOrElement);
18173	};
18174
18175	// this is used to update the sortValue property whenever the cell value is changed
18176	F.Cell.prototype.__sorting_val__ = function(value){
18177		if (F.is.defined(value)){
18178			// set only
18179			this.sortValue = this.column.sortValue.call(this.column, value);
18180		}
18181	};
18182
18183	// overrides the public define method and replaces it with our own
18184	F.Cell.extend('define', function(valueOrElement){
18185		this._super(valueOrElement);
18186		this.__sorting_define__(valueOrElement);
18187	});
18188	// overrides the public val method and replaces it with our own
18189	F.Cell.extend('val', function(value, redraw, redrawSelf){
18190		var val = this._super(value, redraw, redrawSelf);
18191		this.__sorting_val__(value);
18192		return val;
18193	});
18194})(FooTable);
18195(function($, F){
18196	/**
18197	 * The direction to sort if the {@link FooTable.Column#sorted} property is set to true. Can be "ASC", "DESC" or NULL. Added by the {@link FooTable.Sorting} component.
18198	 * @type {string}
18199	 * @default null
18200	 */
18201	F.Column.prototype.direction = null;
18202	/**
18203	 * Whether or not the column can be sorted. Added by the {@link FooTable.Sorting} component.
18204	 * @type {boolean}
18205	 * @default true
18206	 */
18207	F.Column.prototype.sortable = true;
18208	/**
18209	 * Whether or not the column is sorted. Added by the {@link FooTable.Sorting} component.
18210	 * @type {boolean}
18211	 * @default false
18212	 */
18213	F.Column.prototype.sorted = false;
18214
18215	/**
18216	 * This is supplied two values from the column for a comparison to be made and the result returned. Added by the {@link FooTable.Sorting} component.
18217	 * @param {*} a - The first value to be compared.
18218	 * @param {*} b - The second value to compare to the first.
18219	 * @returns {number}
18220	 * @example <caption>This example shows using pseudo code what a sort function would look like.</caption>
18221	 * "sorter": function(a, b){
18222	 * 	if (a is less than b by some ordering criterion) {
18223	 * 		return -1;
18224	 * 	}
18225	 * 	if (a is greater than b by the ordering criterion) {
18226	 * 		return 1;
18227	 * 	}
18228	 * 	// a must be equal to b
18229	 * 	return 0;
18230	 * }
18231	 */
18232	F.Column.prototype.sorter = function(a, b){
18233		if (typeof a === 'string') a = a.toLowerCase();
18234		if (typeof b === 'string') b = b.toLowerCase();
18235		if (a === b) return 0;
18236		if (a < b) return -1;
18237		return 1;
18238	};
18239
18240	/**
18241	 * This is supplied either the cell value or jQuery object to parse. A value must be returned from this method and will be used during sorting operations.
18242	 * @param {(*|jQuery)} valueOrElement - The value or jQuery cell object.
18243	 * @returns {*}
18244	 * @this FooTable.Column
18245	 */
18246	F.Column.prototype.sortValue = function(valueOrElement){
18247		// if we have an element or a jQuery object use jQuery to get the value
18248		if (F.is.element(valueOrElement) || F.is.jq(valueOrElement)){
18249			var data = $(valueOrElement).data('sortValue');
18250			return F.is.defined(data) ? data : this.parser(valueOrElement);
18251		}
18252		// if options are supplied with the value
18253		if (F.is.hash(valueOrElement) && F.is.hash(valueOrElement.options)){
18254			if (F.is.string(valueOrElement.options.sortValue)) return valueOrElement.options.sortValue;
18255			if (F.is.defined(valueOrElement.value)) valueOrElement = valueOrElement.value;
18256		}
18257		if (F.is.defined(valueOrElement) && valueOrElement != null) return valueOrElement;
18258		return null;
18259	};
18260
18261	// this is used to define the sorting specific properties on column creation
18262	F.Column.prototype.__sorting_define__ = function(definition){
18263		this.sorter = F.checkFnValue(this, definition.sorter, this.sorter);
18264		this.direction = F.is.type(definition.direction, 'string') ? F.Sorting.dir(definition.direction) : null;
18265		this.sortable = F.is.boolean(definition.sortable) ? definition.sortable : true;
18266		this.sorted = F.is.boolean(definition.sorted) ? definition.sorted : false;
18267		this.sortValue = F.checkFnValue(this, definition.sortValue, this.sortValue);
18268	};
18269
18270	// overrides the public define method and replaces it with our own
18271	F.Column.extend('define', function(definition){
18272		this._super(definition);
18273		this.__sorting_define__(definition);
18274	});
18275
18276})(jQuery, FooTable);
18277(function(F){
18278	/**
18279	 * An object containing the sorting options for the plugin. Added by the {@link FooTable.Sorting} component.
18280	 * @type {object}
18281	 * @prop {boolean} enabled=false - Whether or not to allow sorting on the table.
18282	 */
18283	F.Defaults.prototype.sorting = {
18284		enabled: false
18285	};
18286})(FooTable);
18287(function($, F){
18288
18289	F.HTMLColumn.extend('__sorting_define__', function(definition){
18290		this._super(definition);
18291		this.sortUse = F.is.string(definition.sortUse) && $.inArray(definition.sortUse, ['html','text']) !== -1 ? definition.sortUse : 'html';
18292	});
18293
18294	/**
18295	 * This is supplied either the cell value or jQuery object to parse. A value must be returned from this method and will be used during sorting operations.
18296	 * @param {(*|jQuery)} valueOrElement - The value or jQuery cell object.
18297	 * @returns {*}
18298	 * @this FooTable.HTMLColumn
18299	 */
18300	F.HTMLColumn.prototype.sortValue = function(valueOrElement){
18301		// if we have an element or a jQuery object use jQuery to get the data value or pass it off to the parser
18302		if (F.is.element(valueOrElement) || F.is.jq(valueOrElement)){
18303			var data = $(valueOrElement).data('sortValue');
18304			return F.is.defined(data) ? data : this.parser(valueOrElement);
18305		}
18306		// if options are supplied with the value
18307		if (F.is.hash(valueOrElement) && F.is.hash(valueOrElement.options)){
18308			if (F.is.string(valueOrElement.options.sortValue)) return valueOrElement.options.sortValue;
18309			if (F.is.defined(valueOrElement.value)) valueOrElement = valueOrElement.value;
18310		}
18311		if (F.is.defined(valueOrElement) && valueOrElement != null) return valueOrElement;
18312		return null;
18313	};
18314
18315})(jQuery, FooTable);
18316(function($, F){
18317
18318	/**
18319	 * This is supplied either the cell value or jQuery object to parse. A value must be returned from this method and will be used during sorting operations.
18320	 * @param {(*|jQuery)} valueOrElement - The value or jQuery cell object.
18321	 * @returns {*}
18322	 */
18323	F.NumberColumn.prototype.sortValue = function(valueOrElement){
18324		// if we have an element or a jQuery object use jQuery to get the data value or pass it off to the parser
18325		if (F.is.element(valueOrElement) || F.is.jq(valueOrElement)){
18326			var data = $(valueOrElement).data('sortValue');
18327			return F.is.number(data) ? data : this.parser(valueOrElement);
18328		}
18329		// if options are supplied with the value
18330		if (F.is.hash(valueOrElement) && F.is.hash(valueOrElement.options)){
18331			if (F.is.string(valueOrElement.options.sortValue)) return this.parser(valueOrElement);
18332			if (F.is.number(valueOrElement.options.sortValue)) return valueOrElement.options.sortValue;
18333			if (F.is.number(valueOrElement.value)) return valueOrElement.value;
18334		}
18335		if (F.is.string(valueOrElement)) return this.parser(valueOrElement);
18336		if (F.is.number(valueOrElement)) return valueOrElement;
18337		return null;
18338	};
18339
18340})(jQuery, FooTable);
18341(function(F){
18342	/**
18343	 * Sort the table using the specified column and direction. Added by the {@link FooTable.Sorting} component.
18344	 * @instance
18345	 * @param {(string|number|FooTable.Column)} column - The column name, index or the actual {@link FooTable.Column} object to sort by.
18346	 * @param {string} [direction="ASC"] - The direction to sort by, either ASC or DESC.
18347	 * @returns {jQuery.Promise}
18348	 * @fires FooTable.Sorting#"change.ft.sorting"
18349	 * @fires FooTable.Sorting#"changed.ft.sorting"
18350	 * @see FooTable.Sorting#sort
18351	 */
18352	F.Table.prototype.sort = function(column, direction){
18353		return this.use(F.Sorting).sort(column, direction);
18354	};
18355})(FooTable);
18356(function($, F){
18357
18358	F.Pager = F.Class.extend(/** @lends FooTable.Pager */{
18359		/**
18360		 * The pager object contains the page number and direction to page to.
18361		 * @constructs
18362		 * @extends FooTable.Class
18363		 * @param {number} total - The total number of pages available.
18364		 * @param {number} current - The current page number.
18365		 * @param {number} size - The number of rows per page.
18366		 * @param {number} page - The page number to goto.
18367		 * @param {boolean} forward - A boolean indicating the direction of paging, TRUE = forward, FALSE = back.
18368		 * @returns {FooTable.Pager}
18369		 */
18370		construct: function(total, current, size, page, forward){
18371			/**
18372			 * The total number of pages available.
18373			 * @type {number}
18374			 */
18375			this.total = total;
18376			/**
18377			 * The current page number.
18378			 * @type {number}
18379			 */
18380			this.current = current;
18381			/**
18382			 * The number of rows per page.
18383			 * @type {number}
18384			 */
18385			this.size = size;
18386			/**
18387			 * The page number to goto.
18388			 * @type {number}
18389			 */
18390			this.page = page;
18391			/**
18392			 * A boolean indicating the direction of paging, TRUE = forward, FALSE = back.
18393			 * @type {boolean}
18394			 */
18395			this.forward = forward;
18396		}
18397	});
18398
18399})(jQuery, FooTable);
18400(function($, F){
18401	F.Paging = F.Component.extend(/** @lends FooTable.Paging */{
18402		/**
18403		 * The paging component adds a pagination control to the table allowing users to navigate table rows via pages.
18404		 * @constructs
18405		 * @extends FooTable.Component
18406		 * @param {FooTable.Table} table - The parent {@link FooTable.Table} object for the component.
18407		 * @returns {FooTable.Filtering}
18408		 */
18409		construct: function(table){
18410			// call the base constructor
18411			this._super(table, table.o.paging.enabled);
18412
18413			/* PROTECTED */
18414			/**
18415			 * An object containing the strings used by the paging buttons.
18416			 * @type {{ first: string, prev: string, next: string, last: string }}
18417			 */
18418			this.strings = table.o.paging.strings;
18419
18420			/* PUBLIC */
18421			/**
18422			 * The current page number to display.
18423			 * @instance
18424			 * @type {number}
18425			 */
18426			this.current = table.o.paging.current;
18427			/**
18428			 * The number of rows to display per page.
18429			 * @instance
18430			 * @type {number}
18431			 */
18432			this.size = table.o.paging.size;
18433			/**
18434			 * The maximum number of page links to display at once.
18435			 * @instance
18436			 * @type {number}
18437			 */
18438			this.limit = table.o.paging.limit;
18439			/**
18440			 * The position of the pagination control within the paging rows cell.
18441			 * @instance
18442			 * @type {string}
18443			 */
18444			this.position = table.o.paging.position;
18445			/**
18446			 * The format string used to generate the text displayed under the pagination control.
18447			 * @instance
18448			 * @type {string}
18449			 */
18450			this.countFormat = table.o.paging.countFormat;
18451			/**
18452			 * A selector specifying where to place the paging components UI, if null the UI is displayed within a row in the foot of the table.
18453			 * @instance
18454			 * @type {string}
18455			 */
18456			this.container = table.o.paging.container;
18457				/**
18458			 * The total number of pages.
18459			 * @instance
18460			 * @type {number}
18461			 */
18462			this.total = -1;
18463			/**
18464			 * The number of rows in the {@link FooTable.Rows#array} before paging is applied.
18465			 * @instance
18466			 * @type {number}
18467			 */
18468			this.totalRows = 0;
18469			/**
18470			 * A number indicating the previous page displayed.
18471			 * @instance
18472			 * @type {number}
18473			 */
18474			this.previous = -1;
18475			/**
18476			 * The count string generated using the {@link FooTable.Filtering#countFormat} option. This value is only set after the first call to the {@link FooTable.Filtering#predraw} method.
18477			 * @instance
18478			 * @type {string}
18479			 */
18480			this.formattedCount = null;
18481			/**
18482			 * The jQuery object of the element containing the entire paging UI.
18483			 * @instance
18484			 * @type {jQuery}
18485			 */
18486			this.$container = null;
18487			/**
18488			 * The jQuery object of the element wrapping all the paging UI elements.
18489			 * @instance
18490			 * @type {jQuery}
18491			 */
18492			this.$wrapper = null;
18493			/** +
18494			 * The jQuery row object that contains all the paging specific elements.
18495			 * @instance
18496			 * @type {jQuery}
18497			 */
18498			this.$row = null;
18499			/**
18500			 * The jQuery cell object that contains the pagination control and total count.
18501			 * @instance
18502			 * @type {jQuery}
18503			 */
18504			this.$cell = null;
18505			/**
18506			 * The jQuery object that contains the links for the pagination control.
18507			 * @instance
18508			 * @type {jQuery}
18509			 */
18510			this.$pagination = null;
18511			/**
18512			 * The jQuery object that contains the row count.
18513			 * @instance
18514			 * @type {jQuery}
18515			 */
18516			this.$count = null;
18517			/**
18518			 * Whether or not the pagination row is detached from the table.
18519			 * @instance
18520			 * @type {boolean}
18521			 */
18522			this.detached = true;
18523
18524			/* PRIVATE */
18525			/**
18526			 * Used to hold the number of page links created.
18527			 * @instance
18528			 * @type {number}
18529			 * @private
18530			 */
18531			this._createdLinks = 0;
18532		},
18533
18534		/* PROTECTED */
18535		/**
18536		 * Checks the supplied data and options for the paging component.
18537		 * @instance
18538		 * @protected
18539		 * @param {object} data - The jQuery data object from the parent table.
18540		 * @fires FooTable.Paging#"preinit.ft.paging"
18541		 */
18542		preinit: function(data){
18543			var self = this;
18544			/**
18545			 * The preinit.ft.paging event is raised before the UI is created and provides the tables jQuery data object for additional options parsing.
18546			 * Calling preventDefault on this event will disable the component.
18547			 * @event FooTable.Paging#"preinit.ft.paging"
18548			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
18549			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
18550			 * @param {object} data - The jQuery data object of the table raising the event.
18551			 */
18552			this.ft.raise('preinit.ft.paging', [data]).then(function(){
18553				if (self.ft.$el.hasClass('footable-paging'))
18554					self.enabled = true;
18555				self.enabled = F.is.boolean(data.paging)
18556					? data.paging
18557					: self.enabled;
18558
18559				if (!self.enabled) return;
18560
18561				self.size = F.is.number(data.pagingSize)
18562					? data.pagingSize
18563					: self.size;
18564
18565				self.current = F.is.number(data.pagingCurrent)
18566					? data.pagingCurrent
18567					: self.current;
18568
18569				self.limit = F.is.number(data.pagingLimit)
18570					? data.pagingLimit
18571					: self.limit;
18572
18573				if (self.ft.$el.hasClass('footable-paging-left'))
18574					self.position = 'left';
18575				if (self.ft.$el.hasClass('footable-paging-center'))
18576					self.position = 'center';
18577				if (self.ft.$el.hasClass('footable-paging-right'))
18578					self.position = 'right';
18579
18580				self.position = F.is.string(data.pagingPosition)
18581					? data.pagingPosition
18582					: self.position;
18583
18584				self.countFormat = F.is.string(data.pagingCountFormat)
18585					? data.pagingCountFormat
18586					: self.countFormat;
18587
18588				self.container = F.is.string(data.pagingContainer)
18589					? data.pagingContainer
18590					: self.container;
18591
18592				self.total = Math.ceil(self.ft.rows.all.length / self.size);
18593			}, function(){
18594				self.enabled = false;
18595			});
18596		},
18597		/**
18598		 * Initializes the paging component for the plugin using the supplied table and options.
18599		 * @instance
18600		 * @protected
18601		 * @fires FooTable.Paging#"init.ft.paging"
18602		 */
18603		init: function(){
18604			/**
18605			 * The init.ft.paging event is raised before its UI is generated.
18606			 * Calling preventDefault on this event will disable the component.
18607			 * @event FooTable.Paging#"init.ft.paging"
18608			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
18609			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
18610			 */
18611			var self = this;
18612			this.ft.raise('init.ft.paging').then(function(){
18613				self.$create();
18614			}, function(){
18615				self.enabled = false;
18616			});
18617		},
18618		/**
18619		 * Destroys the paging component removing any UI generated from the table.
18620		 * @instance
18621		 * @protected
18622		 * @fires FooTable.Paging#"destroy.ft.paging"
18623		 */
18624		destroy: function () {
18625			/**
18626			 * The destroy.ft.paging event is raised before its UI is removed.
18627			 * Calling preventDefault on this event will prevent the component from being destroyed.
18628			 * @event FooTable.Paging#"destroy.ft.paging"
18629			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
18630			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
18631			 */
18632			var self = this;
18633			this.ft.raise('destroy.ft.paging').then(function(){
18634				self.ft.$el.removeClass('footable-paging')
18635					.find('tfoot > tr.footable-paging').remove();
18636				self.detached = true;
18637				self._createdLinks = 0;
18638			});
18639		},
18640		/**
18641		 * Performs the actual paging against the {@link FooTable.Rows#current} array removing all rows that are not on the current visible page.
18642		 * @instance
18643		 * @protected
18644		 */
18645		predraw: function(){
18646			this.total = Math.ceil(this.ft.rows.array.length / this.size);
18647			this.current = this.current > this.total ? this.total : (this.current < 1 ? 1 : this.current);
18648			this.totalRows = this.ft.rows.array.length;
18649			if (this.totalRows > this.size){
18650				this.ft.rows.array = this.ft.rows.array.splice((this.current - 1) * this.size, this.size);
18651			}
18652			this.formattedCount = this.format(this.countFormat);
18653		},
18654		/**
18655		 * Updates the paging UI setting the state of the pagination control.
18656		 * @instance
18657		 * @protected
18658		 */
18659		draw: function(){
18660			if (this.total <= 1){
18661				if (!this.detached){
18662					if (this.$row){
18663						this.$row.detach();
18664					} else {
18665						this.$wrapper.detach();
18666					}
18667					this.detached = true;
18668				}
18669			} else {
18670				if (this.detached){
18671					if (this.$row){
18672						var $tfoot = this.ft.$el.children('tfoot');
18673						if ($tfoot.length == 0){
18674							$tfoot = $('<tfoot/>');
18675							this.ft.$el.append($tfoot);
18676						}
18677						this.$row.appendTo($tfoot);
18678					} else {
18679						this.$wrapper.appendTo(this.$container);
18680					}
18681					this.detached = false;
18682				}
18683				if (F.is.jq(this.$cell)){
18684					this.$cell.attr('colspan', this.ft.columns.visibleColspan);
18685				}
18686				this._createLinks();
18687				this._setVisible(this.current, this.current > this.previous);
18688				this._setNavigation(true);
18689				this.$count.text(this.formattedCount);
18690			}
18691		},
18692		/**
18693		 * Creates the paging UI from the current options setting the various jQuery properties of this component.
18694		 * @instance
18695		 * @protected
18696		 */
18697		$create: function(){
18698			this._createdLinks = 0;
18699			var position = 'footable-paging-center';
18700			switch (this.position){
18701				case 'left': position = 'footable-paging-left'; break;
18702				case 'right': position = 'footable-paging-right'; break;
18703			}
18704			this.ft.$el.addClass('footable-paging').addClass(position);
18705
18706			this.$container = this.container === null ? null : $(this.container).first();
18707			if (!F.is.jq(this.$container)){
18708				var $tfoot = this.ft.$el.children('tfoot');
18709				if ($tfoot.length == 0){
18710					$tfoot = $('<tfoot/>');
18711					this.ft.$el.append($tfoot);
18712				}
18713				// add it to a row and then populate it with the search input and column selector dropdown.
18714				this.$row = $('<tr/>', {'class': 'footable-paging'}).prependTo($tfoot);
18715				this.$container = this.$cell = $('<td/>').attr('colspan', this.ft.columns.visibleColspan).appendTo(this.$row);
18716			} else {
18717				this.$container.addClass('footable-paging-external').addClass(position);
18718			}
18719			this.$wrapper = $('<div/>', {'class': 'footable-pagination-wrapper'}).appendTo(this.$container);
18720			this.$pagination = $('<ul/>', { 'class': 'pagination' }).on('click.footable', 'a.footable-page-link', { self: this }, this._onPageClicked);
18721			this.$count = $('<span/>', { 'class': 'label label-default' });
18722			this.$wrapper.append(this.$pagination, $('<div/>', {'class': 'divider'}), this.$count);
18723			this.detached = false;
18724		},
18725
18726		/* PUBLIC */
18727		/**
18728		 * @summary Uses the supplied format string and replaces the placeholder strings with the current values.
18729		 * @description This method is used to generate the short description label for the pagination control. i.e. Showing X of Y records. The placeholders for this string are the following:
18730		 * * {CP} - The current page number.
18731		 * * {TP} - The total number of pages.
18732		 * * {PF} - The first row of the current page.
18733		 * * {PL} - The last row of the current page.
18734		 * * {TR} - The total rows available.
18735		 * These placeholders can be supplied in a string like; "Showing {PF} to {PL} of {TR} rows."
18736		 * @param {string} formatString - The string to be formatted with the paging specific variables.
18737		 * @returns {string}
18738		 */
18739		format: function(formatString){
18740			var firstRow = (this.size * (this.current - 1)) + 1,
18741				lastRow = this.size * this.current;
18742			if (this.ft.rows.array.length == 0){
18743				firstRow = 0;
18744				lastRow = 0;
18745			} else {
18746				lastRow = lastRow > this.totalRows ? this.totalRows : lastRow;
18747			}
18748			return formatString.replace(/\{CP}/g, this.current)
18749				.replace(/\{TP}/g, this.total)
18750				.replace(/\{PF}/g, firstRow)
18751				.replace(/\{PL}/g, lastRow)
18752				.replace(/\{TR}/g, this.totalRows);
18753		},
18754		/**
18755		 * Pages to the first page.
18756		 * @instance
18757		 * @returns {jQuery.Promise}
18758		 * @fires FooTable.Paging#"before.ft.paging"
18759		 * @fires FooTable.Paging#"after.ft.paging"
18760		 */
18761		first: function(){
18762			return this._set(1);
18763		},
18764		/**
18765		 * Pages to the previous page.
18766		 * @instance
18767		 * @returns {jQuery.Promise}
18768		 * @fires FooTable.Paging#"before.ft.paging"
18769		 * @fires FooTable.Paging#"after.ft.paging"
18770		 */
18771		prev: function(){
18772			return this._set(this.current - 1 > 0 ? this.current - 1 : 1);
18773		},
18774		/**
18775		 * Pages to the next page.
18776		 * @instance
18777		 * @returns {jQuery.Promise}
18778		 * @fires FooTable.Paging#"before.ft.paging"
18779		 * @fires FooTable.Paging#"after.ft.paging"
18780		 */
18781		next: function(){
18782			return this._set(this.current + 1 < this.total ? this.current + 1 : this.total);
18783		},
18784		/**
18785		 * Pages to the last page.
18786		 * @instance
18787		 * @returns {jQuery.Promise}
18788		 * @fires FooTable.Paging#"before.ft.paging"
18789		 * @fires FooTable.Paging#"after.ft.paging"
18790		 */
18791		last: function(){
18792			return this._set(this.total);
18793		},
18794		/**
18795		 * Pages to the specified page.
18796		 * @instance
18797		 * @param {number} page - The page number to go to.
18798		 * @returns {jQuery.Promise}
18799		 * @fires FooTable.Paging#"before.ft.paging"
18800		 * @fires FooTable.Paging#"after.ft.paging"
18801		 */
18802		goto: function(page){
18803			return this._set(page > this.total ? this.total : (page < 1 ? 1 : page));
18804		},
18805		/**
18806		 * Shows the previous X number of pages in the pagination control where X is the value set by the {@link FooTable.Defaults#paging} - limit option value.
18807		 * @instance
18808		 */
18809		prevPages: function(){
18810			var page = this.$pagination.children('li.footable-page.visible:first').data('page') - 1;
18811			this._setVisible(page, true);
18812			this._setNavigation(false);
18813		},
18814		/**
18815		 * Shows the next X number of pages in the pagination control where X is the value set by the {@link FooTable.Defaults#paging} - limit option value.
18816		 * @instance
18817		 */
18818		nextPages: function(){
18819			var page = this.$pagination.children('li.footable-page.visible:last').data('page') + 1;
18820			this._setVisible(page, false);
18821			this._setNavigation(false);
18822		},
18823		/**
18824		 * Gets or sets the current page size.
18825		 * @instance
18826		 * @param {(number|string)} [value] - The new page size to use, this value is supplied to `parseInt` so strings can be used. If not supplied or an invali
18826d valid the current page size is returned.
18827		 * @returns {(number|undefined)}
18828		 */
18829		pageSize: function(value){
18830			value = parseInt(value);
18831			if (isNaN(value)){
18832				return this.size;
18833			}
18834			this.size = value;
18835			this.total = Math.ceil(this.ft.rows.all.length / this.size);
18836			if (F.is.jq(this.$wrapper)){
18837				if (this.$container.is("td")){
18838					this.$row.remove();
18839				} else {
18840					this.$wrapper.remove();
18841				}
18842			}
18843			this.$create();
18844			this.ft.draw();
18845		},
18846
18847		/* PRIVATE */
18848		/**
18849		 * Performs the required steps to handle paging including the raising of the {@link FooTable.Paging#"before.ft.paging"} and {@link FooTable.Paging#"after.ft.paging"} events.
18850		 * @instance
18851		 * @private
18852		 * @param {number} page - The page to set.
18853		 * @returns {jQuery.Promise}
18854		 * @fires FooTable.Paging#"before.ft.paging"
18855		 * @fires FooTable.Paging#"after.ft.paging"
18856		 */
18857		_set: function(page){
18858			var self = this,
18859				pager = new F.Pager(self.total, self.current, self.size, page, page > self.current);
18860			/**
18861			 * The before.ft.paging event is raised before a sort is applied and allows listeners to modify the pager or cancel it completely by calling preventDefault on the jQuery.Event object.
18862			 * @event FooTable.Paging#"before.ft.paging"
18863			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
18864			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
18865			 * @param {FooTable.Pager} pager - The pager that is about to be applied.
18866			 */
18867			return self.ft.raise('before.ft.paging', [pager]).then(function(){
18868				pager.page = pager.page > pager.total ? pager.total	: pager.page;
18869				pager.page = pager.page < 1 ? 1 : pager.page;
18870				if (self.current == page) return $.when();
18871				self.previous = self.current;
18872				self.current = pager.page;
18873				return self.ft.draw().then(function(){
18874					/**
18875					 * The after.ft.paging event is raised after a pager has been applied.
18876					 * @event FooTable.Paging#"after.ft.paging"
18877					 * @param {jQuery.Event} e - The jQuery.Event object for the event.
18878					 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
18879					 * @param {FooTable.Pager} pager - The pager that has been applied.
18880					 */
18881					self.ft.raise('after.ft.paging', [pager]);
18882				});
18883			});
18884		},
18885		/**
18886		 * Creates the pagination links using the current state of the plugin. If the total number of pages is the same as
18887		 * the last time this function was executed it does nothing.
18888		 * @instance
18889		 * @private
18890		 */
18891		_createLinks: function(){
18892			if (this._createdLinks === this.total) return;
18893			var self = this,
18894				multiple = self.total > 1,
18895				link = function(attr, html, klass){
18896					return $('<li/>', {
18897						'class': klass
18898					}).attr('data-page', attr)
18899						.append($('<a/>', {
18900							'class': 'footable-page-link',
18901							href: '#'
18902						}).data('page', attr).html(html));
18903				};
18904			self.$pagination.empty();
18905			if (multiple) {
18906				self.$pagination.append(link('first', self.strings.first, 'footable-page-nav'));
18907				self.$pagination.append(link('prev', self.strings.prev, 'footable-page-nav'));
18908				if (self.limit > 0 && self.limit < self.total){
18909					self.$pagination.append(link('prev-limit', self.strings.prevPages, 'footable-page-nav'));
18910				}
18911			}
18912			for (var i = 0, $li; i < self.total; i++){
18913				$li = link(i + 1, i + 1, 'footable-page');
18914				self.$pagination.append($li);
18915			}
18916			if (multiple){
18917				if (self.limit > 0 && self.limit < self.total){
18918					self.$pagination.append(link('next-limit', self.strings.nextPages, 'footable-page-nav'));
18919				}
18920				self.$pagination.append(link('next', self.strings.next, 'footable-page-nav'));
18921				self.$pagination.append(link('last', self.strings.last, 'footable-page-nav'));
18922			}
18923			self._createdLinks = self.total;
18924		},
18925		/**
18926		 * Sets the state for the navigation links of the pagination control and optionally sets the active class state on the current page link.
18927		 * @instance
18928		 * @private
18929		 * @param {boolean} active - Whether or not to set the active class state on the individual page links.
18930		 */
18931		_setNavigation: function(active){
18932			if (this.current == 1) {
18933				this.$pagination.children('li[data-page="first"],li[data-page="prev"]').addClass('disabled');
18934			} else {
18935				this.$pagination.children('li[data-page="first"],li[data-page="prev"]').removeClass('disabled');
18936			}
18937
18938			if (this.current == this.total) {
18939				this.$pagination.children('li[data-page="next"],li[data-page="last"]').addClass('disabled');
18940			} else {
18941				this.$pagination.children('li[data-page="next"],li[data-page="last"]').removeClass('disabled');
18942			}
18943
18944			if ((this.$pagination.children('li.footable-page.visible:first').data('page') || 1) == 1) {
18945				this.$pagination.children('li[data-page="prev-limit"]').addClass('disabled');
18946			} else {
18947				this.$pagination.children('li[data-page="prev-limit"]').removeClass('disabled');
18948			}
18949
18950			if ((this.$pagination.children('li.footable-page.visible:last').data('page') || this.limit) == this.total) {
18951				this.$pagination.children('li[data-page="next-limit"]').addClass('disabled');
18952			} else {
18953				this.$pagination.children('li[data-page="next-limit"]').removeClass('disabled');
18954			}
18955
18956			if (this.limit > 0 && this.total < this.limit){
18957				this.$pagination.children('li[data-page="prev-limit"],li[data-page="next-limit"]').css('display', 'none');
18958			} else {
18959				this.$pagination.children('li[data-page="prev-limit"],li[data-page="next-limit"]').css('display', '');
18960			}
18961
18962			if (active){
18963				this.$pagination.children('li.footable-page').removeClass('active').filter('li[data-page="' + this.current + '"]').addClass('active');
18964			}
18965		},
18966		/**
18967		 * Sets the visible page using the supplied parameters.
18968		 * @instance
18969		 * @private
18970		 * @param {number} page - The page to make visible.
18971		 * @param {boolean} right - If set to true the supplied page will be the right most visible pagination link.
18972		 */
18973		_setVisible: function(page, right){
18974			if (this.limit > 0 && this.total > this.limit){
18975				if (!this.$pagination.children('li.footable-page[data-page="'+page+'"]').hasClass('visible')){
18976					var start = 0, end = 0;
18977					if (right == true){
18978						end = page > this.total ? this.total : page;
18979						start = end - this.limit;
18980					} else {
18981						start = page < 1 ? 0 : page - 1;
18982						end = start + this.limit;
18983					}
18984					if (start < 0){
18985						start = 0;
18986						end = this.limit > this.total ? this.total : this.limit;
18987					}
18988					if (end > this.total){
18989						end = this.total;
18990						start = this.total - this.limit < 0 ? 0 : this.total - this.limit;
18991					}
18992					this.$pagination.children('li.footable-page').removeClass('visible').slice(start, end).addClass('visible');
18993				}
18994			} else {
18995				this.$pagination.children('li.footable-page').removeClass('visible').slice(0, this.total).addClass('visible');
18996			}
18997		},
18998		/**
18999		 * Handles the click event for all links in the pagination control.
19000		 * @instance
19001		 * @private
19002		 * @param {jQuery.Event} e - The event object for the event.
19003		 */
19004		_onPageClicked: function(e){
19005			e.preventDefault();
19006			if ($(e.target).closest('li').is('.active,.disabled')) return;
19007
19008			var self = e.data.self, page = $(this).data('page');
19009			switch(page){
19010				case 'first': self.first();
19011					return;
19012				case 'prev': self.prev();
19013					return;
19014				case 'next': self.next();
19015					return;
19016				case 'last': self.last();
19017					return;
19018				case 'prev-limit': self.prevPages();
19019					return;
19020				case 'next-limit': self.nextPages();
19021					return;
19022				default: self._set(page);
19023					return;
19024			}
19025		}
19026	});
19027
19028	F.components.register('paging', F.Paging, 400);
19029
19030})(jQuery, FooTable);
19031(function(F){
19032	/**
19033	 * An object containing the paging options for the plugin. Added by the {@link FooTable.Paging} component.
19034	 * @type {object}
19035	 * @prop {boolean} enabled=false - Whether or not to allow paging on the table.
19036	 * @prop {string} countFormat="{CP} of {TP}" - A string format used to generate the page count text.
19037	 * @prop {number} current=1 - The page number to display.
19038	 * @prop {number} limit=5 - The maximum number of page links to display at once.
19039	 * @prop {string} position="center" - The string used to specify the alignment of the pagination control.
19040	 * @prop {number} size=10 - The number of rows displayed per page.
19041	 * @prop {string} container=null - A selector specifying where to place the paging components UI, if null the UI is displayed within a row in the foot of the table.
19042	 * @prop {object} strings - An object containing the strings used by the paging buttons.
19043	 * @prop {string} strings.first="&laquo;" - The string used for the 'first' button.
19044	 * @prop {string} strings.prev="&lsaquo;" - The string used for the 'previous' button.
19045	 * @prop {string} strings.next="&rsaquo;" - The string used for the 'next' button.
19046	 * @prop {string} strings.last="&raquo;" - The string used for the 'last' button.
19047	 * @prop {string} strings.prevPages="..." - The string used for the 'previous X pages' button.
19048	 * @prop {string} strings.nextPages="..." - The string used for the 'next X pages' button.
19049	 */
19050	F.Defaults.prototype.paging = {
19051		enabled: false,
19052		countFormat: '{CP} of {TP}',
19053		current: 1,
19054		limit: 5,
19055		position: 'center',
19056		size: 10,
19057		container: null,
19058		strings: {
19059			first: '&laquo;',
19060			prev: '&lsaquo;',
19061			next: '&rsaquo;',
19062			last: '&raquo;',
19063			prevPages: '...',
19064			nextPages: '...'
19065		}
19066	};
19067})(FooTable);
19068(function(F){
19069	/**
19070	 * Navigates to the specified page number. Added by the {@link FooTable.Paging} component.
19071	 * @instance
19072	 * @param {number} num - The page number to go to.
19073	 * @returns {jQuery.Promise}
19074	 * @fires FooTable.Paging#paging_changing
19075	 * @fires FooTable.Paging#paging_changed
19076	 * @see FooTable.Paging#goto
19077	 */
19078	F.Table.prototype.gotoPage = function(num){
19079		return this.use(F.Paging).goto(num);
19080	};
19081
19082	/**
19083	 * Navigates to the next page. Added by the {@link FooTable.Paging} component.
19084	 * @instance
19085	 * @returns {jQuery.Promise}
19086	 * @fires FooTable.Paging#paging_changing
19087	 * @fires FooTable.Paging#paging_changed
19088	 * @see FooTable.Paging#next
19089	 */
19090	F.Table.prototype.nextPage = function(){
19091		return this.use(F.Paging).next();
19092	};
19093
19094	/**
19095	 * Navigates to the previous page. Added by the {@link FooTable.Paging} component.
19096	 * @instance
19097	 * @returns {jQuery.Promise}
19098	 * @fires FooTable.Paging#paging_changing
19099	 * @fires FooTable.Paging#paging_changed
19100	 * @see FooTable.Paging#prev
19101	 */
19102	F.Table.prototype.prevPage = function(){
19103		return this.use(F.Paging).prev();
19104	};
19105
19106	/**
19107	 * Navigates to the first page. Added by the {@link FooTable.Paging} component.
19108	 * @instance
19109	 * @returns {jQuery.Promise}
19110	 * @fires FooTable.Paging#paging_changing
19111	 * @fires FooTable.Paging#paging_changed
19112	 * @see FooTable.Paging#first
19113	 */
19114	F.Table.prototype.firstPage = function(){
19115		return this.use(F.Paging).first();
19116	};
19117
19118	/**
19119	 * Navigates to the last page. Added by the {@link FooTable.Paging} component.
19120	 * @instance
19121	 * @returns {jQuery.Promise}
19122	 * @fires FooTable.Paging#paging_changing
19123	 * @fires FooTable.Paging#paging_changed
19124	 * @see FooTable.Paging#last
19125	 */
19126	F.Table.prototype.lastPage = function(){
19127		return this.use(F.Paging).last();
19128	};
19129
19130	/**
19131	 * Shows the next X number of pages in the pagination control where X is the value set by the {@link FooTable.Defaults#paging} - limit.size option value. Added by the {@link FooTable.Paging} component.
19132	 * @instance
19133	 * @see FooTable.Paging#nextPages
19134	 */
19135	F.Table.prototype.nextPages = function(){
19136		return this.use(F.Paging).nextPages();
19137	};
19138
19139	/**
19140	 * Shows the previous X number of pages in the pagination control where X is the value set by the {@link FooTable.Defaults#paging} - limit.size option value. Added by the {@link FooTable.Paging} component.
19141	 * @instance
19142	 * @see FooTable.Paging#prevPages
19143	 */
19144	F.Table.prototype.prevPages = function(){
19145		return this.use(F.Paging).prevPages();
19146	};
19147
19148	/**
19149	 * Gets or sets the current page size
19150	 * @instance
19151	 * @param {number} [value] - The new page size to use.
19152	 * @returns {(number|undefined)}
19153	 * @see FooTable.Paging#pageSize
19154	 */
19155	F.Table.prototype.pageSize = function(value){
19156		return this.use(F.Paging).pageSize(value);
19157	};
19158})(FooTable);
19159(function($, F){
19160
19161	F.Editing = F.Component.extend(/** @lends FooTable.Editing */{
19162		/**
19163		 * The editing component adds a column with edit and delete buttons to each row as well as a single add row button in the footer.
19164		 * @constructs
19165		 * @extends FooTable.Component
19166		 * @param {FooTable.Table} table - The parent {@link FooTable.Table} object for the component.
19167		 * @returns {FooTable.Editing}
19168		 */
19169		construct: function(table){
19170			// call the base constructor
19171			this._super(table, table.o.editing.enabled);
19172
19173			/**
19174			 * Whether or not to automatically page to a new row when it is added to the table.
19175			 * @type {boolean}
19176			 */
19177			this.pageToNew = table.o.editing.pageToNew;
19178
19179			/**
19180			 * Whether or not the editing column and add row button are always visible.
19181			 * @type {boolean}
19182			 */
19183			this.alwaysShow = table.o.editing.alwaysShow;
19184
19185			/**
19186			 * The options for the editing column. @see {@link FooTable.EditingColumn} for more info.
19187			 * @type {object}
19188			 * @prop {string} classes="footable-editing" - A space separated string of class names to apply to all cells in the column.
19189			 * @prop {string} name="editing" - The name of the column.
19190			 * @prop {string} title="" - The title displayed in the header row of the table for the column.
19191			 * @prop {boolean} filterable=false - Whether or not the column should be filterable when using the filtering component.
19192			 * @prop {boolean} sortable=false - Whether or not the column should be sortable when using the sorting component.
19193			 */
19194			this.column = $.extend(true, {}, table.o.editing.column, {visible: this.alwaysShow});
19195
19196			/**
19197			 * The position of the editing column in the table as well as the alignment of the buttons.
19198			 * @type {string}
19199			 */
19200			this.position = table.o.editing.position;
19201
19202
19203			/**
19204			 * The text that appears in the show button. This can contain HTML.
19205			 * @type {string}
19206			 */
19207			this.showText = table.o.editing.showText;
19208
19209			/**
19210			 * The text that appears in the hide button. This can contain HTML.
19211			 * @type {string}
19212			 */
19213			this.hideText = table.o.editing.hideText;
19214
19215			/**
19216			 * The text that appears in the add button. This can contain HTML.
19217			 * @type {string}
19218			 */
19219			this.addText = table.o.editing.addText;
19220
19221			/**
19222			 * The text that appears in the edit button. This can contain HTML.
19223			 * @type {string}
19224			 */
19225			this.editText = table.o.editing.editText;
19226
19227			/**
19228			 * The text that appears in the delete button. This can contain HTML.
19229			 * @type {string}
19230			 */
19231			this.deleteText = table.o.editing.deleteText;
19232			
19233			/**
19234			 * The text that appears in the view button. This can contain HTML.
19235			 * @type {string}
19236			 */
19237			this.viewText = table.o.editing.viewText;
19238
19239			/**
19240			 * Whether or not to show the Add Row button.
19241			 * @type {boolean}
19242			 */
19243			this.allowAdd = table.o.editing.allowAdd;
19244
19245			/**
19246			 * Whether or not to show the Edit Row button.
19247			 * @type {boolean}
19248			 */
19249			this.allowEdit = table.o.editing.allowEdit;
19250
19251			/**
19252			 * Whether or not to show the Delete Row button.
19253			 * @type {boolean}
19254			 */
19255			this.allowDelete = table.o.editing.allowDelete;
19256
19257			/**
19258			 * Whether or not to show the View Row button.
19259			 * @type {boolean}
19260			 */
19261			this.allowView = table.o.editing.allowView;
19262
19263			/**
19264			 * Caches the row button elements to help with performance.
19265			 * @type {(null|jQuery)}
19266			 * @private
19267			 */
19268			this._$buttons = null;
19269
19270			/**
19271			 * This object is used to contain the callbacks for the add, edit and delete row buttons.
19272			 * @type {object}
19273			 * @prop {function} addRow
19274			 * @prop {function} editRow
19275			 * @prop {function} deleteRow
19276			 * @prop {function} viewRow
19277			 */
19278			this.callbacks = {
19279				addRow: F.checkFnValue(this, table.o.editing.addRow),
19280				editRow: F.checkFnValue(this, table.o.editing.editRow),
19281				deleteRow: F.checkFnValue(this, table.o.editing.deleteRow),
19282				viewRow: F.checkFnValue(this, table.o.editing.viewRow)
19283			};
19284		},
19285		/* PROTECTED */
19286		/**
19287		 * Checks the supplied data and options for the editing component.
19288		 * @instance
19289		 * @protected
19290		 * @param {object} data - The jQuery data object from the parent table.
19291		 * @fires FooTable.Editing#"preinit.ft.editing"
19292		 */
19293		preinit: function(data){
19294			var self = this;
19295			/**
19296			 * The preinit.ft.editing event is raised before the UI is created and provides the tables jQuery data object for additional options parsing.
19297			 * Calling preventDefault on this event will disable the component.
19298			 * @event FooTable.Editing#"preinit.ft.editing"
19299			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
19300			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
19301			 * @param {object} data - The jQuery data object of the table raising the event.
19302			 */
19303			this.ft.raise('preinit.ft.editing', [data]).then(function(){
19304				if (self.ft.$el.hasClass('footable-editing'))
19305					self.enabled = true;
19306
19307				self.enabled = F.is.boolean(data.editing)
19308					? data.editing
19309					: self.enabled;
19310
19311				if (!self.enabled) return;
19312
19313				self.pageToNew = F.is.boolean(data.editingPageToNew) ? data.editingPageToNew : self.pageToNew;
19314
19315				self.alwaysShow = F.is.boolean(data.editingAlwaysShow) ? data.editingAlwaysShow : self.alwaysShow;
19316
19317				self.position = F.is.string(data.editingPosition) ? data.editingPosition : self.position;
19318
19319				self.showText = F.is.string(data.editingShowText) ? data.editingShowText : self.showText;
19320
19321				self.hideText = F.is.string(data.editingHideText) ? data.editingHideText : self.hideText;
19322
19323				self.addText = F.is.string(data.editingAddText) ? data.editingAddText : self.addText;
19324
19325				self.editText = F.is.string(data.editingEditText) ? data.editingEditText : self.editText;
19326
19327				self.deleteText = F.is.string(data.editingDeleteText) ? data.editingDeleteText : self.deleteText;
19328
19329				self.viewText = F.is.string(data.editingViewText) ? data.editingViewText : self.viewText;
19330
19331				self.allowAdd = F.is.boolean(data.editingAllowAdd) ? data.editingAllowAdd : self.allowAdd;
19332
19333				self.allowEdit = F.is.boolean(data.editingAllowEdit) ? data.editingAllowEdit : self.allowEdit;
19334
19335				self.allowDelete = F.is.boolean(data.editingAllowDelete) ? data.editingAllowDelete : self.allowDelete;
19336
19337				self.allowView = F.is.boolean(data.editingAllowView) ? data.editingAllowView : self.allowView;
19338
19339				self.column = new F.EditingColumn(self.ft, self, $.extend(true, {}, self.column, data.editingColumn, {visible: self.alwaysShow}));
19340
19341				if (self.ft.$el.hasClass('footable-editing-left'))
19342					self.position = 'left';
19343
19344				if (self.ft.$el.hasClass('footable-editing-right'))
19345					self.position = 'right';
19346
19347				if (self.position === 'right'){
19348					self.column.index = self.ft.columns.array.length;
19349				} else {
19350					self.column.index = 0;
19351					for (var i = 0, len = self.ft.columns.array.length; i < len; i++){
19352						self.ft.columns.array[i].index += 1;
19353					}
19354				}
19355				self.ft.columns.array.push(self.column);
19356				self.ft.columns.array.sort(function(a, b){ return a.index - b.index; });
19357
19358				self.callbacks.addRow = F.checkFnValue(self, data.editingAddRow, self.callbacks.addRow);
19359				self.callbacks.editRow = F.checkFnValue(self, data.editingEditRow, self.callbacks.editRow);
19360				self.callbacks.deleteRow = F.checkFnValue(self, data.editingDeleteRow, self.callbacks.deleteRow);
19361				self.callbacks.viewRow = F.checkFnValue(self, data.editingViewRow, self.callbacks.viewRow);
19362			}, function(){
19363				self.enabled = false;
19364			});
19365		},
19366		/**
19367		 * Initializes the editing component for the plugin using the supplied table and options.
19368		 * @instance
19369		 * @protected
19370		 * @fires FooTable.Editing#"init.ft.editing"
19371		 */
19372		init: function(){
19373			/**
19374			 * The init.ft.editing event is raised before its UI is generated.
19375			 * Calling preventDefault on this event will disable the component.
19376			 * @event FooTable.Editing#"init.ft.editing"
19377			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
19378			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
19379			 */
19380			var self = this;
19381			this.ft.raise('init.ft.editing').then(function(){
19382				self.$create();
19383			}, function(){
19384				self.enabled = false;
19385			});
19386		},
19387		/**
19388		 * Destroys the editing component removing any UI generated from the table.
19389		 * @instance
19390		 * @protected
19391		 * @fires FooTable.Editing#"destroy.ft.editing"
19392		 */
19393		destroy: function () {
19394			/**
19395			 * The destroy.ft.editing event is raised before its UI is removed.
19396			 * Calling preventDefault on this event will prevent the component from being destroyed.
19397			 * @event FooTable.Editing#"destroy.ft.editing"
19398			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
19399			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
19400			 */
19401			var self = this;
19402			this.ft.raise('destroy.ft.editing').then(function(){
19403				self.ft.$el.removeClass('footable-editing footable-editing-always-show footable-editing-no-add footable-editing-no-edit footable-editing-no-delete footable-editing-no-view')
19404					.off('click.ft.editing').find('tfoot > tr.footable-editing').remove();
19405			});
19406		},
19407		/**
19408		 * Creates the editing UI from the current options setting the various jQuery properties of this component.
19409		 * @instance
19410		 * @protected
19411		 */
19412		$create: function(){
19413			var self = this, position = self.position === 'right' ? 'footable-editing-right' : 'footable-editing-left';
19414			self.ft.$el.addClass('footable-editing').addClass(position)
19415				.on('click.ft.editing', '.footable-show', {self: self}, self._onShowClick)
19416				.on('click.ft.editing', '.footable-hide', {self: self}, self._onHideClick)
19417				.on('click.ft.editing', '.footable-edit', {self: self}, self._onEditClick)
19418				.on('click.ft.editing', '.footable-delete', {self: self}, self._onDeleteClick)
19419				.on('click.ft.editing', '.footable-view', {self: self}, self._onViewClick)
19420				.on('click.ft.editing', '.footable-add', {self: self}, self._onAddClick);
19421
19422			self.$cell = $('<td/>').attr('colspan', self.ft.columns.visibleColspan).append(self.$buttonShow());
19423			if (self.allowAdd){
19424				self.$cell.append(self.$buttonAdd());
19425			}
19426			self.$cell.append(self.$buttonHide());
19427
19428			if (self.alwaysShow){
19429				self.ft.$el.addClass('footable-editing-always-show');
19430			}
19431
19432			if (!self.allowAdd) self.ft.$el.addClass('footable-editing-no-add');
19433			if (!self.allowEdit) self.ft.$el.addClass('footable-editing-no-edit');
19434			if (!self.allowDelete) self.ft.$el.addClass('footable-editing-no-delete');
19435			if (!self.allowView) self.ft.$el.addClass('footable-editing-no-view');
19436
19437			var $tfoot = self.ft.$el.children('tfoot');
19438			if ($tfoot.length == 0){
19439				$tfoot = $('<tfoot/>');
19440				self.ft.$el.append($tfoot);
19441			}
19442			self.$row = $('<tr/>', { 'class': 'footable-editing' }).append(self.$cell).appendTo($tfoot);
19443		},
19444		/**
19445		 * Creates the show button for the editing component.
19446		 * @instance
19447		 * @protected
19448		 * @returns {(string|HTMLElement|jQuery)}
19449		 */
19450		$buttonShow: function(){
19451			return '<button type="button" class="btn btn-primary footable-show">
19451' + this.showText + '</button>';
19452		},
19453		/**
19454		 * Creates the hide button for the editing component.
19455		 * @instance
19456		 * @protected
19457		 * @returns {(string|HTMLElement|jQuery)}
19458		 */
19459		$buttonHide: function(){
19460			return '<button type="button" class="btn btn-default footable-hide">' + this.hideText + '</button>';
19461		},
19462		/**
19463		 * Creates the add button for the editing component.
19464		 * @instance
19465		 * @protected
19466		 * @returns {(string|HTMLElement|jQuery)}
19467		 */
19468		$buttonAdd: function(){
19469			return '<button type="button" class="btn btn-primary footable-add">' + this.addText + '</button> ';
19470		},
19471		/**
19472		 * Creates the edit button for the editing component.
19473		 * @instance
19474		 * @protected
19475		 * @returns {(string|HTMLElement|jQuery)}
19476		 */
19477		$buttonEdit: function(){
19478			return '<button type="button" class="btn btn-default footable-edit">' + this.editText + '</button> ';
19479		},
19480		/**
19481		 * Creates the delete button for the editing component.
19482		 * @instance
19483		 * @protected
19484		 * @returns {(string|HTMLElement|jQuery)}
19485		 */
19486		$buttonDelete: function(){
19487			return '<button type="button" class="btn btn-default footable-delete">' + this.deleteText + '</button>';
19488		},
19489		/**
19490		 * Creates the view button for the editing component.
19491		 * @instance
19492		 * @protected
19493		 * @returns {(string|HTMLElement|jQuery)}
19494		 */
19495		$buttonView: function(){
19496			return '<button type="button" class="btn btn-default footable-view">' + this.viewText + '</button> ';
19497		},
19498		/**
19499		 * Creates the button group for the row buttons.
19500		 * @instance
19501		 * @protected
19502		 * @returns {(string|HTMLElement|jQuery)}
19503		 */
19504		$rowButtons: function(){
19505			if (F.is.jq(this._$buttons)) return this._$buttons.clone();
19506			this._$buttons = $('<div class="btn-group btn-group-xs" role="group"></div>');
19507			if (this.allowView) this._$buttons.append(this.$buttonView());
19508			if (this.allowEdit) this._$buttons.append(this.$buttonEdit());
19509			if (this.allowDelete) this._$buttons.append(this.$buttonDelete());
19510			return this._$buttons;
19511		},
19512		/**
19513		 * Performs the drawing of the component.
19514		 */
19515		draw: function(){
19516			this.$cell.attr('colspan', this.ft.columns.visibleColspan);
19517		},
19518		/**
19519		 * Handles the edit button click event.
19520		 * @instance
19521		 * @private
19522		 * @param {jQuery.Event} e - The jQuery.Event object for the event.
19523		 * @fires FooTable.Editing#"edit.ft.editing"
19524		 */
19525		_onEditClick: function(e){
19526			e.preventDefault();
19527			var self = e.data.self, row = $(this).closest('tr').data('__FooTableRow__');
19528			if (row instanceof F.Row){
19529				/**
19530				 * The edit.ft.editing event is raised before its callback is executed.
19531				 * Calling preventDefault on this event will prevent the callback from being executed.
19532				 * @event FooTable.Editing#"edit.ft.editing"
19533				 * @param {jQuery.Event} e - The jQuery.Event object for the event.
19534				 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
19535				 * @param {FooTable.Row} row - The row to be edited.
19536				 */
19537				self.ft.raise('edit.ft.editing', [row]).then(function(){
19538					self.callbacks.editRow.call(self.ft, row);
19539				});
19540			}
19541		},
19542		/**
19543		 * Handles the delete button click event.
19544		 * @instance
19545		 * @private
19546		 * @param {jQuery.Event} e - The jQuery.Event object for the event.
19547		 * @fires FooTable.Editing#"delete.ft.editing"
19548		 */
19549		_onDeleteClick: function(e){
19550			e.preventDefault();
19551			var self = e.data.self, row = $(this).closest('tr').data('__FooTableRow__');
19552			if (row instanceof F.Row){
19553				/**
19554				 * The delete.ft.editing event is raised before its callback is executed.
19555				 * Calling preventDefault on this event will prevent the callback from being executed.
19556				 * @event FooTable.Editing#"delete.ft.editing"
19557				 * @param {jQuery.Event} e - The jQuery.Event object for the event.
19558				 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
19559				 * @param {FooTable.Row} row - The row to be deleted.
19560				 */
19561				self.ft.raise('delete.ft.editing', [row]).then(function(){
19562					self.callbacks.deleteRow.call(self.ft, row);
19563				});
19564			}
19565		},
19566		/**
19567		 * Handles the view button click event.
19568		 * @instance
19569		 * @private
19570		 * @param {jQuery.Event} e - The jQuery.Event object for the event.
19571		 * @fires FooTable.Editing#"view.ft.editing"
19572		 */
19573		_onViewClick: function(e){
19574			e.preventDefault();
19575			var self = e.data.self, row = $(this).closest('tr').data('__FooTableRow__');
19576			if (row instanceof F.Row){
19577				/**
19578				 * The view.ft.editing event is raised before its callback is executed.
19579				 * Calling preventDefault on this event will prevent the callback from being executed.
19580				 * @event FooTable.Editing#"view.ft.editing"
19581				 * @param {jQuery.Event} e - The jQuery.Event object for the event.
19582				 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
19583				 * @param {FooTable.Row} row - The row to be viewed.
19584				 */
19585				self.ft.raise('view.ft.editing', [row]).then(function(){
19586					self.callbacks.viewRow.call(self.ft, row);
19587				});
19588			}
19589		},
19590		/**
19591		 * Handles the add button click event.
19592		 * @instance
19593		 * @private
19594		 * @param {jQuery.Event} e - The jQuery.Event object for the event.
19595		 * @fires FooTable.Editing#"add.ft.editing"
19596		 */
19597		_onAddClick: function(e){
19598			e.preventDefault();
19599			var self = e.data.self;
19600			/**
19601			 * The add.ft.editing event is raised before its callback is executed.
19602			 * Calling preventDefault on this event will prevent the callback from being executed.
19603			 * @event FooTable.Editing#"add.ft.editing"
19604			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
19605			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
19606			 */
19607			self.ft.raise('add.ft.editing').then(function(){
19608				self.callbacks.addRow.call(self.ft);
19609			});
19610		},
19611		/**
19612		 * Handles the show button click event.
19613		 * @instance
19614		 * @private
19615		 * @param {jQuery.Event} e - The jQuery.Event object for the event.
19616		 * @fires FooTable.Editing#"show.ft.editing"
19617		 */
19618		_onShowClick: function(e){
19619			e.preventDefault();
19620			var self = e.data.self;
19621			/**
19622			 * The show.ft.editing event is raised before its callback is executed.
19623			 * Calling preventDefault on this event will prevent the callback from being executed.
19624			 * @event FooTable.Editing#"show.ft.editing"
19625			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
19626			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
19627			 */
19628			self.ft.raise('show.ft.editing').then(function(){
19629				self.ft.$el.addClass('footable-editing-show');
19630				self.column.visible = true;
19631				self.ft.draw();
19632			});
19633		},
19634		/**
19635		 * Handles the hide button click event.
19636		 * @instance
19637		 * @private
19638		 * @param {jQuery.Event} e - The jQuery.Event object for the event.
19639		 * @fires FooTable.Editing#"show.ft.editing"
19640		 */
19641		_onHideClick: function(e){
19642			e.preventDefault();
19643			var self = e.data.self;
19644			/**
19645			 * The hide.ft.editing event is raised before its callback is executed.
19646			 * Calling preventDefault on this event will prevent the callback from being executed.
19647			 * @event FooTable.Editing#"hide.ft.editing"
19648			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
19649			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
19650			 */
19651			self.ft.raise('hide.ft.editing').then(function(){
19652				self.ft.$el.removeClass('footable-editing-show');
19653				self.column.visible = false;
19654				self.ft.draw();
19655			});
19656		}
19657	});
19658
19659	F.components.register('editing', F.Editing, 850);
19660
19661})(jQuery, FooTable);
19662
19663(function($, F){
19664
19665	F.EditingColumn = F.Column.extend(/** @lends FooTable.EditingColumn */{
19666		/**
19667		 * The Editing column class is used to create the column containing the editing buttons.
19668		 * @constructs
19669		 * @extends FooTable.Column
19670		 * @param {FooTable.Table} instance -  The parent {@link FooTable.Table} this column belongs to.
19671		 * @param {FooTable.Editing} editing - The parent {@link FooTable.Editing} component this column is used with.
19672		 * @param {object} definition - An object containing all the properties to set for the column.
19673		 * @returns {FooTable.EditingColumn}
19674		 */
19675		construct: function(instance, editing, definition){
19676			this._super(instance, definition, 'editing');
19677			this.editing = editing;
19678			this.internal = true;
19679		},
19680		/**
19681		 * After the column has been defined this ensures that the $el property is a jQuery object by either creating or updating the current value.
19682		 * @instance
19683		 * @protected
19684		 * @this FooTable.Column
19685		 */
19686		$create: function(){
19687			(this.$el = !this.virtual && F.is.jq(this.$el) ? this.$el : $('<th/>', {'class': 'footable-editing'})).html(this.title);
19688		},
19689		/**
19690		 * This is supplied either the cell value or jQuery object to parse. Any value can be returned from this method and
19691		 * will be provided to the {@link FooTable.EditingColumn#format} function
19692		 * to generate the cell contents.
19693		 * @instance
19694		 * @protected
19695		 * @param {(*|jQuery)} valueOrElement - The value or jQuery cell object.
19696		 * @returns {(jQuery)}
19697		 */
19698		parser: function(valueOrElement){
19699			if (F.is.string(valueOrElement)) valueOrElement = $($.trim(valueOrElement));
19700			if (F.is.element(valueOrElement)) valueOrElement = $(valueOrElement);
19701			if (F.is.jq(valueOrElement)){
19702				var tagName = valueOrElement.prop('tagName').toLowerCase();
19703				if (tagName == 'td' || tagName == 'th') return valueOrElement.data('value') || valueOrElement.contents();
19704				return valueOrElement;
19705			}
19706			return null;
19707		},
19708		/**
19709		 * Creates a cell to be used in the supplied row for this column.
19710		 * @param {FooTable.Row} row - The row to create the cell for.
19711		 * @returns {FooTable.Cell}
19712		 */
19713		createCell: function(row){
19714			var $buttons = this.editing.$rowButtons(), $cell = $('<td/>').append($buttons);
19715			if (F.is.jq(row.$el)){
19716				if (this.index === 0){
19717					$cell.prependTo(row.$el);
19718				} else {
19719					$cell.insertAfter(row.$el.children().eq(this.index-1));
19720				}
19721			}
19722			return new F.Cell(this.ft, row, this, $cell || $cell.html());
19723		}
19724	});
19725
19726	F.columns.register('editing', F.EditingColumn);
19727
19728})(jQuery, FooTable);
19729(function($, F) {
19730
19731	/**
19732	 * An object containing the editing options for the plugin. Added by the {@link FooTable.Editing} component.
19733	 * @type {object}
19734	 * @prop {boolean} enabled=false - Whether or not to allow editing on the table.
19735	 * @prop {boolean} pageToNew=true - Whether or not to automatically page to a new row when it is added to the table.
19736	 * @prop {string} position="right" - The position of the editing column in the table as well as the alignment of the buttons.
19737	 * @prop {boolean} alwaysShow=false - Whether or not the editing column and add row button are always visible.
19738	 * @prop {function} addRow - The callback function to execute when the add row button is clicked.
19739	 * @prop {function} editRow - The callback function to execute when the edit row button is clicked.
19740	 * @prop {function} deleteRow - The callback function to execute when the delete row button is clicked.
19741	 * @prop {function} viewRow - The callback function to execute when the view row button is clicked.
19742	 * @prop {string} showText - The text that appears in the show button. This can contain HTML.
19743	 * @prop {string} hideText - The text that appears in the hide button. This can contain HTML.
19744	 * @prop {string} addText - The text that appears in the add button. This can contain HTML.
19745	 * @prop {string} editText - The text that appears in the edit button. This can contain HTML.
19746	 * @prop {string} deleteText - The text that appears in the delete button. This can contain HTML.
19747	 * @prop {string} viewText - The text that appears in the view button. This can contain HTML.
19748	 * @prop {boolean} allowAdd - Whether or not to show the Add Row button.
19749	 * @prop {boolean} allowEdit - Whether or not to show the Edit Row button.
19750	 * @prop {boolean} allowDelete - Whether or not to show the Delete Row button.
19751	 * @prop {boolean} allowView - Whether or not to show the View Row button.
19752	 * @prop {object} column - The options for the editing column. @see {@link FooTable.EditingColumn} for more info.
19753	 * @prop {string} column.classes="footable-editing" - A space separated string of class names to apply to all cells in the column.
19754	 * @prop {string} column.name="editing" - The name of the column.
19755	 * @prop {string} column.title="" - The title displayed in the header row of the table for the column.
19756	 * @prop {boolean} column.filterable=false - Whether or not the column should be filterable when using the filtering component.
19757	 * @prop {boolean} column.sortable=false - Whether or not the column should be sortable when using the sorting component.
19758	 */
19759	F.Defaults.prototype.editing = {
19760		enabled: false,
19761		pageToNew: true,
19762		position: 'right',
19763		alwaysShow: false,
19764		addRow: function(){},
19765		editRow: function(row){},
19766		deleteRow: function(row){},
19767		viewRow: function(row){},
19768		showText: '<span class="fooicon fooicon-pencil" aria-hidden="true"></span> Edit rows',
19769		hideText: 'Cancel',
19770		addText: 'New row',
19771		editText: '<span class="fooicon fooicon-pencil" aria-hidden="true"></span>',
19772		deleteText: '<span class="fooicon fooicon-trash" aria-hidden="true"></span>',
19773		viewText: '<span class="fooicon fooicon-stats" aria-hidden="true"></span>',
19774		allowAdd: true,
19775		allowEdit: true,
19776		allowDelete: true,
19777		allowView: false,
19778		column: {
19779			classes: 'footable-editing',
19780			name: 'editing',
19781			title: '',
19782			filterable: false,
19783			sortable: false
19784		}
19785	};
19786
19787})(jQuery, FooTable);
19788
19789(function($, F){
19790
19791	if (F.is.defined(F.Paging)){
19792		/**
19793		 * Holds a shallow clone of the un-paged {@link FooTable.Rows#array} value before paging occurs and superfluous rows are removed. Added by the {@link FooTable.Editing} component.
19794		 * @instance
19795		 * @public
19796		 * @type {Array<FooTable.Row>}
19797		 */
19798		F.Paging.prototype.unpaged = [];
19799
19800		// override the default predraw method with one that sets the unpaged property.
19801		F.Paging.extend('predraw', function(){
19802			this.unpaged = this.ft.rows.array.slice(0); // create a shallow clone for later use
19803			this._super(); // call the original method
19804		});
19805	}
19806
19807})(jQuery, FooTable);
19808(function($, F){
19809
19810	/**
19811	 * Adds the row to the table.
19812	 * @param {boolean} [redraw=true] - Whether or not to redraw the table, defaults to true but for bulk operations this
19813	 * can be set to false and then followed by a call to the {@link FooTable.Table#draw} method.
19814	 * @returns {jQuery.Deferred}
19815	 */
19816	F.Row.prototype.add = function(redraw){
19817		redraw = F.is.boolean(redraw) ? redraw : true;
19818		var self = this;
19819		return $.Deferred(function(d){
19820			var index = self.ft.rows.all.push(self) - 1;
19821			if (redraw){
19822				return self.ft.draw().then(function(){
19823					d.resolve(index);
19824				});
19825			} else {
19826				d.resolve(index);
19827			}
19828		});
19829	};
19830
19831	/**
19832	 * Removes the row from the table.
19833	 * @param {boolean} [redraw=true] - Whether or not to redraw the table, defaults to true but for bulk operations this
19834	 * can be set to false and then followed by a call to the {@link FooTable.Table#draw} method.
19835	 * @returns {jQuery.Deferred}
19836	 */
19837	F.Row.prototype.delete = function(redraw){
19838		redraw = F.is.boolean(redraw) ? redraw : true;
19839		var self = this;
19840		return $.Deferred(function(d){
19841			var index = self.ft.rows.all.indexOf(self);
19842			if (F.is.number(index) && index >= 0 && index < self.ft.rows.all.length){
19843				self.ft.rows.all.splice(index, 1);
19844				if (redraw){
19845					return self.ft.draw().then(function(){
19846						d.resolve(self);
19847					});
19848				}
19849			}
19850			d.resolve(self);
19851		});
19852	};
19853
19854	if (F.is.defined(F.Paging)){
19855		// override the default add method with one that supports paging
19856		F.Row.extend('add', function(redraw){
19857			redraw = F.is.boolean(redraw) ? redraw : true;
19858			var self = this,
19859				added = this._super(redraw),
19860				editing = self.ft.use(F.Editing),
19861				paging;
19862			if (editing && editing.pageToNew && (paging = self.ft.use(F.Paging)) && redraw){
19863				return added.then(function(){
19864					var index = paging.unpaged.indexOf(self); // find this row in the unpaged array (this array will be sorted and filtered)
19865					var page = Math.ceil((index + 1) / paging.size); // calculate the page the new row is on
19866					if (paging.current !== page){ // goto the page if we need to
19867						return paging.goto(page);
19868					}
19869				});
19870			}
19871			return added;
19872		});
19873	}
19874
19875	if (F.is.defined(F.Sorting)){
19876		// override the default val method with one that supports sorting and paging
19877		F.Row.extend('val', function(data, redraw){
19878			redraw = F.is.boolean(redraw) ? redraw : true;
19879			var result = this._super(data);
19880			if (!F.is.hash(data)){
19881				return result;
19882			}
19883			var self = this;
19884			if (redraw){
19885				self.ft.draw().then(function(){
19886					var editing = self.ft.use(F.Editing), paging;
19887					if (F.is.defined(F.Paging) && editing && editing.pageToNew && (paging = self.ft.use(F.Paging))){
19888						var index = paging.unpaged.indexOf(self); // find this row in the unpaged array (this array will be sorted and filtered)
19889						var page = Math.ceil((index + 1) / paging.size); // calculate the page the new row is on
19890						if (paging.current !== page){ // goto the page if we need to
19891							return paging.goto(page);
19892						}
19893					}
19894				});
19895			}
19896			return result;
19897		});
19898	}
19899
19900})(jQuery, FooTable);
19901(function(F){
19902
19903	/**
19904	 * Adds a row to the underlying {@link FooTable.Rows#all} array.
19905	 * @param {(object|FooTable.Row)} dataOrRow - A hash containing the row values or an actual {@link FooTable.Row} object.
19906	 * @param {boolean} [redraw=true] - Whether or not to redraw the table, defaults to true but for bulk operations this
19907	 * can be set to false and then followed by a call to the {@link FooTable.Table#draw} method.
19908	 */
19909	F.Rows.prototype.add = function(dataOrRow, redraw){
19910		var row = dataOrRow;
19911		if (F.is.hash(dataOrRow)){
19912			row = new FooTable.Row(this.ft, this.ft.columns.array, dataOrRow);
19913		}
19914		if (row instanceof FooTable.Row){
19915			row.add(redraw);
19916		}
19917	};
19918
19919	/**
19920	 * Updates a row in the underlying {@link FooTable.Rows#all} array.
19921	 * @param {(number|FooTable.Row)} indexOrRow - The index to update or the actual {@link FooTable.Row} object.
19922	 * @param {object} data - A hash containing the new row values.
19923	 * @param {boolean} [redraw=true] - Whether or not to redraw the table, defaults to true but for bulk operations this
19924	 * can be set to false and then followed by a call to the {@link FooTable.Table#draw} method.
19925	 */
19926	F.Rows.prototype.update = function(indexOrRow, data, redraw){
19927		var len = this.ft.rows.all.length, 
19928			row = indexOrRow;
19929		if (F.is.number(indexOrRow) && indexOrRow >= 0 && indexOrRow < len){
19930			row = this.ft.rows.all[indexOrRow];
19931		}
19932		if (row instanceof FooTable.Row && F.is.hash(data)){
19933			row.val(data, redraw);
19934		}
19935	};
19936
19937	/**
19938	 * Deletes a row from the underlying {@link FooTable.Rows#all} array.
19939	 * @param {(number|FooTable.Row)} indexOrRow - The index to delete or the actual {@link FooTable.Row} object.
19940	 * @param {boolean} [redraw=true] - Whether or not to redraw the table, defaults to true but for bulk operations this
19941	 * can be set to false and then followed by a call to the {@link FooTable.Table#draw} method.
19942	 */
19943	F.Rows.prototype.delete = function(indexOrRow, redraw){
19944		var len = this.ft.rows.all.length, 
19945			row = indexOrRow;
19946		if (F.is.number(indexOrRow) && indexOrRow >= 0 && indexOrRow < len){
19947			row = this.ft.rows.all[indexOrRow];
19948		}
19949		if (row instanceof FooTable.Row){
19950			row.delete(redraw);
19951		}
19952	};
19953
19954})(FooTable);
19955
19956(function($, F){
19957
19958	// global int to use if the table has no ID
19959	var _uid = 0,
19960	// a hash value for the current url
19961		_url_hash = (function(str){
19962			var i, l, hval = 0x811c9dc5;
19963			for (i = 0, l = str.length; i < l; i++) {
19964				hval ^= str.charCodeAt(i);
19965				hval += (hval << 1) + (hval << 4) + (hval << 7) + (hval << 8) + (hval << 24);
19966			}
19967			return hval >>> 0;
19968		})(location.origin + location.pathname);
19969
19970	F.State = F.Component.extend(/** @lends FooTable.State */{
19971		/**
19972		 * The state component adds the ability for the table to remember its basic state for filtering, paging and sorting.
19973		 * @constructs
19974		 * @extends FooTable.Component
19975		 * @param {FooTable.Table} table - The parent {@link FooTable.Table} object for the component.
19976		 * @returns {FooTable.State}
19977		 */
19978		construct: function(table){
19979			// call the constructor of the base class
19980			this._super(table, table.o.state.enabled);
19981			// Change this value if an update to this component requires any stored data to be reset
19982			this._key = '1';
19983			/**
19984			 * The key to use to store the state for this table.
19985			 * @type {(null|string)}
19986			 */
19987			this.key = this._key + (F.is.string(table.o.state.key) ? table.o.state.key : this._uid());
19988			/**
19989			 * Whether or not to allow the filtering component to store it's state.
19990			 * @type {boolean}
19991			 */
19992			this.filtering = F.is.boolean(table.o.state.filtering) ? table.o.state.filtering : true;
19993			/**
19994			 * Whether or not to allow the paging component to store it's state.
19995			 * @type {boolean}
19996			 */
19997			this.paging = F.is.boolean(table.o.state.paging) ? table.o.state.paging : true;
19998			/**
19999			 * Whether or not to allow the sorting component to store it's state.
20000			 * @type {boolean}
20001			 */
20002			this.sorting = F.is.boolean(table.o.state.sorting) ? table.o.state.sorting : true;
20003		},
20004		/* PROTECTED */
20005		/**
20006		 * Checks the supplied data and options for the state component.
20007		 * @instance
20008		 * @protected
20009		 * @param {object} data - The jQuery data object from the parent table.
20010		 * @fires FooTable.State#"preinit.ft.state"
20011		 * @this FooTable.State
20012		 */
20013		preinit: function(data){
20014			var self = this;
20015			/**
20016			 * The preinit.ft.state event is raised before the UI is created and provides the tables jQuery data object for additional options parsing.
20017			 * Calling preventDefault on this event will disable the component.
20018			 * @event FooTable.State#"preinit.ft.state"
20019			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
20020			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
20021			 * @param {object} data - The jQuery data object of the table raising the event.
20022			 */
20023			this.ft.raise('preinit.ft.state', [data]).then(function(){
20024
20025				self.enabled = F.is.boolean(data.state)
20026					? data.state
20027					: self.enabled;
20028
20029				if (!self.enabled) return;
20030
20031				self.key = self._key + (F.is.string(data.stateKey) ? data.stateKey : self.key);
20032
20033				self.filtering = F.is.boolean(data.stateFiltering) ? data.stateFiltering : self.filtering;
20034
20035				self.paging = F.is.boolean(data.statePaging) ? data.statePaging : self.paging;
20036
20037				self.sorting = F.is.boolean(data.stateSorting) ? data.stateSorting : self.sorting;
20038
20039			}, function(){
20040				self.enabled = false;
20041			});
20042		},
20043		/**
20044		 * Gets the state value for the specified key for this table.
20045		 * @instance
20046		 * @param {string} key - The key to get the value for.
20047		 * @returns {(*|null)}
20048		 */
20049		get: function(key){
20050			return JSON.parse(localStorage.getItem(this.key + ':' + key));
20051		},
20052		/**
20053		 * Sets the state value for the specified key for this table.
20054		 * @instance
20055		 * @param {string}
20055 key - The key to set the value for.
20056		 * @param {*} data - The value to store for the key. This value must be JSON.stringify friendly.
20057		 */
20058		set: function(key, data){
20059			localStorage.setItem(this.key + ':' + key, JSON.stringify(data));
20060		},
20061		/**
20062		 * Clears the state value for the specified key for this table.
20063		 * @instance
20064		 * @param {string} key - The key to clear the value for.
20065		 */
20066		remove: function(key){
20067			localStorage.removeItem(this.key + ':' + key);
20068		},
20069		/**
20070		 * Executes the {@link FooTable.Component#readState} function on all components.
20071		 * @instance
20072		 */
20073		read: function(){
20074			this.ft.execute(false, true, 'readState');
20075		},
20076		/**
20077		 * Executes the {@link FooTable.Component#writeState} function on all components.
20078		 * @instance
20079		 */
20080		write: function(){
20081			this.ft.execute(false, true, 'writeState');
20082		},
20083		/**
20084		 * Executes the {@link FooTable.Component#clearState} function on all components.
20085		 * @instance
20086		 */
20087		clear: function(){
20088			this.ft.execute(false, true, 'clearState');
20089		},
20090		/**
20091		 * Generates a unique identifier for the current {@link FooTable.Table} if one is not supplied through the options.
20092		 * This value is a combination of the url hash and either the element ID or an incremented global int value.
20093		 * @instance
20094		 * @returns {*}
20095		 * @private
20096		 */
20097		_uid: function(){
20098			var id = this.ft.$el.attr('id');
20099			return _url_hash + '_' + (F.is.string(id) ? id : ++_uid);
20100		}
20101	});
20102
20103	F.components.register('state', F.State, 700);
20104
20105})(jQuery, FooTable);
20106(function(F){
20107
20108	/**
20109	 * This method is called from the {@link FooTable.State#read} method and allows a component to retrieve its' stored state.
20110	 * @instance
20111	 * @protected
20112	 * @function
20113	 */
20114	F.Component.prototype.readState = function(){};
20115
20116	/**
20117	 * This method is called from the {@link FooTable.State#write} method and allows a component to write its' current state to the store.
20118	 * @instance
20119	 * @protected
20120	 * @function
20121	 */
20122	F.Component.prototype.writeState = function(){};
20123
20124	/**
20125	 * This method is called from the {@link FooTable.State#clear} method and allows a component to clear any stored state.
20126	 * @instance
20127	 * @protected
20128	 * @function
20129	 */
20130	F.Component.prototype.clearState = function(){};
20131
20132})(FooTable);
20133(function(F){
20134
20135	/**
20136	 * An object containing the state options for the plugin. Added by the {@link FooTable.State} component.
20137	 * @type {object}
20138	 * @prop {boolean} enabled=false - Whether or not to allow state to be stored for the table. This overrides the individual component enable options.
20139	 * @prop {boolean} filtering=true - Whether or not to allow the filtering state to be stored.
20140	 * @prop {boolean} paging=true - Whether or not to allow the filtering state to be stored.
20141	 * @prop {boolean} sorting=true - Whether or not to allow the filtering state to be stored.
20142	 * @prop {string} key=null - The unique key to use to store the table's data.
20143	 */
20144	F.Defaults.prototype.state = {
20145		enabled: false,
20146		filtering: true,
20147		paging: true,
20148		sorting: true,
20149		key: null
20150	};
20151
20152})(FooTable);
20153(function(F){
20154
20155	if (!F.Filtering) return;
20156
20157	/**
20158	 * Allows the filtering component to retrieve its' stored state.
20159	 */
20160	F.Filtering.prototype.readState = function(){
20161		if (this.ft.state.filtering){
20162			var state = this.ft.state.get('filtering');
20163			if (F.is.hash(state) && !F.is.emptyArray(state.filters)){
20164				this.filters = this.ensure(state.filters);
20165			}
20166		}
20167	};
20168
20169	/**
20170	 * Allows the filtering component to write its' current state to the store.
20171	 */
20172	F.Filtering.prototype.writeState = function(){
20173		if (this.ft.state.filtering) {
20174			var filters = F.arr.map(this.filters, function (f) {
20175				return {
20176					name: f.name,
20177					query: f.query instanceof F.Query ? f.query.val() : f.query,
20178					columns: F.arr.map(f.columns, function (c) {
20179						return c.name;
20180					}),
20181					hidden: f.hidden,
20182					space: f.space,
20183					connectors: f.connectors,
20184					ignoreCase: f.ignoreCase
20185				};
20186			});
20187			this.ft.state.set('filtering', {filters: filters});
20188		}
20189	};
20190
20191	/**
20192	 * Allows the filtering component to clear any stored state.
20193	 */
20194	F.Filtering.prototype.clearState = function(){
20195		if (this.ft.state.filtering) {
20196			this.ft.state.remove('filtering');
20197		}
20198	};
20199
20200})(FooTable);
20201(function(F){
20202
20203	if (!F.Paging) return;
20204
20205	/**
20206	 * Allows the paging component to retrieve its' stored state.
20207	 */
20208	F.Paging.prototype.readState = function(){
20209		if (this.ft.state.paging) {
20210			var state = this.ft.state.get('paging');
20211			if (F.is.hash(state)) {
20212				this.current = state.current;
20213				this.size = state.size;
20214			}
20215		}
20216	};
20217
20218	/**
20219	 * Allows the paging component to write its' current state to the store.
20220	 */
20221	F.Paging.prototype.writeState = function(){
20222		if (this.ft.state.paging) {
20223			this.ft.state.set('paging', {
20224				current: this.current,
20225				size: this.size
20226			});
20227		}
20228	};
20229
20230	/**
20231	 * Allows the paging component to clear any stored state.
20232	 */
20233	F.Paging.prototype.clearState = function(){
20234		if (this.ft.state.paging) {
20235			this.ft.state.remove('paging');
20236		}
20237	};
20238
20239})(FooTable);
20240(function(F){
20241
20242	if (!F.Sorting) return;
20243
20244	/**
20245	 * Allows the sorting component to retrieve its' stored state.
20246	 */
20247	F.Sorting.prototype.readState = function(){
20248		if (this.ft.state.sorting) {
20249			var state = this.ft.state.get('sorting');
20250			if (F.is.hash(state)) {
20251				var column = this.ft.columns.get(state.column);
20252				if (column instanceof F.Column) {
20253					this.column = column;
20254					this.column.direction = state.direction;
20255				}
20256			}
20257		}
20258	};
20259
20260	/**
20261	 * Allows the sorting component to write its' current state to the store.
20262	 */
20263	F.Sorting.prototype.writeState = function(){
20264		if (this.ft.state.sorting && this.column instanceof F.Column){
20265			this.ft.state.set('sorting', {
20266				column: this.column.name,
20267				direction: this.column.direction
20268			});
20269		}
20270	};
20271
20272	/**
20273	 * Allows the sorting component to clear any stored state.
20274	 */
20275	F.Sorting.prototype.clearState = function(){
20276		if (this.ft.state.sorting) {
20277			this.ft.state.remove('sorting');
20278		}
20279	};
20280
20281})(FooTable);
20282(function(F){
20283
20284	// hook into the _construct method so we can add the state property to the table.
20285	F.Table.extend('_construct', function(ready){
20286		this.state = this.use(FooTable.State);
20287		return this._super(ready);
20288	});
20289
20290	// hook into the _preinit method so we can trigger a plugin wide read state operation.
20291	F.Table.extend('_preinit', function(){
20292		var self = this;
20293		return self._super().then(function(){
20294			if (self.state.enabled){
20295				self.state.read();
20296			}
20297		});
20298	});
20299
20300	// hook into the draw method so we can trigger a plugin wide write state operation.
20301	F.Table.extend('draw', function(){
20302		var self = this;
20303		return self._super().then(function(){
20304			if (self.state.enabled){
20305				self.state.write();
20306			}
20307		});
20308	});
20309
20310})(FooTable);
20311(function($, F){
20312
20313	F.Export = F.Component.extend(/** @lends FooTable.Export */{
20314		/**
20315		 * @summary This component provides some basic export functionality.
20316		 * @memberof FooTable
20317		 * @constructs Export
20318		 * @param {FooTable.Table} table - The current instance of the plugin.
20319		 */
20320		construct: function(table){
20321			// call the constructor of the base class
20322			this._super(table, true);
20323			/**
20324			 * @summary A snapshot of the working set of rows prior to being trimmed by the paging component.
20325			 * @memberof FooTable.Export#
20326			 * @name snapshot
20327			 * @type {FooTable.Row[]}
20328			 */
20329			this.snapshot = [];
20330		},
20331		/**
20332		 * @summary Hooks into the predraw pipeline after sorting and filtering have taken place but prior to paging.
20333		 * @memberof FooTable.Export#
20334		 * @function predraw
20335		 * @description This method allows us to take a snapshot of the working set of rows before they are trimmed by the paging component and is called by the plugin instance.
20336		 */
20337		predraw: function(){
20338			this.snapshot = this.ft.rows.array.slice(0);
20339		},
20340		/**
20341		 * @summary Return the columns as simple JavaScript objects in an array.
20342		 * @memberof FooTable.Export#
20343		 * @function columns
20344		 * @returns {Object[]}
20345		 */
20346		columns: function(){
20347			var result = [];
20348			F.arr.each(this.ft.columns.array, function(column){
20349				if (!column.internal){
20350					result.push({
20351						type: column.type,
20352						name: column.name,
20353						title: column.title,
20354						visible: column.visible,
20355						hidden: column.hidden,
20356						classes: column.classes,
20357						style: column.style
20358					});
20359				}
20360			});
20361			return result;
20362		},
20363		/**
20364		 * @summary Return the rows as simple JavaScript objects in an array.
20365		 * @memberof FooTable.Export#
20366		 * @function rows
20367		 * @param {boolean} [filtered=false] - Whether or not to exclude filtered rows from the result.
20368		 * @returns {Object[]}
20369		 */
20370		rows: function(filtered){
20371			filtered = F.is.boolean(filtered) ? filtered : false;
20372			var rows = filtered ? this.ft.rows.all : this.snapshot, result = [];
20373			F.arr.each(rows, function(row){
20374				result.push(row.val());
20375			});
20376			return result;
20377		},
20378		/**
20379		 * @summary Return the columns and rows as a properly formatted JSON object.
20380		 * @memberof FooTable.Export#
20381		 * @function json
20382		 * @param {boolean} [filtered=false] - Whether or not to exclude filtered rows from the result.
20383		 * @returns {Object}
20384		 */
20385		json: function(filtered){
20386			return JSON.parse(JSON.stringify({columns: this.columns(),rows: this.rows(filtered)}));
20387		},
20388		/**
20389		 * @summary Return the columns and rows as a properly formatted CSV value.
20390		 * @memberof FooTable.Export#
20391		 * @function csv
20392		 * @param {boolean} [filtered=false] - Whether or not to exclude filtered rows from the result.
20393		 * @returns {string}
20394		 */
20395		csv: function(filtered){
20396			var csv = "", columns = this.columns(), value, escaped;
20397			F.arr.each(columns, function(column, i){
20398				escaped = '"' + column.title.replace(/"/g, '""') + '"';
20399				csv += (i === 0 ? escaped : "," + escaped);
20400			});
20401			csv += "\n";
20402
20403			var rows = filtered ? this.ft.rows.all : this.snapshot;
20404			F.arr.each(rows, function(row){
20405				F.arr.each(row.cells, function(cell, i){
20406					if (!cell.column.internal){
20407						value = cell.column.stringify.call(cell.column, cell.value, cell.ft.o, cell.row.value);
20408						escaped = '"' + value.replace(/"/g, '""') + '"';
20409						csv += (i === 0 ? escaped : "," + escaped);
20410					}
20411				});
20412				csv += "\n";
20413			});
20414			return csv;
20415		}
20416	});
20417
20418	// register the component using a priority of 490 which falls just after filtering (500) and before paging (400).
20419	F.components.register("export", F.Export, 490);
20420
20421})(jQuery, FooTable);
20422(function(F){
20423	// this is used to define the filtering specific properties on column creation
20424	F.Column.prototype.__export_define__ = function(definition){
20425		this.stringify = F.checkFnValue(this, definition.stringify, this.stringify);
20426	};
20427
20428	// overrides the public define method and replaces it with our own
20429	F.Column.extend('define', function(definition){
20430		this._super(definition); // call the base so we don't have to redefine any previously set properties
20431		this.__export_define__(definition); // then call our own
20432	});
20433
20434	/**
20435	 * @summary Return the supplied value as a string.
20436	 * @memberof FooTable.Column#
20437	 * @function stringify
20438	 * @returns {string}
20439	 */
20440	F.Column.prototype.stringify = function(value, options, rowData){
20441		return value + "";
20442	};
20443
20444	// override the base method for DateColumns
20445	F.DateColumn.prototype.stringify = function(value, options, rowData){
20446		return F.is.object(value) && F.is.boolean(value._isAMomentObject) && value.isValid() ? value.format(this.formatString) : '';
20447	};
20448
20449	// override the base method for ObjectColumns
20450	F.ObjectColumn.prototype.stringify = function(value, options, rowData){
20451		return F.is.object(value) ? JSON.stringify(value) : "";
20452	};
20453
20454	// override the base method for ArrayColumns
20455	F.ArrayColumn.prototype.stringify = function(value, options, rowData){
20456		return F.is.array(value) ? JSON.stringify(value) : "";
20457	};
20458
20459})(FooTable);
20460(function(F){
20461	/**
20462	 * @summary Return the columns and rows as a properly formatted JSON object.
20463	 * @memberof FooTable.Table#
20464	 * @function toJSON
20465	 * @param {boolean} [filtered=false] - Whether or not to exclude filtered rows from the result.
20466	 * @returns {Object}
20467	 */
20468	F.Table.prototype.toJSON = function(filtered){
20469		return this.use(F.Export).json(filtered);
20470	};
20471
20472	/**
20473	 * @summary Return the columns and rows as a properly formatted CSV value.
20474	 * @memberof FooTable.Table#
20475	 * @function toCSV
20476	 * @param {boolean} [filtered=false] - Whether or not to exclude filtered rows from the result.
20477	 * @returns {string}
20478	 */
20479	F.Table.prototype.toCSV = function(filtered){
20480		return this.use(F.Export).csv(filtered);
20481	};
20482
20483})(FooTable);
20484/* End */
20485;
20486; /* Start:"a:4:{s:4:"full";s:69:"/bitrix/templates/aspro_max/vendor/js/ResizeSensor.js?171646553711190";s:6:"source";s:53:"/bitrix/templates/aspro_max/vendor/js/ResizeSensor.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
20487'use strict';
20488
20489/**
20490 * Copyright Marc J. Schmidt. See the LICENSE file at the top-level
20491 * directory of this distribution and at
20492 * https://github.com/marcj/css-element-queries/blob/master/LICENSE.
20493 */
20494(function (root, factory) {
20495    if (typeof define === "function" && define.amd) {
20496        define(factory);
20497    } else if (typeof exports === "object") {
20498        module.exports = factory();
20499    } else {
20500        root.ResizeSensor = factory();
20501    }
20502}(typeof window !== 'undefined' ? window : this, function () {
20503
20504    // Make sure it does not throw in a SSR (Server Side Rendering) situation
20505    if (typeof window === "undefined") {
20506        return null;
20507    }
20508    // https://github.com/Semantic-Org/Semantic-UI/issues/3855
20509    // https://github.com/marcj/css-element-queries/issues/257
20510    var globalWindow = typeof window != 'undefined' && window.Math == Math
20511        ? window
20512        : typeof self != 'undefined' && self.Math == Math
20513            ? self
20514            : Function('return this')();
20515    // Only used for the dirty checking, so the event callback count is limited to max 1 call per fps per sensor.
20516    // In combination with the event based resize sensor this saves cpu time, because the sensor is too fast and
20517    // would generate too many unnecessary events.
20518    var requestAnimationFrame = globalWindow.requestAnimationFrame ||
20519        globalWindow.mozRequestAnimationFrame ||
20520        globalWindow.webkitRequestAnimationFrame ||
20521        function (fn) {
20522            return globalWindow.setTimeout(fn, 20);
20523        };
20524
20525    /**
20526     * Iterate over each of the provided element(s).
20527     *
20528     * @param {HTMLElement|HTMLElement[]} elements
20529     * @param {Function}                  callback
20530     */
20531    function forEachElement(elements, callback){
20532        var elementsType = Object.prototype.toString.call(elements);
20533        var isCollectionTyped = ('[object Array]' === elementsType
20534            || ('[object NodeList]' === elementsType)
20535            || ('[object HTMLCollection]' === elementsType)
20536            || ('[object Object]' === elementsType)
20537            || ('undefined' !== typeof jQuery && elements instanceof jQuery) //jquery
20538            || ('undefined' !== typeof Elements && elements instanceof Elements) //mootools
20539        );
20540        var i = 0, j = elements.length;
20541        if (isCollectionTyped) {
20542            for (; i < j; i++) {
20543                callback(elements[i]);
20544            }
20545        } else {
20546            callback(elements);
20547        }
20548    }
20549
20550    /**
20551    * Get element size
20552    * @param {HTMLElement} element
20553    * @returns {Object} {width, height}
20554    */
20555    function getElementSize(element) {
20556        if (!element.getBoundingClientRect) {
20557            return {
20558                width: element.offsetWidth,
20559                height: element.offsetHeight
20560            }
20561        }
20562
20563        var rect = element.getBoundingClientRect();
20564        return {
20565            width: Math.round(rect.width),
20566            height: Math.round(rect.height)
20567        }
20568    }
20569
20570    /**
20571     * Apply CSS styles to element.
20572     *
20573     * @param {HTMLElement} element
20574     * @param {Object} style
20575     */
20576    function setStyle(element, style) {
20577        Object.keys(style).forEach(function(key) {
20578            element.style[key] = style[key];
20579        });
20580    }
20581
20582    /**
20583     * Class for dimension change detection.
20584     *
20585     * @param {Element|Element[]|Elements|jQuery} element
20586     * @param {Function} callback
20587     *
20588     * @constructor
20589     */
20590    var ResizeSensor = function(element, callback) {
20591        /**
20592         *
20593         * @constructor
20594         */
20595        function EventQueue() {
20596            var q = [];
20597            this.add = function(ev) {
20598                q.push(ev);
20599            };
20600
20601            var i, j;
20602            this.call = function(sizeInfo) {
20603                for (i = 0, j = q.length; i < j; i++) {
20604                    q[i].call(this, sizeInfo);
20605                }
20606            };
20607
20608            this.remove = function(ev) {
20609                var newQueue = [];
20610                for(i = 0, j = q.length; i < j; i++) {
20611                    if(q[i] !== ev) newQueue.push(q[i]);
20612                }
20613                q = newQueue;
20614            };
20615
20616            this.length = function() {
20617                return q.length;
20618            }
20619        }
20620
20621        /**
20622         *
20623         * @param {HTMLElement} element
20624         * @param {Function}    resized
20625         */
20626        function attachResizeEvent(element, resized) {
20627            if (!element) return;
20628            if (element.resizedAttached) {
20629                element.resizedAttached.add(resized);
20630                return;
20631            }
20632
20633            element.resizedAttached = new EventQueue();
20634            element.resizedAttached.add(resized);
20635
20636            element.resizeSensor = document.createElement('div');
20637            element.resizeSensor.dir = 'ltr';
20638            element.resizeSensor.className = 'resize-sensor';
20639
20640            var style = {
20641                pointerEvents: 'none',
20642                position: 'absolute',
20643                left: '0px',
20644                top: '0px',
20645                right: '0px',
20646                bottom: '0px',
20647                overflow: 'hidden',
20648                zIndex: '-1',
20649                visibility: 'hidden',
20650                maxWidth: '100%'
20651            };
20652            var styleChild = {
20653                position: 'absolute',
20654                left: '0px',
20655                top: '0px',
20656                transition: '0s',
20657            };
20658
20659            setStyle(element.resizeSensor, style);
20660
20661            var expand = document.createElement('div');
20662            expand.className = 'resize-sensor-expand';
20663            setStyle(expand, style);
20664
20665            var expandChild = document.createElement('div');
20666            setStyle(expandChild, styleChild);
20667            expand.appendChild(expandChild);
20668
20669            var shrink = document.createElement('div');
20670            shrink.className = 'resize-sensor-shrink';
20671            setStyle(shrink, style);
20672
20673            var shrinkChild = document.createElement('div');
20674            setStyle(shrinkChild, styleChild);
20675            setStyle(shrinkChild, { width: '200%', height: '200%' });
20676            shrink.appendChild(shrinkChild);
20677
20678            element.resizeSensor.appendChild(expand);
20679            element.resizeSensor.appendChild(shrink);
20680            element.appendChild(element.resizeSensor);
20681
20682            var computedStyle = window.getComputedStyle(element);
20683            var position = computedStyle ? computedStyle.getPropertyValue('position') : null;
20684            if ('absolute' !== position && 'relative' !== position && 'fixed' !== position) {
20685                element.style.position = 'relative';
20686            }
20687
20688            var dirty, rafId;
20689            var size = getElementSize(element);
20690            var lastWidth = 0;
20691            var lastHeight = 0;
20692            var initialHiddenCheck = true;
20693            var lastAnimationFrame = 0;
20694
20695            var resetExpandShrink = function () {
20696                var width = element.offsetWidth;
20697                var height = element.offsetHeight;
20698
20699                expandChild.style.width = (width + 10) + 'px';
20700                expandChild.style.height = (height + 10) + 'px';
20701
20702                expand.scrollLeft = width + 10;
20703                expand.scrollTop = height + 10;
20704
20705                shrink.scrollLeft = width + 10;
20706                shrink.scrollTop = height + 10;
20707            };
20708
20709            var reset = function() {
20710                // Check if element is hidden
20711                if (initialHiddenCheck) {
20712                    var invisible = element.offsetWidth === 0 && element.offsetHeight === 0;
20713                    if (invisible) {
20714                        // Check in next frame
20715                        if (!lastAnimationFrame){
20716                            lastAnimationFrame = requestAnimationFrame(function(){
20717                                lastAnimationFrame = 0;
20718
20719                                reset();
20720                            });
20721                        }
20722
20723                        return;
20724                    } else {
20725                        // Stop checking
20726                        initialHiddenCheck = false;
20727                    }
20728                }
20729
20730                resetExpandShrink();
20731            };
20732            element.resizeSensor.resetSensor = reset;
20733
20734            var onResized = function() {
20735                rafId = 0;
20736
20737                if (!dirty) return;
20738
20739                lastWidth = size.width;
20740                lastHeight = size.height;
20741
20742                if (element.resizedAttached) {
20743                    element.resizedAttached.call(size);
20744                }
20745            };
20746
20747            var onScroll = function() {
20748                size = getElementSize(element);
20749                dirty = size.width !== lastWidth || size.height !== lastHeight;
20750
20751                if (dirty && !rafId) {
20752                    rafId = requestAnimationFrame(onResized);
20753                }
20754
20755                reset();
20756            };
20757
20758            var addEvent = function(el, name, cb) {
20759                if (el.attachEvent) {
20760                    el.attachEvent('on' + name, cb);
20761                } else {
20762                    el.addEventListener(name, cb);
20763                }
20764            };
20765
20766            addEvent(expand, 'scroll', onScroll);
20767            addEvent(shrink, 'scroll', onScroll);
20768
20769            // Fix for custom Elements
20770            requestAnimationFrame(reset);
20771        }
20772
20773        forEachElement(element, function(elem){
20774            attachResizeEvent(elem, callback);
20775        });
20776
20777        this.detach = function(ev) {
20778            ResizeSensor.detach(element, ev);
20779        };
20780
20781        this.reset = function() {
20782            element.resizeSensor.resetSensor();
20783        };
20784    };
20785
20786    ResizeSensor.reset = function(element) {
20787        forEachElement(element, function(elem){
20788            elem.resizeSensor.resetSensor();
20789        });
20790    };
20791
20792    ResizeSensor.detach = function(element, ev) {
20793        forEachElement(element, function(elem){
20794            if (!elem) return;
20795            if(elem.resizedAttached && typeof ev === "function"){
20796                elem.resizedAttached.remove(ev);
20797                if(elem.resizedAttached.length()) return;
20798            }
20799            if (elem.resizeSensor) {
20800                if (elem.contains(elem.resizeSensor)) {
20801                    elem.removeChild(elem.resizeSensor);
20802                }
20803                delete elem.resizeSensor;
20804                delete elem.resizedAttached;
20805            }
20806        });
20807    };
20808
20809    if (typeof MutationObserver !== "undefined") {
20810        var observer = new MutationObserver(function (mutations) {
20811            for (var i in mutations) {
20812                if (mutations.hasOwnProperty(i)) {
20813                    var items = mutations[i].addedNodes;
20814                    for (var j = 0; j < items.length; j++) {
20815                        if (items[j].resizeSensor) {
20816                            ResizeSensor.reset(items[j]);
20817                        }
20818                    }
20819                }
20820            }
20821        });
20822
20823        document.addEventListener("DOMContentLoaded", function (event) {
20824            observer.observe(document.body, {
20825                childList: true,
20826                subtree: true,
20827            });
20828        });
20829    }
20830
20831    return ResizeSensor;
20832
20833}));
20834
20835/* End */
20836;
20837; /* Start:"a:4:{s:4:"full";s:71:"/bitrix/templates/aspro_max/vendor/js/sticky-sidebar.js?171646553725483";s:6:"source";s:55:"/bitrix/templates/aspro_max/vendor/js/sticky-sidebar.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
20838(function (global, factory) {
20839	typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
20840	typeof define === 'function' && define.amd ? define(['exports'], factory) :
20841	(factory((global.StickySidebar = {})));
20842}(this, (function (exports) { 'use strict';
20843
20844var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
20845
20846
20847
20848function unwrapExports (x) {
20849	return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
20850}
20851
20852function createCommonjsModule(fn, module) {
20853	return module = { exports: {} }, fn(module, module.exports), module.exports;
20854}
20855
20856var stickySidebar = createCommonjsModule(function (module, exports) {
20857(function (global, factory) {
20858  if (typeof undefined === "function" && undefined.amd) {
20859    undefined(['exports'], factory);
20860  } else {
20861    factory(exports);
20862  }
20863})(commonjsGlobal, function (exports) {
20864  Object.defineProperty(exports, "__esModule", {
20865    value: true
20866  });
20867
20868  function _classCallCheck(instance, Constructor) {
20869    if (!(instance instanceof Constructor)) {
20870      throw new TypeError("Cannot call a class as a function");
20871    }
20872  }
20873
20874  var _createClass = function () {
20875    function defineProperties(target, props) {
20876      for (var i = 0; i < props.length; i++) {
20877        var descriptor = props[i];
20878        descriptor.enumerable = descriptor.enumerable || false;
20879        descriptor.configurable = true;
20880        if ("value" in descriptor) descriptor.writable = true;
20881        Object.defineProperty(target, descriptor.key, descriptor);
20882      }
20883    }
20884
20885    return function (Constructor, protoProps, staticProps) {
20886      if (protoProps) defineProperties(Constructor.prototype, protoProps);
20887      if (staticProps) defineProperties(Constructor, staticProps);
20888      return Constructor;
20889    };
20890  }();
20891
20892  /**
20893   * Sticky Sidebar JavaScript Plugin.
20894   * @version 3.3.4
20895   * @author Ahmed Bouhuolia <[email protected]>
20896   * @license The MIT License (MIT)
20897   */
20898  var StickySidebar = function () {
20899
20900    // ---------------------------------
vendor: 3,359 bytes, lines 20901-21020
20901    // # Define Constants
20902    // ---------------------------------
20903    //
20904    var EVENT_KEY = '.stickySidebar';
20905    var DEFAULTS = {
20906      /**
20907       * Additional top spacing of the element when it becomes sticky.
20908       * @type {Numeric|Function}
20909       */
20910      topSpacing: 0,
20911
20912      /**
20913       * Additional bottom spacing of the element when it becomes sticky.
20914       * @type {Numeric|Function}
20915       */
20916      bottomSpacing: 0,
20917
20918      /**
20919       * Container sidebar selector to know what the beginning and end of sticky element.
20920       * @type {String|False}
20921       */
20922      containerSelector: false,
20923
20924      /**
20925       * Inner wrapper selector.
20926       * @type {String}
20927       */
20928      innerWrapperSelector: '.inner-wrapper-sticky',
20929
20930      /**
20931       * The name of CSS class to apply to elements when they have become stuck.
20932       * @type {String|False}
20933       */
20934      stickyClass: 'is-affixed',
20935
20936      /**
20937       * Detect when sidebar and its container change height so re-calculate their dimensions.
20938       * @type {Boolean}
20939       */
20940      resizeSensor: true,
20941
20942      /**
20943       * The sidebar returns to its normal position if its width below this value.
20944       * @type {Numeric}
20945       */
20946      minWidth: false
20947    };
20948
20949    // ---------------------------------
20950    // # Class Definition
20951    // ---------------------------------
20952    //
20953    /**
20954     * Sticky Sidebar Class.
20955     * @public
20956     */
20957
20958    var StickySidebar = function () {
20959
20960      /**
20961       * Sticky Sidebar Constructor.
20962       * @constructor
20963       * @param {HTMLElement|String} sidebar - The sidebar element or sidebar selector.
20964       * @param {Object} options - The options of sticky sidebar.
20965       */
20966      function StickySidebar(sidebar) {
20967        var _this = this;
20968
20969        var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
20970
20971        _classCallCheck(this, StickySidebar);
20972
20973        this.options = StickySidebar.extend(DEFAULTS, options);
20974
20975        // Sidebar element query if there's no one, throw error.
20976        this.sidebar = 'string' === typeof sidebar ? document.querySelector(sidebar) : sidebar;
20977        if ('undefined' === typeof this.sidebar) throw new Error("There is no specific sidebar element.");
20978
20979        this.sidebarInner = false;
20980        this.container = this.sidebar.parentElement;
20981
20982        // Current Affix Type of sidebar element.
20983        this.affixedType = 'STATIC';
20984        this.direction = 'down';
20985        this.support = {
20986          transform: false,
20987          transform3d: false
20988        };
20989
20990        this._initialized = false;
20991        this._reStyle = false;
20992        this._breakpoint = false;
20993
20994        // Dimensions of sidebar, container and screen viewport.
20995        this.dimensions = {
20996          translateY: 0,
20997          maxTranslateY: 0,
20998          topSpacing: 0,
20999          lastTopSpacing: 0,
21000          bottomSpacing: 0,
21001          lastBottomSpacing: 0,
21002          sidebarHeight: 0,
21003          sidebarWidth: 0,
21004          containerTop: 0,
21005          containerHeight: 0,
21006          viewportHeight: 0,
21007          viewportTop: 0,
21008          lastViewportTop: 0
21009        };
21010
21011        // Bind event handlers for referencability.
21012        ['handleEvent'].forEach(function (method) {
21013          _this[method] = _this[method].bind(_this);
21014        });
21015
21016        // Initialize sticky sidebar for first time.
21017        this.initialize();
21018      }
21019
21020      /**
21021       * Initializes the sticky sidebar by adding inner wrapper, define its container, 
21022       * min-width breakpoint, calculating dimensions, adding helper classes and inline style.
21023       * @private
21024       */
21025
21026
21027      _createClass(StickySidebar, [{
21028        key: 'initialize',
21029        value: function initialize() {
21030          var _this2 = this;
21031
21032          this._setSupportFeatures();
21033
21034          // Get sticky sidebar inner wrapper, if not found, will create one.
21035          if (this.options.innerWrapperSelector) {
21036            this.sidebarInner = this.sidebar.querySelector(this.options.innerWrapperSelector);
21037
21038            if (null === this.sidebarInner) this.sidebarInner = false;
21039          }
21040
21041          if (!this.sidebarInner) {
21042            var wrapper = document.createElement('div');
21043            wrapper.setAttribute('class', 'inner-wrapper-sticky');
21044            this.sidebar.appendChild(wrapper);
21045
21046            while (this.sidebar.firstChild != wrapper) {
21047              wrapper.appendChild(this.sidebar.firstChild);
21048            }this.sidebarInner = this.sidebar.querySelector('.inner-wrapper-sticky');
21049          }
21050
21051          // Container wrapper of the sidebar.
21052          if (this.options.containerSelector) {
21053            var containers = document.querySelectorAll(this.options.containerSelector);
21054            containers = Array.prototype.slice.call(containers);
21055
21056            containers.forEach(function (container, item) {
21057              if (!container.contains(_this2.sidebar)) return;
21058              _this2.container = container;
21059            });
21060
21061            if (!containers.length) throw new Error("The container does not contains on the sidebar.");
21062          }
21063
21064          // If top/bottom spacing is not function parse value to integer.
21065          if ('function' !== typeof this.options.topSpacing) this.options.topSpacing = parseInt(this.options.topSpacing) || 0;
21066
21067          if ('function' !== typeof this.options.bottomSpacing) this.options.bottomSpacing = parseInt(this.options.bottomSpacing) || 0;
21068
21069          // Breakdown sticky sidebar if screen width below `options.minWidth`.
21070          this._widthBreakpoint();
21071
21072          // Calculate dimensions of sidebar, container and viewport.
21073          this.calcDimensions();
21074
21075          // Affix sidebar in proper position.
21076          this.stickyPosition();
21077
21078          // Bind all events.
21079          this.bindEvents();
21080
vendor: 4,110 bytes, lines 21081-21178
21081          // Inform other properties the sticky sidebar is initialized.
21082          this._initialized = true;
21083        }
21084      }, {
21085        key: 'bindEvents',
21086        value: function bindEvents() {
21087          window.addEventListener('resize', this, { passive: true, capture: false });
21088          window.addEventListener('scroll', this, { passive: true, capture: false });
21089
21090          this.sidebar.addEventListener('update' + EVENT_KEY, this);
21091
21092          if (this.options.resizeSensor && 'undefined' !== typeof ResizeSensor) {
21093            new ResizeSensor(this.sidebarInner, this.handleEvent);
21094            new ResizeSensor(this.container, this.handleEvent);
21095          }
21096        }
21097      }, {
21098        key: 'handleEvent',
21099        value: function handleEvent(event) {
21100          this.updateSticky(event);
21101        }
21102      }, {
21103        key: 'calcDimensions',
21104        value: function calcDimensions() {
21105          if (this._breakpoint) return;
21106          var dims = this.dimensions;
21107
21108          // Container of sticky sidebar dimensions.
21109          dims.containerTop = StickySidebar.offsetRelative(this.container).top;
21110          dims.containerHeight = this.container.clientHeight;
21111          dims.containerBottom = dims.containerTop + dims.containerHeight;
21112
21113          // Sidebar dimensions.
21114          dims.sidebarHeight = this.sidebarInner.offsetHeight;
21115          dims.sidebarWidth = this.sidebarInner.offsetWidth;
21116
21117          // Screen viewport dimensions.
21118          dims.viewportHeight = window.innerHeight;
21119
21120          // Maximum sidebar translate Y.
21121          dims.maxTranslateY = dims.containerHeight - dims.sidebarHeight;
21122
21123          this._calcDimensionsWithScroll();
21124        }
21125      }, {
21126        key: '_calcDimensionsWithScroll',
21127        value: function _calcDimensionsWithScroll() {
21128          var dims = this.dimensions;
21129
21130          dims.sidebarLeft = StickySidebar.offsetRelative(this.sidebar).left;
21131
21132          dims.viewportTop = document.documentElement.scrollTop || document.body.scrollTop;
21133          dims.viewportBottom = dims.viewportTop + dims.viewportHeight;
21134          dims.viewportLeft = document.documentElement.scrollLeft || document.body.scrollLeft;
21135
21136          dims.topSpacing = this.options.topSpacing;
21137          dims.bottomSpacing = this.options.bottomSpacing;
21138
21139          if ('function' === typeof dims.topSpacing) dims.topSpacing = parseInt(dims.topSpacing(this.sidebar)) || 0;
21140
21141          if ('function' === typeof dims.bottomSpacing) dims.bottomSpacing = parseInt(dims.bottomSpacing(this.sidebar)) || 0;
21142
21143          if ('VIEWPORT-TOP' === this.affixedType) {
21144            // Adjust translate Y in the case decrease top spacing value.
21145            if (dims.topSpacing < dims.lastTopSpacing) {
21146              dims.translateY += dims.lastTopSpacing - dims.topSpacing;
21147              this._reStyle = true;
21148            }
21149          } else if ('VIEWPORT-BOTTOM' === this.affixedType) {
21150            // Adjust translate Y in the case decrease bottom spacing value.
21151            if (dims.bottomSpacing < dims.lastBottomSpacing) {
21152              dims.translateY += dims.lastBottomSpacing - dims.bottomSpacing;
21153              this._reStyle = true;
21154            }
21155          }
21156
21157          dims.lastTopSpacing = dims.topSpacing;
21158          dims.lastBottomSpacing = dims.bottomSpacing;
21159        }
21160      }, {
21161        key: 'isSidebarFitsViewport',
21162        value: function isSidebarFitsViewport() {
21163          var dims = this.dimensions;
21164          var offset = this.scrollDirection === 'down' ? dims.lastBottomSpacing : dims.lastTopSpacing;
21165          return this.dimensions.sidebarHeight + offset < this.dimensions.viewportHeight;
21166        }
21167      }, {
21168        key: 'observeScrollDir',
21169        value: function observeScrollDir() {
21170          var dims = this.dimensions;
21171          if (dims.lastViewportTop === dims.viewportTop) return;
21172
21173          var furthest = 'down' === this.direction ? Math.min : Math.max;
21174
21175          // If the browser is scrolling not in the same direction.
21176          if (dims.viewportTop === furthest(dims.viewportTop, dims.lastViewportTop)) this.direction = 'down' === this.direction ? 'up' : 'down';
21177        }
21178      }, {
vendor: 5,308 bytes, lines 21179-21307
21179        key: 'getAffixType',
21180        value: function getAffixType() {
21181          this._calcDimensionsWithScroll();
21182          var dims = this.dimensions;
21183          var colliderTop = dims.viewportTop + dims.topSpacing;
21184          var affixType = this.affixedType;
21185
21186
21187
21188          if (colliderTop <= dims.containerTop || dims.containerHeight < dims.sidebarHeight) {
21189            dims.translateY = 0;
21190            affixType = 'STATIC';
21191          } else {
21192            affixType = 'up' === this.direction ? this._getAffixTypeScrollingUp() : this._getAffixTypeScrollingDown();
21193          }
21194
21195          // Make sure the translate Y is not bigger than container height.
21196          dims.translateY = Math.max(0, dims.translateY);
21197          dims.translateY = Math.min(dims.containerHeight, dims.translateY);
21198          dims.translateY = Math.round(dims.translateY);
21199
21200          dims.lastViewportTop = dims.viewportTop;
21201          return affixType;
21202        }
21203      }, {
21204        key: '_getAffixTypeScrollingDown',
21205        value: function _getAffixTypeScrollingDown() {
21206          var dims = this.dimensions;
21207          var sidebarBottom = dims.sidebarHeight + dims.containerTop;
21208          var colliderTop = dims.viewportTop + dims.topSpacing;
21209          var colliderBottom = dims.viewportBottom - dims.bottomSpacing;
21210          var affixType = this.affixedType;
21211
21212          if (this.isSidebarFitsViewport()) {
21213            if (dims.sidebarHeight + colliderTop >= dims.containerBottom) {
21214              dims.translateY = dims.containerBottom - sidebarBottom;
21215              affixType = 'CONTAINER-BOTTOM';
21216            } else if (colliderTop >= dims.containerTop) {
21217              dims.translateY = colliderTop - dims.containerTop;
21218              affixType = 'VIEWPORT-TOP';
21219            }
21220          } else {
21221            if (dims.containerBottom <= colliderBottom) {
21222              dims.translateY = dims.containerBottom - sidebarBottom;
21223              affixType = 'CONTAINER-BOTTOM';
21224            } else if (sidebarBottom + dims.translateY <= colliderBottom) {
21225              dims.translateY = colliderBottom - sidebarBottom;
21226              affixType = 'VIEWPORT-BOTTOM';
21227            } else if (dims.containerTop + dims.translateY <= colliderTop && 0 !== dims.translateY && dims.maxTranslateY !== dims.translateY) {
21228              affixType = 'VIEWPORT-UNBOTTOM';
21229            }
21230          }
21231
21232          return affixType;
21233        }
21234      }, {
21235        key: '_getAffixTypeScrollingUp',
21236        value: function _getAffixTypeScrollingUp() {
21237          var dims = this.dimensions;
21238          var sidebarBottom = dims.sidebarHeight + dims.containerTop;
21239          var colliderTop = dims.viewportTop + dims.topSpacing;
21240          var colliderBottom = dims.viewportBottom - dims.bottomSpacing;
21241          var affixType = this.affixedType;
21242
21243          if (colliderTop <= dims.translateY + dims.containerTop) {
21244            dims.translateY = colliderTop - dims.containerTop;
21245            affixType = 'VIEWPORT-TOP';
21246          } else if (dims.containerBottom <= colliderBottom) {
21247            dims.translateY = dims.containerBottom - sidebarBottom;
21248            affixType = 'CONTAINER-BOTTOM';
21249          } else if (!this.isSidebarFitsViewport()) {
21250
21251            if (dims.containerTop <= colliderTop && 0 !== dims.translateY && dims.maxTranslateY !== dims.translateY) {
21252              affixType = 'VIEWPORT-UNBOTTOM';
21253            }
21254          }
21255
21256          return affixType;
21257        }
21258      }, {
21259        key: '_getStyle',
21260        value: function _getStyle(affixType) {
21261          if ('undefined' === typeof affixType) return;
21262
21263          var style = { inner: {}, outer: {} };
21264          var dims = this.dimensions;
21265
21266          switch (affixType) {
21267            case 'VIEWPORT-TOP':
21268              style.inner = { position: 'fixed', top: dims.topSpacing,
21269                left: dims.sidebarLeft - dims.viewportLeft, width: dims.sidebarWidth };
21270              break;
21271            case 'VIEWPORT-BOTTOM':
21272              style.inner = { position: 'fixed', top: 'auto', left: dims.sidebarLeft,
21273                bottom: dims.bottomSpacing, width: dims.sidebarWidth };
21274              break;
21275            case 'CONTAINER-BOTTOM':
21276            case 'VIEWPORT-UNBOTTOM':
21277              var translate = this._getTranslate(0, dims.translateY + 'px');
21278
21279              if (translate) style.inner = { transform: translate };else style.inner = { position: 'absolute', top: dims.translateY, width: dims.sidebarWidth };
21280              break;
21281          }
21282
21283          switch (affixType) {
21284            case 'VIEWPORT-TOP':
21285            case 'VIEWPORT-BOTTOM':
21286            case 'VIEWPORT-UNBOTTOM':
21287            case 'CONTAINER-BOTTOM':
21288              style.outer = { height: dims.sidebarHeight, position: 'relative' };
21289              break;
21290          }
21291
21292          style.outer = StickySidebar.extend({ height: '', position: '' }, style.outer);
21293          style.inner = StickySidebar.extend({ position: 'relative', top: '', left: '',
21294            bottom: '', width: '', transform: '' }, style.inner);
21295
21296          return style;
21297        }
21298      }, {
21299        key: 'stickyPosition',
21300        value: function stickyPosition(force) {
21301          if (this._breakpoint) return;
21302
21303          force = this._reStyle || force || false;
21304
21305          var offsetTop = this.options.topSpacing;
21306          var offsetBottom = this.options.bottomSpacing;
21307
vendor: 5,484 bytes, lines 21308-21439
21308          var affixType = this.getAffixType();
21309          var style = this._getStyle(affixType);
21310
21311          if ((this.affixedType != affixType || force) && affixType) {
21312            var affixEvent = 'affix.' + affixType.toLowerCase().replace('viewport-', '') + EVENT_KEY;
21313            StickySidebar.eventTrigger(this.sidebar, affixEvent);
21314
21315            if ('STATIC' === affixType) StickySidebar.removeClass(this.sidebar, this.options.stickyClass);else StickySidebar.addClass(this.sidebar, this.options.stickyClass);
21316
21317            for (var key in style.outer) {
21318              var unit = 'number' === typeof style.outer[key] ? 'px' : '';
21319              this.sidebar.style[key] = style.outer[key] + unit;
21320            }
21321
21322            for (var _key in style.inner) {
21323              var _unit = 'number' === typeof style.inner[_key] ? 'px' : '';
21324              this.sidebarInner.style[_key] = style.inner[_key] + _unit;
21325            }
21326
21327            var affixedEvent = 'affixed.' + affixType.toLowerCase().replace('viewport-', '') + EVENT_KEY;
21328            StickySidebar.eventTrigger(this.sidebar, affixedEvent);
21329          } else {
21330            if (this._initialized) this.sidebarInner.style.left = style.inner.left;
21331          }
21332
21333          this.affixedType = affixType;
21334        }
21335      }, {
21336        key: '_widthBreakpoint',
21337        value: function _widthBreakpoint() {
21338
21339          if (window.innerWidth <= this.options.minWidth) {
21340            this._breakpoint = true;
21341            this.affixedType = 'STATIC';
21342
21343            this.sidebar.removeAttribute('style');
21344            StickySidebar.removeClass(this.sidebar, this.options.stickyClass);
21345            this.sidebarInner.removeAttribute('style');
21346          } else {
21347            this._breakpoint = false;
21348          }
21349        }
21350      }, {
21351        key: 'updateSticky',
21352        value: function updateSticky() {
21353          var _this3 = this;
21354
21355          var event = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
21356
21357          if (this._running) return;
21358          this._running = true;
21359
21360          (function (eventType) {
21361            requestAnimationFrame(function () {
21362              switch (eventType) {
21363                // When browser is scrolling and re-calculate just dimensions
21364                // within scroll. 
21365                case 'scroll':
21366                  _this3._calcDimensionsWithScroll();
21367                  _this3.observeScrollDir();
21368                  _this3.stickyPosition();
21369                  break;
21370
21371                // When browser is resizing or there's no event, observe width
21372                // breakpoint and re-calculate dimensions.
21373                case 'resize':
21374                default:
21375                  _this3._widthBreakpoint();
21376                  _this3.calcDimensions();
21377                  _this3.stickyPosition(true);
21378                  break;
21379              }
21380              _this3._running = false;
21381            });
21382          })(event.type);
21383        }
21384      }, {
21385        key: '_setSupportFeatures',
21386        value: function _setSupportFeatures() {
21387          var support = this.support;
21388
21389          support.transform = StickySidebar.supportTransform();
21390          support.transform3d = StickySidebar.supportTransform(true);
21391        }
21392      }, {
21393        key: '_getTranslate',
21394        value: function _getTranslate() {
21395          var y = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
21396          var x = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
21397          var z = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
21398
21399          if (this.support.transform3d) return 'translate3d(' + y + ', ' + x + ', ' + z + ')';else if (this.support.translate) return 'translate(' + y + ', ' + x + ')';else return false;
21400        }
21401      }, {
21402        key: 'destroy',
21403        value: function destroy() {
21404          window.removeEventListener('resize', this, { capture: false });
21405          window.removeEventListener('scroll', this, { capture: false });
21406
21407          this.sidebar.classList.remove(this.options.stickyClass);
21408          this.sidebar.style.minHeight = '';
21409
21410          this.sidebar.removeEventListener('update' + EVENT_KEY, this);
21411
21412          var styleReset = { inner: {}, outer: {} };
21413
21414          styleReset.inner = { position: '', top: '', left: '', bottom: '', width: '', transform: '' };
21415          styleReset.outer = { height: '', position: '' };
21416
21417          for (var key in styleReset.outer) {
21418            this.sidebar.style[key] = styleReset.outer[key];
21419          }for (var _key2 in styleReset.inner) {
21420            this.sidebarInner.style[_key2] = styleReset.inner[_key2];
21421          }if (this.options.resizeSensor && 'undefined' !== typeof ResizeSensor) {
21422            ResizeSensor.detach(this.sidebarInner, this.handleEvent);
21423            ResizeSensor.detach(this.container, this.handleEvent);
21424          }
21425        }
21426      }], [{
21427        key: 'supportTransform',
21428        value: function supportTransform(transform3d) {
21429          var result = false,
21430              property = transform3d ? 'perspective' : 'transform',
21431              upper = property.charAt(0).toUpperCase() + property.slice(1),
21432              prefixes = ['Webkit', 'Moz', 'O', 'ms'],
21433              support = document.createElement('support'),
21434              style = support.style;
21435
21436          (property + ' ' + prefixes.join(upper + ' ') + upper).split(' ').forEach(function (property, i) {
21437            if (style[property] !== undefined) {
21438              result = property;
21439              return false;
21440            }
21441          });
21442          return result;
21443        }
21444      }, {
21445        key: 'eventTrigger',
21446        value: function eventTrigger(element, eventName, data) {
21447          try {
21448            var event = new CustomEvent(eventName, { detail: data });
21449          } catch (e) {
21450            var event = document.createEvent('CustomEvent');
21451            event.initCustomEvent(eventName, true, true, data);
21452          }
21453          element.dispatchEvent(event);
21454        }
21455      }, {
21456        key: 'extend',
21457        value: function extend(defaults, options) {
21458          var results = {};
21459          for (var key in defaults) {
21460            if ('undefined' !== typeof options[key]) results[key] = options[key];else results[key] = defaults[key];
21461          }
21462          return results;
21463        }
21464      }, {
21465        key: 'offsetRelative',
21466        value: function offsetRelative(element) {
21467          var result = { left: 0, top: 0 };
21468
21469          do {
21470            var offsetTop = element.offsetTop;
21471            var offsetLeft = element.offsetLeft;
21472
21473            if (!isNaN(offsetTop)) result.top += offsetTop;
21474
21475            if (!isNaN(offsetLeft)) result.left += offsetLeft;
21476
21477            element = 'BODY' === element.tagName ? element.parentElement : element.offsetParent;
21478          } while (element);
21479          return result;
21480        }
21481      }, {
21482        key: 'addClass',
21483        value: function addClass(element, className) {
21484          if (!StickySidebar.hasClass(element, className)) {
21485            if (element.classList) element.classList.add(className);else element.className += ' ' + className;
21486          }
21487        }
21488      }, {
21489        key: 'removeClass',
21490        value: function removeClass(element, className) {
21491          if (StickySidebar.hasClass(element, className)) {
21492            if (element.classList) element.classList.remove(className);else element.className = element.className.replace(new RegExp('(^|\\b)' + className.split(' ').join('|') + '(\\b|$)', 'gi'), ' ');
21493          }
21494        }
21495      }, {
21496        key: 'hasClass',
21497        value: function hasClass(element, className) {
21498          if (element.classList) return element.classList.contains(className);else return new RegExp('(^| )' + className + '( |$)', 'gi').test(element.className);
21499        }
21500      }, {
21501        key: 'defaults',
21502        get: function () {
21503          return DEFAULTS;
21504        }
21505      }]);
21506
21507      return StickySidebar;
21508    }();
21509
21510    return StickySidebar;
21511  }();
21512
21513  exports.default = StickySidebar;
21514
21515
21516  // Global
21517  // -------------------------
21518  window.StickySidebar = StickySidebar;
21519});
21520});
21521
21522var stickySidebar$1 = unwrapExports(stickySidebar);
21523
21524exports['default'] = stickySidebar$1;
21525exports.__moduleExports = stickySidebar;
21526
21527Object.defineProperty(exports, '__esModule', { value: true });
21528
21529})));
21530/* End */
21531;
21532; /* Start:"a:4:{s:4:"full";s:69:"/bitrix/templates/aspro_max/js/jquery.validate.min.js?171646553722257";s:6:"source";s:53:"/bitrix/templates/aspro_max/js/jquery.validate.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
21533/*! jQuery Validation Plugin - v1.13.1 - 10/14/2014
21534 * http://jqueryvalidation.org/
21535 * Copyright (c) 2014 Jörn Zaefferer; Licensed MIT */
21536!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a(jQuery)}(function(a){a.extend(a.fn,{validate:function(b){if(!this.length)return void(b&&b.debug&&window.console&&console.warn("Nothing selected, can't validate, returning nothing."));var c=a.data(this[0],"validator");return c?c:(this.attr("novalidate","novalidate"),c=new a.validator(b,this[0]),a.data(this[0],"validator",c),c.settings.onsubmit&&(this.validateDelegate(":submit","click",function(b){c.settings.submitHandler&&(c.submitButton=b.target),a(b.target).hasClass("cancel")&&(c.cancelSubmit=!0),void 0!==a(b.target).attr("formnovalidate")&&(c.cancelSubmit=!0)}),this.submit(function(b){function d(){var d,e;return c.settings.submitHandler?(c.submitButton&&(d=a("<input type='hidden'/>").attr("name",c.submitButton.name).val(a(c.submitButton).val()).appendTo(c.currentForm)),e=c.settings.submitHandler.call(c,c.currentForm,b),c.submitButton&&d.remove(),void 0!==e?e:!1):!0}return c.settings.debug&&b.preventDefault(),c.cancelSubmit?(c.cancelSubmit=!1,d()):c.form()?c.pendingRequest?(c.formSubmitted=!0,!1):d():(c.focusInvalid(),!1)})),c)},valid:function(){var b,c;return a(this[0]).is("form")?b=this.validate().form():(b=!0,c=a(this[0].form).validate(),this.each(function(){b=c.element
21536(this)&&b})),b},removeAttrs:function(b){var c={},d=this;return a.each(b.split(/\s/),function(a,b){c[b]=d.attr(b),d.removeAttr(b)}),c},rules:function(b,c){var d,e,f,g,h,i,j=this[0];if(b)switch(d=a.data(j.form,"validator").settings,e=d.rules,f=a.validator.staticRules(j),b){case"add":a.extend(f,a.validator.normalizeRule(c)),delete f.messages,e[j.name]=f,c.messages&&(d.messages[j.name]=a.extend(d.messages[j.name],c.messages));break;case"remove":return c?(i={},a.each(c.split(/\s/),function(b,c){i[c]=f[c],delete f[c],"required"===c&&a(j).removeAttr("aria-required")}),i):(delete e[j.name],f)}return g=a.validator.normalizeRules(a.extend({},a.validator.classRules(j),a.validator.attributeRules(j),a.validator.dataRules(j),a.validator.staticRules(j)),j),g.required&&(h=g.required,delete g.required,g=a.extend({required:h},g),a(j).attr("aria-required","true")),g.remote&&(h=g.remote,delete g.remote,g=a.extend(g,{remote:h})),g}}),a.extend(a.expr[":"],{blank:function(b){return!a.trim(""+a(b).val())},filled:function(b){return!!a.trim(""+a(b).val())},unchecked:function(b){return!a(b).prop("checked")}}),a.validator=function(b,c){this.settings=a.extend(!0,{},a.validator.defaults,b),this.currentForm=c,this.init()},a.validator.format=function(b,c){return 1===arguments.length?function(){var c=a.makeArray(arguments);return c.unshift(b),a.validator.format.apply(this,c)}:(arguments.length>2&&c.constructor!==Array&&(c=a.makeArray(arguments).slice(1)),c.constructor!==Array&&(c=[c]),a.each(c,function(a,c){b=b.replace(new RegExp("\\{"+a+"\\}","g"),function(){return c})}),b)},a.extend(a.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",validClass:"valid",errorElement:"label",focusCleanup:!1,focusInvalid:!0,errorContainer:a([]),errorLabelContainer:a([]),onsubmit:!0,ignore:":hidden",ignoreTitle:!1,onfocusin:function(a){this.lastActive=a,this.settings.focusCleanup&&(this.settings.unhighlight&&this.settings.unhighlight.call(this,a,this.settings.errorClass,this.settings.validClass),this.hideThese(this.errorsFor(a)))},onfocusout:function(a){this.checkable(a)||!(a.name in this.submitted)&&this.optional(a)||this.element(a)},onkeyup:function(a,b){(9!==b.which||""!==this.elementValue(a))&&(a.name in this.submitted||a===this.lastElement)&&this.element(a)},onclick:function(a){a.name in this.submitted?this.element(a):a.parentNode.name in this.submitted&&this.element(a.parentNode)},highlight:function(b,c,d){"radio"===b.type?this.findByName(b.name).addClass(c).removeClass(d):a(b).addClass(c).removeClass(d)},unhighlight:function(b,c,d){"radio"===b.type?this.findByName(b.name).removeClass(c).addClass(d):a(b).removeClass(c).addClass(d)}},setDefaults:function(b){a.extend(a.validator.defaults,b)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date ( ISO ).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",maxlength:a.validator.format("Please enter no more than {0} characters."),minlength:a.validator.format("Please enter at least {0} characters."),rangelength:a.validator.format("Please enter a value between {0} and {1} characters long."),range:a.validator.format("Please enter a value between {0} and {1}."),max:a.validator.format("Please enter a value less than or equal to {0}."),min:a.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:!1,prototype:{init:function(){function b(b){var c=a.data(this[0].form,"validator"),d="on"+b.type.replace(/^validate/,""),e=c.settings;e[d]&&!this.is(e.ignore)&&e[d].call(c,this[0],b)}this.labelContainer=a(this.settings.errorLabelContainer),this.errorContext=this.labelContainer.length&&this.labelContainer||a(this.currentForm),this.containers=a(this.settings.errorContainer).add(this.settings.errorLabelContainer),this.submitted={},this.valueCache={},this.pendingRequest=0,this.pending={},this.invalid={},this.reset();var c,d=this.groups={};a.each(this.settings.groups,function(b,c){"string"==typeof c&&(c=c.split(/\s/)),a.each(c,function(a,c){d[c]=b})}),c=this.settings.rules,a.each(c,function(b,d){c[b]=a.validator.normalizeRule(d)}),a(this.currentForm).validateDelegate(":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'] ,[type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], [type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'], [type='radio'], [type='checkbox']","focusin focusout keyup",b).validateDelegate("select, option, [type='radio'], [type='checkbox']","click",b),this.settings.invalidHandler&&a(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler),a(this.currentForm).find("[required], [data-rule-required], .required").attr("aria-required","true")},form:function(){return this.checkForm(),a.extend(this.submitted,this.errorMap),this.invalid=a.extend({},this.errorMap),this.valid()||a(this.currentForm).triggerHandler("invalid-form",[this]),this.showErrors(),this.valid()},checkForm:function(){this.prepareForm();for(var a=0,b=this.currentElements=this.elements();b[a];a++)this.check(b[a]);return this.valid()},element:function(b){var c=this.clean(b),d=this.validationTargetFor(c),e=!0;return this.lastElement=d,void 0===d?delete this.invalid[c.name]:(this.prepareElement(d),this.currentElements=a(d),e=this.check(d)!==!1,e?delete this.invalid[d.name]:this.invalid[d.name]=!0),a(b).attr("aria-invalid",!e),this.numberOfInvalids()||(this.toHide=this.toHide.add(this.containers
21536)),this.showErrors(),e},showErrors:function(b){if(b){a.extend(this.errorMap,b),this.errorList=[];for(var c in b)this.errorList.push({message:b[c],element:this.findByName(c)[0]});this.successList=a.grep(this.successList,function(a){return!(a.name in b)})}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){a.fn.resetForm&&a(this.currentForm).resetForm(),this.submitted={},this.lastElement=null,this.prepareForm(),this.hideErrors(),this.elements().removeClass(this.settings.errorClass).removeData("previousValue").removeAttr("aria-invalid")},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(a){var b,c=0;for(b in a)c++;return c},hideErrors:function(){this.hideThese(this.toHide)},hideThese:function(a){a.not(this.containers).text(""),this.addWrapper(a).hide()},valid:function(){return 0===this.size()},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid)try{a(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin")}catch(b){}},findLastActive:function(){var b=this.lastActive;return b&&1===a.grep(this.errorList,function(a){return a.element.name===b.name}).length&&b},elements:function(){var b=this,c={};return a(this.currentForm).find("input, select, textarea").not(":submit, :reset, :image, [disabled], [readonly]").not(this.settings.ignore).filter(function(){return!this.name&&b.settings.debug&&window.console&&console.error("%o has no name assigned",this),this.name in c||!b.objectLength(a(this).rules())?!1:(c[this.name]=!0,!0)})},clean:function(b){return a(b)[0]},errors:function(){var b=this.settings.errorClass.split(" ").join(".");return a(this.settings.errorElement+"."+b,this.errorContext)},reset:function(){this.successList=[],this.errorList=[],this.errorMap={},this.toShow=a([]),this.toHide=a([]),this.currentElements=a([])},prepareForm:function(){this.reset(),this.toHide=this.errors().add(this.containers)},prepareElement:function(a){this.reset(),this.toHide=this.errorsFor(a)},elementValue:function(b){var c,d=a(b),e=b.type;return"radio"===e||"checkbox"===e?a("input[name='"+b.name+"']:checked").val():"number"===e&&"undefined"!=typeof b.validity?b.validity.badInput?!1:d.val():(c=d.val(),"string"==typeof c?c.replace(/\r/g,""):c)},check:function(b){b=this.validationTargetFor(this.clean(b));var c,d,e,f=a(b).rules(),g=a.map(f,function(a,b){return b}).length,h=!1,i=this.elementValue(b);for(d in f){e={method:d,parameters:f[d]};try{if(c=a.validator.methods[d].call(this,i,b,e.parameters),"dependency-mismatch"===c&&1===g){h=!0;continue}if(h=!1,"pending"===c)return void(this.toHide=this.toHide.not(this.errorsFor(b)));if(!c)return this.formatAndAdd(b,e),!1}catch(j){throw this.settings.debug&&window.console&&console.log("Exception occurred when checking element "+b.id+", check the '"+e.method+"' method.",j),j}}if(!h)return this.objectLength(f)&&this.successList.push(b),!0},customDataMessage:function(b,c){return a(b).data("msg"+c.charAt(0).toUpperCase()+c.substring(1).toLowerCase())||a(b).data("msg")},customMessage:function(a,b){var c=this.settings.messages[a];return c&&(c.constructor===String?c:c[b])},findDefined:function(){for(var a=0;a<arguments.length;a++)if(void 0!==arguments[a])return arguments[a];return void 0},defaultMessage:function(b,c){return this.findDefined(this.customMessage(b.name,c),this.customDataMessage(b,c),!this.settings.ignoreTitle&&b.title||void 0,a.validator.messages[c],"<strong>Warning: No message defined for "+b.name+"</strong>")},formatAndAdd:function(b,c){var d=this.defaultMessage(b,c.method),e=/\$?\{(\d+)\}/g;"function"==typeof d?d=d.call(this,c.parameters,b):e.test(d)&&(d=a.validator.format(d.replace(e,"{$1}"),c.parameters)),this.errorList.push({message:d,element:b,method:c.method}),this.errorMap[b.name]=d,this.submitted[b.name]=d},addWrapper:function(a){return this.settings.wrapper&&(a=a.add(a.parent(this.settings.wrapper))),a},defaultShowErrors:function(){var a,b,c;for(a=0;this.errorList[a];a++)c=this.errorList[a],this.settings.highlight&&this.settings.highlight.call(this,c.element,this.settings.errorClass,this.settings.val
21536idClass),this.showLabel(c.element,c.message);if(this.errorList.length&&(this.toShow=this.toShow.add(this.containers)),this.settings.success)for(a=0;this.successList[a];a++)this.showLabel(this.successList[a]);if(this.settings.unhighlight)for(a=0,b=this.validElements();b[a];a++)this.settings.unhighlight.call(this,b[a],this.settings.errorClass,this.settings.validClass);this.toHide=this.toHide.not(this.toShow),this.hideErrors(),this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return a(this.errorList).map(function(){return this.element})},showLabel:function(b,c){var d,e,f,g=this.errorsFor(b),h=this.idOrName(b),i=a(b).attr("aria-describedby");g.length?(g.removeClass(this.settings.validClass).addClass(this.settings.errorClass),g.html(c)):(g=a("<"+this.settings.errorElement+">").attr("id",h+"-error").addClass(this.settings.errorClass).html(c||""),d=g,this.settings.wrapper&&(d=g.hide().show().wrap("<"+this.settings.wrapper+"/>").parent()),this.labelContainer.length?this.labelContainer.append(d):this.settings.errorPlacement?this.settings.errorPlacement(d,a(b)):d.insertAfter(b),g.is("label")?g.attr("for",h):0===g.parents("label[for='"+h+"']").length&&(f=g.attr("id").replace(/(:|\.|\[|\])/g,"\\$1"),i?i.match(new RegExp("\\b"+f+"\\b"))||(i+=" "+f):i=f,a(b).attr("aria-describedby",i),e=this.groups[b.n
21536ame],e&&a.each(this.groups,function(b,c){c===e&&a("[name='"+b+"']",this.currentForm).attr("aria-describedby",g.attr("id"))}))),!c&&this.settings.success&&(g.text(""),"string"==typeof this.settings.success?g.addClass(this.settings.success):this.settings.success(g,b)),this.toShow=this.toShow.add(g)},errorsFor:function(b){var c=this.idOrName(b),d=a(b).attr("aria-describedby"),e="label[for='"+c+"'], label[for='"+c+"'] *";return d&&(e=e+", #"+d.replace(/\s+/g,", #")),this.errors().filter(e)},idOrName:function(a){return this.groups[a.name]||(this.checkable(a)?a.name:a.id||a.name)},validationTargetFor:function(b){return this.checkable(b)&&(b=this.findByName(b.name)),a(b).not(this.settings.ignore)[0]},checkable:function(a){return/radio|checkbox/i.test(a.type)},findByName:function(b){return a(this.currentForm).find("[name='"+b+"']")},getLength:function(b,c){switch(c.nodeName.toLowerCase()){case"select":return a("option:selected",c).length;case"input":if(this.checkable(c))return this.findByName(c.name).filter(":checked").length}return b.length},depend:function(a,b){return this.dependTypes[typeof a]?this.dependTypes[typeof a](a,b):!0},dependTypes:{"boolean":function(a){return a},string:function(b,c){return!!a(b,c.form).length},"function":function(a,b){return a(b)}},optional:function(b){var c=this.elementValue(b);
21536return!a.validator.methods.required.call(this,c,b)&&"dependency-mismatch"},startRequest:function(a){this.pending[a.name]||(this.pendingRequest++,this.pending[a.name]=!0)},stopRequest:function(b,c){this.pendingRequest--,this.pendingRequest<0&&(this.pendingRequest=0),delete this.pending[b.name],c&&0===this.pendingRequest&&this.formSubmitted&&this.form()?(a(this.currentForm).submit(),this.formSubmitted=!1):!c&&0===this.pendingRequest&&this.formSubmitted&&(a(this.currentForm).triggerHandler("invalid-form",[this]),this.formSubmitted=!1)},previousValue:function(b){return a.data(b,"previousValue")||a.data(b,"previousValue",{old:null,valid:!0,message:this.defaultMessage(b,"remote")})}},classRuleSettings:{required:{required:!0},email:{email:!0},url:{url:!0},date:{date:!0},dateISO:{dateISO:!0},number:{number:!0},digits:{digits:!0},creditcard:{creditcard:!0}},addClassRules:function(b,c){b.constructor===String?this.classRuleSettings[b]=c:a.extend(this.classRuleSettings,b)},classRules:function(b){var c={},d=a(b).attr("class");return d&&a.each(d.split(" "),function(){this in a.validator.classRuleSettings&&a.extend(c,a.validator.classRuleSettings[this])}),c},attributeRules:function(b){var c,d,e={},f=a(b),g=b.getAttribute("type");for(c in a.validator.methods)"required"===c?(d=b.getAttribute(c),""===d&&(d=!0),d=!!d):d=f.attr(c),/min|max/.test(c)&&(null===g||/number|range|text/.test(g))&&(d=Number(d)),d||0===d?e[c]=d:g===c&&"range"!==g&&(e[c]=!0);return e.maxlength&&/-1|2147483647|524288/.test(e.maxlength)&&delete e.maxlength,e},dataRules:function(b){var c,d,e={},f=a(b);for(c in a.validator.methods)d=f.data("rule"+c.charAt(0).toUpperCase()+c.substring(1).toLowerCase()),void 0!==d&&(e[c]=d);return e},staticRules:function(b){var c={},d=a.data(b.form,"validator");return d.settings.rules&&(c=a.validator.normalizeRule(d.settings.rules[b.name])||{}),c},normalizeRules:function(b,c){return a.each(b,function(d,e){if(e===!1)return void delete b[d];if(e.param||e.depends){var f=!0;switch(typeof e.depends){case"string":f=!!a(e.depends,c.form).length;break;case"function":f=e.depends.call(c,c)}f?b[d]=void 0!==e.param?e.param:!0:delete b[d]}}),a.each(b,function(d,e){b[d]=a.isFunction(e)?e(c):e}),a.each(["minlength","maxlength"],function(){b[this]&&(b[this]=Number(b[this]))}),a.each(["rangelength","range"],function(){var c;b[this]&&(a.isArray(b[this])?b[this]=[Number(b[this][0]),Number(b[this][1])]:"string"==typeof b[this]&&(c=b[this].replace(/[\[\]]/g,"").split(/[\s,]+/),b[this]=[Number(c[0]),Number(c[1])]))}),a.validator.autoCreateRanges&&(null!=b.min&&null!=b.max&&(b.range=[b.min,b.max],delete b.min,delete b.max),null!=b.minlength&&null!=b.maxlength&&(b.rangelength=[b.minlength,b.maxlength],delete b.minlength,delete b.maxlength)),b},normalizeRule:function(b){if("string"==typeof b){var c={};a.each(b.split(/\s/),function(){c[this]=!0}),b=c}return b},addMethod:function(b,c,d){a.validator.methods[b]=c,a.validator.messages[b]=void 0!==d?d:a.validator.messages[b],c.length<3&&a.validator.addClassRules(b,a.validator.normalizeRule(b))},methods:{required:function(b,c,d){if(!this.depend(d,c))return"dependency-mismatch";if("select"===c.nodeName.toLowerCase()){var e=a(c).val();return e&&e.length>0}return this.checkable(c)?this.getLength(b,c)>0:a.trim(b).length>0},email:function(a,b){return this.optional(b)||/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(a)},url:function(a,b){return this.optional(b)||/^(https?|s?ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(a)},date:function(a,b){/*return this.optional(b)||!/Invalid|NaN/.test(new Date(a).toString())*/ /*customized!!!*/ var check = false,re=new RegExp((typeof(VALIDATE_DATE_MASK)!=='undefined'?VALIDATE_DATE_MASK:'^[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{4}$')),adata,gg,mm,aaaa,xdata;if(re.test(a)){adata=a.split('.');if(adata.length===1){adata=a.split('-');if(adata.length===1){adata=a.split(' ');
21536if(adata.length===1){adata=a.split('/');if(adata.length===1){adata=a.split(':');}}}}gg=parseInt(adata[0],10);mm=parseInt(adata[1],10);aaaa=parseInt(adata[2],10);xdata=new Date(aaaa,mm-1,gg,12,0,0,0);if((xdata.getUTCFullYear()===aaaa)&&(xdata.getUTCMonth()===mm-1)&&(xdata.getUTCDate()===gg)){check = true;}else{check = false;}}else{check = false;}return this.optional(b)||check;},dateISO:function(a,b){return this.optional(b)||/^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test(a)},number:function(a,b){return this.optional(b)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(a)},digits:function(a,b){return this.optional(b)||/^\d+$/.test(a)},creditcard:function(a,b){if(this.optional(b))return"dependency-mismatch";if(/[^0-9 \-]+/.test(a))return!1;var c,d,e=0,f=0,g=!1;if(a=a.replace(/\D/g,""),a.length<13||a.length>19)return!1;for(c=a.length-1;c>=0;c--)d=a.charAt(c),f=parseInt(d,10),g&&(f*=2)>9&&(f-=9),e+=f,g=!g;return e%10===0},minlength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(b,c);return this.optional(c)||e>=d},maxlength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(b,c);return this.optional(c)||d>=e},rangelength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(b,c);return this.optional(c)||e>=d[0]&&e<=d[1]},min:function(a,b,c){return this.optional(b)||a>=c},max:function(a,b,c){return this.optional(b)||c>=a},range:function(a,b,c){return this.optional(b)||a>=c[0]&&a<=c[1]},equalTo:function(b,c,d){var e=a(d);return this.settings.onfocusout&&e.unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){a(c).valid()}),b===e.val()},remote:function(b,c,d){if(this.optional(c))return"dependency-mismatch";var e,f,g=this.previousValue(c);return this.settings.messages[c.name]||(this.settings.messages[c.name]={}),g.originalMessage=this.settings.messages[c.name].remote,this.settings.messages[c.name].remote=g.message,d="string"==typeof d&&{url:d}||d,g.old===b?g.valid:(g.old=b,e=this,this.startRequest(c),f={},f[c.name]=b,a.ajax(a.extend(!0,{url:d,mode:"abort",port:"validate"+c.name,dataType:"json",data:f,context:e.currentForm,success:function(d){var f,h,i,j=d===!0||"true"===d;e.settings.messages[c.name].remote=g.originalMessage,j?(i=e.formSubmitted,e.prepareElement(c),e.formSubmitted=i,e.successList.push(c),delete e.invalid[c.name],e.showErrors()):(f={},h=d||e.defaultMessage(c,"remote"),f[c.name]=g.message=a.isFunction(h)?h(b):h,e.invalid[c.name]=!0,e.showErrors(f)),g.valid=j,e.stopRequest(c,j)}},d)),"pending")}}}),a.format=function(){throw"$.format has been deprecated. Please use $.validator.format instead."};var b,c={};a.ajaxPrefilter?a.ajaxPrefilter(function(a,b,d){var e=a.port;"abort"===a.mode&&(c[e]&&c[e].abort(),c[e]=d)}):(b=a.ajax,a.ajax=function(d){var e=("mode"in d?d:a.ajaxSettings).mode,f=("port"in d?d:a.ajaxSettings).port;return"abort"===e?(c[f]&&c[f].abort(),c[f]=b.apply(this,arguments),c[f]):b.apply(this,arguments)}),a.extend(a.fn,{validateDelegate:function(b,c,d){return this.bind(c,function(c){var e=a(c.target);return e.is(b)?d.apply(e,arguments):void 0})}})});
21537/* End */
21538;
21539; /* Start:"a:4:{s:4:"full";s:73:"/bitrix/templates/aspro_max/js/aspro_animate_open_fancy.js?17164655371916";s:6:"source";s:58:"/bitrix/templates/aspro_max/js/aspro_animate_open_fancy.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
21540function retrieveScale(btn) {
21541	var btnRadius = btn.width()/2,
21542		left = btn.offset().left + btnRadius,
21543		top = btn.offset().top + btnRadius - $(window).scrollTop(),
21544		scale = scaleValue(top, left, btnRadius, $(window).height(), $(window).width());
21545
21546	btn.css('position', 'fixed').velocity({
21547		top: top - btnRadius,
21548		left: left - btnRadius,
21549		translateX: 0,
21550	}, 0);
21551
21552	return scale;
21553}
21554
21555function scaleValue( topValue, leftValue, radiusValue, windowW, windowH) {
21556	var maxDistHor = ( leftValue > windowW/2) ? leftValue : (windowW - leftValue),
21557		maxDistVert = ( topValue > windowH/2) ? topValue : (windowH - topValue);
21558	return Math.ceil(Math.sqrt( Math.pow(maxDistHor, 2) + Math.pow(maxDistVert, 2) )/radiusValue);
21559}
21560
21561function animateLayer(layer, scaleVal, bool) {
21562	layer.velocity({ scale: scaleVal }, 400, function(){
21563		$('body').toggleClass('overflow-hidden', bool);
21564		(bool)
21565			? layer.parents('.cd-section').addClass('modal-is-visible').end().off('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend')
21566			: layer.removeClass('is-visible').removeAttr( 'style' ).siblings('[data-type="modal-trigger"]').removeClass('to-circle');
21567	});
21568}
21569
21570function updateLayer() {
21571	var layer = $('.cd-section.modal-is-visible .cd-modal-bg'),
21572		layerRadius = layer.width()/2,
21573		layerTop = layer.siblings('.btn').offset().top + layerRadius - $(window).scrollTop(),
21574		layerLeft = layer.siblings('.btn').offset().left + layerRadius,
21575		scale = scaleValue(layerTop, layerLeft, layerRadius, $(window).height(), $(window).width());
21576
21577	layer.velocity({
21578		top: layerTop - layerRadius,
21579		left: layerLeft - layerRadius,
21580		scale: scale,
21581	}, 0);
21582}
21583
21584function closeModal() {
21585	$('.cd-modal-bg').fadeOut();
21586	animateLayer($('.cd-modal-bg'), 1, false);
21587	//$('.cd-modal-bg').removeAttr('style');
21588	//setTimeout(function(){
21589		$('.cd-modal-bg').removeClass('is-visible');
21590	//}, 510);
21591}
21592/* End */
21593;
21594; /* Start:"a:4:{s:4:"full";s:77:"/bitrix/templates/aspro_max/js/jquery.inputmask.bundle.min.js?171646553770933";s:6:"source";
21594s:61:"/bitrix/templates/aspro_max/js/jquery.inputmask.bundle.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
21595!function(e){function t(n){if(i[n])return i[n].exports;var a=i[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,t),a.l=!0,a.exports}var i={};t.m=e,t.c=i,t.d=function(e,i,n){t.o(e,i)||Object.defineProperty(e,i,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var i=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(i,"a",i),i},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=3)}([function(e,t,i){"use strict";var n,a,r;"function"==typeof Symbol&&Symbol.iterator,a=[i(2)],void 0!==(r="function"==typeof(n=function(e){return e})?n.apply(t,a):n)&&(e.exports=r)},function(e,t,i){"use strict";var n,a,r,o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};a=[i(0),i(5),i(6)],void 0!==(r="function"==typeof(n=function(e,t,i,n){function a(t,i,o){if(!(this instanceof a))return new a(t,i,o);this.el=n,this.events={},this.maskset=n,this.refreshValue=!1,!0!==o&&(e.isPlainObject(t)?i=t:(i=i||{},t&&(i.alias=t)),this.opts=e.extend(!0,{},this.defaults,i),this.noMasksCache=i&&i.definitions!==n,this.userOptions=i||{},this.isRTL=this.opts.numericInput,r(this.opts.alias,i,this.opts))}function r(t,i,o){var s=a.prototype.aliases[t];return s?(s.alias&&r(s.alias,n,o),e.extend(!0,o,s),e.extend(!0,o,i),!0):(null===o.mask&&(o.mask=t),!1)}function s(t,i){function r(t,r,o){var s=!1;if(null!==t&&""!==t||((s=null!==o.regex)?t=(t=o.regex).replace(/^(\^)(.*)(\$)$/,"$2"):(s=!0,t=".*")),1===t.length&&!1===o.greedy&&0!==o.repeat&&(o.placeholder=""),o.repeat>0||"*"===o.repeat||"+"===o.repeat){var l="*"===o.repeat?0:"+"===o.repeat?1:o.repeat;t=o.groupmarker[0]+t+o.groupmarker[1]+o.quantifiermarker[0]+l+","+o.repeat+o.quantifiermarker[1]}var u,c=s?"regex_"+o.regex:o.numericInput?t.split("").reverse().join(""):t;return a.prototype.masksCache[c]===n||!0===i?(u={mask:t,maskToken:a.prototype.analyseMask(t,s,o),validPositions:{},_buffer:n,buffer:n,tests:{},excludes:{},metadata:r,maskLength:n},!0!==i&&(a.prototype.masksCache[c]=u,u=e.extend(!0,{},a.prototype.masksCache[c]))):u=e.extend(!0,{},a.prototype.masksCache[c]),u}if(e.isFunction(t.mask)&&(t.mask=t.mask(t)),e.isArray(t.mask)){if(t.mask.length>1){if(null===t.keepStatic){t.keepStatic="auto";for(var o=0;o<t.mask.length;o++)if(t.mask[o].charAt(0)!==t.mask[0].charAt(0)){t.keepStatic=!0;break}}var s=t.groupmarker[0];return e.each(t.isRTL?t.mask.reverse():t.mask,function(i,a){s.length>1&&(s+=t.groupmarker[1]+t.alternatormarker+t.groupmarker[0]),a.mask===n||e.isFunction(a.mask)?s+=a:s+=a.mask}),r(s+=t.groupmarker[1],t.mask,t)}t.mask=t.mask.pop()}return t.mask&&t.mask.mask!==n&&!e.isFunction(t.mask.mask)?r(t.mask.mask,t.mask,t):r(t.mask,t.mask,t)}function l(e){var t=i.createElement("input"),n="on"+e,a=n in t;return a||(t.setAttribute(n,"return;"),a="function"==typeof t[n]),t=null,a}function u(r,s,c){function d(e,t,i){t=t||0;var a,r,o,s=[],l=0,u=v();do{!0===e&&h().validPositions[l]?(r=(o=h().validPositions[l]).match,a=o.locator.slice(),s.push(!0===i?o.input:!1===i?r.nativeDef:N(l,r))):(r=(o=P(l,a,l-1)).match,a=o.locator.slice(),(!1===c.jitMasking||l<u||"number"==typeof c.jitMasking&&isFinite(c.jitMasking)&&c.jitMasking>l)&&s.push(!1===i?r.nativeDef:N(l,r))),"auto"===c.keepStatic&&r.newBlockMarker&&null!==r.fn&&(c.keepStatic=l-1),l++}while(($===n||l<$)&&(null!==r.fn||""!==r.def)||t>l);return""===s[s.length-1]&&s.pop(),!1===i&&h().maskLength!==n||(h().maskLength=l-1),s}function h(){return s}function g(e){var t=h();t.buffer=n,!0!==e&&(t.validPositions={},t.p=0)}function v(e,t,i){var a=-1,r=-1,o=i||h().validPositions;e===n&&(e=-1);for(var s in o){var l=parseInt(s);o[l]&&(t||!0!==o[l].generatedInput)&&(l<=e&&(a=l),l>=e&&(r=l))}return-1!==a&&e-a>1||r<e?a:r}function k(t,i,a,r){var o,s=t,l=e.extend(!0,{},h().validPositions),u=!1;for(h().p=t,o=i-1;o>=s;
21595o--)h().validPositions[o]!==n&&(!0!==a&&(!h().validPositions[o].match.optionality&&function(e){var t=h().validPositions[e];if(t!==n&&null===t.match.fn){var i=h().validPositions[e-1],a=h().validPositions[e+1];return i!==n&&a!==n}return!1}(o)||!1===c.canClearPosition(h(),o,v(n,!0),r,c))||delete h().validPositions[o]);for(g(!0),o=s+1;o<=v();){for(;h().validPositions[s]!==n;)s++;if(o<s&&(o=s+1),h().validPositions[o]===n&&j(o))o++;else{var p=P(o);!1===u&&l[s]&&l[s].match.def===p.match.def?(h().validPositions[s]=e.extend(!0,{},l[s]),h().validPositions[s].input=p.input,delete h().validPositions[o],o++):A(s,p.match.def)?!1!==_(s,p.input||N(o),!0)&&(delete h().validPositions[o],o++,u=!0):j(o)||(o++,s--),s++}}if(!0!==r)for(o=v(-1,!0);h().validPositions[o]&&!0===h().validPositions[o].generatedInput;)delete h().validPositions[o--];g(!0)}function y(e,t,i){for(var a,r=S(e=e>0?e-1:0),o=r.alternation!==n?r.locator[r.alternation].toString().split(","):[],s=0;s<t.length&&(!((a=t[s]).match&&(c.greedy&&!0!==a.match.optionalQuantifier||(!1===a.match.optionality||!1===a.match.newBlockMarker)&&!0!==a.match.optionalQuantifier)&&(r.alternation===n||r.alternation!==a.alternation||a.locator[r.alternation]!==n&&D(a.locator[r.alternation].toString().split(","),o)))||!0===i&&(null!==a.match.fn||/[0-9a-bA-Z]/.test(a.match.def)));s++);return a}function b(e){var t=e.locator[e.alternation];return"string"==typeof t&&t.length>0&&(t=t.split(",")[0]),t!==n?t.toString():""}function x(e,t){for(var i=(e.alternation!=n?e.mloc[b(e)]:e.locator).join("");i.length<t;)i+="0";return i}function P(e,t,i){return h().validPositions[e]||y(e,C(e,t?t.slice():t,i))}function S(e){return h().validPositions[e]?h().validPositions[e]:C(e)[0]}function A(e,t){for(var i=!1,n=C(e),a=0;a<n.length;a++)if(n[a].match&&n[a].match.def===t){i=!0;break}return i}function C(t,i,a){function r(i,a,s,l){function u(s,l,p){function m(t,i){var n=0===e.inArray(t,i.matches);return n||e.each(i.matches,function(e,a){if(!0===a.isQuantifier&&(n=m(t,i.matches[e-1])))return!1}),n}function k(t,i,a){var r,o;if((h().tests[t]||h().validPositions[t])&&e.each(h().tests[t]||[h().validPositions[t]],function(e,t){if(t.mloc[i])return r=t,!1;var s=a!==n?a:t.alternation,l=t.locator[s]!==n?t.locator[s].toString().indexOf(i):-1;(o===n||l<o)&&-1!==l&&(r=t,o=l)}),r){var s=r.locator[r.alternation];return(r.mloc[i]||r.mloc[s]||r.locator).slice((a!==n?a:r.alternation)+1)}return a!==n?k(t,i):n}function y(e,t){function i(e){for(var t,i,n=[],a=0,r=e.length;a<r;a++)if("-"===e.charAt(a))for(i=e.charCodeAt(a+1);++t<i;)n.push(String.fromCharCode(t));else t=e.charCodeAt(a),n.push(e.charAt(a));return n.join("")}return c.regex&&null!==e.match.fn&&null!==t.match.fn?-1!==i(t.match.def.replace(/[\[\]]/g,"")).indexOf(i(e.match.def.replace(/[\[\]]/g,""))):e.match.def===t.match.nativeDef}function b(e,t){if(t===n||e.alternation===t.alternation&&-1===e.locator[e.alternation].toString().indexOf(t.locator[t.alternation])){e.mloc=e.mloc||{};var i=e.locator[e.alternation];if(i!==n){if("string"==typeof i&&(i=i.split(",")[0]),e.mloc[i]===n&&(e.mloc[i]=e.locator.slice()),t!==n){for(var a in t.mloc)"string"==typeof a&&(a=a.split(",")[0]),e.mloc[a]===n&&(e.mloc[a]=t.mloc[a]);e.locator[e.alternation]=Object.keys(e.mloc).join(",")}return!0}e.alternation=n}return!1}if(f>1e4)throw"Inputmask: There is probably an error in your mask definition or in the code. Create an issue on github with an example of the mask you are using. "+h().mask;if(f===t&&s.matches===n)return d.push({match:s,locator:l.reverse(),cd:v,mloc:{}}),!0;if(s.matches!==n){if(s.isGroup&&p!==s){if(s=u(i.matches[e.inArray(s,i.matches)+1],l))return!0}else if(s.isOptional){var x=s;if(s=r(s,a,l,p)){if(!m(o=d[d.length-1].match,x))return!0;g=!0,f=t}}else if(s.isAlternator){var P,S=s,A=[],C=d.slice(),M=l.length,E=a.length>0?a.shift():-1;if(-1===E||"string"==typeof E){var w,D=f,O=a.slice(),_=[];if("string"==typeof E)_=E.split(",");else for(w=0;w<S.matches.length;w++)_.push(w.toString());if(h().excludes[t]){for(var j=_.slice(),F=0,T=h().excludes[t].length;F<T;F++)_.splice(_.indexOf(h().excludes[t][F].toString()),1);0===_.length&&(h().excludes[t]=n,_=j)}(!0===c.keepStatic||isFinite(parseInt(c.keepStatic))&&D>=c.keepStatic)&&(_=_.slice(0,1));for(var R=0;R<_.length;R++){w=parseInt(_[R]),d=[],a=k(f,w,M)||O.slice(),S.matches[w]&&u(S.matches[w],[w].concat(l),p)&&(s=!0),P=d.slice(),f=D,d=[];for(var N=0;N<P.length;N++){var G=P[N],B=!1;G.alternation=G.alternation||M,b(G);for(var I=0;I<A.length;I++){var L=A[I];if("string"!=typeof E||G.alternation!==n&&-1!==e.inArray(G.locator[G.alternation].toString(),_)){if(G.match.nativeDef===L.match.nativeDef){B=!0,b(L,G);break}if(y(G,L)){b(G,L)&&(B=!0,A.splice(A.indexOf(L),0,G));break}if(y(L,G)){b(L,G);break}if(z=L,null===(U=G).match.fn&&null!==z.match.fn&&z.match.fn.test(U.match.def,h(),t,!1,c,!1)){b(G,L)&&(B=!0,A.splice(A.indexOf(L),0,G));break}}}B||A.push(G)}}d=C.concat(A),f=t,g=d.length>0,s=A.length>0,a=O.slice()}else s=u(S.matches[E]||i.matches[E],[E].concat(l),p);if(s)return!0}else if(s.isQuantifier&&p!==i.matches[e.inArray(s,i.matches)-1])for(var H=s,V=a.length>0?a.shift():0;V<(isNaN(H.quantifier.max)?V+1:H.quantifier.max)&&f<=t;V++){var K=i.matches[e.inArray(H,i.matches)-1];
21595if(s=u(K,[V].concat(l),K)){if((o=d[d.length-1].match).optionalQuantifier=V>H.quantifier.min-1,m(o,K)){if(V>H.quantifier.min-1){g=!0,f=t;break}return!0}return!0}}else if(s=r(s,a,l,p))return!0}else f++;var U,z}for(var p=a.length>0?a.shift():0;p<i.matches.length;p++)if(!0!==i.matches[p].isQuantifier){var m=u(i.matches[p],[p].concat(s),l);if(m&&f===t)return m;if(f>t)break}}var o,s,l,u,p=h().maskToken,f=i?a:0,m=i?i.slice():[0],d=[],g=!1,v=i?i.join(""):"";if(t>-1){if(i===n){for(var k,b=t-1;(k=h().validPositions[b]||h().tests[b])===n&&b>-1;)b--;k!==n&&b>-1&&(s=b,l=k,u=[],e.isArray(l)||(l=[l]),l.length>0&&(l[0].alternation===n?0===(u=y(s,l.slice()).locator.slice()).length&&(u=l[0].locator.slice()):e.each(l,function(e,t){if(""!==t.def)if(0===u.length)u=t.locator.slice();else for(var i=0;i<u.length;i++)t.locator[i]&&-1===u[i].toString().indexOf(t.locator[i])&&(u[i]+=","+t.locator[i])})),v=(m=u).join(""),f=b)}if(h().tests[t]&&h().tests[t][0].cd===v)return h().tests[t];for(var x=m.shift();x<p.length&&!(r(p[x],m,[x])&&f===t||f>t);x++);}return(0===d.length||g)&&d.push({match:{fn:null,optionality:!0,casing:null,def:"",placeholder:""},locator:[],mloc:{},cd:v}),i!==n&&h().tests[t]?e.extend(!0,[],d):(h().tests[t]=e.extend(!0,[],d),h().tests[t])}function M(){return h()._buffer===n&&(h()._buffer=d(!1,1),h().buffer===n&&(h().buffer=h()._buffer.slice())),h()._buffer}function E(e){return h().buffer!==n&&!0!==e||(h().buffer=d(!0,v(),!0)),h().buffer}function w(e,t,i){var a,r;if(!0===e)g(),e=0,t=i.length;else for(a=e;a<t;a++)delete h().validPositions[a];for(r=e,a=e;a<t;a++)if(g(!0),i[a]!==c.skipOptionalPartCharacter){var o=_(r,i[a],!0,!0);!1!==o&&(g(!0),r=o.caret!==n?o.caret:o.pos+1)}}function D(t,i,a){for(var r,o=c.greedy?i:i.slice(0,1),s=!1,l=a!==n?a.split(","):[],u=0;u<l.length;u++)-1!==(r=t.indexOf(l[u]))&&t.splice(r,1);for(var p=0;p<t.length;p++)if(-1!==e.inArray(t[p],o)){s=!0;break}return s}function O(t,i,a,r,o){var s,l,u,p,f,m,d,k=e.extend(!0,{},h().validPositions),y=!1,x=o!==n?o:v();if(-1===x&&o===n)l=(p=S(s=0)).alternation;else for(;x>=0;x--)if((u=h().validPositions[x])&&u.alternation!==n){if(p&&p.locator[u.alternation]!==u.locator[u.alternation])break;s=x,l=h().validPositions[s].alternation,p=u}if(l!==n){d=parseInt(s),h().excludes[d]=h().excludes[d]||[],!0!==t&&h().excludes[d].push(b(p));var P=[],A=0;for(f=d;f<v(n,!0)+1;f++)(m=h().validPositions[f])&&!0!==m.generatedInput&&/[0-9a-bA-Z]/.test(m.input)?P.push(m.input):f<t&&A++,delete h().validPositions[f];for(;h().excludes[d]&&h().excludes[d].length<10;){var C=-1*A,M=P.slice();for(h().tests[d]=n,g(!0),y=!0;M.length>0;){var E=M.shift();if(E!==c.skipOptionalPartCharacter&&!(y=_(v(n,!0)+1,E,!1,r,!0)))break}if(y&&i!==n){var w=v(t)+1;for(f=d;f<v()+1;f++)((m=h().validPositions[f])===n||null==m.match.fn)&&f<t+C&&C++;y=_((t+=C)>w?w:t,i,a,r,!0)}if(y)break;if(g(),p=S(d),h().validPositions=e.extend(!0,{},k),!h().excludes[d]){y=O(t,i,a,r,d-1);break}var D=b(p);if(-1!==h().excludes[d].indexOf(D)){y=O(t,i,a,r,d-1);break}for(h().excludes[d].push(D),f=d;f<v(n,!0)+1;f++)delete h().validPositions[f]}}return h().excludes[d]=n,y}function _(t,i,r,o,s,l){function u(e){return X?e.begin-e.end>1||e.begin-e.end==1:e.end-e.begin>1||e.end-e.begin==1}function p(i,r,s){var l=!1;return e.each(C(i),function(p,f){var d=f.match;if(E(!0),!1!==(l=null!=d.fn?d.fn.test(r,h(),i,s,c,u(t)):(r===d.def||r===c.skipOptionalPartCharacter)&&""!==d.def&&{c:N(i,d,!0)||d.def,pos:i})){var y=l.c!==n?l.c:r;y=y===c.skipOptionalPartCharacter&&null===d.fn?N(i,d,!0)||d.def:y;var b=i,x=E();if(l.remove!==n&&(e.isArray(l.remove)||(l.remove=[l.remove]),e.each(l.remove.sort(function(e,t){return t-e}),function(e,t){k(t,t+1,!0)})),l.insert!==n&&(e.isArray(l.insert)||(l.insert=[l.insert]),e.each(l.insert.sort(function(e,t){return e-t}),function(e,t){_(t.pos,t.c,!0,o)})),l.refreshFromBuffer){var P=l.refreshFromBuffer;if(w(!0===P?P:P.start,P.end,x),l.pos===n&&l.c===n)return l.pos=v(),!1;if((b=l.pos!==n?l.pos:i)!==i)return l=e.extend(l,_(b,y,!0,o)),!1}else if(!0!==l&&l.pos!==n&&l.pos!==i&&(b=l.pos,w(i,b,E().slice()),b!==i))return l=e.extend(l,_(b,y,!0)),!1;return(!0===l||l.pos!==n||l.c!==n)&&(p>0&&g(!0),m(b,e.extend({}
21595,f,{input:function(t,i,n){switch(c.casing||i.casing){case"upper":t=t.toUpperCase();break;case"lower":t=t.toLowerCase();break;case"title":var r=h().validPositions[n-1];t=0===n||r&&r.input===String.fromCharCode(a.keyCode.SPACE)?t.toUpperCase():t.toLowerCase();break;default:if(e.isFunction(c.casing)){var o=Array.prototype.slice.call(arguments);o.push(h().validPositions),t=c.casing.apply(this,o)}}return t}(y,d,b)}),o,u(t))||(l=!1),!1)}}),l}function f(t,i,a){var r;if(t===n)for(t=i-1;t>0&&!h().validPositions[t];t--);for(var o=t;o<i;o++)if(h().validPositions[o]===n&&!j(o,!0)){var s=0==o?S(o):h().validPositions[o-1];if(s){var l,u=x(s),c=C(o).slice(),p=n,f=S(o);if(""===c[c.length-1].match.def&&c.pop(),e.each(c,function(e,t){l=x(t,u.length);var i=Math.abs(l-u);(p===n||i<p)&&null===t.match.fn&&!0!==t.match.optionality&&!0!==t.match.optionalQuantifier&&(p=i,f=t)}),(f=e.extend({},f,{input:N(o,f.match,!0)||f.match.def})).generatedInput=!0,m(o,f,!0),!0!==a){var d=h().validPositions[i].input;h().validPositions[i]=n,r=_(i,d,!0,!0)}}}return r}function m(t,i,a,r){if(r||c.insertMode&&h().validPositions[t]!==n&&a===n){var o,s=e.extend(!0,{},h().validPositions),l=v(n,!0);for(o=t;o<=l;o++)delete h().validPositions[o];h().validPositions[t]=e.extend(!0,{},i);var u,p=!0,m=h().validPositions,d=!1;for(o=u=t;o<=l;o++){var k=s[o];if(k!==n)for(var y=u;""!==S(y).match.def&&(null===k.match.fn&&m[o]&&(!0===m[o].match.optionalQuantifier||!0===m[o].match.optionality)||null!=k.match.fn);){if(y++,!1===d&&s[y]&&s[y].match.def===k.match.def)h().validPositions[y]=e.extend(!0,{},s[y]),h().validPositions[y].input=k.input,f(n,y,!0),u=y,p=!0;else if(A(y,k.match.def)){var b=_(y,k.input,!0,!0);p=!1!==b,u=b.caret||b.insert?v():y,d=!0}else if(!(p=!0===k.generatedInput)&&""===S(y).match.def)break;if(p)break}if(!p)break}if(!p)return h().validPositions=e.extend(!0,{},s),g(!0),!1}else h().validPositions[t]=e.extend(!0,{},i);return g(!0),!0}r=!0===r;var d=t;t.begin!==n&&(d=X&&!u(t)?t.end:t.begin);var y=!0,b=e.extend(!0,{},h().validPositions);if(e.isFunction(c.preValidation)&&!r&&!0!==o&&!0!==l&&(y=c.preValidation(E(),d,i,u(t),c)),!0===y){if(f(n,d,!0),u(t)&&(K(0,a.keyCode.DELETE,t,!0,!0),d=h().p),($===n||d<$)&&(y=p(d,i,r),(!r||!0===o)&&!1===y&&!0!==l)){var P=h().validPositions[d];if(!P||null!==P.match.fn||P.match.def!==i&&i!==c.skipOptionalPartCharacter){if((c.insertMode||h().validPositions[F(d)]===n)&&!j(d,!0))for(var M=d+1,D=F(d);M<=D;M++)if(!1!==(y=p(M,i,r))){y=f(d,y.pos!==n?y.pos:M)||y,d=M;break}}else y={caret:F(d)}}!1!==y||null===c.keepStatic||!1===c.keepStatic||r||!0===s||(y=O(d,i,r,o)),!0===y&&(y={pos:d})}if(e.isFunction(c.postValidation)&&!1!==y&&!r&&!0!==o&&!0!==l){var T=c.postValidation(E(!0),y,c);if(T!==n){if(T.refreshFromBuffer&&T.buffer){var R=T.refreshFromBuffer;w(!0===R?R:R.start,R.end,T.buffer)}y=!0===T?y:T}}return y&&y.pos===n&&(y.pos=d),!1!==y&&!0!==l||(g(!0),h().validPositions=e.extend(!0,{},b)),y}function j(e,t){var i=P(e).match;if(""===i.def&&(i=S(e).match),null!=i.fn)return i.fn;if(!0!==t&&e>-1){var n=C(e);return n.length>1+(""===n[n.length-1].match.def?1:0)}return!1}function F(e,t){for(var i=e+1;""!==S(i).match.def&&(!0===t&&(!0!==S(i).match.newBlockMarker||!j(i))||!0!==t&&!j(i));)i++;return i}function T(e,t){var i,n=e;if(n<=0)return 0;for(;--n>0&&(!0===t&&!0!==S(n).match.newBlockMarker||!0!==t&&!j(n)&&((i=C(n)).length<2||2===i.length&&""===i[1].match.def)););return n}function R(t,i,a,r,o){if(r&&e.isFunction(c.onBeforeWrite)){var s=c.onBeforeWrite.call(J,r,i,a,c);if(s){if(s.refreshFromBuffer){var l=s.refreshFromBuffer;w(!0===l?l:l.start,l.end,s.buffer||i),i=E(!0)}a!==n&&(a=s.caret!==n?s.caret:a)}}t!==n&&(t.inputmask._valueSet(i.join("")),a===n||r!==n&&"blur"===r.type?z(t,a,0===i.length):I(t,a),!0===o&&(te=!0,e(t).trigger("input")))}function N(t,i,a){if((i=i||S(t).match).placeholder!==n||!0===a)return e.isFunction(i.placeholder)?i.placeholder(c):i.placeholder;if(null===i.fn){if(t>-1&&h().validPositions[t]===n){var r,o=C(t),s=[];if(o.length>1+(""===o[o.length-1].match.def?1:0))for(var l=0;l<o.length;l++)if(!0!==o[l].match.optionality&&!0!==o[l].match.optionalQuantifier&&(null===o[l].match.fn||r===n||!1!==o[l].match.fn.test(r.match.def,h(),t,!0,c))&&(s.push(o[l]),null===o[l].match.fn&&(r=o[l]),s.length>1&&/[0-9a-bA-Z]/.test(s[0].match.def)))return c.placeholder.charAt(t%c.placeholder.length)}return i.def}return c.placeholder.charAt(t%c.placeholder.length)}function G(t,i,r,o,s){var l=o.slice(),u="",p=-1,f=n;if(g(),r||!0===c.autoUnmask)p=F(p);else{var m=M().slice(0,F(-1)).join(""),k=l.join("").match(new RegExp("^"+a.escapeRegex(m),"g"));k&&k.length>0&&(l.splice(0,k.length*m.length),p=F(p))}-1===p?(h().p=F(p),p=0):h().p=p,e.each(l,function(i,a){if(a!==n)if(h().validPositions[i]===n&&l[i]===N(i)&&j(i,!0)&&!1===_(i,l[i],!0,n,n,!0))h().p++;else{var o=new e.Event("_checkval");
21595o.which=a.charCodeAt(0),u+=a;var s=v(n,!0),m=S(s),g=P(s+1,m?m.locator.slice():n,s);if(y=p,b=u,-1===d(!0,0,!1).slice(y,F(y)).join("").indexOf(b)||j(y)||S(y).match.nativeDef!==b.charAt(0)&&(" "!==S(y).match.nativeDef||S(y+1).match.nativeDef!==b.charAt(0))||r||c.autoUnmask){var k=r?i:null==g.match.fn&&g.match.optionality&&s+1<h().p?s+1:h().p;(f=oe.keypressEvent.call(t,o,!0,!1,r,k))&&(p=k+1,u="")}else f=oe.keypressEvent.call(t,o,!0,!1,!0,s+1);R(n,E(),f.forwardPosition,o,!1)}var y,b}),i&&R(t,E(),f?f.forwardPosition:n,s||new e.Event("checkval"),s&&"input"===s.type)}function B(t){if(t){if(t.inputmask===n)return t.value;t.inputmask&&t.inputmask.refreshValue&&oe.setValueEvent.call(t)}var i=[],a=h().validPositions;for(var r in a)a[r].match&&null!=a[r].match.fn&&i.push(a[r].input);var o=0===i.length?"":(X?i.reverse():i).join("");if(e.isFunction(c.onUnMask)){var s=(X?E().slice().reverse():E()).join("");o=c.onUnMask.call(J,s,o,c)}return o}function I(a,r,o,s){function l(e){return!0===s||!X||"number"!=typeof e||c.greedy&&""===c.placeholder||(e=a.inputmask.__valueGet.call(a).length-e),e}var u;if(r===n)return a.setSelectionRange?(r=a.selectionStart,o=a.selectionEnd):t.getSelection?(u=t.getSelection().getRangeAt(0)).commonAncestorContainer.parentNode!==a&&u.commonAncestorContainer!==a||(r=u.startOffset,o=u.endOffset):i.selection&&i.selection.createRange&&(o=(r=0-(u=i.selection.createRange()).duplicate().moveStart("character",-a.inputmask._valueGet().length))+u.text.length),{begin:l(r),end:l(o)};if(e.isArray(r)&&(o=X?r[0]:r[1],r=X?r[1]:r[0]),r.begin!==n&&(o=X?r.begin:r.end,r=X?r.end:r.begin),"number"==typeof r){r=l(r),o="number"==typeof(o=l(o))?o:r;var p=parseInt(((a.ownerDocument.defaultView||t).getComputedStyle?(a.ownerDocument.defaultView||t).getComputedStyle(a,null):a.currentStyle).fontSize)*o;if(a.scrollLeft=p>a.scrollWidth?p:0,!1===c.insertMode&&r===o&&o++,a.inputmask.caretPos={begin:r,end:o},a.setSelectionRange)a.selectionStart=r,a.selectionEnd=o;else if(t.getSelection){if(u=i.createRange(),a.firstChild===n||null===a.firstChild){var f=i.createTextNode("");a.appendChild(f)}u.setStart(a.firstChild,r<a.inputmask._valueGet().length?r:a.inputmask._valueGet().length),u.setEnd(a.firstChild,o<a.inputmask._valueGet().length?o:a.inputmask._valueGet().length),u.collapse(!0);var m=t.getSelection();m.removeAllRanges(),m.addRange(u)}else a.createTextRange&&((u=a.createTextRange()).collapse(!0),u.moveEnd("character",o),u.moveStart("character",r),u.select());z(a,{begin:r,end:o})}}function L(t){var i,a,r=E(),o=r.length,s=v(),l={},u=h().validPositions[s],c=u!==n?u.locator.slice():n;for(i=s+1;i<r.length;i++)c=(a=P(i,c,i-1)).locator.slice(),l[i]=e.extend(!0,{},a);var p=u&&u.alternation!==n?u.locator[u.alternation]:n;for(i=o-1;i>s&&((a=l[i]).match.optionality||a.match.optionalQuantifier&&a.match.newBlockMarker||p&&(p!==l[i].locator[u.alternation]&&null!=a.match.fn||null===a.match.fn&&a.locator[u.alternation]&&D(a.locator[u.alternation].toString().split(","),p.toString().split(","))&&""!==C(i)[0].def))&&r[i]===N(i,a.match);i--)o--;return t?{l:o,def:l[o]?l[o].match:n}:o}function H(e){for(var t,i=L(),a=e.length,r=h().validPositions[v()];i<a&&!j(i,!0)&&(t=r!==n?P(i,r.locator.slice(""),r):S(i))&&!0!==t.match.optionality&&(!0!==t.match.optionalQuantifier&&!0!==t.match.newBlockMarker||i+1===a&&""===(r!==n?P(i+1,r.locator.slice(""),r):S(i+1)).match.def);)i++;for(;(t=h().validPositions[i-1])&&t&&t.match.optionality&&t.input===c.skipOptionalPartCharacter;)i--;return e.splice(i),e}function V(t){if(e.isFunction(c.isComplete))return c.isComplete(t,c);if("*"===c.repeat)return n;var i=!1,a=L(!0),r=T(a.l);if(a.def===n||a.def.newBlockMarker||a.def.optionality||a.def.optionalQuantifier){i=!0;for(var o=0;o<=r;o++){var s=P(o).match;if(null!==s.fn&&h().validPositions[o]===n&&!0!==s.optionality&&!0!==s.optionalQuantifier||null===s.fn&&t[o]!==N(o,s)){i=!1;break}}}return i}function K(e,t,i,r,o){if((c.numericInput||X)&&(t===a.keyCode.BACKSPACE?t=a.keyCode.DELETE:t===a.keyCode.DELETE&&(t=a.keyCode.BACKSPACE),X)){var s=i.end;i.end=i.begin,i.begin=s}if(t===a.keyCode.BACKSPACE&&(i.end-i.begin<1||!1===c.insertMode)?(i.begin=T(i.begin),h().validPositions[i.begin]!==n&&h().validPositions[i.begin].input===c.groupSeparator&&i.begin--):t===a.keyCode.DELETE&&i.begin===i.end&&(i.end=j(i.end,!0)&&h().validPositions[i.end]&&h().validPositions[i.end].input!==c.radixPoint?i.end+1:F(i.end)+1,h().validPositions[i.begin]!==n&&h().validPositions[i.begin].input===c.groupSeparator&&i.end++),k(i.begin,i.end,!1,r),!0!==r&&null!==c.keepStatic&&!1!==c.keepStatic){var l=O(!0);l&&(i.begin=l.caret!==n?l.caret:l.pos?F(l.pos.begin?l.pos.begin:l.pos):v(-1,!0))}var u=v(i.begin,!0);if(u<i.begin||-1===i.begin)h().p=F(u);else if(!0!==r&&(h().p=i.begin,!0!==o))for(;h().p<u&&h().validPositions[h().p]===n;)h().p++}function U(n){var a=(n.ownerDocument.defaultView||t).getComputedStyle(n,null),r=i.createElement("div");r.style.width=a.width,r.style.textAlign=a.textAlign,q=i.createElement("div"),n.inputmask.colorMask=q,q.className="im-colormask",n.parentNode.insertBefore(q,n),n.parentNode.removeChild(n),q.appendChild(r),q.appendChild(n),n.style.left=r.offsetLeft+"px",e(n).on("click",function(e){return I(n,function(e){var t,r=i.createElement("span");for(var o in a)isNaN(o)&&-1!==o.indexOf("font")&&(r.style[o]=a[o]);r.style.textTransform=a.textTransform,r.style.letterSpacing=a.letterSpacing,r.style.position="absolute",r.style.height="auto",r.style.width="auto",r.style.visibility="hidden",r.style.whiteSpace="nowrap",i.body.appendChild(r);var s,l=n.inputmask._valueGet(),u=0;for(t=0,s=l.length;t<=s;t++){if(r.innerHTML+=l.charAt(t)||"_",r.offsetWidth>=e){var c=e-u,p=r.offsetWidth-e;r.innerHTML=l.charAt(t),t=(c-=r.offsetWidth/3)<p?t-1:t;break}u=r.offsetWidth}return i.body.removeChild(r),t}(e.clientX)),oe.clickEvent.call(n,[e])}),e(n).on("keydown",function(e){e.shiftKey||!1===c.insertMode||setTimeout(function(){z(n)},0)})}function z(e,t,a){function r(e){if(e===n&&(e=""),p||null!==o.fn&&s.input!==n)if(p&&(null!==o.fn&&s.input!==n||""===o.def)){p=!1;var t=u.length;u[t-1]=u[t-1]+"</span>",u.push(e)}else u.push(e);else p=!0,u.push("<span class='im-static'>"+e)}var o,s,l,u=[],p=!1,f=0;if(q!==n){var m=E();if(t===n?t=I(e):t.begin===n&&(t={begin:t,end:t}),!0!==a){var d=v();
21595do{h().validPositions[f]?(s=h().validPositions[f],o=s.match,l=s.locator.slice(),r(m[f])):(s=P(f,l,f-1),o=s.match,l=s.locator.slice(),(!1===c.jitMasking||f<d||"number"==typeof c.jitMasking&&isFinite(c.jitMasking)&&c.jitMasking>f)&&r(N(f,o))),f++}while(($===n||f<$)&&(null!==o.fn||""!==o.def)||d>f||p);p&&r(),i.activeElement===e&&(u.splice(t.begin,0,t.begin===t.end?'<mark class="im-caret" style="border-right-width: 1px;border-right-style: solid;">':'<mark class="im-caret-select">'),u.splice(t.end+1,0,"</mark>"))}var g=q.getElementsByTagName("div")[0];g.innerHTML=u.join(""),e.inputmask.positionColorMask(e,g)}}s=s||this.maskset,c=c||this.opts;var Q,W,$,q,Z,J=this,Y=this.el,X=this.isRTL,ee=!1,te=!1,ie=!1,ne=!1,ae=!1,re={on:function(t,i,r){var o=function(t){var i=this;if(i.inputmask===n&&"FORM"!==this.nodeName){var o=e.data(i,"_inputmask_opts");o?new a(o).mask(i):re.off(i)}else{if("setvalue"===t.type||"FORM"===this.nodeName||!(i.disabled||i.readOnly&&!("keydown"===t.type&&t.ctrlKey&&67===t.keyCode||!1===c.tabThrough&&t.keyCode===a.keyCode.TAB))){switch(t.type){case"input":if(!0===te)return te=!1,t.preventDefault();p&&(ae=!0);break;case"keydown":ee=!1,te=!1;break;case"keypress":if(!0===ee)return t.preventDefault();ee=!0;break;case"click":if(f||m){var s=arguments;return setTimeout(function(){r.apply(i,s)},0),!1}}var l=r.apply(i,arguments);return ae&&(ae=!1,setTimeout(function(){I(i,i.inputmask.caretPos,n,!0)})),!1===l&&(t.preventDefault(),t.stopPropagation()),l}t.preventDefault()}};t.inputmask.events[i]=t.inputmask.events[i]||[],t.inputmask.events[i].push(o),-1!==e.inArray(i,["submit","reset"])?null!==t.form&&e(t.form).on(i,o):e(t).on(i,o)},off:function(t,i){var n;t.inputmask&&t.inputmask.events&&(i?(n=[])[i]=t.inputmask.events[i]:n=t.inputmask.events,e.each(n,function(i,n){for(;n.length>0;){var a=n.pop();-1!==e.inArray(i,["submit","reset"])?null!==t.form&&e(t.form).off(i,a):e(t).off(i,a)}delete t.inputmask.events[i]}))}},oe={keydownEvent:function(t){var i=this,n=e(i),r=t.keyCode,o=I(i);if(r===a.keyCode.BACKSPACE||r===a.keyCode.DELETE||m&&r===a.keyCode.BACKSPACE_SAFARI||t.ctrlKey&&r===a.keyCode.X&&!l("cut"))t.preventDefault(),K(0,r,o),R(i,E(!0),h().p,t,i.inputmask._valueGet()!==E().join("")),i.inputmask._valueGet()===M().join("")?n.trigger("cleared"):!0===V(E())&&n.trigger("complete");else if(r===a.keyCode.END||r===a.keyCode.PAGE_DOWN){t.preventDefault();var s=F(v());c.insertMode||s!==h().maskLength||t.shiftKey||s--,I(i,t.shiftKey?o.begin:s,s,!0)}else r===a.keyCode.HOME&&!t.shiftKey||r===a.keyCode.PAGE_UP?(t.preventDefault(),I(i,0,t.shiftKey?o.begin:0,!0)):(c.undoOnEscape&&r===a.keyCode.ESCAPE||90===r&&t.ctrlKey)&&!0!==t.altKey?(G(i,!0,!1,Q.split("")),n.trigger("click")):r!==a.keyCode.INSERT||t.shiftKey||t.ctrlKey?!0===c.tabThrough&&r===a.keyCode.TAB?(!0===t.shiftKey?(null===S(o.begin).match.fn&&(o.begin=F(o.begin)),o.end=T(o.begin,!0),o.begin=T(o.end,!0)):(o.begin=F(o.begin,!0),o.end=F(o.begin,!0),o.end<h().maskLength&&o.end--),o.begin<h().maskLength&&(t.preventDefault(),I(i,o.begin,o.end))):t.shiftKey||!1===c.insertMode&&(r===a.keyCode.RIGHT?setTimeout(function(){var e=I(i);I(i,e.begin)},0):r===a.keyCode.LEFT&&setTimeout(function(){var e=I(i);I(i,X?e.begin+1:e.begin-1)},0)):(c.insertMode=!c.insertMode,I(i,c.insertMode||o.begin!==h().maskLength?o.begin:o.begin-1));c.onKeyDown.call(this,t,E(),I(i).begin,c),ie=-1!==e.inArray(r,c.ignorables)},keypressEvent:function(t,i,r,o,s){var l=this,u=e(l),p=t.which||t.charCode||t.keyCode;if(!(!0===i||t.ctrlKey&&t.altKey)&&(t.ctrlKey||t.metaKey||ie))return p===a.keyCode.ENTER&&Q!==E().join("")&&(Q=E().join(""),setTimeout(function(){u.trigger("change")},0)),!0;if(p){46===p&&!1===t.shiftKey&&""!==c.radixPoint&&(p=c.radixPoint.charCodeAt(0));var f,m=i?{begin:s,end:s}:I(l),d=String.fromCharCode(p);h().writeOutBuffer=!0;var v=_(m,d,o);if(!1!==v&&(g(!0),f=v.caret!==n?v.caret:F(v.pos.begin?v.pos.begin:v.pos),h().p=f),f=c.numericInput&&v.caret===n?T(f):f,!1!==r&&(setTimeout(function(){c.onKeyValidation.call(l,p,v,c)},0),h().writeOutBuffer&&!1!==v)){var k=E();R(l,k,f,t,!0!==i),!0!==i&&setTimeout(function(){!0===V(k)&&u.trigger("complete")},0)}if(t.preventDefault(),i)return!1!==v&&(v.forwardPosition=f),v}},pasteEvent:function(i){var n,a=this,r=i.originalEvent||i,o=e(a),s=a.inputmask._valueGet(!0),l=I(a);X&&(n=l.end,l.end=l.begin,l.begin=n);var u=s.substr(0,l.begin),p=s.substr(l.end,s.length);if(u===(X?M().reverse():M()).slice(0,l.begin).join("")&&(u=""),p===(X?M().reverse():M()).slice(l.end).join("")&&(p=""),X&&(n=u,u=p,p=n),t.clipboardData&&t.clipboardData.getData)s=u+t.clipboardData.getData("Text")+p;else{if(!r.clipboardData||!r.clipboardData.getData)return!0;s=u+r.clipboardData.getData("text/plain")+p}var f=s;if(e.isFunction(c.onBeforePaste)){if(!1===(f=c.onBeforePaste.call(J,s,c)))return i.preventDefault();f||(f=s)}return G(a,!1,!1,X?f.split("").reverse():f.toString().split("")),R(a,E(),F(v()),i,Q!==E().join("")),!0===V(E())&&o.trigger("complete"),i.preventDefault()},inputFallBackEvent:function(t){var i,n,r=this,o=r.inputmask._valueGet();if(E().join("")!==o){var s=I(r);if(n=s,"."===(i=o).charAt(n.begin-1)&&""!==c.radixPoint&&((i=i.split(""))[n.begin-1]=c.radixPoint.charAt(0),i=i.join("")),o=function(e,t,i){if(f){var n=t.replace(E().join(""),"");if(1===n.length){var a=t.split("");
21595a.splice(i.begin,0,n),t=a.join("")}}return t}(0,o=i,s),E().join("")!==o){var l=E().join(""),u=o.length>l.length?-1:0,p=o.substr(0,s.begin),m=o.substr(s.begin),d=l.substr(0,s.begin+u),h=l.substr(s.begin+u),g=s,v="",k=!1;if(p!==d){for(var y=(k=p.length>=d.length)?p.length:d.length,b=0;p.charAt(b)===d.charAt(b)&&b<y;b++);k&&(0===u&&(g.begin=b),v+=p.slice(b,g.end))}if(m!==h&&(m.length>h.length?v+=m.slice(0,1):m.length<h.length&&(g.end+=h.length-m.length,k||""===c.radixPoint||""!==m||p.charAt(g.begin+u-1)!==c.radixPoint||(g.begin--,v=c.radixPoint))),R(r,E(),{begin:g.begin+u,end:g.end+u}),v.length>0)e.each(v.split(""),function(t,i){var n=new e.Event("keypress");n.which=i.charCodeAt(0),ie=!1,oe.keypressEvent.call(r,n)});else{g.begin===g.end-1&&(g.begin=T(g.begin+1),g.begin===g.end-1?I(r,g.begin):I(r,g.begin,g.end));var x=new e.Event("keydown");x.keyCode=a.keyCode.DELETE,oe.keydownEvent.call(r,x),!1===c.insertMode&&I(r,I(r).begin-1)}t.preventDefault()}}},setValueEvent:function(t){this.inputmask.refreshValue=!1;var i=this.inputmask._valueGet(!0);e.isFunction(c.onBeforeMask)&&(i=c.onBeforeMask.call(J,i,c)||i),i=i.split(""),G(this,!0,!1,X?i.reverse():i),Q=E().join(""),(c.clearMaskOnLostFocus||c.clearIncomplete)&&this.inputmask._valueGet()===M().join("")&&this.inputmask._valueSet("")},focusEvent:function(e){var t=this,i=t.inputmask._valueGet();c.showMaskOnFocus&&(!c.showMaskOnHover||c.showMaskOnHover&&""===i)&&(t.inputmask._valueGet()!==E().join("")?R(t,E(),F(v())):!1===ne&&I(t,F(v()))),!0===c.positionCaretOnTab&&!1===ne&&oe.clickEvent.apply(t,[e,!0]),Q=E().join("")},mouseleaveEvent:function(e){if(ne=!1,c.clearMaskOnLostFocus&&i.activeElement!==this){var t=E().slice(),n=this.inputmask._valueGet();n!==this.getAttribute("placeholder")&&""!==n&&(-1===v()&&n===M().join("")?t=[]:H(t),R(this,t))}},clickEvent:function(t,a){var r=this;setTimeout(function(){if(i.activeElement===r){var t=I(r);if(a&&(X?t.end=t.begin:t.begin=t.end),t.begin===t.end)switch(c.positionCaretOnClick){case"none":break;case"select":I(r,0,E().length);break;case"radixFocus":if(function(t){if(""!==c.radixPoint){var i=h().validPositions;if(i[t]===n||i[t].input===N(t)){if(t<F(-1))return!0;var a=e.inArray(c.radixPoint,E());if(-1!==a){for(var r in i)if(a<r&&i[r].input!==N(r))return!1;return!0}}}return!1}(t.begin)){var o=E().join("").indexOf(c.radixPoint);I(r,c.numericInput?F(o):o);break}default:var s=t.begin,l=v(s,!0),u=F(l);if(s<u)I(r,j(s,!0)||j(s-1,!0)?s:F(s));
21595else{var p=h().validPositions[l],f=P(u,p?p.match.locator:n,p),m=N(u,f.match);if(""!==m&&E()[u]!==m&&!0!==f.match.optionalQuantifier&&!0!==f.match.newBlockMarker||!j(u,!0)&&f.match.def===m){var d=F(u);(s>=d||s===u)&&(u=d)}I(r,u)}}}},0)},dblclickEvent:function(e){var t=this;setTimeout(function(){I(t,0,F(v()))},0)},cutEvent:function(n){var r=e(this),o=I(this),s=n.originalEvent||n,l=t.clipboardData||s.clipboardData,u=X?E().slice(o.end,o.begin):E().slice(o.begin,o.end);l.setData("text",X?u.reverse().join(""):u.join("")),i.execCommand&&i.execCommand("copy"),K(0,a.keyCode.DELETE,o),R(this,E(),h().p,n,Q!==E().join("")),this.inputmask._valueGet()===M().join("")&&r.trigger("cleared")},blurEvent:function(t){var i=e(this);if(this.inputmask){var a=this.inputmask._valueGet(),r=E().slice();""===a&&q===n||(c.clearMaskOnLostFocus&&(-1===v()&&a===M().join("")?r=[]:H(r)),!1===V(r)&&(setTimeout(function(){i.trigger("incomplete")},0),c.clearIncomplete&&(g(),r=c.clearMaskOnLostFocus?[]:M().slice())),R(this,r,n,t)),Q!==E().join("")&&(Q=r.join(""),i.trigger("change"))}},mouseenterEvent:function(e){ne=!0,i.activeElement!==this&&c.showMaskOnHover&&this.inputmask._valueGet()!==E().join("")&&R(this,E())},submitEvent:function(e){Q!==E().join("")&&W.trigger("change"),c.clearMaskOnLostFocus&&-1===v()&&Y.inputmask._valueGet&&Y.inputmask._valueGet()===M().join("")&&Y.inputmask._valueSet(""),c.removeMaskOnSubmit&&(Y.inputmask._valueSet(Y.inputmask.unmaskedvalue(),!0),setTimeout(function(){R(Y,E())},0))},resetEvent:function(e){Y.inputmask.refreshValue=!0,setTimeout(function(){W.trigger("setvalue")},0)}};if(a.prototype.positionColorMask=function(e,t){e.style.left=t.offsetLeft+"px"},r!==n)switch(r.action){case"isComplete":return Y=r.el,V(E());case"unmaskedvalue":return Y!==n&&r.value===n||(Z=r.value,Z=(e.isFunction(c.onBeforeMask)&&c.onBeforeMask.call(J,Z,c)||Z).split(""),G(n,!1,!1,X?Z.reverse():Z),e.isFunction(c.onBeforeWrite)&&c.onBeforeWrite.call(J,n,E(),0,c)),B(Y);case"mask":!function(t){re.off(t);var a=function(t,a){var r=t.getAttribute("type"),s="INPUT"===t.tagName&&-1!==e.inArray(r,a.supportsInputType)||t.isContentEditable||"TEXTAREA"===t.tagName;if(!s)if("INPUT"===t.tagName){var l=i.createElement("input");l.setAttribute("type",r),s="text"===l.type,l=null}else s="partial";return!1!==s?function(t){function r(){return this.inputmask?this.inputmask.opts.autoUnmask?this.inputmask.unmaskedvalue():-1!==v()||!0!==a.nullable?i.activeElement===this&&a.clearMaskOnLostFocus?(X?H(E().slice()).reverse():H(E().slice())).join(""):l.call(this):"":l.call(this)}function s(t){u.call(this,t),this.inputmask&&e(this).trigger("setvalue")}var l,u,c;if(!t.inputmask.__valueGet){if(!0!==a.noValuePatching){if(Object.getOwnPropertyDescriptor){"function"!=typeof Object.getPrototypeOf&&(Object.getPrototypeOf="object"===o("test".__proto__)?function(e){return e.__proto__}:function(e){return e.constructor.prototype});var p=Object.getPrototypeOf?Object.getOwnPropertyDescriptor(Object.getPrototypeOf(t),"value"):n;p&&p.get&&p.set?(l=p.get,u=p.set,Object.defineProperty(t,"value",{get:r,set:s,configurable:!0})):"INPUT"!==t.tagName&&(l=function(){return this.textContent},u=function(e){this.textContent=e},Object.defineProperty(t,"value",{get:r,set:s,configurable:!0}))}else i.__lookupGetter__&&t.__lookupGetter__("value")&&(l=t.__lookupGetter__("value"),u=t.__lookupSetter__("value"),t.__defineGetter__("value",r),t.__defineSetter__("value",s));t.inputmask.__valueGet=l,t.inputmask.__valueSet=u}t.inputmask._valueGet=function(e){return X&&!0!==e?l.call(this.el).split("").reverse().join(""):l.call(this.el)},t.inputmask._valueSet=function(e,t){u.call(this.el,null===e||e===n?"":!0!==t&&X?e.split("").reverse().join(""):e)},l===n&&(l=function(){return this.value},u=function(e){this.value=e},function(t){if(e.valHooks&&(e.valHooks[t]===n||!0!==e.valHooks[t].inputmaskpatch)){var i=e.valHooks[t]&&e.valHooks[t].get?e.valHooks[t].get:function(e){return e.value},r=e.valHooks[t]&&e.valHooks[t].set?e.valHooks[t].set:function(e,t){return e.value=t,e};e.valHooks[t]={get:function(e){if(e.inputmask){if(e.inputmask.opts.autoUnmask)return e.inputmask.unmaskedvalue();var t=i(e);return-1!==v(n,n,e.inputmask.maskset.validPositions)||!0!==a.nullable?t:""}return i(e)},set:function(t,i){var n,a=e(t);return n=r(t,i),t.inputmask&&a.trigger("setvalue"),n},inputmaskpatch:!0}}}(t.type),c=t,re.on(c,"mouseenter",function(t){var i=e(this);this.inputmask._valueGet()!==E().join("")&&i.trigger("setvalue")}))}}(t):t.inputmask=n,s}(t,c);if(!1!==a&&(W=e(Y=t),-1===($=Y!==n?Y.maxLength:n)&&($=n),!0===c.colorMask&&U(Y),p&&("inputmode"in Y&&(Y.inputmode=c.inputmode,Y.setAttribute("inputmode",c.inputmode)),!0===c.disablePredictiveText&&("autocorrect"in Y?Y.autocorrect=!1:(!0!==c.colorMask&&U(Y),Y.type="password"))),!0===a&&(re.on(Y,"submit",oe.submitEvent),re.on(Y,"reset",oe.resetEvent),re.on(Y,"mouseenter",oe.mouseenterEvent),re.on(Y,"blur",oe.blurEvent),re.on(Y,"focus",oe.focusEvent),re.on(Y,"mouseleave",oe.mouseleaveEvent),!0!==c.colorMask&&re.on(Y,"click",oe.clickEvent),re.on(Y,"dblclick",oe.dblclickEvent),re.on(Y,"paste",oe.pasteEvent),re.on(Y,"dragdrop",oe.pasteEvent),re.on(Y,"drop",oe.pasteEvent),re.on(Y,"cut",oe.cutEvent),re.on(Y,"complete",c.oncomplete),re.on(Y,"incomplete",c.onincomplete),re.on(Y,"cleared",c.oncleared),p||!0===c.inputEventOnly?Y.removeAttribute("maxLength"):(re.on(Y,"keydown",oe.keydownEvent),re.on(Y,"keypress",oe.keypressEvent)),re.on(Y,"compositionstart",e.noop),re.on(Y,"compositionupdate",e.noop),re.on(Y,"compositionend",e.noop),re.on(Y,"keyup",e.noop),re.on(Y,"input",oe.inputFallBackEvent),re.on(Y,"beforeinput",e.noop)),re.on(Y,"setvalue",oe.setValueEvent),Q=M().join(""),""!==Y.inputmask._valueGet(!0)||!1===c.clearMaskOnLostFocus||i.activeElement===Y)){var r=e.isFunction(c.onBeforeMask)&&c.onBeforeMask.call(J,Y.
21595inputmask._valueGet(!0),c)||Y.inputmask._valueGet(!0);""!==r&&G(Y,!0,!1,X?r.split("").reverse():r.split(""));var s=E().slice();Q=s.join(""),!1===V(s)&&c.clearIncomplete&&g(),c.clearMaskOnLostFocus&&i.activeElement!==Y&&(-1===v()?s=[]:H(s)),R(Y,s),i.activeElement===Y&&I(Y,F(v()))}}(Y);break;case"format":return Z=(e.isFunction(c.onBeforeMask)&&c.onBeforeMask.call(J,r.value,c)||r.value).split(""),G(n,!0,!1,X?Z.reverse():Z),r.metadata?{value:X?E().slice().reverse().join(""):E().join(""),metadata:u.call(this,{action:"getmetadata"},s,c)}:X?E().slice().reverse().join(""):E().join("");case"isValid":r.value?(Z=r.value.split(""),G(n,!0,!0,X?Z.reverse():Z)):r.value=E().join("");for(var se=E(),le=L(),ue=se.length-1;ue>le&&!j(ue);ue--);return se.splice(le,ue+1-le),V(se)&&r.value===E().join("");case"getemptymask":return M().join("");case"remove":return Y&&Y.inputmask&&(W=e(Y),Y.inputmask._valueSet(c.autoUnmask?B(Y):Y.inputmask._valueGet(!0)),re.off(Y),Y.inputmask.colorMask&&((q=Y.inputmask.colorMask).removeChild(Y),q.parentNode.insertBefore(Y,q),q.parentNode.removeChild(q)),Object.getOwnPropertyDescriptor&&Object.getPrototypeOf?Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Y),"value")&&Y.inputmask.__valueGet&&Object.defineProperty(Y,"value",{get:Y.inputmask.__valueGet,set:Y.inputmask.__valueSet,configurable:!0}):i.__lookupGetter__&&Y.__lookupGetter__("value")&&Y.inputmask.__valueGet&&(Y.__defineGetter__("value",Y.inputmask.__valueGet),Y.__defineSetter__("value",Y.inputmask.__valueSet)),Y.inputmask=n),Y;case"getmetadata":if(e.isArray(s.metadata)){var ce=d(!0,0,!1).join("");return e.each(s.metadata,function(e,t){if(t.mask===ce)return ce=t,!1}),ce}return s.metadata}}var c=navigator.userAgent,p=l("touchstart"),f=/iemobile/i.test(c),m=/iphone/i.test(c)&&!f;return a.prototype={dataAttribute:"data-inputmask",defaults:{placeholder:"_",optionalmarker:["[","]"],quantifiermarker:["{","}"],groupmarker:["(",")"],alternatormarker:"|",escapeChar:"\\",mask:null,regex:null,oncomplete:e.noop,onincomplete:e.noop,oncleared:e.noop,repeat:0,greedy:!0,autoUnmask:!1,removeMaskOnSubmit:!1,clearMaskOnLostFocus:!0,insertMode:!0,clearIncomplete:!1,alias:null,onKeyDown:e.noop,onBeforeMask:null,onBeforePaste:function(t,i){return e.isFunction(i.onBeforeMask)?i.onBeforeMask.call(this,t,i):t},onBeforeWrite:null,onUnMask:null,showMaskOnFocus:!0,showMaskOnHover:!0,onKeyValidation:e.noop,skipOptionalPartCharacter:" ",numericInput:!1,rightAlign:!1,undoOnEscape:!0,radixPoint:"",radixPointDefinitionSymbol:n,groupSeparator:"",keepStatic:null,positionCaretOnTab:!0,tabThrough:!1,supportsInputType:["text","tel","password","search"],ignorables:[8,9,13,19,27,33,34,35,36,37,38,39,40,45,46,93,112,113,114,115,116,117,118,119,120,121,122,123,0,229],isComplete:null,canClearPosition:e.noop,preValidation:null,postValidation:null,staticDefinitionSymbol:n,jitMasking:!1,nullable:!0,inputEventOnly:!1,noValuePatching:!1,positionCaretOnClick:"lvp",casing:null,inputmode:"verbatim",colorMask:!1,disablePredictiveText:!1,importDataAttributes:!0},definitions:{9:{validator:"[0-91-9]",definitionSymbol:"*"},a:{validator:"[A-Za-zÀ-ÿ¨¸A-yµ]",definitionSymbol:"*"},"*":{validator:"[0-91-9A-Za-zÀ-ÿ¨¸A-yµ]"}},aliases:{},masksCache:{},mask:function(o){var l=this;return"string"==typeof o&&(o=i.getElementById(o)||i.querySelectorAll(o)),o=o.nodeName?[o]:o,e.each(o,function(i,o){var c=e.extend(!0,{},l.opts);if(function(i,a,o,s){if(!0===a.importDataAttributes){var l,u,c,p,f=function(e,a){null!==(a=a!==n?a:i.getAttribute(s+"-"+e))&&("string"==typeof a&&(0===e.indexOf("on")?a=t[a]:"false"===a?a=!1:"true"===a&&(a=!0)),o[e]=a)},m=i.getAttribute(s);if(m&&""!==m&&(m=m.replace(/'/g,'"'),u=JSON.parse("{"+m+"}")),u){c=n;for(p in u)if("alias"===p.toLowerCase()){c=u[p];break}}f("alias",c),o.alias&&r(o.alias,o,a);for(l in a){if(u){c=n;for(p in u)if(p.toLowerCase()===l.toLowerCase()){c=u[p];break}}f(l,c)}}return e.extend(!0,a,o),("rtl"===i.dir||a.rightAlign)&&(i.style.textAlign="right"),("rtl"===i.dir||a.numericInput)&&(i.dir="ltr",i.removeAttribute("dir"),a.isRTL=!0),Object.keys(o).length}(o,c,e.extend(!0,{},l.userOptions),l.dataAttribute)){var p=s(c,l.noMasksCache);p!==n&&(o.inputmask!==n&&(o.inputmask.opts.autoUnmask=!0,o.inputmask.remove()),o.inputmask=new a(n,n,!0),o.inputmask.opts=c,o.inputmask.noMasksCache=l.noMasksCache,o.inputmask.userOptions=e.extend(!0,{},l.userOptions),o.inputmask.isRTL=c.isRTL||c.numericInput,o.inputmask.el=o,o.inputmask.maskset=p,e.data(o,"_inputmask_opts",c),u.call(o.inputmask,{action:"mask"}))}}),o&&o[0]&&o[0].inputmask||this},option:function(t,i){return"string"==typeof t?this.opts[t]:"object"===(void 0===t?"undefined":o(t))?(e.extend(this.userOptions,t),this.el&&!0!==i&&this.mask(this.el),this):void 0},unmaskedvalue:function(e){return this.maskset=this.maskset||s(this.opts,this.noMasksCache),u.call(this,{action:"unmaskedvalue",value:e})},remove:function(){return u.call(this,{action:"remove"})},getemptymask:function(){return this.maskset=this.maskset||s(this.opts,this.noMasksCache),u.call(this,{action:"getemptymask"})},hasMaskedValue:function(){return!this.opts.autoUnmask},isComplete:function(){return this.maskset=this.maskset||s(this.opts,this.noMasksCache),u.call(this,{action:"isComplete"})},getmetadata:function(){return this.maskset=this.maskset||s(this.opts,this.noMasksCache),u.call(this,{action:"getmetadata"})},isValid:function(e){return this.maskset=this.maskset||s(this.opts,this.noMasksCache),u.call(this,{action:"isValid",value:e})},format:function(e,t){return this.maskset=this.maskset||s(this.opts,this.noMasksCache),u.call(this,{action:"format",value:e,metadata:t})},analyseMask:function(t,i,r){function o(e,t,i,n){this.matches=[],this.openGroup=e||!1,this.alternatorGroup=!1,this.isGroup=e||!1,this.isOptional=t||!1,this.isQuantifier=i||!1,this.isAlternator=n||!1,this.quantifier={min:1,max:1}}function s(t,o,s){s=s!==n?s:t.matches.length;var l=t.matches[s-1];if(i)0===o.indexOf("[")||k&&/\\d|\\s|\\w]/i.test(o)||"."===o?t.matches.splice(s++,0,{fn:new RegExp(o,r.casing?"i":""),optionality:t.isOptional,newBlockMarker:l===n||l.def!==o,casing:null,def:o,placeholder:n,nativeDef:o}):(k&&(o=o[o.length-1]),e.each(o.split(""),function(e,i){l=t.matches[s-1],t.matches.splice(s++,0,{fn:null,optionality:t.isOptional,newBlockMarker:l===n||l.def!==i&&null!==l.fn,casing:null,def:r.staticDefinitionSymbol||i,placeholder:r.staticDefinitionSymbol!==n?i:n,nativeDef:i})})),k=!1;else{var u=(r.definitions?r.definitions[o]:n)||a.prototype.definitions[o];u&&!k?t.matches.splice(s++,0,{fn:u.validator?"string"==typeof u.validator?new RegExp(u.validator,r.casing?"i":""):new function(){this.test=u.validator}:new RegExp("."),optionality:t.isOptional,newBlockMarker:l===n||l.def!==(u.definitionSymbol||o),casing:u.casing,def:u.definitionSymbol||o,placeholder:u.placeholder,nativeDef:o}):(t.matches.splice(s++,0,{fn:null,optionality:t.isOptional,newBlockMarker:l===n||l.def!==o&&null!==l.fn,casing:null,def:r.staticDefinitionSymbol||o,placeholder:r.staticDefinitionSymbol!==n?o:n,nativeDef:o}),k=!1)}}function l(){if(b.length>0){if(s(f=b[b.length-1],c),f.isAlternator){m=b.pop();for(var e=0;e<m.matches.length;e++)m.matches[e].isGroup=!1;b.length>0?(f=b[b.length-1]).matches.push(m):y.matches.push(m)}}else s(y,c)}var u,c,p,f,m,d,h,g=/(?:[?*+]|\{[0-9\+\*]+(?:,[0-9\+\*]*)?\})|[^.?*+^${[]()|\\]+|./g,v=/\[\^?]?(?:[^\\\]]+|\\[\S\s]?)*]?|\\(?:0(?:[0-3][0-7]{0,2}|[4-7][0-7]?)?|[1-9][0-9]*|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|c[A-Za-z]|[\S\s]?)|\((?:\?[:=!]?)?|(?:[?*+]|\{[0-9]+(?:,[0-9]*)?\})\??|[^.?*+^${[()|\\]+|./g,k=!1,y=new o,b=[],x=[];for(i&&(r.optionalmarker[0]=n,r.optionalmarker[1]=n);u=i?v.exec(t):g.exec(t);){if(c=u[0],i)switch(c.charAt(0)){case"?":c="{0,1}";break;case"+":case"*":c="{"+c+"}"}if(k)l();else switch(c.charAt(0)){case r.escapeChar:k=!0,i&&l();break;case r.optionalmarker[1]:case r.groupmarker[1]:if((p=b.pop()).openGroup=!1,p!==n)if(b.length>0){if((f=b[b.length-1]).matches.push(p),f.isAlternator){m=b.pop();for(var P=0;P<m.matches.length;P++)m.matches[P].isGroup=!1,m.matches[P].alternatorGroup=!1;b.length>0?(f=b[b.length-1]).matches.push(m):y.matches.push(m)}}else y.matches.push(p);else l();break;case r.optionalmarker[0]:b.push(new o(!1,!0));break;case r.groupmarker[0]:b.push(new o(!0));break;case r.quantifiermarker[0]:var S=new o(!1,!1,!0),A=(c=c.replace(/[{}]/g,"")).split(","),C=isNaN(A[0])?A[0]:parseInt(A[0]),M=1===A.length?C:isNaN(A[1])?A[1]:parseInt(A[1]);if("*"!==M&&"+"!==M||(C="*"===M?0:1),S.quantifier={min:C,max:M},b.length>0){var E=b[b.length-1].matches;(u=E.pop()).isGroup||((h=new o(!0)).matches.push(u),u=h),E.push(u),E.push(S)}else(u=y.matches.pop()).isGroup||(i&&null===u.fn&&"."===u.def&&(u.fn=new RegExp(u.def,r.casing?"i":"")),(h=new o(!0)).matches.push(u),u=h),y.matches.push(u),y.matches.push(S);break;case r.alternatormarker:if(b.length>0){var w=(f=b[b.length-1]).matches[f.matches.length-1];
21595d=f.openGroup&&(w.matches===n||!1===w.isGroup&&!1===w.isAlternator)?b.pop():f.matches.pop()}else d=y.matches.pop();if(d.isAlternator)b.push(d);else if(d.alternatorGroup?(m=b.pop(),d.alternatorGroup=!1):m=new o(!1,!1,!1,!0),m.matches.push(d),b.push(m),d.openGroup){d.openGroup=!1;var D=new o(!0);D.alternatorGroup=!0,b.push(D)}break;default:l()}}for(;b.length>0;)p=b.pop(),y.matches.push(p);return y.matches.length>0&&(function t(a){a&&a.matches&&e.each(a.matches,function(e,o){var l=a.matches[e+1];(l===n||l.matches===n||!1===l.isQuantifier)&&o&&o.isGroup&&(o.isGroup=!1,i||(s(o,r.groupmarker[0],0),!0!==o.openGroup&&s(o,r.groupmarker[1]))),t(o)})}(y),x.push(y)),(r.numericInput||r.isRTL)&&function e(t){t.matches=t.matches.reverse();for(var i in t.matches)if(t.matches.hasOwnProperty(i)){var a=parseInt(i);if(t.matches[i].isQuantifier&&t.matches[a+1]&&t.matches[a+1].isGroup){var o=t.matches[i];t.matches.splice(i,1),t.matches.splice(a+1,0,o)}t.matches[i].matches!==n?t.matches[i]=e(t.matches[i]):t.matches[i]=function(e){return e===r.optionalmarker[0]?e=r.optionalmarker[1]:e===r.optionalmarker[1]?e=r.optionalmarker[0]:e===r.groupmarker[0]?e=r.groupmarker[1]:e===r.groupmarker[1]&&(e=r.groupmarker[0]),e}(t.matches[i])}return t}(x[0]),x}},a.extendDefaults=function(t){e.extend(!0,a.prototype.defaults,t)},a.extendDefinitions=function(t){e.extend(!0,a.prototype.definitions,t)},a.extendAliases=function(t){e.extend(!0,a.prototype.aliases,t)},a.format=function(e,t,i){return a(t).format(e,i)},a.unmask=function(e,t){return a(t).unmaskedvalue(e)},a.isValid=function(e,t){return a(t).isValid(e)},a.remove=function(t){e.each(t,function(e,t){t.inputmask&&t.inputmask.remove()})},a.escapeRegex=function(e){return e.replace(new RegExp("(\\"+["/",".","*","+","?","|","(",")","[","]","{","}","\\","$","^"].join("|\\")+")","gim"),"\\$1")},a.keyCode={BACKSPACE:8,BACKSPACE_SAFARI:127,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,RIGHT:39,SPACE:32,TAB:9,UP:38,X:88,CONTROL:17},a})?n.apply(t,a):n)&&(e.exports=r)},function(e,t){e.exports=jQuery},function(e,t,i){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}i(4),i(7),i(8),i(9);var a=n(i(1)),r=n(i(0)),o=n(i(2));r.default===o.default&&i(10),window.Inputmask=a.default},function(e,t,i){"use strict";var n,a,r;"function"==typeof Symbol&&Symbol.iterator,a=[i(0),i(1)],void 0!==(r="function"==typeof(n=function(e,t){function i(e){if(!e.tokenizer){var t=[];for(var i in o)-1===t.indexOf(i[0])&&t.push(i[0]);e.tokenizer="("+t.join("+|")+")+?|.",e.tokenizer=new RegExp(e.tokenizer,"g")}return e.tokenizer}function n(e,n,a){for(var r,s="";r=i(a).exec(e);)void 0===n?s+=o[r[0]]?"("+o[r[0]][0]+")":t.escapeRegex(r[0]):o[r[0]]?s+=o[r[0]][3].call(n.date):s+=r[0];return s}function a(e,t){for(e=String(e),t=t||2;e.length<t;)e="0"+e;return e}function r(e,t,n){var a,r,s,l,u,c,p,f,m={date:new Date(1,0,1)},d=e;if("string"==typeof d){for(;r=i(n).exec(t);){var h=d.slice(0,r[0].length);o.hasOwnProperty(r[0])&&(a=o[r[0]][2],s=o[r[0]][1],l=m,u=h,c=n,p=void 0,f=void 0,"year"===a?(l[a]=(f=4===(p=u).length?p:(new Date).getFullYear().toString().substr(0,4-p.length)+p,n.min&&n.min.year&&n.max&&n.max.year?(f=f.replace(/[^0-9]/g,""),f=p.charAt(0)===n.max.year.charAt(0)?p.replace(/[^0-9]/g,"0"):f+n.min.year.substr(f.length)):f=f.replace(/[^0-9]/g,"0"),f),l["raw"+a]=u):l[a]=c.min&&u.match(/[^0-9]/)?c.min[a]:u,void 0!==s&&s.call(l.date,"month"==a?parseInt(l[a])-1:l[a])),d=d.slice(h.length)}return m}}var o={d:["[1-9]|[12][0-9]|3[01]",Date.prototype.setDate,"day",Date.prototype.getDate],dd:["0[1-9]|[12][0-9]|3[01]",Date.prototype.setDate,"day",function(){return a(Date.prototype.getDate.call(this),2)}],ddd:[""],dddd:[""],m:["[1-9]|1[012]",Date.prototype.setMonth,"month",function(){return Date.prototype.getMonth.call(this)+1}],mm:["0[1-9]|1[012]",Date.prototype.setMonth,"month",function(){return a(Date.prototype.getMonth.call(this)+1,2)}],mmm:[""],mmmm:[""],yy:["[0-9]{2}",Date.prototype.setFullYear,"year",function(){return a(Date.prototype.getFullYear.call(this),2)}],yyyy:["[0-9]{4}",Date.prototype.setFullYear,"year",function(){return a(Date.prototype.getFullYear.call(this),4)}],h:["[1-9]|1[0-2]",Date.prototype.setHours,"hours",Date.prototype.getHours],hh:["0[1-9]|1[0-2]",Date.prototype.setHours,"hours",function(){return a(Date.prototype.getHours.call(this),2)}],hhh:["[0-9]+",Date.prototype.setHours,"hours",Date.prototype.getHours],H:["1?[0-9]|2[0-3]",Date.prototype.setHours,"hours",Date.prototype.getHours],HH:["[01][0-9]|2[0-3]",Date.prototype.setHours,"hours",function(){return a(Date.prototype.getHours.call(this),2)}],HHH:["[0-9]+",Date.prototype.setHours,"hours",Date.prototype.getHours],M:["[1-5]?[0-9]",Date.prototype.setMinutes,"minutes",Date.prototype.getMinutes],MM:["[0-5][0-9]",Date.prototype.setMinutes,"minutes",function(){return a(Date.prototype.getMinutes.call(this),2)}],s:["[1-5]?[0-9]",Date.prototype.setSeconds,"seconds",Date.prototype.getSeconds],ss:["[0-5][0-9]",Date.prototype.setSeconds,"seconds",function(){return a(Date.prototype.getSeconds.call(this),2)}],l:["[0-9]{3}",Date.prototype.setMilliseconds,"milliseconds",function(){return a(Date.prototype.getMilliseconds.call(this),3)}],L:["[0-9]{2}",Date.prototype.setMilliseconds,"milliseconds",function(){return a(Date.prototype.getMilliseconds.call(this),2)}],t:[""],tt:[""],T:[""],TT:[""],Z:[""],o:[""],S:[""]},s={isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:ss",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"};return t.extendAliases({datetime:{mask:function(e){return e.inputFormat=s[e.inputFormat]||e.inputFormat,e.displayFormat=s[e.displayFormat]||e.displayFormat||e.inputFormat,e.outputFormat=s[e.outputFormat]||e.outputFormat||e.inputFormat,e.placeholder=e.placeholder!==t.prototype.defaults.placeholder?e.placeholder:e.inputFormat,e.min=r(e.min,e.inputFormat,e),e.max=r(e.max,e.inputFormat,e),e.regex=n(e.inputFormat,void 0,e),null},inputFormat:"isoDateTime",displayFormat:void 0,outputFormat:void 0,min:null,max:null,i18n:{dayNames:["Mon","Tue","Wed","Thu","Fri","Sat","Sun","Monday","Tuesday","Wednesday","Thursday","Frid
21595ay","Saturday","Sunday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"]},postValidation:function(e,t,i){var n,a,o,s,l,u=t,c=r(e.join(""),i.inputFormat,i);return u&&c.date.getTime()==c.date.getTime()&&(s=c,l=u,u=(u=(!isFinite(s.day)||"29"==s.day&&!isFinite(s.rawyear)||new Date(s.date.getFullYear(),isFinite(s.month)?s.month:s.date.getMonth()+1,0).getDate()>=s.day)&&l)&&(n=c.date,o=!0,(a=i).min&&a.min.date.getTime()==a.min.date.getTime()&&(o=o&&a.min.date.getTime()<=n.getTime()),a.max&&a.max.date.getTime()==a.max.date.getTime()&&(o=o&&a.max.date.getTime()>=n.getTime()),o)),u},onKeyDown:function(n,r,o,s){if(n.ctrlKey&&n.keyCode===t.keyCode.RIGHT){for(var l,u=new Date,c="";l=i(s).exec(s.inputFormat);)"d"===l[0].charAt(0)?c+=a(u.getDate(),l[0].length):"m"===l[0].charAt(0)?c+=a(u.getMonth()+1,l[0].length):"yyyy"===l[0]?c+=u.getFullYear().toString():"y"===l[0].charAt(0)&&(c+=a(u.getYear(),l[0].length));this.inputmask._valueSet(c),e(this).trigger("setvalue")}},onUnMask:function(e,t,i){return n(i.outputFormat,r(e,i.inputFormat,i),i)},insertMode:!1}}),t})?n.apply(t,a):n)&&(e.exports=r)},function(e,t,i){"use strict";var n;"function"==typeof Symbol&&Symbol.iterator,void 0!==(n=function(){return window}.call(t,i,t,e))&&(e.exports=n)},function(e,t,i){"use strict";var n;"function"==typeof Symbol&&Symbol.iterator,void 0!==(n=function(){return document}.call(t,i,t,e))&&(e.exports=n)},function(e,t,i){"use strict";var n,a,r;"function"==typeof Symbol&&Symbol.iterator,a=[i(0),i(1)],void 0!==(r="function"==typeof(n=function(e,t){return t.extendDefinitions({A:{validator:"[A-Za-zÀ-ÿ¨¸A-yµ]",casing:"upper"},"&":{validator:"[0-9A-Za-zÀ-ÿ¨¸A-yµ]",casing:"upper"},"#":{validator:"[0-9A-Fa-f]",casing:"upper"}}),t.extendAliases({url:{definitions:{i:{validator:"."}},mask:"(\\http://)|(\\http\\s://)|(ftp://)|(ftp\\s://)i{+}",insertMode:!1,autoUnmask:!1,inputmode:"url"},ip:{mask:"i[i[i]].i[i[i]].i[i[i]].i[i[i]]",definitions:{i:{validator:function(e,t,i,n,a){return i-1>-1&&"."!==t.buffer[i-1]?(e=t.buffer[i-1]+e,e=i-2>-1&&"."!==t.buffer[i-2]?t.buffer[i-2]+e:"0"+e):e="00"+e,new RegExp("25[0-5]|2[0-4][0-9]|[01][0-9][0-9]").test(e)}}},onUnMask:function(e,t,i){return e},inputmode:"numeric"},email:{mask:"*{1,64}[.*{1,64}][.*{1,64}][.*{1,63}]@-{1,63}.-{1,63}[.-{1,63}][.-{1,63}]",greedy:!1,onBeforePaste:function(e,t){return(e=e.toLowerCase()).replace("mailto:","")},definitions:{"*":{validator:"[0-9A-Za-z!#$%&'*+/=?^_`{|}~-]",casing:"lower"},"-":{validator:"[0-9A-Za-z-]",casing:"lower"}},onUnMask:function(e,t,i){return e},inputmode:"email"},mac:{mask:"##:##:##:##:##:##"},vin:{mask:"V{13}9{4}",definitions:{V:{validator:"[A-HJ-NPR-Za-hj-npr-z\\d]",casing:"upper"}},clearIncomplete:!0,autoUnmask:!0}}),t})?n.apply(t,a):n)&&(e.exports=r)},function(e,t,i){"use strict";var n,a,r;"function"==typeof Symbol&&Symbol.iterator,a=[i(0),i(1)],void 0!==(r="function"==typeof(n=function(e,t,i){function n(e,i){for(var n="",a=0;a<e.length;a++)t.prototype.definitions[e.charAt(a)]||i.definitions[e.charAt(a)]||i.optionalmarker.start===e.charAt(a)||i.optionalmarker.end===e.charAt(a)||i.quantifiermarker.start===e.charAt(a)||i.quantifiermarker.end===e.charAt(a)||i.groupmarker.start===e.charAt(a)||i.groupmarker.end===e.charAt(a)||i.alternatormarker===e.charAt(a)?n+="\\"+e.charAt(a):n+=e.charAt(a);return n}return t.extendAliases({numeric:{mask:function(e){if(0!==e.repeat&&isNaN(e.integerDigits)&&(e.integerDigits=e.repeat),e.repeat=0,e.groupSeparator===e.radixPoint&&e.digits&&"0"!==e.digits&&("."===e.radixPoint?e.groupSeparator=",":","===e.radixPoint?e.groupSeparator=".":e.groupSeparator="")," "===e.groupSeparator&&(e.skipOptionalPartCharacter=i),e.autoGroup=e.autoGroup&&""!==e.groupSeparator,e.autoGroup&&("string"==typeof e.groupSize&&isFinite(e.groupSize)&&(e.groupSize=parseInt(e.groupSize)),isFinite(e.integerDigits))){var t=Math.floor(e.integerDigits/e.groupSize),a=e.integerDigits%e.groupSize;e.integerDigits=parseInt(e.integerDigits)+(0===a?t-1:t),e.integerDigits<1&&(e.integerDigits="*")}e.placeholder.length>1&&(e.placeholder=e.placeholder.charAt(0)),"radixFocus"===e.positionCaretOnClick&&""===e.placeholder&&!1===e.integerOptional&&(e.positionCaretOnClick="lvp"),e.definitions[";"]=e.definitions["~"],e.definitions[";
21595"].definitionSymbol="~",!0===e.numericInput&&(e.positionCaretOnClick="radixFocus"===e.positionCaretOnClick?"lvp":e.positionCaretOnClick,e.digitsOptional=!1,isNaN(e.digits)&&(e.digits=2),e.decimalProtect=!1);var r="[+]";if(r+=n(e.prefix,e),!0===e.integerOptional?r+="~{1,"+e.integerDigits+"}":r+="~{"+e.integerDigits+"}",e.digits!==i){e.radixPointDefinitionSymbol=e.decimalProtect?":":e.radixPoint;var o=e.digits.toString().split(",");isFinite(o[0]&&o[1]&&isFinite(o[1]))?r+=e.radixPointDefinitionSymbol+";{"+e.digits+"}":(isNaN(e.digits)||parseInt(e.digits)>0)&&(e.digitsOptional?r+="["+e.radixPointDefinitionSymbol+";{1,"+e.digits+"}]":r+=e.radixPointDefinitionSymbol+";{"+e.digits+"}")}return r+=n(e.suffix,e),r+="[-]",e.greedy=!1,r},placeholder:"",greedy:!1,digits:"*",digitsOptional:!0,enforceDigitsOnBlur:!1,radixPoint:".",positionCaretOnClick:"radixFocus",groupSize:3,groupSeparator:"",autoGroup:!1,allowMinus:!0,negationSymbol:{front:"-",back:""},integerDigits:"+",integerOptional:!0,prefix:"",suffix:"",rightAlign:!0,decimalProtect:!0,min:null,max:null,step:1,insertMode:!0,autoUnmask:!1,unmaskAsNumber:!1,inputmode:"numeric",preValidation:function(t,n,a,r,o){if("-"===a||a===o.negationSymbol.front)return!0===o.allowMinus&&(o.isNegative=o.isNegative===i||!o.isNegative,""===t.join("")||{caret:n,dopost:!0});if(!1===r&&a===o.radixPoint&&o.digits!==i&&(isNaN(o.digits)||parseInt(o.digits)>0)){var s=e.inArray(o.radixPoint,t);if(-1!==s)return!0===o.numericInput?n===s:{caret:s+1}}return!0},postValidation:function(n,a,r){var o=r.suffix.split(""),s=r.prefix.split("");if(a.pos===i&&a.caret!==i&&!0!==a.dopost)return a;var l=a.caret!==i?a.caret:a.pos,u=n.slice();r.numericInput&&(l=u.length-l-1,u=u.reverse());var c=u[l];if(c===r.groupSeparator&&(c=u[l+=1]),l===u.length-r.suffix.length-1&&c===r.radixPoint)return a;c!==i&&c!==r.radixPoint&&c!==r.negationSymbol.front&&c!==r.negationSymbol.back&&(u[l]="?",r.prefix.length>0&&l>=(!1===r.isNegative?1:0)&&l<r.prefix.length-1+(!1===r.isNegative?1:0)?s[l-(!1===r.isNegative?1:0)]="?":r.suffix.length>0&&l>=u.length-r.suffix.length-(!1===r.isNegative?1:0)&&(o[l-(u.length-r.suffix.length-(!1===r.isNegative?1:0))]="?")),s=s.join(""),o=o.join("");var p=u.join("").replace(s,"");if(p=(p=(p=(p=p.replace(o,"")).replace(new RegExp(t.escapeRegex(r.groupSeparator),"g"),"")).replace(new RegExp("[-"+t.escapeRegex(r.negationSymbol.front)+"]","g"),"")).replace(new RegExp(t.escapeRegex(r.negationSymbol.back)+"$"),""),isNaN(r.placeholder)&&(p=p.replace(new RegExp(t.escapeRegex(r.placeholder),"g"),"")),p.length>1&&1!==p.indexOf(r.radixPoint)&&("0"===c&&(p=p.replace(/^\?/g,"")),p=p.replace(/^0/g,"")),p.charAt(0)===r.radixPoint&&""!==r.radixPoint&&!0!==r.numericInput&&(p="0"+p),""!==p){if(p=p.split(""),(!r.digitsOptional||r.enforceDigitsOnBlur&&"blur"===a.event)&&isFinite(r.digits)){var f=e.inArray(r.radixPoint,p),m=e.inArray(r.radixPoint,u);-1===f&&(p.push(r.radixPoint),f=p.length-1);for(var d=1;d<=r.digits;d++)r.digitsOptional&&(!r.enforceDigitsOnBlur||"blur"!==a.event)||p[f+d]!==i&&p[f+d]!==r.placeholder.charAt(0)?-1!==m&&u[m+d]!==i&&(p[f+d]=p[f+d]||u[m+d]):p[f+d]=a.placeholder||r.placeholder.charAt(0)}if(!0!==r.autoGroup||""===r.groupSeparator||c===r.radixPoint&&a.pos===i&&!a.dopost)p=p.join("");else{var h=p[p.length-1]===r.radixPoint&&a.c===r.radixPoint;p=t(function(e,t){var i="";if(i+="("+t.groupSeparator+"*{"+t.groupSize+"}){*}",""!==t.radixPoint){var n=e.join("").split(t.radixPoint);n[1]&&(i+=t.radixPoint+"*{"+n[1].match(/^\d*\??\d*/)[0].length+"}")}return i}(p,r),{numericInput:!0,jitMasking:!0,definitions:{"*":{validator:"[0-9?]",cardinality:1}}}).format(p.join("")),h&&(p+=r.radixPoint),p.charAt(0)===r.groupSeparator&&p.substr(1)}}if(r.isNegative&&"blur"===a.event&&(r.isNegative="0"!==p),p=s+p,p+=o,r.isNegative&&(p=r.negationSymbol.front+p,p+=r.negationSymbol.back),p=p.split(""),c!==i)if(c!==r.radixPoint&&c!==r.negationSymbol.front&&c!==r.negationSymbol.back)(l=e.inArray("?",p))>-1?p[l]=c:l=a.caret||0;else if(c===r.radixPoint||c===r.negationSymbol.front||c===r.negationSymbol.back){var g=e.inArray(c,p);-1!==g&&(l=g)}r.numericInput&&(l=p.length-l-1,p=p.reverse());var v={caret:c===i||a.pos!==i?l+(r.numericInput?-1:1):l,buffer:p,refreshFromBuffer:a.dopost||n.join("")!==p.join("")};return v.refreshFromBuffer?v:a},onBeforeWrite:function(n,a,r,o){if(n)switch(n.type){case"keydown":return o.postValidation(a,{caret:r,dopost:!0},o);case"blur":case"checkval":var s;if((l=o).parseMinMaxOptions===i&&(null!==l.min&&(l.min=l.min.toString().replace(new RegExp(t.escapeRegex(l.groupSeparator),"g"),""),","===l.radixPoint&&(l.min=l.min.replace(l.radixPoint,".")),l.min=isFinite(l.min)?parseFloat(l.min):NaN,isNaN(l.min)&&(l.min=Number.MIN_VALUE)),null!==l.max&&(l.max=l.max.toString().replace(new RegExp(t.escapeRegex(l.groupSeparator),"g"),""),","===l.radixPoint&&(l.max=l.max.replace(l.radixPoint,".")),l.max=isFinite(l.max)?parseFloat(l.max):NaN,isNaN(l.max)&&(l.max=Number.MAX_VALUE)),l.parseMinMaxOptions="done"),null!==o.min||null!==o.max){if(s=o.onUnMask(a.join(""),i,e.extend({},o,{unmaskAsNumber:!0})),null!==o.min&&s<o.min)return o.isNegative=o.min<0,o.postValidation(o.min.toString().replace(".",o.radixPoint).split(""),{caret:r,dopost:!0,placeholder:"0"},o);if(null!==o.max&&s>o.max)return o.isNegative=o.max<0,o.postValidation(o.max.toString().replace(".",o.radixPoint).split(""),{caret:r,dopost:!0,placeholder:"0"},o)}return o.postValidation(a,{caret:r,placeholder:"0",event:"blur"},o);case"_checkval":return{caret:r}}var l},regex:{integerPart:function(e,i){return i?new RegExp("["+t.escapeRegex(e.negationSymbol.front)+"+]?"):new RegExp("["+t.escapeRegex(e.negationSymbol.front)+"+]?\\d+")},integerNPart:function(e){return new RegExp("[\\d"+t.escapeRegex(e.groupSeparator)+t.escapeRegex(e.placeholder.charAt(0))+"]+")}},definitions:{"~":{validator:function(e,n,a,r,o,s){var l=r?new RegExp("[0-9"+t.escapeRegex(o.groupSeparator)+"]").test(e):new RegExp("[0-9]").test(e);
21595if(!0===l){if(!0!==o.numericInput&&n.validPositions[a]!==i&&"~"===n.validPositions[a].match.def&&!s){var u=n.buffer.join(""),c=(u=(u=u.replace(new RegExp("[-"+t.escapeRegex(o.negationSymbol.front)+"]","g"),"")).replace(new RegExp(t.escapeRegex(o.negationSymbol.back)+"$"),"")).split(o.radixPoint);c.length>1&&(c[1]=c[1].replace(/0/g,o.placeholder.charAt(0))),"0"===c[0]&&(c[0]=c[0].replace(/0/g,o.placeholder.charAt(0))),u=c[0]+o.radixPoint+c[1]||"";var p=n._buffer.join("");for(u===o.radixPoint&&(u=p);null===u.match(t.escapeRegex(p)+"$");)p=p.slice(1);l=(u=(u=u.replace(p,"")).split(""))[a]===i?{pos:a,remove:a}:{pos:a}}}else r||e!==o.radixPoint||n.validPositions[a-1]!==i||(n.buffer[a]="0",l={pos:a+1});return l},cardinality:1},"+":{validator:function(e,t,i,n,a){return a.allowMinus&&("-"===e||e===a.negationSymbol.front)},cardinality:1,placeholder:""},"-":{validator:function(e,t,i,n,a){return a.allowMinus&&e===a.negationSymbol.back},cardinality:1,placeholder:""},":":{validator:function(e,i,n,a,r){var o="["+t.escapeRegex(r.radixPoint)+"]",s=new RegExp(o).test(e);return s&&i.validPositions[n]&&i.validPositions[n].match.placeholder===r.radixPoint&&(s={caret:n+1}),s},cardinality:1,placeholder:function(e){return e.radixPoint}}},onUnMask:function(e,i,n){if(""===i&&!0===n.nullable)return i;var a=e.replace(n.prefix,"");return a=(a=a.replace(n.suffix,"")).replace(new RegExp(t.escapeRegex(n.groupSeparator),"g"),""),""!==n.placeholder.charAt(0)&&(a=a.replace(new RegExp(n.placeholder.charAt(0),"g"),"0")),n.unmaskAsNumber?(""!==n.radixPoint&&-1!==a.indexOf(n.radixPoint)&&(a=a.replace(t.escapeRegex.call(this,n.radixPoint),".")),a=(a=a.replace(new RegExp("^"+t.escapeRegex(n.negationSymbol.front)),"-")).replace(new RegExp(t.escapeRegex(n.negationSymbol.back)+"$"),""),Number(a)):a},isComplete:function(e,i){var n=e.join("");if(e.slice().join("")!==n)return!1;var a=n.replace(i.prefix,"");return a=(a=a.replace(i.suffix,"")).replace(new RegExp(t.escapeRegex(i.groupSeparator)+"([0-9]{3})","g"),"$1"),","===i.radixPoint&&(a=a.replace(t.escapeRegex(i.radixPoint),".")),isFinite(a)},onBeforeMask:function(e,n){if(n.isNegative=i,e=e.toString().charAt(e.length-1)===n.radixPoint?e.toString().substr(0,e.length-1):e.toString(),""!==n.radixPoint&&isFinite(e)){var a=e.split("."),r=""!==n.groupSeparator?parseInt(n.groupSize):0;2===a.length&&(a[0].length>r||a[1].length>r||a[0].length<=r&&a[1].length<r)&&(e=e.replace(".",n.radixPoint))}var o=e.match(/,/g),s=e.match(/\./g);if(e=s&&o?s.length>o.length?(e=e.replace(/\./g,"")).replace(",",n.radixPoint):o.length>s.length?(e=e.replace(/,/g,"")).replace(".",n.radixPoint):e.indexOf(".")<e.indexOf(",")?e.replace(/\./g,""):e.replace(/,/g,""):e.replace(new RegExp(t.escapeRegex(n.groupSeparator),"g"),""),0===n.digits&&(-1!==e.indexOf(".")?e=e.substring(0,e.indexOf(".")):-1!==e.indexOf(",")&&(e=e.substring(0,e.indexOf(",")))),""!==n.radixPoint&&isFinite(n.digits)&&-1!==e.indexOf(n.radixPoint)){var l=e.split(n.radixPoint)[1].match(new RegExp("\\d*"))[0];if(parseInt(n.digits)<l.toString().length){var u=Math.pow(10,parseInt(n.digits));e=e.replace(t.escapeRegex(n.radixPoint),"."),e=(e=Math.round(parseFloat(e)*u)/u).toString().replace(".",n.radixPoint)}}return e},canClearPosition:function(e,t,i,n,a){var r=e.validPositions[t],o=r.input!==a.radixPoint||null!==e.validPositions[t].match.fn&&!1===a.decimalProtect||r.input===a.radixPoint&&e.validPositions[t+1]&&null===e.validPositions[t+1].match.fn||isFinite(r.input)||t===i||r.input===a.groupSeparator||r.input===a.negationSymbol.front||r.input===a.negationSymbol.back;return!o||"+"!==r.match.nativeDef&&"-"!==r.match.nativeDef||(a.isNegative=!1),o},onKeyDown:function(i,n,a,r){var o=e(this);if(i.ctrlKey)switch(i.keyCode){case t.keyCode.UP:o.val(parseFloat(this.inputmask.unmaskedvalue())+parseInt(r.step)),o.trigger("setvalue");break;case t.keyCode.DOWN:o.val(parseFloat(this.inputmask.unmaskedvalue())-parseInt(r.step)),o.trigger("setvalue")}}},currency:{prefix:"$ ",groupSeparator:",",alias:"numeric",placeholder:"0",autoGroup:!0,digits:2,digitsOptional:!1,clearMaskOnLostFocus:!1},decimal:{alias:"numeric"},integer:{alias:"numeric",digits:0,radixPoint:""},percentage:{alias:"numeric",digits:2,digitsOptional:!0,radixPoint:".",placeholder:"0",autoGroup:!1,min:0,max:100,suffix:" %",allowMinus:!1}}),t})?n.apply(t,a):n)&&(e.exports=r)},function(e,t,i){"use strict";var n,a,r;"function"==typeof Symbol&&Symbol.iterator,a=[i(0),i(1)],void 0!==(r="function"==typeof(n=function(e,t){function i(e,t){var i=(e.mask||e).replace(/#/g,"0").replace(/\)/,"0").replace(/[+()#-]/g,""),n=(t.mask||t).replace(/#/g,"0").replace(/\)/,"0").replace(/[+()#-]/g,"");return i.localeCompare(n)}
21595var n=t.prototype.analyseMask;return t.prototype.analyseMask=function(t,i,a){var r={};return a.phoneCodes&&(a.phoneCodes&&a.phoneCodes.length>1e3&&(function e(i,n,a){n=n||"",a=a||r,""!==n&&(a[n]={});for(var o="",s=a[n]||a,l=i.length-1;l>=0;l--)s[o=(t=i[l].mask||i[l]).substr(0,1)]=s[o]||[],s[o].unshift(t.substr(1)),i.splice(l,1);for(var u in s)s[u].length>500&&e(s[u].slice(),u,s)}((t=t.substr(1,t.length-2)).split(a.groupmarker[1]+a.alternatormarker+a.groupmarker[0])),t=function t(i){var n="",r=[];for(var o in i)e.isArray(i[o])?1===i[o].length?r.push(o+i[o]):r.push(o+a.groupmarker[0]+i[o].join(a.groupmarker[1]+a.alternatormarker+a.groupmarker[0])+a.groupmarker[1]):r.push(o+t(i[o]));return 1===r.length?n+=r[0]:n+=a.groupmarker[0]+r.join(a.groupmarker[1]+a.alternatormarker+a.groupmarker[0])+a.groupmarker[1],n}(r)),t=t.replace(/9/g,"\\9")),n.call(this,t,i,a)},t.extendAliases({abstractphone:{groupmarker:["<",">"],countrycode:"",phoneCodes:[],keepStatic:"auto",mask:function(e){return e.definitions={"#":t.prototype.definitions[9]},e.phoneCodes.sort(i)},onBeforeMask:function(e,t){var i=e.replace(/^0{1,2}/,"").replace(/[\s]/g,"");return(i.indexOf(t.countrycode)>1||-1===i.indexOf(t.countrycode))&&(i="+"+t.countrycode+i),i},onUnMask:function(e,t,i){return e.replace(/[()#-]/g,"")},inputmode:"tel"}}),t})?n.apply(t,a):n)&&(e.exports=r)},function(e,t,i){"use strict";var n,a,r,o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};a=[i(2),i(1)],void 0!==(r="function"==typeof(n=function(e,t){return void 0===e.fn.inputmask&&(e.fn.inputmask=function(i,n){var a,r=this[0];if(void 0===n&&(n={}),"string"==typeof i)switch(i){case"unmaskedvalue":return r&&r.inputmask?r.inputmask.unmaskedvalue():e(r).val();case"remove":return this.each(function(){this.inputmask&&this.inputmask.remove()});case"getemptymask":return r&&r.inputmask?r.inputmask.getemptymask():"";case"hasMaskedValue":return!(!r||!r.inputmask)&&r.inputmask.hasMaskedValue();case"isComplete":return!r||!r.inputmask||r.inputmask.isComplete();case"getmetadata":return r&&r.inputmask?r.inputmask.getmetadata():void 0;case"setvalue":e(r).val(n),r&&void 0===r.inputmask&&e(r).triggerHandler("setvalue");break;case"option":if("string"!=typeof n)return this.each(function(){if(void 0!==this.inputmask)return this.inputmask.option(n)});if(r&&void 0!==r.inputmask)return r.inputmask.option(n);break;default:return n.alias=i,a=new t(n),this.each(function(){a.mask(this)})}else{if("object"==(void 0===i?"undefined":o(i)))return a=new t(i),void 0===i.mask&&void 0===i.alias?this.each(function(){if(void 0!==this.inputmask)return this.inputmask.option(i);a.mask(this)}):this.each(function(){a.mask(this)});if(void 0===i)return this.each(function(){(a=new t(n)).mask(this)})}}),e.fn.inputmask})?n.apply(t,a):n)&&(e.exports=r)}]);
21596/* End */
21597;
21598; /* Start:"a:4:{s:4:"full";s:66:"/bitrix/templates/aspro_max/js/jquery.easing.1.3.js?17164655378095";s:6:"source";s:51:"/bitrix/templates/aspro_max/js/jquery.easing.1.3.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
21599/*
21600 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
21601 *
21602 * Uses the built in easing capabilities added In jQuery 1.1
21603 * to offer multiple easing options
21604 *
21605 * TERMS OF USE - jQuery Easing
21606 * 
21607 * Open source under the BSD License. 
21608 * 
21609 * Copyright © 2008 George McGinley Smith
21610 * All rights reserved.
21611 * 
21612 * Redistribution and use in source and binary forms, with or without modification, 
21613 * are permitted provided that the following conditions are met:
21614 * 
21615 * Redistributions of source code must retain the above copyright notice, this list of 
21616 * conditions and the following disclaimer.
21617 * Redistributions in binary form must reproduce the above copyright notice, this list 
21618 * of conditions and the following disclaimer in the documentation and/or other materials 
21619 * provided with the distribution.
21620 * 
21621 * Neither the name of the author nor the names of contributors may be used to endorse 
21622 * or promote products derived from this software without specific prior written permission.
21623 * 
21624 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
21625 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21626 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21627 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
vendor: 5,091 bytes, lines 21628-21773
21628 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
21629 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
21630 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
21631 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
21632 * OF THE POSSIBILITY OF SUCH DAMAGE. 
21633 *
21634*/
21635
21636// t: current time, b: begInnIng value, c: change In value, d: duration
21637jQuery.easing['jswing'] = jQuery.easing['swing'];
21638
21639jQuery.extend( jQuery.easing,
21640{
21641	def: 'easeOutQuad',
21642	swing: function (x, t, b, c, d) {
21643		//alert(jQuery.easing.default);
21644		return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
21645	},
21646	easeInQuad: function (x, t, b, c, d) {
21647		return c*(t/=d)*t + b;
21648	},
21649	easeOutQuad: function (x, t, b, c, d) {
21650		return -c *(t/=d)*(t-2) + b;
21651	},
21652	easeInOutQuad: function (x, t, b, c, d) {
21653		if ((t/=d/2) < 1) return c/2*t*t + b;
21654		return -c/2 * ((--t)*(t-2) - 1) + b;
21655	},
21656	easeInCubic: function (x, t, b, c, d) {
21657		return c*(t/=d)*t*t + b;
21658	},
21659	easeOutCubic: function (x, t, b, c, d) {
21660		return c*((t=t/d-1)*t*t + 1) + b;
21661	},
21662	easeInOutCubic: function (x, t, b, c, d) {
21663		if ((t/=d/2) < 1) return c/2*t*t*t + b;
21664		return c/2*((t-=2)*t*t + 2) + b;
21665	},
21666	easeInQuart: function (x, t, b, c, d) {
21667		return c*(t/=d)*t*t*t + b;
21668	},
21669	easeOutQuart: function (x, t, b, c, d) {
21670		return -c * ((t=t/d-1)*t*t*t - 1) + b;
21671	},
21672	easeInOutQuart: function (x, t, b, c, d) {
21673		if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
21674		return -c/2 * ((t-=2)*t*t*t - 2) + b;
21675	},
21676	easeInQuint: function (x, t, b, c, d) {
21677		return c*(t/=d)*t*t*t*t + b;
21678	},
21679	easeOutQuint: function (x, t, b, c, d) {
21680		return c*((t=t/d-1)*t*t*t*t + 1) + b;
21681	},
21682	easeInOutQuint: function (x, t, b, c, d) {
21683		if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
21684		return c/2*((t-=2)*t*t*t*t + 2) + b;
21685	},
21686	easeInSine: function (x, t, b, c, d) {
21687		return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
21688	},
21689	easeOutSine: function (x, t, b, c, d) {
21690		return c * Math.sin(t/d * (Math.PI/2)) + b;
21691	},
21692	easeInOutSine: function (x, t, b, c, d) {
21693		return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
21694	},
21695	easeInExpo: function (x, t, b, c, d) {
21696		return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
21697	},
21698	easeOutExpo: function (x, t, b, c, d) {
21699		return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
21700	},
21701	easeInOutExpo: function (x, t, b, c, d) {
21702		if (t==0) return b;
21703		if (t==d) return b+c;
21704		if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
21705		return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
21706	},
21707	easeInCirc: function (x, t, b, c, d) {
21708		return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
21709	},
21710	easeOutCirc: function (x, t, b, c, d) {
21711		return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
21712	},
21713	easeInOutCirc: function (x, t, b, c, d) {
21714		if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
21715		return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
21716	},
21717	easeInElastic: function (x, t, b, c, d) {
21718		var s=1.70158;var p=0;var a=c;
21719		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
21720		if (a < Math.abs(c)) { a=c; var s=p/4; }
21721		else var s = p/(2*Math.PI) * Math.asin (c/a);
21722		return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
21723	},
21724	easeOutElastic: function (x, t, b, c, d) {
21725		var s=1.70158;var p=0;var a=c;
21726		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
21727		if (a < Math.abs(c)) { a=c; var s=p/4; }
21728		else var s = p/(2*Math.PI) * Math.asin (c/a);
21729		return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
21730	},
21731	easeInOutElastic: function (x, t, b, c, d) {
21732		var s=1.70158;var p=0;var a=c;
21733		if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
21734		if (a < Math.abs(c)) { a=c; var s=p/4; }
21735		else var s = p/(2*Math.PI) * Math.asin (c/a);
21736		if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
21737		return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
21738	},
21739	easeInBack: function (x, t, b, c, d, s) {
21740		if (s == undefined) s = 1.70158;
21741		return c*(t/=d)*t*((s+1)*t - s) + b;
21742	},
21743	easeOutBack: function (x, t, b, c, d, s) {
21744		if (s == undefined) s = 1.70158;
21745		return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
21746	},
21747	easeInOutBack: function (x, t, b, c, d, s) {
21748		if (s == undefined) s = 1.70158; 
21749		if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
21750		return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
21751	},
21752	easeInBounce: function (x, t, b, c, d) {
21753		return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
21754	},
21755	easeOutBounce: function (x, t, b, c, d) {
21756		if ((t/=d) < (1/2.75)) {
21757			return c*(7.5625*t*t) + b;
21758		} else if (t < (2/2.75)) {
21759			return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
21760		} else if (t < (2.5/2.75)) {
21761			return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
21762		} else {
21763			return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
21764		}
21765	},
21766	easeInOutBounce: function (x, t, b, c, d) {
21767		if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
21768		return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
21769	}
21770});
21771
21772/*
21773 *
21774 * TERMS OF USE - EASING EQUATIONS
21775 * 
21776 * Open source under the BSD License. 
21777 * 
21778 * Copyright © 2001 Robert Penner
21779 * All rights reserved.
21780 * 
21781 * Redistribution and use in source and binary forms, with or without modification, 
21782 * are permitted provided that the following conditions are met:
21783 * 
21784 * Redistributions of source code must retain the above copyright notice, this list of 
21785 * conditions and the following disclaimer.
21786 * Redistributions in binary form must reproduce the above copyright notice, this list 
21787 * of conditions and the following disclaimer in the documentation and/or other materials 
21788 * provided with the distribution.
21789 * 
21790 * Neither the name of the author nor the names of contributors may be used to endorse 
21791 * or promote products derived from this software without specific prior written permission.
21792 * 
21793 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
21794 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21795 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21796 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21797 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
21798 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
21799 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
21800 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
21801 * OF THE POSSIBILITY OF SUCH DAMAGE. 
21802 *
21803 */
21804/* End */
21805;
21806; /* Start:"a:4:{s:4:"full";s:60:"/bitrix/templates/aspro_max/js/equalize.min.js?1716465537588";s:6:"source";s:46:"/bitrix/templates/aspro_max/js/equalize.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
21807/**
21808 * equalize.js
21809 * Author & copyright (c) 2012: Tim Svensen
21810 * Dual MIT & GPL license
21811 *
21812 * Page: http://tsvensen.github.com/equalize.js
21813 * Repo: https://github.com/tsvensen/equalize.js/
21814 */
21815(function(b){b.fn.equalize=function(a){var d=!1,g=!1,c,e;b.isPlainObject(a)?(c=a.equalize||"height",d=a.children||!1,g=a.reset||!1):c=a||"height";if(!b.isFunction(b.fn[c]))return!1;e=0<c.indexOf("eight")?"height":"width";return this.each(function(){var a=d?b(this).find(d):b(this).children(),f=0;a.each(function(){var a=b(this);g&&a.css(e,"");a=a[c]();a>f&&(f=a)});a.css(e,f+"px")})}})(jQuery);
21816/* End */
21817;
21818; /* Start:"a:4:{s:4:"full";s:68:"/bitrix/templates/aspro_max/js/jquery.alphanumeric.js?17164655371972";s:6:"source";s:53:"/bitrix/templates/aspro_max/js/jquery.alphanumeric.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
21819(function ($) {
21820    $.fn.alphanumeric = function (p) {
21821        var input = $(this),
21822            az = "abcdefghijklmnopqrstuvwxyz",
21823            options = $.extend({
21824                ichars: '!@#$%^&*()+=[]\\\';,/{}|":<>?~`.- _',
21825                nchars: '',
21826                allow: ''
21827            }, p),
21828            s = options.allow.split(''),
21829            i = 0,
21830            ch,
21831            regex;
21832
21833        for (i; i < s.length; i++) {
21834            if (options.ichars.indexOf(s[i]) != -1) {
21835                s[i] = '\\' + s[i];
21836            }
21837        }
21838
21839        if (options.nocaps) {
21840            options.nchars += az.toUpperCase();
21841        }
21842        if (options.allcaps) {
21843            options.nchars += az;
21844        }
21845
21846        options.allow = s.join('|');
21847
21848        regex = new RegExp(options.allow, 'gi');
21849        ch = (options.ichars + options.nchars).replace(regex, '');
21850
21851        input.keypress(function (e) {
21852            var key = String.fromCharCode(!e.charCode ? e.which : e.charCode);
21853
21854            if (ch.indexOf(key) != -1 && !e.ctrlKey) {
21855                e.preventDefault();
21856            }
21857        });
21858
21859        input.blur(function () {
21860            var value = input.val(),
21861                j = 0;
21862
21863            for (j; j < value.length; j++) {
21864                if (ch.indexOf(value[j]) != -1) {
21865                    input.val('');
21866                    return false;
21867                }
21868            }
21869            return false;
21870        });
21871
21872        return input;
21873    };
21874
21875    $.fn.numeric = function (p) {
21876        var az = 'abcdefghijklmnopqrstuvwxyz',
21877            aZ = az.toUpperCase();
21878
21879        return this.each(function () {
21880            $(this).alphanumeric($.extend({ nchars: az + aZ }, p));
21881        });
21882    };
21883
21884    $.fn.alpha = function (p) {
21885        var nm = '1234567890';
21886        return this.each(function () {
21887            $(this).alphanumeric($.extend({ nchars: nm }, p));
21888        });
21889    };
21890})(jQuery);
21891/* End */
21892;
21893; /* Start:"a:4:{s:4:"full";s:62:"/bitrix/templates/aspro_max/js/jquery.cookie.js?17164655373066";s:6:"source";s:47:"/bitrix/templates/aspro_max/js/jquery.cookie.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
21894/*!
21895 * jQuery Cookie Plugin v1.4.0
21896 * https://github.com/carhartl/jquery-cookie
21897 *
21898 * Copyright 2013 Klaus Hartl
21899 * Released under the MIT license
21900 */
21901(function (factory) {
21902	if (typeof define === 'function' && define.amd) {
21903		// AMD. Register as anonymous module.
21904		define(['jquery'], factory);
21905	} else {
21906		// Browser globals.
21907		factory(jQuery);
21908	}
21909}(function ($) {
21910
21911	var pluses = /\+/g;
21912
21913	function encode(s) {
21914		return config.raw ? s : encodeURIComponent(s);
21915	}
21916
21917	function decode(s) {
21918		return config.raw ? s : decodeURIComponent(s);
21919	}
21920
21921	function stringifyCookieValue(value) {
21922		return encode(config.json ? JSON.stringify(value) : String(value));
21923	}
21924
21925	function parseCookieValue(s) {
21926		if (s.indexOf('"') === 0) {
21927			// This is a quoted cookie as according to RFC2068, unescape...
21928			s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
21929		}
21930
21931		try {
21932			// Replace server-side written pluses with spaces.
21933			// If we can't decode the cookie, ignore it, it's unusable.
21934			// If we can't parse the cookie, ignore it, it's unusable.
21935			s = decodeURIComponent(s.replace(pluses, ' '));
21936			return config.json ? JSON.parse(s) : s;
21937		} catch(e) {}
21938	}
21939
21940	function read(s, converter) {
21941		var value = config.raw ? s : parseCookieValue(s);
21942		return $.isFunction(converter) ? converter(value) : value;
21943	}
21944
21945	var config = $.cookie = function (key, value, options) {
21946
21947		// Write
21948
21949		if (value !== undefined && !$.isFunction(value)) {
21950			options = $.extend({}, config.defaults, options);
21951
21952			if (typeof options.expires === 'number') {
21953				var days = options.expires, t = options.expires = new Date();
21954				t.setTime(+t + days * 864e+5);
21955			}
21956
21957			return (document.cookie = [
21958				encode(key), '=', stringifyCookieValue(value),
21959				options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
21960				options.path    ? '; path=' + options.path : '',
21961				options.domain  ? '; domain=' + options.domain : '',
21962				options.secure  ? '; secure' : ''
21963			].join(''));
21964		}
21965
21966		// Read
21967
21968		var result = key ? undefined : {};
21969
21970		// To prevent the for loop in the first place assign an empty array
21971		// in case there are no cookies at all. Also prevents odd result when
21972		// calling $.cookie().
21973		var cookies = document.cookie ? document.cookie.split('; ') : [];
21974
21975		for (var i = 0, l = cookies.length; i < l; i++) {
21976			var parts = cookies[i].split('=');
21977			var name = decode(parts.shift());
21978			var cookie = parts.join('=');
21979
21980			if (key && key === name) {
21981				// If second argument (value) is a function it's a converter...
21982				result = read(cookie, value);
21983				break;
21984			}
21985
21986			// Prevent storing a cookie that we couldn't decode.
21987			if (!key && (cookie = read(cookie)) !== undefined) {
21988				result[name] = cookie;
21989			}
21990		}
21991
21992		return result;
21993	};
21994
21995	config.defaults = {};
21996
21997	$.removeCookie = function (key, options) {
21998		if ($.cookie(key) === undefined) {
21999			return false;
22000		}
22001
22002		// Must not alter options, thus extending a fresh object...
22003		$.cookie(key, '', $.extend({}, options, { expires: -1 }));
22004		return !$.cookie(key);
22005	};
22006
22007}));
22008
22009/* End */
22010;
22011; /* Start:"a:4:{s:4:"full";s:66:"/bitrix/templates/aspro_max/js/jquery.plugin.min.js?17164655373181";s:6:"source";s:51:"/bitrix/templates/aspro_max/js/jquery.plugin.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
22012/** Abstract base class for collection plugins v1.0.1.
22013	Written by Keith Wood (kbwood{at}iinet.com.au) December 2013.
22014	Licensed under the MIT (http://keith-wood.name/licence.html) license. */
22015(function(){var j=false;window.JQClass=function(){};JQClass.classes={};JQClass.extend=function extender(f){var g=this.prototype;j=true;var h=new this();j=false;for(var i in f){h[i]=typeof f[i]=='function'&&typeof g[i]=='function'?(function(d,e){return function(){var b=this._super;this._super=function(a){return g[d].apply(this,a||[])};var c=e.apply(this,arguments);this._super=b;return c}})(i,f[i]):f[i]}function JQClass(){if(!j&&this._init){this._init.apply(this,arguments)}}JQClass.prototype=h;JQClass.prototype.constructor=JQClass;JQClass.extend=extender;return JQClass}})();(function($){JQClass.classes.JQPlugin=JQClass.extend({name:'plugin',defaultOptions:{},regionalOptions:{},_getters:[],_getMarker:function(){return'is-'+this.name},_init:function(){$.extend(this.defaultOptions,(this.regionalOptions&&this.regionalOptions[''])||{});var c=camelCase(this.name);$[c]=this;$.fn[c]=function(a){var b=Array.prototype.slice.call(arguments,1
22015);if($[c]._isNotChained(a,b)){return $[c][a].apply($[c],[this[0]].concat(b))}return this.each(function(){if(typeof a==='string'){if(a[0]==='_'||!$[c][a]){throw'Unknown method: '+a;}$[c][a].apply($[c],[this].concat(b))}else{$[c]._attach(this,a)}})}},setDefaults:function(a){$.extend(this.defaultOptions,a||{})},_isNotChained:function(a,b){if(a==='option'&&(b.length===0||(b.length===1&&typeof b[0]==='string'))){return true}return $.inArray(a,this._getters)>-1},_attach:function(a,b){a=$(a);if(a.hasClass(this._getMarker())){return}a.addClass(this._getMarker());b=$.extend({},this.defaultOptions,this._getMetadata(a),b||{});var c=$.extend({name:this.name,elem:a,options:b},this._instSettings(a,b));a.data(this.name,c);this._postAttach(a,c);this.option(a,b)},_instSettings:function(a,b){return{}},_postAttach:function(a,b){},_getMetadata:function(d){try{var f=d.data(this.name.toLowerCase())||'';f=f.replace(/'/g,'"');f=f.replace(/([a-zA-Z0-9]+):/g,function(a,b,i){var c=f.substring(0,i).match(/"/g);return(!c||c.length%2===0?'"'+b+'":':b+':')});f=$.parseJSON('{'+f+'}');for(var g in f){var h=f[g];if(typeof h==='string'&&h.match(/^new Date\((.*)\)$/)){f[g]=eval(h)}}return f}catch(e){return{}}},_getInst:function(a){return $(a).data(this.name)||{}},option:function(a,b,c){a=$(a);var d=a.data(this.name);if(!b||(typeof b==='string'&&c==null)){var e=(d||{}).options;return(e&&b?e[b]:e)}if(!a.hasClass(this._getMarker())){return}var e=b||{};if(typeof b==='string'){e={};e[b]=c}this._optionsChanged(a,d,e);$.extend(d.options,e)},_optionsChanged:function(a,b,c){},destroy:function(a){a=$(a);if(!a.hasClass(this._getMarker())){return}this._preDestroy(a,this._getInst(a));a.removeData(this.name).removeClass(this._getMarker())},_preDestroy:function(a,b){}});function camelCase(c){return c.replace(/-([a-z])/g,function(a,b){return b.toUpperCase()})}$.JQPlugin={createPlugin:function(a,b){if(typeof a==='object'){b=a;a='JQPlugin'}a=camelCase(a);var c=camelCase(b.name);JQClass.classes[c]=JQClass.classes[a].extend(b);new JQClass.classes[c]()}}})(jQuery);
22016/* End */
22017;
22018; /* Start:"a:4:{s:4:"full";s:70:"/bitrix/templates/aspro_max/js/jquery.countdown.min.js?171646553713137";s:6:"source";s:54:"/bitrix/templates/aspro_max/js/jquery.countdown.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
22019!function(e){var t="countdown",i=0,s=1,n=2,o=3,r=4,a=5,l=6;e.JQPlugin.createPlugin({name:t,defaultOptions:{until:null,since:null,timezone:null,serverSync:null,format:"dHMS",layout:"",compact:!1,padZeroes:!1,significant:0,description:"",expiryUrl:"",expiryText:"",alwaysExpire:!1,onExpiry:null,onTick:null,tickInterval:1},regionalOptions:{"":{labels:["Years","Months","Weeks","Days","Hours","Minutes","Seconds"],labels1:["Year","Month","Week","Day","Hour","Minute","Second"],compactLabels:["y","m","w","d"],whichLabels:null,digits:["0","1","2","3","4","5","6","7","8","9"],timeSeparator:":",isRTL:!1}},_getters:["getTimes"],_rtlClass:t+"-rtl",_sectionClass:t+"-section",_amountClass:t+"-amount",_periodClass:t+"-period",_rowClass:t+"-row",_holdingClass:t+"-holding",_showClass:t+"-show",_descrClass:t+"-descr",_timerElems:[],_init:function(){function t(e){var a=1e12>e?n?performance.now()+performance.timing.navigationStart:s():e||s();a-r>=1e3&&(i._updateElems(),r=a),o(t)}var i=this;this._super(),this._serverSyncs=[];var s="function"==typeof Date.now?Date.now:function(){return(new Date).getTime()},n=window.performance&&"function"==typeof window.performance.now,o=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||null,r=0;!o||e.noRequestAnimationFrame?(e.noRequestAnimationFrame=null,setInterval(function(){i._updateElems()},980)):(r=window.animationStartTime||window.webkitAnimationStartTime||window.mozAnimationStartTime||window.oAnimationStartTime||window.msAnimationStartTime||s(),o(t))},UTCDate:function(e,t,i,s,n,o,r,a){"object"==typeof t&&t.constructor==Date&&(a=t.getMilliseconds(),r=t.getSeconds(),o=t.getMinutes(),n=t.getHours(),s=t.getDate(),i=t.getMonth(),t=t.getFullYear());var l=new Date;return l.setUTCFullYear(t),l.setUTCDate(1),l.setUTCMonth(i||0),l.setUTCDate(s||1),l.setUTCHours(n||0),l.setUTCMinutes((o||0)-(Math.abs(e)<30?60*e:e)),l.setUTCSeconds(r||0),l.setUTCMilliseconds(a||0),l}
22019,periodsToSeconds:function(e){return 31557600*e[0]+2629800*e[1]+604800*e[2]+86400*e[3]+3600*e[4]+60*e[5]+e[6]},resync:function(){var t=this;e("."+this._getMarker()).each(function(){var i=e.data(this,t.name);if(i.options.serverSync){for(var s=null,n=0;n<t._serverSyncs.length;n++)if(t._serverSyncs[n][0]==i.options.serverSync){s=t._serverSyncs[n];break}if(null==s[2]){var o=e.isFunction(i.options.serverSync)?i.options.serverSync.apply(this,[]):null;s[2]=(o?(new Date).getTime()-o.getTime():0)-s[1]}i._since&&i._since.setMilliseconds(i._since.getMilliseconds()+s[2]),i._until.setMilliseconds(i._until.getMilliseconds()+s[2])}});for(var i=0;i<t._serverSyncs.length;i++)null!=t._serverSyncs[i][2]&&(t._serverSyncs[i][1]+=t._serverSyncs[i][2],delete t._serverSyncs[i][2])},_instSettings:function(e,t){return{_periods:[0,0,0,0,0,0,0]}},_addElem:function(e){this._hasElem(e)||this._timerElems.push(e)},_hasElem:function(t){return e.inArray(t,this._timerElems)>-1},_removeElem:function(t){this._timerElems=e.map(this._timerElems,function(e){return e==t?null:e})},_updateElems:function(){for(var e=this._timerElems.length-1;e>=0;e--)this._updateCountdown(this._timerElems[e])},_optionsChanged:function(t,i,s){s.layout&&(s.layout=s.layout.replace(/&lt;/g,"<").replace(/&gt;/g,">")),this._resetExtraLabels(i.options,s);var n=i.options.timezone!=s.timezone;e.extend(i.options,s),this._adjustSettings(t,i,null!=s.until||null!=s.since||n);var o=new Date;(i._since&&i._since<o||i._until&&i._until>o)&&this._addElem(t[0]),this._updateCountdown(t,i)},_updateCountdown:function(t,i){if(t=t.jquery?t:e(t),i=i||this._getInst(t),i&&i.options){if(t.html(this._generateHTML(i)).toggleClass(this._rtlClass,i.options.isRTL),e.isFunction(i.options.onT
22019ick)){var s="lap"!=i._hold?i._periods:this._calculatePeriods(i,i._show,i.options.significant,new Date);(1==i.options.tickInterval||this.periodsToSeconds(s)%i.options.tickInterval==0)&&i.options.onTick.apply(t[0],[s])}var n="pause"!=i._hold&&(i._since?i._now.getTime()<i._since.getTime():i._now.getTime()>=i._until.getTime());if(n&&!i._expiring){if(i._expiring=!0,this._hasElem(t[0])||i.options.alwaysExpire){if(this._removeElem(t[0]),e.isFunction(i.options.onExpiry)&&i.options.onExpiry.apply(t[0],[]),i.options.expiryText){var o=i.options.layout;i.options.layout=i.options.expiryText,this._updateCountdown(t[0],i),i.options.layout=o}i.options.expiryUrl&&(window.location=i.options.expiryUrl)}i._expiring=!1}else"pause"==i._hold&&this._removeElem(t[0])}},_resetExtraLabels:function(e,t){for(var i in t)i.match(/[Ll]abels[02-9]|compactLabels1/)&&(e[i]=t[i]);for(var i in e)i.match(/[Ll]abels[02-9]|compactLabels1/)&&"undefined"==typeof t[i]&&(e[i]=null)},_adjustSettings:function(t,i,s){for(var n=null,o=0;o<this._serverSyncs.length;o++)if(this._serverSyncs[o][0]==i.options.serverSync){n=this._serverSyncs[o][1];break}if(null!=n)var r=i.options.serverSync?n:0,a=new Date;else{var l=e.isFunction(i.options.serverSync)?i.options.serverSync.apply(t[0],[]):null,a=new Date,r=l?a.getTime()-l.getTime():0;this._serverSyncs.push([i.options.serverSync,r])}var _=i.options.timezone;_=null==_?-a.getTimezoneOffset():_,(s||!s&&null==i._until&&null==i._since)&&(i._since=i.options.since,null!=i._since&&(i._since=this.UTCDate(_,this._determineTime(i._since,null)),i._since&&r&&i._since.setMilliseconds(i._since.getMilliseconds()+r)),i._until=this.UTCDate(_,this._determineTime(i.options.until,a)),r&&i._until.setMilliseconds(i._until.getMilliseconds()+r)),i._show=this._determineShow(i)},_preDestroy:function(e,t){this._removeElem(e[0]),e.empty()},pause:function(e){this._hold(e,"pause")},lap:function(e){this._hold(e,"lap")},resume:function(e){this._hold(e,null)},toggle:function(t){var i=e.data(t,this.name)||{};this[i._hold?"resume":"pause"](t)},toggleLap:function(t){var i=e.data(t,this.name)||{};this[i._hold?"resume":"lap"](t)},_hold:function(t,i){var s=e.data(t,this.name);if(s){if("pause"==s._hold&&!i){s._periods=s._savePeriods;var n=s._since?"-":"+";s[s._since?"_since":"_until"]=this._determineTime(n+s._periods[0]+"y"+n+s._periods[1]+"o"+n+s._periods[2]+"w"+n+s._periods[3]+"d"+n+s._periods[4]+"h"+n+s._periods[5]+"m"+n+s._periods[6]+"s"),this._addElem(t)}s._hold=i,s._savePeriods="pause"==i?s._periods:null,e.data(t,this.name,s),this._updateCountdown(t,s)}},getTimes:function(t){var i=e.data(t,this.name);return i?"pause"==i._hold?i._savePeriods:i._hold?this._calculatePeriods(i,i._show,i.options.significant,new Date):i._periods:null},_determineTime:function(e,t){var i=this,s=function(e){var t=new Date;return t.setTime(t.getTime()+1e3*e),t},n=function(e){e=e.toLowerCase();for(var t=new Date,s=t.getFullYear(),n=t.getMonth(),o=t.getDate(),r=t.getHours(),a=t.getMinutes(),l=t.getSeconds(),_=/([+-]?[0-9]+)\s*(s|m|h|d|w|o|y)?/g,p=_.exec(e);p;){switch(p[2]||"s"){case"s":l+=parseInt(p[1],10);break;case"m":a+=parseInt(p[1],10);break;case"h":r+=parseInt(p[1],10);break;case"d":o+=parseInt(p[1],10);break;case"w":o+=7*parseInt(p[1],10);break;case"o":n+=parseInt(p[1],10),o=Math.min(o,i._getDaysInMonth(s,n));break;case"y":s+=parseInt(p[1],10),o=Math.min(o,i._getDaysInMonth(s,n))}p=_.exec(e)}return new Date(s,n,o,r,a,l,0)},o=null==e?t:"string"==typeof e?n(e):"number"==typeof e?s(e):e;return o&&o.setMilliseconds(0),o},_getDaysInMonth:function(e,t){return 32-new Date(e,t,32).getDate()},_normalLabels:function(e){return e},_generateHTML:function(t){var _=this;t._periods=t._hold?t._periods:this._calculatePeriods(t,t._show,t.options.significant,new Date);for(var p=!1,c=0,u=t.options.significant,d=e.extend({},t._show),h=i;l>=h;h++)p|="?"==t._show[h]&&t._periods[h]>0,d[h]="?"!=t._show[h]||p?t._show[h]:null,c+=d[h]?1:0,u-=t._periods[h]>0?1:0;for(var m=[!1,!1,!1,!1,!1,!1,!1],h=l;h>=i;h--)t._show[h]&&(t._periods[h]?m[h]=!0:(m[h]=u>0,u--));var g=t.options.compact?t.options.compactLabels:t.options.labels,f=t.options.whichLabels||this._normalLabels,w=function(e){var i=t.o
22019ptions["compactLabels"+f(t._periods[e])];return d[e]?_._translateDigits(t,t._periods[e])+(i?i[e]:g[e])+" ":""},y=t.options.padZeroes?2:1,v=function(e){var i=t.options["labels"+f(t._periods[e])];return!t.options.significant&&d[e]||t.options.significant&&m[e]?'<span class="'+_._sectionClass+'"><span class="'+_._amountClass+'">'+_._minDigits(t,t._periods[e],y)+'</span><span class="'+_._periodClass+'">'+(i?i[e]:g[e])+"</span></span>":""};return t.options.layout?this._buildLayout(t,d,t.options.layout,t.options.compact,t.options.significant,m):(t.options.compact?'<span class="'+this._rowClass+" "+this._amountClass+(t._hold?" "+this._holdingClass:"")+'">'+w(i)+w(s)+w(n)+w(o)+(d[r]?this._minDigits(t,t._periods[r],2):"")+(d[a]?(d[r]?t.options.timeSeparator:"")+this._minDigits(t,t._periods[a],2):"")+(d[l]?(d[r]||d[a]?t.options.timeSeparator:"")+this._minDigits(t,t._periods[l],2):""):'<span class="'+this._rowClass+" "+this._showClass+(t.options.significant||c)+(t._hold?" "+this._holdingClass:"")+'">'+v(i)+v(s)+v(n)+v(o)+v(r)+v(a)+v(l))+"</span>"+(t.options.description?'<span class="'+this._rowClass+" "+this._descrClass+'">'+t.options.description+"</span>":"")},_buildLayout:function(t,_,p,c,u,d){for(var h=t.options[c?"compactLabels":"labels"],m=t.options.whichLabels||this._normalLabels,g=function(e){return(t.options[(c?"compactLabels":"labels")+m(t._periods[e])]||h)[e]},f=function(e,i){return t.options.digits[Math.floor(e/i)%10]},w={desc:t.options.description,sep:t.options.timeSeparator,yl:g(i),yn:this._minDigits(t,t._periods[i],1),ynn:this._minDigits(t,t._periods[i],2),ynnn:this._minDigits(t,t._periods[i],3),y1:f(t._periods[i],1),y10:f(t._periods[i],10),y100:f(t._periods[i],100),y1000:f(t._periods[i],1e3),ol:g(s),on:this._minDigits(t,t._periods[s],1),onn:this._minDigits(t,t._periods[s],2),onnn:this._minDigits(t,t._periods[s],3),o1:f(t._periods[s],1),o10:f(t._periods[s],10),o100:f(t._periods[s],100),o1000:f(t._periods[s],1e3),wl:g(n),wn:this._minDigits(t,t._periods[n],1),wnn:this._minDigits(t,t._periods[n],2),wnnn:this._minDigits(t,t._periods[n],3),w1:f(t._periods[n],1),w10:f(t._periods[n],10),w100:f(t._periods[n],100),w1000:f(t._periods[n],1e3),dl:g(o),dn:this._minDigits(t,t._periods[o],1),dnn:this._minDigits(t,t._periods[o],2),dnnn:this._minDigits(t,t._periods[o],3),d1:f(t._periods[o],1),d10:f(t._periods[o],10),d100:f(t._periods[o],100),d1000:f(t._periods[o],1e3),hl:g(r),hn:this._minDigits(t,t._periods[r],1),hnn:this._minDigits(t,t._periods[r],2),hnnn:this._minDigits(t,t._periods[r],3),h1:f(t._periods[r],1),h10:f(t._periods[r],10),h100:f(t._periods[r],100),h1000:f(t._periods[r],1e3),ml:g(a),mn:this._minDigits(t,t._periods[a],1),mnn:this._minDigits(t,t._periods[a],2),mnnn:this._minDigits(t,t._periods[a],3),m1:f(t._periods[a],1),m10:f(t._periods[a],10),m100:f(t._periods[a],100),m1000:f(t._periods[a],1e3),sl:g(l),sn:this._minDigits(t,t._periods[l],1),snn:this._minDigits(t,t._periods[l],2),snnn:this._minDigits(t,t._periods[l],3),s1:f(t._periods[l],1),s10:f(t._periods[l],10),s100:f(t._periods[l],100),s1000:f(t._periods[l],1e3)},y=p,v=i;l>=v;v++){var D="yowdhms".charAt(v),T=new RegExp("\\{"+D+"<\\}([\\s\\S]*)\\{"+D+">\\}","g");y=y.replace(T,!u&&_[v]||u&&d[v]?"$1":"")}return e.each(w,function(e,t){var i=new RegExp("\\{"+e+"\\}","g");y=y.replace(i,t)}),y},_minDigits:function(e,t,i){return t=""+t,t.length>=i?this._translateDigits(e,t):(t="0000000000"+t,this._translateDigits(e,t.substr(t.length-i)))},_translateDigits:function(e,t){return(""+t).replace(/[0-9]/g,function(t){return e.options.digits[t]})},_determineShow:function(e){var t=e.options.format,_=[];return _[i]=t.match("y")?"?":t.match("Y")?"!":null,_[s]=t.match("o")?"?":t.match("O")?"!":null,_[n]=t.match("w")?"?":t.match("W")?"!":null,_[o]=t.match("d")?"?":t.match("D")?"!":null,_[r]=t.match("h")?"?":t.match("H")?"!":null,_[a]=t.match("m")?"?":t.match("M")?"!":null,_[l]=t.match("s")?"?":t.match("S")?"!":null,_},_calculatePeriods:function(e,t,_,p){e._now=p,e._now.setMilliseconds(0);var c=new Date(e._now.getTime());e._since?p.getTime()<e._since.getTime()?e._now=p=c:p=e._since:(c.setTime(e._until.getTime()),p.getTime()>e._until.getTime()&&(e._now=p=c));var u=[0,0,0,0,0,0,0];if(t[i]||t[s]){var d=this._getDaysInMonth(p.getFullYear(),p.getMonth()),h=this._getDaysInMonth(c.getFullYear(),c.getMonth()),m=c.getDate()==p.getDate()||c.getDate()>=Math.min(d,h)&&p.getDate()>=Math.min(d,h),g=function(e){return 60*(60*e.getHours()+e.getMinutes())+e.getSeconds()},f=Math.max(0,12*(c.getFullYear()-p.getFullYear())+c.getMonth()-p.getMonth()+(c.getDate()<p.getDate()&&!m||m&&g(c)<g(p)?-1:0));u[i]=t[i]?Math.floor(f/12):0,u[s]=t[s]?f-12*u[i]:0,p=new Date(p.getTime());var w=p.getDate()==d,y=this._getDaysInMonth(p.getFullYear()+u[i],p.getMonth()+u[s]);p.getDate()>y&&p.setDate(y),p.setFullYear(p.getFullYear()+u[i]),p.setMonth(p.getMonth()+u[s]),w&&p.setDate(y)}var v=Math.floor((c.getTime()-p.getTime())/1e3),D=function(e,i){u[e]=t[e]?Math.floor(v/i):0,v-=u[e]*i};if(D(n,604800),D(o,86400),D(r,3600),D(a,60),D(l,1),v>0&&!e._since)for(var T=[1,12,4.3482,7,24,60,60],M=l,S=1,b=l;b>=i;b--)t[b]&&(u[M]>=S&&(u[M]=0,v=1),v>0&&(u[b]++,v=0,M=b,S=1)),S*=T[b];if(_)for(var b=i;l>=b;b++)_&&u[b]?_--:_||(u[b]=0);return u}})}(jQuery);
22020/* End */
22021;
22022; /* Start:"a:4:{s:4:"full";s:68:"/bitrix/templates/aspro_max/js/jquery.countdown-ru.js?17164655371885";s:6:"source";s:53:"/bitrix/templates/aspro_max/js/jquery.countdown-ru.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
22023/* http://keith-wood.name/countdown.html
22024 * Russian initialisation for the jQuery countdown extension
22025 * Written by Sergey K. (xslade{at}gmail.com) June 2010. */
22026(function($) {
22027        $.countdown.regionalOptions['ru'] = {
22028		labels: [BX.message('COUNTDOWN_YEAR0'), BX.message('COUNTDOWN_MONTH0'), BX.message('COUNTDOWN_WEAK0'), BX.message('COUNTDOWN_DAY0'), BX.message('COUNTDOWN_HOUR'), BX.message('COUNTDOWN_MIN'), BX.message('COUNTDOWN_SEC')],
22029		labels1: [BX.message('COUNTDOWN_YEAR1'), BX.message('COUNTDOWN_MONTH1'), BX.message('COUNTDOWN_WEAK1'), BX.message('COUNTDOWN_DAY1'), BX.message('COUNTDOWN_HOUR'), BX.message('COUNTDOWN_MIN'), BX.message('COUNTDOWN_SEC')],
22030		labels2: [BX.message('COUNTDOWN_YEAR2'), BX.message('COUNTDOWN_MONTH2'), BX.message('COUNTDOWN_WEAK2'), BX.message('COUNTDOWN_DAY2'), BX.message('COUNTDOWN_HOUR'), BX.message('COUNTDOWN_MIN'), BX.message('COUNTDOWN_SEC')],
22031		compactLabels: [BX.message('COUNTDOWN_COMPACT_YEAR0'), BX.message('COUNTDOWN_COMPACT_MONTH'), BX.message('COUNTDOWN_COMPACT_WEAK'), BX.message('COUNTDOWN_COMPACT_DAY'), BX.message('COUNTDOWN_COMPACT_HOUR'), BX.message('COUNTDOWN_COMPACT_MIN'), BX.message('COUNTDOWN_COMPACT_SEC')],
22032		compactLabels1: [BX.message('COUNTDOWN_COMPACT_YEAR1'), BX.message('COUNTDOWN_COMPACT_MONTH'), BX.message('COUNTDOWN_COMPACT_WEAK'), BX.message('COUNTDOWN_COMPACT_DAY'), BX.message('COUNTDOWN_COMPACT_HOUR'), BX.message('COUNTDOWN_COMPACT_MIN'), BX.message('COUNTDOWN_COMPACT_SEC')],
22033		whichLabels: function(amount) {
22034			var units = amount % 10;
22035			var tens = Math.floor((amount % 100) / 10);
22036			return (amount == 1 ? 1 : (units >= 2 && units <= 4 && tens != 1 ? 2 :
22037				(units == 1 && tens != 1 ? 1 : 0)));
22038		},
22039		digits: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
22040		timeSeparator: ':', isRTL: false};
22041	$.countdown.setDefaults($.countdown.regionalOptions['ru']);
22042})(jQuery);
22043/* End */
22044;
22045; /* Start:"a:4:{s:4:"full";s:65:"/bitrix/templates/aspro_max/js/jquery.ikSelect.js?171646553732030";s:6:"source";s:49:"/bitrix/templates/aspro_max/js/jquery.ikSelect.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
22046/*! ikSelect 1.0.3
22047	Copyright (c) 2013 Igor Kozlov
22048	http://igorkozlov.me */
22049
22050;(function ($, window, document, undefined) {
22051	var $window = $(window);
22052	var defaults = {
22053		syntax: '<div class="ik_select_link"><div class="ik_select_link_text"></div></div><div class="ik_select_dropdown"><div class="ik_select_list"></div></div>',
22054		autoWidth: true, // set select width according to the longest option
22055		ddFullWidth: true, // set dropdown width according to the longest option
22056		equalWidths: true, // include scrollbar width in fake select calculations
22057		dynamicWidth: false, // change fake select's width according to it's contents
22058		extractLink: false,
22059		customClass: '',
22060		linkCustomClass: '',
22061		ddCustomClass: '',
22062		ddMaxHeight: 200,
22063		filter: false,
22064		nothingFoundText: 'Nothing found',
22065		isDisabled: false,
22066		onInit: function() {},
22067		onShow: function () {},
22068		onHide: function () {},
22069		onKeyUp: function () {},
22070		onKeyDown: function () {},
22071		onHoverMove: function () {}
22072	};
22073
22074	var instOpened; // instance of the currently opened select
22075
22076	// browser detection part was taken from jQuery migrate
22077	// https://github.com/jquery/jquery-migrate/blob/e6bda6a84c294eb1319fceb48c09f51042c80892/src/core.js
22078	var uaMatch = function (ua) {
22079		ua = ua.toLowerCase();
22080
22081		var match = /(chrome)[ \/]([\w.]+)/.exec(ua) ||
22082			/(webkit)[ \/]([\w.]+)/.exec(ua) ||
22083			/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) ||
22084			/(msie) ([\w.]+)/.exec(ua) ||
22085			ua.indexOf('compatible') < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) ||
22086			[];
22087
22088		return {
22089			browser: match[1] || '',
22090			version: match[2] || '0'
22091		};
22092	};
22093
22094	if (! $.browser) {
22095		var matched = uaMatch(navigator.userAgent);
22096		var browser = {};
22097
22098		if (matched.browser) {
22099			browser[matched.browser] = true;
22100			browser.version = matched.version;
22101		}
22102
22103		if (browser.chrome) {
22104			browser.webkit = true;
22105		} else if (browser.webkit) {
22106			browser.safari = true;
22107		}
22108
22109		$.browser = browser;
22110	}
22111
22112	$.browser.mobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile/i.test(navigator.userAgent);
22113	$.browser.operamini = Object.prototype.toString.call(window.operamini) === "[object OperaMini]";
22114
22115	function IkSelect(element, options) {
22116		var dataOptions = {}; // parsed data- attributes
22117
22118		this.el = element;
22119		this.$el = $(element); // original select
22120
22121		for (var key in defaults) {
22122			dataOptions[key] = this.$el.data(key.toLowerCase());
22123		}
22124
22125		this.options = $.extend({}, defaults, options, dataOptions);
22126
22127		if ($.browser.mobile) {
22128			this.options.filter = false;
22129		}
22130
22131		this.init();
22132	}
22133
22134	$.extend(IkSelect.prototype, {
22135		init: function () {
22136			this.$wrapper = $('<div class="ik_select">' + this.options.syntax + '</div>'); // wrapper for the fake select and the fake dropdown
22137			this.$link = $('.ik_select_link', this.$wrapper); // fake select
22138			this.$linkText = $('.ik_select_link_text', this.$wrapper); // fake select's text
22139			this.$dropdown = $('.ik_select_dropdown', this.$wrapper); // fake dropdown
22140			this.$list = $('.ik_select_list', this.$wrapper); // options list inside the fake dropdown
22141			this.$listInner = $('<div class="ik_select_list_inner"/>'); // support dropdown for scrolling
22142			this.$active = $([]); // active fake option
22143			this.$hover = $([]); // hovered fake option
22144			this.hoverIndex = 0; // hovered fake option's index
22145
22146			this.$optionSet = $([]);
22147			this.$optgroupSet = $([]);
22148
22149			this.$list.append(this.$listInner);
22150
22151			if (this.options.filter) {
22152				this.$filter = $([]); // filter text input
22153				this.$optionSetOriginal = $([]); // contains original list items when filtering
22154				this.$nothingFoundText = $('<div class="ik_select_nothing_found"/>').html(this.options.nothingFoundText);
22155				this.$filterWrap = $('.ik_select_filter_wrap', this.$wrapper);
22156
22157				if (! this.$filterWrap.length) {
22158					this.$filterWrap = $('<div class="ik_select_filter_wrap"/>');
22159				}
22160
22161				this.$filter = $('<input type="text" class="ik_select_filter">');
22162
22163				this.$filterWrap.append(this.$filter);
22164				this.$list.prepend(this.$filterWrap);
22165
22166				this.$filter.on({
22167					// keyboard controls should work even if the filter is in focus
22168					'keydown.ikSelect keyup.ikSelect': $.proxy(this, '_elKeyUpDown'),
22169					// actual filtering happens on keyup
22170					'keyup.ikSelect': $.proxy(this, '_filterKeyup')
22171				});
22172			}
22173
22174			this.$wrapper.addClass(this.options.customClass);
22175			this.$link.addClass(this.options.linkCustomClass || (this.options.customClass && this.options.customClass + '-link'));
22176			this.$dropdown.addClass(this.options.ddCustomClass || (this.options.customClass && this.options.customClass + '-dd'));
22177
22178			// creating fake option list
22179			this.reset();
22180
22181			// disable select if an option or attribute are truthy
22182			this.toggle(!(this.options.isDisabled || this.$el.prop('disabled') || this.$el.hasClass('hidden')));
22183
22184			// click event for fake select
22185			this.$link.on('click.ikSelect', $.proxy(this, '_linkClick'));
22186
22187			this.$el.on({
22188				// when focus is on the original select add a focus class to the fake one
22189				'focus.ikSelect': $.proxy(this, '_elFocus'),
22190				// when focus lost remove the focus class from the fake one
22191				'blur.ikSelect': $.proxy(this, '_elBlur'),
22192				// make sure that the fake select shows correct data
22193				'change.ikSelect': $.proxy(this, '_syncOriginalOption'),
22194				// keyboard controls for the fake select
22195				'keydown.ikSelect keyup.ikSelect': $.proxy(this, '_elKeyUpDown')
22196			});
22197
22198			this.$list.on({
22199				'click.ikSelect': $.proxy(this, '_optionClick'),
22200				'mouseover.ikSelect': $.proxy(this, '_optionMouseover')
22201			}, '.ik_select_option');
22202
22203			// stop propagation of click events on the wrapper
22204			this.$wrapper.on('click', function () {
22205				return false;
22206			});
22207
22208			// appending the fake select right after the original one
22209			this.$el.after(this.$wrapper);
22210
22211			// set correct dimensions
22212			this.redraw();
22213
22214			// move original select inside the wrapper
22215			this.$el.appendTo(this.$wrapper);
22216
22217			this.options.onInit(this);
22218			this.$el.trigger('ikinit', this);
22219		},
22220
22221		// click listener for fake select
22222		_linkClick: function () {
22223			if (this.isDisabled) {
22224				return;
22225			}
22226			if (this === instOpened) {
22227				this.hideDropdown();
22228			} else {
22229				this.showDropdown();
22230			}
22231
22232		},
22233
22234		// click listener for the fake options
22235		_optionClick: function () {
22236			this._makeOptionActive(this.searchIndexes ? this.$optionSetOriginal.index(this.$hover) : this.hoverIndex, true);
22237			this.hideDropdown();
22238			this.$el.change().focus();
22239		},
22240
22241		// hover listener for the fake options
22242		_optionMouseover: function (event) {
22243			var $option = $(event.currentTarget);
22244			if ($option.hasClass('ik_select_option_disabled')) {
22245				return;
22246			}
22247			this.$hover.removeClass('ik_select_hover');
22248			this.$hover = $option.addClass('ik_select_hover');
22249			this.hoverIndex = this.$optionSet.index(this.$hover);
22250		},
22251
22252		// makes fake option active without syncing the original select
22253		_makeOptionActive: function (index, shouldSync) {
22254			var $option = $(this.el.options[index]),
22255				text='';
22256			if($option.data('img_src')){
22257				text+='<span class="icon_color" style="background: url('+$option.data('img_src')+')"></span>';
22258				this.$link.addClass('img');
22259			}
22260			if($option.attr('title')){
22261				this.$link.attr('title', $option.attr('title'));
22262			}
22263			text+=$option.text();
22264			this.$linkText.html(text);
22265
22266			this.$link.toggleClass('ik_select_link_novalue', !$option.attr('value'));
22267
22268			this.$hover.removeClass('ik_select_hover');
22269			this.$active.removeClass('ik_select_active');
22270			this.$hover = this.$active = this.$optionSet.eq(index).addClass('ik_select_hover ik_select_active');
22271			this.hoverIndex = index;
22272
22273			if (shouldSync) {
22274				this._syncFakeOption();
22275			}
22276		},
22277
22278		// keyboard controls for the fake select
22279		_elKeyUpDown: function (event) {
22280			var $handle = $(event.currentTarget);
22281			var type = event.type;
22282			var keycode = event.which;
22283			var newTop;
22284
22285			switch (keycode) {
22286			case 38: // up
22287				if (type === 'keydown') {
22288					event.preventDefault();
22289					this._moveToPrevActive();
22290				}
22291				break;
22292			case 40: // down
22293				if (type === 'keydown') {
22294					event.preventDefault();
22295					this._moveToNextActive();
22296				}
22297				break;
22298			case 33: // page up
22299				if (type === 'keydown') {
22300					event.preventDefault();
22301					newTop = this.$hover.position().top - this.$listInner.height();
22302					this._moveToPrevActive(function (optionTop) {
22303						return optionTop <= newTop;
22304					});
22305				}
22306				break;
22307			case 34: // page down
22308				if (type === 'keydown') {
22309					event.preventDefault();
22310					newTop = this.$hover.position().top + this.$listInner.height();
22311					this._moveToNextActive(function (optionTop) {
22312						return optionTop >= newTop;
22313					});
22314				}
22315				break;
22316			case 36: // home
22317				if (type === 'keydown' && $handle.is(this.$el)) {
22318					event.preventDefault();
22319					this._moveToFirstActive();
22320				}
22321				break;
22322			case 35: // end
22323				if (type === 'keydown' && $handle.is(this.$el)) {
22324					event.preventDefault();
22325					this._moveToLastActive();
22326				}
22327				break;
22328			case 32: // space
22329				if (type === 'keydown' && $handle.is(this.$el)) {
22330					event.preventDefault();
22331					if (! this.$dropdown.is(':visible')) {
22332						this._linkClick();
22333					} else {
22334						this.$hover.click();
22335					}
22336				}
22337				break;
22338			case 13: // enter
22339				if (type === 'keydown' && this.$dropdown.is(':visible')) {
22340					event.preventDefault();
22341					this.$hover.click();
22342				}
22343				break;
22344			case 27: // esc
22345				if (type === 'keydown' && this.$dropdown.is(':visible')) {
22346					event.preventDefault();
22347					this.hideDropdown();
22348				}
22349				break;
22350			case 9: // tab
22351				if (type === 'keydown') {
22352					if ($.browser.webkit && this.$dropdown.is(':visible')) {
22353						event.preventDefault();
22354					} else {
22355						this.hideDropdown();
22356					}
22357				}
22358				break;
22359			default:
22360				if (type === 'keyup' && $handle.is(this.$el)) {
22361					this._syncOriginalOption();
22362				}
22363				break;
22364			}
22365
22366			// mozilla ignores preventDefault for select navigation
22367			// this ensures that original select is in sync
22368			if (type === 'keyup' && $.browser.mozilla) {
22369				this._syncFakeOption();
22370			}
22371
22372			if (type === 'keydown') {
22373				this.options.onKeyDown(this, keycode);
22374				this.$el.trigger('ikkeydown', [this, keycode]);
22375			}
22376			if (type === 'keyup') {
22377				this.options.onKeyUp(this, keycode);
22378				this.$el.trigger('ikkeyup', [this, keycode]);
22379			}
22380		},
22381
22382		// controls hover/active states for options and makes selected with keyboard options fully visible
22383		_moveTo: function (index) {
22384			var optionTopLine, optionBottomLine;
22385			var $optgroup;
22386
22387			if (!this.$dropdown.is(':visible') && $.browser.webkit) {
22388				this.showDropdown();
22389				return this;
22390			}
22391
22392			if (!this.$dropdown.is(':visible') || $.browser.mozilla) {
22393				this._makeOptionActive(index, true);
22394			} else {
22395				this.$hover.removeClass('ik_select_hover');
22396				this.$hover = this.$optionSet.eq(index).addClass('ik_select_hover');
22397				this.hoverIndex = index;
22398			}
22399
22400			// make option fully visible
22401			optionTopLine = this.$hover.position().top;
22402			optionBottomLine = optionTopLine + this.$active.outerHeight();
22403			// make optgroup label visible if first option witin this optgroup is hovered
22404			if (!this.$hover.index()) {
22405				$optgroup = this.$hover.closest('.ik_select_optgroup');
22406				if ($optgroup.length) {
22407					optionTopLine = $optgroup.position().top;
22408				}
22409			}
22410			if (optionBottomLine > this.$listInner.height()) {
22411				this.$listInner.scrollTop(this.$listInner.scrollTop() + optionBottomLine - this.$listInner.height());
22412			} else if (optionTopLine < 0) {
22413				this.$listInner.scrollTop(this.$listInner.scrollTop() + optionTopLine);
22414			}
22415
22416			this.options.onHoverMove(this);
22417			this.$el.trigger('ikhovermove', this);
22418		},
22419
22420		_moveToFirstActive: function () {
22421			for (var i = 0; i < this.$optionSet.length; i++) {
22422				if (!this.$optionSet.eq(i).hasClass('ik_select_option_disabled')) {
22423					this._moveTo(i);
22424					break;
22425				}
22426			}
22427		},
22428
22429		_moveToLastActive: function () {
22430			for (var i = this.$optionSet.length - 1; i >= 0; i++) {
22431				if (!this.$optionSet.eq(i).hasClass('ik_select_option_disabled')) {
22432					this._moveTo(i);
22433					break;
22434				}
22435			}
22436		},
22437
22438		_moveToPrevActive: function (condition) {
22439			var $option;
22440			for (var i = this.hoverIndex - 1; i >= 0; i--) {
22441				$option = this.$optionSet.eq(i);
22442				if (!$option.hasClass('ik_select_option_disabled') && (typeof condition === 'undefined' || condition($option.position().top))) {
22443					this._moveTo(i);
22444					break;
22445				}
22446			}
22447		},
22448
22449		_moveToNextActive: function (condition) {
22450			var $option;
22451			for (var i = this.hoverIndex + 1; i < this.$optionSet.length; i++) {
22452				$option = this.$optionSet.eq(i);
22453				if (!$option.hasClass('ik_select_option_disabled') && (typeof condition === 'undefined' || condition($option.position().top))) {
22454					this._moveTo(i);
22455					break;
22456				}
22457			}
22458		},
22459
22460		// when focus is on the original select add a focus class to the fake one
22461		_elFocus:  function () {
22462			var wrapperOffsetTop, wrapperHeight, windowScrollTop, windowHeight;
22463			if (this.isDisabled) {
22464				return this;
22465			}
22466			this.$link.addClass('ik_select_link_focus');
22467
22468			// scroll the window so that focused select is visible
22469			wrapperOffsetTop = this.$wrapper.offset().top;
22470			wrapperHeight = this.$wrapper.height();
22471			windowScrollTop = $window.scrollTop();
22472			windowHeight = $window.height();
22473			if ((wrapperOffsetTop + wrapperHeight > windowScrollTop + windowHeight) ||
22474				(wrapperOffsetTop < windowScrollTop)) {
22475				$window.scrollTop(wrapperOffsetTop - windowHeight / 2);
22476			}
22477		},
22478
22479		// when focus lost remove the focus class from the fake one
22480		_elBlur: function () {
22481			this.$link.removeClass('ik_select_link_focus');
22482		},
22483
22484		// filtering on key up
22485		_filterKeyup: function () {
22486			var filterVal = $.trim(this.$filter.val());
22487			var filterValOld;
22488			this.$listInner.show();
22489
22490			if (typeof this.searchIndexes === 'undefined') {
22491				this.$optionSetOriginal = this.$optionSet;
22492				this.searchIndexes = $.makeArray(this.$optionSet.map(function (optionIndex, option) {
22493					return $(option).text().toLowerCase();
22494				}));
22495			}
22496
22497			if (filterVal !== filterValOld) {
22498				if (filterVal === '') {
22499					this.$optionSet = this.$optionSetOriginal.show();
22500					this.$optgroupSet.show();
22501					this.$nothingFoundText.remove();
22502				} else {
22503					this.$optionSet = $([]);
22504					this.$optgroupSet.show();
22505					this.$optionSetOriginal.each($.proxy(function (optionIndex, option) {
22506						var $option = $(option);
22507						if (this.searchIndexes[optionIndex].indexOf(filterVal.toLowerCase()) >= 0) {
22508							this.$optionSet = this.$optionSet.add($option);
22509							$option.show();
22510						} else {
22511							$option.hide();
22512						}
22513					}, this));
22514
22515					if (this.$optionSet.length) {
22516						this.$nothingFoundText.remove();
22517						this.$optgroupSet.each(function (optgroupIndex, optgroup) {
22518							var $optgroup = $(optgroup);
22519							if (!$('.ik_select_option:visible', $optgroup).length) {
22520								$optgroup.hide();
22521							}
22522						});
22523
22524						if (!this.$hover.is(':visible')) {
22525							this._moveToFirstActive();
22526						}
22527					} else {
22528						this.$listInner.hide();
22529						this.$list.append(this.$nothingFoundText);
22530					}
22531				}
22532
22533				filterValOld = filterVal;
22534			}
22535		},
22536
22537		// sync selected option in the fake select with the original one
22538		_syncFakeOption: function () {
22539			this.el.selectedIndex = this.hoverIndex;
22540		},
22541
22542		// sync selected option in the original select with the fake one
22543		_syncOriginalOption: function () {
22544			this._makeOptionActive(this.el.selectedIndex);
22545		},
22546
22547		// sets fixed height to dropdown if it's bigger than ddMaxHeight
22548		_fixHeight: function () {
22549			this.$dropdown.show();
22550			this.$listInner.css('height', 'auto');
22551			if (this.$listInner.height() > this.options.ddMaxHeight) {
22552				this.$listInner.css({
22553					overflow: 'auto',
22554					height: this.options.ddMaxHeight,
22555					position: 'relative'
22556				});
22557			}
22558			this.$dropdown.hide();
22559		},
22560
22561		// calculates the needed data for showing the dropdown
22562		redraw: function () {
22563			var maxWidthOuter, scrollbarWidth, wrapperParentWidth;
22564
22565			if (this.options.filter) {
22566				this.$filter.hide();
22567			}
22568
22569			this.$wrapper.css({
22570				position: 'relative'
22571			});
22572			this.$dropdown.css({
22573				position: 'absolute',
22574				zIndex: 9998,
22575				width: '100%'
22576			});
22577			this.$list.css({
22578				position: 'relative'
22579			});
22580
22581			this._fixHeight();
22582
22583			// width calculations for the fake select when "autoWidth" is "true"
22584			if (this.options.dynamicWidth || this.options.autoWidth || this.options.ddFullWidth) {
22585				this.$wrapper.width('');
22586
22587				this.$dropdown.show().width(9999);
22588				this.$listInner.css('float', 'left');
22589				this.$list.css('float', 'left');
22590				maxWidthOuter = this.$list.outerWidth(true);
22591				scrollbarWidth = this.$listInner.width() - this.$listInnerUl.width();
22592				this.$list.css('float', '');
22593				this.$listInner.css('float', '');
22594				this.$dropdown.css('width', '100%');
22595
22596				if (this.options.ddFullWidth) {
22597					this.$dropdown.width(maxWidthOuter + scrollbarWidth);
22598				}
22599
22600				if (this.options.dynamicWidth) {
22601					this.$wrapper.css({
22602						display: 'inline-block',
22603						width: 'auto',
22604						verticalAlign: 'top'
22605					});
22606				} else if (this.options.autoWidth) {
22607					this.$wrapper.width(maxWidthOuter + (this.options.equalWidths ? scrollbarWidth : 0)).addClass('ik_select_autowidth');
22608				}
22609
22610				wrapperParentWidth = this.$wrapper.parent().width();
22611				if (this.$wrapper.width() > wrapperParentWidth) {
22612					this.$wrapper.width(wrapperParentWidth);
22613				}
22614			}
22615
22616			if (this.options.filter) {
22617				this.$filter.show().outerWidth(this.$filterWrap.width());
22618			}
22619
22620			this.$dropdown.hide();
22621
22622			// hide the original select
22623			this.$el.css({
22624				position: 'absolute',
22625				margin: 0,
22626				padding: 0,
22627				top: 0,
22628				left: -9999
22629			});
22630
22631			// show the original select in mobile browsers
22632			if ($.browser.mobile) {
22633				this.$el.css({
22634					opacity: 0,
22635					left: 0,
22636					height: this.$wrapper.height(),
22637					width: this.$wrapper.width()
22638				});
22639			}
22640		},
22641
22642		// creates or recreates dropdown and sets selected options's text into fake select
22643		reset: function () {
22644			var html = '';
22645
22646			// init fake select's text
22647			this.$linkText.html(this.$el.val());
22648
22649			this.$listInner.empty();
22650
22651			// creating an ul>li list identical to the original dropdown
22652			html = '<ul>';
22653			this.$el.children().each($.proxy(function (childIndex, child) {
22654				var $child = $(child);
22655				var tagName = child.tagName.toLowerCase();
22656				var options;
22657				if (tagName === 'optgroup') {
22658					options = $child.children().map($.proxy(function (optionIndex, option) {
22659						return this._generateOptionObject($(option));
22660					}, this));
22661					options = $.makeArray(options);
22662					html += this._renderListOptgroup({
22663						label: $child.attr('label') || '&nbsp;',
22664						isDisabled: $child.is(':disabled'),
22665						options: options
22666					});
22667				} else if (tagName === 'option') {
22668					html += this._renderListOption(this._generateOptionObject($child));
22669				}
22670			}, this));
22671			html += '</ul>';
22672			this.$listInner.append(html);
22673			this._syncOriginalOption();
22674
22675			this.$listInnerUl = $('> ul', this.$listInner);
22676			this.$optgroupSet = $('.ik_select_optgroup', this.$listInner);
22677			this.$optionSet = $('.ik_select_option', this.$listInner);
22678		},
22679
22680		// hides dropdown
22681		hideDropdown: function () {
22682			if (this.options.filter) {
22683				this.$filter.val('');
22684				this._filterKeyup();
22685			}
22686
22687			this.$dropdown.hide().appendTo(this.$wrapper).css({
22688				'left': '',
22689				'top': ''
22690			});
22691			if (this.options.extractLink) {
22692				this.$wrapper.outerWidth(this.$wrapper.data('outerWidth'));
22693				this.$wrapper.height('');
22694				this.$link.removeClass('ik_select_link_extracted').css({
22695					position: '',
22696					top: '',
22697					left: '',
22698					zIndex: ''
22699				}).prependTo(this.$wrapper);
22700			}
22701			instOpened = null;
22702			this.$el.focus();
22703
22704			this.options.onHide(this);
22705			this.$el.trigger('ikhide', this);
22706		},
22707
22708		// shows dropdown
22709		showDropdown: function () {
22710			var dropdownOffset, dropdownOuterWidth, dropdownOuterHeight;
22711			var wrapperOffset, wrapperOuterWidth;
22712			var windowWidth, windowHeight, windowScroll;
22713			var linkOffset;
22714
22715			if (instOpened === this || !this.$optionSet.length) {
22716				return;
22717			} else if (instOpened) {
22718				instOpened.hideDropdown();
22719			}
22720
22721			this._syncOriginalOption();
22722			if($('.show_un_props').length)
22723				this.$dropdown.addClass('show_un_props');
22724			else if($('.unshow_un_props').length)
22725				this.$dropdown.addClass('unshow_un_props');
22726			this.$dropdown.show();
22727
22728			dropdownOffset = this.$dropdown.offset();
22729			dropdownOuterWidth = this.$dropdown.outerWidth(true);
22730			dropdownOuterHeight = this.$dropdown.outerHeight(true);
22731			wrapperOffset = this.$wrapper.offset();
22732			windowWidth = $window.width();
22733			windowHeight = $window.height();
22734			windowScroll = $window.scrollTop();
22735
22736			// if the dropdown's right border is beyond window's edge then move the dropdown to the left so that it fits
22737			if (this.options.ddFullWidth && wrapperOffset.left + dropdownOuterWidth > windowWidth) {
22738				dropdownOffset.left = windowWidth - dropdownOuterWidth;
22739			}
22740
22741			// if the dropdown's bottom border is beyond window's edge then move the dropdown to the top so that it fits
22742			if (dropdownOffset.top + dropdownOuterHeight > windowScroll + windowHeight) {
22743				dropdownOffset.top = windowScroll + windowHeight - dropdownOuterHeight;
22744			}
22745
22746			this.$dropdown.css({
22747				left: dropdownOffset.left,
22748				top: dropdownOffset.top,
22749				width: this.$dropdown.width()
22750			}).appendTo('body');
22751
22752			if (this.options.extractLink) {
22753				linkOffset = this.$link.offset();
22754				wrapperOuterWidth = this.$wrapper.outerWidth();
22755				this.$wrapper.data('outerWidth', wrapperOuterWidth);
22756				this.$wrapper.outerWidth(wrapperOuterWidth);
22757				this.$wrapper.outerHeight(this.$wrapper.outerHeight());
22758				this.$link.outerWidth(this.$link.outerWidth());
22759				this.$link.addClass('ik_select_link_extracted').css({
22760					position: 'absolute',
22761					top: linkOffset.top,
22762					left: linkOffset.left,
22763					zIndex: 9999
22764				}).appendTo('body');
22765			}
22766
22767			this.$listInner.scrollTop(this.$active.position().top - this.$list.height() / 2);
22768
22769			if (this.options.filter) {
22770				this.$filter.focus();
22771			} else {
22772				this.$el.focus();
22773			}
22774
22775			instOpened = this;
22776
22777			this.options.onShow(this);
22778			this.$el.trigger('ikshow', this);
22779		},
22780
22781		_generateOptionObject: function ($option) {
22782			
22783			return {
22784				value: $option.val(),
22785				label: $option.html() || '&nbsp;',
22786				isDisabled: $option.is(':disabled'),
22787				dataParam: $option.data(),
22788				className: $option.attr('class'),
22789				title: $option.attr('title')
22790			};
22791		},
22792
22793		// generates option code for the fake dropdown
22794		_renderListOption: function (option) {
22795			var html;
22796			var disabledClass = option.isDisabled ? ' ik_select_option_disabled' : '';
22797			var imgClass = option.dataParam.img_src ? ' img' : '';
22798			var missingClass = option.className=='hidden' ? ' missing' : '';
22799			var title = option.title;
22800			html = '<li class="ik_select_option' + disabledClass + imgClass + missingClass + '" title="'+title+'" data-value="' + option.value + '">';
22801			html += '<span class="ik_select_option_label" title="'+title+'">';
22802			if(option.dataParam.img_src){
22803				html += '<span class="icon_color" style="background: url('+option.dataParam.img_src+')"></span>';
22804			}
22805			html += option.label;
22806			html += '</span>';
22807			html += '</li>';
22808			return html;
22809		},
22810
22811		// generates optgroup code for the fake dropdown
22812		_renderListOptgroup: function (optgroup) {
22813			var html;
22814			var disabledClass = optgroup.isDisabled ? ' ik_select_optgroup_disabled' : '';
22815			html = '<li class="ik_select_optgroup' + disabledClass + '">';
22816			html += '<div class="ik_select_optgroup_label">' + optgroup.label + '</div>';
22817			html += '<ul>';
22818			if ($.isArray(optgroup.options)) {
22819				$.each(optgroup.options, $.proxy(function (optionIndex, option) {
22820					html += this._renderListOption({
22821						value: option.value,
22822						label: option.label || '&nbsp;',
22823						isDisabled: option.isDisabled
22824					});
22825				}, this));
22826			}
22827			html += '</ul>';
22828			html += '</li>';
22829			return html;
22830		},
22831
22832		// generates option code for the select
22833		_renderOption: function (option) {
22834			return '<option value="' + option.value + '">' + option.label + '</option>';
22835		},
22836
22837		// generates optgroup code for the select
22838		_renderOptgroup: function (optgroup) {
22839			var html;
22840			html = '<optgroup label="' + optgroup.label + '">';
22841			if ($.isArray(optgroup.options)) {
22842				$.each(optgroup.options, $.proxy(function (optionIndex, option) {
22843					html += this._renderOption(option);
22844				}, this));
22845			}
22846			html += '</option>';
22847			return html;
22848		},
22849
22850		addOptions: function (options, optionIndex, optgroupIndex) {
22851			var listHtml = '', selectHtml = '';
22852			var $destinationUl = this.$listInnerUl;
22853			var $destinationOptgroup = this.$el;
22854			var $ulOptions, $optgroupOptions;
22855
22856			options = $.isArray(options) ? options : [options];
22857
22858			$.each(options, $.proxy(function (index, option) {
22859				listHtml += this._renderListOption(option);
22860				selectHtml += this._renderOption(option);
22861			}, this));
22862
22863			if ($.isNumeric(optgroupIndex) && optgroupIndex < this.$optgroupSet.length) {
22864				$destinationUl = this.$optgroupSet.eq(optgroupIndex);
22865				$destinationOptgroup = $('optgroup', this.$el).eq(optgroupIndex);
22866			}
22867			if ($.isNumeric(optionIndex)) {
22868				$ulOptions = $('.ik_select_option', $destinationUl);
22869				if (optionIndex < $ulOptions.length) {
22870					$ulOptions.eq(optionIndex).before(listHtml);
22871					$optgroupOptions = $('option', $destinationOptgroup);
22872					$optgroupOptions.eq(optionIndex).before(selectHtml);
22873				}
22874			}
22875			if (!$optgroupOptions) {
22876				$destinationUl.append(listHtml);
22877				$destinationOptgroup.append(selectHtml);
22878			}
22879
22880			this.$optionSet = $('.ik_select_option', this.$listInner);
22881			this._fixHeight();
22882		},
22883
22884		addOptgroups: function (optgroups, optgroupIndex) {
22885			var listHtml = '', selectHtml = '';
22886			if (!optgroups) {
22887				return;
22888			}
22889			optgroups = $.isArray(optgroups) ? optgroups : [optgroups];
22890
22891			$.each(optgroups, $.proxy(function (optgroupIndex, optgroup) {
22892				listHtml += this._renderListOptgroup(optgroup);
22893				selectHtml += this._renderOptgroup(optgroup);
22894			}, this));
22895
22896			if ($.isNumeric(optgroupIndex) && optgroupIndex < this.$optgroupSet.length) {
22897				this.$optgroupSet.eq(optgroupIndex).before(listHtml);
22898				$('optgroup', this.$el).eq(optgroupIndex).before(selectHtml);
22899			} else {
22900				this.$listInnerUl.append(listHtml);
22901				this.$el.append(selectHtml);
22902			}
22903
22904			this.$optgroupSet = $('.ik_select_optgroup', this.$listInner);
22905			this.$optionSet = $('.ik_select_option', this.$listInner);
22906			this._fixHeight();
22907		},
22908
22909		removeOptions: function (optionIndexes, optgroupIndex) {
22910			var $removeList = $([]);
22911			var $listContext;
22912			var $selectContext;
22913
22914			if ($.isNumeric(optgroupIndex)) {
22915				if (optgroupIndex < 0) {
22916					$listContext = $('> .ik_select_option', this.$listInnerUl);
22917					$selectContext = $('> option', this.$el);
22918				} else if (optgroupIndex < this.$optgroupSet.length) {
22919					$listContext = $('.ik_select_option', this.$optgroupSet.eq(optgroupIndex));
22920					$selectContext = $('optgroup', this.$el).eq(optgroupIndex).find('option');
22921				}
22922			}
22923			if (!$listContext) {
22924				$listContext = this.$optionSet;
22925				$selectContext = $(this.el.options);
22926			}
22927
22928			if (!$.isArray(optionIndexes)) {
22929				optionIndexes = [optionIndexes];
22930			}
22931
22932			$.each(optionIndexes, $.proxy(function (index, optionIndex) {
22933				if (optionIndex < $listContext.length) {
22934					$removeList = $removeList.add($listContext.eq(optionIndex)).add($selectContext.eq(optionIndex));
22935				}
22936			}, this));
22937
22938			$removeList.remove();
22939			this.$optionSet = $('.ik_select_option', this.$listInner);
22940			this._syncOriginalOption();
22941			this._fixHeight();
22942		},
22943
22944		removeOptgroups: function (optgroupIndexes) {
22945			var $removeList = $([]);
22946			var $selectOptgroupSet = $('optgroup', this.el);
22947
22948			if (!$.isArray(optgroupIndexes)) {
22949				optgroupIndexes = [optgroupIndexes];
22950			}
22951
22952			$.each(optgroupIndexes, $.proxy(function (index, optgroupIndex) {
22953				if (optgroupIndex < this.$optgroupSet.length) {
22954					$removeList = $removeList.add(this.$optgroupSet.eq(optgroupIndex)).add($selectOptgroupSet.eq(optgroupIndex));
22955				}
22956			}, this));
22957
22958			$removeList.remove();
22959			this.$optionSet = $('.ik_select_option', this.$listInner);
22960			this.$optgroupSet = $('.ik_select_optgroup', this.$listInner);
22961			this._syncOriginalOption();
22962			this._fixHeight();
22963		},
22964
22965		// disable select
22966		disable: function () {
22967			this.toggle(false);
22968		},
22969
22970		// enable select
22971		enable: function () {
22972			this.toggle(true);
22973		},
22974
22975		// toggle select
22976		toggle: function (bool) {
22977			this.isDisabled = typeof bool !== 'undefined' ? !bool : !this.isDisabled;
22978			this.$el.prop('disabled', this.isDisabled);
22979			this.$link.toggleClass('ik_select_link_disabled', this.isDisabled);
22980		},
22981
22982		// make option selected by value
22983		select: function (value, isIndex) {
22984			if (!isIndex) {
22985				this.$el.val(value);
22986			} else {
22987				this.el.selectedIndex = value;
22988			}
22989			this._syncOriginalOption();
22990		},
22991
22992		disableOptgroups: function (optgroupIndexes) {
22993			this.toggleOptgroups(optgroupIndexes, false);
22994		},
22995
22996		enableOptgroups: function (optgroupIndexes) {
22997			this.toggleOptgroups(optgroupIndexes, true);
22998		},
22999
23000		toggleOptgroups: function (optgroupIndexes, bool) {
23001			if (!$.isArray(optgroupIndexes)) {
23002				optgroupIndexes = [optgroupIndexes];
23003			}
23004
23005			$.each(optgroupIndexes, $.proxy(function (index, optgroupIndex) {
23006				var isDisabled;
23007				var $optionSet, indexes = [], indexFirst;
23008				var $optgroup = $('optgroup', this.$el).eq(optgroupIndex);
23009				isDisabled = typeof bool !== 'undefined' ? bool : $optgroup.prop('disabled');
23010				$optgroup.prop('disabled', !isDisabled);
23011				this.$optgroupSet.eq(optgroupIndex).toggleClass('ik_select_optgroup_disabled', !isDisabled);
23012
23013				$optionSet = $('option', $optgroup);
23014				indexFirst = $(this.el.options).index($optionSet.eq(0));
23015				for (var i = indexFirst; i < indexFirst + $optionSet.length; i++) {
23016					indexes.push(i);
23017				}
23018				this.toggleOptions(indexes, true, isDisabled);
23019			}, this));
23020
23021			this._syncOriginalOption();
23022		},
23023
23024		disableOptions: function (lookupValues, isIndex) {
23025			this.toggleOptions(lookupValues, isIndex, false);
23026		},
23027
23028		enableOptions: function (lookupValues, isIndex) {
23029			this.toggleOptions(lookupValues, isIndex, true);
23030		},
23031
23032		toggleOptions: function (lookupValues, isIndex, bool) {
23033			var $selectOptionSet = $('option', this.el);
23034			if (!$.isArray(lookupValues)) {
23035				lookupValues = [lookupValues];
23036			}
23037
23038			var toggleOption = $.proxy(function ($option, optionIndex) {
23039				var isDisabled = typeof bool !== 'undefined' ? bool : $option.prop('disabled');
23040				$option.prop('disabled', !isDisabled);
23041				this.$optionSet.eq(optionIndex).toggleClass('ik_select_option_disabled', !isDisabled);
23042			}, this);
23043
23044			$.each(lookupValues, function (index, lookupValue) {
23045				if (!isIndex) {
23046					$selectOptionSet.each(function (optionIndex, option) {
23047						var $option = $(option);
23048						if ($option.val() === lookupValue) {
23049							toggleOption($option, optionIndex);
23050							return this;
23051						}
23052					});
23053				} else {
23054					toggleOption($selectOptionSet.eq(lookupValue), lookupValue);
23055				}
23056			});
23057
23058			this._syncOriginalOption();
23059		},
23060
23061		// detach plugin from the orignal select
23062		detach: function () {
23063			this.$el.off('.ikSelect').css({
23064				width: '',
23065				height: '',
23066				left: '',
23067				top: '',
23068				position: '',
23069				margin: '',
23070				padding: ''
23071			});
23072
23073			this.$wrapper.before(this.$el);
23074			this.$wrapper.remove();
23075			this.$el.removeData('plugin_ikSelect');
23076		}
23077	});
23078
23079	$.fn.ikSelect = function (options) {
23080		var args;
23081		//do nothing if opera mini
23082		if ($.browser.operamini) {
23083			return this;
23084		}
23085
23086		args = Array.prototype.slice.call(arguments, 1);
23087
23088		return this.each(function () {
23089			var plugin;
23090			if (!$.data(this, 'plugin_ikSelect')) {
23091				$.data(this, 'plugin_ikSelect', new IkSelect(this, options));
23092			} else if (typeof options === 'string') {
23093				plugin = $.data(this, 'plugin_ikSelect');
23094				if (typeof plugin[options] === 'function') {
23095					plugin[options].apply(plugin, args);
23096				}
23097			}
23098		});
23099	};
23100
23101	$.ikSelect = {
23102		extendDefaults: function (options) {
23103			$.extend(defaults, options);
23104		}
23105	};
23106
23107	$(document).bind('click.ikSelect', function () {
23108		if (instOpened) {
23109			instOpened.hideDropdown();
23110		}
23111	});
23112})(jQuery, window, document);
23113
23114/* End */
23115;
23116; /* Start:"a:4:{s:4:"full";s:79:"/bitrix/templates/aspro_max/js/jquery.mobile.custom.touch.min.js?17164655377784";s:6:"source";s:64:"/bitrix/templates/aspro_max/js/jquery.mobile.custom.touch.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
23117/*! jQuery Mobile v1.4.5 | Copyright 2010, 2014 jQuery Foundation, Inc. | jquery.org/license */
23118
23119(function(e,t,n){typeof define=="function"&&define.amd?define(["jquery"],function(r){return n(r,e,t),r.mobile}):n(e.jQuery,e,t)})(this,document,function(e,t,n,r){(function(e,t,n,r){function T(e){while(e&&typeof e.originalEvent!="undefined")e=e.originalEvent;return e}function N(t,n){var i=t.type,s,o,a,l,c,h,p,d,v;t=e.Event(t),t.type=n,s=t.originalEvent,o=e.event.props,i.search(/^(mouse|click)/)>-1&&(o=f);if(s)for(p=o.length,l;p;)l=o[--p],t[l]=s[l];i.search(/mouse(down|up)|click/)>-1&&!t.which&&(t.which=1);if(i.search(/^touch/)!==-1){a=T(s),i=a.touches,c=a.changedTouches,h=i&&i.length?i[0]:c&&c.length?c[0]:r;if(h)for(d=0,v=u.length;d<v;d++)l=u[d],t[l]=h[l]}return t}function C(t){var n={},r,s;while(t){r=e.data(t,i);for(s in r)r[s]&&(n[s]=n.hasVirtualBinding=!0);t=t.parentNode}return n}function k(t,n){var r;while(t){r=e.data(t,i);if(r&&(!n||r[n]))return t;t=t.parentNode}return null}function L(){g=!1}function A(){g=!0}function O(){E=0,v.length=0,m=!1,A()}function M(){L()}function _(){D(),c=setTimeout(function(){c=0,O()},e.vmouse.resetTimerDuration)}function D(){c&&(clearTimeout(c),c=0)}function P(t,n,r){var i;if(r&&r[t]||!r&&k(n.target,t))i=N(n,t),e(n.target).trigger(i);return i}function H(t){var n=e.data(t.target,s),r;!m&&(!E||E!==n)&&(r=P("v"+t.type,t),r&&(r.isDefaultPrevented()&&t.preventDefault(),r.isPropagationStopped()&&t.stopPropagation(),r.isImmediatePropagationStopped()&&t.stopImmediatePropagation()))}function B(t){var n=T(t).touches,r,i,o;n&&n.length===1&&(r=t.target,i=C(r),i.hasVirtualBinding&&(E=w++,e.data(r,s,E),D(),M(),d=!1,o=T(t).touches[0],h=o.pageX,p=o.pageY,P("vmouseover",t,i),P("vmousedown",t,i)))}function j(e){if(g)return;
vendor: 4,463 bytes, line 23119
23119d||P("vmousecancel",e,C(e.target)),d=!0,_()}function F(t){if(g)return;var n=T(t).touches[0],r=d,i=e.vmouse.moveDistanceThreshold,s=C(t.target);d=d||Math.abs(n.pageX-h)>i||Math.abs(n.pageY-p)>i,d&&!r&&P("vmousecancel",t,s),P("vmousemove",t,s),_()}function I(e){if(g)return;A();var t=C(e.target),n,r;P("vmouseup",e,t),d||(n=P("vclick",e,t),n&&n.isDefaultPrevented()&&(r=T(e).changedTouches[0],v.push({touchID:E,x:r.clientX,y:r.clientY}),m=!0)),P("vmouseout",e,t),d=!1,_()}function q(t){var n=e.data(t,i),r;if(n)for(r in n)if(n[r])return!0;return!1}function R(){}function U(t){var n=t.substr(1);return{setup:function(){q(this)||e.data(this,i,{});var r=e.data(this,i);r[t]=!0,l[t]=(l[t]||0)+1,l[t]===1&&b.bind(n,H),e(this).bind(n,R),y&&(l.touchstart=(l.touchstart||0)+1,l.touchstart===1&&b.bind("touchstart",B).bind("touchend",I).bind("touchmove",F).bind("scroll",j))},teardown:function(){--l[t],l[t]||b.unbind(n,H),y&&(--l.touchstart,l.touchstart||b.unbind("touchstart",B).unbind("touchmove",F).unbind("touchend",I).unbind("scroll",j));var r=e(this),s=e.data(this,i);s&&(s[t]=!1),r.unbind(n,R),q(this)||r.removeData(i)}}}var i="virtualMouseBindings",s="virtualTouchID",o="vmouseover vmousedown vmousemove vmouseup vclick vmouseout vmousecancel".split(" "),u="clientX clientY pageX pageY screenX screenY".split(" "),a=e.event.mouseHooks?e.event.mouseHooks.props:[],f=e.event.props.concat(a),l={},c=0,h=0,p=0,d=!1,v=[],m=!1,g=!1,y="addEventListener"in n,b=e(n),w=1,E=0,S,x;e.vmouse={moveDistanceThreshold:10,clickDistanceThreshold:10,resetTimerDuration:1500};for(x=0;x<o.length;x++)e.event.special[o[x]]=U(o[x]);y&&n.addEventListener("click",function(t){var n=v.length,r=t.target,i,o,u,a,f,l;if(n){i=t.clientX,o=t.clientY,S=e.vmouse.clickDistanceThreshold,u=r;while(u){for(a=0;a<n;a++){f=v[a],l=0;if(u===r&&Math.abs(f.x-i)<S&&Math.abs(f.y-o)<S||e.data(u,s)===f.touchID){t.preventDefault(),t.stopPropagation();return}}u=u.parentNode}}},!0)})(e,t,n),function(e){e.mobile={}}(e),function(e,t){var r={touch:"ontouchend"in n};e.mobile.support=e.mobile.support||{},e.extend(e.support,r),e.extend(e.mobile.support,r)}(e),function(e,t,r){function l(t,n,i,s){var o=i.type;i.type=n,s?e.event.trigger(i,r,t):e.event.dispatch.call(t,i),i.type=o}var i=e(n),s=e.mobile.support.touch,o="touchmove scroll",u=s?"touchstart":"mousedown",a=s?"touchend":"mouseup",f=s?"touchmove":"mousemove";e.each("touchstart touchmove touchend tap taphold swipe swipeleft swiperight scrollstart scrollstop".split(" "),function(t,n){e.fn[n]=function(e){return e?this.bind(n,e):this.trigger(n)},e.attrFn&&(e.attrFn[n]=!0)}),e.event.special.scrollstart={enabled:!0,setup:function(){function s(e,n){r=n,l(t,r?"scrollstart":"scrollstop",e)}var t=this,n=e(t),r,i;n.bind(o,function(t){if(!e.event.special.scrollstart.enabled)return;r||s(t,!0),clearTimeout(i),i=setTimeout(function(){s(t,!1)},50)})},teardown:function(){e(this).unbind(o)}},e.event.special.tap={tapholdThreshold:750,emitTapOnTaphold:!0,setup:function(){var t=this,n=e(t),r=!1;n.bind("vmousedown",function(s){function a(){clearTimeout(u)}function f(){a(),n.unbind("vclick",c).unbind("vmouseup",a),i.unbind("vmousecancel",f)}function c(e){f(),!r&&o===e.target?l(t,"tap",e):r&&e.preventDefault()}r=!1;if(s.which&&s.which!==1)return!1;var o=s.target,u;n.bind("vmouseup",a).bind("vclick",c),i.bind("vmousecancel",f),u=setTimeout(function(){e.event.special.tap.emitTapOnTaphold||(r=!0),l(t,"taphold",e.Event("taphold",{target:o}))},e.event.special.tap.tapholdThreshold)})},teardown:function(){e(this).unbind("vmousedown").unbind("vclick").unbind("vmouseup"),i.unbind("vmousecancel")}},e.event.special.swipe={scrollSupressionThreshold:30,durationThreshold:1e3,horizontalDistanceThreshold:30,verticalDistanceThreshold:30,getLocation:function(e){var n=t.pageXOffset,r=t.pageYOffset,i=e.clientX,s=e.clientY;if(e.pageY===0&&Math.floor(s)>Math.floor(e.pageY)||e.pageX===0&&Math.floor(i)>Math.floor(e.pageX))i-=n,s-=r;else if(s<e.pageY-r||i<e.pageX-n)i=e.pageX-n,s=e.pageY-r;return{x:i,y:s}},start:function(t){var n=t.originalEvent.touches?t.originalEvent.touches[0]:t,r=e.event.special.swipe.getLocation(n);return{time:(new Date).getTime(),coords:[r.x,r.y],origin:e(t.target)}},stop:function(t){var n=t.originalEvent.touches?t.originalEvent.touches[0]:t,r=e.event.special.swipe.getLocation(n);return{time:(new Date).getTime(),coords:[r.x,r.y]}},handleSwipe:function(t,n,r,i){if(n.time-t.time<e.event.special.swipe.durationThreshold&&Math.abs(t.coords[0]-n.
23119coords[0])>e.event.special.swipe.horizontalDistanceThreshold&&Math.abs(t.coords[1]-n.coords[1])<e.event.special.swipe.verticalDistanceThreshold){var s=t.coords[0]>n.coords[0]?"swipeleft":"swiperight";return l(r,"swipe",e.Event("swipe",{target:i,swipestart:t,swipestop:n}),!0),l(r,s,e.Event(s,{target:i,swipestart:t,swipestop:n}),!0),!0}return!1},eventInProgress:!1,setup:function(){var t,n=this,r=e(n),s={};t=e.data(this,"mobile-events"),t||(t={length:0},e.data(this,"mobile-events",t)),t.length++,t.swipe=s,s.start=function(t){if(e.event.special.swipe.eventInProgress)return;e.event.special.swipe.eventInProgress=!0;var r,o=e.event.special.swipe.start(t),u=t.target,l=!1;s.move=function(t){if(!o||t.isDefaultPrevented())return;r=e.event.special.swipe.stop(t),l||(l=e.event.special.swipe.handleSwipe(o,r,n,u),l&&(e.event.special.swipe.eventInProgress=!1)),Math.abs(o.coords[0]-r.coords[0])>e.event.special.swipe.scrollSupressionThreshold&&t.preventDefault()},s.stop=function(){l=!0,e.event.special.swipe.eventInProgress=!1,i.off(f,s.move),s.move=null},i.on(f,s.move).one(a,s.stop)},r.on(u,s.start)},teardown:function(){var t,n;t=e.data(this,"mobile-events"),t&&(n=t.swipe,delete t.swipe,t.length--,t.length===0&&e.removeData(this,"mobile-events")),n&&(n.start&&e(this).off(u,n.start),n.move&&i.off(f,n.move),n.stop&&i.off(a,n.stop))}},e.each({scrollstop:"scrollstart",taphold:"tap",swipeleft:"swipe.left",swiperight:"swipe.right"},function(t,n){e.event.special[t]={setup:function(){e(this).bind(n,e.noop)},teardown:function(){e(this).unbind(n)}}})}(e,this)});
23120/* End */
23121;
23122; /* Start:"a:4:{s:4:"full";s:65:"/bitrix/templates/aspro_max/js/jquery.dotdotdot.js?17164655375908";s:6:"source";s:50:"/bitrix/templates/aspro_max/js/jquery.dotdotdot.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
23123!function(t,e){function n(t,e,n){var r=t.children(),o=!1;t.empty();for(var i=0,d=r.length;d>i;i++){var l=r.eq(i);if(t.append(l),n&&t.append(n),a(t,e)){l.remove(),o=!0;break}n&&n.detach()}return o}function r(e,n,i,d,l){var s=!1,c="a table, thead, tbody, tfoot, tr, col, colgroup, object, embed, param, ol, ul, dl, blockquote, select, optgroup, option, textarea, script, style",u="script, .dotdotdot-keep";return e.contents().detach().each(function(){var f=this,h=t(f);if("undefined"==typeof f||3==f.nodeType&&0==t.trim(f.data).length)return!0;if(h.is(u))e.append(h);else{if(s)return!0;e.append(h),!l||h.is(d.after)||h.find(d.after).length||e[e.is(c)?"after":"append"](l),a(i,d)&&(s=3==f.nodeType?o(h,n,i,d,l):r(h,n,i,d,l),s||(h.detach(),s=!0)),s||l&&l.detach()}}),s}function o(e,n,r,o,d){var c=e[0];if(!c)return!1;var f=s(c),h=-1!==f.indexOf(" ")?" ":" ",p="letter"==o.wrap?"":h,g=f.split(p),v=-1,w=-1,y=0,b=g.length-1;for(o.fallbackToLetter&&0==y&&0==b&&(p="",g=f.split(p),b=g.length-1);b>=y&&(0!=y||0!=b);){var m=Math.floor((y+b)/2);if(m==w)break;w=m,l(c,g.slice(0,w+1).join(p)+o.ellipsis),a(r,o)?(b=w,o.fallbackToLetter&&0==y&&0==b&&(p="",g=g[0].split(p),v=-1,w=-1,y=0,b=g.length-1)):(v=w,y=w)}if(-1==v||1==g.length&&0==g[0].length){var T=e.parent();e.detach();var x=d&&d.closest(T).length?d.length:0;T.contents().length>x?c=u(T.contents().eq(-1-x),n):(c=u(T,n,!0),x||T.detach()),c&&(f=i(s(c),o),l(c,f),x&&d&&t(c).parent().append(d))}else f=i(g.slice(0,v+1).join(p),o),l(c,f);return!0}function a(t,e){return t.innerHeight()>e.maxHeight}function i(e,n){for(;t.inArray(e.slice(-1),n.lastCharacter.remove)>-1;)e=e.slice(0,-1);return t.inArray(e.slice(-1),n.lastCharacter.noEllipsis)<0&&(e+=n.ellipsis),e}function d(t){return{width:t.innerWidth(),height:t.innerHeight()}}function l(t,e){t.innerText?t.innerText=e:t.nodeValue?t.nodeValue=e:t.textContent&&(t.textContent=e)}function s(t){return t.innerText?t.innerText:t.nodeValue?t.nodeValue:t.textContent?t.textContent:""}function c(t){do t=t.previousSibling;while(t&&1!==t.nodeType&&3!==t.nodeType);return t}function u(e,n,r){var o,a=e&&e[0];if(a){if(!r){if(3===a.nodeType)return a;
vendor: 4,250 bytes, lines 23123-23137
23123if(t.trim(e.text()))return u(e.contents().last(),n)}for(o=c(a);!o;){if(e=e.parent(),e.is(n)||!e.length)return!1;o=c(e[0])}if(o)return u(t(o),n)}return!1}function f(e,n){return e?"string"==typeof e?(e=t(e,n),e.length?e:!1):e.jquery?e:!1:!1}function h(t){for(var e=t.innerHeight(),n=["paddingTop","paddingBottom"],r=0,o=n.length;o>r;r++){var a=parseInt(t.css(n[r]),10);isNaN(a)&&(a=0),e-=a}return e}if(!t.fn.dotdotdot){t.fn.dotdotdot=function(e){if(0==this.length)return t.fn.dotdotdot.debug('No element found for "'+this.selector+'".'),this;if(this.length>1)return this.each(function(){t(this).dotdotdot(e)});var o=this;o.data("dotdotdot")&&o.trigger("destroy.dot"),o.data("dotdotdot-style",o.attr("style")||""),o.css("word-wrap","break-word"),"nowrap"===o.css("white-space")&&o.css("white-space","normal"),o.bind_events=function(){return o.bind("update.dot",function(e,d){e.preventDefault(),e.stopPropagation(),l.maxHeight="number"==typeof l.height?l.height:h(o),l.maxHeight+=l.tolerance,"undefined"!=typeof d&&(("string"==typeof d||"nodeType"in d&&1===d.nodeType)&&(d=t("<div />").append(d).contents()),d instanceof t&&(i=d)),g=o.wrapInner('<div class="dotdotdot" />').children(),g.contents().detach().end().append(i.clone(!0)).find("br").replaceWith("  <br />  ").end().css({height:"auto",width:"auto",border:"none",padding:0,margin:0});var c=!1,u=!1;return s.afterElement&&(c=s.afterElement.clone(!0),c.show(),s.afterElement.detach()),a(g,l)&&(u="children"==l.wrap?n(g,l,c):r(g,o,g,l,c)),g.replaceWith(g.contents()),g=null,t.isFunction(l.callback)&&l.callback.call(o[0],u,i),s.isTruncated=u,u}).bind("isTruncated.dot",function(t,e){return t.preventDefault(),t.stopPropagation(),"function"==typeof e&&e.call(o[0],s.isTruncated),s.isTruncated}).bind("originalContent.dot",function(t,e){return t.preventDefault(),t.stopPropagation(),"function"==typeof e&&e.call(o[0],i),i}).bind("destroy.dot",function(t){t.preventDefault(),t.stopPropagation(),o.unwatch().unbind_events().contents().detach().end().append(i).attr("style",o.data("dotdotdot-style")||"").data("dotdotdot",!1)}),o},o.unbind_events=function(){return o.unbind(".dot"),o},o.watch=function(){if(o.unwatch(),"window"==l.watch){var e=t(window),n=e.width(),r=e.height();e.bind("resize.dot"+s.dotId,function(){n==e.width()&&r==e.height()&&l.windowResizeFix||(n=e.width(),r=e.height(),u&&clearInterval(u),u=setTimeout(function(){o.trigger("update.dot")},100))})}else c=d(o),u=setInterval(function(){if(o.is(":visible")){var t=d(o);(c.width!=t.width||c.height!=t.height)&&(o.trigger("update.dot"),c=t)}},500);return o},o.unwatch=function(){return t(window).unbind("resize.dot"+s.dotId),u&&clearInterval(u),o};var i=o.contents(),l=t.extend(!0,{},t.fn.dotdotdot.defaults,e),s={},c={},u=null,g=null;return l.lastCharacter.remove instanceof Array||(l.lastCharacter.remove=t.fn.dotdotdot.defaultArrays.lastCharacter.remove),l.lastCharacter.noEllipsis instanceof Array||(l.lastCharacter.noEllipsis=t.fn.dotdotdot.defaultArrays.lastCharacter.noEllipsis),s.afterElement=f(l.after,o),s.isTruncated=!1,s.dotId=p++,o.data("dotdotdot",!0).bind_events().trigger("update.dot"),l.watch&&o.watch(),o},t.fn.dotdotdot.defaults={ellipsis:"... ",wrap:"word",fallbackToLetter:!0,lastCharacter:{},tolerance:0,callback:null,after:null,height:null,watch:!1,windowResizeFix:!0},t.fn.dotdotdot.defaultArrays={lastCharacter:{remove:[" "," ",",",";",".","!","?"],noEllipsis:[]}},t.fn.dotdotdot.debug=function(t){};var p=1,g=t.fn.html;t.fn.html=function(n){return n!=e&&!t.isFunction(n)&&this.data("dotdotdot")?this.trigger("update",[n]):g.apply(this,arguments)};var v=t.fn.text;t.fn.text=function(n){return n!=e&&!t.isFunction(n)&&this.data("dotdotdot")?(n=t("<div />").text(n).html(),this.trigger("update",[n])):v.apply(this,arguments)}}}(jQuery);
23124/* End */
23125;
23126; /* Start:"a:4:{s:4:"full";s:62:"/bitrix/templates/aspro_max/js/rating_likes.js?171646553710797";s:6:"source";s:46:"/bitrix/templates/aspro_max/js/rating_likes.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
23127if (!BXRL)
23128{
23129	var BXRL = {};
23130	var BXRLW = null;
23131}
23132
23133RatingLikes = function(likeId, entityTypeId, entityId, available, userId, localize, template, pathToUserProfile, pathToAjax)
23134{
23135	this.enabled = true;
23136	this.likeId = likeId;
23137	this.entityTypeId = entityTypeId;
23138	this.entityId = entityId;
23139	this.available = (available == 'Y');
23140	this.userId = userId;
23141	this.localize = localize;
23142	this.template = template;
23143	this.pathToUserProfile = pathToUserProfile;
23144	this.pathToAjax = typeof(pathToAjax) == "string"? pathToAjax: '/bitrix/components/bitrix/rating.vote/vote.ajax.php';
23145
23146	this.box = BX('bx-ilike-button-'+likeId);
23147	if (this.box === null)
23148	{
23149		this.enabled = false;
23150		return false;
23151	}
23152
23153	this.button = BX.findChild(this.box, {className:'bx-ilike-left-wrap'}, true, false);
23154	this.wrapp = BX.findChild(this.box, {className:'all-wrapper'}, true, false);
23155	this.buttonText = BX.findChild(this.button, {className:'bx-ilike-text'}, true, false);
23156	this.count = BX.findChild(this.box,  {tagName:'span', className:'bx-ilike-right-wrap'}, true, false);
23157	this.countText	= BX.findChild(this.count, {tagName:'span', className:'bx-ilike-right'}, true, false);
23158	this.popup = null;
23159	this.popupId = null;
23160	this.popupOpenId = null;
23161	this.popupTimeoutId = null;
23162	this.popupContent = BX.findChild(BX('bx-ilike-popup-cont-'+likeId), {tagName:'span', className:'bx-ilike-popup'}, true, false);
23163	this.popupContentPage = 1;
23164	this.popupListProcess = false;
23165	this.popupTimeout = false;
23166	this.likeTimeout = false;
23167
23168	this.lastVote = BX.hasClass(template == 'standart'? this.button: this.count, 'bx-you-like')? 'plus': 'cancel';
23169};
23170
23171RatingLikes.LiveUpdate = function(params)
23172{
23173	if (params.USER_ID == BX.message('USER_ID'))
23174		return false;
23175
23176	for(var i in BXRL)
23177	{
23178		if (BXRL.hasOwnProperty(i))
23179		{
23180			if (BXRL[i].entityTypeId == params.ENTITY_TYPE_ID && BXRL[i].entityId == params.ENTITY_ID)
23181			{
23182				var element = BXRL[i];
23183				element.countText.innerHTML = parseInt(params.TOTAL_POSITIVE_VOTES);
23184				element.count.insertBefore(
23185					BX.create("span", { props : { className : "bx-ilike-plus-one" }, style: {width: (element.countText.clientWidth-8)+'px', height: (element.countText.clientHeight-8)+'px'}, html: (params.TYPE == 'ADD'? '+1': '-1')})
23186					, element.count.firstChild);
23187
23188				if (element.popup)
23189				{
23190					element.popup.close();
23191					element.popupContentPage = 1;
23192				}
23193			}
23194		}
23195	}
23196};
23197
23198RatingLikes.Set = function(likeId, entityTypeId, entityId, available, userId, localize, template, pathToUserProfile, pathToAjax)
23199{
23200	if (template === undefined)
23201		template = 'standart';
23202
23203	if (!BXRL[likeId] || BXRL[likeId].tryToSet <= 5)
23204	{
23205		var tryToSend = BXRL[likeId] && BXRL[likeId].tryToSet? BXRL[likeId].tryToSet: 1;
23206		BXRL[likeId] = new RatingLikes(likeId, entityTypeId, entityId, available, userId, localize, template, pathToUserProfile, pathToAjax);
23207		if (BXRL[likeId].enabled)
23208		{
23209			RatingLikes.Init(likeId);
23210		}
23211		else
23212		{
23213			setTimeout(function(){
23214				BXRL[likeId].tryToSet = tryToSend+1;
23215				RatingLikes.Set(likeId, entityTypeId, entityId, available, userId, localize, template, pathToUserProfile, pathToAjax);
23216			}, 500);
23217		}
23218	}
23219};
23220
23221RatingLikes.Init = function(likeId)
23222{
23223	// like/unlike button
23224	if (BXRL[likeId].available)
23225	{
23226
23227		BX.bind(BXRL[likeId].template == 'standart'? BXRL[likeId].button: BXRL[likeId].buttonText, 'click' ,function(e) {
23228			clearTimeout(BXRL[likeId].likeTimeout);
23229			if (BX.hasClass(BXRL[likeId].template == 'standart'? this: BXRL[likeId].count, 'bx-you-like'))
23230			{
23231				BXRL[likeId].buttonText.innerHTML	=	BXRL[likeId].localize['LIKE_N'];
23232				BXRL[likeId].countText.innerHTML		= 	parseInt(BXRL[likeId].countText.innerHTML)-1;
23233				BX.removeClass(BXRL[likeId].template == 'standart'? this: BXRL[likeId].count, 'bx-you-like');
23234
23235				BXRL[likeId].likeTimeout = setTimeout(function(){
23236					if (BXRL[likeId].lastVote != 'cancel')
23237						RatingLikes.Vote(likeId, 'cancel');
23238				}, 1000);
23239			}
23240			else
23241			{
23242				BXRL[likeId].buttonText.innerHTML	=	BXRL[likeId].localize['LIKE_Y'];
23243				BXRL[likeId].countText.innerHTML 	= 	parseInt(BXRL[likeId].countText.innerHTML)+1;
23244				BX.addClass(BXRL[likeId].template == 'standart'? this: BXRL[likeId].count, 'bx-you-like');
23245
23246				BXRL[likeId].likeTimeout = setTimeout(function(){
23247					if (BXRL[likeId].lastVote != 'plus')
23248						RatingLikes.Vote(likeId, 'plus');
23249				}, 1000);
23250			}
23251			BX.removeClass(this.box, 'bx-ilike-button-hover');
23252			BX.PreventDefault(e);
23253		});
23254		// Hover/unHover like-button
23255		BX.bind(BXRL[likeId].box, 'mouseover', function() {BX.addClass(this, 'bx-ilike-button-hover')});
23256		BX.bind(BXRL[likeId].box, 'mouseout', function() {BX.removeClass(this, 'bx-ilike-button-hover')});
23257
23258	}
23259	else
23260	{
23261		if (BXRL[likeId].buttonText != undefined)
23262			BXRL[likeId].buttonText.innerHTML	=	BXRL[likeId].localize['LIKE_D'];
23263	}
23264	// get like-user-list
23265	RatingLikes.PopupScroll(likeId);
23266	console.log();
23267	BX.bind(BXRL[likeId].wrapp, 'mouseover' , function() {
23268		clearTimeout(BXRL[likeId].popupTimeoutId);
23269		BXRL[likeId].popupTimeoutId = setTimeout(function(){
23270			if (BXRLW == likeId)
23271				return false;
23272			if (BXRL[likeId].popupContentPage == 1)
23273				RatingLikes.List(likeId, 1);
23274			BXRL[likeId].popupTimeoutId = setTimeout(function() {
23275				RatingLikes.OpenWindow(likeId);
23276			}, 400);
23277		}, 400);
23278	});
23279	BX.bind(BXRL[likeId].wrapp, 'mouseout' , function() {
23280		clearTimeout(BXRL[likeId].popupTimeoutId);
23281	});
23282	/*BX.bind(BXRL[likeId].count, 'click' , function() {
23283		clearTimeout(BXRL[likeId].popupTimeoutId);
23284		if (BXRL[likeId].popupContentPage == 1)
23285			RatingLikes.List(likeId, 1);
23286		RatingLikes.OpenWindow(likeId);
23287	});*/
23288
23289	BX.bind(BXRL[likeId].box, 'mouseover' , function() {
23290		clearTimeout(BXRL[likeId].popupTimeout);
23291	});
23292	BX.bind(BXRL[likeId].box, 'mouseout' , function() {
23293		clearTimeout(BXRL[likeId].popupTimeout);
23294		BXRL[likeId].popupTimeout = setTimeout(function(){
23295			if (BXRL[likeId].popup !== null)
23296			{
23297				BXRL[likeId].popup.close();
23298				BXRLW = null;
23299			}
23300		}, 1000);
23301	});
23302};
23303
23304RatingLikes.OpenWindow = function(likeId)
23305{
23306	if (parseInt(BXRL[likeId].countText.innerHTML) == 0)
23307		return false;
23308
23309	if (BXRL[likeId].popup == null)
23310	{
23311		BXRL[likeId].popup = new BX.PopupWindow('ilike-popup-'+likeId, (BXRL[likeId].template == 'standart'? BXRL[likeId].count: BXRL[likeId].box), {
23312			lightShadow : true,
23313			offsetLeft: 5,
23314			autoHide: true,
23315			closeByEsc: true,
23316			zIndex: 2005,
23317			bindOptions: {position: "top"},
23318			events : {
23319				onPopupClose : function() { BXRLW = null; },
23320				onPopupDestroy : function() {  }
23321			},
23322			content : BX('bx-ilike-popup-cont-'+likeId)
23323		});
23324		BXRL[likeId].popup.setAngle({});
23325
23326		BX.bind(BX('ilike-popup-'+likeId), 'mouseout' , function() {
23327			clearTimeout(BXRL[likeId].popupTimeout);
23328			BXRL[likeId].popupTimeout = setTimeout(function(){
23329				BXRL[likeId].popup.close();
23330			}, 1000);
23331		});
23332
23333		BX.bind(BX('ilike-popup-'+likeId), 'mouseover' , function() {
23334			clearTimeout(BXRL[likeId].popupTimeout);
23335		});
23336	}
23337
23338	if (BXRLW != null)
23339		BXRL[BXRLW].popup.close();
23340
23341	BXRLW = likeId;
23342	BXRL[likeId].popup.show();
23343
23344	RatingLikes.AdjustWindow(likeId);
23345};
23346
23347RatingLikes.Vote = function(likeId, voteAction)
23348{
23349	BX.ajax({
23350		url: BXRL[likeId].pathToAjax,
23351		method: 'POST',
23352		dataType: 'json',
23353		data: {'RATING_VOTE' : 'Y', 'RATING_VOTE_TYPE_ID' : BXRL[likeId].entityTypeId, 'RATING_VOTE_ENTITY_ID' : BXRL[likeId].entityId, 'RATING_VOTE_ACTION' : voteAction, 'sessid': BX.bitrix_sessid()},
23354		onsuccess: function(data)	{
23355			BXRL[likeId].lastVote = data.action;
23356			BXRL[likeId].countText.innerHTML = data.items_all;
23357			BXRL[likeId].popupContentPage = 1;
23358
23359			BXRL[likeId].popupContent.innerHTML = '';
23360			spanTag0 = document.createElement("span");
23361			spanTag0.className = "bx-ilike-wait";
23362			BXRL[likeId].popupContent.appendChild(spanTag0);
23363			RatingLikes.AdjustWindow(likeId);
23364
23365			if(BX('ilike-popup-'+likeId) && BX('ilike-popup-'+likeId).style.display == "block")
23366				RatingLikes.List(likeId, null);
23367		},
23368		onfailure: function(data)	{}
23369	});
23370	return false;
23371};
23372
23373RatingLikes.List = function(likeId, page)
23374{
23375	if (parseInt(BXRL[likeId].countText.innerHTML) == 0)
23376		return false;
23377
23378	if (page == null)
23379		page = BXRL[likeId].popupContentPage;
23380	BXRL[likeId].popupListProcess = true;
23381	BX.ajax({
23382		url: BXRL[likeId].pathToAjax,
23383		method: 'POST',
23384		dataType: 'json',
23385		data: {'RATING_VOTE_LIST' : 'Y', 'RATING_VOTE_TYPE_ID' : BXRL[likeId].entityTypeId, 'RATING_VOTE_ENTITY_ID' : BXRL[likeId].entityId, 'RATING_VOTE_LIST_PAGE' : page, 'PATH_TO_USER_PROFILE' : BXRL[likeId].pathToUserProfile, 'sessid': BX.bitrix_sessid()},
23386		onsuccess: function(data)
23387		{
23388			BXRL[likeId].countText.innerHTML = data.items_all;
23389
23390			if ( parseInt(data.items_page) == 0 )
23391				return false;
23392
23393			if (page == 1)
23394			{
23395				BXRL[likeId].popupContent.innerHTML = '';
23396				spanTag0 = document.createElement("span");
23397				spanTag0.className = "bx-ilike-bottom_scroll";
23398				BXRL[likeId].popupContent.appendChild(spanTag0);
23399			}
23400			BXRL[likeId].popupContentPage += 1;
23401
23402			var avatarNode = null;
23403
23404			for (var i = 0; i < data.items.length; i++)
23405			{
23406				if (data.items[i]['PHOTO_SRC'].length > 0)
23407				{
23408					avatarNode = BX.create("IMG", {
23409						attrs: {src: data.items[i]['PHOTO_SRC']},
23410						props: {className: "bx-ilike-popup-avatar-img"}
23411					});
23412				}
23413				else
23414				{
23415					avatarNode = BX.create("IMG", {
23416						attrs: {src: '/bitrix/images/main/blank.gif'},
23417						props: {className: "bx-ilike-popup-avatar-img bx-ilike-popup-avatar-img-default"}
23418					});
23419				}
23420
23421				BXRL[likeId].popupContent.appendChild(
23422					BX.create("div", {
23423						/*attrs: {
23424							href: data.items[i]['URL'],
23425							target: '_blank'
23426						},*/
23427						props: {
23428							className: "bx-ilike-popup-img" + (!!data.items[i]['USER_TYPE'] ? " bx-ilike-popup-img-" + data.items[i]['USER_TYPE'] : "")
23429						},
23430						children: [
23431							BX.create("SPAN", {
23432								props: {
23433									className: "bx-ilike-popup-avatar-new"
23434								},
23435								children: [
23436									avatarNode,
23437									BX.create("SPAN", {
23438										props: {className: "bx-ilike-popup-avatar-status-icon"}
23439									})
23440								]
23441							}),
23442							BX.create("SPAN", {
23443								props: {
23444									className: "bx-ilike-popup-name-new"
23445								},
23446								html: data.items[i]['FULL_NAME']
23447							})
23448						]
23449					})
23450				);
23451			}
23452
23453			RatingLikes.AdjustWindow(likeId);
23454			RatingLikes.PopupScroll(likeId);
23455
23456			BXRL[likeId].popupListProcess = false;
23457		},
23458		onfailure: function(data)	{}
23459	});
23460	return false;
23461};
23462
23463RatingLikes.AdjustWindow = function(likeId)
23464{
23465	if (BXRL[likeId].popup != null)
23466	{
23467		BXRL[likeId].popup.bindOptions.forceBindPosition = true;
23468		BXRL[likeId].popup.adjustPosition();
23469		BXRL[likeId].popup.bindOptions.forceBindPosition = false;
23470	}
23471};
23472
23473RatingLikes.PopupScroll = function(likeId)
23474{
23475	BX.bind(BXRL[likeId].popupContent, 'scroll' , function() {
23476		if (this.scrollTop > (this.scrollHeight - this.offsetHeight) / 1.5)
23477		{
23478			RatingLikes.List(likeId, null);
23479			BX.unbindAll(this);
23480		}
23481	});
23482};
23483
23484/* End */
23485;
23486; /* Start:"a:4:{s:4:"full";s:56:"/bitrix/templates/aspro_max/js/mobile.js?171646553721833";s:6:"source";s:40:"/bitrix/templates/aspro_max/js/mobile.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
23487$(document).ready(function(){
23488    /*  --- Bind mobile menu  --- */
23489        var $mobileMenu = $("#mobilemenu")
23490        if($mobileMenu.length){
23491            $mobileMenu.isLeftSide = $mobileMenu.hasClass('leftside')
23492            $mobileMenu.isOpen = $mobileMenu.hasClass('show')
23493            $mobileMenu.isDowndrop = $mobileMenu.find('>.scroller').hasClass('downdrop')
23494
23495            $('#mobileheader .burger').click(function(){
23496                SwipeMobileMenu()
23497            })
23498
23499            if($mobileMenu.isLeftSide){
23500                $mobileMenu.parent().append('<div id="mobilemenu-overlay"></div>')
23501                var $mobileMenuOverlay = $('#mobilemenu-overlay')
23502
23503                $mobileMenuOverlay.click(function(){
23504                    if($mobileMenu.isOpen){
23505                        CloseMobileMenu()
23506                    }
23507                });
23508
23509                $(document).swiperight(function(e) {
23510                    if(!$(e.target).closest('.flexslider').length && !$(e.target).closest('.swipeignore').length && !$(e.target).closest('.jqmWindow.popup').length){
23511                        OpenMobileMenu()
23512                    }
23513                });
23514
23515                $(document).swipeleft(function(e) {
23516                    if(!$(e.target).closest('.flexslider').length && !$(e.target).closest('.swipeignore').length && !$(e.target).closest('.jqmWindow.popup').length){
23517                        CloseMobileMenu()
23518                    }
23519                });
23520            }
23521            else{
23522                $('#mobileheader').click(function(e){
23523                    if(!$(e.target).closest('#mobilemenu').length && !$(e.target).closest('.burger').length && $mobileMenu.isOpen){
23524                        CloseMobileMenu()
23525                    }
23526                });
23527            }
23528
23529            $('#mobilemenu .menu a,#mobilemenu .social-icons a').click(function(e){
23530                var $this = $(this)
23531                if($this.hasClass('parent')){
23532                    e.preventDefault()
23533
23534                    if(!$mobileMenu.isDowndrop){
23535                        $this.closest('li').addClass('expanded')
23536                        MoveMobileMenuWrapNext()
23537                    }
23538                    else{
23539                        if(!$this.closest('li').hasClass('expanded')){
23540                            $this.closest('li').addClass('expanded')
23541                        }
23542                        else{
23543                            $this.closest('li').removeClass('expanded')
23544                        }
23545                    }
23546                }
23547                else{
23548                    if($this.closest('li').hasClass('counters')){
23549                        var href = $this.attr('href')
23550                        if(typeof href !== 'undefined'){
23551                            window.location.href = href
23552                            window.location.reload()
23553                        }
23554                    }
23555
23556                    if(!$this.closest('.menu_back').length){
23557                        CloseMobileMenu()
23558                    }
23559                }
23560            })
23561
23562            $('#mobilemenu .dropdown .menu_back').click(function(e){
23563                e.preventDefault()
23564                var $this = $(this)
23565                MoveMobileMenuWrapPrev()
23566                setTimeout(function(){
23567                    $this.closest('.expanded').removeClass('expanded')
23568                }, 400)
23569            })
23570
23571            OpenMobileMenu = function(){
23572                CloseMobilePhone();
23573
23574                if(!$mobileMenu.isOpen){
23575                    // hide styleswitcher
23576                    if($('.style-switcher').hasClass('active')){
23577                        $('.style-switcher .switch').trigger('click')
23578                    }
23579                    $('.style-switcher .switch').hide()
23580
23581                    if($mobileMenu.isLeftSide){
23582                        // show overlay
23583                        setTimeout(function(){
23584                            $mobileMenuOverlay.fadeIn('fast')
23585                        }, 100)
23586                    }
23587                    else{
23588                        // scroll body to top & set fixed
23589                        $('body').scrollTop(0).css({position: 'fixed'})
23590
23591                        // set menu top = bottom of header
23592                        $mobileMenu.css({top: + ($('#mobileheader').height() + $('#mobileheader').offset().top) + 'px'})
23593
23594                        // change burger icon
23595                        $('#mobileheader .burger').addClass('c')
23596                    }
23597
23598                    // show menu
23599                    $mobileMenu.addClass('show')
23600                    $mobileMenu.isOpen = true
23601
23602                    if(!$mobileMenu.isDowndrop){
23603                        var $wrap = $mobileMenu.find('.wrap').first()
23604                        var params =  $wrap.data('params')
23605                        if(typeof params === 'undefined'){
23606                            params = {
23607                                depth: 0,
23608                                scroll: {},
23609                                height: {}
23610                            }
23611                        }
23612                        $wrap.data('params', params)
23613                    }
23614                }
23615            }
23616
23617            CloseMobileMenu = function(){
23618                if($mobileMenu.isOpen){
23619                    // hide menu
23620                    $mobileMenu.removeClass('show')
23621                    $mobileMenu.isOpen = false
23622
23623                    // show styleswitcher
23624                    $('.style-switcher .switch').show()
23625
23626                    if($mobileMenu.isLeftSide){
23627                        // hide overlay
23628                        setTimeout(function(){
23629                            $mobileMenuOverlay.fadeOut('fast')
23630                        }, 100)
23631                    }
23632                    else{
23633                        // change burger icon
23634                        $('#mobileheader .burger').removeClass('c')
23635
23636                        // body unset fixed
23637                        $('body').css({position: ''})
23638                    }
23639
23640                    if(!$mobileMenu.isDowndrop){
23641                        setTimeout(function(){
23642                            var $scroller = $mobileMenu.find('.scroller').first()
23643                            var $wrap = $mobileMenu.find('.wrap').first()
23644                            var params =  $wrap.data('params')
23645                            params.depth = 0
23646                            $wrap.data('params', params).attr('style', '')
23647                            $mobileMenu.scrollTop(0)
23648                            $scroller.css('height', '')
23649                        }, 400)
23650                    }
23651                }
23652            }
23653
23654            SwipeMobileMenu = function(){
23655                if($mobileMenu.isOpen){
23656                    CloseMobileMenu()
23657                }
23658                else{
23659                    OpenMobileMenu()
23660                }
23661            }
23662
23663            function MoveMobileMenuWrapNext(){
23664                if(!$mobileMenu.isDowndrop){
23665                    var $scroller = $mobileMenu.find('.scroller').first()
23666                    var $wrap = $mobileMenu.find('.wrap').first()
23667                    if($wrap.length){
23668                        var params =  $wrap.data('params')
23669                        var $dropdownNext = $mobileMenu.find('.expanded>.dropdown').eq(params.depth)
23670                        if($dropdownNext.length){
23671                            // save scroll position
23672                            params.scroll[params.depth] = parseInt($mobileMenu.scrollTop())
23673
23674                            // height while move animating
23675                            params.height[params.depth + 1] = Math.max($dropdownNext.height(), (!params.depth ? $wrap.height() : $mobileMenu.find('.expanded>.dropdown').eq(params.depth - 1).height()))
23676                            $scroller.css('height', params.height[params.depth + 1] + 'px')
23677
23678                            // inc depth
23679                            ++params.depth
23680
23681                            // translateX for move
23682                            $wrap.css('transform', 'translateX(' + -100 * params.depth + '%)')
23683
23684                            // scroll to top
23685                            setTimeout(function() {
23686                                $mobileMenu.animate({scrollTop : 0}, 200);
23687                            }, 100)
23688
23689                            // height on enimating end
23690                            var h = $dropdownNext.height()
23691                            setTimeout(function() {
23692                                if(h){
23693                                    $scroller.css('height', h + 'px')
23694                                }
23695                                else{
23696                                    $scroller.css('height', '')
23697                                }
23698                            }, 200)
23699                        }
23700
23701                        $wrap.data('params', params)
23702                    }
23703                }
23704            }
23705
23706            function MoveMobileMenuWrapPrev(){
23707                if(!$mobileMenu.isDowndrop){
23708                    var $scroller = $mobileMenu.find('.scroller').first()
23709                    var $wrap = $mobileMenu.find('.wrap').first()
23710                    if($wrap.length){
23711                        var params =  $wrap.data('params')
23712                        if(params.depth > 0){
23713                            var $dropdown = $mobileMenu.find('.expanded>.dropdown').eq(params.depth - 1)
23714                            if($dropdown.length){
23715                                // height while move animating
23716                                $scroller.css('height', params.height[params.depth] + 'px')
23717
23718                                // dec depth
23719                                --params.depth
23720
23721                                // translateX for move
23722                                $wrap.css('transform', 'translateX(' + -100 * params.depth + '%)')
23723
23724                                // restore scroll position
23725                                setTimeout(function() {
23726                                    $mobileMenu.animate({scrollTop : params.scroll[params.depth]}, 200);
23727                                }, 100)
23728
23729                                // height on enimating end
23730                                var h = (!params.depth ? false : $mobileMenu.find('.expanded>.dropdown').eq(params.depth - 1).height())
23731                                setTimeout(function() {
23732                                    if(h){
23733                                        $scroller.css('height', h + 'px')
23734                                    }
23735                                    else{
23736                                        $scroller.css('height', '')
23737                                    }
23738                                }, 200)
23739                            }
23740                        }
23741
23742                        $wrap.data('params', params)
23743                    }
23744                }
23745            }
23746        }
23747    /*  --- END Bind mobile menu  --- */
23748
23749    /*  --- Bind mobile phone  --- */
23750        var $mobileHeader = $("#mobileheader");
23751        var $mobilePhone = $("#mobilePhone");
23752        $mobilePhone.isOpen = false;
23753        if($mobilePhone.length){
23754            $mobilePhone.isOpen = $mobilePhone.hasClass('show');
23755
23756            $(document).on('click', '.wrap_phones .svg-inline-phone', function(e){
23757                SwipeMobilePhone();
23758                e.stopPropagation();
23759            });
23760
23761            $(document).on('click', '.wrap_phones .svg-inline-close', function(e){
23762                CloseMobilePhone();
23763                e.stopPropagation();
23764            });
23765        }
23766
23767        SwipeMobilePhone = function(){
23768            if($mobilePhone.isOpen){
23769                CloseMobilePhone();
23770            }
23771            else{
23772                OpenMobilePhone();
23773            }
23774        }
23775
23776        OpenMobilePhone = function(){
23777            if(!$mobilePhone.isOpen){
23778                CloseMobileMenu();
23779
23780                // show overlay
23781                $('<div class="jqmOverlay mobp" style="top:'+($mobileHeader.position().top+$mobileHeader.height())+'px;position:absolute"></div>').appendTo('body');
23782
23783                // toggle phones
23784                setTimeout(function(){
23785                    $mobilePhone.slideDown('fast', function(){
23786                        $mobilePhone.addClass('show');
23787                        $mobilePhone.isOpen = true;
23788                    });
23789                }, 100);
23790            }
23791        }
23792
23793        CloseMobilePhone = function(){
23794            if($mobilePhone.isOpen){
23795            	// toggle phones
23796                setTimeout(function(){
23797                    $mobilePhone.slideUp('fast', function(){
23798                        $mobilePhone.removeClass('show');
23799                        $mobilePhone.isOpen = false;
23800
23801    		        	// hide overlay
23802    		            $('.jqmOverlay.mobp').remove();
23803                    });
23804                }, 100);
23805            }
23806        }
23807
23808        checkMobilePhone = function(){
23809            if((!window.matchMedia('(max-width: 991px)').matches)){
23810                CloseMobilePhone();
23811    		}
23812        }
23813    /*  --- END Bind mobile phone  --- */
23814
23815    /*  --- Bind mobile filter  --- */
23816        var $mobilefilter = $("#mobilefilter");
23817        if($mobilefilter.length){
23818            $mobilefilter.isOpen = $mobileMenu.hasClass('show');
23819            $mobilefilter.isAppendLeft = false;
23820            $mobilefilter.isWrapFilter = false;
23821            $mobilefilter.isHorizontalOrCompact = $('.filter_horizontal').length || $('.bx_filter_vertical.compact').length;
23822            $mobilefilter.close = '<i class="svg svg-close close-icons"></i>';
23823
23824            $(document).on('click', '.bx-filter-title', function(){
23825                OpenMobileFilter();
23826            });
23827
23828            $(document).on('click', '#mobilefilter .svg-close.close-icons', function(){
23829                CloseMobileFilter();
23830            });
23831
23832            $(document).on('click', '.bx_filter_select_block', function(e){
23833                var bx_filter_select_container = $(e.target).parents('.bx_filter_select_container');
23834                if(bx_filter_select_container.length) {
23835                    var prop_id = bx_filter_select_container.closest('.bx_filter_parameters_box').attr('data-property_id');
23836                    if($('#smartFilterDropDown'+prop_id).length){
23837    					$('#smartFilterDropDown'+prop_id).css({"max-width":bx_filter_select_container.width(), "z-index":"3020"});
23838                    }
23839                }
23840            });
23841
23842            $(document).on('mouseup', '.bx_filter_section', function(e){
23843                if($(e.target).hasClass('bx_filter_search_button')) {
23844                    CloseMobileFilter();
23845                }
23846            });
23847
23848
23849            $(document).on('mouseup', '.bx_filter_parameters_box_title', function(e){
23850                $("[id^='smartFilterDropDown']").hide();
23851                if($(e.target).hasClass('close-icons')) {
23852                    CloseMobileFilter();
23853                }
23854            });
23855
23856            /*$(document).on('DOMSubtreeModified', "#mobilefilter #modef_num_mobile", function() {
23857                mobileFilterNum($(this));
23858            });
23859
23860            $(document).on('DOMSubtreeModified', "#mobilefilter .bx_filter_container_modef", function() {
23861                mobileFilterNum($(this));
23862            });*/
23863
23864            $mobilefilter.parent().append('<div id="mobilefilter-overlay"></div>');
23865            var $mobilefilterOverlay = $('#mobilefilter-overlay');
23866
23867            $mobilefilterOverlay.click(function(){
23868                if($mobilefilter.isOpen){
23869                    CloseMobileFilter();
23870                    //e.stopPropagation();
23871                }
23872            });
23873
23874            mobileFilterNum = function(num, def){
23875                if(def){
23876                    $('.bx_filter_search_button').text(num.data("f"));;
23877                }
23878                else {
23879                    var str = "";
23880                    var $prosLeng = $('.bx_filter_parameters_box > span');
23881
23882                    str += $prosLeng.data("f") + " " + num + " " + declOfNumFilter(num, [$prosLeng.data("fi"), $prosLeng.data("fr"), $prosLeng.data("frm"),]);
23883                    $('.bx_filter_search_button').text(str);
23884                }
23885            }
23886
23887            declOfNumFilter = function(number, titles){
23888                cases = [2, 0, 1, 1, 1, 2];
23889                return titles[ (number%100>4 && number%100<20)? 2 : cases[(number%10<5)?number%10:5] ];
23890            }
23891
23892            OpenMobileFilter = function(){
23893                if(!$mobilefilter.isOpen)
23894                {
23895                    $('body').addClass('jqm-initied wf');
23896
23897                    $('.bx_filter_vertical .slide-block__head.filter_title').removeClass('closed');
23898                    $('.bx_filter_vertical .slide-block__head.filter_title + .slide-block__body').show();
23899
23900
23901                    if(!$mobilefilter.isAppendLeft)
23902                    {
23903                        if(!$mobilefilter.isWrapFilter)
23904                        {
23905                            $(".bx_filter").wrap("<div id='wrapInlineFilter'></div>");
23906                            $mobilefilter.isWrapFilter = true;
23907                        }
23908                        $(".bx_filter").appendTo($("#mobilefilter"));
23909                        var helper = $('#filter-helper');
23910                        if(helper.length) {
23911                            helper.prependTo($("#mobilefilter .bx_filter_parameters"));
23912                        }
23913                        $mobilefilter.isAppendLeft = true;
23914
23915                    }
23916
23917                    $("#mobilefilter .bx_filter_parameters").addClass('scrollbar');
23918                    $("#mobilefilter .slide-block .filter_title").addClass('ignore');
23919                    $("#mobilefilter .bx_filter_parameters .bx_filter_parameters_box_title").addClass('colored_theme_hover_bg-block');
23920
23921                    $(".bx_filter_button_box.ajax-btns").addClass('colored_theme_bg');
23922                    $(".bx_filter_button_box.ajax-btns .filter-bnt-wrapper").removeClass('hidden');
23923                    InitCustomScrollBar();
23924
23925                    // show overlay
23926                    setTimeout(function(){
23927    					$mobilefilterOverlay.fadeIn('fast');
23928                    }, 100);
23929
23930                    // fix body
23931                    $('body').css({'overflow': 'hidden','height': '100vh'});
23932
23933                    // show mobile filter
23934                    $mobilefilter.addClass('show');
23935                    $mobilefilter.find('.bx_filter').css({'display':'block'});
23936                    $mobilefilter.isOpen = true;
23937
23938                    var init =  $mobilefilter.data('init');
23939                    if(typeof init === 'undefined'){
23940                        $mobilefilter.scroll(function() {
23941                            $(".bx_filter_section .bx_filter_select_container").each(function(){
23942                                var prop_id=$(this).closest('.bx_filter_parameters_box').attr('data-property_id');
23943                                if($('#smartFilterDropDown'+prop_id).length){
23944                                    $('#smartFilterDropDown'+prop_id).hide();
23945                                }
23946                            });
23947                        });
23948
23949                        $mobilefilter.data('init', "Y");
23950                    };
23951                };
23952            }
23953
23954            CloseMobileFilter = function(append){
23955                $mobilefilter.find('.bx_filter_parameters').removeClass('scrollbar');
23956                
23957                if($("#mobilefilter .bx_filter_parameters").length)
23958                    $('body').removeClass('jqm-initied wf');
23959
23960                $("#mobilefilter .bx_filter_parameters .bx_filter_parameters_box_title").removeClass('colored_theme_hover_bg-block');
23961                $(".slide-block .filter_title").removeClass('ignore');
23962                $(".bx_filter_button_box.ajax-btns").removeClass('colored_theme_bg');
23963
23964                $(".bx_filter:not(.n-ajax) .bx_filter_button_box.ajax-btns .filter-bnt-wrapper").addClass('hidden');
23965
23966                if($mobilefilter.isOpen){
23967                	// scroll to top
23968                    $mobilefilter.find('.bx_filter_parameters').scrollTop(0);
23969
23970                    // unfix body
23971                    $('body').css({'overflow': '','height': ''});
23972
23973                    // hide overlay
23974                    setTimeout(function(){
23975    					$mobilefilterOverlay.fadeOut('fast');
23976                    }, 100);
23977
23978                    // hide mobile filter
23979                    $mobilefilter.removeClass('show');
23980                    $mobilefilter.isOpen = false;
23981                }
23982
23983                if(append && $mobilefilter.isAppendLeft){
23984                    $(".bx_filter").appendTo($("#wrapInlineFilter")).show();
23985                    var helper = $('#filter-helper');
23986                    if(helper.length) {
23987                        helper.appendTo($('#filter-helper-wrapper'));
23988                    }
23989                    $mobilefilter.isAppendLeft = false;
23990                    $mobilefilter.removeData('init');
23991                    mobileFilterNum($("#modef_num_mobile"),true);
23992    	        }
23993            }
23994
23995            checkMobileFilter = function(){
23996                if((!window.matchMedia('(max-width: 991px)').matches && !$mobilefilter.isHorizontalOrCompact) || (!window.matchMedia('(max-width: 767px)').matches && $mobilefilter.isHorizontalOrCompact)){
23997                    CloseMobileFilter(true);
23998    			}
23999            }
24000        }
24001        else {
24002            checkTopFilter();
24003            $(document).on('click', '.bx-filter-title', function(){
24004    			$(this).toggleClass("opened");
24005    			if($('.visible_mobile_filter').length) {
24006    				$('.visible_mobile_filter').show();
24007    				$('.bx_filter_vertical, .bx_filter').slideToggle(333);
24008    			}
24009    			else{
24010    				$('.bx_filter_vertical').closest('div[id^=bx_incl]').show();
24011    			    $('.bx_filter_vertical, .bx_filter').slideToggle(333);
24012    			}
24013            });
24014        }
24015    /*  --- END Bind mobile filter  --- */
24016})
24017/* End */
24018;
24019; /* Start:"a:4:{s:4:"full";s:73:"/bitrix/templates/aspro_max/js/jquery.mCustomScrollbar.js?171646553794214";s:6:"source";s:57:"/bitrix/templates/aspro_max/js/jquery.mCustomScrollbar.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
24020/*
24021== malihu jquery custom scrollbar plugin == 
24022Version: 3.1.5 
24023Plugin URI: http://manos.malihu.gr/jquery-custom-content-scroller 
24024Author: malihu
24025Author URI: http://manos.malihu.gr
24026License: MIT License (MIT)
24027*/
24028
24029/*
24030Copyright Manos Malihutsakis (email: [email protected])
24031
24032Permission is hereby granted, free of charge, to any person obtaining a copy
24033of this software and associated documentation files (the "Software"), to deal
24034in the Software without restriction, including without limitation the rights
24035to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
24036copies of the Software, and to permit persons to whom the Software is
24037furnished to do so, subject to the following conditions:
24038
24039The above copyright notice and this permission notice shall be included in
24040all copies or substantial portions of the Software.
24041
24042THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24043IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24044FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24045AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24046LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24047OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24048THE SOFTWARE.
24049*/
24050
24051/*
24052The code below is fairly long, fully commented and should be normally used in development. 
24053For production, use either the minified jquery.mCustomScrollbar.min.js script or 
24054the production-ready jquery.mCustomScrollbar.concat.min.js which contains the plugin 
24055and dependencies (minified). 
24056*/
24057
24058(function(factory){
24059	if(typeof define==="function" && define.amd){
24060		define(["jquery"],factory);
24061	}else if(typeof module!=="undefined" && module.exports){
24062		module.exports=factory;
24063	}else{
24064		factory(jQuery,window,document);
24065	}
24066}(function($){
24067(function(init){
24068	var _rjs=typeof define==="function" && define.amd, /* RequireJS */
24069		_njs=typeof module !== "undefined" && module.exports, /* NodeJS */
24070		_dlp=("https:"==document.location.protocol) ? "https:" : "http:", /* location protocol */
24071		_url="cdnjs.cloudflare.com/ajax/libs/jquery-mousewheel/3.1.13/jquery.mousewheel.min.js";
24072	if(!_rjs){
24073		if(_njs){
24074			require("jquery-mousewheel")($);
24075		}else{
24076			/* load jquery-mousewheel plugin (via CDN) if it's not present or not loaded via RequireJS 
24077			(works when mCustomScrollbar fn is called on window load) */
24078			$.event.special.mousewheel || $("head").append(decodeURI("%3Cscript src="+_dlp+"//"+_url+"%3E%3C/script%3E"));
24079		}
24080	}
vendor: 9,056 bytes, lines 24081-24403
24081	init();
24082}(function(){
24083	
24084	/* 
24085	----------------------------------------
24086	PLUGIN NAMESPACE, PREFIX, DEFAULT SELECTOR(S) 
24087	----------------------------------------
24088	*/
24089	
24090	var pluginNS="mCustomScrollbar",
24091		pluginPfx="mCS",
24092		defaultSelector=".mCustomScrollbar",
24093	
24094	
24095		
24096	
24097	
24098	/* 
24099	----------------------------------------
24100	DEFAULT OPTIONS 
24101	----------------------------------------
24102	*/
24103	
24104		defaults={
24105			/*
24106			set element/content width/height programmatically 
24107			values: boolean, pixels, percentage 
24108				option						default
24109				-------------------------------------
24110				setWidth					false
24111				setHeight					false
24112			*/
24113			/*
24114			set the initial css top property of content  
24115			values: string (e.g. "-100px", "10%" etc.)
24116			*/
24117			setTop:0,
24118			/*
24119			set the initial css left property of content  
24120			values: string (e.g. "-100px", "10%" etc.)
24121			*/
24122			setLeft:0,
24123			/* 
24124			scrollbar axis (vertical and/or horizontal scrollbars) 
24125			values (string): "y", "x", "yx"
24126			*/
24127			axis:"y",
24128			/*
24129			position of scrollbar relative to content  
24130			values (string): "inside", "outside" ("outside" requires elements with position:relative)
24131			*/
24132			scrollbarPosition:"inside",
24133			/*
24134			scrolling inertia
24135			values: integer (milliseconds)
24136			*/
24137			scrollInertia:100,
24138			/* 
24139			auto-adjust scrollbar dragger length
24140			values: boolean
24141			*/
24142			autoDraggerLength:true,
24143			/*
24144			auto-hide scrollbar when idle 
24145			values: boolean
24146				option						default
24147				-------------------------------------
24148				autoHideScrollbar			false
24149			*/
24150			/*
24151			auto-expands scrollbar on mouse-over and dragging
24152			values: boolean
24153				option						default
24154				-------------------------------------
24155				autoExpandScrollbar			false
24156			*/
24157			/*
24158			always show scrollbar, even when there's nothing to scroll 
24159			values: integer (0=disable, 1=always show dragger rail and buttons, 2=always show dragger rail, dragger and buttons), boolean
24160			*/
24161			alwaysShowScrollbar:0,
24162			/*
24163			scrolling always snaps to a multiple of this number in pixels
24164			values: integer, array ([y,x])
24165				option						default
24166				-------------------------------------
24167				snapAmount					null
24168			*/
24169			/*
24170			when snapping, snap with this number in pixels as an offset 
24171			values: integer
24172			*/
24173			snapOffset:0,
24174			/* 
24175			mouse-wheel scrolling
24176			*/
24177			mouseWheel:{
24178				/* 
24179				enable mouse-wheel scrolling
24180				values: boolean
24181				*/
24182				enable:true,
24183				/* 
24184				scrolling amount in pixels
24185				values: "auto", integer 
24186				*/
24187				scrollAmount:"auto",
24188				/* 
24189				mouse-wheel scrolling axis 
24190				the default scrolling direction when both vertical and horizontal scrollbars are present 
24191				values (string): "y", "x" 
24192				*/
24193				axis:"y",
24194				/* 
24195				prevent the default behaviour which automatically scrolls the parent element(s) when end of scrolling is reached 
24196				values: boolean
24197					option						default
24198					-------------------------------------
24199					preventDefault				null
24200				*/
24201				/*
24202				the reported mouse-wheel delta value. The number of lines (translated to pixels) one wheel notch scrolls.  
24203				values: "auto", integer 
24204				"auto" uses the default OS/browser value 
24205				*/
24206				deltaFactor:"auto",
24207				/*
24208				normalize mouse-wheel delta to -1 or 1 (disables mouse-wheel acceleration) 
24209				values: boolean
24210					option						default
24211					-------------------------------------
24212					normalizeDelta				null
24213				*/
24214				/*
24215				invert mouse-wheel scrolling direction 
24216				values: boolean
24217					option						default
24218					-------------------------------------
24219					invert						null
24220				*/
24221				/*
24222				the tags that disable mouse-wheel when cursor is over them
24223				*/
24224				disableOver:["select","option","keygen","datalist","textarea"]
24225			},
24226			/* 
24227			scrollbar buttons
24228			*/
24229			scrollButtons:{ 
24230				/*
24231				enable scrollbar buttons
24232				values: boolean
24233					option						default
24234					-------------------------------------
24235					enable						null
24236				*/
24237				/*
24238				scrollbar buttons scrolling type 
24239				values (string): "stepless", "stepped"
24240				*/
24241				scrollType:"stepless",
24242				/*
24243				scrolling amount in pixels
24244				values: "auto", integer 
24245				*/
24246				scrollAmount:"auto"
24247				/*
24248				tabindex of the scrollbar buttons
24249				values: false, integer
24250					option						default
24251					-------------------------------------
24252					tabindex					null
24253				*/
24254			},
24255			/* 
24256			keyboard scrolling
24257			*/
24258			keyboard:{ 
24259				/*
24260				enable scrolling via keyboard
24261				values: boolean
24262				*/
24263				enable:true,
24264				/*
24265				keyboard scrolling type 
24266				values (string): "stepless", "stepped"
24267				*/
24268				scrollType:"stepless",
24269				/*
24270				scrolling amount in pixels
24271				values: "auto", integer 
24272				*/
24273				scrollAmount:"auto"
24274			},
24275			/*
24276			enable content touch-swipe scrolling 
24277			values: boolean, integer, string (number)
24278			integer values define the axis-specific minimum amount required for scrolling momentum
24279			*/
24280			contentTouchScroll:25,
24281			/*
24282			enable/disable document (default) touch-swipe scrolling 
24283			*/
24284			documentTouchScroll:true,
24285			/*
24286			advanced option parameters
24287			*/
24288			advanced:{
24289				/*
24290				auto-expand content horizontally (for "x" or "yx" axis) 
24291				values: boolean, integer (the value 2 forces the non scrollHeight/scrollWidth method, the value 3 forces the scrollHeight/scrollWidth method)
24292					option						default
24293					-------------------------------------
24294					autoExpandHorizontalScroll	null
24295				*/
24296				/*
24297				auto-scroll to elements with focus
24298				*/
24299				autoScrollOnFocus:"input,textarea,select,button,datalist,keygen,a[tabindex],area,object,[contenteditable='true']",
24300				/*
24301				auto-update scrollbars on content, element or viewport resize 
24302				should be true for fluid layouts/elements, adding/removing content dynamically, hiding/showing elements, content with images etc. 
24303				values: boolean
24304				*/
24305				updateOnContentResize:true,
24306				/*
24307				auto-update scrollbars each time each image inside the element is fully loaded 
24308				values: "auto", boolean
24309				*/
24310				updateOnImageLoad:"auto",
24311				/*
24312				auto-update scrollbars based on the amount and size changes of specific selectors 
24313				useful when you need to update the scrollbar(s) automatically, each time a type of element is added, removed or changes its size 
24314				values: boolean, string (e.g. "ul li" will auto-update scrollbars each time list-items inside the element are changed) 
24315				a value of true (boolean) will auto-update scrollbars each time any element is changed
24316					option						default
24317					-------------------------------------
24318					updateOnSelectorChange		null
24319				*/
24320				/*
24321				extra selectors that'll allow scrollbar dragging upon mousemove/up, pointermove/up, touchend etc. (e.g. "selector-1, selector-2")
24322					option						default
24323					-------------------------------------
24324					extraDraggableSelectors		null
24325				*/
24326				/*
24327				extra selectors that'll release scrollbar dragging upon mouseup, pointerup, touchend etc. (e.g. "selector-1, selector-2")
24328					option						default
24329					-------------------------------------
24330					releaseDraggableSelectors	null
24331				*/
24332				/*
24333				auto-update timeout 
24334				values: integer (milliseconds)
24335				*/
24336				autoUpdateTimeout:60
24337			},
24338			/* 
24339			scrollbar theme 
24340			values: string (see CSS/plugin URI for a list of ready-to-use themes)
24341			*/
24342			theme:"light",
24343			/*
24344			user defined callback functions
24345			*/
24346			callbacks:{
24347				/*
24348				Available callbacks: 
24349					callback					default
24350					-------------------------------------
24351					onCreate					null
24352					onInit						null
24353					onScrollStart				null
24354					onScroll					null
24355					onTotalScroll				null
24356					onTotalScrollBack			null
24357					whileScrolling				null
24358					onOverflowY					null
24359					onOverflowX					null
24360					onOverflowYNone				null
24361					onOverflowXNone				null
24362					onImageLoad					null
24363					onSelectorChange			null
24364					onBeforeUpdate				null
24365					onUpdate					null
24366				*/
24367				onTotalScrollOffset:0,
24368				onTotalScrollBackOffset:0,
24369				alwaysTriggerOffsets:true
24370			}
24371			/*
24372			add scrollbar(s) on all elements matching the current selector, now and in the future 
24373			values: boolean, string 
24374			string values: "on" (enable), "once" (disable after first invocation), "off" (disable)
24375			liveSelector values: string (selector)
24376				option						default
24377				-------------------------------------
24378				live						false
24379				liveSelector				null
24380			*/
24381		},
24382	
24383	
24384	
24385	
24386	
24387	/* 
24388	----------------------------------------
24389	VARS, CONSTANTS 
24390	----------------------------------------
24391	*/
24392	
24393		totalInstances=0, /* plugin instances amount */
24394		liveTimers={}, /* live option timers */
24395		oldIE=(window.attachEvent && !window.addEventListener) ? 1 : 0, /* detect IE < 9 */
24396		touchActive=false,touchable, /* global touch vars (for touch and pointer events) */
24397		/* general plugin classes */
24398		classes=[
24399			"mCSB_dragger_onDrag","mCSB_scrollTools_onDrag","mCS_img_loaded","mCS_disabled","mCS_destroyed","mCS_no_scrollbar",
24400			"mCS-autoHide","mCS-dir-rtl","mCS_no_scrollbar_y","mCS_no_scrollbar_x","mCS_y_hidden","mCS_x_hidden","mCSB_draggerContainer",
24401			"mCSB_buttonUp","mCSB_buttonDown","mCSB_buttonLeft colored_theme_hover_text","mCSB_buttonRight colored_theme_hover_text"
24402		],
24403		touchOffCustom = false;
vendor: 22,935 bytes, lines 24403-24967
24403
24404		
24405	
24406	
24407	
24408	
24409	/* 
24410	----------------------------------------
24411	METHODS 
24412	----------------------------------------
24413	*/
24414	
24415		methods={
24416			
24417			/* 
24418			plugin initialization method 
24419			creates the scrollbar(s), plugin data object and options
24420			----------------------------------------
24421			*/
24422			
24423			init:function(options){
24424				
24425				var options=$.extend(true,{},defaults,options),
24426					selector=_selector.call(this); /* validate selector */
24427				
24428				/* 
24429				if live option is enabled, monitor for elements matching the current selector and 
24430				apply scrollbar(s) when found (now and in the future) 
24431				*/
24432				if(options.live){
24433					var liveSelector=options.liveSelector || this.selector || defaultSelector, /* live selector(s) */
24434						$liveSelector=$(liveSelector); /* live selector(s) as jquery object */
24435					if(options.live==="off"){
24436						/* 
24437						disable live if requested 
24438						usage: $(selector).mCustomScrollbar({live:"off"}); 
24439						*/
24440						removeLiveTimers(liveSelector);
24441						return;
24442					}
24443					liveTimers[liveSelector]=setTimeout(function(){
24444						/* call mCustomScrollbar fn on live selector(s) every half-second */
24445						$liveSelector.mCustomScrollbar(options);
24446						if(options.live==="once" && $liveSelector.length){
24447							/* disable live after first invocation */
24448							removeLiveTimers(liveSelector);
24449						}
24450					},500);
24451				}else{
24452					removeLiveTimers(liveSelector);
24453				}
24454				
24455				/* options backward compatibility (for versions < 3.0.0) and normalization */
24456				options.setWidth=(options.set_width) ? options.set_width : options.setWidth;
24457				options.setHeight=(options.set_height) ? options.set_height : options.setHeight;
24458				options.axis=(options.horizontalScroll) ? "x" : _findAxis(options.axis);
24459				options.scrollInertia=options.scrollInertia>0 && options.scrollInertia<17 ? 17 : options.scrollInertia;
24460				if(typeof options.mouseWheel!=="object" &&  options.mouseWheel==true){ /* old school mouseWheel option (non-object) */
24461					options.mouseWheel={enable:true,scrollAmount:"auto",axis:"y",preventDefault:false,deltaFactor:"auto",normalizeDelta:false,invert:false}
24462				}
24463				options.mouseWheel.scrollAmount=!options.mouseWheelPixels ? options.mouseWheel.scrollAmount : options.mouseWheelPixels;
24464				options.mouseWheel.normalizeDelta=!options.advanced.normalizeMouseWheelDelta ? options.mouseWheel.normalizeDelta : options.advanced.normalizeMouseWheelDelta;
24465				options.scrollButtons.scrollType=_findScrollButtonsType(options.scrollButtons.scrollType); 
24466				
24467				_theme(options); /* theme-specific options */
24468				
24469				/* plugin constructor */
24470				return $(selector).each(function(){
24471					
24472					var $this=$(this);
24473					
24474					if(!$this.data(pluginPfx)){ /* prevent multiple instantiations */
24475					
24476						/* store options and create objects in jquery data */
24477						$this.data(pluginPfx,{
24478							idx:++totalInstances, /* instance index */
24479							opt:options, /* options */
24480							scrollRatio:{y:null,x:null}, /* scrollbar to content ratio */
24481							overflowed:null, /* overflowed axis */
24482							contentReset:{y:null,x:null}, /* object to check when content resets */
24483							bindEvents:false, /* object to check if events are bound */
24484							tweenRunning:false, /* object to check if tween is running */
24485							sequential:{}, /* sequential scrolling object */
24486							langDir:$this.css("direction"), /* detect/store direction (ltr or rtl) */
24487							cbOffsets:null, /* object to check whether callback offsets always trigger */
24488							/* 
24489							object to check how scrolling events where last triggered 
24490							"internal" (default - triggered by this script), "external" (triggered by other scripts, e.g. via scrollTo method) 
24491							usage: object.data("mCS").trigger
24492							*/
24493							trigger:null,
24494							/* 
24495							object to check for changes in elements in order to call the update method automatically 
24496							*/
24497							poll:{size:{o:0,n:0},img:{o:0,n:0},change:{o:0,n:0}}
24498						});
24499						
24500						var d=$this.data(pluginPfx),o=d.opt,
24501							/* HTML data attributes */
24502							htmlDataAxis=$this.data("mcs-axis"),htmlDataSbPos=$this.data("mcs-scrollbar-position"),htmlDataTheme=$this.data("mcs-theme");
24503						 
24504						if(htmlDataAxis){o.axis=htmlDataAxis;} /* usage example: data-mcs-axis="y" */
24505						if(htmlDataSbPos){o.scrollbarPosition=htmlDataSbPos;} /* usage example: data-mcs-scrollbar-position="outside" */
24506						if(htmlDataTheme){ /* usage example: data-mcs-theme="minimal" */
24507							o.theme=htmlDataTheme;
24508							_theme(o); /* theme-specific options */
24509						}
24510						
24511						_pluginMarkup.call(this); /* add plugin markup */
24512						
24513						if(d && o.callbacks.onCreate && typeof o.callbacks.onCreate==="function"){o.callbacks.onCreate.call(this);} /* callbacks: onCreate */
24514						
24515						$("#mCSB_"+d.idx+"_container img:not(."+classes[2]+")").addClass(classes[2]); /* flag loaded images */
24516						
24517						methods.update.call(null,$this); /* call the update method */
24518					
24519					}
24520					
24521				});
24522				
24523			},
24524			/* ---------------------------------------- */
24525			
24526			
24527			
24528			/* 
24529			plugin update method 
24530			updates content and scrollbar(s) values, events and status 
24531			----------------------------------------
24532			usage: $(selector).mCustomScrollbar("update");
24533			*/
24534			
24535			update:function(el,cb){
24536				
24537				var selector=el || _selector.call(this); /* validate selector */
24538				
24539				return $(selector).each(function(){
24540					
24541					var $this=$(this);
24542					
24543					if($this.data(pluginPfx)){ /* check if plugin has initialized */
24544						
24545						var d=$this.data(pluginPfx),o=d.opt,
24546							mCSB_container=$("#mCSB_"+d.idx+"_container"),
24547							mCustomScrollBox=$("#mCSB_"+d.idx),
24548							mCSB_dragger=[$("#mCSB_"+d.idx+"_dragger_vertical"),$("#mCSB_"+d.idx+"_dragger_horizontal")];
24549						
24550						if(!mCSB_container.length){return;}
24551						
24552						if(d.tweenRunning){_stop($this);} /* stop any running tweens while updating */
24553						
24554						if(cb && d && o.callbacks.onBeforeUpdate && typeof o.callbacks.onBeforeUpdate==="function"){o.callbacks.onBeforeUpdate.call(this);} /* callbacks: onBeforeUpdate */
24555						
24556						/* if element was disabled or destroyed, remove class(es) */
24557						if($this.hasClass(classes[3])){$this.removeClass(classes[3]);}
24558						if($this.hasClass(classes[4])){$this.removeClass(classes[4]);}
24559						
24560						/* css flexbox fix, detect/set max-height */
24561						mCustomScrollBox.css("max-height","none");
24562						if(mCustomScrollBox.height()!==$this.height()){mCustomScrollBox.css("max-height",$this.height());}
24563						
24564						_expandContentHorizontally.call(this); /* expand content horizontally */
24565						
24566						if(o.axis!=="y" && !o.advanced.autoExpandHorizontalScroll){
24567							mCSB_container.css("width",_contentWidth(mCSB_container));
24568						}
24569						
24570						d.overflowed=_overflowed.call(this); /* determine if scrolling is required */
24571						
24572						_scrollbarVisibility.call(this); /* show/hide scrollbar(s) */
24573						
24574						/* auto-adjust scrollbar dragger length analogous to content */
24575						if(o.autoDraggerLength){_setDraggerLength.call(this);}
24576						
24577						_scrollRatio.call(this); /* calculate and store scrollbar to content ratio */
24578						
24579						_bindEvents.call(this); /* bind scrollbar events */
24580						
24581						/* reset scrolling position and/or events */
24582						var to=[Math.abs(mCSB_container[0].offsetTop),Math.abs(mCSB_container[0].offsetLeft)];
24583						if(o.axis!=="x"){ /* y/yx axis */
24584							if(!d.overflowed[0]){ /* y scrolling is not required */
24585								_resetContentPosition.call(this); /* reset content position */
24586								if(o.axis==="y"){
24587									_unbindEvents.call(this);
24588								}else if(o.axis==="yx" && d.overflowed[1]){
24589									_scrollTo($this,to[1].toString(),{dir:"x",dur:0,overwrite:"none"});
24590								}
24591							}else if(mCSB_dragger[0].height()>mCSB_dragger[0].parent().height()){
24592								_resetContentPosition.call(this); /* reset content position */
24593							}else{ /* y scrolling is required */
24594								_scrollTo($this,to[0].toString(),{dir:"y",dur:0,overwrite:"none"});
24595								d.contentReset.y=null;
24596							}
24597						}
24598						if(o.axis!=="y"){ /* x/yx axis */
24599							if(!d.overflowed[1]){ /* x scrolling is not required */
24600								_resetContentPosition.call(this); /* reset content position */
24601								if(o.axis==="x"){
24602									_unbindEvents.call(this);
24603								}else if(o.axis==="yx" && d.overflowed[0]){
24604									_scrollTo($this,to[0].toString(),{dir:"y",dur:0,overwrite:"none"});
24605								}
24606							}else if(mCSB_dragger[1].width()>mCSB_dragger[1].parent().width()){
24607								_resetContentPosition.call(this); /* reset content position */
24608							}else{ /* x scrolling is required */
24609								_scrollTo($this,to[1].toString(),{dir:"x",dur:0,overwrite:"none"});
24610								d.contentReset.x=null;
24611							}
24612						}
24613						
24614						/* callbacks: onImageLoad, onSelectorChange, onUpdate */
24615						if(cb && d){
24616							if(cb===2 && o.callbacks.onImageLoad && typeof o.callbacks.onImageLoad==="function"){
24617								o.callbacks.onImageLoad.call(this);
24618							}else if(cb===3 && o.callbacks.onSelectorChange && typeof o.callbacks.onSelectorChange==="function"){
24619								o.callbacks.onSelectorChange.call(this);
24620							}else if(o.callbacks.onUpdate && typeof o.callbacks.onUpdate==="function"){
24621								o.callbacks.onUpdate.call(this);
24622							}
24623						}
24624						
24625						_autoUpdate.call(this); /* initialize automatic updating (for dynamic content, fluid layouts etc.) */
24626						
24627					}
24628					
24629				});
24630				
24631			},
24632			/* ---------------------------------------- */
24633			
24634			
24635			
24636			/* 
24637			plugin scrollTo method 
24638			triggers a scrolling event to a specific value
24639			----------------------------------------
24640			usage: $(selector).mCustomScrollbar("scrollTo",value,options);
24641			*/
24642		
24643			scrollTo:function(val,options){
24644				
24645				/* prevent silly things like $(selector).mCustomScrollbar("scrollTo",undefined); */
24646				if(typeof val=="undefined" || val==null){return;}
24647				
24648				var selector=_selector.call(this); /* validate selector */
24649				
24650				return $(selector).each(function(){
24651					
24652					var $this=$(this);
24653					
24654					if($this.data(pluginPfx)){ /* check if plugin has initialized */
24655					
24656						var d=$this.data(pluginPfx),o=d.opt,
24657							/* method default options */
24658							methodDefaults={
24659								trigger:"external", /* method is by default triggered externally (e.g. from other scripts) */
24660								scrollInertia:o.scrollInertia, /* scrolling inertia (animation duration) */
24661								scrollEasing:"mcsEaseInOut", /* animation easing */
24662								moveDragger:false, /* move dragger instead of content */
24663								timeout:60, /* scroll-to delay */
24664								callbacks:true, /* enable/disable callbacks */
24665								onStart:true,
24666								onUpdate:true,
24667								onComplete:true
24668							},
24669							methodOptions=$.extend(true,{},methodDefaults,options),
24670							to=_arr.call(this,val),dur=methodOptions.scrollInertia>0 && methodOptions.scrollInertia<17 ? 17 : methodOptions.scrollInertia;
24671						
24672						/* translate yx values to actual scroll-to positions */
24673						to[0]=_to.call(this,to[0],"y");
24674						to[1]=_to.call(this,to[1],"x");
24675						
24676						/* 
24677						check if scroll-to value moves the dragger instead of content. 
24678						Only pixel values apply on dragger (e.g. 100, "100px", "-=100" etc.) 
24679						*/
24680						if(methodOptions.moveDragger){
24681							to[0]*=d.scrollRatio.y;
24682							to[1]*=d.scrollRatio.x;
24683						}
24684						
24685						methodOptions.dur=_isTabHidden() ? 0 : dur; //skip animations if browser tab is hidden
24686						setTimeout(function(){ 
24687							/* do the scrolling */
24688							if(to[0]!==null && typeof to[0]!=="undefined" && o.axis!=="x" && d.overflowed[0]){ /* scroll y */
24689								methodOptions.dir="y";
24690								methodOptions.overwrite="all";
24691								_scrollTo($this,to[0].toString(),methodOptions);
24692							}
24693							if(to[1]!==null && typeof to[1]!=="undefined" && o.axis!=="y" && d.overflowed[1]){ /* scroll x */
24694								methodOptions.dir="x";
24695								methodOptions.overwrite="none";
24696								_scrollTo($this,to[1].toString(),methodOptions);
24697							}
24698						},methodOptions.timeout);
24699						
24700					}
24701					
24702				});
24703				
24704			},
24705			/* ---------------------------------------- */
24706			
24707			
24708			
24709			/*
24710			plugin stop method 
24711			stops scrolling animation
24712			----------------------------------------
24713			usage: $(selector).mCustomScrollbar("stop");
24714			*/
24715			stop:function(){
24716				
24717				var selector=_selector.call(this); /* validate selector */
24718				
24719				return $(selector).each(function(){
24720					
24721					var $this=$(this);
24722					
24723					if($this.data(pluginPfx)){ /* check if plugin has initialized */
24724										
24725						_stop($this);
24726					
24727					}
24728					
24729				});
24730				
24731			},
24732			/* ---------------------------------------- */
24733			
24734			
24735			
24736			/*
24737			plugin disable method 
24738			temporarily disables the scrollbar(s) 
24739			----------------------------------------
24740			usage: $(selector).mCustomScrollbar("disable",reset); 
24741			reset (boolean): resets content position to 0 
24742			*/
24743			disable:function(r){
24744				
24745				var selector=_selector.call(this); /* validate selector */
24746				
24747				return $(selector).each(function(){
24748					
24749					var $this=$(this);
24750					
24751					if($this.data(pluginPfx)){ /* check if plugin has initialized */
24752						
24753						var d=$this.data(pluginPfx);
24754						
24755						_autoUpdate.call(this,"remove"); /* remove automatic updating */
24756						
24757						_unbindEvents.call(this); /* unbind events */
24758						
24759						if(r){_resetContentPosition.call(this);} /* reset content position */
24760						
24761						_scrollbarVisibility.call(this,true); /* show/hide scrollbar(s) */
24762						
24763						$this.addClass(classes[3]); /* add disable class */
24764					
24765					}
24766					
24767				});
24768				
24769			},
24770			/* ---------------------------------------- */
24771			
24772			
24773			
24774			/*
24775			plugin destroy method 
24776			completely removes the scrollbar(s) and returns the element to its original state
24777			----------------------------------------
24778			usage: $(selector).mCustomScrollbar("destroy"); 
24779			*/
24780			destroy:function(){
24781				
24782				var selector=_selector.call(this); /* validate selector */
24783				
24784				return $(selector).each(function(){
24785					
24786					var $this=$(this);
24787					
24788					if($this.data(pluginPfx)){ /* check if plugin has initialized */
24789					
24790						var d=$this.data(pluginPfx),o=d.opt,
24791							mCustomScrollBox=$("#mCSB_"+d.idx),
24792							mCSB_container=$("#mCSB_"+d.idx+"_container"),
24793							scrollbar=$(".mCSB_"+d.idx+"_scrollbar");
24794					
24795						if(o.live){removeLiveTimers(o.liveSelector || $(selector).selector);} /* remove live timers */
24796						
24797						_autoUpdate.call(this,"remove"); /* remove automatic updating */
24798						
24799						_unbindEvents.call(this); /* unbind events */
24800						
24801						_resetContentPosition.call(this); /* reset content position */
24802						
24803						$this.removeData(pluginPfx); /* remove plugin data object */
24804						
24805						_delete(this,"mcs"); /* delete callbacks object */
24806						
24807						/* remove plugin markup */
24808						scrollbar.remove(); /* remove scrollbar(s) first (those can be either inside or outside plugin's inner wrapper) */
24809						mCSB_container.find("img."+classes[2]).removeClass(classes[2]); /* remove loaded images flag */
24810						mCustomScrollBox.replaceWith(mCSB_container.contents()); /* replace plugin's inner wrapper with the original content */
24811						/* remove plugin classes from the element and add destroy class */
24812						$this.removeClass(pluginNS+" _"+pluginPfx+"_"+d.idx+" "+classes[6]+" "+classes[7]+" "+classes[5]+" "+classes[3]).addClass(classes[4]);
24813					
24814					}
24815					
24816				});
24817				
24818			}
24819			/* ---------------------------------------- */
24820			
24821		},
24822	
24823	
24824	
24825	
24826		
24827	/* 
24828	----------------------------------------
24829	FUNCTIONS
24830	----------------------------------------
24831	*/
24832	
24833		/* validates selector (if selector is invalid or undefined uses the default one) */
24834		_selector=function(){
24835			return (typeof $(this)!=="object" || $(this).length<1) ? defaultSelector : this;
24836		},
24837		/* -------------------- */
24838		
24839		
24840		/* changes options according to theme */
24841		_theme=function(obj){
24842			var fixedSizeScrollbarThemes=["rounded","rounded-dark","rounded-dots","rounded-dots-dark"],
24843				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"],
24844				disabledScrollButtonsThemes=["minimal","minimal-dark"],
24845				enabledAutoHideScrollbarThemes=["minimal","minimal-dark"],
24846				scrollbarPositionOutsideThemes=["minimal","minimal-dark"];
24847			obj.autoDraggerLength=$.inArray(obj.theme,fixedSizeScrollbarThemes) > -1 ? false : obj.autoDraggerLength;
24848			obj.autoExpandScrollbar=$.inArray(obj.theme,nonExpandedScrollbarThemes) > -1 ? false : obj.autoExpandScrollbar;
24849			obj.scrollButtons.enable=$.inArray(obj.theme,disabledScrollButtonsThemes) > -1 ? false : obj.scrollButtons.enable;
24850			obj.autoHideScrollbar=$.inArray(obj.theme,enabledAutoHideScrollbarThemes) > -1 ? true : obj.autoHideScrollbar;
24851			obj.scrollbarPosition=$.inArray(obj.theme,scrollbarPositionOutsideThemes) > -1 ? "outside" : obj.scrollbarPosition;
24852		},
24853		/* -------------------- */
24854		
24855		
24856		/* live option timers removal */
24857		removeLiveTimers=function(selector){
24858			if(liveTimers[selector]){
24859				clearTimeout(liveTimers[selector]);
24860				_delete(liveTimers,selector);
24861			}
24862		},
24863		/* -------------------- */
24864		
24865		
24866		/* normalizes axis option to valid values: "y", "x", "yx" */
24867		_findAxis=function(val){
24868			return (val==="yx" || val==="xy" || val==="auto") ? "yx" : (val==="x" || val==="horizontal") ? "x" : "y";
24869		},
24870		/* -------------------- */
24871		
24872		
24873		/* normalizes scrollButtons.scrollType option to valid values: "stepless", "stepped" */
24874		_findScrollButtonsType=function(val){
24875			return (val==="stepped" || val==="pixels" || val==="step" || val==="click") ? "stepped" : "stepless";
24876		},
24877		/* -------------------- */
24878		
24879		
24880		/* generates plugin markup */
24881		_pluginMarkup=function(){
24882			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
24883				expandClass=o.autoExpandScrollbar ? " "+classes[1]+"_expand" : "",
24884				scrollbar=["<div id='mCSB_"+d.idx+"_scrollbar_vertical' class='mCSB_scrollTools mCSB_"+d.idx+"_scrollbar mCS-"+o.theme+" mCSB_scrollTools_vertical"+expandClass+"'><div class='"+classes[12]+"'><div id='mCSB_"+d.idx+"_dragger_vertical' class='mCSB_dragger' style='position:absolute;'><div class='mCSB_dragger_bar' /></div><div class='mCSB_draggerRail' /></div></div>","<div id='mCSB_"+d.idx+"_scrollbar_horizontal' class='mCSB_scrollTools mCSB_"+d.idx+"_scrollbar mCS-"+o.theme+" mCSB_scrollTools_horizontal"+expandClass+"'><div class='"+classes[12]+"'><div id='mCSB_"+d.idx+"_dragger_horizontal' class='mCSB_dragger' style='position:absolute;'><div class='mCSB_dragger_bar' /></div><div class='mCSB_draggerRail' /></div></div>"],
24885				wrapperClass=o.axis==="yx" ? "mCSB_vertical_horizontal" : o.axis==="x" ? "mCSB_horizontal" : "mCSB_vertical",
24886				scrollbars=o.axis==="yx" ? scrollbar[0]+scrollbar[1] : o.axis==="x" ? scrollbar[1] : scrollbar[0],
24887				contentWrapper=o.axis==="yx" ? "<div id='mCSB_"+d.idx+"_container_wrapper' class='mCSB_container_wrapper' />" : "",
24888				autoHideClass=o.autoHideScrollbar ? " "+classes[6] : "",
24889				scrollbarDirClass=(o.axis!=="x" && d.langDir==="rtl") ? " "+classes[7] : "";
24890			if(o.setWidth){$this.css("width",o.setWidth);} /* set element width */
24891			if(o.setHeight){$this.css("height",o.setHeight);} /* set element height */
24892			o.setLeft=(o.axis!=="y" && d.langDir==="rtl") ? "989999px" : o.setLeft; /* adjust left position for rtl direction */
24893			$this.addClass(pluginNS+" _"+pluginPfx+"_"+d.idx+autoHideClass+scrollbarDirClass).wrapInner("<div id='mCSB_"+d.idx+"' class='mCustomScrollBox mCS-"+o.theme+" "+wrapperClass+"'><div id='mCSB_"+d.idx+"_container' class='mCSB_container' style='position:relative; top:"+o.setTop+"; left:"+o.setLeft+";' dir='"+d.langDir+"' /></div>");
24894			var mCustomScrollBox=$("#mCSB_"+d.idx),
24895				mCSB_container=$("#mCSB_"+d.idx+"_container");
24896			if(o.axis!=="y" && !o.advanced.autoExpandHorizontalScroll){
24897				mCSB_container.css("width",_contentWidth(mCSB_container));
24898			}
24899			if(o.scrollbarPosition==="outside"){
24900				if($this.css("position")==="static"){ /* requires elements with non-static position */
24901					$this.css("position","relative");
24902				}
24903				$this.css("overflow","visible");
24904				mCustomScrollBox.addClass("mCSB_outside").after(scrollbars);
24905			}else{
24906				mCustomScrollBox.addClass("mCSB_inside").append(scrollbars);
24907				mCSB_container.wrap(contentWrapper);
24908			}
24909			_scrollButtons.call(this); /* add scrollbar buttons */
24910			/* minimum dragger length */
24911			var mCSB_dragger=[$("#mCSB_"+d.idx+"_dragger_vertical"),$("#mCSB_"+d.idx+"_dragger_horizontal")];
24912			mCSB_dragger[0].css("min-height",mCSB_dragger[0].height());
24913			mCSB_dragger[1].css("min-width",mCSB_dragger[1].width());
24914		},
24915		/* -------------------- */
24916		
24917		
24918		/* calculates content width */
24919		_contentWidth=function(el){
24920			var val=[el[0].scrollWidth,Math.max.apply(Math,el.children().map(function(){return $(this).outerWidth(true);}).get())],w=el.parent().width();
24921			return val[0]>w ? val[0] : val[1]>w ? val[1] : "100%";
24922		},
24923		/* -------------------- */
24924		
24925		
24926		/* expands content horizontally */
24927		_expandContentHorizontally=function(){
24928			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
24929				mCSB_container=$("#mCSB_"+d.idx+"_container");
24930			if(o.advanced.autoExpandHorizontalScroll && o.axis!=="y"){
24931				/* calculate scrollWidth */
24932				mCSB_container.css({"width":"auto","min-width":0,"overflow-x":"scroll"});
24933				var w=Math.ceil(mCSB_container[0].scrollWidth);
24934				if(o.advanced.autoExpandHorizontalScroll===3 || (o.advanced.autoExpandHorizontalScroll!==2 && w>mCSB_container.parent().width())){
24935					mCSB_container.css({"width":w,"min-width":"100%","overflow-x":"inherit"});
24936				}else{
24937					/* 
24938					wrap content with an infinite width div and set its position to absolute and width to auto. 
24939					Setting width to auto before calculating the actual width is important! 
24940					We must let the browser set the width as browser zoom values are impossible to calculate.
24941					*/
24942					mCSB_container.css({"overflow-x":"inherit","position":"absolute"})
24943						.wrap("<div class='mCSB_h_wrapper' style='position:relative; left:0; width:999999px;' />")
24944						.css({ /* set actual width, original position and un-wrap */
24945							/* 
24946							get the exact width (with decimals) and then round-up. 
24947							Using jquery outerWidth() will round the width value which will mess up with inner elements that have non-integer width
24948							*/
24949							"width":(Math.ceil(mCSB_container[0].getBoundingClientRect().right+0.4)-Math.floor(mCSB_container[0].getBoundingClientRect().left)),
24950							"min-width":"100%",
24951							"position":"relative"
24952						}).unwrap();
24953				}
24954			}
24955		},
24956		/* -------------------- */
24957		
24958		
24959		/* adds scrollbar buttons */
24960		_scrollButtons=function(){
24961			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
24962				mCSB_scrollTools=$(".mCSB_"+d.idx+"_scrollbar:first"),
24963				tabindex=!_isNumeric(o.scrollButtons.tabindex) ? "" : "tabindex='"+o.scrollButtons.tabindex+"'",
24964				btnHTML=[
24965					"<a href='#' class='"+classes[13]+"' "+tabindex+" />",
24966					"<a href='#' class='"+classes[14]+"' "+tabindex+" />",
24967					"<a href='#' class='"+classes[15]+"' "+tabindex+" 
24967><i class='svg right'><svg width='12' height='6.969' viewBox='0 0 12 6.969'><path class='cls-1' d='M361.691,401.707a1,1,0,0,1-1.414,0L356,397.416l-4.306,4.291a1,1,0,0,1-1.414,0,0.991,0.991,0,0,1,0-1.406l5.016-5a1.006,1.006,0,0,1,1.415,0l4.984,5A0.989,0.989,0,0,1,361.691,401.707Z' transform='translate(-350 -395.031)'></path></svg></i></a>",
24968					"<a href='#' class='"+classes[16]+"' "+tabindex+" ><i class='svg right'><svg width='12' height='6.969' viewBox='0 0 12 6.969'><path class='cls-1' d='M361.691,401.707a1,1,0,0,1-1.414,0L356,397.416l-4.306,4.291a1,1,0,0,1-1.414,0,0.99
vendor: 17,514 bytes, lines 24968-25391
249681,0.991,0,0,1,0-1.406l5.016-5a1.006,1.006,0,0,1,1.415,0l4.984,5A0.989,0.989,0,0,1,361.691,401.707Z' transform='translate(-350 -395.031)'></path></svg></i></a>"
24969				],
24970				btn=[(o.axis==="x" ? btnHTML[2] : btnHTML[0]),(o.axis==="x" ? btnHTML[3] : btnHTML[1]),btnHTML[2],btnHTML[3]];
24971			if(o.scrollButtons.enable){
24972				mCSB_scrollTools.prepend(btn[0]).append(btn[1]).next(".mCSB_scrollTools").prepend(btn[2]).append(btn[3]);
24973			}
24974		},
24975		/* -------------------- */
24976		
24977		
24978		/* auto-adjusts scrollbar dragger length */
24979		_setDraggerLength=function(){
24980			var $this=$(this),d=$this.data(pluginPfx),
24981				mCustomScrollBox=$("#mCSB_"+d.idx),
24982				mCSB_container=$("#mCSB_"+d.idx+"_container"),
24983				mCSB_dragger=[$("#mCSB_"+d.idx+"_dragger_vertical"),$("#mCSB_"+d.idx+"_dragger_horizontal")],
24984				ratio=[mCustomScrollBox.height()/mCSB_container.outerHeight(false),mCustomScrollBox.width()/mCSB_container.outerWidth(false)],
24985				l=[
24986					parseInt(mCSB_dragger[0].css("min-height")),Math.round(ratio[0]*mCSB_dragger[0].parent().height()),
24987					parseInt(mCSB_dragger[1].css("min-width")),Math.round(ratio[1]*mCSB_dragger[1].parent().width())
24988				],
24989				h=oldIE && (l[1]<l[0]) ? l[0] : l[1],w=oldIE && (l[3]<l[2]) ? l[2] : l[3];
24990			mCSB_dragger[0].css({
24991				"height":h,"max-height":(mCSB_dragger[0].parent().height()-10)
24992			}).find(".mCSB_dragger_bar").css({"line-height":l[0]+"px"});
24993			mCSB_dragger[1].css({
24994				"width":w,"max-width":(mCSB_dragger[1].parent().width()-10)
24995			});
24996		},
24997		/* -------------------- */
24998		
24999		
25000		/* calculates scrollbar to content ratio */
25001		_scrollRatio=function(){
25002			var $this=$(this),d=$this.data(pluginPfx),
25003				mCustomScrollBox=$("#mCSB_"+d.idx),
25004				mCSB_container=$("#mCSB_"+d.idx+"_container"),
25005				mCSB_dragger=[$("#mCSB_"+d.idx+"_dragger_vertical"),$("#mCSB_"+d.idx+"_dragger_horizontal")],
25006				scrollAmount=[mCSB_container.outerHeight(false)-mCustomScrollBox.height(),mCSB_container.outerWidth(false)-mCustomScrollBox.width()],
25007				ratio=[
25008					scrollAmount[0]/(mCSB_dragger[0].parent().height()-mCSB_dragger[0].height()),
25009					scrollAmount[1]/(mCSB_dragger[1].parent().width()-mCSB_dragger[1].width())
25010				];
25011			d.scrollRatio={y:ratio[0],x:ratio[1]};
25012		},
25013		/* -------------------- */
25014		
25015		
25016		/* toggles scrolling classes */
25017		_onDragClasses=function(el,action,xpnd){
25018			var expandClass=xpnd ? classes[0]+"_expanded" : "",
25019				scrollbar=el.closest(".mCSB_scrollTools");
25020			if(action==="active"){
25021				el.toggleClass(classes[0]+" "+expandClass); scrollbar.toggleClass(classes[1]); 
25022				el[0]._draggable=el[0]._draggable ? 0 : 1;
25023			}else{
25024				if(!el[0]._draggable){
25025					if(action==="hide"){
25026						el.removeClass(classes[0]); scrollbar.removeClass(classes[1]);
25027					}else{
25028						el.addClass(classes[0]); scrollbar.addClass(classes[1]);
25029					}
25030				}
25031			}
25032		},
25033		/* -------------------- */
25034		
25035		
25036		/* checks if content overflows its container to determine if scrolling is required */
25037		_overflowed=function(){
25038			var $this=$(this),d=$this.data(pluginPfx),
25039				mCustomScrollBox=$("#mCSB_"+d.idx),
25040				mCSB_container=$("#mCSB_"+d.idx+"_container"),
25041				contentHeight=d.overflowed==null ? mCSB_container.height() : mCSB_container.outerHeight(false),
25042				contentWidth=d.overflowed==null ? mCSB_container.width() : mCSB_container.outerWidth(false),
25043				h=mCSB_container[0].scrollHeight,w=mCSB_container[0].scrollWidth;
25044			if(h>contentHeight){contentHeight=h;}
25045			if(w>contentWidth){contentWidth=w;}
25046			return [contentHeight>mCustomScrollBox.height(),contentWidth>mCustomScrollBox.width()];
25047		},
25048		/* -------------------- */
25049		
25050		
25051		/* resets content position to 0 */
25052		_resetContentPosition=function(){
25053			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
25054				mCustomScrollBox=$("#mCSB_"+d.idx),
25055				mCSB_container=$("#mCSB_"+d.idx+"_container"),
25056				mCSB_dragger=[$("#mCSB_"+d.idx+"_dragger_vertical"),$("#mCSB_"+d.idx+"_dragger_horizontal")];
25057			_stop($this); /* stop any current scrolling before resetting */
25058			if((o.axis!=="x" && !d.overflowed[0]) || (o.axis==="y" && d.overflowed[0])){ /* reset y */
25059				mCSB_dragger[0].add(mCSB_container).css("top",0);
25060				_scrollTo($this,"_resetY");
25061			}
25062			if((o.axis!=="y" && !d.overflowed[1]) || (o.axis==="x" && d.overflowed[1])){ /* reset x */
25063				var cx=dx=0;
25064				if(d.langDir==="rtl"){ /* adjust left position for rtl direction */
25065					cx=mCustomScrollBox.width()-mCSB_container.outerWidth(false);
25066					dx=Math.abs(cx/d.scrollRatio.x);
25067				}
25068				mCSB_container.css("left",cx);
25069				mCSB_dragger[1].css("left",dx);
25070				_scrollTo($this,"_resetX");
25071			}
25072		},
25073		/* -------------------- */
25074		
25075		
25076		/* binds scrollbar events */
25077		_bindEvents=function(){
25078			var $this=$(this),d=$this.data(pluginPfx),o=d.opt;
25079			if(!d.bindEvents){ /* check if events are already bound */
25080				_draggable.call(this);
25081				if(o.contentTouchScroll){_contentDraggable.call(this);}
25082				_selectable.call(this);
25083				if(o.mouseWheel.enable){ /* bind mousewheel fn when plugin is available */
25084					function _mwt(){
25085						mousewheelTimeout=setTimeout(function(){
25086							if(!$.event.special.mousewheel){
25087								_mwt();
25088							}else{
25089								clearTimeout(mousewheelTimeout);
25090								_mousewheel.call($this[0]);
25091							}
25092						},100);
25093					}
25094					var mousewheelTimeout;
25095					_mwt();
25096				}
25097				_draggerRail.call(this);
25098				_wrapperScroll.call(this);
25099				if(o.advanced.autoScrollOnFocus){_focus.call(this);}
25100				if(o.scrollButtons.enable){_buttons.call(this);}
25101				if(o.keyboard.enable){_keyboard.call(this);}
25102				d.bindEvents=true;
25103			}
25104		},
25105		/* -------------------- */
25106		
25107		
25108		/* unbinds scrollbar events */
25109		_unbindEvents=function(){
25110			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
25111				namespace=pluginPfx+"_"+d.idx,
25112				sb=".mCSB_"+d.idx+"_scrollbar",
25113				sel=$("#mCSB_"+d.idx+",#mCSB_"+d.idx+"_container,#mCSB_"+d.idx+"_container_wrapper,"+sb+" ."+classes[12]+",#mCSB_"+d.idx+"_dragger_vertical,#mCSB_"+d.idx+"_dragger_horizontal,"+sb+">a"),
25114				mCSB_container=$("#mCSB_"+d.idx+"_container");
25115			if(o.advanced.releaseDraggableSelectors){sel.add($(o.advanced.releaseDraggableSelectors));}
25116			if(o.advanced.extraDraggableSelectors){sel.add($(o.advanced.extraDraggableSelectors));}
25117			if(d.bindEvents){ /* check if events are bound */
25118				/* unbind namespaced events from document/selectors */
25119				$(document).add($(!_canAccessIFrame() || top.document)).unbind("."+namespace);
25120				sel.each(function(){
25121					$(this).unbind("."+namespace);
25122				});
25123				/* clear and delete timeouts/objects */
25124				clearTimeout($this[0]._focusTimeout); _delete($this[0],"_focusTimeout");
25125				clearTimeout(d.sequential.step); _delete(d.sequential,"step");
25126				clearTimeout(mCSB_container[0].onCompleteTimeout); _delete(mCSB_container[0],"onCompleteTimeout");
25127				d.bindEvents=false;
25128			}
25129		},
25130		/* -------------------- */
25131		
25132		
25133		/* toggles scrollbar visibility */
25134		_scrollbarVisibility=function(disabled){
25135			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
25136				contentWrapper=$("#mCSB_"+d.idx+"_container_wrapper"),
25137				content=contentWrapper.length ? contentWrapper : $("#mCSB_"+d.idx+"_container"),
25138				scrollbar=[$("#mCSB_"+d.idx+"_scrollbar_vertical"),$("#mCSB_"+d.idx+"_scrollbar_horizontal")],
25139				mCSB_dragger=[scrollbar[0].find(".mCSB_dragger"),scrollbar[1].find(".mCSB_dragger")];
25140			if(o.axis!=="x"){
25141				if(d.overflowed[0] && !disabled){
25142					scrollbar[0].add(mCSB_dragger[0]).add(scrollbar[0].children("a")).css("display","block");
25143					content.removeClass(classes[8]+" "+classes[10]);
25144				}else{
25145					if(o.alwaysShowScrollbar){
25146						if(o.alwaysShowScrollbar!==2){mCSB_dragger[0].css("display","none");}
25147						content.removeClass(classes[10]);
25148					}else{
25149						scrollbar[0].css("display","none");
25150						content.addClass(classes[10]);
25151					}
25152					content.addClass(classes[8]);
25153				}
25154			}
25155			if(o.axis!=="y"){
25156				if(d.overflowed[1] && !disabled){
25157					scrollbar[1].add(mCSB_dragger[1]).add(scrollbar[1].children("a")).css("display","block");
25158					content.removeClass(classes[9]+" "+classes[11]);
25159				}else{
25160					if(o.alwaysShowScrollbar){
25161						if(o.alwaysShowScrollbar!==2){mCSB_dragger[1].css("display","none");}
25162						content.removeClass(classes[11]);
25163					}else{
25164						scrollbar[1].css("display","none");
25165						content.addClass(classes[11]);
25166					}
25167					content.addClass(classes[9]);
25168				}
25169			}
25170			if(!d.overflowed[0] && !d.overflowed[1]){
25171				$this.addClass(classes[5]);
25172			}else{
25173				$this.removeClass(classes[5]);
25174			}
25175		},
25176		/* -------------------- */
25177		
25178		
25179		/* returns input coordinates of pointer, touch and mouse events (relative to document) */
25180		_coordinates=function(e){
25181			var t=e.type,o=e.target.ownerDocument!==document && frameElement!==null ? [$(frameElement).offset().top,$(frameElement).offset().left] : null,
25182				io=_canAccessIFrame() && e.target.ownerDocument!==top.document && frameElement!==null ? [$(e.view.frameElement).offset().top,$(e.view.frameElement).offset().left] : [0,0];
25183			switch(t){
25184				case "pointerdown": case "MSPointerDown": case "pointermove": case "MSPointerMove": case "pointerup": case "MSPointerUp":
25185					return o ? [e.originalEvent.pageY-o[0]+io[0],e.originalEvent.pageX-o[1]+io[1],false] : [e.originalEvent.pageY,e.originalEvent.pageX,false];
25186					break;
25187				case "touchstart": case "touchmove": case "touchend":
25188					var touch=e.originalEvent.touches[0] || e.originalEvent.changedTouches[0],
25189						touches=e.originalEvent.touches.length || e.originalEvent.changedTouches.length;
25190					return e.target.ownerDocument!==document ? [touch.screenY,touch.screenX,touches>1] : [touch.pageY,touch.pageX,touches>1];
25191					break;
25192				default:
25193					return o ? [e.pageY-o[0]+io[0],e.pageX-o[1]+io[1],false] : [e.pageY,e.pageX,false];
25194			}
25195		},
25196		/* -------------------- */
25197		
25198		
25199		/* 
25200		SCROLLBAR DRAG EVENTS
25201		scrolls content via scrollbar dragging 
25202		*/
25203		_draggable=function(){
25204			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
25205				namespace=pluginPfx+"_"+d.idx,
25206				draggerId=["mCSB_"+d.idx+"_dragger_vertical","mCSB_"+d.idx+"_dragger_horizontal"],
25207				mCSB_container=$("#mCSB_"+d.idx+"_container"),
25208				mCSB_dragger=$("#"+draggerId[0]+",#"+draggerId[1]),
25209				draggable,dragY,dragX,
25210				rds=o.advanced.releaseDraggableSelectors ? mCSB_dragger.add($(o.advanced.releaseDraggableSelectors)) : mCSB_dragger,
25211				eds=o.advanced.extraDraggableSelectors ? $(!_canAccessIFrame() || top.document).add($(o.advanced.extraDraggableSelectors)) : $(!_canAccessIFrame() || top.document);
25212			mCSB_dragger.bind("contextmenu."+namespace,function(e){
25213				e.preventDefault(); //prevent right click
25214			}).bind("mousedown."+namespace+" touchstart."+namespace+" pointerdown."+namespace+" MSPointerDown."+namespace,function(e){
25215				e.stopImmediatePropagation();
25216				e.preventDefault();
25217				if(!_mouseBtnLeft(e)){return;} /* left mouse button only */
25218				touchActive=true;
25219				if(oldIE){document.onselectstart=function(){return false;}} /* disable text selection for IE < 9 */
25220				_iframe.call(mCSB_container,false); /* enable scrollbar dragging over iframes by disabling their events */
25221				_stop($this);
25222				draggable=$(this);
25223				var offset=draggable.offset(),y=_coordinates(e)[0]-offset.top,x=_coordinates(e)[1]-offset.left,
25224					h=draggable.height()+offset.top,w=draggable.width()+offset.left;
25225				if(y<h && y>0 && x<w && x>0){
25226					dragY=y; 
25227					dragX=x;
25228				}
25229				_onDragClasses(draggable,"active",o.autoExpandScrollbar); 
25230			}).bind("touchmove."+namespace,function(e){
25231				e.stopImmediatePropagation();
25232				e.preventDefault();
25233				var offset=draggable.offset(),y=_coordinates(e)[0]-offset.top,x=_coordinates(e)[1]-offset.left;
25234				_drag(dragY,dragX,y,x);
25235			});
25236			$(document).add(eds).bind("mousemove."+namespace+" pointermove."+namespace+" MSPointerMove."+namespace,function(e){
25237				if(draggable){
25238					var offset=draggable.offset(),y=_coordinates(e)[0]-offset.top,x=_coordinates(e)[1]-offset.left;
25239					if(dragY===y && dragX===x){return;} /* has it really moved? */
25240					_drag(dragY,dragX,y,x);
25241				}
25242			}).add(rds).bind("mouseup."+namespace+" touchend."+namespace+" pointerup."+namespace+" MSPointerUp."+namespace,function(e){
25243				if(draggable){
25244					_onDragClasses(draggable,"active",o.autoExpandScrollbar); 
25245					draggable=null;
25246				}
25247				touchActive=false;
25248				if(oldIE){document.onselectstart=null;} /* enable text selection for IE < 9 */
25249				_iframe.call(mCSB_container,true); /* enable iframes events */
25250			});
25251			function _drag(dragY,dragX,y,x){
25252				mCSB_container[0].idleTimer=o.scrollInertia<233 ? 250 : 0;
25253				if(draggable.attr("id")===draggerId[1]){
25254					var dir="x",to=((draggable[0].offsetLeft-dragX)+x)*d.scrollRatio.x;
25255				}else{
25256					var dir="y",to=((draggable[0].offsetTop-dragY)+y)*d.scrollRatio.y;
25257				}
25258				_scrollTo($this,to.toString(),{dir:dir,drag:true});
25259			}
25260		},
25261		/* -------------------- */
25262		
25263		
25264		/* 
25265		TOUCH SWIPE EVENTS
25266		scrolls content via touch swipe 
25267		Emulates the native touch-swipe scrolling with momentum found in iOS, Android and WP devices 
25268		*/
25269		_contentDraggable=function(){
25270			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
25271				namespace=pluginPfx+"_"+d.idx,
25272				mCustomScrollBox=$("#mCSB_"+d.idx),
25273				mCSB_container=$("#mCSB_"+d.idx+"_container"),
25274				mCSB_dragger=[$("#mCSB_"+d.idx+"_dragger_vertical"),$("#mCSB_"+d.idx+"_dragger_horizontal")],
25275				draggable,dragY,dragX,touchStartY,touchStartX,touchMoveY=[],touchMoveX=[],startTime,runningTime,endTime,distance,speed,amount,
25276				durA=0,durB,overwrite=o.axis==="yx" ? "none" : "all",touchIntent=[],touchDrag,docDrag,
25277				iframe=mCSB_container.find("iframe"),
25278				events=[
25279					"touchstart."+namespace+" pointerdown."+namespace+" MSPointerDown."+namespace, //start
25280					"touchmove."+namespace+" pointermove."+namespace+" MSPointerMove."+namespace, //move
25281					"touchend."+namespace+" pointerup."+namespace+" MSPointerUp."+namespace //end
25282				],
25283				touchAction=document.body.style.touchAction!==undefined && document.body.style.touchAction!=="";
25284			mCSB_container.bind(events[0],function(e){
25285				_onTouchstart(e);
25286			}).bind(events[1],function(e){
25287				_onTouchmove(e);
25288			});
25289			mCustomScrollBox.bind(events[0],function(e){
25290				_onTouchstart2(e);
25291			}).bind(events[2],function(e){
25292				_onTouchend(e);
25293			});
25294			if(iframe.length){
25295				iframe.each(function(){
25296					$(this).bind("load",function(){
25297						/* bind events on accessible iframes */
25298						if(_canAccessIFrame(this)){
25299							$(this.contentDocument || this.contentWindow.document).bind(events[0],function(e){
25300								_onTouchstart(e);
25301								_onTouchstart2(e);
25302							}).bind(events[1],function(e){
25303								_onTouchmove(e);
25304							}).bind(events[2],function(e){
25305								_onTouchend(e);
25306							});
25307						}
25308					});
25309				});
25310			}
25311			function _onTouchstart(e){
25312				if(!_pointerTouch(e) || touchActive || _coordinates(e)[2]){touchable=0; return;}
25313
25314				if($(e.target).closest('.bx_ui_slider_track').length){
25315					touchOffCustom = true;
25316					touchable=0; return;
25317				} else {
25318					touchOffCustom = false;
25319				}
25320
25321				touchable=1; touchDrag=0; docDrag=0; draggable=1;
25322				$this.removeClass("mCS_touch_action");
25323				var offset=mCSB_container.offset();
25324				dragY=_coordinates(e)[0]-offset.top;
25325				dragX=_coordinates(e)[1]-offset.left;
25326				touchIntent=[_coordinates(e)[0],_coordinates(e)[1]];
25327
25328			}
25329			function _onTouchmove(e){
25330				if(!_pointerTouch(e) || touchActive || _coordinates(e)[2]){return;}
25331
25332				if(touchOffCustom){
25333					touchable=0; return;
25334				}
25335
25336				if(!o.documentTouchScroll){e.preventDefault();} 
25337				e.stopImmediatePropagation();
25338				if(docDrag && !touchDrag){return;}
25339				if(draggable){
25340					runningTime=_getTime();
25341					var offset=mCustomScrollBox.offset(),y=_coordinates(e)[0]-offset.top,x=_coordinates(e)[1]-offset.left,
25342						easing="mcsLinearOut";
25343					touchMoveY.push(y);
25344					touchMoveX.push(x);
25345					touchIntent[2]=Math.abs(_coordinates(e)[0]-touchIntent[0]); touchIntent[3]=Math.abs(_coordinates(e)[1]-touchIntent[1]);
25346					if(d.overflowed[0]){
25347						var limit=mCSB_dragger[0].parent().height()-mCSB_dragger[0].height(),
25348							prevent=((dragY-y)>0 && (y-dragY)>-(limit*d.scrollRatio.y) && (touchIntent[3]*2<touchIntent[2] || o.axis==="yx"));
25349					}
25350					if(d.overflowed[1]){
25351						var limitX=mCSB_dragger[1].parent().width()-mCSB_dragger[1].width(),
25352							preventX=((dragX-x)>0 && (x-dragX)>-(limitX*d.scrollRatio.x) && (touchIntent[2]*2<touchIntent[3] || o.axis==="yx"));
25353					}
25354					if(prevent || preventX){ /* prevent native document scrolling */
25355						if(!touchAction){e.preventDefault();} 
25356						touchDrag=1;
25357					}else{
25358						docDrag=1;
25359						$this.addClass("mCS_touch_action");
25360					}
25361					if(touchAction){e.preventDefault();} 
25362					amount=o.axis==="yx" ? [(dragY-y),(dragX-x)] : o.axis==="x" ? [null,(dragX-x)] : [(dragY-y),null];
25363					mCSB_container[0].idleTimer=250;
25364					if(d.overflowed[0]){_drag(amount[0],durA,easing,"y","all",true);}
25365					if(d.overflowed[1]){_drag(amount[1],durA,easing,"x",overwrite,true);}
25366				}
25367			}
25368			function _onTouchstart2(e){
25369				if(!_pointerTouch(e) || touchActive || _coordinates(e)[2]){touchable=0; return;}
25370
25371				if($(e.target).closest('.bx_ui_slider_track').length){
25372					touchOffCustom = true;
25373					touchable=0; return;
25374				} else {
25375					touchOffCustom = false;
25376				}
25377
25378				touchable=1;
25379				e.stopImmediatePropagation();
25380				_stop($this);
25381				startTime=_getTime();
25382				var offset=mCustomScrollBox.offset();
25383				touchStartY=_coordinates(e)[0]-offset.top;
25384				touchStartX=_coordinates(e)[1]-offset.left;
25385				touchMoveY=[]; touchMoveX=[];
25386			}
25387			function _onTouchend(e){				
25388				if(!_pointerTouch(e) || touchActive || _coordinates(e)[2]){return;}
25389
25390				if($(e.target).closest('.bx_ui_slider_track').length){
25391					touchOffCustom = false;
25392					touchable=0; return;
25393				}
vendor: 13,509 bytes, lines 25394-25737
25394
25395				draggable=0;
25396				e.stopImmediatePropagation();
25397				touchDrag=0; docDrag=0;
25398				endTime=_getTime();
25399				var offset=mCustomScrollBox.offset(),y=_coordinates(e)[0]-offset.top,x=_coordinates(e)[1]-offset.left;
25400				if((endTime-runningTime)>30){return;}
25401				speed=1000/(endTime-startTime);
25402				var easing="mcsEaseOut",slow=speed<2.5,
25403					diff=slow ? [touchMoveY[touchMoveY.length-2],touchMoveX[touchMoveX.length-2]] : [0,0];
25404				distance=slow ? [(y-diff[0]),(x-diff[1])] : [y-touchStartY,x-touchStartX];
25405				var absDistance=[Math.abs(distance[0]),Math.abs(distance[1])];
25406				speed=slow ? [Math.abs(distance[0]/4),Math.abs(distance[1]/4)] : [speed,speed];
25407				var a=[
25408					Math.abs(mCSB_container[0].offsetTop)-(distance[0]*_m((absDistance[0]/speed[0]),speed[0])),
25409					Math.abs(mCSB_container[0].offsetLeft)-(distance[1]*_m((absDistance[1]/speed[1]),speed[1]))
25410				];
25411				amount=o.axis==="yx" ? [a[0],a[1]] : o.axis==="x" ? [null,a[1]] : [a[0],null];
25412				durB=[(absDistance[0]*4)+o.scrollInertia,(absDistance[1]*4)+o.scrollInertia];
25413				var md=parseInt(o.contentTouchScroll) || 0; /* absolute minimum distance required */
25414				amount[0]=absDistance[0]>md ? amount[0] : 0;
25415				amount[1]=absDistance[1]>md ? amount[1] : 0;
25416				if(d.overflowed[0]){_drag(amount[0],durB[0],easing,"y",overwrite,false);}
25417				if(d.overflowed[1]){_drag(amount[1],durB[1],easing,"x",overwrite,false);}
25418			}
25419			function _m(ds,s){
25420				var r=[s*1.5,s*2,s/1.5,s/2];
25421				if(ds>90){
25422					return s>4 ? r[0] : r[3];
25423				}else if(ds>60){
25424					return s>3 ? r[3] : r[2];
25425				}else if(ds>30){
25426					return s>8 ? r[1] : s>6 ? r[0] : s>4 ? s : r[2];
25427				}else{
25428					return s>8 ? s : r[3];
25429				}
25430			}
25431			function _drag(amount,dur,easing,dir,overwrite,drag){
25432				if(!amount){return;}
25433				_scrollTo($this,amount.toString(),{dur:dur,scrollEasing:easing,dir:dir,overwrite:overwrite,drag:drag});
25434			}
25435		},
25436		/* -------------------- */
25437		
25438		
25439		/* 
25440		SELECT TEXT EVENTS 
25441		scrolls content when text is selected 
25442		*/
25443		_selectable=function(){
25444			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,seq=d.sequential,
25445				namespace=pluginPfx+"_"+d.idx,
25446				mCSB_container=$("#mCSB_"+d.idx+"_container"),
25447				wrapper=mCSB_container.parent(),
25448				action;
25449			mCSB_container.bind("mousedown."+namespace,function(e){
25450				if(touchable){return;}
25451				if(!action){action=1; touchActive=true;}
25452			}).add(document).bind("mousemove."+namespace,function(e){
25453				if(!touchable && action && _sel()){
25454					var offset=mCSB_container.offset(),
25455						y=_coordinates(e)[0]-offset.top+mCSB_container[0].offsetTop,x=_coordinates(e)[1]-offset.left+mCSB_container[0].offsetLeft;
25456					if(y>0 && y<wrapper.height() && x>0 && x<wrapper.width()){
25457						if(seq.step){_seq("off",null,"stepped");}
25458					}else{
25459						if(o.axis!=="x" && d.overflowed[0]){
25460							if(y<0){
25461								_seq("on",38);
25462							}else if(y>wrapper.height()){
25463								_seq("on",40);
25464							}
25465						}
25466						if(o.axis!=="y" && d.overflowed[1]){
25467							if(x<0){
25468								_seq("on",37);
25469							}else if(x>wrapper.width()){
25470								_seq("on",39);
25471							}
25472						}
25473					}
25474				}
25475			}).bind("mouseup."+namespace+" dragend."+namespace,function(e){
25476				if(touchable){return;}
25477				if(action){action=0; _seq("off",null);}
25478				touchActive=false;
25479			});
25480			function _sel(){
25481				return 	window.getSelection ? window.getSelection().toString() : 
25482						document.selection && document.selection.type!="Control" ? document.selection.createRange().text : 0;
25483			}
25484			function _seq(a,c,s){
25485				seq.type=s && action ? "stepped" : "stepless";
25486				seq.scrollAmount=10;
25487				_sequentialScroll($this,a,c,"mcsLinearOut",s ? 60 : null);
25488			}
25489		},
25490		/* -------------------- */
25491		
25492		
25493		/* 
25494		MOUSE WHEEL EVENT
25495		scrolls content via mouse-wheel 
25496		via mouse-wheel plugin (https://github.com/brandonaaron/jquery-mousewheel)
25497		*/
25498		_mousewheel=function(){
25499			if(!$(this).data(pluginPfx)){return;} /* Check if the scrollbar is ready to use mousewheel events (issue: #185) */
25500			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
25501				namespace=pluginPfx+"_"+d.idx,
25502				mCustomScrollBox=$("#mCSB_"+d.idx),
25503				mCSB_dragger=[$("#mCSB_"+d.idx+"_dragger_vertical"),$("#mCSB_"+d.idx+"_dragger_horizontal")],
25504				iframe=$("#mCSB_"+d.idx+"_container").find("iframe");
25505			if(iframe.length){
25506				iframe.each(function(){
25507					$(this).bind("load",function(){
25508						/* bind events on accessible iframes */
25509						if(_canAccessIFrame(this)){
25510							$(this.contentDocument || this.contentWindow.document).bind("mousewheel."+namespace,function(e,delta){
25511								_onMousewheel(e,delta);
25512							});
25513						}
25514					});
25515				});
25516			}
25517			mCustomScrollBox.bind("mousewheel."+namespace,function(e,delta){
25518				_onMousewheel(e,delta);
25519			});
25520			function _onMousewheel(e,delta){
25521				_stop($this);
25522				if(_disableMousewheel($this,e.target)){return;} /* disables mouse-wheel when hovering specific elements */
25523				var deltaFactor=o.mouseWheel.deltaFactor!=="auto" ? parseInt(o.mouseWheel.deltaFactor) : (oldIE && e.deltaFactor<100) ? 100 : e.deltaFactor || 100,
25524					dur=o.scrollInertia;
25525				if(o.axis==="x" || o.mouseWheel.axis==="x"){
25526					var dir="x",
25527						px=[Math.round(deltaFactor*d.scrollRatio.x),parseInt(o.mouseWheel.scrollAmount)],
25528						amount=o.mouseWheel.scrollAmount!=="auto" ? px[1] : px[0]>=mCustomScrollBox.width() ? mCustomScrollBox.width()*0.9 : px[0],
25529						contentPos=Math.abs($("#mCSB_"+d.idx+"_container")[0].offsetLeft),
25530						draggerPos=mCSB_dragger[1][0].offsetLeft,
25531						limit=mCSB_dragger[1].parent().width()-mCSB_dragger[1].width(),
25532						dlt=o.mouseWheel.axis==="y" ? (e.deltaY || delta) : e.deltaX;
25533				}else{
25534					var dir="y",
25535						px=[Math.round(deltaFactor*d.scrollRatio.y),parseInt(o.mouseWheel.scrollAmount)],
25536						amount=o.mouseWheel.scrollAmount!=="auto" ? px[1] : px[0]>=mCustomScrollBox.height() ? mCustomScrollBox.height()*0.9 : px[0],
25537						contentPos=Math.abs($("#mCSB_"+d.idx+"_container")[0].offsetTop),
25538						draggerPos=mCSB_dragger[0][0].offsetTop,
25539						limit=mCSB_dragger[0].parent().height()-mCSB_dragger[0].height(),
25540						dlt=e.deltaY || delta;
25541				}
25542				if((dir==="y" && !d.overflowed[0]) || (dir==="x" && !d.overflowed[1])){return;}
25543				if(o.mouseWheel.invert || e.webkitDirectionInvertedFromDevice){dlt=-dlt;}
25544				if(o.mouseWheel.normalizeDelta){dlt=dlt<0 ? -1 : 1;}
25545				if((dlt>0 && draggerPos!==0) || (dlt<0 && draggerPos!==limit) || o.mouseWheel.preventDefault){
25546					e.stopImmediatePropagation();
25547					e.preventDefault();
25548				}
25549				if(e.deltaFactor<5 && !o.mouseWheel.normalizeDelta){
25550					//very low deltaFactor values mean some kind of delta acceleration (e.g. osx trackpad), so adjusting scrolling accordingly
25551					amount=e.deltaFactor; dur=17;
25552				}
25553				_scrollTo($this,(contentPos-(dlt*amount)).toString(),{dir:dir,dur:dur});
25554			}
25555		},
25556		/* -------------------- */
25557		
25558		
25559		/* checks if iframe can be accessed */
25560		_canAccessIFrameCache=new Object(),
25561		_canAccessIFrame=function(iframe){
25562		    var result=false,cacheKey=false,html=null;
25563		    if(iframe===undefined){
25564				cacheKey="#empty";
25565		    }else if($(iframe).attr("id")!==undefined){
25566				cacheKey=$(iframe).attr("id");
25567		    }
25568			if(cacheKey!==false && _canAccessIFrameCache[cacheKey]!==undefined){
25569				return _canAccessIFrameCache[cacheKey];
25570			}
25571			if(!iframe){
25572				try{
25573					var doc=top.document;
25574					html=doc.body.innerHTML;
25575				}catch(err){/* do nothing */}
25576				result=(html!==null);
25577			}else{
25578				try{
25579					var doc=iframe.contentDocument || iframe.contentWindow.document;
25580					html=doc.body.innerHTML;
25581				}catch(err){/* do nothing */}
25582				result=(html!==null);
25583			}
25584			if(cacheKey!==false){_canAccessIFrameCache[cacheKey]=result;}
25585			return result;
25586		},
25587		/* -------------------- */
25588		
25589		
25590		/* switches iframe's pointer-events property (drag, mousewheel etc. over cross-domain iframes) */
25591		_iframe=function(evt){
25592			var el=this.find("iframe");
25593			if(!el.length){return;} /* check if content contains iframes */
25594			var val=!evt ? "none" : "auto";
25595			el.css("pointer-events",val); /* for IE11, iframe's display property should not be "block" */
25596		},
25597		/* -------------------- */
25598		
25599		
25600		/* disables mouse-wheel when hovering specific elements like select, datalist etc. */
25601		_disableMousewheel=function(el,target){
25602			var tag=target.nodeName.toLowerCase(),
25603				tags=el.data(pluginPfx).opt.mouseWheel.disableOver,
25604				/* elements that require focus */
25605				focusTags=["select","textarea"];
25606			return $.inArray(tag,tags) > -1 && !($.inArray(tag,focusTags) > -1 && !$(target).is(":focus"));
25607		},
25608		/* -------------------- */
25609		
25610		
25611		/* 
25612		DRAGGER RAIL CLICK EVENT
25613		scrolls content via dragger rail 
25614		*/
25615		_draggerRail=function(){
25616			var $this=$(this),d=$this.data(pluginPfx),
25617				namespace=pluginPfx+"_"+d.idx,
25618				mCSB_container=$("#mCSB_"+d.idx+"_container"),
25619				wrapper=mCSB_container.parent(),
25620				mCSB_draggerContainer=$(".mCSB_"+d.idx+"_scrollbar ."+classes[12]),
25621				clickable;
25622			mCSB_draggerContainer.bind("mousedown."+namespace+" touchstart."+namespace+" pointerdown."+namespace+" MSPointerDown."+namespace,function(e){
25623				touchActive=true;
25624				if(!$(e.target).hasClass("mCSB_dragger")){clickable=1;}
25625			}).bind("touchend."+namespace+" pointerup."+namespace+" MSPointerUp."+namespace,function(e){
25626				touchActive=false;
25627			}).bind("click."+namespace,function(e){
25628				if(!clickable){return;}
25629				clickable=0;
25630				if($(e.target).hasClass(classes[12]) || $(e.target).hasClass("mCSB_draggerRail")){
25631					_stop($this);
25632					var el=$(this),mCSB_dragger=el.find(".mCSB_dragger");
25633					if(el.parent(".mCSB_scrollTools_horizontal").length>0){
25634						if(!d.overflowed[1]){return;}
25635						var dir="x",
25636							clickDir=e.pageX>mCSB_dragger.offset().left ? -1 : 1,
25637							to=Math.abs(mCSB_container[0].offsetLeft)-(clickDir*(wrapper.width()*0.9));
25638					}else{
25639						if(!d.overflowed[0]){return;}
25640						var dir="y",
25641							clickDir=e.pageY>mCSB_dragger.offset().top ? -1 : 1,
25642							to=Math.abs(mCSB_container[0].offsetTop)-(clickDir*(wrapper.height()*0.9));
25643					}
25644					_scrollTo($this,to.toString(),{dir:dir,scrollEasing:"mcsEaseInOut"});
25645				}
25646			});
25647		},
25648		/* -------------------- */
25649		
25650		
25651		/* 
25652		FOCUS EVENT
25653		scrolls content via element focus (e.g. clicking an input, pressing TAB key etc.)
25654		*/
25655		_focus=function(){
25656			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
25657				namespace=pluginPfx+"_"+d.idx,
25658				mCSB_container=$("#mCSB_"+d.idx+"_container"),
25659				wrapper=mCSB_container.parent();
25660			mCSB_container.bind("focusin."+namespace,function(e){
25661				var el=$(document.activeElement),
25662					nested=mCSB_container.find(".mCustomScrollBox").length,
25663					dur=0;
25664				if(!el.is(o.advanced.autoScrollOnFocus)){return;}
25665				_stop($this);
25666				clearTimeout($this[0]._focusTimeout);
25667				$this[0]._focusTimer=nested ? (dur+17)*nested : 0;
25668				$this[0]._focusTimeout=setTimeout(function(){
25669					var	to=[_childPos(el)[0],_childPos(el)[1]],
25670						contentPos=[mCSB_container[0].offsetTop,mCSB_container[0].offsetLeft],
25671						isVisible=[
25672							(contentPos[0]+to[0]>=0 && contentPos[0]+to[0]<wrapper.height()-el.outerHeight(false)),
25673							(contentPos[1]+to[1]>=0 && contentPos[0]+to[1]<wrapper.width()-el.outerWidth(false))
25674						],
25675						overwrite=(o.axis==="yx" && !isVisible[0] && !isVisible[1]) ? "none" : "all";
25676					if(o.axis!=="x" && !isVisible[0]){
25677						_scrollTo($this,to[0].toString(),{dir:"y",scrollEasing:"mcsEaseInOut",overwrite:overwrite,dur:dur});
25678					}
25679					if(o.axis!=="y" && !isVisible[1]){
25680						_scrollTo($this,to[1].toString(),{dir:"x",scrollEasing:"mcsEaseInOut",overwrite:overwrite,dur:dur});
25681					}
25682				},$this[0]._focusTimer);
25683			});
25684		},
25685		/* -------------------- */
25686		
25687		
25688		/* sets content wrapper scrollTop/scrollLeft always to 0 */
25689		_wrapperScroll=function(){
25690			var $this=$(this),d=$this.data(pluginPfx),
25691				namespace=pluginPfx+"_"+d.idx,
25692				wrapper=$("#mCSB_"+d.idx+"_container").parent();
25693			wrapper.bind("scroll."+namespace,function(e){
25694				if(wrapper.scrollTop()!==0 || wrapper.scrollLeft()!==0){
25695					$(".mCSB_"+d.idx+"_scrollbar").css("visibility","hidden"); /* hide scrollbar(s) */
25696				}
25697			});
25698		},
25699		/* -------------------- */
25700		
25701		
25702		/* 
25703		BUTTONS EVENTS
25704		scrolls content via up, down, left and right buttons 
25705		*/
25706		_buttons=function(){
25707			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,seq=d.sequential,
25708				namespace=pluginPfx+"_"+d.idx,
25709				sel=".mCSB_"+d.idx+"_scrollbar",
25710				btn=$(sel+">a");
25711			btn.bind("contextmenu."+namespace,function(e){
25712				e.preventDefault(); //prevent right click
25713			}).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){
25714				e.preventDefault();
25715				if(!_mouseBtnLeft(e)){return;} /* left mouse button only */
25716				var btnClass=$(this).attr("class");
25717				seq.type=o.scrollButtons.scrollType;
25718				switch(e.type){
25719					case "mousedown": case "touchstart": case "pointerdown": case "MSPointerDown":
25720						if(seq.type==="stepped"){return;}
25721						touchActive=true;
25722						d.tweenRunning=false;
25723						_seq("on",btnClass);
25724						break;
25725					case "mouseup": case "touchend": case "pointerup": case "MSPointerUp":
25726					case "mouseout": case "pointerout": case "MSPointerOut":
25727						if(seq.type==="stepped"){return;}
25728						touchActive=false;
25729						if(seq.dir){_seq("off",btnClass);}
25730						break;
25731					case "click":
25732						if(seq.type!=="stepped" || d.tweenRunning){return;}
25733						_seq("on",btnClass);
25734						break;
25735				}
25736				function _seq(a,c){
25737					
25737//seq.scrollAmount=o.scrollButtons.scrollAmount;
25738					_sequentialScroll($this,a,c);
25739				}
25740			});
25741		},
25742		/* -------------------- */
25743		
25744		
25745		/* 
25746		KEYBOARD EVENTS
25747		scrolls content via keyboard 
25748		Keys: up arrow, down arrow, left arrow, right arrow, PgUp, PgDn, Home, End
25749		*/
25750		_keyboard=function(){
25751			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,seq=d.sequential,
25752				namespace=pluginPfx+"_"+d.idx,
25753				mCustomScrollBox=$("#mCSB_"+d.idx),
25754				mCSB_container=$("#mCSB_"+d.idx+"_container"),
25755				wrapper=mCSB_container.parent(),
25756				editables="input,textarea,select,datalist,keygen,[contenteditable='true']",
25757				iframe=mCSB_container.find("iframe"),
vendor: 23,820 bytes, lines 25758-26412
25758				events=["blur."+namespace+" keydown."+namespace+" keyup."+namespace];
25759			if(iframe.length){
25760				iframe.each(function(){
25761					$(this).bind("load",function(){
25762						/* bind events on accessible iframes */
25763						if(_canAccessIFrame(this)){
25764							$(this.contentDocument || this.contentWindow.document).bind(events[0],function(e){
25765								_onKeyboard(e);
25766							});
25767						}
25768					});
25769				});
25770			}
25771			mCustomScrollBox.attr("tabindex","0").bind(events[0],function(e){
25772				_onKeyboard(e);
25773			});
25774			function _onKeyboard(e){
25775				switch(e.type){
25776					case "blur":
25777						if(d.tweenRunning && seq.dir){_seq("off",null);}
25778						break;
25779					case "keydown": case "keyup":
25780						var code=e.keyCode ? e.keyCode : e.which,action="on";
25781						if((o.axis!=="x" && (code===38 || code===40)) || (o.axis!=="y" && (code===37 || code===39))){
25782							/* up (38), down (40), left (37), right (39) arrows */
25783							if(((code===38 || code===40) && !d.overflowed[0]) || ((code===37 || code===39) && !d.overflowed[1])){return;}
25784							if(e.type==="keyup"){action="off";}
25785							if(!$(document.activeElement).is(editables)){
25786								e.preventDefault();
25787								e.stopImmediatePropagation();
25788								_seq(action,code);
25789							}
25790						}else if(code===33 || code===34){
25791							/* PgUp (33), PgDn (34) */
25792							if(d.overflowed[0] || d.overflowed[1]){
25793								e.preventDefault();
25794								e.stopImmediatePropagation();
25795							}
25796							if(e.type==="keyup"){
25797								_stop($this);
25798								var keyboardDir=code===34 ? -1 : 1;
25799								if(o.axis==="x" || (o.axis==="yx" && d.overflowed[1] && !d.overflowed[0])){
25800									var dir="x",to=Math.abs(mCSB_container[0].offsetLeft)-(keyboardDir*(wrapper.width()*0.9));
25801								}else{
25802									var dir="y",to=Math.abs(mCSB_container[0].offsetTop)-(keyboardDir*(wrapper.height()*0.9));
25803								}
25804								_scrollTo($this,to.toString(),{dir:dir,scrollEasing:"mcsEaseInOut"});
25805							}
25806						}else if(code===35 || code===36){
25807							/* End (35), Home (36) */
25808							if(!$(document.activeElement).is(editables)){
25809								if(d.overflowed[0] || d.overflowed[1]){
25810									e.preventDefault();
25811									e.stopImmediatePropagation();
25812								}
25813								if(e.type==="keyup"){
25814									if(o.axis==="x" || (o.axis==="yx" && d.overflowed[1] && !d.overflowed[0])){
25815										var dir="x",to=code===35 ? Math.abs(wrapper.width()-mCSB_container.outerWidth(false)) : 0;
25816									}else{
25817										var dir="y",to=code===35 ? Math.abs(wrapper.height()-mCSB_container.outerHeight(false)) : 0;
25818									}
25819									_scrollTo($this,to.toString(),{dir:dir,scrollEasing:"mcsEaseInOut"});
25820								}
25821							}
25822						}
25823						break;
25824				}
25825				function _seq(a,c){
25826					seq.type=o.keyboard.scrollType;
25827					seq.scrollAmount=o.keyboard.scrollAmount;
25828					if(seq.type==="stepped" && d.tweenRunning){return;}
25829					_sequentialScroll($this,a,c);
25830				}
25831			}
25832		},
25833		/* -------------------- */
25834		
25835		
25836		/* scrolls content sequentially (used when scrolling via buttons, keyboard arrows etc.) */
25837		_sequentialScroll=function(el,action,trigger,e,s){
25838			var d=el.data(pluginPfx),o=d.opt,seq=d.sequential,
25839				mCSB_container=$("#mCSB_"+d.idx+"_container"),
25840				once=seq.type==="stepped" ? true : false,
25841				steplessSpeed=o.scrollInertia < 26 ? 26 : o.scrollInertia, /* 26/1.5=17 */
25842				steppedSpeed=o.scrollInertia < 1 ? 17 : o.scrollInertia;
25843			switch(action){
25844				case "on":
25845					seq.dir=[
25846						(trigger===classes[16] || trigger===classes[15] || trigger===39 || trigger===37 ? "x" : "y"),
25847						(trigger===classes[13] || trigger===classes[15] || trigger===38 || trigger===37 ? -1 : 1)
25848					];
25849					_stop(el);
25850					if(_isNumeric(trigger) && seq.type==="stepped"){return;}
25851					_on(once);
25852					break;
25853				case "off":
25854					_off();
25855					if(once || (d.tweenRunning && seq.dir)){
25856						_on(true);
25857					}
25858					break;
25859			}
25860			
25861			/* starts sequence */
25862			function _on(once){
25863				if(o.snapAmount){seq.scrollAmount=!(o.snapAmount instanceof Array) ? o.snapAmount : seq.dir[0]==="x" ? o.snapAmount[1] : o.snapAmount[0];} /* scrolling snapping */
25864				var c=seq.type!=="stepped", /* continuous scrolling */
25865					t=s ? s : !once ? 1000/60 : c ? steplessSpeed/1.5 : steppedSpeed, /* timer */
25866					m=!once ? 2.5 : c ? 7.5 : 40, /* multiplier */
25867					contentPos=[Math.abs(mCSB_container[0].offsetTop),Math.abs(mCSB_container[0].offsetLeft)],
25868					ratio=[d.scrollRatio.y>10 ? 10 : d.scrollRatio.y,d.scrollRatio.x>10 ? 10 : d.scrollRatio.x],
25869					amount=seq.dir[0]==="x" ? contentPos[1]+(seq.dir[1]*(ratio[1]*m)) : contentPos[0]+(seq.dir[1]*(ratio[0]*m)),
25870					px=seq.dir[0]==="x" ? contentPos[1]+(seq.dir[1]*parseInt(seq.scrollAmount)) : contentPos[0]+(seq.dir[1]*parseInt(seq.scrollAmount)),
25871					to=seq.scrollAmount!=="auto" ? px : amount,
25872					easing=e ? e : !once ? "mcsLinear" : c ? "mcsLinearOut" : "mcsEaseInOut",
25873					onComplete=!once ? false : true;
25874				if(once && t<17){
25875					to=seq.dir[0]==="x" ? contentPos[1] : contentPos[0];
25876				}
25877
25878				_scrollTo(el,to.toString(),{dir:seq.dir[0],scrollEasing:easing,dur:t,onComplete:onComplete});
25879				if(once){
25880					seq.dir=false;
25881					return;
25882				}
25883				clearTimeout(seq.step);
25884				seq.step=setTimeout(function(){
25885					_on();
25886				},t);
25887			}
25888			/* stops sequence */
25889			function _off(){
25890				clearTimeout(seq.step);
25891				_delete(seq,"step");
25892				_stop(el);
25893			}
25894		},
25895		/* -------------------- */
25896		
25897		
25898		/* returns a yx array from value */
25899		_arr=function(val){
25900			var o=$(this).data(pluginPfx).opt,vals=[];
25901			if(typeof val==="function"){val=val();} /* check if the value is a single anonymous function */
25902			/* check if value is object or array, its length and create an array with yx values */
25903			if(!(val instanceof Array)){ /* object value (e.g. {y:"100",x:"100"}, 100 etc.) */
25904				vals[0]=val.y ? val.y : val.x || o.axis==="x" ? null : val;
25905				vals[1]=val.x ? val.x : val.y || o.axis==="y" ? null : val;
25906			}else{ /* array value (e.g. [100,100]) */
25907				vals=val.length>1 ? [val[0],val[1]] : o.axis==="x" ? [null,val[0]] : [val[0],null];
25908			}
25909			/* check if array values are anonymous functions */
25910			if(typeof vals[0]==="function"){vals[0]=vals[0]();}
25911			if(typeof vals[1]==="function"){vals[1]=vals[1]();}
25912			return vals;
25913		},
25914		/* -------------------- */
25915		
25916		
25917		/* translates values (e.g. "top", 100, "100px", "#id") to actual scroll-to positions */
25918		_to=function(val,dir){
25919			if(val==null || typeof val=="undefined"){return;}
25920			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
25921				mCSB_container=$("#mCSB_"+d.idx+"_container"),
25922				wrapper=mCSB_container.parent(),
25923				t=typeof val;
25924			if(!dir){dir=o.axis==="x" ? "x" : "y";}
25925			var contentLength=dir==="x" ? mCSB_container.outerWidth(false)-wrapper.width() : mCSB_container.outerHeight(false)-wrapper.height(),
25926				contentPos=dir==="x" ? mCSB_container[0].offsetLeft : mCSB_container[0].offsetTop,
25927				cssProp=dir==="x" ? "left" : "top";
25928			switch(t){
25929				case "function": /* this currently is not used. Consider removing it */
25930					return val();
25931					break;
25932				case "object": /* js/jquery object */
25933					var obj=val.jquery ? val : $(val);
25934					if(!obj.length){return;}
25935					return dir==="x" ? _childPos(obj)[1] : _childPos(obj)[0];
25936					break;
25937				case "string": case "number":
25938					if(_isNumeric(val)){ /* numeric value */
25939						return Math.abs(val);
25940					}else if(val.indexOf("%")!==-1){ /* percentage value */
25941						return Math.abs(contentLength*parseInt(val)/100);
25942					}else if(val.indexOf("-=")!==-1){ /* decrease value */
25943						return Math.abs(contentPos-parseInt(val.split("-=")[1]));
25944					}else if(val.indexOf("+=")!==-1){ /* inrease value */
25945						var p=(contentPos+parseInt(val.split("+=")[1]));
25946						return p>=0 ? 0 : Math.abs(p);
25947					}else if(val.indexOf("px")!==-1 && _isNumeric(val.split("px")[0])){ /* pixels string value (e.g. "100px") */
25948						return Math.abs(val.split("px")[0]);
25949					}else{
25950						if(val==="top" || val==="left"){ /* special strings */
25951							return 0;
25952						}else if(val==="bottom"){
25953							return Math.abs(wrapper.height()-mCSB_container.outerHeight(false));
25954						}else if(val==="right"){
25955							return Math.abs(wrapper.width()-mCSB_container.outerWidth(false));
25956						}else if(val==="first" || val==="last"){
25957							var obj=mCSB_container.find(":"+val);
25958							return dir==="x" ? _childPos(obj)[1] : _childPos(obj)[0];
25959						}else{
25960							if($(val).length){ /* jquery selector */
25961								return dir==="x" ? _childPos($(val))[1] : _childPos($(val))[0];
25962							}else{ /* other values (e.g. "100em") */
25963								mCSB_container.css(cssProp,val);
25964								methods.update.call(null,$this[0]);
25965								return;
25966							}
25967						}
25968					}
25969					break;
25970			}
25971		},
25972		/* -------------------- */
25973		
25974		
25975		/* calls the update method automatically */
25976		_autoUpdate=function(rem){
25977			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
25978				mCSB_container=$("#mCSB_"+d.idx+"_container");
25979			if(rem){
25980				/* 
25981				removes autoUpdate timer 
25982				usage: _autoUpdate.call(this,"remove");
25983				*/
25984				clearTimeout(mCSB_container[0].autoUpdate);
25985				_delete(mCSB_container[0],"autoUpdate");
25986				return;
25987			}
25988			upd();
25989			function upd(){
25990				clearTimeout(mCSB_container[0].autoUpdate);
25991				if($this.parents("html").length===0){
25992					/* check element in dom tree */
25993					$this=null;
25994					return;
25995				}
25996				mCSB_container[0].autoUpdate=setTimeout(function(){
25997					/* update on specific selector(s) length and size change */
25998					if(o.advanced.updateOnSelectorChange){
25999						d.poll.change.n=sizesSum();
26000						if(d.poll.change.n!==d.poll.change.o){
26001							d.poll.change.o=d.poll.change.n;
26002							doUpd(3);
26003							return;
26004						}
26005					}
26006					/* update on main element and scrollbar size changes */
26007					if(o.advanced.updateOnContentResize){
26008						d.poll.size.n=$this[0].scrollHeight+$this[0].scrollWidth+mCSB_container[0].offsetHeight+$this[0].offsetHeight+$this[0].offsetWidth;
26009						if(d.poll.size.n!==d.poll.size.o){
26010							d.poll.size.o=d.poll.size.n;
26011							doUpd(1);
26012							return;
26013						}
26014					}
26015					/* update on image load */
26016					if(o.advanced.updateOnImageLoad){
26017						if(!(o.advanced.updateOnImageLoad==="auto" && o.axis==="y")){ //by default, it doesn't run on vertical content
26018							d.poll.img.n=mCSB_container.find("img").length;
26019							if(d.poll.img.n!==d.poll.img.o){
26020								d.poll.img.o=d.poll.img.n;
26021								mCSB_container.find("img").each(function(){
26022									imgLoader(this);
26023								});
26024								return;
26025							}
26026						}
26027					}
26028					if(o.advanced.updateOnSelectorChange || o.advanced.updateOnContentResize || o.advanced.updateOnImageLoad){upd();}
26029				},o.advanced.autoUpdateTimeout);
26030			}
26031			/* a tiny image loader */
26032			function imgLoader(el){
26033				if($(el).hasClass(classes[2])){doUpd(); return;}
26034				var img=new Image();
26035				function createDelegate(contextObject,delegateMethod){
26036					return function(){return delegateMethod.apply(contextObject,arguments);}
26037				}
26038				function imgOnLoad(){
26039					this.onload=null;
26040					$(el).addClass(classes[2]);
26041					doUpd(2);
26042				}
26043				img.onload=createDelegate(img,imgOnLoad);
26044				img.src=el.src;
26045			}
26046			/* returns the total height and width sum of all elements matching the selector */
26047			function sizesSum(){
26048				if(o.advanced.updateOnSelectorChange===true){o.advanced.updateOnSelectorChange="*";}
26049				var total=0,sel=mCSB_container.find(o.advanced.updateOnSelectorChange);
26050				if(o.advanced.updateOnSelectorChange && sel.length>0){sel.each(function(){total+=this.offsetHeight+this.offsetWidth;});}
26051				return total;
26052			}
26053			/* calls the update method */
26054			function doUpd(cb){
26055				clearTimeout(mCSB_container[0].autoUpdate);
26056				methods.update.call(null,$this[0],cb);
26057			}
26058		},
26059		/* -------------------- */
26060		
26061		
26062		/* snaps scrolling to a multiple of a pixels number */
26063		_snapAmount=function(to,amount,offset){
26064			return (Math.round(to/amount)*amount-offset); 
26065		},
26066		/* -------------------- */
26067		
26068		
26069		/* stops content and scrollbar animations */
26070		_stop=function(el){
26071			var d=el.data(pluginPfx),
26072				sel=$("#mCSB_"+d.idx+"_container,#mCSB_"+d.idx+"_container_wrapper,#mCSB_"+d.idx+"_dragger_vertical,#mCSB_"+d.idx+"_dragger_horizontal");
26073			sel.each(function(){
26074				_stopTween.call(this);
26075			});
26076		},
26077		/* -------------------- */
26078		
26079		
26080		/* 
26081		ANIMATES CONTENT 
26082		This is where the actual scrolling happens
26083		*/
26084		_scrollTo=function(el,to,options){
26085			var d=el.data(pluginPfx),o=d.opt,
26086				defaults={
26087					trigger:"internal",
26088					dir:"y",
26089					scrollEasing:"mcsEaseOut",
26090					drag:false,
26091					dur:o.scrollInertia,
26092					overwrite:"all",
26093					callbacks:true,
26094					onStart:true,
26095					onUpdate:true,
26096					onComplete:true
26097				},
26098				options=$.extend(defaults,options),
26099				dur=[options.dur,(options.drag ? 0 : options.dur)],
26100				mCustomScrollBox=$("#mCSB_"+d.idx),
26101				mCSB_container=$("#mCSB_"+d.idx+"_container"),
26102				wrapper=mCSB_container.parent(),
26103				totalScrollOffsets=o.callbacks.onTotalScrollOffset ? _arr.call(el,o.callbacks.onTotalScrollOffset) : [0,0],
26104				totalScrollBackOffsets=o.callbacks.onTotalScrollBackOffset ? _arr.call(el,o.callbacks.onTotalScrollBackOffset) : [0,0];
26105			d.trigger=options.trigger;
26106			if(wrapper.scrollTop()!==0 || wrapper.scrollLeft()!==0){ /* always reset scrollTop/Left */
26107				$(".mCSB_"+d.idx+"_scrollbar").css("visibility","visible");
26108				wrapper.scrollTop(0).scrollLeft(0);
26109			}
26110			if(to==="_resetY" && !d.contentReset.y){
26111				/* callbacks: onOverflowYNone */
26112				if(_cb("onOverflowYNone")){o.callbacks.onOverflowYNone.call(el[0]);}
26113				d.contentReset.y=1;
26114			}
26115			if(to==="_resetX" && !d.contentReset.x){
26116				/* callbacks: onOverflowXNone */
26117				if(_cb("onOverflowXNone")){o.callbacks.onOverflowXNone.call(el[0]);}
26118				d.contentReset.x=1;
26119			}
26120			if(to==="_resetY" || to==="_resetX"){return;}
26121			if((d.contentReset.y || !el[0].mcs) && d.overflowed[0]){
26122				/* callbacks: onOverflowY */
26123				if(_cb("onOverflowY")){o.callbacks.onOverflowY.call(el[0]);}
26124				d.contentReset.x=null;
26125			}
26126			if((d.contentReset.x || !el[0].mcs) && d.overflowed[1]){
26127				/* callbacks: onOverflowX */
26128				if(_cb("onOverflowX")){o.callbacks.onOverflowX.call(el[0]);}
26129				d.contentReset.x=null;
26130			}
26131			if(o.snapAmount){ /* scrolling snapping */
26132				var snapAmount=!(o.snapAmount instanceof Array) ? o.snapAmount : options.dir==="x" ? o.snapAmount[1] : o.snapAmount[0];
26133				to=_snapAmount(to,snapAmount,o.snapOffset);
26134			}
26135			switch(options.dir){
26136				case "x":
26137					var mCSB_dragger=$("#mCSB_"+d.idx+"_dragger_horizontal"),
26138						property="left",
26139						contentPos=mCSB_container[0].offsetLeft,
26140						limit=[
26141							mCustomScrollBox.width()-mCSB_container.outerWidth(false),
26142							mCSB_dragger.parent().width()-mCSB_dragger.width()
26143						],
26144						scrollTo=[to,to===0 ? 0 : (to/d.scrollRatio.x)],
26145						tso=totalScrollOffsets[1],
26146						tsbo=totalScrollBackOffsets[1],
26147						totalScrollOffset=tso>0 ? tso/d.scrollRatio.x : 0,
26148						totalScrollBackOffset=tsbo>0 ? tsbo/d.scrollRatio.x : 0;
26149					break;
26150				case "y":
26151					var mCSB_dragger=$("#mCSB_"+d.idx+"_dragger_vertical"),
26152						property="top",
26153						contentPos=mCSB_container[0].offsetTop,
26154						limit=[
26155							mCustomScrollBox.height()-mCSB_container.outerHeight(false),
26156							mCSB_dragger.parent().height()-mCSB_dragger.height()
26157						],
26158						scrollTo=[to,to===0 ? 0 : (to/d.scrollRatio.y)],
26159						tso=totalScrollOffsets[0],
26160						tsbo=totalScrollBackOffsets[0],
26161						totalScrollOffset=tso>0 ? tso/d.scrollRatio.y : 0,
26162						totalScrollBackOffset=tsbo>0 ? tsbo/d.scrollRatio.y : 0;
26163					break;
26164			}
26165			if(scrollTo[1]<0 || (scrollTo[0]===0 && scrollTo[1]===0)){
26166				scrollTo=[0,0];
26167			}else if(scrollTo[1]>=limit[1]){
26168				scrollTo=[limit[0],limit[1]];
26169			}else{
26170				scrollTo[0]=-scrollTo[0];
26171			}
26172			if(!el[0].mcs){
26173				_mcs();  /* init mcs object (once) to make it available before callbacks */
26174				if(_cb("onInit")){o.callbacks.onInit.call(el[0]);} /* callbacks: onInit */
26175			}
26176			clearTimeout(mCSB_container[0].onCompleteTimeout);
26177
26178			_tweenTo(mCSB_dragger[0],property,Math.round(scrollTo[1]),dur[1],options.scrollEasing);
26179			if(!d.tweenRunning && ((contentPos===0 && scrollTo[0]>=0) || (contentPos===limit[0] && scrollTo[0]<=limit[0]))){return;}
26180			_tweenTo(mCSB_container[0],property,Math.round(scrollTo[0]),dur[0],options.scrollEasing,options.overwrite,{
26181				onStart:function(){
26182					if(options.callbacks && options.onStart && !d.tweenRunning){
26183						/* callbacks: onScrollStart */
26184						if(_cb("onScrollStart")){_mcs(); o.callbacks.onScrollStart.call(el[0]);}
26185						d.tweenRunning=true;
26186						_onDragClasses(mCSB_dragger);
26187						d.cbOffsets=_cbOffsets();
26188					}
26189				},onUpdate:function(){
26190					if(options.callbacks && options.onUpdate){
26191						/* callbacks: whileScrolling */
26192						if(_cb("whileScrolling")){_mcs(); o.callbacks.whileScrolling.call(el[0]);}
26193					}
26194				},onComplete:function(){
26195					if(options.callbacks && options.onComplete){
26196						if(o.axis==="yx"){clearTimeout(mCSB_container[0].onCompleteTimeout);}
26197						var t=mCSB_container[0].idleTimer || 0;
26198						mCSB_container[0].onCompleteTimeout=setTimeout(function(){
26199							/* callbacks: onScroll, onTotalScroll, onTotalScrollBack */
26200							if(_cb("onScroll")){_mcs(); o.callbacks.onScroll.call(el[0]);}
26201							if(_cb("onTotalScroll") && scrollTo[1]>=limit[1]-totalScrollOffset && d.cbOffsets[0]){_mcs(); o.callbacks.onTotalScroll.call(el[0]);}
26202							if(_cb("onTotalScrollBack") && scrollTo[1]<=totalScrollBackOffset && d.cbOffsets[1]){_mcs(); o.callbacks.onTotalScrollBack.call(el[0]);}
26203							d.tweenRunning=false;
26204							mCSB_container[0].idleTimer=0;
26205							_onDragClasses(mCSB_dragger,"hide");
26206						},t);
26207					}
26208				}
26209			});
26210			/* checks if callback function exists */
26211			function _cb(cb){
26212				return d && o.callbacks[cb] && typeof o.callbacks[cb]==="function";
26213			}
26214			/* checks whether callback offsets always trigger */
26215			function _cbOffsets(){
26216				return [o.callbacks.alwaysTriggerOffsets || contentPos>=limit[0]+tso,o.callbacks.alwaysTriggerOffsets || contentPos<=-tsbo];
26217			}
26218			/* 
26219			populates object with useful values for the user 
26220			values: 
26221				content: this.mcs.content
26222				content top position: this.mcs.top 
26223				content left position: this.mcs.left 
26224				dragger top position: this.mcs.draggerTop 
26225				dragger left position: this.mcs.draggerLeft 
26226				scrolling y percentage: this.mcs.topPct 
26227				scrolling x percentage: this.mcs.leftPct 
26228				scrolling direction: this.mcs.direction
26229			*/
26230			function _mcs(){
26231				var cp=[mCSB_container[0].offsetTop,mCSB_container[0].offsetLeft], /* content position */
26232					dp=[mCSB_dragger[0].offsetTop,mCSB_dragger[0].offsetLeft], /* dragger position */
26233					cl=[mCSB_container.outerHeight(false),mCSB_container.outerWidth(false)], /* content length */
26234					pl=[mCustomScrollBox.height(),mCustomScrollBox.width()]; /* content parent length */
26235				el[0].mcs={
26236					content:mCSB_container, /* original content wrapper as jquery object */
26237					top:cp[0],left:cp[1],draggerTop:dp[0],draggerLeft:dp[1],
26238					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])),
26239					direction:options.dir
26240				};
26241				/* 
26242				this refers to the original element containing the scrollbar(s)
26243				usage: this.mcs.top, this.mcs.leftPct etc. 
26244				*/
26245			}
26246		},
26247		/* -------------------- */
26248		
26249		
26250		/* 
26251		CUSTOM JAVASCRIPT ANIMATION TWEEN 
26252		Lighter and faster than jquery animate() and css transitions 
26253		Animates top/left properties and includes easings 
26254		*/
26255		_tweenTo=function(el,prop,to,duration,easing,overwrite,callbacks){
26256
26257			if(el && !el._mTween){el._mTween={top:{},left:{}};}
26258			var callbacks=callbacks || {},
26259				onStart=callbacks.onStart || function(){},onUpdate=callbacks.onUpdate || function(){},onComplete=callbacks.onComplete || function(){},
26260				startTime=_getTime(),_delay,progress=0,from=el.offsetTop,elStyle=el.style,_request,tobj=el._mTween[prop];
26261			if(prop==="left"){from=el.offsetLeft;}
26262			var diff=to-from;
26263			tobj.stop=0;
26264			if(overwrite!=="none"){_cancelTween();}
26265			_startTween();
26266			function _step(){
26267				if(tobj.stop){return;}
26268				if(!progress){onStart.call();}
26269				progress=_getTime()-startTime;
26270				_tween();
26271				if(progress>=tobj.time){
26272					tobj.time=(progress>tobj.time) ? progress+_delay-(progress-tobj.time) : progress+_delay-1;
26273					if(tobj.time<progress+1){tobj.time=progress+1;}
26274				}
26275				if(tobj.time<duration){tobj.id=_request(_step);}else{onComplete.call();}
26276			}
26277			function _tween(){
26278				if(duration>0){
26279					tobj.currVal=_ease(tobj.time,from,diff,duration,easing);
26280					elStyle[prop]=Math.round(tobj.currVal)+"px";
26281				}else{
26282					elStyle[prop]=to+"px";
26283				}
26284				onUpdate.call();
26285			}
26286			function _startTween(){
26287				_delay=1000/60;
26288				tobj.time=progress+_delay;
26289				_request=(!window.requestAnimationFrame) ? function(f){_tween(); return setTimeout(f,0.01);} : window.requestAnimationFrame;
26290				tobj.id=_request(_step);
26291			}
26292			function _cancelTween(){
26293				if(tobj.id==null){return;}
26294				if(!window.requestAnimationFrame){clearTimeout(tobj.id);
26295				}else{window.cancelAnimationFrame(tobj.id);}
26296				tobj.id=null;
26297			}
26298			function _ease(t,b,c,d,type){
26299				switch(type){
26300					case "linear": case "mcsLinear":
26301						return c*t/d + b;
26302						break;
26303					case "mcsLinearOut":
26304						t/=d; t--; return c * Math.sqrt(1 - t*t) + b;
26305						break;
26306					case "easeInOutSmooth":
26307						t/=d/2;
26308						if(t<1) return c/2*t*t + b;
26309						t--;
26310						return -c/2 * (t*(t-2) - 1) + b;
26311						break;
26312					case "easeInOutStrong":
26313						t/=d/2;
26314						if(t<1) return c/2 * Math.pow( 2, 10 * (t - 1) ) + b;
26315						t--;
26316						return c/2 * ( -Math.pow( 2, -10 * t) + 2 ) + b;
26317						break;
26318					case "easeInOut": case "mcsEaseInOut":
26319						t/=d/2;
26320						if(t<1) return c/2*t*t*t + b;
26321						t-=2;
26322						return c/2*(t*t*t + 2) + b;
26323						break;
26324					case "easeOutSmooth":
26325						t/=d; t--;
26326						return -c * (t*t*t*t - 1) + b;
26327						break;
26328					case "easeOutStrong":
26329						return c * ( -Math.pow( 2, -10 * t/d ) + 1 ) + b;
26330						break;
26331					case "easeOut": case "mcsEaseOut": default:
26332						var ts=(t/=d)*t,tc=ts*t;
26333						return b+c*(0.499999999999997*tc*ts + -2.5*ts*ts + 5.5*tc + -6.5*ts + 4*t);
26334				}
26335			}
26336		},
26337		/* -------------------- */
26338		
26339		
26340		/* returns current time */
26341		_getTime=function(){
26342			if(window.performance && window.performance.now){
26343				return window.performance.now();
26344			}else{
26345				if(window.performance && window.performance.webkitNow){
26346					return window.performance.webkitNow();
26347				}else{
26348					if(Date.now){return Date.now();}else{return new Date().getTime();}
26349				}
26350			}
26351		},
26352		/* -------------------- */
26353		
26354		
26355		/* stops a tween */
26356		_stopTween=function(){
26357			var el=this;
26358			if(!el._mTween){el._mTween={top:{},left:{}};}
26359			var props=["top","left"];
26360			for(var i=0; i<props.length; i++){
26361				var prop=props[i];
26362				if(el._mTween[prop].id){
26363					if(!window.requestAnimationFrame){clearTimeout(el._mTween[prop].id);
26364					}else{window.cancelAnimationFrame(el._mTween[prop].id);}
26365					el._mTween[prop].id=null;
26366					el._mTween[prop].stop=1;
26367				}
26368			}
26369		},
26370		/* -------------------- */
26371		
26372		
26373		/* deletes a property (avoiding the exception thrown by IE) */
26374		_delete=function(c,m){
26375			try{delete c[m];}catch(e){c[m]=null;}
26376		},
26377		/* -------------------- */
26378		
26379		
26380		/* detects left mouse button */
26381		_mouseBtnLeft=function(e){
26382			return !(e.which && e.which!==1);
26383		},
26384		/* -------------------- */
26385		
26386		
26387		/* detects if pointer type event is touch */
26388		_pointerTouch=function(e){
26389			var t=e.originalEvent.pointerType;
26390			return !(t && t!=="touch" && t!==2);
26391		},
26392		/* -------------------- */
26393		
26394		
26395		/* checks if value is numeric */
26396		_isNumeric=function(val){
26397			return !isNaN(parseFloat(val)) && isFinite(val);
26398		},
26399		/* -------------------- */
26400		
26401		
26402		/* returns element position according to content */
26403		_childPos=function(el){
26404			var p=el.parents(".mCSB_container");
26405			return [el.offset().top-p.offset().top,el.offset().left-p.offset().left];
26406		},
26407		/* -------------------- */
26408		
26409		
26410		/* checks if browser tab is hidden/inactive via Page Visibility API */
26411		_isTabHidden=function(){
26412			var prop=_getHiddenProp();
26413			if(!prop) return false;
26414			return document[prop];
26415			function _getHiddenProp(){
26416				var pfx=["webkit","moz","ms","o"];
26417				if("hidden" in document) return "hidden"; //natively supported
26418				for(var i=0; i<pfx.length; i++){ //prefixed
26419				    if((pfx[i]+"Hidden") in document) 
26420				        return pfx[i]+"Hidden";
26421				}
26422				return null; //not supported
26423			}
26424		};
26425		/* -------------------- */
26426		
26427	
26428	
26429	
26430	
26431	/* 
26432	----------------------------------------
26433	PLUGIN SETUP 
26434	----------------------------------------
26435	*/
26436	
26437	/* plugin constructor functions */
26438	$.fn[pluginNS]=function(method){ /* usage: $(selector).mCustomScrollbar(); */
26439		if(methods[method]){
26440			return methods[method].apply(this,Array.prototype.slice.call(arguments,1));
26441		}else if(typeof method==="object" || !method){
26442			return methods.init.apply(this,arguments);
26443		}else{
26444			$.error("Method "+method+" does not exist");
26445		}
26446	};
26447	$[pluginNS]=function(method){ /* usage: $.mCustomScrollbar(); */
26448		if(methods[method]){
26449			return methods[method].apply(this,Array.prototype.slice.call(arguments,1));
26450		}else if(typeof method==="object" || !method){
26451			return methods.init.apply(this,arguments);
26452		}else{
26453			$.error("Method "+method+" does not exist");
26454		}
26455	};
26456	
26457	/* 
26458	allow setting plugin default options. 
26459	usage: $.mCustomScrollbar.defaults.scrollInertia=500; 
26460	to apply any changed default options on default selectors (below), use inside document ready fn 
26461	e.g.: $(document).ready(function(){ $.mCustomScrollbar.defaults.scrollInertia=500; });
26462	*/
26463	$[pluginNS].defaults=defaults;
26464	
26465	/* 
26466	add window object (window.mCustomScrollbar) 
26467	usage: if(window.mCustomScrollbar){console.log("custom scrollbar plugin loaded");}
26468	*/
26469	window[pluginNS]=true;
26470	
26471	$(window).bind("load",function(){
26472		
26473		$(defaultSelector)[pluginNS](); /* add scrollbars automatically on default selector */
26474		
26475		/* extend jQuery expressions */
26476		$.extend($.expr[":"],{
26477			/* checks if element is within scrollable viewport */
26478			mcsInView:$.expr[":"].mcsInView || function(el){
26479				var $el=$(el),content=$el.parents(".mCSB_container"),wrapper,cPos;
26480				if(!content.length){return;}
26481				wrapper=content.parent();
26482				cPos=[content[0].offsetTop,content[0].offsetLeft];
26483				return 	cPos[0]+_childPos($el)[0]>=0 && cPos[0]+_childPos($el)[0]<wrapper.height()-$el.outerHeight(false) && 
26484						cPos[1]+_childPos($el)[1]>=0 && cPos[1]+_childPos($el)[1]<wrapper.width()-$el.outerWidth(false);
26485			},
26486			/* checks if element or part of element is in view of scrollable viewport */
26487			mcsInSight:$.expr[":"].mcsInSight || function(el,i,m){
26488				var $el=$(el),elD,content=$el.parents(".mCSB_container"),wrapperView,pos,wrapperViewPct,
26489					pctVals=m[3]==="exact" ? [[1,0],[1,0]] : [[0.9,0.1],[0.6,0.4]];
26490				if(!content.length){return;}
26491				elD=[$el.outerHeight(false),$el.outerWidth(false)];
26492				pos=[content[0].offsetTop+_childPos($el)[0],content[0].offsetLeft+_childPos($el)[1]];
26493				wrapperView=[content.parent()[0].offsetHeight,content.parent()[0].offsetWidth];
26494				wrapperViewPct=[elD[0]<wrapperView[0] ? pctVals[0] : pctVals[1],elD[1]<wrapperView[1] ? pctVals[0] : pctVals[1]];
26495				return 	pos[0]-(wrapperView[0]*wrapperViewPct[0][0])<0 && pos[0]+elD[0]-(wrapperView[0]*wrapperViewPct[0][1])>=0 && 
26496						pos[1]-(wrapperView[1]*wrapperViewPct[1][0])<0 && pos[1]+elD[1]-(wrapperView[1]*wrapperViewPct[1][1])>=0;
26497			},
26498			/* checks if element is overflowed having visible scrollbar(s) */
26499			mcsOverflow:$.expr[":"].mcsOverflow || function(el){
26500				var d=$(el).data(pluginPfx);
26501				if(!d){return;}
26502				return d.overflowed[0] || d.overflowed[1];
26503			}
26504		});
26505	
26506	});
26507
26508}))}));
26509/* End */
26510;
26511; /* Start:"a:4:{s:4:"full";s:60:"/bitrix/templates/aspro_max/js/scrollTabs.js?171646553712996";s:6:"source";s:44:"/bitrix/templates/aspro_max/js/scrollTabs.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
26512InitTabsScroll = function () {
26513	$('.arrow_scroll:not(.arrow_scroll_init)').scrollTab();
26514}
26515
26516ResizeScrollTabs = function () {
26517	var scrollTabs = $('.arrow_scroll_init');
26518
26519	if (scrollTabs.length) {
26520		scrollTabs.each(function (i, scrollTab) {
26521			var _scrollTab = $(scrollTab);
26522			_scrollTab.data('scrollTabOptions').resize();
26523		});
26524	}
26525}
26526
26527$(document).ready(function () {
26528	InitTabsScroll();
26529});
26530
26531$(window).on('resize', function () {
26532	if (window.scrollTabsTimeout !== undefined) {
26533		clearTimeout(window.scrollTabsTimeout);
26534	}
26535
26536	window.scrollTabsTimeout = setTimeout(
26537		ResizeScrollTabs,
26538		20
26539	);
26540});
26541
26542$.fn.scrollTab = function (options) {
26543	function _scrollTab(element, options) {
26544		var _scrollTab = $(element);
26545		var tabs_wrapper = _scrollTab.find(options.tabs_wrapper);
26546		var tabs = tabs_wrapper.find('> li');
26547
26548		var arrow_svg = '<svg xmlns="http://www.w3.org/2000/svg" width="12" height="8" viewBox="0 0 12 8">' +
26549			'<rect width="12" height="8" fill="#333" fill-opacity="0" />' +
26550			'<path d="M1015.69,507.693a0.986,0.986,0,0,1-1.4,0l-4.31-4.316-4.3,4.316a0.993,0.993,0,0,1-1.4-1.408l4.99-5.009a1.026,1.026,0,0,1,1.43,0l4.99,5.009A0.993,0.993,0,0,1,1015.69,507.693Z" fill="#333" transform="translate(-1004 -501)"/>' +
26551			'</svg>';
26552		var arrows_wrapper = '<div class="arrows_wrapper">' +
26553			'<div class="arrow arrow_left colored_theme_hover_text">' + arrow_svg + '</div>' +
26554			'<div class="arrow arrow_right colored_theme_hover_text">' + arrow_svg + '</div>' +
26555			'</div>';
26556
26557		var arrows = $(arrows_wrapper).insertAfter(tabs_wrapper);
26558		var arrow_left = arrows.find('.arrow_left');
26559		var arrow_right = arrows.find('.arrow_right');
26560
26561		var thisOoptions = $.extend({}, options);
26562
26563		thisOoptions.scrollTab = _scrollTab;
26564		thisOoptions.wrapper = tabs_wrapper;
26565		thisOoptions.tabs = tabs;
26566		thisOoptions.arrows = {};
26567		thisOoptions.arrows.wrapper = arrows;
26568		thisOoptions.arrows.arrow_left = arrow_left;
26569		thisOoptions.arrows.arrow_right = arrow_right;
26570		thisOoptions.arrows.arrow_width = arrow_right[0].getBoundingClientRect().width;
26571
26572		if (thisOoptions.linked_tabs !== undefined && thisOoptions.linked_tabs.length && thisOoptions.linked_tabs.data('scrollTabOptions') !== undefined) {
26573			thisOoptions.linked_options = thisOoptions.linked_tabs.data('scrollTabOptions');
26574			thisOoptions.linked_options.linked_options = thisOoptions;
26575		}
26576
26577		if (options.arrows_css) {
26578			thisOoptions.arrows.arrow_left.css(options.arrows_css);
26579			thisOoptions.arrows.arrow_right.css(options.arrows_css);
26580		}
26581
26582		thisOoptions.GetSummWidth = function (elements) {
26583			elements = $(elements);
26584			var result = 0;
26585			if (elements.length) {
26586				elements.each(function (i, element) {
26587					var _element = $(element);
26588					var elementWidth = _element.outerWidth(true) + thisOoptions.width_grow;
26589					elementWidth = Math.ceil(elementWidth * 10) / 10;
26590					_element.data('leftBound', result);
26591					result += elementWidth;
26592					_element.data('rightBound', result);
26593				});
26594			}
26595			return result;
26596		}
26597
26598		var tabs_width = thisOoptions.GetSummWidth(thisOoptions.tabs);
26599		thisOoptions.tabs_width = tabs_width;
26600		thisOoptions.minTranslate = (thisOoptions.width < thisOoptions.tabs_width ? thisOoptions.width - thisOoptions.tabs_width - 1 : 0);
26601
26602		if (thisOoptions.tabs_width) {
26603			thisOoptions.wrapper.css({
26604				'white-space': 'nowrap',
26605				'min-width': 'auto',
26606			});
26607		};
26608		thisOoptions.scrollTab.css({
26609			'overflow': 'hidden',
26610			'position': 'relative',
26611		});
26612
26613		thisOoptions.checkArrows = function (translate) {
26614			if (translate === undefined) {
26615				translate = thisOoptions.translate;
26616			}
26617
26618			if (translate <= 1) {
26619				return;
26620			}
26621
26622			if (translate >= thisOoptions.maxTranslate) {
26623				thisOoptions.arrows.arrow_left.addClass('disabled');
26624				thisOoptions.arrows.arrow_right.removeClass('disabled');
26625			} else if (translate <= thisOoptions.minTranslate) {
26626				thisOoptions.arrows.arrow_right.addClass('disabled');
26627				thisOoptions.arrows.arrow_left.removeClass('disabled');
26628			} else {
26629				thisOoptions.arrows.arrow_left.removeClass('disabled');
26630				thisOoptions.arrows.arrow_right.removeClass('disabled');
26631			}
26632
26633		}
26634
26635		thisOoptions.directScroll = function (distance, delay) {
26636			if (delay === undefined) {
26637				delay = 5;
26638			}
26639			clearInterval(thisOoptions.timerMoveDirect);
26640			var newTranslate = thisOoptions.translate + distance;
26641
26642			if (newTranslate > thisOoptions.maxTranslate) {
26643				newTranslate = thisOoptions.maxTranslate;
26644			} else if (newTranslate < thisOoptions.minTranslate) {
26645				newTranslate = thisOoptions.minTranslate;
26646			}
26647
26648			if (delay == 0) {
26649				thisOoptions.translate = newTranslate;
26650				thisOoptions.wrapper.css({
26651					'transform': 'translateX(' + thisOoptions.translate + 'px)',
26652				});
26653			} else {
26654				thisOoptions.timerMoveDirect = setInterval(
26655					function () {
26656						if ((distance < 0 && thisOoptions.translate <= newTranslate) || (distance > 0 && thisOoptions.translate >= newTranslate)) {
26657							clearInterval(thisOoptions.timerMoveDirect);
26658						}
26659
26660						if (thisOoptions.translate < newTranslate) {
26661							thisOoptions.translate++;
26662						} else {
26663							thisOoptions.translate--;
26664						}
26665
26666						thisOoptions.wrapper.css({
26667							'transform': 'translateX(' + thisOoptions.translate + 'px)',
26668						});
26669					},
26670					delay
26671				);
26672			}
26673			thisOoptions.checkArrows(newTranslate);
26674		};
26675
26676		thisOoptions.addArrowsEvents = function () {
26677			thisOoptions.arrows.arrow_right.on('mouseenter', function () {
26678				thisOoptions.arrows.arrow_left.removeClass('disabled');
26679				thisOoptions.tabs_width = thisOoptions.GetSummWidth(thisOoptions.tabs);
26680				thisOoptions.minTranslate = (thisOoptions.width < thisOoptions.tabs_width ? thisOoptions.width - thisOoptions.tabs_width - 1 : 0);
26681				thisOoptions.timerMoveLeft = setInterval(
26682					function () {
26683						if (thisOoptions.translate < thisOoptions.minTranslate) {
26684							clearInterval(thisOoptions.timerMoveLeft);
26685							thisOoptions.arrows.arrow_right.addClass('disabled');
26686						} else {
26687							thisOoptions.translate -= thisOoptions.translateSpeed;
26688							thisOoptions.wrapper.css({
26689								'transform': 'translateX(' + thisOoptions.translate + 'px)',
26690							});
26691						}
26692					},
26693					10
26694				);
26695			});
26696
26697			thisOoptions.arrows.arrow_right.on('mouseleave', function () {
26698				clearInterval(thisOoptions.timerMoveLeft);
26699			});
26700
26701			thisOoptions.arrows.arrow_right.on('click', function () {
26702				thisOoptions.directScroll(-thisOoptions.directTranslate);
26703				thisOoptions.arrows.arrow_left.removeClass('disabled');
26704			});
26705
26706			thisOoptions.arrows.arrow_right.on('touchend', function () {
26707				setTimeout(function () {
26708					clearInterval(thisOoptions.timerMoveLeft);
26709				}, 1);
26710			});
26711
26712			thisOoptions.arrows.arrow_left.on('mouseenter', function () {
26713				thisOoptions.tabs_width = thisOoptions.GetSummWidth(thisOoptions.tabs);
26714				thisOoptions.minTranslate = (thisOoptions.width < thisOoptions.tabs_width ? thisOoptions.width - thisOoptions.tabs_width - 1 : 0);
26715				thisOoptions.arrows.arrow_right.removeClass('disabled');
26716				thisOoptions.timerMoveRight = setInterval(
26717					function () {
26718						if (thisOoptions.translate >= thisOoptions.maxTranslate) {
26719							clearInterval(thisOoptions.timerMoveRight);
26720							thisOoptions.arrows.arrow_left.addClass('disabled');
26721						} else {
26722							thisOoptions.translate += thisOoptions.translateSpeed;
26723							thisOoptions.wrapper.css({
26724								'transform': 'translateX(' + thisOoptions.translate + 'px)',
26725							});
26726						}
26727					},
26728					10
26729				);
26730			});
26731
26732			thisOoptions.arrows.arrow_left.on('mouseleave', function () {
26733				clearInterval(thisOoptions.timerMoveRight);
26734			});
26735
26736			thisOoptions.arrows.arrow_left.on('click', function () {
26737				thisOoptions.directScroll(thisOoptions.directTranslate);
26738				thisOoptions.arrows.arrow_right.removeClass('disabled');
26739			});
26740
26741			thisOoptions.arrows.arrow_left.on('touchend', function () {
26742				setTimeout(function () {
26743					clearInterval(thisOoptions.timerMoveRight);
26744				}, 1);
26745			});
26746		};
26747
26748		thisOoptions.addTabsEvents = function () {
26749			thisOoptions.tabs.on('click', function () {
26750				var leftScrollBound = thisOoptions.scrollTab[0].getBoundingClientRect().left;
26751				var rightScrollBound = thisOoptions.scrollTab[0].getBoundingClientRect().right;
26752				var tabBounds = this.getBoundingClientRect();
26753
26754				if (tabBounds.left < leftScrollBound) {
26755					thisOoptions.directScroll(leftScrollBound - tabBounds.left + thisOoptions.arrows.arrow_width, 1);
26756				} else if (tabBounds.right > rightScrollBound) {
26757					thisOoptions.directScroll(rightScrollBound - tabBounds.right - thisOoptions.arrows.arrow_width, 1);
26758				}
26759
26760				if (thisOoptions.linked_options !== undefined) {
26761					var this_index = $(this).index();
26762					var linked_tab = $(thisOoptions.linked_options.tabs[this_index]);
26763					var linked_tabs = {
26764						leftScrollBound: thisOoptions.linked_options.scrollTab[0].getBoundingClientRect().left,
26765						rightScrollBound: thisOoptions.linked_options.scrollTab[0].getBoundingClientRect().right,
26766						tabBounds: linked_tab[0].getBoundingClientRect(),
26767					};
26768					if (linked_tabs.tabBounds.left < linked_tabs.leftScrollBound) {
26769						thisOoptions.linked_options.directScroll(linked_tabs.leftScrollBound - linked_tabs.tabBounds.left + thisOoptions.linked_options.arrows.arrow_width + 1, 0);
26770					} else if (linked_tabs.tabBounds.right > linked_tabs.rightScrollBound) {
26771						thisOoptions.linked_options.directScroll(linked_tabs.rightScrollBound - linked_tabs.tabBounds.right - thisOoptions.linked_options.arrows.arrow_width - 1, 0);
26772					}
26773				}
26774
26775
26776			});
26777		};
26778
26779		thisOoptions.addWrapperEvents = function () {
26780			thisOoptions.wrapper.on('touchstart', function (event) {
26781				thisOoptions.touch.posPrev = event.originalEvent.changedTouches[0].pageX;
26782				clearInterval(thisOoptions.timerMoveRight);
26783				clearInterval(thisOoptions.timerMoveLeft);
26784				clearInterval(thisOoptions.timerMoveDirect);
26785				thisOoptions.tabs_width = thisOoptions.GetSummWidth(thisOoptions.tabs);
26786				thisOoptions.minTranslate = (thisOoptions.width < thisOoptions.tabs_width ? thisOoptions.width - thisOoptions.tabs_width - 1 : 0);
26787			});
26788
26789			thisOoptions.wrapper.on('touchmove', function (event) {
26790				thisOoptions.touch.posCurrent = event.originalEvent.changedTouches[0].pageX - thisOoptions.touch.posPrev;
26791				thisOoptions.directScroll(thisOoptions.touch.posCurrent, 0);
26792				thisOoptions.touch.posPrev = event.originalEvent.changedTouches[0].pageX;
26793			});
26794		};
26795
26796		thisOoptions.resize = function () {
26797			if (thisOoptions.onBeforeResize && typeof (thisOoptions.onBeforeResize) == 'function') {
26798				thisOoptions.onBeforeResize(thisOoptions);
26799			}
26800			thisOoptions.width = Math.ceil(thisOoptions.scrollTab[0].getBoundingClientRect().width);
26801			thisOoptions.tabs_width = thisOoptions.GetSummWidth(thisOoptions.tabs);
26802			thisOoptions.minTranslate = (thisOoptions.width < thisOoptions.tabs_width ? thisOoptions.width - thisOoptions.tabs_width - 1 : 0);
26803
26804			if (thisOoptions.onResize && typeof (thisOoptions.onResize) == 'function') {
26805				thisOoptions.onResize(thisOoptions);
26806			}
26807
26808			if (thisOoptions.translate < thisOoptions.minTranslate) {
26809				thisOoptions.directScroll(thisOoptions.minTranslate - thisOoptions.translate);
26810			} else if (thisOoptions.translate > thisOoptions.maxTranslate) {
26811				thisOoptions.directScroll(thisOoptions.maxTranslate - thisOoptions.translate);
26812			}
26813
26814			if (thisOoptions.tabs_width < thisOoptions.width) {
26815				thisOoptions.arrows.wrapper.css('display', 'none');
26816			} else {
26817				thisOoptions.arrows.wrapper.css('display', '');
26818				thisOoptions.arrows.arrow_left.removeClass('disabled');
26819				thisOoptions.arrows.arrow_right.removeClass('disabled');
26820				if (thisOoptions.translate >= 0) {
26821					thisOoptions.arrows.arrow_left.addClass('disabled');
26822				}
26823				if (thisOoptions.translate <= thisOoptions.minTranslate) {
26824					thisOoptions.arrows.arrow_right.addClass('disabled');
26825				}
26826			}
26827
26828			if (thisOoptions.onAfterResize && typeof (thisOoptions.onAfterResize) == 'function') {
26829				thisOoptions.onAfterResize(thisOoptions);
26830			}
26831		};
26832
26833
26834		_scrollTab.data('scrollTabOptions', thisOoptions);
26835		_scrollTab.data('scrollTabOptions').addArrowsEvents();
26836		_scrollTab.data('scrollTabOptions').addTabsEvents();
26837		_scrollTab.data('scrollTabOptions').addWrapperEvents();
26838		_scrollTab.addClass('arrow_scroll_init').addClass('swipeignore');
26839		_scrollTab.data('scrollTabOptions').resize();
26840		delete thisOoptions;
26841	}
26842
26843	var options = $.extend({
26844		translate: 0,
26845		translateSpeed: 2,
26846		directTranslate: 150,
26847		maxTranslate: 1,
26848		touch: {},
26849		arrows_css: false,
26850		tabs_wrapper: '.nav-tabs',
26851		onResize: false,
26852		width_grow: 9,
26853	}, options);
26854
26855	var el = $(this);
26856
26857	if (el.hasClass('arrow_scroll_init'))
26858		return false;
26859
26860	el.each(function (i, scrollTab) {
26861		_scrollTab(scrollTab, options);
26862	});
26863}
26864/* End */
26865;
26866; /* Start:"a:4:{s:4:"full";s:55:"/bitrix/templates/aspro_max/js/main.js?1777873358290020";s:6:"source";s:38:"/bitrix/templates/aspro_max/js/main.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
26867var basketTimeoutSlide;
26868var resizeEventTimer;
26869
26870var funcDefined = function (func) {
26871	try {
26872		if (typeof func == 'function')
26873			return true;
26874		else
26875			return typeof window[func] === "function";
26876	}
26877	catch (e) {
26878		return false;
26879	}
26880}
26881
26882InitLazyLoad = function () { }
26883
26884$(document).on('change', '.uploader input[type=file]', function () {
26885	if (!$(this).next().length || !$(this).next().hasClass('resetfile')) {
26886		$('<span class="resetfile"><svg xmlns="http://www.w3.org/2000/svg" width="11" height="11" viewBox="0 0 11 11"><path d="M1345.19,376.484l4.66,4.659a0.492,0.492,0,0,1,0,.707,0.5,0.5,0,0,1-.71,0l-4.66-4.659-4.65,4.659a0.5,0.5,0,0,1-.71,0,0.492,0.492,0,0,1,0-.707l4.66-4.659-4.66-4.659a0.492,0.492,0,0,1,0-.707,0.5,0.5,0,0,1,.71,0l4.65,4.659,4.66-4.659a0.5,0.5,0,0,1,.71,0,0.492,0.492,0,0,1,0,.707Z" transform="translate(-1339 -371)"/></svg></span>').insertAfter($(this));
26887	}
26888});
26889
26890$(document).on('click', '.uploader.files_add input[type=file] + .resetfile', function () {
26891	var $input = $(this).prev();
26892	$input.val('');
26893	$.uniform.update($input);
26894	$(this).remove();
26895});
26896
26897$(document).on('click', '.top_block h3', function () {
26898	if (window.matchMedia('(max-width: 550px)').matches) {
26899		var $this = $(this);
26900		var a = $this.siblings('a');
26901		if (a.length) {
26902			a[0].click();
26903		}
26904	}
26905});
26906
26907BX.addCustomEvent('onAjaxSuccess', function (data) {
26908	if (typeof (data) !== undefined && data !== null && typeof (data) == 'object') {
26909		if (typeof (data) !== undefined && typeof (data.BASKET_REFRESHED) !== undefined && data.BASKET_REFRESHED === true) {
26910			var basketCounts = data.BASKET_DATA.BASKET_ITEMS_COUNT;
26911			reloadBasketCounters(basketCounts);
26912		}
26913	}
26914});
26915
26916if (!funcDefined('setLocationSKU')) {
26917	function setLocationSKU(ID) {
26918		var objUrl = parseUrlQuery(),
26919			j = 0,
26920			prefix = '',
26921			query_string = '',
26922			url = '';
26923		if ('oid' in objUrl) {
26924			if (parseInt(objUrl.oid) > 0) {
26925				objUrl.oid = ID;
26926				for (var i in objUrl) {
26927					if (parseInt(j) > 0)
26928						prefix = '&';
26929					query_string = query_string + prefix + i + '=' + objUrl[i];
26930					j++;
26931				}
26932				if (query_string) {
26933					url = location.pathname + '?' + query_string;
26934				}
26935				try {
26936					history.replaceState(null, null, url);
26937					return;
26938				}
26939				catch (e) { }
26940				location.hash = '#' + url.substr(1)
26941			}
26942		}
26943	}
26944}
26945
26946
26947if (!funcDefined('ShowOverlay')) {
26948	ShowOverlay = function () {
26949		$('<div class="jqmOverlay waiting"></div>').appendTo('body');
26950	}
26951}
26952if (!funcDefined('HideOverlay')) {
26953	HideOverlay = function () {
26954		$('.jqmOverlay').detach();
26955	}
26956}
26957if (!funcDefined('trimPrice')) {
26958	var trimPrice = function trimPrice(s) {
26959		s = s.split(" ").join("");
26960		s = s.split("&nbsp;").join("");
26961		return s;
26962	}
26963}
26964
26965if (!funcDefined('markProductRemoveBasket')) {
26966	var markProductRemoveBasket = function markProductRemoveBasket(id) {
26967		$('.in-cart[data-item=' + id + ']').hide();
26968		$('.to-cart[data-item=' + id + ']').show();
26969		$('.to-cart[data-item=' + id + ']').closest('.button_block').removeClass('wide');
26970		$('.to-cart[data-item=' + id + ']').closest('.counter_wrapp').find('.counter_block').show();
26971		$('.counter_block[data-item=' + id + ']').closest('.counter_block_inner').show();
26972		$('.counter_block[data-item=' + id + ']').show();
26973		$('.in-subscribe[data-item=' + id + ']').hide();
26974		$('.to-subscribe[data-item=' + id + ']').show();
26975		//$('.wish_item[data-item='+id+']').removeClass("added");
26976		$('.wish_item[data-item=' + id + '] .value:not(.added)').show();
26977		$('.wish_item[data-item=' + id + '] .value.added').hide();
26978		$('.wish_item.to[data-item=' + id + ']').show();
26979		$('.wish_item.in[data-item=' + id + ']').hide();
26980		$('.banner_buttons.with_actions .wraps_buttons[data-id=' + id + '] .basket_item_add').removeClass('added');
26981		$('.banner_buttons.with_actions .wraps_buttons[data-id=' + id + '] .wish_item_add').removeClass('added');
26982	}
26983}
26984
26985if (!funcDefined('markProductAddBasket')) {
26986	var markProductAddBasket = function markProductAddBasket(id) {
26987		$('.to-cart[data-item=' + id + ']').hide();
26988		$('.to-cart[data-item=' + id + ']').closest('.counter_wrapp').find('.counter_block_inner').hide();
26989		$('.to-cart[data-item=' + id + ']').closest('.counter_wrapp').find('.counter_block').hide();
26990		$('.to-cart[data-item=' + id + ']').closest('.button_block').addClass('wide');
26991		$('.in-cart[data-item=' + id + ']').show();
26992		//$('.wish_item[data-item='+id+']').removeClass("added");
26993		$('.wish_item[data-item=' + id + '] .value:not(.added)').show();
26994		$('.wish_item[data-item=' + id + '] .value.added').hide();
26995
26996		$('.wish_item.to[data-item=' + id + ']').show();
26997		$('.wish_item.in[data-item=' + id + ']').hide();
26998		$('.banner_buttons.with_actions .wraps_buttons[data-id=' + id + '] .basket_item_add').addClass('added');
26999	}
27000}
27001
27002if (!funcDefined('markProductDelay')) {
27003	var markProductDelay = function markProductDelay(id) {
27004		$('.in-cart[data-item=' + id + ']').hide();
27005		$('.to-cart[data-item=' + id + ']').show();
27006		$('.to-cart[data-item=' + id + ']').closest('.counter_wrapp').find('.counter_block_inner').show();
27007		$('.to-cart[data-item=' + id + ']').closest('.counter_wrapp').find('.counter_block').show();
27008		$('.to-cart[data-item=' + id + ']').closest('.button_block').removeClass('wide');
27009		//$('.wish_item[data-item='+id+']').addClass("added");
27010		$('.wish_item[data-item=' + id + '] .value:not(.added)').hide();
27011		$('.wish_item[data-item=' + id + '] .value.added').css('display', 'block');
27012
27013		$('.wish_item.to[data-item=' + id + ']').hide();
27014		$('.wish_item.in[data-item=' + id + ']').show();
27015
27016		$('.banner_buttons.with_actions .wraps_buttons[data-id=' + id + '] .wish_item_add').addClass('added');
27017
27018	}
27019}
27020
27021if (!funcDefined('markProductSubscribe')) {
27022	var markProductSubscribe = function markProductSubscribe(id) {
27023		$('.to-subscribe[data-item=' + id + ']').hide();
27024		$('.in-subscribe[data-item=' + id + ']').css('display', 'block');
27025	}
27026}
27027
27028if (!funcDefined('basketFly')) {
27029	var basketFly = function basketFly(action, opener) {
27030		if (typeof obMaxPredictions === 'object') {
27031			obMaxPredictions.updateAll();
27032		}
27033
27034		/*if(arAsproOptions['PAGES']['BASKET_PAGE'])
27035			return;*/
27036		$.post(arAsproOptions['SITE_DIR'] + "ajax/basket_fly.php", "PARAMS=" + $("#basket_form").find("input#fly_basket_params").val(), $.proxy(function (data) {
27037			var small = $('.opener .basket_count').hasClass('small'),
27038				basket_count = $(data).find('.basket_count').find('.items div').text();
27039			$('#basket_line .basket_fly').addClass('loaded').html(data);
27040
27041			if (action == "refresh")
27042				$('li[data-type=AnDelCanBuy]').trigger('click');
27043
27044
27045			if (typeof (opener) == 'undefined' || $('#basket_line .basket_fly').hasClass('loading')) {
27046				if (window.matchMedia('(min-width: 769px)').matches) {
27047					if (action == 'open') {
27048						if (small) {
27049							if (arAsproOptions['THEME']['SHOW_BASKET_ONADDTOCART'] !== 'N') {
27050								$('.opener .basket_count').click();
27051							}
27052						}
27053						else {
27054							$('.opener .basket_count').removeClass('small')
27055							$('.tabs_content.basket li[item-section="AnDelCanBuy"]').addClass('cur');
27056							$('#basket_line ul.tabs li[item-section="AnDelCanBuy"]').addClass('cur');
27057
27058							$("#basket_line .basket_fly .opener > div:eq(0)").addClass("cur");
27059						}
27060					}
27061					else if (action == 'wish') {
27062						if (small) {
27063							if (arAsproOptions['THEME']['SHOW_BASKET_ONADDTOCART'] !== 'N')
27064								$('.opener .wish_count').click();
27065						}
27066						else {
27067							$('.opener .wish_count').removeClass('small')
27068							$('.tabs_content.basket li[item-section="DelDelCanBuy"]').addClass('cur');
27069							$('#basket_line ul.tabs li[item-section="DelDelCanBuy"]').addClass('cur');
27070						}
27071					}
27072					else {
27073						if (arAsproOptions['THEME']['SHOW_BASKET_ONADDTOCART'] !== 'N') {
27074							$('.opener .basket_count').click();
27075						}
27076					}
27077				}
27078			}
27079		}));
27080	}
27081}
27082
27083if (!funcDefined('basketTop')) {
27084	var basketTop = function basketTop(action, opener) {
27085
27086		if (action == 'close') {
27087			if ($('#headerfixed .basket_hover_block, .top_basket .basket_hover_block').length) {
27088				$('#headerfixed .basket_hover_block, .top_basket .basket_hover_block').css({
27089					'opacity': '',
27090					'visibility': ''
27091				});
27092				return true;
27093			}
27094		}
27095		/*if(arAsproOptions['PAGES']['BASKET_PAGE'])
27096			return;*/
27097
27098		$('.basket_hover_block').removeClass('loaded');
27099		$.post(arAsproOptions['SITE_DIR'] + "ajax/showBasketHover.php", "PARAMS=" + $("#basket_form").find("input#fly_basket_params").val(), $.proxy(function (data) {
27100			var small = $('.opener .basket_count').hasClass('small'),
27101				basket_count = $(data).find('.basket_count').find('.items div').text();
27102
27103			$('.basket_hover_block').each(function () {
27104				$(this).addClass('loaded').html(data);
27105			});
27106
27107			if (action == "refresh")
27108				$('li[data-type=AnDelCanBuy]').trigger('click');
27109
27110			if (typeof (opener) == 'undefined') {
27111				if (window.matchMedia('(min-width: 769px)').matches) {
27112					if (action == 'open') {
27113						// if(small)
27114						// {
27115						if (arAsproOptions['THEME']['SHOW_BASKET_ONADDTOCART'] !== 'N') {
27116
27117							if ($('#headerfixed').hasClass('fixed')) {
27118								var selector = '#headerfixed .basket_hover_block';
27119							} else {
27120								var selector = '.top_basket .basket_hover_block';
27121							}
27122
27123							$(selector).css({
27124								'opacity': '1',
27125								'visibility': 'visible'
27126							});
27127
27128							setTimeout(
27129								function () {
27130									$(selector).css({
27131										'opacity': '',
27132										'visibility': ''
27133									});
27134								},
27135								2000
27136							);
27137						}
27138						// }
27139						// else
27140						// {
27141						// 	$('.opener .basket_count').removeClass('small')
27142						// 	$('.tabs_content.basket li[item-section="AnDelCanBuy"]').addClass('cur');
27143						// 	$('#basket_line ul.tabs li[item-section="AnDelCanBuy"]').addClass('cur');
27144
27145						// 	$("#basket_line .basket_fly .opener > div:eq(0)").addClass("cur");
27146						// }
27147					}
27148					else if (action == 'wish') {
27149						if (small) {
27150							if (arAsproOptions['THEME']['SHOW_BASKET_ONADDTOCART'] !== 'N')
27151								$('.opener .wish_count').click();
27152						}
27153						else {
27154							$('.opener .wish_count').removeClass('small')
27155							$('.tabs_content.basket li[item-section="DelDelCanBuy"]').addClass('cur');
27156							$('#basket_line ul.tabs li[item-section="DelDelCanBuy"]').addClass('cur');
27157						}
27158					}
27159					else {
27160						if (arAsproOptions['THEME']['SHOW_BASKET_ONADDTOCART'] !== 'N') {
27161							$('.opener .basket_count').click();
27162						}
27163					}
27164				}
27165			}
27166		}));
27167	}
27168}
27169
27170//work with hash start
27171var lastHash = location.hash;
27172if ("onhashchange" in window) {
27173	$(window).bind('hashchange', function () {
27174		var newHash = location.hash;
27175		if (newHash == '#delayed') {
27176			if ($('#basket_toolbar_button_delayed').length)
27177				$('#basket_toolbar_button_delayed').trigger('click');
27178		}
27179		else {
27180			if ($('#basket_toolbar_button').length)
27181				$('#basket_toolbar_button').trigger('click');
27182		}
27183		// Do something
27184		var diff = compareHash(newHash, lastHash);
27185		// alert("Difference between old and new hash:\n"+diff[0]+"\n\n"+diff[1]);
27186
27187		//At the end of the func:
27188		lastHash = newHash;
27189	});
27190
27191	function compareHash(current, previous) {
27192		for (var i = 0, len = Math.min(current.length, previous.length); i < len; i++) {
27193			if (current.charAt(0) != previous.charAt(0)) break;
27194		}
27195		current = current.substr(i);
27196		previous = previous.substr(i);
27197		for (var i = 0, len = Math.min(current.length, previous.length); i < len; i++) {
27198			if (current.substr(-1) != previous.substr(-1)) break;
27199		}
27200
27201		//Array: Current = New hash, previous = old hash
27202		return [current, previous];
27203	}
27204}
27205$(document).on('click', "#basket_toolbar_button", function () {
27206	if (lastHash)
27207		location.hash = 'cart';
27208})
27209$(document).on('click', "#basket_toolbar_button_delayed", function () {
27210	if (lastHash)
27211		location.hash = 'delayed';
27212})
27213//work with hash end
27214
27215$(document).on('click', "#basket_line .basket_fly .opener > div.clicked", function () {
27216	if (arAsproOptions['PAGES']['BASKET_PAGE'])
27217		return;
27218	function onOpenFlyBasket(_this) {
27219		$("#basket_line .basket_fly .tabs li").removeClass("cur");
27220		$("#basket_line .basket_fly .tabs_content li").removeClass("cur");
27221		// $("#basket_line .basket_fly .remove_all_basket").removeClass("cur");
27222		if (!$(_this).is(".wish_count.empty")) {
27223			$("#basket_line .basket_fly .tabs_content li[item-section=" + $(_this).data("type") + "]").addClass("cur");
27224			$("#basket_line .basket_fly .tabs li:eq(" + $(_this).index() + ")").addClass("cur");
27225			// $("#basket_line .basket_fly .remove_all_basket."+$(_this).data("type")).addClass("cur");
27226		}
27227		else {
27228			$("#basket_line .basket_fly .tabs li").first().addClass("cur").siblings().removeClass("cur");
27229			$("#basket_line .basket_fly .tabs_content li").first().addClass("cur").siblings().removeClass("cur");
27230			// $("#basket_line .basket_fly .remove_all_basket").first().addClass("cur");
27231		}
27232		$("#basket_line .basket_fly .opener > div.clicked").removeClass('small');
27233
27234		$("#basket_line .basket_fly .opener > div").siblings().removeClass('cur');
27235		$("#basket_line .basket_fly .opener > div:eq(" + $(_this).index() + ")").addClass('cur');
27236
27237	}
27238
27239	if (window.matchMedia('(min-width: 769px)').matches) {
27240		var _this = this;
27241
27242		$(_this).siblings().removeClass('cur');
27243		$(_this).addClass('cur');
27244
27245		if (parseInt($("#basket_line .basket_fly").css("right")) < 0) {
27246			$("#basket_line .basket_fly").stop().addClass('loading').animate({ "right": "0" }, 333, function () {
27247				if ($(_this).closest('.basket_fly.loaded').length) {
27248					onOpenFlyBasket(_this);
27249				}
27250				else {
27251					$.ajax({
27252						url: arAsproOptions['SITE_DIR'] + 'ajax/basket_fly.php',
27253						type: 'post',
27254						success: function (html) {
27255							$('#basket_line .basket_fly').removeClass('loading').addClass('loaded').html(html);
27256							onOpenFlyBasket(_this);
27257						}
27258					});
27259				}
27260			});
27261			$('#basket_line .basket_fly').addClass('swiped');
27262		}
27263		else if ($(this).is(".wish_count:not(.empty)") && !$("#basket_line .basket_fly .basket_sort ul.tabs li.cur").is("[item-section=DelDelCanBuy]")) {
27264			$("#basket_line .basket_fly .tabs li").removeClass("cur");
27265			$("#basket_line .basket_fly .tabs_content li").removeClass("cur");
27266			// $("#basket_line .basket_fly .remove_all_basket").removeClass("cur");
27267			$("#basket_line .basket_fly .tabs_content li[item-section=" + $(this).data("type") + "]").addClass("cur");
27268			$("#basket_line  .basket_fly .tabs li:eq(" + $(this).index() + ")").first().addClass("cur");
27269			// $("#basket_line .basket_fly .remove_all_basket."+$(this).data("type")).first().addClass("cur");
27270		}
27271		else if ($(this).is(".basket_count") && $("#basket_line .basket_fly .basket_sort ul.tabs li.cur").length && !$("#basket_line .basket_fly .basket_sort ul.tabs li.cur").is("[item-section=AnDelCanBuy]")) {
27272			$("#basket_line .basket_fly .tabs li").removeClass("cur");
27273			$("#basket_line .basket_fly .tabs_content li").removeClass("cur");
27274			// $("#basket_line .basket_fly .remove_all_basket").removeClass("cur");
27275			$("#basket_line  .basket_fly .tabs_content li:eq(" + $(this).index() + ")").addClass("cur");
27276			$("#basket_line  .basket_fly .tabs li:eq(" + $(this).index() + ")").first().addClass("cur");
27277			// $("#basket_line .basket_fly .remove_all_basket."+$(this).data("type")).first().addClass("cur");
27278		}
27279		else {
27280			$("#basket_line .basket_fly").stop().animate({ "right": -$("#basket_line .basket_fly").outerWidth() }, 150);
27281			$("#basket_line .basket_fly .opener > div.clicked").addClass('small');
27282			$('#basket_line .basket_fly').removeClass('swiped');
27283			$("#basket_line .basket_fly .opener > div").removeClass("cur");
27284		}
27285	}
27286});
27287
27288if (!funcDefined("clearViewedProduct")) {
27289	function clearViewedProduct() {
27290		try {
27291			var siteID = arAsproOptions.SITE_ID;
27292			var localKey = 'MAX_VIEWED_ITEMS_' + siteID;
27293			var cookieParams = { path: '/', expires: 30 };
27294			if (typeof BX.localStorage !== 'undefined') {
27295				// remove local storage
27296				BX.localStorage.set(localKey, {}, 0);
27297			}
27298			// remove cookie
27299			$.removeCookie(localKey, cookieParams);
27300		}
27301		catch (e) {
27302			console.error(e);
27303		}
27304	}
27305}
27306
27307if (!funcDefined("setViewedProduct")) {
27308	function setViewedProduct(id, arData) {
27309		try {
27310
27311			// save $.cookie option
27312			var bCookieJson = $.cookie.json;
27313			$.cookie.json = true;
27314
27315			var siteID = arAsproOptions.SITE_ID;
27316			var localKey = 'MAX_VIEWED_ITEMS_' + siteID;
27317			var cookieParams = { path: '/', expires: 30 };
27318
27319			if ((typeof BX.localStorage !== 'undefined') && (typeof id !== 'undefined') && (typeof arData !== 'undefined')) {
27320				var PRODUCT_ID = (typeof arData.PRODUCT_ID !== 'undefined') ? arData.PRODUCT_ID : id;
27321				var arViewedLocal = BX.localStorage.get(localKey) ? BX.localStorage.get(localKey) : {};
27322				var arViewedCookie = $.cookie(localKey) ? $.cookie(localKey) : {};
27323				var count = 0;
27324
27325				// delete some items (sync cookie & local storage)
27326				for (var _id in arViewedLocal) {
27327					arViewedLocal[_id].IS_LAST = false;
27328					if (typeof arViewedCookie[_id] === 'undefined') {
27329						delete arViewedLocal[_id];
27330					}
27331				}
27332				for (var _id in arViewedCookie) {
27333					if (typeof arViewedLocal[_id] === 'undefined') {
27334						delete arViewedCookie[_id];
27335					}
27336				}
27337
27338				for (var _id in arViewedCookie) {
27339					count++;
27340				}
27341
27342				// delete item if other item (offer) of that PRODUCT_ID is exists
27343				if (typeof arViewedLocal[PRODUCT_ID] !== 'undefined') {
27344					if (arViewedLocal[PRODUCT_ID].ID != id) {
27345						delete arViewedLocal[PRODUCT_ID];
27346						delete arViewedCookie[PRODUCT_ID];
27347					}
27348				}
27349
27350				delete arViewedLocal[2243];
27351				delete arViewedCookie[2243];
27352
27353				var time = new Date().getTime();
27354				arData.ID = id;
27355				arData.ACTIVE_FROM = time;
27356				arData.IS_LAST = true;
27357				arViewedLocal[PRODUCT_ID] = arData;
27358				arViewedCookie[PRODUCT_ID] = [time.toString(), arData.PICTURE_ID];
27359
27360				$.cookie(localKey, arViewedCookie, cookieParams);
27361				BX.localStorage.set(localKey, arViewedLocal, 2592000);  // 30 days
27362			}
27363		}
27364		catch (e) {
27365			console.error(e);
27366		}
27367		finally {
27368			// restore $.cookie option
27369			$.cookie.json = bCookieJson;
27370		}
27371	}
27372}
27373
27374
27375
27376if (!funcDefined('initSelects')) {
27377	function initSelects(target) {
27378		var iOS = (navigator.userAgent.match(/(iPad|iPhone|iPod)/g) ? true : false);
27379		if (iOS) return;
27380		if ($("#bx-soa-order").length)
27381			return;
27382		// SELECT STYLING
27383		$(target).find('.wrapper1 select:visible').ikSelect({
27384			syntax: '<div class="ik_select_link"> \
27385						<span class="ik_select_link_text"></span> \
27386						<div class="trigger"></div> \
27387					</div> \
27388					<div class="ik_select_dropdown"> \
27389						<div class="ik_select_list"> \
27390						</div> \
27391					</div>',
27392			dynamicWidth: true,
27393			ddMaxHeight: 112,
27394			customClass: 'common_select',
27395			//equalWidths: true,
27396			onShow: function (inst) {
27397				inst.$dropdown.css('top', (parseFloat(inst.$dropdown.css('top')) - 5) + 'px');
27398				if (inst.$dropdown.outerWidth() < inst.$link.outerWidth()) {
27399					inst.$dropdown.css('width', inst.$link.outerWidth());
27400				}
27401				if (inst.$dropdown.outerWidth() > inst.$link.outerWidth()) {
27402					inst.$dropdown.css('width', inst.$link.outerWidth());
27403				}
27404				var count = 0,
27405					client_height = 0;
27406				inst.$dropdown.css('left', inst.$link.offset().left);
27407				$(inst.$listInnerUl).find('li').each(function () {
27408					if (!$(this).hasClass('ik_select_option_disabled')) {
27409						++count;
27410						client_height += $(this).outerHeight();
27411					}
27412				})
27413				if (client_height < 112) {
27414					inst.$listInner.css('height', 'auto');
27415				} else {
27416					inst.$listInner.css('height', '112px');
27417				}
27418				inst.$link.addClass('opened');
27419				inst.$listInner.addClass('scroller');
27420				if ($('.confirm_region').length)
27421					$('.confirm_region').remove();
27422			},
27423			onHide: function (inst) {
27424				inst.$link.removeClass('opened');
27425			}
27426		});
27427		// END OF SELECT STYLING
27428
27429		var timeout;
27430		$(window).on('resize', function () {
27431			ignoreResize.push(true);
27432			clearTimeout(timeout);
27433			timeout = setTimeout(function () {
27434				//$('select:visible').ikSelect('redraw');
27435				var inst = '';
27436				if (inst = $('.common_select-link.opened + select').ikSelect().data('plugin_ikSelect')) {
27437					inst.$dropdown.css('left', inst.$link.offset().left + 'px');
27438				}
27439			}, 20);
27440			ignoreResize.pop();
27441		});
27442	}
27443}
27444
27445if (!funcDefined('CheckTopMenuFullCatalogSubmenu')) {
27446	CheckTopMenuFullCatalogSubmenu = function () {
27447		if (arAsproOptions['THEME']['MENU_TYPE_VIEW'] != 'HOVER')
27448			return;
27449
27450		var $menu = $('.left_block .menu_top_block');
27451		if ($menu.length) {
27452			var $wrapmenu = $menu.parents('.wrap_menu');
27453
27454			var wrapMenuWidth = $menu.closest('.wrapper_inner').actual('width');
27455			if (!wrapMenuWidth)
27456				wrapMenuWidth = $menu.closest('.wraps').actual('width');
27457
27458			var bCatalogFirst = $menu.hasClass('catalogfirst');
27459			var findMenuLi = $('.left_block .menu_top_block:visible li.full');
27460			var parentSubmenuWidth = $menu.actual('outerWidth');
27461			var wrapMenuLeft = 0;
27462			var wrapMenuRight = 0;
27463
27464			if ($wrapmenu.length) {
27465				wrapMenuWidth = $wrapmenu.actual('outerWidth');
27466				wrapMenuLeft = $wrapmenu.offset().left;
27467				wrapMenuRight = wrapMenuLeft + wrapMenuWidth;
27468			}
27469
27470			if ($('.left_block .catalog_block.menu_top_block').length) {
27471				if ($('.left_block .catalog_block.menu_top_block').is(':visible'))
27472					findMenuLi = $('.left_block .menu_top_block.catalog_block li.full');
27473			}
27474			findMenuLi.each(function () {
27475				var $this = $(this);
27476				var $submenu = $this.find('>.dropdown');
27477
27478				if ($submenu.length) {
27479					// $submenu.css({left: parentSubmenuWidth + 'px', width: (wrapMenuWidth - parentSubmenuWidth) + 'px', 'padding-left': '0px', 'padding-right': '0px', 'opacity': 1});
27480					$submenu.css({ width: (wrapMenuWidth - parentSubmenuWidth) + 'px' });
27481
27482					if (!isOnceInited && arAsproOptions["THEME"]["MENU_POSITION"] == "TOP") {
27483						$this.on('mouseenter', function () {
27484							$submenu.css('min-height', $this.closest('.dropdown').actual('outerHeight') + 'px');
27485						});
27486					}
27487				}
27488			});
27489		}
27490	}
27491}
27492
27493$.fn.getMaxHeights = function (outer, classNull, minHeight) {
27494	var maxHeight = this.map(function (i, e) {
27495		var calc_height = 0;
27496		$(e).css('height', '');
27497
27498		if (outer == true)
27499			calc_height = $(e).actual('outerHeight');
27500		else
27501			calc_height = $(e).actual('height');
27502
27503		return calc_height;
27504	}).get();
27505	for (var i = 0, c = maxHeight.length; i < c; ++i) {
27506		if (maxHeight[i] % 2)
27507			--maxHeight[i];
27508	}
27509	return Math.max.apply(this, maxHeight);
27510}
27511
27512$.fn.equalizeHeights = function (outer, classNull, options) {
27513	var maxHeight = [];
27514	for (var i = 0, itemKey = 0; i < this.length; itemKey++) {
27515
27516		var item = this[itemKey],
27517			_item = $(item),
27518			minus_height = 0,
27519			calc_height = 0;
27520
27521		i++;
27522
27523		if (options.blockNull !== undefined) {
27524			if (options.blockNull.class !== undefined) {
27525				if (_item.hasClass(options.blockNull.class) || _item.closest('.' + options.blockNull.class).length) {
27526					var counts = options.blockNull.width === undefined ? 1 : options.blockNull.width - 1;
27527					i += counts;
27528					continue;
27529				}
27530			}
27531		}
27532
27533		if (classNull !== false) {
27534			if (!isMobile) {
27535				var nulled = _item.find(classNull);
27536				if (nulled.length) {
27537					minus_height = parseInt(nulled[0].offsetHeight);
27538					//minus_height=parseInt(_item.find(classNull).outerHeight(false));
27539					//minus_height=parseInt(_item.find(classNull).actual('outerHeight'));
27540				}
27541			}
27542		}
27543
27544		if (minus_height)
27545			minus_height += 12;
27546
27547		_item.css('height', '');
27548
27549		calc_height = item.offsetHeight - minus_height;
27550
27551		if (options.minHeight !== false) {
27552			if (calc_height < options.minHeight)
27553				calc_height += (options.minHeight - calc_height);
27554
27555			if (window.matchMedia('(max-width: 520px)').matches)
27556				calc_height = 300;
27557
27558			if (window.matchMedia('(max-width: 400px)').matches)
27559				calc_height = 200;
27560
27561		}
27562
27563		if (!calc_height)
27564			calc_height = 0;
27565
27566		maxHeight.push(calc_height);
27567	}
27568
27569
27570	for (var i = 0, c = maxHeight.length; i < c; ++i) {
27571		if (maxHeight[i] % 2) {
27572			--maxHeight[i];
27573		}
27574	}
27575	var result = this.height(Math.max.apply(this, maxHeight));
27576
27577	return result;
27578}
27579
27580$.fn.getFloatWidth = function () {
27581	var width = 0;
27582	if ($(this).length) {
27583		var rect = $(this)[0].getBoundingClientRect();
27584		if (!(width = rect.width))
27585			width = rect.right - rect.left;
27586	}
27587
27588	$(this).data('floatWidth', width);
27589
27590	return width;
27591}
27592
27593function extendDepthObject(target, FromObj) {
27594	var to = Object.assign({}, target);
27595	for (var key in FromObj) {
27596		if (typeof (FromObj[key]) == 'object') {
27597			to[key] = extendDepthObject(to[key], FromObj[key]);
27598		} else {
27599			to[key] = FromObj[key];
27600		}
27601	}
27602
27603	return to;
27604}
27605
27606$.fn.sliceHeight = function (options) {
27607	function _slice(el) {
27608		var arBreakpoints = Object.keys(options.breakpoint);
27609		var resizeOptionsTmp = {};
27610		if (arBreakpoints.length) {
27611			for (var key in arBreakpoints) {
27612				if (window.matchMedia(arBreakpoints[key].toString()).matches) {
27613					resizeOptionsTmp = options.breakpoint[arBreakpoints[key]];
27614				}
27615			}
27616		}
27617
27618		var resizeOptions = extendDepthObject(options, resizeOptionsTmp);
27619
27620		var blockNullClass = resizeOptions.blockNull !== undefined && resizeOptions.blockNull.class !== undefined ? resizeOptions.blockNull.class : false;
27621		var parent = (typeof (resizeOptions.row) !== 'undefined' && resizeOptions.row.length) ? el.first().parents(resizeOptions.row) : el.first().parents('.items');
27622		var item = '';
27623
27624		if (typeof (resizeOptions.item) !== 'undefined' && resizeOptions.item.length) {
27625			if (blockNullClass) {
27626				$(resizeOptions.item).each(function (i, element) {
27627					_element = $(element);
27628					if (!_element.hasClass(blockNullClass)) {
27629						item = _element;
27630					}
27631				});
27632			} else {
27633				item = $(resizeOptions.item).first();
27634			}
27635		} else {
27636			if (el.first().hasClass('item')) {
27637				item = el.first();
27638			} else {
27639				item = el.first().parents('.item');
27640			}
27641		}
27642
27643		if (typeof (resizeOptions.autoslicecount) == 'undefined' || resizeOptions.autoslicecount !== false) {
27644			var elsw = parent.getFloatWidth(),
27645				elw = item.getFloatWidth();
27646			if (!elsw) {
27647				elsw = el.first().parents('.row').getFloatWidth();
27648			}
27649			if (!elw) {
27650				if (typeof (resizeOptions.item) !== 'undefined' && resizeOptions.item.length)
27651					elw = (($(resizeOptions.item + ':eq(1)').getFloatWidth()) ? $(resizeOptions.item + ':eq(1)').getFloatWidth() : $(resizeOptions.item + ':eq(2)').getFloatWidth());
27652				else
27653					elw = (($(el[1]).getFloatWidth()) ? $(el[1]).getFloatWidth() : $(el[2]).getFloatWidth());
27654			}
27655			if (elw && resizeOptions.fixWidth)
27656				elw -= resizeOptions.fixWidth;
27657
27658			elw = (parseInt(elw * 100)) / 100;
27659
27660			if (elsw && elw) {
27661				resizeOptions.slice = Math.floor(elsw / elw);
27662			}
27663		}
27664
27665		if (resizeOptions.customSlice) //manual slice count
27666		{
27667			var bSliceNext = false;
27668			if (resizeOptions.length) {
27669				elw = (typeof (resizeOptions.item) !== 'undefined' && resizeOptions.item.length) ? $(resizeOptions.item).last().getFloatWidth() : (el.last().hasClass('item') ? el.last().getFloatWidth() : el.last().parents('.item').getFloatWidth());
27670				if (elw)
27671					resizeOptions.sliceNext = Math.floor(elsw / elw);
27672
27673				bSliceNext = true;
27674			}
27675		}
27676
27677		elements = [];
27678		if (resizeOptions.classes !== undefined && resizeOptions.classes.length) {
27679			for (var i = 0; i < resizeOptions.classes.length; i++) {
27680				var items = $(resizeOptions.item).find(resizeOptions.classes[i]);
27681				elements.push(items);
27682			}
27683		}
27684		var elIndex = elements.push(el) - 1;
27685
27686		if (resizeOptions.mobile == true) {
27687			if (window.matchMedia('(max-width: 500px)').matches) {
27688				for (var block = 0; block < elements.length; block++) {
27689					var items = $(elements[block]);
27690					items.css({
27691						'line-height': '',
27692						'height': '',
27693					});
27694				}
27695				return;
27696			}
27697		}
27698
27699		if (typeof (resizeOptions.typeResize) == 'undefined' || resizeOptions.typeResize == false) {
27700			if (resizeOptions.slice) {
27701				for (var block = 0; block < elements.length; block++) {
27702					if (resizeOptions.currentRow) {
27703						var itemNumber = el.index(resizeOptions.currentItem);
27704						var rowCount = resizeOptions.slice;
27705						var rowNumber = Math.floor(itemNumber / rowCount);
27706
27707						var items = $(elements[block].slice(rowNumber * rowCount, rowNumber * rowCount + rowCount));
27708						var classNull = block == elIndex ? resizeOptions.classNull : false;
27709						items.css({
27710							'line-height': '',
27711							'height': '',
27712						});
27713						items.equalizeHeights(resizeOptions.outer, classNull, resizeOptions);
27714					} else {
27715						for (var i = 0; i < elements[block].length; i += resizeOptions.slice) {
27716							if (resizeOptions.customSlice && resizeOptions.sliceNext && bSliceNext && i) //manual slice count
27717								resizeOptions.slice = resizeOptions.sliceNext;
27718							var items = $(elements[block].slice(i, i + resizeOptions.slice));
27719							var classNull = block == elIndex ? resizeOptions.classNull : false;
27720
27721							if (resizeOptions.blockNull !== undefined) {
27722								if (resizeOptions.blockNull.class !== undefined) {
27723									var counts = 0;
27724									items.each(function (i, item) {
27725										var _item = $(item);
27726										if (_item.hasClass(resizeOptions.blockNull.class) || _item.closest('.' + resizeOptions.blockNull.class).length) {
27727											counts++;
27728										}
27729									});
27730								}
27731							}
27732							items.css({
27733								'line-height': '',
27734								'height': '',
27735							});
27736							items.equalizeHeights(resizeOptions.outer, classNull, resizeOptions);
27737
27738
27739							if (counts) {
27740								i -= resizeOptions.blockNull.width * counts - 1;
27741							}
27742						}
27743					}
27744
27745				}
27746			}
27747			if (resizeOptions.lineheight) {
27748				var lineheightAdd = parseInt(resizeOptions.lineheight);
27749				if (isNaN(lineheightAdd)) {
27750					lineheightAdd = 0;
27751				}
27752				el.each(function () {
27753					$(this).css('line-height', ($(this).actual('height') + lineheightAdd) + 'px');
27754				});
27755			}
27756		}
27757	}
27758	var options = $.extend({
27759		slice: null,
27760		sliceNext: null,
27761		outer: false,
27762		lineheight: false,
27763		autoslicecount: true,
27764		classNull: false,
27765		minHeight: false,
27766		row: false,
27767		item: false,
27768		typeResize: false,
27769		typeValue: false,
27770		fixWidth: 0,
27771		resize: true,
27772		mobile: false,
27773		customSlice: false,
27774		breakpoint: {},
27775		classes: [],
27776	}, options);
27777
27778	var el = $(this);
27779
27780	ignoreResize.push(true);
27781	_slice(el);
27782	ignoreResize.pop();
27783
27784	if (options.resize) {
27785		BX.addCustomEvent('onWindowResize', function (eventdata) {
27786			try {
27787				ignoreResize.push(true);
27788				_slice(el);
27789			}
27790			catch (e) { }
27791			finally {
27792				ignoreResize.pop();
27793			}
27794		});
27795	}
27796	else {
27797		if (!ignoreResize.length) {
27798			// ignoreResize.push(true);
27799			_slice(el);
27800			// ignoreResize.pop();
27801		}
27802	}
27803}
27804
27805$.fn.sliceHeightNoResize = function (options) {
27806	function _slice(el) {
27807		el.each(function () {
27808			$(this).css('line-height', '');
27809			$(this).css('height', '');
27810		});
27811		if (options.mobile == true) {
27812			if (window.matchMedia('(max-width: 550px)').matches)
27813				return;
27814		}
27815		if (typeof (options.autoslicecount) == 'undefined' || options.autoslicecount !== false) {
27816			var elsw = (typeof (options.row) !== 'undefined' && options.row.length) ? el.first().parents(options.row).getFloatWidth() : el.first().parents('.items').getFloatWidth(),
27817				elw = (typeof (options.item) !== 'undefined' && options.item.length) ? $(options.item).first().getFloatWidth() : (el.first().hasClass('item') ? el.first().getFloatWidth() : el.first().parents('.item').getFloatWidth());
27818
27819			if (!elsw) {
27820				elsw = el.first().parents('.row').getFloatWidth();
27821			}
27822			if (elw && options.fixWidth)
27823				elw -= options.fixWidth;
27824
27825			if (elsw && elw) {
27826				options.slice = Math.floor(elsw / elw);
27827			}
27828		}
27829		if (options.customSlice) //manual slice count
27830		{
27831			var arBreakpoints = Object.keys(options.breakpoint),
27832				bSliceNext = false;
27833			if (arBreakpoints.length) {
27834				elw = (typeof (options.item) !== 'undefined' && options.item.length) ? $(options.item).last().getFloatWidth() : (el.last().hasClass('item') ? el.last().getFloatWidth() : el.last().parents('.item').getFloatWidth());
27835				if (elw)
27836					options.sliceNext = Math.floor(elsw / elw);
27837				for (var key in arBreakpoints) {
27838					if (window.matchMedia(arBreakpoints[key].toString()).matches) {
27839						bSliceNext = true;
27840						options.slice = options.breakpoint[arBreakpoints[key]];
27841					}
27842				}
27843			}
27844		}
27845		if (typeof (options.typeResize) == 'undefined' || options.typeResize == false) {
27846			if (options.slice) {
27847				for (var i = 0; i < el.length; i += options.slice) {
27848					if (options.customSlice && options.sliceNext && bSliceNext && i) //manual slice count
27849						options.slice = options.sliceNext;
27850					$(el.slice(i, i + options.slice)).equalizeHeights(options.outer, options.classNull, options.minHeight, options.typeResize, options.typeValue);
27851				}
27852			}
27853			if (options.lineheight) {
27854				var lineheightAdd = parseInt(options.lineheight);
27855				if (isNaN(lineheightAdd)) {
27856					lineheightAdd = 0;
27857				}
27858				el.each(function () {
27859					$(this).css('line-height', ($(this).actual('height') + lineheightAdd) + 'px');
27860				});
27861			}
27862		}
27863	}
27864	var options = $.extend({
27865		slice: null,
27866		sliceNext: null,
27867		outer: false,
27868		lineheight: false,
27869		autoslicecount: true,
27870		classNull: false,
27871		minHeight: false,
27872		row: false,
27873		item: false,
27874		typeResize: false,
27875		typeValue: false,
27876		fixWidth: 0,
27877		resize: true,
27878		mobile: false,
27879		customSlice: false,
27880		breakpoint: {},
27881	}, options);
27882
27883	var el = $(this);
27884
27885	ignoreResize.push(true);
27886	_slice(el);
27887	ignoreResize.pop();
27888}
27889
27890if (!funcDefined('initHoverBlock')) {
27891	function initHoverBlock(target) {
27892		/*$(target).find('.catalog_item.item_wrap').on('mouseenter', function(){
27893			$(this).addClass('hover');
27894		})
27895		$(target).find('.catalog_item.item_wrap').on('mouseleave', function(){
27896			$(this).removeClass('hover');
27897		})*/
27898	}
27899}
27900if (!funcDefined('setStatusButton')) {
27901	function setStatusButton() {
27902		if (!funcDefined('setItemButtonStatus')) {
27903			setItemButtonStatus = function (data) {
27904				if (data.BASKET) {
27905					for (var i in data.BASKET) {
27906						var id = data.BASKET[i];
27907						if (typeof id === 'number' || typeof id === 'string') {
27908							$('.to-cart[data-item=' + id + ']').hide();
27909							$('.counter_block[data-item=' + id + ']').closest('.counter_block_inner').hide();
27910							$('.counter_block[data-item=' + id + ']').hide();
27911							$('.in-cart[data-item=' + id + ']').show();
27912							$('.in-cart[data-item=' + id + ']').closest('.button_block').addClass('wide');
27913						}
27914					}
27915				}
27916				if (data.DELAY) {
27917					for (var i in data.DELAY) {
27918						var id = data.DELAY[i];
27919						if (typeof id === 'number' || typeof id === 'string') {
27920							$('.wish_item.to[data-item=' + id + ']').hide();
27921							$('.wish_item.in[data-item=' + id + ']').show();
27922							if ($('.wish_item[data-item=' + id + ']').find(".value.added").length) {
27923								//$('.wish_item[data-item='+id+']').addClass("added");
27924								$('.wish_item[data-item=' + id + ']').find(".value").hide();
27925								$('.wish_item[data-item=' + id + ']').find(".value.added").show();
27926							}
27927						}
27928					}
27929				}
27930				if (data.SUBSCRIBE) {
27931					for (var i in data.SUBSCRIBE) {
27932						var id = data.SUBSCRIBE[i];
27933						if (typeof id === 'number' || typeof id === 'string') {
27934							$('.to-subscribe[data-item=' + id + ']').hide();
27935							$('.in-subscribe[data-item=' + id + ']').show();
27936						}
27937					}
27938				}
27939				if (data.COMPARE) {
27940					for (var i in data.COMPARE) {
27941						var id = data.COMPARE[i];
27942						if (typeof id === 'number' || typeof id === 'string') {
27943							$('.compare_item.to[data-item=' + id + ']').hide();
27944							$('.compare_item.in[data-item=' + id + ']').show();
27945							if ($('.compare_item[data-item=' + id + ']').find(".value.added").length) {
27946								$('.compare_item[data-item=' + id + ']').find(".value").hide();
27947								$('.compare_item[data-item=' + id + ']').find(".value.added").show();
27948							}
27949						}
27950					}
27951				}
27952			}
27953		}
27954		if (!Object.keys(arStatusBasketAspro).length) {
27955			if (typeof arAsproOptions === 'undefined') {
27956				var arAsproOptions = ({
27957					"SITE_DIR": '/'
27958				});
27959				if ($('body').data('site') !== undefined)
27960					arAsproOptions["SITE_DIR"] = $('body').data('site');
27961			}
27962			$.ajax({
27963				url: arAsproOptions["SITE_DIR"] + 'ajax/getAjaxBasket.php',
27964				type: 'POST',
27965				success: function (data) {
27966					arStatusBasketAspro = data;
27967					setItemButtonStatus(arStatusBasketAspro);
27968				}
27969			});
27970		}
27971		else
27972			setItemButtonStatus(arStatusBasketAspro);
27973	}
27974}
27975
27976
27977if (!funcDefined('onLoadjqm')) {
27978	var onLoadjqm = function (name, hash, requestData, selector, requestTitle, isButton, thButton) {
27979		if (hash.c.noOverlay === undefined || (hash.c.noOverlay !== undefined && !hash.c.noOverlay)) {
27980			$('body').addClass('jqm-initied');
27981		}
27982		if (window.matchMedia('(min-width: 768px)').matches) {
27983			$("body").addClass("swipeignore");
27984		}
27985
27986		if (typeof $(hash.t).data('ls') !== ' undefined' && $(hash.t).data('ls')) {
27987			var ls = $(hash.t).data('ls'),
27988				ls_timeout = 0,
27989				v = '';
27990
27991			if ($(hash.t).data('ls_timeout'))
27992				ls_timeout = $(hash.t).data('ls_timeout');
27993
27994			ls_timeout = ls_timeout ? Date.now() + (ls_timeout * 1000) : '';
27995
27996			if (typeof localStorage !== 'undefined') {
27997				var val = localStorage.getItem(ls);
27998				try {
27999					v = JSON.parse(val);
28000				}
28001				catch (e) {
28002					v = val
28003				}
28004				if (v != null) {
28005					localStorage.removeItem(ls);
28006				}
28007				v = {};
28008				v['VALUE'] = 'Y';
28009				v['TIMESTAMP'] = ls_timeout; // default: seconds for 1 day
28010
28011				localStorage.setItem(ls, JSON.stringify(v));
28012			}
28013			else {
28014				var val = $.cookie(ls);
28015				if (!val)
28016					$.cookie(ls, "Y", { expires: ls_timeout });// default: seconds for 1 day
28017			}
28018
28019			var dopClasses = hash.w.find('.marketing-popup').data('classes');
28020			if (dopClasses) {
28021				hash.w.addClass(dopClasses);
28022			}
28023		}
28024
28025		$.each($(hash.t).get(0).attributes, function (index, attr) {
28026			if (/^data\-autoload\-(.+)$/.test(attr.nodeName)) {
28027				var key = attr.nodeName.match(/^data\-autoload\-(.+)$/)[1];
28028				var el = $('input[data-sid="' + key.toUpperCase() + '"]');
28029				// el.val( $(hash.t).data('autoload-'+key) ).attr('readonly', 'readonly');
28030				el.val(BX.util.htmlspecialcharsback($(hash.t).data('autoload-' + key))).attr('readonly', 'readonly');
28031				el.closest('.form-group').addClass('input-filed');
28032				el.attr('title', el.val());
28033			}
28034		});
28035
28036		//show gift block
28037		if (hash.w.hasClass('send_gift_frame')) {
28038			var imgHtml = priceHtml = propsHtml = '';
28039			if ($('.offers_img a').length)
28040				imgHtml = $('.offers_img a').html();
28041			else if ($('.product-detail-gallery__container').length)
28042				imgHtml = '<img src=' + $('.product-detail-gallery__container link[itemprop="image"]').attr('href') + ' />';
28043
28044			if ($('.product-container *[itemprop="offers"]').length) //show price
28045			{
28046				if ($('.sku-view').length) {
28047					if ($('.prices_block .price').length)
28048						priceHtml = $('.prices_block .cost.prices').html().replace('id', 'data-id');
28049				}
28050				else {
28051					if ($('.prices_block .with_matrix').length)
28052						priceHtml = '<div class="with_matrix">' + $('.prices_block .with_matrix').html() + '</div>';
28053					else if ($('.prices_block .price_group.min').length)
28054						priceHtml = $('.prices_block .price_group.min').html();
28055					else if ($('.prices_block .price_matrix_wrapper').length)
28056						priceHtml = $('.prices_block .price_matrix_wrapper').html();
28057				}
28058			}
28059
28060			if ($('.buy_block .sku_props').length) {
28061				propsHtml = '<div class="props_item">';
28062				$('.buy_block .sku_props .bx_catalog_item_scu > div').each(function () {
28063					var title = $(this).find('.bx_item_section_name > span').html(),
28064						props = ($(this).find('.ik_select_link_text').length ? $(this).find('.ik_select_link_text').text() : $(this).find('ul li.active > span').text());
28065					// props = ($(this).find('ul li').length ? $(this).find('ul li.active > span').text() : $(this).find('.ik_select_link_text').text());
28066
28067					propsHtml += '<div class="prop_item">' +
28068						'<span>' +
28069						title + (title.indexOf(':') > 0 ? '' : ': ') +
28070						(title.indexOf(':') > 0 ? '' : '<span class="val">' + props + '</span>') +
28071						'</span>' +
28072						'</div>';
28073
28074				})
28075				propsHtml += '</div>';
28076			}
28077			$('<div class="custom_block">' +
28078				'<div class="title">' + BX.message('POPUP_GIFT_TEXT') + '</div>' +
28079				'<div class="item_block">' +
28080				'<table class="item_list"><tr>' +
28081				'<td class="image">' +
28082				'<div>' + imgHtml + '</div>' +
28083				'</td>' +
28084				'<td class="text">' +
28085				'<div class="name">' + $('h1').text() + '</div>' +
28086				priceHtml +
28087				propsHtml +
28088				'</td>' +
28089				'</tr></table>' +
28090				'</div>' +
28091				'</div>').prependTo(hash.w.find('.form_body'))
28092		}
28093
28094		if (arAsproOptions['THEME']['REGIONALITY_SEARCH_ROW'] == 'Y' && (hash.w.hasClass('city_chooser_frame ') || hash.w.hasClass('city_chooser_small_frame')))
28095			hash.w.addClass('small_popup_regions');
28096
28097		if (hash.w.hasClass('city_chooser_frame ') || hash.w.hasClass('city_chooser_small_frame ')) {
28098			$('.popup_regions .items .items_block').mCustomScrollbar({
28099				mouseWheel: {
28100					scrollAmount: 150,
28101					preventDefault: true
28102				}
28103			});
28104		}
28105
28106
28107		if (name == 'fast_view' && $('.smart-filter-filter').length) {
28108			var navButtons = '<div class="navigation-wrapper-fast-view">' +
28109				'<div class="fast-view-nav prev colored_theme_hover_bg" data-fast-nav="prev">' +
28110				'<i class="svg left">' +
28111				'<svg xmlns="http://www.w3.org/2000/svg" width="12" height="6.969" viewBox="0 0 12 6.969"><path id="Rounded_Rectangle_702_copy_24" data-name="Rounded Rectangle 702 copy 24" class="cls-1" d="M361.691,401.707a1,1,0,0,1-1.414,0L356,397.416l-4.306,4.291a1,1,0,0,1-1.414,0,0.99
281111,0.991,0,0,1,0-1.406l5.016-5a1.006,1.006,0,0,1,1.415,0l4.984,5A0.989,0.989,0,0,1,361.691,401.707Z" transform="translate(-350 -395.031)"/></svg>' +
28112				'</i>' +
28113				'</div>' +
28114
28115				'<div class="fast-view-nav next colored_theme_hover_bg" data-fast-nav="next">' +
28116				'<i class="svg right">' +
28117				'<svg xmlns="http://www.w3.org/2000/svg" width="12" height="6.969" viewBox="0 0 12 6.969"><path id="Rounded_Rectangle_702_copy_24" data-name="Rounded Rectangle 702 copy 24" class="cls-1" d="M361.691,401.707a1,1,0,0,1-1.414,0L356,397.416l-4.306,4.291a1,1,0,0,1-1.414,0,0.991,0.991,0,0,1,0-1.406l5.016-5a1.006,1.006,0,0,1,1.415,0l4.984,5A0.989,0.989,0,0,1,361.691,401.707Z" transform="translate(-350 -395.031)"/></svg>' +
28118				'</i>' +
28119				'</div>' +
28120				'</div>';
28121
28122			hash.w.closest('#popup_iframe_wrapper').append(navButtons);
28123		}
28124
28125		hash.w.addClass('show').css({
28126			// 'top': (($(window).height() > hash.w.height()) ? Math.floor(($(window).height() - hash.w.height()) / 2) : 0) + 'px',
28127			// 'margin-left': ($(window).width() > hash.w.outerWidth() ? '-' + hash.w.outerWidth() / 2 + 'px' : '-' + $(window).width() / 2 + 'px'),
28128			'opacity': 1
28129		});
28130
28131		hash.w.mCustomScrollbar({
28132			mouseWheel: {
28133				scrollAmount: 150,
28134				preventDefault: true
28135			}
28136		});
28137
28138		if (hash.c.noOverlay === undefined || (hash.c.noOverlay !== undefined && !hash.c.noOverlay)) {
28139			$('body').css({ 'overflow': 'hidden', 'height': '100vh' });
28140			hash.w.closest('#popup_iframe_wrapper').css({ 'z-index': 3000, 'display': 'flex' });
28141		}
28142
28143		var eventdata = { action: 'loadForm' };
28144		BX.onCustomEvent('onCompleteAction', [eventdata, $(hash.t)[0]]);
28145
28146
28147		if (typeof (requestData) == 'undefined') {
28148			requestData = '';
28149		}
28150		if (typeof (selector) == 'undefined') {
28151			selector = false;
28152		}
28153
28154		var width = $('.' + name + '_frame').width();
28155		//$('.'+name+'_frame').css('margin-left', '-'+width/2+'px');
28156
28157		if (name == 'order-popup-call') {
28158		}
28159		else if (name == 'order-button') {
28160			$(".order-button_frame").find("div[product_name]").find("input").val(hash.t.title).attr("readonly", "readonly").css({ "overflow": "hidden", "text-overflow": "ellipsis" });
28161		}
28162		else if (name == 'basket_error') {
28163			$(".basket_error_frame .pop-up-title").text(requestTitle);
28164			$(".basket_error_frame .ajax_text").html(requestData);
28165
28166			if (window.matchMedia('(max-width: 991px)').matches) {
28167				$("body").addClass("all_viewed");
28168			}
28169
28170			initSelects(document);
28171			if (isButton == "Y" && thButton)
28172				$("<div class='popup_button_basket_wr'><span class='popup_button_basket big_btn button' data-item=" + thButton.data("item") + "><span class='btn btn-default'>" + BX.message("ERROR_BASKET_BUTTON") + "</span></span></div>").insertAfter($(".basket_error_frame .ajax_text"));
28173		}
28174
28175		$('.' + name + '_frame').show();
28176	}
28177}
28178
28179$.fn.jqmEx = function () {
28180	// $(this).each(function(){
28181	var _this = $(this);
28182	var noOverlay = _this.data('noOverlay') == 'Y';
28183	var name = _this.data('name');
28184	var sFastViewClass = '';
28185	if (name.length) {
28186		if (_this.closest('#fast_view_item').length) {
28187			sFastViewClass = 'fast_view_popup';
28188		}
28189
28190		var paramsStr = ''; var trigger = ''; var arTriggerAttrs = {};
28191		$.each(_this.get(0).attributes, function (index, attr) {
28192			var attrName = attr.nodeName;
28193			var attrValue = _this.attr(attrName);
28194			trigger += '[' + attrName + '=\"' + attrValue + '\"]';
28195			arTriggerAttrs[attrName] = attrValue;
28196			if (/^data\-param\-(.+)$/.test(attrName)) {
28197				var key = attrName.match(/^data\-param\-(.+)$/)[1];
28198				paramsStr += key + '=' + attrValue + '&';
28199			}
28200		});
28201
28202		var triggerAttrs = JSON.stringify(arTriggerAttrs);
28203		var encTriggerAttrs = encodeURIComponent(triggerAttrs);
28204		var script = arAsproOptions['SITE_DIR'] + 'ajax/form.php';
28205		if (name == 'auth')
28206			script += '?' + paramsStr + 'auth=Y';
28207		else
28208			script += '?' + paramsStr + 'data-trigger=' + encTriggerAttrs;
28209
28210		if (_this.attr('disabled') != 'disabled') {
28211			$('body').find('.' + name + '_frame[data-trigger="' + encTriggerAttrs + '"]').remove();
28212
28213			if (noOverlay) {
28214				$('body').append('<div class="' + name + '_frame ' + sFastViewClass + ' jqmWindow popup" data-trigger="' + encTriggerAttrs + '"></div>');
28215			} else {
28216				$('#popup_iframe_wrapper').append('<div class="' + name + '_frame ' + sFastViewClass + ' jqmWindow popup" data-trigger="' + encTriggerAttrs + '"></div>');
28217			}
28218
28219			//$('body').append('<div class="' + name + '_frame ' + sFastViewClass+' jqmWindow popup" data-trigger="' + encTriggerAttrs + '"></div>');
28220
28221			$('.' + name + '_frame[data-trigger="' + encTriggerAttrs + '"]').jqm({
28222				ajax: script,
28223				trigger: trigger,
28224				noOverlay: noOverlay,
28225				onLoad: function (hash) {
28226					onLoadjqm(name, hash);
28227				},
28228				onHide: function (hash) {
28229					onHidejqm(name, hash);
28230				}
28231			});
28232		}
28233	}
28234	// });
28235}
28236
28237window.addEventListener("keydown", function (e) {
28238	if (e.keyCode == 27) {
28239		$('.jqm-init.show').last().jqmHide();
28240
28241		if ($('.inline-search-block.show').length) {
28242
28243			$('.inline-search-block').toggleClass('show');
28244			$('.jqmOverlay.search').detach();
28245		}
28246
28247		$('.mega_fixed_menu').fadeOut(animationTime);
28248	}
28249});
28250
28251if (!funcDefined('onHidejqm')) {
28252	var onHidejqm = function (name, hash) {
28253		if (hash.w.find('.one_click_buy_result_success').is(':visible') && name == "one_click_buy_basket") {
28254			window.location.href = window.location.href;
28255		}
28256
28257		if ($('.xzoom-source').length)
28258			$('.xzoom-source').remove();
28259		if ($('.xzoom-preview').length)
28260			$('.xzoom-preview').remove();
28261
28262		// hash.w.css('opacity', 0).hide();
28263		hash.w.animate({ 'opacity': 0 }, 200, function () {
28264			hash.w.mCustomScrollbar('destroy');
28265			hash.w.hide();
28266			hash.w.empty();
28267			hash.o.remove();
28268			hash.w.removeClass('show');
28269
28270			$('body').css({ 'overflow': '', 'height': '' });
28271
28272			if (!hash.w.closest('#popup_iframe_wrapper').find('.jqmOverlay').length) {
28273				hash.w.closest('#popup_iframe_wrapper').css({ 'z-index': '', 'display': '' });
28274			}
28275
28276			if (window.matchMedia('(max-width: 991px)').matches) {
28277				$("body").removeClass("all_viewed");
28278			}
28279			if (!$('.jqmOverlay:not(.mobp)').length || $('.jqmOverlay.waiting').length) {
28280				$('body').removeClass('jqm-initied');
28281			}
28282
28283			if (window.matchMedia('(min-width: 768px)').matches) {
28284				$("body").removeClass("swipeignore");
28285			}
28286
28287			if (name == 'fast_view') {
28288				$('.fast_view_popup').remove();
28289
28290				var navButtons = hash.w.closest('#popup_iframe_wrapper').find('.navigation-wrapper-fast-view');
28291				navButtons.remove();
28292			}
28293		});
28294
28295		window.b24form = false;
28296	}
28297}
28298
28299if (!funcDefined("scroll_block")) {
28300	function scroll_block(block, clickedItem) {
28301		if (block.length) {
28302
28303			if (clickedItem !== undefined && clickedItem.length) {
28304				clickedItem.trigger('click');
28305			}
28306			else {
28307				$(".prices_tab").addClass("active").siblings().removeClass("active");
28308				if ($(".prices_tab .opener").length && !$(".prices_tab .opener .opened").length) {
28309					var item = $(".prices_tab .opener").first();
28310					item.find(".opener_icon").addClass("opened");
28311					item.parents("tr").addClass("nb")
28312					item.parents("tr").next(".offer_stores").find(".stores_block_wrap").slideDown(200);
28313				}
28314			}
28315			var topPos = block.offset().top,
28316				headerH = $('header').outerHeight(true, true);
28317
28318			$('html,body').animate({ 'scrollTop': topPos - 88 }, 150);
28319		}
28320	}
28321}
28322
28323if (!funcDefined("jqmEd")) {
28324	var jqmEd = function (name, form_id, open_trigger, requestData, selector, requestTitle, isButton, thButton) {
28325		if (typeof (requestData) == "undefined") {
28326			requestData = '';
28327		}
28328		if (typeof (selector) == "undefined") {
28329			selector = false;
28330		}
28331		$('body #popup_iframe_wrapper').find('.' + name + '_frame').remove();
28332		$('body #popup_iframe_wrapper').append('<div class="' + name + '_frame jqmWindow popup"></div>');
28333		if (typeof open_trigger == "undefined") {
28334			$('.' + name + '_frame').jqm({ trigger: '.' + name + '_frame.popup', onHide: function (hash) { onHidejqm(name, hash); }, onLoad: function (hash) { onLoadjqm(name, hash, requestData, selector); }, ajax: arAsproOptions["SITE_DIR"] + 'ajax/form.php?form_id=' + form_id + (requestData.length ? '&' + requestData : '') });
28335		} else {
28336			if (name == 'enter') {
28337				$('.' + name + '_frame').jqm({ trigger: open_trigger, onHide: function (hash) { onHidejqm(name, hash); }, onLoad: function (hash) { onLoadjqm(name, hash, requestData, selector); }, ajax: arAsproOptions["SITE_DIR"] + 'ajax/auth.php' });
28338			} else if (name == 'basket_error') {
28339				$('.' + name + '_frame').jqm({ trigger: open_trigger, onHide: function (hash) { onHidejqm(name, hash); }, onLoad: function (hash) { onLoadjqm(name, hash, requestData, selector, requestTitle, isButton, thButton); }, ajax: arAsproOptions["SITE_DIR"] + 'ajax/basket_error.php' });
28340
28341			} else {
28342				$('.' + name + '_frame').jqm({ trigger: open_trigger, onHide: function (hash) { onHidejqm(name, hash); }, onLoad: function (hash) { onLoadjqm(name, hash, requestData, selector); }, ajax: arAsproOptions["SITE_DIR"] + 'ajax/form.php?form_id=' + form_id + (requestData.length ? '&' + requestData : '') });
28343			}
28344			$(open_trigger).dblclick(function () { return false; })
28345		}
28346		return true;
28347	}
28348}
28349
28350if (!funcDefined("replaceBasketPopup")) {
28351	function replaceBasketPopup(hash) {
28352		if (typeof hash != "undefined") {
28353			hash.w.hide();
28354			hash.o.hide();
28355		}
28356	}
28357}
28358
28359if (!funcDefined("waitLayer")) {
28360	function waitLayer(delay, callback) {
28361		if ((typeof dataLayer !== 'undefined') && (typeof callback === 'function')) {
28362			callback();
28363		}
28364		else {
28365			setTimeout(function () {
28366				waitLayer(delay, callback);
28367			}, delay);
28368		}
28369	}
28370}
28371
28372if (!funcDefined("InitTopestMenuGummi")) {
28373	InitTopestMenuGummi = function () {
28374		if (!isOnceInited) {
28375			function _init() {
28376				var arItems = $menuTopest.find('>li:not(.more)');
28377				var cntItems = arItems.length;
28378				if (cntItems) {
28379					var itemsWidth = 0;
28380					for (var i = 0; i < cntItems; ++i) {
28381						var item = arItems.eq(i);
28382						var itemWidth = item.actual('outerWidth', { includeMargin: true });
28383						arItemsHideWidth[i] = (itemsWidth += itemWidth) + (i !== (cntItems - 1) ? moreWidth : 0);
28384					}
28385				}
28386			}
28387
28388			function _gummi() {
28389				var rowWidth = $menuTopest.actual('innerWidth');
28390				var arItems = $menuTopest.find('>li:not(.more),li.more>.dropdown>li');
28391				var cntItems = arItems.length;
28392				if (cntItems) {
28393					var bMore = false;
28394					for (var i = cntItems - 1; i >= 0; --i) {
28395						var item = arItems.eq(i);
28396						var bInMore = item.parents('.more').length > 0;
28397						if (!bInMore) {
28398							if (arItemsHideWidth[i] > rowWidth) {
28399								if (!bMore) {
28400									bMore = true;
28401									more.removeClass('hidden');
28402								}
28403								var clone = item.clone();
28404								clone.find('>a').addClass('dark_font');
28405								clone.prependTo(moreDropdown);
28406								item.addClass('cloned');
28407							}
28408						}
28409					}
28410					for (var i = 0; i < cntItems; ++i) {
28411						var item = arItems.eq(i);
28412						var bInMore = item.parents('.more').length > 0;
28413						if (bInMore) {
28414							if (arItemsHideWidth[i] <= rowWidth) {
28415								if (i === (cntItems - 1)) {
28416									bMore = false;
28417									more.addClass('hidden');
28418								}
28419								var clone = item.clone();
28420								clone.find('>a').removeClass('dark_font');
28421								clone.insertBefore(more);
28422								item.addClass('cloned');
28423							}
28424						}
28425					}
28426					$menuTopest.find('li.cloned').remove();
28427				}
28428			}
28429
28430			var $menuTopest = $('.menu.topest');
28431			if ($menuTopest.length) {
28432				var more = $menuTopest.find('>.more');
28433				var moreDropdown = more.find('>.dropdown');
28434				var moreWidth = more.actual('outerWidth', { includeMargin: true });
28435				var arItemsHideWidth = [];
28436
28437				ignoreResize.push(true);
28438				_init();
28439				_gummi();
28440				ignoreResize.pop();
28441
28442				BX.addCustomEvent('onWindowResize', function (eventdata) {
28443					try {
28444						ignoreResize.push(true);
28445						_gummi();
28446						$menuTopest.addClass('initied');
28447					}
28448					catch (e) { }
28449					finally {
28450						ignoreResize.pop();
28451					}
28452				});
28453			}
28454		}
28455	}
28456}
28457
28458if (!funcDefined("InitTopMenuGummi")) {
28459	InitTopMenuGummi = function () {
28460		function _init() {
28461			var arItems = $topMenu.closest('.wrap_menu').find('.inc_menu .menu_top_block >li:not(.more)');
28462			var cntItems = arItems.length;
28463			if (cntItems) {
28464				var itemsWidth = 0;
28465				for (var i = 0; i < cntItems; ++i) {
28466					var item = arItems.eq(i);
28467					var itemWidth = item.actual('outerWidth');
28468					arItemsHideWidth[i] = (itemsWidth += itemWidth) + (i !== (cntItems - 1) ? moreWidth : 0);
28469				}
28470			}
28471
28472		}
28473
28474		function _gummi() {
28475			var rowWidth = $wrapMenu.actual('innerWidth') - $wrapMenuLeft.actual('innerWidth');
28476			var arItems = $topMenu.find('>
28476li:not(.more):not(.catalog),li.more>.dropdown>li');
28477			var cntItems = arItems.length;
28478
28479			if (cntItems) {
28480				var bMore = false;
28481				for (var i = cntItems - 1; i >= 0; --i) {
28482					var item = arItems.eq(i);
28483					var bInMore = item.parents('.more').length > 0;
28484					if (!bInMore) {
28485						if (arItemsHideWidth[i] > rowWidth) {
28486							if (!bMore) {
28487								bMore = true;
28488								more.removeClass('hidden');
28489							}
28490							var clone = item.clone();
28491							clone.find('>.dropdown').removeAttr('style').removeClass('toleft');
28492							clone.find('>a').addClass('dark_font').removeAttr('style');
28493							clone.prependTo(moreDropdown);
28494							item.addClass('cloned');
28495						}
28496					}
28497				}
28498				for (var i = 0; i < cntItems; ++i) {
28499					var item = arItems.eq(i);
28500					var bInMore = item.parents('.more').length > 0;
28501					if (bInMore) {
28502						if (arItemsHideWidth[i] <= rowWidth) {
28503							if (i === (cntItems - 1)) {
28504								bMore = false;
28505								more.addClass('hidden');
28506							}
28507							var clone = item.clone();
28508							clone.find('>a').removeClass('dark_font');
28509							clone.insertBefore(more);
28510							item.addClass('cloned');
28511						}
28512					}
28513				}
28514				$topMenu.find('li.cloned').remove();
28515
28516				var cntItemsVisible = $topMenu.find('>li:not(.more):not(.catalog)').length;
28517				var o = rowWidth - arItemsHideWidth[cntItemsVisible - 1];
28518				var itemsPaddingAdd = Math.floor(o / (cntItemsVisible + (more.hasClass('hidden') ? 0 : 1)));
28519				var itemsPadding_new = itemsPadding_min + itemsPaddingAdd;
28520				var itemsPadding_new_l = Math.floor(itemsPadding_new / 2);
28521				var itemsPadding_new_r = itemsPadding_new - itemsPadding_new_l;
28522
28523				$topMenu.find('>li:not(.catalog):visible>a').each(function () {
28524					$(this).css({ 'padding-left': itemsPadding_new_l + 'px' });
28525					$(this).css({ 'padding-right': itemsPadding_new_r + 'px' });
28526				});
28527
28528				var lastItemPadding_new = itemsPadding_new + o - (cntItemsVisible + (more.is(':visible') ? 1 : 0)) * itemsPaddingAdd;
28529				var lastItemPadding_new_l = Math.floor(lastItemPadding_new / 2);
28530				var lastItemPadding_new_r = lastItemPadding_new - lastItemPadding_new_l;
28531				$topMenu.find('>li:visible').last().find('>a').css({ 'padding-left': lastItemPadding_new_l + 'px' });
28532				$topMenu.find('>li:visible').last().find('>a').css({ 'padding-right': lastItemPadding_new_r + 'px' });
28533			}
28534			CheckTopMenuFullCatalogSubmenu();
28535		}
28536
28537		var $topMenu = $('.menu_top_block');
28538		if ($menuTopest.length) {
28539			var $wrapMenu = $topMenu.parents('.wrap_menu');
28540			var $wrapMenuLeft = $wrapMenu.find('.catalog_menu_ext');
28541			var more = $topMenu.find('>.more');
28542			var moreWidth = more.actual('outerWidth', { includeMargin: true });
28543			more.addClass('hidden');
28544			var arItemsHideWidth = [];
28545			var moreDropdown = more.find('>.dropdown');
28546			var itemsPadding = parseInt(more.find('>a').css('padding-left')) * 2;
28547			var itemsPadding_min = itemsPadding;
28548
28549
28550			setTimeout(function () {
28551				ignoreResize.push(true);
28552				_init();
28553				_gummi();
28554				ignoreResize.pop();
28555			}, 5000);
28556
28557			BX.addCustomEvent('onWindowResize', function (eventdata) {
28558				try {
28559					ignoreResize.push(true);
28560					_gummi();
28561				}
28562				catch (e) { }
28563				finally {
28564					ignoreResize.pop();
28565				}
28566			});
28567
28568			/*BX.addCustomEvent('onTopPanelFixUnfix', function(eventdata) {
28569				ignoreResize.push(true);
28570				_gummi();
28571				ignoreResize.pop();
28572			});*/
28573		}
28574	}
28575}
28576
28577if (!funcDefined("checkCounters")) {
28578	function checkCounters(name) {
28579		if (typeof name !== "undefined") {
28580			if (name == "google" && (arAsproOptions["COUNTERS"]["GOOGLE_ECOMERCE"] == "Y" && arAsproOptions["COUNTERS"]["GOOGLE_COUNTER"] > 0)) {
28581				return true;
28582			}
28583			else if (name == "yandex" && (arAsproOptions["COUNTERS"]["YANDEX_ECOMERCE"] == "Y" && arAsproOptions["COUNTERS"]["YANDEX_COUNTER"] > 0)) {
28584				return true;
28585			}
28586			else {
28587				return false;
28588			}
28589		}
28590		else if ((arAsproOptions["COUNTERS"]["YANDEX_ECOMERCE"] == "Y" && arAsproOptions["COUNTERS"]["YANDEX_COUNTER"] > 0) || (arAsproOptions["COUNTERS"]["GOOGLE_ECOMERCE"] == "Y" && arAsproOptions["COUNTERS"]["GOOGLE_COUNTER"] > 0)) {
28591			return true;
28592		}
28593		else {
28594			return false;
28595		}
28596	}
28597}
28598
28599if (!funcDefined("addBasketCounter")) {
28600	function addBasketCounter(id) {
28601		if (arAsproOptions['COUNTERS']['USE_BASKET_GOALS'] !== 'N') {
28602			var eventdata = { goal: 'goal_basket_add', params: { id: id } };
28603			BX.onCustomEvent('onCounterGoals', [eventdata]);
28604		}
28605		if (checkCounters()) {
28606			$.ajax({
28607				url: arAsproOptions['SITE_DIR'] + "ajax/goals.php",
28608				dataType: "json",
28609				type: "POST",
28610				data: { "ID": id },
28611				success: function (item) {
28612					if (!!item && !!item.ID) {
28613						waitLayer(100, function () {
28614							dataLayer.push({
28615								"event": arAsproOptions["COUNTERS"]['GOOGLE_EVENTS']['ADD2BASKET'],
28616								"ecommerce": {
28617									"currencyCode": item.CURRENCY,
28618									"add": {
28619										"products": [{
28620											"id": item.ID,
28621											"name": item.NAME,
28622											"price": item.PRICE,
28623											"brand": item.BRAND,
28624											"category": item.CATEGORY,
28625											"quantity": item.QUANTITY
28626										}]
28627									}
28628								}
28629							});
28630						});
28631					}
28632				}
28633			});
28634		}
28635	}
28636}
28637
28638if (!funcDefined("purchaseCounter")) {
28639	function purchaseCounter(order_id, type, callback) {
28640		if (checkCounters()) {
28641			$.ajax({
28642				url: arAsproOptions['SITE_DIR'] + "ajax/goals.php",
28643				dataType: "json",
28644				type: "POST",
28645				data: { "ORDER_ID": order_id, "TYPE": type },
28646				success: function (order) {
28647					var products = [];
28648					if (order.ITEMS) {
28649						for (var i in order.ITEMS) {
28650							products.push({
28651								"id": order.ITEMS[i].ID,
28652								"sku": order.ITEMS[i].ID,
28653								"name": order.ITEMS[i].NAME,
28654								"price": order.ITEMS[i].PRICE,
28655								"brand": order.ITEMS[i].BRAND,
28656								"category": order.ITEMS[i].CATEGORY,
28657								"quantity": order.ITEMS[i].QUANTITY
28658							});
28659						}
28660					}
28661					if (order.ID) {
28662						waitLayer(100, function () {
28663							dataLayer.push({
28664								"event": arAsproOptions["COUNTERS"]['GOOGLE_EVENTS']['PURCHASE'],
28665								"ecommerce": d = {
28666									"purchase": {
28667										"actionField": {
28668											"id": order.ACCOUNT_NUMBER,
28669											"shipping": order.PRICE_DELIVERY,
28670											"tax": order.TAX_VALUE,
28671											"list": type,
28672											"revenue": order.PRICE
28673										},
28674										"products": products
28675									}
28676								}
28677							});
28678
28679							if (typeof callback !== 'undefined') {
28680								callback(d);
28681							}
28682						});
28683					}
28684					else {
28685						if (typeof callback !== 'undefined') {
28686							callback();
28687						}
28688					}
28689				},
28690				error: function () {
28691					if (typeof callback !== 'undefined') {
28692						callback();
28693					}
28694				}
28695			});
28696		}
28697	}
28698}
28699
28700if (!funcDefined("viewItemCounter")) {
28701	function viewItemCounter(id, price_id) {
28702		if (checkCounters()) {
28703			$.ajax({
28704				url: arAsproOptions['SITE_DIR'] + "ajax/goals.php",
28705				dataType: "json",
28706				type: "POST",
28707				data: { "PRODUCT_ID": id, "PRICE_ID": price_id },
28708				success: function (item) {
28709					if (item.ID) {
28710						waitLayer(100, function () {
28711							dataLayer.push({
28712								//"event": "",
28713								"ecommerce": {
28714									"detail": {
28715										"products": [{
28716											"id": item.ID,
28717											"name": item.NAME,
28718											"price": item.PRICE,
28719											"brand": item.BRAND,
28720											"category": item.CATEGORY
28721										}]
28722									}
28723								}
28724							});
28725						});
28726					}
28727				}
28728			});
28729		}
28730	}
28731}
28732
28733if (!funcDefined("checkoutCounter")) {
28734	function checkoutCounter(step, option, callback) {
28735		if (checkCounters('google')) {
28736			$.ajax({
28737				url: arAsproOptions['SITE_DIR'] + "ajax/goals.php",
28738				dataType: "json",
28739				type: "POST",
28740				data: { "BASKET": "Y" },
28741				success: function (basket) {
28742					var products = [];
28743					if (basket.ITEMS) {
28744						for (var i in basket.ITEMS) {
28745							products.push({
28746								"id": basket.ITEMS[i].ID,
28747								"name": basket.ITEMS[i].NAME,
28748								"price": basket.ITEMS[i].PRICE,
28749								"brand": basket.ITEMS[i].BRAND,
28750								"category": basket.ITEMS[i].CATEGORY,
28751								"quantity": basket.ITEMS[i].QUANTITY
28752							});
28753						}
28754					}
28755					if (products) {
28756						waitLayer(100, function () {
28757							dataLayer.push({
28758								"event": arAsproOptions["COUNTERS"]['GOOGLE_EVENTS']['CHECKOUT_ORDER'],
28759								"ecommerce": {
28760									'checkout': {
28761										"actionField": {
28762											"step": step,
28763											"option": option
28764										},
28765										"products": products
28766									}
28767								},
28768								/*"eventCallback": function() {
28769									if((typeof callback !== 'undefined') && (typeof callback === 'function')){
28770										callback();
28771									}
28772							 }*/
28773							});
28774						});
28775						document.location.href = '/order/';
28776					}
28777				}
28778			});
28779		}
28780	}
28781}
28782
28783if (!funcDefined("delFromBasketCounter")) {
28784	function delFromBasketCounter(id, callback) {
28785		if (checkCounters()) {
28786			$.ajax({
28787				url: arAsproOptions['SITE_DIR'] + "ajax/goals.php",
28788				dataType: "json",
28789				type: "POST",
28790				data: { "ID": id },
28791				success: function (item) {
28792					if (item.ID) {
28793						waitLayer(100, function () {
28794							dataLayer.push({
28795								"event": arAsproOptions["COUNTERS"]['GOOGLE_EVENTS']['REMOVE_BASKET'],
28796								"ecommerce": {
28797									"remove": {
28798										"products": [{
28799											"id": item.ID,
28800											"name": item.NAME,
28801											"category": item.CATEGORY
28802										}]
28803									}
28804								}
28805							});
28806							if (typeof callback == 'function') {
28807								callback();
28808							}
28809						});
28810					}
28811				}
28812			});
28813		}
28814	}
28815}
28816
28817if (!funcDefined("setHeightCompany")) {
28818	function setHeightCompany() {
28819		$('.md-50.img').height($('.md-50.big').outerHeight() - 35);
28820	}
28821}
28822
28823if (!funcDefined("initSly")) {
28824	function initSly() {
28825		/*var $frame  = $(document).find('.frame');
28826		var $slidee = $frame.children('ul').eq(0);
28827		var $wrap   = $frame.parent();
28828
28829		if(arAsproOptions["PAGES"]["CATALOG_PAGE"] && $frame.length){
28830			$frame.sly({
28831				horizontal: 1,
28832				itemNav: 'basic',
28833				smart: 1,
28834				mouseDragging: 0,
28835				touchDragging: 0,
28836				releaseSwing: 0,
28837				startAt: 0,
28838				scrollBar: $wrap.find('.scrollbar'),
28839				scrollBy: 1,
28840				speed: 300,
28841				elasticBounds: 0,
28842				easing: 'swing',
28843				dragHandle: 1,
28844				dynamicHandle: 1,
28845				clickBar: 1,
28846
28847				// Buttons
28848				forward: $wrap.find('.forward'),
28849				backward: $wrap.find('.backward'),
28850			});
28851			$frame.sly('reload');
28852		}*/
28853	}
28854}
28855
28856if (!funcDefined("createTableCompare")) {
28857	function createTableCompare(originalTable, appendDiv, cloneTable) {
28858
28859		try {
28860			var clone = originalTable.clone().removeAttr('id').addClass('clone');
28861			if (cloneTable.length) {
28862				cloneTable.remove();
28863				appendDiv.html('');
28864				appendDiv.html(clone);
28865			} else {
28866				appendDiv.append(clone);
28867			}
28868		}
28869		catch (e) { }
28870		finally {
28871
28872		}
28873	}
28874}
28875
28876if (!funcDefined('fillBasketPropsExt')) {
28877	fillBasketPropsExt = function (that, prop_code, basket_prop_div) {
28878		var
28879			i = 0,
28880			propCollection = null,
28881			foundValues = false,
28882			basketParams = {},
28883			obBasketProps = null;
28884
28885		obBasketProps = BX(basket_prop_div);
28886		if (!obBasketProps && that.closest('.item').find('.basket_props_block').length)
28887			obBasketProps = that.closest('.item').find('.basket_props_block')[0];
28888
28889		if (!!obBasketProps) {
28890			propCollection = obBasketProps.getElementsByTagName('select');
28891			if (!!propCollection && !!propCollection.length) {
28892				for (i = 0; i < propCollection.length; i++) {
28893					if (!propCollection[i].disabled) {
28894						switch (propCollection[i].type.toLowerCase()) {
28895							case 'select-one':
28896								basketParams[propCollection[i].name] = propCollection[i].value;
28897								foundValues = true;
28898								break;
28899							default:
28900								break;
28901						}
28902					}
28903				}
28904			}
28905			propCollection = obBasketProps.getElementsByTagName('input');
28906			if (!!propCollection && !!propCollection.length) {
28907				for (i = 0; i < propCollection.length; i++) {
28908					if (!propCollection[i].disabled) {
28909						switch (propCollection[i].type.toLowerCase()) {
28910							case 'hidden':
28911								basketParams[propCollection[i].name] = propCollection[i].value;
28912								foundValues = true;
28913								break;
28914							case 'radio':
28915								if (propCollection[i].checked) {
28916									basketParams[propCollection[i].name] = propCollection[i].value;
28917									foundValues = true;
28918								}
28919								break;
28920							default:
28921								break;
28922						}
28923					}
28924				}
28925			}
28926		}
28927		if (!foundValues) {
28928			basketParams[prop_code] = [];
28929			basketParams[prop_code][0] = 0;
28930		}
28931		return basketParams;
28932	}
28933}
28934if (!funcDefined('showBasketError')) {
28935	showBasketError = function (mess, title, addButton, th, callback) {
28936		var title_set = (title ? title : BX.message("ERROR_BASKET_TITLE")),
28937			isButton = "N",
28938			thButton = "";
28939		if (typeof addButton !== undefined) {
28940			isButton = "Y";
28941		}
28942		if (typeof th !== undefined) {
28943			thButton = th;
28944		}
28945		$("body").append("<span class='add-error-bakset' style='display:none;'></span>");
28946		jqmEd('basket_error', 'error-bakset', '.add-error-bakset', mess, this, title_set, isButton, thButton);
28947		$("body .add-error-bakset").click();
28948		$("body .add-error-bakset").remove();
28949
28950		if (typeof callback === 'function') {
28951			callback();
28952		}
28953	}
28954}
28955
28956CheckTopVisibleMenu = function (that) {
28957	var dropdownMenu = $('.dropdown-menu:visible').last();
28958
28959	if (dropdownMenu.length) {
28960		dropdownMenu.find('a').css('white-space', '');
28961		dropdownMenu.css('left', '');
28962		dropdownMenu.css('right', '');
28963		dropdownMenu.removeClass('toright');
28964
28965		var dropdownMenu_left = dropdownMenu.offset().left;
28966		if (typeof (dropdownMenu_left) != 'undefined') {
28967			var menu = dropdownMenu.parents('.mega-menu');
28968			if (!menu.length)
28969				menu = dropdownMenu.closest('.logo-row');
28970			var menu_width = menu.outerWidth();
28971			var menu_left = menu.offset().left;
28972			var menu_right = menu_left + menu_width;
28973			var isToRight = dropdownMenu.parents('.toright').length > 0;
28974			var parentsDropdownMenus = dropdownMenu.parents('.dropdown-menu');
28975			var isHasParentDropdownMenu = parentsDropdownMenus.length > 0;
28976			if (isHasParentDropdownMenu) {
28977				var parentDropdownMenu_width = parentsDropdownMenus.first().outerWidth();
28978				var parentDropdownMenu_left = parentsDropdownMenus.first().offset().left;
28979				var parentDropdownMenu_right = parentDropdownMenu_width + parentDropdownMenu_left;
28980			}
28981
28982			if (parentDropdownMenu_right + dropdownMenu.outerWidth() > menu_right) {
28983				dropdownMenu.find('a').css('white-space', 'normal');
28984			}
28985
28986			var dropdownMenu_width = dropdownMenu.outerWidth();
28987			var dropdownMenu_right = dropdownMenu_left + dropdownMenu_width;
28988
28989			if (dropdownMenu_right > menu_right || isToRight) {
28990				var addleft = 0;
28991				addleft = menu_right - dropdownMenu_right;
28992				if (isHasParentDropdownMenu || isToRight) {
28993					dropdownMenu.css('left', 'auto');
28994					dropdownMenu.css('right', '100%');
28995					dropdownMenu.addClass('toright');
28996				}
28997				else {
28998					var dropdownMenu_curLeft = parseInt(dropdownMenu.css('left'));
28999					dropdownMenu.css('left', (dropdownMenu_curLeft + addleft) + 'px');
29000				}
29001			}
29002		}
29003	}
29004}
29005
29006if (!funcDefined("isRealValue")) {
29007	function isRealValue(obj) {
29008		return obj && obj !== "null" && obj !== "undefined";
29009	}
29010}
29011
29012if (!funcDefined("rightScroll")) {
29013	function rightScroll(prop, id) {
29014		var el = BX('prop_' + prop + '_' + id);
29015		if (el) {
29016			var curVal = parseInt(el.style.marginLeft);
29017			if (curVal >= 0) el.style.marginLeft = curVal - 20 + '%';
29018		}
29019	}
29020}
29021
29022if (!funcDefined("leftScroll")) {
29023	function leftScroll(prop, id) {
29024		var el = BX('prop_' + prop + '_' + id);
29025		if (el) {
29026			var curVal = parseInt(el.style.marginLeft);
29027			if (curVal < 0) el.style.marginLeft = curVal + 20 + '%';
29028		}
29029	}
29030}
29031
29032if (!funcDefined("InitOrderCustom")) {
29033	InitOrderCustom = function () {
29034		$('.ps_logo img').wrap('<div class="image"></div>');
29035
29036		$('#bx-soa-order .radio-inline').each(function () {
29037			if ($(this).find('input').attr('checked') == 'checked') {
29038				$(this).addClass('checked');
29039			}
29040		});
29041
29042		$('#bx-soa-order .checkbox input[type=checkbox]').each(function () {
29043			if ($(this).attr('checked') == 'checked')
29044				$(this).parent().addClass('checked');
29045		});
29046
29047		$('#bx-soa-order .bx-authform-starrequired').each(function () {
29048			var html = $(this).html();
29049			$(this).closest('label').append('<span class="bx-authform-starrequired"> ' + html + '</span>');
29050			$(this).detach();
29051		});
29052		$('.bx_ordercart_coupon').each(function () {
29053			if ($(this).find('.bad').length)
29054				$(this).addClass('bad');
29055			else if ($(this).find('.good').length)
29056				$(this).addClass('good');
29057		});
29058		/*if (typeof(propsMap) !== 'undefined') {
29059			$(propsMap).on('click', function () {
29060				var value = $('#orderDescription').val();
29061				if ($('#orderDescription')) {
29061
29062					if (value != '') {
29063						$('#orderDescription').closest('.form-group').addClass('value_y');
29064					}
29065				}
29066			});
29067		}*/
29068	}
29069}
29070
29071if (!funcDefined("InitLabelAnimation")) {
29072	InitLabelAnimation = function (className) {
29073		// Fix order labels
29074		if (!$(className).length) {
29075			return;
29076		}
29077		$(className).find('.form-group').each(function () {
29078			if ($(this).find('input[type=text], textarea').length && !$(this).find('.dropdown-block').length && $(this).find('input[type=text], textarea').val() != '') {
29079				$(this).addClass('value_y');
29080			}
29081		});
29082
29083		$(document).on('click', className + ' .form-group:not(.bx-soa-pp-field) label', function () {
29084			$(this).parent().find('input, textarea').focus();
29085		});
29086
29087		$(document).on('focusout', className + ' .form-group:not(.bx-soa-pp-field) input, ' + className + ' .form-group:not(.bx-soa-pp-field) textarea', function () {
29088			var value = $(this).val();
29089			if (value != '' && !$(this).closest('.form-group').find('.dropdown-block').length && !$(this).closest('.form-group').find('#profile_change').length) {
29090				$(this).closest('.form-group').addClass('value_y');
29091			} else {
29092				$(this).closest('.form-group').removeClass('value_y');
29093			}
29094		});
29095
29096		$(document).on('focus', className + ' .form-group:not(.bx-soa-pp-field) input, ' + className + ' .form-group:not(.bx-soa-pp-field) textarea', function () {
29097			if (!$(this).closest('.form-group').find('.dropdown-block').length && !$(this).closest('.form-group').find('#profile_change').length && !$(this).closest('.form-group').find('[name=PERSON_TYPE_OLD]').length) {
29098				$(this).closest('.form-group').addClass('value_y');
29099			}
29100		});
29101	};
29102}
29103
29104checkPopupWidth = function () {
29105	$('.popup.show').each(function () {
29106		var width_form = $(this).actual('width');
29107		$(this).css({
29108			'margin-left': ($(window).width() > width_form ? '-' + width_form / 2 + 'px' : '-' + $(window).width() / 2 + 'px'),
29109		});
29110	});
29111}
29112
29113checkCaptchaWidth = function () {
29114	$('.captcha-row').each(function () {
29115		var width = $(this).actual('width');
29116		if ($(this).hasClass('b')) {
29117			if (width > 320) {
29118				$(this).removeClass('b');
29119			}
29120		}
29121		else {
29122			if (width <= 320) {
29123				$(this).addClass('b');
29124			}
29125		}
29126	});
29127}
29128
29129checkFormWidth = function () {
29130	$('.form .form_left').each(function () {
29131		var form = $(this).parents('.form');
29132		var width = form.actual('width');
29133		if (form.hasClass('b')) {
29134			if (width > 417) {
29135				form.removeClass('b');
29136			}
29137		}
29138		else {
29139			if (width <= 417) {
29140				form.addClass('b');
29141			}
29142		}
29143	});
29144}
29145
29146checkFormControlWidth = function () {
29147	$('.form-control').each(function () {
29148		var width = $(this).actual('width');
29149		var labelWidth = $(this).find('label:not(.error) > span').actual('width');
29150		var errorWidth = $(this).find('label.error').actual('width');
29151		if (errorWidth > 0) {
29152			if ($(this).hasClass('h')) {
29153				if (width > (labelWidth + errorWidth + 5)) {
29154					$(this).removeClass('h');
29155				}
29156			}
29157			else {
29158				if (width <= (labelWidth + errorWidth + 5)) {
29159					$(this).addClass('h');
29160				}
29161			}
29162		}
29163		else {
29164			$(this).removeClass('h');
29165		}
29166	});
29167}
29168
29169scrollToTop = function () {
29170	if (arAsproOptions['THEME']['SCROLLTOTOP_TYPE'] !== 'NONE') {
29171		var _isScrolling = false;
29172		// Append Button
29173		$('body').append($('<a />').addClass('scroll-to-top ' + arAsproOptions['THEME']['SCROLLTOTOP_TYPE'] + ' ' + arAsproOptions['THEME']['SCROLLTOTOP_POSITION']).attr({ 'href': '#', 'id': 'scrollToTop' }));
29174
29175		if (arAsproOptions['THEME']['SCROLLTOTOP_POSITION_BOTTOM']) {
29176			$('#scrollToTop').css('bottom', +arAsproOptions['THEME']['SCROLLTOTOP_POSITION_BOTTOM'] + 'px');
29177		}
29178
29179		if (arAsproOptions['THEME']['SCROLLTOTOP_POSITION_RIGHT']) {
29180			$('#scrollToTop').css('right', +arAsproOptions['THEME']['SCROLLTOTOP_POSITION_RIGHT'] + 'px');
29181		}
29182
29183		$('#scrollToTop').click(function (e) {
29184			e.preventDefault();
29185			$('body, html').animate({ scrollTop: 0 }, 500);
29186			return false;
29187		});
29188		// Show/Hide Button on Window Scroll event.
29189		$(window).scroll(function () {
29190			if (!_isScrolling) {
29191				_isScrolling = true;
29192				if ($(window).scrollTop() > 150) {
29193					$('#scrollToTop').stop(true, true).addClass('visible');
29194					_isScrolling = false;
29195				}
29196				else {
29197					$('#scrollToTop').stop(true, true).removeClass('visible');
29198					_isScrolling = false;
29199				}
29200				checkScrollToTop();
29201			}
29202		});
29203	}
29204}
29205
29206checkScrollToTop = function () {
29207	if (arAsproOptions['THEME']['SCROLLTOTOP_POSITION_BOTTOM'])
29208		var bottom = +arAsproOptions['THEME']['SCROLLTOTOP_POSITION_BOTTOM'];
29209	else
29210		var bottom = 55;
29211
29212	var scrollVal = $(window).scrollTop(),
29213		windowHeight = $(window).height(),
29214		footerOffset = 0;
29215	if ($('footer').length)
29216		footerOffset = $('footer .footer-inner').offset().top;
29217
29218	if (arAsproOptions['THEME']['SCROLLTOTOP_POSITION'] == 'CONTENT') {
29219		warpperWidth = $('body > .wrapper > .wrapper_inner').width();
29220		$('#scrollToTop').css('margin-left', Math.ceil(warpperWidth / 2) + 23);
29221	}
29222
29223	if (scrollVal + windowHeight > footerOffset) {
29224		$('#scrollToTop').css('bottom', Math.round(bottom + scrollVal + windowHeight - footerOffset) + 'px');
29225	}
29226	else if (parseInt($('#scrollToTop').css('bottom')) > bottom) {
29227		$('#scrollToTop').css('bottom', Math.round(bottom));
29228	}
29229}
29230
29231CheckObjectsSizes = function () {
29232	$('.container iframe,.container object,.container video').each(function () {
29233		var height_attr = $(this).attr('height');
29234		var width_attr = $(this).attr('width');
29235		if (height_attr && width_attr) {
29236			$(this).css('height', $(this).outerWidth() * height_attr / width_attr);
29237		}
29238	});
29239}
29240
29241if (!funcDefined('reloadTopBasket')) {
29242	var reloadTopBasket = function reloadTopBasket(action, basketWindow, speed, delay, slideDown, item, sync) {
29243		var obj = {
29244			"PARAMS": $('#top_basket_params').val(),
29245			"ACTION": action
29246		};
29247		if (typeof item !== "undefined" && item) {
29248			obj.delete_top_item = 'Y';
29249			obj.delete_top_item_id = item.data('id');
29250		}
29251		// $.post( arAsproOptions['SITE_DIR']+"ajax/show_basket_popup.php", obj, $.proxy(function( data ){
29252		$.post(arAsproOptions['SITE_DIR'] + "ajax/show_basket_actual.php", obj, $.proxy(function (data) {
29253			$(basketWindow).html(data);
29254
29255			getActualBasket('', '', sync);
29256
29257			var eventdata = { action: 'loadBasket' };
29258			BX.onCustomEvent('onCompleteAction', [eventdata]);
29259
29260			/*if(arAsproOptions['THEME']['SHOW_BASKET_ONADDTOCART'] !== 'N'){
29261				if($(window).outerWidth() > 520){
29262					if(slideDown=="Y")
29263						$(basketWindow).find('.basket_popup_wrapp').stop(true,true).slideDown(speed);
29264					clearTimeout(basketTimeoutSlide);
29265					basketTimeoutSlide = setTimeout(function() {
29266						var _this = $('#basket_line').find('.basket_popup_wrapp');
29267						if (_this.is(':hover')) {
29268							_this.show();
29269						}else{
29270							$('#basket_line').find('.basket_popup_wrapp').slideUp(speed);
29271						}
29272					},delay);
29273				}
29274			}*/
29275		}))
29276	}
29277}
29278
29279CheckTabActive = function () {
29280	if (typeof (clicked_tab) && clicked_tab) {
29281		if (window.matchMedia('(min-width: 768px)').matches) {
29282			clicked_tab--;
29283			$('.nav.nav-tabs li').each(function () {
29284				if ($(this).index() == clicked_tab)
29285					$(this).addClass('active');
29286			})
29287			// $('.nav.nav-tabs li:eq('+clicked_tab+')').addClass('active');
29288			$('.catalog_detail .tab-content .tab-pane:eq(' + clicked_tab + ')').addClass('active');
29289			$('.catalog_detail .tab-content .tab-pane .title-tab-heading').next().removeAttr('style');
29290			clicked_tab = 0;
29291		}
29292	}
29293}
29294
29295/*countdown start*/
29296if (!funcDefined('initCountdown')) {
29297	var initCountdown = function initCountdown() {
29298		if ($('.view_sale_block').size()) {
29299			$('.view_sale_block').each(function () {
29300				var activeTo = $(this).find('.active_to').text(),
29301					dateTo = new Date(activeTo.replace(/(\d+)\.(\d+)\.(\d+)/, '$3/$2/$1'));
29302				if ($(this).hasClass('compact'))
29303					$(this).find('.countdown').countdown({ until: dateTo, format: 'dHMS', compact: true, padZeroes: true, layout: '{d<}<span class="days item">{dn}<div class="text">{dl}</div></span>{d>} <span class="hours item">{hn}<div class="text">{hl}</div></span> <span class="minutes item">{mn}<div class="text">{ml}</div></span> <span class="sec item">{sn}<div class="text">{sl}</div></span>' }, $.countdown.regionalOptions['ru']);
29304				else
29305					$(this).find('.countdown').countdown({ until: dateTo, format: 'dHMS', padZeroes: true, layout: '{d<}<span class="days item">{dnn}<div class="text">{dl}</div></span>{d>} <span class="hours item">{hnn}<div class="text">{hl}</div></span> <span class="minutes item">{mnn}<div class="text">{ml}</div></span> <span class="sec item">{snn}<div class="text">{sl}</div></span>' }, $.countdown.regionalOptions['ru']);
29306			})
29307		}
29308	}
29309}
29310
29311if (!funcDefined('initCountdownTime')) {
29312	var initCountdownTime = function initCountdownTime(block, time) {
29313		if (time) {
29314			var dateTo = new Date(time.replace(/(\d+)\.(\d+)\.(\d+)/, '$3/$2/$1'));
29315			block.find('.countdown').countdown('destroy');
29316			if (block.hasClass('compact'))
29317				block.find('.countdown').countdown({ until: dateTo, format: 'dHM', compact: true, padZeroes: true, layout: '{d<}<span class="days item">{dn}<div class="text">{dl}</div></span>{d>} <span class="hours item">{hn}<div class="text">{hl}</div></span> <span class="minutes item">{mn}<div class="text">{ml}</div></span> <span class="sec item">{sn}<div class="text">{sl}</div></span>' }, $.countdown.regionalOptions['ru']);
29318			else
29319				block.find('.countdown').countdown({ until: dateTo, format: 'dHMS', padZeroes: true, layout: '{d<}<span class="days item">{dnn}<div class="text">{dl}</div></span>{d>} <span class="hours item">{hnn}<div class="text">{hl}</div></span> <span class="minutes item">{mnn}<div class="text">{ml}</div></span> <span class="sec item">{snn}<div class="text">{sl}</div></span>' }, $.countdown.regionalOptions['ru']);
29320			block.find('.view_sale_block').show();
29321		}
29322		else {
29323			block.find('.view_sale_block').hide();
29324		}
29325	}
29326}
29327/*countdown end*/
29328
29329waitCounter = function (idCounter, delay, callback) {
29330	var obCounter = window['yaCounter' + idCounter];
29331	if (typeof obCounter == 'object') {
29332		if (typeof callback == 'function')
29333			callback();
29334
29335	}
29336	else {
29337		setTimeout(function () {
29338			waitCounter(idCounter, delay, callback);
29339		}, delay);
29340	}
29341}
29342
29343var isOnceInited = insertFilter = false;
29344var animationTime = 200;
29345var delayTime = 200;
29346var topMenuEnterTimer = false;
29347var isMobile = ((jQuery.browser.mobile && window.matchMedia('(max-width:767px)').matches) || window.matchMedia('(max-width:400px)').matches);
29348
29349if (isMobile)
29350	document.documentElement.className += ' mobile';
29351
29352if (navigator.userAgent.indexOf("Edge") != -1)
29353	document.documentElement.className += ' bx-ie-edge';
29354
29355/*filter start*/
29356if (!funcDefined('checkVerticalMobileFilter')) {
29357	var checkVerticalMobileFilter = function checkVerticalMobileFilter() {
29358		/*if($('.right_block1.catalog.vertical').length && !$('.left_block.filter_ajax').length)
29359		{
29360			if(typeof window['trackBarOptions'] !== 'undefined')
29361			{
29362				window['trackBarValues'] = {}
29363				for(key in window['trackBarOptions'])
29364				{
29365					window['trackBarValues'][key] = {
29366						'leftPercent': window['trackBar' + key].leftPercent,
29367						'leftValue': window['trackBar' + key].minInput.value,
29368						'rightPercent': window['trackBar' + key].rightPercent,
29369						'rightValue': window['trackBar' + key].maxInput.value,
29370					}
29371				}
29372			}
29373
29374			if(window.matchMedia('(max-width: 991px)').matches)
29375			{
29376				if(!insertFilter)
29377				{
29378					$('.js_filter .bx_filter.bx_filter_vertical').html($('.left_block .bx_filter.bx_filter_vertical').html());
29379					$('.left_block .bx_filter.bx_filter_vertical .bx_filter_section').remove();
29380					insertFilter=true;
29381				}
29382			}
29383			else
29384			{
29385				if(insertFilter)
29386				{
29387					$('.left_block .bx_filter.bx_filter_vertical').html($('.js_filter .bx_filter.bx_filter_vertical').html());
29388					$('.js_filter .bx_filter.bx_filter_vertical .bx_filter_section').remove();
29389					insertFilter=false;
29390				}
29391			}
29392
29393			if(typeof window['trackBarOptions'] !== 'undefined')
29394			{
29395				for(key in window['trackBarOptions'])
29396				{
29397					window['trackBarOptions'][key].leftPercent = window['trackBarValues'][key].leftPercent;
29398					window['trackBarOptions'][key].rightPercent = window['trackBarValues'][key].rightPercent;
29399					window['trackBarOptions'][key].curMinPrice = window['trackBarValues'][key].leftValue;
29400					window['trackBarOptions'][key].curMaxPrice = window['trackBarValues'][key].rightValue;
29401					window['trackBar' + key] = new BX.Iblock.SmartFilter(window['trackBarOptions'][key]);
29402					window['trackBar' + key].minInput.value = window['trackBarValues'][key].leftValue;
29403					window['trackBar' + key].maxInput.value = window['trackBarValues'][key].rightValue;
29404				}
29405			}
29406		}
29407		else if($('.visible_mobile_filter').length)
29408		{
29409			var posTopBlock = BX.pos($('.detail.partners')[0]),
29410				posBlock = $('.ajax_load').position();
29411			// $('.visible_mobile_filter').css('top', posBottomBlock.top-posTopBlock.top);
29412			$('.visible_mobile_filter').css('top', posBlock.top);
29413
29414		}*/
29415	}
29416}
29417/*filter end*/
29418
29419// ONE CLICK
29420if (!funcDefined("oneClickBuy")) {
29421	var oneClickBuy = function (elementID, iblockID, that) {
29422		var name = 'one_click_buy';
29423		var elementQuantity = 1;
29424		var offerProps = false;
29425		var buy_btn = $(that).closest('.buy_block').find('.to-cart');
29426		var buy_btn2 = $(that).closest('tr').find('.to-cart');
29427
29428		if (typeof (that) !== 'undefined') {
29429			elementQuantity = $(that).attr('data-quantity');
29430			offerProps = $(that).attr('data-props');
29431		}
29432
29433		if (elementQuantity < 0) {
29434			elementQuantity = 1;
29435		}
29436
29437		var tmp_props = buy_btn.data("props"),
29438			tmp_props2 = buy_btn2.data("props"),
29439			props = '',
29440			part_props = '',
29441			add_props = 'N',
29442			fill_prop = {},
29443			iblockid = buy_btn.data('iblockid'),
29444			item = buy_btn.attr('data-item');
29445
29446		if (tmp_props) {
29447			props = tmp_props.split(";");
29448		} else if (tmp_props2) {
29449			props = tmp_props2.split(";");
29450		}
29451		if (buy_btn.data("part_props")) {
29452			part_props = buy_btn.data("part_props");
29453		}
29454		if (buy_btn.data("add_props")) {
29455			add_props = buy_btn.data("add_props");
29456		}
29457
29458		fill_prop = fillBasketPropsExt(buy_btn, 'prop', buy_btn.data('bakset_div'));
29459		fill_prop.iblockID = iblockid;
29460		fill_prop.part_props = part_props;
29461		fill_prop.add_props = add_props;
29462		fill_prop.props = JSON.stringify(props);
29463		fill_prop.item = item;
29464		fill_prop.ocb_item = "Y";
29465
29466		if (!isMobile) {
29467			if (!$(that).hasClass('clicked')) {
29468				$(that).addClass('clicked');
29469				$('body').find('.' + name + '_frame').remove();
29470				$('body').find('.' + name + '_trigger').remove();
29471				$('body #popup_iframe_wrapper').append('<div class="' + name + '_frame popup"></div>');
29472				$('body #popup_iframe_wrapper').append('<div class="' + name + '_trigger"></div>');
29473				$('.' + name + '_frame').jqm({ trigger: '.' + name + '_trigger', onHide: function (hash) { onHidejqm(name, hash); }, toTop: false, onLoad: function (hash) { onLoadjqm(name, hash); }, ajax: arAsproOptions["SITE_DIR"] + 'ajax/one_click_buy.php?ELEMENT_ID=' + elementID + '&IBLOCK_ID=' + iblockID + '&ELEMENT_QUANTITY=' + elementQuantity + '&OFFER_PROPS=' + fill_prop.props });
29474				$('.' + name + '_trigger').click();
29475			}
29476		}
29477		else {
29478			var script = arAsproOptions['SITE_DIR'] + 'form/';
29479			script += '?name=' + name + '&form_id=ocb&path=' + window.location.pathname + '&ELEMENT_ID=' + elementID + '&IBLOCK_ID=' + iblockID + '&ELEMENT_QUANTITY=' + elementQuantity + '&OFFER_PROPS=' + fill_prop.props
29480			location.href = script;
29481		}
29482	}
29483}
29484
29485if (!funcDefined("oneClickBuyBasket")) {
29486	var oneClickBuyBasket = function () {
29487		name = 'one_click_buy_basket';
29488		if (!isMobile) {
29489			if (!$('.fast_order').hasClass('clicked')) {
29490				$('.fast_order').addClass('clicked');
29491				$('body').find('.' + name + '_frame').remove();
29492				$('body').find('.' + name + '_trigger').remove();
29493				$('body #popup_iframe_wrapper').append('<div class="' + name + '_frame popup"></div>');
29494				$('body #popup_iframe_wrapper').append('<div class="' + name + '_trigger"></div>');
29495				$('.' + name + '_frame').jqm({ trigger: '.' + name + '_trigger', onHide: function (hash) { onHidejqm(name, hash) }, onLoad: function (hash) { onLoadjqm(name, hash); }, ajax: arAsproOptions["SITE_DIR"] + 'ajax/one_click_buy_basket.php' });
29496				$('.' + name + '_trigger').click();
29497			}
29498		}
29499		else {
29500			var script = arAsproOptions['SITE_DIR'] + 'form/';
29501			script += '?name=' + name + '&form_id=ocb&path=' + window.location.pathname + '&buy_basket=y';
29502			location.href = script;
29503		}
29504	}
29505}
29506
29507// TOP MENU ANIMATION
29508$(document).on('click', '.menu_top_block>li .more a', function () {
29509	$this = $(this);
29510	$this.parents('.dropdown').first().find('>.hidden').removeClass('hidden');
29511	$this.parent().addClass('hidden');
29512	setTimeout(function () {
29513		$this.parent().remove();
29514	}, 500);
29515});
29516
29517$(document).on('mouseenter', '.menu_top_block.catalogfirst>li>.dropdown>li.full', function () {
29518	var $submenu = $(this).find('>.dropdown');
29519
29520	if ($submenu.length) {
29521		if (topMenuEnterTimer) {
29522			clearTimeout(topMenuEnterTimer);
29523			topMenuEnterTimer = false;
29524		}
29525	}
29526});
29527
29528$(document).on('mouseenter', '.menu_top_block>li:not(.full)', function () {
29529	var $submenu = $(this).find('>.dropdown');
29530
29531	if ($submenu.length && !$submenu.hasClass('visible')) {
29532		var $menu = $(this).parents('.menu');
29533		var $wrapmenu = $menu.parents('.wrap_menu');
29534		var wrapMenuWidth = $wrapmenu.actual('outerWidth');
29535		var wrapMenuLeft = $wrapmenu.offset().left;
29536		var wrapMenuRight = wrapMenuLeft + wrapMenuWidth;
29537		var left = wrapMenuRight - ($(this).offset().left + $submenu.actual('outerWidth'));
29538		if (window.matchMedia('(min-width: 951px)').matches && $(this).hasClass('catalog') && ($('.banner_auto').hasClass('catalog_page') || $('.banner_auto').hasClass('front_page'))) {
29539			return;
29540		}
29541		if (left < 0) {
29542			$submenu.css({ left: left + 'px' });
29543		}
29544		$submenu.stop().slideDown(animationTime, function () {
29545			$submenu.css({ height: '', 'overflow': 'visible' });
29546		});
29547
29548
29549		$(this).on('mouseleave', function () {
29550			var leaveTimer = setTimeout(function () {
29551				$submenu.stop().slideUp(animationTime, function () {
29552					$submenu.css({ left: '' });
29553				});
29554			}, delayTime);
29555
29556			$(this).on('mouseenter', function () {
29557				if (leaveTimer) {
29558					clearTimeout(leaveTimer);
29559					leaveTimer = false;
29560				}
29561			});
29562		});
29563	}
29564});
29565
29566$(document).on('mouseenter', '.menu_top_block>li .dropdown>li', function () {
29567	var $this = $(this);
29568	var $submenu = $this.find('>.dropdown');
29569
29570	if ($submenu.length && ((!$this.parents('.full').length && !$this.hasClass('full')) || $this.parents('.more').length)) {
29571		var $menu = $this.parents('.menu');
29572		var $wrapmenu = $menu.parents('.wrap_menu');
29573		var arParentSubmenuForOpacity = [];
29574		topMenuEnterTimer = setTimeout(function () {
29575
29576			var wrapMenuWidth = $wrapmenu.actual('outerWidth');
29577			var wrapMenuLeft = $wrapmenu.offset().left;
29578			var wrapMenuRight = wrapMenuLeft + wrapMenuWidth;
29579			var $parentSubmenu = $this.parent();
29580			var bToLeft = $parentSubmenu.hasClass('toleft') ? true : false;
29581			if (!bToLeft) {
29582				bToLeft = $this.offset().left + $this.actual('outerWidth') + $submenu.actual('outerWidth') > wrapMenuRight;
29583			}
29584			else {
29585				bToLeft = $this.offset().left + $this.actual('outerWidth') - $submenu.actual('outerWidth') < wrapMenuLeft;
29586			}
29587
29588			if (bToLeft) {
29589				$this.find('>.dropdown').addClass('toleft').show();
29590			}
29591			else {
29592				$this.find('>.dropdown').removeClass('toleft').show();
29593			}
29594			var submenuLeft = $submenu.offset().left;
29595			var submenuRight = submenuLeft + $submenu.actual('outerWidth');
29596
29597			$this.parents('.dropdown').each(function () {
29598				var $this = $(this);
29599				var leftOffset = $this.offset().left;
29600				var rightOffset = leftOffset + $this.actual('outerWidth');
29601				if (leftOffset >= submenuLeft && leftOffset < (submenuRight - 1) || (rightOffset > (submenuLeft + 1) && rightOffset <= submenuRight)) {
29602					arParentSubmenuForOpacity.push($this);
29603					$this.find('>li>a').css({ opacity: '0.1' });
29604				}
29605			});
29606		}, delayTime);
29607
29608		$this.unbind('mouseleave');
29609		$this.on('mouseleave', function () {
29610			var leaveTimer = setTimeout(function () {
29611				$this.find('.dropdown').removeClass('toleft').hide();
29612				if (arParentSubmenuForOpacity.length) {
29613					for (i in arParentSubmenuForOpacity) {
29614						arParentSubmenuForOpacity[i].find('>li>a').css({ opacity: '' });
29615					}
29616				}
29617			}, delayTime);
29618
29619			$this.unbind('mouseenter');
29620			$this.on('mouseenter', function () {
29621				if (leaveTimer) {
29622					clearTimeout(leaveTimer);
29623					leaveTimer = false;
29624				}
29625			});
29626		});
29627	}
29628});
29629
29630/*hover animate*/
29631//breadcrumbs
29632$(document).on('mouseenter', '.breadcrumbs .breadcrumbs__item, .hover-block .hover-block__item', function () {
29633	var _this = $(this),
29634		menu = _this.find('> .breadcrumbs__dropdown-wrapper, > .hover-block__item-wrapper');
29635
29636	menu.velocity('stop').velocity('transition.slideUpIn', {
29637		duration: 300,
29638		delay: 100
29639	});
29640
29641	_this.one('mouseleave', function () {
29642
29643		menu.velocity('stop').velocity('fadeOut', {
29644			duration: 100,
29645			// delay: 0
29646		});
29647	});
29648});
29649
29650//top menu
29651$(document).on('mouseenter', '.menu .mega-menu table td, .menu-row .mega-menu table td', function () {
29652
29653	var _this = $(this),
29654		menu = _this.find('> .wrap > .dropdown-menu');
29655
29656	if (!_this.hasClass('wide_menu')) {
29657		menu.show();
29658		CheckTopVisibleMenu();
29659	}
29660
29661	var bDarkness = $('.wrapper1.dark-hover-overlay').length > 0;
29662
29663	menu.velocity('stop');
29664
29665	if (menu.css('opacity') != 0) {
29666		menu.css('opacity', '1');
29667		if (bDarkness) {
29668			$('.shadow-block').css('opacity', '1');
29669		}
29670	}
29671	else {
29672		// menu.velocity('stop').velocity('transition.perspectiveDownIn', {
29673		// menu.velocity('stop').velocity('transition.slideUpBigIn', {
29674		// menu.velocity('transition.expandIn', {
29675		menu.velocity('fadeIn', {
29676			duration: 150,
29677			delay: 250,
29678			complete: function () {
29679				if (bDarkness) {
29680					$('body').addClass('menu-hovered');
29681					if (!$('.shadow-block').length)
29682						$('<div class="shadow-block"></div>').appendTo($('body'));
29683					$('.shadow-block').velocity('stop').velocity('fadeIn', 200);
29684
29685					var bannerMenu = $('.dropdown-menu.with_right_block .owl-carousel-hover');
29686					if (bannerMenu.length) {
29687						bannerMenu.removeClass('owl-carousel-hover').addClass('owl-carousel');
29688						setTimeout(function () {
29689							InitOwlSlider();
29690							bannerMenu.removeClass('loader_circle');
29691						}, 1);
29692					}
29693				}
29694			}
29695		});
29696	}
29697
29698	_this.one('mouseleave', function () {
29699		menu.velocity('stop').velocity('fadeOut', {
29700			duration: 50,
29701			delay: 300,
29702			complete: function () {
29703				if (bDarkness) {
29704					$('.shadow-block').velocity('stop').velocity('fadeOut', {
29705						duration: 200,
29706						// delay: 100,
29707						complete: function () {
29708							$('body').removeClass('menu-hovered');
29709						}
29710					});
29711				}
29712			}
29713		});
29714	});
29715});
29716/**/
29717
29718$(document).on('mouseenter', '.menu-item:not(.wide_menu) .dropdown-menu .dropdown-submenu', function () {
29719	var _this = $(this),
29720		menu = _this.find('> .dropdown-menu');
29721
29722	menu.velocity('stop');
29723
29724	if (menu.css('opacity') != 0) {
29725		menu.css('opacity', '1');
29726	}
29727	else {
29728		menu.velocity('transition.fadeIn', {
29729			duration: 300,
29730			delay: 250
29731		});
29732	}
29733
29734	_this.one('mouseleave', function () {
29735		menu.velocity('stop').velocity('fadeOut', {
29736			duration: 150,
29737			delay: 300
29738		});
29739	});
29740})
29741
29742/*register custom velocity animate*/
29743if (typeof $.Velocity !== undefined && ('RegisterEffect' in $.Velocity)) {
29744	var effects = {
29745		"transition.slideDownFullIn": {
29746			defaultDuration: 900,
29747			calls: [[{ opacity: [1, 0], translateY: [0, '-100%'], translateZ: 0 }]]
29748		},
29749		"transition.slideDownFullOut": {
29750			defaultDuration: 900,
29751			calls: [[{ opacity: [0.4, 1], translateY: ['-100%', 0], translateZ: 0 }]]
29752		}
29753	};
29754
29755	for (var effectName in effects) {
29756		if (effects.hasOwnProperty(effectName)) {
29757			$.Velocity.RegisterEffect(effectName, effects[effectName]);
29758		}
29759	}
29760}
29761/**/
29762
29763getGridSize = function (counts, slider) {
29764	var counts_item = 1;
29765	//wide
29766	if (window.matchMedia('(min-width: 1200px)').matches) {
29767		counts_item = counts[0];
29768		if (typeof (slider.data('lg_count')) !== 'undefined' && slider.data('lg_count') && $('.front.wide_page').length)
29769			counts_item = slider.data('lg_count');
29770	}
29771
29772	//large
29773	if (window.matchMedia('(max-width: 1200px)').matches) {
29774		counts_item = counts[1];
29775	}
29776
29777	//middle
29778	if (window.matchMedia('(max-width: 992px)').matches) {
29779		counts_item = counts[2];
29780	}
29781
29782	//small
29783	if (counts[3]) {
29784		if (window.matchMedia('(max-width: 600px)').matches) {
29785			counts_item = counts[3];
29786		}
29787	}
29788
29789	//exsmall
29790	if (counts[4]) {
29791		if (window.matchMedia('(max-width: 400px)').matches) {
29792			counts_item = counts[4];
29793		}
29794	}
29795	return counts_item;
29796}
29797
29798CheckFlexSlider = function () {
29799	$('.flexslider:not(.thmb)').each(function () {
29800		var slider = $(this);
29801		if (typeof (slider.data('flexslider')) != 'undefined') {
29802			if ('vars' in slider.data('flexslider')) {
29803				slider.resize();
29804
29805				var counts = slider.data('flexslider').vars.counts;
29806				if (typeof (counts) != 'undefined' && slider.is(':visible')) {
29807					var cnt = getGridSize(counts, slider);
29808					var to0 = (cnt != slider.data('flexslider').vars.minItems || cnt != slider.data('flexslider').vars.maxItems || cnt != slider.data('flexslider').vars.move);
29809					if (to0) {
29810						slider.data('flexslider').vars.minItems = cnt;
29811						slider.data('flexslider').vars.maxItems = cnt;
29812						slider.data('flexslider').vars.move = cnt;
29813						slider.flexslider(0);
29814						slider.resize();
29815						slider.resize(); // twise!
29816					}
29817				}
29818			}
29819		}
29820	});
29821}
29822
29823InitScrollBar = function (el, initOptions) {
29824	var block = $('.srollbar-custom:not(.mobile-scroll)');
29825	if (typeof el !== 'undefined')
29826		block = el;
29827	if (block.length) {
29828		var options,
29829			defaults = {
29830				mouseWheel: {
29831					scrollAmount: 150,
29832					preventDefault: true
29833				}
29834			};
29835		var config = $.extend({}, defaults, options, block.data('plugin-options'), initOptions);
29836
29837		config.callbacks = {
29838			onScroll: function () {
29839				if ($(this).find('.mCSB_buttonLeft').hasClass('disabled'))
29840					$(this).find('.mCSB_buttonLeft').removeClass('disabled');
29841				if ($(this).find('.mCSB_buttonRight').hasClass('disabled'))
29842					$(this).find('.mCSB_buttonRight').removeClass('disabled');
29843			},
29844			onTotalScrollBack: function () {
29845				$(this).find('.mCSB_buttonLeft').addClass('disabled');
29846			},
29847			onTotalScroll: function () {
29848				$(this).find('.mCSB_buttonRight').addClass('disabled');
29849			},
29850			onInit: function () {
29851				$(this).find('.mCSB_buttonLeft').addClass('disabled');
29852			}
29853		};
29854		block.mCustomScrollbar('destroy');
29855		block.mCustomScrollbar(config);
29856	}
29857}
29858
29859InitFancyBox = function () {
29860	$('.fancy').fancybox({
29861		padding: [40, 40, 64, 40],
29862		openEffect: 'fade',
29863		closeEffect: 'fade',
29864		nextEffect: 'fade',
29865		prevEffect: 'fade',
29866		opacity: true,
29867		tpl: {
29868			closeBtn: '<span title="' + BX.message('FANCY_CLOSE') + '" class="fancybox-item fancybox-close inline svg"><svg class="svg svg-close" width="14" height="14" viewBox="0 0 14 14"><path data-name="Rounded Rectangle 568 copy 16" d="M1009.4,953l5.32,5.315a0.987,0.987,0,0,1,0,1.4,1,1,0,0,1-1.41,0L1008,954.4l-5.32,5.315a0.991,0.991,0,0,1-1.4-1.4L1006.6,953l-5.32-5.315a0.991,0.991,0,0,1,1.4-1.4l5.32,5.315,5.31-5.315a1,1,0,0,1,1.41,0,0.987,0.987,0,0,1,0,1.4Z" transform="translate(-1001 -946)"></path></svg></span>',
29869			next: '<a title="' + BX.message('FANCY_NEXT') + '" class="fancybox-nav fancybox-next" href="javascript:;"><span></span></a>',
29870			prev: '<a title="' + BX.message('FANCY_PREV') + '" class="fancybox-nav fancybox-prev" href="javascript:;"><span></span></a>'
29871		},
29872		touch: 'enabled',
29873		buttons: [
29874			// "zoom",
29875			//"share",
29876			// "slideShow",
29877			//"fullScreen",
29878			//"download",
29879			// "thumbs",
29880			"close"
29881		],
29882		backFocus: false,
29883		beforeShow: function (event) {
29884			if (!$('.cd-modal-bg').hasClass('is-visible')) {
29885				var scaleValue = retrieveScale($('.cd-modal-bg'));
29886
29887				$('.cd-modal-bg').show().addClass('is-visible').one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function () {
29888					animateLayer($('.cd-modal-bg'), scaleValue, true);
29889				});
29890			}
29891			var video_block = $('.company-block source.video-block');
29892			if (video_block.length) {
29893				if (video_block.attr('src') == '#') {
29894					var video_block_wrapper = video_block.closest('video');
29895					var video_block_clone = video_block_wrapper.clone();
29896
29897					video_block_clone.find('source').attr('src', video_block_clone.find('source').data('src'));
29898					video_block.attr('src', video_block.data('src'));
29899					video_block_clone.insertAfter(video_block_wrapper);
29900					video_block_clone.siblings('video').remove();
29901				}
29902			}
29903			var video_block_frame = $('.company-block #company_video_iframe');
29904			if (video_block_frame.length) {
29905				var data_src_iframe = video_block_frame.attr("data-src");
29906				video_block_frame.attr("src", data_src_iframe);
29907				video_block_frame.attr("allow", 'autoplay');
29908			}
29909			// $('.detail .galery .overlay_form').hide();
29910		},
29911		afterShow: function () {
29912			if ($('.fancybox-overlay').css('opacity') == 0) {
29913				setTimeout(function () {
29914					$('.fancybox-overlay').css('opacity', 1);
29915					$('html').addClass('overflow_html');
29916				}, 200);
29917			}
29918
29919			$('.fancybox-nav').css('opacity', 0);
29920			setTimeout(function () {
29921				$('.fancybox-nav').css('opacity', 1);
29922			}, 150);
29923			if ($('.fancybox-inner #company_video').length) {
29924				// var fancyHeight = $('.fancybox-wrap').height();
29925				// $('.fancybox-inner').height(fancyHeight);
29926				setTimeout(function () {
29927					$('.fancybox-wrap video').resize();
29928					setTimeout(function () {
29929						$('.fancybox-wrap').addClass('show_video');
29930						document.getElementById('company_video').currentTime = 0;
29931						document.getElementById('company_video').play();
29932					}, 300);
29933				}, 150);
29934			}
29935			else if ($('.fancybox-wrap iframe').length) {
29936				$('.fancybox-inner').height('100%');
29937			}
29938		},
29939		beforeClose: function () {
29940			closeModal();
29941			$('.fancybox-overlay').fadeOut();
29942			if ($('#company_video').length) {
29943				document.getElementById('company_video').currentTime = 0;
29944			}
29945			$('html').removeClass('overflow_html');
29946			var video_block_frame = $('.company-block .video-block');
29947			if (video_block_frame.length) {
29948				$("#company_video_iframe").attr("src", '');
29949
29950			}
29951		},
29952		onClosed: function () {
29953			if ($('.fancybox-wrap #company_video').length) {
29954				document.getElementById('company_video').pause();
29955			}
29956		},
29957	});
29958}
29959
29960InitFancyBoxVideo = function () {
29961	$(".video_link").fancybox({
29962		type: "iframe",
29963		maxWidth: 800,
29964		maxHeight: 600,
29965		fitToView: false,
29966		width: '70%',
29967		height: '70%',
29968		autoSize: false,
29969		closeClick: false,
29970		opacity: true,
29971		tpl: {
29972			closeBtn: '<span title="' + BX.message('FANCY_CLOSE') + '" class="fancybox-item fancybox-close inline svg"><svg class="svg svg-close" width="14" height="14" viewBox="0 0 14 14"><path data-name="Rounded Rectangle 568 copy 16" d="M1009.4,953l5.32,5.315a0.987,0.987,0,0,1,0,1.4,1,1,0,0,1-1.41,0L1008,954.4l-5.32,5.315a0.991,0.991,0,0,1-1.4-1.4L1006.6,953l-5.32-5.315a0.991,0.991,0,0,1,1.4-1.4l5.32,5.315,5.31-5.315a1,1,0,0,1,1.41,0,0.987,0.987,0,0,1,0,1.4Z" transform="translate(-1001 -946)"></path></svg></span>',
29973			next: '<a title="' + BX.message('FANCY_NEXT') + '" class="fancybox-nav fancybox-next" href="javascript:;"><span></span></a>',
29974			prev: '<a title="' + BX.message('FANCY_PREV') + '" class="fancybox-nav fancybox-prev" href="javascript:;"><span></span></a>'
29975		},
29976		beforeShow: function (event) {
29977			if (!$('.cd-modal-bg').hasClass('is-visible')) {
29978				var scaleValue = retrieveScale($('.cd-modal-bg'));
29979
29980				$('.cd-modal-bg').show().addClass('is-visible').one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function () {
29981					animateLayer($('.cd-modal-bg'), scaleValue, true);
29982				});
29983			}
29984		},
29985		afterShow: function () {
29986			if ($('.fancybox-overlay').css('opacity') == 0) {
29987				setTimeout(function () {
29988					$('.fancybox-overlay').css('opacity', 1);
29989					$('html').addClass('overflow_html');
29990				}, 200);
29991			}
29992
29993			$('.fancybox-nav').css('opacity', 0);
29994			setTimeout(function () {
29995				$('.fancybox-nav').css('opacity', 1);
29996			}, 150);
29997			if ($('.fancybox-wrap iframe').length) {
29998				$('.fancybox-inner').height('100%');
29999			}
30000		},
30001		beforeClose: function () {
30002			closeModal();
30003			$('.fancybox-overlay').fadeOut();
30004			$('html').removeClass('overflow_html');
30005		},
30006	});
30007}
30008
30009InitStickySideBar = function (el, container_el) {
30010	var block = '.sticky-sidebar',
30011		container_catalog = '.wraps .wrapper_inner .container_inner .main-catalog-wrapper',
30012		container = '.wraps .wrapper_inner .container_inner';
30013	if (typeof el !== 'undefined')
30014		block = el;
30015
30016	if ($(container_catalog).length)
30017		container = container_catalog;
30018
30019	if (typeof container_el !== 'undefined')
30020		container = container_el;
30021
30022	if ($(block).length && arAsproOptions['THEME']['STICKY_SIDEBAR'] != 'N') {
30023		if (typeof window['stickySidebar'] !== 'undefined') {
30024			window['stickySidebar'].destroy();
30025		}
30026		window['stickySidebar'] = new StickySidebar(block, {
30027			topSpacing: 60,
30028			bottomSpacing: 20,
30029			containerSelector: container,
30030			resizeSensor: true,
30031			innerWrapperSelector: '.sticky-sidebar__inner'
30032		});
30033
30034		if ($('.sticky-sidebar .sticky-sidebar__inner .banner img').length) {
30035			$('.sticky-sidebar .sticky-sidebar__inner .banner img').load(function () {
30036				if (typeof window['stickySidebar'] !== 'undefined') {
30037					window['stickySidebar'].updateSticky();
30038				}
30039			})
30040		}
30041	}
30042}
30043
30044InitCustomScrollBar = function (el) {
30045	var block = $('.scrollbar:not(.mobile-scroll)');
30046	if (typeof el !== 'undefined')
30047		block = el;
30048
30049	if (block.length) {
30050		var options,
30051			defaults = {
30052				effect: 'fadeIn',
30053				effectTime: 300,
30054				threshold: 0
30055				// threshold: 30
30056			};
30057
30058		var config = $.extend({}, defaults, options, block.data('plugin-options'));
30059
30060		block.mCustomScrollbar(config);
30061	}
30062}
30063
30064InitOwlSlider = function () {
30065	$('.owl-carousel:not(.owl-loaded):not(.appear-block)').each(function () {
30066		var slider = $(this);
30067		var options;
30068		var svg = '<svg xmlns="http://www.w3.org/2000/svg" width="12" height="6.969" viewBox="0 0 12 6.969"><path id="Rounded_Rectangle_702_copy_24" data-name="Rounded Rectangle 702 copy 24" class="cls-1" d="M361.691,401.707a1,1,0,0,1-1.414,0L356,397.416l-4.306,4.291a1,1,0,0,1-1.414,0,0.991,0.991,0,0,1,0-1.406l5.016-5a1.006,1.006,0,0,1,1.415,0l4.984,5A0.989,0.989,0,0,1,361.691,401.707Z" transform="translate(-350 -395.031)"/></svg>';
30069		var defaults = {
30070			navText: [
30071				'<i class="svg left colored_theme_hover_text">' + svg + '</i>',
30072				'<i class="svg right colored_theme_hover_text">' + svg + '</i>',
30073			]
30074		}
30075		var config = $.extend({}, defaults, options, slider.data('plugin-options'));
30076
30077		slider.on('initialized.owl.carousel', function (event) {
30078
30079			var eventdata = { slider: event };
30080			BX.onCustomEvent('onSliderInitialized', [eventdata]);
30081
30082			$(event.target).removeClass('loading-state');
30083			$(event.target).find('.owl-item:first').addClass('current');
30084
30085			if (typeof (sliceItemBlockSlide) === "function") {
30086				sliceItemBlockSlide();
30087			}
30088
30089		})
30090		slider.owlCarousel(config);
30091
30092		slider.on('change.owl.carousel', function (event) {
30093			var eventdata = { slider: event };
30094			BX.onCustomEvent('onSlideChange', [eventdata]);
30095
30096		})
30097		slider.on('resized.owl.carousel', function (event) {
30098			if (typeof (sliceItemBlockSlide) === "function") {
30099				sliceItemBlockSlide({ resize: false });
30100			}
30101		})
30102
30103
30104
30105		slider.on('changed.owl.carousel', function (event) {
30106			var eventdata = { slider: event };
30107			BX.onCustomEvent('onSlideChanged', [eventdata]);
30108
30109			if ($(event.target).data('pluginOptions')) {
30110				if (('index' in $(event.target).data('pluginOptions'))) {
30111					if ($('.switch-item-block').length) {
30112						$('.switch-item-block__count-wrapper--big .switch-item-block__count-value').text(event.item.index + 1 + '/' + event.item.count);
30113					}
30114				}
30115
30116				if (('relatedTo' in $(event.target).data('pluginOptions'))) {
30117					// console.log(event);
30118
30119					var relatedClass = $(event.target).data('pluginOptions').relatedTo,
30120						relatedBlock = $(relatedClass);
30121
30122					if (relatedBlock.length && $(event.target).data('owl.carousel')) {
30123						// console.log($(event.target).data())
30124						if (!$(event.target).data('owl.carousel').loop) {
30125							var current = event.item.index;
30126						}
30127						else {
30128							var count = event.item.count - 1;
30129							var current = Math.round(event.item.index - (event.item.count / 2) - .5);
30130
30131							if (current < 0)
30132								current = count;
30133
30134							if (current > count)
30135								current = 0;
30136						}
30137
30138						relatedBlock
30139							.find(".owl-item")
30140							.removeClass("current")
30141							.eq(current)
30142							.addClass("current");
30143
30144						var onscreen = relatedBlock.find('.owl-item.active').length - 1;
30145						var start = relatedBlock.find('.owl-item.active').first().index();
30146						var end = relatedBlock.find('.owl-item.active').last().index();
30147
30148
30149						if (current > end)
30150							relatedBlock.data('owl.carousel').to(current, 100, true);
30151
30152						if (current < start)
30153							relatedBlock.data('owl.carousel').to(current - onscreen, 100, true);
30154						// $(".owl-slider-"+id).trigger('to.owl.carousel', [itemCarousel])
30155					}
30156				}
30157			}
30158		})
30159
30160		slider.on('translated.owl.carousel', function (event) {
30161		})
30162
30163		if (('clickTo' in config)) {
30164			var relatedClass = config.clickTo,
30165				magnifier = ('magnifier' in config);
30166
30167			slider.on("click", ".owl-item", function (e) {
30168				e.preventDefault();
30169				var _this = $(this),
30170					number = _this.index();
30171
30172				if (magnifier) {
30173					if ($(relatedClass).closest('.product-container').find('.zoom_picture').length) {
30174						$(relatedClass).closest('.product-container').find('.zoom_picture').attr('data-large', _this.find('.product-detail-gallery__item').data('big'));
30175						$(relatedClass).closest('.product-container').find('.zoom_picture').attr('xoriginal', _this.find('.product-detail-gallery__item').data('big'));
30176						$(relatedClass).closest('.product-container').find('.zoom_picture').attr('src', _this.find('.product-detail-gallery__item img').attr('src'));
30177					}
30178					_this.siblings('').removeClass('current');
30179					_this.addClass('current');
30180				}
30181				else {
30182					$(relatedClass).data('owl.carousel').to(number, 300, true);
30183				}
30184			});
30185		}
30186	});
30187}
30188
30189InitFlexSlider = function () {
30190	// return;
30191	$('.flexslider:not(.thmb):not(.flexslider-init):not(.appear-block)').each(function () {
30192		var slider = $(this);
30193		var options;
30194		var defaults = {
30195			animationLoop: false,
30196			controlNav: false,
30197			keyboard: false,
30198			pauseOnAction: false,
30199			pauseInvisible: false,
30200			directionNav: true,
30201			useCSS: false,
30202			animation: "slide"
30203		}
30204		var config = $.extend({}, defaults, options, slider.data('plugin-options'));
30205		if (!slider.parent().hasClass('top_slider_wrapp') && slider.is(':visible')) {
30206			if (typeof (config.counts) != 'undefined' && config.direction !== 'vertical') {
30207				config.maxItems = getGridSize(config.counts, slider);
30208				config.minItems = getGridSize(config.counts, slider);
30209				config.itemWidth = 200;
30210			}
30211			if (typeof (config.move) == 'undefined')
30212				config.move = 1;
30213
30214			config.start = function (slider) {
30215				var eventdata = { slider: slider };
30216				BX.onCustomEvent('onSlideInit', [eventdata]);
30217			}
30218
30219			config.after = function (slider) {
30220				var eventdata = { slider: slider };
30221				BX.onCustomEvent('onSlideComplete', [eventdata]);
30222			}
30223
30224			config.end = function (slider) {
30225				var eventdata = { slider: slider };
30226				BX.onCustomEvent('onSlideEnd', [eventdata]);
30227			}
30228			slider.flexslider(config).addClass('flexslider-init');
30229			if (config.controlNav)
30230				slider.addClass('flexslider-control-nav');
30231			if (config.directionNav)
30232				slider.addClass('flexslider-direction-nav');
30233		}
30234	});
30235}
30236
30237InitFlexSliderByClass = function ($class) {
30238	if ($class.hasClass('flexslider-init'))
30239		return;
30240	var slider = $class;
30241	var options;
30242	var defaults = {
30243		animationLoop: false,
30244		controlNav: false,
30245		keyboard: false,
30246		pauseOnAction: false,
30247		pauseInvisible: false,
30248		directionNav: true,
30249		useCSS: false,
30250		animation: "slide"
30251	}
30252	var config = $.extend({}, defaults, options, slider.data('plugin-options'));
30253	if (!slider.parent().hasClass('top_slider_wrapp') && slider.is(':visible')) {
30254		if (typeof (config.counts) != 'undefined' && config.direction !== 'vertical') {
30255			config.maxItems = getGridSize(config.counts, slider);
30256			config.minItems = getGridSize(config.counts, slider);
30257			config.itemWidth = 200;
30258		}
30259		if (typeof (config.move) == 'undefined')
30260			config.move = 1;
30261
30262		config.start = function (slider) {
30263			var eventdata = { slider: slider };
30264			BX.onCustomEvent('onSlideInit', [eventdata]);
30265		}
30266
30267		config.after = function (slider) {
30268			var eventdata = { slider: slider };
30269			BX.onCustomEvent('onSlideComplete', [eventdata]);
30270		}
30271
30272		config.end = function (slider) {
30273			var eventdata = { slider: slider };
30274			BX.onCustomEvent('onSlideEnd', [eventdata]);
30275		}
30276
30277		slider.flexslider(config).addClass('flexslider-init');
30278		if (config.controlNav)
30279			slider.addClass('flexslider-control-nav');
30280		if (config.directionNav)
30281			slider.addClass('flexslider-direction-nav');
30282	}
30283}
30284
30285inIframe = function () {
30286	try {
30287		return window.self !== window.top;
30288	} catch (e) {
30289		return true;
30290	}
30291}
30292
30293InitZoomPict = function (el) {
30294	var block = $('.zoom_picture');
30295	if (typeof el !== 'undefined')
30296		block = el;
30297	if (block.length) {
30298		var zoomer = block,
30299			options,
30300			defaults = {
30301				zoomWidth: 200,
30302				zoomHeight: 200,
30303				adaptive: false,
30304				title: true,
30305				Xoffset: 15,
30306
30307			};
30308		var config = $.extend({}, defaults, options, zoomer.data('plugin-options'));
30309		zoomer.xzoom(config);
30310
30311		block.on('mouseleave', function () {
30312			block.data('xzoom').movezoom(event);
30313		})
30314	}
30315}
30316
30317var arBasketAsproCounters = arStatusBasketAspro = arBasketPrices = {};
30318SetActualBasketFlyCounters = function (sync) {
30319	if (arBasketAsproCounters.DEFAULT == true) {
30320		$.ajax({
30321			url: arAsproOptions['SITE_DIR'] + 'ajax/basket_fly.php',
30322			type: 'post',
30323			success: function (html) {
30324				$('#basket_line .basket_fly').removeClass('loaded').html(html);
30325
30326				if (typeof sync !== 'undefined') {
30327					$.ajax({
30328						type: "GET",
30329						url: arAsproOptions['SITE_DIR'] + "ajax/actualBasket.php",
30330						// data:data,
30331						success: function (data) {
30332							if (!$('.js_ajax').length)
30333								$('body').append('<div class="js_ajax"></div>');
30334							$('.js_ajax').html(data);
30335
30336							setBasketStatusBtn(true);
30337
30338						}
30339					});
30340				}
30341			}
30342		});
30343	}
30344	else {
30345		// insert currency &#8381; by this hack!: $('<div/>').html(arBasketAsproCounters.READY.TITLE).text()
30346		$('.basket_fly .opener .basket_count .count').attr('class', 'count' + (arBasketAsproCounters.READY.COUNT > 0 ? '' : ' empty_items')).find('.items span').text(arBasketAsproCounters.READY.COUNT)
30347		$('.basket_fly .opener .basket_count + a').attr('href', arBasketAsproCounters['READY']['HREF'])
30348		$('.basket_fly .opener .basket_count').attr('title', $('<div/>').html(arBasketAsproCounters.READY.TITLE).text()).attr('class', 'colored_theme_hover_text basket_count small clicked' + (arBasketAsproCounters.READY.COUNT > 0 ? '' : ' empty'))
30349
30350		$('.basket_fly .opener .wish_count .count').attr('class', 'count' + (arBasketAsproCounters.DELAY.COUNT > 0 ? '' : ' empty_items')).find('.items span').text(arBasketAsproCounters.DELAY.COUNT)
30351		$('.basket_fly .opener .wish_count + a').attr('href', arBasketAsproCounters.DELAY.HREF)
30352		$('.basket_fly .opener .wish_count').attr('title', $('<div/>').html(arBasketAsproCounters.DELAY.TITLE).text()).attr('class', 'colored_theme_hover_text wish_count small clicked' + (arBasketAsproCounters.DELAY.COUNT > 0 ? '' : ' empty'))
30353
30354		$('.basket_fly .opener .compare_count .wraps_icon_block').attr('class', 'wraps_icon_block compare' + (arBasketAsproCounters.COMPARE.COUNT > 0 ? '' : ' empty_block'));
30355		$('.basket_fly .opener .compare_count .count').attr('class', 'count' + (arBasketAsproCounters.COMPARE.COUNT > 0 ? '' : ' empty_items')).find('.items span').text(arBasketAsproCounters.COMPARE.COUNT)
30356		$('.basket_fly .opener .compare_count + a').attr('href', arBasketAsproCounters.COMPARE.HREF)
30357
30358	}
30359}
30360
30361CheckHeaderFixed = function () {
30362	var header_fixed = $('#headerfixed');
30363	header = $('header').first();
30364	if (header_fixed.length) {
30365		if (header.length) {
30366			var isHeaderFixed = false,
30367				isTabsFixed = false,
30368				headerCanFix = true,
30369				headerFixedHeight = header_fixed.actual('outerHeight'),
30370				headerNormalHeight = header.actual('outerHeight'),
30371				headerDiffHeight = headerNormalHeight - headerFixedHeight,
30372				mobileBtnMenu = $('.btn.btn-responsive-nav'),
30373				headerTop = $('#panel:visible').actual('outerHeight');
30374			topBlock = $('.TOP_HEADER').first();
30375
30376			if (headerDiffHeight <= 0)
30377				headerDiffHeight = 0;
30378			if (topBlock.length)
30379				headerTop += topBlock.actual('outerHeight');
30380
30381			$(window).scroll(function () {
30382				var tabs_fixed = $('.product-item-detail-tabs-container-fixed');
30383				if (window.matchMedia('(min-width:992px)').matches) {
30384					var scrollTop = $(window).scrollTop();
30385					headerCanFix = !mobileBtnMenu.is(':visible')/* && !$('.dropdown-menu:visible').length*/;
30386
30387					var tabs = $('.ordered-block .nav.nav-tabs');
30388
30389					var current_is = $('.search-wrapper .search-input:visible'),
30390						title_search_result = $('.title-search-result.' + current_is.attr('id')),
30391						pos, pos_input;
30392
30393					if (!isHeaderFixed) {
30394						if ((scrollTop > headerNormalHeight + headerTop) && headerCanFix) {
30395							isHeaderFixed = true;
30396							// header_fixed.css('top', '-' + headerNormalHeight + 'px');
30397							header_fixed.addClass('fixed');
30398							// header_fixed.stop(0).animate({top: '0'}, 300);
30399
30400							/*header_fixed.animate({top: '0'}, {duration:300, complete:
30401								function(){}
30402							});*/
30403
30404							if ($('nav.mega-menu.sliced').length)
30405								$('nav.mega-menu.sliced').removeClass('initied');
30406							CheckTopMenuDotted();
30407						}
30408					}
30409					else if (isHeaderFixed || !headerCanFix) {
30410						if ((scrollTop <= headerDiffHeight + headerTop) || !headerCanFix) {
30411							isHeaderFixed = false;
30412							header_fixed.removeClass('fixed');
30413						}
30414					}
30415					//fixed tabs
30416					if (tabs_fixed.length && tabs.length) {
30417						var tabs_offset = $('.ordered-block .nav.nav-tabs').offset();
30418						if (scrollTop + headerFixedHeight > tabs_offset.top) {
30419							tabs_fixed.css({ 'top': header_fixed.actual('outerHeight') });
30420							tabs_fixed.addClass('fixed');
30421
30422							header_fixed.addClass('tabs-fixed');
30423						}
30424						else if (tabs_fixed.hasClass('fixed')) {
30425							tabs_fixed.removeAttr('style');
30426							tabs_fixed.removeClass('fixed');
30427
30428							header_fixed.removeClass('tabs-fixed');
30429						}
30430					}
30431				}
30432			});
30433		}
30434	}
30435
30436	//mobile fixed
30437	var mfixed = $('.wrapper1.mfixed_Y #mobileheader');
30438	if (mfixed.length && isMobile) {
30439		var isMHeaderFixed = false,
30440			mheaderCanFix = true,
30441			//mheaderFixedHeight = mfixed.actual('outerHeight'),
30442			mheaderFixedHeight = 0,
30443			mheaderTop = $('#panel:visible').actual('outerHeight');
30444		$(window).scroll(function () {
30445			var scrollTop = $(window).scrollTop();
30446			if (window.matchMedia('(max-width:991px)').matches) {
30447				if ($('.wrapper1.mfixed_Y.mfixed_view_scroll_top #mobileheader').length) {
30448					if (scrollTop > startScroll) {
30449						if (!$("#mobilePhone.show").length) {
30450							$('.wrapper1.mfixed_Y.mfixed_view_scroll_top #mobileheader').removeClass('fixed');
30451						}
30452					}
30453					else if (scrollTop > mheaderFixedHeight + mheaderTop) {
30454						$('.wrapper1.mfixed_Y.mfixed_view_scroll_top #mobileheader').addClass('fixed');
30455					}
30456					else if (scrollTop <= mheaderFixedHeight + mheaderTop) {
30457						$('.wrapper1.mfixed_Y.mfixed_view_scroll_top #mobileheader').removeClass('fixed');
30458					}
30459					startScroll = scrollTop;
30460				}
30461				else {
30462					if (!isMHeaderFixed) {
30463						if ((scrollTop > mheaderFixedHeight + mheaderTop)) {
30464							isMHeaderFixed = true;
30465							mfixed.addClass('fixed');
30466						}
30467					}
30468					else if (isMHeaderFixed) {
30469						if ((scrollTop <= mheaderFixedHeight + mheaderTop)) {
30470							isMHeaderFixed = false;
30471							mfixed.removeClass('fixed');
30472						}
30473					}
30474				}
30475			}
30476			else
30477				mfixed.removeClass('fixed');
30478		})
30479	}
30480}
30481
30482CheckHeaderFixedMenu = function () {
30483	if (arAsproOptions['THEME']['HEADER_FIXED'] == 2 && $('#headerfixed .js-nav').length && window.matchMedia('(min-width: 992px)').matches) {
30484		$('#headerfixed .js-nav').css('width', '0');
30485		var all_width = 0,
30486			cont_width = $('#headerfixed .maxwidth-theme').actual('width'),
30487			padding_menu = $('#headerfixed .logo-row.v2 .menu-block').actual('outerWidth') - $('#headerfixed .logo-row.v2 .menu-block').actual('width');
30488		$('#headerfixed .logo-row.v2 > .inner-table-block').each(function () {
30489			if (!$(this).hasClass('menu-block'))
30490				all_width += $(this).actual('outerWidth');
30491		})
30492		$('#headerfixed .js-nav').width(cont_width - all_width - padding_menu);
30493	}
30494}
30495
30496CheckSearchWidth = function () {
30497	if ($('.logo_and_menu-row .search_wrap').length) {
30498		var searchPosition = $('.logo_and_menu-row .search_wrap').position().left,
30499			maxWidth = $('.logo_and_menu-row .maxwidth-theme').width() - 2;
30500		width = 0;
30501		if ($('.logo_and_menu-row .subtop .search_wrap').length) {
30502			maxWidth = $('.logo_and_menu-row .subtop').width() - 2;
30503			$('.logo_and_menu-row .subtop > .row >div >div').each(function () {
30504				if (!$(this).hasClass('search_wrap')) {
30505					var elementWidth = $(this).outerWidth();
30506					if (!$(this).is(':visible') || !$(this).height())
30507						elementWidth = 0;
30508					width = (width ? width - elementWidth : maxWidth - elementWidth);
30509				}
30510			}).promise().done(function () {
30511				if ($('.logo_and_menu-row .search_wrap.wide_search').length)
30512					$('.logo_and_menu-row .search_wrap .search-block').outerWidth(width);
30513				else
30514					$('.logo_and_menu-row .search_wrap').outerWidth(width);
30515				$('.logo_and_menu-row .search_wrap').css({ 'opacity': 1, 'visibility': 'visible' });
30516			});
30517		}
30518		else {
30519			if ($('.logo_and_menu-row .subbottom .search_wrap').length) {
30520				maxWidth = $('.logo_and_menu-row .subbottom').width() - 2;
30521				$('.logo_and_menu-row .subbottom >div').each(function () {
30522					if (!$(this).hasClass('search_wrap')) {
30523						var elementWidth = $(this).outerWidth();
30524						if (!$(this).is(':visible') || !$(this).height())
30525							elementWidth = 0;
30526						width = (width ? width - elementWidth : maxWidth - elementWidth);
30527					}
30528				}).promise().done(function () {
30529					if ($('.logo_and_menu-row .search_wrap.wide_search').length)
30530						$('.logo_and_menu-row .search_wrap .search-block').outerWidth(width);
30531					else
30532						$('.logo_and_menu-row .search_wrap').outerWidth(width);
30533					$('.logo_and_menu-row .search_wrap').css({ 'opacity': 1, 'visibility': 'visible' });
30534				});
30535			}
30536			else {
30537				$('.logo_and_menu-row .maxwidth-theme > .row >div >div').each(function () {
30538					if (!$(this).hasClass('search_wrap')) {
30539						var elementWidth = $(this).outerWidth();
30540						if (!$(this).is(':visible') || !$(this).height())
30541							elementWidth = 0;
30542						width = (width ? width - elementWidth : maxWidth - elementWidth);
30543					}
30544				}).promise().done(function () {
30545					if ($('.logo_and_menu-row .search_wrap.wide_search').length)
30546						$('.logo_and_menu-row .search_wrap .search-block').outerWidth(width);
30547					else
30548						$('.logo_and_menu-row .search_wrap').outerWidth(width);
30549					$('.logo_and_menu-row .search_wrap').css({ 'opacity': 1, 'visibility': 'visible' });
30550				});
30551			}
30552		}
30553	}
30554}
30555
30556scrollPreviewBlock = function () {
30557	if (typeof ($.cookie('scroll_block')) != 'undefined' && $.cookie('scroll_block')) {
30558		var scroll_block = $($.cookie('scroll_block'));
30559		if (scroll_block.length) {
30560			$('body, html').animate({ scrollTop: scroll_block.offset().top }, 500);
30561		}
30562		$.cookie('scroll_block', null);
30563	}
30564}
30565
30566scrollToBlock = function (block) {
30567	if ($(block).length) {
30568		var offset = $(block).offset().top;
30569		if (typeof ($(block).data('toggle')) != 'undefined')
30570			$(block).click();
30571
30572		if (typeof ($(block).data('offset')) != 'undefined')
30573			offset += $(block).data('offset');
30574
30575		$('body, html').animate({ scrollTop: offset }, 500);
30576	}
30577}
30578
30579checkMenuLines = function () {
30580	if ($('.front_page .menu-row .left_border').length || $('.front_page .menu-row .right_border').length) {
30581		var positionMenu = ($('.centered .menu-row .mega-menu table').length ? $('.centered .menu-row .mega-menu table').offset().left : 0),
30582			varFixLineWidth = ($('body').hasClass('with_decorate') && window.matchMedia('(min-width: 1100px)').matches ? 126 : 7);
30583
30584		$('.menu-row .left_border, .menu-row .right_border').css('width', positionMenu - varFixLineWidth);
30585	}
30586}
30587
30588SetFixedAskBlock = function () {
30589	if ($('.ask_a_question_wrapper').length) {
30590		var offset = $('.ask_a_question_wrapper').offset(),
30591			footer_offset = 0,
30592			block = $('.ask_a_question_wrapper').find('.ask_a_question'),
30593			block_offset = BX.pos(block[0]),
30594			block_height = block_offset.bottom - block_offset.top,
30595			diff_top_scroll = $('#headerfixed').height() + 20;
30596
30597		if ($('footer').length)
30598			footer_offset = $('footer').offset().top;
30599
30600		if ($('.banner.CONTENT_BOTTOM').length)
30601			footer_offset = $('.banner.CONTENT_BOTTOM').offset().top;
30602
30603		/* removed for ISSUE NEXT-414
30604		if(block_height+130 > block.closest('.fixed_wrapper').height())
30605			block.addClass('nonfixed');
30606		else
30607			block.removeClass('nonfixed');
30608		*/
30609
30610		if (block_height + diff_top_scroll + documentScrollTopLast + 130 > footer_offset) {
30611			block.removeClass('fixed').css({ 'top': 'auto', 'width': 'auto', 'bottom': 0 });
30612			block.parent().css('position', 'static');
30613			block.parent().parent().css('position', 'static');
30614		}
30615		else {
30616			block.parent().removeAttr('style');
30617			block.parent().parent().removeAttr('style');
30618
30619			if (documentScrollTopLast + diff_top_scroll > offset.top) {
30620				var fixed_width = $('.fixed_block_fix').width();
30621				block.addClass('fixed').css({ 'top': diff_top_scroll, 'bottom': 'auto' });
30622				if (fixed_width)
30623					block.css({ 'width': $('.fixed_block_fix').width() })
30624			}
30625			else
30626				block.removeClass('fixed').css({ 'top': 0, 'width': 'auto' });
30627		}
30628	}
30629}
30630
30631MegaMenuFixed = function () {
30632	var animationTime = 150;
30633
30634	$('header .burger, #headerfixed .burger').on('click', function () {
30635		$('.mega_fixed_menu').fadeIn(animationTime);
30636		//$('.header_wrap').toggleClass('zindexed');
30637		$('.mega_fixed_menu').mCustomScrollbar({
30638			mouseWheel: {
30639				scrollAmount: 150,
30640				preventDefault: true
30641			}
30642		});
30643	});
30644
30645	$('.mega_fixed_menu .svg.svg-close').on('click', function () {
30646		$(this).closest('.mega_fixed_menu').fadeOut(animationTime);
30647		//$('.header_wrap').toggleClass('zindexed');
30648	});
30649
30650	$('.mega_fixed_menu .dropdown-menu .arrow').on('click', function (e) {
30651		e.preventDefault();
30652		e.stopPropagation();
30653		$(this).closest('.dropdown-submenu').find('.dropdown-menu').slideToggle(animationTime);
30654		$(this).closest('.dropdown-submenu').addClass('opened');
30655	});
30656}
30657
30658CheckPopupTop = function () {
30659	// var popup = $('.jqmWindow.show:last');
30660	// if(!popup.length)
30661	// 	popup = $('.jqmWindow.show');
30662	// if(!popup.length)
30663	// 	popup = $('.jqm-init.show');
30664	// if(popup.length){
30665	// 	var documentScollTop = $(document).scrollTop();
30666	// 	var windowHeight = $(window).height();
30667	// 	var popupTop = parseInt(popup.css('top'));
30668	// 	var popupHeight = popup.height();
30669
30670	// 	if(windowHeight >= popupHeight){
30671	// 		// center
30672	// 		popupTop = (windowHeight - popupHeight) / 2;
30673	// 	}
30674	// 	else{
30675	// 		if(documentScollTop > documentScrollTopLast){
30676	// 			// up
30677	// 			popupTop -= documentScollTop - documentScrollTopLast;
30678	// 		}
30679	// 		else if(documentScollTop < documentScrollTopLast){
30680	// 			// down
30681	// 			popupTop += documentScrollTopLast - documentScollTop;
30682	// 		}
30683
30684	// 		if(popupTop + popupHeight < windowHeight){
30685	// 			// bottom
30686	// 			popupTop = windowHeight - popupHeight;
30687	// 		}
30688	// 		else if(popupTop > 0){
30689	// 			// top
30690	// 			popupTop = 0;
30691	// 		}
30692	// 	}
30693	// 	popup.css('top', popupTop + 'px');
30694	// }
30695}
30696
30697AjaxClickLink = function (e) {
30698	var _this = '',
30699		container = $('.js-load-wrapper'),
30700		container_inner = $('.js-load-wrapper').find('.ajax_load'),
30701		dopAction = '';
30702	url = '';
30703	if ('preventDefault' in e) {
30704		e.preventDefault();
30705		_this = ($(e.target).hasClass('js-load-link') ? $(e.target) : $(e.target).closest('.js-load-link'))
30706	}
30707	else {
30708		_this = $(e);
30709		dopAction = 'Y';
30710	}
30711
30712	if (container.length) {
30713		var objUrl = parseUrlQuery(),
30714			obGetData = { "ajax_get_filter": "Y", "control_ajax": "Y" };
30715
30716		obGetData.bitrix_include_areas = 'N';
30717
30718		if ('clear_cache' in objUrl) {
30719			if (objUrl.clear_cache == 'Y') {
30720				obGetData.clear_cache = 'Y';
30721			}
30722		}
30723
30724		if (container_inner.length)
30725			container_inner.addClass('loading-state');
30726		else
30727			container.addClass('loading-state');
30728
30729		if (_this.data('url'))
30730			url = _this.data('url');
30731
30732		if (dopAction) {
30733			BX.PopupWindowManager.getCurrentPopup().close();
30734			$('.bx_filter_select_popup ul li .sort_btn').removeClass('current');
30735			_this.addClass('current');
30736			_this.closest('.bx_filter_block').find('.bx_filter_select_text').text(_this.text());
30737		}
30738
30739		$('.bx_filter .bx_sort_filter .bx_filter_select_text').text(_this.text());
30740		$('.bx_filter .bx_sort_filter .bx_filter_select_popup ul li span.current').removeClass('current');
30741		$('.bx_filter .bx_sort_filter .bx_filter_select_popup ul li').eq(_this.parent().index()).find('span').addClass('current');
30742
30743		$.ajax({
30744			url: url,
30745			data: obGetData,
30746			success: function (html) {
30747				container.html(html);
30748
30749				if (container_inner.length)
30750					container_inner.removeClass('loading-state');
30751				else
30752					container.removeClass('loading-state');
30753
30754				initAnimateLoad();
30755
30756				var eventdata = { action: 'jsLoadBlock' }
30757				BX.onCustomEvent('onCompleteAction', [eventdata, _this]);
30758
30759				initSelects(document);
30760				InitCustomScrollBar();
30761				InitScrollBar();
30762
30763				if (window.FilterHelper !== undefined) {
30764					FilterHelper.resultDiv = $('#filter-helper');
30765					FilterHelper.show();
30766				}
30767
30768			}
30769		})
30770
30771	}
30772}
30773
30774initCalculatePreview = function () {
30775	$('.calculate-delivery.with_preview:not(.inited)').each(function () {
30776		var $this = $(this);
30777		var $calculateSpan = $this.find('span[data-event=jqm]');
30778		var $preview = $this.find('.calculate-delivery-preview');
30779
30780		$this.addClass('inited');
30781		$this.appear(function () {
30782
30783			if ($calculateSpan.length) {
30784				if (typeof window['calculate-delivery-preview-index'] === 'undefined') {
30785					window['calculate-delivery-preview-index'] = 1001;
30786				}
30787				else {
30788					++window['calculate-delivery-preview-index'];
30789				}
30790
30791				var productId = $calculateSpan.attr('data-param-product_id') * 1;
30792				var quantity = $calculateSpan.attr('data-param-quantity') * 1;
30793
30794				if (productId > 0) {
30795					var areaIndexSended = window['calculate-delivery-preview-index'];
30796					$calculateSpan.data({ areaIndex: areaIndexSended });
30797
30798					$.ajax({
30799						url: arAsproOptions['SITE_DIR'] + 'ajax/delivery.php',
30800						type: 'POST',
30801						data: {
30802							is_preview: 'Y',
30803							index: areaIndexSended,
30804							product_id: productId,
30805							quantity: quantity
30806						},
30807						beforeSend: function () {
30808							$this.addClass('loadings');
30809						},
30810						success: function (response) {
30811							var areaIndex = $calculateSpan.data('areaIndex');
30812							if (typeof areaIndex !== 'undefined' && areaIndex == areaIndexSended) {
30813								$calculateSpan.hide();
30814								$preview.html(response);
30815								if (!$preview.find('.catalog-delivery-preview').length) {
30816									$preview.empty();
30817									$calculateSpan.show();
30818								}
30819							}
30820						},
30821						error: function (xhr, ajaxOptions, thrownError) {
30822						},
30823						complete: function () {
30824							var areaIndex = $calculateSpan.data('areaIndex');
30825							if (typeof areaIndex !== 'undefined' && areaIndex == areaIndexSended) {
30826								$this.removeClass('loadings');
30827							}
30828						}
30829					});
30830				}
30831			}
30832
30833		}, { accX: 0, accY: 0 });
30834	});
30835}
30836
30837/*set price item*/
30838if (!funcDefined('setPriceItem')) {
30839	var setPriceItem = function setPriceItem(main_block, quantity, rewrite_price, check_quantity, is_sku, show_percent, percent) {
30840		var old_quantity = main_block.find('.to-cart').attr('data-ratio'),
30841			value = (typeof rewrite_price !== 'undefined' && rewrite_price ? rewrite_price : main_block.find('.to-cart').attr('data-value')),
30842			currency = main_block.find('.to-cart').attr('data-currency'),
30843			total_block = '<div class="total_summ" style="display:none;"><div>
30843' + BX.message('TOTAL_SUMM_ITEM') + '<span></span></div></div>',
30844			price_block = main_block.find('.cost.prices'),
30845			use_percent = (typeof show_percent !== 'undefined' && show_percent == 'Y'),
30846			percent_number = (typeof percent !== 'undefined' && percent),
30847			sku_checked = (main_block.find('.has_offer_prop').length ? 'Y' : 'N'),
30848			check = (typeof check_quantity !== 'undefined' && check_quantity);
30849
30850		if (main_block.find('.counter_wrapp + .wrapp-one-click').length) {
30851			if (!main_block.find('.wrapp-one-click .total_summ').length && !is_sku)
30852				$(total_block).appendTo(main_block.find('.counter_wrapp + .wrapp-one-click'))
30853		}
30854		else if (main_block.find('.buy_block').length) {
30855			if (!main_block.find('.buy_block .total_summ').length && !is_sku)
30856				$(total_block).appendTo(main_block.find('.buy_block'))
30857		}
30858		else if (main_block.find('.counter_wrapp').length) {
30859			if (!main_block.find('.counter_wrapp .total_summ').length && !is_sku)
30860				$(total_block).appendTo(main_block.find('.counter_wrapp:first'))
30861		}
30862		if (main_block.find('.total_summ').length) {
30863			if (value && currency) {
30864				if ((1 == quantity && old_quantity == quantity) || (typeof is_sku !== 'undefined' && is_sku && !check)) {
30865					main_block.find('.total_summ').slideUp(50);
30866				}
30867				else {
30868					main_block.find('.total_summ span').html(BX.Currency.currencyFormat((value * quantity), currency, true));
30869					if (main_block.find('.total_summ').is(':hidden')/* || sku_checked == 'Y'*/)
30870						main_block.find('.total_summ').slideDown(100);
30871				}
30872			}
30873			else {
30874				main_block.find('.total_summ').slideUp(100);
30875			}
30876		}
30877	}
30878}
30879
30880if (!funcDefined('getCurrentPrice')) {
30881	var getCurrentPrice = function getCurrentPrice(price, currency, print_price) {
30882		var val = '';
30883		var format_value = BX.Currency.currencyFormat(price, currency);
30884		if (print_price.indexOf(format_value) >= 0) {
30885			val = print_price.replace(format_value, '<span class="price_value">' + format_value + '</span><span class="price_currency">');
30886			val += '</span>';
30887		}
30888		else {
30889			val = print_price;
30890		}
30891
30892		return val;
30893	}
30894}
30895
30896if (!funcDefined('initAnimateLoad')) {
30897	var initAnimateLoad = function initAnimateLoad() {
30898		$('.animate-load').click(function () {
30899			if (!jQuery.browser.mobile) {
30900				$(this).parent().addClass('loadings');
30901			}
30902		})
30903	}
30904}
30905
30906$(document).ready(function () {
30907	//check width for menu and search
30908	CheckSearchWidth();
30909	MegaMenuFixed();
30910	InitScrollBar();
30911
30912
30913	/*ripple effect for buttons*/
30914	/*$.ripple(".btn", {
30915		debug: false, // Turn Ripple.js logging on/off
30916		on: 'mouseenter', // The event to trigger a ripple effect
30917
30918		opacity: 0.4, // The opacity of the ripple
30919		color: "auto", // Set the background color. If set to "auto", it will use the text color
30920		multi: true, // Allow multiple ripples per element
30921
30922		duration: 0.6, // The duration of the ripple
30923
30924		easing: 'linear' // The CSS3 easing function of the ripple
30925	});*/
30926	/**/
30927
30928	//ecommerce order
30929	if (arAsproOptions["PAGES"]["ORDER_PAGE"]) {
30930		var arUrl = parseUrlQuery();
30931		if ("ORDER_ID" in arUrl) {
30932			var _id = arUrl["ORDER_ID"];
30933			if (arAsproOptions['COUNTERS']['USE_FULLORDER_GOALS'] !== 'N') {
30934				var eventdata = { goal: 'goal_order_success', result: _id };
30935				BX.onCustomEvent('onCounterGoals', [eventdata])
30936			}
30937			if (checkCounters()) {
30938				if (typeof localStorage !== 'undefined') {
30939					var val = localStorage.getItem('gtm_e_' + _id),
30940						d = '';
30941					try {
30942						d = JSON.parse(val);
30943					}
30944					catch (e) {
30945						d = val
30946					}
30947					if (typeof d === 'object') {
30948						window.dataLayer = window.dataLayer || [];
30949						dataLayer.push({ "event": arAsproOptions["COUNTERS"]['GOOGLE_EVENTS']['PURCHASE'], "ecommerce": d });
30950					}
30951
30952					if (typeof localStorage !== 'undefined') {
30953						localStorage.removeItem('gtm_e_' + _id);
30954					}
30955				}
30956			}
30957		}
30958	}
30959	var bSafary = false;
30960	if (typeof jQuery.browser == 'object')
30961		bSafary = jQuery.browser.safari;
30962	else if (typeof browser == 'object')
30963		bSafary = browser.safari;
30964	if (!bSafary) {
30965		CheckTopMenuPadding();
30966		CheckTopMenuOncePadding();
30967		CheckTopMenuDotted();
30968		CheckHeaderFixed();
30969		checkMenuLines();
30970		setTimeout(function () { $(window).resize(); }, 150); // need to check resize flexslider & menu
30971		setTimeout(function () { $(window).scroll(); }, 250); // need to check position fixed ask block
30972	}
30973	else {
30974		setTimeout(function () {
30975			$(window).resize(); // need to check resize flexslider & menu
30976			setTimeout(function () {
30977				CheckTopMenuPadding();
30978				CheckTopMenuOncePadding();
30979				CheckTopMenuDotted();
30980				CheckHeaderFixed();
30981				checkMenuLines();
30982
30983				setTimeout(function () {
30984					$(window).scroll();
30985				}, 50);
30986			}, 50);
30987		}, 350);
30988	}
30989
30990
30991	/*for filter scrol in mobile*/
30992	/*if(window.matchMedia('(min-width: 768px)').matches){
30993		$('.bx_filter .scrollbar').removeClass('mobile-scroll');
30994		$('.bx_filter .srollbar-custom').removeClass('mobile-scroll');
30995		$('.bx_filter .bx_filter_section form .bx_filter_parameters').removeClass('mobile-scroll');
30996		InitScrollBar();
30997		InitCustomScrollBar();
30998
30999	}*/
31000
31001	if (window.matchMedia('(max-width: 767px)').matches) {
31002		$('.bx_filter .scrollbar').addClass('mobile-scroll');
31003		$('.bx_filter .srollbar-custom').addClass('mobile-scroll');
31004		$('.bx_filter .bx_filter_section form .bx_filter_parameters').addClass('mobile-scroll');
31005		if ($('.bx_filter .mobile-scroll.scrollbar').length)
31006			$('.bx_filter .mobile-scroll.scrollbar').mCustomScrollbar("destroy");
31007		if ($('.bx_filter .mobile-scroll.srollbar-custom').length)
31008			$('.bx_filter .mobile-scroll.srollbar-custom').mCustomScrollbar("destroy");
31009	}
31010	/**/
31011
31012
31013	if (arAsproOptions['THEME']['USE_DEBUG_GOALS'] === 'Y')
31014		$.cookie('_ym_debug', 1, { path: '/', });
31015	else
31016		$.cookie('_ym_debug', null, { path: '/', });
31017
31018	/* change type2 menu for fixed */
31019	if ($('#headerfixed .js-nav').length) {
31020		if (arAsproOptions['THEME']['HEADER_FIXED'] == 2)
31021			CheckHeaderFixedMenu();
31022
31023		setTimeout(function () {
31024			$('#headerfixed .js-nav').addClass('opacity1');
31025		}, 350);
31026	}
31027
31028	// -- scroll after apply option
31029	if ($('.instagram_ajax').length) {
31030		BX.addCustomEvent('onCompleteAction', function (eventdata) {
31031			if (eventdata.action === 'instagrammLoaded')
31032				scrollPreviewBlock();
31033		});
31034	}
31035	else
31036		scrollPreviewBlock();
31037
31038
31039	scrollToTop();
31040	checkVerticalMobileFilter();
31041
31042	$.extend($.validator.messages, {
31043		required: BX.message('JS_REQUIRED'),
31044		email: BX.message('JS_FORMAT'),
31045		equalTo: BX.message('JS_PASSWORD_COPY'),
31046		minlength: BX.message('JS_PASSWORD_LENGTH'),
31047		remote: BX.message('JS_ERROR')
31048	});
31049
31050	$.validator.addMethod(
31051		'regexp', function (value, element, regexp) {
31052			var re = new RegExp(regexp);
31053			return this.optional(element) || re.test(value);
31054		},
31055		BX.message('JS_FORMAT')
31056	);
31057
31058	$.validator.addMethod(
31059		'filesize', function (value, element, param) {
31060			return this.optional(element) || (element.files[0].size <= param)
31061		},
31062		BX.message('JS_FILE_SIZE')
31063	);
31064
31065	$.validator.addMethod(
31066		'date', function (value, element, param) {
31067			var status = false;
31068			if (!value || value.length <= 0) {
31069				status = false;
31070			}
31071			else {
31072				// html5 date allways yyyy-mm-dd
31073				var re = new RegExp('^([0-9]{4})(.)([0-9]{2})(.)([0-9]{2})$');
31074				var matches = re.exec(value);
31075				if (matches) {
31076					var composedDate = new Date(matches[1], (matches[3] - 1), matches[5]);
31077					status = ((composedDate.getMonth() == (matches[3] - 1)) && (composedDate.getDate() == matches[5]) && (composedDate.getFullYear() == matches[1]));
31078				}
31079				else {
31080					// firefox
31081					var re = new RegExp('^([0-9]{2})(.)([0-9]{2})(.)([0-9]{4})$');
31082					var matches = re.exec(value);
31083					if (matches) {
31084						var composedDate = new Date(matches[5], (matches[3] - 1), matches[1]);
31085						status = ((composedDate.getMonth() == (matches[3] - 1)) && (composedDate.getDate() == matches[1]) && (composedDate.getFullYear() == matches[5]));
31086					}
31087				}
31088			}
31089			return status;
31090		}, BX.message('JS_DATE')
31091	);
31092
31093	$.validator.addMethod(
31094		'extension', function (value, element, param) {
31095			param = typeof param === 'string' ? param.replace(/,/g, '|') : 'png|jpe?g|gif';
31096			return this.optional(element) || value.match(new RegExp('.(' + param + ')$', 'i'));
31097		}, BX.message('JS_FILE_EXT')
31098	);
31099
31100	$.validator.addMethod(
31101		'captcha', function (value, element, params) {
31102			return $.validator.methods.remote.call(this, value, element, {
31103				url: arAsproOptions['SITE_DIR'] + 'ajax/check-captcha.php',
31104				type: 'post',
31105				data: {
31106					captcha_word: value,
31107					captcha_sid: function () {
31108						return $(element).closest('form').find('input[name="captcha_sid"]').val();
31109					}
31110				}
31111			});
31112		},
31113		BX.message('JS_ERROR')
31114	);
31115
31116	$.validator.addMethod(
31117		'recaptcha', function (value, element, param) {
31118			var id = $(element).closest('form').find('.g-recaptcha').attr('data-widgetid');
31119			if (typeof id !== 'undefined') {
31120				return grecaptcha.getResponse(id) != '';
31121			}
31122			else {
31123				return true;
31124			}
31125		}, BX.message('JS_RECAPTCHA_ERROR')
31126	);
31127
31128	$.validator.addClassRules({
31129		'phone': {
31130			regexp: arAsproOptions['THEME']['VALIDATE_PHONE_MASK']
31131		},
31132		'confirm_password': {
31133			equalTo: 'input[name="REGISTER\[PASSWORD\]"]',
31134			minlength: 6
31135		},
31136		'password': {
31137			minlength: 6
31138		},
31139		'inputfile': {
31140			extension: arAsproOptions['THEME']['VALIDATE_FILE_EXT'],
31141			filesize: 5000000
31142		},
31143		'captcha': {
31144			captcha: ''
31145		},
31146		'recaptcha': {
31147			recaptcha: ''
31148		}
31149	});
31150
31151	if (arAsproOptions['THEME']['PHONE_MASK']) {
31152		$('input.phone').inputmask('mask', { 'mask': arAsproOptions['THEME']['PHONE_MASK'] });
31153	}
31154
31155	// init calculate delivery with preview
31156	initCalculatePreview();
31157
31158	/*city*/
31159	$('select.region').on('change', function () {
31160		var val = parseInt($(this).val());
31161		if ($('select.city').length) {
31162			if (val) {
31163				$('select.city option').hide();
31164				$('select.city option').prop('disabled', 'disabled');
31165				$('select.city option[data-parent_section=' + val + ']').prop('disabled', '');
31166				$('select.city option:eq(0)').prop('disabled', '');
31167				$('select.city').ikSelect('reset');
31168				$('select.city option[data-parent_section=' + val + ']').show();
31169			}
31170			else
31171				$('select.city option').prop('disabled', 'disabled');
31172			$('select.city option:eq(0)').prop('disabled', '');
31173			$('select.city').ikSelect('reset');
31174		}
31175	})
31176
31177	$('select.city, select.region').on('change', function () {
31178		var _this = $(this),
31179			val = parseInt(_this.val());
31180		if (_this.hasClass('region')) {
31181			$('select.city option:eq(0)').show();
31182			$('select.city').val(0);
31183		}
31184
31185		if ((_this.hasClass('region') && !val) || _this.hasClass('city')) {
31186			$.ajax({
31187				type: 'POST',
31188				data: { ID: val },
31189			}).success(function (html) {
31190				var ob = BX.processHTML(html);
31191				$('.ajax_items')[0].innerHTML = ob.HTML;
31192				BX.ajax.processScripts(ob.SCRIPT);
31193			})
31194		}
31195	})
31196
31197	$(document).on('mouseenter', '.section-gallery-wrapper .section-gallery-wrapper__item', function () {
31198		$(this).siblings().removeClass('_active');
31199		$(this).addClass('_active');
31200	})
31201
31202	$('.mobile_regions .city_item').on('click', function (e) {
31203		e.preventDefault();
31204		var _this = $(this);
31205		$.removeCookie('current_region');
31206		$.cookie('current_region', _this.data('id'), { path: '/', domain: arAsproOptions['SITE_ADDRESS'] });
31207		location.href = _this.attr('href');
31208	})
31209
31210	/* toggle */
31211	var $this = this,
31212		previewParClosedHeight = 25;
31213
31214	$('section.toggle >
31214 label').prepend($('<i />').addClass('fa fa-plus'));
31215	$('section.toggle > label').prepend($('<i />').addClass('fa fa-minus'));
31216	$('section.toggle.active > p').addClass('preview-active');
31217	$('section.toggle.active > div.toggle-content').slideDown(350, function () { });
31218
31219	$('section.toggle > label').click(function (e) {
31220		var parentSection = $(this).parent(),
31221			parentWrapper = $(this).parents('div.toogle'),
31222			previewPar = false,
31223			isAccordion = parentWrapper.hasClass('toogle-accordion');
31224
31225		if (isAccordion && typeof (e.originalEvent) != 'undefined') {
31226			parentWrapper.find('section.toggle.active > label').trigger('click');
31227		}
31228
31229		parentSection.toggleClass('active');
31230
31231		// Preview Paragraph
31232		if (parentSection.find('> p').get(0)) {
31233			previewPar = parentSection.find('> p');
31234			var previewParCurrentHeight = previewPar.css('height');
31235			previewPar.css('height', 'auto');
31236			var previewParAnimateHeight = previewPar.css('height');
31237			previewPar.css('height', previewParCurrentHeight);
31238		}
31239
31240		// Content
31241		var toggleContent = parentSection.find('> div.toggle-content');
31242
31243		if (parentSection.hasClass('active')) {
31244			$(previewPar).animate({
31245				height: previewParAnimateHeight
31246			}, 350, function () {
31247				$(this).addClass('preview-active');
31248			});
31249			toggleContent.slideDown(350, function () { });
31250		}
31251		else {
31252			$(previewPar).animate({
31253				height: previewParClosedHeight
31254			}, 350, function () {
31255				$(this).removeClass('preview-active');
31256			});
31257			toggleContent.slideUp(350, function () { });
31258		}
31259	});
31260
31261	$('.tables-responsive .responsive').footable(); //responsive table
31262
31263	$('a[rel=tooltip]').tooltip();
31264	$('span[data-toggle=tooltip]').tooltip();
31265
31266	$('.toggle .more_items').on('click', function () {
31267		$(this).closest('.toggle').find('.collapsed').css('display', 'inline-block').removeClass('collapsed');
31268		$(this).remove();
31269		if (typeof $(this).data('resize') !== 'undefined' && $(this).data('resize'))
31270			$(window).resize();
31271	})
31272	$('.toggle_menu .more_items').on('click', function () {
31273		$(this).closest('.toggle_menu').find('.collapsed').addClass('clicked_exp');
31274		$(this).remove();
31275	})
31276
31277	/* search sync */
31278	$(document).on('keyup', '.search-input-div input', function (e) {
31279		var inputValue = $(this).val();
31280		$('.search-input-div input:not(:focus').val(inputValue);
31281
31282		if ($(this).closest('#headerfixed').length) {
31283			if (e.keyCode == 13)
31284				$('.search form').submit();
31285		}
31286	});
31287	$(document).on('click', '.search-button-div button', function (e) {
31288		if ($(this).closest('#headerfixed').length)
31289			$('.search form').submit();
31290	});
31291
31292	$('.inline-search-show, .inline-search-hide').on('click', function (e) {
31293		CloseMobilePhone();
31294		// if(window.matchMedia('(min-width: 600px)').matches)
31295		// {
31296		if (typeof ($(this).data('type_search')) != 'undefined' && $(this).data('type_search') == 'fixed')
31297			$('.inline-search-block').addClass('fixed');
31298
31299		if (arAsproOptions['THEME']['TYPE_SEARCH'] == 'fixed') {
31300			/*setTimeout(function(){
31301				$('.inline-search-block.fixed.big .search-input').focus();
31302			}, 200);*/
31303			$('.inline-search-block.fixed.big .search-input').focus();
31304		}
31305		if (arAsproOptions['THEME']['TYPE_SEARCH'] != 'fixed') {
31306			$('#title-search-input').focus();
31307		}
31308
31309		$('.inline-search-block').toggleClass('show');
31310		if ($('.top-block').length) {
31311			if ($('.inline-search-block').hasClass('show'))
31312				$('.inline-search-block').css('background', $('.top-block').css('background-color'));
31313			else
31314				$('.inline-search-block').css('background', '#fff');
31315		}
31316		if (arAsproOptions['THEME']['TYPE_SEARCH'] == 'fixed') {
31317			if ($('.inline-search-block').hasClass('show'))
31318				$('<div class="jqmOverlay search"></div>').appendTo('body');
31319			else {
31320				$('#title-search-input').blur();
31321				$('.jqmOverlay').detach();
31322			}
31323		}
31324		// }
31325		// else
31326		// 	location.href = arAsproOptions['PAGES']['CATALOG_PAGE_URL']+'?q';
31327	})
31328
31329	/* close search block */
31330	$("html, body").on('mousedown', function (e) {
31331		if (typeof e.target.className == 'string' && e.target.className.indexOf('adm') < 0) {
31332			e.stopPropagation();
31333			var search_target = $(e.target).closest('.title-search-result');
31334			if (!$(e.target).hasClass('inline-search-block') && !$(e.target).hasClass('svg') && !search_target.length) {
31335				$('.inline-search-block').removeClass('show');
31336				$('.title-search-result').hide();
31337				if (arAsproOptions['THEME']['TYPE_SEARCH'] == 'fixed')
31338					$('.jqmOverlay.search').detach();
31339			}
31340
31341			if ($("#mobilePhone").length) {
31342				CloseMobilePhone();
31343			}
31344
31345			if ($('#basket_line .basket_fly').length && parseInt($("#basket_line .basket_fly").css("right")) >= 0) {
31346				if (!$(e.target).closest('.basket_wrapp').length) {
31347					$("#basket_line .basket_fly").stop().animate({ "right": -$("#basket_line .basket_fly").outerWidth() }, 150);
31348					$("#basket_line .basket_fly .opener > div").removeClass("cur");
31349					$('#basket_line .basket_fly').removeClass('swiped');
31350				}
31351			}
31352
31353			if (isMobile) {
31354				if (search_target.length)
31355					location.href = search_target.attr('href');
31356			}
31357
31358			if (!$(e.target).closest('.js-info-block').length && !$(e.target).closest('.js-show-info-block').length) {
31359				$('.js-show-info-block').removeClass('opened');
31360				$('.js-info-block').fadeOut();
31361			}
31362
31363			var class_name = $(e.target).attr('class');
31364			if (typeof (class_name) == 'undefined' || class_name.indexOf('tooltip') < 0) //tooltip link
31365				$('.tooltip-link').tooltip('hide');
31366		}
31367	});
31368	$('.inline-search-block').find('*').on('mousedown', function (e) {
31369		e.stopPropagation();
31370	});
31371
31372	initAnimateLoad();
31373
31374	/*check all opt table items*/
31375	$(document).on('change', "input#select_all_items", function () {
31376		var _this = $(this);
31377
31378		var notOfferCount = $('.table-view__item:not([data-product_type=3])').find('.button_block .to-cart').length;
31379		var wishCount = $('.table-view__item:not([data-product_type=3])').find('.item-icons .wish_item_button .wish_item.to').length;
31380		var allGoodsCount = $('.table-view__item').length;
31381
31382		if (_this.is(':checked')) {
31383			//$('.opt_action').removeClass('no-action');
31384
31385			//buy && wish
31386			if (notOfferCount != 0) {
31387				$('.opt_action:not([data-action=compare])').removeClass('no-action');
31388			}
31389
31390			//compare
31391			$('.opt_action[data-action=compare]').removeClass('no-action');
31392
31393
31394			$('.opt_action').addClass('animate-load');
31395			$('.opt_action .text').remove();
31396			//$('<div class="text muted">(<span>'+$('.table-view__item').length+'</span>)</div>').appendTo($('.opt_action'));
31397			//$('<div class="text muted">(<span>' + $('.table-view__item:not([data-product_type=3])').length + '</span>)</div>').appendTo($('.opt_action'));
31398
31399			//buy
31400			$('<div class="text muted">(<span>' + notOfferCount + '</span>)</div>').appendTo($('.opt_action[data-action=buy]'));
31401
31402			//wish
31403			$('<div class="text muted">(<span>' + wishCount + '</span>)</div>').appendTo($('.opt_action[data-action=wish]'));
31404
31405			//compare
31406			$('<div class="text muted">(<span>' + allGoodsCount + '</span>)</div>').appendTo($('.opt_action[data-action=compare]'));
31407
31408
31409			$('input[name="chec_item"]').prop('checked', 'checked');
31410		}
31411		else {
31412			$('.opt_action').addClass('no-action');
31413			$('.opt_action').removeClass('animate-load');
31414			$('.opt_action .text').remove();
31415
31416			$('input[name="chec_item"]').removeAttr('checked');
31417		}
31418	})
31419
31420	/*check opt table item*/
31421	$(document).on('change', "input[name='chec_item']", function () {
31422		var _this = $(this);
31423
31424		var canBuy = _this.closest('.table-view__item').find('.button_block .to-cart').length;
31425		var isOffer = _this.closest('.main_item_wrapper').attr('data-product_type') == '3';
31426		//console.log(isOffer);
31427
31428		if (_this.is(':checked')) {
31429			$('.opt_action').each(function () {
31430				var _this = $(this);
31431
31432				var isBuyAction = _this.attr('data-action') == 'buy';
31433				var isWishAction = _this.attr('data-action') == 'wish';
31434
31435				if (isOffer && (isBuyAction || isWishAction)) {
31436					return true;
31437				}
31438
31439				if (isBuyAction && !canBuy) {
31440					return true;
31441				}
31442
31443				if (_this.find('.text').length) {
31444					var count = parseInt(_this.find('.text span').text());
31445					_this.find('.text span').text(++count);
31446				}
31447				else {
31448					_this.removeClass('no-action');
31449					_this.addClass('animate-load');
31450					$('<div class="text muted">(<span>1</span>)</div>').appendTo(_this);
31451				}
31452			})
31453		}
31454		else {
31455			$('.opt_action').each(function () {
31456				var _this = $(this);
31457
31458				var isBuyAction = _this.attr('data-action') == 'buy';
31459				var isWishAction = _this.attr('data-action') == 'wish';
31460
31461				if (isOffer && (isBuyAction || isWishAction)) {
31462					return true;
31463				}
31464
31465				if (isBuyAction && !canBuy) {
31466					return true;
31467				}
31468
31469				if (_this.find('.text').length) {
31470					var count = parseInt(_this.find('.text span').text());
31471					--count
31472					_this.find('.text span').text(count);
31473
31474					if (!count) {
31475						_this.addClass('no-action');
31476						_this.removeClass('animate-load');
31477						_this.find('.text').remove();
31478					}
31479				}
31480			})
31481		}
31482	})
31483
31484	/*buy|wish|compare opt table items*/
31485	$(document).on('click', ".opt_action", function () {
31486		var _this = $(this),
31487			action = _this.data('action'),
31488			basketParams = {
31489				type: 'multiple',
31490				iblock_id: _this.data('iblock_id'),
31491				action: action,
31492				items: {}
31493			};
31494
31495		if (!_this.hasClass('no-action')) {
31496			$('.opt_action').addClass('no-action');
31497			_this.removeClass('no-action');
31498
31499			$('.table-view__item').each(function () {
31500				var _this = $(this);
31501				var canBuy = _this.find('.button_block .to-cart').length; //console.log(basketParams);
31502				var add = _this.find('input[name="chec_item"]').is(':checked') && (canBuy || (action != "buy"));
31503				if (add) {
31504					basketParams['items'][_this.data('id')] = {};
31505					basketParams['items'][_this.data('id')]['id'] = _this.data('id');
31506					basketParams['items'][_this.data('id')]['product_type'] = _this.data('product_type');
31507					basketParams['items'][_this.data('id')]['quantity'] = _this.find('input[name="quantity"]').val();
31508				}
31509			})
31510			$.ajax({
31511				type: "POST",
31512				url: arAsproOptions['SITE_DIR'] + "ajax/item.php",
31513				data: basketParams,
31514				dataType: "json",
31515				success: function (data) {
31516					if ("STATUS" in data) {
31517						if (data.STATUS !== 'OK') {
31518							showBasketError(BX.message(data.MESSAGE) + ' <br/>' + data.MESSAGE_EXT);
31519						}
31520						if ($('.header-cart.fly').length) {
31521							arBasketAsproCounters.DEFAULT = true;
31522							SetActualBasketFlyCounters(true);
31523						}
31524						else {
31525							if ($("#ajax_basket").length)
31526								reloadTopBasket('add', $('#ajax_basket'), 200, 5000, 'N', '', true);
31527							else
31528								reloadBasketCounters('', true);
31529						}
31530					}
31531					_this.parent().removeClass('loadings');
31532					$('.opt_action').removeClass('no-action');
31533				}
31534			})
31535		}
31536	})
31537
31538
31539
31540	//fix opt checked for back in browser
31541	setTimeout(function () {
31542		if ($('.with-opt-buy input[name="chec_item"], .with-opt-buy input[name="select_all_items"]').length) {
31543			$('.with-opt-buy input[name="chec_item"], .with-opt-buy input[name="select_all_items"]').prop('checked', false);
31544		}
31545	}, 1);
31546
31547
31548
31549	/*check mobile device*/
31550	if (isMobile) {
31551		$(document).on('click', '*[data-event="jqm"]', function (e) {
31552			e.preventDefault();
31553			e.stopPropagation();
31554			var _this = $(this);
31555			var name = _this.data('name');
31556
31557			if (window.matchMedia('(min-width:768px)').matches || (typeof _this.data('no-mobile') !== 'undefinde' && _this.data('no-mobile') == 'Y')) {
31558				if (!$(this).hasClass('clicked')) {
31559					$(this).addClass('clicked');
31560					$(this).jqmEx();
31561					$(this).trigger('click');
31562				}
31563				return false;
31564			}
31565			else if (name.length) {
31566				var script = arAsproOptions['SITE_DIR'] + 'form/';
31567				var paramsStr = ''; var arTriggerAttrs = {};
31568				$.each(_this.get(0).attributes, function (index, attr) {
31569					var attrName = attr.nodeName;
31570					var attrValue = _this.attr(attrName);
31571					arTriggerAttrs[attrName] = attrValue;
31572					if (/^data\-param\-(.+)$/.test(attrName)) {
31573						var key = attrName.match(/^data\-param\-(.+)$/)[1];
31574						paramsStr += key + '=' + attrValue + '&';
31575					}
31576				});
31577
31578				var triggerAttrs = JSON.stringify(arTriggerAttrs);
31579				var encTriggerAttrs = encodeURIComponent(triggerAttrs);
31580				script += '?name=' + name + '&' + paramsStr + 'data-trigger=' + encTriggerAttrs;
31581
31582				location.href = script;
31583			}
31584		});
31585
31586		$('.fancybox').removeClass('fancybox');
31587	}
31588	else {
31589		$(document).on('click', '*[data-event="jqm"]', function (e) {
31590			e.preventDefault();
31591			e.stopPropagation();
31592			if (!$(this).hasClass('clicked')) {
31593				$(this).addClass('clicked');
31594				$(this).jqmEx();
31595				$(this).trigger('click');
31596			}
31597			return false;
31598		});
31599	}
31600
31601	BX.addCustomEvent('onCompleteAction', function (eventdata, _this) {
31602		try {
31603			if (eventdata.action === 'loadForm') {
31604				$(_this).parent().removeClass('loadings');
31605				$(_this).removeClass('clicked');
31606
31607				if ($(_this).hasClass('one_click_buy_trigger')) {
31608					$('.wrapp_one_click > span').removeClass('clicked')
31609					$('.one_click').removeClass('clicked')
31610				}
31611				else if ($(_this).hasClass('one_click_buy_basket_trigger')) {
31612					$('.fast_order').removeClass('clicked')
31613				}
31614			}
31615			else if (eventdata.action === 'loadBasket') {
31616				$('.basket-link.basket').attr('title', arBasketPrices.BASKET_SUMM_TITLE);
31617				$('.basket-link.delay').attr('title', arBasketPrices.DELAY_SUMM_TITLE);
31618
31619				if (arBasketPrices.BASKET_COUNT > 0) {
31620					$('.basket-link.basket').addClass('basket-count');
31621					$('.basket-link.basket .count').removeClass('empted');
31622					if ($('.basket-link.basket .prices').length)
31623						$('.basket-link.basket .prices').html(arBasketPrices.BASKET_SUMM);
31624				}
31625				else {
31626					$('.basket-link.basket').removeClass('basket-count');
31627					$('.basket-link.basket .count').addClass('empted');
31628					if ($('.basket-link.basket .prices').length)
31629						$('.basket-link.basket .prices').html(arBasketPrices.BASKET_SUMM_TITLE_SMALL);
31630				}
31631				$('.basket-link.basket .count').text(arBasketPrices.BASKET_COUNT);
31632				if (arBasketPrices.DELAY_COUNT > 0) {
31633					$('.basket-link.delay').addClass('basket-count');
31634					$('.basket-link.delay .count').removeClass('empted');
31635				}
31636				else {
31637					$('.basket-link.delay').removeClass('basket-count');
31638					$('.basket-link.delay .count').addClass('empted');
31639				}
31640				$('.basket-link.delay .count').text(arBasketPrices.DELAY_COUNT);
31641			}
31642			else if (eventdata.action === 'loadActualBasketCompare') {
31643				var compare_count = Object.keys(arBasketAspro.COMPARE).length;
31644				if (compare_count > 0) {
31645					$('.basket-link.compare').addClass('basket-count');
31646					$('.basket-link.compare .count').removeClass('empted');
31647					if ($('#compare_fly').length)
31648						$('#compare_fly').removeClass('empty_block');
31649				}
31650				else {
31651					$('.basket-link.compare').removeClass('basket-count');
31652					$('.basket-link.compare .count').addClass('empted');
31653					if ($('#compare_fly').length)
31654						$('#compare_fly').addClass('empty_block');
31655				}
31656				$('.basket-link.compare .count').text(compare_count);
31657			}
31658			else if (eventdata.action === 'loadRSS') {
31659			}
31660			else if (eventdata.action === 'ajaxContentLoaded') {
31661			}
31662			else if (eventdata.action === 'jsLoadBlock') {
31663				initCountdown();
31664				setStatusButton();
31665				InitFlexSlider();
31666				InitOwlSlider();
31667				InitFancyBox();
31668
31669				checkLinkedArticles();
31670
31671				if (typeof window['stickySidebar'] !== 'undefined') {
31672					window['stickySidebar'].updateSticky();
31673				}
31674			}
31675		}
31676		catch (e) {
31677			console.error(e)
31678		}
31679	})
31680
31681	/*slices*/
31682	if ($('.banners-small .item.normal-block').length)
31683		$('.banners-small .item.normal-block').sliceHeight();
31684	if ($('.teasers .item').length)
31685		$('.teasers .item').sliceHeight();
31686	if ($('.wrap-portfolio-front .row.items > div').length)
31687		$('.wrap-portfolio-front .row.items > div').sliceHeight({ 'row': '.row.items', 'item': '.item1' });
31688
31689	/* bug fix in ff*/
31690	$('img').removeAttr('draggable');
31691
31692	clicked_tab = 0;
31693
31694	$('.title-tab-heading').on('click', function () {
31695		var container = $(this).parent(),
31696			slide_block = $(this).next(),
31697			bReviewTab = container.hasClass('media_review');
31698
31699		clicked_tab = container.index() + 1;
31700
31701		container.siblings().removeClass('active');
31702
31703		$('.nav.nav-tabs li').removeClass('active');
31704
31705		if (container.hasClass('active')) {
31706			if (bReviewTab) {
31707				$('#reviews_content').slideUp(200, function () {
31708					container.removeClass('active');
31709				});
31710			}
31711			else {
31712				slide_block.slideUp(200, function () {
31713					container.removeClass('active');
31714				});
31715			}
31716		}
31717		else {
31718			container.addClass('active');
31719			if (bReviewTab) {
31720				$('#reviews_content').slideDown();
31721			}
31722			else {
31723				if ($('.tabs_section + #reviews_content').length)
31724					$('.tabs_section + #reviews_content').slideUp();
31725				slide_block.slideDown();
31726				if (typeof container.attr('id') !== 'undefined' && container.attr('id') == 'descr') {
31727					var $gallery = $('.galerys-block');
31728					if ($gallery.length) {
31729						var bTypeBig = $gallery.find('.big_slider').length;
31730						var $slider = bTypeBig ? $gallery.find('.big_slider') : $gallery.find('.small_slider');
31731						InitFlexSlider();
31732						var interval = setInterval(function () {
31733							if ($slider.find('.slides .item').attr('style').indexOf('height') === -1) {
31734								$(window).resize();
31735							}
31736							else {
31737								clearInterval(interval);
31738							}
31739						}, 100);
31740					}
31741				}
31742			}
31743		}
31744	})
31745
31746	InitFlexSlider();
31747	InitOwlSlider();
31748	InitStickySideBar();
31749	InitFancyBox();
31750	InitFancyBoxVideo();
31751
31752	setTimeout(function () {
31753		InitTopestMenuGummi();
31754		isOnceInited = true;
31755	}, 50);
31756
31757	InitZoomPict();
31758
31759	// $('body').on( 'click', '.captcha_reload', function(e){
31760	$(document).on('click', '.captcha_reload', function (e) {
31761		var captcha = $(this).parents('.captcha-row');
31762		e.preventDefault();
31763		$.ajax({
31764			url: arAsproOptions['SITE_DIR'] + 'ajax/captcha.php'
31765		}).done(function (text) {
31766			captcha.find('input[name=captcha_sid]').val(text);
31767			captcha.find('img').attr('src', '/bitrix/tools/captcha.php?captcha_sid=' + text);
31768			captcha.find('input[name=captcha_word]').val('').removeClass('error');
31769			captcha.find('.captcha_input').removeClass('error').find('.error').remove();
31770		});
31771	});
31772
31773	/* show print */
31774	if (arAsproOptions["PAGES"]["BASKET_PAGE"]) {
31775		if (arAsproOptions["THEME"]["SHOW_BASKET_PRINT"] == "Y") {
31776			if ($('.page-top h1').length)
31777				$('<div class="print-link colored_theme_hover_bg-block" title="' + arAsproOptions["THEME"]["EXPRESSION_FOR_PRINT_PAGE"] + '"><i class="svg colored_theme_hover_bg-el-svg"><svg class="svg svg-print" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><path id="Rectangle_665_copy_4" data-name="Rectangle 665 copy 4" class="cls-print" d="M1570,210h-2v3h-8v-3h-2a2,2,0,0,1-2-2v-5a2,2,0,0,1,2-2h2v-4h8v4h2a2,2,0,0,1,2,2v5A2,2,0,0,1,1570,210Zm-8,1h4v-4h-4v4Zm4-12h-4v2h4v-2Zm4,4h-12v5h2v-3h8v3h2v-5Z" transform="translate(-1556 -197)"></path></svg></i></div>').insertBefore($('.page-top .topic .topic__heading'));
31778
31779		}
31780	}
31781	else {
31782		if (arAsproOptions['THEME']['PRINT_BUTTON'] == 'Y') {
31783			setTimeout(function () {
31784
31785				if ($('.period_wrapper.in-detail-news1 .period_wrapper_inner').length) {
31786					$('<div class="print-link colored_theme_hover_bg-block" title="' + arAsproOptions["THEME"]["EXPRESSION_FOR_PRINT_PAGE"] + '"><i class="svg colored_theme_hover_bg-el-svg"><svg class="svg svg-print" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><path id="Rectangle_665_copy_4" data-name="Rectangle 665 copy 4" class="cls-print" d="M1570,210h-2v3h-8v-3h-2a2,2,0,0,1-2-2v-5a2,2,0,0,1,2-2h2v-4h8v4h2a2,2,0,0,1,2,2v5A2,2,0,0,1,1570,210Zm-8,1h4v-4h-4v4Zm4-12h-4v2h4v-2Zm4,4h-12v5h2v-3h8v3h2v-5Z" transform="translate(-1556 -197)"></path></svg></i></div>').insertBefore($('.detail-news1 .period_wrapper .period_wrapper_inner'));
31787				} else if ($('.page-top .topic .topic__heading').length) {
31788					$('<div class="print-link colored_theme_hover_bg-block" title="' + arAsproOptions["THEME"]["EXPRESSION_FOR_PRINT_PAGE"] + '"><i class="svg colored_theme_hover_bg-el-svg"><svg class="svg svg-print" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><path id="Rectangle_665_copy_4" data-name="Rectangle 665 copy 4" class="cls-print" d="M1570,210h-2v3h-8v-3h-2a2,2,0,0,1-2-2v-5a2,2,0,0,1,2-2h2v-4h8v4h2a2,2,0,0,1,2,2v5A2,2,0,0,1,1570,210Zm-8,1h4v-4h-4v4Zm4-12h-4v2h4v-2Zm4,4h-12v5h2v-3h8v3h2v-5Z" transform="translate(-1556 -197)"></path></svg></i></div>').insertBefore($('.page-top .topic .topic__heading'));
31789				}
31790
31791
31792			}, 150);
31793		}
31794	}
31795
31796	$(document).on('click', '.print-link', function () {
31797		window.print();
31798	})
31799
31800	$('.head-block .item-link').on('click', function () {
31801		var _this = $(this);
31802		_this.siblings().removeClass('active');
31803		_this.addClass('active');
31804	})
31805
31806	$('table.table').each(function () {
31807		var _this = $(this),
31808			first_td = _this.find('thead tr th');
31809		if (!first_td.length)
31810			first_td = _this.find('thead tr td');
31811		if (first_td.length) {
31812			var j = 0;
31813			_this.find('tbody tr td').each(function (i) {
31814				if (j > first_td.length - 1)
31815					j = 0;
31816				$('<div class="th-mobile">' + first_td[j].textContent + '</div>').appendTo($(this));
31817				j++;
31818			})
31819		}
31820	})
31821
31822	if (window.matchMedia('(min-width: 768px)').matches)
31823		$('.wrapper_middle_menu.wrap_menu').removeClass('mobile');
31824
31825
31826	if (window.matchMedia('(max-width: 767px)').matches)
31827		$('.wrapper_middle_menu.wrap_menu').addClass('mobile');
31828
31829
31830
31831	$('.menu_top_block .v_bottom a').on('click', function (e) {
31832		if ($(e.target).hasClass('toggle_block'))
31833			e.preventDefault();
31834	})
31835	$('.menu_top_block .v_bottom a .toggle_block').click(function (e) {
31836		var _this = $(this),
31837			menu = _this.closest('.has-child').find('> .dropdown'),
31838			bVisibleMeu = (menu.is(':visible')),
31839			animate = (bVisibleMeu ? 'slideUp' : 'slideDown');
31840
31841		if (!_this.hasClass('clicked')) {
31842			_this.addClass('clicked');
31843
31844
31845			menu.velocity('stop').velocity(animate, {
31846				duration: 150,
31847				// delay: 250,
31848				begin: function () {
31849					_this.toggleClass('closed');
31850				},
31851				complete: function () {
31852					_this.removeClass('clicked');
31853
31854					if (typeof window['stickySidebar'] !== 'undefined')
31855						window['stickySidebar'].updateSticky();
31856				}
31857			});
31858		}
31859
31860		$(this).closest('.has-child').toggleClass('opened');
31861	})
31862
31863	$(document).on('click', '.show_props', function () {
31864		$(this).prev().stop().slideToggle(333);
31865		$(this).find('.char_title').toggleClass('opened');
31866	});
31867
31868	$('.see_more').on('click', function (e) {
31869		e.preventDefault();
31870		var see_more = ($(this).is('.see_more') ? $(this) : $(this).parents('.see_more').first());
31871		var see_moreText = (see_more.find('> a').length ? see_more.find('> a') : see_more);
31872		var see_moreHiden = see_more.parent().find('> .d');
31873		if (see_more.hasClass('open')) {
31874			see_moreText.text(BX.message('CATALOG_VIEW_MORE'));
31875			see_more.removeClass('open');
31876			see_moreHiden.hide();
31877		}
31878		else {
31879			see_moreText.text(BX.message('CATALOG_VIEW_LESS'));
31880			see_more.addClass('open');
31881			see_moreHiden.show();
31882		}
31883		return false;
31884	});
31885
31886	$('.button.faq_button').click(function (e) {
31887		e.preventDefault();
31888		$(this).toggleClass('opened');
31889		$('.faq_ask .form').slideToggle();
31890	});
31891
31892	$('.staff.list .staff_section .staff_section_title a').click(function (e) {
31893		e.preventDefault();
31894		$(this).parents('.staff_section').toggleClass('opened');
31895		$(this).parents('.staff_section').find('.staff_section_items').stop().slideToggle(600);
31896		$(this).parents('.staff_section_title').find('.opener_icon').toggleClass('opened');
31897	});
31898
31899	$('.jobs_wrapp .item .name').click(function (e) {
31900		$(this).closest('.item').toggleClass('opened');
31901		$(this).closest('.item').find('.description_wrapp').stop().slideToggle(600);
31902		$(this).closest('.item').find('.opener_icon').toggleClass('opened');
31903	});
31904
31905	$('.faq.list .item .q a').on('click', function (e) {
31906		e.preventDefault();
31907		$(this).parents('.item').toggleClass('opened');
31908		$(this).parents('.item').find('.a').stop().slideToggle();
31909		$(this).parents('.item').find('.q .opener_icon').toggleClass('opened');
31910	});
31911
31912	$('.opener_icon').click(function (e) {
31913		e.preventDefault();
31914		$(this).parent().find('a').trigger('click');
31915	});
31916
31917	$('.dotdot').dotdotdot();
31918
31919	$('.more_block span').on('click', function () {
31920		var content_offset = $('.catalog_detail .tabs_section').offset();
31921		$('html, body').animate({ scrollTop: content_offset.top - 43 }, 400);
31922	});
31923
31924	$(document).on("click", ".counter_block:not(.basket) .plus", function () {
31925		if (!$(this).parents('.basket_wrapp').length) {
31926			if ($(this).parent().data("offers") != "Y") {
31927				var isDetailSKU2 = $(this).parents('.counter_block_wr').length;
31928				input = $(this).parents(".counter_block").find("input[type=text]")
31929				tmp_ratio = !isDetailSKU2 ? $(this).parents(".counter_wrapp").find(".to-cart").data('ratio') : $(this).parents('tr').first().find("td.buy .to-cart").data('ratio'),
31930					//console.log(!isDetailSKU2);
31931					isDblQuantity = !isDetailSKU2 ? $(this).parents(".counter_wrapp").find(".to-cart").data('float_ratio') : $(this).parents('tr').first().find("td.buy .to-cart").data('float_ratio'),
31932					ratio = (isDblQuantity ? parseFloat(tmp_ratio) : parseInt(tmp_ratio, 10)),
31933					max_value = '';
31934				currentValue = input.val();
31935
31936
31937				if (isDblQuantity)
31938					ratio = Math.round(ratio * arAsproOptions.JS_ITEM_CLICK.precisionFactor) / arAsproOptions.JS_ITEM_CLICK.precisionFactor;
31939
31940				curValue = (isDblQuantity ? parseFloat(currentValue) : parseInt(currentValue, 10));
31941
31942				curValue += ratio;
31943				if (isDblQuantity) {
31944					curValue = Math.round(curValue * arAsproOptions.JS_ITEM_CLICK.precisionFactor) / arAsproOptions.JS_ITEM_CLICK.precisionFactor;
31945				}
31946				if (parseFloat($(this).data('max')) > 0) {
31947					if (input.val() < $(this).data('max')) {
31948						if (curValue <= $(this).data('max'))
31949							input.val(curValue);
31950
31951						input.change();
31952					}
31953				} else {
31954					input.val(curValue);
31955					input.change();
31956				}
31957			}
31958		}
31959	});
31960	$(document).on("click", ".counter_block:not(.basket) .minus", function () {
31961		if (!$(this).parents('.basket_wrapp').length) {
31962			if ($(this).parent().data("offers") != "Y") {
31963				var isDetailSKU2 = $(this).parents('.counter_block_wr').length;
31964				input = $(this).parents(".counter_block").find("input[type=text]")
31965				tmp_ratio = !isDetailSKU2 ? $(this).parents(".counter_wrapp").find(".to-cart").data('ratio') : $(this).parents('tr').first().find("td.buy .to-cart").data('ratio'),
31966					isDblQuantity = !isDetailSKU2 ? $(this).parents(".counter_wrapp").find(".to-cart").data('float_ratio') : $(this).parents('tr').first().find("td.buy .to-cart").data('float_ratio'),
31967					ratio = (isDblQuantity ? parseFloat(tmp_ratio) : parseInt(tmp_ratio, 10)),
31968					max_value = '';
31969				currentValue = input.val();
31970
31971				if (isDblQuantity)
31972					ratio = Math.round(ratio * arAsproOptions.JS_ITEM_CLICK.precisionFactor) / arAsproOptions.JS_ITEM_CLICK.precisionFactor;
31973
31974				curValue = (isDblQuantity ? parseFloat(currentValue) : parseInt(currentValue, 10));
31975
31976				curValue -= ratio;
31977				if (isDblQuantity) {
31978					curValue = Math.round(curValue * arAsproOptions.JS_ITEM_CLICK.precisionFactor) / arAsproOptions.JS_ITEM_CLICK.precisionFactor;
31979				}
31980
31981				if (parseFloat($(this).parents(".counter_block").find(".plus").data('max')) > 0) {
31982					if (currentValue > ratio) {
31983						if (curValue < ratio) {
31984							input.val(ratio);
31985						} else {
31986							input.val(curValue);
31987						}
31988						input.change();
31989					}
31990				} else {
31991					if (curValue > ratio) {
31992						input.val(curValue);
31993					} else {
31994						if (ratio) {
31995							input.val(ratio);
31996						} else if (currentValue > 1) {
31997							input.val(curValue);
31998						}
31999					}
32000					input.change();
32001				}
32002			}
32003		}
32004	});
32005
32006	$('.counter_block input[type=text]').numeric({ allow: "." });
32007
32008	$(document).on("focus", ".counter_block input[type=text]", function (e) {
32009		$(this).addClass('focus');
32010	})
32011
32012	$(document).on("blur", ".counter_block input[type=text]", function (e) {
32013		$(this).removeClass('focus');
32014	})
32015
32016	var timerInitCalculateDelivery = false;
32017	$(document).on("change", ".counter_block input[type=text]", function (e) {
32018		if (!$(this).parents('.basket_wrapp').length) {
32019			var val = $(this).val(),
32020				tmp_ratio = $(this).parents(".counter_wrapp").find(".to-cart").data('ratio') ? $(this).parents(".counter_wrapp").find(".to-cart").data('ratio') : $(this).parents('tr').first().find("td.buy .to-cart").data('ratio'),
32021				isDblQuantity = $(this).parents(".counter_wrapp").find(".to-cart").data('float_ratio') ? $(this).parents(".counter_wrapp").find(".to-cart").data('float_ratio') : $(this).parents('tr').first().find("td.buy .to-cart").data('float_ratio'),
32022				ratio = (isDblQuantity ? parseFloat(tmp_ratio) : parseInt(tmp_ratio, 10)),
32023				diff = val % ratio;
32024
32025			if (isDblQuantity) {
32026				ratio = Math.round(ratio * arAsproOptions.JS_ITEM_CLICK.precisionFactor) / arAsproOptions.JS_ITEM_CLICK.precisionFactor;
32027				if (Math.round(diff * arAsproOptions.JS_ITEM_CLICK.precisionFactor) / arAsproOptions.JS_ITEM_CLICK.precisionFactor == ratio)
32028					diff = 0;
32029			}
32030
32031			if ($(this).hasClass('focus')) {
32032				intCount = Math.round(
32033					Math.round(val * arAsproOptions.JS_ITEM_CLICK.precisionFactor / ratio) / arAsproOptions.JS_ITEM_CLICK.precisionFactor
32034				) || 1;
32035				val = (intCount <= 1 ? ratio : intCount * ratio);
32036				// val -= diff;
32037				val = Math.round(val * arAsproOptions.JS_ITEM_CLICK.precisionFactor) / arAsproOptions.JS_ITEM_CLICK.precisionFactor;
32038			}
32039
32040			if (parseFloat($(this).parents(".counter_block").find(".plus").data('max')) > 0) {
32041				if (val > parseFloat($(this).parents(".counter_block").find(".plus").data('max'))) {
32042					val = parseFloat($(this).parents(".counter_block").find(".plus").data('max'));
32043					// val -= (val % ratio);
32044				}
32045			}
32046			if (val < ratio) {
32047				val = ratio;
32048			} else if (!parseFloat(val)) {
32049				val = 1;
32050			}
32051
32052			$(this).parents('.counter_block').parent().parent().find('.to-cart').attr('data-quantity', val);
32053			$(this).parents('.counter_block').parent().parent().parent().find('.one_click').attr('data-quantity', val);
32054			$(this).val(val);
32055
32056			var $calculate = $(this).closest('.item').length ? $(this).closest('.item').find('.calculate-delivery') : $(this).closest('.catalog_detail').find('.calculate-delivery');
32057			if ($calculate.length) {
32058				$calculate.each(function () {
32059					var $calculateSpan = $(this).find('span[data-event=jqm]').first();
32060
32061					if ($calculateSpan.length) {
32062						var $clone = $calculateSpan.clone();
32063						$clone.attr('data-param-quantity', val).removeClass('clicked');
32064						$clone.insertAfter($calculateSpan).on('click', function () {
32065							if (!jQuery.browser.mobile) {
32066								$(this).parent().addClass('loadings');
32067							}
32068						});
32069						$calculateSpan.remove();
32070					}
32071
32072					if ($(this).hasClass('with_preview')) {
32073						$(this).removeClass('inited');
32074
32075						if (timerInitCalculateDelivery) {
32076							clearTimeout(timerInitCalculateDelivery);
32077						}
32078
32079						timerInitCalculateDelivery = setTimeout(function () {
32080							initCalculatePreview();
32081							timerInitCalculateDelivery = false;
32082						}, 1000);
32083					}
32084				});
32085			}
32086
32087			var eventdata = { type: 'change', params: { id: $(this), value: val } };
32088			BX.onCustomEvent('onCounterProductAction', [eventdata]);
32089		}
32090	});
32091
32092	BX.addCustomEvent('onCounterProductAction', function (eventdata) {
32093		if (typeof eventdata != 'object') {
32094			eventdata = { type: 'undefined' };
32095		}
32096		try {
32097			if (typeof eventdata.type != 'undefined') {
32098				if (!eventdata.params.id.closest('.gifts').length) // no gift
32099				{
32100					var obProduct = eventdata.params.id.data('product');
32101
32102					if (eventdata.params.id.closest('.has_offer_prop').length) // type1 for offers in element list
32103					{
32104						if (typeof window['obSkuQuantys'] === 'undefined')
32105							window["obSkuQuantys"] = {};
32106
32107						// if(typeof window['obOffers'] === 'undefined')
32108						window["obSkuQuantys"][eventdata.params.id.closest('.offer_buy_block').find('.to-cart').data('item')] = eventdata.params.value;
32109					}
32110					if (typeof window[obProduct] == 'object') {
32111						if (obProduct == "obOffers")
32112							setPriceAction('', '', 'Y');
32113						else
32114							window[obProduct].setPriceAction('Y');
32115					}
32116					else if (eventdata.params.id.length) {
32117						if (eventdata.params.id.closest('.main_item_wrapper').length && arAsproOptions['THEME']['SHOW_TOTAL_SUMM'] == 'Y') {
32118							setPriceItem(eventdata.params.id.closest('.main_item_wrapper'), eventdata.params.value);
32119						}
32120					}
32121					BX.onCustomEvent('onCounterProductActionResize');
32122				}
32123			}
32124		}
32125		catch (e) {
32126			console.error(e)
32127		}
32128	});
32129
32130	/*show basket on hover */
32131	$(document).on('mouseenter', '.wrap_icon.top_basket, #headerfixed .basket-link.basket', function () {
32132
32133		var _this = $(this);
32134		var parent = _this.closest('header, #headerfixed');
32135		var hover_block = parent.find('.basket_hover_block');
32136
32137		if (!hover_block.hasClass('loaded')) {
32138			$.ajax({
32139				type: "POST",
32140				url: arAsproOptions['SITE_DIR'] + "ajax/showBasketHover.php",
32141				//data:fill_prop,
32142				//dataType:"json",
32143				success: function (html) {
32144					//$('.basket_error_frame').jqmHide();
32145					if (html) {
32146						hover_block.html(html);
32147						hover_block.addClass('loaded');
32148					} else {
32149						showBasketError(BX.message("CATALOG_PARTIAL_BASKET_PROPERTIES_ERROR"));
32150					}
32151				}
32152			});
32153		}
32154	});
32155
32156	/*show basket on click mobile */
32157	$(document).on('click', '.wrap_icon.wrap_basket.top_basket, #headerfixed .basket-link.basket', function (e) {
32158		var _this = $(this);
32159		if (isMobile) {
32160			if (!_this.hasClass('clicked')) {
32161				e.preventDefault();
32162				_this.addClass('clicked');
32163				setTimeout(function () {
32164					_this.removeClass('clicked');
32165				}, 3000);
32166			}
32167		}
32168	});
32169
32170	/*slide cart*/
32171	$(document).on('mouseenter', '#basket_line .basket_normal:not(.empty_cart):not(.bcart) .basket_block ', function () {
32172		$(this).closest('.basket_normal').find('.popup').addClass('block');
32173		$(this).closest('.basket_normal').find('.basket_popup_wrapp').stop(true, true).slideDown(150);
32174	});
32175	$(document).on('mouseleave', '#basket_line .basket_normal .basket_block ', function () {
32176		var th = $(this);
32177		$(this).closest('.basket_normal').find('.basket_popup_wrapp').stop(true, true).slide
32177Up(150, function () {
32178			th.closest('.basket_normal').find('.popup').removeClass('block');
32179		});
32180	});
32181
32182	$(document).on('click', '.popup_button_basket', function () {
32183		var th = $(".to-cart[data-item=" + $(this).data("item") + "]");
32184
32185		var val = th.attr('data-quantity');
32186
32187		if (!val) $val = 1;
32188
32189		var tmp_props = th.data("props"),
32190			props = '',
32191			part_props = '',
32192			add_props = 'N',
32193			fill_prop = {},
32194			iblockid = th.data('iblockid'),
32195			offer = th.data('offers'),
32196			rid = '',
32197			basket_props = '',
32198			item = th.attr('data-item');
32199
32200		if (offer != "Y") {
32201			offer = "N";
32202		} else {
32203			basket_props = th.closest('.prices_tab').find('.bx_sku_props input').val();
32204		}
32205		if (tmp_props) {
32206			props = tmp_props.split(";");
32207		}
32208		if (th.data("part_props")) {
32209			part_props = th.data("part_props");
32210		}
32211		if (th.data("add_props")) {
32212			add_props = th.data("add_props");
32213		}
32214		if ($('.rid_item').length) {
32215			rid = $('.rid_item').data('rid');
32216		} else if (th.data('rid')) {
32217			rid = th.data('rid');
32218		}
32219
32220		fill_prop = fillBasketPropsExt(th, 'prop', 'bx_ajax_text');
32221
32222		fill_prop.quantity = val;
32223		fill_prop.add_item = 'Y';
32224		fill_prop.rid = rid;
32225		fill_prop.offers = offer;
32226		fill_prop.iblockID = iblockid;
32227		fill_prop.part_props = part_props;
32228		fill_prop.add_props = add_props;
32229		fill_prop.props = JSON.stringify(props);
32230		fill_prop.item = item;
32231		fill_prop.basket_props = basket_props;
32232
32233		$.ajax({
32234			type: "POST",
32235			url: arAsproOptions['SITE_DIR'] + "ajax/item.php",
32236			data: fill_prop,
32237			dataType: "json",
32238			success: function (data) {
32239				$('.basket_error_frame').jqmHide();
32240				if ("STATUS" in data) {
32241					getActualBasket(fill_prop.iblockID);
32242					if (data.STATUS === 'OK') {
32243						th.hide();
32244						th.closest('.counter_wrapp').find('.counter_block_inner').hide();
32245						th.closest('.counter_wrapp').find('.counter_block').hide();
32246						th.parents('tr').find('.counter_block_wr .counter_block').hide();
32247						th.closest('.button_block').addClass('wide');
32248						th.parent().find('.in-cart').show();
32249
32250						addBasketCounter(item);
32251						//$('.wish_item[data-item='+item+']').removeClass("added");
32252						$('.wish_item[data-item=' + item + ']').find(".value").show();
32253						$('.wish_item[data-item=' + item + ']').find(".value.added").hide();
32254
32255						if ($("#ajax_basket").length)
32256							reloadTopBasket('add', $('#ajax_basket'), 200, 5000, 'Y');
32257
32258						if ($("#basket_line .basket_fly").length) {
32259							if (th.closest('.fast_view_frame').length || window.matchMedia('(max-width: 767px)').matches)
32260								basketFly('open', 'N');
32261							else
32262								basketFly('open');
32263						}
32264
32265					} else {
32266						showBasketError(BX.message(data.MESSAGE));
32267					}
32268				} else {
32269					showBasketError(BX.message("CATALOG_PARTIAL_BASKET_PROPERTIES_ERROR"));
32270				}
32271			}
32272		});
32273	})
32274
32275	$(document).on('click', '.to-cart:not(.read_more), .basket_item_add', function (e) {
32276		e.preventDefault();
32277		var th = $(this);
32278		if (!th.hasClass('clicked')) {
32279			th.addClass('clicked');
32280			var val = $(this).attr('data-quantity');
32281			var tmp_props = $(this).data("props"),
32282				props = '',
32283				part_props = '',
32284				add_props = 'N',
32285				fill_prop = {},
32286				iblockid = $(this).data('iblockid'),
32287				offer = $(this).data('offers'),
32288				rid = '',
32289				bBannerAction = false,
32290				basket_props = '',
32291				item = $(this).attr('data-item');
32292			if (th.closest('.but-cell').length) {
32293				if ($('.counter_block[data-item="' + item + '"]').length)
32294					val = $('.counter_block[data-item="' + item + '"] input').val();
32295			}
32296
32297			if (th.closest('.banner_buttons.with_actions').length) //banner action
32298			{
32299				var wrapper_btns = th.closest('.wraps_buttons');
32300				item = wrapper_btns.data('id');
32301				bBannerAction = true;
32302			}
32303
32304			if (!val)
32305				val = 1;
32306			if (offer != "Y") {
32307				offer = "N";
32308			} else {
32309				basket_props = $(this).closest('.prices_tab').find('.bx_sku_props input').val();
32310			}
32311			if (tmp_props) {
32312				props = tmp_props.split(";");
32313			}
32314			if ($(this).data("part_props")) {
32315				part_props = $(this).data("part_props");
32316			}
32317			if ($(this).data("add_props")) {
32318				add_props = $(this).data("add_props");
32319			}
32320			if ($('.rid_item').length) {
32321				rid = $('.rid_item').data('rid');
32322			} else if ($(this).data('rid')) {
32323				rid = $(this).data('rid');
32324			}
32325
32326			fill_prop = fillBasketPropsExt(th, 'prop', th.data('bakset_div'));
32327
32328			fill_prop.quantity = val;
32329			fill_prop.add_item = 'Y';
32330			fill_prop.rid = rid;
32331			fill_prop.offers = offer;
32332			fill_prop.iblockID = iblockid;
32333			fill_prop.part_props = part_props;
32334			fill_prop.add_props = add_props;
32335			fill_prop.props = JSON.stringify(props);
32336			fill_prop.item = item;
32337			fill_prop.basket_props = basket_props;
32338
32339			if (bBannerAction) {
32340
32341				if (th.hasClass('added')) {
32342					location.href = th.data('href');
32343					return false;
32344				}
32345				else {
32346					th.attr('title', th.data('title2'))
32347					th.toggleClass('added');
32348				}
32349
32350				if (wrapper_btns.find('.wish_item_add').length)
32351					wrapper_btns.find('.wish_item_add').removeClass('added');
32352			}
32353
32354			if (th.data("empty_props") == "N"/* && fill_prop.part_props != 'Y'*/) {
32355				var basket_popup_html = $("#" + th.data("bakset_div")).html();
32356				if (!basket_popup_html && th.closest('.item').find('.basket_props_block').length)
32357					basket_popup_html = th.closest('.item').find('.basket_props_block').html();
32358
32359				showBasketError(basket_popup_html, BX.message("ERROR_BASKET_PROP_TITLE"), "Y", th);
32360				BX.addCustomEvent('onCompleteAction', function (e) {
32361					if (!e.ignoreSelf) {
32362						var eventdata = { action: 'loadForm', ignoreSelf: true };
32363						BX.onCustomEvent('onCompleteAction', [eventdata, th[0]]);
32364					}
32365				});
32366
32367			} else {
32368				$.ajax({
32369					type: "POST",
32370					url: arAsproOptions['SITE_DIR'] + "ajax/item.php",
32371					data: fill_prop,
32372					dataType: "json",
32373					success: function (data) {
32374						getActualBasket(fill_prop.iblockID);
32375
32376						var eventdata = { action: 'loadForm' };
32377						BX.onCustomEvent('onCompleteAction', [eventdata, th[0]]);
32378						arStatusBasketAspro = {};
32379
32380						if (data !== null) {
32381							if ("STATUS" in data) {
32382								if (data.MESSAGE_EXT === null)
32383									data.MESSAGE_EXT = '';
32384								if (data.STATUS === 'OK') {
32385									// th.hide();
32386									$('.to-cart[data-item=' + item + ']').hide();
32387									$('.to-cart[data-item=' + item + ']').closest('.counter_wrapp').find('.counter_block_inner').hide();
32388									$('.to-cart[data-item=' + item + ']').closest('.counter_wrapp').find('.counter_block').hide();
32389									$('.to-cart[data-item=' + item + ']').parents('tr').find('.counter_block_wr .counter_block').hide();
32390									$('.to-cart[data-item=' + item + ']').closest('.button_block').addClass('wide');
32391									// th.parent().find('.in-cart').show();
32392									$('.in-cart[data-item=' + item + ']').show();
32393
32394									addBasketCounter(item);
32395									//$('.wish_item[data-item='+item+']').removeClass("added");
32396									$('.wish_item[data-item=' + item + ']').find(".value").show();
32397									$('.wish_item[data-item=' + item + ']').find(".value.added").hide();
32398									$('.wish_item.to[data-item=' + item + ']').show();
32399									$('.wish_item.in[data-item=' + item + ']').hide();
32400
32401									if ($("#ajax_basket").length)
32402										reloadTopBasket('add', $('#ajax_basket'), 200, 5000, 'Y');
32403
32404									if ($("#basket_line .basket_fly").length) {
32405										if (th.closest('.fast_view_frame').length || window.matchMedia('(max-width: 767px)').matches || $("#basket_line .basket_fly.loaded").length)
32406											basketFly('open', 'N');
32407										else
32408											basketFly('open');
32409									}
32410
32411									if ($(".top_basket").length) {
32412										basketTop('open');
32413									}
32414
32415								} else {
32416									showBasketError(BX.message(data.MESSAGE) + ' <br/>' + data.MESSAGE_EXT);
32417								}
32418							} else {
32419								showBasketError(BX.message("CATALOG_PARTIAL_BASKET_PROPERTIES_ERROR"));
32420							}
32421						} else {
32422							// th.hide();
32423							$('.to-cart[data-item=' + item + ']').hide();
32424							$('.to-cart[data-item=' + item + ']').closest('.counter_wrapp').find('.counter_block_inner').hide();
32425							$('.to-cart[data-item=' + item + ']').closest('.counter_wrapp').find('.counter_block').hide();
32426							$('.to-cart[data-item=' + item + ']').parents('tr').find('.counter_block_wr .counter_block').hide();
32427							$('.to-cart[data-item=' + item + ']').closest('.button_block').addClass('wide');
32428							// th.parent().find('.in-cart').show();
32429							$('.in-cart[data-item=' + item + ']').show();
32430
32431							addBasketCounter(item);
32432							//$('.wish_item[data-item='+item+']').removeClass("added");
32433							$('.wish_item[data-item=' + item + ']').find(".value").show();
32434							$('.wish_item[data-item=' + item + ']').find(".value.added").hide();
32435
32436							if ($("#ajax_basket").length)
32437								reloadTopBasket('add', $('#ajax_basket'), 200, 5000, 'Y');
32438
32439							if ($("#basket_line .basket_fly").length) {
32440								if (th.closest('.fast_view_frame').length || window.matchMedia('(max-width: 767px)').matches || $("#basket_line .basket_fly.loaded").length)
32441									basketFly('open', 'N');
32442								else
32443									basketFly('open');
32444							}
32445						}
32446					}
32447				});
32448			}
32449		}
32450
32451	})
32452
32453	$(document).on('click', '.to-subscribe', function (e) {
32454		e.preventDefault();
32455		var th = $(this);
32456		if (!th.hasClass('clicked')) {
32457			th.addClass('clicked');
32458			if ($(this).is('.auth')) {
32459				if ($(this).hasClass('nsubsc')) {
32460					$(this).jqmEx();
32461					$(this).trigger('click');
32462				}
32463				else {
32464					location.href = arAsproOptions['SITE_DIR'] + 'auth/?backurl=' + location.pathname;
32465				}
32466			}
32467			else {
32468				var item = $(this).attr('data-item'),
32469					iblockid = $(this).attr('data-iblockid');
32470				// $(this).hide();
32471				$('.to-subscribe[data-item=' + item + ']').hide();
32472				$('.to-subscribe[data-item=' + item + ']').parent().find('.in-subscribe').show();
32473				$.get(arAsproOptions['SITE_DIR'] + 'ajax/item.php?item=' + item + '&subscribe_item=Y',
32474					$.proxy(function (data) {
32475						arStatusBasketAspro = {};
32476						getActualBasket(iblockid);
32477					})
32478				);
32479				th.removeClass('clicked');
32480			}
32481		}
32482	})
32483
32484	$(document).on('click', '.in-subscribe', function (e) {
32485		e.preventDefault();
32486		var item = $(this).attr('data-item'),
32487			iblockid = $(this).attr('data-iblockid');;
32488		// $(this).hide();
32489		$('.in-subscribe[data-item=' + item + ']').hide();
32490		$('.in-subscribe[data-item=' + item + ']').parent().find('.to-subscribe').removeClass('clicked');
32491		$('.in-subscribe[data-item=' + item + ']').parent().find('.to-subscribe').show();
32492		$.get(arAsproOptions['SITE_DIR'] + 'ajax/item.php?item=' + item + '&subscribe_item=Y',
32493			$.proxy(function (data) {
32494				getActualBasket(iblockid);
32495				arStatusBasketAspro = {};
32496			})
32497		);
32498	})
32499
32500	$(document).on('click', '.wish_item, .wish_item_add', function (e) {
32501		e.preventDefault();
32502		var val = $(this).attr('data-quantity'),
32503			_this = $(this),
32504			offer = $(this).data('offers'),
32505			iblockid = $(this).data('iblock'),
32506			tmp_props = $(this).data("props"),
32507			props = '',
32508			bBannerAction = false,
32509			item = $(this).attr('data-item'),
32510			item2 = $(this).attr('data-item');
32511
32512		if (_this.closest('.banner_buttons.with_actions').length) //banner action
32513		{
32514			var wrapper_btns = _this.closest('.wraps_buttons');
32515			item = item2 = wrapper_btns.data('id');
32516			bBannerAction = true;
32517		}
32518
32519		if (!_this.hasClass('clicked')) {
32520			_this.addClass('clicked');
32521			if (!val) val = 1;
32522			if (offer != "Y") offer = "N";
32523			if (tmp_props) {
32524				props = tmp_props.split(";");
32525			}
32526			if (!$(this).hasClass('text')) {
32527				if ($(this).hasClass('added')) {
32528					if (!bBannerAction) {
32529						$(this).hide();
32530						$(this).closest('.wish_item_button').find('.to').show();
32531					}
32532					$('.like_icons').each(function () {
32533						if ($(this).find('.wish_item.text[data-item="' + item + '"]').length) {
32534							$(this).find('.wish_item.text[data-item="' + item + '"]').removeClass('added');
32535							$(this).find('.wish_item.text[data-item="' + item + '"]').find('.value').show();
32536							$(this).find('.wish_item.text[data-item="' + item + '"]').find('.value.added').hide();
32537						}
32538						if ($(this).find('.wish_item_button').length) {
32539							/*$(this).find('.wish_item_button').find('.wish_item[data-item="'+item+'"]').removeClass('added');
32540							$(this).find('.wish_item_button').find('.wish_item[data-item="'+item+'"]').find('.value').show();
32541							$(this).find('.wish_item_button').find('.wish_item[data-item="'+item+'"]').find('.value.added').hide();*/
32542							$(this).find('.wish_item_button').find('.wish_item[data-item="' + item + '"].to').show();
32543							$(this).find('.wish_item_button').find('.wish_item[data-item="' + item + '"].in').hide();
32544						}
32545					})
32546				}
32547				else {
32548					if (!bBannerAction) {
32549						$(this).hide();
32550						$(this).closest('.wish_item_button').find('.in').addClass('added').show();
32551					}
32552
32553					$('.like_icons').each(function () {
32554						if ($(this).find('.wish_item.text[data-item="' + item + '"]').length) {
32555							$(this).find('.wish_item.text[data-item="' + item + '"]').addClass('added');
32556							$(this).find('.wish_item.text[data-item="' + item + '"]').find('.value').hide();
32557							$(this).find('.wish_item.text[data-item="' + item + '"]').find('.value.added').css({ "display": "block" })
32558						}
32559						if ($(this).find('.wish_item_button').length) {
32560							/*$(this).find('.wish_item_button').find('.wish_item[data-item="'+item+'"]').addClass('added');
32561							$(this).find('.wish_item_button').find('.wish_item[data-item="'+item+'"]').find('.value').hide();
32562							$(this).find('.wish_item_button').find('.wish_item[data-item="'+item+'"]').find('.value.added').show();*/
32563							$(this).find('.wish_item_button').find('.wish_item[data-item="' + item + '"].to').hide();
32564							$(this).find('.wish_item_button').find('.wish_item[data-item="' + item + '"].in').show();
32565						}
32566					})
32567				}
32568			} else {
32569				if (!$(this).hasClass('added')) {
32570					$('.wish_item[data-item=' + item + ']').addClass('added');
32571					$('.wish_item[data-item=' + item + ']').find('.value').hide();
32572					$('.wish_item[data-item=' + item + ']').find('.value.added').css('display', 'block');
32573
32574					$('.wish_item.to[data-item=' + item + ']').hide();
32575					$('.wish_item.in[data-item=' + item + ']').show();
32576
32577
32578					$('.like_icons').each(function () {
32579						if ($(this).find('.wish_item_button').length) {
32580							$(this).find('.wish_item_button').find('.wish_item[data-item="' + item + '"]').addClass('added');
32581							$(this).find('.wish_item_button').find('.wish_item[data-item="' + item + '"]').find('.value').hide();
32582							$(this).find('.wish_item_button').find('.wish_item[data-item="' + item + '"]').find('.value.added').show();
32583						}
32584					})
32585				} else {
32586					$('.wish_item[data-item=' + item + ']').removeClass('added');
32587					$('.wish_item[data-item=' + item + ']').find('.value').show();
32588					$('.wish_item[data-item=' + item + ']').find('.value.added').hide();
32589
32590					$('.wish_item.to[data-item=' + item + ']').show();
32591					$('.wish_item.in[data-item=' + item + ']').hide();
32592
32593					$('.like_icons').each(function () {
32594						if ($(this).find('.wish_item_button').length) {
32595							$(this).find('.wish_item_button').find('.wish_item[data-item="' + item + '"]').removeClass('added');
32596							$(this).find('.wish_item_button').find('.wish_item[data-item="' + item + '"]').find('.value').show();
32597							$(this).find('.wish_item_button').find('.wish_item[data-item="' + item + '"]').find('.value.added').hide();
32598						}
32599					})
32600				}
32601			}
32602
32603			$('.in-cart[data-item=' + item + ']').hide();
32604			$('.to-cart[data-item=' + item + ']').removeClass('clicked');
32605			$('.to-cart[data-item=' + item + ']').parent().removeClass('wide');
32606			if (!$('.counter_block[data-item=' + item + ']').closest('.counter_wrapp').find('.to-order').length) {
32607				$('.to-cart[data-item=' + item + ']').show();
32608				$('.counter_block[data-item=' + item + ']').closest('.counter_block_inner').show();
32609				$('.counter_block[data-item=' + item + ']').show();
32610			}
32611
32612			if (bBannerAction) {
32613				_this.toggleClass('added');
32614
32615				if (_this.hasClass('added'))
32616					_this.attr('title', _this.data('title2'))
32617				else
32618					_this.attr('title', _this.data('title'))
32619
32620				if (wrapper_btns.find('.basket_item_add').length)
32621					wrapper_btns.find('.basket_item_add').removeClass('added');
32622			}
32623
32624			if (!$(this).closest('.module-cart').size()) {
32625				$.ajax({
32626					type: "GET",
32627					url: arAsproOptions['SITE_DIR'] + "ajax/item.php",
32628					data: "item=" + item2 + "&quantity=" + val + "&wish_item=Y" + "&offers=" + offer + "&iblockID=" + iblockid + "&props=" + JSON.stringify(props),
32629					dataType: "json",
32630					success: function (data) {
32631						getActualBasket(iblockid);
32632						arStatusBasketAspro = {};
32633						if (data !== null) {
32634							if (data.MESSAGE_EXT === null)
32635								data.MESSAGE_EXT = '';
32636							if ("STATUS" in data) {
32637								if (data.STATUS === 'OK') {
32638									if (arAsproOptions['COUNTERS']['USE_BASKET_GOALS'] !== 'N') {
32639										var eventdata = { goal: 'goal_wish_add', params: { id: item2 } };
32640										BX.onCustomEvent('onCounterGoals', [eventdata]);
32641									}
32642									if ($("#ajax_basket").length)
32643										reloadTopBasket('wish', $('#ajax_basket'), 200, 5000, 'N');
32644
32645									if ($("#basket_line .basket_fly").length) {
32646										if (_this.closest('.fast_view_frame').length || window.matchMedia('(max-width: 767px)').matches || $("#basket_line .basket_fly.loaded").length)
32647											basketFly('wish', 'N');
32648										else
32649											basketFly('wish');
32650									}
32651								} else {
32652									showBasketError(BX.message(data.MESSAGE) + ' <br/>' + data.MESSAGE_EXT, BX.message("ERROR_ADD_DELAY_ITEM"));
32653								}
32654							} else {
32655								showBasketError(BX.message(data.MESSAGE) + ' <br/>' + data.MESSAGE_EXT, BX.message("ERROR_ADD_DELAY_ITEM"));
32656							}
32657						} else {
32658							if ($("#ajax_basket").length)
32659								reloadTopBasket('wish', $('#ajax_basket'), 200, 5000, 'N');
32660
32661							if ($("#basket_line .basket_fly").length) {
32662								if (_this.closest('.fast_view_frame').length || window.matchMedia('(max-width: 767px)').matches || $("#basket_line .basket_fly.loaded").length)
32663									basketFly('wish', 'N');
32664								else
32665									basketFly('wish');
32666							}
32667						}
32668						_this.removeClass('clicked');
32669					}
32670				});
32671			}
32672		}
32673
32674	})
32675
32676	$(document).on('click', '.item_main_info .item_slider .flex-direction-nav li span', function (e) {
32677		if ($('.inner_slider .slides_block').length) {
32678			if ($(this).parent().hasClass('flex-nav-next'))
32679				$('.inner_slider .slides_block li.current').next().click();
32680			else
32681				$('.inner_slider .slides_block li.current').prev().click();
32682		}
32683	})
32684
32685	$(document).on('click', '.compare_item, .compare_item_add', function (e) {
32686		e.preventDefault();
32687		var item = $(this).attr('data-item');
32688		var iblockID = $(this).attr('data-iblock'),
32689			bBannerAction = false,
32690			th = $(this);
32691
32692		if (th.closest('.banner_buttons.with_actions').length) //banner action
32693		{
32694			var wrapper_btns = th.closest('.wraps_buttons');
32695			item = wrapper_btns.data('id');
32696			iblockID = wrapper_btns.data('iblockid');
32697			bBannerAction = true;
32698
32699			th.toggleClass('added');
32700
32701			if (th.hasClass('added'))
32702				th.attr('title', th.data('title2'))
32703			else
32704				th.attr('title', th.data('title'))
32705		}
32706
32707		if (!th.hasClass('clicked')) {
32708			th.addClass('clicked');
32709			if (!$(this).hasClass('text')) {
32710				if ($(this).hasClass('added')) {
32711					if (!bBannerAction) {
32712						$(this).hide();
32713						$(this).closest('.compare_item_button').find('.to').show();
32714					}
32715
32716					/*sync other button*/
32717					$('.like_icons').each(function () {
32718						if ($(this).find('.compare_item.text[data-item="' + item + '"]').length) {
32719							$(this).find('.compare_item.text[data-item="' + item + '"]').removeClass('added');
32720							$(this).find('.compare_item.text[data-item="' + item + '"]').find('.value').show();
32721							$(this).find('.compare_item.text[data-item="' + item + '"]').find('.value.added').hide();
32722						}
32723						if ($(this).find('.compare_item_button').length) {
32724							/*$(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"]').removeClass('added');
32725							$(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"]').find('.value').show();
32726							$(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"]').find('.value.added').hide();*/
32727							$(this).find('.compare_item_button').find('.compare_item[data-item="' + item + '"].in').hide();
32728							$(this).find('.compare_item_button').find('.compare_item[data-item="' + item + '"].to').show();
32729						}
32730					})
32731				}
32732				else {
32733					if (!bBannerAction) {
32734						$(this).hide();
32735						$(this).closest('.compare_item_button').find('.in').show();
32736					}
32737
32738					/*sync other button*/
32739					$('.like_icons').each(function () {
32740						if ($(this).find('.compare_item.text[data-item="' + item + '"]').length) {
32741							$(this).find('.compare_item.text[data-item="' + item + '"]').addClass('added');;
32742							$(this).find('.compare_item.text[data-item="' + item + '"]').find('.value').hide();
32743							$(this).find('.compare_item.text[data-item="' + item + '"]').find('.value.added').css({ "display": "block" });
32744						}
32745						if ($(this).find('.compare_item_button').length) {
32746							/*$(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"]').addClass('added');
32747							$(this).find('.comp
32747are_item_button').find('.compare_item[data-item="'+item+'"]').find('.value.added').show();
32748							$(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"]').find('.value').hide();*/
32749							$(this).find('.compare_item_button').find('.compare_item[data-item="' + item + '"].to').hide();
32750							$(this).find('.compare_item_button').find('.compare_item[data-item="' + item + '"].in').show();
32751						}
32752					})
32753				}
32754			} else {
32755				if (!$(this).hasClass('added')) {
32756					$('.compare_item[data-item=' + item + ']').addClass('added');
32757					$('.compare_item[data-item=' + item + ']').find('.value').hide();
32758					$('.compare_item[data-item=' + item + ']').find('.value.added').css('display', 'block');
32759
32760					/*sync other button*/
32761					$('.like_icons').each(function () {
32762						if ($(this).find('.compare_item_button').length) {
32763							$(this).find('.compare_item_button').find('.compare_item[data-item="' + item + '"]').addClass('added');
32764							$(this).find('.compare_item_button').find('.compare_item[data-item="' + item + '"]').find('.value.added').show();
32765							$(this).find('.compare_item_button').find('.compare_item[data-item="' + item + '"]').find('.value').hide();
32766						}
32767					})
32768				} else {
32769					$('.compare_item[data-item=' + item + ']').removeClass('added');
32770					$('.compare_item[data-item=' + item + ']').find('.value').show();
32771					$('.compare_item[data-item=' + item + ']').find('.value.added').hide();
32772
32773					/*sync other button*/
32774					$('.like_icons').each(function () {
32775						if ($(this).find('.compare_item_button').length) {
32776							$(this).find('.compare_item_button').find('.compare_item[data-item="' + item + '"]').removeClass('added');
32777							$(this).find('.compare_item_button').find('.compare_item[data-item="' + item + '"]').find('.value').show();
32778							$(this).find('.compare_item_button').find('.compare_item[data-item="' + item + '"]').find('.value.added').hide();
32779						}
32780					})
32781				}
32782			}
32783
32784			$.get(arAsproOptions['SITE_DIR'] + 'ajax/item.php?item=' + item + '&compare_item=Y&iblock_id=' + iblockID,
32785				$.proxy(function (data) {
32786					getActualBasket(iblockID, 'Compare');
32787					arStatusBasketAspro = {};
32788					if ($('#compare_fly').length) {
32789						jsAjaxUtil.InsertDataToNode(arAsproOptions['SITE_DIR'] + 'ajax/show_compare_preview_fly.php', 'compare_fly', false);
32790					}
32791					th.removeClass('clicked');
32792				})
32793			);
32794		}
32795
32796	});
32797
32798	$('.fancybox').fancybox({
32799		backFocus: false,
32800	});
32801
32802	$(document).on('click', '.tabs>li', function () {
32803		var parent = $(this).parent();
32804		if (!$(this).hasClass('active')) {
32805			var sliderIndex = $(this).index(),
32806				curLiNav = $(this).closest('.top_block').find('.slider_navigation').find('>li:eq(' + sliderIndex + ')'),
32807				curLi = $(this).closest('.top_block').siblings('.tabs_content').find('>li:eq(' + sliderIndex + ')');
32808			$(this).addClass('active').addClass('cur').siblings().removeClass('active').removeClass('cur');
32809			curLi.addClass('cur').siblings().removeClass('cur');
32810			curLiNav.addClass('cur').siblings().removeClass('cur');
32811
32812			if (parent.hasClass('ajax')) // front tabs
32813			{
32814				if (!$(this).hasClass('clicked')) {
32815					$.ajax({
32816						url: arAsproOptions['SITE_DIR'] + 'include/mainpage/comp_catalog_ajax.php',
32817						type: 'POST',
32818						data: { AJAX_POST: 'Y', FILTER_HIT_PROP: $(this).data('code'), AJAX_PARAMS: $(this).closest('.tab_slider_wrapp').find('.request-data').data('value'), GLOBAL_FILTER: curLi.data('filter') },
32819					}).success(function (html) {
32820						curLi.find('.tabs_slider').html(html);
32821						setTimeout(function () {
32822							curLi.addClass('opacity1');
32823						}, 100);
32824
32825						/*equal height*/
32826						// curLi.find('.catalog_block .catalog_item_wrapp .catalog_item .item_info:visible .item-title').sliceHeight({item:'.catalog_item:visible', mobile: true});
32827						// curLi.find('.catalog_block .catalog_item_wrapp .catalog_item .item_info:visible').sliceHeight({item:'.catalog_item:visible', mobile: true});
32828						// curLi.find('.catalog_block .catalog_item_wrapp .catalog_item:visible').sliceHeight({classNull: '.footer_button', item:'.catalog_item:visible', mobile: true});
32829
32830						initCountdown();
32831					})
32832					$(this).addClass('clicked');
32833				} else {
32834					$('.cur .catalog_block .catalog_item_wrapp.catalog_item:not(.big):visible').sliceHeight({
32835						classNull: '.footer_button',
32836						item: '.cur .catalog_block .catalog_item_wrapp.catalog_item:not(.big):visible',
32837						classes: [
32838							'.item_info .item-title',
32839							'.item_info .sa_block',
32840							'.item_info .cost.prices',
32841						],
32842						mobile: true,
32843					});
32844				}
32845			}
32846		}
32847	})
32848
32849	/*search click*/
32850	$('.search_block .icon').on('click', function () {
32851		var th = $(this);
32852		if ($(this).hasClass('open')) {
32853			$(this).closest('.center_block').find('.search_middle_block').removeClass('active');
32854			$(this).removeClass('open');
32855			$(this).closest('.center_block').find('.search_middle_block').find('.noborder').hide();
32856		} else {
32857			setTimeout(function () {
32858				th.closest('.center_block').find('.search_middle_block').find('.noborder').show();
32859			}, 100);
32860			$(this).closest('.center_block').find('.search_middle_block').addClass('active');
32861			$(this).addClass('open');
32862		}
32863	})
32864
32865	$(document).on('click', '.no_goods .button', function () {
32866		$('.bx_filter .smartfilter .bx_filter_search_reset').trigger('click');
32867	});
32868
32869	$(document).on('click', '.js-load-link', function (e) {
32870		AjaxClickLink(e)
32871	})
32872
32873	$(document).on('click', '.ajax_load_btn', function () {
32874		var
32875			_this = $(this),
32876			url = _this.closest('.container').find('.module-pagination .flex-direction-nav .flex-next').attr('href'),
32877			th = _this.find('.more_text_ajax'),
32878			bottom_nav = _this.closest('.bottom_nav'),
32879			bLoadingState = _this.closest('.animate-load-state').length,
32880			bCatalogInContent = _this.closest('.catalog_in_content').length;
32881
32882		if (!th.hasClass('loading')) {
32883			th.addClass('loading');
32884			if (bLoadingState)
32885				_this.addClass('loadings');
32886
32887			var objUrl = parseUrlQuery(),
32888				add_url = ''
32889			obGetData = { "ajax_get": "Y", "AJAX_REQUEST": "Y" };
32890
32891			if (_this.closest('.wrapper_inner.front').length) //index page
32892			{
32893				var class_block = th.closest('.drag-block').data('class').replace('_drag', '');
32894				class_block = class_block.replace(/\s/g, '');
32895				obGetData.BLOCK = class_block;
32896			}
32897
32898			if (_this.closest('.tab').length) //tabs block
32899			{
32900				var filter = th.closest('.tab').data('filter');
32901				obGetData.GLOBAL_FILTER = filter;
32902				url = _this.closest('.bottom_nav').find('.module-pagination .flex-direction-nav .flex-next').attr('href');
32903			}
32904
32905
32906			if (_this.closest('.content_linked_goods').length) //linked_goods block in content
32907			{
32908				var filterSections = th.closest('.content_linked_goods').attr('data-sections-ids');
32909				obGetData.ajax_section_id = decodeURIComponent(filterSections);
32910
32911				url = _this.closest('.bottom_nav').find('.module-pagination .flex-direction-nav .flex-next').attr('href');
32912			}
32913
32914			if ('clear_cache' in objUrl) {
32915				if (objUrl.clear_cache == 'Y')
32916					add_url = '&clear_cache=Y';
32917			}
32918			if (_this.hasClass('ajax'))
32919				obGetData.ajax = 'y';
32920
32921			if (th.closest('.goods-block.ajax_load'))
32922				obGetData.bitrix_include_areas = 'N';
32923			$.ajax({
32924				url: url + add_url,
32925				data: obGetData,
32926				success: function (html) {
32927					if (th.closest('.ajax_load').length) {
32928						th.removeClass('loading');
32929						if (th.closest('.ajax_load').find('.js_append').length) {
32930							if (bCatalogInContent) {
32931								th.closest('.ajax_load').find('.js_append').append($('.inner_wrapper .js_wrapper_items>', html));//need for brands & landings
32932							} else {
32933								th.closest('.ajax_load').find('.js_append').append(html);
32934							}
32935							th.closest('.ajax_load').find('.bottom_nav_wrapper').remove();
32936						}
32937						else {
32938							if ($('.display_list').length) {
32939								$('.display_list').append(html);
32940								th.closest('.display_list').find('.bottom_nav_wrapper').remove();
32941
32942							} else if ($('.block_list').length) {
32943								$('.block_list').append(html);
32944								touchItemBlock('.catalog_item a');
32945								th.closest('.block_list').find('.bottom_nav_wrapper').remove();
32946							} else if ($('.module_products_list').length) {
32947								$('.module_products_list > tbody').append(html);
32948								th.closest('.module_products_list > tbody').find('.bottom_nav_wrapper').remove();
32949							}
32950
32951						}
32952
32953
32954						setStatusButton();
32955						checkLinkedArticles();
32956
32957						var eventdata = { action: 'ajaxContentLoadedTab' };
32958						BX.onCustomEvent('onAjaxSuccess', [eventdata]);
32959						_this.closest('.bottom_nav').html($(html).find('.bottom_nav').html());
32960					}
32961					else {
32962						var eventdata = { action: 'ajaxContentLoaded' };
32963
32964						if ($('.banners-small.front').length) {
32965							$('.banners-small .items.row').append(html);
32966							$('.bottom_nav').html($('.banners-small .items.row .bottom_nav').html());
32967							$('.banners-small .items.row .bottom_nav').remove();
32968						}
32969						else {
32970							if (typeof bottom_nav.data('append') !== undefined && typeof bottom_nav.data('parent') !== undefined) {
32971								th.closest(bottom_nav.data('parent')).find(bottom_nav.data('append')).append(html);
32972								th.closest(bottom_nav.data('parent')).find(bottom_nav.data('append')).find('.bottom_nav_wrapper').remove();
32973
32974								bottom_nav.html($(html).find('.bottom_nav').html());
32975
32976								eventdata.container = th.closest(bottom_nav.data('parent'));
32977							}
32978							else {
32979								if (th.closest('.item-views').find('.items').length) {
32980									th.closest('.item-views').find('.items').append(html);
32981								}
32982								else {
32983									$(html).insertBefore($('.blog .bottom_nav'));
32984								}
32985
32986								bottom_nav.html($('.bottom_nav:hidden').html());
32987								_this.closest('.item-views').find('.bottom_nav:hidden').remove();
32988							}
32989						}
32990
32991						eventdata.content = html;
32992						eventdata.container = th;
32993						BX.onCustomEvent('onCompleteAction', [eventdata, th[0]]);
32994
32995						setTimeout(function () {
32996							$('.banners-small .item.normal-block').sliceHeight({ resize: false });
32997							if ($('.item.slice-item').length) {
32998								$('.item.slice-item .title').sliceHeight({ resize: false });
32999								$('.item.slice-item').sliceHeight({ resize: false });
33000							}
33001							th.removeClass('loading');
33002							if (bLoadingState)
33003								_this.removeClass('loadings');
33004						}, 100);
33005					}
33006					initCountdown();
33007				}
33008			})
33009		}
33010	})
33011
33012	// form rating
33013	$(document).on('mouseenter', '.form .votes_block.with-text .item-rating', function () {
33014		var $this = $(this),
33015			index = $this.index(),
33016			ratingValue = $this.data('rating_value'),
33017			ratingMessage = $this.data('message');
33018
33019		$(this).addClass('filed')
33020		$this.siblings().each(function () {
33021			if ($(this).index() <= index)
33022				$(this).addClass('filed')
33023			else
33024				$(this).removeClass('filed')
33025		});
33026		$this.closest('.votes_block').find('.rating_message').text(ratingMessage);
33027	});
33028
33029	$(document).on('mouseleave', '.form .votes_block.with-text', function () {
33030		var $this = $(this),
33031			index = $this.data('rating'),
33032			ratingMessage = $this.closest('.votes_block').find('.rating_message').data('message');
33033
33034		$this.find('.item-rating').each(function () {
33035			if ($(this).index() < index && index !== undefined)
33036				$(this).addClass('filed')
33037			else
33038				$(this).removeClass('filed')
33039		});
33040		$this.closest('.votes_block').find('.rating_message').text(ratingMessage);
33041	});
33042
33043	$(document).on('click', '.form .votes_block.with-text .item-rating', function () {
33044		var $this = $(this),
33045			rating = $this.closest('.votes_block').data('rating'),
33046			index = $this.index() + 1,
33047			ratingMessage = $this.data('message');
33048
33049		$this.closest('.votes_block').data('rating', index);
33050		if ($this.closest('.form-control').find('input[name=RATING]').length) {
33051			$this.closest('.form-control').find('input[name=RATING]').val(index);
33052		}
33053		else {
33054			$this.closest('.form-control').find('input[data-sid=RATING]').val(index);
33055		}
33056		$this.closest('.votes_block').find('.rating_message').data('message', ratingMessage);
33057	});
33058
33059	//set cookie for basket link click
33060	$(document).on('click', '.bx_ordercart_order_table_container .control > a, .basket-item-actions-remove, a[data-entity=basket-item-remove-delayed]', function (e) {
33061		$.removeCookie('click_basket', { path: '/' });
33062		$.cookie('click_basket', 'Y', { path: '/' });
33063	})
33064
33065	$(document).on('click', '.bx_compare .tabs-head li', function () {
33066		var url = $(this).find('.sortbutton').data('href');
33067		BX.showWait(BX("bx_catalog_compare_block"));
33068		$.ajax({
33069			url: url,
33070			data: { 'ajax_action': 'Y' },
33071			success: function (html) {
33072				history.pushState(null, null, url);
33073				$('#bx_catalog_compare_block').html(html);
33074				BX.closeWait();
33075			}
33076		})
33077	})
33078	var hoveredTrs;
33079	$(document).on({
33080		mouseover: function (e) {
33081			var _ = $(this);
33082			var tbodyIndex = _.closest('tbody').index() + 1; //+1 for nth-child
33083			var trIndex = _.index() + 1; // +1 for nth-child
33084			hoveredTrs = $(e.delegateTarget).find('.data_table_props')
33085				.children(':nth-child(' + tbodyIndex + ')')
33086				.children(':nth-child(' + trIndex + ')').addClass('hovered');
33087		},
33088		mouseleave: function (e) {
33089			if (hoveredTrs)
33090				hoveredTrs.removeClass('hovered');
33091		}
33092	}, '.bx_compare .data_table_props tbody>tr');
33093	$(document).on('click', '.fancy_offer', function (e) {
33094		e.preventDefault();
33095		var arPict = [], index = 0;
33096		$(this).closest('.item_slider').find('.sliders .slides_block li').each(function () {
33097			var obImg = {};
33098			obImg = {
33099				'title': $(this).find('img').attr('alt'),
33100				'href': $(this).data('big')
33101			}
33102			if ($(this).hasClass('current')) {
33103				index = $(this).index();
33104			}
33105			arPict.push(obImg);
33106		})
33107		$.fancybox(arPict, {
33108			index: index,
33109			openEffect: 'fade',
33110			closeEffect: 'fade',
33111			nextEffect: 'fade',
33112			prevEffect: 'fade',
33113			type: 'image',
33114			tpl: {
33115				closeBtn: '<a title="' + BX.message('FANCY_CLOSE') + '" class="fancybox-item fancybox-close" href="javascript:;"></a>',
33116				next: '<a title="' + BX.message('FANCY_NEXT') + '" class="fancybox-nav fancybox-next" href="javascript:;"><span></span></a>',
33117				prev: '<a title="' + BX.message('FANCY_PREV') + '" class="fancybox-nav fancybox-prev" href="javascript:;"><span></span></a>'
33118			},
33119		});
33120	})
33121
33122	/*tabs*/
33123	$(".tabs_section .tabs-head li").on("click", function () {
33124		if (!$(this).is(".current")) {
33125			$(".tabs_section .tabs-head li").removeClass("current");
33126			$(this).addClass("current");
33127			$(".tabs_section ul.tabs_content li").removeClass("current");
33128			if ($(this).attr("id") == "product_reviews_tab") {
33129				$(".shadow.common").hide(); $("#reviews_content").show();
33130			}
33131			else {
33132				$(".shadow.common").show();
33133				$("#reviews_content").hide();
33134				$(".tabs_section ul.tabs_content > li:eq(" + $(this).index() + ")").addClass("current");
33135			}
33136		}
33137	});
33138
33139	/*open first section slide*/
33140	setTimeout(function () {
33141		$('.jobs_wrapp .item:first .name tr').trigger('click');
33142	}, 300);
33143
33144	$('.choise').on('click', function () {
33145		var _this = $(this);
33146		if (typeof (_this.data('block')) != 'undefined') {
33147			if ($(_this.data('block')).closest('.tab-pane').length) {
33148				$('.ordered-block a[href="#' + $(_this.data('block')).closest('.tab-pane').attr('id') + '"]').click();
33149				// _this.data('block', '.ordered-block');
33150				$(_this.data('block')).data('offset', -100);
33151			}
33152			scrollToBlock(_this.data('block'));
33153		}
33154	})
33155
33156	$(document).on('click', '.buy_block .slide_offer', function () {
33157		scroll_block($('.js-offers-scroll'));
33158	});
33159	$('.share  > .share_wrapp .text').on('click', function () {
33160		var block = $(this).parent().find('.shares');
33161		if (!block.is(':visible') && !$(this).closest('.share.top').length)
33162			$('#content').css('z-index', 3);
33163		block.fadeToggle(100, function () {
33164			if (!block.is(':visible'))
33165				$('#content').css('z-index', 2);
33166		});
33167	})
33168	$('html, body').on('mousedown', function (e) {
33169		if (typeof e.target.className == 'string' && e.target.className.indexOf('adm') < 0) {
33170			e.stopPropagation();
33171			$('div.shares').fadeOut(100, function () {
33172				$('#content').css('z-index', 2);
33173				$('.price_txt .share_wrapp').removeClass('opened');
33174			});
33175			$('.search_middle_block').removeClass('active_wide');
33176		}
33177	})
33178	$('.share_wrapp').find('*').on('mousedown', function (e) {
33179		e.stopPropagation();
33180	});
33181
33182	$('.price_txt .share_wrapp .text').click(function () {
33183		$(this).parent().toggleClass('opened');
33184		$(this).parent().find('.shares').fadeToggle();
33185	})
33186
33187	$(document).on('click', '.reviews-collapse-link', function () {
33188		$('.reviews-reply-form').slideToggle();
33189	})
33190
33191	/* accordion action*/
33192	$('.panel-collapse').on('hidden.bs.collapse', function () {
33193		$(this).parent().toggleClass('opened');
33194	})
33195	$('.panel-collapse').on('show.bs.collapse', function () {
33196		$(this).parent().toggleClass('opened');
33197	})
33198
33199	/* accordion */
33200	$('.accordion-head').on('click', function (e) {
33201		e.preventDefault();
33202		if (!$(this).next().hasClass('collapsing')) {
33203			$(this).toggleClass('accordion-open');
33204			$(this).toggleClass('accordion-close');
33205		}
33206	});
33207
33208	/* progress bar */
33209	$('[data-appear-progress-animation]').each(function () {
33210		var $this = $(this);
33211		$this.appear(function () {
33212			var delay = ($this.attr('data-appear-animation-delay') ? $this.attr('data-appear-animation-delay') : 1);
33213			if (delay > 1)
33214				$this.css('animation-delay', delay + 'ms');
33215			$this.addClass($this.attr('data-appear-animation'));
33216
33217			setTimeout(function () {
33218				$this.animate({
33219					width: $this.attr('data-appear-progress-animation')
33220				}, 1500, 'easeOutQuad', function () {
33221					$this.find('.progress-bar-tooltip').animate({
33222						opacity: 1
33223					}, 500, 'easeOutQuad');
33224				});
33225			}, delay);
33226		}, { accX: 0, accY: -50 });
33227	});
33228
33229	initCountdown();
33230
33231	/* portfolio item */
33232	if ($('.item.animated-block').length) {
33233		$('.item.animated-block').appear(function () {
33234			var $this = $(this);
33235
33236			$this.addClass($this.data('animation')).addClass('visible');
33237
33238		}, { accX: 0, accY: 150 })
33239	}
33240
33241	/* flexslider appear */
33242	if ($('.appear-block').length) {
33243		$('.appear-block').appear(function () {
33244			var $this = $(this);
33245			$this.removeClass('appear-block');
33246
33247			CheckFlexSlider();
33248			InitFlexSlider()
33249		}, { accX: 0, accY: 150 })
33250	}
33251
33252	/* js-load-block appear */
33253	if ($('.js-load-block').length) {
33254		$('.js-load-block').appear(function () {
33255			var $this = $(this);
33256			if ($this.data('file')) {
33257				var objUrl = parseUrlQuery(),
33258					bClearCache = false,
33259					add_url = '';
33260				if ('clear_cache' in objUrl) {
33261					if (objUrl.clear_cache == 'Y') {
33262						add_url += '?clear_cache=Y';
33263						bClearCache = true;
33264					}
33265				}
33266				if ($this.data('block'))
33267					add_url += (bClearCache ? '&' : '?') + 'BLOCK=' + $this.data('block');
33268
33269				// return;
33270				$.get($this.data('file') + add_url)
33271					.done(function (html) {
33272						if ($this.data('appendTo')) {
33273							$this.find($this.data('appendTo')).html(html);
33274						}
33275						else {
33276							if ($this.find('> div[id*="bx_incl_"]').length) {
33277								$this.find('> div[id*="bx_incl_"]').html(html);
33278							}
33279							else {
33280								$this.html(html);
33281							}
33282						}
33283
33284						$this.removeAttr('data-file').removeClass('loader_circle');
33285
33286						var eventdata = { action: 'jsLoadBlock' };
33287						BX.onCustomEvent('onCompleteAction', [eventdata, $this]);
33288					})
33289			}
33290		}, { accX: 0, accY: 150 })
33291	}
33292
33293	/*show ajax store amount product*/
33294	$(document).on('click', '.js-show-info-block', function (e) {
33295		var $this = $(this);
33296		e.stopPropagation();
33297		$('.js-info-block').fadeOut();
33298
33299		if ($this.hasClass('opened')) {
33300			$('.js-show-info-block').removeClass('opened');
33301		}
33302		else {
33303			$('.js-show-info-block').removeClass('opened');
33304			$this.addClass('opened');
33305		}
33306
33307		if (!$this.siblings('.js-info-block').length) {
33308			var dataFields = $this.closest('.sa_block').data('fields');
33309			dataFields = dataFields == 'null' || dataFields === undefined ? '' : dataFields;
33310			var dataUserFields = $this.closest('.sa_block').data('user-fields');
33311			dataUserFields = dataUserFields == 'null' || dataUserFields === undefined ? '' : dataUserFields;
33312			var objUrl = parseUrlQuery(),
33313				add_url = '';
33314			if ('clear_cache' in objUrl) {
33315				if (objUrl.clear_cache == 'Y')
33316					add_url += '?clear_cache=Y';
33317			}
33318
33319			var obPostParams = {
33320				'ajax': 'Y',
33321				'ELEMENT_ID': $this.data('id'),
33322				'FIELDS': dataFields,
33323				'USER_FIELDS': dataUserFields,
33324				'STORES': $this.closest('.sa_block').data('stores') || ''
33325			};
33326
33327			$this.addClass('loadings');
33328			$.post(arAsproOptions['SITE_DIR'] + 'ajax/productStoreAmountCompact.php' + add_url, obPostParams)
33329				.done(function (html) {
33330					$this.removeClass('loadings');
33331					$(html).appendTo($this.closest('.sa_block'));
33332
33333					$this.siblings('.js-info-block').find('.more-btn a').attr('href', $this.closest('.item_info').find('a').attr('href'));
33334					InitScrollBar();
33335
33336					var eventdata = { action: 'jsShowStores' };
33337					BX.onCustomEvent('onCompleteAction', [eventdata, $this]);
33338				})
33339		}
33340		else {
33341			if ($this.hasClass('opened')) {
33342				$this.siblings('.js-info-block').find('.more-btn a').attr('href', $this.closest('.item_info').find('a').attr('href'));
33343				$this.siblings('.js-info-block').fadeIn();
33344				InitScrollBar();
33345			}
33346			else {
33347				$this.siblings('.js-info-block').fadeOut();
33348			}
33349		}
33350	})
33351	$(document).on('click', '.js-info-block .svg-inline-close', function () {
33352		$('.js-show-info-block').removeClass('opened');
33353		$(this).closest('.js-info-block').fadeOut();
33354	})
33355	/**/
33356
33357	/*adaptive menu start*/
33358	$('.menu.adaptive').on('click', function () {
33359		$(this).toggleClass('opened');
33360		if ($(this).hasClass('opened')) {
33361			$('.mobile_menu').toggleClass('opened').slideDown();
33362		} else {
33363			$('.mobile_menu').toggleClass('opened').slideUp();
33364		}
33365	});
33366	$('.mobile_menu .has-child >a').on('click', function (e) {
33367		var parentLi = $(this).parent();
33368		e.preventDefault();
33369		parentLi.toggleClass('opened');
33370		parentLi.find('.dropdown').slideToggle();
33371	})
33372
33373	$('.mobile_menu .search-input-div input').on('keyup', function (e) {
33374		var inputValue = $(this).val();
33375		$('.center_block .stitle_form input').val(inputValue);
33376		if (e.keyCode == 13) {
33377			$('.center_block .stitle_form form').submit();
33378		}
33379	});
33380
33381	$('.center_block .stitle_form input').on('keyup', function (e) {
33382		var inputValue = $(this).val();
33383		$('.mobile_menu .search-input-div input').val(inputValue);
33384		if (e.keyCode == 13) {
33385			$('.center_block .stitle_form form').submit();
33386		}
33387	});
33388
33389	$('.mobile_menu .search-button-div button').on('click', function (e) {
33390		e.preventDefault();
33391		var inputValue = $(this).parents().find('input').val();
33392		$('.center_block .stitle_form input').val(inputValue);
33393		$('.center_block .stitle_form form').submit();
33394	});
33395	/*adaptive menu end*/
33396
33397	$(document).on('click', '.mega-menu .dropdown-menu', function (e) {
33398		e.stopPropagation()
33399	});
33400
33401	$(document).on('click', '.mega-menu .dropdown-toggle.more-items', function (e) {
33402		e.preventDefault();
33403	});
33404
33405	$(document).on('mouseenter', '.table-menu .dropdown,.table-menu .dropdown-submenu,.table-menu .dropdown-toggle', function () {
33406		setTimeout(
33407			function () {
33408				CheckTopVisibleMenu();
33409			}, 275);
33410
33411	});
33412	$(document).on('mouseenter', '#headerfixed .table-menu .dropdown-menu .dropdown-submenu', function () {
33413		setTimeout(
33414			function () {
33415				CheckTopVisibleMenu();
33416			}, 275);
33417	});
33418
33419	$('.mega-menu .search-item .search-icon, .menu-row #title-search .fa-close').on('click', function (e) {
33420		e.preventDefault();
33421		$('.menu-row #title-search').toggleClass('hide');
33422	});
33423
33424	$('.mega-menu ul.nav .search input').on('keyup', function (e) {
33425		var inputValue = $(this).val();
33426		$('.menu-row > .search input').val(inputValue);
33427		if (e.keyCode == 13) {
33428			$('.menu-row > .search form').submit();
33429		}
33430	});
33431
33432	$('.menu-row > .search input').on('keyup', function (e) {
33433		var inputValue = $(this).val();
33434		$('.mega-menu ul.nav .search input').val(inputValue);
33435		if (e.keyCode == 13) {
33436			$('.menu-row > .search form').submit();
33437		}
33438	});
33439
33440	$('.mega-menu ul.nav .search button').on('click', function (e) {
33441		e.preventDefault();
33442		var inputValue = $(this).parents('.search').find('input').val();
33443		$('.menu-and-search .search input').val(inputValue);
33444		$('.menu-row > .search form').submit();
33445	});
33446
33447	$('.btn.btn-add').on('click', function () {
33448		$.ajax({
33449			type: "GET",
33450			url: arAsproOptions['SITE_DIR'] + "ajax/clearBasket.php",
33451			success: function (data) {
33452			}
33453		});
33454	})
33455
33456	$('.sort_display a').on('click', function () {
33457		$(this).siblings().removeClass('current');
33458		$(this).addClass('current');
33459	})
33460
33461	/*detail order show payments*/
33462	$('.sale-order-detail-payment-options-methods-info-change-link').on('click', function () {
33463		$(this).closest('.sale-order-detail-payment-options-methods-info').addClass('opened').siblings().addClass('opened');
33464	})
33465
33466	/*expand/hide filter values*/
33467	$(document).on('click', '.expand_block', function () {
33468		togglePropBlock($(this));
33469	})
33470
33471	/*touch event*/
33472	document.addEventListener('touchend', function (event) {
33473		if (!$(event.target).closest('.menu-item').length && !$(event.target).hasClass('menu-item')) {
33474			$('.menu-row .dropdown-menu').css({ 'display': 'none', 'opacity': 0 });
33475			$('.menu-item').removeClass('hover');
33476			$('.bx-breadcrumb-item.drop').removeClass('hover');
33477		}
33478		if (!$(event.target).closest('.menu.topest').length) {
33479			$('.menu.topest').css({ 'overflow': 'hidden' });
33480			$('.menu.topest > li').removeClass('hover');
33481		}
33482		if (!$(event.target).closest('.full.has-child').length) {
33483			$('.menu_top_block.catalog_block li').removeClass('hover');
33484		}
33485		if (!$(event.target).closest('.basket_block').length) {
33486			$('.basket_block .link').removeClass('hover');
33487			$('.basket_block .basket_popup_wrapp').slideUp();
33488		}
33489		if (!$(event.target).closest('.catalog_item').length) {
33490			var tabsContentUnhoverHover = $('.tab:visible').attr('data-unhover') * 1;
33491			$('.tab:visible').stop().animate({ 'height': tabsContentUnhoverHover }, 100);
33492			$('.tab:visible').find('.catalog_item').removeClass('hover');
33493			$('.tab:visible').find('.catalog_item .buttons_block').stop().fadeOut(233);
33494			if ($('.catalog_block').length) {
33495				$('.catalog_block').find('.catalog_item_wrapp').removeClass('hover');
33496				$('.catalog_block').find('.catalog_item').removeClass('hover');
33497			}
33498		}
33499		//togglePropBlock($(event.target));
33500
33501	}, false);
33502
33503
33504	touchMenu('.menu-row .menu-item');
33505	touchTopMenu('.menu.topest li');
33506	touchLeftMenu('.menu_top_block li.full');
33507	touchBreadcrumbs('.bx-breadcrumb-item.drop');
33508
33509	$(document).on('keyup', '.coupon .input_coupon input', function () {
33510		if ($(this).val().length) {
33511			$(this).removeClass('error');
33512			$(this).closest('.input_coupon').find('.error').remove();
33513		} else {
33514			$(this).addClass('error');
33515			$("<label class='error'>" + BX.message("INPUT_COUPON") + "</label>").insertBefore($(this));
33516		}
33517	})
33518	showPhoneMask('input[autocomplete=tel]');
33519	BX.addCustomEvent(window, "onAjaxSuccessFilter", function (e) {
33520		setBasketStatusBtn();
33521		checkLinkedArticles();
33522	});
33523
33524	$(document).on('click', '.block_container .items .item.initied', function () {
33525		var _this = $(this),
33526			itemID = _this.data('id'),
33527			animationTime = 200;
33528
33529		_this.closest('.items').fadeOut(animationTime, function () {
33530			_this.closest('.block_container').find('.detail_items').fadeIn(animationTime);
33531			_this.closest('.block_container').find('.detail_items .item[data-id=' + itemID + ']').fadeIn(animationTime);
33532
33533			var arCoordinates = _this.data('coordinates').split(',');
33534
33535			if (typeof map !== 'undefined')
33536				map.setCenter([arCoordinates[0], arCoordinates[1]], 15);
33537		});
33538	});
33539
33540	$(document).on('click', '.block_container .top-close', function () {
33541		var _this = $(this).closest('.block_container').find('.detail_items .item:visible'),
33542			animationTime = 200;
33543		_this.fadeOut(animationTime);
33544		_this.closest('.block_container').find('.detail_items').fadeOut(animationTime, function () {
33545			_this.closest('.block_container').find('.items').fadeIn(animationTime);
33546
33547			if (typeof map !== 'undefined' && typeof clusterer !== 'undefined') {
33548				map.setBounds(clusterer.getBounds(), {
33549					zoomMargin: 40,
33550					// checkZoomRange: true
33551				});
33552			}
33553		});
33554	});
33555
33556	BX.addCustomEvent(window, "onAjaxSuccess", function (e) {
33557		if (e != 'OK') {
33558			if (typeof (e) !== 'undefined' && e && typeof (e.FILTER_URL) != 'undefined' && typeof (e.ELEMENT_COUNT) != 'undefined') {
33559				mobileFilterNum(e.ELEMENT_COUNT);
33560			}
33561
33562			initSelects(document);
33563			InitOrderCustom();
33564			showPhoneMask('input[autocomplete=tel]');
33565
33566			/*scroll in mobile for filter*/
33567			if ($('.bx_filter').length) {
33568				if (window.matchMedia('(min-width: 768px)').matches) {
33569					$('.bx_filter .scrollbar').removeClass('mobile-scroll');
33570					$('.bx_filter .srollbar-custom').removeClass('mobile-scroll');
33571					$('.bx_filter .bx_filter_section form .bx_filter_parameters').removeClass('mobile-scroll');
33572					InitScrollBar();
33573					InitCustomScrollBar();
33574				}
33575
33576				if (window.matchMedia('(max-width: 767px)').matches) {
33577					$('.bx_filter .scrollbar').addClass('mobile-scroll');
33578					$('.bx_filter .srollbar-custom').addClass('mobile-scroll');
33579					$('.bx_filter .bx_filter_section form .bx_filter_parameters').addClass('mobile-scroll');
33580					if ($('.bx_filter .mobile-scroll.scrollbar').length)
33581						$('.bx_filter .mobile-scroll.scrollbar').mCustomScrollbar("destroy");
33582					if ($('.bx_filter .mobile-scroll.srollbar-custom').length)
33583						$('.bx_filter .mobile-scroll.srollbar-custom').mCustomScrollbar("destroy");
33584				}
33585			}
33586			/*end*/
33587
33588			if ($('.catalog_detail').length && !$('.fast_view_frame').length) {
33589				$('.bx_filter').remove();
33590				InitFlexSlider();
33591				InitOwlSlider();
33592			}
33593			if (arAsproOptions["PAGES"]["CATALOG_PAGE"]) {
33594				initCountdown();
33595
33596				if (typeof window['stickySidebar'] !== 'undefined')
33597					window['stickySidebar'].updateSticky();
33598			}
33599
33600			if (arAsproOptions["PAGES"]["ORDER_PAGE"]) {
33601				orderActions(e);
33602			}
33603		}
33604	});
33605
33606	//event for default basket quantity change
33607	BX.addCustomEvent(window, "OnBasketChange", function (e) {
33608		if (arAsproOptions["PAGES"]["BASKET_PAGE"]) {
33609			var summ = 0,
33610				title = '';
33611
33612			if (typeof BX.Sale !== "undefined") {
33613				if (typeof BX.Sale.BasketComponent !== "undefined") {
33614					summ = BX.Sale.BasketComponent.result.allSum;
33615					title = BX.message('JS_BASKET_COUNT_TITLE').replace('SUMM', summ);
33616				}
33617			}
33618			else {
33619				summ = $('#allSum_FORMATED').html().replace(/&nbsp;/g, ' ');
33620				title = BX.message('JS_BASKET_COUNT_TITLE').replace('SUMM', summ);
33621			}
33622
33623			if ($('.js-basket-block .wrap .prices').length)
33624				$('.js-basket-block .wrap .prices').html(summ);
33625			if ($('a.basket-link.basket').length)
33626				$('a.basket-link.basket').attr('title', title);
33627			if ($('.basket_fly .opener .basket_count').length)
33628				$('.basket_fly .opener .basket_count').attr('title', title);
33629
33630		}
33631	})
33632	BX.addCustomEvent(window, "onFrameDataRequestFail", function (response) {
33633		console.log(response);
33634	});
33635
33636});
33637
33638if (!funcDefined('setBasketStatusBtn')) {
33639	setBasketStatusBtn = function (type) {
33640		var bSync = (typeof type !== undefined);
33641		if (typeof (arBasketAspro) !== 'undefined') {
33642			if ('BASKET' in arBasketAspro) // basket items
33643			{
33644				if (arBasketAspro.BASKET) {
33645					for (var i in arBasketAspro.BASKET) {
33646						$('.to-cart[data-item=' + i + ']').hide();
33647						$('.counter_block[data-item=' + i + ']').closest('.counter_block_inner').hide();
33648						$('.counter_block[data-item=' + i + ']').hide();
33649						$('.in-cart[data-item=' + i + ']').show();
33650						$('.in-cart[data-item=' + i + ']').closest('.button_block').addClass('wide');
33651
33652						$('.wish_item.to[data-item=' + i + ']').show();
33653						$('.wish_item.in[data-item=' + i + ']').hide();
33654
33655						if ($('.banner_buttons.with_actions .wraps_buttons[data-id=' + i + '] .basket_item_add').length) {
33656							$('.banner_buttons.with_actions .wraps_buttons[data-id=' + i + '] .basket_item_add').addClass('added')
33657							$('.banner_buttons.with_actions .wraps_buttons[data-id=' + i + '] .basket_item_add').attr('title', $('.banner_buttons.with_actions .wraps_buttons[data-id=' + i + '] .basket_item_add').data('title2'))
33658						}
33659
33660
33661					}
33662				}
33663			}
33664
33665			if ('DELAY' in arBasketAspro) // delay items
33666			{
33667				if (arBasketAspro.DELAY) {
33668					for (var i in arBasketAspro.DELAY) {
33669						$('.wish_item.to[data-item=' + i + ']').hide();
33670						$('.wish_item.in[data-item=' + i + ']').show();
33671						if ($('.wish_item[data-item=' + i + ']').find(".value.added").length) {
33672							//$('.wish_item[data-item='+i+']').addClass("added");
33673							$('.wish_item[data-item=' + i + ']').find(".value").hide();
33674							$('.wish_item[data-item=' + i + ']').find(".value.added").css('display', 'block');
33675						}
33676
33677						$('.in-cart[data-item=' + i + ']').hide();
33678						$('.to-cart[data-item=' + i + ']').show();
33679						$('.to-cart[data-item=' + i + ']').closest('.counter_wrapp').find('.counter_block_inner').show();
33680						$('.to-cart[data-item=' + i + ']').closest('.counter_wrapp').find('.counter_block').show();
33681						$('.to-cart[data-item=' + i + ']').closest('.button_block').removeClass('wide');
33682
33683						if ($('.banner_buttons.with_actions .wraps_buttons[data-id=' + i + '] .wish_item_add').length) {
33684							$('.banner_buttons.with_actions .wraps_buttons[data-id=' + i + '] .wish_item_add').addClass('added')
33685							$('.banner_buttons.with_actions .wraps_buttons[data-id=' + i + '] .wish_item_add').attr('title', $('.banner_buttons.with_actions .wraps_buttons[data-id=' + i + '] .wish_item_add').data('title2'))
33686						}
33687					}
33688				}
33689			}
33690
33691			if ('SUBSCRIBE' in arBasketAspro) // subscribe items
33692			{
33693				if (arBasketAspro.SUBSCRIBE) {
33694					for (var i in arBasketAspro.SUBSCRIBE) {
33695						$('.to-subscribe[data-item=' + i + ']').hide();
33696						$('.in-subscribe[data-item=' + i + ']').show();
33697					}
33698				}
33699			}
33700
33701			if ('COMPARE' in arBasketAspro) // compare items
33702			{
33703				if (arBasketAspro.COMPARE) {
33704					for (var i in arBasketAspro.COMPARE) {
33705						$('.compare_item.to[data-item=' + i + ']').hide();
33706						$('.compare_item.in[data-item=' + i + ']').show();
33707						if ($('.compare_item[data-item=' + i + ']').find(".value.added").length) {
33708							//$('.compare_item[data-item='+i+']').addClass("added");
33709							$('.compare_item[data-item=' + i + ']').find(".value").hide();
33710							$('.compare_item[data-item=' + i + ']').find(".value.added").css('display', 'block');
33711						}
33712
33713						if ($('.banner_buttons.with_actions .wraps_buttons[data-id=' + i + '] .compare_item_add').length) {
33714							$('.banner_buttons.with_actions .wraps_buttons[data-id=' + i + '] .compare_item_add').addClass('added')
33715							$('.banner_buttons.with_actions .wraps_buttons[data-id=' + i + '] .compare_item_add').attr('title', $('.banner_buttons.with_actions .wraps_buttons[data-id=' + i + '] .compare_item_add').data('title2'))
33716						}
33717					}
33718				}
33719			}
33720		}
33721	}
33722}
33723
33724if (!funcDefined('togglePropBlock')) {
33725	togglePropBlock = function (className) {
33726		var all_props_block = className.closest('.bx_filter_parameters_box_container').find('.hidden_values');
33727		if (all_props_block.length && (className.hasClass('inner_text') || className.hasClass('expand_block'))) {
33728			if (all_props_block.is(':visible')) {
33729				className.text(BX.message('FILTER_EXPAND_VALUES'));
33730				all_props_block.hide();
33731			}
33732			else {
33733				className.text(BX.message('FILTER_HIDE_VALUES'));
33734				all_props_block.show();
33735			}
33736		}
33737	}
33738}
33739
33740if (!funcDefined('showPhoneMask')) {
33741	showPhoneMask = function (className) {
33742		$(className).inputmask('mask', { 'mask': arAsproOptions['THEME']['PHONE_MASK'], 'showMaskOnHover': false });
33743	}
33744}
33745
33746if (!funcDefined('parseUrlQuery')) {
33747	parseUrlQuery = function () {
33748		var data = {};
33749		if (location.search) {
33750			var pair = (location.search.substr(1)).split('&');
33751			for (var i = 0; i < pair.length; i++) {
33752				var param = pair[i].split('=');
33753				data[param[0]] = param[1];
33754			}
33755		}
33756		return data;
33757	}
33758}
33759
33760if (!funcDefined('getActualBasket')) {
33761	getActualBasket = function (iblockID, type, sync) {
33762		var data = '';
33763		if (typeof iblockID !== "undefined" && iblockID) {
33764			data = { "iblockID": iblockID }
33765		}
33766		$.ajax({
33767			type: "GET",
33768			url: arAsproOptions['SITE_DIR'] + "ajax/actualBasket.php",
33769			data: data,
33770			success: function (data) {
33771				if (!$('.js_ajax').length)
33772					$('body').append('<div class="js_ajax"></div>');
33773				$('.js_ajax').html(data);
33774
33775				if (typeof sync !== "undefined") {
33776					setBasketStatusBtn(true);
33777				}
33778
33779				if (typeof (type) !== undefined) {
33780					var eventdata = { action: 'loadActualBasket' + type };
33781					BX.onCustomEvent('onCompleteAction', [eventdata]);
33782				}
33783			}
33784		});
33785	}
33786}
33787
33788if (!funcDefined('reloadBasketCounters')) {
33789	reloadBasketCounters = function (count, sync) {
33790		var data = '';
33791		if (count) {
33792			$('.basket-link.basket .count, .wraps_icon_block.basket .count .items > span').text(count);
33793		} else {
33794			$.ajax({
33795				type: "GET",
33796				url: arAsproOptions['SITE_DIR'] + "ajax/actualBasket.php",
33797				data: data,
33798				success: function (data) {
33799					if (!$('.js_ajax').length)
33800						$('body').append('<div class="js_ajax"></div>');
33801					$('.js_ajax').html(data);
33802
33803					$('.basket-link.basket .count, .wraps_icon_block.basket .count .items > span').text(Object.keys(arBasketAspro.BASKET).length);
33804					$('.basket-link.delay .count, .wraps_icon_block.delay .count .items > span').text(Object.keys(arBasketAspro.DELAY).length);
33805					$('.basket-link.compare .count, .wraps_icon_block.compare .count .items > span').text(Object.keys(arBasketAspro.COMPARE).length);
33806
33807					if (typeof sync !== 'undefined') {
33808						setBasketStatusBtn(true);
33809						basketTop();
33810					}
33811				}
33812			});
33813		}
33814	}
33815}
33816
33817function touchMenu(selector) {
33818	if (isMobile) {
33819		if ($(selector).length) {
33820			$(selector).each(function () {
33821				var th = $(this);
33822				th.on('touchend', function (e) {
33823					var _th = $(e.target).closest('.menu-item');
33824
33825					$('.menu.topest > li').removeClass('hover');
33826					$('.menu_top_block.catalog_block li').removeClass('hover');
33827					$('.bx-breadcrumb-item.drop').removeClass('hover');
33828
33829					if (_th.find('.dropdown-menu').length && !_th.hasClass('hover')) {
33830						e.preventDefault();
33831						e.stopPropagation();
33832						_th.siblings().removeClass('hover');
33833						_th.addClass('hover');
33834						$('.menu-row .dropdown-menu').css({ 'display': 'none', 'opacity': 0 });
33835						if (_th.hasClass('menu-item')) {
33836							_th.closest('.dropdown-menu').css({ 'display': 'block', 'opacity': 1 });
33837						}
33838						if (_th.find('> .wrap > .dropdown-menu')) {
33839							_th.find('> .wrap > .dropdown-menu').css({ 'display': 'block', 'opacity': 1 });
33840						}
33841						else if (_th.find('> .dropdown-menu')) {
33842							_th.find('> .dropdown-menu').css({ 'display': 'block', 'opacity': 1 });
33843						}
33844						CheckTopVisibleMenu();
33845					}
33846					else {
33847						var href = ($(e.target).attr('href') ? $(e.target).attr('href') : $(e.target).closest('a').attr('href'))
33848						if (href && href !== 'undefined')
33849							location.href = href;
33850					}
33851				})
33852			})
33853		}
33854	} else {
33855		$(selector).off();
33856	}
33857}
33858
33859function touchTopMenu(selector) {
33860	if (isMobile) {
33861		if ($(selector).length) {
33862			$(selector).each(function () {
33863				var th = $(this);
33864				th.on('touchend', function (e) {
33865					var _th = $(e.target).closest('li');
33866
33867					$('.menu-item').removeClass('hover');
33868					$('.menu_top_block.catalog_block li').removeClass('hover');
33869					$('.bx-breadcrumb-item.drop').removeClass('hover');
33870
33871					if (_th.hasClass('more') && !_th.hasClass('hover')) {
33872						e.preventDefault();
33873						e.stopPropagation();
33874						_th.siblings().removeClass('hover');
33875						_th.addClass('hover');
33876						$('.menu.topest').css({ 'overflow': 'visible' });
33877					}
33878					else {
33879						var href = ($(e.target).attr('href') ? $(e.target).attr('href') : $(e.target).closest('a').attr('href'))
33880						if (href && href !== 'undefined')
33881							location.href = href;
33882					}
33883				})
33884			})
33885		}
33886	} else {
33887		$(selector).off();
33888	}
33889}
33890
33891function touchLeftMenu(selector) {
33892	if (isMobile) {
33893		if ($(selector).length) {
33894			$(selector).each(function () {
33895				var th = $(this);
33896				th.on('touchend', function (e) {
33897					var _th = $(e.target).closest('li');
33898
33899					$('.menu-item').removeClass('hover');
33900					$('.bx-breadcrumb-item.drop').removeClass('hover');
33901					$('.menu.topest > li').removeClass('hover');
33902
33903					if (_th.hasClass('has-child') && !_th.hasClass('hover')) {
33904						e.preventDefault();
33905						e.stopPropagation();
33906						_th.siblings().removeClass('hover');
33907						_th.addClass('hover');
33908					}
33909					else {
33910						var href = ($(e.target).attr('href') ? $(e.target).attr('href') : $(e.target).closest('a').attr('href'))
33911						if (href && href !== 'undefined')
33912							location.href = href;
33913					}
33914				})
33915			})
33916		}
33917	} else {
33918		$(selector).off();
33919	}
33920}
33921
33922function touchBreadcrumbs(selector) {
33923	if (isMobile) {
33924		if ($(selector).length) {
33925			$(selector).each(function () {
33926				var th = $(this);
33927				th.on('touchend', function (e) {
33928					var _th = $(e.target).closest('.bx-breadcrumb-item');
33929
33930					$('.menu-item').removeClass('hover');
33931					$('.menu.topest > li').removeClass('hover');
33932					$('.menu_top_block.catalog_block li').removeClass('hover');
33933
33934					if (!_th.hasClass('hover')) {
33935						e.preventDefault();
33936						e.stopPropagation();
33937						_th.siblings().removeClass('hover');
33938						_th.addClass('hover');
33939					}
33940					else {
33941						_th.removeClass('hover');
33942						var href = ($(e.target).attr('href') ? $(e.target).attr('href') : $(e.target).closest('a').attr('href'));
33943						if (href && href !== 'undefined')
33944							location.href = href;
33945					}
33946				})
33947			})
33948		}
33949	} else {
33950		$(selector).off();
33951	}
33952}
33953
33954function touchItemBlock(selector) {
33955	/*if(isMobile){
33956		if($(selector).length)
33957		{
33958			$(selector).each(function(){
33959				var th=$(this),
33960					item=th.closest('.catalog_item');
33961				th.on('touchend', function(e) {
33962					if (!item.hasClass('hover')) {
33963						e.preventDefault();
33964						// e.stopPropagation();
33965						item.siblings().removeClass('hover');
33966						item.siblings().blur();
33967						item.closest('.catalog_block').find('.catalog_item').removeClass('hover');
33968						item.addClass('hover');
33969						item.addClass('touch');
33970
33971						var tabsContentHover = th.closest('.tab').attr('data-hover') * 1,
33972							tabsContentUnhoverHover = th.closest('.tab').attr('data-unhover') * 1;
33973
33974						th.closest('.tab').stop().animate({'height': tabsContentUnhoverHover}, 100);
33975						th.closest('.catalog_item').siblings().find('.buttons_block').stop().fadeOut(233)
33976
33977						th.closest('.tab').fadeTo(100, 1);
33978						th.closest('.tab').stop().css({'height': tabsContentHover});
33979						th.closest('.catalog_item').find('.buttons_block').fadeIn(450, 'easeOutCirc');
33980					}
33981				})
33982			})
33983		}
33984	}else{
33985		$(selector).off();
33986	}*/
33987}
33988function touchBasket(selector) {
33989	if (arAsproOptions['THEME']['SHOW_BASKET_ONADDTOCART'] !== 'N') {
33990		if ($(window).outerWidth() > 600) {
33991			$(document).find(selector).on('touchend', function (e) {
33992				if ($(this).parent().find('.basket_popup_wrapp').length && !$(this).hasClass('hover')) {
33993					e.preventDefault();
33994					e.stopPropagation();
33995					$(this).addClass('hover');
33996					$(this).parent().find('.basket_popup_wrapp').slideDown();
33997				}
33998			})
33999		} else {
34000			$(selector).off();
34001		}
34002	}
34003}
34004
34005function showTotalSummItem(popup) {
34006	//show total summ
34007	if (arAsproOptions["THEME"]["SHOW_TOTAL_SUMM_TYPE"] == "ALWAYS" && arAsproOptions["THEME"]["SHOW_TOTAL_SUMM"] == "Y") {
34008		var parent = 'body ';
34009		if (typeof popup === 'string' && popup == 'Y')
34010			parent = '.popup ';
34011		$(parent + '.counter_wrapp .counter_block input.text').each(function () {
34012			var _th = $(this);
34013			if (_th.data('product')) {
34014				var obProduct = _th.data('product');
34015				if (typeof window[obProduct] == 'object')
34016					window[obProduct].setPriceAction('Y');
34017				else
34018					setPriceItem(_th.closest('.main_item_wrapper'), _th.val());
34019			}
34020			else
34021				setPriceItem(_th.closest('.main_item_wrapper'), _th.val());
34022		})
34023	}
34024}
34024
34025
34026function initFull() {
34027	initSelects(document);
34028	initHoverBlock(document);
34029	touchItemBlock('.catalog_item a');
34030	InitOrderCustom();
34031	showTotalSummItem();
34032	basketActions();
34033	orderActions();
34034
34035	checkMobileRegion();
34036}
34037
34038checkMobileRegion = function () {
34039	if ($('.confirm_region').length) {
34040		if (!$('.top_mobile_region').length)
34041			$('<div class="top_mobile_region"><div class="confirm_wrapper"><div class="confirm_region"></div><div class="close_popup"></div></div></div>').insertBefore($('#mobileheader'));
34042		$('.top_mobile_region .confirm_region').html($('.confirm_region').html());
34043
34044		$('.top_mobile_region .close_popup').click(function () {
34045			$(this).remove();
34046			$('.confirm_region').remove();
34047		})
34048	}
34049}
34050if (!funcDefined('orderActions')) {
34051	orderActions = function (e) {
34052		if (arAsproOptions["PAGES"]["ORDER_PAGE"]) {
34053			//phone
34054			if ($('#bx-soa-order input[autocomplete=tel]').length) {
34055				// get property phone
34056				for (var i = 0; i < BX.Sale.OrderAjaxComponent.result.ORDER_PROP.properties.length; ++i) {
34057					if (BX.Sale.OrderAjaxComponent.result.ORDER_PROP.properties[i].IS_PHONE == 'Y') {
34058						var arPropertyPhone = BX.Sale.OrderAjaxComponent.result.ORDER_PROP.properties[i];
34059					}
34060				}
34061
34062				// validate input type=tel
34063				if (typeof (BX.Sale.OrderAjaxComponent) !== 'undefined' && typeof (BX.Sale.OrderAjaxComponent) === 'object' && typeof (arPropertyPhone) == 'object' && arPropertyPhone) {
34064					BX.Sale.OrderAjaxComponent.validatePhone = function (input, arProperty, fieldName) {
34065						if (!input || !arProperty)
34066							return [];
34067
34068						var value = input.value,
34069							errors = [],
34070							name = BX.util.htmlspecialchars(arProperty.NAME),
34071							field = BX.message('SOA_FIELD') + ' "' + name + '"',
34072							re;
34073
34074						if (arProperty.REQUIRED == 'Y' && value.length == 0) {
34075							errors.push(field + ' ' + BX.message('SOA_REQUIRED'));
34076						}
34077
34078						if (arProperty.IS_PHONE == 'Y' && value.length > 0) {
34079							function regexpPhone(value, element, regexp) {
34080								var re = new RegExp(regexp);
34081								return re.test(value);
34082							}
34083
34084							var validPhone = regexpPhone($(input).val(), $(input), arAsproOptions['THEME']['VALIDATE_PHONE_MASK']);
34085
34086							if (!validPhone) {
34087								errors.push(field + ' ' + BX.message('JS_FORMAT_ORDER'));
34088							}
34089						}
34090
34091						return errors;
34092					}
34093
34094					BX.Sale.OrderAjaxComponent.getValidationDataPhone = function (arProperty, propContainer) {
34095						var data = {}, inputs;
34096						switch (arProperty.TYPE) {
34097							case 'STRING':
34098								data.action = 'blur';
34099								data.func = BX.delegate(function (input, fieldName) {
34100									return this.validatePhone(input, arProperty, fieldName);
34101								}, this);
34102
34103								inputs = propContainer.querySelectorAll('input[type=tel]');
34104								if ($(inputs).length) {
34105									data.inputs = inputs;
34106									break;
34107								}
34108						}
34109
34110						return data;
34111					};
34112
34113					BX.Sale.OrderAjaxComponent.bindValidationPhone = function (id, propContainer) {
34114						if (!this.validation.properties || !this.validation.properties[id])
34115							return;
34116
34117						var arProperty = this.validation.properties[id],
34118							data = this.getValidationDataPhone(arProperty, propContainer),
34119							i, k;
34120
34121						if (data && data.inputs && data.action) {
34122							for (i = 0; i < $(data.inputs).length; i++) {
34123								if (BX.type.isElementNode(data.inputs[i])) {
34124									BX.bind(data.inputs[i], data.action, BX.delegate(function () {
34125										this.isValidProperty(data);
34126									}, this));
34127								}
34128								else {
34129									for (k = 0; k < $(data.inputs[i]).length; k++)
34130										BX.bind(data.inputs[i][k], data.action, BX.delegate(function () {
34131											this.isValidProperty(data);
34132										}, this));
34133								}
34134							}
34135						}
34136					};
34137
34138					BX.Sale.OrderAjaxComponent.isValidPropertiesBlock = function (excludeLocation) {
34139						if (!this.options.propertyValidation)
34140							return [];
34141
34142						var props = this.orderBlockNode.querySelectorAll('.bx-soa-customer-field[data-property-id-row]'),
34143							propsErrors = [],
34144							id, propContainer, arProperty, data, i;
34145
34146						for (i = 0; i < props.length; i++) {
34147							id = props[i].getAttribute('data-property-id-row');
34148
34149							if (!!excludeLocation && this.locations[id])
34150								continue;
34151
34152							propContainer = props[i].querySelector('.soa-property-container');
34153							if (propContainer) {
34154								arProperty = this.validation.properties[id];
34155								data = this.getValidationData(arProperty, propContainer);
34156								dataPhone = this.getValidationDataPhone(arProperty, propContainer);
34157								data = $.extend({}, data, dataPhone);
34158
34159								propsErrors = propsErrors.concat(this.isValidProperty(data, true));
34160							}
34161						}
34162
34163						return propsErrors;
34164					};
34165
34166
34167					// create input type=tel
34168					var input = $('input[autocomplete=tel]'),
34169						inputHTML = input[0].outerHTML,
34170						value = input.val(),
34171						newInput = input[0].outerHTML.replace('type="text"', 'type="tel" value="' + value + '"');
34172
34173					if ($(input).length < 2) {
34174						input.hide();
34175						$(newInput).insertAfter(input);
34176					}
34177					showPhoneMask('input[autocomplete=tel][type=tel]');
34178
34179					// change value input type=text when change input type=tel
34180					$('input[autocomplete=tel][type=tel]').on('blur', function () {
34181						var $this = $(this);
34182
34183						var value = $this.val();
34184						$this.parent().find('input[autocomplete=tel][type=text]').val(value);
34185					});
34186
34187					BX.Sale.OrderAjaxComponent.bindValidationPhone(arPropertyPhone.ID, $('input[autocomplete=tel]').parent()[0]);
34188				}
34189			}
34190
34191			if ($('.bx-soa-cart-total').length) {
34192				if (!$('.change_basket').length)
34193					$('.bx-soa-cart-total').prepend('<div class="change_basket">
34193' + BX.message("BASKET_CHANGE_TITLE") + '<a href="' + arAsproOptions["SITE_DIR"] + 'basket/" class="change_link">' + BX.message("BASKET_CHANGE_LINK") + '</a></div>');
34194
34195				if (typeof (BX.Sale.OrderAjaxComponent) == "object") {
34196					if (arAsproOptions['COUNTERS']['USE_FULLORDER_GOALS'] !== 'N') {
34197						if (typeof BX.Sale.OrderAjaxComponent.reachgoalbegin === 'undefined') {
34198							BX.Sale.OrderAjaxComponent.reachgoalbegin = true;
34199							var eventdata = { goal: 'goal_order_begin' };
34200							BX.onCustomEvent('onCounterGoals', [eventdata])
34201						}
34202					}
34203
34204					if (BX.Sale.OrderAjaxComponent.hasOwnProperty("params")) {
34205						$('.bx-soa-cart-total .change_link').attr('href', BX.Sale.OrderAjaxComponent.params.PATH_TO_BASKET);
34206						if (arAsproOptions["PRICES"]["MIN_PRICE"]) {
34207							if (arAsproOptions["PRICES"]["MIN_PRICE"] > Number(BX.Sale.OrderAjaxComponent.result.TOTAL.ORDER_PRICE)) {
34208								$('<div class="fademask_ext"></div>').appendTo($('body'));
34209								location.href = BX.Sale.OrderAjaxComponent.params.PATH_TO_BASKET;
34210							}
34211						}
34212					}
34213
34214					// update oreder auth form
34215					if ($('#bx-soa-auth').length && !$('#bx-soa-auth .redisigned').length) {
34216						// update input USER_LOGIN
34217						if ($('input[name="USER_LOGIN"]').length) {
34218							var $label = $('input[name="USER_LOGIN"]').closest('.bx-authform-formgroup-container').find('.bx-authform-label-container');
34219							if (!$label.find('.bx-authform-starrequired').length) {
34220								$label.html($label.html() + '<span class="bx-authform-starrequired"> *</span>');
34221							}
34222						}
34223
34224						// update input USER_PASSWORD
34225						if ($('input[name="USER_PASSWORD"]').length) {
34226							var $label = $('input[name="USER_PASSWORD"]').closest('.bx-authform-formgroup-container').find('.bx-authform-label-container');
34227							if (!$label.find('.bx-authform-starrequired').length) {
34228								$label.html($label.html() + '<span class="bx-authform-starrequired"> *</span>');
34229							}
34230						}
34231
34232						if ($('input[name="USER_REMEMBER"]').length) {
34233							var $label = $('input[name="USER_REMEMBER"]').attr('id', 'ORDER_AUTH_USER_REMEMBER').closest('label').attr('for', 'ORDER_AUTH_USER_REMEMBER');
34234							var html = $('input[name="USER_REMEMBER"]').attr('id', 'ORDER_AUTH_USER_REMEMBER').wrap('<div id="trem_"></div>').parent().html();
34235							$('#trem_').remove();
34236							$label.html($label.text());
34237							$(html).insertBefore($label).closest('.bx-authform-formgroup-container').addClass('filter');
34238							var html = $('#bx-soa-auth .bx-authform>a').addClass('pull-right').addClass('forgot').wrap('<div id="trem_"></div>').parent().html();
34239							$('#trem_').remove();
34240							$(html).insertAfter($label.closest('.checkbox'));
34241						}
34242
34243						$('#bx-soa-auth .bx-soa-reg-block .btn').removeClass('btn-default').removeClass('btn-lg').addClass('transparent').addClass('btn-lg').text(BX.message('ORDER_REGISTER_BUTTON'));
34244
34245						$('#bx-soa-auth').append('<div class="redisigned hidden></div>');
34246					}
34247
34248					// update oreder register form
34249					if ($('.bx-soa-section-content.reg').length && !$('.bx-soa-section-content.reg .redisigned').length) {
34250						var bRebindRegSubmit = false;
34251
34252						if (arAsproOptions.THEME.LOGIN_EQUAL_EMAIL === 'Y') {
34253							bRebindRegSubmit = true;
34254
34255							// update input NEW_LOGIN
34256							if ($('input[name="NEW_LOGIN"]').length) {
34257								$('input[name="NEW_LOGIN"]').closest('.bx-authform-formgroup-container').hide();
34258							}
34259						}
34260
34261						if (arAsproOptions.THEME.PERSONAL_ONEFIO === 'Y') {
34262							bRebindRegSubmit = true;
34263
34264							// update input NEW_NAME
34265							if ($('input[name="NEW_NAME"]').length) {
34266								$('input[name="NEW_NAME"]').closest('.bx-authform-formgroup-container').find('.bx-authform-label-container').html(BX.message('ORDER_FIO_LABEL') + '<span class="bx-authform-starrequired"> *</span>');
34267							}
34268
34269							// update input NEW_LAST_NAME
34270							if ($('input[name="NEW_LAST_NAME"]').length) {
34271								$('input[name="NEW_LAST_NAME"]').closest('.bx-authform-formgroup-container').hide();
34272								$('input[name="NEW_LAST_NAME"]').val(' ');
34273							}
34274						}
34275
34276						if (bRebindRegSubmit) {
34277							// bind new handler for submit button
34278							var $regSubmit = $('#do_register~input[type=submit]');
34279							if ($regSubmit.length) {
34280								BX.unbindAll($regSubmit[0]);
34281								$(document).on('click', '#do_register~input[type=submit]', function (e) {
34282									e.preventDefault();
34283									e.stopImmediatePropagation();
34284
34285									if (arAsproOptions.THEME.LOGIN_EQUAL_EMAIL === 'Y') {
34286										var email = BX.findChild(BX('bx-soa-auth'), { attribute: { 'name': 'NEW_EMAIL' } }, true, false);
34287										var login = BX.findChild(BX('bx-soa-auth'), { attribute: { 'name': 'NEW_LOGIN' } }, true, false);
34288
34289										if (login && email) {
34290											login.value = email.value;
34291										}
34292									}
34293
34294									BX('do_register').value = 'Y';
34295									BX.Sale.OrderAjaxComponent.sendRequest('showAuthForm');
34296								});
34297							}
34298						}
34299
34300						// update captcha
34301						var $captcha = $('.bx-soa-section-content.reg').find('.bx-captcha');
34302						if ($captcha.length) {
34303							$captcha.addClass('captcha_image');
34304							$captcha.append('<div class="captcha_reload"></div>');
34305							$captcha.closest('.bx-authform-formgroup-container').addClass('captcha-row').find('input[name=captcha_w
34305ord]').closest('.bx-authform-input-container').addClass('captcha_input');
34306						}
34307
34308						// update input NEW_NAME && NEW_LAST_NAME
34309						if ($('input[name=NEW_NAME]').length && $('input[name=NEW_LAST_NAME]').length && arAsproOptions.THEME.PERSONAL_ONEFIO !== 'Y') {
34310							if (!$('input[name=NEW_NAME]').closest('.bx-authform-formgroup-container.col-md-6').length) {
34311								$('input[name=NEW_NAME],input[name=NEW_LAST_NAME]').closest('.bx-authform-formgroup-container').addClass('col-md-6');
34312								var html = $('input[name=NEW_LAST_NAME]').closest('.bx-authform-formgroup-container').wrap('<div id="trem_"></div>').parent().html();
34313								$('#trem_').remove();
34314								$(html).insertAfter($('input[name=NEW_NAME]').closest('.bx-authform-formgroup-container').wrap('<div class="row"></div>'));
34315							}
34316						}
34317
34318						// update input NEW_EMAIL && PHONE_NUMBER
34319						if ($('input[name=NEW_EMAIL]').length && $('input[name=PHONE_NUMBER]').length) {
34320							if (!$('input[name=PHONE_NUMBER]').closest('.bx-authform-formgroup-container.col
34320-md-6').length) {
34321								$('input[name=NEW_EMAIL],input[name=PHONE_NUMBER]').closest('.bx-authform-formgroup-container').addClass('col-md-6');
34322								var html = $('input[name=PHONE_NUMBER]').closest('.bx-authform-formgroup-container').wrap('<div id="trem_"></div>').parent().html();
34323								$('#trem_').remove();
34324								$(html).insertAfter($('input[name=NEW_EMAIL]').closest('.bx-authform-formgroup-container').wrap('<div class="row"></div>'));
34325							}
34326						}
34327
34328						// update input NEW_PASSWORD && NEW_PASSWORD_CONFIRM
34329						if ($('input[name=NEW_PASSWORD]').length && $('input[name=NEW_PASSWORD_CONFIRM]').length) {
34330							if (!$('input[name=NEW_PASSWORD]').closest('.bx-authform-formgroup-container.col-md-6').length) {
34331								$('input[name=NEW_PASSWORD],input[name=NEW_PASSWORD_CONFIRM]').closest('.bx-authform-formgroup-container').addClass('col-md-6');
34332								var html = $('input[name=NEW_PASSWORD_CONFIRM]').closest('.bx-authform-formgroup-container').wrap('<div id="trem_"></div>').parent().html();
34333								$('#trem_').remove();
34334								$(html).insertAfter($('input[name=NEW_PASSWORD]').closest('.bx-authform-formgroup-container').wrap('<div class="row"></div>'));
34335							}
34336						}
34337
34338						// update input PHONE_NUMBER
34339						if ($('input[name=PHONE_NUMBER]').length) {
34340							var input = $('input[name=PHONE_NUMBER]'),
34341								inputHTML = input[0].outerHTML,
34342								value = input.val(),
34343								newInput = input[0].outerHTML.replace('type="text"', 'type="tel" value="' + value + '"');
34344
34345							if ($(input).length < 2) {
34346								input.hide();
34347								$(newInput).insertAfter(input);
34348
34349								showPhoneMask('input[name=PHONE_NUMBER][type=tel]');
34350
34351								$('input[name=PHONE_NUMBER][type=tel]').on('blur', function () {
34352									var $this = $(this);
34353									var value = $this.val();
34354									$this.parent().find('input[name=PHONE_NUMBER][type=text]').val(value);
34355								});
34356
34357								var $label = $('input[name=PHONE_NUMBER][type=tel]').closest('.bx-authform-formgroup-container').find('.bx-authform-label-container');
34358								$label.html(BX.message('ORDER_PHONE_LABEL') + ($label.find('.bx-authform-starrequired').length ? '<span class="bx-authform-starrequired"> *</span>' : ''));
34359							}
34360						}
34361
34362						$('.bx-soa-section-content.reg').append('<div class="redisigned hidden></div>');
34363					}
34364
34365					if ($('.bx-soa-cart-total-line-total').length && arAsproOptions["THEME"]["SHOW_LICENCE"] == "Y") {
34366						if (typeof (e) === 'undefined')
34367							BX.Sale.OrderAjaxComponent.state_licence = (arAsproOptions['THEME']['LICENCE_CHECKED'] == 'Y' ? 'checked' : '');
34368
34369						if (!$('.licence_block.filter').length) {
34370							$('<div class="form"><div class="licence_block filter label_block onoff"><label data-for="licenses_order" class="hidden error">' + BX.message('JS_REQUIRED_LICENSES') + '</label><input type="checkbox" name="licenses_order" required ' + BX.Sale.OrderAjaxComponent.state_licence + ' value="Y"><label data-for="licenses_order" class="license">' + BX.message('LICENSES_TEXT') + '</label></div></div>').insertBefore($('#bx-soa-orderSave'));
34371
34372							$(document).on('click', '.bx-soa .licence_block label.license', function () {
34373								var id = $(this).data('for');
34374								$('.bx-soa .licence_block label.error').addClass('hidden');
34375								if (!$('input[name=' + id + ']').prop('checked')) {
34376									$('input[name=' + id + ']').prop('checked', 'checked');
34377									BX.Sale.OrderAjaxComponent.state_licence = 'checked';
34378								}
34379								else {
34380									$('input[name=' + id + ']').prop('checked', '');
34381									BX.Sale.OrderAjaxComponent.state_licence = '';
34382								}
34383							})
34384
34385							$(document).on('click', '.lic_condition a', function () {
34386								if (BX.hasClass(BX('bx-soa-order'), 'orderform--v1')) {
34387									if (BX.Sale.OrderAjaxComponent.isValidForm()) {
34388										BX.Sale.OrderAjaxComponent.animateScrollTo($('.licence_block')[0], 800, 50);
34389									}
34390								}
34391								else {
34392									var iCountErrors = BX.Sale.OrderAjaxComponent.isValidPropertiesBlock().length;
34393									if (!BX.Sale.OrderAjaxComponent.activeSectionId || !iCountErrors) {
34394										BX.Sale.OrderAjaxComponent.animateScrollTo($('.licence_block')[0], 800, 50);
34395									}
34396								}
34397							})
34398						}
34399
34400						$('#bx-soa-orderSave, .bx-soa-cart-total-button-container').addClass('lic_condition');
34401
34402						if (typeof (BX.Sale.OrderAjaxComponent.oldClickOrderSaveAction) === "undefined" && typeof (BX.Sale.OrderAjaxComponent.clickOrderSaveAction) !== 'undefined') {
34403							BX.Sale.OrderAjaxComponent.oldClickOrderSaveAction = BX.Sale.OrderAjaxComponent.clickOrderSaveAction;
34404							BX.Sale.OrderAjaxComponent.clickOrderSaveAction = function (event) {
34405								if ($('input[name="licenses_order"]').prop('checked')) {
34406									$('.bx-soa .licence_block label.error').addClass('hidden');
34407
34408									if (BX.Sale.OrderAjaxComponent.isValidForm()) {
34409										if (typeof BX.Sale.OrderAjaxComponent.allowOrderSave == 'function')
34410											BX.Sale.OrderAjaxComponent.allowOrderSave();
34411										if (typeof BX.Sale.OrderAjaxComponent.doSaveAction == 'function')
34412											BX.Sale.OrderAjaxComponent.doSaveAction();
34413										else
34414											BX.Sale.OrderAjaxComponent.oldClickOrderSaveAction(event);
34415									}
34416								}
34417								else {
34418									$('.bx-soa .licence_block label.error').removeClass('hidden');
34419								}
34420							}
34421							if (BX.Sale.OrderAjaxComponent.orderSaveBlockNode.querySelector('.checkbox')) {
34422								if (typeof browser == 'object') {
34423									if ('msie' in browser && browser.msie)
34424										$(BX.Sale.OrderAjaxComponent.orderSaveBlockNode.querySelector('.checkbox')).remove();
34425									else
34426										BX.Sale.OrderAjaxComponent.orderSaveBlockNode.querySelector('.checkbox').remove();
34427								}
34428							}
34429							BX.unbindAll(BX.Sale.OrderAjaxComponent.totalInfoBlockNode.querySelector('a.btn-order-save'));
34430							BX.unbindAll(BX.Sale.OrderAjaxComponent.mobileTotalBlockNode.querySelector('a.btn-order-save'));
34431							BX.unbindAll(BX.Sale.OrderAjaxComponent.orderSaveBlockNode.querySelector('a'));
34432							BX.bind(BX.Sale.OrderAjaxComponent.totalInfoBlockNode.querySelector('a.btn-order-save'), 'click', BX.proxy(BX.Sale.OrderAjaxComponent.clickOrderSaveAction, BX.Sale.OrderAjaxComponent));
34433							BX.bind(BX.Sale.OrderAjaxComponent.mobileTotalBlockNode.querySelector('a.btn-order-save'), 'click', BX.proxy(BX.Sale.OrderAjaxComponent.clickOrderSaveAction, BX.Sale.OrderAjaxComponent));
34434							BX.bind(BX.Sale.OrderAjaxComponent.orderSaveBlockNode.querySelector('a'), 'click', BX.proxy(BX.Sale.OrderAjaxComponent.clickOrderSaveAction, BX.Sale.OrderAjaxComponent));
34435						}
34436					}
34437
34438					// fix hide total block
34439					$(window).scroll();
34440
34441					if (checkCounters() && typeof (BX.Sale.OrderAjaxComponent.oldSaveOrder) === "undefined") {
34442						var saveFunc = typeof (BX.Sale.OrderAjaxComponent.saveOrder) !== 'undefined' ? 's
34442aveOrder' : 'saveOrderWithJson';
34443						if (typeof (BX.Sale.OrderAjaxComponent[saveFunc]) !== 'undefined') {
34444							BX.Sale.OrderAjaxComponent.oldSaveOrder = BX.Sale.OrderAjaxComponent[saveFunc];
34445							BX.Sale.OrderAjaxComponent[saveFunc] = function (result) {
34446								var res = BX.parseJSON(result);
34447								if (res && res.order) {
34448									if (!res.order.SHOW_AUTH) {
34449										if (res.order.REDIRECT_URL && res.order.REDIRECT_URL.length && (!res.order.ERROR || BX.util.object_keys(res.order.ERROR).length < 1)) {
34450											if ((arMatch = res.order.REDIRECT_URL.match(/ORDER_ID\=[^&=]*/g)) && arMatch.length && (_id = arMatch[0].replace(/ORDER_ID\=/g, '', arMatch[0]))) {
34451												$.ajax({
34452													url: arAsproOptions['SITE_DIR'] + "ajax/check_order.php",
34453													dataType: "json",
34454													type: "POST",
34455													data: { "ID": _id },
34456													success: function (id) {
34457														if (parseInt(id)) {
34458															purchaseCounter(parseInt(id), BX.message('FULL_ORDER'), function (d) {
34459																if (typeof localStorage !== 'undefined' && typeof d === 'object') {
34460																	localStorage.setItem('gtm_e_' + _id, JSON.stringify(d));
34461																}
34462																BX.Sale.OrderAjaxComponent.oldSaveOrder(result);
34463															});
34464														}
34465														else {
34466															BX.Sale.OrderAjaxComponent.oldSaveOrder(result);
34467														}
34468													},
34469													error: function () {
34470														BX.Sale.OrderAjaxComponent.oldSaveOrder(result);
34471													}
34472												})
34473											}
34474											else {
34475												BX.Sale.OrderAjaxComponent.oldSaveOrder(result);
34476											}
34477										}
34478										else {
34479											BX.Sale.OrderAjaxComponent.oldSaveOrder(result);
34480										}
34481									}
34482									else {
34483										BX.Sale.OrderAjaxComponent.oldSaveOrder(result);
34484									}
34485								}
34486								else {
34487									BX.Sale.OrderAjaxComponent.oldSaveOrder(result);
34488								}
34489							}
34490						}
34491					}
34492
34493					if ($('#bx-soa-order-form .captcha-row').length) {
34494						if (window.asproRecaptcha && window.asproRecaptcha.key && window.asproRecaptcha.params.recaptchaSize == 'invisible') {
34495							$('#bx-soa-order-form .captcha-row').addClass('invisible');
34496							if (asproRecaptcha.params.recaptchaLogoShow === 'n') {
34497								$('#bx-soa-order-form .captcha-row').addClass('logo_captcha_n');
34498							}
34499						}
34500					}
34501
34502					if ($('#bx-soa-order-form .captcha-row.invisible').length) {
34503						if (typeof (BX.Sale.OrderAjaxComponent.oldSendRequest) === "undefined" && typeof (BX.Sale.OrderAjaxComponent.sendRequest) !== 'undefined') {
34504							var tmpAction, tmpActionData;
34505							BX.Sale.OrderAjaxComponent.oldSendRequest = BX.Sale.OrderAjaxComponent.sendRequest;
34506							BX.Sale.OrderAjaxComponent.sendRequest = function (action, actionData) {
34507								var bSend = true;
34508
34509								if ($('#bx-soa-order-form .captcha-row.invisible').length) {
34510									if (window.renderRecaptchaById && window.asproRecaptcha && window.asproRecaptcha.key) {
34511										if (window.asproRecaptcha.params.recaptchaSize == 'invisible') {
34512											var form = BX('bx-soa-order-form');
34513											if ($(form).find('.g-recaptcha').length) {
34514												if ($(form).find('.g-recaptcha-response').val()) {
34515													bSend = true;
34516												}
34517												else {
34518													if (typeof grecaptcha != 'undefined') {
34519														grecaptcha.execute($(form).find('.g-recaptcha').data('widgetid'));
34520														bSend = false;
34521													}
34522													else {
34523														bSend = false;
34524													}
34525												}
34526											}
34527										}
34528									}
34529								}
34530
34531								if (bSend) {
34532									BX.Sale.OrderAjaxComponent.oldSendRequest(action, actionData);
34533								}
34534								else {
34535									tmpAction = action;
34536									tmpActionData = actionData;
34537								}
34538							}
34539
34540							$(document).on('submit', '#bx-soa-order-form', function (e) {
34541								e.preventDefault();
34542
34543								if (typeof tmpAction !== 'undefined' || typeof tmpActionData !== 'undefined') {
34544									BX.Sale.OrderAjaxComponent.sendRequest(tmpAction, tmpActionData);
34545									tmpAction = undefined;
34546									tmpActionData = undefined;
34547								}
34548							});
34549						}
34550					}
34551				}
34552
34553				$('.bx-ui-sls-quick-locations.quick-locations').on('click', function () {
34554					$(this).siblings().removeClass('active');
34555					$(this).addClass('active');
34556				})
34557			}
34558		}
34559	}
34560}
34561
34562if (!funcDefined('basketActions')) {
34563	basketActions = function () {
34564		if (arAsproOptions["PAGES"]["BASKET_PAGE"]) {
34565			checkMinPrice();
34566
34567			//remove4Cart
34568			if (typeof (BX.Sale) !== 'undefined' && typeof (BX.Sale) === 'object') {
34569				if (typeof (BX.Sale.BasketComponent) !== 'undefined' && typeof (BX.Sale.BasketComponent) === 'object') {
34570					$(document).on('click', '.basket-item-actions-remove', function () {
34571						var basketID = $(this).closest('.basket-items-list-item-container').data('id');
34572						delFromBasketCounter(BX.Sale.BasketComponent.items[basketID].PRODUCT_ID);
34573					})
34574				}
34575			}
34576
34577			if (location.hash) {
34578				var hash = location.hash.substring(1);
34579				if ($('#basket_toolbar_button_' + hash).length)
34580					$('#basket_toolbar_button_' + hash).trigger('click');
34581
34582				if ($('.basket-items-list-header-filter a[data-filter="' + hash + '"]').length)
34583					$('.basket-items-list-header-filter a[data-filter="' + hash + '"]')[0].click();
34584			}
34585			var svg_cross = '<svg xmlns="http://www.w3.org/2000/svg" width="8" height="8" viewBox="0 0 8 8"><path id="Rounded_Rectangle_568_copy_13" data-name="Rounded Rectangle 568 copy 13" class="cls-1" d="M1615.4,589l2.32,2.315a0.987,0.987,0,0,1,0,1.4,1,1,0,0,1-1.41,0L1614,590.4l-2.31,2.315a1,1,0,0,1-1.41,0,0.987,0.987,0,0,1,0-1.4L1612.6,589l-2.32-2.314a0.989,0.989,0,0,1,0-1.4,1,1,0,0,1,1.41,0l2.31,2.315,2.31-2.315a1,1,0,0,1,1.41,0,0.989,0.989,0,0,1,0,1.4Z" transform="translate(-1610 -585)"/></svg>';
34586
34587			$('.bx_sort_container').append('<div class="top_control basket_action"><span style="opacity:0;
34587" class="delete_all colored_theme_hover_text remove_all_basket">' + svg_cross + BX.message("BASKET_CLEAR_ALL_BUTTON") + '</span></div>');
34588			if ($('.basket-items-list-header-filter').length) {
34589				$('.basket-items-list-header-filter').append('<div class="top_control basket_action"><span style="opacity:1;" class="delete_all colored_theme_hover_text remove_all_basket">' + svg_cross + BX.message("BASKET_CLEAR_ALL_BUTTON") + '</span></div>');
34590
34591				var cur_index = $('.basket-items-list-header-filter > a.active').index();
34592				//fix delayed
34593				if (cur_index == 3)
34594					cur_index = 2;
34595
34596				if ($('.basket-items-list-header-filter > a.active').data('filter') == 'all')
34597					cur_index = 'all';
34598
34599				$('.basket-items-list-header-filter .top_control .delete_all').data("type", cur_index);
34600
34601				$('.basket-items-list-header-filter > a').on('click', function () {
34602					var index = $(this).index();
34603
34604					//fix delayed
34605					if (index == 3)
34606						index = 2;
34607
34608					if ($(this).data('filter') == 'all')
34609						index = 'all';
34610
34611					$('.basket-items-list-header-filter .top_control .delete_all').data("type", index);
34612				});
34613			}
34614			else {
34615				var cur_index = $('.bx_sort_container a.current').index();
34616				$('.bx_sort_container .top_control .delete_all').data("type", cur_index);
34617				if ($('.bx_ordercart > div:eq(' + cur_index + ') table tbody tr td.item').length)
34618					$('.bx_sort_container .top_control .delete_all').css('opacity', 1);
34619
34620				$('.bx_ordercart .bx_ordercart_coupon #coupon').wrap('<div class="input"></div>');
34621
34622				$('.bx_sort_container > a').on('click', function () {
34623					var index = $(this).index();
34624					$('.bx_sort_container .top_control .delete_all').data("type", index);
34625
34626					if ($('.bx_ordercart > div:eq(' + index + ') table tbody tr td.item').length)
34627						$('.bx_sort_container .top_control .delete_all').css('opacity', 1);
34628					else
34629						$('.bx_sort_container .top_control .delete_all').css('opacity', 0);
34630				});
34631			}
34632
34633
34634			$('.basket_print').on('click', function () {
34635				// window.open(location.pathname+"?print=Y",'_blank');
34636				window.print();
34637			});
34638
34639			$('.delete_all').on('click', function () {
34640				if (arAsproOptions['COUNTERS']['USE_BASKET_GOALS'] !== 'N') {
34641					var eventdata = { goal: 'goal_basket_clear', params: { type: $(this).data('type') } };
34642					BX.onCustomEvent('onCounterGoals', [eventdata]);
34643				}
34644				$.post(arAsproOptions['SITE_DIR'] + "ajax/action_basket.php", "TYPE=" + $(this).data('type') + "&CLEAR_ALL=Y", $.proxy(function (data) {
34645					location.reload();
34646				}));
34647			});
34648
34649			$('.bx_item_list_section .bx_catalog_item').sliceHeight({ row: '.bx_item_list_slide', item: '.bx_catalog_item' });
34650
34651			BX.addCustomEvent('onAjaxSuccess', function () {
34652				checkMinPrice();
34653
34654				var errorText = $.trim($('#warning_message').text());
34655				$('#basket_items_list .error_text').detach();
34656				if (errorText != '') {
34657					$('#warning_message').hide().text('');
34658					$('#basket_items_list').prepend('<div class="error_text">' + errorText + '</div>');
34659				}
34660			});
34661			$(document).on('click', '.bx_ordercart_order_pay_center .checkout, .basket-checkout-section-inner .basket-btn-checkout', function () {
34662				if (checkCounters('google')) {
34663					checkoutCounter(1, 'start order');
34664				}
34665			})
34666		}
34667	}
34668}
34669
34670if (!funcDefined('checkMinPrice')) {
34671	checkMinPrice = function () {
34672		if (arAsproOptions["PAGES"]["BASKET_PAGE"]) {
34673			var summ_raw = 0,
34674				summ = 0;
34675			if ($('#allSum_FORMATED').length) {
34676				summ_raw = $('#allSum_FORMATED').text().replace(/[^0-9\.,]/g, '');
34677				summ = parseFloat(summ_raw);
34678				if ($('#basket_items').length) {
34679					var summ = 0;
34680					$('#basket_items tr').each(function () {
34681						if (typeof ($(this).data('item-price')) !== 'undefined' && $(this).data('item-price'))
34682							summ += $(this).data('item-price') * $(this).find('#QUANTITY_INPUT_' + $(this).attr('id')).val();
34683					})
34684				}
34685				if (!$('.catalog_back').length)
34686					$('.bx_ordercart_order_pay_center').prepend('<a href="' + arAsproOptions["PAGES"]["CATALOG_PAGE_URL"] + '" class="catalog_back btn btn-default btn-lg white grey">' + BX.message("BASKET_CONTINUE_BUTTON") + '</a>');
34687			}
34688
34689			if (arAsproOptions["THEME"]["SHOW_ONECLICKBUY_ON_BASKET_PAGE"] == "Y")
34690				$('.basket-coupon-section').addClass('smallest');
34691
34692			if (typeof BX.Sale !== "undefined") {
34693				if (typeof BX.Sale.BasketComponent !== "undefined" && typeof BX.Sale.BasketComponent.result !== "undefined")
34694					summ = BX.Sale.BasketComponent.result.allSum;
34695			}
34696
34697			if (arAsproOptions["PRICES"]["MIN_PRICE"]) {
34698				if (arAsproOptions["PRICES"]["MIN_PRICE"] > summ) {
34699					var svgMinPrice = '<i class="svg  svg-inline-price colored_theme_svg" aria-hidden="true"><svg id="Group_278_copy" data-name="Group 278 copy" xmlns="http://www.w3.org/2000/svg" width="38" height="38" viewBox="0 0 38 38"><path id="Ellipse_305_copy_2" data-name="Ellipse 305 copy 2" class="clswm-1" d="M1851,561a19,19,0,1,1,19-19A19,19,0,0,1,1851,561Zm0-36a17,17,0,1,0,17,17A17,17,0,0,0,1851,525Zm3.97,10.375-0.03.266c-0.01.062-.02,0.127-0.03,0.188l-0.94,7.515h0a2.988,2.988,0,0,1-5.94,0H1848l-0.91-7.525c-0.01-.041-0.01-0.086-0.02-0.128l-0.04-.316h0.01c-0.01-.125-0.04-0.246-0.04-0.375a4,4,0,0,1,8,0c0,0.129-.03.25-0.04,0.375h0.01ZM1851,533a2,2,0,0,0-2,2,1.723,1.723,0,0,0,.06.456L1850,543a1,1,0,0,0,2,0l0.94-7.544A1.723,1.723,0,0,0,1853,535,2,2,0,0,0,1851,533Zm0,14a3,3,0,1,1-3,3A3,3,0,0,1,1851,547Zm0,4a1,1,0,1,0-1-1A1,1,0,0,0,1851,551Z" transform="translate(-1832 -523)"></path>  <path class="clswm-2 op-cls" d="M1853,543l-1,1h-2l-1-1-1-8,1-2,1-1h2l1,1,1,2Zm-1,5,1,1v2l-1,1h-2l-1-1v-2l1-1h2Z" transform="translate(-1832 -523)"></path></svg></i>';
34700					if ($('.oneclickbuy.fast_order').length)
34701						$('.oneclickbuy.fast_order').remove();
34702
34703					if ($('.basket-checkout-container').length) {
34704						if (!$('.icon_error_wrapper').length) {
34705							$('.basket-checkout-block.basket-checkout-block-btn').html('<div class="icon_error_wrapper"><div class="icon_error_block">' + svgMinPrice + BX.message("MIN_ORDER_PRICE_TEXT").replace("#PRICE#", jsPriceFormat(arAsproOptions["PRICES"]["MIN_PRICE"])) + '</div></div>');
34706						}
34707					}
34708					else {
34709						if (!$('.icon_error_wrapper').length && typeof jsPriceFormat !== 'undefined') {
34710							$('.bx_ordercart_order_pay_center').prepend('<div class="icon_error_wrapper"><div class="icon_error_block">' + svgMinPrice + BX.message("MIN_ORDER_PRICE_TEXT").replace("#PRICE#", jsPriceFormat(arAsproOptions["PRICES"]["MIN_PRICE"])) + '</div></div>');
34711						}
34712						if ($('.bx_ordercart_order_pay .checkout').length)
34713							$('.bx_ordercart_order_pay .checkout').remove();
34714					}
34715				} else {
34716					if ($('.icon_error_wrapper').length)
34717						$('.icon_error_wrapper').remove();
34718
34719					if ($('.basket-checkout-container').length) {
34720						if (!$('.oneclickbuy.fast_order').length && arAsproOptions["THEME"]["SHOW_ONECLICKBUY_ON_BASKET_PAGE"] == "Y" && !$('.basket-btn-checkout.disabled').length)
34721							$('.basket-checkout-section-inner').append('<div class="fastorder"><span class="oneclickbuy btn btn-lg fast_order btn-transparent-border-color" onclick="oneClickBuyBasket()">' + BX.message("BASKET_QUICK_ORDER_BUTTON") + '</span></div>');
34722					}
34723					else {
34724						if ($('.bx_ordercart_order_pay .checkout').length)
34725							$('.bx_ordercart .bx_ordercart_order_pay .checkout').css('opacity', '1');
34726						else
34727							$('.bx_ordercart_order_pay_center').append('<a href="javascript:void(0)" onclick="checkOut();" class="checkout" style="opacity: 1;">' + BX.message("BASKET_ORDER_BUTTON") + '</a>');
34728						if (!$('.oneclickbuy.fast_order').length && arAsproOptions["THEME"]["SHOW_ONECLICKBUY_ON_BASKET_PAGE"] == "Y")
34729							$('.bx_ordercart_order_pay_center').append('<span class="oneclickbuy btn btn-lg fast_order btn-transparent-border-color" onclick="oneClickBuyBasket()">' + BX.message("BASKET_QUICK_ORDER_BUTTON") + '</span>');
34730					}
34731				}
34732			} else {
34733				if ($('.basket-checkout-container').length) {
34734					if (!$('.oneclickbuy.fast_order').length && arAsproOptions["THEME"]["SHOW_ONECLICKBUY_ON_BASKET_PAGE"] == "Y" && !$('.basket-btn-checkout.disabled').length)
34735						$('.basket-checkout-section-inner').append('<div class="fastorder"><span class="oneclickbuy btn btn-lg fast_order btn-transparent-border-color" onclick="oneClickBuyBasket()">' + BX.message("BASKET_QUICK_ORDER_BUTTON") + '</span></div>');
34736				}
34737				else {
34738					$('.bx_ordercart .bx_ordercart_order_pay .checkout').css('opacity', '1');
34739					if (!$('.oneclickbuy.fast_order').length && arAsproOptions["THEME"]["SHOW_ONECLICKBUY_ON_BASKET_PAGE"] == "Y")
34740						$('.bx_ordercart_order_pay_center').append('<span class="oneclickbuy btn btn-lg fast_order btn-trans
34740parent-border-color" onclick="oneClickBuyBasket()">' + BX.message("BASKET_QUICK_ORDER_BUTTON") + '</span>');
34741				}
34742			}
34743
34744			$('#basket-root .basket-checkout-container .basket-checkout-section .basket-checkout-block .basket-btn-checkout');
34745			$('#basket-root .basket-checkout-container').addClass('visible');
34746		}
34747	}
34748}
34749
34750var isFrameDataReceived = false;
34751if (typeof window.frameCacheVars !== "undefined") {
34752	BX.addCustomEvent("onFrameDataReceived", function (json) {
34753		initFull();
34754
34755		CheckTopMenuPadding();
34756		CheckTopMenuOncePadding();
34757		CheckTopMenuDotted();
34758
34759		CheckSearchWidth();
34760
34761		checkLinkedArticles();
34762
34763		if ($('.logo-row.v2').length) {
34764			$(window).resize(); // need to check resize flexslider & menu
34765			setTimeout(function () {
34766				CheckTopMenuDotted();
34767			}, 100);
34768		}
34769
34770		if (funcDefined('setNewHeader')) {
34771			if ((BX.message('TYPE_SKU') != 'TYPE_1' || BX.message('HAS_SKU_PROPS') != 'Y')) {
34772				setNewHeader();
34773			} else {
34774				var objNameWrapper = $('.bx_catalog_item_scu[id]');
34775				if (objNameWrapper.length) {
34776					var id = 'ob' + objNameWrapper.attr('id').replace('_skudiv', '');
34777					if (id && window[id] !== undefined) {
34778						var obj = window[id].offers[window[id].offerNum];
34779						if (obj !== undefined) {
34780							setNewHeader(obj);
34781						}
34782					}
34783				}
34784			}
34785		}
34786
34787		isFrameDataReceived = true;
34788	});
34789} else {
34790	$(document).ready(initFull);
34791}
34792
34793if (!funcDefined('setHeightBlockSlider')) {
34794	setHeightBlockSlider = function () {
34795		$(document).find('.specials.tab_slider_wrapp .tabs_content > li.cur').equalize({ children: '.item-title' });
34796		$(document).find('.specials.tab_slider_wrapp .tabs_content > li.cur').equalize({ children: '.item_info' });
34797		$(document).find('.specials.tab_slider_wrapp .tabs_content > li.cur').equalize({ children: '.catalog_item' });
34798
34799		var sliderWidth = $(document).find('.specials.tab_slider_wrapp').outerWidth();
34800
34801		var iCountTabs = $(document).find('.specials.tab_slider_wrapp .tabs_content > li.cur').length;
34802
34803		if (iCountTabs <= 1) {
34804			$(document).find('.specials.tab_slider_wrapp .tabs_content > li.cur').css('height', '');
34805
34806			var itemsButtonsHeight = 0;
34807			if ($(document).find('.specials.tab_slider_wrapp .tabs_content .tab.cur .tabs_slider li .footer_button').length) {
34808				$(document).find('.specials.tab_slider_wrapp .tabs_content .tab.cur .tabs_slider li .footer_button').css('height', 'auto');
34809				itemsButtonsHeight = $(document).find('.specials.tab_slider_wrapp .tabs_content .tab.cur .tabs_slider li .footer_button').height();
34810				$(document).find('.specials.tab_slider_wrapp .tabs_content .tab.cur .tabs_slider li .footer_button').css('height', '');
34811			}
34812			var tabsContentUnhover = $(document).find('.specials.tab_slider_wrapp .tabs_content .tab.cur').height() * 1;
34813			var tabsContentHover = tabsContentUnhover + itemsButtonsHeight + 50;
34814			$(document).find('.specials.tab_slider_wrapp .tabs_content .tab.cur').attr('data-unhover', tabsContentUnhover);
34815			$(document).find('.specials.tab_slider_wrapp .tabs_content .tab.cur').attr('data-hover', tabsContentHover);
34816			$(document).find('.specials.tab_slider_wrapp .tabs_content').height(tabsContentUnhover);
34817			$(document).find('.specials.tab_slider_wrapp .tabs_content .tab.cur .flex-viewport').height(tabsContentUnhover);
34818		}
34819		else {
34820			$(document).find('.specials.tab_slider_wrapp .tabs_content > li.cur').each(function () {
34821				var _th = $(this);
34822				_th.css('height', '');
34823
34824				var itemsButtonsHeight = 0;
34825				if (_th.find('.tabs_slider li .footer_button').length) {
34826					_th.find('.tabs_slider li .footer_button').css('height', 'auto');
34827					itemsButtonsHeight = _th.find('.tabs_slider li .footer_button').height();
34828					_th.find('.tabs_slider li .footer_button').css('height', '');
34829				}
34830
34831				var tabsContentUnhover = _th.height() * 1;
34832				var tabsContentHover = tabsContentUnhover + itemsButtonsHeight + 50;
34833				_th.attr('data-unhover', tabsContentUnhover);
34834				_th.attr('data-hover', tabsContentHover);
34835				_th.parent().height(tabsContentUnhover);
34836				_th.find('.flex-viewport').height(tabsContentUnhover);
34837
34838			})
34839		}
34840	}
34841}
34842
34843if (!funcDefined('checkTopFilter')) {
34844	checkTopFilter = function () {
34845		/*if(window.matchMedia('(max-width: 991px)').matches){
34846			//if($('.group_description_block.top').length){
34847				var top_pos=$('.adaptive_filter').position().top;
34848				$('.bx_filter.bx_filter_vertical').css({'top':top_pos+43});
34849			//}
34850		}*/
34851	}
34852}
34853
34854if (!funcDefined('checkStickyFooter')) {
34855	checkStickyFooter = function () {
34856		try {
34857			ignoreResize.push(true);
34858			$('#content').css('min-height', '');
34859			var contentTop = $('#content').offset().top;
34860			var contentBottom = contentTop + $('#content').outerHeight();
34861			var footerTop = 0;
34862			if ($('footer').length)
34863				footerOffset = $('footer').offset().top;
34864
34865			$('#content').css('min-height', $(window).height() - contentTop - (footerTop - contentBottom) - $('footer').outerHeight() + 'px');
34866			ignoreResize.pop();
34867		}
34868		catch (e) { console.error(e); }
34869	}
34870}
34871
34872if (!funcDefined('checkLinkedArticles')) {
34873	checkLinkedArticles = function () {
34874		try {
34875			if ($('.linked-blog-list.content .item-views').length) {
34876				var mobileRow = $('.linked-blog-list').data('mobile_row'),
34877					desktopRow = $('.linked-blog-list').data('desktop_row'),
34878					parentBlock = $('.ajax_load .js_append'),
34879					widthRow = parentBlock.getFloatWidth(),
34880					elementWidthRow = parentBlock.find('> .item:eq(0)').getFloatWidth(),
34881					elementsCount = parentBlock.find('> .item').length,
34882					slice = Math.floor(widthRow / elementWidthRow),
34883					rowInsertCount = Math.floor(elementsCount / slice),
34884					bCalculateRows = false;
34885				if (window.matchMedia('(max-width: 767px)').matches) {
34886					if (!mobileRow && desktopRow) {
34887						mobileRow = desktopRow;
34888					}
34889					if (mobileRow && mobileRow <= rowInsertCount) {
34890						rowInsertCount = slice * mobileRow;
34891						bCalculateRows = true;
34892					}
34893				} else {
34894					if (desktopRow && desktopRow <= rowInsertCount) {
34895						rowInsertCount = slice * desktopRow;
34896						bCalculateRows = true;
34897					}
34898				}
34899				if (!bCalculateRows) {
34900					rowInsertCount = elementsCount;
34901				}
34902
34903				$('.linked-blog-list').insertAfter(parentBlock.find('> .item:eq(' + (rowInsertCount - 1) + ')'));
34904				setTimeout(function () {
34905					$('.linked-blog-list').addClass('visible');
34906				}, 0);
34907			}
34908		}
34909		catch (e) { console.error(e); }
34910	}
34911}
34912
34913/* EVENTS */
34914var timerResize = false, ignoreResize = [];
34915$(window).resize(function () {
34916	CheckPopupTop();
34917	checkLinkedArticles();
34918
34919	// here immediate functions
34920	if (!ignoreResize.length) {
34921		if (timerResize) {
34922			clearTimeout(timerResize);
34923			timerResize = false;
34924		}
34925		timerResize = setTimeout(function () {
34926			// here delayed functions in event
34927			BX.onCustomEvent('onWindowResize', false);
34928		}, 50);
34929	}
34930});
34931
34932var timerScroll = false, ignoreScroll = [], documentScrollTopLast = $(document).scrollTop(), startScroll = 0;
34933$(window).scroll(function () {
34934	CheckPopupTop();
34935	// here immediate functions
34936	documentScrollTopLast = $(document).scrollTop();
34937	SetFixedAskBlock();
34938	/*if($('.wrapper1.mfixed_Y.mfixed_view_scroll_top #mobileheader').length && window.matchMedia('(max-width: 991px)').matches)
34939	{
34940		if(documentScrollTopLast > startScroll)
34941			$('.wrapper1.mfixed_Y.mfixed_view_scroll_top #mobileheader').removeClass('fixed');
34942		else
34943			$('.wrapper1.mfixed_Y.mfixed_view_scroll_top #mobileheader').addClass('fixed');
34944		startScroll = documentScrollTopLast;
34945	}*/
34946
34947	if (!ignoreScroll.length) {
34948		if (timerScroll) {
34949			clearTimeout(timerScroll);
34950			timerScroll = false;
34951		}
34952		timerScroll = setTimeout(function () {
34953			// here delayed functions in event
34954			BX.onCustomEvent('onWindowScroll', false);
34955		}, 50);
34956	}
34957});
34958
34959BX.addCustomEvent('onWindowResize', function (eventdata) {
34960	try {
34961		ignoreResize.push(true);
34962
34963		CheckTopMenuPadding();
34964		CheckTopMenuOncePadding();
34965		CheckSearchWidth();
34966
34967		CheckTabActive();
34968		CheckTopMenuFullCatalogSubmenu();
34969		CheckHeaderFixedMenu();
34970
34971		CheckTopMenuDotted();
34972		if ($('nav.mega-menu.sliced').length)
34973			$('nav.mega-menu.sliced').removeClass('initied');
34974
34975
34976		CheckTopVisibleMenu();
34977
34978		checkScrollToTop();
34979		CheckObjectsSizes();
34980
34981		CheckFlexSlider();
34982		initSly();
34983
34984		// checkVerticalMobileFilter();
34985
34986		checkMobilePhone();
34987		checkTopFilter();
34988		checkMobileFilter();
34989
34990		if (arAsproOptions['THEME']['COMPACT_FOOTER_MOBILE'] == 'Y') {
34991			if (window.matchMedia('(max-width:767px)').matches) {
34992				$('footer').addClass('mobile');
34993				$('.bottom-menu .items>.wrap_compact_mobile').addClass('accordion-body collapse');
34994				$('.bottom-menu .items>.item.childs').attr('data-toggle', 'collapse');
34995			} else {
34996				$('footer').removeClass('mobile');
34997				$('.bottom-menu .items>.wrap_compact_mobile').removeClass('accordion-body collapse');
34998				$('.bottom-menu .items>.item.childs').removeAttr('data-toggle');
34999			}
35000		}
35001
35002		if (typeof window['stickySidebar'] !== 'undefined') {
35003			if (window.matchMedia('(max-width: 991px)').matches) {
35004				window['stickySidebar'].destroy();
35005			}
35006			else {
35007				window['stickySidebar'].bindEvents();
35008			}
35009		}
35010
35011		if ($('.flexslider.wsmooth').length) {
35012			$('.flexslider.wsmooth').each(function () {
35013				$(this).data('flexslider').smoothHeight();
35014			});
35015		}
35016
35017		if (window.matchMedia('(min-width: 767px)').matches)
35018			$('.wrapper_middle_menu.wrap_menu').removeClass('mobile');
35019
35020		if (window.matchMedia('(max-width: 767px)').matches)
35021			$('.wrapper_middle_menu.wrap_menu').addClass('mobile');
35022
35023
35024		if ($("#basket_form").length && $(window).outerWidth() <= 600) {
35025			$("#basket_form .tabs_content.basket > li.cur td").each(function () { $(this).css("width", ""); });
35026		}
35027
35028		$(".bx_filter_section .bx_filter_select_container").each(function () {
35029			var prop_id = $(this).closest('.bx_filter_parameters_box').attr('property_id');
35030			if ($('#smartFilterDropDown' + prop_id).length) {
35031				$('#smartFilterDropDown' + prop_id).css("max-width", $(this).width());
35032			}
35033		})
35034
35035		if (window.matchMedia('(min-width: 768px)').matches) {
35036			$('.bx_filter .scrollbar').removeClass('mobile-scroll');
35037			$('.bx_filter .srollbar-custom').removeClass('mobile-scroll');
35038			$('.bx_filter .bx_filter_section form .bx_filter_parameters').removeClass('mobile-scroll');
35039			InitScrollBar();
35040			InitCustomScrollBar();
35041		}
35042
35043		if (window.matchMedia('(max-width: 767px)').matches) {
35044			$('.bx_filter .scrollbar').addClass('mobile-scroll');
35045			$('.bx_filter .srollbar-custom').addClass('mobile-scroll');
35046			$('.bx_filter .bx_filter_section form .bx_filter_parameters').addClass('mobile-scroll');
35047			if ($('.bx_filter .mobile-scroll.scrollbar').length)
35048				$('.bx_filter .mobile-scroll.scrollbar').mCustomScrollbar("destroy");
35049			if ($('.bx_filter .mobile-scroll.srollbar-custom').length)
35050				$('.bx_filter .mobile-scroll.srollbar-custom').mCustomScrollbar("destroy");
35051		}
35052
35053	}
35054	catch (e) { }
35055	finally {
35056		ignoreResize.pop();
35057	}
35058});
35059
35060BX.addCustomEvent('onWindowScroll', function (eventdata) {
35061	try {
35062		ignoreScroll.push(true);
35063	}
35064	catch (e) { }
35065	finally {
35066		ignoreScroll.pop();
35067	}
35068});
35069
35070BX.addCustomEvent('onSlideInit', function (eventdata) {
35071	try {
35072		ignoreResize.push(true);
35073		if (eventdata) {
35074			var slider = eventdata.slider;
35075			if (slider) {
35076				if (slider.hasClass('small-gallery'))
35077					$(window).resize();
35078				// add classes .curent & .shown to slide
35079				slider.find('.item').removeClass('current');
35080				var curSlide = slider.find('.item.flex-active-slide'),
35081					curSlideId = curSlide.attr('id'),
35082					nav = slider.find('.flex-direction-nav');
35083
35084				curSlide.addClass('current');
35085
35086				slider.find('.visible').css('opacity', '1');
35087				slider.find('.height0').css('height', 'auto');
35088
35089				if (curSlide.hasClass('shown')) {
35090					slider.find('.item.clone[id=' + curSlideId + '_clone]').addClass('shown');
35091				}
35092
35093				curSlide.addClass('shown');
35094
35095			}
35096		}
35097	}
35098	catch (e) { }
35099	finally {
35100		ignoreResize.pop();
35101	}
35102});
35103
35104BX.addCustomEvent('onCounterGoals', function (eventdata) {
35105	if (arAsproOptions['THEME']['YA_GOALS'] == 'Y' && arAsproOptions['THEME']['YA_COUNTER_ID']) {
35106		var idCounter = arAsproOptions['THEME']['YA_COUNTER_ID'];
35107		idCounter = parseInt(idCounter);
35108
35109		if (typeof eventdata != 'object')
35110			eventdata = { goal: 'undefined' };
35111
35112		if (typeof eventdata.goal != 'string')
35113			eventdata.goal = 'undefined';
35114
35115		if (idCounter) {
35116			try {
35117				waitCounter(idCounter, 50, function () {
35118					var obCounter = window['yaCounter' + idCounter];
35119					if (typeof obCounter == 'object') {
35120						obCounter.reachGoal(eventdata.goal);
35121					}
35122				});
35123			}
35124			catch (e) {
35125				console.error(e)
35126			}
35127		}
35128		else {
35129			console.info('Bad counter id!', idCounter);
35130		}
35131	}
35132})
35133
35134var onCaptchaVerifyinvisible = function (response) {
35135	$('.g-recaptcha:last').each(function () {
35136		var id = $(this).attr('data-widgetid');
35137		if (typeof (id) !== 'undefined' && response) {
35138			if (!$(this).closest('form').find('.g-recaptcha-response').val())
35139				$(this).closest('form').find('.g-recaptcha-response').val(response)
35140			if ($('iframe[src*=recaptcha]').length) {
35141				$('iframe[src*=recaptcha]').each(function () {
35142					var block = $(this).parent().parent();
35143					if (!block.hasClass('grecaptcha-badge'))
35144						block.css('width', '100%');
35145				})
35146			}
35147			$(this).closest('form').submit();
35148		}
35149	})
35150}
35151
35152var onCaptchaVerifynormal = function (response) {
35153	$('.g-recaptcha').each(function () {
35154		var id = $(this).attr('data-widgetid');
35155		if (typeof (id) !== 'undefined') {
35156			if (grecaptcha.getResponse(id) != '') {
35157				$(this).closest('form').find('.recaptcha').valid();
35158			}
35159		}
35160	});
35161}
35162
35163BX.addCustomEvent('onSubmitForm', function (eventdata) {
35164	try {
35165		if (!window.renderRecaptchaById || !window.asproRecaptcha || !window.asproRecaptcha.key) {
35166			eventdata.form.submit();
35167			$(eventdata.form).closest('.form').addClass('sending');
35168			return true;
35169		}
35170
35171		if (window.asproRecaptcha.params.recaptchaSize == 'invisible' && $(eventdata.form).find('.g-recaptcha').length) {
35172			if ($(eventdata.form).find('.g-recaptcha-response').val()) {
35173				eventdata.form.submit();
35174				$(eventdata.form).closest('.form').addClass('sending');
35175				return true;
35176			}
35177			else {
35178				if (typeof grecaptcha != 'undefined') {
35179					grecaptcha.execute($(eventdata.form).find('.g-recaptcha').data('widgetid'));
35180				}
35181				else {
35182					return false;
35183				}
35184			}
35185		}
35186		else {
35187			eventdata.form.submit();
35188			$(eventdata.form).closest('.form').addClass('sending');
35189			return true;
35190		}
35191	}
35192	catch (e) {
35193		console.error(e);
35194		return true;
35195	}
35196})
35197
35198$(document).on('click', '.catalog_reviews_extended span.dropdown-select__list-link', function () {
35199	var _this = $(this);
35200	var ajaxData = _this.data('review_sort_ajax');
35201	var container = _this.closest('[id^=comp_]');
35202	containerId = container.attr('id');
35203	if (containerId !== undefined && containerId) {
35204		ajaxData.containerId = containerId;
35205	}
35206	if (ajaxData !== undefined) {
35207		container.addClass('blur')
35208		$.ajax({
35209			type: 'post',
35210			data: ajaxData,
35211			success: function (html) {
35212				$('#reviews_sort_continer').html(html);
35213			}
35214		});
35215	}
35216});
35217
35218$(document).on('click', '.rating_vote:not(.disable)', function () {
35219
35220	var _this = $(this);
35221	var action = _this.data('action');
35222	var parent = _this.closest('.rating-vote');
35223	var commentId = parent.data('comment_id');
35224	var userId = parent.data('user_id');
35225	var ajaxUrl = parent.data('ajax_url');
35226	$.ajax({
35227		url: ajaxUrl,
35228		dataType: 'json',
35229		data: { 'commentId': commentId, 'action': action, 'userId': userId },
35230		success: function (data) {
35231			if (data.LIKE !== undefined) {
35232				_this.siblings('.rating-vote-result.like').text(data.LIKE);
35233			}
35234			if (data.DISLIKE !== undefined) {
35235				_this.siblings('.rating-vote-result.dislike').text(data.DISLIKE);
35236			}
35237			if (data.SET_ACTIVE_LIKE !== undefined) {
35238				parent.find('.rating_vote.plus').toggleClass('active');
35239			}
35240			if (data.SET_ACTIVE_DISLIKE !== undefined) {
35241				parent.find('.rating_vote.minus').toggleClass('active');
35242			}
35243		}
35244	});
35245
35246});
35247
35248function fileInputInit(message) {
35249	$('input[type=file]').uniform({ fileButtonHtml: BX.message('JS_FILE_BUTTON_NAME'), fileDefaultHtml: message });
35250	$(document).on('change', 'input[type=file]', function () {
35251		if ($(this).val()) {
35252			$(this).closest('.uploader').addClass('files_add');
35253		}
35254		else {
35255			$(this).closest('.uploader').removeClass('files_add');
35256		}
35257	})
35258	$('.form .add_file').on('click', function () {
35259		var index = $(this).closest('.input').find('input[type=file]').length + 1;
35260
35261		$(this).closest('.form-group').find('.input').append('<input type="file" id="POPUP_FILE" name="FILE_n' + index + '"   class="inputfile" value="" />');
35262		$('input[type=file]').uniform({ fileButtonHtml: BX.message('JS_FILE_BUTTON_NAME'), fileDefaultHtml: message });
35263	});
35264
35265	$('.form .add_file').on('click', function () {
35266		var index = $(this).closest('.input').find('input[type=file]').length + 1;
35267
35268		$(this).closest('.form-group').find('.input').append('<input type="file" id="POPUP_FILE" name="FILE_n' + index + '"   class="inputfile" value="" />');
35269		$('input[type=file]').uniform({ fileButtonHtml: BX.message('JS_FILE_BUTTON_NAME'), fileDefaultHtml: message });
35270	});
35271}
35272
35273/*custom event for sku prices*/
35274
35275/*BX.addCustomEvent('onAsproSkuSetPrice', function(eventdata){
35276	console.log(eventdata);
35277})*/
35278
35279/*BX.addCustomEvent('onAsproSkuSetPriceMatrix', function(eventdata){
35280	console.log(eventdata);
35281})*/
35282
35283function toggleServices() {
35284    const dd = document.getElementById('services-dropdown');
35285    const arrow = document.getElementById('services-arrow');
35286    const items = document.getElementById('services-item').closest('.items');
35287
35288    dd.classList.toggle('open');
35289    arrow.classList.toggle('rotated');
35290    if (items) items.classList.toggle('opened');
35291}
35292
35293document.addEventListener('click', function(e) {
35294    const item = document.getElementById('services-item');
35295    const dd = document.getElementById('services-dropdown');
35296    const items = item.closest('.items');
35297
35298    if (dd.contains(e.target)) {
35299        dd.classList.remove('open');
35300        document.getElementById('services-arrow').classList.remove('rotated');
35301        if (items) items.classList.remove('opened');
35302        return;
35303    }
35304
35305    if (!item.contains(e.target)) {
35306        dd.classList.remove('open');
35307        document.getElementById('services-arrow').classList.remove('rotated');
35308        if (items) items.classList.remove('opened');
35309    }
35310});
35311/* End */
35312;
35313; /* Start:"a:4:{s:4:"full";s:62:"/bitrix/templates/aspro_max/js/blocks/blocks.js?17164655377762";s:6:"source";
35313s:47:"/bitrix/templates/aspro_max/js/blocks/blocks.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
35314$(document).ready(function(){
35315	//dropdown-select
35316		$(document).on('click', '.dropdown-select .dropdown-select__title', function(){
35317			var _this = $(this),
35318				menu = _this.parent().find('> .dropdown-select__list'),
35319				bVisibleMeu = (menu.is(':visible')),
35320				animate = (!bVisibleMeu ? 'transition.slideUpIn' : 'fadeOut');
35321
35322			if(!_this.hasClass('clicked'))
35323			{
35324				_this.addClass('clicked');
35325
35326				menu.velocity('stop').velocity(animate, {
35327					duration: 300,
35328					// delay: 250,
35329					begin: function(){
35330						_this.toggleClass('opened');
35331					},
35332					complete: function(){
35333						_this.removeClass('clicked');
35334					}
35335				});
35336			}
35337		})
35338
35339		// close select
35340		$("html, body").on('mousedown', function(e){
35341			if(typeof e.target.className == 'string' && e.target.className.indexOf('adm') < 0)
35342			{
35343				e.stopPropagation();
35344
35345				if(!$(e.target).closest('.dropdown-select').length)
35346				{
35347					$('.dropdown-select .dropdown-select__title.opened').click();
35348				}
35349			}
35350		})
35351	/**/
35352
35353
35354	/*side head block*/
35355	$(document).on('click', '.slide-block .slide-block__head', function(e){
35356		var _this = $(this),
35357			menu = _this.siblings('.slide-block__body'),
35358			bVisibleMeu = (menu.is(':visible')),
35359			animate = (bVisibleMeu ? 'slideUp' : 'slideDown');
35360
35361		if(!_this.hasClass('clicked') && menu.length && !_this.hasClass('ignore') && !$(e.target).attr('href'))
35362		{
35363			var type = _this.data('id');
35364			_this.addClass('clicked');
35365
35366			if(bVisibleMeu)
35367				$.cookie(type+'_CLOSED', 'Y');
35368			else
35369				$.removeCookie(type+'_CLOSED');
35370
35371			menu.velocity('stop').velocity(animate, {
35372				duration: 150,
35373				// delay: 250,
35374				begin: function(){
35375					_this.toggleClass('closed');
35376				},
35377				complete: function(){
35378					_this.removeClass('clicked');
35379					
35380					if(typeof window['stickySidebar'] !== 'undefined')
35381						window['stickySidebar'].updateSticky();
35382				}
35383			});
35384		}
35385	})
35386	/**/
35387
35388	/*sku change props*/
35389	if(!('SelectOfferProp' in window) && typeof window.SelectOfferProp != 'function')
35390	{
35391		SelectOfferProp = function(){
35392			// return false;
35393			var _this = $(this),
35394				obParams = {},
35395				obSelect = {},
35396				objUrl = parseUrlQuery(),
35397				add_url = '',
35398				selectMode = (_this.hasClass('list_values_wrapper') ? true : false),
35399				container = _this.closest('.bx_catalog_item_scu'),
35400				img = _this.closest('.item-parent').find('.thumb img');
35401
35402			/* request params */
35403			obParams = {
35404				'PARAMS': _this.closest('.js_wrapper_items').data('params'),
35405				'ID': container.data('offer_id'),
35406				'SITE_ID': container.data('site_id'),
35407				'LINK_ID': container.data('id')+'_'+_this.closest('.cur').data('code'),
35408				'IBLOCK_ID': container.data('offer_iblockid'),
35409				'PROPERTY_ID': container.data('propertyid'),
35410				'DEPTH': _this.closest('.item_wrapper').index(),
35411				'VALUE': (selectMode ? _this.find('option:selected').data('onevalue') : _this.data('onevalue')),
35412				'CLASS': 'inner_content',
35413				'PICTURE': (img.data('src') ? img.data('src') : img.attr('src')),
35414				'ARTICLE_NAME': _this.closest('.item-parent').find('.article_block').data('name'),
35415				'ARTICLE_VALUE': _this.closest('.item-parent').find('.article_block').data('value'),
35416			}
35417			/**/
35418
35419			if("clear_cache" in objUrl)
35420			{
35421				if(objUrl.clear_cache == "Y")
35422					add_url += "?clear_cache=Y";
35423			}
35424
35425			/* save selected values */
35426			for (i = 0; i < obParams.DEPTH+1; i++)
35427			{
35428				strName = 'PROP_'+container.find('.item_wrapper:eq('+i+') > div').data('id');
35429				if(container.find('.item_wrapper:eq('+i+') select').length)
35430				{
35431					obSelect[strName] = container.find('.item_wrapper:eq('+i+') select option:selected').data('onevalue');
35432					obParams[strName] = container.find('.item_wrapper:eq('+i+') select option:selected').data('onevalue');
35433				}
35434				else
35435				{
35436					obSelect[strName] = container.find('.item_wrapper:eq('+i+') li.item.active').data('onevalue');
35437					obParams[strName] = container.find('.item_wrapper:eq('+i+') li.item.active').data('onevalue');
35438				}
35439			}
35440
35441			// obParams.SELECTED = JSON.stringify(obSelect);
35442			/**/
35443			
35444			if(!selectMode)
35445			{
35446				_this.siblings().removeClass('active');
35447				_this.addClass('active');
35448			}
35449
35450			if(_this.attr('title'))
35451			{
35452				_this.closest('.item_wrapper').find('.show_class span').text(_this.attr('title'))
35453			}
35454			else
35455			{
35456				var img_row = _this.find(' > i');
35457				if(img_row.length && img_row.attr('title'))
35458					_this.closest('.item_wrapper').find('.show_class span').text(img_row.attr('title'))
35459			}
35460
35461			/* get sku */
35462			$.ajax({
35463				url: arMaxOptions['SITE_DIR']+'ajax/js_item_detail.php'+add_url,
35464				type: 'POST',
35465				data: obParams,
35466			}).success(function(html){
35467				var ob = BX.processHTML(html);BX.ajax.processScripts(ob.SCRIPT);
35468				if($('.counter_wrapp.list'))
35469				{
35470					$('.counter_wrapp.list .counter_block.big').removeClass('big');
35471				}
35472			})
35473		}
35474		$(document).on('click', '.ajax_load .bx_catalog_item_scu li.item', SelectOfferProp)
35475		$(document).on('change', '.ajax_load .bx_catalog_item_scu select.list_values_wrapper', SelectOfferProp)
35476	}
35477
35478	/**/
35479
35480	/**/
35481	$('.switch-item-block .switch-item-block__icons').on('click', function(){
35482		var $this = $(this),
35483			animationTime = 200;
35484
35485		if($this.hasClass('switch-item-block__icons--small') && !$this.hasClass('active')){
35486			$this.addClass('active');
35487			$this.siblings('.switch-item-block__icons--big').removeClass('active');
35488			$this.closest('.switch-item-block').find('.switch-item-block__count-wrapper--big').fadeOut(animationTime, function(){
35489				$this.closest('.switch-item-block').find('.switch-item-block__count-wrapper--small').fadeIn(animationTime);
35490			});
35491
35492			$this.closest('.switch-item-block').siblings('.big-gallery-block').fadeOut(animationTime, function(){
35493				$this.closest('.switch-item-block').siblings('.small-gallery-block').fadeIn(animationTime);
35494			});
35495		}
35496		else if($this.hasClass('switch-item-block__icons--big') && !$this.hasClass('active')){
35497			$this.addClass('active');
35498			$this.siblings('.switch-item-block__icons--small').removeClass('active');
35499			$this.closest('.switch-item-block').find('.switch-item-block__count-wrapper--small').fadeOut(animationTime, function(){
35500				$this.closest('.switch-item-block').find('.switch-item-block__count-wrapper--big').fadeIn(animationTime);
35501			});
35502
35503			$this.closest('.switch-item-block').siblings('.small-gallery-block').fadeOut(animationTime, function(){
35504				$this.closest('.switch-item-block').siblings('.big-gallery-block').fadeIn(animationTime);
35505			});
35506		}
35507		setTimeout(function(){
35508			InitLazyLoad();
35509		}, 300);
35510	});
35511	/**/
35512
35513	/*many items menu*/
35514
35515	$('.menu-navigation__sections-wrapper .menu-navigation__sections').menuAim({
35516        firstActiveRow: true,
35517        rowSelector: "> .menu-navigation__sections-item",
35518        activate: function activate(a) {
35519            var _this = $(a),
35520                index = _this.index(),
35521                items = _this.closest('.menu-navigation__sections-wrapper').next(),
35522                link = _this.find('> a');
35523
35524            _this.siblings().find('> a').addClass('dark_link')
35525            link.addClass('colored_theme_text').removeClass('dark_link');
35526            items.find('.parent-items').siblings().hide();
35527            items.find('.parent-items').eq(index).show();
35528        },
35529        deactivate: function deactivate(a) {
35530            var _this = $(a),
35531                index = _this.index(),
35532                items = _this.closest('.menu-navigation__sections-wrapper').next(),
35533                link = _this.find('> a');
35534                
35535          link.removeClass('colored_theme_text').addClass('dark_link');
35536          items.find('.parent-items').siblings().hide();
35537        }
35538    });
35539	/**/
35540})
35541/* End */
35542;
35543; /* Start:"a:4:{s:4:"full";s:63:"/bitrix/components/bitrix/search.title/script.js?17164655439847";s:6:"source";s:48:"/bitrix/components/bitrix/search.title/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
35544function JCTitleSearch(arParams)
35545{
35546	var _this = this;
35547
35548	this.arParams = {
35549		'AJAX_PAGE': arParams.AJAX_PAGE,
35550		'CONTAINER_ID': arParams.CONTAINER_ID,
35551		'INPUT_ID': arParams.INPUT_ID,
35552		'MIN_QUERY_LEN': parseInt(arParams.MIN_QUERY_LEN)
35553	};
35554	if(arParams.WAIT_IMAGE)
35555		this.arParams.WAIT_IMAGE = arParams.WAIT_IMAGE;
35556	if(arParams.MIN_QUERY_LEN <= 0)
35557		arParams.MIN_QUERY_LEN = 1;
35558
35559	this.cache = [];
35560	this.cache_key = null;
35561
35562	this.startText = '';
35563	this.running = false;
35564	this.runningCall = false;
35565	this.currentRow = -1;
35566	this.RESULT = null;
35567	this.CONTAINER = null;
35568	this.INPUT = null;
35569	this.WAIT = null;
35570
35571	this.ShowResult = function(result)
35572	{
35573		if(BX.type.isString(result))
35574		{
35575			_this.RESULT.innerHTML = result;
35576		}
35577
35578		_this.RESULT.style.display = _this.RESULT.innerHTML !== '' ? 'block' : 'none';
35579		var pos = _this.adjustResultNode();
35580
35581		//adjust left column to be an outline
35582		var res_pos;
35583		var th;
35584		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
35585		if(tbl)
35586		{
35587			th = BX.findChild(tbl, {'tag':'th'}, true);
35588		}
35589
35590		if(th)
35591		{
35592			var tbl_pos = BX.pos(tbl);
35593			tbl_pos.width = tbl_pos.right - tbl_pos.left;
35594
35595			var th_pos = BX.pos(th);
35596			th_pos.width = th_pos.right - th_pos.left;
35597			th.style.width = th_pos.width + 'px';
35598
35599			_this.RESULT.style.width = (pos.width + th_pos.width) + 'px';
35600
35601			//Move table to left by width of the first column
35602			_this.RESULT.style.left = (pos.left - th_pos.width - 1)+ 'px';
35603
35604			//Shrink table when it's too wide
35605			if((tbl_pos.width - th_pos.width) > pos.width)
35606				_this.RESULT.style.width = (pos.width + th_pos.width -1) + 'px';
35607
35608			//Check if table is too wide and shrink result div to it's width
35609			tbl_pos = BX.pos(tbl);
35610			res_pos = BX.pos(_this.RESULT);
35611			if(res_pos.right > tbl_pos.right)
35612			{
35613				_this.RESULT.style.width = (tbl_pos.right - tbl_pos.left) + 'px';
35614			}
35615		}
35616
35617		var fade;
35618		if(tbl) fade = BX.findChild(_this.RESULT, {'class':'title-search-fader'}, true);
35619		if(fade && th)
35620		{
35621			res_pos = BX.pos(_this.RESULT);
35622			fade.style.left = (res_pos.right - res_pos.left - 18) + 'px';
35623			fade.style.width = 18 + 'px';
35624			fade.style.top = 0 + 'px';
35625			fade.style.height = (res_pos.bottom - res_pos.top) + 'px';
35626			fade.style.display = 'block';
35627		}
35628	};
35629
35630	this.onKeyPress = function(keyCode)
35631	{
35632		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
35633		if(!tbl)
35634			return false;
35635
35636		var i;
35637		var cnt = tbl.rows.length;
35638
35639		switch (keyCode)
35640		{
35641		case 27: // escape key - close search div
35642			_this.RESULT.style.display = 'none';
35643			_this.currentRow = -1;
35644			_this.UnSelectAll();
35645		return true;
35646
35647		case 40: // down key - navigate down on search results
35648			if(_this.RESULT.style.display == 'none')
35649				_this.RESULT.style.display = 'block';
35650
35651			var first = -1;
35652			for(i = 0; i < cnt; i++)
35653			{
35654				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
35655				{
35656					if(first == -1)
35657						first = i;
35658
35659					if(_this.currentRow < i)
35660					{
35661						_this.currentRow = i;
35662						break;
35663					}
35664					else if(tbl.rows[i].className == 'title-search-selected')
35665					{
35666						tbl.rows[i].className = '';
35667					}
35668				}
35669			}
35670
35671			if(i == cnt && _this.currentRow != i)
35672				_this.currentRow = first;
35673
35674			tbl.rows[_this.currentRow].className = 'title-search-selected';
35675		return true;
35676
35677		case 38: // up key - navigate up on search results
35678			if(_this.RESULT.style.display == 'none')
35679				_this.RESULT.style.display = 'block';
35680
35681			var last = -1;
35682			for(i = cnt-1; i >= 0; i--)
35683			{
35684				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
35685				{
35686					if(last == -1)
35687						last = i;
35688
35689					if(_this.currentRow > i)
35690					{
35691						_this.currentRow = i;
35692						break;
35693					}
35694					else if(tbl.rows[i].className == 'title-search-selected')
35695					{
35696						tbl.rows[i].className = '';
35697					}
35698				}
35699			}
35700
35701			if(i < 0 && _this.currentRow != i)
35702				_this.currentRow = last;
35703
35704			tbl.rows[_this.currentRow].className = 'title-search-selected';
35705		return true;
35706
35707		case 13: // enter key - choose current search result
35708			if(_this.RESULT.style.display == 'block')
35709			{
35710				for(i = 0; i < cnt; i++)
35711				{
35712					if(_this.currentRow == i)
35713					{
35714						if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
35715						{
35716							var a = BX.findChild(tbl.rows[i], {'tag':'a'}, true);
35717							if(a)
35718							{
35719								window.location = a.href;
35720								return true;
35721							}
35722						}
35723					}
35724				}
35725			}
35726		return false;
35727		}
35728
35729		return false;
35730	};
35731
35732	this.onTimeout = function()
35733	{
35734		_this.onChange(function(){
35735			setTimeout(_this.onTimeout, 500);
35736		});
35737	};
35738
35739	this.onChange = function(callback)
35740	{
35741		if (_this.running)
35742		{
35743			_this.runningCall = true;
35744			return;
35745		}
35746		_this.running = true;
35747
35748		if(_this.INPUT.value != _this.oldValue && _this.INPUT.value != _this.startText)
35749		{
35750			_this.oldValue = _this.INPUT.value;
35751			if(_this.INPUT.value.length >= _this.arParams.MIN_QUERY_LEN)
35752			{
35753				_this.cache_key = _this.arParams.INPUT_ID + '|' + _this.INPUT.value;
35754				if(_this.cache[_this.cache_key] == null)
35755				{
35756					if(_this.WAIT)
35757					{
35758						var pos = BX.pos(_this.INPUT);
35759						var height = (pos.bottom - pos.top)-2;
35760						_this.WAIT.style.top = (pos.top+1) + 'px';
35761						_this.WAIT.style.height = height + 'px';
35762						_this.WAIT.style.width = height + 'px';
35763						_this.WAIT.style.left = (pos.right - height + 2) + 'px';
35764						_this.WAIT.style.display = 'block';
35765					}
35766
35767					BX.ajax.post(
35768						_this.arParams.AJAX_PAGE,
35769						{
35770							'ajax_call':'y',
35771							'INPUT_ID':_this.arParams.INPUT_ID,
35772							'q':_this.INPUT.value,
35773							'l':_this.arParams.MIN_QUERY_LEN
35774						},
35775						function(result)
35776						{
35777							_this.cache[_this.cache_key] = result;
35778							_this.ShowResult(result);
35779							_this.currentRow = -1;
35780							_this.EnableMouseEvents();
35781							if(_this.WAIT)
35782								_this.WAIT.style.display = 'none';
35783							if (!!callback)
35784								callback();
35785							_this.running = false;
35786							if (_this.runningCall)
35787							{
35788								_this.runningCall = false;
35789								_this.onChange();
35790							}
35791						}
35792					);
35793					return;
35794				}
35795				else
35796				{
35797					_this.ShowResult(_this.cache[_this.cache_key]);
35798					_this.currentRow = -1;
35799					_this.EnableMouseEvents();
35800				}
35801			}
35802			else
35803			{
35804				_this.RESULT.style.display = 'none';
35805				_this.currentRow = -1;
35806				_this.UnSelectAll();
35807			}
35808		}
35809		if (!!callback)
35810			callback();
35811		_this.running = false;
35812	};
35813
35814	this.onScroll = function ()
35815	{
35816		if(BX.type.isElementNode(_this.RESULT)
35817			&& _this.RESULT.style.display !== "none"
35818			&& _this.RESULT.innerHTML !== ''
35819		)
35820		{
35821			_this.adjustResultNode();
35822		}
35823	};
35824
35825	this.UnSelectAll = function()
35826	{
35827		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
35828		if(tbl)
35829		{
35830			var cnt = tbl.rows.length;
35831			for(var i = 0; i < cnt; i++)
35832				tbl.rows[i].className = '';
35833		}
35834	};
35835
35836	this.EnableMouseEvents = function()
35837	{
35838		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
35839		if(tbl)
35840		{
35841			var cnt = tbl.rows.length;
35842			for(var i = 0; i < cnt; i++)
35843				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
35844				{
35845					tbl.rows[i].id = 'row_' + i;
35846					tbl.rows[i].onmouseover = function (e) {
35847						if(_this.currentRow != this.id.substr(4))
35848						{
35849							_this.UnSelectAll();
35850							this.className = 'title-search-selected';
35851							_this.currentRow = this.id.substr(4);
35852						}
35853					};
35854					tbl.rows[i].onmouseout = function (e) {
35855						this.className = '';
35856						_this.currentRow = -1;
35857					};
35858				}
35859		}
35860	};
35861
35862	this.onFocusLost = function(hide)
35863	{
35864		setTimeout(function(){_this.RESULT.style.display = 'none';}, 250);
35865	};
35866
35867	this.onFocusGain = function()
35868	{
35869		if(_this.RESULT.innerHTML.length)
35870			_this.ShowResult();
35871	};
35872
35873	this.onKeyDown = function(e)
35874	{
35875		if(!e)
35876			e = window.event;
35877
35878		if (_this.RESULT.style.display == 'block')
35879		{
35880			if(_this.onKeyPress(e.keyCode))
35881				return BX.PreventDefault(e);
35882		}
35883	};
35884
35885	this.adjustResultNode = function()
35886	{
35887		if(!(BX.type.isElementNode(_this.RESULT)
35888			&& BX.type.isElementNode(_this.CONTAINER))
35889		)
35890		{
35891			return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 };
35892		}
35893
35894		var pos = BX.pos(_this.CONTAINER);
35895
35896		_this.RESULT.style.position = 'absolute';
35897		_this.RESULT.style.top = (pos.bottom + 2) + 'px';
35898		_this.RESULT.style.left = pos.left + 'px';
35899		_this.RESULT.style.width = pos.width + 'px';
35900
35901		return pos;
35902	};
35903
35904	this._onContainerLayoutChange = function()
35905	{
35906		if(BX.type.isElementNode(_this.RESULT)
35907			&& _this.RESULT.style.display !== "none"
35908			&& _this.RESULT.innerHTML !== ''
35909		)
35910		{
35911			_this.adjustResultNode();
35912		}
35913	};
35914	this.Init = function()
35915	{
35916		this.CONTAINER = document.getElementById(this.arParams.CONTAINER_ID);
35917		BX.addCustomEvent(this.CONTAINER, "OnNodeLayoutChange", this._onContainerLayoutChange);
35918
35919		this.RESULT = document.body.appendChild(document.createElement("DIV"));
35920		this.RESULT.className = 'title-search-result';
35921		this.INPUT = document.getElementById(this.arParams.INPUT_ID);
35922		this.startText = this.oldValue = this.INPUT.value;
35923		BX.bind(this.INPUT, 'focus', function() {_this.onFocusGain()});
35924		BX.bind(this.INPUT, 'blur', function() {_this.onFocusLost()});
35925		this.INPUT.onkeydown = this.onKeyDown;
35926
35927		if(this.arParams.WAIT_IMAGE)
35928		{
35929			this.WAIT = document.body.appendChild(document.createElement("DIV"));
35930			this.WAIT.style.backgroundImage = "url('" + this.arParams.WAIT_IMAGE + "')";
35931			if(!BX.browser.IsIE())
35932				this.WAIT.style.backgroundRepeat = 'none';
35933			this.WAIT.style.display = 'none';
35934			this.WAIT.style.position = 'absolute';
35935			this.WAIT.style.zIndex = '1100';
35936		}
35937
35938		BX.bind(this.INPUT, 'bxchange', function() {_this.onChange()});
35939
35940		var fixedParent = BX.findParent(this.CONTAINER, BX.is_fixed);
35941		if(BX.type.isElementNode(fixedParent))
35942		{
35943			BX.bind(window, 'scroll', BX.throttle(this.onScroll, 100, this));
35944		}
35945	};
35946	BX.ready(function (){_this.Init(arParams)});
35947}
35948
35949/* End */
35950;
35951; /* Start:"a:4:{s:4:"full";s:94:"/bitrix/templates/aspro_max/components/bitrix/search.title/mega_menu/script.js?171646553710313";s:6:"source";s:78:"/bitrix/templates/aspro_max/components/bitrix/search.title/mega_menu/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
35952$(document).ready(function(){
35953	var containerHTML = $('.title-search-input_mega_menu').detach();
35954	$('#title-search_mega_menu').append(containerHTML);
35955});
35956
35957function JCTitleSearch3(arParams)
35958{
35959	var _this = this;
35960
35961	this.arParams = {
35962		'AJAX_PAGE': arParams.AJAX_PAGE,
35963		'CONTAINER_ID': arParams.CONTAINER_ID,
35964		'INPUT_ID': arParams.INPUT_ID,
35965		'MIN_QUERY_LEN': parseInt(arParams.MIN_QUERY_LEN)
35966	};
35967	if(arParams.WAIT_IMAGE)
35968		this.arParams.WAIT_IMAGE = arParams.WAIT_IMAGE;
35969	if(arParams.MIN_QUERY_LEN <= 0)
35970		arParams.MIN_QUERY_LEN = 1;
35971
35972	this.cache = [];
35973	this.cache_key = null;
35974
35975	this.startText = '';
35976	this.running = false;
35977	this.needRunAgain = false;
35978	this.currentRow = -1;
35979	this.RESULT = null;
35980	this.CONTAINER = null;
35981	this.INPUT = null;
35982	this.WAIT = null;
35983
35984	this.ShowResult = function(result)
35985	{
35986		if(BX.type.isString(result))
35987		{
35988			_this.RESULT.innerHTML = result;
35989		}
35990
35991		_this.RESULT.style.display = _this.RESULT.innerHTML !== '' ? 'block' : 'none';
35992		var pos = _this.adjustResultNode();
35993
35994		//adjust left column to be an outline
35995		var res_pos;
35996		var th;
35997		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
35998		if(tbl)
35999		{
36000			th = BX.findChild(tbl, {'tag':'th'}, true);
36001		}
36002		if(th)
36003		{
36004			var tbl_pos = BX.pos(tbl);
36005			tbl_pos.width = tbl_pos.right - tbl_pos.left;
36006
36007			var th_pos = BX.pos(th);
36008			th_pos.width = th_pos.right - th_pos.left;
36009			th.style.width = th_pos.width + 'px';
36010
36011			_this.RESULT.style.width = (pos.width + th_pos.width) + 'px';
36012
36013			//Move table to left by width of the first column
36014			_this.RESULT.style.left = (pos.left - th_pos.width - 1)+ 'px';
36015
36016			//Shrink table when it's too wide
36017			if((tbl_pos.width - th_pos.width) > pos.width)
36018				_this.RESULT.style.width = (pos.width + th_pos.width -1) + 'px';
36019
36020			//Check if table is too wide and shrink result div to it's width
36021			tbl_pos = BX.pos(tbl);
36022			res_pos = BX.pos(_this.RESULT);
36023			if(res_pos.right > tbl_pos.right)
36024			{
36025				_this.RESULT.style.width = (tbl_pos.right - tbl_pos.left) + 'px';
36026			}
36027		}
36028
36029		var fade;
36030		if(tbl) fade = BX.findChild(_this.RESULT, {'class':'title-search-fader'}, true);
36031		if(fade && th)
36032		{
36033			res_pos = BX.pos(_this.RESULT);
36034			fade.style.left = (res_pos.right - res_pos.left - 18) + 'px';
36035			fade.style.width = 18 + 'px';
36036			fade.style.top = 0 + 'px';
36037			fade.style.height = (res_pos.bottom - res_pos.top) + 'px';
36038			fade.style.display = 'block';
36039		}
36040
36041		
36042		$('.bx_searche.scrollbar').mCustomScrollbar({
36043			mouseWheel: {
36044				scrollAmount: 150,
36045				preventDefault: true
36046			}
36047		});
36048	};
36049
36050	this.onKeyPress = function(keyCode)
36051	{
36052		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
36053		if(!tbl)
36054			return false;
36055
36056		var i;
36057		var cnt = tbl.rows.length;
36058
36059		switch (keyCode)
36060		{
36061		case 27: // escape key - close search div
36062			_this.RESULT.style.display = 'none';
36063			_this.currentRow = -1;
36064			_this.UnSelectAll();
36065		return true;
36066
36067		case 40: // down key - navigate down on search results
36068			if(_this.RESULT.style.display == 'none')
36069				_this.RESULT.style.display = 'block';
36070
36071			var first = -1;
36072			for(i = 0; i < cnt; i++)
36073			{
36074				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
36075				{
36076					if(first == -1)
36077						first = i;
36078
36079					if(_this.currentRow < i)
36080					{
36081						_this.currentRow = i;
36082						break;
36083					}
36084					else if(tbl.rows[i].className == 'title-search-selected')
36085					{
36086						tbl.rows[i].className = '';
36087					}
36088				}
36089			}
36090
36091			if(i == cnt && _this.currentRow != i)
36092				_this.currentRow = first;
36093
36094			tbl.rows[_this.currentRow].className = 'title-search-selected';
36095		return true;
36096
36097		case 38: // up key - navigate up on search results
36098			if(_this.RESULT.style.display == 'none')
36099				_this.RESULT.style.display = 'block';
36100
36101			var last = -1;
36102			for(i = cnt-1; i >= 0; i--)
36103			{
36104				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
36105				{
36106					if(last == -1)
36107						last = i;
36108
36109					if(_this.currentRow > i)
36110					{
36111						_this.currentRow = i;
36112						break;
36113					}
36114					else if(tbl.rows[i].className == 'title-search-selected')
36115					{
36116						tbl.rows[i].className = '';
36117					}
36118				}
36119			}
36120
36121			if(i < 0 && _this.currentRow != i)
36122				_this.currentRow = last;
36123
36124			tbl.rows[_this.currentRow].className = 'title-search-selected';
36125		return true;
36126
36127		case 13: // enter key - choose current search result
36128			if(_this.RESULT.style.display == 'block')
36129			{
36130				for(i = 0; i < cnt; i++)
36131				{
36132					if(_this.currentRow == i)
36133					{
36134						if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
36135						{
36136							var a = BX.findChild(tbl.rows[i], {'tag':'a'}, true);
36137							if(a)
36138							{
36139								window.location = a.href;
36140								return true;
36141							}
36142						}
36143					}
36144				}
36145			}
36146		return false;
36147		}
36148
36149		return false;
36150	};
36151
36152	this.onTimeout = function()
36153	{
36154		_this.onChange(function(){
36155			setTimeout(_this.onTimeout, 500);
36156		});
36157	};
36158
36159	this.onChange = function(callback)
36160	{
36161		if (_this.running) {
36162			_this.needRunAgain = true;
36163			return;
36164		}
36165		_this.running = true;
36166
36167		if(_this.INPUT.value != _this.oldValue && _this.INPUT.value != _this.startText)
36168		{
36169			_this.oldValue = _this.INPUT.value;
36170			if(_this.INPUT.value.length >= _this.arParams.MIN_QUERY_LEN)
36171			{
36172				_this.cache_key = _this.arParams.INPUT_ID + '|' + _this.INPUT.value;
36173				if(_this.cache[_this.cache_key] == null)
36174				{
36175					if(_this.WAIT)
36176					{
36177						var pos = BX.pos(_this.INPUT);
36178						var height = (pos.bottom - pos.top)-2;
36179						_this.WAIT.style.top = (pos.top+1) + 'px';
36180						_this.WAIT.style.height = height + 'px';
36181						_this.WAIT.style.width = height + 'px';
36182						_this.WAIT.style.left = (pos.right - height + 2) + 'px';
36183						_this.WAIT.style.display = 'block';
36184					}
36185
36186					BX.ajax.post(
36187						_this.arParams.AJAX_PAGE,
36188						{
36189							'ajax_call':'y',
36190							'INPUT_ID':_this.arParams.INPUT_ID,
36191							'q':_this.INPUT.value,
36192							'l':_this.arParams.MIN_QUERY_LEN
36193						},
36194						function(result)
36195						{
36196							_this.cache[_this.cache_key] = result;
36197							_this.ShowResult(result);
36198							_this.currentRow = -1;
36199							_this.EnableMouseEvents();
36200							if(_this.WAIT)
36201								_this.WAIT.style.display = 'none';
36202							if (!!callback)
36203								callback();
36204							_this.running = false;
36205
36206							if(_this.needRunAgain){
36207								_this.needRunAgain = false;
36208								_this.onChange(callback);
36209							}
36210						}
36211					);
36212					return;
36213				}
36214				else
36215				{
36216					_this.ShowResult(_this.cache[_this.cache_key]);
36217					_this.currentRow = -1;
36218					_this.EnableMouseEvents();
36219				}
36220			}
36221			else
36222			{
36223				_this.RESULT.style.display = 'none';
36224				_this.currentRow = -1;
36225				_this.UnSelectAll();
36226			}
36227		}
36228		if (!!callback)
36229			callback();
36230		_this.running = false;
36231	};
36232
36233	this.UnSelectAll = function()
36234	{
36235		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
36236		if(tbl)
36237		{
36238			var cnt = tbl.rows.length;
36239			for(var i = 0; i < cnt; i++)
36240				tbl.rows[i].className = '';
36241		}
36242	};
36243
36244	this.EnableMouseEvents = function()
36245	{
36246		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
36247		if(tbl)
36248		{
36249			var cnt = tbl.rows.length;
36250			for(var i = 0; i < cnt; i++)
36251				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
36252				{
36253					tbl.rows[i].id = 'row_' + i;
36254					tbl.rows[i].onmouseover = function (e) {
36255						if(_this.currentRow != this.id.substr(4))
36256						{
36257							_this.UnSelectAll();
36258							this.className = 'title-search-selected';
36259							_this.currentRow = this.id.substr(4);
36260						}
36261					};
36262					tbl.rows[i].onmouseout = function (e) {
36263						this.className = '';
36264						_this.currentRow = -1;
36265					};
36266				}
36267		}
36268	};
36269
36270	this.onFocusLost = function(hide)
36271	{
36272		setTimeout(function(){_this.RESULT.style.display = 'none';}, 250);
36273		//_this.RESULT.style.display = 'none';
36274	};
36275
36276	this.onFocusGain = function()
36277	{
36278		if(_this.RESULT.innerHTML.length)
36279			_this.ShowResult();
36280	};
36281
36282	this.onKeyDown = function(e)
36283	{
36284		if(!e)
36285			e = window.event;
36286
36287		if (_this.RESULT.style.display == 'block')
36288		{
36289			if(_this.onKeyPress(e.keyCode))
36290				return BX.PreventDefault(e);
36291		}
36292		
36293		$('.title-search-result.'+_this.arParams.INPUT_ID).removeClass('closed');
36294	};
36295
36296	this.adjustResultNode = function()
36297	{
36298		var pos, pos_input;
36299		var fixedParent = BX.findParent(_this.CONTAINER, BX.is_fixed);
36300		/*if(!!fixedParent)
36301		{
36302			_this.RESULT.style.position = 'fixed';
36303			_this.RESULT.style.zIndex = BX.style(fixedParent, 'z-index') + 2;
36304			pos = BX.pos(_this.CONTAINER, true);
36305		}
36306		else
36307		{*/
36308			_this.RESULT.style.position = 'absolute';
36309			pos = BX.pos(_this.CONTAINER, true);
36310		//}
36311		pos_input = BX.pos(_this.INPUT);
36312
36313		pos.width = pos.right - pos.left;
36314		_this.RESULT.style.top = (pos.bottom + 2) + 'px';
36315		//_this.RESULT.style.left = pos_input.left + 'px';
36316		_this.RESULT.style.left = 0 + 'px';
36317
36318		if($(_this.INPUT).closest('.inline-search-block.with-close').length)
36319			_this.RESULT.style.width = pos_input.width + 'px';
36320		else
36321			_this.RESULT.style.width = pos.width + 'px';
36322		return pos;
36323	};
36324
36325	this._onContainerLayoutChange = function()
36326	{
36327		if(_this.RESULT.style.display !== "none" && _this.RESULT.innerHTML !== '')
36328		{
36329			_this.adjustResultNode();
36330		}
36331	};
36332	this.Init = function()
36333	{
36334		this.CONTAINER = document.getElementById(this.arParams.CONTAINER_ID);
36335		BX.addCustomEvent(this.CONTAINER, "OnNodeLayoutChange", this._onContainerLayoutChange);
36336
36337		this.RESULT = document.body.appendChild(document.createElement("DIV"));
36338
36339		this.RESULT.className = 'title-search-result '+this.arParams.INPUT_ID;
36340		this.INPUT = document.getElementById(this.arParams.INPUT_ID);
36341		this.startText = this.oldValue = this.INPUT.value;
36342		BX.bind(this.INPUT, 'focus', function() {_this.onFocusGain()});
36343		BX.bind(this.INPUT, 'blur', function() {_this.onFocusLost()});
36344
36345		if(BX.browser.IsSafari() || BX.browser.IsIE())
36346			this.INPUT.onkeydown = this.onKeyDown;
36347		else
36348			this.INPUT.onkeypress = this.onKeyDown;
36349
36350		if(this.arParams.WAIT_IMAGE)
36351		{
36352			this.WAIT = document.body.appendChild(document.createElement("DIV"));
36353			this.WAIT.style.backgroundImage = "url('" + this.arParams.WAIT_IMAGE + "')";
36354			if(!BX.browser.IsIE())
36355				this.WAIT.style.backgroundRepeat = 'none';
36356			this.WAIT.style.display = 'none';
36357			this.WAIT.style.position = 'absolute';
36358			this.WAIT.style.zIndex = '1100';
36359		}
36360
36361		BX.bind(this.INPUT, 'bxchange', function() {_this.onChange()});
36362	};
36363	BX.ready(function (){_this.Init(arParams)});
36364}
36365
36366/* End */
36367;
36368; /* Start:"a:4:{s:4:"full";s:89:"/bitrix/templates/aspro_max/components/bitrix/menu/menu_in_burger/script.js?1716465537208";s:6:"source";s:75:"/bitrix/templates/aspro_max/components/bitrix/menu/menu_in_burger/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
36369$(document).ready(function(){
36370	$('.menu-row .mega-menu table td.wide_menu .dropdown-menu > .customScrollbar').mCustomScrollbar({
36371		mouseWheel: {
36372			scrollAmount: 150,
36373			preventDefault: true
36374		}
36375	})
36376})
36377/* End */
36378;
36379; /* Start:"a:4:{s:4:"full";s:78:"/bitrix/templates/aspro_max/components/bitrix/menu/top/script.
36379js?1716465537191";s:6:"source";s:64:"/bitrix/templates/aspro_max/components/bitrix/menu/top/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
36380$(document).ready(function(){
36381	$('.menu-row .mega-menu table td.wide_menu .customScrollbar').mCustomScrollbar({
36382		mouseWheel: {
36383			scrollAmount: 150,
36384			preventDefault: true
36385		}
36386	})
36387})
36388/* End */
36389;
36390; /* Start:"a:4:{s:4:"full";s:89:"/bitrix/templates/aspro_max/components/bitrix/search.title/corp/script.js?171646553710607";s:6:"source";s:73:"/bitrix/templates/aspro_max/components/bitrix/search.title/corp/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
36391$(document).ready(function(){
36392	var containerHTML = $('.title-search-input_fixed').detach();
36393	$('#title-search_fixed').append(containerHTML);
36394});
36395
36396$(document).ready(function(){
36397	var containerHTML = $('.title-search-input_fixedtf').detach();
36398	$('#title-search_fixedtf').append(containerHTML);
36399});
36400
36401$(document).ready(function(){
36402	var containerHTML = $('.title-search-input').detach();
36403	$('#title-search').append(containerHTML);
36404});
36405
36406
36407
36408function JCTitleSearch4(arParams)
36409{
36410	var _this = this;
36411	
36412	this.arParams = {
36413		'AJAX_PAGE': arParams.AJAX_PAGE,
36414		'CONTAINER_ID': arParams.CONTAINER_ID,
36415		'INPUT_ID': arParams.INPUT_ID,
36416		'INPUT_ID_TMP': arParams.INPUT_ID_TMP,
36417		'MIN_QUERY_LEN': parseInt(arParams.MIN_QUERY_LEN)
36418	};
36419
36420	if(arParams.WAIT_IMAGE)
36421		this.arParams.WAIT_IMAGE = arParams.WAIT_IMAGE;
36422	if(arParams.MIN_QUERY_LEN <= 0)
36423		arParams.MIN_QUERY_LEN = 1;
36424
36425	this.cache = [];
36426	this.cache_key = null;
36427
36428	this.startText = '';
36429	this.running = false;
36430	this.needRunAgain = false;
36431	this.currentRow = -1;
36432	this.RESULT = null;
36433	this.CONTAINER = null;
36434	this.INPUT = null;
36435	this.WAIT = null;
36436
36437	this.ShowResult = function(result)
36438	{
36439		if(BX.type.isString(result))
36440		{
36441			_this.RESULT.innerHTML = result;
36442		}
36443
36444		_this.RESULT.style.display = _this.RESULT.innerHTML !== '' ? 'block' : 'none';
36445		var pos = _this.adjustResultNode();
36446
36447		//adjust left column to be an outline
36448		var res_pos;
36449		var th;
36450		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
36451		if(tbl)
36452		{
36453			th = BX.findChild(tbl, {'tag':'th'}, true);
36454		}
36455		
36456		if(th)
36457		{
36458			var tbl_pos = BX.pos(tbl);
36459			tbl_pos.width = tbl_pos.right - tbl_pos.left;
36460
36461			var th_pos = BX.pos(th);
36462			th_pos.width = th_pos.right - th_pos.left;
36463			th.style.width = th_pos.width + 'px';
36464
36465			_this.RESULT.style.width = (pos.width + th_pos.width) + 'px';
36466
36467			//Move table to left by width of the first column
36468			_this.RESULT.style.left = '0px';//(pos.left - th_pos.width - 1)+ 'px';
36469
36470			//Shrink table when it's too wide
36471			if((tbl_pos.width - th_pos.width) > pos.width)
36472				_this.RESULT.style.width = (pos.width + th_pos.width -1) + 'px';
36473
36474			//Check if table is too wide and shrink result div to it's width
36475			tbl_pos = BX.pos(tbl);
36476			res_pos = BX.pos(_this.RESULT);
36477			if(res_pos.right > tbl_pos.right)
36478			{
36479				_this.RESULT.style.width = (tbl_pos.right - tbl_pos.left) + 'px';
36480			}
36481		}
36482
36483		var fade;
36484		if(tbl) fade = BX.findChild(_this.RESULT, {'class':'title-search-fader'}, true);
36485		if(fade && th)
36486		{
36487			res_pos = BX.pos(_this.RESULT);
36488			fade.style.left = (res_pos.right - res_pos.left - 18) + 'px';
36489			fade.style.width = 18 + 'px';
36490			fade.style.top = 0 + 'px';
36491			fade.style.height = (res_pos.bottom - res_pos.top) + 'px';
36492			fade.style.display = 'block';
36493		}
36494
36495		
36496		$('.bx_searche.scrollbar').mCustomScrollbar({
36497			mouseWheel: {
36498				scrollAmount: 150,
36499				preventDefault: true
36500			}
36501		});
36502	};
36503
36504	this.onKeyPress = function(keyCode)
36505	{
36506		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
36507		if(!tbl)
36508			return false;
36509
36510		var i;
36511		var cnt = tbl.rows.length;
36512
36513		switch (keyCode)
36514		{
36515		case 27: // escape key - close search div
36516			_this.RESULT.style.display = 'none';
36517			_this.currentRow = -1;
36518			_this.UnSelectAll();
36519		return true;
36520
36521		case 40: // down key - navigate down on search results
36522			if(_this.RESULT.style.display == 'none')
36523				_this.RESULT.style.display = 'block';
36524
36525			var first = -1;
36526			for(i = 0; i < cnt; i++)
36527			{
36528				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
36529				{
36530					if(first == -1)
36531						first = i;
36532
36533					if(_this.currentRow < i)
36534					{
36535						_this.currentRow = i;
36536						break;
36537					}
36538					else if(tbl.rows[i].className == 'title-search-selected')
36539					{
36540						tbl.rows[i].className = '';
36541					}
36542				}
36543			}
36544
36545			if(i == cnt && _this.currentRow != i)
36546				_this.currentRow = first;
36547
36548			tbl.rows[_this.currentRow].className = 'title-search-selected';
36549		return true;
36550
36551		case 38: // up key - navigate up on search results
36552			if(_this.RESULT.style.display == 'none')
36553				_this.RESULT.style.display = 'block';
36554
36555			var last = -1;
36556			for(i = cnt-1; i >= 0; i--)
36557			{
36558				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
36559				{
36560					if(last == -1)
36561						last = i;
36562
36563					if(_this.currentRow > i)
36564					{
36565						_this.currentRow = i;
36566						break;
36567					}
36568					else if(tbl.rows[i].className == 'title-search-selected')
36569					{
36570						tbl.rows[i].className = '';
36571					}
36572				}
36573			}
36574
36575			if(i < 0 && _this.currentRow != i)
36576				_this.currentRow = last;
36577
36578			tbl.rows[_this.currentRow].className = 'title-search-selected';
36579		return true;
36580
36581		case 13: // enter key - choose current search result
36582			if(_this.RESULT.style.display == 'block')
36583			{
36584				for(i = 0; i < cnt; i++)
36585				{
36586					if(_this.currentRow == i)
36587					{
36588						if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
36589						{
36590							var a = BX.findChild(tbl.rows[i], {'tag':'a'}, true);
36591							if(a)
36592							{
36593								window.location = a.href;
36594								return true;
36595							}
36596						}
36597					}
36598				}
36599			}
36600		return false;
36601		}
36602
36603		return false;
36604	};
36605
36606	this.onTimeout = function()
36607	{
36608		_this.onChange(function(){
36609			setTimeout(_this.onTimeout, 500);
36610		});
36611	};
36612
36613	this.onChange = function(callback)
36614	{
36615		if (_this.running){
36616			_this.needRunAgain = true;
36617			return;
36618		}
36619		_this.running = true;
36620
36621		if(_this.INPUT.value != _this.oldValue && _this.INPUT.value != _this.startText)
36622		{
36623			_this.oldValue = _this.INPUT.value;
36624			if(_this.INPUT.value.length >= _this.arParams.MIN_QUERY_LEN)
36625			{
36626				_this.cache_key = _this.arParams.INPUT_ID + '|' + _this.INPUT.value;
36627				if(_this.cache[_this.cache_key] == null)
36628				{
36629					if(_this.WAIT)
36630					{
36631						var pos = BX.pos(_this.INPUT);
36632						var height = (pos.bottom - pos.top)-2;
36633						_this.WAIT.style.top = (pos.top+1) + 'px';
36634						_this.WAIT.style.height = height + 'px';
36635						_this.WAIT.style.width = height + 'px';
36636						_this.WAIT.style.left = (pos.right - height + 2) + 'px';
36637						_this.WAIT.style.display = 'block';
36638					}
36639
36640					BX.ajax.post(
36641						_this.arParams.AJAX_PAGE,
36642						{
36643							'ajax_call':'y',
36644							'INPUT_ID':_this.arParams.INPUT_ID_TMP,
36645							'q':_this.INPUT.value,
36646							'l':_this.arParams.MIN_QUERY_LEN
36647						},
36648						function(result)
36649						{
36650							_this.cache[_this.cache_key] = result;
36651							_this.ShowResult(result);
36652							_this.currentRow = -1;
36653							_this.EnableMouseEvents();
36654							if(_this.WAIT)
36655								_this.WAIT.style.display = 'none';
36656							if (!!callback)
36657								callback();
36658							_this.running = false;
36659
36660							if(_this.needRunAgain){
36661								_this.needRunAgain = false;
36662								_this.onChange(callback);
36663							}
36664						}
36665					);
36666					return;
36667				}
36668				else
36669				{
36670					_this.ShowResult(_this.cache[_this.cache_key]);
36671					_this.currentRow = -1;
36672					_this.EnableMouseEvents();
36673				}
36674			}
36675			else
36676			{
36677				_this.RESULT.style.display = 'none';
36678				_this.currentRow = -1;
36679				_this.UnSelectAll();
36680			}
36681		}
36682		if (!!callback)
36683			callback();
36684		_this.running = false;
36685	};
36686
36687	this.UnSelectAll = function()
36688	{
36689		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
36690		if(tbl)
36691		{
36692			var cnt = tbl.rows.length;
36693			for(var i = 0; i < cnt; i++)
36694				tbl.rows[i].className = '';
36695		}
36696	};
36697
36698	this.EnableMouseEvents = function()
36699	{
36700		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
36701		if(tbl)
36702		{
36703			var cnt = tbl.rows.length;
36704			for(var i = 0; i < cnt; i++)
36705				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
36706				{
36707					tbl.rows[i].id = 'row_' + i;
36708					tbl.rows[i].onmouseover = function (e) {
36709						if(_this.currentRow != this.id.substr(4))
36710						{
36711							_this.UnSelectAll();
36712							this.className = 'title-search-selected';
36713							_this.currentRow = this.id.substr(4);
36714						}
36715					};
36716					tbl.rows[i].onmouseout = function (e) {
36717						this.className = '';
36718						_this.currentRow = -1;
36719					};
36720				}
36721		}
36722	};
36723
36724	this.onFocusLost = function(hide)
36725	{
36726		setTimeout(function(){_this.RESULT.style.display = 'none';}, 300);
36727		// _this.RESULT.style.display = 'none';
36728	};
36729
36730	this.onFocusGain = function()
36731	{
36732		if(_this.RESULT.innerHTML.length)
36733			_this.ShowResult();
36734	};
36735
36736	this.onKeyDown = function(e)
36737	{
36738		if(!e)
36739			e = window.event;
36740		if (_this.RESULT.style.display == 'block')
36741		{
36742			if(_this.onKeyPress(e.keyCode))
36743				return BX.PreventDefault(e);
36744		}
36745	};
36746
36747	this.adjustResultNode = function()
36748	{
36749		var pos, pos_input;
36750		var fixedParent = BX.findParent(_this.CONTAINER, BX.is_fixed);
36751		// if(!!fixedParent)
36752		// {
36753		// 	_this.RESULT.style.position = 'fixed';
36754		// 	_this.RESULT.style.zIndex = BX.style(fixedParent, 'z-index') + 2;
36755		// 	pos = BX.pos(_this.CONTAINER, true);
36756		// }
36757		// else
36758		// {
36759			_this.RESULT.style.position = 'absolute';
36760			pos = BX.pos(_this.CONTAINER);
36761		// }
36762		pos_input = BX.pos(_this.INPUT);
36763
36764		pos.width = pos.right - pos.left;
36765		_this.RESULT.style.top = '100%';
36766		_this.RESULT.style.left = '0px';//pos_input.left + 'px';
36767
36768		if($(_this.INPUT).closest('.inline-search-block.with-close').length)
36769			_this.RESULT.style.width = pos_input.width + 'px';
36770		else
36771			_this.RESULT.style.width = pos.width + 'px';
36772		return pos;
36773	};
36774
36775	this._onContainerLayoutChange = function()
36776	{
36777		if(_this.RESULT.style.display !== "none" && _this.RESULT.innerHTML !== '')
36778		{
36779			_this.adjustResultNode();
36780		}
36781	};
36782	this.Init = function()
36783	{
36784		this.CONTAINER = document.getElementById(this.arParams.CONTAINER_ID);
36785		BX.addCustomEvent(this.CONTAINER, "OnNodeLayoutChange", this._onContainerLayoutChange);
36786
36787		this.RESULT = document.body.appendChild(document.createElement("DIV"));
36788
36789		this.RESULT.className = 'title-search-result '+this.arParams.INPUT_ID;
36790		this.INPUT = document.getElementById(this.arParams.INPUT_ID);
36791		this.startText = this.oldValue = this.INPUT.value;
36792		BX.bind(this.INPUT, 'focus', function(e) {
36793			_this.onFocusGain()
36794		});
36795		BX.bind(this.INPUT, 'blur', function(e) {
36796			if(!$(e.relatedTarget).hasClass('bx_item_block'))
36797				_this.onFocusLost();
36798		});
36799
36800		if(BX.browser.IsSafari() || BX.browser.IsIE())
36801			this.INPUT.onkeydown = this.onKeyDown;
36802		else
36803			this.INPUT.onkeypress = this.onKeyDown;
36804
36805		if(this.arParams.WAIT_IMAGE)
36806		{
36807			this.WAIT = document.body.appendChild(document.createElement("DIV"));
36808			this.WAIT.style.backgroundImage = "url('" + this.arParams.WAIT_IMAGE + "')";
36809			if(!BX.browser.IsIE())
36810				this.WAIT.style.backgroundRepeat = 'none';
36811			this.WAIT.style.display = 'none';
36812			this.WAIT.style.position = 'absolute';
36813			this.WAIT.style.zIndex = '1100';
36814		}
36815
36816		BX.bind(this.INPUT, 'bxchange', function(e) {_this.onChange()});
36817	};
36818	BX.ready(function (){_this.Init(arParams)});
36819}
36820
36821/* End */
36822;
36823; /* Start:"a:4:{s:4:"full";
36823s:88:"/bitrix/components/aspro/marketing.popup.max/templates/.default/script.js?17164655411434";s:6:"source";s:73:"/bitrix/components/aspro/marketing.popup.max/templates/.default/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
36824$(document).ready(function(){
36825	if($('.dyn_mp_jqm').length)
36826	{
36827		var delayNext = 0;
36828		$('.dyn_mp_jqm').each(function(i, el) {
36829			var jqmBlock = $(el),
36830				delay = 0;
36831
36832			if(!jqmBlock.hasClass('initied')) // first load
36833			{
36834				jqmBlock.addClass('initied');
36835
36836				if(jqmBlock.data('param-delay'))
36837					delay = jqmBlock.data('param-delay')*1000;
36838
36839				if (delayNext == delay) {
36840					delay += 1000;
36841				}
36842
36843				delayNext = delay;
36844
36845				if(typeof localStorage !== 'undefined')
36846				{
36847					var dataLS = localStorage.getItem(jqmBlock.data('ls')),
36848						ls = '';
36849					try{
36850						ls = JSON.parse(dataLS);
36851					}
36852					catch(e){
36853						ls = dataLS
36854					}
36855					if(!ls || (ls && (ls.TIMESTAMP < Date.now() && ls.TIMESTAMP)))
36856					{
36857						/*if (timeoutID) {
36858							clearTimeout(timeoutID);
36859						}*/ 
36860						timeoutID = setTimeout(function(){
36861							console.log(jqmBlock, delay)
36862							jqmBlock.click();
36863						}, delay);
36864					}
36865				}
36866				else
36867				{
36868					var ls = $.cookie(jqmBlock.data('ls'));
36869					if(!ls)
36870					{
36871						/*if (timeoutID) {
36872							clearTimeout(timeoutID);
36873						}*/ 
36874						timeoutID = setTimeout(function(){
36875							jqmBlock.click();
36876						}, delay);
36877					}
36878				}
36879
36880			}
36881			else // ajax popup
36882			{
36883
36884			}
36885
36886		});
36887	}
36888
36889
36890	$(document).on('click', '.dyn_mp_jqm_frame .popup-text-info__btn .btn', function() {
36891		var closeBtn = $(this).closest('.dyn_mp_jqm_frame').find('.jqmClose');
36892
36893		if(closeBtn.length) {
36894			closeBtn.trigger('click');
36895		}
36896	}); 
36897})
36898/* End */
36899;
36900; /* Start:"a:4:{s:4:"full";s:90:"/bitrix/templates/aspro_max/components/bitrix/search.title/fixed/script.js?171646553710264";s:6:"source";s:74:"/bitrix/templates/aspro_max/components/bitrix/search.title/fixed/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
36901function JCTitleSearch2(arParams)
36902{
36903	var _this = this;
36904
36905	this.arParams = {
36906		'AJAX_PAGE': arParams.AJAX_PAGE,
36907		'CONTAINER_ID': arParams.CONTAINER_ID,
36908		'INPUT_ID': arParams.INPUT_ID,
36909		'INPUT_ID_TMP': arParams.INPUT_ID_TMP,
36910		'MIN_QUERY_LEN': parseInt(arParams.MIN_QUERY_LEN)
36911	};
36912	if(arParams.WAIT_IMAGE)
36913		this.arParams.WAIT_IMAGE = arParams.WAIT_IMAGE;
36914	if(arParams.MIN_QUERY_LEN <= 0)
36915		arParams.MIN_QUERY_LEN = 1;
36916
36917	this.cache = [];
36918	this.cache_key = null;
36919
36920	this.startText = '';
36921	this.running = false;
36922	this.needRunAgain = false;
36923	this.currentRow = -1;
36924	this.RESULT = null;
36925	this.CONTAINER = null;
36926	this.INPUT = null;
36927	this.WAIT = null;
36928
36929	this.ShowResult = function(result)
36930	{
36931		if(BX.type.isString(result))
36932		{
36933			_this.RESULT.innerHTML = result;
36934		}
36935
36936		_this.RESULT.style.display = _this.RESULT.innerHTML !== '' ? 'block' : 'none';
36937		var pos = _this.adjustResultNode();
36938
36939		//adjust left column to be an outline
36940		var res_pos;
36941		var th;
36942		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
36943		if(tbl)
36944		{
36945			th = BX.findChild(tbl, {'tag':'th'}, true);
36946		}
36947		if(th)
36948		{
36949			var tbl_pos = BX.pos(tbl);
36950			tbl_pos.width = tbl_pos.right - tbl_pos.left;
36951
36952			var th_pos = BX.pos(th);
36953			th_pos.width = th_pos.right - th_pos.left;
36954			th.style.width = th_pos.width + 'px';
36955
36956			_this.RESULT.style.width = (pos.width + th_pos.width) + 'px';
36957
36958			//Move table to left by width of the first column
36959			_this.RESULT.style.left = (pos.left - th_pos.width - 1)+ 'px';
36960
36961			//Shrink table when it's too wide
36962			if((tbl_pos.width - th_pos.width) > pos.width)
36963				_this.RESULT.style.width = (pos.width + th_pos.width -1) + 'px';
36964
36965			//Check if table is too wide and shrink result div to it's width
36966			tbl_pos = BX.pos(tbl);
36967			res_pos = BX.pos(_this.RESULT);
36968			if(res_pos.right > tbl_pos.right)
36969			{
36970				_this.RESULT.style.width = (tbl_pos.right - tbl_pos.left) + 'px';
36971			}
36972		}
36973
36974		var fade;
36975		if(tbl) fade = BX.findChild(_this.RESULT, {'class':'title-search-fader'}, true);
36976		if(fade && th)
36977		{
36978			res_pos = BX.pos(_this.RESULT);
36979			fade.style.left = (res_pos.right - res_pos.left - 18) + 'px';
36980			fade.style.width = 18 + 'px';
36981			fade.style.top = 0 + 'px';
36982			fade.style.height = (res_pos.bottom - res_pos.top) + 'px';
36983			fade.style.display = 'block';
36984		}
36985
36986		$('.bx_searche.scrollbar').mCustomScrollbar({
36987			mouseWheel: {
36988				scrollAmount: 150,
36989				preventDefault: true
36990			}
36991		});
36992	};
36993
36994	this.onKeyPress = function(keyCode)
36995	{
36996		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
36997		if(!tbl)
36998			return false;
36999
37000		var i;
37001		var cnt = tbl.rows.length;
37002
37003		switch (keyCode)
37004		{
37005		case 27: // escape key - close search div
37006			_this.RESULT.style.display = 'none';
37007			_this.currentRow = -1;
37008			_this.UnSelectAll();
37009		return true;
37010
37011		case 40: // down key - navigate down on search results
37012			if(_this.RESULT.style.display == 'none')
37013				_this.RESULT.style.display = 'block';
37014
37015			var first = -1;
37016			for(i = 0; i < cnt; i++)
37017			{
37018				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
37019				{
37020					if(first == -1)
37021						first = i;
37022
37023					if(_this.currentRow < i)
37024					{
37025						_this.currentRow = i;
37026						break;
37027					}
37028					else if(tbl.rows[i].className == 'title-search-selected')
37029					{
37030						tbl.rows[i].className = '';
37031					}
37032				}
37033			}
37034
37035			if(i == cnt && _this.currentRow != i)
37036				_this.currentRow = first;
37037
37038			tbl.rows[_this.currentRow].className = 'title-search-selected';
37039		return true;
37040
37041		case 38: // up key - navigate up on search results
37042			if(_this.RESULT.style.display == 'none')
37043				_this.RESULT.style.display = 'block';
37044
37045			var last = -1;
37046			for(i = cnt-1; i >= 0; i--)
37047			{
37048				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
37049				{
37050					if(last == -1)
37051						last = i;
37052
37053					if(_this.currentRow > i)
37054					{
37055						_this.currentRow = i;
37056						break;
37057					}
37058					else if(tbl.rows[i].className == 'title-search-selected')
37059					{
37060						tbl.rows[i].className = '';
37061					}
37062				}
37063			}
37064
37065			if(i < 0 && _this.currentRow != i)
37066				_this.currentRow = last;
37067
37068			tbl.rows[_this.currentRow].className = 'title-search-selected';
37069		return true;
37070
37071		case 13: // enter key - choose current search result
37072			if(_this.RESULT.style.display == 'block')
37073			{
37074				for(i = 0; i < cnt; i++)
37075				{
37076					if(_this.currentRow == i)
37077					{
37078						if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
37079						{
37080							var a = BX.findChild(tbl.rows[i], {'tag':'a'}, true);
37081							if(a)
37082							{
37083								window.location = a.href;
37084								return true;
37085							}
37086						}
37087					}
37088				}
37089			}
37090		return false;
37091		}
37092
37093		return false;
37094	};
37095
37096	this.onTimeout = function()
37097	{
37098		_this.onChange(function(){
37099			setTimeout(_this.onTimeout, 500);
37100		});
37101	};
37102
37103	this.onChange = function(callback)
37104	{
37105		if (_this.running){
37106			_this.needRunAgain = true;
37107			return;
37108		}
37109		_this.running = true;
37110
37111		if(_this.INPUT.value != _this.oldValue && _this.INPUT.value != _this.startText)
37112		{
37113			_this.oldValue = _this.INPUT.value;
37114			if(_this.INPUT.value.length >= _this.arParams.MIN_QUERY_LEN)
37115			{
37116				_this.cache_key = _this.arParams.INPUT_ID + '|' + _this.INPUT.value;
37117				if(_this.cache[_this.cache_key] == null)
37118				{
37119					if(_this.WAIT)
37120					{
37121						var pos = BX.pos(_this.INPUT);
37122						var height = (pos.bottom - pos.top)-2;
37123						_this.WAIT.style.top = (pos.top+1) + 'px';
37124						_this.WAIT.style.height = height + 'px';
37125						_this.WAIT.style.width = height + 'px';
37126						_this.WAIT.style.left = (pos.right - height + 2) + 'px';
37127						_this.WAIT.style.display = 'block';
37128					}
37129
37130					BX.ajax.post(
37131						_this.arParams.AJAX_PAGE,
37132						{
37133							'ajax_call':'y',
37134							'INPUT_ID':_this.arParams.INPUT_ID_TMP,
37135							'q':_this.INPUT.value,
37136							'l':_this.arParams.MIN_QUERY_LEN
37137						},
37138						function(result)
37139						{
37140							_this.cache[_this.cache_key] = result;
37141							_this.ShowResult(result);
37142							_this.currentRow = -1;
37143							_this.EnableMouseEvents();
37144							if(_this.WAIT)
37145								_this.WAIT.style.display = 'none';
37146							if (!!callback)
37147								callback();
37148							_this.running = false;
37149
37150							if(_this.needRunAgain){
37151								_this.needRunAgain = false;
37152								_this.onChange(callback);
37153							}
37154						}
37155					);
37156					return;
37157				}
37158				else
37159				{
37160					_this.ShowResult(_this.cache[_this.cache_key]);
37161					_this.currentRow = -1;
37162					_this.EnableMouseEvents();
37163				}
37164			}
37165			else
37166			{
37167				_this.RESULT.style.display = 'none';
37168				_this.currentRow = -1;
37169				_this.UnSelectAll();
37170			}
37171		}
37172		if (!!callback)
37173			callback();
37174		_this.running = false;
37175	};
37176
37177	this.UnSelectAll = function()
37178	{
37179		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
37180		if(tbl)
37181		{
37182			var cnt = tbl.rows.length;
37183			for(var i = 0; i < cnt; i++)
37184				tbl.rows[i].className = '';
37185		}
37186	};
37187
37188	this.EnableMouseEvents = function()
37189	{
37190		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
37191		if(tbl)
37192		{
37193			var cnt = tbl.rows.length;
37194			for(var i = 0; i < cnt; i++)
37195				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
37196				{
37197					tbl.rows[i].id = 'row_' + i;
37198					tbl.rows[i].onmouseover = function (e) {
37199						if(_this.currentRow != this.id.substr(4))
37200						{
37201							_this.UnSelectAll();
37202							this.className = 'title-search-selected';
37203							_this.currentRow = this.id.substr(4);
37204						}
37205					};
37206					tbl.rows[i].onmouseout = function (e) {
37207						this.className = '';
37208						_this.currentRow = -1;
37209					};
37210				}
37211		}
37212	};
37213
37214	this.onFocusLost = function(hide)
37215	{
37216		setTimeout(function(){_this.RESULT.style.display = 'none';}, 300);
37217		// _this.RESULT.style.display = 'none';
37218	};
37219
37220	this.onFocusGain = function()
37221	{
37222		if(_this.RESULT.innerHTML.length)
37223			_this.ShowResult();
37224	};
37225
37226	this.onKeyDown = function(e)
37227	{
37228		if(!e)
37229			e = window.event;
37230
37231		if (_this.RESULT.style.display == 'block')
37232		{
37233			if(_this.onKeyPress(e.keyCode))
37234				return BX.PreventDefault(e);
37235		}
37236	};
37237
37238	this.adjustResultNode = function()
37239	{
37240		var pos, pos_input;
37241		var fixedParent = BX.findParent(_this.CONTAINER, BX.is_fixed);
37242		if(!!fixedParent)
37243		{
37244			_this.RESULT.style.position = 'fixed';
37245			_this.RESULT.style.zIndex = BX.style(fixedParent, 'z-index') + 2;
37246			pos = BX.pos(_this.CONTAINER, true);
37247		}
37248		else
37249		{
37250			_this.RESULT.style.position = 'absolute';
37251			pos = BX.pos(_this.CONTAINER);
37252		}
37253		//console.log(pos);
37254		//console.log(_this.CONTAINER);
37255		pos_input = BX.pos(_this.INPUT);
37256
37257		pos.width = pos.right - pos.left;
37258		_this.RESULT.style.top = (pos.bottom + 2) + 'px';
37259		_this.RESULT.style.left = pos_input.left + 'px';
37260
37261		if($(_this.INPUT).closest('.inline-search-block.with-close').length)
37262			_this.RESULT.style.width = pos_input.width + 'px';
37263		else
37264			_this.RESULT.style.width = pos.width + 'px';
37265		return pos;
37266	};
37267
37268	this._onContainerLayoutChange = function()
37269	{
37270		if(_this.RESULT.style.display !== "none" && _this.RESULT.innerHTML !== '')
37271		{
37272			_this.adjustResultNode();
37273		}
37274	};
37275	this.Init = function()
37276	{
37277		this.CONTAINER = document.getElementById(this.arParams.CONTAINER_ID);
37278		BX.addCustomEvent(this.CONTAINER, "OnNodeLayoutChange", this._onContainerLayoutChange);
37279
37280		this.RESULT = document.body.appendChild(document.createElement("DIV"));
37281
37282		this.RESULT.className = 'title-search-result '+this.arParams.INPUT_ID;
37283		if(this.arParams.INPUT_ID != 'title-search-input_fixed')
37284			this.RESULT.className += ' '+arMaxOptions['THEME']['TYPE_SEARCH']+'_type';
37285
37286		this.INPUT = document.getElementById(this.arParams.INPUT_ID);
37287		this.startText = this.oldValue = this.INPUT.value;
37288		BX.bind(this.INPUT, 'focus', function() {_this.onFocusGain()});
37289		BX.bind(this.INPUT, 'blur', function() {_this.onFocusLost()});
37290
37291		if(BX.browser.IsSafari() || BX.browser.IsIE())
37292			this.INPUT.onkeydown = this.onKeyDown;
37293		else
37294			this.INPUT.onkeypress = this.onKeyDown;
37295
37296		if(this.arParams.WAIT_IMAGE)
37297		{
37298			this.WAIT = document.body.appendChild(document.createElement("DIV"));
37299			this.WAIT.style.backgroundImage = "url('" + this.arParams.WAIT_IMAGE + "')";
37300			if(!BX.browser.IsIE())
37301				this.WAIT.style.backgroundRepeat = 'none';
37302			this.WAIT.style.display = 'none';
37303			this.WAIT.style.position = 'absolute';
37304			this.WAIT.style.zIndex = '1100';
37305		}
37306
37307		BX.bind(this.INPUT, 'bxchange', function() {_this.onChange()});
37308	};
37309	BX.ready(function (){_this.Init(arParams)});
37310}
37311
37312/* End */
37313;
37314; /* Start:"a:4:{s:4:"full";
37314s:60:"/bitrix/templates/aspro_max/js/set_referrer.js?1716465537420";s:6:"source";s:46:"/bitrix/templates/aspro_max/js/set_referrer.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
37315
37316//////// SEND DOCUMENT REFFER IF IT'S EXTERNAL (PRE-OG)
37317//console.log(document.referrer);
37318//console.log(document.location.hostname);
37319//console.log(document.location.href);
37320
37321//if (document.referrer.indexOf(document.location.hostname) === -1) {
37322$.ajax({
37323  url: "/ajax/set_referrer.php",
37324  method: "POST",
37325  data: {
37326    document_referrer: document.referrer,
37327    document_location_href: document.location.href
37328  }
37329});
37330  //}
37331/* End */
37332;
37333; /* Start:"a:4:{s:4:"full";s:58:"/bitrix/templates/aspro_max/js/fast_panel.js?1716465537471";s:6:"source";s:44:"/bitrix/templates/aspro_max/js/fast_panel.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
37334document.addEventListener('DOMContentLoaded', function() {
37335  var panel = $('.b-fast-panel__index');
37336  var scrollPrev = 0;
37337
37338  $(window).on('scroll', function () {
37339    var width = window.innerWidth;
37340    if (width < 768) {
37341      var scrolled = $(window).scrollTop();
37342      if (scrolled > 0 && scrolled > scrollPrev || scrolled < 10) {
37343        panel.addClass('out');
37344      } else {
37345        panel.removeClass('out');
37346      }
37347      scrollPrev = scrolled;
37348    }
37349  });
37350}, false);
37351/* End */
37352;
37353; /* Start:"a:4:{s:4:"full";s:56:"/bitrix/templates/aspro_max/js/custom.js?171646553713185";s:6:"source";s:40:"/bitrix/templates/aspro_max/js/custom.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
37354/*
37355You can use this file with your scripts.
37356It will not be overwritten when you upgrade solution.
37357*/
37358
37359
37360document.addEventListener('DOMContentLoaded', function () {
37361  let quiz_load = true;
37362  if (document.querySelector('#quiz-load') || document.querySelector('#quiz-load-banner')) {
37363    document.querySelector('#quiz-load').addEventListener("click",  quizLoad);
37364    if(document.querySelector('#quiz-load-banner')) {
37365      document.querySelector('#quiz-load-banner').addEventListener("click",  quizLoad);
37366    }
37367    
37368    
37369    async function quizLoad(e) {
37370      e.preventDefault();
37371      if (quiz_load) {
37372        quiz_load = false;
37373        const head = document.querySelector('head');
37374        const body = document.querySelector('body');
37375
37376        function addCSS(id, css, href, media) {
37377          let link = document.createElement('link');
37378          link.id = id;
37379          link.rel = 'stylesheet';
37380          if (css) {
37381            link.type = 'text/css';
37382          }
37383          link.href = href;
37384          if (media) {
37385            link.media = 'all';
37386          }
37387          head.appendChild(link);
37388        };
37389
37390        function addScript(id, src) {
37391          let link = document.createElement('script');
37392          link.id = id;
37393          link.src = src;
37394          body.appendChild(link);
37395        };
37396
37397        addCSS('quiz-css', true, '/quiz/css/style.min.css?00012', true);
37398        addCSS('quiz-font', false, 'https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap', false);
37399
37400        await fetch('/quiz/start.php?0001')
37401          .then(function (response) {
37402            return response.text()
37403          })
37404          .then(function (html) {
37405            // console.info(html);
37406            let quiz = document.createElement('div');
37407            quiz.id = 'quiz-block';
37408            // quiz.setAttribute('data-id', '1')
37409            quiz.classList.add('quiz-block');
37410            quiz.innerHTML = html;
37411            body.appendChild(quiz);
37412            // quizForm();
37413            // quizLink();
37414            addScript('quiz-js', '/quiz/js/script.min.js?0008');
37415            // Close
37416            let closeQuiz = document.querySelector('#close-quiz');
37417            let closeSuccess = document.querySelector('#close-success');
37418            let quizBlock = document.querySelector('#quiz-block');
37419            closeQuiz.addEventListener('click', function (e) {
37420              e.preventDefault();
37421              quizBlock.classList.add('dn');
37422            })
37423            closeSuccess.addEventListener('click', function (e) {
37424              e.preventDefault();
37425              quiz_load = true;
37426              quizBlock.remove();
37427              document.querySelector('#quiz-js').remove();
37428              document.querySelector('#quiz-css').remove();
37429              document.querySelector('#quiz-font').remove();
37430            })
37431          })
37432          .catch(function (err) {
37433            console.error('Failed to fetch page: ', err);
37434          });
37435      } else {
37436        document.querySelector('#quiz-block').classList.remove('dn');
37437      }
37438    }
37439    
37440  }
37441}, false);
37442
37443
37444
37445// $(window).on("load", function () {
37446//
37447//   // Маска ввода телефона start
37448//   function setCursorPosition(pos, elem) {
37449//     elem.focus();
37450//     if (elem.setSelectionRange) elem.setSelectionRange(pos, pos);
37451//     else if (elem.createTextRange) {
37452//       var range = elem.createTextRange();
37453//       range.collapse(true);
37454//       range.moveEnd("character", pos);
37455//       range.moveStart("character", pos);
37456//       range.select()
37457//     }
37458//   }
37459//
37460//   function mask(event) {
37461//     var matrix = "+7 (___) ___-__-__",
37462//       i = 0,
37463//       def = matrix.replace(/\D/g, ""),
37464//       val = this.value.replace(/\D/g, "");
37465//     if (def.length >= val.length) val = def;
37466//     this.value = matrix.replace(/./g, function (a) {
37467//       return /[_\d]/.test(a) && i < val.length ? val.charAt(i++) : i >= val.length ? "" : a
37468//     });
37469//     if (event.type == "blur") {
37470//       if (this.value.length == 2) this.value = ""
37471//     } else setCursorPosition(this.value.length, this)
37472//   };
37473//
37474//   var inputPhone = document.querySelectorAll('input[name="phone"].required');
37475//   for (var i = 0; i < inputPhone.length; i++) {
37476//     inputPhone[i].addEventListener("input", mask, false);
37477//     inputPhone[i].addEventListener("focus", mask, false);
37478//     inputPhone[i].addEventListener("blur", mask, false);
37479//   }
37480//   ;
37481//   // Маска ввода телефона end
37482//
37483//
37484//   // показ модалки start
37485//   //ховер start
37486//   if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
37487//     // код для мобильных устройств
37488//   } else {
37489//     $(".modal-form__img, .modal-form__content, .modal-form__form")
37490//       .hover(
37491//         function () {
37492//           $(".modal-form__img").addClass("active");
37493//         },
37494//         function () {
37495//           $(".modal-form__img").removeClass('active');
37496//         }
37497//       );
37498//   }
37499//   //ховер end
37500//
37501//   function modalShow() {
37502//     // console.log("modalShow", sessionStorage.getItem("modalShow"));
37503//     return sessionStorage.getItem("modalShow") == "0" ? false : true
37504//   }
37505//
37506//   function modalActive() {
37507//     if (modalShow()) {
37508//       $(".modal-form_wrap").addClass("active");
37509//       sessionStorage.setItem("modalShow", "0");
37510//     }
37511//   }
37512//
37513//   const dataElement = $(".modal-form_wrap").attr("data-element");
37514//   // console.log("dataElement", dataElement);
37515//   if (dataElement === "" && modalShow()) {
37516//     console.log("dataElement if", dataElement);
37517//     inWindow();
37518//   } else if (dataElement !== "" && modalShow() && dataElement !== undefined) {
37519//     // console.log("dataElement else if", dataElement);
37520//     inWindow(dataElement);
37521//   }
37522//
37523//   function inWindow(elem = "#fast-popup") {
37524//     $(window).scroll(function () {
37525//       let wt = $(window).scrollTop();
37526//       let wh = $(window).height();
37527//       let et = $(elem).offset().top;
37528//       let eh = $(elem).outerHeight();
37529//       if (wt + wh >= et && wt + wh - eh * 2 <= et + (wh - eh)) {
37530//         if (modalShow()) {
37531//           modalActive();
37532//         }
37533//       }
37534//     });
37535//     // $(window).scroll(function(){
37536//     //   let wt = $(window).scrollTop();
37537//     //   let wh = $(window).height();
37538//     //   let et = $(elem).offset().top;
37539//     //   let eh = $(elem).outerHeight();
37540//     //   let dh = $(document).height();
37541//     //   if (wt + wh >= et || wh + wt == dh || eh + et < wh){
37542//     //     modalActive();
37543//     //   }
37544//     // });
37545//   }
37546//
37547//   const dataTime = $(".modal-form_wrap").attr("data-time");
37548//
37549//   // console.log("dataTime", dataTime);
37550//   function funTime(time = 60) {
37551//     setTimeout(modalActive, time + "000");
37552//   }
37553//
37554//   if (dataTime === "" && modalShow()) {
37555//     // console.log("dataTime if", dataTime);
37556//     funTime();
37557//   } else if (dataTime && dataTime > 0 && modalShow()) {
37558//     // console.log("dataTime else if", dataTime);
37559//     funTime(Number(dataTime));
37560//   }
37561//
37562//   const dataScroll = $(".modal-form_wrap").attr("data-scroll");
37563//   // console.log("dataScroll", dataScroll);
37564//   if (dataScroll !== "" && dataScroll !== undefined) {
37565//     // console.log("dataScroll if", dataScroll);
37566//     const heightHTML = $(document).outerHeight(true);
37567//     // console.log("heightHTML", heightHTML);
37568//     const heigh = Math.round(heightHTML / 100 * dataScroll - window.innerHeight / 2); // window.innerHeight / 2
37569//     // console.log("heigh", heigh);
37570//     $(window).scroll(function () {
37571//       let scrollTop = $(this).scrollTop()
37572//       // console.log("scrollTop", scrollTop);
37573//       // if (scrollTop <= heigh+10 && scrollTop >= heigh-10) {
37574//       //   console.log("TEST");
37575//       //   $(".modal-form_wrap").addClass("active");
37576//       // }
37577//       if (scrollTop >= heigh && modalShow()) {
37578//         modalActive();
37579//       }
37580//     });
37581//   }
37582//
37583//   const dataClick = $(".modal-form_wrap").attr("data-click");
37584//
37585//   // console.log("dataClick", dataClick);
37586//   function funClick(click = "#show-fast-popup") {
37587//     $("a[href=" + click + "]").on("click", function () {
37588//       modalActive();
37589//     });
37590//   }
37591//
37592//   if (dataClick === "") {
37593//     // console.log("dataClick if", dataClick);
37594//     funClick();
37595//   } else if (dataClick !== "" && dataClick !== undefined) {
37596//     // console.log("dataClick else if", dataClick);
37597//     funClick(dataClick);
37598//   }
37599//
37600//   const dataMouse = $(".modal-form_wrap").attr("data-mouse");
37601//   // console.log("dataMouse", dataMouse);
37602//   if (dataMouse === "" && modalShow()) {
37603//     $(window).on('mouseleave', function (e) {
37604//       if (e.relatedTarget == null && modalShow()) {
37605//         modalActive();
37606//       }
37607//     });
37608//   }
37609//
37610//   $(".modal-form__close").on("click", function () {
37611//     $(".modal-form_wrap").removeClass("active");
37612//   });
37613//   // показ модалки end
37614//
37615//   // отправка формы start
37616//   if ($(".modal-form_wrap")) {
37617//     // Отправка формы
37618//     $(".modal-form__form-send").on("click", function (e) {
37619//       e.preventDefault();
37620//
37621//       // получаем форму
37622//       var form = $(this).parent(".modal-form__form-form");
37623//       // console.log(form);
37624//
37625//       //укажем url в форме
37626//       var location = window.location.pathname;
37627//       // console.log(location)
37628//       form.find("input[name='url']").val(location);
37629//
37630//       // собираем потомков
37631//       var formChildren = form.find(".modal-form__form-input.required");
37632//       // console.log(formChildren);
37633//
37634//       // очистка поля от обводки ошибки заполнения
37635//       if (formChildren.parent(".modal-form__form-label").hasClass("err")) {
37636//         formChildren.parent(".modal-form__form-label").removeClass("err");
37637//         form.find("div.error").remove();
37638//         // formChildren.parent(".modal-form__form-label").siblings("div.error").remove();
37639//       }
37640//
37641//       // массив ошибок заполнение полей
37642//       var err = [];
37643//
37644//       // Проверка на заполнение полей
37645//       formChildren.each(function () {
37646//         if ($(this).hasClass("required")) {
37647//           var name = $(this).attr("name");
37648//           // console.log(name);
37649//           switch (name) {
37650//             case "name":
37651//               if ($(this).val() === "") {
37652//                 $(this).after('<div class="error">Заполните поле</div>');
37653//                 $(this).parent(".modal-form__form-label").addClass("err");
37654//                 err.push('false');
37655//               }
37656//               break;
37657//             case "phone":
37658//               if ($(this).val() === "") {
37659//                 $(this).after('<div class="error">Заполните поле</div>');
37660//                 $(this).parent(".modal-form__form-label").addClass("err");
37661//                 err.push('false');
37662//               } else if ($(this).val() != $(this).val().match(/\+7 \(\d\d\d\) \d\d\d-\d\d-\d\d/)) {
37663//                 $(this).after('<div class="error">Введите валидный номер</div>');
37664//                 $(this).parent(".modal-form__form-label").addClass("err");
37665//                 err.push('false');
37666//               }
37667//               break;
37668//           }
37669//           setTimeout(function () {
37670//             formChildren.parent(".modal-form__form-label").removeClass("err");
37671//             form.find("div.error").remove();
37672//           }, 5000);
37673//         }
37674//       });
37675//
37676//       // если ошибок нет отправим форму
37677//       if (!err.includes('false')) {
37678//         var formData = new FormData(form.get(0));
37679//         // for(let [name, value] of formData) {
37680//         //   console.log(`${name} = ${value}`);
37681//         // }
37682//
37683//         $.ajax({
37684//           url: "/ajax/custom_form/handler.php",
37685//           type: "POST",
37686//           contentType: false,
37687//           processData: false,
37688//           data: formData,
37689//           success: function (data) {
37690//             // console.log(data);
37691//             // form.html(data);
37692//             // var dt = data.replace(/\s/g, '');
37693//             form.after("<p id='successfully'>Форма успешно отправлена</p>");
37694//             form.hide();
37695//             $(".modal-form__form-privacy").hide();
37696//
37697//             gtag('event', 'Отправка формы', {'event_category': 'Отправка любой формы'});
37698//             ym(66908173, 'reachGoal', 'send_all_form');
37699//
37700//             setTimeout(function () {
37701//               $("#successfully").remove();
37702//               form[0].reset();
37703//               form.show();
37704//               $(".modal-form__form-privacy").show();
37705//             }, 5000);
37706//           },
37707//           error: function (xhr, str) {
37708//             alert('Возникла ошибка: ' + xhr.responseCode);
37709//           }
37710//         });
37711//       }
37712//
37713//     });
37714//   }
37715//   // отправка формы end
37716// });
37717//
37718
37719/* End */
37720;; /* /bitrix/templates/aspro_max/js/lazysizes.min.js?17164655377057*/
37721; /* /bitrix/templates/aspro_max/js/ls.unveilhooks.min.js?17164655371467*/
37722; /* /bitrix/templates/aspro_max/js/jquery.actual.min.js?17164655371251*/
37723; /* /bitrix/templates/aspro_max/vendor/js/jquery.bxslider.js?171646553766080*/
37724; /* /bitrix/templates/aspro_max/js/jqModal.js?171646553710972*/
37725; /* /bitrix/templates/aspro_max/vendor/js/bootstrap.js?171646553727908*/
37726; /* /bitrix/templates/aspro_max/vendor/js/jquery.appear.js?17164655373188*/
37727; /* /bitrix/templates/aspro_max/vendor/js/ripple.js?17164655374702*/
37728; /* /bitrix/templates/aspro_max/vendor/js/velocity/velocity.js?171646553744791*/
37729; /* /bitrix/templates/aspro_max/vendor/js/velocity/velocity.ui.js?171646553713257*/
37730; /* /bitrix/templates/aspro_max/vendor/js/jquery.menu-aim.js?171646553712787*/
37731; /* /bitrix/templates/aspro_max/js/browser.js?17164655371032*/
37732; /* /bitrix/templates/aspro_max/js/jquery.fancybox.js?1716465537160667*/
37733; /* /bitrix/templates/aspro_max/js/jquery.flexslider.js?171646553759389*/
37734; /* /bitrix/templates/aspro_max/js/jquery.uniform.min.js?17164655378308*/
37735;
37735 /* /bitrix/templates/aspro_max/vendor/js/carousel/owl/owl.carousel.js?171646553789992*/
37736; /* /bitrix/templates/aspro_max/vendor/js/moment.min.js?171646553734436*/
37737; /* /bitrix/templates/aspro_max/vendor/js/footable.js?1716465537275478*/
37738; /* /bitrix/templates/aspro_max/vendor/js/ResizeSensor.js?171646553711190*/
37739; /* /bitrix/templates/aspro_max/vendor/js/sticky-sidebar.js?171646553725483*/
37740; /* /bitrix/templates/aspro_max/js/jquery.validate.min.js?171646553722257*/
37741; /* /bitrix/templates/aspro_max/js/aspro_animate_open_fancy.js?17164655371916*/
37742; /* /bitrix/templates/aspro_max/js/jquery.inputmask.bundle.min.js?171646553770933*/
37743; /* /bitrix/templates/aspro_max/js/jquery.easing.1.3.js?17164655378095*/
37744; /* /bitrix/templates/aspro_max/js/equalize.min.js?1716465537588*/
37745; /* /bitrix/templates/aspro_max/js/jquery.alphanumeric.js?17164655371972*/
37746; /* /bitrix/templates/aspro_max/js/jquery.cookie.js?17164655373066*/
37747; /* /bitrix/templates/aspro_max/js/jquery.plugin.min.js?17164655373181*/
37748; /* /bitrix/templates/aspro_max/js/jquery.countdown.min.js?171646553713137*/
37749; /* /bitrix/templates/aspro_max/js/jquery.countdown-ru.js?17164655371885*/
37750; /* /bitrix/templates/aspro_max/js/jquery.ikSelect.js?171646553732030*/
37751; /* /bitrix/templates/aspro_max/js/jquery.mobile.custom.touch.min.js?17164655377784*/
37752; /* /bitrix/templates/aspro_max/js/jquery.dotdotdot.js?17164655375908*/
37753; /* /bitrix/templates/aspro_max/js/rating_likes.js?171646553710797*/
37754; /* /bitrix/templates/aspro_max/js/mobile.js?171646553721833*/
37755; /* /bitrix/templates/aspro_max/js/jquery.mCustomScrollbar.js?171646553794214*/
37756; /* /bitrix/templates/aspro_max/js/scrollTabs.js?171646553712996*/
37757; /* /bitrix/templates/aspro_max/js/main.js?1777873358290020*/
37758; /* /bitrix/templates/aspro_max/js/blocks/blocks.js?17164655377762*/
37759; /* /bitrix/components/bitrix/search.title/script.js?17164655439847*/
37760; /* /bitrix/templates/aspro_max/components/bitrix/search.title/mega_menu/script.js?171646553710313*/
37761; /* /bitrix/templates/aspro_max/components/bitrix/menu/menu_in_burger/script.js?1716465537208*/
37762; /* /bitrix/templates/aspro_max/components/bitrix/menu/top/script.js?1716465537191*/
37763; /* /bitrix/templates/aspro_max/components/bitrix/search.title/corp/script.
37763js?171646553710607*/
37764; /* /bitrix/components/aspro/marketing.popup.max/templates/.default/script.js?17164655411434*/
37765; /* /bitrix/templates/aspro_max/components/bitrix/search.title/fixed/script.js?171646553710264*/
37766; /* /bitrix/templates/aspro_max/js/set_referrer.js?1716465537420*/
37767; /* /bitrix/templates/aspro_max/js/fast_panel.js?1716465537471*/
37768; /* /bitrix/templates/aspro_max/js/custom.js?171646553713185*/

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.