PageSourceSearch

https://lkg.ru/bitrix/cache/js/s1/aspro_max/template_be3c883543552…3d19d4aeab513ba407b_v1.js?17778733591578276

js lkg.ru collected 2026-10-08 03:28:06 UTC 1,578,276 bytes, 38,884 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:62:"/bitrix/templates/aspro_max/js/video_banner.js?171646553732656";s:6:"source";s:46:"/bitrix/templates/aspro_max/js/video_banner.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
23487var players = {};
23488
23489function pauseMainBanner(){
23490	$('.top_slider_wrapp .flexslider').flexslider('pause');
23491}
23492
23493function playMainBanner(){
23494	$('.top_slider_wrapp .flexslider').flexslider('play');
23495}
23496
23497function startMainBannerSlideVideo($slide){
23498	var slideActiveIndex = $slide.attr('data-slide_index')
23499	var $slides = $slide.closest('.slides').find('.box[data-slide_index="'+ slideActiveIndex +'"]') // current slide & cloned
23500	var videoSource = $slide.attr('data-video_source')
23501	if(videoSource){
23502		$slides.addClass('loading')
23503		pauseMainBanner()
23504
23505		var $slider = $slide.closest('.flexslider')
23506		$slider.addClass('video_visible')
23507		var slidesIndexesWithVideo = $slider.data('slidesIndexesWithVideo')
23508		if(typeof slidesIndexesWithVideo === 'undefined'){
23509			slidesIndexesWithVideo = [];
23510		}
23511		slidesIndexesWithVideo.push(slideActiveIndex)
23512		$slider.data('slidesIndexesWithVideo', slidesIndexesWithVideo)
23513
23514		var videoPlayerSrc = $slide.attr('data-video_src')
23515		var videoSoundDisabled = $slide.attr('data-video_disable_sound')
23516		var bVideoSoundDisabled = videoSoundDisabled == 1
23517		var videoLoop = $slide.attr('data-video_loop')
23518		var bVideoLoop = videoLoop == 1
23519		var videoCover = $slide.attr('data-video_cover')
23520		var bVideoCover = videoCover == 1
23521		var videoUnderText = $slide.attr('data-video_under_text')
23522		var bVideoUnderText = videoUnderText == 1
23523		var videoPlayer = $slide.attr('data-video_player')
23524		var bVideoPlayerYoutube = videoPlayer === 'YOUTUBE'
23525		var bVideoPlayerVimeo = videoPlayer === 'VIMEO'
23526		var bVideoPlayerRutube = videoPlayer === 'RUTUBE'
23527		var bVideoPlayerHtml5 = videoPlayer === 'HTML5'
23528		var videoWidth = bVideoPlayerHtml5 ? false : $slide.attr('data-video_width')
23529		var videoHeight = bVideoPlayerHtml5 ? false : $slide.attr('data-video_height')
23530
23531		if(videoPlayerSrc && !$slide.find('.video').length){
23532			var InitPlayer = function(){
23533				$slides.each(function(i, node){
23534					var $_slide = $(node);
23535					var videoID = getRandomInt(100, 1000);
23536					var bClone = $_slide.hasClass('clone'),
23537						tmp_class = $_slide.attr('id');
23538					if(!$_slide.find('.video.'+tmp_class).length)
23539					{
23540						if(bVideoPlayerYoutube){
23541							$_slide.prepend('<div class="wrapper_video"><iframe id="player_' + videoID + '" class="video ' + tmp_class + (bVideoCover ? ' cover' : '') + '" src="'+ videoPlayerSrc +'" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen allow="accelerometer; autoplay; encrypted-media; gyroscope; fullscreen;"' + ((videoWidth && videoHeight) ? ' data-video_proportion="' + (videoWidth / videoHeight) + '"' : '') + '></iframe></div>');
23542						}
23543						else if(bVideoPlayerVimeo){
23544							$_slide.prepend('<div class="wrapper_video"><iframe id="player_' + videoID + '" class="video ' + tmp_class + (bVideoCover ? ' cover' : '') + '" src="'+ videoPlayerSrc +'" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen allow="accelerometer; autoplay; encrypted-media; gyroscope; fullscreen;"' + ((videoWidth && videoHeight) ? ' data-video_proportion="' + (videoWidth / videoHeight) + '"' : '') + '></iframe></div>');
23545						}
23546						else if(bVideoPlayerRutube){
23547							videoPlayerSrc = videoPlayerSrc + '&playerid=' + videoID;
23548							$_slide.prepend('<div class="wrapper_video"><iframe id="player_' + videoID + '" class="video ' + tmp_class + (bVideoCover ? ' cover' : '') + '" src="'+ videoPlayerSrc +'" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen allow="autoplay; encrypted-media; gyroscope; fullscreen;"' + ((videoWidth && videoHeight) ? ' data-video_proportion="' + (videoWidth / videoHeight) + '"' : '') + '></iframe></div>');
23549						}
23550						else if(bVideoPlayerHtml5){
23551							$_slide.prepend('<div class="wrapper_video"><video autobuffer playsinline webkit-playsinline autoplay id="player_' + videoID + '" class="video ' + tmp_class + (bVideoCover ? ' cover' : '') + '"' + (bVideoLoop ? ' loop ' : '') + (bVideoSoundDisabled || bClone ? ' muted ' : '') + '><source src="'+ videoPlayerSrc +'" type=\'video/mp4; codecs="avc1.42E01E, mp4a.40.2"\' /><p class="vjs-no-js">To view this video please enable JavaScript, and consider upgrading to a web browser that supports HTML5 video</p></iframe></div>');
23552						}
23553					}
23554
23555					if(typeof(players) !== 'undefined' && players){
23556						players[videoID] = {
23557							id: 'player_' + videoID,
23558							mute: bVideoSoundDisabled || bClone,
23559							loop: bVideoLoop,
23560							cover: bVideoCover,
23561							videoPlayer: videoPlayer,
23562							slideIndex: slideActiveIndex,
23563							clone: bClone,
23564							playing: false,
23565							videoWidth: videoWidth,
23566							videoHeight: videoHeight,
23567							videoProportion: ((videoWidth && videoHeight) ? videoWidth / videoHeight : false)
23568						};
23569
23570						if(bVideoPlayerYoutube){
23571							window[players[videoID].id] = new YT.Player(
23572								players[videoID].id, {
23573									events: {
23574										'onReady': onYoutubePlayerReady,
23575										'onStateChange': onYoutubePlayerStateChange
23576									}
23577								}
23578							);
23579						}
23580						else if(bVideoPlayerVimeo){
23581						    window[players[videoID].id] = new Vimeo.Player(document.getElementById(players[videoID].id), {autopause: false, byline: false, loop: false, title: false});
23582						    window[players[videoID].id].on('loaded', onVimeoPlayerReady)
23583						    window[players[videoID].id].on('play', onVimeoPlayerStateChange)
23584						    window[players[videoID].id].on('pause', onVimeoPlayerStateChange)
23585						    window[players[videoID].id].on('ended', onVimeoPlayerStateChange)
23586						}
23587						else if(bVideoPlayerRutube){
23588							document.getElementById(players[videoID].id).onload = function(e){
23589								var videoID = this.id.replace('player_', '')
23590								players[videoID].contentWindow = this.contentWindow
23591								onRutubePlayerReady(videoID)
23592							}
23593						}
23594						else if(bVideoPlayerHtml5){
23595							document.getElementById(players[videoID].id).addEventListener('loadeddata', onHtml5PlayerReady)
23596							document.getElementById(players[videoID].id).addEventListener('play', onHtml5PlayerStateChange)
23597							document.getElementById(players[videoID].id).addEventListener('pause', onHtml5PlayerStateChange)
23598							document.getElementById(players[videoID].id).addEventListener('ended', onHtml5PlayerStateChange)
23599						}
23600					}
23601				});
23602			}
23603
23604			if(!bVideoPlayerHtml5){
23605				var obPlayerVariable = ''
23606				var fnPlayerVariable = ''
23607				if(typeof window['YoutubePlayerScriptLoaded'] === 'undefined'){
23608					window['YoutubePlayerScriptLoaded'] = false
23609				}
23610				if(typeof window['VimeoPlayerScriptLoaded'] === 'undefined'){
23611					window['VimeoPlayerScriptLoaded'] = false
23612				}
23613				if(typeof window['RutubePlayerListnersAdded'] === 'undefined'){
23614					window['RutubePlayerListnersAdded'] = false
23615				}
23616
23617				// load script
23618				if(bVideoPlayerYoutube){
23619					obPlayerVariable = 'YT'
23620					fnPlayerVariable = 'Player'
23621					if(!window['YoutubePlayerScriptLoaded']){
23622						var script = document.createElement('script');
23623						script.src = "https://www.youtube.com/iframe_api";
23624						var firstScriptTag = document.getElementsByTagName('script')[0];
23625						firstScriptTag.parentNode.insertBefore(script, firstScriptTag);
23626						window['YoutubePlayerScriptLoaded'] = true;
23627					}
23628				}
23629				else if(bVideoPlayerVimeo){
23630					obPlayerVariable = 'Vimeo'
23631					if(!window['VimeoPlayerScriptLoaded']){
23632						var script = document.createElement('script');
23633						script.src = 'https://player.vimeo.com/api/player.js';
23634						(document.head || document.documentElement).appendChild(script);
23635						window['VimeoPlayerScriptLoaded'] = true
23636					}
23637				}
23638				else if(bVideoPlayerRutube){
23639					if(!window['RutubePlayerListnersAdded']){
23640						window.addEventListener('message', function(e){
23641							if(e.origin.indexOf('rutube.ru') !== -1){
23642							    var message = JSON.parse(e.data)
23643							    if(typeof message === 'object' && message){
23644							    	if(typeof message.type !== 'undefined' && message.type){
23645							    		var videoID = false
23646
23647							    		for(var j in players){
23648									    	if(typeof players[j].contentWindow !== 'undefined'){
23649									    		if(players[j].contentWindow == e.source){
23650									    			videoID = j
23651									    			break
23652									    		}
23653									    	}
23654									    }
23655
23656									    if(videoID){
23657										    switch (message.type) {
23658										        case 'player:changeState':
23659										            onRutubePlayerStateChange(videoID, message.data.state)
23660										            break
23661										        case 'player:currentTime':
23662										            onRutubePlayerCurrentTime(videoID, message.data.time)
23663										            break
23664										    }
23665										}
23666									}
23667							    }
23668							}
23669						});
23670					}
23671				}
23672
23673				if(!obPlayerVariable.length){
23674					InitPlayer()
23675				}
23676				else{
23677					// wait player class
23678					if(typeof window[obPlayerVariable] === 'object'){
23679						if(!fnPlayerVariable.length || (fnPlayerVariable.length && typeof window[obPlayerVariable][fnPlayerVariable] === 'function')){
23680
23681							InitPlayer()
23682						}
23683					}
23684					else{
23685						var waitPlayerInterval = setInterval(function(){
23686							if(typeof window[obPlayerVariable] === 'object'){
23687								if(!fnPlayerVariable.length || (fnPlayerVariable.length && typeof window[obPlayerVariable][fnPlayerVariable] === 'function')){
23688
23689									clearInterval(waitPlayerInterval)
23690
23691									InitPlayer()
23692								}
23693							}
23694						}, 50)
23695					}
23696				}
23697			}
23698			else{
23699				InitPlayer()
23700			}
23701		}
23702		else
23703		{
23704			// pause play video
23705			if(typeof(players) !== 'undefined' && players){
23706				for(var j in players){
23707					if(/*players[j].playing &&*/ !players[j].clone/* && (players[j].slideIndex != $curSlideIndex)*/){
23708						if((typeof window[players[j].id] == 'object')){
23709							if(players[j].playing)
23710							{
23711								if(players[j].videoPlayer === 'YOUTUBE'){
23712									window[players[j].id].pauseVideo()
23713								}
23714								else if(players[j].videoPlayer === 'VIMEO'){
23715									window[players[j].id].pause()
23716								}
23717								else if(players[j].videoPlayer === 'RUTUBE'){
23718									document.getElementById(players[j].id).contentWindow.postMessage(JSON.stringify({
23719									    type: 'player:pause',
23720									    data: {}
23721									}), '*')
23722								}
23723								else if(players[j].videoPlayer === 'HTML5'){
23724									document.getElementById(players[j].id).pause()
23725								}
23726							}
23727							else if(players[j].slideIndex == slideActiveIndex)
23728							{
23729								if(players[j].videoPlayer === 'YOUTUBE'){
23730									window[players[j].id].playVideo()
23731								}
23732								else if(players[j].videoPlayer === 'VIMEO'){
23733									window[players[j].id].play()
23734								}
23735								else if(players[j].videoPlayer === 'RUTUBE'){
23736									document.getElementById(players[j].id).contentWindow.postMessage(JSON.stringify({
23737									    type: 'player:play',
23738									    data: {}
23739									}), '*')
23740								}
23741								else if(players[j].videoPlayer === 'HTML5'){
23742									document.getElementById(players[j].id).play()
23743								}
23744							}
23745						}
23746					}
23747				}
23748			}
23749		}
23750	}
23751}
23752
23753var CoverPlayer = function(){
23754	$('.top_slider_wrapp .video.cover').each(function(){
23755
23756		var view2 = $(this).closest('.top_slider_wrapp.view_2');
23757		if(view2.length && window.matchMedia('(max-width:767px)').matches) {
23758			var $slide = view2.find('table');
23759		} else {
23760			var $slide = $(this).closest('.box');
23761		}
23762
23763		var slideHeight = $slide.height();
23764		var slideWidth = $slide.width();
23765		var videoProportion = $(this).attr('data-video_proportion');
23766		if(videoProportion === undefined){
23767			videoProportion = 16 / 9;
23768		}
23769
23770		// set video width = 100% of slide width
23771		var videoWidth = slideWidth;
23772		// calculate video height proportional
23773		var videoHeight = slideWidth / videoProportion;
23774		// video minimal  height = 100% slide height
23775		if(videoHeight < slideHeight){
23776			// increase video width proportional
23777			videoWidth = slideHeight * videoProportion;
23778			videoHeight = slideHeight;
23779		}
23780
23781		$(this).width(videoWidth).height(videoHeight).css({
23782			'margin-top' : '-' + (videoHeight - slideHeight) / 2 + 'px',
23783			'margin-left' : '-' + (videoWidth - slideWidth) / 2 + 'px'
23784		});
23785	});
23786}
23787
23788// var CoverPlayerHtml = function(){
23789// 	$('.top_slider_wrapp li[data-video_player="HTML5"] .video.cover').each(function(){
23790// 		var view2 = $(this).closest('.top_slider_wrapp.view_2');
23791// 		if(view2.length && window.matchMedia('(max-width:767px)').matches) {
23792// 			var $slide = view2.find('table');
23793// 		} else {
23794// 			var $slide = $(this).closest('.box');
23795// 		}
23796// 		var slideHeight = $slide.height();
23797// 		var slideWidth = $slide.width();
23798// 		var videoHeight = $(this)[0].videoHeight; // original video size
23799// 		var videoWidth = $(this)[0].videoWidth; // original video size
23800// 		var videoProportion = videoWidth / videoHeight;
23801
23802// 		videoWidth = slideWidth;
23803// 		videoHeight = slideWidth / videoProportion;
23804
23805// 		if(videoHeight < slideHeight){
23806// 			videoWidth = slideHeight * videoProportion;
23807// 			videoHeight = slideHeight;
23808// 		}
23809
23810// 		$(this).width(videoWidth).height(videoHeight).css({
23811// 			'margin-top' : '-' + (videoHeight - slideHeight) / 2 + 'px',
23812// 			'margin-left' : '-' + (videoWidth - slideWidth) / 2 + 'px',
23813// 		});
23814// 	});
23815
23816// 	setTimeout(function(){
23817// 		$('.top_slider_wrapp .flex-active-slide .video.cover').css('visibility', 'visible');
23818// 	}, 1300);
23819// }
23820
23821// var CoverPlayer = function(){
23822// 	$('.top_slider_wrapp li:not([data-video_player="HTML5"]) .video.cover').each(function(){
23823// 		var view2 = $(this).closest('.top_slider_wrapp.view_2');
23824// 		if(view2.length && window.matchMedia('(max-width:767px)').matches) {
23825// 			var $slide = view2.find('table');
23826// 		} else {
23827// 			var $slide = $(this).closest('.box');
23828// 		}
23829// 		var $slide = $(this).closest('.box');
23830// 		var slideHeight = $slide.height();
23831// 		var slideWidth = $slide.width();
23832
23833// 		var videoHeight = $(this).attr('data-video_height'); // original video size
23834// 		var videoWidth = $(this).attr('data-video_width'); // original video size
23835
23836// 		if(videoHeight !== undefined && videoWidth !== undefined){
23837// 			var videoProportion = videoWidth / videoHeight;
23838
23839// 			videoWidth = slideWidth;
23840// 			videoHeight = slideWidth / videoProportion;
23841
23842// 			if(videoHeight < slideHeight){
23843// 				videoWidth = slideHeight * videoProportion;
23844// 				videoHeight = slideHeight;
23845// 			}
23846
23847// 			$(this).width(videoWidth).height(videoHeight).css({
23848// 				'margin-top' : '-' + (videoHeight - slideHeight) / 2 + 'px',
23849// 				'margin-left' : '-' + (videoWidth - slideWidth) / 2 + 'px',
23850// 			});
23851// 		}
23852// 		else{
23853// 			var windowWidth = $(window).width()
23854// 			var height = windowWidth * 9 / 16
23855// 			$(this).css({'height': height + 'px', 'margin-top': (height > slideHeight ? (slideHeight - height) / 2 : 0) + 'px'})
23856// 		}
23857// 	});
23858// }
23859
23860function onYoutubePlayerReady(e) {
23861	var videoID = e.target.a.id.replace('player_', '')
23862	if(videoID){
23863		var mute = players[videoID].mute
23864		var cover = players[videoID].cover
23865    	var clone = players[videoID].clone
23866    	var $slide = $('#player_' + videoID).closest('.box')
23867
23868    	// mute sound
23869		if(mute || clone){
23870			window[players[videoID].id].mute()
23871		}
23872
23873    	// cover video
23874		if(cover){
23875			// get video`s original size
23876			if(!players[videoID].videoProportion){
23877				var embedHtml = e.target.getVideoEmbedCode();
23878				if(embedHtml.length){
23879					var match = embedHtml.match(/width="(\d*)"[^>]*height="(\d*)"/);
23880					if(match !== null){
23881						var videoWidth = match[1];
23882						var videoHeight = match[2];
23883
23884						players[videoID].videoWidth = videoWidth;
23885						players[videoID].videoHeight = videoHeight;
23886						players[videoID].videoProportion = videoWidth / videoHeight;
23887
23888						$slide.find('.video').attr('data-video_proportion', players[videoID].videoProportion);
23889					}
23890				}
23891			}
23892
23893	    	CoverPlayer()
23894	    }
23895
23896    	// not start clone video playing
23897    	if(clone){
23898    		setTimeout(function(){
23899				e.target.pauseVideo()
23900    		}, 100)
23901    	}
23902    	else{
23903		    // stop slider
23904			pauseMainBanner()
23905			e.target.playVideo();
23906
23907		    // e.target.playVideo();
23908		    // e.target.playVideo();
23909    	}
23910
23911    	// update slide class
23912		$slide.addClass('started')
23913		// $slide.removeClass('loading')
23914    }
23915}
23916
23917function onYoutubePlayerStateChange(e){
23918	var videoID = e.target.a.id.replace('player_', '')
23919    if(videoID){
23920    	var clone = players[videoID].clone
23921		var loop = players[videoID].loop
23922    	var slideIndex = players[videoID].slideIndex
23923    	if(!clone){
23924			if(e.data === YT.PlayerState.PLAYING){
23925				players[videoID].playing = true
23926
23927				$('#player_'+videoID).closest('.box').find('.wrapper_inner').addClass('loading');
23928				$('#player_'+videoID).closest('.box').find('.wrapper_inner .btn-video').addClass('loading');
23929
23930				// stop slider
23931				pauseMainBanner()
23932
23933				e.target.playVideo()
23934			}
23935			else if(e.data === YT.PlayerState.PAUSED){
23936		    	players[videoID].playing = false
23937
23938		    	// sync time in cloned players & pause
23939	    		var time = Math.floor(window[players[videoID].id].getCurrentTime() * 10) / 10
23940
23941				$('#player_'+videoID).closest('.box').find('.wrapper_inner').removeClass('loading');
23942				$('#player_'+videoID).closest('.box').find('.wrapper_inner .btn-video').removeClass('loading');
23943
23944				window[players[videoID].id].seekTo(time, true)
23945				for(var j in players){
23946					if(players[j].slideIndex == slideIndex && players[j].clone){
23947
23948						if('getCurrentTime' in window[players[j].id])
23949						{
23950							window[players[j].id].pauseVideo()
23951							window[players[j].id].seekTo(time, true)
23952						}
23953					}
23954				}
23955			}
23956			else if(e.data === YT.PlayerState.ENDED){
23957				players[videoID].playing = false
23958		    	if(loop){
23959		    		e.target.playVideo()
23960		    	}
23961		    	else{
23962		    		// play slider
23963					playMainBanner()
23964		    	}
23965			}
23966			else if(e.data === YT.PlayerState.UNSTARTED){
23967				players[videoID].playing = false
23968				$('#player_'+videoID).closest('.box').find('.wrapper_inner .btn-video').removeClass('loading');
23969				window[players[videoID].id].mute()
23970				e.target.playVideo()
23971			}
23972		}
23973	}
23974}
23975
23976function onVimeoPlayerReady(e){
23977	var videoID = this.element.id.replace('player_', '')
23978	if(videoID){
23979		var mute = players[videoID].mute
23980		var cover = players[videoID].cover
23981    	var clone = players[videoID].clone
23982		var $slide = $('#player_' + videoID).closest('.box')
23983
23984    	// mute sound
23985		if(mute || clone){
23986			window[players[videoID].id].setVolume(0)
23987		}
23988
23989    	// cover video
23990		if(cover){
23991			// get video`s original size
23992			if(!players[videoID].videoProportion){
23993				var widthPromise = window[players[videoID].id].getVideoWidth();
23994				var heightPromise = window[players[videoID].id].getVideoHeight();
23995				widthPromise.then(
23996					function(value) {
23997						var videoWidth = value;
23998
23999						heightPromise.then(
24000							function(value) {
24001								var videoHeight = value;
24002
24003								players[videoID].videoWidth = videoWidth;
24004								players[videoID].videoHeight = videoHeight;
24005								players[videoID].videoProportion = videoWidth / videoHeight;
24006
24007								$slide.find('.video').attr('data-video_proportion', players[videoID].videoProportion);
24008
24009								CoverPlayer();
24010							}
24011						);
24012					}
24013				);
24014			}
24015	    }
24016
24017    	// not start clone video playing
24018    	if(clone){
24019    		setTimeout(function(){
24020				window[players[videoID].id].pause()
24021    		}, 100)
24022    	}
24023    	else{
24024		    // stop slider
24025			pauseMainBanner()
24026
24027		    // start video
24028		    var promise = window[players[videoID].id].play();
24029			if(typeof promise !== 'undefined'){
24030				promise.catch(
24031					function(){
24032						setTimeout(function(){
24033							window[players[videoID].id].setVolume(0)
24034							window[players[videoID].id].play()
24035						}, 100);
24036					}
24037				);
24038			}
24039    	}
24040
24041    	// update slide class
24042		$slide.addClass('started')
24043		// $slide.removeClass('loading')
24044    }
24045}
24046
24047function onVimeoPlayerStateChange(e){
24048	var videoID = this.element.id.replace('player_', '')
24049	if(videoID){
24050		var cover = players[videoID].cover
24051    	var clone = players[videoID].clone
24052		var loop = players[videoID].loop
24053    	var slideIndex = players[videoID].slideIndex
24054
24055    	if(!clone){
24056    		window[players[videoID].id].getPaused().then(function(paused){
24057    			if(paused){
24058			    	players[videoID].playing = false
24059
24060			    	$('#player_'+videoID).closest('.box').find('.wrapper_inner').removeClass('loading');
24061					$('#player_'+videoID).closest('.box').find('.wrapper_inner .btn-video').removeClass('loading');
24062
24063			    	// sync time in cloned players & pause
24064			    	window[players[videoID].id].getCurrentTime().then(function(seconds){
24065			    		var time = Math.floor(seconds * 10) / 10
24066			    		window[players[videoID].id].setCurrentTime(time).then(function(seconds){
24067							for(var j in players){
24068								if(players[j].slideIndex == slideIndex && players[j].clone){
24069									window[players[j].id].pause()
24070									window[players[j].id].setCurrentTime(time).then(function(seconds){})
24071								}
24072							}
24073			    		})
24074			    	})
24075    			}
24076    			else{
24077    				$('#player_'+videoID).closest('.box').find('.wrapper_inner').addClass('loading');
24078					$('#player_'+videoID).closest('.box').find('.wrapper_inner .btn-video').addClass('loading');
24079		    		window[players[videoID].id].getEnded().then(function(ended){
24080		    			if(ended){
24081							players[videoID].playing = false
24082					    	if(loop){
24083					    		window[players[videoID].id].play()
24084					    	}
24085					    	else{
24086					    		// play slider
24087								playMainBanner()
24088					    	}
24089		    			}
24090		    			else{
24091		    				players[videoID].playing = true
24092
24093
24094		    				// stop slider
24095							pauseMainBanner()
24096		    			}
24097		    		})
24098    			}
24099    		})
24100		}
24101	}
24102}
24103
24104function onRutubePlayerReady(videoID){
24105	if(videoID){
24106		var mute = players[videoID].mute
24107		var cover = players[videoID].cover
24108    	var clone = players[videoID].clone
24109    	var player = document.getElementById(players[videoID].id)
24110    	var $slide = $('#player_' + videoID).closest('.box')
24111
24112    	// mute sound
24113		if(mute || clone){
24114			player.contentWindow.postMessage(JSON.stringify({
24115			    type: 'player:mute',
24116			    data: {}
24117			}), '*')
24118		}
24119
24120    	// cover video
24121		if(cover){
24122	    	CoverPlayer()
24123	    }
24124
24125    	// not start clone video playing
24126    	if(clone){
24127    		setTimeout(function(){
24128				player.contentWindow.postMessage(JSON.stringify({
24129				    type: 'player:pause',
24130				    data: {}
24131				}), '*')
24132    		}, 100)
24133    	}
24134    	else{
24135		    // stop slider
24136			pauseMainBanner()
24137
24138		    player.contentWindow.postMessage(JSON.stringify({
24139			    type: 'player:play',
24140			    data: {}
24141			}), '*')
24142    	}
24143
24144    	// update slide class
24145		$slide.addClass('started')
24146		// $slide.removeClass('loading')
24147    }
24148}
24149
24150function onRutubePlayerCurrentTime(videoID, time){
24151	if(videoID){
24152		players[videoID].time = time
24153	}
24154}
24155
24156function onRutubePlayerStateChange(videoID, state){
24157	if(videoID){
24158    	var clone = players[videoID].clone
24159		var loop = players[videoID].loop
24160    	var slideIndex = players[videoID].slideIndex
24161    	var player = document.getElementById(players[videoID].id)
24162
24163    	if(!clone){
24164			if(state === 'playing'){
24165				$('#'+videoID).closest('.box').find('.wrapper_inner').addClass('loading');
24166				$('#'+videoID).closest('.box').find('.wrapper_inner .btn-video').addClass('loading');
24167
24168				players[videoID].playing = true
24169
24170				// stop slider
24171				pauseMainBanner()
24172			}
24173			else if(state === 'paused'){
24174				$('#'+videoID).closest('.box').find('.wrapper_inner').removeClass('loading');
24175				$('#'+videoID).closest('.box').find('.wrapper_inner .btn-video').removeClass('loading');
24176
24177		    	players[videoID].playing = false
24178
24179		    	// sync time in cloned players & pause
24180	    		var time = Math.floor(players[videoID].time * 10) / 10
24181				player.contentWindow.postMessage(JSON.stringify({
24182				    type: 'player:setCurrentTime',
24183				    data: {time: time}
24184				}), '*')
24185				for(var j in players){
24186					if(players[j].slideIndex == slideIndex && players[j].clone){
24187						document.getElementById(players[j].id).contentWindow.postMessage(JSON.stringify({
24188						    type: 'player:pause',
24189						    data: {}
24190						}), '*')
24191						document.getElementById(players[j].id).contentWindow.postMessage(JSON.stringify({
24192						    type: 'player:setCurrentTime',
24193						    data: {time: time}
24194						}), '*')
24195					}
24196				}
24197			}
24198			else if(state === 'stopped'){
24199				$('#'+videoID).closest('.box').find('.wrapper_inner').removeClass('loading');
24200				$('#'+videoID).closest('.box').find('.wrapper_inner .btn-video').removeClass('loading');
24201
24202				players[videoID].playing = false
24203		    	if(loop){
24204		    		player.contentWindow.postMessage(JSON.stringify({
24205					    type: 'player:play',
24206					    data: {}
24207					}), '*')
24208		    	}
24209		    	else{
24210		    		// play slider
24211					playMainBanner()
24212		    	}
24213			}
24214		}
24215	}
24216}
24217
24218function onHtml5PlayerReady(e){
24219	var videoID = e.target.id.replace('player_', '')
24220	if(videoID){
24221		var mute = players[videoID].mute
24222		var cover = players[videoID].cover
24223    	var clone = players[videoID].clone
24224    	var $slide = $('#player_' + videoID).closest('.box')
24225
24226    	// mute sound
24227		if(mute || clone){
24228			$('#' + players[videoID].id).prop('muted', true);
24229		}
24230
24231    	// cover video
24232		if(cover){
24233	    	// get video`s original size
24234			if(!players[videoID].videoProportion){
24235				var videoWidth = $slide.find('.video')[0].videoWidth;
24236				var videoHeight = $slide.find('.video')[0].videoHeight;
24237
24238				players[videoID].videoWidth = videoWidth;
24239				players[videoID].videoHeight = videoHeight;
24240				players[videoID].videoProportion = videoWidth / videoHeight;
24241
24242				$slide.find('.video').attr('data-video_proportion', players[videoID].videoProportion);
24243			}
24244
24245			CoverPlayer();
24246	    }
24247
24248    	// not start clone video playing
24249    	if(clone){
24250    		e.target.pause()
24251    	}
24252    	else{
24253		    // stop slider
24254			pauseMainBanner()
24255
24256			var promise = e.target.play();
24257		    if(typeof promise !== 'undefined'){
24258				promise.catch(
24259					function(){
24260						setTimeout(function(){
24261							$('#' + players[videoID].id).prop('muted', true);
24262							e.target.play();
24263						}, 100);
24264					}
24265				);
24266			}
24267    	}
24268
24269    	// update slide class
24270		$slide.addClass('started')
24271		// $slide.removeClass('loading')
24272    }
24273}
24274
24275function onHtml5PlayerStateChange(e){
24276	var videoID = e.target.id.replace('player_', '')
24277	if(videoID){
24278    	var cover = players[videoID].cover
24279    	var clone = players[videoID].clone
24280		var loop = players[videoID].loop
24281    	var slideIndex = players[videoID].slideIndex
24282
24283    	if(!clone){
24284			if(e.target.paused){
24285		    	players[videoID].playing = false
24286
24287		    	$('#player_'+videoID).closest('.box').find('.wrapper_inner').removeClass('loading');
24288				$('#player_'+videoID).closest('.box').find('.wrapper_inner .btn-video').removeClass('loading');
24289
24290		    	// sync time in cloned players & pause
24291	    		var time = Math.floor(e.target.currentTime * 10) / 10
24292				e.target.currentTime = time
24293				for(var j in players){
24294					if(players[j].slideIndex == slideIndex && players[j].clone){
24295						document.getElementById(players[j].id).pause()
24296						document.getElementById(players[j].id).currentTime = time
24297					}
24298				}
24299			}
24300			else if(e.target.ended){
24301				players[videoID].playing = false
24302		    	if(loop){
24303		    		$('#player_'+videoID).closest('.box').find('.wrapper_inner').addClass('loading');
24304					$('#player_'+videoID).closest('.box').find('.wrapper_inner .btn-video').addClass('loading');
24305
24306		    		e.target.play()
24307		    	}
24308		    	else{
24309		    		// play slider
24310					playMainBanner()
24311		    	}
24312			}
24313			else{
24314				players[videoID].playing = true
24315
24316				$('#player_'+videoID).closest('.box').find('.wrapper_inner').addClass('loading');
24317				$('#player_'+videoID).closest('.box').find('.wrapper_inner .btn-video').addClass('loading');
24318				// stop slider
24319				pauseMainBanner()
24320			}
24321		}
24322	}
24323}
24324
24325waitYTPlayer = function(delay, callback){
24326	if((typeof YT !== "undefined") && YT && YT.Player)
24327	{
24328		if(typeof callback == 'function')
24329			callback();
24330	}
24331	else
24332	{
24333		setTimeout(function(){
24334			waitYTPlayer(delay, callback);
24335		}, delay);
24336	}
24337}
24338
24339// click on HTML5 video
24340$(document).on('click', 'video.video', function(e){
24341	var videoID = e.target.id.replace('player_', '')
24342    if(videoID){
24343    	if(players[videoID].playing){
24344			e.target.pause()
24345    	}
24346    	else{
24347    		e.target.play()
24348    	}
24349    }
24350})
24351
24352// START VIDEO BUTTON
24353$(document).on('click', '.top_slider_wrapp .box .btn-video', function(e){
24354	e.stopPropagation();
24355	if(!$(this).hasClass('loading'))
24356	{
24357		$(this).addClass('loading');
24358		$(this).closest('.wrapper_inner').addClass('loading');
24359	}
24360	else
24361	{
24362		$(this).removeClass('loading');
24363		$(this).closest('.wrapper_inner').removeClass('loading');
24364	}
24365
24366	startMainBannerSlideVideo($(this).closest('.box'));
24367});
24368
24369// START VIDEO BY BANNER OR GOTO LINK
24370$(document).on('click', '.top_slider_wrapp .box .wrapper_inner', function(e){
24371	var wvideo = $(this).closest('.box').hasClass('wvideo');
24372	var wurl = $(this).closest('.box').hasClass('wurl');
24373
24374	if($(e.target).hasClass('btn')){
24375		if(wvideo){
24376			if($(e.target).hasClass('btn-video')){
24377				e.stopPropagation();
24378				$(this).find('.btn-video').trigger('click');
24379			}
24380		}
24381	}
24382	else{
24383		if(wurl){
24384			var href = $(this).closest('.box').find('.target').attr('href');
24385			if(href.length){
24386				var target = $(this).closest('.box').find('.target').attr('target');
24387				if(typeof target === 'undefined' || target === '_self'){
24388					location.href = href;
24389				}
24390				else{
24391					window.open(href);
24392				}
24393			}
24394		}
24395		else{
24396			if(wvideo){
24397				e.stopPropagation();
24398				$(this).find('.btn-video').trigger('click');
24399			}
24400		}
24401	}
24402})
24403
24404getRandomInt = function(min, max){
24405	return Math.floor(Math.random() * (max - min)) + min;
24406}
24407
24408var ignoreResize = [];
24409
24410BX.addCustomEvent('onWindowResize', function(eventdata) {
24411	try{
24412		CoverPlayer();
24413	}
24414	catch(e){}
24415	finally{
24416		ignoreResize.pop();
24417	}
24418});
24419
24420BX.addCustomEvent('onSlideEnd', function(eventdata) {
24421	try{
24422		ignoreResize.push(true);
24423		if(eventdata){
24424			var slider = eventdata.slider;
24425			if(slider){
24426				setTimeout(function(){
24427					$('.banners-big.front .btn-video, .banners-big.front .box').removeClass('loading');
24428				}, 300);
24429			}
24430		}
24431	}
24432	catch(e){}
24433	finally{
24434		ignoreResize.pop();
24435	}
24436});
24437
24438BX.addCustomEvent('onSlide', function(eventdata) {
24439	try{
24440		ignoreResize.push(true);
24441		if(eventdata){
24442			var slider = eventdata.slider;
24443			if(slider){
24444				var $curSlide = slider.find('.box.flex-active-slide');
24445				var $curSlideIndex = $curSlide.attr('data-slide_index');
24446
24447				if(typeof($curSlideIndex) !== 'undefined' && $curSlideIndex.length){
24448					var slidesIndexesWithVideo = slider.data('slidesIndexesWithVideo')
24449					if(typeof slidesIndexesWithVideo === 'undefined'){
24450						slidesIndexesWithVideo = [];
24451					}
24452
24453					var bVideoVisible = slidesIndexesWithVideo.indexOf($curSlideIndex) != -1;
24454					if(bVideoVisible){
24455						slider.addClass('video_visible');
24456					}
24457					else{
24458						slider.removeClass('video_visible');
24459					}
24460
24461					setTimeout(function(){
24462						CoverPlayer();
24463					}, 200);
24464
24465					// pause play video
24466					if(typeof(players) !== 'undefined' && players){
24467						for(var j in players){
24468							if(players[j].playing && !players[j].clone && (players[j].slideIndex != $curSlideIndex)){
24469								if((typeof window[players[j].id] == 'object')){
24470									if(players[j].videoPlayer === 'YOUTUBE'){
24471										window[players[j].id].pauseVideo()
24472									}
24473									else if(players[j].videoPlayer === 'VIMEO'){
24474										window[players[j].id].pause()
24475									}
24476									else if(players[j].videoPlayer === 'RUTUBE'){
24477										document.getElementById(players[j].id).contentWindow.postMessage(JSON.stringify({
24478										    type: 'player:pause',
24479										    data: {}
24480										}), '*')
24481									}
24482									else if(players[j].videoPlayer === 'HTML5'){
24483										document.getElementById(players[j].id).pause()
24484									}
24485								}
24486							}
24487						}
24488					}
24489					// autoplay video
24490					var bVideoAutoPlay = $curSlide.attr('data-video_autoplay') == 1
24491					if(bVideoAutoPlay){
24492						startMainBannerSlideVideo($curSlide)
24493					}
24494				}
24495
24496				if($curSlide.find('video').length && !$curSlide.find('.btn-video').length){
24497					var videoID = $curSlide.find('video').attr('id');
24498					document.getElementById(videoID).play();
24499				}
24500			}
24501		}
24502	}
24503	catch(e){}
24504	finally{
24505		ignoreResize.pop();
24506	}
24507});
24508/* End */
24509;
24510; /* 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:"";}"*/
24511$(document).ready(function(){
24512    /*  --- Bind mobile menu  --- */
24513        var $mobileMenu = $("#mobilemenu")
24514        if($mobileMenu.length){
24515            $mobileMenu.isLeftSide = $mobileMenu.hasClass('leftside')
24516            $mobileMenu.isOpen = $mobileMenu.hasClass('show')
24517            $mobileMenu.isDowndrop = $mobileMenu.find('>.scroller').hasClass('downdrop')
24518
24519            $('#mobileheader .burger').click(function(){
24520                SwipeMobileMenu()
24521            })
24522
24523            if($mobileMenu.isLeftSide){
24524                $mobileMenu.parent().append('<div id="mobilemenu-overlay"></div>')
24525                var $mobileMenuOverlay = $('#mobilemenu-overlay')
24526
24527                $mobileMenuOverlay.click(function(){
24528                    if($mobileMenu.isOpen){
24529                        CloseMobileMenu()
24530                    }
24531                });
24532
24533                $(document).swiperight(function(e) {
24534                    if(!$(e.target).closest('.flexslider').length && !$(e.target).closest('.swipeignore').length && !$(e.target).closest('.jqmWindow.popup').length){
24535                        OpenMobileMenu()
24536                    }
24537                });
24538
24539                $(document).swipeleft(function(e) {
24540                    if(!$(e.target).closest('.flexslider').length && !$(e.target).closest('.swipeignore').length && !$(e.target).closest('.jqmWindow.popup').length){
24541                        CloseMobileMenu()
24542                    }
24543                });
24544            }
24545            else{
24546                $('#mobileheader').click(function(e){
24547                    if(!$(e.target).closest('#mobilemenu').length && !$(e.target).closest('.burger').length && $mobileMenu.isOpen){
24548                        CloseMobileMenu()
24549                    }
24550                });
24551            }
24552
24553            $('#mobilemenu .menu a,#mobilemenu .social-icons a').click(function(e){
24554                var $this = $(this)
24555                if($this.hasClass('parent')){
24556                    e.preventDefault()
24557
24558                    if(!$mobileMenu.isDowndrop){
24559                        $this.closest('li').addClass('expanded')
24560                        MoveMobileMenuWrapNext()
24561                    }
24562                    else{
24563                        if(!$this.closest('li').hasClass('expanded')){
24564                            $this.closest('li').addClass('expanded')
24565                        }
24566                        else{
24567                            $this.closest('li').removeClass('expanded')
24568                        }
24569                    }
24570                }
24571                else{
24572                    if($this.closest('li').hasClass('counters')){
24573                        var href = $this.attr('href')
24574                        if(typeof href !== 'undefined'){
24575                            window.location.href = href
24576                            window.location.reload()
24577                        }
24578                    }
24579
24580                    if(!$this.closest('.menu_back').length){
24581                        CloseMobileMenu()
24582                    }
24583                }
24584            })
24585
24586            $('#mobilemenu .dropdown .menu_back').click(function(e){
24587                e.preventDefault()
24588                var $this = $(this)
24589                MoveMobileMenuWrapPrev()
24590                setTimeout(function(){
24591                    $this.closest('.expanded').removeClass('expanded')
24592                }, 400)
24593            })
24594
24595            OpenMobileMenu = function(){
24596                CloseMobilePhone();
24597
24598                if(!$mobileMenu.isOpen){
24599                    // hide styleswitcher
24600                    if($('.style-switcher').hasClass('active')){
24601                        $('.style-switcher .switch').trigger('click')
24602                    }
24603                    $('.style-switcher .switch').hide()
24604
24605                    if($mobileMenu.isLeftSide){
24606                        // show overlay
24607                        setTimeout(function(){
24608                            $mobileMenuOverlay.fadeIn('fast')
24609                        }, 100)
24610                    }
24611                    else{
24612                        // scroll body to top & set fixed
24613                        $('body').scrollTop(0).css({position: 'fixed'})
24614
24615                        // set menu top = bottom of header
24616                        $mobileMenu.css({top: + ($('#mobileheader').height() + $('#mobileheader').offset().top) + 'px'})
24617
24618                        // change burger icon
24619                        $('#mobileheader .burger').addClass('c')
24620                    }
24621
24622                    // show menu
24623                    $mobileMenu.addClass('show')
24624                    $mobileMenu.isOpen = true
24625
24626                    if(!$mobileMenu.isDowndrop){
24627                        var $wrap = $mobileMenu.find('.wrap').first()
24628                        var params =  $wrap.data('params')
24629                        if(typeof params === 'undefined'){
24630                            params = {
24631                                depth: 0,
24632                                scroll: {},
24633                                height: {}
24634                            }
24635                        }
24636                        $wrap.data('params', params)
24637                    }
24638                }
24639            }
24640
24641            CloseMobileMenu = function(){
24642                if($mobileMenu.isOpen){
24643                    // hide menu
24644                    $mobileMenu.removeClass('show')
24645                    $mobileMenu.isOpen = false
24646
24647                    // show styleswitcher
24648                    $('.style-switcher .switch').show()
24649
24650                    if($mobileMenu.isLeftSide){
24651                        // hide overlay
24652                        setTimeout(function(){
24653                            $mobileMenuOverlay.fadeOut('fast')
24654                        }, 100)
24655                    }
24656                    else{
24657                        // change burger icon
24658                        $('#mobileheader .burger').removeClass('c')
24659
24660                        // body unset fixed
24661                        $('body').css({position: ''})
24662                    }
24663
24664                    if(!$mobileMenu.isDowndrop){
24665                        setTimeout(function(){
24666                            var $scroller = $mobileMenu.find('.scroller').first()
24667                            var $wrap = $mobileMenu.find('.wrap').first()
24668                            var params =  $wrap.data('params')
24669                            params.depth = 0
24670                            $wrap.data('params', params).attr('style', '')
24671                            $mobileMenu.scrollTop(0)
24672                            $scroller.css('height', '')
24673                        }, 400)
24674                    }
24675                }
24676            }
24677
24678            SwipeMobileMenu = function(){
24679                if($mobileMenu.isOpen){
24680                    CloseMobileMenu()
24681                }
24682                else{
24683                    OpenMobileMenu()
24684                }
24685            }
24686
24687            function MoveMobileMenuWrapNext(){
24688                if(!$mobileMenu.isDowndrop){
24689                    var $scroller = $mobileMenu.find('.scroller').first()
24690                    var $wrap = $mobileMenu.find('.wrap').first()
24691                    if($wrap.length){
24692                        var params =  $wrap.data('params')
24693                        var $dropdownNext = $mobileMenu.find('.expanded>.dropdown').eq(params.depth)
24694                        if($dropdownNext.length){
24695                            // save scroll position
24696                            params.scroll[params.depth] = parseInt($mobileMenu.scrollTop())
24697
24698                            // height while move animating
24699                            params.height[params.depth + 1] = Math.max($dropdownNext.height(), (!params.depth ? $wrap.height() : $mobileMenu.find('.expanded>.dropdown').eq(params.depth - 1).height()))
24700                            $scroller.css('height', params.height[params.depth + 1] + 'px')
24701
24702                            // inc depth
24703                            ++params.depth
24704
24705                            // translateX for move
24706                            $wrap.css('transform', 'translateX(' + -100 * params.depth + '%)')
24707
24708                            // scroll to top
24709                            setTimeout(function() {
24710                                $mobileMenu.animate({scrollTop : 0}, 200);
24711                            }, 100)
24712
24713                            // height on enimating end
24714                            var h = $dropdownNext.height()
24715                            setTimeout(function() {
24716                                if(h){
24717                                    $scroller.css('height', h + 'px')
24718                                }
24719                                else{
24720                                    $scroller.css('height', '')
24721                                }
24722                            }, 200)
24723                        }
24724
24725                        $wrap.data('params', params)
24726                    }
24727                }
24728            }
24729
24730            function MoveMobileMenuWrapPrev(){
24731                if(!$mobileMenu.isDowndrop){
24732                    var $scroller = $mobileMenu.find('.scroller').first()
24733                    var $wrap = $mobileMenu.find('.wrap').first()
24734                    if($wrap.length){
24735                        var params =  $wrap.data('params')
24736                        if(params.depth > 0){
24737                            var $dropdown = $mobileMenu.find('.expanded>.dropdown').eq(params.depth - 1)
24738                            if($dropdown.length){
24739                                // height while move animating
24740                                $scroller.css('height', params.height[params.depth] + 'px')
24741
24742                                // dec depth
24743                                --params.depth
24744
24745                                // translateX for move
24746                                $wrap.css('transform', 'translateX(' + -100 * params.depth + '%)')
24747
24748                                // restore scroll position
24749                                setTimeout(function() {
24750                                    $mobileMenu.animate({scrollTop : params.scroll[params.depth]}, 200);
24751                                }, 100)
24752
24753                                // height on enimating end
24754                                var h = (!params.depth ? false : $mobileMenu.find('.expanded>.dropdown').eq(params.depth - 1).height())
24755                                setTimeout(function() {
24756                                    if(h){
24757                                        $scroller.css('height', h + 'px')
24758                                    }
24759                                    else{
24760                                        $scroller.css('height', '')
24761                                    }
24762                                }, 200)
24763                            }
24764                        }
24765
24766                        $wrap.data('params', params)
24767                    }
24768                }
24769            }
24770        }
24771    /*  --- END Bind mobile menu  --- */
24772
24773    /*  --- Bind mobile phone  --- */
24774        var $mobileHeader = $("#mobileheader");
24775        var $mobilePhone = $("#mobilePhone");
24776        $mobilePhone.isOpen = false;
24777        if($mobilePhone.length){
24778            $mobilePhone.isOpen = $mobilePhone.hasClass('show');
24779
24780            $(document).on('click', '.wrap_phones .svg-inline-phone', function(e){
24781                SwipeMobilePhone();
24782                e.stopPropagation();
24783            });
24784
24785            $(document).on('click', '.wrap_phones .svg-inline-close', function(e){
24786                CloseMobilePhone();
24787                e.stopPropagation();
24788            });
24789        }
24790
24791        SwipeMobilePhone = function(){
24792            if($mobilePhone.isOpen){
24793                CloseMobilePhone();
24794            }
24795            else{
24796                OpenMobilePhone();
24797            }
24798        }
24799
24800        OpenMobilePhone = function(){
24801            if(!$mobilePhone.isOpen){
24802                CloseMobileMenu();
24803
24804                // show overlay
24805                $('<div class="jqmOverlay mobp" style="top:'+($mobileHeader.position().top+$mobileHeader.height())+'px;position:absolute"></div>').appendTo('body');
24806
24807                // toggle phones
24808                setTimeout(function(){
24809                    $mobilePhone.slideDown('fast', function(){
24810                        $mobilePhone.addClass('show');
24811                        $mobilePhone.isOpen = true;
24812                    });
24813                }, 100);
24814            }
24815        }
24816
24817        CloseMobilePhone = function(){
24818            if($mobilePhone.isOpen){
24819            	// toggle phones
24820                setTimeout(function(){
24821                    $mobilePhone.slideUp('fast', function(){
24822                        $mobilePhone.removeClass('show');
24823                        $mobilePhone.isOpen = false;
24824
24825    		        	// hide overlay
24826    		            $('.jqmOverlay.mobp').remove();
24827                    });
24828                }, 100);
24829            }
24830        }
24831
24832        checkMobilePhone = function(){
24833            if((!window.matchMedia('(max-width: 991px)').matches)){
24834                CloseMobilePhone();
24835    		}
24836        }
24837    /*  --- END Bind mobile phone  --- */
24838
24839    /*  --- Bind mobile filter  --- */
24840        var $mobilefilter = $("#mobilefilter");
24841        if($mobilefilter.length){
24842            $mobilefilter.isOpen = $mobileMenu.hasClass('show');
24843            $mobilefilter.isAppendLeft = false;
24844            $mobilefilter.isWrapFilter = false;
24845            $mobilefilter.isHorizontalOrCompact = $('.filter_horizontal').length || $('.bx_filter_vertical.compact').length;
24846            $mobilefilter.close = '<i class="svg svg-close close-icons"></i>';
24847
24848            $(document).on('click', '.bx-filter-title', function(){
24849                OpenMobileFilter();
24850            });
24851
24852            $(document).on('click', '#mobilefilter .svg-close.close-icons', function(){
24853                CloseMobileFilter();
24854            });
24855
24856            $(document).on('click', '.bx_filter_select_block', function(e){
24857                var bx_filter_select_container = $(e.target).parents('.bx_filter_select_container');
24858                if(bx_filter_select_container.length) {
24859                    var prop_id = bx_filter_select_container.closest('.bx_filter_parameters_box').attr('data-property_id');
24860                    if($('#smartFilterDropDown'+prop_id).length){
24861    					$('#smartFilterDropDown'+prop_id).css({"max-width":bx_filter_select_container.width(), "z-index":"3020"});
24862                    }
24863                }
24864            });
24865
24866            $(document).on('mouseup', '.bx_filter_section', function(e){
24867                if($(e.target).hasClass('bx_filter_search_button')) {
24868                    CloseMobileFilter();
24869                }
24870            });
24871
24872
24873            $(document).on('mouseup', '.bx_filter_parameters_box_title', function(e){
24874                $("[id^='smartFilterDropDown']").hide();
24875                if($(e.target).hasClass('close-icons')) {
24876                    CloseMobileFilter();
24877                }
24878            });
24879
24880            /*$(document).on('DOMSubtreeModified', "#mobilefilter #modef_num_mobile", function() {
24881                mobileFilterNum($(this));
24882            });
24883
24884            $(document).on('DOMSubtreeModified', "#mobilefilter .bx_filter_container_modef", function() {
24885                mobileFilterNum($(this));
24886            });*/
24887
24888            $mobilefilter.parent().append('<div id="mobilefilter-overlay"></div>');
24889            var $mobilefilterOverlay = $('#mobilefilter-overlay');
24890
24891            $mobilefilterOverlay.click(function(){
24892                if($mobilefilter.isOpen){
24893                    CloseMobileFilter();
24894                    //e.stopPropagation();
24895                }
24896            });
24897
24898            mobileFilterNum = function(num, def){
24899                if(def){
24900                    $('.bx_filter_search_button').text(num.data("f"));;
24901                }
24902                else {
24903                    var str = "";
24904                    var $prosLeng = $('.bx_filter_parameters_box > span');
24905
24906                    str += $prosLeng.data("f") + " " + num + " " + declOfNumFilter(num, [$prosLeng.data("fi"), $prosLeng.data("fr"), $prosLeng.data("frm"),]);
24907                    $('.bx_filter_search_button').text(str);
24908                }
24909            }
24910
24911            declOfNumFilter = function(number, titles){
24912                cases = [2, 0, 1, 1, 1, 2];
24913                return titles[ (number%100>4 && number%100<20)? 2 : cases[(number%10<5)?number%10:5] ];
24914            }
24915
24916            OpenMobileFilter = function(){
24917                if(!$mobilefilter.isOpen)
24918                {
24919                    $('body').addClass('jqm-initied wf');
24920
24921                    $('.bx_filter_vertical .slide-block__head.filter_title').removeClass('closed');
24922                    $('.bx_filter_vertical .slide-block__head.filter_title + .slide-block__body').show();
24923
24924
24925                    if(!$mobilefilter.isAppendLeft)
24926                    {
24927                        if(!$mobilefilter.isWrapFilter)
24928                        {
24929                            $(".bx_filter").wrap("<div id='wrapInlineFilter'></div>");
24930                            $mobilefilter.isWrapFilter = true;
24931                        }
24932                        $(".bx_filter").appendTo($("#mobilefilter"));
24933                        var helper = $('#filter-helper');
24934                        if(helper.length) {
24935                            helper.prependTo($("#mobilefilter .bx_filter_parameters"));
24936                        }
24937                        $mobilefilter.isAppendLeft = true;
24938
24939                    }
24940
24941                    $("#mobilefilter .bx_filter_parameters").addClass('scrollbar');
24942                    $("#mobilefilter .slide-block .filter_title").addClass('ignore');
24943                    $("#mobilefilter .bx_filter_parameters .bx_filter_parameters_box_title").addClass('colored_theme_hover_bg-block');
24944
24945                    $(".bx_filter_button_box.ajax-btns").addClass('colored_theme_bg');
24946                    $(".bx_filter_button_box.ajax-btns .filter-bnt-wrapper").removeClass('hidden');
24947                    InitCustomScrollBar();
24948
24949                    // show overlay
24950                    setTimeout(function(){
24951    					$mobilefilterOverlay.fadeIn('fast');
24952                    }, 100);
24953
24954                    // fix body
24955                    $('body').css({'overflow': 'hidden','height': '100vh'});
24956
24957                    // show mobile filter
24958                    $mobilefilter.addClass('show');
24959                    $mobilefilter.find('.bx_filter').css({'display':'block'});
24960                    $mobilefilter.isOpen = true;
24961
24962                    var init =  $mobilefilter.data('init');
24963                    if(typeof init === 'undefined'){
24964                        $mobilefilter.scroll(function() {
24965                            $(".bx_filter_section .bx_filter_select_container").each(function(){
24966                                var prop_id=$(this).closest('.bx_filter_parameters_box').attr('data-property_id');
24967                                if($('#smartFilterDropDown'+prop_id).length){
24968                                    $('#smartFilterDropDown'+prop_id).hide();
24969                                }
24970                            });
24971                        });
24972
24973                        $mobilefilter.data('init', "Y");
24974                    };
24975                };
24976            }
24977
24978            CloseMobileFilter = function(append){
24979                $mobilefilter.find('.bx_filter_parameters').removeClass('scrollbar');
24980                
24981                if($("#mobilefilter .bx_filter_parameters").length)
24982                    $('body').removeClass('jqm-initied wf');
24983
24984                $("#mobilefilter .bx_filter_parameters .bx_filter_parameters_box_title").removeClass('colored_theme_hover_bg-block');
24985                $(".slide-block .filter_title").removeClass('ignore');
24986                $(".bx_filter_button_box.ajax-btns").removeClass('colored_theme_bg');
24987
24988                $(".bx_filter:not(.n-ajax) .bx_filter_button_box.ajax-btns .filter-bnt-wrapper").addClass('hidden');
24989
24990                if($mobilefilter.isOpen){
24991                	// scroll to top
24992                    $mobilefilter.find('.bx_filter_parameters').scrollTop(0);
24993
24994                    // unfix body
24995                    $('body').css({'overflow': '','height': ''});
24996
24997                    // hide overlay
24998                    setTimeout(function(){
24999    					$mobilefilterOverlay.fadeOut('fast');
25000                    }, 100);
25001
25002                    // hide mobile filter
25003                    $mobilefilter.removeClass('show');
25004                    $mobilefilter.isOpen = false;
25005                }
25006
25007                if(append && $mobilefilter.isAppendLeft){
25008                    $(".bx_filter").appendTo($("#wrapInlineFilter")).show();
25009                    var helper = $('#filter-helper');
25010                    if(helper.length) {
25011                        helper.appendTo($('#filter-helper-wrapper'));
25012                    }
25013                    $mobilefilter.isAppendLeft = false;
25014                    $mobilefilter.removeData('init');
25015                    mobileFilterNum($("#modef_num_mobile"),true);
25016    	        }
25017            }
25018
25019            checkMobileFilter = function(){
25020                if((!window.matchMedia('(max-width: 991px)').matches && !$mobilefilter.isHorizontalOrCompact) || (!window.matchMedia('(max-width: 767px)').matches && $mobilefilter.isHorizontalOrCompact)){
25021                    CloseMobileFilter(true);
25022    			}
25023            }
25024        }
25025        else {
25026            checkTopFilter();
25027            $(document).on('click', '.bx-filter-title', function(){
25028    			$(this).toggleClass("opened");
25029    			if($('.visible_mobile_filter').length) {
25030    				$('.visible_mobile_filter').show();
25031    				$('.bx_filter_vertical, .bx_filter').slideToggle(333);
25032    			}
25033    			else{
25034    				$('.bx_filter_vertical').closest('div[id^=bx_incl]').show();
25035    			    $('.bx_filter_vertical, .bx_filter').slideToggle(333);
25036    			}
25037            });
25038        }
25039    /*  --- END Bind mobile filter  --- */
25040})
25041/* End */
25042;
25043; /* 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:"";}"*/
25044/*
25045== malihu jquery custom scrollbar plugin == 
25046Version: 3.1.5 
25047Plugin URI: http://manos.malihu.gr/jquery-custom-content-scroller 
25048Author: malihu
25049Author URI: http://manos.malihu.gr
25050License: MIT License (MIT)
25051*/
25052
25053/*
25054Copyright Manos Malihutsakis (email: [email protected])
25055
25056Permission is hereby granted, free of charge, to any person obtaining a copy
25057of this software and associated documentation files (the "Software"), to deal
25058in the Software without restriction, including without limitation the rights
25059to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
25060copies of the Software, and to permit persons to whom the Software is
25061furnished to do so, subject to the following conditions:
25062
25063The above copyright notice and this permission notice shall be included in
25064all copies or substantial portions of the Software.
25065
25066THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25067IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25068FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25069AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25070LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25071OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25072THE SOFTWARE.
25073*/
25074
25075/*
25076The code below is fairly long, fully commented and should be normally used in development. 
25077For production, use either the minified jquery.mCustomScrollbar.min.js script or 
25078the production-ready jquery.mCustomScrollbar.concat.min.js which contains the plugin 
25079and dependencies (minified). 
25080*/
25081
25082(function(factory){
25083	if(typeof define==="function" && define.amd){
25084		define(["jquery"],factory);
25085	}else if(typeof module!=="undefined" && module.exports){
25086		module.exports=factory;
25087	}else{
25088		factory(jQuery,window,document);
25089	}
25090}(function($){
25091(function(init){
25092	var _rjs=typeof define==="function" && define.amd, /* RequireJS */
25093		_njs=typeof module !== "undefined" && module.exports, /* NodeJS */
25094		_dlp=("https:"==document.location.protocol) ? "https:" : "http:", /* location protocol */
25095		_url="cdnjs.cloudflare.com/ajax/libs/jquery-mousewheel/3.1.13/jquery.mousewheel.min.js";
25096	if(!_rjs){
25097		if(_njs){
25098			require("jquery-mousewheel")($);
25099		}else{
25100			/* load jquery-mousewheel plugin (via CDN) if it's not present or not loaded via RequireJS 
25101			(works when mCustomScrollbar fn is called on window load) */
25102			$.event.special.mousewheel || $("head").append(decodeURI("%3Cscript src="+_dlp+"//"+_url+"%3E%3C/script%3E"));
25103		}
25104	}
vendor: 9,056 bytes, lines 25105-25427
25105	init();
25106}(function(){
25107	
25108	/* 
25109	----------------------------------------
25110	PLUGIN NAMESPACE, PREFIX, DEFAULT SELECTOR(S) 
25111	----------------------------------------
25112	*/
25113	
25114	var pluginNS="mCustomScrollbar",
25115		pluginPfx="mCS",
25116		defaultSelector=".mCustomScrollbar",
25117	
25118	
25119		
25120	
25121	
25122	/* 
25123	----------------------------------------
25124	DEFAULT OPTIONS 
25125	----------------------------------------
25126	*/
25127	
25128		defaults={
25129			/*
25130			set element/content width/height programmatically 
25131			values: boolean, pixels, percentage 
25132				option						default
25133				-------------------------------------
25134				setWidth					false
25135				setHeight					false
25136			*/
25137			/*
25138			set the initial css top property of content  
25139			values: string (e.g. "-100px", "10%" etc.)
25140			*/
25141			setTop:0,
25142			/*
25143			set the initial css left property of content  
25144			values: string (e.g. "-100px", "10%" etc.)
25145			*/
25146			setLeft:0,
25147			/* 
25148			scrollbar axis (vertical and/or horizontal scrollbars) 
25149			values (string): "y", "x", "yx"
25150			*/
25151			axis:"y",
25152			/*
25153			position of scrollbar relative to content  
25154			values (string): "inside", "outside" ("outside" requires elements with position:relative)
25155			*/
25156			scrollbarPosition:"inside",
25157			/*
25158			scrolling inertia
25159			values: integer (milliseconds)
25160			*/
25161			scrollInertia:100,
25162			/* 
25163			auto-adjust scrollbar dragger length
25164			values: boolean
25165			*/
25166			autoDraggerLength:true,
25167			/*
25168			auto-hide scrollbar when idle 
25169			values: boolean
25170				option						default
25171				-------------------------------------
25172				autoHideScrollbar			false
25173			*/
25174			/*
25175			auto-expands scrollbar on mouse-over and dragging
25176			values: boolean
25177				option						default
25178				-------------------------------------
25179				autoExpandScrollbar			false
25180			*/
25181			/*
25182			always show scrollbar, even when there's nothing to scroll 
25183			values: integer (0=disable, 1=always show dragger rail and buttons, 2=always show dragger rail, dragger and buttons), boolean
25184			*/
25185			alwaysShowScrollbar:0,
25186			/*
25187			scrolling always snaps to a multiple of this number in pixels
25188			values: integer, array ([y,x])
25189				option						default
25190				-------------------------------------
25191				snapAmount					null
25192			*/
25193			/*
25194			when snapping, snap with this number in pixels as an offset 
25195			values: integer
25196			*/
25197			snapOffset:0,
25198			/* 
25199			mouse-wheel scrolling
25200			*/
25201			mouseWheel:{
25202				/* 
25203				enable mouse-wheel scrolling
25204				values: boolean
25205				*/
25206				enable:true,
25207				/* 
25208				scrolling amount in pixels
25209				values: "auto", integer 
25210				*/
25211				scrollAmount:"auto",
25212				/* 
25213				mouse-wheel scrolling axis 
25214				the default scrolling direction when both vertical and horizontal scrollbars are present 
25215				values (string): "y", "x" 
25216				*/
25217				axis:"y",
25218				/* 
25219				prevent the default behaviour which automatically scrolls the parent element(s) when end of scrolling is reached 
25220				values: boolean
25221					option						default
25222					-------------------------------------
25223					preventDefault				null
25224				*/
25225				/*
25226				the reported mouse-wheel delta value. The number of lines (translated to pixels) one wheel notch scrolls.  
25227				values: "auto", integer 
25228				"auto" uses the default OS/browser value 
25229				*/
25230				deltaFactor:"auto",
25231				/*
25232				normalize mouse-wheel delta to -1 or 1 (disables mouse-wheel acceleration) 
25233				values: boolean
25234					option						default
25235					-------------------------------------
25236					normalizeDelta				null
25237				*/
25238				/*
25239				invert mouse-wheel scrolling direction 
25240				values: boolean
25241					option						default
25242					-------------------------------------
25243					invert						null
25244				*/
25245				/*
25246				the tags that disable mouse-wheel when cursor is over them
25247				*/
25248				disableOver:["select","option","keygen","datalist","textarea"]
25249			},
25250			/* 
25251			scrollbar buttons
25252			*/
25253			scrollButtons:{ 
25254				/*
25255				enable scrollbar buttons
25256				values: boolean
25257					option						default
25258					-------------------------------------
25259					enable						null
25260				*/
25261				/*
25262				scrollbar buttons scrolling type 
25263				values (string): "stepless", "stepped"
25264				*/
25265				scrollType:"stepless",
25266				/*
25267				scrolling amount in pixels
25268				values: "auto", integer 
25269				*/
25270				scrollAmount:"auto"
25271				/*
25272				tabindex of the scrollbar buttons
25273				values: false, integer
25274					option						default
25275					-------------------------------------
25276					tabindex					null
25277				*/
25278			},
25279			/* 
25280			keyboard scrolling
25281			*/
25282			keyboard:{ 
25283				/*
25284				enable scrolling via keyboard
25285				values: boolean
25286				*/
25287				enable:true,
25288				/*
25289				keyboard scrolling type 
25290				values (string): "stepless", "stepped"
25291				*/
25292				scrollType:"stepless",
25293				/*
25294				scrolling amount in pixels
25295				values: "auto", integer 
25296				*/
25297				scrollAmount:"auto"
25298			},
25299			/*
25300			enable content touch-swipe scrolling 
25301			values: boolean, integer, string (number)
25302			integer values define the axis-specific minimum amount required for scrolling momentum
25303			*/
25304			contentTouchScroll:25,
25305			/*
25306			enable/disable document (default) touch-swipe scrolling 
25307			*/
25308			documentTouchScroll:true,
25309			/*
25310			advanced option parameters
25311			*/
25312			advanced:{
25313				/*
25314				auto-expand content horizontally (for "x" or "yx" axis) 
25315				values: boolean, integer (the value 2 forces the non scrollHeight/scrollWidth method, the value 3 forces the scrollHeight/scrollWidth method)
25316					option						default
25317					-------------------------------------
25318					autoExpandHorizontalScroll	null
25319				*/
25320				/*
25321				auto-scroll to elements with focus
25322				*/
25323				autoScrollOnFocus:"input,textarea,select,button,datalist,keygen,a[tabindex],area,object,[contenteditable='true']",
25324				/*
25325				auto-update scrollbars on content, element or viewport resize 
25326				should be true for fluid layouts/elements, adding/removing content dynamically, hiding/showing elements, content with images etc. 
25327				values: boolean
25328				*/
25329				updateOnContentResize:true,
25330				/*
25331				auto-update scrollbars each time each image inside the element is fully loaded 
25332				values: "auto", boolean
25333				*/
25334				updateOnImageLoad:"auto",
25335				/*
25336				auto-update scrollbars based on the amount and size changes of specific selectors 
25337				useful when you need to update the scrollbar(s) automatically, each time a type of element is added, removed or changes its size 
25338				values: boolean, string (e.g. "ul li" will auto-update scrollbars each time list-items inside the element are changed) 
25339				a value of true (boolean) will auto-update scrollbars each time any element is changed
25340					option						default
25341					-------------------------------------
25342					updateOnSelectorChange		null
25343				*/
25344				/*
25345				extra selectors that'll allow scrollbar dragging upon mousemove/up, pointermove/up, touchend etc. (e.g. "selector-1, selector-2")
25346					option						default
25347					-------------------------------------
25348					extraDraggableSelectors		null
25349				*/
25350				/*
25351				extra selectors that'll release scrollbar dragging upon mouseup, pointerup, touchend etc. (e.g. "selector-1, selector-2")
25352					option						default
25353					-------------------------------------
25354					releaseDraggableSelectors	null
25355				*/
25356				/*
25357				auto-update timeout 
25358				values: integer (milliseconds)
25359				*/
25360				autoUpdateTimeout:60
25361			},
25362			/* 
25363			scrollbar theme 
25364			values: string (see CSS/plugin URI for a list of ready-to-use themes)
25365			*/
25366			theme:"light",
25367			/*
25368			user defined callback functions
25369			*/
25370			callbacks:{
25371				/*
25372				Available callbacks: 
25373					callback					default
25374					-------------------------------------
25375					onCreate					null
25376					onInit						null
25377					onScrollStart				null
25378					onScroll					null
25379					onTotalScroll				null
25380					onTotalScrollBack			null
25381					whileScrolling				null
25382					onOverflowY					null
25383					onOverflowX					null
25384					onOverflowYNone				null
25385					onOverflowXNone				null
25386					onImageLoad					null
25387					onSelectorChange			null
25388					onBeforeUpdate				null
25389					onUpdate					null
25390				*/
25391				onTotalScrollOffset:0,
25392				onTotalScrollBackOffset:0,
25393				alwaysTriggerOffsets:true
25394			}
25395			/*
25396			add scrollbar(s) on all elements matching the current selector, now and in the future 
25397			values: boolean, string 
25398			string values: "on" (enable), "once" (disable after first invocation), "off" (disable)
25399			liveSelector values: string (selector)
25400				option						default
25401				-------------------------------------
25402				live						false
25403				liveSelector				null
25404			*/
25405		},
25406	
25407	
25408	
25409	
25410	
25411	/* 
25412	----------------------------------------
25413	VARS, CONSTANTS 
25414	----------------------------------------
25415	*/
25416	
25417		totalInstances=0, /* plugin instances amount */
25418		liveTimers={}, /* live option timers */
25419		oldIE=(window.attachEvent && !window.addEventListener) ? 1 : 0, /* detect IE < 9 */
25420		touchActive=false,touchable, /* global touch vars (for touch and pointer events) */
25421		/* general plugin classes */
25422		classes=[
25423			"mCSB_dragger_onDrag","mCSB_scrollTools_onDrag","mCS_img_loaded","mCS_disabled","mCS_destroyed","mCS_no_scrollbar",
25424			"mCS-autoHide","mCS-dir-rtl","mCS_no_scrollbar_y","mCS_no_scrollbar_x","mCS_y_hidden","mCS_x_hidden","mCSB_draggerContainer",
25425			"mCSB_buttonUp","mCSB_buttonDown","mCSB_buttonLeft colored_theme_hover_text","mCSB_buttonRight colored_theme_hover_text"
25426		],
25427		touchOffCustom = false;
vendor: 22,935 bytes, lines 25427-25991
25427
25428		
25429	
25430	
25431	
25432	
25433	/* 
25434	----------------------------------------
25435	METHODS 
25436	----------------------------------------
25437	*/
25438	
25439		methods={
25440			
25441			/* 
25442			plugin initialization method 
25443			creates the scrollbar(s), plugin data object and options
25444			----------------------------------------
25445			*/
25446			
25447			init:function(options){
25448				
25449				var options=$.extend(true,{},defaults,options),
25450					selector=_selector.call(this); /* validate selector */
25451				
25452				/* 
25453				if live option is enabled, monitor for elements matching the current selector and 
25454				apply scrollbar(s) when found (now and in the future) 
25455				*/
25456				if(options.live){
25457					var liveSelector=options.liveSelector || this.selector || defaultSelector, /* live selector(s) */
25458						$liveSelector=$(liveSelector); /* live selector(s) as jquery object */
25459					if(options.live==="off"){
25460						/* 
25461						disable live if requested 
25462						usage: $(selector).mCustomScrollbar({live:"off"}); 
25463						*/
25464						removeLiveTimers(liveSelector);
25465						return;
25466					}
25467					liveTimers[liveSelector]=setTimeout(function(){
25468						/* call mCustomScrollbar fn on live selector(s) every half-second */
25469						$liveSelector.mCustomScrollbar(options);
25470						if(options.live==="once" && $liveSelector.length){
25471							/* disable live after first invocation */
25472							removeLiveTimers(liveSelector);
25473						}
25474					},500);
25475				}else{
25476					removeLiveTimers(liveSelector);
25477				}
25478				
25479				/* options backward compatibility (for versions < 3.0.0) and normalization */
25480				options.setWidth=(options.set_width) ? options.set_width : options.setWidth;
25481				options.setHeight=(options.set_height) ? options.set_height : options.setHeight;
25482				options.axis=(options.horizontalScroll) ? "x" : _findAxis(options.axis);
25483				options.scrollInertia=options.scrollInertia>0 && options.scrollInertia<17 ? 17 : options.scrollInertia;
25484				if(typeof options.mouseWheel!=="object" &&  options.mouseWheel==true){ /* old school mouseWheel option (non-object) */
25485					options.mouseWheel={enable:true,scrollAmount:"auto",axis:"y",preventDefault:false,deltaFactor:"auto",normalizeDelta:false,invert:false}
25486				}
25487				options.mouseWheel.scrollAmount=!options.mouseWheelPixels ? options.mouseWheel.scrollAmount : options.mouseWheelPixels;
25488				options.mouseWheel.normalizeDelta=!options.advanced.normalizeMouseWheelDelta ? options.mouseWheel.normalizeDelta : options.advanced.normalizeMouseWheelDelta;
25489				options.scrollButtons.scrollType=_findScrollButtonsType(options.scrollButtons.scrollType); 
25490				
25491				_theme(options); /* theme-specific options */
25492				
25493				/* plugin constructor */
25494				return $(selector).each(function(){
25495					
25496					var $this=$(this);
25497					
25498					if(!$this.data(pluginPfx)){ /* prevent multiple instantiations */
25499					
25500						/* store options and create objects in jquery data */
25501						$this.data(pluginPfx,{
25502							idx:++totalInstances, /* instance index */
25503							opt:options, /* options */
25504							scrollRatio:{y:null,x:null}, /* scrollbar to content ratio */
25505							overflowed:null, /* overflowed axis */
25506							contentReset:{y:null,x:null}, /* object to check when content resets */
25507							bindEvents:false, /* object to check if events are bound */
25508							tweenRunning:false, /* object to check if tween is running */
25509							sequential:{}, /* sequential scrolling object */
25510							langDir:$this.css("direction"), /* detect/store direction (ltr or rtl) */
25511							cbOffsets:null, /* object to check whether callback offsets always trigger */
25512							/* 
25513							object to check how scrolling events where last triggered 
25514							"internal" (default - triggered by this script), "external" (triggered by other scripts, e.g. via scrollTo method) 
25515							usage: object.data("mCS").trigger
25516							*/
25517							trigger:null,
25518							/* 
25519							object to check for changes in elements in order to call the update method automatically 
25520							*/
25521							poll:{size:{o:0,n:0},img:{o:0,n:0},change:{o:0,n:0}}
25522						});
25523						
25524						var d=$this.data(pluginPfx),o=d.opt,
25525							/* HTML data attributes */
25526							htmlDataAxis=$this.data("mcs-axis"),htmlDataSbPos=$this.data("mcs-scrollbar-position"),htmlDataTheme=$this.data("mcs-theme");
25527						 
25528						if(htmlDataAxis){o.axis=htmlDataAxis;} /* usage example: data-mcs-axis="y" */
25529						if(htmlDataSbPos){o.scrollbarPosition=htmlDataSbPos;} /* usage example: data-mcs-scrollbar-position="outside" */
25530						if(htmlDataTheme){ /* usage example: data-mcs-theme="minimal" */
25531							o.theme=htmlDataTheme;
25532							_theme(o); /* theme-specific options */
25533						}
25534						
25535						_pluginMarkup.call(this); /* add plugin markup */
25536						
25537						if(d && o.callbacks.onCreate && typeof o.callbacks.onCreate==="function"){o.callbacks.onCreate.call(this);} /* callbacks: onCreate */
25538						
25539						$("#mCSB_"+d.idx+"_container img:not(."+classes[2]+")").addClass(classes[2]); /* flag loaded images */
25540						
25541						methods.update.call(null,$this); /* call the update method */
25542					
25543					}
25544					
25545				});
25546				
25547			},
25548			/* ---------------------------------------- */
25549			
25550			
25551			
25552			/* 
25553			plugin update method 
25554			updates content and scrollbar(s) values, events and status 
25555			----------------------------------------
25556			usage: $(selector).mCustomScrollbar("update");
25557			*/
25558			
25559			update:function(el,cb){
25560				
25561				var selector=el || _selector.call(this); /* validate selector */
25562				
25563				return $(selector).each(function(){
25564					
25565					var $this=$(this);
25566					
25567					if($this.data(pluginPfx)){ /* check if plugin has initialized */
25568						
25569						var d=$this.data(pluginPfx),o=d.opt,
25570							mCSB_container=$("#mCSB_"+d.idx+"_container"),
25571							mCustomScrollBox=$("#mCSB_"+d.idx),
25572							mCSB_dragger=[$("#mCSB_"+d.idx+"_dragger_vertical"),$("#mCSB_"+d.idx+"_dragger_horizontal")];
25573						
25574						if(!mCSB_container.length){return;}
25575						
25576						if(d.tweenRunning){_stop($this);} /* stop any running tweens while updating */
25577						
25578						if(cb && d && o.callbacks.onBeforeUpdate && typeof o.callbacks.onBeforeUpdate==="function"){o.callbacks.onBeforeUpdate.call(this);} /* callbacks: onBeforeUpdate */
25579						
25580						/* if element was disabled or destroyed, remove class(es) */
25581						if($this.hasClass(classes[3])){$this.removeClass(classes[3]);}
25582						if($this.hasClass(classes[4])){$this.removeClass(classes[4]);}
25583						
25584						/* css flexbox fix, detect/set max-height */
25585						mCustomScrollBox.css("max-height","none");
25586						if(mCustomScrollBox.height()!==$this.height()){mCustomScrollBox.css("max-height",$this.height());}
25587						
25588						_expandContentHorizontally.call(this); /* expand content horizontally */
25589						
25590						if(o.axis!=="y" && !o.advanced.autoExpandHorizontalScroll){
25591							mCSB_container.css("width",_contentWidth(mCSB_container));
25592						}
25593						
25594						d.overflowed=_overflowed.call(this); /* determine if scrolling is required */
25595						
25596						_scrollbarVisibility.call(this); /* show/hide scrollbar(s) */
25597						
25598						/* auto-adjust scrollbar dragger length analogous to content */
25599						if(o.autoDraggerLength){_setDraggerLength.call(this);}
25600						
25601						_scrollRatio.call(this); /* calculate and store scrollbar to content ratio */
25602						
25603						_bindEvents.call(this); /* bind scrollbar events */
25604						
25605						/* reset scrolling position and/or events */
25606						var to=[Math.abs(mCSB_container[0].offsetTop),Math.abs(mCSB_container[0].offsetLeft)];
25607						if(o.axis!=="x"){ /* y/yx axis */
25608							if(!d.overflowed[0]){ /* y scrolling is not required */
25609								_resetContentPosition.call(this); /* reset content position */
25610								if(o.axis==="y"){
25611									_unbindEvents.call(this);
25612								}else if(o.axis==="yx" && d.overflowed[1]){
25613									_scrollTo($this,to[1].toString(),{dir:"x",dur:0,overwrite:"none"});
25614								}
25615							}else if(mCSB_dragger[0].height()>mCSB_dragger[0].parent().height()){
25616								_resetContentPosition.call(this); /* reset content position */
25617							}else{ /* y scrolling is required */
25618								_scrollTo($this,to[0].toString(),{dir:"y",dur:0,overwrite:"none"});
25619								d.contentReset.y=null;
25620							}
25621						}
25622						if(o.axis!=="y"){ /* x/yx axis */
25623							if(!d.overflowed[1]){ /* x scrolling is not required */
25624								_resetContentPosition.call(this); /* reset content position */
25625								if(o.axis==="x"){
25626									_unbindEvents.call(this);
25627								}else if(o.axis==="yx" && d.overflowed[0]){
25628									_scrollTo($this,to[0].toString(),{dir:"y",dur:0,overwrite:"none"});
25629								}
25630							}else if(mCSB_dragger[1].width()>mCSB_dragger[1].parent().width()){
25631								_resetContentPosition.call(this); /* reset content position */
25632							}else{ /* x scrolling is required */
25633								_scrollTo($this,to[1].toString(),{dir:"x",dur:0,overwrite:"none"});
25634								d.contentReset.x=null;
25635							}
25636						}
25637						
25638						/* callbacks: onImageLoad, onSelectorChange, onUpdate */
25639						if(cb && d){
25640							if(cb===2 && o.callbacks.onImageLoad && typeof o.callbacks.onImageLoad==="function"){
25641								o.callbacks.onImageLoad.call(this);
25642							}else if(cb===3 && o.callbacks.onSelectorChange && typeof o.callbacks.onSelectorChange==="function"){
25643								o.callbacks.onSelectorChange.call(this);
25644							}else if(o.callbacks.onUpdate && typeof o.callbacks.onUpdate==="function"){
25645								o.callbacks.onUpdate.call(this);
25646							}
25647						}
25648						
25649						_autoUpdate.call(this); /* initialize automatic updating (for dynamic content, fluid layouts etc.) */
25650						
25651					}
25652					
25653				});
25654				
25655			},
25656			/* ---------------------------------------- */
25657			
25658			
25659			
25660			/* 
25661			plugin scrollTo method 
25662			triggers a scrolling event to a specific value
25663			----------------------------------------
25664			usage: $(selector).mCustomScrollbar("scrollTo",value,options);
25665			*/
25666		
25667			scrollTo:function(val,options){
25668				
25669				/* prevent silly things like $(selector).mCustomScrollbar("scrollTo",undefined); */
25670				if(typeof val=="undefined" || val==null){return;}
25671				
25672				var selector=_selector.call(this); /* validate selector */
25673				
25674				return $(selector).each(function(){
25675					
25676					var $this=$(this);
25677					
25678					if($this.data(pluginPfx)){ /* check if plugin has initialized */
25679					
25680						var d=$this.data(pluginPfx),o=d.opt,
25681							/* method default options */
25682							methodDefaults={
25683								trigger:"external", /* method is by default triggered externally (e.g. from other scripts) */
25684								scrollInertia:o.scrollInertia, /* scrolling inertia (animation duration) */
25685								scrollEasing:"mcsEaseInOut", /* animation easing */
25686								moveDragger:false, /* move dragger instead of content */
25687								timeout:60, /* scroll-to delay */
25688								callbacks:true, /* enable/disable callbacks */
25689								onStart:true,
25690								onUpdate:true,
25691								onComplete:true
25692							},
25693							methodOptions=$.extend(true,{},methodDefaults,options),
25694							to=_arr.call(this,val),dur=methodOptions.scrollInertia>0 && methodOptions.scrollInertia<17 ? 17 : methodOptions.scrollInertia;
25695						
25696						/* translate yx values to actual scroll-to positions */
25697						to[0]=_to.call(this,to[0],"y");
25698						to[1]=_to.call(this,to[1],"x");
25699						
25700						/* 
25701						check if scroll-to value moves the dragger instead of content. 
25702						Only pixel values apply on dragger (e.g. 100, "100px", "-=100" etc.) 
25703						*/
25704						if(methodOptions.moveDragger){
25705							to[0]*=d.scrollRatio.y;
25706							to[1]*=d.scrollRatio.x;
25707						}
25708						
25709						methodOptions.dur=_isTabHidden() ? 0 : dur; //skip animations if browser tab is hidden
25710						setTimeout(function(){ 
25711							/* do the scrolling */
25712							if(to[0]!==null && typeof to[0]!=="undefined" && o.axis!=="x" && d.overflowed[0]){ /* scroll y */
25713								methodOptions.dir="y";
25714								methodOptions.overwrite="all";
25715								_scrollTo($this,to[0].toString(),methodOptions);
25716							}
25717							if(to[1]!==null && typeof to[1]!=="undefined" && o.axis!=="y" && d.overflowed[1]){ /* scroll x */
25718								methodOptions.dir="x";
25719								methodOptions.overwrite="none";
25720								_scrollTo($this,to[1].toString(),methodOptions);
25721							}
25722						},methodOptions.timeout);
25723						
25724					}
25725					
25726				});
25727				
25728			},
25729			/* ---------------------------------------- */
25730			
25731			
25732			
25733			/*
25734			plugin stop method 
25735			stops scrolling animation
25736			----------------------------------------
25737			usage: $(selector).mCustomScrollbar("stop");
25738			*/
25739			stop:function(){
25740				
25741				var selector=_selector.call(this); /* validate selector */
25742				
25743				return $(selector).each(function(){
25744					
25745					var $this=$(this);
25746					
25747					if($this.data(pluginPfx)){ /* check if plugin has initialized */
25748										
25749						_stop($this);
25750					
25751					}
25752					
25753				});
25754				
25755			},
25756			/* ---------------------------------------- */
25757			
25758			
25759			
25760			/*
25761			plugin disable method 
25762			temporarily disables the scrollbar(s) 
25763			----------------------------------------
25764			usage: $(selector).mCustomScrollbar("disable",reset); 
25765			reset (boolean): resets content position to 0 
25766			*/
25767			disable:function(r){
25768				
25769				var selector=_selector.call(this); /* validate selector */
25770				
25771				return $(selector).each(function(){
25772					
25773					var $this=$(this);
25774					
25775					if($this.data(pluginPfx)){ /* check if plugin has initialized */
25776						
25777						var d=$this.data(pluginPfx);
25778						
25779						_autoUpdate.call(this,"remove"); /* remove automatic updating */
25780						
25781						_unbindEvents.call(this); /* unbind events */
25782						
25783						if(r){_resetContentPosition.call(this);} /* reset content position */
25784						
25785						_scrollbarVisibility.call(this,true); /* show/hide scrollbar(s) */
25786						
25787						$this.addClass(classes[3]); /* add disable class */
25788					
25789					}
25790					
25791				});
25792				
25793			},
25794			/* ---------------------------------------- */
25795			
25796			
25797			
25798			/*
25799			plugin destroy method 
25800			completely removes the scrollbar(s) and returns the element to its original state
25801			----------------------------------------
25802			usage: $(selector).mCustomScrollbar("destroy"); 
25803			*/
25804			destroy:function(){
25805				
25806				var selector=_selector.call(this); /* validate selector */
25807				
25808				return $(selector).each(function(){
25809					
25810					var $this=$(this);
25811					
25812					if($this.data(pluginPfx)){ /* check if plugin has initialized */
25813					
25814						var d=$this.data(pluginPfx),o=d.opt,
25815							mCustomScrollBox=$("#mCSB_"+d.idx),
25816							mCSB_container=$("#mCSB_"+d.idx+"_container"),
25817							scrollbar=$(".mCSB_"+d.idx+"_scrollbar");
25818					
25819						if(o.live){removeLiveTimers(o.liveSelector || $(selector).selector);} /* remove live timers */
25820						
25821						_autoUpdate.call(this,"remove"); /* remove automatic updating */
25822						
25823						_unbindEvents.call(this); /* unbind events */
25824						
25825						_resetContentPosition.call(this); /* reset content position */
25826						
25827						$this.removeData(pluginPfx); /* remove plugin data object */
25828						
25829						_delete(this,"mcs"); /* delete callbacks object */
25830						
25831						/* remove plugin markup */
25832						scrollbar.remove(); /* remove scrollbar(s) first (those can be either inside or outside plugin's inner wrapper) */
25833						mCSB_container.find("img."+classes[2]).removeClass(classes[2]); /* remove loaded images flag */
25834						mCustomScrollBox.replaceWith(mCSB_container.contents()); /* replace plugin's inner wrapper with the original content */
25835						/* remove plugin classes from the element and add destroy class */
25836						$this.removeClass(pluginNS+" _"+pluginPfx+"_"+d.idx+" "+classes[6]+" "+classes[7]+" "+classes[5]+" "+classes[3]).addClass(classes[4]);
25837					
25838					}
25839					
25840				});
25841				
25842			}
25843			/* ---------------------------------------- */
25844			
25845		},
25846	
25847	
25848	
25849	
25850		
25851	/* 
25852	----------------------------------------
25853	FUNCTIONS
25854	----------------------------------------
25855	*/
25856	
25857		/* validates selector (if selector is invalid or undefined uses the default one) */
25858		_selector=function(){
25859			return (typeof $(this)!=="object" || $(this).length<1) ? defaultSelector : this;
25860		},
25861		/* -------------------- */
25862		
25863		
25864		/* changes options according to theme */
25865		_theme=function(obj){
25866			var fixedSizeScrollbarThemes=["rounded","rounded-dark","rounded-dots","rounded-dots-dark"],
25867				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"],
25868				disabledScrollButtonsThemes=["minimal","minimal-dark"],
25869				enabledAutoHideScrollbarThemes=["minimal","minimal-dark"],
25870				scrollbarPositionOutsideThemes=["minimal","minimal-dark"];
25871			obj.autoDraggerLength=$.inArray(obj.theme,fixedSizeScrollbarThemes) > -1 ? false : obj.autoDraggerLength;
25872			obj.autoExpandScrollbar=$.inArray(obj.theme,nonExpandedScrollbarThemes) > -1 ? false : obj.autoExpandScrollbar;
25873			obj.scrollButtons.enable=$.inArray(obj.theme,disabledScrollButtonsThemes) > -1 ? false : obj.scrollButtons.enable;
25874			obj.autoHideScrollbar=$.inArray(obj.theme,enabledAutoHideScrollbarThemes) > -1 ? true : obj.autoHideScrollbar;
25875			obj.scrollbarPosition=$.inArray(obj.theme,scrollbarPositionOutsideThemes) > -1 ? "outside" : obj.scrollbarPosition;
25876		},
25877		/* -------------------- */
25878		
25879		
25880		/* live option timers removal */
25881		removeLiveTimers=function(selector){
25882			if(liveTimers[selector]){
25883				clearTimeout(liveTimers[selector]);
25884				_delete(liveTimers,selector);
25885			}
25886		},
25887		/* -------------------- */
25888		
25889		
25890		/* normalizes axis option to valid values: "y", "x", "yx" */
25891		_findAxis=function(val){
25892			return (val==="yx" || val==="xy" || val==="auto") ? "yx" : (val==="x" || val==="horizontal") ? "x" : "y";
25893		},
25894		/* -------------------- */
25895		
25896		
25897		/* normalizes scrollButtons.scrollType option to valid values: "stepless", "stepped" */
25898		_findScrollButtonsType=function(val){
25899			return (val==="stepped" || val==="pixels" || val==="step" || val==="click") ? "stepped" : "stepless";
25900		},
25901		/* -------------------- */
25902		
25903		
25904		/* generates plugin markup */
25905		_pluginMarkup=function(){
25906			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
25907				expandClass=o.autoExpandScrollbar ? " "+classes[1]+"_expand" : "",
25908				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>"],
25909				wrapperClass=o.axis==="yx" ? "mCSB_vertical_horizontal" : o.axis==="x" ? "mCSB_horizontal" : "mCSB_vertical",
25910				scrollbars=o.axis==="yx" ? scrollbar[0]+scrollbar[1] : o.axis==="x" ? scrollbar[1] : scrollbar[0],
25911				contentWrapper=o.axis==="yx" ? "<div id='mCSB_"+d.idx+"_container_wrapper' class='mCSB_container_wrapper' />" : "",
25912				autoHideClass=o.autoHideScrollbar ? " "+classes[6] : "",
25913				scrollbarDirClass=(o.axis!=="x" && d.langDir==="rtl") ? " "+classes[7] : "";
25914			if(o.setWidth){$this.css("width",o.setWidth);} /* set element width */
25915			if(o.setHeight){$this.css("height",o.setHeight);} /* set element height */
25916			o.setLeft=(o.axis!=="y" && d.langDir==="rtl") ? "989999px" : o.setLeft; /* adjust left position for rtl direction */
25917			$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>");
25918			var mCustomScrollBox=$("#mCSB_"+d.idx),
25919				mCSB_container=$("#mCSB_"+d.idx+"_container");
25920			if(o.axis!=="y" && !o.advanced.autoExpandHorizontalScroll){
25921				mCSB_container.css("width",_contentWidth(mCSB_container));
25922			}
25923			if(o.scrollbarPosition==="outside"){
25924				if($this.css("position")==="static"){ /* requires elements with non-static position */
25925					$this.css("position","relative");
25926				}
25927				$this.css("overflow","visible");
25928				mCustomScrollBox.addClass("mCSB_outside").after(scrollbars);
25929			}else{
25930				mCustomScrollBox.addClass("mCSB_inside").append(scrollbars);
25931				mCSB_container.wrap(contentWrapper);
25932			}
25933			_scrollButtons.call(this); /* add scrollbar buttons */
25934			/* minimum dragger length */
25935			var mCSB_dragger=[$("#mCSB_"+d.idx+"_dragger_vertical"),$("#mCSB_"+d.idx+"_dragger_horizontal")];
25936			mCSB_dragger[0].css("min-height",mCSB_dragger[0].height());
25937			mCSB_dragger[1].css("min-width",mCSB_dragger[1].width());
25938		},
25939		/* -------------------- */
25940		
25941		
25942		/* calculates content width */
25943		_contentWidth=function(el){
25944			var val=[el[0].scrollWidth,Math.max.apply(Math,el.children().map(function(){return $(this).outerWidth(true);}).get())],w=el.parent().width();
25945			return val[0]>w ? val[0] : val[1]>w ? val[1] : "100%";
25946		},
25947		/* -------------------- */
25948		
25949		
25950		/* expands content horizontally */
25951		_expandContentHorizontally=function(){
25952			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
25953				mCSB_container=$("#mCSB_"+d.idx+"_container");
25954			if(o.advanced.autoExpandHorizontalScroll && o.axis!=="y"){
25955				/* calculate scrollWidth */
25956				mCSB_container.css({"width":"auto","min-width":0,"overflow-x":"scroll"});
25957				var w=Math.ceil(mCSB_container[0].scrollWidth);
25958				if(o.advanced.autoExpandHorizontalScroll===3 || (o.advanced.autoExpandHorizontalScroll!==2 && w>mCSB_container.parent().width())){
25959					mCSB_container.css({"width":w,"min-width":"100%","overflow-x":"inherit"});
25960				}else{
25961					/* 
25962					wrap content with an infinite width div and set its position to absolute and width to auto. 
25963					Setting width to auto before calculating the actual width is important! 
25964					We must let the browser set the width as browser zoom values are impossible to calculate.
25965					*/
25966					mCSB_container.css({"overflow-x":"inherit","position":"absolute"})
25967						.wrap("<div class='mCSB_h_wrapper' style='position:relative; left:0; width:999999px;' />")
25968						.css({ /* set actual width, original position and un-wrap */
25969							/* 
25970							get the exact width (with decimals) and then round-up. 
25971							Using jquery outerWidth() will round the width value which will mess up with inner elements that have non-integer width
25972							*/
25973							"width":(Math.ceil(mCSB_container[0].getBoundingClientRect().right+0.4)-Math.floor(mCSB_container[0].getBoundingClientRect().left)),
25974							"min-width":"100%",
25975							"position":"relative"
25976						}).unwrap();
25977				}
25978			}
25979		},
25980		/* -------------------- */
25981		
25982		
25983		/* adds scrollbar buttons */
25984		_scrollButtons=function(){
25985			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
25986				mCSB_scrollTools=$(".mCSB_"+d.idx+"_scrollbar:first"),
25987				tabindex=!_isNumeric(o.scrollButtons.tabindex) ? "" : "tabindex='"+o.scrollButtons.tabindex+"'",
25988				btnHTML=[
25989					"<a href='#' class='"+classes[13]+"' "+tabindex+" />",
25990					"<a href='#' class='"+classes[14]+"' "+tabindex+" />",
25991					"<a href='#' class='"+classes[15]+"' "+tabindex+" 
25991><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>",
25992					"<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 25992-26415
259921,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>"
25993				],
25994				btn=[(o.axis==="x" ? btnHTML[2] : btnHTML[0]),(o.axis==="x" ? btnHTML[3] : btnHTML[1]),btnHTML[2],btnHTML[3]];
25995			if(o.scrollButtons.enable){
25996				mCSB_scrollTools.prepend(btn[0]).append(btn[1]).next(".mCSB_scrollTools").prepend(btn[2]).append(btn[3]);
25997			}
25998		},
25999		/* -------------------- */
26000		
26001		
26002		/* auto-adjusts scrollbar dragger length */
26003		_setDraggerLength=function(){
26004			var $this=$(this),d=$this.data(pluginPfx),
26005				mCustomScrollBox=$("#mCSB_"+d.idx),
26006				mCSB_container=$("#mCSB_"+d.idx+"_container"),
26007				mCSB_dragger=[$("#mCSB_"+d.idx+"_dragger_vertical"),$("#mCSB_"+d.idx+"_dragger_horizontal")],
26008				ratio=[mCustomScrollBox.height()/mCSB_container.outerHeight(false),mCustomScrollBox.width()/mCSB_container.outerWidth(false)],
26009				l=[
26010					parseInt(mCSB_dragger[0].css("min-height")),Math.round(ratio[0]*mCSB_dragger[0].parent().height()),
26011					parseInt(mCSB_dragger[1].css("min-width")),Math.round(ratio[1]*mCSB_dragger[1].parent().width())
26012				],
26013				h=oldIE && (l[1]<l[0]) ? l[0] : l[1],w=oldIE && (l[3]<l[2]) ? l[2] : l[3];
26014			mCSB_dragger[0].css({
26015				"height":h,"max-height":(mCSB_dragger[0].parent().height()-10)
26016			}).find(".mCSB_dragger_bar").css({"line-height":l[0]+"px"});
26017			mCSB_dragger[1].css({
26018				"width":w,"max-width":(mCSB_dragger[1].parent().width()-10)
26019			});
26020		},
26021		/* -------------------- */
26022		
26023		
26024		/* calculates scrollbar to content ratio */
26025		_scrollRatio=function(){
26026			var $this=$(this),d=$this.data(pluginPfx),
26027				mCustomScrollBox=$("#mCSB_"+d.idx),
26028				mCSB_container=$("#mCSB_"+d.idx+"_container"),
26029				mCSB_dragger=[$("#mCSB_"+d.idx+"_dragger_vertical"),$("#mCSB_"+d.idx+"_dragger_horizontal")],
26030				scrollAmount=[mCSB_container.outerHeight(false)-mCustomScrollBox.height(),mCSB_container.outerWidth(false)-mCustomScrollBox.width()],
26031				ratio=[
26032					scrollAmount[0]/(mCSB_dragger[0].parent().height()-mCSB_dragger[0].height()),
26033					scrollAmount[1]/(mCSB_dragger[1].parent().width()-mCSB_dragger[1].width())
26034				];
26035			d.scrollRatio={y:ratio[0],x:ratio[1]};
26036		},
26037		/* -------------------- */
26038		
26039		
26040		/* toggles scrolling classes */
26041		_onDragClasses=function(el,action,xpnd){
26042			var expandClass=xpnd ? classes[0]+"_expanded" : "",
26043				scrollbar=el.closest(".mCSB_scrollTools");
26044			if(action==="active"){
26045				el.toggleClass(classes[0]+" "+expandClass); scrollbar.toggleClass(classes[1]); 
26046				el[0]._draggable=el[0]._draggable ? 0 : 1;
26047			}else{
26048				if(!el[0]._draggable){
26049					if(action==="hide"){
26050						el.removeClass(classes[0]); scrollbar.removeClass(classes[1]);
26051					}else{
26052						el.addClass(classes[0]); scrollbar.addClass(classes[1]);
26053					}
26054				}
26055			}
26056		},
26057		/* -------------------- */
26058		
26059		
26060		/* checks if content overflows its container to determine if scrolling is required */
26061		_overflowed=function(){
26062			var $this=$(this),d=$this.data(pluginPfx),
26063				mCustomScrollBox=$("#mCSB_"+d.idx),
26064				mCSB_container=$("#mCSB_"+d.idx+"_container"),
26065				contentHeight=d.overflowed==null ? mCSB_container.height() : mCSB_container.outerHeight(false),
26066				contentWidth=d.overflowed==null ? mCSB_container.width() : mCSB_container.outerWidth(false),
26067				h=mCSB_container[0].scrollHeight,w=mCSB_container[0].scrollWidth;
26068			if(h>contentHeight){contentHeight=h;}
26069			if(w>contentWidth){contentWidth=w;}
26070			return [contentHeight>mCustomScrollBox.height(),contentWidth>mCustomScrollBox.width()];
26071		},
26072		/* -------------------- */
26073		
26074		
26075		/* resets content position to 0 */
26076		_resetContentPosition=function(){
26077			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
26078				mCustomScrollBox=$("#mCSB_"+d.idx),
26079				mCSB_container=$("#mCSB_"+d.idx+"_container"),
26080				mCSB_dragger=[$("#mCSB_"+d.idx+"_dragger_vertical"),$("#mCSB_"+d.idx+"_dragger_horizontal")];
26081			_stop($this); /* stop any current scrolling before resetting */
26082			if((o.axis!=="x" && !d.overflowed[0]) || (o.axis==="y" && d.overflowed[0])){ /* reset y */
26083				mCSB_dragger[0].add(mCSB_container).css("top",0);
26084				_scrollTo($this,"_resetY");
26085			}
26086			if((o.axis!=="y" && !d.overflowed[1]) || (o.axis==="x" && d.overflowed[1])){ /* reset x */
26087				var cx=dx=0;
26088				if(d.langDir==="rtl"){ /* adjust left position for rtl direction */
26089					cx=mCustomScrollBox.width()-mCSB_container.outerWidth(false);
26090					dx=Math.abs(cx/d.scrollRatio.x);
26091				}
26092				mCSB_container.css("left",cx);
26093				mCSB_dragger[1].css("left",dx);
26094				_scrollTo($this,"_resetX");
26095			}
26096		},
26097		/* -------------------- */
26098		
26099		
26100		/* binds scrollbar events */
26101		_bindEvents=function(){
26102			var $this=$(this),d=$this.data(pluginPfx),o=d.opt;
26103			if(!d.bindEvents){ /* check if events are already bound */
26104				_draggable.call(this);
26105				if(o.contentTouchScroll){_contentDraggable.call(this);}
26106				_selectable.call(this);
26107				if(o.mouseWheel.enable){ /* bind mousewheel fn when plugin is available */
26108					function _mwt(){
26109						mousewheelTimeout=setTimeout(function(){
26110							if(!$.event.special.mousewheel){
26111								_mwt();
26112							}else{
26113								clearTimeout(mousewheelTimeout);
26114								_mousewheel.call($this[0]);
26115							}
26116						},100);
26117					}
26118					var mousewheelTimeout;
26119					_mwt();
26120				}
26121				_draggerRail.call(this);
26122				_wrapperScroll.call(this);
26123				if(o.advanced.autoScrollOnFocus){_focus.call(this);}
26124				if(o.scrollButtons.enable){_buttons.call(this);}
26125				if(o.keyboard.enable){_keyboard.call(this);}
26126				d.bindEvents=true;
26127			}
26128		},
26129		/* -------------------- */
26130		
26131		
26132		/* unbinds scrollbar events */
26133		_unbindEvents=function(){
26134			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
26135				namespace=pluginPfx+"_"+d.idx,
26136				sb=".mCSB_"+d.idx+"_scrollbar",
26137				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"),
26138				mCSB_container=$("#mCSB_"+d.idx+"_container");
26139			if(o.advanced.releaseDraggableSelectors){sel.add($(o.advanced.releaseDraggableSelectors));}
26140			if(o.advanced.extraDraggableSelectors){sel.add($(o.advanced.extraDraggableSelectors));}
26141			if(d.bindEvents){ /* check if events are bound */
26142				/* unbind namespaced events from document/selectors */
26143				$(document).add($(!_canAccessIFrame() || top.document)).unbind("."+namespace);
26144				sel.each(function(){
26145					$(this).unbind("."+namespace);
26146				});
26147				/* clear and delete timeouts/objects */
26148				clearTimeout($this[0]._focusTimeout); _delete($this[0],"_focusTimeout");
26149				clearTimeout(d.sequential.step); _delete(d.sequential,"step");
26150				clearTimeout(mCSB_container[0].onCompleteTimeout); _delete(mCSB_container[0],"onCompleteTimeout");
26151				d.bindEvents=false;
26152			}
26153		},
26154		/* -------------------- */
26155		
26156		
26157		/* toggles scrollbar visibility */
26158		_scrollbarVisibility=function(disabled){
26159			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
26160				contentWrapper=$("#mCSB_"+d.idx+"_container_wrapper"),
26161				content=contentWrapper.length ? contentWrapper : $("#mCSB_"+d.idx+"_container"),
26162				scrollbar=[$("#mCSB_"+d.idx+"_scrollbar_vertical"),$("#mCSB_"+d.idx+"_scrollbar_horizontal")],
26163				mCSB_dragger=[scrollbar[0].find(".mCSB_dragger"),scrollbar[1].find(".mCSB_dragger")];
26164			if(o.axis!=="x"){
26165				if(d.overflowed[0] && !disabled){
26166					scrollbar[0].add(mCSB_dragger[0]).add(scrollbar[0].children("a")).css("display","block");
26167					content.removeClass(classes[8]+" "+classes[10]);
26168				}else{
26169					if(o.alwaysShowScrollbar){
26170						if(o.alwaysShowScrollbar!==2){mCSB_dragger[0].css("display","none");}
26171						content.removeClass(classes[10]);
26172					}else{
26173						scrollbar[0].css("display","none");
26174						content.addClass(classes[10]);
26175					}
26176					content.addClass(classes[8]);
26177				}
26178			}
26179			if(o.axis!=="y"){
26180				if(d.overflowed[1] && !disabled){
26181					scrollbar[1].add(mCSB_dragger[1]).add(scrollbar[1].children("a")).css("display","block");
26182					content.removeClass(classes[9]+" "+classes[11]);
26183				}else{
26184					if(o.alwaysShowScrollbar){
26185						if(o.alwaysShowScrollbar!==2){mCSB_dragger[1].css("display","none");}
26186						content.removeClass(classes[11]);
26187					}else{
26188						scrollbar[1].css("display","none");
26189						content.addClass(classes[11]);
26190					}
26191					content.addClass(classes[9]);
26192				}
26193			}
26194			if(!d.overflowed[0] && !d.overflowed[1]){
26195				$this.addClass(classes[5]);
26196			}else{
26197				$this.removeClass(classes[5]);
26198			}
26199		},
26200		/* -------------------- */
26201		
26202		
26203		/* returns input coordinates of pointer, touch and mouse events (relative to document) */
26204		_coordinates=function(e){
26205			var t=e.type,o=e.target.ownerDocument!==document && frameElement!==null ? [$(frameElement).offset().top,$(frameElement).offset().left] : null,
26206				io=_canAccessIFrame() && e.target.ownerDocument!==top.document && frameElement!==null ? [$(e.view.frameElement).offset().top,$(e.view.frameElement).offset().left] : [0,0];
26207			switch(t){
26208				case "pointerdown": case "MSPointerDown": case "pointermove": case "MSPointerMove": case "pointerup": case "MSPointerUp":
26209					return o ? [e.originalEvent.pageY-o[0]+io[0],e.originalEvent.pageX-o[1]+io[1],false] : [e.originalEvent.pageY,e.originalEvent.pageX,false];
26210					break;
26211				case "touchstart": case "touchmove": case "touchend":
26212					var touch=e.originalEvent.touches[0] || e.originalEvent.changedTouches[0],
26213						touches=e.originalEvent.touches.length || e.originalEvent.changedTouches.length;
26214					return e.target.ownerDocument!==document ? [touch.screenY,touch.screenX,touches>1] : [touch.pageY,touch.pageX,touches>1];
26215					break;
26216				default:
26217					return o ? [e.pageY-o[0]+io[0],e.pageX-o[1]+io[1],false] : [e.pageY,e.pageX,false];
26218			}
26219		},
26220		/* -------------------- */
26221		
26222		
26223		/* 
26224		SCROLLBAR DRAG EVENTS
26225		scrolls content via scrollbar dragging 
26226		*/
26227		_draggable=function(){
26228			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
26229				namespace=pluginPfx+"_"+d.idx,
26230				draggerId=["mCSB_"+d.idx+"_dragger_vertical","mCSB_"+d.idx+"_dragger_horizontal"],
26231				mCSB_container=$("#mCSB_"+d.idx+"_container"),
26232				mCSB_dragger=$("#"+draggerId[0]+",#"+draggerId[1]),
26233				draggable,dragY,dragX,
26234				rds=o.advanced.releaseDraggableSelectors ? mCSB_dragger.add($(o.advanced.releaseDraggableSelectors)) : mCSB_dragger,
26235				eds=o.advanced.extraDraggableSelectors ? $(!_canAccessIFrame() || top.document).add($(o.advanced.extraDraggableSelectors)) : $(!_canAccessIFrame() || top.document);
26236			mCSB_dragger.bind("contextmenu."+namespace,function(e){
26237				e.preventDefault(); //prevent right click
26238			}).bind("mousedown."+namespace+" touchstart."+namespace+" pointerdown."+namespace+" MSPointerDown."+namespace,function(e){
26239				e.stopImmediatePropagation();
26240				e.preventDefault();
26241				if(!_mouseBtnLeft(e)){return;} /* left mouse button only */
26242				touchActive=true;
26243				if(oldIE){document.onselectstart=function(){return false;}} /* disable text selection for IE < 9 */
26244				_iframe.call(mCSB_container,false); /* enable scrollbar dragging over iframes by disabling their events */
26245				_stop($this);
26246				draggable=$(this);
26247				var offset=draggable.offset(),y=_coordinates(e)[0]-offset.top,x=_coordinates(e)[1]-offset.left,
26248					h=draggable.height()+offset.top,w=draggable.width()+offset.left;
26249				if(y<h && y>0 && x<w && x>0){
26250					dragY=y; 
26251					dragX=x;
26252				}
26253				_onDragClasses(draggable,"active",o.autoExpandScrollbar); 
26254			}).bind("touchmove."+namespace,function(e){
26255				e.stopImmediatePropagation();
26256				e.preventDefault();
26257				var offset=draggable.offset(),y=_coordinates(e)[0]-offset.top,x=_coordinates(e)[1]-offset.left;
26258				_drag(dragY,dragX,y,x);
26259			});
26260			$(document).add(eds).bind("mousemove."+namespace+" pointermove."+namespace+" MSPointerMove."+namespace,function(e){
26261				if(draggable){
26262					var offset=draggable.offset(),y=_coordinates(e)[0]-offset.top,x=_coordinates(e)[1]-offset.left;
26263					if(dragY===y && dragX===x){return;} /* has it really moved? */
26264					_drag(dragY,dragX,y,x);
26265				}
26266			}).add(rds).bind("mouseup."+namespace+" touchend."+namespace+" pointerup."+namespace+" MSPointerUp."+namespace,function(e){
26267				if(draggable){
26268					_onDragClasses(draggable,"active",o.autoExpandScrollbar); 
26269					draggable=null;
26270				}
26271				touchActive=false;
26272				if(oldIE){document.onselectstart=null;} /* enable text selection for IE < 9 */
26273				_iframe.call(mCSB_container,true); /* enable iframes events */
26274			});
26275			function _drag(dragY,dragX,y,x){
26276				mCSB_container[0].idleTimer=o.scrollInertia<233 ? 250 : 0;
26277				if(draggable.attr("id")===draggerId[1]){
26278					var dir="x",to=((draggable[0].offsetLeft-dragX)+x)*d.scrollRatio.x;
26279				}else{
26280					var dir="y",to=((draggable[0].offsetTop-dragY)+y)*d.scrollRatio.y;
26281				}
26282				_scrollTo($this,to.toString(),{dir:dir,drag:true});
26283			}
26284		},
26285		/* -------------------- */
26286		
26287		
26288		/* 
26289		TOUCH SWIPE EVENTS
26290		scrolls content via touch swipe 
26291		Emulates the native touch-swipe scrolling with momentum found in iOS, Android and WP devices 
26292		*/
26293		_contentDraggable=function(){
26294			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
26295				namespace=pluginPfx+"_"+d.idx,
26296				mCustomScrollBox=$("#mCSB_"+d.idx),
26297				mCSB_container=$("#mCSB_"+d.idx+"_container"),
26298				mCSB_dragger=[$("#mCSB_"+d.idx+"_dragger_vertical"),$("#mCSB_"+d.idx+"_dragger_horizontal")],
26299				draggable,dragY,dragX,touchStartY,touchStartX,touchMoveY=[],touchMoveX=[],startTime,runningTime,endTime,distance,speed,amount,
26300				durA=0,durB,overwrite=o.axis==="yx" ? "none" : "all",touchIntent=[],touchDrag,docDrag,
26301				iframe=mCSB_container.find("iframe"),
26302				events=[
26303					"touchstart."+namespace+" pointerdown."+namespace+" MSPointerDown."+namespace, //start
26304					"touchmove."+namespace+" pointermove."+namespace+" MSPointerMove."+namespace, //move
26305					"touchend."+namespace+" pointerup."+namespace+" MSPointerUp."+namespace //end
26306				],
26307				touchAction=document.body.style.touchAction!==undefined && document.body.style.touchAction!=="";
26308			mCSB_container.bind(events[0],function(e){
26309				_onTouchstart(e);
26310			}).bind(events[1],function(e){
26311				_onTouchmove(e);
26312			});
26313			mCustomScrollBox.bind(events[0],function(e){
26314				_onTouchstart2(e);
26315			}).bind(events[2],function(e){
26316				_onTouchend(e);
26317			});
26318			if(iframe.length){
26319				iframe.each(function(){
26320					$(this).bind("load",function(){
26321						/* bind events on accessible iframes */
26322						if(_canAccessIFrame(this)){
26323							$(this.contentDocument || this.contentWindow.document).bind(events[0],function(e){
26324								_onTouchstart(e);
26325								_onTouchstart2(e);
26326							}).bind(events[1],function(e){
26327								_onTouchmove(e);
26328							}).bind(events[2],function(e){
26329								_onTouchend(e);
26330							});
26331						}
26332					});
26333				});
26334			}
26335			function _onTouchstart(e){
26336				if(!_pointerTouch(e) || touchActive || _coordinates(e)[2]){touchable=0; return;}
26337
26338				if($(e.target).closest('.bx_ui_slider_track').length){
26339					touchOffCustom = true;
26340					touchable=0; return;
26341				} else {
26342					touchOffCustom = false;
26343				}
26344
26345				touchable=1; touchDrag=0; docDrag=0; draggable=1;
26346				$this.removeClass("mCS_touch_action");
26347				var offset=mCSB_container.offset();
26348				dragY=_coordinates(e)[0]-offset.top;
26349				dragX=_coordinates(e)[1]-offset.left;
26350				touchIntent=[_coordinates(e)[0],_coordinates(e)[1]];
26351
26352			}
26353			function _onTouchmove(e){
26354				if(!_pointerTouch(e) || touchActive || _coordinates(e)[2]){return;}
26355
26356				if(touchOffCustom){
26357					touchable=0; return;
26358				}
26359
26360				if(!o.documentTouchScroll){e.preventDefault();} 
26361				e.stopImmediatePropagation();
26362				if(docDrag && !touchDrag){return;}
26363				if(draggable){
26364					runningTime=_getTime();
26365					var offset=mCustomScrollBox.offset(),y=_coordinates(e)[0]-offset.top,x=_coordinates(e)[1]-offset.left,
26366						easing="mcsLinearOut";
26367					touchMoveY.push(y);
26368					touchMoveX.push(x);
26369					touchIntent[2]=Math.abs(_coordinates(e)[0]-touchIntent[0]); touchIntent[3]=Math.abs(_coordinates(e)[1]-touchIntent[1]);
26370					if(d.overflowed[0]){
26371						var limit=mCSB_dragger[0].parent().height()-mCSB_dragger[0].height(),
26372							prevent=((dragY-y)>0 && (y-dragY)>-(limit*d.scrollRatio.y) && (touchIntent[3]*2<touchIntent[2] || o.axis==="yx"));
26373					}
26374					if(d.overflowed[1]){
26375						var limitX=mCSB_dragger[1].parent().width()-mCSB_dragger[1].width(),
26376							preventX=((dragX-x)>0 && (x-dragX)>-(limitX*d.scrollRatio.x) && (touchIntent[2]*2<touchIntent[3] || o.axis==="yx"));
26377					}
26378					if(prevent || preventX){ /* prevent native document scrolling */
26379						if(!touchAction){e.preventDefault();} 
26380						touchDrag=1;
26381					}else{
26382						docDrag=1;
26383						$this.addClass("mCS_touch_action");
26384					}
26385					if(touchAction){e.preventDefault();} 
26386					amount=o.axis==="yx" ? [(dragY-y),(dragX-x)] : o.axis==="x" ? [null,(dragX-x)] : [(dragY-y),null];
26387					mCSB_container[0].idleTimer=250;
26388					if(d.overflowed[0]){_drag(amount[0],durA,easing,"y","all",true);}
26389					if(d.overflowed[1]){_drag(amount[1],durA,easing,"x",overwrite,true);}
26390				}
26391			}
26392			function _onTouchstart2(e){
26393				if(!_pointerTouch(e) || touchActive || _coordinates(e)[2]){touchable=0; return;}
26394
26395				if($(e.target).closest('.bx_ui_slider_track').length){
26396					touchOffCustom = true;
26397					touchable=0; return;
26398				} else {
26399					touchOffCustom = false;
26400				}
26401
26402				touchable=1;
26403				e.stopImmediatePropagation();
26404				_stop($this);
26405				startTime=_getTime();
26406				var offset=mCustomScrollBox.offset();
26407				touchStartY=_coordinates(e)[0]-offset.top;
26408				touchStartX=_coordinates(e)[1]-offset.left;
26409				touchMoveY=[]; touchMoveX=[];
26410			}
26411			function _onTouchend(e){				
26412				if(!_pointerTouch(e) || touchActive || _coordinates(e)[2]){return;}
26413
26414				if($(e.target).closest('.bx_ui_slider_track').length){
26415					touchOffCustom = false;
26416					touchable=0; return;
26417				}
vendor: 13,509 bytes, lines 26418-26761
26418
26419				draggable=0;
26420				e.stopImmediatePropagation();
26421				touchDrag=0; docDrag=0;
26422				endTime=_getTime();
26423				var offset=mCustomScrollBox.offset(),y=_coordinates(e)[0]-offset.top,x=_coordinates(e)[1]-offset.left;
26424				if((endTime-runningTime)>30){return;}
26425				speed=1000/(endTime-startTime);
26426				var easing="mcsEaseOut",slow=speed<2.5,
26427					diff=slow ? [touchMoveY[touchMoveY.length-2],touchMoveX[touchMoveX.length-2]] : [0,0];
26428				distance=slow ? [(y-diff[0]),(x-diff[1])] : [y-touchStartY,x-touchStartX];
26429				var absDistance=[Math.abs(distance[0]),Math.abs(distance[1])];
26430				speed=slow ? [Math.abs(distance[0]/4),Math.abs(distance[1]/4)] : [speed,speed];
26431				var a=[
26432					Math.abs(mCSB_container[0].offsetTop)-(distance[0]*_m((absDistance[0]/speed[0]),speed[0])),
26433					Math.abs(mCSB_container[0].offsetLeft)-(distance[1]*_m((absDistance[1]/speed[1]),speed[1]))
26434				];
26435				amount=o.axis==="yx" ? [a[0],a[1]] : o.axis==="x" ? [null,a[1]] : [a[0],null];
26436				durB=[(absDistance[0]*4)+o.scrollInertia,(absDistance[1]*4)+o.scrollInertia];
26437				var md=parseInt(o.contentTouchScroll) || 0; /* absolute minimum distance required */
26438				amount[0]=absDistance[0]>md ? amount[0] : 0;
26439				amount[1]=absDistance[1]>md ? amount[1] : 0;
26440				if(d.overflowed[0]){_drag(amount[0],durB[0],easing,"y",overwrite,false);}
26441				if(d.overflowed[1]){_drag(amount[1],durB[1],easing,"x",overwrite,false);}
26442			}
26443			function _m(ds,s){
26444				var r=[s*1.5,s*2,s/1.5,s/2];
26445				if(ds>90){
26446					return s>4 ? r[0] : r[3];
26447				}else if(ds>60){
26448					return s>3 ? r[3] : r[2];
26449				}else if(ds>30){
26450					return s>8 ? r[1] : s>6 ? r[0] : s>4 ? s : r[2];
26451				}else{
26452					return s>8 ? s : r[3];
26453				}
26454			}
26455			function _drag(amount,dur,easing,dir,overwrite,drag){
26456				if(!amount){return;}
26457				_scrollTo($this,amount.toString(),{dur:dur,scrollEasing:easing,dir:dir,overwrite:overwrite,drag:drag});
26458			}
26459		},
26460		/* -------------------- */
26461		
26462		
26463		/* 
26464		SELECT TEXT EVENTS 
26465		scrolls content when text is selected 
26466		*/
26467		_selectable=function(){
26468			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,seq=d.sequential,
26469				namespace=pluginPfx+"_"+d.idx,
26470				mCSB_container=$("#mCSB_"+d.idx+"_container"),
26471				wrapper=mCSB_container.parent(),
26472				action;
26473			mCSB_container.bind("mousedown."+namespace,function(e){
26474				if(touchable){return;}
26475				if(!action){action=1; touchActive=true;}
26476			}).add(document).bind("mousemove."+namespace,function(e){
26477				if(!touchable && action && _sel()){
26478					var offset=mCSB_container.offset(),
26479						y=_coordinates(e)[0]-offset.top+mCSB_container[0].offsetTop,x=_coordinates(e)[1]-offset.left+mCSB_container[0].offsetLeft;
26480					if(y>0 && y<wrapper.height() && x>0 && x<wrapper.width()){
26481						if(seq.step){_seq("off",null,"stepped");}
26482					}else{
26483						if(o.axis!=="x" && d.overflowed[0]){
26484							if(y<0){
26485								_seq("on",38);
26486							}else if(y>wrapper.height()){
26487								_seq("on",40);
26488							}
26489						}
26490						if(o.axis!=="y" && d.overflowed[1]){
26491							if(x<0){
26492								_seq("on",37);
26493							}else if(x>wrapper.width()){
26494								_seq("on",39);
26495							}
26496						}
26497					}
26498				}
26499			}).bind("mouseup."+namespace+" dragend."+namespace,function(e){
26500				if(touchable){return;}
26501				if(action){action=0; _seq("off",null);}
26502				touchActive=false;
26503			});
26504			function _sel(){
26505				return 	window.getSelection ? window.getSelection().toString() : 
26506						document.selection && document.selection.type!="Control" ? document.selection.createRange().text : 0;
26507			}
26508			function _seq(a,c,s){
26509				seq.type=s && action ? "stepped" : "stepless";
26510				seq.scrollAmount=10;
26511				_sequentialScroll($this,a,c,"mcsLinearOut",s ? 60 : null);
26512			}
26513		},
26514		/* -------------------- */
26515		
26516		
26517		/* 
26518		MOUSE WHEEL EVENT
26519		scrolls content via mouse-wheel 
26520		via mouse-wheel plugin (https://github.com/brandonaaron/jquery-mousewheel)
26521		*/
26522		_mousewheel=function(){
26523			if(!$(this).data(pluginPfx)){return;} /* Check if the scrollbar is ready to use mousewheel events (issue: #185) */
26524			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
26525				namespace=pluginPfx+"_"+d.idx,
26526				mCustomScrollBox=$("#mCSB_"+d.idx),
26527				mCSB_dragger=[$("#mCSB_"+d.idx+"_dragger_vertical"),$("#mCSB_"+d.idx+"_dragger_horizontal")],
26528				iframe=$("#mCSB_"+d.idx+"_container").find("iframe");
26529			if(iframe.length){
26530				iframe.each(function(){
26531					$(this).bind("load",function(){
26532						/* bind events on accessible iframes */
26533						if(_canAccessIFrame(this)){
26534							$(this.contentDocument || this.contentWindow.document).bind("mousewheel."+namespace,function(e,delta){
26535								_onMousewheel(e,delta);
26536							});
26537						}
26538					});
26539				});
26540			}
26541			mCustomScrollBox.bind("mousewheel."+namespace,function(e,delta){
26542				_onMousewheel(e,delta);
26543			});
26544			function _onMousewheel(e,delta){
26545				_stop($this);
26546				if(_disableMousewheel($this,e.target)){return;} /* disables mouse-wheel when hovering specific elements */
26547				var deltaFactor=o.mouseWheel.deltaFactor!=="auto" ? parseInt(o.mouseWheel.deltaFactor) : (oldIE && e.deltaFactor<100) ? 100 : e.deltaFactor || 100,
26548					dur=o.scrollInertia;
26549				if(o.axis==="x" || o.mouseWheel.axis==="x"){
26550					var dir="x",
26551						px=[Math.round(deltaFactor*d.scrollRatio.x),parseInt(o.mouseWheel.scrollAmount)],
26552						amount=o.mouseWheel.scrollAmount!=="auto" ? px[1] : px[0]>=mCustomScrollBox.width() ? mCustomScrollBox.width()*0.9 : px[0],
26553						contentPos=Math.abs($("#mCSB_"+d.idx+"_container")[0].offsetLeft),
26554						draggerPos=mCSB_dragger[1][0].offsetLeft,
26555						limit=mCSB_dragger[1].parent().width()-mCSB_dragger[1].width(),
26556						dlt=o.mouseWheel.axis==="y" ? (e.deltaY || delta) : e.deltaX;
26557				}else{
26558					var dir="y",
26559						px=[Math.round(deltaFactor*d.scrollRatio.y),parseInt(o.mouseWheel.scrollAmount)],
26560						amount=o.mouseWheel.scrollAmount!=="auto" ? px[1] : px[0]>=mCustomScrollBox.height() ? mCustomScrollBox.height()*0.9 : px[0],
26561						contentPos=Math.abs($("#mCSB_"+d.idx+"_container")[0].offsetTop),
26562						draggerPos=mCSB_dragger[0][0].offsetTop,
26563						limit=mCSB_dragger[0].parent().height()-mCSB_dragger[0].height(),
26564						dlt=e.deltaY || delta;
26565				}
26566				if((dir==="y" && !d.overflowed[0]) || (dir==="x" && !d.overflowed[1])){return;}
26567				if(o.mouseWheel.invert || e.webkitDirectionInvertedFromDevice){dlt=-dlt;}
26568				if(o.mouseWheel.normalizeDelta){dlt=dlt<0 ? -1 : 1;}
26569				if((dlt>0 && draggerPos!==0) || (dlt<0 && draggerPos!==limit) || o.mouseWheel.preventDefault){
26570					e.stopImmediatePropagation();
26571					e.preventDefault();
26572				}
26573				if(e.deltaFactor<5 && !o.mouseWheel.normalizeDelta){
26574					//very low deltaFactor values mean some kind of delta acceleration (e.g. osx trackpad), so adjusting scrolling accordingly
26575					amount=e.deltaFactor; dur=17;
26576				}
26577				_scrollTo($this,(contentPos-(dlt*amount)).toString(),{dir:dir,dur:dur});
26578			}
26579		},
26580		/* -------------------- */
26581		
26582		
26583		/* checks if iframe can be accessed */
26584		_canAccessIFrameCache=new Object(),
26585		_canAccessIFrame=function(iframe){
26586		    var result=false,cacheKey=false,html=null;
26587		    if(iframe===undefined){
26588				cacheKey="#empty";
26589		    }else if($(iframe).attr("id")!==undefined){
26590				cacheKey=$(iframe).attr("id");
26591		    }
26592			if(cacheKey!==false && _canAccessIFrameCache[cacheKey]!==undefined){
26593				return _canAccessIFrameCache[cacheKey];
26594			}
26595			if(!iframe){
26596				try{
26597					var doc=top.document;
26598					html=doc.body.innerHTML;
26599				}catch(err){/* do nothing */}
26600				result=(html!==null);
26601			}else{
26602				try{
26603					var doc=iframe.contentDocument || iframe.contentWindow.document;
26604					html=doc.body.innerHTML;
26605				}catch(err){/* do nothing */}
26606				result=(html!==null);
26607			}
26608			if(cacheKey!==false){_canAccessIFrameCache[cacheKey]=result;}
26609			return result;
26610		},
26611		/* -------------------- */
26612		
26613		
26614		/* switches iframe's pointer-events property (drag, mousewheel etc. over cross-domain iframes) */
26615		_iframe=function(evt){
26616			var el=this.find("iframe");
26617			if(!el.length){return;} /* check if content contains iframes */
26618			var val=!evt ? "none" : "auto";
26619			el.css("pointer-events",val); /* for IE11, iframe's display property should not be "block" */
26620		},
26621		/* -------------------- */
26622		
26623		
26624		/* disables mouse-wheel when hovering specific elements like select, datalist etc. */
26625		_disableMousewheel=function(el,target){
26626			var tag=target.nodeName.toLowerCase(),
26627				tags=el.data(pluginPfx).opt.mouseWheel.disableOver,
26628				/* elements that require focus */
26629				focusTags=["select","textarea"];
26630			return $.inArray(tag,tags) > -1 && !($.inArray(tag,focusTags) > -1 && !$(target).is(":focus"));
26631		},
26632		/* -------------------- */
26633		
26634		
26635		/* 
26636		DRAGGER RAIL CLICK EVENT
26637		scrolls content via dragger rail 
26638		*/
26639		_draggerRail=function(){
26640			var $this=$(this),d=$this.data(pluginPfx),
26641				namespace=pluginPfx+"_"+d.idx,
26642				mCSB_container=$("#mCSB_"+d.idx+"_container"),
26643				wrapper=mCSB_container.parent(),
26644				mCSB_draggerContainer=$(".mCSB_"+d.idx+"_scrollbar ."+classes[12]),
26645				clickable;
26646			mCSB_draggerContainer.bind("mousedown."+namespace+" touchstart."+namespace+" pointerdown."+namespace+" MSPointerDown."+namespace,function(e){
26647				touchActive=true;
26648				if(!$(e.target).hasClass("mCSB_dragger")){clickable=1;}
26649			}).bind("touchend."+namespace+" pointerup."+namespace+" MSPointerUp."+namespace,function(e){
26650				touchActive=false;
26651			}).bind("click."+namespace,function(e){
26652				if(!clickable){return;}
26653				clickable=0;
26654				if($(e.target).hasClass(classes[12]) || $(e.target).hasClass("mCSB_draggerRail")){
26655					_stop($this);
26656					var el=$(this),mCSB_dragger=el.find(".mCSB_dragger");
26657					if(el.parent(".mCSB_scrollTools_horizontal").length>0){
26658						if(!d.overflowed[1]){return;}
26659						var dir="x",
26660							clickDir=e.pageX>mCSB_dragger.offset().left ? -1 : 1,
26661							to=Math.abs(mCSB_container[0].offsetLeft)-(clickDir*(wrapper.width()*0.9));
26662					}else{
26663						if(!d.overflowed[0]){return;}
26664						var dir="y",
26665							clickDir=e.pageY>mCSB_dragger.offset().top ? -1 : 1,
26666							to=Math.abs(mCSB_container[0].offsetTop)-(clickDir*(wrapper.height()*0.9));
26667					}
26668					_scrollTo($this,to.toString(),{dir:dir,scrollEasing:"mcsEaseInOut"});
26669				}
26670			});
26671		},
26672		/* -------------------- */
26673		
26674		
26675		/* 
26676		FOCUS EVENT
26677		scrolls content via element focus (e.g. clicking an input, pressing TAB key etc.)
26678		*/
26679		_focus=function(){
26680			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
26681				namespace=pluginPfx+"_"+d.idx,
26682				mCSB_container=$("#mCSB_"+d.idx+"_container"),
26683				wrapper=mCSB_container.parent();
26684			mCSB_container.bind("focusin."+namespace,function(e){
26685				var el=$(document.activeElement),
26686					nested=mCSB_container.find(".mCustomScrollBox").length,
26687					dur=0;
26688				if(!el.is(o.advanced.autoScrollOnFocus)){return;}
26689				_stop($this);
26690				clearTimeout($this[0]._focusTimeout);
26691				$this[0]._focusTimer=nested ? (dur+17)*nested : 0;
26692				$this[0]._focusTimeout=setTimeout(function(){
26693					var	to=[_childPos(el)[0],_childPos(el)[1]],
26694						contentPos=[mCSB_container[0].offsetTop,mCSB_container[0].offsetLeft],
26695						isVisible=[
26696							(contentPos[0]+to[0]>=0 && contentPos[0]+to[0]<wrapper.height()-el.outerHeight(false)),
26697							(contentPos[1]+to[1]>=0 && contentPos[0]+to[1]<wrapper.width()-el.outerWidth(false))
26698						],
26699						overwrite=(o.axis==="yx" && !isVisible[0] && !isVisible[1]) ? "none" : "all";
26700					if(o.axis!=="x" && !isVisible[0]){
26701						_scrollTo($this,to[0].toString(),{dir:"y",scrollEasing:"mcsEaseInOut",overwrite:overwrite,dur:dur});
26702					}
26703					if(o.axis!=="y" && !isVisible[1]){
26704						_scrollTo($this,to[1].toString(),{dir:"x",scrollEasing:"mcsEaseInOut",overwrite:overwrite,dur:dur});
26705					}
26706				},$this[0]._focusTimer);
26707			});
26708		},
26709		/* -------------------- */
26710		
26711		
26712		/* sets content wrapper scrollTop/scrollLeft always to 0 */
26713		_wrapperScroll=function(){
26714			var $this=$(this),d=$this.data(pluginPfx),
26715				namespace=pluginPfx+"_"+d.idx,
26716				wrapper=$("#mCSB_"+d.idx+"_container").parent();
26717			wrapper.bind("scroll."+namespace,function(e){
26718				if(wrapper.scrollTop()!==0 || wrapper.scrollLeft()!==0){
26719					$(".mCSB_"+d.idx+"_scrollbar").css("visibility","hidden"); /* hide scrollbar(s) */
26720				}
26721			});
26722		},
26723		/* -------------------- */
26724		
26725		
26726		/* 
26727		BUTTONS EVENTS
26728		scrolls content via up, down, left and right buttons 
26729		*/
26730		_buttons=function(){
26731			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,seq=d.sequential,
26732				namespace=pluginPfx+"_"+d.idx,
26733				sel=".mCSB_"+d.idx+"_scrollbar",
26734				btn=$(sel+">a");
26735			btn.bind("contextmenu."+namespace,function(e){
26736				e.preventDefault(); //prevent right click
26737			}).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){
26738				e.preventDefault();
26739				if(!_mouseBtnLeft(e)){return;} /* left mouse button only */
26740				var btnClass=$(this).attr("class");
26741				seq.type=o.scrollButtons.scrollType;
26742				switch(e.type){
26743					case "mousedown": case "touchstart": case "pointerdown": case "MSPointerDown":
26744						if(seq.type==="stepped"){return;}
26745						touchActive=true;
26746						d.tweenRunning=false;
26747						_seq("on",btnClass);
26748						break;
26749					case "mouseup": case "touchend": case "pointerup": case "MSPointerUp":
26750					case "mouseout": case "pointerout": case "MSPointerOut":
26751						if(seq.type==="stepped"){return;}
26752						touchActive=false;
26753						if(seq.dir){_seq("off",btnClass);}
26754						break;
26755					case "click":
26756						if(seq.type!=="stepped" || d.tweenRunning){return;}
26757						_seq("on",btnClass);
26758						break;
26759				}
26760				function _seq(a,c){
26761					
26761//seq.scrollAmount=o.scrollButtons.scrollAmount;
26762					_sequentialScroll($this,a,c);
26763				}
26764			});
26765		},
26766		/* -------------------- */
26767		
26768		
26769		/* 
26770		KEYBOARD EVENTS
26771		scrolls content via keyboard 
26772		Keys: up arrow, down arrow, left arrow, right arrow, PgUp, PgDn, Home, End
26773		*/
26774		_keyboard=function(){
26775			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,seq=d.sequential,
26776				namespace=pluginPfx+"_"+d.idx,
26777				mCustomScrollBox=$("#mCSB_"+d.idx),
26778				mCSB_container=$("#mCSB_"+d.idx+"_container"),
26779				wrapper=mCSB_container.parent(),
26780				editables="input,textarea,select,datalist,keygen,[contenteditable='true']",
26781				iframe=mCSB_container.find("iframe"),
vendor: 23,820 bytes, lines 26782-27436
26782				events=["blur."+namespace+" keydown."+namespace+" keyup."+namespace];
26783			if(iframe.length){
26784				iframe.each(function(){
26785					$(this).bind("load",function(){
26786						/* bind events on accessible iframes */
26787						if(_canAccessIFrame(this)){
26788							$(this.contentDocument || this.contentWindow.document).bind(events[0],function(e){
26789								_onKeyboard(e);
26790							});
26791						}
26792					});
26793				});
26794			}
26795			mCustomScrollBox.attr("tabindex","0").bind(events[0],function(e){
26796				_onKeyboard(e);
26797			});
26798			function _onKeyboard(e){
26799				switch(e.type){
26800					case "blur":
26801						if(d.tweenRunning && seq.dir){_seq("off",null);}
26802						break;
26803					case "keydown": case "keyup":
26804						var code=e.keyCode ? e.keyCode : e.which,action="on";
26805						if((o.axis!=="x" && (code===38 || code===40)) || (o.axis!=="y" && (code===37 || code===39))){
26806							/* up (38), down (40), left (37), right (39) arrows */
26807							if(((code===38 || code===40) && !d.overflowed[0]) || ((code===37 || code===39) && !d.overflowed[1])){return;}
26808							if(e.type==="keyup"){action="off";}
26809							if(!$(document.activeElement).is(editables)){
26810								e.preventDefault();
26811								e.stopImmediatePropagation();
26812								_seq(action,code);
26813							}
26814						}else if(code===33 || code===34){
26815							/* PgUp (33), PgDn (34) */
26816							if(d.overflowed[0] || d.overflowed[1]){
26817								e.preventDefault();
26818								e.stopImmediatePropagation();
26819							}
26820							if(e.type==="keyup"){
26821								_stop($this);
26822								var keyboardDir=code===34 ? -1 : 1;
26823								if(o.axis==="x" || (o.axis==="yx" && d.overflowed[1] && !d.overflowed[0])){
26824									var dir="x",to=Math.abs(mCSB_container[0].offsetLeft)-(keyboardDir*(wrapper.width()*0.9));
26825								}else{
26826									var dir="y",to=Math.abs(mCSB_container[0].offsetTop)-(keyboardDir*(wrapper.height()*0.9));
26827								}
26828								_scrollTo($this,to.toString(),{dir:dir,scrollEasing:"mcsEaseInOut"});
26829							}
26830						}else if(code===35 || code===36){
26831							/* End (35), Home (36) */
26832							if(!$(document.activeElement).is(editables)){
26833								if(d.overflowed[0] || d.overflowed[1]){
26834									e.preventDefault();
26835									e.stopImmediatePropagation();
26836								}
26837								if(e.type==="keyup"){
26838									if(o.axis==="x" || (o.axis==="yx" && d.overflowed[1] && !d.overflowed[0])){
26839										var dir="x",to=code===35 ? Math.abs(wrapper.width()-mCSB_container.outerWidth(false)) : 0;
26840									}else{
26841										var dir="y",to=code===35 ? Math.abs(wrapper.height()-mCSB_container.outerHeight(false)) : 0;
26842									}
26843									_scrollTo($this,to.toString(),{dir:dir,scrollEasing:"mcsEaseInOut"});
26844								}
26845							}
26846						}
26847						break;
26848				}
26849				function _seq(a,c){
26850					seq.type=o.keyboard.scrollType;
26851					seq.scrollAmount=o.keyboard.scrollAmount;
26852					if(seq.type==="stepped" && d.tweenRunning){return;}
26853					_sequentialScroll($this,a,c);
26854				}
26855			}
26856		},
26857		/* -------------------- */
26858		
26859		
26860		/* scrolls content sequentially (used when scrolling via buttons, keyboard arrows etc.) */
26861		_sequentialScroll=function(el,action,trigger,e,s){
26862			var d=el.data(pluginPfx),o=d.opt,seq=d.sequential,
26863				mCSB_container=$("#mCSB_"+d.idx+"_container"),
26864				once=seq.type==="stepped" ? true : false,
26865				steplessSpeed=o.scrollInertia < 26 ? 26 : o.scrollInertia, /* 26/1.5=17 */
26866				steppedSpeed=o.scrollInertia < 1 ? 17 : o.scrollInertia;
26867			switch(action){
26868				case "on":
26869					seq.dir=[
26870						(trigger===classes[16] || trigger===classes[15] || trigger===39 || trigger===37 ? "x" : "y"),
26871						(trigger===classes[13] || trigger===classes[15] || trigger===38 || trigger===37 ? -1 : 1)
26872					];
26873					_stop(el);
26874					if(_isNumeric(trigger) && seq.type==="stepped"){return;}
26875					_on(once);
26876					break;
26877				case "off":
26878					_off();
26879					if(once || (d.tweenRunning && seq.dir)){
26880						_on(true);
26881					}
26882					break;
26883			}
26884			
26885			/* starts sequence */
26886			function _on(once){
26887				if(o.snapAmount){seq.scrollAmount=!(o.snapAmount instanceof Array) ? o.snapAmount : seq.dir[0]==="x" ? o.snapAmount[1] : o.snapAmount[0];} /* scrolling snapping */
26888				var c=seq.type!=="stepped", /* continuous scrolling */
26889					t=s ? s : !once ? 1000/60 : c ? steplessSpeed/1.5 : steppedSpeed, /* timer */
26890					m=!once ? 2.5 : c ? 7.5 : 40, /* multiplier */
26891					contentPos=[Math.abs(mCSB_container[0].offsetTop),Math.abs(mCSB_container[0].offsetLeft)],
26892					ratio=[d.scrollRatio.y>10 ? 10 : d.scrollRatio.y,d.scrollRatio.x>10 ? 10 : d.scrollRatio.x],
26893					amount=seq.dir[0]==="x" ? contentPos[1]+(seq.dir[1]*(ratio[1]*m)) : contentPos[0]+(seq.dir[1]*(ratio[0]*m)),
26894					px=seq.dir[0]==="x" ? contentPos[1]+(seq.dir[1]*parseInt(seq.scrollAmount)) : contentPos[0]+(seq.dir[1]*parseInt(seq.scrollAmount)),
26895					to=seq.scrollAmount!=="auto" ? px : amount,
26896					easing=e ? e : !once ? "mcsLinear" : c ? "mcsLinearOut" : "mcsEaseInOut",
26897					onComplete=!once ? false : true;
26898				if(once && t<17){
26899					to=seq.dir[0]==="x" ? contentPos[1] : contentPos[0];
26900				}
26901
26902				_scrollTo(el,to.toString(),{dir:seq.dir[0],scrollEasing:easing,dur:t,onComplete:onComplete});
26903				if(once){
26904					seq.dir=false;
26905					return;
26906				}
26907				clearTimeout(seq.step);
26908				seq.step=setTimeout(function(){
26909					_on();
26910				},t);
26911			}
26912			/* stops sequence */
26913			function _off(){
26914				clearTimeout(seq.step);
26915				_delete(seq,"step");
26916				_stop(el);
26917			}
26918		},
26919		/* -------------------- */
26920		
26921		
26922		/* returns a yx array from value */
26923		_arr=function(val){
26924			var o=$(this).data(pluginPfx).opt,vals=[];
26925			if(typeof val==="function"){val=val();} /* check if the value is a single anonymous function */
26926			/* check if value is object or array, its length and create an array with yx values */
26927			if(!(val instanceof Array)){ /* object value (e.g. {y:"100",x:"100"}, 100 etc.) */
26928				vals[0]=val.y ? val.y : val.x || o.axis==="x" ? null : val;
26929				vals[1]=val.x ? val.x : val.y || o.axis==="y" ? null : val;
26930			}else{ /* array value (e.g. [100,100]) */
26931				vals=val.length>1 ? [val[0],val[1]] : o.axis==="x" ? [null,val[0]] : [val[0],null];
26932			}
26933			/* check if array values are anonymous functions */
26934			if(typeof vals[0]==="function"){vals[0]=vals[0]();}
26935			if(typeof vals[1]==="function"){vals[1]=vals[1]();}
26936			return vals;
26937		},
26938		/* -------------------- */
26939		
26940		
26941		/* translates values (e.g. "top", 100, "100px", "#id") to actual scroll-to positions */
26942		_to=function(val,dir){
26943			if(val==null || typeof val=="undefined"){return;}
26944			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
26945				mCSB_container=$("#mCSB_"+d.idx+"_container"),
26946				wrapper=mCSB_container.parent(),
26947				t=typeof val;
26948			if(!dir){dir=o.axis==="x" ? "x" : "y";}
26949			var contentLength=dir==="x" ? mCSB_container.outerWidth(false)-wrapper.width() : mCSB_container.outerHeight(false)-wrapper.height(),
26950				contentPos=dir==="x" ? mCSB_container[0].offsetLeft : mCSB_container[0].offsetTop,
26951				cssProp=dir==="x" ? "left" : "top";
26952			switch(t){
26953				case "function": /* this currently is not used. Consider removing it */
26954					return val();
26955					break;
26956				case "object": /* js/jquery object */
26957					var obj=val.jquery ? val : $(val);
26958					if(!obj.length){return;}
26959					return dir==="x" ? _childPos(obj)[1] : _childPos(obj)[0];
26960					break;
26961				case "string": case "number":
26962					if(_isNumeric(val)){ /* numeric value */
26963						return Math.abs(val);
26964					}else if(val.indexOf("%")!==-1){ /* percentage value */
26965						return Math.abs(contentLength*parseInt(val)/100);
26966					}else if(val.indexOf("-=")!==-1){ /* decrease value */
26967						return Math.abs(contentPos-parseInt(val.split("-=")[1]));
26968					}else if(val.indexOf("+=")!==-1){ /* inrease value */
26969						var p=(contentPos+parseInt(val.split("+=")[1]));
26970						return p>=0 ? 0 : Math.abs(p);
26971					}else if(val.indexOf("px")!==-1 && _isNumeric(val.split("px")[0])){ /* pixels string value (e.g. "100px") */
26972						return Math.abs(val.split("px")[0]);
26973					}else{
26974						if(val==="top" || val==="left"){ /* special strings */
26975							return 0;
26976						}else if(val==="bottom"){
26977							return Math.abs(wrapper.height()-mCSB_container.outerHeight(false));
26978						}else if(val==="right"){
26979							return Math.abs(wrapper.width()-mCSB_container.outerWidth(false));
26980						}else if(val==="first" || val==="last"){
26981							var obj=mCSB_container.find(":"+val);
26982							return dir==="x" ? _childPos(obj)[1] : _childPos(obj)[0];
26983						}else{
26984							if($(val).length){ /* jquery selector */
26985								return dir==="x" ? _childPos($(val))[1] : _childPos($(val))[0];
26986							}else{ /* other values (e.g. "100em") */
26987								mCSB_container.css(cssProp,val);
26988								methods.update.call(null,$this[0]);
26989								return;
26990							}
26991						}
26992					}
26993					break;
26994			}
26995		},
26996		/* -------------------- */
26997		
26998		
26999		/* calls the update method automatically */
27000		_autoUpdate=function(rem){
27001			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
27002				mCSB_container=$("#mCSB_"+d.idx+"_container");
27003			if(rem){
27004				/* 
27005				removes autoUpdate timer 
27006				usage: _autoUpdate.call(this,"remove");
27007				*/
27008				clearTimeout(mCSB_container[0].autoUpdate);
27009				_delete(mCSB_container[0],"autoUpdate");
27010				return;
27011			}
27012			upd();
27013			function upd(){
27014				clearTimeout(mCSB_container[0].autoUpdate);
27015				if($this.parents("html").length===0){
27016					/* check element in dom tree */
27017					$this=null;
27018					return;
27019				}
27020				mCSB_container[0].autoUpdate=setTimeout(function(){
27021					/* update on specific selector(s) length and size change */
27022					if(o.advanced.updateOnSelectorChange){
27023						d.poll.change.n=sizesSum();
27024						if(d.poll.change.n!==d.poll.change.o){
27025							d.poll.change.o=d.poll.change.n;
27026							doUpd(3);
27027							return;
27028						}
27029					}
27030					/* update on main element and scrollbar size changes */
27031					if(o.advanced.updateOnContentResize){
27032						d.poll.size.n=$this[0].scrollHeight+$this[0].scrollWidth+mCSB_container[0].offsetHeight+$this[0].offsetHeight+$this[0].offsetWidth;
27033						if(d.poll.size.n!==d.poll.size.o){
27034							d.poll.size.o=d.poll.size.n;
27035							doUpd(1);
27036							return;
27037						}
27038					}
27039					/* update on image load */
27040					if(o.advanced.updateOnImageLoad){
27041						if(!(o.advanced.updateOnImageLoad==="auto" && o.axis==="y")){ //by default, it doesn't run on vertical content
27042							d.poll.img.n=mCSB_container.find("img").length;
27043							if(d.poll.img.n!==d.poll.img.o){
27044								d.poll.img.o=d.poll.img.n;
27045								mCSB_container.find("img").each(function(){
27046									imgLoader(this);
27047								});
27048								return;
27049							}
27050						}
27051					}
27052					if(o.advanced.updateOnSelectorChange || o.advanced.updateOnContentResize || o.advanced.updateOnImageLoad){upd();}
27053				},o.advanced.autoUpdateTimeout);
27054			}
27055			/* a tiny image loader */
27056			function imgLoader(el){
27057				if($(el).hasClass(classes[2])){doUpd(); return;}
27058				var img=new Image();
27059				function createDelegate(contextObject,delegateMethod){
27060					return function(){return delegateMethod.apply(contextObject,arguments);}
27061				}
27062				function imgOnLoad(){
27063					this.onload=null;
27064					$(el).addClass(classes[2]);
27065					doUpd(2);
27066				}
27067				img.onload=createDelegate(img,imgOnLoad);
27068				img.src=el.src;
27069			}
27070			/* returns the total height and width sum of all elements matching the selector */
27071			function sizesSum(){
27072				if(o.advanced.updateOnSelectorChange===true){o.advanced.updateOnSelectorChange="*";}
27073				var total=0,sel=mCSB_container.find(o.advanced.updateOnSelectorChange);
27074				if(o.advanced.updateOnSelectorChange && sel.length>0){sel.each(function(){total+=this.offsetHeight+this.offsetWidth;});}
27075				return total;
27076			}
27077			/* calls the update method */
27078			function doUpd(cb){
27079				clearTimeout(mCSB_container[0].autoUpdate);
27080				methods.update.call(null,$this[0],cb);
27081			}
27082		},
27083		/* -------------------- */
27084		
27085		
27086		/* snaps scrolling to a multiple of a pixels number */
27087		_snapAmount=function(to,amount,offset){
27088			return (Math.round(to/amount)*amount-offset); 
27089		},
27090		/* -------------------- */
27091		
27092		
27093		/* stops content and scrollbar animations */
27094		_stop=function(el){
27095			var d=el.data(pluginPfx),
27096				sel=$("#mCSB_"+d.idx+"_container,#mCSB_"+d.idx+"_container_wrapper,#mCSB_"+d.idx+"_dragger_vertical,#mCSB_"+d.idx+"_dragger_horizontal");
27097			sel.each(function(){
27098				_stopTween.call(this);
27099			});
27100		},
27101		/* -------------------- */
27102		
27103		
27104		/* 
27105		ANIMATES CONTENT 
27106		This is where the actual scrolling happens
27107		*/
27108		_scrollTo=function(el,to,options){
27109			var d=el.data(pluginPfx),o=d.opt,
27110				defaults={
27111					trigger:"internal",
27112					dir:"y",
27113					scrollEasing:"mcsEaseOut",
27114					drag:false,
27115					dur:o.scrollInertia,
27116					overwrite:"all",
27117					callbacks:true,
27118					onStart:true,
27119					onUpdate:true,
27120					onComplete:true
27121				},
27122				options=$.extend(defaults,options),
27123				dur=[options.dur,(options.drag ? 0 : options.dur)],
27124				mCustomScrollBox=$("#mCSB_"+d.idx),
27125				mCSB_container=$("#mCSB_"+d.idx+"_container"),
27126				wrapper=mCSB_container.parent(),
27127				totalScrollOffsets=o.callbacks.onTotalScrollOffset ? _arr.call(el,o.callbacks.onTotalScrollOffset) : [0,0],
27128				totalScrollBackOffsets=o.callbacks.onTotalScrollBackOffset ? _arr.call(el,o.callbacks.onTotalScrollBackOffset) : [0,0];
27129			d.trigger=options.trigger;
27130			if(wrapper.scrollTop()!==0 || wrapper.scrollLeft()!==0){ /* always reset scrollTop/Left */
27131				$(".mCSB_"+d.idx+"_scrollbar").css("visibility","visible");
27132				wrapper.scrollTop(0).scrollLeft(0);
27133			}
27134			if(to==="_resetY" && !d.contentReset.y){
27135				/* callbacks: onOverflowYNone */
27136				if(_cb("onOverflowYNone")){o.callbacks.onOverflowYNone.call(el[0]);}
27137				d.contentReset.y=1;
27138			}
27139			if(to==="_resetX" && !d.contentReset.x){
27140				/* callbacks: onOverflowXNone */
27141				if(_cb("onOverflowXNone")){o.callbacks.onOverflowXNone.call(el[0]);}
27142				d.contentReset.x=1;
27143			}
27144			if(to==="_resetY" || to==="_resetX"){return;}
27145			if((d.contentReset.y || !el[0].mcs) && d.overflowed[0]){
27146				/* callbacks: onOverflowY */
27147				if(_cb("onOverflowY")){o.callbacks.onOverflowY.call(el[0]);}
27148				d.contentReset.x=null;
27149			}
27150			if((d.contentReset.x || !el[0].mcs) && d.overflowed[1]){
27151				/* callbacks: onOverflowX */
27152				if(_cb("onOverflowX")){o.callbacks.onOverflowX.call(el[0]);}
27153				d.contentReset.x=null;
27154			}
27155			if(o.snapAmount){ /* scrolling snapping */
27156				var snapAmount=!(o.snapAmount instanceof Array) ? o.snapAmount : options.dir==="x" ? o.snapAmount[1] : o.snapAmount[0];
27157				to=_snapAmount(to,snapAmount,o.snapOffset);
27158			}
27159			switch(options.dir){
27160				case "x":
27161					var mCSB_dragger=$("#mCSB_"+d.idx+"_dragger_horizontal"),
27162						property="left",
27163						contentPos=mCSB_container[0].offsetLeft,
27164						limit=[
27165							mCustomScrollBox.width()-mCSB_container.outerWidth(false),
27166							mCSB_dragger.parent().width()-mCSB_dragger.width()
27167						],
27168						scrollTo=[to,to===0 ? 0 : (to/d.scrollRatio.x)],
27169						tso=totalScrollOffsets[1],
27170						tsbo=totalScrollBackOffsets[1],
27171						totalScrollOffset=tso>0 ? tso/d.scrollRatio.x : 0,
27172						totalScrollBackOffset=tsbo>0 ? tsbo/d.scrollRatio.x : 0;
27173					break;
27174				case "y":
27175					var mCSB_dragger=$("#mCSB_"+d.idx+"_dragger_vertical"),
27176						property="top",
27177						contentPos=mCSB_container[0].offsetTop,
27178						limit=[
27179							mCustomScrollBox.height()-mCSB_container.outerHeight(false),
27180							mCSB_dragger.parent().height()-mCSB_dragger.height()
27181						],
27182						scrollTo=[to,to===0 ? 0 : (to/d.scrollRatio.y)],
27183						tso=totalScrollOffsets[0],
27184						tsbo=totalScrollBackOffsets[0],
27185						totalScrollOffset=tso>0 ? tso/d.scrollRatio.y : 0,
27186						totalScrollBackOffset=tsbo>0 ? tsbo/d.scrollRatio.y : 0;
27187					break;
27188			}
27189			if(scrollTo[1]<0 || (scrollTo[0]===0 && scrollTo[1]===0)){
27190				scrollTo=[0,0];
27191			}else if(scrollTo[1]>=limit[1]){
27192				scrollTo=[limit[0],limit[1]];
27193			}else{
27194				scrollTo[0]=-scrollTo[0];
27195			}
27196			if(!el[0].mcs){
27197				_mcs();  /* init mcs object (once) to make it available before callbacks */
27198				if(_cb("onInit")){o.callbacks.onInit.call(el[0]);} /* callbacks: onInit */
27199			}
27200			clearTimeout(mCSB_container[0].onCompleteTimeout);
27201
27202			_tweenTo(mCSB_dragger[0],property,Math.round(scrollTo[1]),dur[1],options.scrollEasing);
27203			if(!d.tweenRunning && ((contentPos===0 && scrollTo[0]>=0) || (contentPos===limit[0] && scrollTo[0]<=limit[0]))){return;}
27204			_tweenTo(mCSB_container[0],property,Math.round(scrollTo[0]),dur[0],options.scrollEasing,options.overwrite,{
27205				onStart:function(){
27206					if(options.callbacks && options.onStart && !d.tweenRunning){
27207						/* callbacks: onScrollStart */
27208						if(_cb("onScrollStart")){_mcs(); o.callbacks.onScrollStart.call(el[0]);}
27209						d.tweenRunning=true;
27210						_onDragClasses(mCSB_dragger);
27211						d.cbOffsets=_cbOffsets();
27212					}
27213				},onUpdate:function(){
27214					if(options.callbacks && options.onUpdate){
27215						/* callbacks: whileScrolling */
27216						if(_cb("whileScrolling")){_mcs(); o.callbacks.whileScrolling.call(el[0]);}
27217					}
27218				},onComplete:function(){
27219					if(options.callbacks && options.onComplete){
27220						if(o.axis==="yx"){clearTimeout(mCSB_container[0].onCompleteTimeout);}
27221						var t=mCSB_container[0].idleTimer || 0;
27222						mCSB_container[0].onCompleteTimeout=setTimeout(function(){
27223							/* callbacks: onScroll, onTotalScroll, onTotalScrollBack */
27224							if(_cb("onScroll")){_mcs(); o.callbacks.onScroll.call(el[0]);}
27225							if(_cb("onTotalScroll") && scrollTo[1]>=limit[1]-totalScrollOffset && d.cbOffsets[0]){_mcs(); o.callbacks.onTotalScroll.call(el[0]);}
27226							if(_cb("onTotalScrollBack") && scrollTo[1]<=totalScrollBackOffset && d.cbOffsets[1]){_mcs(); o.callbacks.onTotalScrollBack.call(el[0]);}
27227							d.tweenRunning=false;
27228							mCSB_container[0].idleTimer=0;
27229							_onDragClasses(mCSB_dragger,"hide");
27230						},t);
27231					}
27232				}
27233			});
27234			/* checks if callback function exists */
27235			function _cb(cb){
27236				return d && o.callbacks[cb] && typeof o.callbacks[cb]==="function";
27237			}
27238			/* checks whether callback offsets always trigger */
27239			function _cbOffsets(){
27240				return [o.callbacks.alwaysTriggerOffsets || contentPos>=limit[0]+tso,o.callbacks.alwaysTriggerOffsets || contentPos<=-tsbo];
27241			}
27242			/* 
27243			populates object with useful values for the user 
27244			values: 
27245				content: this.mcs.content
27246				content top position: this.mcs.top 
27247				content left position: this.mcs.left 
27248				dragger top position: this.mcs.draggerTop 
27249				dragger left position: this.mcs.draggerLeft 
27250				scrolling y percentage: this.mcs.topPct 
27251				scrolling x percentage: this.mcs.leftPct 
27252				scrolling direction: this.mcs.direction
27253			*/
27254			function _mcs(){
27255				var cp=[mCSB_container[0].offsetTop,mCSB_container[0].offsetLeft], /* content position */
27256					dp=[mCSB_dragger[0].offsetTop,mCSB_dragger[0].offsetLeft], /* dragger position */
27257					cl=[mCSB_container.outerHeight(false),mCSB_container.outerWidth(false)], /* content length */
27258					pl=[mCustomScrollBox.height(),mCustomScrollBox.width()]; /* content parent length */
27259				el[0].mcs={
27260					content:mCSB_container, /* original content wrapper as jquery object */
27261					top:cp[0],left:cp[1],draggerTop:dp[0],draggerLeft:dp[1],
27262					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])),
27263					direction:options.dir
27264				};
27265				/* 
27266				this refers to the original element containing the scrollbar(s)
27267				usage: this.mcs.top, this.mcs.leftPct etc. 
27268				*/
27269			}
27270		},
27271		/* -------------------- */
27272		
27273		
27274		/* 
27275		CUSTOM JAVASCRIPT ANIMATION TWEEN 
27276		Lighter and faster than jquery animate() and css transitions 
27277		Animates top/left properties and includes easings 
27278		*/
27279		_tweenTo=function(el,prop,to,duration,easing,overwrite,callbacks){
27280
27281			if(el && !el._mTween){el._mTween={top:{},left:{}};}
27282			var callbacks=callbacks || {},
27283				onStart=callbacks.onStart || function(){},onUpdate=callbacks.onUpdate || function(){},onComplete=callbacks.onComplete || function(){},
27284				startTime=_getTime(),_delay,progress=0,from=el.offsetTop,elStyle=el.style,_request,tobj=el._mTween[prop];
27285			if(prop==="left"){from=el.offsetLeft;}
27286			var diff=to-from;
27287			tobj.stop=0;
27288			if(overwrite!=="none"){_cancelTween();}
27289			_startTween();
27290			function _step(){
27291				if(tobj.stop){return;}
27292				if(!progress){onStart.call();}
27293				progress=_getTime()-startTime;
27294				_tween();
27295				if(progress>=tobj.time){
27296					tobj.time=(progress>tobj.time) ? progress+_delay-(progress-tobj.time) : progress+_delay-1;
27297					if(tobj.time<progress+1){tobj.time=progress+1;}
27298				}
27299				if(tobj.time<duration){tobj.id=_request(_step);}else{onComplete.call();}
27300			}
27301			function _tween(){
27302				if(duration>0){
27303					tobj.currVal=_ease(tobj.time,from,diff,duration,easing);
27304					elStyle[prop]=Math.round(tobj.currVal)+"px";
27305				}else{
27306					elStyle[prop]=to+"px";
27307				}
27308				onUpdate.call();
27309			}
27310			function _startTween(){
27311				_delay=1000/60;
27312				tobj.time=progress+_delay;
27313				_request=(!window.requestAnimationFrame) ? function(f){_tween(); return setTimeout(f,0.01);} : window.requestAnimationFrame;
27314				tobj.id=_request(_step);
27315			}
27316			function _cancelTween(){
27317				if(tobj.id==null){return;}
27318				if(!window.requestAnimationFrame){clearTimeout(tobj.id);
27319				}else{window.cancelAnimationFrame(tobj.id);}
27320				tobj.id=null;
27321			}
27322			function _ease(t,b,c,d,type){
27323				switch(type){
27324					case "linear": case "mcsLinear":
27325						return c*t/d + b;
27326						break;
27327					case "mcsLinearOut":
27328						t/=d; t--; return c * Math.sqrt(1 - t*t) + b;
27329						break;
27330					case "easeInOutSmooth":
27331						t/=d/2;
27332						if(t<1) return c/2*t*t + b;
27333						t--;
27334						return -c/2 * (t*(t-2) - 1) + b;
27335						break;
27336					case "easeInOutStrong":
27337						t/=d/2;
27338						if(t<1) return c/2 * Math.pow( 2, 10 * (t - 1) ) + b;
27339						t--;
27340						return c/2 * ( -Math.pow( 2, -10 * t) + 2 ) + b;
27341						break;
27342					case "easeInOut": case "mcsEaseInOut":
27343						t/=d/2;
27344						if(t<1) return c/2*t*t*t + b;
27345						t-=2;
27346						return c/2*(t*t*t + 2) + b;
27347						break;
27348					case "easeOutSmooth":
27349						t/=d; t--;
27350						return -c * (t*t*t*t - 1) + b;
27351						break;
27352					case "easeOutStrong":
27353						return c * ( -Math.pow( 2, -10 * t/d ) + 1 ) + b;
27354						break;
27355					case "easeOut": case "mcsEaseOut": default:
27356						var ts=(t/=d)*t,tc=ts*t;
27357						return b+c*(0.499999999999997*tc*ts + -2.5*ts*ts + 5.5*tc + -6.5*ts + 4*t);
27358				}
27359			}
27360		},
27361		/* -------------------- */
27362		
27363		
27364		/* returns current time */
27365		_getTime=function(){
27366			if(window.performance && window.performance.now){
27367				return window.performance.now();
27368			}else{
27369				if(window.performance && window.performance.webkitNow){
27370					return window.performance.webkitNow();
27371				}else{
27372					if(Date.now){return Date.now();}else{return new Date().getTime();}
27373				}
27374			}
27375		},
27376		/* -------------------- */
27377		
27378		
27379		/* stops a tween */
27380		_stopTween=function(){
27381			var el=this;
27382			if(!el._mTween){el._mTween={top:{},left:{}};}
27383			var props=["top","left"];
27384			for(var i=0; i<props.length; i++){
27385				var prop=props[i];
27386				if(el._mTween[prop].id){
27387					if(!window.requestAnimationFrame){clearTimeout(el._mTween[prop].id);
27388					}else{window.cancelAnimationFrame(el._mTween[prop].id);}
27389					el._mTween[prop].id=null;
27390					el._mTween[prop].stop=1;
27391				}
27392			}
27393		},
27394		/* -------------------- */
27395		
27396		
27397		/* deletes a property (avoiding the exception thrown by IE) */
27398		_delete=function(c,m){
27399			try{delete c[m];}catch(e){c[m]=null;}
27400		},
27401		/* -------------------- */
27402		
27403		
27404		/* detects left mouse button */
27405		_mouseBtnLeft=function(e){
27406			return !(e.which && e.which!==1);
27407		},
27408		/* -------------------- */
27409		
27410		
27411		/* detects if pointer type event is touch */
27412		_pointerTouch=function(e){
27413			var t=e.originalEvent.pointerType;
27414			return !(t && t!=="touch" && t!==2);
27415		},
27416		/* -------------------- */
27417		
27418		
27419		/* checks if value is numeric */
27420		_isNumeric=function(val){
27421			return !isNaN(parseFloat(val)) && isFinite(val);
27422		},
27423		/* -------------------- */
27424		
27425		
27426		/* returns element position according to content */
27427		_childPos=function(el){
27428			var p=el.parents(".mCSB_container");
27429			return [el.offset().top-p.offset().top,el.offset().left-p.offset().left];
27430		},
27431		/* -------------------- */
27432		
27433		
27434		/* checks if browser tab is hidden/inactive via Page Visibility API */
27435		_isTabHidden=function(){
27436			var prop=_getHiddenProp();
27437			if(!prop) return false;
27438			return document[prop];
27439			function _getHiddenProp(){
27440				var pfx=["webkit","moz","ms","o"];
27441				if("hidden" in document) return "hidden"; //natively supported
27442				for(var i=0; i<pfx.length; i++){ //prefixed
27443				    if((pfx[i]+"Hidden") in document) 
27444				        return pfx[i]+"Hidden";
27445				}
27446				return null; //not supported
27447			}
27448		};
27449		/* -------------------- */
27450		
27451	
27452	
27453	
27454	
27455	/* 
27456	----------------------------------------
27457	PLUGIN SETUP 
27458	----------------------------------------
27459	*/
27460	
27461	/* plugin constructor functions */
27462	$.fn[pluginNS]=function(method){ /* usage: $(selector).mCustomScrollbar(); */
27463		if(methods[method]){
27464			return methods[method].apply(this,Array.prototype.slice.call(arguments,1));
27465		}else if(typeof method==="object" || !method){
27466			return methods.init.apply(this,arguments);
27467		}else{
27468			$.error("Method "+method+" does not exist");
27469		}
27470	};
27471	$[pluginNS]=function(method){ /* usage: $.mCustomScrollbar(); */
27472		if(methods[method]){
27473			return methods[method].apply(this,Array.prototype.slice.call(arguments,1));
27474		}else if(typeof method==="object" || !method){
27475			return methods.init.apply(this,arguments);
27476		}else{
27477			$.error("Method "+method+" does not exist");
27478		}
27479	};
27480	
27481	/* 
27482	allow setting plugin default options. 
27483	usage: $.mCustomScrollbar.defaults.scrollInertia=500; 
27484	to apply any changed default options on default selectors (below), use inside document ready fn 
27485	e.g.: $(document).ready(function(){ $.mCustomScrollbar.defaults.scrollInertia=500; });
27486	*/
27487	$[pluginNS].defaults=defaults;
27488	
27489	/* 
27490	add window object (window.mCustomScrollbar) 
27491	usage: if(window.mCustomScrollbar){console.log("custom scrollbar plugin loaded");}
27492	*/
27493	window[pluginNS]=true;
27494	
27495	$(window).bind("load",function(){
27496		
27497		$(defaultSelector)[pluginNS](); /* add scrollbars automatically on default selector */
27498		
27499		/* extend jQuery expressions */
27500		$.extend($.expr[":"],{
27501			/* checks if element is within scrollable viewport */
27502			mcsInView:$.expr[":"].mcsInView || function(el){
27503				var $el=$(el),content=$el.parents(".mCSB_container"),wrapper,cPos;
27504				if(!content.length){return;}
27505				wrapper=content.parent();
27506				cPos=[content[0].offsetTop,content[0].offsetLeft];
27507				return 	cPos[0]+_childPos($el)[0]>=0 && cPos[0]+_childPos($el)[0]<wrapper.height()-$el.outerHeight(false) && 
27508						cPos[1]+_childPos($el)[1]>=0 && cPos[1]+_childPos($el)[1]<wrapper.width()-$el.outerWidth(false);
27509			},
27510			/* checks if element or part of element is in view of scrollable viewport */
27511			mcsInSight:$.expr[":"].mcsInSight || function(el,i,m){
27512				var $el=$(el),elD,content=$el.parents(".mCSB_container"),wrapperView,pos,wrapperViewPct,
27513					pctVals=m[3]==="exact" ? [[1,0],[1,0]] : [[0.9,0.1],[0.6,0.4]];
27514				if(!content.length){return;}
27515				elD=[$el.outerHeight(false),$el.outerWidth(false)];
27516				pos=[content[0].offsetTop+_childPos($el)[0],content[0].offsetLeft+_childPos($el)[1]];
27517				wrapperView=[content.parent()[0].offsetHeight,content.parent()[0].offsetWidth];
27518				wrapperViewPct=[elD[0]<wrapperView[0] ? pctVals[0] : pctVals[1],elD[1]<wrapperView[1] ? pctVals[0] : pctVals[1]];
27519				return 	pos[0]-(wrapperView[0]*wrapperViewPct[0][0])<0 && pos[0]+elD[0]-(wrapperView[0]*wrapperViewPct[0][1])>=0 && 
27520						pos[1]-(wrapperView[1]*wrapperViewPct[1][0])<0 && pos[1]+elD[1]-(wrapperView[1]*wrapperViewPct[1][1])>=0;
27521			},
27522			/* checks if element is overflowed having visible scrollbar(s) */
27523			mcsOverflow:$.expr[":"].mcsOverflow || function(el){
27524				var d=$(el).data(pluginPfx);
27525				if(!d){return;}
27526				return d.overflowed[0] || d.overflowed[1];
27527			}
27528		});
27529	
27530	});
27531
27532}))}));
27533/* End */
27534;
27535; /* 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:"";}"*/
27536InitTabsScroll = function () {
27537	$('.arrow_scroll:not(.arrow_scroll_init)').scrollTab();
27538}
27539
27540ResizeScrollTabs = function () {
27541	var scrollTabs = $('.arrow_scroll_init');
27542
27543	if (scrollTabs.length) {
27544		scrollTabs.each(function (i, scrollTab) {
27545			var _scrollTab = $(scrollTab);
27546			_scrollTab.data('scrollTabOptions').resize();
27547		});
27548	}
27549}
27550
27551$(document).ready(function () {
27552	InitTabsScroll();
27553});
27554
27555$(window).on('resize', function () {
27556	if (window.scrollTabsTimeout !== undefined) {
27557		clearTimeout(window.scrollTabsTimeout);
27558	}
27559
27560	window.scrollTabsTimeout = setTimeout(
27561		ResizeScrollTabs,
27562		20
27563	);
27564});
27565
27566$.fn.scrollTab = function (options) {
27567	function _scrollTab(element, options) {
27568		var _scrollTab = $(element);
27569		var tabs_wrapper = _scrollTab.find(options.tabs_wrapper);
27570		var tabs = tabs_wrapper.find('> li');
27571
27572		var arrow_svg = '<svg xmlns="http://www.w3.org/2000/svg" width="12" height="8" viewBox="0 0 12 8">' +
27573			'<rect width="12" height="8" fill="#333" fill-opacity="0" />' +
27574			'<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)"/>' +
27575			'</svg>';
27576		var arrows_wrapper = '<div class="arrows_wrapper">' +
27577			'<div class="arrow arrow_left colored_theme_hover_text">' + arrow_svg + '</div>' +
27578			'<div class="arrow arrow_right colored_theme_hover_text">' + arrow_svg + '</div>' +
27579			'</div>';
27580
27581		var arrows = $(arrows_wrapper).insertAfter(tabs_wrapper);
27582		var arrow_left = arrows.find('.arrow_left');
27583		var arrow_right = arrows.find('.arrow_right');
27584
27585		var thisOoptions = $.extend({}, options);
27586
27587		thisOoptions.scrollTab = _scrollTab;
27588		thisOoptions.wrapper = tabs_wrapper;
27589		thisOoptions.tabs = tabs;
27590		thisOoptions.arrows = {};
27591		thisOoptions.arrows.wrapper = arrows;
27592		thisOoptions.arrows.arrow_left = arrow_left;
27593		thisOoptions.arrows.arrow_right = arrow_right;
27594		thisOoptions.arrows.arrow_width = arrow_right[0].getBoundingClientRect().width;
27595
27596		if (thisOoptions.linked_tabs !== undefined && thisOoptions.linked_tabs.length && thisOoptions.linked_tabs.data('scrollTabOptions') !== undefined) {
27597			thisOoptions.linked_options = thisOoptions.linked_tabs.data('scrollTabOptions');
27598			thisOoptions.linked_options.linked_options = thisOoptions;
27599		}
27600
27601		if (options.arrows_css) {
27602			thisOoptions.arrows.arrow_left.css(options.arrows_css);
27603			thisOoptions.arrows.arrow_right.css(options.arrows_css);
27604		}
27605
27606		thisOoptions.GetSummWidth = function (elements) {
27607			elements = $(elements);
27608			var result = 0;
27609			if (elements.length) {
27610				elements.each(function (i, element) {
27611					var _element = $(element);
27612					var elementWidth = _element.outerWidth(true) + thisOoptions.width_grow;
27613					elementWidth = Math.ceil(elementWidth * 10) / 10;
27614					_element.data('leftBound', result);
27615					result += elementWidth;
27616					_element.data('rightBound', result);
27617				});
27618			}
27619			return result;
27620		}
27621
27622		var tabs_width = thisOoptions.GetSummWidth(thisOoptions.tabs);
27623		thisOoptions.tabs_width = tabs_width;
27624		thisOoptions.minTranslate = (thisOoptions.width < thisOoptions.tabs_width ? thisOoptions.width - thisOoptions.tabs_width - 1 : 0);
27625
27626		if (thisOoptions.tabs_width) {
27627			thisOoptions.wrapper.css({
27628				'white-space': 'nowrap',
27629				'min-width': 'auto',
27630			});
27631		};
27632		thisOoptions.scrollTab.css({
27633			'overflow': 'hidden',
27634			'position': 'relative',
27635		});
27636
27637		thisOoptions.checkArrows = function (translate) {
27638			if (translate === undefined) {
27639				translate = thisOoptions.translate;
27640			}
27641
27642			if (translate <= 1) {
27643				return;
27644			}
27645
27646			if (translate >= thisOoptions.maxTranslate) {
27647				thisOoptions.arrows.arrow_left.addClass('disabled');
27648				thisOoptions.arrows.arrow_right.removeClass('disabled');
27649			} else if (translate <= thisOoptions.minTranslate) {
27650				thisOoptions.arrows.arrow_right.addClass('disabled');
27651				thisOoptions.arrows.arrow_left.removeClass('disabled');
27652			} else {
27653				thisOoptions.arrows.arrow_left.removeClass('disabled');
27654				thisOoptions.arrows.arrow_right.removeClass('disabled');
27655			}
27656
27657		}
27658
27659		thisOoptions.directScroll = function (distance, delay) {
27660			if (delay === undefined) {
27661				delay = 5;
27662			}
27663			clearInterval(thisOoptions.timerMoveDirect);
27664			var newTranslate = thisOoptions.translate + distance;
27665
27666			if (newTranslate > thisOoptions.maxTranslate) {
27667				newTranslate = thisOoptions.maxTranslate;
27668			} else if (newTranslate < thisOoptions.minTranslate) {
27669				newTranslate = thisOoptions.minTranslate;
27670			}
27671
27672			if (delay == 0) {
27673				thisOoptions.translate = newTranslate;
27674				thisOoptions.wrapper.css({
27675					'transform': 'translateX(' + thisOoptions.translate + 'px)',
27676				});
27677			} else {
27678				thisOoptions.timerMoveDirect = setInterval(
27679					function () {
27680						if ((distance < 0 && thisOoptions.translate <= newTranslate) || (distance > 0 && thisOoptions.translate >= newTranslate)) {
27681							clearInterval(thisOoptions.timerMoveDirect);
27682						}
27683
27684						if (thisOoptions.translate < newTranslate) {
27685							thisOoptions.translate++;
27686						} else {
27687							thisOoptions.translate--;
27688						}
27689
27690						thisOoptions.wrapper.css({
27691							'transform': 'translateX(' + thisOoptions.translate + 'px)',
27692						});
27693					},
27694					delay
27695				);
27696			}
27697			thisOoptions.checkArrows(newTranslate);
27698		};
27699
27700		thisOoptions.addArrowsEvents = function () {
27701			thisOoptions.arrows.arrow_right.on('mouseenter', function () {
27702				thisOoptions.arrows.arrow_left.removeClass('disabled');
27703				thisOoptions.tabs_width = thisOoptions.GetSummWidth(thisOoptions.tabs);
27704				thisOoptions.minTranslate = (thisOoptions.width < thisOoptions.tabs_width ? thisOoptions.width - thisOoptions.tabs_width - 1 : 0);
27705				thisOoptions.timerMoveLeft = setInterval(
27706					function () {
27707						if (thisOoptions.translate < thisOoptions.minTranslate) {
27708							clearInterval(thisOoptions.timerMoveLeft);
27709							thisOoptions.arrows.arrow_right.addClass('disabled');
27710						} else {
27711							thisOoptions.translate -= thisOoptions.translateSpeed;
27712							thisOoptions.wrapper.css({
27713								'transform': 'translateX(' + thisOoptions.translate + 'px)',
27714							});
27715						}
27716					},
27717					10
27718				);
27719			});
27720
27721			thisOoptions.arrows.arrow_right.on('mouseleave', function () {
27722				clearInterval(thisOoptions.timerMoveLeft);
27723			});
27724
27725			thisOoptions.arrows.arrow_right.on('click', function () {
27726				thisOoptions.directScroll(-thisOoptions.directTranslate);
27727				thisOoptions.arrows.arrow_left.removeClass('disabled');
27728			});
27729
27730			thisOoptions.arrows.arrow_right.on('touchend', function () {
27731				setTimeout(function () {
27732					clearInterval(thisOoptions.timerMoveLeft);
27733				}, 1);
27734			});
27735
27736			thisOoptions.arrows.arrow_left.on('mouseenter', function () {
27737				thisOoptions.tabs_width = thisOoptions.GetSummWidth(thisOoptions.tabs);
27738				thisOoptions.minTranslate = (thisOoptions.width < thisOoptions.tabs_width ? thisOoptions.width - thisOoptions.tabs_width - 1 : 0);
27739				thisOoptions.arrows.arrow_right.removeClass('disabled');
27740				thisOoptions.timerMoveRight = setInterval(
27741					function () {
27742						if (thisOoptions.translate >= thisOoptions.maxTranslate) {
27743							clearInterval(thisOoptions.timerMoveRight);
27744							thisOoptions.arrows.arrow_left.addClass('disabled');
27745						} else {
27746							thisOoptions.translate += thisOoptions.translateSpeed;
27747							thisOoptions.wrapper.css({
27748								'transform': 'translateX(' + thisOoptions.translate + 'px)',
27749							});
27750						}
27751					},
27752					10
27753				);
27754			});
27755
27756			thisOoptions.arrows.arrow_left.on('mouseleave', function () {
27757				clearInterval(thisOoptions.timerMoveRight);
27758			});
27759
27760			thisOoptions.arrows.arrow_left.on('click', function () {
27761				thisOoptions.directScroll(thisOoptions.directTranslate);
27762				thisOoptions.arrows.arrow_right.removeClass('disabled');
27763			});
27764
27765			thisOoptions.arrows.arrow_left.on('touchend', function () {
27766				setTimeout(function () {
27767					clearInterval(thisOoptions.timerMoveRight);
27768				}, 1);
27769			});
27770		};
27771
27772		thisOoptions.addTabsEvents = function () {
27773			thisOoptions.tabs.on('click', function () {
27774				var leftScrollBound = thisOoptions.scrollTab[0].getBoundingClientRect().left;
27775				var rightScrollBound = thisOoptions.scrollTab[0].getBoundingClientRect().right;
27776				var tabBounds = this.getBoundingClientRect();
27777
27778				if (tabBounds.left < leftScrollBound) {
27779					thisOoptions.directScroll(leftScrollBound - tabBounds.left + thisOoptions.arrows.arrow_width, 1);
27780				} else if (tabBounds.right > rightScrollBound) {
27781					thisOoptions.directScroll(rightScrollBound - tabBounds.right - thisOoptions.arrows.arrow_width, 1);
27782				}
27783
27784				if (thisOoptions.linked_options !== undefined) {
27785					var this_index = $(this).index();
27786					var linked_tab = $(thisOoptions.linked_options.tabs[this_index]);
27787					var linked_tabs = {
27788						leftScrollBound: thisOoptions.linked_options.scrollTab[0].getBoundingClientRect().left,
27789						rightScrollBound: thisOoptions.linked_options.scrollTab[0].getBoundingClientRect().right,
27790						tabBounds: linked_tab[0].getBoundingClientRect(),
27791					};
27792					if (linked_tabs.tabBounds.left < linked_tabs.leftScrollBound) {
27793						thisOoptions.linked_options.directScroll(linked_tabs.leftScrollBound - linked_tabs.tabBounds.left + thisOoptions.linked_options.arrows.arrow_width + 1, 0);
27794					} else if (linked_tabs.tabBounds.right > linked_tabs.rightScrollBound) {
27795						thisOoptions.linked_options.directScroll(linked_tabs.rightScrollBound - linked_tabs.tabBounds.right - thisOoptions.linked_options.arrows.arrow_width - 1, 0);
27796					}
27797				}
27798
27799
27800			});
27801		};
27802
27803		thisOoptions.addWrapperEvents = function () {
27804			thisOoptions.wrapper.on('touchstart', function (event) {
27805				thisOoptions.touch.posPrev = event.originalEvent.changedTouches[0].pageX;
27806				clearInterval(thisOoptions.timerMoveRight);
27807				clearInterval(thisOoptions.timerMoveLeft);
27808				clearInterval(thisOoptions.timerMoveDirect);
27809				thisOoptions.tabs_width = thisOoptions.GetSummWidth(thisOoptions.tabs);
27810				thisOoptions.minTranslate = (thisOoptions.width < thisOoptions.tabs_width ? thisOoptions.width - thisOoptions.tabs_width - 1 : 0);
27811			});
27812
27813			thisOoptions.wrapper.on('touchmove', function (event) {
27814				thisOoptions.touch.posCurrent = event.originalEvent.changedTouches[0].pageX - thisOoptions.touch.posPrev;
27815				thisOoptions.directScroll(thisOoptions.touch.posCurrent, 0);
27816				thisOoptions.touch.posPrev = event.originalEvent.changedTouches[0].pageX;
27817			});
27818		};
27819
27820		thisOoptions.resize = function () {
27821			if (thisOoptions.onBeforeResize && typeof (thisOoptions.onBeforeResize) == 'function') {
27822				thisOoptions.onBeforeResize(thisOoptions);
27823			}
27824			thisOoptions.width = Math.ceil(thisOoptions.scrollTab[0].getBoundingClientRect().width);
27825			thisOoptions.tabs_width = thisOoptions.GetSummWidth(thisOoptions.tabs);
27826			thisOoptions.minTranslate = (thisOoptions.width < thisOoptions.tabs_width ? thisOoptions.width - thisOoptions.tabs_width - 1 : 0);
27827
27828			if (thisOoptions.onResize && typeof (thisOoptions.onResize) == 'function') {
27829				thisOoptions.onResize(thisOoptions);
27830			}
27831
27832			if (thisOoptions.translate < thisOoptions.minTranslate) {
27833				thisOoptions.directScroll(thisOoptions.minTranslate - thisOoptions.translate);
27834			} else if (thisOoptions.translate > thisOoptions.maxTranslate) {
27835				thisOoptions.directScroll(thisOoptions.maxTranslate - thisOoptions.translate);
27836			}
27837
27838			if (thisOoptions.tabs_width < thisOoptions.width) {
27839				thisOoptions.arrows.wrapper.css('display', 'none');
27840			} else {
27841				thisOoptions.arrows.wrapper.css('display', '');
27842				thisOoptions.arrows.arrow_left.removeClass('disabled');
27843				thisOoptions.arrows.arrow_right.removeClass('disabled');
27844				if (thisOoptions.translate >= 0) {
27845					thisOoptions.arrows.arrow_left.addClass('disabled');
27846				}
27847				if (thisOoptions.translate <= thisOoptions.minTranslate) {
27848					thisOoptions.arrows.arrow_right.addClass('disabled');
27849				}
27850			}
27851
27852			if (thisOoptions.onAfterResize && typeof (thisOoptions.onAfterResize) == 'function') {
27853				thisOoptions.onAfterResize(thisOoptions);
27854			}
27855		};
27856
27857
27858		_scrollTab.data('scrollTabOptions', thisOoptions);
27859		_scrollTab.data('scrollTabOptions').addArrowsEvents();
27860		_scrollTab.data('scrollTabOptions').addTabsEvents();
27861		_scrollTab.data('scrollTabOptions').addWrapperEvents();
27862		_scrollTab.addClass('arrow_scroll_init').addClass('swipeignore');
27863		_scrollTab.data('scrollTabOptions').resize();
27864		delete thisOoptions;
27865	}
27866
27867	var options = $.extend({
27868		translate: 0,
27869		translateSpeed: 2,
27870		directTranslate: 150,
27871		maxTranslate: 1,
27872		touch: {},
27873		arrows_css: false,
27874		tabs_wrapper: '.nav-tabs',
27875		onResize: false,
27876		width_grow: 9,
27877	}, options);
27878
27879	var el = $(this);
27880
27881	if (el.hasClass('arrow_scroll_init'))
27882		return false;
27883
27884	el.each(function (i, scrollTab) {
27885		_scrollTab(scrollTab, options);
27886	});
27887}
27888/* End */
27889;
27890; /* 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:"";}"*/
27891var basketTimeoutSlide;
27892var resizeEventTimer;
27893
27894var funcDefined = function (func) {
27895	try {
27896		if (typeof func == 'function')
27897			return true;
27898		else
27899			return typeof window[func] === "function";
27900	}
27901	catch (e) {
27902		return false;
27903	}
27904}
27905
27906InitLazyLoad = function () { }
27907
27908$(document).on('change', '.uploader input[type=file]', function () {
27909	if (!$(this).next().length || !$(this).next().hasClass('resetfile')) {
27910		$('<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));
27911	}
27912});
27913
27914$(document).on('click', '.uploader.files_add input[type=file] + .resetfile', function () {
27915	var $input = $(this).prev();
27916	$input.val('');
27917	$.uniform.update($input);
27918	$(this).remove();
27919});
27920
27921$(document).on('click', '.top_block h3', function () {
27922	if (window.matchMedia('(max-width: 550px)').matches) {
27923		var $this = $(this);
27924		var a = $this.siblings('a');
27925		if (a.length) {
27926			a[0].click();
27927		}
27928	}
27929});
27930
27931BX.addCustomEvent('onAjaxSuccess', function (data) {
27932	if (typeof (data) !== undefined && data !== null && typeof (data) == 'object') {
27933		if (typeof (data) !== undefined && typeof (data.BASKET_REFRESHED) !== undefined && data.BASKET_REFRESHED === true) {
27934			var basketCounts = data.BASKET_DATA.BASKET_ITEMS_COUNT;
27935			reloadBasketCounters(basketCounts);
27936		}
27937	}
27938});
27939
27940if (!funcDefined('setLocationSKU')) {
27941	function setLocationSKU(ID) {
27942		var objUrl = parseUrlQuery(),
27943			j = 0,
27944			prefix = '',
27945			query_string = '',
27946			url = '';
27947		if ('oid' in objUrl) {
27948			if (parseInt(objUrl.oid) > 0) {
27949				objUrl.oid = ID;
27950				for (var i in objUrl) {
27951					if (parseInt(j) > 0)
27952						prefix = '&';
27953					query_string = query_string + prefix + i + '=' + objUrl[i];
27954					j++;
27955				}
27956				if (query_string) {
27957					url = location.pathname + '?' + query_string;
27958				}
27959				try {
27960					history.replaceState(null, null, url);
27961					return;
27962				}
27963				catch (e) { }
27964				location.hash = '#' + url.substr(1)
27965			}
27966		}
27967	}
27968}
27969
27970
27971if (!funcDefined('ShowOverlay')) {
27972	ShowOverlay = function () {
27973		$('<div class="jqmOverlay waiting"></div>').appendTo('body');
27974	}
27975}
27976if (!funcDefined('HideOverlay')) {
27977	HideOverlay = function () {
27978		$('.jqmOverlay').detach();
27979	}
27980}
27981if (!funcDefined('trimPrice')) {
27982	var trimPrice = function trimPrice(s) {
27983		s = s.split(" ").join("");
27984		s = s.split("&nbsp;").join("");
27985		return s;
27986	}
27987}
27988
27989if (!funcDefined('markProductRemoveBasket')) {
27990	var markProductRemoveBasket = function markProductRemoveBasket(id) {
27991		$('.in-cart[data-item=' + id + ']').hide();
27992		$('.to-cart[data-item=' + id + ']').show();
27993		$('.to-cart[data-item=' + id + ']').closest('.button_block').removeClass('wide');
27994		$('.to-cart[data-item=' + id + ']').closest('.counter_wrapp').find('.counter_block').show();
27995		$('.counter_block[data-item=' + id + ']').closest('.counter_block_inner').show();
27996		$('.counter_block[data-item=' + id + ']').show();
27997		$('.in-subscribe[data-item=' + id + ']').hide();
27998		$('.to-subscribe[data-item=' + id + ']').show();
27999		//$('.wish_item[data-item='+id+']').removeClass("added");
28000		$('.wish_item[data-item=' + id + '] .value:not(.added)').show();
28001		$('.wish_item[data-item=' + id + '] .value.added').hide();
28002		$('.wish_item.to[data-item=' + id + ']').show();
28003		$('.wish_item.in[data-item=' + id + ']').hide();
28004		$('.banner_buttons.with_actions .wraps_buttons[data-id=' + id + '] .basket_item_add').removeClass('added');
28005		$('.banner_buttons.with_actions .wraps_buttons[data-id=' + id + '] .wish_item_add').removeClass('added');
28006	}
28007}
28008
28009if (!funcDefined('markProductAddBasket')) {
28010	var markProductAddBasket = function markProductAddBasket(id) {
28011		$('.to-cart[data-item=' + id + ']').hide();
28012		$('.to-cart[data-item=' + id + ']').closest('.counter_wrapp').find('.counter_block_inner').hide();
28013		$('.to-cart[data-item=' + id + ']').closest('.counter_wrapp').find('.counter_block').hide();
28014		$('.to-cart[data-item=' + id + ']').closest('.button_block').addClass('wide');
28015		$('.in-cart[data-item=' + id + ']').show();
28016		//$('.wish_item[data-item='+id+']').removeClass("added");
28017		$('.wish_item[data-item=' + id + '] .value:not(.added)').show();
28018		$('.wish_item[data-item=' + id + '] .value.added').hide();
28019
28020		$('.wish_item.to[data-item=' + id + ']').show();
28021		$('.wish_item.in[data-item=' + id + ']').hide();
28022		$('.banner_buttons.with_actions .wraps_buttons[data-id=' + id + '] .basket_item_add').addClass('added');
28023	}
28024}
28025
28026if (!funcDefined('markProductDelay')) {
28027	var markProductDelay = function markProductDelay(id) {
28028		$('.in-cart[data-item=' + id + ']').hide();
28029		$('.to-cart[data-item=' + id + ']').show();
28030		$('.to-cart[data-item=' + id + ']').closest('.counter_wrapp').find('.counter_block_inner').show();
28031		$('.to-cart[data-item=' + id + ']').closest('.counter_wrapp').find('.counter_block').show();
28032		$('.to-cart[data-item=' + id + ']').closest('.button_block').removeClass('wide');
28033		//$('.wish_item[data-item='+id+']').addClass("added");
28034		$('.wish_item[data-item=' + id + '] .value:not(.added)').hide();
28035		$('.wish_item[data-item=' + id + '] .value.added').css('display', 'block');
28036
28037		$('.wish_item.to[data-item=' + id + ']').hide();
28038		$('.wish_item.in[data-item=' + id + ']').show();
28039
28040		$('.banner_buttons.with_actions .wraps_buttons[data-id=' + id + '] .wish_item_add').addClass('added');
28041
28042	}
28043}
28044
28045if (!funcDefined('markProductSubscribe')) {
28046	var markProductSubscribe = function markProductSubscribe(id) {
28047		$('.to-subscribe[data-item=' + id + ']').hide();
28048		$('.in-subscribe[data-item=' + id + ']').css('display', 'block');
28049	}
28050}
28051
28052if (!funcDefined('basketFly')) {
28053	var basketFly = function basketFly(action, opener) {
28054		if (typeof obMaxPredictions === 'object') {
28055			obMaxPredictions.updateAll();
28056		}
28057
28058		/*if(arAsproOptions['PAGES']['BASKET_PAGE'])
28059			return;*/
28060		$.post(arAsproOptions['SITE_DIR'] + "ajax/basket_fly.php", "PARAMS=" + $("#basket_form").find("input#fly_basket_params").val(), $.proxy(function (data) {
28061			var small = $('.opener .basket_count').hasClass('small'),
28062				basket_count = $(data).find('.basket_count').find('.items div').text();
28063			$('#basket_line .basket_fly').addClass('loaded').html(data);
28064
28065			if (action == "refresh")
28066				$('li[data-type=AnDelCanBuy]').trigger('click');
28067
28068
28069			if (typeof (opener) == 'undefined' || $('#basket_line .basket_fly').hasClass('loading')) {
28070				if (window.matchMedia('(min-width: 769px)').matches) {
28071					if (action == 'open') {
28072						if (small) {
28073							if (arAsproOptions['THEME']['SHOW_BASKET_ONADDTOCART'] !== 'N') {
28074								$('.opener .basket_count').click();
28075							}
28076						}
28077						else {
28078							$('.opener .basket_count').removeClass('small')
28079							$('.tabs_content.basket li[item-section="AnDelCanBuy"]').addClass('cur');
28080							$('#basket_line ul.tabs li[item-section="AnDelCanBuy"]').addClass('cur');
28081
28082							$("#basket_line .basket_fly .opener > div:eq(0)").addClass("cur");
28083						}
28084					}
28085					else if (action == 'wish') {
28086						if (small) {
28087							if (arAsproOptions['THEME']['SHOW_BASKET_ONADDTOCART'] !== 'N')
28088								$('.opener .wish_count').click();
28089						}
28090						else {
28091							$('.opener .wish_count').removeClass('small')
28092							$('.tabs_content.basket li[item-section="DelDelCanBuy"]').addClass('cur');
28093							$('#basket_line ul.tabs li[item-section="DelDelCanBuy"]').addClass('cur');
28094						}
28095					}
28096					else {
28097						if (arAsproOptions['THEME']['SHOW_BASKET_ONADDTOCART'] !== 'N') {
28098							$('.opener .basket_count').click();
28099						}
28100					}
28101				}
28102			}
28103		}));
28104	}
28105}
28106
28107if (!funcDefined('basketTop')) {
28108	var basketTop = function basketTop(action, opener) {
28109
28110		if (action == 'close') {
28111			if ($('#headerfixed .basket_hover_block, .top_basket .basket_hover_block').length) {
28112				$('#headerfixed .basket_hover_block, .top_basket .basket_hover_block').css({
28113					'opacity': '',
28114					'visibility': ''
28115				});
28116				return true;
28117			}
28118		}
28119		/*if(arAsproOptions['PAGES']['BASKET_PAGE'])
28120			return;*/
28121
28122		$('.basket_hover_block').removeClass('loaded');
28123		$.post(arAsproOptions['SITE_DIR'] + "ajax/showBasketHover.php", "PARAMS=" + $("#basket_form").find("input#fly_basket_params").val(), $.proxy(function (data) {
28124			var small = $('.opener .basket_count').hasClass('small'),
28125				basket_count = $(data).find('.basket_count').find('.items div').text();
28126
28127			$('.basket_hover_block').each(function () {
28128				$(this).addClass('loaded').html(data);
28129			});
28130
28131			if (action == "refresh")
28132				$('li[data-type=AnDelCanBuy]').trigger('click');
28133
28134			if (typeof (opener) == 'undefined') {
28135				if (window.matchMedia('(min-width: 769px)').matches) {
28136					if (action == 'open') {
28137						// if(small)
28138						// {
28139						if (arAsproOptions['THEME']['SHOW_BASKET_ONADDTOCART'] !== 'N') {
28140
28141							if ($('#headerfixed').hasClass('fixed')) {
28142								var selector = '#headerfixed .basket_hover_block';
28143							} else {
28144								var selector = '.top_basket .basket_hover_block';
28145							}
28146
28147							$(selector).css({
28148								'opacity': '1',
28149								'visibility': 'visible'
28150							});
28151
28152							setTimeout(
28153								function () {
28154									$(selector).css({
28155										'opacity': '',
28156										'visibility': ''
28157									});
28158								},
28159								2000
28160							);
28161						}
28162						// }
28163						// else
28164						// {
28165						// 	$('.opener .basket_count').removeClass('small')
28166						// 	$('.tabs_content.basket li[item-section="AnDelCanBuy"]').addClass('cur');
28167						// 	$('#basket_line ul.tabs li[item-section="AnDelCanBuy"]').addClass('cur');
28168
28169						// 	$("#basket_line .basket_fly .opener > div:eq(0)").addClass("cur");
28170						// }
28171					}
28172					else if (action == 'wish') {
28173						if (small) {
28174							if (arAsproOptions['THEME']['SHOW_BASKET_ONADDTOCART'] !== 'N')
28175								$('.opener .wish_count').click();
28176						}
28177						else {
28178							$('.opener .wish_count').removeClass('small')
28179							$('.tabs_content.basket li[item-section="DelDelCanBuy"]').addClass('cur');
28180							$('#basket_line ul.tabs li[item-section="DelDelCanBuy"]').addClass('cur');
28181						}
28182					}
28183					else {
28184						if (arAsproOptions['THEME']['SHOW_BASKET_ONADDTOCART'] !== 'N') {
28185							$('.opener .basket_count').click();
28186						}
28187					}
28188				}
28189			}
28190		}));
28191	}
28192}
28193
28194//work with hash start
28195var lastHash = location.hash;
28196if ("onhashchange" in window) {
28197	$(window).bind('hashchange', function () {
28198		var newHash = location.hash;
28199		if (newHash == '#delayed') {
28200			if ($('#basket_toolbar_button_delayed').length)
28201				$('#basket_toolbar_button_delayed').trigger('click');
28202		}
28203		else {
28204			if ($('#basket_toolbar_button').length)
28205				$('#basket_toolbar_button').trigger('click');
28206		}
28207		// Do something
28208		var diff = compareHash(newHash, lastHash);
28209		// alert("Difference between old and new hash:\n"+diff[0]+"\n\n"+diff[1]);
28210
28211		//At the end of the func:
28212		lastHash = newHash;
28213	});
28214
28215	function compareHash(current, previous) {
28216		for (var i = 0, len = Math.min(current.length, previous.length); i < len; i++) {
28217			if (current.charAt(0) != previous.charAt(0)) break;
28218		}
28219		current = current.substr(i);
28220		previous = previous.substr(i);
28221		for (var i = 0, len = Math.min(current.length, previous.length); i < len; i++) {
28222			if (current.substr(-1) != previous.substr(-1)) break;
28223		}
28224
28225		//Array: Current = New hash, previous = old hash
28226		return [current, previous];
28227	}
28228}
28229$(document).on('click', "#basket_toolbar_button", function () {
28230	if (lastHash)
28231		location.hash = 'cart';
28232})
28233$(document).on('click', "#basket_toolbar_button_delayed", function () {
28234	if (lastHash)
28235		location.hash = 'delayed';
28236})
28237//work with hash end
28238
28239$(document).on('click', "#basket_line .basket_fly .opener > div.clicked", function () {
28240	if (arAsproOptions['PAGES']['BASKET_PAGE'])
28241		return;
28242	function onOpenFlyBasket(_this) {
28243		$("#basket_line .basket_fly .tabs li").removeClass("cur");
28244		$("#basket_line .basket_fly .tabs_content li").removeClass("cur");
28245		// $("#basket_line .basket_fly .remove_all_basket").removeClass("cur");
28246		if (!$(_this).is(".wish_count.empty")) {
28247			$("#basket_line .basket_fly .tabs_content li[item-section=" + $(_this).data("type") + "]").addClass("cur");
28248			$("#basket_line .basket_fly .tabs li:eq(" + $(_this).index() + ")").addClass("cur");
28249			// $("#basket_line .basket_fly .remove_all_basket."+$(_this).data("type")).addClass("cur");
28250		}
28251		else {
28252			$("#basket_line .basket_fly .tabs li").first().addClass("cur").siblings().removeClass("cur");
28253			$("#basket_line .basket_fly .tabs_content li").first().addClass("cur").siblings().removeClass("cur");
28254			// $("#basket_line .basket_fly .remove_all_basket").first().addClass("cur");
28255		}
28256		$("#basket_line .basket_fly .opener > div.clicked").removeClass('small');
28257
28258		$("#basket_line .basket_fly .opener > div").siblings().removeClass('cur');
28259		$("#basket_line .basket_fly .opener > div:eq(" + $(_this).index() + ")").addClass('cur');
28260
28261	}
28262
28263	if (window.matchMedia('(min-width: 769px)').matches) {
28264		var _this = this;
28265
28266		$(_this).siblings().removeClass('cur');
28267		$(_this).addClass('cur');
28268
28269		if (parseInt($("#basket_line .basket_fly").css("right")) < 0) {
28270			$("#basket_line .basket_fly").stop().addClass('loading').animate({ "right": "0" }, 333, function () {
28271				if ($(_this).closest('.basket_fly.loaded').length) {
28272					onOpenFlyBasket(_this);
28273				}
28274				else {
28275					$.ajax({
28276						url: arAsproOptions['SITE_DIR'] + 'ajax/basket_fly.php',
28277						type: 'post',
28278						success: function (html) {
28279							$('#basket_line .basket_fly').removeClass('loading').addClass('loaded').html(html);
28280							onOpenFlyBasket(_this);
28281						}
28282					});
28283				}
28284			});
28285			$('#basket_line .basket_fly').addClass('swiped');
28286		}
28287		else if ($(this).is(".wish_count:not(.empty)") && !$("#basket_line .basket_fly .basket_sort ul.tabs li.cur").is("[item-section=DelDelCanBuy]")) {
28288			$("#basket_line .basket_fly .tabs li").removeClass("cur");
28289			$("#basket_line .basket_fly .tabs_content li").removeClass("cur");
28290			// $("#basket_line .basket_fly .remove_all_basket").removeClass("cur");
28291			$("#basket_line .basket_fly .tabs_content li[item-section=" + $(this).data("type") + "]").addClass("cur");
28292			$("#basket_line  .basket_fly .tabs li:eq(" + $(this).index() + ")").first().addClass("cur");
28293			// $("#basket_line .basket_fly .remove_all_basket."+$(this).data("type")).first().addClass("cur");
28294		}
28295		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]")) {
28296			$("#basket_line .basket_fly .tabs li").removeClass("cur");
28297			$("#basket_line .basket_fly .tabs_content li").removeClass("cur");
28298			// $("#basket_line .basket_fly .remove_all_basket").removeClass("cur");
28299			$("#basket_line  .basket_fly .tabs_content li:eq(" + $(this).index() + ")").addClass("cur");
28300			$("#basket_line  .basket_fly .tabs li:eq(" + $(this).index() + ")").first().addClass("cur");
28301			// $("#basket_line .basket_fly .remove_all_basket."+$(this).data("type")).first().addClass("cur");
28302		}
28303		else {
28304			$("#basket_line .basket_fly").stop().animate({ "right": -$("#basket_line .basket_fly").outerWidth() }, 150);
28305			$("#basket_line .basket_fly .opener > div.clicked").addClass('small');
28306			$('#basket_line .basket_fly').removeClass('swiped');
28307			$("#basket_line .basket_fly .opener > div").removeClass("cur");
28308		}
28309	}
28310});
28311
28312if (!funcDefined("clearViewedProduct")) {
28313	function clearViewedProduct() {
28314		try {
28315			var siteID = arAsproOptions.SITE_ID;
28316			var localKey = 'MAX_VIEWED_ITEMS_' + siteID;
28317			var cookieParams = { path: '/', expires: 30 };
28318			if (typeof BX.localStorage !== 'undefined') {
28319				// remove local storage
28320				BX.localStorage.set(localKey, {}, 0);
28321			}
28322			// remove cookie
28323			$.removeCookie(localKey, cookieParams);
28324		}
28325		catch (e) {
28326			console.error(e);
28327		}
28328	}
28329}
28330
28331if (!funcDefined("setViewedProduct")) {
28332	function setViewedProduct(id, arData) {
28333		try {
28334
28335			// save $.cookie option
28336			var bCookieJson = $.cookie.json;
28337			$.cookie.json = true;
28338
28339			var siteID = arAsproOptions.SITE_ID;
28340			var localKey = 'MAX_VIEWED_ITEMS_' + siteID;
28341			var cookieParams = { path: '/', expires: 30 };
28342
28343			if ((typeof BX.localStorage !== 'undefined') && (typeof id !== 'undefined') && (typeof arData !== 'undefined')) {
28344				var PRODUCT_ID = (typeof arData.PRODUCT_ID !== 'undefined') ? arData.PRODUCT_ID : id;
28345				var arViewedLocal = BX.localStorage.get(localKey) ? BX.localStorage.get(localKey) : {};
28346				var arViewedCookie = $.cookie(localKey) ? $.cookie(localKey) : {};
28347				var count = 0;
28348
28349				// delete some items (sync cookie & local storage)
28350				for (var _id in arViewedLocal) {
28351					arViewedLocal[_id].IS_LAST = false;
28352					if (typeof arViewedCookie[_id] === 'undefined') {
28353						delete arViewedLocal[_id];
28354					}
28355				}
28356				for (var _id in arViewedCookie) {
28357					if (typeof arViewedLocal[_id] === 'undefined') {
28358						delete arViewedCookie[_id];
28359					}
28360				}
28361
28362				for (var _id in arViewedCookie) {
28363					count++;
28364				}
28365
28366				// delete item if other item (offer) of that PRODUCT_ID is exists
28367				if (typeof arViewedLocal[PRODUCT_ID] !== 'undefined') {
28368					if (arViewedLocal[PRODUCT_ID].ID != id) {
28369						delete arViewedLocal[PRODUCT_ID];
28370						delete arViewedCookie[PRODUCT_ID];
28371					}
28372				}
28373
28374				delete arViewedLocal[2243];
28375				delete arViewedCookie[2243];
28376
28377				var time = new Date().getTime();
28378				arData.ID = id;
28379				arData.ACTIVE_FROM = time;
28380				arData.IS_LAST = true;
28381				arViewedLocal[PRODUCT_ID] = arData;
28382				arViewedCookie[PRODUCT_ID] = [time.toString(), arData.PICTURE_ID];
28383
28384				$.cookie(localKey, arViewedCookie, cookieParams);
28385				BX.localStorage.set(localKey, arViewedLocal, 2592000);  // 30 days
28386			}
28387		}
28388		catch (e) {
28389			console.error(e);
28390		}
28391		finally {
28392			// restore $.cookie option
28393			$.cookie.json = bCookieJson;
28394		}
28395	}
28396}
28397
28398
28399
28400if (!funcDefined('initSelects')) {
28401	function initSelects(target) {
28402		var iOS = (navigator.userAgent.match(/(iPad|iPhone|iPod)/g) ? true : false);
28403		if (iOS) return;
28404		if ($("#bx-soa-order").length)
28405			return;
28406		// SELECT STYLING
28407		$(target).find('.wrapper1 select:visible').ikSelect({
28408			syntax: '<div class="ik_select_link"> \
28409						<span class="ik_select_link_text"></span> \
28410						<div class="trigger"></div> \
28411					</div> \
28412					<div class="ik_select_dropdown"> \
28413						<div class="ik_select_list"> \
28414						</div> \
28415					</div>',
28416			dynamicWidth: true,
28417			ddMaxHeight: 112,
28418			customClass: 'common_select',
28419			//equalWidths: true,
28420			onShow: function (inst) {
28421				inst.$dropdown.css('top', (parseFloat(inst.$dropdown.css('top')) - 5) + 'px');
28422				if (inst.$dropdown.outerWidth() < inst.$link.outerWidth()) {
28423					inst.$dropdown.css('width', inst.$link.outerWidth());
28424				}
28425				if (inst.$dropdown.outerWidth() > inst.$link.outerWidth()) {
28426					inst.$dropdown.css('width', inst.$link.outerWidth());
28427				}
28428				var count = 0,
28429					client_height = 0;
28430				inst.$dropdown.css('left', inst.$link.offset().left);
28431				$(inst.$listInnerUl).find('li').each(function () {
28432					if (!$(this).hasClass('ik_select_option_disabled')) {
28433						++count;
28434						client_height += $(this).outerHeight();
28435					}
28436				})
28437				if (client_height < 112) {
28438					inst.$listInner.css('height', 'auto');
28439				} else {
28440					inst.$listInner.css('height', '112px');
28441				}
28442				inst.$link.addClass('opened');
28443				inst.$listInner.addClass('scroller');
28444				if ($('.confirm_region').length)
28445					$('.confirm_region').remove();
28446			},
28447			onHide: function (inst) {
28448				inst.$link.removeClass('opened');
28449			}
28450		});
28451		// END OF SELECT STYLING
28452
28453		var timeout;
28454		$(window).on('resize', function () {
28455			ignoreResize.push(true);
28456			clearTimeout(timeout);
28457			timeout = setTimeout(function () {
28458				//$('select:visible').ikSelect('redraw');
28459				var inst = '';
28460				if (inst = $('.common_select-link.opened + select').ikSelect().data('plugin_ikSelect')) {
28461					inst.$dropdown.css('left', inst.$link.offset().left + 'px');
28462				}
28463			}, 20);
28464			ignoreResize.pop();
28465		});
28466	}
28467}
28468
28469if (!funcDefined('CheckTopMenuFullCatalogSubmenu')) {
28470	CheckTopMenuFullCatalogSubmenu = function () {
28471		if (arAsproOptions['THEME']['MENU_TYPE_VIEW'] != 'HOVER')
28472			return;
28473
28474		var $menu = $('.left_block .menu_top_block');
28475		if ($menu.length) {
28476			var $wrapmenu = $menu.parents('.wrap_menu');
28477
28478			var wrapMenuWidth = $menu.closest('.wrapper_inner').actual('width');
28479			if (!wrapMenuWidth)
28480				wrapMenuWidth = $menu.closest('.wraps').actual('width');
28481
28482			var bCatalogFirst = $menu.hasClass('catalogfirst');
28483			var findMenuLi = $('.left_block .menu_top_block:visible li.full');
28484			var parentSubmenuWidth = $menu.actual('outerWidth');
28485			var wrapMenuLeft = 0;
28486			var wrapMenuRight = 0;
28487
28488			if ($wrapmenu.length) {
28489				wrapMenuWidth = $wrapmenu.actual('outerWidth');
28490				wrapMenuLeft = $wrapmenu.offset().left;
28491				wrapMenuRight = wrapMenuLeft + wrapMenuWidth;
28492			}
28493
28494			if ($('.left_block .catalog_block.menu_top_block').length) {
28495				if ($('.left_block .catalog_block.menu_top_block').is(':visible'))
28496					findMenuLi = $('.left_block .menu_top_block.catalog_block li.full');
28497			}
28498			findMenuLi.each(function () {
28499				var $this = $(this);
28500				var $submenu = $this.find('>.dropdown');
28501
28502				if ($submenu.length) {
28503					// $submenu.css({left: parentSubmenuWidth + 'px', width: (wrapMenuWidth - parentSubmenuWidth) + 'px', 'padding-left': '0px', 'padding-right': '0px', 'opacity': 1});
28504					$submenu.css({ width: (wrapMenuWidth - parentSubmenuWidth) + 'px' });
28505
28506					if (!isOnceInited && arAsproOptions["THEME"]["MENU_POSITION"] == "TOP") {
28507						$this.on('mouseenter', function () {
28508							$submenu.css('min-height', $this.closest('.dropdown').actual('outerHeight') + 'px');
28509						});
28510					}
28511				}
28512			});
28513		}
28514	}
28515}
28516
28517$.fn.getMaxHeights = function (outer, classNull, minHeight) {
28518	var maxHeight = this.map(function (i, e) {
28519		var calc_height = 0;
28520		$(e).css('height', '');
28521
28522		if (outer == true)
28523			calc_height = $(e).actual('outerHeight');
28524		else
28525			calc_height = $(e).actual('height');
28526
28527		return calc_height;
28528	}).get();
28529	for (var i = 0, c = maxHeight.length; i < c; ++i) {
28530		if (maxHeight[i] % 2)
28531			--maxHeight[i];
28532	}
28533	return Math.max.apply(this, maxHeight);
28534}
28535
28536$.fn.equalizeHeights = function (outer, classNull, options) {
28537	var maxHeight = [];
28538	for (var i = 0, itemKey = 0; i < this.length; itemKey++) {
28539
28540		var item = this[itemKey],
28541			_item = $(item),
28542			minus_height = 0,
28543			calc_height = 0;
28544
28545		i++;
28546
28547		if (options.blockNull !== undefined) {
28548			if (options.blockNull.class !== undefined) {
28549				if (_item.hasClass(options.blockNull.class) || _item.closest('.' + options.blockNull.class).length) {
28550					var counts = options.blockNull.width === undefined ? 1 : options.blockNull.width - 1;
28551					i += counts;
28552					continue;
28553				}
28554			}
28555		}
28556
28557		if (classNull !== false) {
28558			if (!isMobile) {
28559				var nulled = _item.find(classNull);
28560				if (nulled.length) {
28561					minus_height = parseInt(nulled[0].offsetHeight);
28562					//minus_height=parseInt(_item.find(classNull).outerHeight(false));
28563					//minus_height=parseInt(_item.find(classNull).actual('outerHeight'));
28564				}
28565			}
28566		}
28567
28568		if (minus_height)
28569			minus_height += 12;
28570
28571		_item.css('height', '');
28572
28573		calc_height = item.offsetHeight - minus_height;
28574
28575		if (options.minHeight !== false) {
28576			if (calc_height < options.minHeight)
28577				calc_height += (options.minHeight - calc_height);
28578
28579			if (window.matchMedia('(max-width: 520px)').matches)
28580				calc_height = 300;
28581
28582			if (window.matchMedia('(max-width: 400px)').matches)
28583				calc_height = 200;
28584
28585		}
28586
28587		if (!calc_height)
28588			calc_height = 0;
28589
28590		maxHeight.push(calc_height);
28591	}
28592
28593
28594	for (var i = 0, c = maxHeight.length; i < c; ++i) {
28595		if (maxHeight[i] % 2) {
28596			--maxHeight[i];
28597		}
28598	}
28599	var result = this.height(Math.max.apply(this, maxHeight));
28600
28601	return result;
28602}
28603
28604$.fn.getFloatWidth = function () {
28605	var width = 0;
28606	if ($(this).length) {
28607		var rect = $(this)[0].getBoundingClientRect();
28608		if (!(width = rect.width))
28609			width = rect.right - rect.left;
28610	}
28611
28612	$(this).data('floatWidth', width);
28613
28614	return width;
28615}
28616
28617function extendDepthObject(target, FromObj) {
28618	var to = Object.assign({}, target);
28619	for (var key in FromObj) {
28620		if (typeof (FromObj[key]) == 'object') {
28621			to[key] = extendDepthObject(to[key], FromObj[key]);
28622		} else {
28623			to[key] = FromObj[key];
28624		}
28625	}
28626
28627	return to;
28628}
28629
28630$.fn.sliceHeight = function (options) {
28631	function _slice(el) {
28632		var arBreakpoints = Object.keys(options.breakpoint);
28633		var resizeOptionsTmp = {};
28634		if (arBreakpoints.length) {
28635			for (var key in arBreakpoints) {
28636				if (window.matchMedia(arBreakpoints[key].toString()).matches) {
28637					resizeOptionsTmp = options.breakpoint[arBreakpoints[key]];
28638				}
28639			}
28640		}
28641
28642		var resizeOptions = extendDepthObject(options, resizeOptionsTmp);
28643
28644		var blockNullClass = resizeOptions.blockNull !== undefined && resizeOptions.blockNull.class !== undefined ? resizeOptions.blockNull.class : false;
28645		var parent = (typeof (resizeOptions.row) !== 'undefined' && resizeOptions.row.length) ? el.first().parents(resizeOptions.row) : el.first().parents('.items');
28646		var item = '';
28647
28648		if (typeof (resizeOptions.item) !== 'undefined' && resizeOptions.item.length) {
28649			if (blockNullClass) {
28650				$(resizeOptions.item).each(function (i, element) {
28651					_element = $(element);
28652					if (!_element.hasClass(blockNullClass)) {
28653						item = _element;
28654					}
28655				});
28656			} else {
28657				item = $(resizeOptions.item).first();
28658			}
28659		} else {
28660			if (el.first().hasClass('item')) {
28661				item = el.first();
28662			} else {
28663				item = el.first().parents('.item');
28664			}
28665		}
28666
28667		if (typeof (resizeOptions.autoslicecount) == 'undefined' || resizeOptions.autoslicecount !== false) {
28668			var elsw = parent.getFloatWidth(),
28669				elw = item.getFloatWidth();
28670			if (!elsw) {
28671				elsw = el.first().parents('.row').getFloatWidth();
28672			}
28673			if (!elw) {
28674				if (typeof (resizeOptions.item) !== 'undefined' && resizeOptions.item.length)
28675					elw = (($(resizeOptions.item + ':eq(1)').getFloatWidth()) ? $(resizeOptions.item + ':eq(1)').getFloatWidth() : $(resizeOptions.item + ':eq(2)').getFloatWidth());
28676				else
28677					elw = (($(el[1]).getFloatWidth()) ? $(el[1]).getFloatWidth() : $(el[2]).getFloatWidth());
28678			}
28679			if (elw && resizeOptions.fixWidth)
28680				elw -= resizeOptions.fixWidth;
28681
28682			elw = (parseInt(elw * 100)) / 100;
28683
28684			if (elsw && elw) {
28685				resizeOptions.slice = Math.floor(elsw / elw);
28686			}
28687		}
28688
28689		if (resizeOptions.customSlice) //manual slice count
28690		{
28691			var bSliceNext = false;
28692			if (resizeOptions.length) {
28693				elw = (typeof (resizeOptions.item) !== 'undefined' && resizeOptions.item.length) ? $(resizeOptions.item).last().getFloatWidth() : (el.last().hasClass('item') ? el.last().getFloatWidth() : el.last().parents('.item').getFloatWidth());
28694				if (elw)
28695					resizeOptions.sliceNext = Math.floor(elsw / elw);
28696
28697				bSliceNext = true;
28698			}
28699		}
28700
28701		elements = [];
28702		if (resizeOptions.classes !== undefined && resizeOptions.classes.length) {
28703			for (var i = 0; i < resizeOptions.classes.length; i++) {
28704				var items = $(resizeOptions.item).find(resizeOptions.classes[i]);
28705				elements.push(items);
28706			}
28707		}
28708		var elIndex = elements.push(el) - 1;
28709
28710		if (resizeOptions.mobile == true) {
28711			if (window.matchMedia('(max-width: 500px)').matches) {
28712				for (var block = 0; block < elements.length; block++) {
28713					var items = $(elements[block]);
28714					items.css({
28715						'line-height': '',
28716						'height': '',
28717					});
28718				}
28719				return;
28720			}
28721		}
28722
28723		if (typeof (resizeOptions.typeResize) == 'undefined' || resizeOptions.typeResize == false) {
28724			if (resizeOptions.slice) {
28725				for (var block = 0; block < elements.length; block++) {
28726					if (resizeOptions.currentRow) {
28727						var itemNumber = el.index(resizeOptions.currentItem);
28728						var rowCount = resizeOptions.slice;
28729						var rowNumber = Math.floor(itemNumber / rowCount);
28730
28731						var items = $(elements[block].slice(rowNumber * rowCount, rowNumber * rowCount + rowCount));
28732						var classNull = block == elIndex ? resizeOptions.classNull : false;
28733						items.css({
28734							'line-height': '',
28735							'height': '',
28736						});
28737						items.equalizeHeights(resizeOptions.outer, classNull, resizeOptions);
28738					} else {
28739						for (var i = 0; i < elements[block].length; i += resizeOptions.slice) {
28740							if (resizeOptions.customSlice && resizeOptions.sliceNext && bSliceNext && i) //manual slice count
28741								resizeOptions.slice = resizeOptions.sliceNext;
28742							var items = $(elements[block].slice(i, i + resizeOptions.slice));
28743							var classNull = block == elIndex ? resizeOptions.classNull : false;
28744
28745							if (resizeOptions.blockNull !== undefined) {
28746								if (resizeOptions.blockNull.class !== undefined) {
28747									var counts = 0;
28748									items.each(function (i, item) {
28749										var _item = $(item);
28750										if (_item.hasClass(resizeOptions.blockNull.class) || _item.closest('.' + resizeOptions.blockNull.class).length) {
28751											counts++;
28752										}
28753									});
28754								}
28755							}
28756							items.css({
28757								'line-height': '',
28758								'height': '',
28759							});
28760							items.equalizeHeights(resizeOptions.outer, classNull, resizeOptions);
28761
28762
28763							if (counts) {
28764								i -= resizeOptions.blockNull.width * counts - 1;
28765							}
28766						}
28767					}
28768
28769				}
28770			}
28771			if (resizeOptions.lineheight) {
28772				var lineheightAdd = parseInt(resizeOptions.lineheight);
28773				if (isNaN(lineheightAdd)) {
28774					lineheightAdd = 0;
28775				}
28776				el.each(function () {
28777					$(this).css('line-height', ($(this).actual('height') + lineheightAdd) + 'px');
28778				});
28779			}
28780		}
28781	}
28782	var options = $.extend({
28783		slice: null,
28784		sliceNext: null,
28785		outer: false,
28786		lineheight: false,
28787		autoslicecount: true,
28788		classNull: false,
28789		minHeight: false,
28790		row: false,
28791		item: false,
28792		typeResize: false,
28793		typeValue: false,
28794		fixWidth: 0,
28795		resize: true,
28796		mobile: false,
28797		customSlice: false,
28798		breakpoint: {},
28799		classes: [],
28800	}, options);
28801
28802	var el = $(this);
28803
28804	ignoreResize.push(true);
28805	_slice(el);
28806	ignoreResize.pop();
28807
28808	if (options.resize) {
28809		BX.addCustomEvent('onWindowResize', function (eventdata) {
28810			try {
28811				ignoreResize.push(true);
28812				_slice(el);
28813			}
28814			catch (e) { }
28815			finally {
28816				ignoreResize.pop();
28817			}
28818		});
28819	}
28820	else {
28821		if (!ignoreResize.length) {
28822			// ignoreResize.push(true);
28823			_slice(el);
28824			// ignoreResize.pop();
28825		}
28826	}
28827}
28828
28829$.fn.sliceHeightNoResize = function (options) {
28830	function _slice(el) {
28831		el.each(function () {
28832			$(this).css('line-height', '');
28833			$(this).css('height', '');
28834		});
28835		if (options.mobile == true) {
28836			if (window.matchMedia('(max-width: 550px)').matches)
28837				return;
28838		}
28839		if (typeof (options.autoslicecount) == 'undefined' || options.autoslicecount !== false) {
28840			var elsw = (typeof (options.row) !== 'undefined' && options.row.length) ? el.first().parents(options.row).getFloatWidth() : el.first().parents('.items').getFloatWidth(),
28841				elw = (typeof (options.item) !== 'undefined' && options.item.length) ? $(options.item).first().getFloatWidth() : (el.first().hasClass('item') ? el.first().getFloatWidth() : el.first().parents('.item').getFloatWidth());
28842
28843			if (!elsw) {
28844				elsw = el.first().parents('.row').getFloatWidth();
28845			}
28846			if (elw && options.fixWidth)
28847				elw -= options.fixWidth;
28848
28849			if (elsw && elw) {
28850				options.slice = Math.floor(elsw / elw);
28851			}
28852		}
28853		if (options.customSlice) //manual slice count
28854		{
28855			var arBreakpoints = Object.keys(options.breakpoint),
28856				bSliceNext = false;
28857			if (arBreakpoints.length) {
28858				elw = (typeof (options.item) !== 'undefined' && options.item.length) ? $(options.item).last().getFloatWidth() : (el.last().hasClass('item') ? el.last().getFloatWidth() : el.last().parents('.item').getFloatWidth());
28859				if (elw)
28860					options.sliceNext = Math.floor(elsw / elw);
28861				for (var key in arBreakpoints) {
28862					if (window.matchMedia(arBreakpoints[key].toString()).matches) {
28863						bSliceNext = true;
28864						options.slice = options.breakpoint[arBreakpoints[key]];
28865					}
28866				}
28867			}
28868		}
28869		if (typeof (options.typeResize) == 'undefined' || options.typeResize == false) {
28870			if (options.slice) {
28871				for (var i = 0; i < el.length; i += options.slice) {
28872					if (options.customSlice && options.sliceNext && bSliceNext && i) //manual slice count
28873						options.slice = options.sliceNext;
28874					$(el.slice(i, i + options.slice)).equalizeHeights(options.outer, options.classNull, options.minHeight, options.typeResize, options.typeValue);
28875				}
28876			}
28877			if (options.lineheight) {
28878				var lineheightAdd = parseInt(options.lineheight);
28879				if (isNaN(lineheightAdd)) {
28880					lineheightAdd = 0;
28881				}
28882				el.each(function () {
28883					$(this).css('line-height', ($(this).actual('height') + lineheightAdd) + 'px');
28884				});
28885			}
28886		}
28887	}
28888	var options = $.extend({
28889		slice: null,
28890		sliceNext: null,
28891		outer: false,
28892		lineheight: false,
28893		autoslicecount: true,
28894		classNull: false,
28895		minHeight: false,
28896		row: false,
28897		item: false,
28898		typeResize: false,
28899		typeValue: false,
28900		fixWidth: 0,
28901		resize: true,
28902		mobile: false,
28903		customSlice: false,
28904		breakpoint: {},
28905	}, options);
28906
28907	var el = $(this);
28908
28909	ignoreResize.push(true);
28910	_slice(el);
28911	ignoreResize.pop();
28912}
28913
28914if (!funcDefined('initHoverBlock')) {
28915	function initHoverBlock(target) {
28916		/*$(target).find('.catalog_item.item_wrap').on('mouseenter', function(){
28917			$(this).addClass('hover');
28918		})
28919		$(target).find('.catalog_item.item_wrap').on('mouseleave', function(){
28920			$(this).removeClass('hover');
28921		})*/
28922	}
28923}
28924if (!funcDefined('setStatusButton')) {
28925	function setStatusButton() {
28926		if (!funcDefined('setItemButtonStatus')) {
28927			setItemButtonStatus = function (data) {
28928				if (data.BASKET) {
28929					for (var i in data.BASKET) {
28930						var id = data.BASKET[i];
28931						if (typeof id === 'number' || typeof id === 'string') {
28932							$('.to-cart[data-item=' + id + ']').hide();
28933							$('.counter_block[data-item=' + id + ']').closest('.counter_block_inner').hide();
28934							$('.counter_block[data-item=' + id + ']').hide();
28935							$('.in-cart[data-item=' + id + ']').show();
28936							$('.in-cart[data-item=' + id + ']').closest('.button_block').addClass('wide');
28937						}
28938					}
28939				}
28940				if (data.DELAY) {
28941					for (var i in data.DELAY) {
28942						var id = data.DELAY[i];
28943						if (typeof id === 'number' || typeof id === 'string') {
28944							$('.wish_item.to[data-item=' + id + ']').hide();
28945							$('.wish_item.in[data-item=' + id + ']').show();
28946							if ($('.wish_item[data-item=' + id + ']').find(".value.added").length) {
28947								//$('.wish_item[data-item='+id+']').addClass("added");
28948								$('.wish_item[data-item=' + id + ']').find(".value").hide();
28949								$('.wish_item[data-item=' + id + ']').find(".value.added").show();
28950							}
28951						}
28952					}
28953				}
28954				if (data.SUBSCRIBE) {
28955					for (var i in data.SUBSCRIBE) {
28956						var id = data.SUBSCRIBE[i];
28957						if (typeof id === 'number' || typeof id === 'string') {
28958							$('.to-subscribe[data-item=' + id + ']').hide();
28959							$('.in-subscribe[data-item=' + id + ']').show();
28960						}
28961					}
28962				}
28963				if (data.COMPARE) {
28964					for (var i in data.COMPARE) {
28965						var id = data.COMPARE[i];
28966						if (typeof id === 'number' || typeof id === 'string') {
28967							$('.compare_item.to[data-item=' + id + ']').hide();
28968							$('.compare_item.in[data-item=' + id + ']').show();
28969							if ($('.compare_item[data-item=' + id + ']').find(".value.added").length) {
28970								$('.compare_item[data-item=' + id + ']').find(".value").hide();
28971								$('.compare_item[data-item=' + id + ']').find(".value.added").show();
28972							}
28973						}
28974					}
28975				}
28976			}
28977		}
28978		if (!Object.keys(arStatusBasketAspro).length) {
28979			if (typeof arAsproOptions === 'undefined') {
28980				var arAsproOptions = ({
28981					"SITE_DIR": '/'
28982				});
28983				if ($('body').data('site') !== undefined)
28984					arAsproOptions["SITE_DIR"] = $('body').data('site');
28985			}
28986			$.ajax({
28987				url: arAsproOptions["SITE_DIR"] + 'ajax/getAjaxBasket.php',
28988				type: 'POST',
28989				success: function (data) {
28990					arStatusBasketAspro = data;
28991					setItemButtonStatus(arStatusBasketAspro);
28992				}
28993			});
28994		}
28995		else
28996			setItemButtonStatus(arStatusBasketAspro);
28997	}
28998}
28999
29000
29001if (!funcDefined('onLoadjqm')) {
29002	var onLoadjqm = function (name, hash, requestData, selector, requestTitle, isButton, thButton) {
29003		if (hash.c.noOverlay === undefined || (hash.c.noOverlay !== undefined && !hash.c.noOverlay)) {
29004			$('body').addClass('jqm-initied');
29005		}
29006		if (window.matchMedia('(min-width: 768px)').matches) {
29007			$("body").addClass("swipeignore");
29008		}
29009
29010		if (typeof $(hash.t).data('ls') !== ' undefined' && $(hash.t).data('ls')) {
29011			var ls = $(hash.t).data('ls'),
29012				ls_timeout = 0,
29013				v = '';
29014
29015			if ($(hash.t).data('ls_timeout'))
29016				ls_timeout = $(hash.t).data('ls_timeout');
29017
29018			ls_timeout = ls_timeout ? Date.now() + (ls_timeout * 1000) : '';
29019
29020			if (typeof localStorage !== 'undefined') {
29021				var val = localStorage.getItem(ls);
29022				try {
29023					v = JSON.parse(val);
29024				}
29025				catch (e) {
29026					v = val
29027				}
29028				if (v != null) {
29029					localStorage.removeItem(ls);
29030				}
29031				v = {};
29032				v['VALUE'] = 'Y';
29033				v['TIMESTAMP'] = ls_timeout; // default: seconds for 1 day
29034
29035				localStorage.setItem(ls, JSON.stringify(v));
29036			}
29037			else {
29038				var val = $.cookie(ls);
29039				if (!val)
29040					$.cookie(ls, "Y", { expires: ls_timeout });// default: seconds for 1 day
29041			}
29042
29043			var dopClasses = hash.w.find('.marketing-popup').data('classes');
29044			if (dopClasses) {
29045				hash.w.addClass(dopClasses);
29046			}
29047		}
29048
29049		$.each($(hash.t).get(0).attributes, function (index, attr) {
29050			if (/^data\-autoload\-(.+)$/.test(attr.nodeName)) {
29051				var key = attr.nodeName.match(/^data\-autoload\-(.+)$/)[1];
29052				var el = $('input[data-sid="' + key.toUpperCase() + '"]');
29053				// el.val( $(hash.t).data('autoload-'+key) ).attr('readonly', 'readonly');
29054				el.val(BX.util.htmlspecialcharsback($(hash.t).data('autoload-' + key))).attr('readonly', 'readonly');
29055				el.closest('.form-group').addClass('input-filed');
29056				el.attr('title', el.val());
29057			}
29058		});
29059
29060		//show gift block
29061		if (hash.w.hasClass('send_gift_frame')) {
29062			var imgHtml = priceHtml = propsHtml = '';
29063			if ($('.offers_img a').length)
29064				imgHtml = $('.offers_img a').html();
29065			else if ($('.product-detail-gallery__container').length)
29066				imgHtml = '<img src=' + $('.product-detail-gallery__container link[itemprop="image"]').attr('href') + ' />';
29067
29068			if ($('.product-container *[itemprop="offers"]').length) //show price
29069			{
29070				if ($('.sku-view').length) {
29071					if ($('.prices_block .price').length)
29072						priceHtml = $('.prices_block .cost.prices').html().replace('id', 'data-id');
29073				}
29074				else {
29075					if ($('.prices_block .with_matrix').length)
29076						priceHtml = '<div class="with_matrix">' + $('.prices_block .with_matrix').html() + '</div>';
29077					else if ($('.prices_block .price_group.min').length)
29078						priceHtml = $('.prices_block .price_group.min').html();
29079					else if ($('.prices_block .price_matrix_wrapper').length)
29080						priceHtml = $('.prices_block .price_matrix_wrapper').html();
29081				}
29082			}
29083
29084			if ($('.buy_block .sku_props').length) {
29085				propsHtml = '<div class="props_item">';
29086				$('.buy_block .sku_props .bx_catalog_item_scu > div').each(function () {
29087					var title = $(this).find('.bx_item_section_name > span').html(),
29088						props = ($(this).find('.ik_select_link_text').length ? $(this).find('.ik_select_link_text').text() : $(this).find('ul li.active > span').text());
29089					// props = ($(this).find('ul li').length ? $(this).find('ul li.active > span').text() : $(this).find('.ik_select_link_text').text());
29090
29091					propsHtml += '<div class="prop_item">' +
29092						'<span>' +
29093						title + (title.indexOf(':') > 0 ? '' : ': ') +
29094						(title.indexOf(':') > 0 ? '' : '<span class="val">' + props + '</span>') +
29095						'</span>' +
29096						'</div>';
29097
29098				})
29099				propsHtml += '</div>';
29100			}
29101			$('<div class="custom_block">' +
29102				'<div class="title">' + BX.message('POPUP_GIFT_TEXT') + '</div>' +
29103				'<div class="item_block">' +
29104				'<table class="item_list"><tr>' +
29105				'<td class="image">' +
29106				'<div>' + imgHtml + '</div>' +
29107				'</td>' +
29108				'<td class="text">' +
29109				'<div class="name">' + $('h1').text() + '</div>' +
29110				priceHtml +
29111				propsHtml +
29112				'</td>' +
29113				'</tr></table>' +
29114				'</div>' +
29115				'</div>').prependTo(hash.w.find('.form_body'))
29116		}
29117
29118		if (arAsproOptions['THEME']['REGIONALITY_SEARCH_ROW'] == 'Y' && (hash.w.hasClass('city_chooser_frame ') || hash.w.hasClass('city_chooser_small_frame')))
29119			hash.w.addClass('small_popup_regions');
29120
29121		if (hash.w.hasClass('city_chooser_frame ') || hash.w.hasClass('city_chooser_small_frame ')) {
29122			$('.popup_regions .items .items_block').mCustomScrollbar({
29123				mouseWheel: {
29124					scrollAmount: 150,
29125					preventDefault: true
29126				}
29127			});
29128		}
29129
29130
29131		if (name == 'fast_view' && $('.smart-filter-filter').length) {
29132			var navButtons = '<div class="navigation-wrapper-fast-view">' +
29133				'<div class="fast-view-nav prev colored_theme_hover_bg" data-fast-nav="prev">' +
29134				'<i class="svg left">' +
29135				'<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
291351,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>' +
29136				'</i>' +
29137				'</div>' +
29138
29139				'<div class="fast-view-nav next colored_theme_hover_bg" data-fast-nav="next">' +
29140				'<i class="svg right">' +
29141				'<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>' +
29142				'</i>' +
29143				'</div>' +
29144				'</div>';
29145
29146			hash.w.closest('#popup_iframe_wrapper').append(navButtons);
29147		}
29148
29149		hash.w.addClass('show').css({
29150			// 'top': (($(window).height() > hash.w.height()) ? Math.floor(($(window).height() - hash.w.height()) / 2) : 0) + 'px',
29151			// 'margin-left': ($(window).width() > hash.w.outerWidth() ? '-' + hash.w.outerWidth() / 2 + 'px' : '-' + $(window).width() / 2 + 'px'),
29152			'opacity': 1
29153		});
29154
29155		hash.w.mCustomScrollbar({
29156			mouseWheel: {
29157				scrollAmount: 150,
29158				preventDefault: true
29159			}
29160		});
29161
29162		if (hash.c.noOverlay === undefined || (hash.c.noOverlay !== undefined && !hash.c.noOverlay)) {
29163			$('body').css({ 'overflow': 'hidden', 'height': '100vh' });
29164			hash.w.closest('#popup_iframe_wrapper').css({ 'z-index': 3000, 'display': 'flex' });
29165		}
29166
29167		var eventdata = { action: 'loadForm' };
29168		BX.onCustomEvent('onCompleteAction', [eventdata, $(hash.t)[0]]);
29169
29170
29171		if (typeof (requestData) == 'undefined') {
29172			requestData = '';
29173		}
29174		if (typeof (selector) == 'undefined') {
29175			selector = false;
29176		}
29177
29178		var width = $('.' + name + '_frame').width();
29179		//$('.'+name+'_frame').css('margin-left', '-'+width/2+'px');
29180
29181		if (name == 'order-popup-call') {
29182		}
29183		else if (name == 'order-button') {
29184			$(".order-button_frame").find("div[product_name]").find("input").val(hash.t.title).attr("readonly", "readonly").css({ "overflow": "hidden", "text-overflow": "ellipsis" });
29185		}
29186		else if (name == 'basket_error') {
29187			$(".basket_error_frame .pop-up-title").text(requestTitle);
29188			$(".basket_error_frame .ajax_text").html(requestData);
29189
29190			if (window.matchMedia('(max-width: 991px)').matches) {
29191				$("body").addClass("all_viewed");
29192			}
29193
29194			initSelects(document);
29195			if (isButton == "Y" && thButton)
29196				$("<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"));
29197		}
29198
29199		$('.' + name + '_frame').show();
29200	}
29201}
29202
29203$.fn.jqmEx = function () {
29204	// $(this).each(function(){
29205	var _this = $(this);
29206	var noOverlay = _this.data('noOverlay') == 'Y';
29207	var name = _this.data('name');
29208	var sFastViewClass = '';
29209	if (name.length) {
29210		if (_this.closest('#fast_view_item').length) {
29211			sFastViewClass = 'fast_view_popup';
29212		}
29213
29214		var paramsStr = ''; var trigger = ''; var arTriggerAttrs = {};
29215		$.each(_this.get(0).attributes, function (index, attr) {
29216			var attrName = attr.nodeName;
29217			var attrValue = _this.attr(attrName);
29218			trigger += '[' + attrName + '=\"' + attrValue + '\"]';
29219			arTriggerAttrs[attrName] = attrValue;
29220			if (/^data\-param\-(.+)$/.test(attrName)) {
29221				var key = attrName.match(/^data\-param\-(.+)$/)[1];
29222				paramsStr += key + '=' + attrValue + '&';
29223			}
29224		});
29225
29226		var triggerAttrs = JSON.stringify(arTriggerAttrs);
29227		var encTriggerAttrs = encodeURIComponent(triggerAttrs);
29228		var script = arAsproOptions['SITE_DIR'] + 'ajax/form.php';
29229		if (name == 'auth')
29230			script += '?' + paramsStr + 'auth=Y';
29231		else
29232			script += '?' + paramsStr + 'data-trigger=' + encTriggerAttrs;
29233
29234		if (_this.attr('disabled') != 'disabled') {
29235			$('body').find('.' + name + '_frame[data-trigger="' + encTriggerAttrs + '"]').remove();
29236
29237			if (noOverlay) {
29238				$('body').append('<div class="' + name + '_frame ' + sFastViewClass + ' jqmWindow popup" data-trigger="' + encTriggerAttrs + '"></div>');
29239			} else {
29240				$('#popup_iframe_wrapper').append('<div class="' + name + '_frame ' + sFastViewClass + ' jqmWindow popup" data-trigger="' + encTriggerAttrs + '"></div>');
29241			}
29242
29243			//$('body').append('<div class="' + name + '_frame ' + sFastViewClass+' jqmWindow popup" data-trigger="' + encTriggerAttrs + '"></div>');
29244
29245			$('.' + name + '_frame[data-trigger="' + encTriggerAttrs + '"]').jqm({
29246				ajax: script,
29247				trigger: trigger,
29248				noOverlay: noOverlay,
29249				onLoad: function (hash) {
29250					onLoadjqm(name, hash);
29251				},
29252				onHide: function (hash) {
29253					onHidejqm(name, hash);
29254				}
29255			});
29256		}
29257	}
29258	// });
29259}
29260
29261window.addEventListener("keydown", function (e) {
29262	if (e.keyCode == 27) {
29263		$('.jqm-init.show').last().jqmHide();
29264
29265		if ($('.inline-search-block.show').length) {
29266
29267			$('.inline-search-block').toggleClass('show');
29268			$('.jqmOverlay.search').detach();
29269		}
29270
29271		$('.mega_fixed_menu').fadeOut(animationTime);
29272	}
29273});
29274
29275if (!funcDefined('onHidejqm')) {
29276	var onHidejqm = function (name, hash) {
29277		if (hash.w.find('.one_click_buy_result_success').is(':visible') && name == "one_click_buy_basket") {
29278			window.location.href = window.location.href;
29279		}
29280
29281		if ($('.xzoom-source').length)
29282			$('.xzoom-source').remove();
29283		if ($('.xzoom-preview').length)
29284			$('.xzoom-preview').remove();
29285
29286		// hash.w.css('opacity', 0).hide();
29287		hash.w.animate({ 'opacity': 0 }, 200, function () {
29288			hash.w.mCustomScrollbar('destroy');
29289			hash.w.hide();
29290			hash.w.empty();
29291			hash.o.remove();
29292			hash.w.removeClass('show');
29293
29294			$('body').css({ 'overflow': '', 'height': '' });
29295
29296			if (!hash.w.closest('#popup_iframe_wrapper').find('.jqmOverlay').length) {
29297				hash.w.closest('#popup_iframe_wrapper').css({ 'z-index': '', 'display': '' });
29298			}
29299
29300			if (window.matchMedia('(max-width: 991px)').matches) {
29301				$("body").removeClass("all_viewed");
29302			}
29303			if (!$('.jqmOverlay:not(.mobp)').length || $('.jqmOverlay.waiting').length) {
29304				$('body').removeClass('jqm-initied');
29305			}
29306
29307			if (window.matchMedia('(min-width: 768px)').matches) {
29308				$("body").removeClass("swipeignore");
29309			}
29310
29311			if (name == 'fast_view') {
29312				$('.fast_view_popup').remove();
29313
29314				var navButtons = hash.w.closest('#popup_iframe_wrapper').find('.navigation-wrapper-fast-view');
29315				navButtons.remove();
29316			}
29317		});
29318
29319		window.b24form = false;
29320	}
29321}
29322
29323if (!funcDefined("scroll_block")) {
29324	function scroll_block(block, clickedItem) {
29325		if (block.length) {
29326
29327			if (clickedItem !== undefined && clickedItem.length) {
29328				clickedItem.trigger('click');
29329			}
29330			else {
29331				$(".prices_tab").addClass("active").siblings().removeClass("active");
29332				if ($(".prices_tab .opener").length && !$(".prices_tab .opener .opened").length) {
29333					var item = $(".prices_tab .opener").first();
29334					item.find(".opener_icon").addClass("opened");
29335					item.parents("tr").addClass("nb")
29336					item.parents("tr").next(".offer_stores").find(".stores_block_wrap").slideDown(200);
29337				}
29338			}
29339			var topPos = block.offset().top,
29340				headerH = $('header').outerHeight(true, true);
29341
29342			$('html,body').animate({ 'scrollTop': topPos - 88 }, 150);
29343		}
29344	}
29345}
29346
29347if (!funcDefined("jqmEd")) {
29348	var jqmEd = function (name, form_id, open_trigger, requestData, selector, requestTitle, isButton, thButton) {
29349		if (typeof (requestData) == "undefined") {
29350			requestData = '';
29351		}
29352		if (typeof (selector) == "undefined") {
29353			selector = false;
29354		}
29355		$('body #popup_iframe_wrapper').find('.' + name + '_frame').remove();
29356		$('body #popup_iframe_wrapper').append('<div class="' + name + '_frame jqmWindow popup"></div>');
29357		if (typeof open_trigger == "undefined") {
29358			$('.' + 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 : '') });
29359		} else {
29360			if (name == 'enter') {
29361				$('.' + 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' });
29362			} else if (name == 'basket_error') {
29363				$('.' + 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' });
29364
29365			} else {
29366				$('.' + 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 : '') });
29367			}
29368			$(open_trigger).dblclick(function () { return false; })
29369		}
29370		return true;
29371	}
29372}
29373
29374if (!funcDefined("replaceBasketPopup")) {
29375	function replaceBasketPopup(hash) {
29376		if (typeof hash != "undefined") {
29377			hash.w.hide();
29378			hash.o.hide();
29379		}
29380	}
29381}
29382
29383if (!funcDefined("waitLayer")) {
29384	function waitLayer(delay, callback) {
29385		if ((typeof dataLayer !== 'undefined') && (typeof callback === 'function')) {
29386			callback();
29387		}
29388		else {
29389			setTimeout(function () {
29390				waitLayer(delay, callback);
29391			}, delay);
29392		}
29393	}
29394}
29395
29396if (!funcDefined("InitTopestMenuGummi")) {
29397	InitTopestMenuGummi = function () {
29398		if (!isOnceInited) {
29399			function _init() {
29400				var arItems = $menuTopest.find('>li:not(.more)');
29401				var cntItems = arItems.length;
29402				if (cntItems) {
29403					var itemsWidth = 0;
29404					for (var i = 0; i < cntItems; ++i) {
29405						var item = arItems.eq(i);
29406						var itemWidth = item.actual('outerWidth', { includeMargin: true });
29407						arItemsHideWidth[i] = (itemsWidth += itemWidth) + (i !== (cntItems - 1) ? moreWidth : 0);
29408					}
29409				}
29410			}
29411
29412			function _gummi() {
29413				var rowWidth = $menuTopest.actual('innerWidth');
29414				var arItems = $menuTopest.find('>li:not(.more),li.more>.dropdown>li');
29415				var cntItems = arItems.length;
29416				if (cntItems) {
29417					var bMore = false;
29418					for (var i = cntItems - 1; i >= 0; --i) {
29419						var item = arItems.eq(i);
29420						var bInMore = item.parents('.more').length > 0;
29421						if (!bInMore) {
29422							if (arItemsHideWidth[i] > rowWidth) {
29423								if (!bMore) {
29424									bMore = true;
29425									more.removeClass('hidden');
29426								}
29427								var clone = item.clone();
29428								clone.find('>a').addClass('dark_font');
29429								clone.prependTo(moreDropdown);
29430								item.addClass('cloned');
29431							}
29432						}
29433					}
29434					for (var i = 0; i < cntItems; ++i) {
29435						var item = arItems.eq(i);
29436						var bInMore = item.parents('.more').length > 0;
29437						if (bInMore) {
29438							if (arItemsHideWidth[i] <= rowWidth) {
29439								if (i === (cntItems - 1)) {
29440									bMore = false;
29441									more.addClass('hidden');
29442								}
29443								var clone = item.clone();
29444								clone.find('>a').removeClass('dark_font');
29445								clone.insertBefore(more);
29446								item.addClass('cloned');
29447							}
29448						}
29449					}
29450					$menuTopest.find('li.cloned').remove();
29451				}
29452			}
29453
29454			var $menuTopest = $('.menu.topest');
29455			if ($menuTopest.length) {
29456				var more = $menuTopest.find('>.more');
29457				var moreDropdown = more.find('>.dropdown');
29458				var moreWidth = more.actual('outerWidth', { includeMargin: true });
29459				var arItemsHideWidth = [];
29460
29461				ignoreResize.push(true);
29462				_init();
29463				_gummi();
29464				ignoreResize.pop();
29465
29466				BX.addCustomEvent('onWindowResize', function (eventdata) {
29467					try {
29468						ignoreResize.push(true);
29469						_gummi();
29470						$menuTopest.addClass('initied');
29471					}
29472					catch (e) { }
29473					finally {
29474						ignoreResize.pop();
29475					}
29476				});
29477			}
29478		}
29479	}
29480}
29481
29482if (!funcDefined("InitTopMenuGummi")) {
29483	InitTopMenuGummi = function () {
29484		function _init() {
29485			var arItems = $topMenu.closest('.wrap_menu').find('.inc_menu .menu_top_block >li:not(.more)');
29486			var cntItems = arItems.length;
29487			if (cntItems) {
29488				var itemsWidth = 0;
29489				for (var i = 0; i < cntItems; ++i) {
29490					var item = arItems.eq(i);
29491					var itemWidth = item.actual('outerWidth');
29492					arItemsHideWidth[i] = (itemsWidth += itemWidth) + (i !== (cntItems - 1) ? moreWidth : 0);
29493				}
29494			}
29495
29496		}
29497
29498		function _gummi() {
29499			var rowWidth = $wrapMenu.actual('innerWidth') - $wrapMenuLeft.actual('innerWidth');
29500			var arItems = $topMenu.find('>
29500li:not(.more):not(.catalog),li.more>.dropdown>li');
29501			var cntItems = arItems.length;
29502
29503			if (cntItems) {
29504				var bMore = false;
29505				for (var i = cntItems - 1; i >= 0; --i) {
29506					var item = arItems.eq(i);
29507					var bInMore = item.parents('.more').length > 0;
29508					if (!bInMore) {
29509						if (arItemsHideWidth[i] > rowWidth) {
29510							if (!bMore) {
29511								bMore = true;
29512								more.removeClass('hidden');
29513							}
29514							var clone = item.clone();
29515							clone.find('>.dropdown').removeAttr('style').removeClass('toleft');
29516							clone.find('>a').addClass('dark_font').removeAttr('style');
29517							clone.prependTo(moreDropdown);
29518							item.addClass('cloned');
29519						}
29520					}
29521				}
29522				for (var i = 0; i < cntItems; ++i) {
29523					var item = arItems.eq(i);
29524					var bInMore = item.parents('.more').length > 0;
29525					if (bInMore) {
29526						if (arItemsHideWidth[i] <= rowWidth) {
29527							if (i === (cntItems - 1)) {
29528								bMore = false;
29529								more.addClass('hidden');
29530							}
29531							var clone = item.clone();
29532							clone.find('>a').removeClass('dark_font');
29533							clone.insertBefore(more);
29534							item.addClass('cloned');
29535						}
29536					}
29537				}
29538				$topMenu.find('li.cloned').remove();
29539
29540				var cntItemsVisible = $topMenu.find('>li:not(.more):not(.catalog)').length;
29541				var o = rowWidth - arItemsHideWidth[cntItemsVisible - 1];
29542				var itemsPaddingAdd = Math.floor(o / (cntItemsVisible + (more.hasClass('hidden') ? 0 : 1)));
29543				var itemsPadding_new = itemsPadding_min + itemsPaddingAdd;
29544				var itemsPadding_new_l = Math.floor(itemsPadding_new / 2);
29545				var itemsPadding_new_r = itemsPadding_new - itemsPadding_new_l;
29546
29547				$topMenu.find('>li:not(.catalog):visible>a').each(function () {
29548					$(this).css({ 'padding-left': itemsPadding_new_l + 'px' });
29549					$(this).css({ 'padding-right': itemsPadding_new_r + 'px' });
29550				});
29551
29552				var lastItemPadding_new = itemsPadding_new + o - (cntItemsVisible + (more.is(':visible') ? 1 : 0)) * itemsPaddingAdd;
29553				var lastItemPadding_new_l = Math.floor(lastItemPadding_new / 2);
29554				var lastItemPadding_new_r = lastItemPadding_new - lastItemPadding_new_l;
29555				$topMenu.find('>li:visible').last().find('>a').css({ 'padding-left': lastItemPadding_new_l + 'px' });
29556				$topMenu.find('>li:visible').last().find('>a').css({ 'padding-right': lastItemPadding_new_r + 'px' });
29557			}
29558			CheckTopMenuFullCatalogSubmenu();
29559		}
29560
29561		var $topMenu = $('.menu_top_block');
29562		if ($menuTopest.length) {
29563			var $wrapMenu = $topMenu.parents('.wrap_menu');
29564			var $wrapMenuLeft = $wrapMenu.find('.catalog_menu_ext');
29565			var more = $topMenu.find('>.more');
29566			var moreWidth = more.actual('outerWidth', { includeMargin: true });
29567			more.addClass('hidden');
29568			var arItemsHideWidth = [];
29569			var moreDropdown = more.find('>.dropdown');
29570			var itemsPadding = parseInt(more.find('>a').css('padding-left')) * 2;
29571			var itemsPadding_min = itemsPadding;
29572
29573
29574			setTimeout(function () {
29575				ignoreResize.push(true);
29576				_init();
29577				_gummi();
29578				ignoreResize.pop();
29579			}, 5000);
29580
29581			BX.addCustomEvent('onWindowResize', function (eventdata) {
29582				try {
29583					ignoreResize.push(true);
29584					_gummi();
29585				}
29586				catch (e) { }
29587				finally {
29588					ignoreResize.pop();
29589				}
29590			});
29591
29592			/*BX.addCustomEvent('onTopPanelFixUnfix', function(eventdata) {
29593				ignoreResize.push(true);
29594				_gummi();
29595				ignoreResize.pop();
29596			});*/
29597		}
29598	}
29599}
29600
29601if (!funcDefined("checkCounters")) {
29602	function checkCounters(name) {
29603		if (typeof name !== "undefined") {
29604			if (name == "google" && (arAsproOptions["COUNTERS"]["GOOGLE_ECOMERCE"] == "Y" && arAsproOptions["COUNTERS"]["GOOGLE_COUNTER"] > 0)) {
29605				return true;
29606			}
29607			else if (name == "yandex" && (arAsproOptions["COUNTERS"]["YANDEX_ECOMERCE"] == "Y" && arAsproOptions["COUNTERS"]["YANDEX_COUNTER"] > 0)) {
29608				return true;
29609			}
29610			else {
29611				return false;
29612			}
29613		}
29614		else if ((arAsproOptions["COUNTERS"]["YANDEX_ECOMERCE"] == "Y" && arAsproOptions["COUNTERS"]["YANDEX_COUNTER"] > 0) || (arAsproOptions["COUNTERS"]["GOOGLE_ECOMERCE"] == "Y" && arAsproOptions["COUNTERS"]["GOOGLE_COUNTER"] > 0)) {
29615			return true;
29616		}
29617		else {
29618			return false;
29619		}
29620	}
29621}
29622
29623if (!funcDefined("addBasketCounter")) {
29624	function addBasketCounter(id) {
29625		if (arAsproOptions['COUNTERS']['USE_BASKET_GOALS'] !== 'N') {
29626			var eventdata = { goal: 'goal_basket_add', params: { id: id } };
29627			BX.onCustomEvent('onCounterGoals', [eventdata]);
29628		}
29629		if (checkCounters()) {
29630			$.ajax({
29631				url: arAsproOptions['SITE_DIR'] + "ajax/goals.php",
29632				dataType: "json",
29633				type: "POST",
29634				data: { "ID": id },
29635				success: function (item) {
29636					if (!!item && !!item.ID) {
29637						waitLayer(100, function () {
29638							dataLayer.push({
29639								"event": arAsproOptions["COUNTERS"]['GOOGLE_EVENTS']['ADD2BASKET'],
29640								"ecommerce": {
29641									"currencyCode": item.CURRENCY,
29642									"add": {
29643										"products": [{
29644											"id": item.ID,
29645											"name": item.NAME,
29646											"price": item.PRICE,
29647											"brand": item.BRAND,
29648											"category": item.CATEGORY,
29649											"quantity": item.QUANTITY
29650										}]
29651									}
29652								}
29653							});
29654						});
29655					}
29656				}
29657			});
29658		}
29659	}
29660}
29661
29662if (!funcDefined("purchaseCounter")) {
29663	function purchaseCounter(order_id, type, callback) {
29664		if (checkCounters()) {
29665			$.ajax({
29666				url: arAsproOptions['SITE_DIR'] + "ajax/goals.php",
29667				dataType: "json",
29668				type: "POST",
29669				data: { "ORDER_ID": order_id, "TYPE": type },
29670				success: function (order) {
29671					var products = [];
29672					if (order.ITEMS) {
29673						for (var i in order.ITEMS) {
29674							products.push({
29675								"id": order.ITEMS[i].ID,
29676								"sku": order.ITEMS[i].ID,
29677								"name": order.ITEMS[i].NAME,
29678								"price": order.ITEMS[i].PRICE,
29679								"brand": order.ITEMS[i].BRAND,
29680								"category": order.ITEMS[i].CATEGORY,
29681								"quantity": order.ITEMS[i].QUANTITY
29682							});
29683						}
29684					}
29685					if (order.ID) {
29686						waitLayer(100, function () {
29687							dataLayer.push({
29688								"event": arAsproOptions["COUNTERS"]['GOOGLE_EVENTS']['PURCHASE'],
29689								"ecommerce": d = {
29690									"purchase": {
29691										"actionField": {
29692											"id": order.ACCOUNT_NUMBER,
29693											"shipping": order.PRICE_DELIVERY,
29694											"tax": order.TAX_VALUE,
29695											"list": type,
29696											"revenue": order.PRICE
29697										},
29698										"products": products
29699									}
29700								}
29701							});
29702
29703							if (typeof callback !== 'undefined') {
29704								callback(d);
29705							}
29706						});
29707					}
29708					else {
29709						if (typeof callback !== 'undefined') {
29710							callback();
29711						}
29712					}
29713				},
29714				error: function () {
29715					if (typeof callback !== 'undefined') {
29716						callback();
29717					}
29718				}
29719			});
29720		}
29721	}
29722}
29723
29724if (!funcDefined("viewItemCounter")) {
29725	function viewItemCounter(id, price_id) {
29726		if (checkCounters()) {
29727			$.ajax({
29728				url: arAsproOptions['SITE_DIR'] + "ajax/goals.php",
29729				dataType: "json",
29730				type: "POST",
29731				data: { "PRODUCT_ID": id, "PRICE_ID": price_id },
29732				success: function (item) {
29733					if (item.ID) {
29734						waitLayer(100, function () {
29735							dataLayer.push({
29736								//"event": "",
29737								"ecommerce": {
29738									"detail": {
29739										"products": [{
29740											"id": item.ID,
29741											"name": item.NAME,
29742											"price": item.PRICE,
29743											"brand": item.BRAND,
29744											"category": item.CATEGORY
29745										}]
29746									}
29747								}
29748							});
29749						});
29750					}
29751				}
29752			});
29753		}
29754	}
29755}
29756
29757if (!funcDefined("checkoutCounter")) {
29758	function checkoutCounter(step, option, callback) {
29759		if (checkCounters('google')) {
29760			$.ajax({
29761				url: arAsproOptions['SITE_DIR'] + "ajax/goals.php",
29762				dataType: "json",
29763				type: "POST",
29764				data: { "BASKET": "Y" },
29765				success: function (basket) {
29766					var products = [];
29767					if (basket.ITEMS) {
29768						for (var i in basket.ITEMS) {
29769							products.push({
29770								"id": basket.ITEMS[i].ID,
29771								"name": basket.ITEMS[i].NAME,
29772								"price": basket.ITEMS[i].PRICE,
29773								"brand": basket.ITEMS[i].BRAND,
29774								"category": basket.ITEMS[i].CATEGORY,
29775								"quantity": basket.ITEMS[i].QUANTITY
29776							});
29777						}
29778					}
29779					if (products) {
29780						waitLayer(100, function () {
29781							dataLayer.push({
29782								"event": arAsproOptions["COUNTERS"]['GOOGLE_EVENTS']['CHECKOUT_ORDER'],
29783								"ecommerce": {
29784									'checkout': {
29785										"actionField": {
29786											"step": step,
29787											"option": option
29788										},
29789										"products": products
29790									}
29791								},
29792								/*"eventCallback": function() {
29793									if((typeof callback !== 'undefined') && (typeof callback === 'function')){
29794										callback();
29795									}
29796							 }*/
29797							});
29798						});
29799						document.location.href = '/order/';
29800					}
29801				}
29802			});
29803		}
29804	}
29805}
29806
29807if (!funcDefined("delFromBasketCounter")) {
29808	function delFromBasketCounter(id, callback) {
29809		if (checkCounters()) {
29810			$.ajax({
29811				url: arAsproOptions['SITE_DIR'] + "ajax/goals.php",
29812				dataType: "json",
29813				type: "POST",
29814				data: { "ID": id },
29815				success: function (item) {
29816					if (item.ID) {
29817						waitLayer(100, function () {
29818							dataLayer.push({
29819								"event": arAsproOptions["COUNTERS"]['GOOGLE_EVENTS']['REMOVE_BASKET'],
29820								"ecommerce": {
29821									"remove": {
29822										"products": [{
29823											"id": item.ID,
29824											"name": item.NAME,
29825											"category": item.CATEGORY
29826										}]
29827									}
29828								}
29829							});
29830							if (typeof callback == 'function') {
29831								callback();
29832							}
29833						});
29834					}
29835				}
29836			});
29837		}
29838	}
29839}
29840
29841if (!funcDefined("setHeightCompany")) {
29842	function setHeightCompany() {
29843		$('.md-50.img').height($('.md-50.big').outerHeight() - 35);
29844	}
29845}
29846
29847if (!funcDefined("initSly")) {
29848	function initSly() {
29849		/*var $frame  = $(document).find('.frame');
29850		var $slidee = $frame.children('ul').eq(0);
29851		var $wrap   = $frame.parent();
29852
29853		if(arAsproOptions["PAGES"]["CATALOG_PAGE"] && $frame.length){
29854			$frame.sly({
29855				horizontal: 1,
29856				itemNav: 'basic',
29857				smart: 1,
29858				mouseDragging: 0,
29859				touchDragging: 0,
29860				releaseSwing: 0,
29861				startAt: 0,
29862				scrollBar: $wrap.find('.scrollbar'),
29863				scrollBy: 1,
29864				speed: 300,
29865				elasticBounds: 0,
29866				easing: 'swing',
29867				dragHandle: 1,
29868				dynamicHandle: 1,
29869				clickBar: 1,
29870
29871				// Buttons
29872				forward: $wrap.find('.forward'),
29873				backward: $wrap.find('.backward'),
29874			});
29875			$frame.sly('reload');
29876		}*/
29877	}
29878}
29879
29880if (!funcDefined("createTableCompare")) {
29881	function createTableCompare(originalTable, appendDiv, cloneTable) {
29882
29883		try {
29884			var clone = originalTable.clone().removeAttr('id').addClass('clone');
29885			if (cloneTable.length) {
29886				cloneTable.remove();
29887				appendDiv.html('');
29888				appendDiv.html(clone);
29889			} else {
29890				appendDiv.append(clone);
29891			}
29892		}
29893		catch (e) { }
29894		finally {
29895
29896		}
29897	}
29898}
29899
29900if (!funcDefined('fillBasketPropsExt')) {
29901	fillBasketPropsExt = function (that, prop_code, basket_prop_div) {
29902		var
29903			i = 0,
29904			propCollection = null,
29905			foundValues = false,
29906			basketParams = {},
29907			obBasketProps = null;
29908
29909		obBasketProps = BX(basket_prop_div);
29910		if (!obBasketProps && that.closest('.item').find('.basket_props_block').length)
29911			obBasketProps = that.closest('.item').find('.basket_props_block')[0];
29912
29913		if (!!obBasketProps) {
29914			propCollection = obBasketProps.getElementsByTagName('select');
29915			if (!!propCollection && !!propCollection.length) {
29916				for (i = 0; i < propCollection.length; i++) {
29917					if (!propCollection[i].disabled) {
29918						switch (propCollection[i].type.toLowerCase()) {
29919							case 'select-one':
29920								basketParams[propCollection[i].name] = propCollection[i].value;
29921								foundValues = true;
29922								break;
29923							default:
29924								break;
29925						}
29926					}
29927				}
29928			}
29929			propCollection = obBasketProps.getElementsByTagName('input');
29930			if (!!propCollection && !!propCollection.length) {
29931				for (i = 0; i < propCollection.length; i++) {
29932					if (!propCollection[i].disabled) {
29933						switch (propCollection[i].type.toLowerCase()) {
29934							case 'hidden':
29935								basketParams[propCollection[i].name] = propCollection[i].value;
29936								foundValues = true;
29937								break;
29938							case 'radio':
29939								if (propCollection[i].checked) {
29940									basketParams[propCollection[i].name] = propCollection[i].value;
29941									foundValues = true;
29942								}
29943								break;
29944							default:
29945								break;
29946						}
29947					}
29948				}
29949			}
29950		}
29951		if (!foundValues) {
29952			basketParams[prop_code] = [];
29953			basketParams[prop_code][0] = 0;
29954		}
29955		return basketParams;
29956	}
29957}
29958if (!funcDefined('showBasketError')) {
29959	showBasketError = function (mess, title, addButton, th, callback) {
29960		var title_set = (title ? title : BX.message("ERROR_BASKET_TITLE")),
29961			isButton = "N",
29962			thButton = "";
29963		if (typeof addButton !== undefined) {
29964			isButton = "Y";
29965		}
29966		if (typeof th !== undefined) {
29967			thButton = th;
29968		}
29969		$("body").append("<span class='add-error-bakset' style='display:none;'></span>");
29970		jqmEd('basket_error', 'error-bakset', '.add-error-bakset', mess, this, title_set, isButton, thButton);
29971		$("body .add-error-bakset").click();
29972		$("body .add-error-bakset").remove();
29973
29974		if (typeof callback === 'function') {
29975			callback();
29976		}
29977	}
29978}
29979
29980CheckTopVisibleMenu = function (that) {
29981	var dropdownMenu = $('.dropdown-menu:visible').last();
29982
29983	if (dropdownMenu.length) {
29984		dropdownMenu.find('a').css('white-space', '');
29985		dropdownMenu.css('left', '');
29986		dropdownMenu.css('right', '');
29987		dropdownMenu.removeClass('toright');
29988
29989		var dropdownMenu_left = dropdownMenu.offset().left;
29990		if (typeof (dropdownMenu_left) != 'undefined') {
29991			var menu = dropdownMenu.parents('.mega-menu');
29992			if (!menu.length)
29993				menu = dropdownMenu.closest('.logo-row');
29994			var menu_width = menu.outerWidth();
29995			var menu_left = menu.offset().left;
29996			var menu_right = menu_left + menu_width;
29997			var isToRight = dropdownMenu.parents('.toright').length > 0;
29998			var parentsDropdownMenus = dropdownMenu.parents('.dropdown-menu');
29999			var isHasParentDropdownMenu = parentsDropdownMenus.length > 0;
30000			if (isHasParentDropdownMenu) {
30001				var parentDropdownMenu_width = parentsDropdownMenus.first().outerWidth();
30002				var parentDropdownMenu_left = parentsDropdownMenus.first().offset().left;
30003				var parentDropdownMenu_right = parentDropdownMenu_width + parentDropdownMenu_left;
30004			}
30005
30006			if (parentDropdownMenu_right + dropdownMenu.outerWidth() > menu_right) {
30007				dropdownMenu.find('a').css('white-space', 'normal');
30008			}
30009
30010			var dropdownMenu_width = dropdownMenu.outerWidth();
30011			var dropdownMenu_right = dropdownMenu_left + dropdownMenu_width;
30012
30013			if (dropdownMenu_right > menu_right || isToRight) {
30014				var addleft = 0;
30015				addleft = menu_right - dropdownMenu_right;
30016				if (isHasParentDropdownMenu || isToRight) {
30017					dropdownMenu.css('left', 'auto');
30018					dropdownMenu.css('right', '100%');
30019					dropdownMenu.addClass('toright');
30020				}
30021				else {
30022					var dropdownMenu_curLeft = parseInt(dropdownMenu.css('left'));
30023					dropdownMenu.css('left', (dropdownMenu_curLeft + addleft) + 'px');
30024				}
30025			}
30026		}
30027	}
30028}
30029
30030if (!funcDefined("isRealValue")) {
30031	function isRealValue(obj) {
30032		return obj && obj !== "null" && obj !== "undefined";
30033	}
30034}
30035
30036if (!funcDefined("rightScroll")) {
30037	function rightScroll(prop, id) {
30038		var el = BX('prop_' + prop + '_' + id);
30039		if (el) {
30040			var curVal = parseInt(el.style.marginLeft);
30041			if (curVal >= 0) el.style.marginLeft = curVal - 20 + '%';
30042		}
30043	}
30044}
30045
30046if (!funcDefined("leftScroll")) {
30047	function leftScroll(prop, id) {
30048		var el = BX('prop_' + prop + '_' + id);
30049		if (el) {
30050			var curVal = parseInt(el.style.marginLeft);
30051			if (curVal < 0) el.style.marginLeft = curVal + 20 + '%';
30052		}
30053	}
30054}
30055
30056if (!funcDefined("InitOrderCustom")) {
30057	InitOrderCustom = function () {
30058		$('.ps_logo img').wrap('<div class="image"></div>');
30059
30060		$('#bx-soa-order .radio-inline').each(function () {
30061			if ($(this).find('input').attr('checked') == 'checked') {
30062				$(this).addClass('checked');
30063			}
30064		});
30065
30066		$('#bx-soa-order .checkbox input[type=checkbox]').each(function () {
30067			if ($(this).attr('checked') == 'checked')
30068				$(this).parent().addClass('checked');
30069		});
30070
30071		$('#bx-soa-order .bx-authform-starrequired').each(function () {
30072			var html = $(this).html();
30073			$(this).closest('label').append('<span class="bx-authform-starrequired"> ' + html + '</span>');
30074			$(this).detach();
30075		});
30076		$('.bx_ordercart_coupon').each(function () {
30077			if ($(this).find('.bad').length)
30078				$(this).addClass('bad');
30079			else if ($(this).find('.good').length)
30080				$(this).addClass('good');
30081		});
30082		/*if (typeof(propsMap) !== 'undefined') {
30083			$(propsMap).on('click', function () {
30084				var value = $('#orderDescription').val();
30085				if ($('#orderDescription')) {
30085
30086					if (value != '') {
30087						$('#orderDescription').closest('.form-group').addClass('value_y');
30088					}
30089				}
30090			});
30091		}*/
30092	}
30093}
30094
30095if (!funcDefined("InitLabelAnimation")) {
30096	InitLabelAnimation = function (className) {
30097		// Fix order labels
30098		if (!$(className).length) {
30099			return;
30100		}
30101		$(className).find('.form-group').each(function () {
30102			if ($(this).find('input[type=text], textarea').length && !$(this).find('.dropdown-block').length && $(this).find('input[type=text], textarea').val() != '') {
30103				$(this).addClass('value_y');
30104			}
30105		});
30106
30107		$(document).on('click', className + ' .form-group:not(.bx-soa-pp-field) label', function () {
30108			$(this).parent().find('input, textarea').focus();
30109		});
30110
30111		$(document).on('focusout', className + ' .form-group:not(.bx-soa-pp-field) input, ' + className + ' .form-group:not(.bx-soa-pp-field) textarea', function () {
30112			var value = $(this).val();
30113			if (value != '' && !$(this).closest('.form-group').find('.dropdown-block').length && !$(this).closest('.form-group').find('#profile_change').length) {
30114				$(this).closest('.form-group').addClass('value_y');
30115			} else {
30116				$(this).closest('.form-group').removeClass('value_y');
30117			}
30118		});
30119
30120		$(document).on('focus', className + ' .form-group:not(.bx-soa-pp-field) input, ' + className + ' .form-group:not(.bx-soa-pp-field) textarea', function () {
30121			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) {
30122				$(this).closest('.form-group').addClass('value_y');
30123			}
30124		});
30125	};
30126}
30127
30128checkPopupWidth = function () {
30129	$('.popup.show').each(function () {
30130		var width_form = $(this).actual('width');
30131		$(this).css({
30132			'margin-left': ($(window).width() > width_form ? '-' + width_form / 2 + 'px' : '-' + $(window).width() / 2 + 'px'),
30133		});
30134	});
30135}
30136
30137checkCaptchaWidth = function () {
30138	$('.captcha-row').each(function () {
30139		var width = $(this).actual('width');
30140		if ($(this).hasClass('b')) {
30141			if (width > 320) {
30142				$(this).removeClass('b');
30143			}
30144		}
30145		else {
30146			if (width <= 320) {
30147				$(this).addClass('b');
30148			}
30149		}
30150	});
30151}
30152
30153checkFormWidth = function () {
30154	$('.form .form_left').each(function () {
30155		var form = $(this).parents('.form');
30156		var width = form.actual('width');
30157		if (form.hasClass('b')) {
30158			if (width > 417) {
30159				form.removeClass('b');
30160			}
30161		}
30162		else {
30163			if (width <= 417) {
30164				form.addClass('b');
30165			}
30166		}
30167	});
30168}
30169
30170checkFormControlWidth = function () {
30171	$('.form-control').each(function () {
30172		var width = $(this).actual('width');
30173		var labelWidth = $(this).find('label:not(.error) > span').actual('width');
30174		var errorWidth = $(this).find('label.error').actual('width');
30175		if (errorWidth > 0) {
30176			if ($(this).hasClass('h')) {
30177				if (width > (labelWidth + errorWidth + 5)) {
30178					$(this).removeClass('h');
30179				}
30180			}
30181			else {
30182				if (width <= (labelWidth + errorWidth + 5)) {
30183					$(this).addClass('h');
30184				}
30185			}
30186		}
30187		else {
30188			$(this).removeClass('h');
30189		}
30190	});
30191}
30192
30193scrollToTop = function () {
30194	if (arAsproOptions['THEME']['SCROLLTOTOP_TYPE'] !== 'NONE') {
30195		var _isScrolling = false;
30196		// Append Button
30197		$('body').append($('<a />').addClass('scroll-to-top ' + arAsproOptions['THEME']['SCROLLTOTOP_TYPE'] + ' ' + arAsproOptions['THEME']['SCROLLTOTOP_POSITION']).attr({ 'href': '#', 'id': 'scrollToTop' }));
30198
30199		if (arAsproOptions['THEME']['SCROLLTOTOP_POSITION_BOTTOM']) {
30200			$('#scrollToTop').css('bottom', +arAsproOptions['THEME']['SCROLLTOTOP_POSITION_BOTTOM'] + 'px');
30201		}
30202
30203		if (arAsproOptions['THEME']['SCROLLTOTOP_POSITION_RIGHT']) {
30204			$('#scrollToTop').css('right', +arAsproOptions['THEME']['SCROLLTOTOP_POSITION_RIGHT'] + 'px');
30205		}
30206
30207		$('#scrollToTop').click(function (e) {
30208			e.preventDefault();
30209			$('body, html').animate({ scrollTop: 0 }, 500);
30210			return false;
30211		});
30212		// Show/Hide Button on Window Scroll event.
30213		$(window).scroll(function () {
30214			if (!_isScrolling) {
30215				_isScrolling = true;
30216				if ($(window).scrollTop() > 150) {
30217					$('#scrollToTop').stop(true, true).addClass('visible');
30218					_isScrolling = false;
30219				}
30220				else {
30221					$('#scrollToTop').stop(true, true).removeClass('visible');
30222					_isScrolling = false;
30223				}
30224				checkScrollToTop();
30225			}
30226		});
30227	}
30228}
30229
30230checkScrollToTop = function () {
30231	if (arAsproOptions['THEME']['SCROLLTOTOP_POSITION_BOTTOM'])
30232		var bottom = +arAsproOptions['THEME']['SCROLLTOTOP_POSITION_BOTTOM'];
30233	else
30234		var bottom = 55;
30235
30236	var scrollVal = $(window).scrollTop(),
30237		windowHeight = $(window).height(),
30238		footerOffset = 0;
30239	if ($('footer').length)
30240		footerOffset = $('footer .footer-inner').offset().top;
30241
30242	if (arAsproOptions['THEME']['SCROLLTOTOP_POSITION'] == 'CONTENT') {
30243		warpperWidth = $('body > .wrapper > .wrapper_inner').width();
30244		$('#scrollToTop').css('margin-left', Math.ceil(warpperWidth / 2) + 23);
30245	}
30246
30247	if (scrollVal + windowHeight > footerOffset) {
30248		$('#scrollToTop').css('bottom', Math.round(bottom + scrollVal + windowHeight - footerOffset) + 'px');
30249	}
30250	else if (parseInt($('#scrollToTop').css('bottom')) > bottom) {
30251		$('#scrollToTop').css('bottom', Math.round(bottom));
30252	}
30253}
30254
30255CheckObjectsSizes = function () {
30256	$('.container iframe,.container object,.container video').each(function () {
30257		var height_attr = $(this).attr('height');
30258		var width_attr = $(this).attr('width');
30259		if (height_attr && width_attr) {
30260			$(this).css('height', $(this).outerWidth() * height_attr / width_attr);
30261		}
30262	});
30263}
30264
30265if (!funcDefined('reloadTopBasket')) {
30266	var reloadTopBasket = function reloadTopBasket(action, basketWindow, speed, delay, slideDown, item, sync) {
30267		var obj = {
30268			"PARAMS": $('#top_basket_params').val(),
30269			"ACTION": action
30270		};
30271		if (typeof item !== "undefined" && item) {
30272			obj.delete_top_item = 'Y';
30273			obj.delete_top_item_id = item.data('id');
30274		}
30275		// $.post( arAsproOptions['SITE_DIR']+"ajax/show_basket_popup.php", obj, $.proxy(function( data ){
30276		$.post(arAsproOptions['SITE_DIR'] + "ajax/show_basket_actual.php", obj, $.proxy(function (data) {
30277			$(basketWindow).html(data);
30278
30279			getActualBasket('', '', sync);
30280
30281			var eventdata = { action: 'loadBasket' };
30282			BX.onCustomEvent('onCompleteAction', [eventdata]);
30283
30284			/*if(arAsproOptions['THEME']['SHOW_BASKET_ONADDTOCART'] !== 'N'){
30285				if($(window).outerWidth() > 520){
30286					if(slideDown=="Y")
30287						$(basketWindow).find('.basket_popup_wrapp').stop(true,true).slideDown(speed);
30288					clearTimeout(basketTimeoutSlide);
30289					basketTimeoutSlide = setTimeout(function() {
30290						var _this = $('#basket_line').find('.basket_popup_wrapp');
30291						if (_this.is(':hover')) {
30292							_this.show();
30293						}else{
30294							$('#basket_line').find('.basket_popup_wrapp').slideUp(speed);
30295						}
30296					},delay);
30297				}
30298			}*/
30299		}))
30300	}
30301}
30302
30303CheckTabActive = function () {
30304	if (typeof (clicked_tab) && clicked_tab) {
30305		if (window.matchMedia('(min-width: 768px)').matches) {
30306			clicked_tab--;
30307			$('.nav.nav-tabs li').each(function () {
30308				if ($(this).index() == clicked_tab)
30309					$(this).addClass('active');
30310			})
30311			// $('.nav.nav-tabs li:eq('+clicked_tab+')').addClass('active');
30312			$('.catalog_detail .tab-content .tab-pane:eq(' + clicked_tab + ')').addClass('active');
30313			$('.catalog_detail .tab-content .tab-pane .title-tab-heading').next().removeAttr('style');
30314			clicked_tab = 0;
30315		}
30316	}
30317}
30318
30319/*countdown start*/
30320if (!funcDefined('initCountdown')) {
30321	var initCountdown = function initCountdown() {
30322		if ($('.view_sale_block').size()) {
30323			$('.view_sale_block').each(function () {
30324				var activeTo = $(this).find('.active_to').text(),
30325					dateTo = new Date(activeTo.replace(/(\d+)\.(\d+)\.(\d+)/, '$3/$2/$1'));
30326				if ($(this).hasClass('compact'))
30327					$(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']);
30328				else
30329					$(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']);
30330			})
30331		}
30332	}
30333}
30334
30335if (!funcDefined('initCountdownTime')) {
30336	var initCountdownTime = function initCountdownTime(block, time) {
30337		if (time) {
30338			var dateTo = new Date(time.replace(/(\d+)\.(\d+)\.(\d+)/, '$3/$2/$1'));
30339			block.find('.countdown').countdown('destroy');
30340			if (block.hasClass('compact'))
30341				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']);
30342			else
30343				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']);
30344			block.find('.view_sale_block').show();
30345		}
30346		else {
30347			block.find('.view_sale_block').hide();
30348		}
30349	}
30350}
30351/*countdown end*/
30352
30353waitCounter = function (idCounter, delay, callback) {
30354	var obCounter = window['yaCounter' + idCounter];
30355	if (typeof obCounter == 'object') {
30356		if (typeof callback == 'function')
30357			callback();
30358
30359	}
30360	else {
30361		setTimeout(function () {
30362			waitCounter(idCounter, delay, callback);
30363		}, delay);
30364	}
30365}
30366
30367var isOnceInited = insertFilter = false;
30368var animationTime = 200;
30369var delayTime = 200;
30370var topMenuEnterTimer = false;
30371var isMobile = ((jQuery.browser.mobile && window.matchMedia('(max-width:767px)').matches) || window.matchMedia('(max-width:400px)').matches);
30372
30373if (isMobile)
30374	document.documentElement.className += ' mobile';
30375
30376if (navigator.userAgent.indexOf("Edge") != -1)
30377	document.documentElement.className += ' bx-ie-edge';
30378
30379/*filter start*/
30380if (!funcDefined('checkVerticalMobileFilter')) {
30381	var checkVerticalMobileFilter = function checkVerticalMobileFilter() {
30382		/*if($('.right_block1.catalog.vertical').length && !$('.left_block.filter_ajax').length)
30383		{
30384			if(typeof window['trackBarOptions'] !== 'undefined')
30385			{
30386				window['trackBarValues'] = {}
30387				for(key in window['trackBarOptions'])
30388				{
30389					window['trackBarValues'][key] = {
30390						'leftPercent': window['trackBar' + key].leftPercent,
30391						'leftValue': window['trackBar' + key].minInput.value,
30392						'rightPercent': window['trackBar' + key].rightPercent,
30393						'rightValue': window['trackBar' + key].maxInput.value,
30394					}
30395				}
30396			}
30397
30398			if(window.matchMedia('(max-width: 991px)').matches)
30399			{
30400				if(!insertFilter)
30401				{
30402					$('.js_filter .bx_filter.bx_filter_vertical').html($('.left_block .bx_filter.bx_filter_vertical').html());
30403					$('.left_block .bx_filter.bx_filter_vertical .bx_filter_section').remove();
30404					insertFilter=true;
30405				}
30406			}
30407			else
30408			{
30409				if(insertFilter)
30410				{
30411					$('.left_block .bx_filter.bx_filter_vertical').html($('.js_filter .bx_filter.bx_filter_vertical').html());
30412					$('.js_filter .bx_filter.bx_filter_vertical .bx_filter_section').remove();
30413					insertFilter=false;
30414				}
30415			}
30416
30417			if(typeof window['trackBarOptions'] !== 'undefined')
30418			{
30419				for(key in window['trackBarOptions'])
30420				{
30421					window['trackBarOptions'][key].leftPercent = window['trackBarValues'][key].leftPercent;
30422					window['trackBarOptions'][key].rightPercent = window['trackBarValues'][key].rightPercent;
30423					window['trackBarOptions'][key].curMinPrice = window['trackBarValues'][key].leftValue;
30424					window['trackBarOptions'][key].curMaxPrice = window['trackBarValues'][key].rightValue;
30425					window['trackBar' + key] = new BX.Iblock.SmartFilter(window['trackBarOptions'][key]);
30426					window['trackBar' + key].minInput.value = window['trackBarValues'][key].leftValue;
30427					window['trackBar' + key].maxInput.value = window['trackBarValues'][key].rightValue;
30428				}
30429			}
30430		}
30431		else if($('.visible_mobile_filter').length)
30432		{
30433			var posTopBlock = BX.pos($('.detail.partners')[0]),
30434				posBlock = $('.ajax_load').position();
30435			// $('.visible_mobile_filter').css('top', posBottomBlock.top-posTopBlock.top);
30436			$('.visible_mobile_filter').css('top', posBlock.top);
30437
30438		}*/
30439	}
30440}
30441/*filter end*/
30442
30443// ONE CLICK
30444if (!funcDefined("oneClickBuy")) {
30445	var oneClickBuy = function (elementID, iblockID, that) {
30446		var name = 'one_click_buy';
30447		var elementQuantity = 1;
30448		var offerProps = false;
30449		var buy_btn = $(that).closest('.buy_block').find('.to-cart');
30450		var buy_btn2 = $(that).closest('tr').find('.to-cart');
30451
30452		if (typeof (that) !== 'undefined') {
30453			elementQuantity = $(that).attr('data-quantity');
30454			offerProps = $(that).attr('data-props');
30455		}
30456
30457		if (elementQuantity < 0) {
30458			elementQuantity = 1;
30459		}
30460
30461		var tmp_props = buy_btn.data("props"),
30462			tmp_props2 = buy_btn2.data("props"),
30463			props = '',
30464			part_props = '',
30465			add_props = 'N',
30466			fill_prop = {},
30467			iblockid = buy_btn.data('iblockid'),
30468			item = buy_btn.attr('data-item');
30469
30470		if (tmp_props) {
30471			props = tmp_props.split(";");
30472		} else if (tmp_props2) {
30473			props = tmp_props2.split(";");
30474		}
30475		if (buy_btn.data("part_props")) {
30476			part_props = buy_btn.data("part_props");
30477		}
30478		if (buy_btn.data("add_props")) {
30479			add_props = buy_btn.data("add_props");
30480		}
30481
30482		fill_prop = fillBasketPropsExt(buy_btn, 'prop', buy_btn.data('bakset_div'));
30483		fill_prop.iblockID = iblockid;
30484		fill_prop.part_props = part_props;
30485		fill_prop.add_props = add_props;
30486		fill_prop.props = JSON.stringify(props);
30487		fill_prop.item = item;
30488		fill_prop.ocb_item = "Y";
30489
30490		if (!isMobile) {
30491			if (!$(that).hasClass('clicked')) {
30492				$(that).addClass('clicked');
30493				$('body').find('.' + name + '_frame').remove();
30494				$('body').find('.' + name + '_trigger').remove();
30495				$('body #popup_iframe_wrapper').append('<div class="' + name + '_frame popup"></div>');
30496				$('body #popup_iframe_wrapper').append('<div class="' + name + '_trigger"></div>');
30497				$('.' + 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 });
30498				$('.' + name + '_trigger').click();
30499			}
30500		}
30501		else {
30502			var script = arAsproOptions['SITE_DIR'] + 'form/';
30503			script += '?name=' + name + '&form_id=ocb&path=' + window.location.pathname + '&ELEMENT_ID=' + elementID + '&IBLOCK_ID=' + iblockID + '&ELEMENT_QUANTITY=' + elementQuantity + '&OFFER_PROPS=' + fill_prop.props
30504			location.href = script;
30505		}
30506	}
30507}
30508
30509if (!funcDefined("oneClickBuyBasket")) {
30510	var oneClickBuyBasket = function () {
30511		name = 'one_click_buy_basket';
30512		if (!isMobile) {
30513			if (!$('.fast_order').hasClass('clicked')) {
30514				$('.fast_order').addClass('clicked');
30515				$('body').find('.' + name + '_frame').remove();
30516				$('body').find('.' + name + '_trigger').remove();
30517				$('body #popup_iframe_wrapper').append('<div class="' + name + '_frame popup"></div>');
30518				$('body #popup_iframe_wrapper').append('<div class="' + name + '_trigger"></div>');
30519				$('.' + 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' });
30520				$('.' + name + '_trigger').click();
30521			}
30522		}
30523		else {
30524			var script = arAsproOptions['SITE_DIR'] + 'form/';
30525			script += '?name=' + name + '&form_id=ocb&path=' + window.location.pathname + '&buy_basket=y';
30526			location.href = script;
30527		}
30528	}
30529}
30530
30531// TOP MENU ANIMATION
30532$(document).on('click', '.menu_top_block>li .more a', function () {
30533	$this = $(this);
30534	$this.parents('.dropdown').first().find('>.hidden').removeClass('hidden');
30535	$this.parent().addClass('hidden');
30536	setTimeout(function () {
30537		$this.parent().remove();
30538	}, 500);
30539});
30540
30541$(document).on('mouseenter', '.menu_top_block.catalogfirst>li>.dropdown>li.full', function () {
30542	var $submenu = $(this).find('>.dropdown');
30543
30544	if ($submenu.length) {
30545		if (topMenuEnterTimer) {
30546			clearTimeout(topMenuEnterTimer);
30547			topMenuEnterTimer = false;
30548		}
30549	}
30550});
30551
30552$(document).on('mouseenter', '.menu_top_block>li:not(.full)', function () {
30553	var $submenu = $(this).find('>.dropdown');
30554
30555	if ($submenu.length && !$submenu.hasClass('visible')) {
30556		var $menu = $(this).parents('.menu');
30557		var $wrapmenu = $menu.parents('.wrap_menu');
30558		var wrapMenuWidth = $wrapmenu.actual('outerWidth');
30559		var wrapMenuLeft = $wrapmenu.offset().left;
30560		var wrapMenuRight = wrapMenuLeft + wrapMenuWidth;
30561		var left = wrapMenuRight - ($(this).offset().left + $submenu.actual('outerWidth'));
30562		if (window.matchMedia('(min-width: 951px)').matches && $(this).hasClass('catalog') && ($('.banner_auto').hasClass('catalog_page') || $('.banner_auto').hasClass('front_page'))) {
30563			return;
30564		}
30565		if (left < 0) {
30566			$submenu.css({ left: left + 'px' });
30567		}
30568		$submenu.stop().slideDown(animationTime, function () {
30569			$submenu.css({ height: '', 'overflow': 'visible' });
30570		});
30571
30572
30573		$(this).on('mouseleave', function () {
30574			var leaveTimer = setTimeout(function () {
30575				$submenu.stop().slideUp(animationTime, function () {
30576					$submenu.css({ left: '' });
30577				});
30578			}, delayTime);
30579
30580			$(this).on('mouseenter', function () {
30581				if (leaveTimer) {
30582					clearTimeout(leaveTimer);
30583					leaveTimer = false;
30584				}
30585			});
30586		});
30587	}
30588});
30589
30590$(document).on('mouseenter', '.menu_top_block>li .dropdown>li', function () {
30591	var $this = $(this);
30592	var $submenu = $this.find('>.dropdown');
30593
30594	if ($submenu.length && ((!$this.parents('.full').length && !$this.hasClass('full')) || $this.parents('.more').length)) {
30595		var $menu = $this.parents('.menu');
30596		var $wrapmenu = $menu.parents('.wrap_menu');
30597		var arParentSubmenuForOpacity = [];
30598		topMenuEnterTimer = setTimeout(function () {
30599
30600			var wrapMenuWidth = $wrapmenu.actual('outerWidth');
30601			var wrapMenuLeft = $wrapmenu.offset().left;
30602			var wrapMenuRight = wrapMenuLeft + wrapMenuWidth;
30603			var $parentSubmenu = $this.parent();
30604			var bToLeft = $parentSubmenu.hasClass('toleft') ? true : false;
30605			if (!bToLeft) {
30606				bToLeft = $this.offset().left + $this.actual('outerWidth') + $submenu.actual('outerWidth') > wrapMenuRight;
30607			}
30608			else {
30609				bToLeft = $this.offset().left + $this.actual('outerWidth') - $submenu.actual('outerWidth') < wrapMenuLeft;
30610			}
30611
30612			if (bToLeft) {
30613				$this.find('>.dropdown').addClass('toleft').show();
30614			}
30615			else {
30616				$this.find('>.dropdown').removeClass('toleft').show();
30617			}
30618			var submenuLeft = $submenu.offset().left;
30619			var submenuRight = submenuLeft + $submenu.actual('outerWidth');
30620
30621			$this.parents('.dropdown').each(function () {
30622				var $this = $(this);
30623				var leftOffset = $this.offset().left;
30624				var rightOffset = leftOffset + $this.actual('outerWidth');
30625				if (leftOffset >= submenuLeft && leftOffset < (submenuRight - 1) || (rightOffset > (submenuLeft + 1) && rightOffset <= submenuRight)) {
30626					arParentSubmenuForOpacity.push($this);
30627					$this.find('>li>a').css({ opacity: '0.1' });
30628				}
30629			});
30630		}, delayTime);
30631
30632		$this.unbind('mouseleave');
30633		$this.on('mouseleave', function () {
30634			var leaveTimer = setTimeout(function () {
30635				$this.find('.dropdown').removeClass('toleft').hide();
30636				if (arParentSubmenuForOpacity.length) {
30637					for (i in arParentSubmenuForOpacity) {
30638						arParentSubmenuForOpacity[i].find('>li>a').css({ opacity: '' });
30639					}
30640				}
30641			}, delayTime);
30642
30643			$this.unbind('mouseenter');
30644			$this.on('mouseenter', function () {
30645				if (leaveTimer) {
30646					clearTimeout(leaveTimer);
30647					leaveTimer = false;
30648				}
30649			});
30650		});
30651	}
30652});
30653
30654/*hover animate*/
30655//breadcrumbs
30656$(document).on('mouseenter', '.breadcrumbs .breadcrumbs__item, .hover-block .hover-block__item', function () {
30657	var _this = $(this),
30658		menu = _this.find('> .breadcrumbs__dropdown-wrapper, > .hover-block__item-wrapper');
30659
30660	menu.velocity('stop').velocity('transition.slideUpIn', {
30661		duration: 300,
30662		delay: 100
30663	});
30664
30665	_this.one('mouseleave', function () {
30666
30667		menu.velocity('stop').velocity('fadeOut', {
30668			duration: 100,
30669			// delay: 0
30670		});
30671	});
30672});
30673
30674//top menu
30675$(document).on('mouseenter', '.menu .mega-menu table td, .menu-row .mega-menu table td', function () {
30676
30677	var _this = $(this),
30678		menu = _this.find('> .wrap > .dropdown-menu');
30679
30680	if (!_this.hasClass('wide_menu')) {
30681		menu.show();
30682		CheckTopVisibleMenu();
30683	}
30684
30685	var bDarkness = $('.wrapper1.dark-hover-overlay').length > 0;
30686
30687	menu.velocity('stop');
30688
30689	if (menu.css('opacity') != 0) {
30690		menu.css('opacity', '1');
30691		if (bDarkness) {
30692			$('.shadow-block').css('opacity', '1');
30693		}
30694	}
30695	else {
30696		// menu.velocity('stop').velocity('transition.perspectiveDownIn', {
30697		// menu.velocity('stop').velocity('transition.slideUpBigIn', {
30698		// menu.velocity('transition.expandIn', {
30699		menu.velocity('fadeIn', {
30700			duration: 150,
30701			delay: 250,
30702			complete: function () {
30703				if (bDarkness) {
30704					$('body').addClass('menu-hovered');
30705					if (!$('.shadow-block').length)
30706						$('<div class="shadow-block"></div>').appendTo($('body'));
30707					$('.shadow-block').velocity('stop').velocity('fadeIn', 200);
30708
30709					var bannerMenu = $('.dropdown-menu.with_right_block .owl-carousel-hover');
30710					if (bannerMenu.length) {
30711						bannerMenu.removeClass('owl-carousel-hover').addClass('owl-carousel');
30712						setTimeout(function () {
30713							InitOwlSlider();
30714							bannerMenu.removeClass('loader_circle');
30715						}, 1);
30716					}
30717				}
30718			}
30719		});
30720	}
30721
30722	_this.one('mouseleave', function () {
30723		menu.velocity('stop').velocity('fadeOut', {
30724			duration: 50,
30725			delay: 300,
30726			complete: function () {
30727				if (bDarkness) {
30728					$('.shadow-block').velocity('stop').velocity('fadeOut', {
30729						duration: 200,
30730						// delay: 100,
30731						complete: function () {
30732							$('body').removeClass('menu-hovered');
30733						}
30734					});
30735				}
30736			}
30737		});
30738	});
30739});
30740/**/
30741
30742$(document).on('mouseenter', '.menu-item:not(.wide_menu) .dropdown-menu .dropdown-submenu', function () {
30743	var _this = $(this),
30744		menu = _this.find('> .dropdown-menu');
30745
30746	menu.velocity('stop');
30747
30748	if (menu.css('opacity') != 0) {
30749		menu.css('opacity', '1');
30750	}
30751	else {
30752		menu.velocity('transition.fadeIn', {
30753			duration: 300,
30754			delay: 250
30755		});
30756	}
30757
30758	_this.one('mouseleave', function () {
30759		menu.velocity('stop').velocity('fadeOut', {
30760			duration: 150,
30761			delay: 300
30762		});
30763	});
30764})
30765
30766/*register custom velocity animate*/
30767if (typeof $.Velocity !== undefined && ('RegisterEffect' in $.Velocity)) {
30768	var effects = {
30769		"transition.slideDownFullIn": {
30770			defaultDuration: 900,
30771			calls: [[{ opacity: [1, 0], translateY: [0, '-100%'], translateZ: 0 }]]
30772		},
30773		"transition.slideDownFullOut": {
30774			defaultDuration: 900,
30775			calls: [[{ opacity: [0.4, 1], translateY: ['-100%', 0], translateZ: 0 }]]
30776		}
30777	};
30778
30779	for (var effectName in effects) {
30780		if (effects.hasOwnProperty(effectName)) {
30781			$.Velocity.RegisterEffect(effectName, effects[effectName]);
30782		}
30783	}
30784}
30785/**/
30786
30787getGridSize = function (counts, slider) {
30788	var counts_item = 1;
30789	//wide
30790	if (window.matchMedia('(min-width: 1200px)').matches) {
30791		counts_item = counts[0];
30792		if (typeof (slider.data('lg_count')) !== 'undefined' && slider.data('lg_count') && $('.front.wide_page').length)
30793			counts_item = slider.data('lg_count');
30794	}
30795
30796	//large
30797	if (window.matchMedia('(max-width: 1200px)').matches) {
30798		counts_item = counts[1];
30799	}
30800
30801	//middle
30802	if (window.matchMedia('(max-width: 992px)').matches) {
30803		counts_item = counts[2];
30804	}
30805
30806	//small
30807	if (counts[3]) {
30808		if (window.matchMedia('(max-width: 600px)').matches) {
30809			counts_item = counts[3];
30810		}
30811	}
30812
30813	//exsmall
30814	if (counts[4]) {
30815		if (window.matchMedia('(max-width: 400px)').matches) {
30816			counts_item = counts[4];
30817		}
30818	}
30819	return counts_item;
30820}
30821
30822CheckFlexSlider = function () {
30823	$('.flexslider:not(.thmb)').each(function () {
30824		var slider = $(this);
30825		if (typeof (slider.data('flexslider')) != 'undefined') {
30826			if ('vars' in slider.data('flexslider')) {
30827				slider.resize();
30828
30829				var counts = slider.data('flexslider').vars.counts;
30830				if (typeof (counts) != 'undefined' && slider.is(':visible')) {
30831					var cnt = getGridSize(counts, slider);
30832					var to0 = (cnt != slider.data('flexslider').vars.minItems || cnt != slider.data('flexslider').vars.maxItems || cnt != slider.data('flexslider').vars.move);
30833					if (to0) {
30834						slider.data('flexslider').vars.minItems = cnt;
30835						slider.data('flexslider').vars.maxItems = cnt;
30836						slider.data('flexslider').vars.move = cnt;
30837						slider.flexslider(0);
30838						slider.resize();
30839						slider.resize(); // twise!
30840					}
30841				}
30842			}
30843		}
30844	});
30845}
30846
30847InitScrollBar = function (el, initOptions) {
30848	var block = $('.srollbar-custom:not(.mobile-scroll)');
30849	if (typeof el !== 'undefined')
30850		block = el;
30851	if (block.length) {
30852		var options,
30853			defaults = {
30854				mouseWheel: {
30855					scrollAmount: 150,
30856					preventDefault: true
30857				}
30858			};
30859		var config = $.extend({}, defaults, options, block.data('plugin-options'), initOptions);
30860
30861		config.callbacks = {
30862			onScroll: function () {
30863				if ($(this).find('.mCSB_buttonLeft').hasClass('disabled'))
30864					$(this).find('.mCSB_buttonLeft').removeClass('disabled');
30865				if ($(this).find('.mCSB_buttonRight').hasClass('disabled'))
30866					$(this).find('.mCSB_buttonRight').removeClass('disabled');
30867			},
30868			onTotalScrollBack: function () {
30869				$(this).find('.mCSB_buttonLeft').addClass('disabled');
30870			},
30871			onTotalScroll: function () {
30872				$(this).find('.mCSB_buttonRight').addClass('disabled');
30873			},
30874			onInit: function () {
30875				$(this).find('.mCSB_buttonLeft').addClass('disabled');
30876			}
30877		};
30878		block.mCustomScrollbar('destroy');
30879		block.mCustomScrollbar(config);
30880	}
30881}
30882
30883InitFancyBox = function () {
30884	$('.fancy').fancybox({
30885		padding: [40, 40, 64, 40],
30886		openEffect: 'fade',
30887		closeEffect: 'fade',
30888		nextEffect: 'fade',
30889		prevEffect: 'fade',
30890		opacity: true,
30891		tpl: {
30892			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>',
30893			next: '<a title="' + BX.message('FANCY_NEXT') + '" class="fancybox-nav fancybox-next" href="javascript:;"><span></span></a>',
30894			prev: '<a title="' + BX.message('FANCY_PREV') + '" class="fancybox-nav fancybox-prev" href="javascript:;"><span></span></a>'
30895		},
30896		touch: 'enabled',
30897		buttons: [
30898			// "zoom",
30899			//"share",
30900			// "slideShow",
30901			//"fullScreen",
30902			//"download",
30903			// "thumbs",
30904			"close"
30905		],
30906		backFocus: false,
30907		beforeShow: function (event) {
30908			if (!$('.cd-modal-bg').hasClass('is-visible')) {
30909				var scaleValue = retrieveScale($('.cd-modal-bg'));
30910
30911				$('.cd-modal-bg').show().addClass('is-visible').one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function () {
30912					animateLayer($('.cd-modal-bg'), scaleValue, true);
30913				});
30914			}
30915			var video_block = $('.company-block source.video-block');
30916			if (video_block.length) {
30917				if (video_block.attr('src') == '#') {
30918					var video_block_wrapper = video_block.closest('video');
30919					var video_block_clone = video_block_wrapper.clone();
30920
30921					video_block_clone.find('source').attr('src', video_block_clone.find('source').data('src'));
30922					video_block.attr('src', video_block.data('src'));
30923					video_block_clone.insertAfter(video_block_wrapper);
30924					video_block_clone.siblings('video').remove();
30925				}
30926			}
30927			var video_block_frame = $('.company-block #company_video_iframe');
30928			if (video_block_frame.length) {
30929				var data_src_iframe = video_block_frame.attr("data-src");
30930				video_block_frame.attr("src", data_src_iframe);
30931				video_block_frame.attr("allow", 'autoplay');
30932			}
30933			// $('.detail .galery .overlay_form').hide();
30934		},
30935		afterShow: function () {
30936			if ($('.fancybox-overlay').css('opacity') == 0) {
30937				setTimeout(function () {
30938					$('.fancybox-overlay').css('opacity', 1);
30939					$('html').addClass('overflow_html');
30940				}, 200);
30941			}
30942
30943			$('.fancybox-nav').css('opacity', 0);
30944			setTimeout(function () {
30945				$('.fancybox-nav').css('opacity', 1);
30946			}, 150);
30947			if ($('.fancybox-inner #company_video').length) {
30948				// var fancyHeight = $('.fancybox-wrap').height();
30949				// $('.fancybox-inner').height(fancyHeight);
30950				setTimeout(function () {
30951					$('.fancybox-wrap video').resize();
30952					setTimeout(function () {
30953						$('.fancybox-wrap').addClass('show_video');
30954						document.getElementById('company_video').currentTime = 0;
30955						document.getElementById('company_video').play();
30956					}, 300);
30957				}, 150);
30958			}
30959			else if ($('.fancybox-wrap iframe').length) {
30960				$('.fancybox-inner').height('100%');
30961			}
30962		},
30963		beforeClose: function () {
30964			closeModal();
30965			$('.fancybox-overlay').fadeOut();
30966			if ($('#company_video').length) {
30967				document.getElementById('company_video').currentTime = 0;
30968			}
30969			$('html').removeClass('overflow_html');
30970			var video_block_frame = $('.company-block .video-block');
30971			if (video_block_frame.length) {
30972				$("#company_video_iframe").attr("src", '');
30973
30974			}
30975		},
30976		onClosed: function () {
30977			if ($('.fancybox-wrap #company_video').length) {
30978				document.getElementById('company_video').pause();
30979			}
30980		},
30981	});
30982}
30983
30984InitFancyBoxVideo = function () {
30985	$(".video_link").fancybox({
30986		type: "iframe",
30987		maxWidth: 800,
30988		maxHeight: 600,
30989		fitToView: false,
30990		width: '70%',
30991		height: '70%',
30992		autoSize: false,
30993		closeClick: false,
30994		opacity: true,
30995		tpl: {
30996			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>',
30997			next: '<a title="' + BX.message('FANCY_NEXT') + '" class="fancybox-nav fancybox-next" href="javascript:;"><span></span></a>',
30998			prev: '<a title="' + BX.message('FANCY_PREV') + '" class="fancybox-nav fancybox-prev" href="javascript:;"><span></span></a>'
30999		},
31000		beforeShow: function (event) {
31001			if (!$('.cd-modal-bg').hasClass('is-visible')) {
31002				var scaleValue = retrieveScale($('.cd-modal-bg'));
31003
31004				$('.cd-modal-bg').show().addClass('is-visible').one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function () {
31005					animateLayer($('.cd-modal-bg'), scaleValue, true);
31006				});
31007			}
31008		},
31009		afterShow: function () {
31010			if ($('.fancybox-overlay').css('opacity') == 0) {
31011				setTimeout(function () {
31012					$('.fancybox-overlay').css('opacity', 1);
31013					$('html').addClass('overflow_html');
31014				}, 200);
31015			}
31016
31017			$('.fancybox-nav').css('opacity', 0);
31018			setTimeout(function () {
31019				$('.fancybox-nav').css('opacity', 1);
31020			}, 150);
31021			if ($('.fancybox-wrap iframe').length) {
31022				$('.fancybox-inner').height('100%');
31023			}
31024		},
31025		beforeClose: function () {
31026			closeModal();
31027			$('.fancybox-overlay').fadeOut();
31028			$('html').removeClass('overflow_html');
31029		},
31030	});
31031}
31032
31033InitStickySideBar = function (el, container_el) {
31034	var block = '.sticky-sidebar',
31035		container_catalog = '.wraps .wrapper_inner .container_inner .main-catalog-wrapper',
31036		container = '.wraps .wrapper_inner .container_inner';
31037	if (typeof el !== 'undefined')
31038		block = el;
31039
31040	if ($(container_catalog).length)
31041		container = container_catalog;
31042
31043	if (typeof container_el !== 'undefined')
31044		container = container_el;
31045
31046	if ($(block).length && arAsproOptions['THEME']['STICKY_SIDEBAR'] != 'N') {
31047		if (typeof window['stickySidebar'] !== 'undefined') {
31048			window['stickySidebar'].destroy();
31049		}
31050		window['stickySidebar'] = new StickySidebar(block, {
31051			topSpacing: 60,
31052			bottomSpacing: 20,
31053			containerSelector: container,
31054			resizeSensor: true,
31055			innerWrapperSelector: '.sticky-sidebar__inner'
31056		});
31057
31058		if ($('.sticky-sidebar .sticky-sidebar__inner .banner img').length) {
31059			$('.sticky-sidebar .sticky-sidebar__inner .banner img').load(function () {
31060				if (typeof window['stickySidebar'] !== 'undefined') {
31061					window['stickySidebar'].updateSticky();
31062				}
31063			})
31064		}
31065	}
31066}
31067
31068InitCustomScrollBar = function (el) {
31069	var block = $('.scrollbar:not(.mobile-scroll)');
31070	if (typeof el !== 'undefined')
31071		block = el;
31072
31073	if (block.length) {
31074		var options,
31075			defaults = {
31076				effect: 'fadeIn',
31077				effectTime: 300,
31078				threshold: 0
31079				// threshold: 30
31080			};
31081
31082		var config = $.extend({}, defaults, options, block.data('plugin-options'));
31083
31084		block.mCustomScrollbar(config);
31085	}
31086}
31087
31088InitOwlSlider = function () {
31089	$('.owl-carousel:not(.owl-loaded):not(.appear-block)').each(function () {
31090		var slider = $(this);
31091		var options;
31092		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>';
31093		var defaults = {
31094			navText: [
31095				'<i class="svg left colored_theme_hover_text">' + svg + '</i>',
31096				'<i class="svg right colored_theme_hover_text">' + svg + '</i>',
31097			]
31098		}
31099		var config = $.extend({}, defaults, options, slider.data('plugin-options'));
31100
31101		slider.on('initialized.owl.carousel', function (event) {
31102
31103			var eventdata = { slider: event };
31104			BX.onCustomEvent('onSliderInitialized', [eventdata]);
31105
31106			$(event.target).removeClass('loading-state');
31107			$(event.target).find('.owl-item:first').addClass('current');
31108
31109			if (typeof (sliceItemBlockSlide) === "function") {
31110				sliceItemBlockSlide();
31111			}
31112
31113		})
31114		slider.owlCarousel(config);
31115
31116		slider.on('change.owl.carousel', function (event) {
31117			var eventdata = { slider: event };
31118			BX.onCustomEvent('onSlideChange', [eventdata]);
31119
31120		})
31121		slider.on('resized.owl.carousel', function (event) {
31122			if (typeof (sliceItemBlockSlide) === "function") {
31123				sliceItemBlockSlide({ resize: false });
31124			}
31125		})
31126
31127
31128
31129		slider.on('changed.owl.carousel', function (event) {
31130			var eventdata = { slider: event };
31131			BX.onCustomEvent('onSlideChanged', [eventdata]);
31132
31133			if ($(event.target).data('pluginOptions')) {
31134				if (('index' in $(event.target).data('pluginOptions'))) {
31135					if ($('.switch-item-block').length) {
31136						$('.switch-item-block__count-wrapper--big .switch-item-block__count-value').text(event.item.index + 1 + '/' + event.item.count);
31137					}
31138				}
31139
31140				if (('relatedTo' in $(event.target).data('pluginOptions'))) {
31141					// console.log(event);
31142
31143					var relatedClass = $(event.target).data('pluginOptions').relatedTo,
31144						relatedBlock = $(relatedClass);
31145
31146					if (relatedBlock.length && $(event.target).data('owl.carousel')) {
31147						// console.log($(event.target).data())
31148						if (!$(event.target).data('owl.carousel').loop) {
31149							var current = event.item.index;
31150						}
31151						else {
31152							var count = event.item.count - 1;
31153							var current = Math.round(event.item.index - (event.item.count / 2) - .5);
31154
31155							if (current < 0)
31156								current = count;
31157
31158							if (current > count)
31159								current = 0;
31160						}
31161
31162						relatedBlock
31163							.find(".owl-item")
31164							.removeClass("current")
31165							.eq(current)
31166							.addClass("current");
31167
31168						var onscreen = relatedBlock.find('.owl-item.active').length - 1;
31169						var start = relatedBlock.find('.owl-item.active').first().index();
31170						var end = relatedBlock.find('.owl-item.active').last().index();
31171
31172
31173						if (current > end)
31174							relatedBlock.data('owl.carousel').to(current, 100, true);
31175
31176						if (current < start)
31177							relatedBlock.data('owl.carousel').to(current - onscreen, 100, true);
31178						// $(".owl-slider-"+id).trigger('to.owl.carousel', [itemCarousel])
31179					}
31180				}
31181			}
31182		})
31183
31184		slider.on('translated.owl.carousel', function (event) {
31185		})
31186
31187		if (('clickTo' in config)) {
31188			var relatedClass = config.clickTo,
31189				magnifier = ('magnifier' in config);
31190
31191			slider.on("click", ".owl-item", function (e) {
31192				e.preventDefault();
31193				var _this = $(this),
31194					number = _this.index();
31195
31196				if (magnifier) {
31197					if ($(relatedClass).closest('.product-container').find('.zoom_picture').length) {
31198						$(relatedClass).closest('.product-container').find('.zoom_picture').attr('data-large', _this.find('.product-detail-gallery__item').data('big'));
31199						$(relatedClass).closest('.product-container').find('.zoom_picture').attr('xoriginal', _this.find('.product-detail-gallery__item').data('big'));
31200						$(relatedClass).closest('.product-container').find('.zoom_picture').attr('src', _this.find('.product-detail-gallery__item img').attr('src'));
31201					}
31202					_this.siblings('').removeClass('current');
31203					_this.addClass('current');
31204				}
31205				else {
31206					$(relatedClass).data('owl.carousel').to(number, 300, true);
31207				}
31208			});
31209		}
31210	});
31211}
31212
31213InitFlexSlider = function () {
31214	// return;
31215	$('.flexslider:not(.thmb):not(.flexslider-init):not(.appear-block)').each(function () {
31216		var slider = $(this);
31217		var options;
31218		var defaults = {
31219			animationLoop: false,
31220			controlNav: false,
31221			keyboard: false,
31222			pauseOnAction: false,
31223			pauseInvisible: false,
31224			directionNav: true,
31225			useCSS: false,
31226			animation: "slide"
31227		}
31228		var config = $.extend({}, defaults, options, slider.data('plugin-options'));
31229		if (!slider.parent().hasClass('top_slider_wrapp') && slider.is(':visible')) {
31230			if (typeof (config.counts) != 'undefined' && config.direction !== 'vertical') {
31231				config.maxItems = getGridSize(config.counts, slider);
31232				config.minItems = getGridSize(config.counts, slider);
31233				config.itemWidth = 200;
31234			}
31235			if (typeof (config.move) == 'undefined')
31236				config.move = 1;
31237
31238			config.start = function (slider) {
31239				var eventdata = { slider: slider };
31240				BX.onCustomEvent('onSlideInit', [eventdata]);
31241			}
31242
31243			config.after = function (slider) {
31244				var eventdata = { slider: slider };
31245				BX.onCustomEvent('onSlideComplete', [eventdata]);
31246			}
31247
31248			config.end = function (slider) {
31249				var eventdata = { slider: slider };
31250				BX.onCustomEvent('onSlideEnd', [eventdata]);
31251			}
31252			slider.flexslider(config).addClass('flexslider-init');
31253			if (config.controlNav)
31254				slider.addClass('flexslider-control-nav');
31255			if (config.directionNav)
31256				slider.addClass('flexslider-direction-nav');
31257		}
31258	});
31259}
31260
31261InitFlexSliderByClass = function ($class) {
31262	if ($class.hasClass('flexslider-init'))
31263		return;
31264	var slider = $class;
31265	var options;
31266	var defaults = {
31267		animationLoop: false,
31268		controlNav: false,
31269		keyboard: false,
31270		pauseOnAction: false,
31271		pauseInvisible: false,
31272		directionNav: true,
31273		useCSS: false,
31274		animation: "slide"
31275	}
31276	var config = $.extend({}, defaults, options, slider.data('plugin-options'));
31277	if (!slider.parent().hasClass('top_slider_wrapp') && slider.is(':visible')) {
31278		if (typeof (config.counts) != 'undefined' && config.direction !== 'vertical') {
31279			config.maxItems = getGridSize(config.counts, slider);
31280			config.minItems = getGridSize(config.counts, slider);
31281			config.itemWidth = 200;
31282		}
31283		if (typeof (config.move) == 'undefined')
31284			config.move = 1;
31285
31286		config.start = function (slider) {
31287			var eventdata = { slider: slider };
31288			BX.onCustomEvent('onSlideInit', [eventdata]);
31289		}
31290
31291		config.after = function (slider) {
31292			var eventdata = { slider: slider };
31293			BX.onCustomEvent('onSlideComplete', [eventdata]);
31294		}
31295
31296		config.end = function (slider) {
31297			var eventdata = { slider: slider };
31298			BX.onCustomEvent('onSlideEnd', [eventdata]);
31299		}
31300
31301		slider.flexslider(config).addClass('flexslider-init');
31302		if (config.controlNav)
31303			slider.addClass('flexslider-control-nav');
31304		if (config.directionNav)
31305			slider.addClass('flexslider-direction-nav');
31306	}
31307}
31308
31309inIframe = function () {
31310	try {
31311		return window.self !== window.top;
31312	} catch (e) {
31313		return true;
31314	}
31315}
31316
31317InitZoomPict = function (el) {
31318	var block = $('.zoom_picture');
31319	if (typeof el !== 'undefined')
31320		block = el;
31321	if (block.length) {
31322		var zoomer = block,
31323			options,
31324			defaults = {
31325				zoomWidth: 200,
31326				zoomHeight: 200,
31327				adaptive: false,
31328				title: true,
31329				Xoffset: 15,
31330
31331			};
31332		var config = $.extend({}, defaults, options, zoomer.data('plugin-options'));
31333		zoomer.xzoom(config);
31334
31335		block.on('mouseleave', function () {
31336			block.data('xzoom').movezoom(event);
31337		})
31338	}
31339}
31340
31341var arBasketAsproCounters = arStatusBasketAspro = arBasketPrices = {};
31342SetActualBasketFlyCounters = function (sync) {
31343	if (arBasketAsproCounters.DEFAULT == true) {
31344		$.ajax({
31345			url: arAsproOptions['SITE_DIR'] + 'ajax/basket_fly.php',
31346			type: 'post',
31347			success: function (html) {
31348				$('#basket_line .basket_fly').removeClass('loaded').html(html);
31349
31350				if (typeof sync !== 'undefined') {
31351					$.ajax({
31352						type: "GET",
31353						url: arAsproOptions['SITE_DIR'] + "ajax/actualBasket.php",
31354						// data:data,
31355						success: function (data) {
31356							if (!$('.js_ajax').length)
31357								$('body').append('<div class="js_ajax"></div>');
31358							$('.js_ajax').html(data);
31359
31360							setBasketStatusBtn(true);
31361
31362						}
31363					});
31364				}
31365			}
31366		});
31367	}
31368	else {
31369		// insert currency &#8381; by this hack!: $('<div/>').html(arBasketAsproCounters.READY.TITLE).text()
31370		$('.basket_fly .opener .basket_count .count').attr('class', 'count' + (arBasketAsproCounters.READY.COUNT > 0 ? '' : ' empty_items')).find('.items span').text(arBasketAsproCounters.READY.COUNT)
31371		$('.basket_fly .opener .basket_count + a').attr('href', arBasketAsproCounters['READY']['HREF'])
31372		$('.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'))
31373
31374		$('.basket_fly .opener .wish_count .count').attr('class', 'count' + (arBasketAsproCounters.DELAY.COUNT > 0 ? '' : ' empty_items')).find('.items span').text(arBasketAsproCounters.DELAY.COUNT)
31375		$('.basket_fly .opener .wish_count + a').attr('href', arBasketAsproCounters.DELAY.HREF)
31376		$('.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'))
31377
31378		$('.basket_fly .opener .compare_count .wraps_icon_block').attr('class', 'wraps_icon_block compare' + (arBasketAsproCounters.COMPARE.COUNT > 0 ? '' : ' empty_block'));
31379		$('.basket_fly .opener .compare_count .count').attr('class', 'count' + (arBasketAsproCounters.COMPARE.COUNT > 0 ? '' : ' empty_items')).find('.items span').text(arBasketAsproCounters.COMPARE.COUNT)
31380		$('.basket_fly .opener .compare_count + a').attr('href', arBasketAsproCounters.COMPARE.HREF)
31381
31382	}
31383}
31384
31385CheckHeaderFixed = function () {
31386	var header_fixed = $('#headerfixed');
31387	header = $('header').first();
31388	if (header_fixed.length) {
31389		if (header.length) {
31390			var isHeaderFixed = false,
31391				isTabsFixed = false,
31392				headerCanFix = true,
31393				headerFixedHeight = header_fixed.actual('outerHeight'),
31394				headerNormalHeight = header.actual('outerHeight'),
31395				headerDiffHeight = headerNormalHeight - headerFixedHeight,
31396				mobileBtnMenu = $('.btn.btn-responsive-nav'),
31397				headerTop = $('#panel:visible').actual('outerHeight');
31398			topBlock = $('.TOP_HEADER').first();
31399
31400			if (headerDiffHeight <= 0)
31401				headerDiffHeight = 0;
31402			if (topBlock.length)
31403				headerTop += topBlock.actual('outerHeight');
31404
31405			$(window).scroll(function () {
31406				var tabs_fixed = $('.product-item-detail-tabs-container-fixed');
31407				if (window.matchMedia('(min-width:992px)').matches) {
31408					var scrollTop = $(window).scrollTop();
31409					headerCanFix = !mobileBtnMenu.is(':visible')/* && !$('.dropdown-menu:visible').length*/;
31410
31411					var tabs = $('.ordered-block .nav.nav-tabs');
31412
31413					var current_is = $('.search-wrapper .search-input:visible'),
31414						title_search_result = $('.title-search-result.' + current_is.attr('id')),
31415						pos, pos_input;
31416
31417					if (!isHeaderFixed) {
31418						if ((scrollTop > headerNormalHeight + headerTop) && headerCanFix) {
31419							isHeaderFixed = true;
31420							// header_fixed.css('top', '-' + headerNormalHeight + 'px');
31421							header_fixed.addClass('fixed');
31422							// header_fixed.stop(0).animate({top: '0'}, 300);
31423
31424							/*header_fixed.animate({top: '0'}, {duration:300, complete:
31425								function(){}
31426							});*/
31427
31428							if ($('nav.mega-menu.sliced').length)
31429								$('nav.mega-menu.sliced').removeClass('initied');
31430							CheckTopMenuDotted();
31431						}
31432					}
31433					else if (isHeaderFixed || !headerCanFix) {
31434						if ((scrollTop <= headerDiffHeight + headerTop) || !headerCanFix) {
31435							isHeaderFixed = false;
31436							header_fixed.removeClass('fixed');
31437						}
31438					}
31439					//fixed tabs
31440					if (tabs_fixed.length && tabs.length) {
31441						var tabs_offset = $('.ordered-block .nav.nav-tabs').offset();
31442						if (scrollTop + headerFixedHeight > tabs_offset.top) {
31443							tabs_fixed.css({ 'top': header_fixed.actual('outerHeight') });
31444							tabs_fixed.addClass('fixed');
31445
31446							header_fixed.addClass('tabs-fixed');
31447						}
31448						else if (tabs_fixed.hasClass('fixed')) {
31449							tabs_fixed.removeAttr('style');
31450							tabs_fixed.removeClass('fixed');
31451
31452							header_fixed.removeClass('tabs-fixed');
31453						}
31454					}
31455				}
31456			});
31457		}
31458	}
31459
31460	//mobile fixed
31461	var mfixed = $('.wrapper1.mfixed_Y #mobileheader');
31462	if (mfixed.length && isMobile) {
31463		var isMHeaderFixed = false,
31464			mheaderCanFix = true,
31465			//mheaderFixedHeight = mfixed.actual('outerHeight'),
31466			mheaderFixedHeight = 0,
31467			mheaderTop = $('#panel:visible').actual('outerHeight');
31468		$(window).scroll(function () {
31469			var scrollTop = $(window).scrollTop();
31470			if (window.matchMedia('(max-width:991px)').matches) {
31471				if ($('.wrapper1.mfixed_Y.mfixed_view_scroll_top #mobileheader').length) {
31472					if (scrollTop > startScroll) {
31473						if (!$("#mobilePhone.show").length) {
31474							$('.wrapper1.mfixed_Y.mfixed_view_scroll_top #mobileheader').removeClass('fixed');
31475						}
31476					}
31477					else if (scrollTop > mheaderFixedHeight + mheaderTop) {
31478						$('.wrapper1.mfixed_Y.mfixed_view_scroll_top #mobileheader').addClass('fixed');
31479					}
31480					else if (scrollTop <= mheaderFixedHeight + mheaderTop) {
31481						$('.wrapper1.mfixed_Y.mfixed_view_scroll_top #mobileheader').removeClass('fixed');
31482					}
31483					startScroll = scrollTop;
31484				}
31485				else {
31486					if (!isMHeaderFixed) {
31487						if ((scrollTop > mheaderFixedHeight + mheaderTop)) {
31488							isMHeaderFixed = true;
31489							mfixed.addClass('fixed');
31490						}
31491					}
31492					else if (isMHeaderFixed) {
31493						if ((scrollTop <= mheaderFixedHeight + mheaderTop)) {
31494							isMHeaderFixed = false;
31495							mfixed.removeClass('fixed');
31496						}
31497					}
31498				}
31499			}
31500			else
31501				mfixed.removeClass('fixed');
31502		})
31503	}
31504}
31505
31506CheckHeaderFixedMenu = function () {
31507	if (arAsproOptions['THEME']['HEADER_FIXED'] == 2 && $('#headerfixed .js-nav').length && window.matchMedia('(min-width: 992px)').matches) {
31508		$('#headerfixed .js-nav').css('width', '0');
31509		var all_width = 0,
31510			cont_width = $('#headerfixed .maxwidth-theme').actual('width'),
31511			padding_menu = $('#headerfixed .logo-row.v2 .menu-block').actual('outerWidth') - $('#headerfixed .logo-row.v2 .menu-block').actual('width');
31512		$('#headerfixed .logo-row.v2 > .inner-table-block').each(function () {
31513			if (!$(this).hasClass('menu-block'))
31514				all_width += $(this).actual('outerWidth');
31515		})
31516		$('#headerfixed .js-nav').width(cont_width - all_width - padding_menu);
31517	}
31518}
31519
31520CheckSearchWidth = function () {
31521	if ($('.logo_and_menu-row .search_wrap').length) {
31522		var searchPosition = $('.logo_and_menu-row .search_wrap').position().left,
31523			maxWidth = $('.logo_and_menu-row .maxwidth-theme').width() - 2;
31524		width = 0;
31525		if ($('.logo_and_menu-row .subtop .search_wrap').length) {
31526			maxWidth = $('.logo_and_menu-row .subtop').width() - 2;
31527			$('.logo_and_menu-row .subtop > .row >div >div').each(function () {
31528				if (!$(this).hasClass('search_wrap')) {
31529					var elementWidth = $(this).outerWidth();
31530					if (!$(this).is(':visible') || !$(this).height())
31531						elementWidth = 0;
31532					width = (width ? width - elementWidth : maxWidth - elementWidth);
31533				}
31534			}).promise().done(function () {
31535				if ($('.logo_and_menu-row .search_wrap.wide_search').length)
31536					$('.logo_and_menu-row .search_wrap .search-block').outerWidth(width);
31537				else
31538					$('.logo_and_menu-row .search_wrap').outerWidth(width);
31539				$('.logo_and_menu-row .search_wrap').css({ 'opacity': 1, 'visibility': 'visible' });
31540			});
31541		}
31542		else {
31543			if ($('.logo_and_menu-row .subbottom .search_wrap').length) {
31544				maxWidth = $('.logo_and_menu-row .subbottom').width() - 2;
31545				$('.logo_and_menu-row .subbottom >div').each(function () {
31546					if (!$(this).hasClass('search_wrap')) {
31547						var elementWidth = $(this).outerWidth();
31548						if (!$(this).is(':visible') || !$(this).height())
31549							elementWidth = 0;
31550						width = (width ? width - elementWidth : maxWidth - elementWidth);
31551					}
31552				}).promise().done(function () {
31553					if ($('.logo_and_menu-row .search_wrap.wide_search').length)
31554						$('.logo_and_menu-row .search_wrap .search-block').outerWidth(width);
31555					else
31556						$('.logo_and_menu-row .search_wrap').outerWidth(width);
31557					$('.logo_and_menu-row .search_wrap').css({ 'opacity': 1, 'visibility': 'visible' });
31558				});
31559			}
31560			else {
31561				$('.logo_and_menu-row .maxwidth-theme > .row >div >div').each(function () {
31562					if (!$(this).hasClass('search_wrap')) {
31563						var elementWidth = $(this).outerWidth();
31564						if (!$(this).is(':visible') || !$(this).height())
31565							elementWidth = 0;
31566						width = (width ? width - elementWidth : maxWidth - elementWidth);
31567					}
31568				}).promise().done(function () {
31569					if ($('.logo_and_menu-row .search_wrap.wide_search').length)
31570						$('.logo_and_menu-row .search_wrap .search-block').outerWidth(width);
31571					else
31572						$('.logo_and_menu-row .search_wrap').outerWidth(width);
31573					$('.logo_and_menu-row .search_wrap').css({ 'opacity': 1, 'visibility': 'visible' });
31574				});
31575			}
31576		}
31577	}
31578}
31579
31580scrollPreviewBlock = function () {
31581	if (typeof ($.cookie('scroll_block')) != 'undefined' && $.cookie('scroll_block')) {
31582		var scroll_block = $($.cookie('scroll_block'));
31583		if (scroll_block.length) {
31584			$('body, html').animate({ scrollTop: scroll_block.offset().top }, 500);
31585		}
31586		$.cookie('scroll_block', null);
31587	}
31588}
31589
31590scrollToBlock = function (block) {
31591	if ($(block).length) {
31592		var offset = $(block).offset().top;
31593		if (typeof ($(block).data('toggle')) != 'undefined')
31594			$(block).click();
31595
31596		if (typeof ($(block).data('offset')) != 'undefined')
31597			offset += $(block).data('offset');
31598
31599		$('body, html').animate({ scrollTop: offset }, 500);
31600	}
31601}
31602
31603checkMenuLines = function () {
31604	if ($('.front_page .menu-row .left_border').length || $('.front_page .menu-row .right_border').length) {
31605		var positionMenu = ($('.centered .menu-row .mega-menu table').length ? $('.centered .menu-row .mega-menu table').offset().left : 0),
31606			varFixLineWidth = ($('body').hasClass('with_decorate') && window.matchMedia('(min-width: 1100px)').matches ? 126 : 7);
31607
31608		$('.menu-row .left_border, .menu-row .right_border').css('width', positionMenu - varFixLineWidth);
31609	}
31610}
31611
31612SetFixedAskBlock = function () {
31613	if ($('.ask_a_question_wrapper').length) {
31614		var offset = $('.ask_a_question_wrapper').offset(),
31615			footer_offset = 0,
31616			block = $('.ask_a_question_wrapper').find('.ask_a_question'),
31617			block_offset = BX.pos(block[0]),
31618			block_height = block_offset.bottom - block_offset.top,
31619			diff_top_scroll = $('#headerfixed').height() + 20;
31620
31621		if ($('footer').length)
31622			footer_offset = $('footer').offset().top;
31623
31624		if ($('.banner.CONTENT_BOTTOM').length)
31625			footer_offset = $('.banner.CONTENT_BOTTOM').offset().top;
31626
31627		/* removed for ISSUE NEXT-414
31628		if(block_height+130 > block.closest('.fixed_wrapper').height())
31629			block.addClass('nonfixed');
31630		else
31631			block.removeClass('nonfixed');
31632		*/
31633
31634		if (block_height + diff_top_scroll + documentScrollTopLast + 130 > footer_offset) {
31635			block.removeClass('fixed').css({ 'top': 'auto', 'width': 'auto', 'bottom': 0 });
31636			block.parent().css('position', 'static');
31637			block.parent().parent().css('position', 'static');
31638		}
31639		else {
31640			block.parent().removeAttr('style');
31641			block.parent().parent().removeAttr('style');
31642
31643			if (documentScrollTopLast + diff_top_scroll > offset.top) {
31644				var fixed_width = $('.fixed_block_fix').width();
31645				block.addClass('fixed').css({ 'top': diff_top_scroll, 'bottom': 'auto' });
31646				if (fixed_width)
31647					block.css({ 'width': $('.fixed_block_fix').width() })
31648			}
31649			else
31650				block.removeClass('fixed').css({ 'top': 0, 'width': 'auto' });
31651		}
31652	}
31653}
31654
31655MegaMenuFixed = function () {
31656	var animationTime = 150;
31657
31658	$('header .burger, #headerfixed .burger').on('click', function () {
31659		$('.mega_fixed_menu').fadeIn(animationTime);
31660		//$('.header_wrap').toggleClass('zindexed');
31661		$('.mega_fixed_menu').mCustomScrollbar({
31662			mouseWheel: {
31663				scrollAmount: 150,
31664				preventDefault: true
31665			}
31666		});
31667	});
31668
31669	$('.mega_fixed_menu .svg.svg-close').on('click', function () {
31670		$(this).closest('.mega_fixed_menu').fadeOut(animationTime);
31671		//$('.header_wrap').toggleClass('zindexed');
31672	});
31673
31674	$('.mega_fixed_menu .dropdown-menu .arrow').on('click', function (e) {
31675		e.preventDefault();
31676		e.stopPropagation();
31677		$(this).closest('.dropdown-submenu').find('.dropdown-menu').slideToggle(animationTime);
31678		$(this).closest('.dropdown-submenu').addClass('opened');
31679	});
31680}
31681
31682CheckPopupTop = function () {
31683	// var popup = $('.jqmWindow.show:last');
31684	// if(!popup.length)
31685	// 	popup = $('.jqmWindow.show');
31686	// if(!popup.length)
31687	// 	popup = $('.jqm-init.show');
31688	// if(popup.length){
31689	// 	var documentScollTop = $(document).scrollTop();
31690	// 	var windowHeight = $(window).height();
31691	// 	var popupTop = parseInt(popup.css('top'));
31692	// 	var popupHeight = popup.height();
31693
31694	// 	if(windowHeight >= popupHeight){
31695	// 		// center
31696	// 		popupTop = (windowHeight - popupHeight) / 2;
31697	// 	}
31698	// 	else{
31699	// 		if(documentScollTop > documentScrollTopLast){
31700	// 			// up
31701	// 			popupTop -= documentScollTop - documentScrollTopLast;
31702	// 		}
31703	// 		else if(documentScollTop < documentScrollTopLast){
31704	// 			// down
31705	// 			popupTop += documentScrollTopLast - documentScollTop;
31706	// 		}
31707
31708	// 		if(popupTop + popupHeight < windowHeight){
31709	// 			// bottom
31710	// 			popupTop = windowHeight - popupHeight;
31711	// 		}
31712	// 		else if(popupTop > 0){
31713	// 			// top
31714	// 			popupTop = 0;
31715	// 		}
31716	// 	}
31717	// 	popup.css('top', popupTop + 'px');
31718	// }
31719}
31720
31721AjaxClickLink = function (e) {
31722	var _this = '',
31723		container = $('.js-load-wrapper'),
31724		container_inner = $('.js-load-wrapper').find('.ajax_load'),
31725		dopAction = '';
31726	url = '';
31727	if ('preventDefault' in e) {
31728		e.preventDefault();
31729		_this = ($(e.target).hasClass('js-load-link') ? $(e.target) : $(e.target).closest('.js-load-link'))
31730	}
31731	else {
31732		_this = $(e);
31733		dopAction = 'Y';
31734	}
31735
31736	if (container.length) {
31737		var objUrl = parseUrlQuery(),
31738			obGetData = { "ajax_get_filter": "Y", "control_ajax": "Y" };
31739
31740		obGetData.bitrix_include_areas = 'N';
31741
31742		if ('clear_cache' in objUrl) {
31743			if (objUrl.clear_cache == 'Y') {
31744				obGetData.clear_cache = 'Y';
31745			}
31746		}
31747
31748		if (container_inner.length)
31749			container_inner.addClass('loading-state');
31750		else
31751			container.addClass('loading-state');
31752
31753		if (_this.data('url'))
31754			url = _this.data('url');
31755
31756		if (dopAction) {
31757			BX.PopupWindowManager.getCurrentPopup().close();
31758			$('.bx_filter_select_popup ul li .sort_btn').removeClass('current');
31759			_this.addClass('current');
31760			_this.closest('.bx_filter_block').find('.bx_filter_select_text').text(_this.text());
31761		}
31762
31763		$('.bx_filter .bx_sort_filter .bx_filter_select_text').text(_this.text());
31764		$('.bx_filter .bx_sort_filter .bx_filter_select_popup ul li span.current').removeClass('current');
31765		$('.bx_filter .bx_sort_filter .bx_filter_select_popup ul li').eq(_this.parent().index()).find('span').addClass('current');
31766
31767		$.ajax({
31768			url: url,
31769			data: obGetData,
31770			success: function (html) {
31771				container.html(html);
31772
31773				if (container_inner.length)
31774					container_inner.removeClass('loading-state');
31775				else
31776					container.removeClass('loading-state');
31777
31778				initAnimateLoad();
31779
31780				var eventdata = { action: 'jsLoadBlock' }
31781				BX.onCustomEvent('onCompleteAction', [eventdata, _this]);
31782
31783				initSelects(document);
31784				InitCustomScrollBar();
31785				InitScrollBar();
31786
31787				if (window.FilterHelper !== undefined) {
31788					FilterHelper.resultDiv = $('#filter-helper');
31789					FilterHelper.show();
31790				}
31791
31792			}
31793		})
31794
31795	}
31796}
31797
31798initCalculatePreview = function () {
31799	$('.calculate-delivery.with_preview:not(.inited)').each(function () {
31800		var $this = $(this);
31801		var $calculateSpan = $this.find('span[data-event=jqm]');
31802		var $preview = $this.find('.calculate-delivery-preview');
31803
31804		$this.addClass('inited');
31805		$this.appear(function () {
31806
31807			if ($calculateSpan.length) {
31808				if (typeof window['calculate-delivery-preview-index'] === 'undefined') {
31809					window['calculate-delivery-preview-index'] = 1001;
31810				}
31811				else {
31812					++window['calculate-delivery-preview-index'];
31813				}
31814
31815				var productId = $calculateSpan.attr('data-param-product_id') * 1;
31816				var quantity = $calculateSpan.attr('data-param-quantity') * 1;
31817
31818				if (productId > 0) {
31819					var areaIndexSended = window['calculate-delivery-preview-index'];
31820					$calculateSpan.data({ areaIndex: areaIndexSended });
31821
31822					$.ajax({
31823						url: arAsproOptions['SITE_DIR'] + 'ajax/delivery.php',
31824						type: 'POST',
31825						data: {
31826							is_preview: 'Y',
31827							index: areaIndexSended,
31828							product_id: productId,
31829							quantity: quantity
31830						},
31831						beforeSend: function () {
31832							$this.addClass('loadings');
31833						},
31834						success: function (response) {
31835							var areaIndex = $calculateSpan.data('areaIndex');
31836							if (typeof areaIndex !== 'undefined' && areaIndex == areaIndexSended) {
31837								$calculateSpan.hide();
31838								$preview.html(response);
31839								if (!$preview.find('.catalog-delivery-preview').length) {
31840									$preview.empty();
31841									$calculateSpan.show();
31842								}
31843							}
31844						},
31845						error: function (xhr, ajaxOptions, thrownError) {
31846						},
31847						complete: function () {
31848							var areaIndex = $calculateSpan.data('areaIndex');
31849							if (typeof areaIndex !== 'undefined' && areaIndex == areaIndexSended) {
31850								$this.removeClass('loadings');
31851							}
31852						}
31853					});
31854				}
31855			}
31856
31857		}, { accX: 0, accY: 0 });
31858	});
31859}
31860
31861/*set price item*/
31862if (!funcDefined('setPriceItem')) {
31863	var setPriceItem = function setPriceItem(main_block, quantity, rewrite_price, check_quantity, is_sku, show_percent, percent) {
31864		var old_quantity = main_block.find('.to-cart').attr('data-ratio'),
31865			value = (typeof rewrite_price !== 'undefined' && rewrite_price ? rewrite_price : main_block.find('.to-cart').attr('data-value')),
31866			currency = main_block.find('.to-cart').attr('data-currency'),
31867			total_block = '<div class="total_summ" style="display:none;"><div>
31867' + BX.message('TOTAL_SUMM_ITEM') + '<span></span></div></div>',
31868			price_block = main_block.find('.cost.prices'),
31869			use_percent = (typeof show_percent !== 'undefined' && show_percent == 'Y'),
31870			percent_number = (typeof percent !== 'undefined' && percent),
31871			sku_checked = (main_block.find('.has_offer_prop').length ? 'Y' : 'N'),
31872			check = (typeof check_quantity !== 'undefined' && check_quantity);
31873
31874		if (main_block.find('.counter_wrapp + .wrapp-one-click').length) {
31875			if (!main_block.find('.wrapp-one-click .total_summ').length && !is_sku)
31876				$(total_block).appendTo(main_block.find('.counter_wrapp + .wrapp-one-click'))
31877		}
31878		else if (main_block.find('.buy_block').length) {
31879			if (!main_block.find('.buy_block .total_summ').length && !is_sku)
31880				$(total_block).appendTo(main_block.find('.buy_block'))
31881		}
31882		else if (main_block.find('.counter_wrapp').length) {
31883			if (!main_block.find('.counter_wrapp .total_summ').length && !is_sku)
31884				$(total_block).appendTo(main_block.find('.counter_wrapp:first'))
31885		}
31886		if (main_block.find('.total_summ').length) {
31887			if (value && currency) {
31888				if ((1 == quantity && old_quantity == quantity) || (typeof is_sku !== 'undefined' && is_sku && !check)) {
31889					main_block.find('.total_summ').slideUp(50);
31890				}
31891				else {
31892					main_block.find('.total_summ span').html(BX.Currency.currencyFormat((value * quantity), currency, true));
31893					if (main_block.find('.total_summ').is(':hidden')/* || sku_checked == 'Y'*/)
31894						main_block.find('.total_summ').slideDown(100);
31895				}
31896			}
31897			else {
31898				main_block.find('.total_summ').slideUp(100);
31899			}
31900		}
31901	}
31902}
31903
31904if (!funcDefined('getCurrentPrice')) {
31905	var getCurrentPrice = function getCurrentPrice(price, currency, print_price) {
31906		var val = '';
31907		var format_value = BX.Currency.currencyFormat(price, currency);
31908		if (print_price.indexOf(format_value) >= 0) {
31909			val = print_price.replace(format_value, '<span class="price_value">' + format_value + '</span><span class="price_currency">');
31910			val += '</span>';
31911		}
31912		else {
31913			val = print_price;
31914		}
31915
31916		return val;
31917	}
31918}
31919
31920if (!funcDefined('initAnimateLoad')) {
31921	var initAnimateLoad = function initAnimateLoad() {
31922		$('.animate-load').click(function () {
31923			if (!jQuery.browser.mobile) {
31924				$(this).parent().addClass('loadings');
31925			}
31926		})
31927	}
31928}
31929
31930$(document).ready(function () {
31931	//check width for menu and search
31932	CheckSearchWidth();
31933	MegaMenuFixed();
31934	InitScrollBar();
31935
31936
31937	/*ripple effect for buttons*/
31938	/*$.ripple(".btn", {
31939		debug: false, // Turn Ripple.js logging on/off
31940		on: 'mouseenter', // The event to trigger a ripple effect
31941
31942		opacity: 0.4, // The opacity of the ripple
31943		color: "auto", // Set the background color. If set to "auto", it will use the text color
31944		multi: true, // Allow multiple ripples per element
31945
31946		duration: 0.6, // The duration of the ripple
31947
31948		easing: 'linear' // The CSS3 easing function of the ripple
31949	});*/
31950	/**/
31951
31952	//ecommerce order
31953	if (arAsproOptions["PAGES"]["ORDER_PAGE"]) {
31954		var arUrl = parseUrlQuery();
31955		if ("ORDER_ID" in arUrl) {
31956			var _id = arUrl["ORDER_ID"];
31957			if (arAsproOptions['COUNTERS']['USE_FULLORDER_GOALS'] !== 'N') {
31958				var eventdata = { goal: 'goal_order_success', result: _id };
31959				BX.onCustomEvent('onCounterGoals', [eventdata])
31960			}
31961			if (checkCounters()) {
31962				if (typeof localStorage !== 'undefined') {
31963					var val = localStorage.getItem('gtm_e_' + _id),
31964						d = '';
31965					try {
31966						d = JSON.parse(val);
31967					}
31968					catch (e) {
31969						d = val
31970					}
31971					if (typeof d === 'object') {
31972						window.dataLayer = window.dataLayer || [];
31973						dataLayer.push({ "event": arAsproOptions["COUNTERS"]['GOOGLE_EVENTS']['PURCHASE'], "ecommerce": d });
31974					}
31975
31976					if (typeof localStorage !== 'undefined') {
31977						localStorage.removeItem('gtm_e_' + _id);
31978					}
31979				}
31980			}
31981		}
31982	}
31983	var bSafary = false;
31984	if (typeof jQuery.browser == 'object')
31985		bSafary = jQuery.browser.safari;
31986	else if (typeof browser == 'object')
31987		bSafary = browser.safari;
31988	if (!bSafary) {
31989		CheckTopMenuPadding();
31990		CheckTopMenuOncePadding();
31991		CheckTopMenuDotted();
31992		CheckHeaderFixed();
31993		checkMenuLines();
31994		setTimeout(function () { $(window).resize(); }, 150); // need to check resize flexslider & menu
31995		setTimeout(function () { $(window).scroll(); }, 250); // need to check position fixed ask block
31996	}
31997	else {
31998		setTimeout(function () {
31999			$(window).resize(); // need to check resize flexslider & menu
32000			setTimeout(function () {
32001				CheckTopMenuPadding();
32002				CheckTopMenuOncePadding();
32003				CheckTopMenuDotted();
32004				CheckHeaderFixed();
32005				checkMenuLines();
32006
32007				setTimeout(function () {
32008					$(window).scroll();
32009				}, 50);
32010			}, 50);
32011		}, 350);
32012	}
32013
32014
32015	/*for filter scrol in mobile*/
32016	/*if(window.matchMedia('(min-width: 768px)').matches){
32017		$('.bx_filter .scrollbar').removeClass('mobile-scroll');
32018		$('.bx_filter .srollbar-custom').removeClass('mobile-scroll');
32019		$('.bx_filter .bx_filter_section form .bx_filter_parameters').removeClass('mobile-scroll');
32020		InitScrollBar();
32021		InitCustomScrollBar();
32022
32023	}*/
32024
32025	if (window.matchMedia('(max-width: 767px)').matches) {
32026		$('.bx_filter .scrollbar').addClass('mobile-scroll');
32027		$('.bx_filter .srollbar-custom').addClass('mobile-scroll');
32028		$('.bx_filter .bx_filter_section form .bx_filter_parameters').addClass('mobile-scroll');
32029		if ($('.bx_filter .mobile-scroll.scrollbar').length)
32030			$('.bx_filter .mobile-scroll.scrollbar').mCustomScrollbar("destroy");
32031		if ($('.bx_filter .mobile-scroll.srollbar-custom').length)
32032			$('.bx_filter .mobile-scroll.srollbar-custom').mCustomScrollbar("destroy");
32033	}
32034	/**/
32035
32036
32037	if (arAsproOptions['THEME']['USE_DEBUG_GOALS'] === 'Y')
32038		$.cookie('_ym_debug', 1, { path: '/', });
32039	else
32040		$.cookie('_ym_debug', null, { path: '/', });
32041
32042	/* change type2 menu for fixed */
32043	if ($('#headerfixed .js-nav').length) {
32044		if (arAsproOptions['THEME']['HEADER_FIXED'] == 2)
32045			CheckHeaderFixedMenu();
32046
32047		setTimeout(function () {
32048			$('#headerfixed .js-nav').addClass('opacity1');
32049		}, 350);
32050	}
32051
32052	// -- scroll after apply option
32053	if ($('.instagram_ajax').length) {
32054		BX.addCustomEvent('onCompleteAction', function (eventdata) {
32055			if (eventdata.action === 'instagrammLoaded')
32056				scrollPreviewBlock();
32057		});
32058	}
32059	else
32060		scrollPreviewBlock();
32061
32062
32063	scrollToTop();
32064	checkVerticalMobileFilter();
32065
32066	$.extend($.validator.messages, {
32067		required: BX.message('JS_REQUIRED'),
32068		email: BX.message('JS_FORMAT'),
32069		equalTo: BX.message('JS_PASSWORD_COPY'),
32070		minlength: BX.message('JS_PASSWORD_LENGTH'),
32071		remote: BX.message('JS_ERROR')
32072	});
32073
32074	$.validator.addMethod(
32075		'regexp', function (value, element, regexp) {
32076			var re = new RegExp(regexp);
32077			return this.optional(element) || re.test(value);
32078		},
32079		BX.message('JS_FORMAT')
32080	);
32081
32082	$.validator.addMethod(
32083		'filesize', function (value, element, param) {
32084			return this.optional(element) || (element.files[0].size <= param)
32085		},
32086		BX.message('JS_FILE_SIZE')
32087	);
32088
32089	$.validator.addMethod(
32090		'date', function (value, element, param) {
32091			var status = false;
32092			if (!value || value.length <= 0) {
32093				status = false;
32094			}
32095			else {
32096				// html5 date allways yyyy-mm-dd
32097				var re = new RegExp('^([0-9]{4})(.)([0-9]{2})(.)([0-9]{2})$');
32098				var matches = re.exec(value);
32099				if (matches) {
32100					var composedDate = new Date(matches[1], (matches[3] - 1), matches[5]);
32101					status = ((composedDate.getMonth() == (matches[3] - 1)) && (composedDate.getDate() == matches[5]) && (composedDate.getFullYear() == matches[1]));
32102				}
32103				else {
32104					// firefox
32105					var re = new RegExp('^([0-9]{2})(.)([0-9]{2})(.)([0-9]{4})$');
32106					var matches = re.exec(value);
32107					if (matches) {
32108						var composedDate = new Date(matches[5], (matches[3] - 1), matches[1]);
32109						status = ((composedDate.getMonth() == (matches[3] - 1)) && (composedDate.getDate() == matches[1]) && (composedDate.getFullYear() == matches[5]));
32110					}
32111				}
32112			}
32113			return status;
32114		}, BX.message('JS_DATE')
32115	);
32116
32117	$.validator.addMethod(
32118		'extension', function (value, element, param) {
32119			param = typeof param === 'string' ? param.replace(/,/g, '|') : 'png|jpe?g|gif';
32120			return this.optional(element) || value.match(new RegExp('.(' + param + ')$', 'i'));
32121		}, BX.message('JS_FILE_EXT')
32122	);
32123
32124	$.validator.addMethod(
32125		'captcha', function (value, element, params) {
32126			return $.validator.methods.remote.call(this, value, element, {
32127				url: arAsproOptions['SITE_DIR'] + 'ajax/check-captcha.php',
32128				type: 'post',
32129				data: {
32130					captcha_word: value,
32131					captcha_sid: function () {
32132						return $(element).closest('form').find('input[name="captcha_sid"]').val();
32133					}
32134				}
32135			});
32136		},
32137		BX.message('JS_ERROR')
32138	);
32139
32140	$.validator.addMethod(
32141		'recaptcha', function (value, element, param) {
32142			var id = $(element).closest('form').find('.g-recaptcha').attr('data-widgetid');
32143			if (typeof id !== 'undefined') {
32144				return grecaptcha.getResponse(id) != '';
32145			}
32146			else {
32147				return true;
32148			}
32149		}, BX.message('JS_RECAPTCHA_ERROR')
32150	);
32151
32152	$.validator.addClassRules({
32153		'phone': {
32154			regexp: arAsproOptions['THEME']['VALIDATE_PHONE_MASK']
32155		},
32156		'confirm_password': {
32157			equalTo: 'input[name="REGISTER\[PASSWORD\]"]',
32158			minlength: 6
32159		},
32160		'password': {
32161			minlength: 6
32162		},
32163		'inputfile': {
32164			extension: arAsproOptions['THEME']['VALIDATE_FILE_EXT'],
32165			filesize: 5000000
32166		},
32167		'captcha': {
32168			captcha: ''
32169		},
32170		'recaptcha': {
32171			recaptcha: ''
32172		}
32173	});
32174
32175	if (arAsproOptions['THEME']['PHONE_MASK']) {
32176		$('input.phone').inputmask('mask', { 'mask': arAsproOptions['THEME']['PHONE_MASK'] });
32177	}
32178
32179	// init calculate delivery with preview
32180	initCalculatePreview();
32181
32182	/*city*/
32183	$('select.region').on('change', function () {
32184		var val = parseInt($(this).val());
32185		if ($('select.city').length) {
32186			if (val) {
32187				$('select.city option').hide();
32188				$('select.city option').prop('disabled', 'disabled');
32189				$('select.city option[data-parent_section=' + val + ']').prop('disabled', '');
32190				$('select.city option:eq(0)').prop('disabled', '');
32191				$('select.city').ikSelect('reset');
32192				$('select.city option[data-parent_section=' + val + ']').show();
32193			}
32194			else
32195				$('select.city option').prop('disabled', 'disabled');
32196			$('select.city option:eq(0)').prop('disabled', '');
32197			$('select.city').ikSelect('reset');
32198		}
32199	})
32200
32201	$('select.city, select.region').on('change', function () {
32202		var _this = $(this),
32203			val = parseInt(_this.val());
32204		if (_this.hasClass('region')) {
32205			$('select.city option:eq(0)').show();
32206			$('select.city').val(0);
32207		}
32208
32209		if ((_this.hasClass('region') && !val) || _this.hasClass('city')) {
32210			$.ajax({
32211				type: 'POST',
32212				data: { ID: val },
32213			}).success(function (html) {
32214				var ob = BX.processHTML(html);
32215				$('.ajax_items')[0].innerHTML = ob.HTML;
32216				BX.ajax.processScripts(ob.SCRIPT);
32217			})
32218		}
32219	})
32220
32221	$(document).on('mouseenter', '.section-gallery-wrapper .section-gallery-wrapper__item', function () {
32222		$(this).siblings().removeClass('_active');
32223		$(this).addClass('_active');
32224	})
32225
32226	$('.mobile_regions .city_item').on('click', function (e) {
32227		e.preventDefault();
32228		var _this = $(this);
32229		$.removeCookie('current_region');
32230		$.cookie('current_region', _this.data('id'), { path: '/', domain: arAsproOptions['SITE_ADDRESS'] });
32231		location.href = _this.attr('href');
32232	})
32233
32234	/* toggle */
32235	var $this = this,
32236		previewParClosedHeight = 25;
32237
32238	$('section.toggle >
32238 label').prepend($('<i />').addClass('fa fa-plus'));
32239	$('section.toggle > label').prepend($('<i />').addClass('fa fa-minus'));
32240	$('section.toggle.active > p').addClass('preview-active');
32241	$('section.toggle.active > div.toggle-content').slideDown(350, function () { });
32242
32243	$('section.toggle > label').click(function (e) {
32244		var parentSection = $(this).parent(),
32245			parentWrapper = $(this).parents('div.toogle'),
32246			previewPar = false,
32247			isAccordion = parentWrapper.hasClass('toogle-accordion');
32248
32249		if (isAccordion && typeof (e.originalEvent) != 'undefined') {
32250			parentWrapper.find('section.toggle.active > label').trigger('click');
32251		}
32252
32253		parentSection.toggleClass('active');
32254
32255		// Preview Paragraph
32256		if (parentSection.find('> p').get(0)) {
32257			previewPar = parentSection.find('> p');
32258			var previewParCurrentHeight = previewPar.css('height');
32259			previewPar.css('height', 'auto');
32260			var previewParAnimateHeight = previewPar.css('height');
32261			previewPar.css('height', previewParCurrentHeight);
32262		}
32263
32264		// Content
32265		var toggleContent = parentSection.find('> div.toggle-content');
32266
32267		if (parentSection.hasClass('active')) {
32268			$(previewPar).animate({
32269				height: previewParAnimateHeight
32270			}, 350, function () {
32271				$(this).addClass('preview-active');
32272			});
32273			toggleContent.slideDown(350, function () { });
32274		}
32275		else {
32276			$(previewPar).animate({
32277				height: previewParClosedHeight
32278			}, 350, function () {
32279				$(this).removeClass('preview-active');
32280			});
32281			toggleContent.slideUp(350, function () { });
32282		}
32283	});
32284
32285	$('.tables-responsive .responsive').footable(); //responsive table
32286
32287	$('a[rel=tooltip]').tooltip();
32288	$('span[data-toggle=tooltip]').tooltip();
32289
32290	$('.toggle .more_items').on('click', function () {
32291		$(this).closest('.toggle').find('.collapsed').css('display', 'inline-block').removeClass('collapsed');
32292		$(this).remove();
32293		if (typeof $(this).data('resize') !== 'undefined' && $(this).data('resize'))
32294			$(window).resize();
32295	})
32296	$('.toggle_menu .more_items').on('click', function () {
32297		$(this).closest('.toggle_menu').find('.collapsed').addClass('clicked_exp');
32298		$(this).remove();
32299	})
32300
32301	/* search sync */
32302	$(document).on('keyup', '.search-input-div input', function (e) {
32303		var inputValue = $(this).val();
32304		$('.search-input-div input:not(:focus').val(inputValue);
32305
32306		if ($(this).closest('#headerfixed').length) {
32307			if (e.keyCode == 13)
32308				$('.search form').submit();
32309		}
32310	});
32311	$(document).on('click', '.search-button-div button', function (e) {
32312		if ($(this).closest('#headerfixed').length)
32313			$('.search form').submit();
32314	});
32315
32316	$('.inline-search-show, .inline-search-hide').on('click', function (e) {
32317		CloseMobilePhone();
32318		// if(window.matchMedia('(min-width: 600px)').matches)
32319		// {
32320		if (typeof ($(this).data('type_search')) != 'undefined' && $(this).data('type_search') == 'fixed')
32321			$('.inline-search-block').addClass('fixed');
32322
32323		if (arAsproOptions['THEME']['TYPE_SEARCH'] == 'fixed') {
32324			/*setTimeout(function(){
32325				$('.inline-search-block.fixed.big .search-input').focus();
32326			}, 200);*/
32327			$('.inline-search-block.fixed.big .search-input').focus();
32328		}
32329		if (arAsproOptions['THEME']['TYPE_SEARCH'] != 'fixed') {
32330			$('#title-search-input').focus();
32331		}
32332
32333		$('.inline-search-block').toggleClass('show');
32334		if ($('.top-block').length) {
32335			if ($('.inline-search-block').hasClass('show'))
32336				$('.inline-search-block').css('background', $('.top-block').css('background-color'));
32337			else
32338				$('.inline-search-block').css('background', '#fff');
32339		}
32340		if (arAsproOptions['THEME']['TYPE_SEARCH'] == 'fixed') {
32341			if ($('.inline-search-block').hasClass('show'))
32342				$('<div class="jqmOverlay search"></div>').appendTo('body');
32343			else {
32344				$('#title-search-input').blur();
32345				$('.jqmOverlay').detach();
32346			}
32347		}
32348		// }
32349		// else
32350		// 	location.href = arAsproOptions['PAGES']['CATALOG_PAGE_URL']+'?q';
32351	})
32352
32353	/* close search block */
32354	$("html, body").on('mousedown', function (e) {
32355		if (typeof e.target.className == 'string' && e.target.className.indexOf('adm') < 0) {
32356			e.stopPropagation();
32357			var search_target = $(e.target).closest('.title-search-result');
32358			if (!$(e.target).hasClass('inline-search-block') && !$(e.target).hasClass('svg') && !search_target.length) {
32359				$('.inline-search-block').removeClass('show');
32360				$('.title-search-result').hide();
32361				if (arAsproOptions['THEME']['TYPE_SEARCH'] == 'fixed')
32362					$('.jqmOverlay.search').detach();
32363			}
32364
32365			if ($("#mobilePhone").length) {
32366				CloseMobilePhone();
32367			}
32368
32369			if ($('#basket_line .basket_fly').length && parseInt($("#basket_line .basket_fly").css("right")) >= 0) {
32370				if (!$(e.target).closest('.basket_wrapp').length) {
32371					$("#basket_line .basket_fly").stop().animate({ "right": -$("#basket_line .basket_fly").outerWidth() }, 150);
32372					$("#basket_line .basket_fly .opener > div").removeClass("cur");
32373					$('#basket_line .basket_fly').removeClass('swiped');
32374				}
32375			}
32376
32377			if (isMobile) {
32378				if (search_target.length)
32379					location.href = search_target.attr('href');
32380			}
32381
32382			if (!$(e.target).closest('.js-info-block').length && !$(e.target).closest('.js-show-info-block').length) {
32383				$('.js-show-info-block').removeClass('opened');
32384				$('.js-info-block').fadeOut();
32385			}
32386
32387			var class_name = $(e.target).attr('class');
32388			if (typeof (class_name) == 'undefined' || class_name.indexOf('tooltip') < 0) //tooltip link
32389				$('.tooltip-link').tooltip('hide');
32390		}
32391	});
32392	$('.inline-search-block').find('*').on('mousedown', function (e) {
32393		e.stopPropagation();
32394	});
32395
32396	initAnimateLoad();
32397
32398	/*check all opt table items*/
32399	$(document).on('change', "input#select_all_items", function () {
32400		var _this = $(this);
32401
32402		var notOfferCount = $('.table-view__item:not([data-product_type=3])').find('.button_block .to-cart').length;
32403		var wishCount = $('.table-view__item:not([data-product_type=3])').find('.item-icons .wish_item_button .wish_item.to').length;
32404		var allGoodsCount = $('.table-view__item').length;
32405
32406		if (_this.is(':checked')) {
32407			//$('.opt_action').removeClass('no-action');
32408
32409			//buy && wish
32410			if (notOfferCount != 0) {
32411				$('.opt_action:not([data-action=compare])').removeClass('no-action');
32412			}
32413
32414			//compare
32415			$('.opt_action[data-action=compare]').removeClass('no-action');
32416
32417
32418			$('.opt_action').addClass('animate-load');
32419			$('.opt_action .text').remove();
32420			//$('<div class="text muted">(<span>'+$('.table-view__item').length+'</span>)</div>').appendTo($('.opt_action'));
32421			//$('<div class="text muted">(<span>' + $('.table-view__item:not([data-product_type=3])').length + '</span>)</div>').appendTo($('.opt_action'));
32422
32423			//buy
32424			$('<div class="text muted">(<span>' + notOfferCount + '</span>)</div>').appendTo($('.opt_action[data-action=buy]'));
32425
32426			//wish
32427			$('<div class="text muted">(<span>' + wishCount + '</span>)</div>').appendTo($('.opt_action[data-action=wish]'));
32428
32429			//compare
32430			$('<div class="text muted">(<span>' + allGoodsCount + '</span>)</div>').appendTo($('.opt_action[data-action=compare]'));
32431
32432
32433			$('input[name="chec_item"]').prop('checked', 'checked');
32434		}
32435		else {
32436			$('.opt_action').addClass('no-action');
32437			$('.opt_action').removeClass('animate-load');
32438			$('.opt_action .text').remove();
32439
32440			$('input[name="chec_item"]').removeAttr('checked');
32441		}
32442	})
32443
32444	/*check opt table item*/
32445	$(document).on('change', "input[name='chec_item']", function () {
32446		var _this = $(this);
32447
32448		var canBuy = _this.closest('.table-view__item').find('.button_block .to-cart').length;
32449		var isOffer = _this.closest('.main_item_wrapper').attr('data-product_type') == '3';
32450		//console.log(isOffer);
32451
32452		if (_this.is(':checked')) {
32453			$('.opt_action').each(function () {
32454				var _this = $(this);
32455
32456				var isBuyAction = _this.attr('data-action') == 'buy';
32457				var isWishAction = _this.attr('data-action') == 'wish';
32458
32459				if (isOffer && (isBuyAction || isWishAction)) {
32460					return true;
32461				}
32462
32463				if (isBuyAction && !canBuy) {
32464					return true;
32465				}
32466
32467				if (_this.find('.text').length) {
32468					var count = parseInt(_this.find('.text span').text());
32469					_this.find('.text span').text(++count);
32470				}
32471				else {
32472					_this.removeClass('no-action');
32473					_this.addClass('animate-load');
32474					$('<div class="text muted">(<span>1</span>)</div>').appendTo(_this);
32475				}
32476			})
32477		}
32478		else {
32479			$('.opt_action').each(function () {
32480				var _this = $(this);
32481
32482				var isBuyAction = _this.attr('data-action') == 'buy';
32483				var isWishAction = _this.attr('data-action') == 'wish';
32484
32485				if (isOffer && (isBuyAction || isWishAction)) {
32486					return true;
32487				}
32488
32489				if (isBuyAction && !canBuy) {
32490					return true;
32491				}
32492
32493				if (_this.find('.text').length) {
32494					var count = parseInt(_this.find('.text span').text());
32495					--count
32496					_this.find('.text span').text(count);
32497
32498					if (!count) {
32499						_this.addClass('no-action');
32500						_this.removeClass('animate-load');
32501						_this.find('.text').remove();
32502					}
32503				}
32504			})
32505		}
32506	})
32507
32508	/*buy|wish|compare opt table items*/
32509	$(document).on('click', ".opt_action", function () {
32510		var _this = $(this),
32511			action = _this.data('action'),
32512			basketParams = {
32513				type: 'multiple',
32514				iblock_id: _this.data('iblock_id'),
32515				action: action,
32516				items: {}
32517			};
32518
32519		if (!_this.hasClass('no-action')) {
32520			$('.opt_action').addClass('no-action');
32521			_this.removeClass('no-action');
32522
32523			$('.table-view__item').each(function () {
32524				var _this = $(this);
32525				var canBuy = _this.find('.button_block .to-cart').length; //console.log(basketParams);
32526				var add = _this.find('input[name="chec_item"]').is(':checked') && (canBuy || (action != "buy"));
32527				if (add) {
32528					basketParams['items'][_this.data('id')] = {};
32529					basketParams['items'][_this.data('id')]['id'] = _this.data('id');
32530					basketParams['items'][_this.data('id')]['product_type'] = _this.data('product_type');
32531					basketParams['items'][_this.data('id')]['quantity'] = _this.find('input[name="quantity"]').val();
32532				}
32533			})
32534			$.ajax({
32535				type: "POST",
32536				url: arAsproOptions['SITE_DIR'] + "ajax/item.php",
32537				data: basketParams,
32538				dataType: "json",
32539				success: function (data) {
32540					if ("STATUS" in data) {
32541						if (data.STATUS !== 'OK') {
32542							showBasketError(BX.message(data.MESSAGE) + ' <br/>' + data.MESSAGE_EXT);
32543						}
32544						if ($('.header-cart.fly').length) {
32545							arBasketAsproCounters.DEFAULT = true;
32546							SetActualBasketFlyCounters(true);
32547						}
32548						else {
32549							if ($("#ajax_basket").length)
32550								reloadTopBasket('add', $('#ajax_basket'), 200, 5000, 'N', '', true);
32551							else
32552								reloadBasketCounters('', true);
32553						}
32554					}
32555					_this.parent().removeClass('loadings');
32556					$('.opt_action').removeClass('no-action');
32557				}
32558			})
32559		}
32560	})
32561
32562
32563
32564	//fix opt checked for back in browser
32565	setTimeout(function () {
32566		if ($('.with-opt-buy input[name="chec_item"], .with-opt-buy input[name="select_all_items"]').length) {
32567			$('.with-opt-buy input[name="chec_item"], .with-opt-buy input[name="select_all_items"]').prop('checked', false);
32568		}
32569	}, 1);
32570
32571
32572
32573	/*check mobile device*/
32574	if (isMobile) {
32575		$(document).on('click', '*[data-event="jqm"]', function (e) {
32576			e.preventDefault();
32577			e.stopPropagation();
32578			var _this = $(this);
32579			var name = _this.data('name');
32580
32581			if (window.matchMedia('(min-width:768px)').matches || (typeof _this.data('no-mobile') !== 'undefinde' && _this.data('no-mobile') == 'Y')) {
32582				if (!$(this).hasClass('clicked')) {
32583					$(this).addClass('clicked');
32584					$(this).jqmEx();
32585					$(this).trigger('click');
32586				}
32587				return false;
32588			}
32589			else if (name.length) {
32590				var script = arAsproOptions['SITE_DIR'] + 'form/';
32591				var paramsStr = ''; var arTriggerAttrs = {};
32592				$.each(_this.get(0).attributes, function (index, attr) {
32593					var attrName = attr.nodeName;
32594					var attrValue = _this.attr(attrName);
32595					arTriggerAttrs[attrName] = attrValue;
32596					if (/^data\-param\-(.+)$/.test(attrName)) {
32597						var key = attrName.match(/^data\-param\-(.+)$/)[1];
32598						paramsStr += key + '=' + attrValue + '&';
32599					}
32600				});
32601
32602				var triggerAttrs = JSON.stringify(arTriggerAttrs);
32603				var encTriggerAttrs = encodeURIComponent(triggerAttrs);
32604				script += '?name=' + name + '&' + paramsStr + 'data-trigger=' + encTriggerAttrs;
32605
32606				location.href = script;
32607			}
32608		});
32609
32610		$('.fancybox').removeClass('fancybox');
32611	}
32612	else {
32613		$(document).on('click', '*[data-event="jqm"]', function (e) {
32614			e.preventDefault();
32615			e.stopPropagation();
32616			if (!$(this).hasClass('clicked')) {
32617				$(this).addClass('clicked');
32618				$(this).jqmEx();
32619				$(this).trigger('click');
32620			}
32621			return false;
32622		});
32623	}
32624
32625	BX.addCustomEvent('onCompleteAction', function (eventdata, _this) {
32626		try {
32627			if (eventdata.action === 'loadForm') {
32628				$(_this).parent().removeClass('loadings');
32629				$(_this).removeClass('clicked');
32630
32631				if ($(_this).hasClass('one_click_buy_trigger')) {
32632					$('.wrapp_one_click > span').removeClass('clicked')
32633					$('.one_click').removeClass('clicked')
32634				}
32635				else if ($(_this).hasClass('one_click_buy_basket_trigger')) {
32636					$('.fast_order').removeClass('clicked')
32637				}
32638			}
32639			else if (eventdata.action === 'loadBasket') {
32640				$('.basket-link.basket').attr('title', arBasketPrices.BASKET_SUMM_TITLE);
32641				$('.basket-link.delay').attr('title', arBasketPrices.DELAY_SUMM_TITLE);
32642
32643				if (arBasketPrices.BASKET_COUNT > 0) {
32644					$('.basket-link.basket').addClass('basket-count');
32645					$('.basket-link.basket .count').removeClass('empted');
32646					if ($('.basket-link.basket .prices').length)
32647						$('.basket-link.basket .prices').html(arBasketPrices.BASKET_SUMM);
32648				}
32649				else {
32650					$('.basket-link.basket').removeClass('basket-count');
32651					$('.basket-link.basket .count').addClass('empted');
32652					if ($('.basket-link.basket .prices').length)
32653						$('.basket-link.basket .prices').html(arBasketPrices.BASKET_SUMM_TITLE_SMALL);
32654				}
32655				$('.basket-link.basket .count').text(arBasketPrices.BASKET_COUNT);
32656				if (arBasketPrices.DELAY_COUNT > 0) {
32657					$('.basket-link.delay').addClass('basket-count');
32658					$('.basket-link.delay .count').removeClass('empted');
32659				}
32660				else {
32661					$('.basket-link.delay').removeClass('basket-count');
32662					$('.basket-link.delay .count').addClass('empted');
32663				}
32664				$('.basket-link.delay .count').text(arBasketPrices.DELAY_COUNT);
32665			}
32666			else if (eventdata.action === 'loadActualBasketCompare') {
32667				var compare_count = Object.keys(arBasketAspro.COMPARE).length;
32668				if (compare_count > 0) {
32669					$('.basket-link.compare').addClass('basket-count');
32670					$('.basket-link.compare .count').removeClass('empted');
32671					if ($('#compare_fly').length)
32672						$('#compare_fly').removeClass('empty_block');
32673				}
32674				else {
32675					$('.basket-link.compare').removeClass('basket-count');
32676					$('.basket-link.compare .count').addClass('empted');
32677					if ($('#compare_fly').length)
32678						$('#compare_fly').addClass('empty_block');
32679				}
32680				$('.basket-link.compare .count').text(compare_count);
32681			}
32682			else if (eventdata.action === 'loadRSS') {
32683			}
32684			else if (eventdata.action === 'ajaxContentLoaded') {
32685			}
32686			else if (eventdata.action === 'jsLoadBlock') {
32687				initCountdown();
32688				setStatusButton();
32689				InitFlexSlider();
32690				InitOwlSlider();
32691				InitFancyBox();
32692
32693				checkLinkedArticles();
32694
32695				if (typeof window['stickySidebar'] !== 'undefined') {
32696					window['stickySidebar'].updateSticky();
32697				}
32698			}
32699		}
32700		catch (e) {
32701			console.error(e)
32702		}
32703	})
32704
32705	/*slices*/
32706	if ($('.banners-small .item.normal-block').length)
32707		$('.banners-small .item.normal-block').sliceHeight();
32708	if ($('.teasers .item').length)
32709		$('.teasers .item').sliceHeight();
32710	if ($('.wrap-portfolio-front .row.items > div').length)
32711		$('.wrap-portfolio-front .row.items > div').sliceHeight({ 'row': '.row.items', 'item': '.item1' });
32712
32713	/* bug fix in ff*/
32714	$('img').removeAttr('draggable');
32715
32716	clicked_tab = 0;
32717
32718	$('.title-tab-heading').on('click', function () {
32719		var container = $(this).parent(),
32720			slide_block = $(this).next(),
32721			bReviewTab = container.hasClass('media_review');
32722
32723		clicked_tab = container.index() + 1;
32724
32725		container.siblings().removeClass('active');
32726
32727		$('.nav.nav-tabs li').removeClass('active');
32728
32729		if (container.hasClass('active')) {
32730			if (bReviewTab) {
32731				$('#reviews_content').slideUp(200, function () {
32732					container.removeClass('active');
32733				});
32734			}
32735			else {
32736				slide_block.slideUp(200, function () {
32737					container.removeClass('active');
32738				});
32739			}
32740		}
32741		else {
32742			container.addClass('active');
32743			if (bReviewTab) {
32744				$('#reviews_content').slideDown();
32745			}
32746			else {
32747				if ($('.tabs_section + #reviews_content').length)
32748					$('.tabs_section + #reviews_content').slideUp();
32749				slide_block.slideDown();
32750				if (typeof container.attr('id') !== 'undefined' && container.attr('id') == 'descr') {
32751					var $gallery = $('.galerys-block');
32752					if ($gallery.length) {
32753						var bTypeBig = $gallery.find('.big_slider').length;
32754						var $slider = bTypeBig ? $gallery.find('.big_slider') : $gallery.find('.small_slider');
32755						InitFlexSlider();
32756						var interval = setInterval(function () {
32757							if ($slider.find('.slides .item').attr('style').indexOf('height') === -1) {
32758								$(window).resize();
32759							}
32760							else {
32761								clearInterval(interval);
32762							}
32763						}, 100);
32764					}
32765				}
32766			}
32767		}
32768	})
32769
32770	InitFlexSlider();
32771	InitOwlSlider();
32772	InitStickySideBar();
32773	InitFancyBox();
32774	InitFancyBoxVideo();
32775
32776	setTimeout(function () {
32777		InitTopestMenuGummi();
32778		isOnceInited = true;
32779	}, 50);
32780
32781	InitZoomPict();
32782
32783	// $('body').on( 'click', '.captcha_reload', function(e){
32784	$(document).on('click', '.captcha_reload', function (e) {
32785		var captcha = $(this).parents('.captcha-row');
32786		e.preventDefault();
32787		$.ajax({
32788			url: arAsproOptions['SITE_DIR'] + 'ajax/captcha.php'
32789		}).done(function (text) {
32790			captcha.find('input[name=captcha_sid]').val(text);
32791			captcha.find('img').attr('src', '/bitrix/tools/captcha.php?captcha_sid=' + text);
32792			captcha.find('input[name=captcha_word]').val('').removeClass('error');
32793			captcha.find('.captcha_input').removeClass('error').find('.error').remove();
32794		});
32795	});
32796
32797	/* show print */
32798	if (arAsproOptions["PAGES"]["BASKET_PAGE"]) {
32799		if (arAsproOptions["THEME"]["SHOW_BASKET_PRINT"] == "Y") {
32800			if ($('.page-top h1').length)
32801				$('<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'));
32802
32803		}
32804	}
32805	else {
32806		if (arAsproOptions['THEME']['PRINT_BUTTON'] == 'Y') {
32807			setTimeout(function () {
32808
32809				if ($('.period_wrapper.in-detail-news1 .period_wrapper_inner').length) {
32810					$('<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'));
32811				} else if ($('.page-top .topic .topic__heading').length) {
32812					$('<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'));
32813				}
32814
32815
32816			}, 150);
32817		}
32818	}
32819
32820	$(document).on('click', '.print-link', function () {
32821		window.print();
32822	})
32823
32824	$('.head-block .item-link').on('click', function () {
32825		var _this = $(this);
32826		_this.siblings().removeClass('active');
32827		_this.addClass('active');
32828	})
32829
32830	$('table.table').each(function () {
32831		var _this = $(this),
32832			first_td = _this.find('thead tr th');
32833		if (!first_td.length)
32834			first_td = _this.find('thead tr td');
32835		if (first_td.length) {
32836			var j = 0;
32837			_this.find('tbody tr td').each(function (i) {
32838				if (j > first_td.length - 1)
32839					j = 0;
32840				$('<div class="th-mobile">' + first_td[j].textContent + '</div>').appendTo($(this));
32841				j++;
32842			})
32843		}
32844	})
32845
32846	if (window.matchMedia('(min-width: 768px)').matches)
32847		$('.wrapper_middle_menu.wrap_menu').removeClass('mobile');
32848
32849
32850	if (window.matchMedia('(max-width: 767px)').matches)
32851		$('.wrapper_middle_menu.wrap_menu').addClass('mobile');
32852
32853
32854
32855	$('.menu_top_block .v_bottom a').on('click', function (e) {
32856		if ($(e.target).hasClass('toggle_block'))
32857			e.preventDefault();
32858	})
32859	$('.menu_top_block .v_bottom a .toggle_block').click(function (e) {
32860		var _this = $(this),
32861			menu = _this.closest('.has-child').find('> .dropdown'),
32862			bVisibleMeu = (menu.is(':visible')),
32863			animate = (bVisibleMeu ? 'slideUp' : 'slideDown');
32864
32865		if (!_this.hasClass('clicked')) {
32866			_this.addClass('clicked');
32867
32868
32869			menu.velocity('stop').velocity(animate, {
32870				duration: 150,
32871				// delay: 250,
32872				begin: function () {
32873					_this.toggleClass('closed');
32874				},
32875				complete: function () {
32876					_this.removeClass('clicked');
32877
32878					if (typeof window['stickySidebar'] !== 'undefined')
32879						window['stickySidebar'].updateSticky();
32880				}
32881			});
32882		}
32883
32884		$(this).closest('.has-child').toggleClass('opened');
32885	})
32886
32887	$(document).on('click', '.show_props', function () {
32888		$(this).prev().stop().slideToggle(333);
32889		$(this).find('.char_title').toggleClass('opened');
32890	});
32891
32892	$('.see_more').on('click', function (e) {
32893		e.preventDefault();
32894		var see_more = ($(this).is('.see_more') ? $(this) : $(this).parents('.see_more').first());
32895		var see_moreText = (see_more.find('> a').length ? see_more.find('> a') : see_more);
32896		var see_moreHiden = see_more.parent().find('> .d');
32897		if (see_more.hasClass('open')) {
32898			see_moreText.text(BX.message('CATALOG_VIEW_MORE'));
32899			see_more.removeClass('open');
32900			see_moreHiden.hide();
32901		}
32902		else {
32903			see_moreText.text(BX.message('CATALOG_VIEW_LESS'));
32904			see_more.addClass('open');
32905			see_moreHiden.show();
32906		}
32907		return false;
32908	});
32909
32910	$('.button.faq_button').click(function (e) {
32911		e.preventDefault();
32912		$(this).toggleClass('opened');
32913		$('.faq_ask .form').slideToggle();
32914	});
32915
32916	$('.staff.list .staff_section .staff_section_title a').click(function (e) {
32917		e.preventDefault();
32918		$(this).parents('.staff_section').toggleClass('opened');
32919		$(this).parents('.staff_section').find('.staff_section_items').stop().slideToggle(600);
32920		$(this).parents('.staff_section_title').find('.opener_icon').toggleClass('opened');
32921	});
32922
32923	$('.jobs_wrapp .item .name').click(function (e) {
32924		$(this).closest('.item').toggleClass('opened');
32925		$(this).closest('.item').find('.description_wrapp').stop().slideToggle(600);
32926		$(this).closest('.item').find('.opener_icon').toggleClass('opened');
32927	});
32928
32929	$('.faq.list .item .q a').on('click', function (e) {
32930		e.preventDefault();
32931		$(this).parents('.item').toggleClass('opened');
32932		$(this).parents('.item').find('.a').stop().slideToggle();
32933		$(this).parents('.item').find('.q .opener_icon').toggleClass('opened');
32934	});
32935
32936	$('.opener_icon').click(function (e) {
32937		e.preventDefault();
32938		$(this).parent().find('a').trigger('click');
32939	});
32940
32941	$('.dotdot').dotdotdot();
32942
32943	$('.more_block span').on('click', function () {
32944		var content_offset = $('.catalog_detail .tabs_section').offset();
32945		$('html, body').animate({ scrollTop: content_offset.top - 43 }, 400);
32946	});
32947
32948	$(document).on("click", ".counter_block:not(.basket) .plus", function () {
32949		if (!$(this).parents('.basket_wrapp').length) {
32950			if ($(this).parent().data("offers") != "Y") {
32951				var isDetailSKU2 = $(this).parents('.counter_block_wr').length;
32952				input = $(this).parents(".counter_block").find("input[type=text]")
32953				tmp_ratio = !isDetailSKU2 ? $(this).parents(".counter_wrapp").find(".to-cart").data('ratio') : $(this).parents('tr').first().find("td.buy .to-cart").data('ratio'),
32954					//console.log(!isDetailSKU2);
32955					isDblQuantity = !isDetailSKU2 ? $(this).parents(".counter_wrapp").find(".to-cart").data('float_ratio') : $(this).parents('tr').first().find("td.buy .to-cart").data('float_ratio'),
32956					ratio = (isDblQuantity ? parseFloat(tmp_ratio) : parseInt(tmp_ratio, 10)),
32957					max_value = '';
32958				currentValue = input.val();
32959
32960
32961				if (isDblQuantity)
32962					ratio = Math.round(ratio * arAsproOptions.JS_ITEM_CLICK.precisionFactor) / arAsproOptions.JS_ITEM_CLICK.precisionFactor;
32963
32964				curValue = (isDblQuantity ? parseFloat(currentValue) : parseInt(currentValue, 10));
32965
32966				curValue += ratio;
32967				if (isDblQuantity) {
32968					curValue = Math.round(curValue * arAsproOptions.JS_ITEM_CLICK.precisionFactor) / arAsproOptions.JS_ITEM_CLICK.precisionFactor;
32969				}
32970				if (parseFloat($(this).data('max')) > 0) {
32971					if (input.val() < $(this).data('max')) {
32972						if (curValue <= $(this).data('max'))
32973							input.val(curValue);
32974
32975						input.change();
32976					}
32977				} else {
32978					input.val(curValue);
32979					input.change();
32980				}
32981			}
32982		}
32983	});
32984	$(document).on("click", ".counter_block:not(.basket) .minus", function () {
32985		if (!$(this).parents('.basket_wrapp').length) {
32986			if ($(this).parent().data("offers") != "Y") {
32987				var isDetailSKU2 = $(this).parents('.counter_block_wr').length;
32988				input = $(this).parents(".counter_block").find("input[type=text]")
32989				tmp_ratio = !isDetailSKU2 ? $(this).parents(".counter_wrapp").find(".to-cart").data('ratio') : $(this).parents('tr').first().find("td.buy .to-cart").data('ratio'),
32990					isDblQuantity = !isDetailSKU2 ? $(this).parents(".counter_wrapp").find(".to-cart").data('float_ratio') : $(this).parents('tr').first().find("td.buy .to-cart").data('float_ratio'),
32991					ratio = (isDblQuantity ? parseFloat(tmp_ratio) : parseInt(tmp_ratio, 10)),
32992					max_value = '';
32993				currentValue = input.val();
32994
32995				if (isDblQuantity)
32996					ratio = Math.round(ratio * arAsproOptions.JS_ITEM_CLICK.precisionFactor) / arAsproOptions.JS_ITEM_CLICK.precisionFactor;
32997
32998				curValue = (isDblQuantity ? parseFloat(currentValue) : parseInt(currentValue, 10));
32999
33000				curValue -= ratio;
33001				if (isDblQuantity) {
33002					curValue = Math.round(curValue * arAsproOptions.JS_ITEM_CLICK.precisionFactor) / arAsproOptions.JS_ITEM_CLICK.precisionFactor;
33003				}
33004
33005				if (parseFloat($(this).parents(".counter_block").find(".plus").data('max')) > 0) {
33006					if (currentValue > ratio) {
33007						if (curValue < ratio) {
33008							input.val(ratio);
33009						} else {
33010							input.val(curValue);
33011						}
33012						input.change();
33013					}
33014				} else {
33015					if (curValue > ratio) {
33016						input.val(curValue);
33017					} else {
33018						if (ratio) {
33019							input.val(ratio);
33020						} else if (currentValue > 1) {
33021							input.val(curValue);
33022						}
33023					}
33024					input.change();
33025				}
33026			}
33027		}
33028	});
33029
33030	$('.counter_block input[type=text]').numeric({ allow: "." });
33031
33032	$(document).on("focus", ".counter_block input[type=text]", function (e) {
33033		$(this).addClass('focus');
33034	})
33035
33036	$(document).on("blur", ".counter_block input[type=text]", function (e) {
33037		$(this).removeClass('focus');
33038	})
33039
33040	var timerInitCalculateDelivery = false;
33041	$(document).on("change", ".counter_block input[type=text]", function (e) {
33042		if (!$(this).parents('.basket_wrapp').length) {
33043			var val = $(this).val(),
33044				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'),
33045				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'),
33046				ratio = (isDblQuantity ? parseFloat(tmp_ratio) : parseInt(tmp_ratio, 10)),
33047				diff = val % ratio;
33048
33049			if (isDblQuantity) {
33050				ratio = Math.round(ratio * arAsproOptions.JS_ITEM_CLICK.precisionFactor) / arAsproOptions.JS_ITEM_CLICK.precisionFactor;
33051				if (Math.round(diff * arAsproOptions.JS_ITEM_CLICK.precisionFactor) / arAsproOptions.JS_ITEM_CLICK.precisionFactor == ratio)
33052					diff = 0;
33053			}
33054
33055			if ($(this).hasClass('focus')) {
33056				intCount = Math.round(
33057					Math.round(val * arAsproOptions.JS_ITEM_CLICK.precisionFactor / ratio) / arAsproOptions.JS_ITEM_CLICK.precisionFactor
33058				) || 1;
33059				val = (intCount <= 1 ? ratio : intCount * ratio);
33060				// val -= diff;
33061				val = Math.round(val * arAsproOptions.JS_ITEM_CLICK.precisionFactor) / arAsproOptions.JS_ITEM_CLICK.precisionFactor;
33062			}
33063
33064			if (parseFloat($(this).parents(".counter_block").find(".plus").data('max')) > 0) {
33065				if (val > parseFloat($(this).parents(".counter_block").find(".plus").data('max'))) {
33066					val = parseFloat($(this).parents(".counter_block").find(".plus").data('max'));
33067					// val -= (val % ratio);
33068				}
33069			}
33070			if (val < ratio) {
33071				val = ratio;
33072			} else if (!parseFloat(val)) {
33073				val = 1;
33074			}
33075
33076			$(this).parents('.counter_block').parent().parent().find('.to-cart').attr('data-quantity', val);
33077			$(this).parents('.counter_block').parent().parent().parent().find('.one_click').attr('data-quantity', val);
33078			$(this).val(val);
33079
33080			var $calculate = $(this).closest('.item').length ? $(this).closest('.item').find('.calculate-delivery') : $(this).closest('.catalog_detail').find('.calculate-delivery');
33081			if ($calculate.length) {
33082				$calculate.each(function () {
33083					var $calculateSpan = $(this).find('span[data-event=jqm]').first();
33084
33085					if ($calculateSpan.length) {
33086						var $clone = $calculateSpan.clone();
33087						$clone.attr('data-param-quantity', val).removeClass('clicked');
33088						$clone.insertAfter($calculateSpan).on('click', function () {
33089							if (!jQuery.browser.mobile) {
33090								$(this).parent().addClass('loadings');
33091							}
33092						});
33093						$calculateSpan.remove();
33094					}
33095
33096					if ($(this).hasClass('with_preview')) {
33097						$(this).removeClass('inited');
33098
33099						if (timerInitCalculateDelivery) {
33100							clearTimeout(timerInitCalculateDelivery);
33101						}
33102
33103						timerInitCalculateDelivery = setTimeout(function () {
33104							initCalculatePreview();
33105							timerInitCalculateDelivery = false;
33106						}, 1000);
33107					}
33108				});
33109			}
33110
33111			var eventdata = { type: 'change', params: { id: $(this), value: val } };
33112			BX.onCustomEvent('onCounterProductAction', [eventdata]);
33113		}
33114	});
33115
33116	BX.addCustomEvent('onCounterProductAction', function (eventdata) {
33117		if (typeof eventdata != 'object') {
33118			eventdata = { type: 'undefined' };
33119		}
33120		try {
33121			if (typeof eventdata.type != 'undefined') {
33122				if (!eventdata.params.id.closest('.gifts').length) // no gift
33123				{
33124					var obProduct = eventdata.params.id.data('product');
33125
33126					if (eventdata.params.id.closest('.has_offer_prop').length) // type1 for offers in element list
33127					{
33128						if (typeof window['obSkuQuantys'] === 'undefined')
33129							window["obSkuQuantys"] = {};
33130
33131						// if(typeof window['obOffers'] === 'undefined')
33132						window["obSkuQuantys"][eventdata.params.id.closest('.offer_buy_block').find('.to-cart').data('item')] = eventdata.params.value;
33133					}
33134					if (typeof window[obProduct] == 'object') {
33135						if (obProduct == "obOffers")
33136							setPriceAction('', '', 'Y');
33137						else
33138							window[obProduct].setPriceAction('Y');
33139					}
33140					else if (eventdata.params.id.length) {
33141						if (eventdata.params.id.closest('.main_item_wrapper').length && arAsproOptions['THEME']['SHOW_TOTAL_SUMM'] == 'Y') {
33142							setPriceItem(eventdata.params.id.closest('.main_item_wrapper'), eventdata.params.value);
33143						}
33144					}
33145					BX.onCustomEvent('onCounterProductActionResize');
33146				}
33147			}
33148		}
33149		catch (e) {
33150			console.error(e)
33151		}
33152	});
33153
33154	/*show basket on hover */
33155	$(document).on('mouseenter', '.wrap_icon.top_basket, #headerfixed .basket-link.basket', function () {
33156
33157		var _this = $(this);
33158		var parent = _this.closest('header, #headerfixed');
33159		var hover_block = parent.find('.basket_hover_block');
33160
33161		if (!hover_block.hasClass('loaded')) {
33162			$.ajax({
33163				type: "POST",
33164				url: arAsproOptions['SITE_DIR'] + "ajax/showBasketHover.php",
33165				//data:fill_prop,
33166				//dataType:"json",
33167				success: function (html) {
33168					//$('.basket_error_frame').jqmHide();
33169					if (html) {
33170						hover_block.html(html);
33171						hover_block.addClass('loaded');
33172					} else {
33173						showBasketError(BX.message("CATALOG_PARTIAL_BASKET_PROPERTIES_ERROR"));
33174					}
33175				}
33176			});
33177		}
33178	});
33179
33180	/*show basket on click mobile */
33181	$(document).on('click', '.wrap_icon.wrap_basket.top_basket, #headerfixed .basket-link.basket', function (e) {
33182		var _this = $(this);
33183		if (isMobile) {
33184			if (!_this.hasClass('clicked')) {
33185				e.preventDefault();
33186				_this.addClass('clicked');
33187				setTimeout(function () {
33188					_this.removeClass('clicked');
33189				}, 3000);
33190			}
33191		}
33192	});
33193
33194	/*slide cart*/
33195	$(document).on('mouseenter', '#basket_line .basket_normal:not(.empty_cart):not(.bcart) .basket_block ', function () {
33196		$(this).closest('.basket_normal').find('.popup').addClass('block');
33197		$(this).closest('.basket_normal').find('.basket_popup_wrapp').stop(true, true).slideDown(150);
33198	});
33199	$(document).on('mouseleave', '#basket_line .basket_normal .basket_block ', function () {
33200		var th = $(this);
33201		$(this).closest('.basket_normal').find('.basket_popup_wrapp').stop(true, true).slide
33201Up(150, function () {
33202			th.closest('.basket_normal').find('.popup').removeClass('block');
33203		});
33204	});
33205
33206	$(document).on('click', '.popup_button_basket', function () {
33207		var th = $(".to-cart[data-item=" + $(this).data("item") + "]");
33208
33209		var val = th.attr('data-quantity');
33210
33211		if (!val) $val = 1;
33212
33213		var tmp_props = th.data("props"),
33214			props = '',
33215			part_props = '',
33216			add_props = 'N',
33217			fill_prop = {},
33218			iblockid = th.data('iblockid'),
33219			offer = th.data('offers'),
33220			rid = '',
33221			basket_props = '',
33222			item = th.attr('data-item');
33223
33224		if (offer != "Y") {
33225			offer = "N";
33226		} else {
33227			basket_props = th.closest('.prices_tab').find('.bx_sku_props input').val();
33228		}
33229		if (tmp_props) {
33230			props = tmp_props.split(";");
33231		}
33232		if (th.data("part_props")) {
33233			part_props = th.data("part_props");
33234		}
33235		if (th.data("add_props")) {
33236			add_props = th.data("add_props");
33237		}
33238		if ($('.rid_item').length) {
33239			rid = $('.rid_item').data('rid');
33240		} else if (th.data('rid')) {
33241			rid = th.data('rid');
33242		}
33243
33244		fill_prop = fillBasketPropsExt(th, 'prop', 'bx_ajax_text');
33245
33246		fill_prop.quantity = val;
33247		fill_prop.add_item = 'Y';
33248		fill_prop.rid = rid;
33249		fill_prop.offers = offer;
33250		fill_prop.iblockID = iblockid;
33251		fill_prop.part_props = part_props;
33252		fill_prop.add_props = add_props;
33253		fill_prop.props = JSON.stringify(props);
33254		fill_prop.item = item;
33255		fill_prop.basket_props = basket_props;
33256
33257		$.ajax({
33258			type: "POST",
33259			url: arAsproOptions['SITE_DIR'] + "ajax/item.php",
33260			data: fill_prop,
33261			dataType: "json",
33262			success: function (data) {
33263				$('.basket_error_frame').jqmHide();
33264				if ("STATUS" in data) {
33265					getActualBasket(fill_prop.iblockID);
33266					if (data.STATUS === 'OK') {
33267						th.hide();
33268						th.closest('.counter_wrapp').find('.counter_block_inner').hide();
33269						th.closest('.counter_wrapp').find('.counter_block').hide();
33270						th.parents('tr').find('.counter_block_wr .counter_block').hide();
33271						th.closest('.button_block').addClass('wide');
33272						th.parent().find('.in-cart').show();
33273
33274						addBasketCounter(item);
33275						//$('.wish_item[data-item='+item+']').removeClass("added");
33276						$('.wish_item[data-item=' + item + ']').find(".value").show();
33277						$('.wish_item[data-item=' + item + ']').find(".value.added").hide();
33278
33279						if ($("#ajax_basket").length)
33280							reloadTopBasket('add', $('#ajax_basket'), 200, 5000, 'Y');
33281
33282						if ($("#basket_line .basket_fly").length) {
33283							if (th.closest('.fast_view_frame').length || window.matchMedia('(max-width: 767px)').matches)
33284								basketFly('open', 'N');
33285							else
33286								basketFly('open');
33287						}
33288
33289					} else {
33290						showBasketError(BX.message(data.MESSAGE));
33291					}
33292				} else {
33293					showBasketError(BX.message("CATALOG_PARTIAL_BASKET_PROPERTIES_ERROR"));
33294				}
33295			}
33296		});
33297	})
33298
33299	$(document).on('click', '.to-cart:not(.read_more), .basket_item_add', function (e) {
33300		e.preventDefault();
33301		var th = $(this);
33302		if (!th.hasClass('clicked')) {
33303			th.addClass('clicked');
33304			var val = $(this).attr('data-quantity');
33305			var tmp_props = $(this).data("props"),
33306				props = '',
33307				part_props = '',
33308				add_props = 'N',
33309				fill_prop = {},
33310				iblockid = $(this).data('iblockid'),
33311				offer = $(this).data('offers'),
33312				rid = '',
33313				bBannerAction = false,
33314				basket_props = '',
33315				item = $(this).attr('data-item');
33316			if (th.closest('.but-cell').length) {
33317				if ($('.counter_block[data-item="' + item + '"]').length)
33318					val = $('.counter_block[data-item="' + item + '"] input').val();
33319			}
33320
33321			if (th.closest('.banner_buttons.with_actions').length) //banner action
33322			{
33323				var wrapper_btns = th.closest('.wraps_buttons');
33324				item = wrapper_btns.data('id');
33325				bBannerAction = true;
33326			}
33327
33328			if (!val)
33329				val = 1;
33330			if (offer != "Y") {
33331				offer = "N";
33332			} else {
33333				basket_props = $(this).closest('.prices_tab').find('.bx_sku_props input').val();
33334			}
33335			if (tmp_props) {
33336				props = tmp_props.split(";");
33337			}
33338			if ($(this).data("part_props")) {
33339				part_props = $(this).data("part_props");
33340			}
33341			if ($(this).data("add_props")) {
33342				add_props = $(this).data("add_props");
33343			}
33344			if ($('.rid_item').length) {
33345				rid = $('.rid_item').data('rid');
33346			} else if ($(this).data('rid')) {
33347				rid = $(this).data('rid');
33348			}
33349
33350			fill_prop = fillBasketPropsExt(th, 'prop', th.data('bakset_div'));
33351
33352			fill_prop.quantity = val;
33353			fill_prop.add_item = 'Y';
33354			fill_prop.rid = rid;
33355			fill_prop.offers = offer;
33356			fill_prop.iblockID = iblockid;
33357			fill_prop.part_props = part_props;
33358			fill_prop.add_props = add_props;
33359			fill_prop.props = JSON.stringify(props);
33360			fill_prop.item = item;
33361			fill_prop.basket_props = basket_props;
33362
33363			if (bBannerAction) {
33364
33365				if (th.hasClass('added')) {
33366					location.href = th.data('href');
33367					return false;
33368				}
33369				else {
33370					th.attr('title', th.data('title2'))
33371					th.toggleClass('added');
33372				}
33373
33374				if (wrapper_btns.find('.wish_item_add').length)
33375					wrapper_btns.find('.wish_item_add').removeClass('added');
33376			}
33377
33378			if (th.data("empty_props") == "N"/* && fill_prop.part_props != 'Y'*/) {
33379				var basket_popup_html = $("#" + th.data("bakset_div")).html();
33380				if (!basket_popup_html && th.closest('.item').find('.basket_props_block').length)
33381					basket_popup_html = th.closest('.item').find('.basket_props_block').html();
33382
33383				showBasketError(basket_popup_html, BX.message("ERROR_BASKET_PROP_TITLE"), "Y", th);
33384				BX.addCustomEvent('onCompleteAction', function (e) {
33385					if (!e.ignoreSelf) {
33386						var eventdata = { action: 'loadForm', ignoreSelf: true };
33387						BX.onCustomEvent('onCompleteAction', [eventdata, th[0]]);
33388					}
33389				});
33390
33391			} else {
33392				$.ajax({
33393					type: "POST",
33394					url: arAsproOptions['SITE_DIR'] + "ajax/item.php",
33395					data: fill_prop,
33396					dataType: "json",
33397					success: function (data) {
33398						getActualBasket(fill_prop.iblockID);
33399
33400						var eventdata = { action: 'loadForm' };
33401						BX.onCustomEvent('onCompleteAction', [eventdata, th[0]]);
33402						arStatusBasketAspro = {};
33403
33404						if (data !== null) {
33405							if ("STATUS" in data) {
33406								if (data.MESSAGE_EXT === null)
33407									data.MESSAGE_EXT = '';
33408								if (data.STATUS === 'OK') {
33409									// th.hide();
33410									$('.to-cart[data-item=' + item + ']').hide();
33411									$('.to-cart[data-item=' + item + ']').closest('.counter_wrapp').find('.counter_block_inner').hide();
33412									$('.to-cart[data-item=' + item + ']').closest('.counter_wrapp').find('.counter_block').hide();
33413									$('.to-cart[data-item=' + item + ']').parents('tr').find('.counter_block_wr .counter_block').hide();
33414									$('.to-cart[data-item=' + item + ']').closest('.button_block').addClass('wide');
33415									// th.parent().find('.in-cart').show();
33416									$('.in-cart[data-item=' + item + ']').show();
33417
33418									addBasketCounter(item);
33419									//$('.wish_item[data-item='+item+']').removeClass("added");
33420									$('.wish_item[data-item=' + item + ']').find(".value").show();
33421									$('.wish_item[data-item=' + item + ']').find(".value.added").hide();
33422									$('.wish_item.to[data-item=' + item + ']').show();
33423									$('.wish_item.in[data-item=' + item + ']').hide();
33424
33425									if ($("#ajax_basket").length)
33426										reloadTopBasket('add', $('#ajax_basket'), 200, 5000, 'Y');
33427
33428									if ($("#basket_line .basket_fly").length) {
33429										if (th.closest('.fast_view_frame').length || window.matchMedia('(max-width: 767px)').matches || $("#basket_line .basket_fly.loaded").length)
33430											basketFly('open', 'N');
33431										else
33432											basketFly('open');
33433									}
33434
33435									if ($(".top_basket").length) {
33436										basketTop('open');
33437									}
33438
33439								} else {
33440									showBasketError(BX.message(data.MESSAGE) + ' <br/>' + data.MESSAGE_EXT);
33441								}
33442							} else {
33443								showBasketError(BX.message("CATALOG_PARTIAL_BASKET_PROPERTIES_ERROR"));
33444							}
33445						} else {
33446							// th.hide();
33447							$('.to-cart[data-item=' + item + ']').hide();
33448							$('.to-cart[data-item=' + item + ']').closest('.counter_wrapp').find('.counter_block_inner').hide();
33449							$('.to-cart[data-item=' + item + ']').closest('.counter_wrapp').find('.counter_block').hide();
33450							$('.to-cart[data-item=' + item + ']').parents('tr').find('.counter_block_wr .counter_block').hide();
33451							$('.to-cart[data-item=' + item + ']').closest('.button_block').addClass('wide');
33452							// th.parent().find('.in-cart').show();
33453							$('.in-cart[data-item=' + item + ']').show();
33454
33455							addBasketCounter(item);
33456							//$('.wish_item[data-item='+item+']').removeClass("added");
33457							$('.wish_item[data-item=' + item + ']').find(".value").show();
33458							$('.wish_item[data-item=' + item + ']').find(".value.added").hide();
33459
33460							if ($("#ajax_basket").length)
33461								reloadTopBasket('add', $('#ajax_basket'), 200, 5000, 'Y');
33462
33463							if ($("#basket_line .basket_fly").length) {
33464								if (th.closest('.fast_view_frame').length || window.matchMedia('(max-width: 767px)').matches || $("#basket_line .basket_fly.loaded").length)
33465									basketFly('open', 'N');
33466								else
33467									basketFly('open');
33468							}
33469						}
33470					}
33471				});
33472			}
33473		}
33474
33475	})
33476
33477	$(document).on('click', '.to-subscribe', function (e) {
33478		e.preventDefault();
33479		var th = $(this);
33480		if (!th.hasClass('clicked')) {
33481			th.addClass('clicked');
33482			if ($(this).is('.auth')) {
33483				if ($(this).hasClass('nsubsc')) {
33484					$(this).jqmEx();
33485					$(this).trigger('click');
33486				}
33487				else {
33488					location.href = arAsproOptions['SITE_DIR'] + 'auth/?backurl=' + location.pathname;
33489				}
33490			}
33491			else {
33492				var item = $(this).attr('data-item'),
33493					iblockid = $(this).attr('data-iblockid');
33494				// $(this).hide();
33495				$('.to-subscribe[data-item=' + item + ']').hide();
33496				$('.to-subscribe[data-item=' + item + ']').parent().find('.in-subscribe').show();
33497				$.get(arAsproOptions['SITE_DIR'] + 'ajax/item.php?item=' + item + '&subscribe_item=Y',
33498					$.proxy(function (data) {
33499						arStatusBasketAspro = {};
33500						getActualBasket(iblockid);
33501					})
33502				);
33503				th.removeClass('clicked');
33504			}
33505		}
33506	})
33507
33508	$(document).on('click', '.in-subscribe', function (e) {
33509		e.preventDefault();
33510		var item = $(this).attr('data-item'),
33511			iblockid = $(this).attr('data-iblockid');;
33512		// $(this).hide();
33513		$('.in-subscribe[data-item=' + item + ']').hide();
33514		$('.in-subscribe[data-item=' + item + ']').parent().find('.to-subscribe').removeClass('clicked');
33515		$('.in-subscribe[data-item=' + item + ']').parent().find('.to-subscribe').show();
33516		$.get(arAsproOptions['SITE_DIR'] + 'ajax/item.php?item=' + item + '&subscribe_item=Y',
33517			$.proxy(function (data) {
33518				getActualBasket(iblockid);
33519				arStatusBasketAspro = {};
33520			})
33521		);
33522	})
33523
33524	$(document).on('click', '.wish_item, .wish_item_add', function (e) {
33525		e.preventDefault();
33526		var val = $(this).attr('data-quantity'),
33527			_this = $(this),
33528			offer = $(this).data('offers'),
33529			iblockid = $(this).data('iblock'),
33530			tmp_props = $(this).data("props"),
33531			props = '',
33532			bBannerAction = false,
33533			item = $(this).attr('data-item'),
33534			item2 = $(this).attr('data-item');
33535
33536		if (_this.closest('.banner_buttons.with_actions').length) //banner action
33537		{
33538			var wrapper_btns = _this.closest('.wraps_buttons');
33539			item = item2 = wrapper_btns.data('id');
33540			bBannerAction = true;
33541		}
33542
33543		if (!_this.hasClass('clicked')) {
33544			_this.addClass('clicked');
33545			if (!val) val = 1;
33546			if (offer != "Y") offer = "N";
33547			if (tmp_props) {
33548				props = tmp_props.split(";");
33549			}
33550			if (!$(this).hasClass('text')) {
33551				if ($(this).hasClass('added')) {
33552					if (!bBannerAction) {
33553						$(this).hide();
33554						$(this).closest('.wish_item_button').find('.to').show();
33555					}
33556					$('.like_icons').each(function () {
33557						if ($(this).find('.wish_item.text[data-item="' + item + '"]').length) {
33558							$(this).find('.wish_item.text[data-item="' + item + '"]').removeClass('added');
33559							$(this).find('.wish_item.text[data-item="' + item + '"]').find('.value').show();
33560							$(this).find('.wish_item.text[data-item="' + item + '"]').find('.value.added').hide();
33561						}
33562						if ($(this).find('.wish_item_button').length) {
33563							/*$(this).find('.wish_item_button').find('.wish_item[data-item="'+item+'"]').removeClass('added');
33564							$(this).find('.wish_item_button').find('.wish_item[data-item="'+item+'"]').find('.value').show();
33565							$(this).find('.wish_item_button').find('.wish_item[data-item="'+item+'"]').find('.value.added').hide();*/
33566							$(this).find('.wish_item_button').find('.wish_item[data-item="' + item + '"].to').show();
33567							$(this).find('.wish_item_button').find('.wish_item[data-item="' + item + '"].in').hide();
33568						}
33569					})
33570				}
33571				else {
33572					if (!bBannerAction) {
33573						$(this).hide();
33574						$(this).closest('.wish_item_button').find('.in').addClass('added').show();
33575					}
33576
33577					$('.like_icons').each(function () {
33578						if ($(this).find('.wish_item.text[data-item="' + item + '"]').length) {
33579							$(this).find('.wish_item.text[data-item="' + item + '"]').addClass('added');
33580							$(this).find('.wish_item.text[data-item="' + item + '"]').find('.value').hide();
33581							$(this).find('.wish_item.text[data-item="' + item + '"]').find('.value.added').css({ "display": "block" })
33582						}
33583						if ($(this).find('.wish_item_button').length) {
33584							/*$(this).find('.wish_item_button').find('.wish_item[data-item="'+item+'"]').addClass('added');
33585							$(this).find('.wish_item_button').find('.wish_item[data-item="'+item+'"]').find('.value').hide();
33586							$(this).find('.wish_item_button').find('.wish_item[data-item="'+item+'"]').find('.value.added').show();*/
33587							$(this).find('.wish_item_button').find('.wish_item[data-item="' + item + '"].to').hide();
33588							$(this).find('.wish_item_button').find('.wish_item[data-item="' + item + '"].in').show();
33589						}
33590					})
33591				}
33592			} else {
33593				if (!$(this).hasClass('added')) {
33594					$('.wish_item[data-item=' + item + ']').addClass('added');
33595					$('.wish_item[data-item=' + item + ']').find('.value').hide();
33596					$('.wish_item[data-item=' + item + ']').find('.value.added').css('display', 'block');
33597
33598					$('.wish_item.to[data-item=' + item + ']').hide();
33599					$('.wish_item.in[data-item=' + item + ']').show();
33600
33601
33602					$('.like_icons').each(function () {
33603						if ($(this).find('.wish_item_button').length) {
33604							$(this).find('.wish_item_button').find('.wish_item[data-item="' + item + '"]').addClass('added');
33605							$(this).find('.wish_item_button').find('.wish_item[data-item="' + item + '"]').find('.value').hide();
33606							$(this).find('.wish_item_button').find('.wish_item[data-item="' + item + '"]').find('.value.added').show();
33607						}
33608					})
33609				} else {
33610					$('.wish_item[data-item=' + item + ']').removeClass('added');
33611					$('.wish_item[data-item=' + item + ']').find('.value').show();
33612					$('.wish_item[data-item=' + item + ']').find('.value.added').hide();
33613
33614					$('.wish_item.to[data-item=' + item + ']').show();
33615					$('.wish_item.in[data-item=' + item + ']').hide();
33616
33617					$('.like_icons').each(function () {
33618						if ($(this).find('.wish_item_button').length) {
33619							$(this).find('.wish_item_button').find('.wish_item[data-item="' + item + '"]').removeClass('added');
33620							$(this).find('.wish_item_button').find('.wish_item[data-item="' + item + '"]').find('.value').show();
33621							$(this).find('.wish_item_button').find('.wish_item[data-item="' + item + '"]').find('.value.added').hide();
33622						}
33623					})
33624				}
33625			}
33626
33627			$('.in-cart[data-item=' + item + ']').hide();
33628			$('.to-cart[data-item=' + item + ']').removeClass('clicked');
33629			$('.to-cart[data-item=' + item + ']').parent().removeClass('wide');
33630			if (!$('.counter_block[data-item=' + item + ']').closest('.counter_wrapp').find('.to-order').length) {
33631				$('.to-cart[data-item=' + item + ']').show();
33632				$('.counter_block[data-item=' + item + ']').closest('.counter_block_inner').show();
33633				$('.counter_block[data-item=' + item + ']').show();
33634			}
33635
33636			if (bBannerAction) {
33637				_this.toggleClass('added');
33638
33639				if (_this.hasClass('added'))
33640					_this.attr('title', _this.data('title2'))
33641				else
33642					_this.attr('title', _this.data('title'))
33643
33644				if (wrapper_btns.find('.basket_item_add').length)
33645					wrapper_btns.find('.basket_item_add').removeClass('added');
33646			}
33647
33648			if (!$(this).closest('.module-cart').size()) {
33649				$.ajax({
33650					type: "GET",
33651					url: arAsproOptions['SITE_DIR'] + "ajax/item.php",
33652					data: "item=" + item2 + "&quantity=" + val + "&wish_item=Y" + "&offers=" + offer + "&iblockID=" + iblockid + "&props=" + JSON.stringify(props),
33653					dataType: "json",
33654					success: function (data) {
33655						getActualBasket(iblockid);
33656						arStatusBasketAspro = {};
33657						if (data !== null) {
33658							if (data.MESSAGE_EXT === null)
33659								data.MESSAGE_EXT = '';
33660							if ("STATUS" in data) {
33661								if (data.STATUS === 'OK') {
33662									if (arAsproOptions['COUNTERS']['USE_BASKET_GOALS'] !== 'N') {
33663										var eventdata = { goal: 'goal_wish_add', params: { id: item2 } };
33664										BX.onCustomEvent('onCounterGoals', [eventdata]);
33665									}
33666									if ($("#ajax_basket").length)
33667										reloadTopBasket('wish', $('#ajax_basket'), 200, 5000, 'N');
33668
33669									if ($("#basket_line .basket_fly").length) {
33670										if (_this.closest('.fast_view_frame').length || window.matchMedia('(max-width: 767px)').matches || $("#basket_line .basket_fly.loaded").length)
33671											basketFly('wish', 'N');
33672										else
33673											basketFly('wish');
33674									}
33675								} else {
33676									showBasketError(BX.message(data.MESSAGE) + ' <br/>' + data.MESSAGE_EXT, BX.message("ERROR_ADD_DELAY_ITEM"));
33677								}
33678							} else {
33679								showBasketError(BX.message(data.MESSAGE) + ' <br/>' + data.MESSAGE_EXT, BX.message("ERROR_ADD_DELAY_ITEM"));
33680							}
33681						} else {
33682							if ($("#ajax_basket").length)
33683								reloadTopBasket('wish', $('#ajax_basket'), 200, 5000, 'N');
33684
33685							if ($("#basket_line .basket_fly").length) {
33686								if (_this.closest('.fast_view_frame').length || window.matchMedia('(max-width: 767px)').matches || $("#basket_line .basket_fly.loaded").length)
33687									basketFly('wish', 'N');
33688								else
33689									basketFly('wish');
33690							}
33691						}
33692						_this.removeClass('clicked');
33693					}
33694				});
33695			}
33696		}
33697
33698	})
33699
33700	$(document).on('click', '.item_main_info .item_slider .flex-direction-nav li span', function (e) {
33701		if ($('.inner_slider .slides_block').length) {
33702			if ($(this).parent().hasClass('flex-nav-next'))
33703				$('.inner_slider .slides_block li.current').next().click();
33704			else
33705				$('.inner_slider .slides_block li.current').prev().click();
33706		}
33707	})
33708
33709	$(document).on('click', '.compare_item, .compare_item_add', function (e) {
33710		e.preventDefault();
33711		var item = $(this).attr('data-item');
33712		var iblockID = $(this).attr('data-iblock'),
33713			bBannerAction = false,
33714			th = $(this);
33715
33716		if (th.closest('.banner_buttons.with_actions').length) //banner action
33717		{
33718			var wrapper_btns = th.closest('.wraps_buttons');
33719			item = wrapper_btns.data('id');
33720			iblockID = wrapper_btns.data('iblockid');
33721			bBannerAction = true;
33722
33723			th.toggleClass('added');
33724
33725			if (th.hasClass('added'))
33726				th.attr('title', th.data('title2'))
33727			else
33728				th.attr('title', th.data('title'))
33729		}
33730
33731		if (!th.hasClass('clicked')) {
33732			th.addClass('clicked');
33733			if (!$(this).hasClass('text')) {
33734				if ($(this).hasClass('added')) {
33735					if (!bBannerAction) {
33736						$(this).hide();
33737						$(this).closest('.compare_item_button').find('.to').show();
33738					}
33739
33740					/*sync other button*/
33741					$('.like_icons').each(function () {
33742						if ($(this).find('.compare_item.text[data-item="' + item + '"]').length) {
33743							$(this).find('.compare_item.text[data-item="' + item + '"]').removeClass('added');
33744							$(this).find('.compare_item.text[data-item="' + item + '"]').find('.value').show();
33745							$(this).find('.compare_item.text[data-item="' + item + '"]').find('.value.added').hide();
33746						}
33747						if ($(this).find('.compare_item_button').length) {
33748							/*$(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"]').removeClass('added');
33749							$(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"]').find('.value').show();
33750							$(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"]').find('.value.added').hide();*/
33751							$(this).find('.compare_item_button').find('.compare_item[data-item="' + item + '"].in').hide();
33752							$(this).find('.compare_item_button').find('.compare_item[data-item="' + item + '"].to').show();
33753						}
33754					})
33755				}
33756				else {
33757					if (!bBannerAction) {
33758						$(this).hide();
33759						$(this).closest('.compare_item_button').find('.in').show();
33760					}
33761
33762					/*sync other button*/
33763					$('.like_icons').each(function () {
33764						if ($(this).find('.compare_item.text[data-item="' + item + '"]').length) {
33765							$(this).find('.compare_item.text[data-item="' + item + '"]').addClass('added');;
33766							$(this).find('.compare_item.text[data-item="' + item + '"]').find('.value').hide();
33767							$(this).find('.compare_item.text[data-item="' + item + '"]').find('.value.added').css({ "display": "block" });
33768						}
33769						if ($(this).find('.compare_item_button').length) {
33770							/*$(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"]').addClass('added');
33771							$(this).find('.comp
33771are_item_button').find('.compare_item[data-item="'+item+'"]').find('.value.added').show();
33772							$(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"]').find('.value').hide();*/
33773							$(this).find('.compare_item_button').find('.compare_item[data-item="' + item + '"].to').hide();
33774							$(this).find('.compare_item_button').find('.compare_item[data-item="' + item + '"].in').show();
33775						}
33776					})
33777				}
33778			} else {
33779				if (!$(this).hasClass('added')) {
33780					$('.compare_item[data-item=' + item + ']').addClass('added');
33781					$('.compare_item[data-item=' + item + ']').find('.value').hide();
33782					$('.compare_item[data-item=' + item + ']').find('.value.added').css('display', 'block');
33783
33784					/*sync other button*/
33785					$('.like_icons').each(function () {
33786						if ($(this).find('.compare_item_button').length) {
33787							$(this).find('.compare_item_button').find('.compare_item[data-item="' + item + '"]').addClass('added');
33788							$(this).find('.compare_item_button').find('.compare_item[data-item="' + item + '"]').find('.value.added').show();
33789							$(this).find('.compare_item_button').find('.compare_item[data-item="' + item + '"]').find('.value').hide();
33790						}
33791					})
33792				} else {
33793					$('.compare_item[data-item=' + item + ']').removeClass('added');
33794					$('.compare_item[data-item=' + item + ']').find('.value').show();
33795					$('.compare_item[data-item=' + item + ']').find('.value.added').hide();
33796
33797					/*sync other button*/
33798					$('.like_icons').each(function () {
33799						if ($(this).find('.compare_item_button').length) {
33800							$(this).find('.compare_item_button').find('.compare_item[data-item="' + item + '"]').removeClass('added');
33801							$(this).find('.compare_item_button').find('.compare_item[data-item="' + item + '"]').find('.value').show();
33802							$(this).find('.compare_item_button').find('.compare_item[data-item="' + item + '"]').find('.value.added').hide();
33803						}
33804					})
33805				}
33806			}
33807
33808			$.get(arAsproOptions['SITE_DIR'] + 'ajax/item.php?item=' + item + '&compare_item=Y&iblock_id=' + iblockID,
33809				$.proxy(function (data) {
33810					getActualBasket(iblockID, 'Compare');
33811					arStatusBasketAspro = {};
33812					if ($('#compare_fly').length) {
33813						jsAjaxUtil.InsertDataToNode(arAsproOptions['SITE_DIR'] + 'ajax/show_compare_preview_fly.php', 'compare_fly', false);
33814					}
33815					th.removeClass('clicked');
33816				})
33817			);
33818		}
33819
33820	});
33821
33822	$('.fancybox').fancybox({
33823		backFocus: false,
33824	});
33825
33826	$(document).on('click', '.tabs>li', function () {
33827		var parent = $(this).parent();
33828		if (!$(this).hasClass('active')) {
33829			var sliderIndex = $(this).index(),
33830				curLiNav = $(this).closest('.top_block').find('.slider_navigation').find('>li:eq(' + sliderIndex + ')'),
33831				curLi = $(this).closest('.top_block').siblings('.tabs_content').find('>li:eq(' + sliderIndex + ')');
33832			$(this).addClass('active').addClass('cur').siblings().removeClass('active').removeClass('cur');
33833			curLi.addClass('cur').siblings().removeClass('cur');
33834			curLiNav.addClass('cur').siblings().removeClass('cur');
33835
33836			if (parent.hasClass('ajax')) // front tabs
33837			{
33838				if (!$(this).hasClass('clicked')) {
33839					$.ajax({
33840						url: arAsproOptions['SITE_DIR'] + 'include/mainpage/comp_catalog_ajax.php',
33841						type: 'POST',
33842						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') },
33843					}).success(function (html) {
33844						curLi.find('.tabs_slider').html(html);
33845						setTimeout(function () {
33846							curLi.addClass('opacity1');
33847						}, 100);
33848
33849						/*equal height*/
33850						// curLi.find('.catalog_block .catalog_item_wrapp .catalog_item .item_info:visible .item-title').sliceHeight({item:'.catalog_item:visible', mobile: true});
33851						// curLi.find('.catalog_block .catalog_item_wrapp .catalog_item .item_info:visible').sliceHeight({item:'.catalog_item:visible', mobile: true});
33852						// curLi.find('.catalog_block .catalog_item_wrapp .catalog_item:visible').sliceHeight({classNull: '.footer_button', item:'.catalog_item:visible', mobile: true});
33853
33854						initCountdown();
33855					})
33856					$(this).addClass('clicked');
33857				} else {
33858					$('.cur .catalog_block .catalog_item_wrapp.catalog_item:not(.big):visible').sliceHeight({
33859						classNull: '.footer_button',
33860						item: '.cur .catalog_block .catalog_item_wrapp.catalog_item:not(.big):visible',
33861						classes: [
33862							'.item_info .item-title',
33863							'.item_info .sa_block',
33864							'.item_info .cost.prices',
33865						],
33866						mobile: true,
33867					});
33868				}
33869			}
33870		}
33871	})
33872
33873	/*search click*/
33874	$('.search_block .icon').on('click', function () {
33875		var th = $(this);
33876		if ($(this).hasClass('open')) {
33877			$(this).closest('.center_block').find('.search_middle_block').removeClass('active');
33878			$(this).removeClass('open');
33879			$(this).closest('.center_block').find('.search_middle_block').find('.noborder').hide();
33880		} else {
33881			setTimeout(function () {
33882				th.closest('.center_block').find('.search_middle_block').find('.noborder').show();
33883			}, 100);
33884			$(this).closest('.center_block').find('.search_middle_block').addClass('active');
33885			$(this).addClass('open');
33886		}
33887	})
33888
33889	$(document).on('click', '.no_goods .button', function () {
33890		$('.bx_filter .smartfilter .bx_filter_search_reset').trigger('click');
33891	});
33892
33893	$(document).on('click', '.js-load-link', function (e) {
33894		AjaxClickLink(e)
33895	})
33896
33897	$(document).on('click', '.ajax_load_btn', function () {
33898		var
33899			_this = $(this),
33900			url = _this.closest('.container').find('.module-pagination .flex-direction-nav .flex-next').attr('href'),
33901			th = _this.find('.more_text_ajax'),
33902			bottom_nav = _this.closest('.bottom_nav'),
33903			bLoadingState = _this.closest('.animate-load-state').length,
33904			bCatalogInContent = _this.closest('.catalog_in_content').length;
33905
33906		if (!th.hasClass('loading')) {
33907			th.addClass('loading');
33908			if (bLoadingState)
33909				_this.addClass('loadings');
33910
33911			var objUrl = parseUrlQuery(),
33912				add_url = ''
33913			obGetData = { "ajax_get": "Y", "AJAX_REQUEST": "Y" };
33914
33915			if (_this.closest('.wrapper_inner.front').length) //index page
33916			{
33917				var class_block = th.closest('.drag-block').data('class').replace('_drag', '');
33918				class_block = class_block.replace(/\s/g, '');
33919				obGetData.BLOCK = class_block;
33920			}
33921
33922			if (_this.closest('.tab').length) //tabs block
33923			{
33924				var filter = th.closest('.tab').data('filter');
33925				obGetData.GLOBAL_FILTER = filter;
33926				url = _this.closest('.bottom_nav').find('.module-pagination .flex-direction-nav .flex-next').attr('href');
33927			}
33928
33929
33930			if (_this.closest('.content_linked_goods').length) //linked_goods block in content
33931			{
33932				var filterSections = th.closest('.content_linked_goods').attr('data-sections-ids');
33933				obGetData.ajax_section_id = decodeURIComponent(filterSections);
33934
33935				url = _this.closest('.bottom_nav').find('.module-pagination .flex-direction-nav .flex-next').attr('href');
33936			}
33937
33938			if ('clear_cache' in objUrl) {
33939				if (objUrl.clear_cache == 'Y')
33940					add_url = '&clear_cache=Y';
33941			}
33942			if (_this.hasClass('ajax'))
33943				obGetData.ajax = 'y';
33944
33945			if (th.closest('.goods-block.ajax_load'))
33946				obGetData.bitrix_include_areas = 'N';
33947			$.ajax({
33948				url: url + add_url,
33949				data: obGetData,
33950				success: function (html) {
33951					if (th.closest('.ajax_load').length) {
33952						th.removeClass('loading');
33953						if (th.closest('.ajax_load').find('.js_append').length) {
33954							if (bCatalogInContent) {
33955								th.closest('.ajax_load').find('.js_append').append($('.inner_wrapper .js_wrapper_items>', html));//need for brands & landings
33956							} else {
33957								th.closest('.ajax_load').find('.js_append').append(html);
33958							}
33959							th.closest('.ajax_load').find('.bottom_nav_wrapper').remove();
33960						}
33961						else {
33962							if ($('.display_list').length) {
33963								$('.display_list').append(html);
33964								th.closest('.display_list').find('.bottom_nav_wrapper').remove();
33965
33966							} else if ($('.block_list').length) {
33967								$('.block_list').append(html);
33968								touchItemBlock('.catalog_item a');
33969								th.closest('.block_list').find('.bottom_nav_wrapper').remove();
33970							} else if ($('.module_products_list').length) {
33971								$('.module_products_list > tbody').append(html);
33972								th.closest('.module_products_list > tbody').find('.bottom_nav_wrapper').remove();
33973							}
33974
33975						}
33976
33977
33978						setStatusButton();
33979						checkLinkedArticles();
33980
33981						var eventdata = { action: 'ajaxContentLoadedTab' };
33982						BX.onCustomEvent('onAjaxSuccess', [eventdata]);
33983						_this.closest('.bottom_nav').html($(html).find('.bottom_nav').html());
33984					}
33985					else {
33986						var eventdata = { action: 'ajaxContentLoaded' };
33987
33988						if ($('.banners-small.front').length) {
33989							$('.banners-small .items.row').append(html);
33990							$('.bottom_nav').html($('.banners-small .items.row .bottom_nav').html());
33991							$('.banners-small .items.row .bottom_nav').remove();
33992						}
33993						else {
33994							if (typeof bottom_nav.data('append') !== undefined && typeof bottom_nav.data('parent') !== undefined) {
33995								th.closest(bottom_nav.data('parent')).find(bottom_nav.data('append')).append(html);
33996								th.closest(bottom_nav.data('parent')).find(bottom_nav.data('append')).find('.bottom_nav_wrapper').remove();
33997
33998								bottom_nav.html($(html).find('.bottom_nav').html());
33999
34000								eventdata.container = th.closest(bottom_nav.data('parent'));
34001							}
34002							else {
34003								if (th.closest('.item-views').find('.items').length) {
34004									th.closest('.item-views').find('.items').append(html);
34005								}
34006								else {
34007									$(html).insertBefore($('.blog .bottom_nav'));
34008								}
34009
34010								bottom_nav.html($('.bottom_nav:hidden').html());
34011								_this.closest('.item-views').find('.bottom_nav:hidden').remove();
34012							}
34013						}
34014
34015						eventdata.content = html;
34016						eventdata.container = th;
34017						BX.onCustomEvent('onCompleteAction', [eventdata, th[0]]);
34018
34019						setTimeout(function () {
34020							$('.banners-small .item.normal-block').sliceHeight({ resize: false });
34021							if ($('.item.slice-item').length) {
34022								$('.item.slice-item .title').sliceHeight({ resize: false });
34023								$('.item.slice-item').sliceHeight({ resize: false });
34024							}
34025							th.removeClass('loading');
34026							if (bLoadingState)
34027								_this.removeClass('loadings');
34028						}, 100);
34029					}
34030					initCountdown();
34031				}
34032			})
34033		}
34034	})
34035
34036	// form rating
34037	$(document).on('mouseenter', '.form .votes_block.with-text .item-rating', function () {
34038		var $this = $(this),
34039			index = $this.index(),
34040			ratingValue = $this.data('rating_value'),
34041			ratingMessage = $this.data('message');
34042
34043		$(this).addClass('filed')
34044		$this.siblings().each(function () {
34045			if ($(this).index() <= index)
34046				$(this).addClass('filed')
34047			else
34048				$(this).removeClass('filed')
34049		});
34050		$this.closest('.votes_block').find('.rating_message').text(ratingMessage);
34051	});
34052
34053	$(document).on('mouseleave', '.form .votes_block.with-text', function () {
34054		var $this = $(this),
34055			index = $this.data('rating'),
34056			ratingMessage = $this.closest('.votes_block').find('.rating_message').data('message');
34057
34058		$this.find('.item-rating').each(function () {
34059			if ($(this).index() < index && index !== undefined)
34060				$(this).addClass('filed')
34061			else
34062				$(this).removeClass('filed')
34063		});
34064		$this.closest('.votes_block').find('.rating_message').text(ratingMessage);
34065	});
34066
34067	$(document).on('click', '.form .votes_block.with-text .item-rating', function () {
34068		var $this = $(this),
34069			rating = $this.closest('.votes_block').data('rating'),
34070			index = $this.index() + 1,
34071			ratingMessage = $this.data('message');
34072
34073		$this.closest('.votes_block').data('rating', index);
34074		if ($this.closest('.form-control').find('input[name=RATING]').length) {
34075			$this.closest('.form-control').find('input[name=RATING]').val(index);
34076		}
34077		else {
34078			$this.closest('.form-control').find('input[data-sid=RATING]').val(index);
34079		}
34080		$this.closest('.votes_block').find('.rating_message').data('message', ratingMessage);
34081	});
34082
34083	//set cookie for basket link click
34084	$(document).on('click', '.bx_ordercart_order_table_container .control > a, .basket-item-actions-remove, a[data-entity=basket-item-remove-delayed]', function (e) {
34085		$.removeCookie('click_basket', { path: '/' });
34086		$.cookie('click_basket', 'Y', { path: '/' });
34087	})
34088
34089	$(document).on('click', '.bx_compare .tabs-head li', function () {
34090		var url = $(this).find('.sortbutton').data('href');
34091		BX.showWait(BX("bx_catalog_compare_block"));
34092		$.ajax({
34093			url: url,
34094			data: { 'ajax_action': 'Y' },
34095			success: function (html) {
34096				history.pushState(null, null, url);
34097				$('#bx_catalog_compare_block').html(html);
34098				BX.closeWait();
34099			}
34100		})
34101	})
34102	var hoveredTrs;
34103	$(document).on({
34104		mouseover: function (e) {
34105			var _ = $(this);
34106			var tbodyIndex = _.closest('tbody').index() + 1; //+1 for nth-child
34107			var trIndex = _.index() + 1; // +1 for nth-child
34108			hoveredTrs = $(e.delegateTarget).find('.data_table_props')
34109				.children(':nth-child(' + tbodyIndex + ')')
34110				.children(':nth-child(' + trIndex + ')').addClass('hovered');
34111		},
34112		mouseleave: function (e) {
34113			if (hoveredTrs)
34114				hoveredTrs.removeClass('hovered');
34115		}
34116	}, '.bx_compare .data_table_props tbody>tr');
34117	$(document).on('click', '.fancy_offer', function (e) {
34118		e.preventDefault();
34119		var arPict = [], index = 0;
34120		$(this).closest('.item_slider').find('.sliders .slides_block li').each(function () {
34121			var obImg = {};
34122			obImg = {
34123				'title': $(this).find('img').attr('alt'),
34124				'href': $(this).data('big')
34125			}
34126			if ($(this).hasClass('current')) {
34127				index = $(this).index();
34128			}
34129			arPict.push(obImg);
34130		})
34131		$.fancybox(arPict, {
34132			index: index,
34133			openEffect: 'fade',
34134			closeEffect: 'fade',
34135			nextEffect: 'fade',
34136			prevEffect: 'fade',
34137			type: 'image',
34138			tpl: {
34139				closeBtn: '<a title="' + BX.message('FANCY_CLOSE') + '" class="fancybox-item fancybox-close" href="javascript:;"></a>',
34140				next: '<a title="' + BX.message('FANCY_NEXT') + '" class="fancybox-nav fancybox-next" href="javascript:;"><span></span></a>',
34141				prev: '<a title="' + BX.message('FANCY_PREV') + '" class="fancybox-nav fancybox-prev" href="javascript:;"><span></span></a>'
34142			},
34143		});
34144	})
34145
34146	/*tabs*/
34147	$(".tabs_section .tabs-head li").on("click", function () {
34148		if (!$(this).is(".current")) {
34149			$(".tabs_section .tabs-head li").removeClass("current");
34150			$(this).addClass("current");
34151			$(".tabs_section ul.tabs_content li").removeClass("current");
34152			if ($(this).attr("id") == "product_reviews_tab") {
34153				$(".shadow.common").hide(); $("#reviews_content").show();
34154			}
34155			else {
34156				$(".shadow.common").show();
34157				$("#reviews_content").hide();
34158				$(".tabs_section ul.tabs_content > li:eq(" + $(this).index() + ")").addClass("current");
34159			}
34160		}
34161	});
34162
34163	/*open first section slide*/
34164	setTimeout(function () {
34165		$('.jobs_wrapp .item:first .name tr').trigger('click');
34166	}, 300);
34167
34168	$('.choise').on('click', function () {
34169		var _this = $(this);
34170		if (typeof (_this.data('block')) != 'undefined') {
34171			if ($(_this.data('block')).closest('.tab-pane').length) {
34172				$('.ordered-block a[href="#' + $(_this.data('block')).closest('.tab-pane').attr('id') + '"]').click();
34173				// _this.data('block', '.ordered-block');
34174				$(_this.data('block')).data('offset', -100);
34175			}
34176			scrollToBlock(_this.data('block'));
34177		}
34178	})
34179
34180	$(document).on('click', '.buy_block .slide_offer', function () {
34181		scroll_block($('.js-offers-scroll'));
34182	});
34183	$('.share  > .share_wrapp .text').on('click', function () {
34184		var block = $(this).parent().find('.shares');
34185		if (!block.is(':visible') && !$(this).closest('.share.top').length)
34186			$('#content').css('z-index', 3);
34187		block.fadeToggle(100, function () {
34188			if (!block.is(':visible'))
34189				$('#content').css('z-index', 2);
34190		});
34191	})
34192	$('html, body').on('mousedown', function (e) {
34193		if (typeof e.target.className == 'string' && e.target.className.indexOf('adm') < 0) {
34194			e.stopPropagation();
34195			$('div.shares').fadeOut(100, function () {
34196				$('#content').css('z-index', 2);
34197				$('.price_txt .share_wrapp').removeClass('opened');
34198			});
34199			$('.search_middle_block').removeClass('active_wide');
34200		}
34201	})
34202	$('.share_wrapp').find('*').on('mousedown', function (e) {
34203		e.stopPropagation();
34204	});
34205
34206	$('.price_txt .share_wrapp .text').click(function () {
34207		$(this).parent().toggleClass('opened');
34208		$(this).parent().find('.shares').fadeToggle();
34209	})
34210
34211	$(document).on('click', '.reviews-collapse-link', function () {
34212		$('.reviews-reply-form').slideToggle();
34213	})
34214
34215	/* accordion action*/
34216	$('.panel-collapse').on('hidden.bs.collapse', function () {
34217		$(this).parent().toggleClass('opened');
34218	})
34219	$('.panel-collapse').on('show.bs.collapse', function () {
34220		$(this).parent().toggleClass('opened');
34221	})
34222
34223	/* accordion */
34224	$('.accordion-head').on('click', function (e) {
34225		e.preventDefault();
34226		if (!$(this).next().hasClass('collapsing')) {
34227			$(this).toggleClass('accordion-open');
34228			$(this).toggleClass('accordion-close');
34229		}
34230	});
34231
34232	/* progress bar */
34233	$('[data-appear-progress-animation]').each(function () {
34234		var $this = $(this);
34235		$this.appear(function () {
34236			var delay = ($this.attr('data-appear-animation-delay') ? $this.attr('data-appear-animation-delay') : 1);
34237			if (delay > 1)
34238				$this.css('animation-delay', delay + 'ms');
34239			$this.addClass($this.attr('data-appear-animation'));
34240
34241			setTimeout(function () {
34242				$this.animate({
34243					width: $this.attr('data-appear-progress-animation')
34244				}, 1500, 'easeOutQuad', function () {
34245					$this.find('.progress-bar-tooltip').animate({
34246						opacity: 1
34247					}, 500, 'easeOutQuad');
34248				});
34249			}, delay);
34250		}, { accX: 0, accY: -50 });
34251	});
34252
34253	initCountdown();
34254
34255	/* portfolio item */
34256	if ($('.item.animated-block').length) {
34257		$('.item.animated-block').appear(function () {
34258			var $this = $(this);
34259
34260			$this.addClass($this.data('animation')).addClass('visible');
34261
34262		}, { accX: 0, accY: 150 })
34263	}
34264
34265	/* flexslider appear */
34266	if ($('.appear-block').length) {
34267		$('.appear-block').appear(function () {
34268			var $this = $(this);
34269			$this.removeClass('appear-block');
34270
34271			CheckFlexSlider();
34272			InitFlexSlider()
34273		}, { accX: 0, accY: 150 })
34274	}
34275
34276	/* js-load-block appear */
34277	if ($('.js-load-block').length) {
34278		$('.js-load-block').appear(function () {
34279			var $this = $(this);
34280			if ($this.data('file')) {
34281				var objUrl = parseUrlQuery(),
34282					bClearCache = false,
34283					add_url = '';
34284				if ('clear_cache' in objUrl) {
34285					if (objUrl.clear_cache == 'Y') {
34286						add_url += '?clear_cache=Y';
34287						bClearCache = true;
34288					}
34289				}
34290				if ($this.data('block'))
34291					add_url += (bClearCache ? '&' : '?') + 'BLOCK=' + $this.data('block');
34292
34293				// return;
34294				$.get($this.data('file') + add_url)
34295					.done(function (html) {
34296						if ($this.data('appendTo')) {
34297							$this.find($this.data('appendTo')).html(html);
34298						}
34299						else {
34300							if ($this.find('> div[id*="bx_incl_"]').length) {
34301								$this.find('> div[id*="bx_incl_"]').html(html);
34302							}
34303							else {
34304								$this.html(html);
34305							}
34306						}
34307
34308						$this.removeAttr('data-file').removeClass('loader_circle');
34309
34310						var eventdata = { action: 'jsLoadBlock' };
34311						BX.onCustomEvent('onCompleteAction', [eventdata, $this]);
34312					})
34313			}
34314		}, { accX: 0, accY: 150 })
34315	}
34316
34317	/*show ajax store amount product*/
34318	$(document).on('click', '.js-show-info-block', function (e) {
34319		var $this = $(this);
34320		e.stopPropagation();
34321		$('.js-info-block').fadeOut();
34322
34323		if ($this.hasClass('opened')) {
34324			$('.js-show-info-block').removeClass('opened');
34325		}
34326		else {
34327			$('.js-show-info-block').removeClass('opened');
34328			$this.addClass('opened');
34329		}
34330
34331		if (!$this.siblings('.js-info-block').length) {
34332			var dataFields = $this.closest('.sa_block').data('fields');
34333			dataFields = dataFields == 'null' || dataFields === undefined ? '' : dataFields;
34334			var dataUserFields = $this.closest('.sa_block').data('user-fields');
34335			dataUserFields = dataUserFields == 'null' || dataUserFields === undefined ? '' : dataUserFields;
34336			var objUrl = parseUrlQuery(),
34337				add_url = '';
34338			if ('clear_cache' in objUrl) {
34339				if (objUrl.clear_cache == 'Y')
34340					add_url += '?clear_cache=Y';
34341			}
34342
34343			var obPostParams = {
34344				'ajax': 'Y',
34345				'ELEMENT_ID': $this.data('id'),
34346				'FIELDS': dataFields,
34347				'USER_FIELDS': dataUserFields,
34348				'STORES': $this.closest('.sa_block').data('stores') || ''
34349			};
34350
34351			$this.addClass('loadings');
34352			$.post(arAsproOptions['SITE_DIR'] + 'ajax/productStoreAmountCompact.php' + add_url, obPostParams)
34353				.done(function (html) {
34354					$this.removeClass('loadings');
34355					$(html).appendTo($this.closest('.sa_block'));
34356
34357					$this.siblings('.js-info-block').find('.more-btn a').attr('href', $this.closest('.item_info').find('a').attr('href'));
34358					InitScrollBar();
34359
34360					var eventdata = { action: 'jsShowStores' };
34361					BX.onCustomEvent('onCompleteAction', [eventdata, $this]);
34362				})
34363		}
34364		else {
34365			if ($this.hasClass('opened')) {
34366				$this.siblings('.js-info-block').find('.more-btn a').attr('href', $this.closest('.item_info').find('a').attr('href'));
34367				$this.siblings('.js-info-block').fadeIn();
34368				InitScrollBar();
34369			}
34370			else {
34371				$this.siblings('.js-info-block').fadeOut();
34372			}
34373		}
34374	})
34375	$(document).on('click', '.js-info-block .svg-inline-close', function () {
34376		$('.js-show-info-block').removeClass('opened');
34377		$(this).closest('.js-info-block').fadeOut();
34378	})
34379	/**/
34380
34381	/*adaptive menu start*/
34382	$('.menu.adaptive').on('click', function () {
34383		$(this).toggleClass('opened');
34384		if ($(this).hasClass('opened')) {
34385			$('.mobile_menu').toggleClass('opened').slideDown();
34386		} else {
34387			$('.mobile_menu').toggleClass('opened').slideUp();
34388		}
34389	});
34390	$('.mobile_menu .has-child >a').on('click', function (e) {
34391		var parentLi = $(this).parent();
34392		e.preventDefault();
34393		parentLi.toggleClass('opened');
34394		parentLi.find('.dropdown').slideToggle();
34395	})
34396
34397	$('.mobile_menu .search-input-div input').on('keyup', function (e) {
34398		var inputValue = $(this).val();
34399		$('.center_block .stitle_form input').val(inputValue);
34400		if (e.keyCode == 13) {
34401			$('.center_block .stitle_form form').submit();
34402		}
34403	});
34404
34405	$('.center_block .stitle_form input').on('keyup', function (e) {
34406		var inputValue = $(this).val();
34407		$('.mobile_menu .search-input-div input').val(inputValue);
34408		if (e.keyCode == 13) {
34409			$('.center_block .stitle_form form').submit();
34410		}
34411	});
34412
34413	$('.mobile_menu .search-button-div button').on('click', function (e) {
34414		e.preventDefault();
34415		var inputValue = $(this).parents().find('input').val();
34416		$('.center_block .stitle_form input').val(inputValue);
34417		$('.center_block .stitle_form form').submit();
34418	});
34419	/*adaptive menu end*/
34420
34421	$(document).on('click', '.mega-menu .dropdown-menu', function (e) {
34422		e.stopPropagation()
34423	});
34424
34425	$(document).on('click', '.mega-menu .dropdown-toggle.more-items', function (e) {
34426		e.preventDefault();
34427	});
34428
34429	$(document).on('mouseenter', '.table-menu .dropdown,.table-menu .dropdown-submenu,.table-menu .dropdown-toggle', function () {
34430		setTimeout(
34431			function () {
34432				CheckTopVisibleMenu();
34433			}, 275);
34434
34435	});
34436	$(document).on('mouseenter', '#headerfixed .table-menu .dropdown-menu .dropdown-submenu', function () {
34437		setTimeout(
34438			function () {
34439				CheckTopVisibleMenu();
34440			}, 275);
34441	});
34442
34443	$('.mega-menu .search-item .search-icon, .menu-row #title-search .fa-close').on('click', function (e) {
34444		e.preventDefault();
34445		$('.menu-row #title-search').toggleClass('hide');
34446	});
34447
34448	$('.mega-menu ul.nav .search input').on('keyup', function (e) {
34449		var inputValue = $(this).val();
34450		$('.menu-row > .search input').val(inputValue);
34451		if (e.keyCode == 13) {
34452			$('.menu-row > .search form').submit();
34453		}
34454	});
34455
34456	$('.menu-row > .search input').on('keyup', function (e) {
34457		var inputValue = $(this).val();
34458		$('.mega-menu ul.nav .search input').val(inputValue);
34459		if (e.keyCode == 13) {
34460			$('.menu-row > .search form').submit();
34461		}
34462	});
34463
34464	$('.mega-menu ul.nav .search button').on('click', function (e) {
34465		e.preventDefault();
34466		var inputValue = $(this).parents('.search').find('input').val();
34467		$('.menu-and-search .search input').val(inputValue);
34468		$('.menu-row > .search form').submit();
34469	});
34470
34471	$('.btn.btn-add').on('click', function () {
34472		$.ajax({
34473			type: "GET",
34474			url: arAsproOptions['SITE_DIR'] + "ajax/clearBasket.php",
34475			success: function (data) {
34476			}
34477		});
34478	})
34479
34480	$('.sort_display a').on('click', function () {
34481		$(this).siblings().removeClass('current');
34482		$(this).addClass('current');
34483	})
34484
34485	/*detail order show payments*/
34486	$('.sale-order-detail-payment-options-methods-info-change-link').on('click', function () {
34487		$(this).closest('.sale-order-detail-payment-options-methods-info').addClass('opened').siblings().addClass('opened');
34488	})
34489
34490	/*expand/hide filter values*/
34491	$(document).on('click', '.expand_block', function () {
34492		togglePropBlock($(this));
34493	})
34494
34495	/*touch event*/
34496	document.addEventListener('touchend', function (event) {
34497		if (!$(event.target).closest('.menu-item').length && !$(event.target).hasClass('menu-item')) {
34498			$('.menu-row .dropdown-menu').css({ 'display': 'none', 'opacity': 0 });
34499			$('.menu-item').removeClass('hover');
34500			$('.bx-breadcrumb-item.drop').removeClass('hover');
34501		}
34502		if (!$(event.target).closest('.menu.topest').length) {
34503			$('.menu.topest').css({ 'overflow': 'hidden' });
34504			$('.menu.topest > li').removeClass('hover');
34505		}
34506		if (!$(event.target).closest('.full.has-child').length) {
34507			$('.menu_top_block.catalog_block li').removeClass('hover');
34508		}
34509		if (!$(event.target).closest('.basket_block').length) {
34510			$('.basket_block .link').removeClass('hover');
34511			$('.basket_block .basket_popup_wrapp').slideUp();
34512		}
34513		if (!$(event.target).closest('.catalog_item').length) {
34514			var tabsContentUnhoverHover = $('.tab:visible').attr('data-unhover') * 1;
34515			$('.tab:visible').stop().animate({ 'height': tabsContentUnhoverHover }, 100);
34516			$('.tab:visible').find('.catalog_item').removeClass('hover');
34517			$('.tab:visible').find('.catalog_item .buttons_block').stop().fadeOut(233);
34518			if ($('.catalog_block').length) {
34519				$('.catalog_block').find('.catalog_item_wrapp').removeClass('hover');
34520				$('.catalog_block').find('.catalog_item').removeClass('hover');
34521			}
34522		}
34523		//togglePropBlock($(event.target));
34524
34525	}, false);
34526
34527
34528	touchMenu('.menu-row .menu-item');
34529	touchTopMenu('.menu.topest li');
34530	touchLeftMenu('.menu_top_block li.full');
34531	touchBreadcrumbs('.bx-breadcrumb-item.drop');
34532
34533	$(document).on('keyup', '.coupon .input_coupon input', function () {
34534		if ($(this).val().length) {
34535			$(this).removeClass('error');
34536			$(this).closest('.input_coupon').find('.error').remove();
34537		} else {
34538			$(this).addClass('error');
34539			$("<label class='error'>" + BX.message("INPUT_COUPON") + "</label>").insertBefore($(this));
34540		}
34541	})
34542	showPhoneMask('input[autocomplete=tel]');
34543	BX.addCustomEvent(window, "onAjaxSuccessFilter", function (e) {
34544		setBasketStatusBtn();
34545		checkLinkedArticles();
34546	});
34547
34548	$(document).on('click', '.block_container .items .item.initied', function () {
34549		var _this = $(this),
34550			itemID = _this.data('id'),
34551			animationTime = 200;
34552
34553		_this.closest('.items').fadeOut(animationTime, function () {
34554			_this.closest('.block_container').find('.detail_items').fadeIn(animationTime);
34555			_this.closest('.block_container').find('.detail_items .item[data-id=' + itemID + ']').fadeIn(animationTime);
34556
34557			var arCoordinates = _this.data('coordinates').split(',');
34558
34559			if (typeof map !== 'undefined')
34560				map.setCenter([arCoordinates[0], arCoordinates[1]], 15);
34561		});
34562	});
34563
34564	$(document).on('click', '.block_container .top-close', function () {
34565		var _this = $(this).closest('.block_container').find('.detail_items .item:visible'),
34566			animationTime = 200;
34567		_this.fadeOut(animationTime);
34568		_this.closest('.block_container').find('.detail_items').fadeOut(animationTime, function () {
34569			_this.closest('.block_container').find('.items').fadeIn(animationTime);
34570
34571			if (typeof map !== 'undefined' && typeof clusterer !== 'undefined') {
34572				map.setBounds(clusterer.getBounds(), {
34573					zoomMargin: 40,
34574					// checkZoomRange: true
34575				});
34576			}
34577		});
34578	});
34579
34580	BX.addCustomEvent(window, "onAjaxSuccess", function (e) {
34581		if (e != 'OK') {
34582			if (typeof (e) !== 'undefined' && e && typeof (e.FILTER_URL) != 'undefined' && typeof (e.ELEMENT_COUNT) != 'undefined') {
34583				mobileFilterNum(e.ELEMENT_COUNT);
34584			}
34585
34586			initSelects(document);
34587			InitOrderCustom();
34588			showPhoneMask('input[autocomplete=tel]');
34589
34590			/*scroll in mobile for filter*/
34591			if ($('.bx_filter').length) {
34592				if (window.matchMedia('(min-width: 768px)').matches) {
34593					$('.bx_filter .scrollbar').removeClass('mobile-scroll');
34594					$('.bx_filter .srollbar-custom').removeClass('mobile-scroll');
34595					$('.bx_filter .bx_filter_section form .bx_filter_parameters').removeClass('mobile-scroll');
34596					InitScrollBar();
34597					InitCustomScrollBar();
34598				}
34599
34600				if (window.matchMedia('(max-width: 767px)').matches) {
34601					$('.bx_filter .scrollbar').addClass('mobile-scroll');
34602					$('.bx_filter .srollbar-custom').addClass('mobile-scroll');
34603					$('.bx_filter .bx_filter_section form .bx_filter_parameters').addClass('mobile-scroll');
34604					if ($('.bx_filter .mobile-scroll.scrollbar').length)
34605						$('.bx_filter .mobile-scroll.scrollbar').mCustomScrollbar("destroy");
34606					if ($('.bx_filter .mobile-scroll.srollbar-custom').length)
34607						$('.bx_filter .mobile-scroll.srollbar-custom').mCustomScrollbar("destroy");
34608				}
34609			}
34610			/*end*/
34611
34612			if ($('.catalog_detail').length && !$('.fast_view_frame').length) {
34613				$('.bx_filter').remove();
34614				InitFlexSlider();
34615				InitOwlSlider();
34616			}
34617			if (arAsproOptions["PAGES"]["CATALOG_PAGE"]) {
34618				initCountdown();
34619
34620				if (typeof window['stickySidebar'] !== 'undefined')
34621					window['stickySidebar'].updateSticky();
34622			}
34623
34624			if (arAsproOptions["PAGES"]["ORDER_PAGE"]) {
34625				orderActions(e);
34626			}
34627		}
34628	});
34629
34630	//event for default basket quantity change
34631	BX.addCustomEvent(window, "OnBasketChange", function (e) {
34632		if (arAsproOptions["PAGES"]["BASKET_PAGE"]) {
34633			var summ = 0,
34634				title = '';
34635
34636			if (typeof BX.Sale !== "undefined") {
34637				if (typeof BX.Sale.BasketComponent !== "undefined") {
34638					summ = BX.Sale.BasketComponent.result.allSum;
34639					title = BX.message('JS_BASKET_COUNT_TITLE').replace('SUMM', summ);
34640				}
34641			}
34642			else {
34643				summ = $('#allSum_FORMATED').html().replace(/&nbsp;/g, ' ');
34644				title = BX.message('JS_BASKET_COUNT_TITLE').replace('SUMM', summ);
34645			}
34646
34647			if ($('.js-basket-block .wrap .prices').length)
34648				$('.js-basket-block .wrap .prices').html(summ);
34649			if ($('a.basket-link.basket').length)
34650				$('a.basket-link.basket').attr('title', title);
34651			if ($('.basket_fly .opener .basket_count').length)
34652				$('.basket_fly .opener .basket_count').attr('title', title);
34653
34654		}
34655	})
34656	BX.addCustomEvent(window, "onFrameDataRequestFail", function (response) {
34657		console.log(response);
34658	});
34659
34660});
34661
34662if (!funcDefined('setBasketStatusBtn')) {
34663	setBasketStatusBtn = function (type) {
34664		var bSync = (typeof type !== undefined);
34665		if (typeof (arBasketAspro) !== 'undefined') {
34666			if ('BASKET' in arBasketAspro) // basket items
34667			{
34668				if (arBasketAspro.BASKET) {
34669					for (var i in arBasketAspro.BASKET) {
34670						$('.to-cart[data-item=' + i + ']').hide();
34671						$('.counter_block[data-item=' + i + ']').closest('.counter_block_inner').hide();
34672						$('.counter_block[data-item=' + i + ']').hide();
34673						$('.in-cart[data-item=' + i + ']').show();
34674						$('.in-cart[data-item=' + i + ']').closest('.button_block').addClass('wide');
34675
34676						$('.wish_item.to[data-item=' + i + ']').show();
34677						$('.wish_item.in[data-item=' + i + ']').hide();
34678
34679						if ($('.banner_buttons.with_actions .wraps_buttons[data-id=' + i + '] .basket_item_add').length) {
34680							$('.banner_buttons.with_actions .wraps_buttons[data-id=' + i + '] .basket_item_add').addClass('added')
34681							$('.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'))
34682						}
34683
34684
34685					}
34686				}
34687			}
34688
34689			if ('DELAY' in arBasketAspro) // delay items
34690			{
34691				if (arBasketAspro.DELAY) {
34692					for (var i in arBasketAspro.DELAY) {
34693						$('.wish_item.to[data-item=' + i + ']').hide();
34694						$('.wish_item.in[data-item=' + i + ']').show();
34695						if ($('.wish_item[data-item=' + i + ']').find(".value.added").length) {
34696							//$('.wish_item[data-item='+i+']').addClass("added");
34697							$('.wish_item[data-item=' + i + ']').find(".value").hide();
34698							$('.wish_item[data-item=' + i + ']').find(".value.added").css('display', 'block');
34699						}
34700
34701						$('.in-cart[data-item=' + i + ']').hide();
34702						$('.to-cart[data-item=' + i + ']').show();
34703						$('.to-cart[data-item=' + i + ']').closest('.counter_wrapp').find('.counter_block_inner').show();
34704						$('.to-cart[data-item=' + i + ']').closest('.counter_wrapp').find('.counter_block').show();
34705						$('.to-cart[data-item=' + i + ']').closest('.button_block').removeClass('wide');
34706
34707						if ($('.banner_buttons.with_actions .wraps_buttons[data-id=' + i + '] .wish_item_add').length) {
34708							$('.banner_buttons.with_actions .wraps_buttons[data-id=' + i + '] .wish_item_add').addClass('added')
34709							$('.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'))
34710						}
34711					}
34712				}
34713			}
34714
34715			if ('SUBSCRIBE' in arBasketAspro) // subscribe items
34716			{
34717				if (arBasketAspro.SUBSCRIBE) {
34718					for (var i in arBasketAspro.SUBSCRIBE) {
34719						$('.to-subscribe[data-item=' + i + ']').hide();
34720						$('.in-subscribe[data-item=' + i + ']').show();
34721					}
34722				}
34723			}
34724
34725			if ('COMPARE' in arBasketAspro) // compare items
34726			{
34727				if (arBasketAspro.COMPARE) {
34728					for (var i in arBasketAspro.COMPARE) {
34729						$('.compare_item.to[data-item=' + i + ']').hide();
34730						$('.compare_item.in[data-item=' + i + ']').show();
34731						if ($('.compare_item[data-item=' + i + ']').find(".value.added").length) {
34732							//$('.compare_item[data-item='+i+']').addClass("added");
34733							$('.compare_item[data-item=' + i + ']').find(".value").hide();
34734							$('.compare_item[data-item=' + i + ']').find(".value.added").css('display', 'block');
34735						}
34736
34737						if ($('.banner_buttons.with_actions .wraps_buttons[data-id=' + i + '] .compare_item_add').length) {
34738							$('.banner_buttons.with_actions .wraps_buttons[data-id=' + i + '] .compare_item_add').addClass('added')
34739							$('.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'))
34740						}
34741					}
34742				}
34743			}
34744		}
34745	}
34746}
34747
34748if (!funcDefined('togglePropBlock')) {
34749	togglePropBlock = function (className) {
34750		var all_props_block = className.closest('.bx_filter_parameters_box_container').find('.hidden_values');
34751		if (all_props_block.length && (className.hasClass('inner_text') || className.hasClass('expand_block'))) {
34752			if (all_props_block.is(':visible')) {
34753				className.text(BX.message('FILTER_EXPAND_VALUES'));
34754				all_props_block.hide();
34755			}
34756			else {
34757				className.text(BX.message('FILTER_HIDE_VALUES'));
34758				all_props_block.show();
34759			}
34760		}
34761	}
34762}
34763
34764if (!funcDefined('showPhoneMask')) {
34765	showPhoneMask = function (className) {
34766		$(className).inputmask('mask', { 'mask': arAsproOptions['THEME']['PHONE_MASK'], 'showMaskOnHover': false });
34767	}
34768}
34769
34770if (!funcDefined('parseUrlQuery')) {
34771	parseUrlQuery = function () {
34772		var data = {};
34773		if (location.search) {
34774			var pair = (location.search.substr(1)).split('&');
34775			for (var i = 0; i < pair.length; i++) {
34776				var param = pair[i].split('=');
34777				data[param[0]] = param[1];
34778			}
34779		}
34780		return data;
34781	}
34782}
34783
34784if (!funcDefined('getActualBasket')) {
34785	getActualBasket = function (iblockID, type, sync) {
34786		var data = '';
34787		if (typeof iblockID !== "undefined" && iblockID) {
34788			data = { "iblockID": iblockID }
34789		}
34790		$.ajax({
34791			type: "GET",
34792			url: arAsproOptions['SITE_DIR'] + "ajax/actualBasket.php",
34793			data: data,
34794			success: function (data) {
34795				if (!$('.js_ajax').length)
34796					$('body').append('<div class="js_ajax"></div>');
34797				$('.js_ajax').html(data);
34798
34799				if (typeof sync !== "undefined") {
34800					setBasketStatusBtn(true);
34801				}
34802
34803				if (typeof (type) !== undefined) {
34804					var eventdata = { action: 'loadActualBasket' + type };
34805					BX.onCustomEvent('onCompleteAction', [eventdata]);
34806				}
34807			}
34808		});
34809	}
34810}
34811
34812if (!funcDefined('reloadBasketCounters')) {
34813	reloadBasketCounters = function (count, sync) {
34814		var data = '';
34815		if (count) {
34816			$('.basket-link.basket .count, .wraps_icon_block.basket .count .items > span').text(count);
34817		} else {
34818			$.ajax({
34819				type: "GET",
34820				url: arAsproOptions['SITE_DIR'] + "ajax/actualBasket.php",
34821				data: data,
34822				success: function (data) {
34823					if (!$('.js_ajax').length)
34824						$('body').append('<div class="js_ajax"></div>');
34825					$('.js_ajax').html(data);
34826
34827					$('.basket-link.basket .count, .wraps_icon_block.basket .count .items > span').text(Object.keys(arBasketAspro.BASKET).length);
34828					$('.basket-link.delay .count, .wraps_icon_block.delay .count .items > span').text(Object.keys(arBasketAspro.DELAY).length);
34829					$('.basket-link.compare .count, .wraps_icon_block.compare .count .items > span').text(Object.keys(arBasketAspro.COMPARE).length);
34830
34831					if (typeof sync !== 'undefined') {
34832						setBasketStatusBtn(true);
34833						basketTop();
34834					}
34835				}
34836			});
34837		}
34838	}
34839}
34840
34841function touchMenu(selector) {
34842	if (isMobile) {
34843		if ($(selector).length) {
34844			$(selector).each(function () {
34845				var th = $(this);
34846				th.on('touchend', function (e) {
34847					var _th = $(e.target).closest('.menu-item');
34848
34849					$('.menu.topest > li').removeClass('hover');
34850					$('.menu_top_block.catalog_block li').removeClass('hover');
34851					$('.bx-breadcrumb-item.drop').removeClass('hover');
34852
34853					if (_th.find('.dropdown-menu').length && !_th.hasClass('hover')) {
34854						e.preventDefault();
34855						e.stopPropagation();
34856						_th.siblings().removeClass('hover');
34857						_th.addClass('hover');
34858						$('.menu-row .dropdown-menu').css({ 'display': 'none', 'opacity': 0 });
34859						if (_th.hasClass('menu-item')) {
34860							_th.closest('.dropdown-menu').css({ 'display': 'block', 'opacity': 1 });
34861						}
34862						if (_th.find('> .wrap > .dropdown-menu')) {
34863							_th.find('> .wrap > .dropdown-menu').css({ 'display': 'block', 'opacity': 1 });
34864						}
34865						else if (_th.find('> .dropdown-menu')) {
34866							_th.find('> .dropdown-menu').css({ 'display': 'block', 'opacity': 1 });
34867						}
34868						CheckTopVisibleMenu();
34869					}
34870					else {
34871						var href = ($(e.target).attr('href') ? $(e.target).attr('href') : $(e.target).closest('a').attr('href'))
34872						if (href && href !== 'undefined')
34873							location.href = href;
34874					}
34875				})
34876			})
34877		}
34878	} else {
34879		$(selector).off();
34880	}
34881}
34882
34883function touchTopMenu(selector) {
34884	if (isMobile) {
34885		if ($(selector).length) {
34886			$(selector).each(function () {
34887				var th = $(this);
34888				th.on('touchend', function (e) {
34889					var _th = $(e.target).closest('li');
34890
34891					$('.menu-item').removeClass('hover');
34892					$('.menu_top_block.catalog_block li').removeClass('hover');
34893					$('.bx-breadcrumb-item.drop').removeClass('hover');
34894
34895					if (_th.hasClass('more') && !_th.hasClass('hover')) {
34896						e.preventDefault();
34897						e.stopPropagation();
34898						_th.siblings().removeClass('hover');
34899						_th.addClass('hover');
34900						$('.menu.topest').css({ 'overflow': 'visible' });
34901					}
34902					else {
34903						var href = ($(e.target).attr('href') ? $(e.target).attr('href') : $(e.target).closest('a').attr('href'))
34904						if (href && href !== 'undefined')
34905							location.href = href;
34906					}
34907				})
34908			})
34909		}
34910	} else {
34911		$(selector).off();
34912	}
34913}
34914
34915function touchLeftMenu(selector) {
34916	if (isMobile) {
34917		if ($(selector).length) {
34918			$(selector).each(function () {
34919				var th = $(this);
34920				th.on('touchend', function (e) {
34921					var _th = $(e.target).closest('li');
34922
34923					$('.menu-item').removeClass('hover');
34924					$('.bx-breadcrumb-item.drop').removeClass('hover');
34925					$('.menu.topest > li').removeClass('hover');
34926
34927					if (_th.hasClass('has-child') && !_th.hasClass('hover')) {
34928						e.preventDefault();
34929						e.stopPropagation();
34930						_th.siblings().removeClass('hover');
34931						_th.addClass('hover');
34932					}
34933					else {
34934						var href = ($(e.target).attr('href') ? $(e.target).attr('href') : $(e.target).closest('a').attr('href'))
34935						if (href && href !== 'undefined')
34936							location.href = href;
34937					}
34938				})
34939			})
34940		}
34941	} else {
34942		$(selector).off();
34943	}
34944}
34945
34946function touchBreadcrumbs(selector) {
34947	if (isMobile) {
34948		if ($(selector).length) {
34949			$(selector).each(function () {
34950				var th = $(this);
34951				th.on('touchend', function (e) {
34952					var _th = $(e.target).closest('.bx-breadcrumb-item');
34953
34954					$('.menu-item').removeClass('hover');
34955					$('.menu.topest > li').removeClass('hover');
34956					$('.menu_top_block.catalog_block li').removeClass('hover');
34957
34958					if (!_th.hasClass('hover')) {
34959						e.preventDefault();
34960						e.stopPropagation();
34961						_th.siblings().removeClass('hover');
34962						_th.addClass('hover');
34963					}
34964					else {
34965						_th.removeClass('hover');
34966						var href = ($(e.target).attr('href') ? $(e.target).attr('href') : $(e.target).closest('a').attr('href'));
34967						if (href && href !== 'undefined')
34968							location.href = href;
34969					}
34970				})
34971			})
34972		}
34973	} else {
34974		$(selector).off();
34975	}
34976}
34977
34978function touchItemBlock(selector) {
34979	/*if(isMobile){
34980		if($(selector).length)
34981		{
34982			$(selector).each(function(){
34983				var th=$(this),
34984					item=th.closest('.catalog_item');
34985				th.on('touchend', function(e) {
34986					if (!item.hasClass('hover')) {
34987						e.preventDefault();
34988						// e.stopPropagation();
34989						item.siblings().removeClass('hover');
34990						item.siblings().blur();
34991						item.closest('.catalog_block').find('.catalog_item').removeClass('hover');
34992						item.addClass('hover');
34993						item.addClass('touch');
34994
34995						var tabsContentHover = th.closest('.tab').attr('data-hover') * 1,
34996							tabsContentUnhoverHover = th.closest('.tab').attr('data-unhover') * 1;
34997
34998						th.closest('.tab').stop().animate({'height': tabsContentUnhoverHover}, 100);
34999						th.closest('.catalog_item').siblings().find('.buttons_block').stop().fadeOut(233)
35000
35001						th.closest('.tab').fadeTo(100, 1);
35002						th.closest('.tab').stop().css({'height': tabsContentHover});
35003						th.closest('.catalog_item').find('.buttons_block').fadeIn(450, 'easeOutCirc');
35004					}
35005				})
35006			})
35007		}
35008	}else{
35009		$(selector).off();
35010	}*/
35011}
35012function touchBasket(selector) {
35013	if (arAsproOptions['THEME']['SHOW_BASKET_ONADDTOCART'] !== 'N') {
35014		if ($(window).outerWidth() > 600) {
35015			$(document).find(selector).on('touchend', function (e) {
35016				if ($(this).parent().find('.basket_popup_wrapp').length && !$(this).hasClass('hover')) {
35017					e.preventDefault();
35018					e.stopPropagation();
35019					$(this).addClass('hover');
35020					$(this).parent().find('.basket_popup_wrapp').slideDown();
35021				}
35022			})
35023		} else {
35024			$(selector).off();
35025		}
35026	}
35027}
35028
35029function showTotalSummItem(popup) {
35030	//show total summ
35031	if (arAsproOptions["THEME"]["SHOW_TOTAL_SUMM_TYPE"] == "ALWAYS" && arAsproOptions["THEME"]["SHOW_TOTAL_SUMM"] == "Y") {
35032		var parent = 'body ';
35033		if (typeof popup === 'string' && popup == 'Y')
35034			parent = '.popup ';
35035		$(parent + '.counter_wrapp .counter_block input.text').each(function () {
35036			var _th = $(this);
35037			if (_th.data('product')) {
35038				var obProduct = _th.data('product');
35039				if (typeof window[obProduct] == 'object')
35040					window[obProduct].setPriceAction('Y');
35041				else
35042					setPriceItem(_th.closest('.main_item_wrapper'), _th.val());
35043			}
35044			else
35045				setPriceItem(_th.closest('.main_item_wrapper'), _th.val());
35046		})
35047	}
35048}
35048
35049
35050function initFull() {
35051	initSelects(document);
35052	initHoverBlock(document);
35053	touchItemBlock('.catalog_item a');
35054	InitOrderCustom();
35055	showTotalSummItem();
35056	basketActions();
35057	orderActions();
35058
35059	checkMobileRegion();
35060}
35061
35062checkMobileRegion = function () {
35063	if ($('.confirm_region').length) {
35064		if (!$('.top_mobile_region').length)
35065			$('<div class="top_mobile_region"><div class="confirm_wrapper"><div class="confirm_region"></div><div class="close_popup"></div></div></div>').insertBefore($('#mobileheader'));
35066		$('.top_mobile_region .confirm_region').html($('.confirm_region').html());
35067
35068		$('.top_mobile_region .close_popup').click(function () {
35069			$(this).remove();
35070			$('.confirm_region').remove();
35071		})
35072	}
35073}
35074if (!funcDefined('orderActions')) {
35075	orderActions = function (e) {
35076		if (arAsproOptions["PAGES"]["ORDER_PAGE"]) {
35077			//phone
35078			if ($('#bx-soa-order input[autocomplete=tel]').length) {
35079				// get property phone
35080				for (var i = 0; i < BX.Sale.OrderAjaxComponent.result.ORDER_PROP.properties.length; ++i) {
35081					if (BX.Sale.OrderAjaxComponent.result.ORDER_PROP.properties[i].IS_PHONE == 'Y') {
35082						var arPropertyPhone = BX.Sale.OrderAjaxComponent.result.ORDER_PROP.properties[i];
35083					}
35084				}
35085
35086				// validate input type=tel
35087				if (typeof (BX.Sale.OrderAjaxComponent) !== 'undefined' && typeof (BX.Sale.OrderAjaxComponent) === 'object' && typeof (arPropertyPhone) == 'object' && arPropertyPhone) {
35088					BX.Sale.OrderAjaxComponent.validatePhone = function (input, arProperty, fieldName) {
35089						if (!input || !arProperty)
35090							return [];
35091
35092						var value = input.value,
35093							errors = [],
35094							name = BX.util.htmlspecialchars(arProperty.NAME),
35095							field = BX.message('SOA_FIELD') + ' "' + name + '"',
35096							re;
35097
35098						if (arProperty.REQUIRED == 'Y' && value.length == 0) {
35099							errors.push(field + ' ' + BX.message('SOA_REQUIRED'));
35100						}
35101
35102						if (arProperty.IS_PHONE == 'Y' && value.length > 0) {
35103							function regexpPhone(value, element, regexp) {
35104								var re = new RegExp(regexp);
35105								return re.test(value);
35106							}
35107
35108							var validPhone = regexpPhone($(input).val(), $(input), arAsproOptions['THEME']['VALIDATE_PHONE_MASK']);
35109
35110							if (!validPhone) {
35111								errors.push(field + ' ' + BX.message('JS_FORMAT_ORDER'));
35112							}
35113						}
35114
35115						return errors;
35116					}
35117
35118					BX.Sale.OrderAjaxComponent.getValidationDataPhone = function (arProperty, propContainer) {
35119						var data = {}, inputs;
35120						switch (arProperty.TYPE) {
35121							case 'STRING':
35122								data.action = 'blur';
35123								data.func = BX.delegate(function (input, fieldName) {
35124									return this.validatePhone(input, arProperty, fieldName);
35125								}, this);
35126
35127								inputs = propContainer.querySelectorAll('input[type=tel]');
35128								if ($(inputs).length) {
35129									data.inputs = inputs;
35130									break;
35131								}
35132						}
35133
35134						return data;
35135					};
35136
35137					BX.Sale.OrderAjaxComponent.bindValidationPhone = function (id, propContainer) {
35138						if (!this.validation.properties || !this.validation.properties[id])
35139							return;
35140
35141						var arProperty = this.validation.properties[id],
35142							data = this.getValidationDataPhone(arProperty, propContainer),
35143							i, k;
35144
35145						if (data && data.inputs && data.action) {
35146							for (i = 0; i < $(data.inputs).length; i++) {
35147								if (BX.type.isElementNode(data.inputs[i])) {
35148									BX.bind(data.inputs[i], data.action, BX.delegate(function () {
35149										this.isValidProperty(data);
35150									}, this));
35151								}
35152								else {
35153									for (k = 0; k < $(data.inputs[i]).length; k++)
35154										BX.bind(data.inputs[i][k], data.action, BX.delegate(function () {
35155											this.isValidProperty(data);
35156										}, this));
35157								}
35158							}
35159						}
35160					};
35161
35162					BX.Sale.OrderAjaxComponent.isValidPropertiesBlock = function (excludeLocation) {
35163						if (!this.options.propertyValidation)
35164							return [];
35165
35166						var props = this.orderBlockNode.querySelectorAll('.bx-soa-customer-field[data-property-id-row]'),
35167							propsErrors = [],
35168							id, propContainer, arProperty, data, i;
35169
35170						for (i = 0; i < props.length; i++) {
35171							id = props[i].getAttribute('data-property-id-row');
35172
35173							if (!!excludeLocation && this.locations[id])
35174								continue;
35175
35176							propContainer = props[i].querySelector('.soa-property-container');
35177							if (propContainer) {
35178								arProperty = this.validation.properties[id];
35179								data = this.getValidationData(arProperty, propContainer);
35180								dataPhone = this.getValidationDataPhone(arProperty, propContainer);
35181								data = $.extend({}, data, dataPhone);
35182
35183								propsErrors = propsErrors.concat(this.isValidProperty(data, true));
35184							}
35185						}
35186
35187						return propsErrors;
35188					};
35189
35190
35191					// create input type=tel
35192					var input = $('input[autocomplete=tel]'),
35193						inputHTML = input[0].outerHTML,
35194						value = input.val(),
35195						newInput = input[0].outerHTML.replace('type="text"', 'type="tel" value="' + value + '"');
35196
35197					if ($(input).length < 2) {
35198						input.hide();
35199						$(newInput).insertAfter(input);
35200					}
35201					showPhoneMask('input[autocomplete=tel][type=tel]');
35202
35203					// change value input type=text when change input type=tel
35204					$('input[autocomplete=tel][type=tel]').on('blur', function () {
35205						var $this = $(this);
35206
35207						var value = $this.val();
35208						$this.parent().find('input[autocomplete=tel][type=text]').val(value);
35209					});
35210
35211					BX.Sale.OrderAjaxComponent.bindValidationPhone(arPropertyPhone.ID, $('input[autocomplete=tel]').parent()[0]);
35212				}
35213			}
35214
35215			if ($('.bx-soa-cart-total').length) {
35216				if (!$('.change_basket').length)
35217					$('.bx-soa-cart-total').prepend('<div class="change_basket">
35217' + BX.message("BASKET_CHANGE_TITLE") + '<a href="' + arAsproOptions["SITE_DIR"] + 'basket/" class="change_link">' + BX.message("BASKET_CHANGE_LINK") + '</a></div>');
35218
35219				if (typeof (BX.Sale.OrderAjaxComponent) == "object") {
35220					if (arAsproOptions['COUNTERS']['USE_FULLORDER_GOALS'] !== 'N') {
35221						if (typeof BX.Sale.OrderAjaxComponent.reachgoalbegin === 'undefined') {
35222							BX.Sale.OrderAjaxComponent.reachgoalbegin = true;
35223							var eventdata = { goal: 'goal_order_begin' };
35224							BX.onCustomEvent('onCounterGoals', [eventdata])
35225						}
35226					}
35227
35228					if (BX.Sale.OrderAjaxComponent.hasOwnProperty("params")) {
35229						$('.bx-soa-cart-total .change_link').attr('href', BX.Sale.OrderAjaxComponent.params.PATH_TO_BASKET);
35230						if (arAsproOptions["PRICES"]["MIN_PRICE"]) {
35231							if (arAsproOptions["PRICES"]["MIN_PRICE"] > Number(BX.Sale.OrderAjaxComponent.result.TOTAL.ORDER_PRICE)) {
35232								$('<div class="fademask_ext"></div>').appendTo($('body'));
35233								location.href = BX.Sale.OrderAjaxComponent.params.PATH_TO_BASKET;
35234							}
35235						}
35236					}
35237
35238					// update oreder auth form
35239					if ($('#bx-soa-auth').length && !$('#bx-soa-auth .redisigned').length) {
35240						// update input USER_LOGIN
35241						if ($('input[name="USER_LOGIN"]').length) {
35242							var $label = $('input[name="USER_LOGIN"]').closest('.bx-authform-formgroup-container').find('.bx-authform-label-container');
35243							if (!$label.find('.bx-authform-starrequired').length) {
35244								$label.html($label.html() + '<span class="bx-authform-starrequired"> *</span>');
35245							}
35246						}
35247
35248						// update input USER_PASSWORD
35249						if ($('input[name="USER_PASSWORD"]').length) {
35250							var $label = $('input[name="USER_PASSWORD"]').closest('.bx-authform-formgroup-container').find('.bx-authform-label-container');
35251							if (!$label.find('.bx-authform-starrequired').length) {
35252								$label.html($label.html() + '<span class="bx-authform-starrequired"> *</span>');
35253							}
35254						}
35255
35256						if ($('input[name="USER_REMEMBER"]').length) {
35257							var $label = $('input[name="USER_REMEMBER"]').attr('id', 'ORDER_AUTH_USER_REMEMBER').closest('label').attr('for', 'ORDER_AUTH_USER_REMEMBER');
35258							var html = $('input[name="USER_REMEMBER"]').attr('id', 'ORDER_AUTH_USER_REMEMBER').wrap('<div id="trem_"></div>').parent().html();
35259							$('#trem_').remove();
35260							$label.html($label.text());
35261							$(html).insertBefore($label).closest('.bx-authform-formgroup-container').addClass('filter');
35262							var html = $('#bx-soa-auth .bx-authform>a').addClass('pull-right').addClass('forgot').wrap('<div id="trem_"></div>').parent().html();
35263							$('#trem_').remove();
35264							$(html).insertAfter($label.closest('.checkbox'));
35265						}
35266
35267						$('#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'));
35268
35269						$('#bx-soa-auth').append('<div class="redisigned hidden></div>');
35270					}
35271
35272					// update oreder register form
35273					if ($('.bx-soa-section-content.reg').length && !$('.bx-soa-section-content.reg .redisigned').length) {
35274						var bRebindRegSubmit = false;
35275
35276						if (arAsproOptions.THEME.LOGIN_EQUAL_EMAIL === 'Y') {
35277							bRebindRegSubmit = true;
35278
35279							// update input NEW_LOGIN
35280							if ($('input[name="NEW_LOGIN"]').length) {
35281								$('input[name="NEW_LOGIN"]').closest('.bx-authform-formgroup-container').hide();
35282							}
35283						}
35284
35285						if (arAsproOptions.THEME.PERSONAL_ONEFIO === 'Y') {
35286							bRebindRegSubmit = true;
35287
35288							// update input NEW_NAME
35289							if ($('input[name="NEW_NAME"]').length) {
35290								$('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>');
35291							}
35292
35293							// update input NEW_LAST_NAME
35294							if ($('input[name="NEW_LAST_NAME"]').length) {
35295								$('input[name="NEW_LAST_NAME"]').closest('.bx-authform-formgroup-container').hide();
35296								$('input[name="NEW_LAST_NAME"]').val(' ');
35297							}
35298						}
35299
35300						if (bRebindRegSubmit) {
35301							// bind new handler for submit button
35302							var $regSubmit = $('#do_register~input[type=submit]');
35303							if ($regSubmit.length) {
35304								BX.unbindAll($regSubmit[0]);
35305								$(document).on('click', '#do_register~input[type=submit]', function (e) {
35306									e.preventDefault();
35307									e.stopImmediatePropagation();
35308
35309									if (arAsproOptions.THEME.LOGIN_EQUAL_EMAIL === 'Y') {
35310										var email = BX.findChild(BX('bx-soa-auth'), { attribute: { 'name': 'NEW_EMAIL' } }, true, false);
35311										var login = BX.findChild(BX('bx-soa-auth'), { attribute: { 'name': 'NEW_LOGIN' } }, true, false);
35312
35313										if (login && email) {
35314											login.value = email.value;
35315										}
35316									}
35317
35318									BX('do_register').value = 'Y';
35319									BX.Sale.OrderAjaxComponent.sendRequest('showAuthForm');
35320								});
35321							}
35322						}
35323
35324						// update captcha
35325						var $captcha = $('.bx-soa-section-content.reg').find('.bx-captcha');
35326						if ($captcha.length) {
35327							$captcha.addClass('captcha_image');
35328							$captcha.append('<div class="captcha_reload"></div>');
35329							$captcha.closest('.bx-authform-formgroup-container').addClass('captcha-row').find('input[name=captcha_w
35329ord]').closest('.bx-authform-input-container').addClass('captcha_input');
35330						}
35331
35332						// update input NEW_NAME && NEW_LAST_NAME
35333						if ($('input[name=NEW_NAME]').length && $('input[name=NEW_LAST_NAME]').length && arAsproOptions.THEME.PERSONAL_ONEFIO !== 'Y') {
35334							if (!$('input[name=NEW_NAME]').closest('.bx-authform-formgroup-container.col-md-6').length) {
35335								$('input[name=NEW_NAME],input[name=NEW_LAST_NAME]').closest('.bx-authform-formgroup-container').addClass('col-md-6');
35336								var html = $('input[name=NEW_LAST_NAME]').closest('.bx-authform-formgroup-container').wrap('<div id="trem_"></div>').parent().html();
35337								$('#trem_').remove();
35338								$(html).insertAfter($('input[name=NEW_NAME]').closest('.bx-authform-formgroup-container').wrap('<div class="row"></div>'));
35339							}
35340						}
35341
35342						// update input NEW_EMAIL && PHONE_NUMBER
35343						if ($('input[name=NEW_EMAIL]').length && $('input[name=PHONE_NUMBER]').length) {
35344							if (!$('input[name=PHONE_NUMBER]').closest('.bx-authform-formgroup-container.col
35344-md-6').length) {
35345								$('input[name=NEW_EMAIL],input[name=PHONE_NUMBER]').closest('.bx-authform-formgroup-container').addClass('col-md-6');
35346								var html = $('input[name=PHONE_NUMBER]').closest('.bx-authform-formgroup-container').wrap('<div id="trem_"></div>').parent().html();
35347								$('#trem_').remove();
35348								$(html).insertAfter($('input[name=NEW_EMAIL]').closest('.bx-authform-formgroup-container').wrap('<div class="row"></div>'));
35349							}
35350						}
35351
35352						// update input NEW_PASSWORD && NEW_PASSWORD_CONFIRM
35353						if ($('input[name=NEW_PASSWORD]').length && $('input[name=NEW_PASSWORD_CONFIRM]').length) {
35354							if (!$('input[name=NEW_PASSWORD]').closest('.bx-authform-formgroup-container.col-md-6').length) {
35355								$('input[name=NEW_PASSWORD],input[name=NEW_PASSWORD_CONFIRM]').closest('.bx-authform-formgroup-container').addClass('col-md-6');
35356								var html = $('input[name=NEW_PASSWORD_CONFIRM]').closest('.bx-authform-formgroup-container').wrap('<div id="trem_"></div>').parent().html();
35357								$('#trem_').remove();
35358								$(html).insertAfter($('input[name=NEW_PASSWORD]').closest('.bx-authform-formgroup-container').wrap('<div class="row"></div>'));
35359							}
35360						}
35361
35362						// update input PHONE_NUMBER
35363						if ($('input[name=PHONE_NUMBER]').length) {
35364							var input = $('input[name=PHONE_NUMBER]'),
35365								inputHTML = input[0].outerHTML,
35366								value = input.val(),
35367								newInput = input[0].outerHTML.replace('type="text"', 'type="tel" value="' + value + '"');
35368
35369							if ($(input).length < 2) {
35370								input.hide();
35371								$(newInput).insertAfter(input);
35372
35373								showPhoneMask('input[name=PHONE_NUMBER][type=tel]');
35374
35375								$('input[name=PHONE_NUMBER][type=tel]').on('blur', function () {
35376									var $this = $(this);
35377									var value = $this.val();
35378									$this.parent().find('input[name=PHONE_NUMBER][type=text]').val(value);
35379								});
35380
35381								var $label = $('input[name=PHONE_NUMBER][type=tel]').closest('.bx-authform-formgroup-container').find('.bx-authform-label-container');
35382								$label.html(BX.message('ORDER_PHONE_LABEL') + ($label.find('.bx-authform-starrequired').length ? '<span class="bx-authform-starrequired"> *</span>' : ''));
35383							}
35384						}
35385
35386						$('.bx-soa-section-content.reg').append('<div class="redisigned hidden></div>');
35387					}
35388
35389					if ($('.bx-soa-cart-total-line-total').length && arAsproOptions["THEME"]["SHOW_LICENCE"] == "Y") {
35390						if (typeof (e) === 'undefined')
35391							BX.Sale.OrderAjaxComponent.state_licence = (arAsproOptions['THEME']['LICENCE_CHECKED'] == 'Y' ? 'checked' : '');
35392
35393						if (!$('.licence_block.filter').length) {
35394							$('<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'));
35395
35396							$(document).on('click', '.bx-soa .licence_block label.license', function () {
35397								var id = $(this).data('for');
35398								$('.bx-soa .licence_block label.error').addClass('hidden');
35399								if (!$('input[name=' + id + ']').prop('checked')) {
35400									$('input[name=' + id + ']').prop('checked', 'checked');
35401									BX.Sale.OrderAjaxComponent.state_licence = 'checked';
35402								}
35403								else {
35404									$('input[name=' + id + ']').prop('checked', '');
35405									BX.Sale.OrderAjaxComponent.state_licence = '';
35406								}
35407							})
35408
35409							$(document).on('click', '.lic_condition a', function () {
35410								if (BX.hasClass(BX('bx-soa-order'), 'orderform--v1')) {
35411									if (BX.Sale.OrderAjaxComponent.isValidForm()) {
35412										BX.Sale.OrderAjaxComponent.animateScrollTo($('.licence_block')[0], 800, 50);
35413									}
35414								}
35415								else {
35416									var iCountErrors = BX.Sale.OrderAjaxComponent.isValidPropertiesBlock().length;
35417									if (!BX.Sale.OrderAjaxComponent.activeSectionId || !iCountErrors) {
35418										BX.Sale.OrderAjaxComponent.animateScrollTo($('.licence_block')[0], 800, 50);
35419									}
35420								}
35421							})
35422						}
35423
35424						$('#bx-soa-orderSave, .bx-soa-cart-total-button-container').addClass('lic_condition');
35425
35426						if (typeof (BX.Sale.OrderAjaxComponent.oldClickOrderSaveAction) === "undefined" && typeof (BX.Sale.OrderAjaxComponent.clickOrderSaveAction) !== 'undefined') {
35427							BX.Sale.OrderAjaxComponent.oldClickOrderSaveAction = BX.Sale.OrderAjaxComponent.clickOrderSaveAction;
35428							BX.Sale.OrderAjaxComponent.clickOrderSaveAction = function (event) {
35429								if ($('input[name="licenses_order"]').prop('checked')) {
35430									$('.bx-soa .licence_block label.error').addClass('hidden');
35431
35432									if (BX.Sale.OrderAjaxComponent.isValidForm()) {
35433										if (typeof BX.Sale.OrderAjaxComponent.allowOrderSave == 'function')
35434											BX.Sale.OrderAjaxComponent.allowOrderSave();
35435										if (typeof BX.Sale.OrderAjaxComponent.doSaveAction == 'function')
35436											BX.Sale.OrderAjaxComponent.doSaveAction();
35437										else
35438											BX.Sale.OrderAjaxComponent.oldClickOrderSaveAction(event);
35439									}
35440								}
35441								else {
35442									$('.bx-soa .licence_block label.error').removeClass('hidden');
35443								}
35444							}
35445							if (BX.Sale.OrderAjaxComponent.orderSaveBlockNode.querySelector('.checkbox')) {
35446								if (typeof browser == 'object') {
35447									if ('msie' in browser && browser.msie)
35448										$(BX.Sale.OrderAjaxComponent.orderSaveBlockNode.querySelector('.checkbox')).remove();
35449									else
35450										BX.Sale.OrderAjaxComponent.orderSaveBlockNode.querySelector('.checkbox').remove();
35451								}
35452							}
35453							BX.unbindAll(BX.Sale.OrderAjaxComponent.totalInfoBlockNode.querySelector('a.btn-order-save'));
35454							BX.unbindAll(BX.Sale.OrderAjaxComponent.mobileTotalBlockNode.querySelector('a.btn-order-save'));
35455							BX.unbindAll(BX.Sale.OrderAjaxComponent.orderSaveBlockNode.querySelector('a'));
35456							BX.bind(BX.Sale.OrderAjaxComponent.totalInfoBlockNode.querySelector('a.btn-order-save'), 'click', BX.proxy(BX.Sale.OrderAjaxComponent.clickOrderSaveAction, BX.Sale.OrderAjaxComponent));
35457							BX.bind(BX.Sale.OrderAjaxComponent.mobileTotalBlockNode.querySelector('a.btn-order-save'), 'click', BX.proxy(BX.Sale.OrderAjaxComponent.clickOrderSaveAction, BX.Sale.OrderAjaxComponent));
35458							BX.bind(BX.Sale.OrderAjaxComponent.orderSaveBlockNode.querySelector('a'), 'click', BX.proxy(BX.Sale.OrderAjaxComponent.clickOrderSaveAction, BX.Sale.OrderAjaxComponent));
35459						}
35460					}
35461
35462					// fix hide total block
35463					$(window).scroll();
35464
35465					if (checkCounters() && typeof (BX.Sale.OrderAjaxComponent.oldSaveOrder) === "undefined") {
35466						var saveFunc = typeof (BX.Sale.OrderAjaxComponent.saveOrder) !== 'undefined' ? 's
35466aveOrder' : 'saveOrderWithJson';
35467						if (typeof (BX.Sale.OrderAjaxComponent[saveFunc]) !== 'undefined') {
35468							BX.Sale.OrderAjaxComponent.oldSaveOrder = BX.Sale.OrderAjaxComponent[saveFunc];
35469							BX.Sale.OrderAjaxComponent[saveFunc] = function (result) {
35470								var res = BX.parseJSON(result);
35471								if (res && res.order) {
35472									if (!res.order.SHOW_AUTH) {
35473										if (res.order.REDIRECT_URL && res.order.REDIRECT_URL.length && (!res.order.ERROR || BX.util.object_keys(res.order.ERROR).length < 1)) {
35474											if ((arMatch = res.order.REDIRECT_URL.match(/ORDER_ID\=[^&=]*/g)) && arMatch.length && (_id = arMatch[0].replace(/ORDER_ID\=/g, '', arMatch[0]))) {
35475												$.ajax({
35476													url: arAsproOptions['SITE_DIR'] + "ajax/check_order.php",
35477													dataType: "json",
35478													type: "POST",
35479													data: { "ID": _id },
35480													success: function (id) {
35481														if (parseInt(id)) {
35482															purchaseCounter(parseInt(id), BX.message('FULL_ORDER'), function (d) {
35483																if (typeof localStorage !== 'undefined' && typeof d === 'object') {
35484																	localStorage.setItem('gtm_e_' + _id, JSON.stringify(d));
35485																}
35486																BX.Sale.OrderAjaxComponent.oldSaveOrder(result);
35487															});
35488														}
35489														else {
35490															BX.Sale.OrderAjaxComponent.oldSaveOrder(result);
35491														}
35492													},
35493													error: function () {
35494														BX.Sale.OrderAjaxComponent.oldSaveOrder(result);
35495													}
35496												})
35497											}
35498											else {
35499												BX.Sale.OrderAjaxComponent.oldSaveOrder(result);
35500											}
35501										}
35502										else {
35503											BX.Sale.OrderAjaxComponent.oldSaveOrder(result);
35504										}
35505									}
35506									else {
35507										BX.Sale.OrderAjaxComponent.oldSaveOrder(result);
35508									}
35509								}
35510								else {
35511									BX.Sale.OrderAjaxComponent.oldSaveOrder(result);
35512								}
35513							}
35514						}
35515					}
35516
35517					if ($('#bx-soa-order-form .captcha-row').length) {
35518						if (window.asproRecaptcha && window.asproRecaptcha.key && window.asproRecaptcha.params.recaptchaSize == 'invisible') {
35519							$('#bx-soa-order-form .captcha-row').addClass('invisible');
35520							if (asproRecaptcha.params.recaptchaLogoShow === 'n') {
35521								$('#bx-soa-order-form .captcha-row').addClass('logo_captcha_n');
35522							}
35523						}
35524					}
35525
35526					if ($('#bx-soa-order-form .captcha-row.invisible').length) {
35527						if (typeof (BX.Sale.OrderAjaxComponent.oldSendRequest) === "undefined" && typeof (BX.Sale.OrderAjaxComponent.sendRequest) !== 'undefined') {
35528							var tmpAction, tmpActionData;
35529							BX.Sale.OrderAjaxComponent.oldSendRequest = BX.Sale.OrderAjaxComponent.sendRequest;
35530							BX.Sale.OrderAjaxComponent.sendRequest = function (action, actionData) {
35531								var bSend = true;
35532
35533								if ($('#bx-soa-order-form .captcha-row.invisible').length) {
35534									if (window.renderRecaptchaById && window.asproRecaptcha && window.asproRecaptcha.key) {
35535										if (window.asproRecaptcha.params.recaptchaSize == 'invisible') {
35536											var form = BX('bx-soa-order-form');
35537											if ($(form).find('.g-recaptcha').length) {
35538												if ($(form).find('.g-recaptcha-response').val()) {
35539													bSend = true;
35540												}
35541												else {
35542													if (typeof grecaptcha != 'undefined') {
35543														grecaptcha.execute($(form).find('.g-recaptcha').data('widgetid'));
35544														bSend = false;
35545													}
35546													else {
35547														bSend = false;
35548													}
35549												}
35550											}
35551										}
35552									}
35553								}
35554
35555								if (bSend) {
35556									BX.Sale.OrderAjaxComponent.oldSendRequest(action, actionData);
35557								}
35558								else {
35559									tmpAction = action;
35560									tmpActionData = actionData;
35561								}
35562							}
35563
35564							$(document).on('submit', '#bx-soa-order-form', function (e) {
35565								e.preventDefault();
35566
35567								if (typeof tmpAction !== 'undefined' || typeof tmpActionData !== 'undefined') {
35568									BX.Sale.OrderAjaxComponent.sendRequest(tmpAction, tmpActionData);
35569									tmpAction = undefined;
35570									tmpActionData = undefined;
35571								}
35572							});
35573						}
35574					}
35575				}
35576
35577				$('.bx-ui-sls-quick-locations.quick-locations').on('click', function () {
35578					$(this).siblings().removeClass('active');
35579					$(this).addClass('active');
35580				})
35581			}
35582		}
35583	}
35584}
35585
35586if (!funcDefined('basketActions')) {
35587	basketActions = function () {
35588		if (arAsproOptions["PAGES"]["BASKET_PAGE"]) {
35589			checkMinPrice();
35590
35591			//remove4Cart
35592			if (typeof (BX.Sale) !== 'undefined' && typeof (BX.Sale) === 'object') {
35593				if (typeof (BX.Sale.BasketComponent) !== 'undefined' && typeof (BX.Sale.BasketComponent) === 'object') {
35594					$(document).on('click', '.basket-item-actions-remove', function () {
35595						var basketID = $(this).closest('.basket-items-list-item-container').data('id');
35596						delFromBasketCounter(BX.Sale.BasketComponent.items[basketID].PRODUCT_ID);
35597					})
35598				}
35599			}
35600
35601			if (location.hash) {
35602				var hash = location.hash.substring(1);
35603				if ($('#basket_toolbar_button_' + hash).length)
35604					$('#basket_toolbar_button_' + hash).trigger('click');
35605
35606				if ($('.basket-items-list-header-filter a[data-filter="' + hash + '"]').length)
35607					$('.basket-items-list-header-filter a[data-filter="' + hash + '"]')[0].click();
35608			}
35609			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>';
35610
35611			$('.bx_sort_container').append('<div class="top_control basket_action"><span style="opacity:0;
35611" class="delete_all colored_theme_hover_text remove_all_basket">' + svg_cross + BX.message("BASKET_CLEAR_ALL_BUTTON") + '</span></div>');
35612			if ($('.basket-items-list-header-filter').length) {
35613				$('.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>');
35614
35615				var cur_index = $('.basket-items-list-header-filter > a.active').index();
35616				//fix delayed
35617				if (cur_index == 3)
35618					cur_index = 2;
35619
35620				if ($('.basket-items-list-header-filter > a.active').data('filter') == 'all')
35621					cur_index = 'all';
35622
35623				$('.basket-items-list-header-filter .top_control .delete_all').data("type", cur_index);
35624
35625				$('.basket-items-list-header-filter > a').on('click', function () {
35626					var index = $(this).index();
35627
35628					//fix delayed
35629					if (index == 3)
35630						index = 2;
35631
35632					if ($(this).data('filter') == 'all')
35633						index = 'all';
35634
35635					$('.basket-items-list-header-filter .top_control .delete_all').data("type", index);
35636				});
35637			}
35638			else {
35639				var cur_index = $('.bx_sort_container a.current').index();
35640				$('.bx_sort_container .top_control .delete_all').data("type", cur_index);
35641				if ($('.bx_ordercart > div:eq(' + cur_index + ') table tbody tr td.item').length)
35642					$('.bx_sort_container .top_control .delete_all').css('opacity', 1);
35643
35644				$('.bx_ordercart .bx_ordercart_coupon #coupon').wrap('<div class="input"></div>');
35645
35646				$('.bx_sort_container > a').on('click', function () {
35647					var index = $(this).index();
35648					$('.bx_sort_container .top_control .delete_all').data("type", index);
35649
35650					if ($('.bx_ordercart > div:eq(' + index + ') table tbody tr td.item').length)
35651						$('.bx_sort_container .top_control .delete_all').css('opacity', 1);
35652					else
35653						$('.bx_sort_container .top_control .delete_all').css('opacity', 0);
35654				});
35655			}
35656
35657
35658			$('.basket_print').on('click', function () {
35659				// window.open(location.pathname+"?print=Y",'_blank');
35660				window.print();
35661			});
35662
35663			$('.delete_all').on('click', function () {
35664				if (arAsproOptions['COUNTERS']['USE_BASKET_GOALS'] !== 'N') {
35665					var eventdata = { goal: 'goal_basket_clear', params: { type: $(this).data('type') } };
35666					BX.onCustomEvent('onCounterGoals', [eventdata]);
35667				}
35668				$.post(arAsproOptions['SITE_DIR'] + "ajax/action_basket.php", "TYPE=" + $(this).data('type') + "&CLEAR_ALL=Y", $.proxy(function (data) {
35669					location.reload();
35670				}));
35671			});
35672
35673			$('.bx_item_list_section .bx_catalog_item').sliceHeight({ row: '.bx_item_list_slide', item: '.bx_catalog_item' });
35674
35675			BX.addCustomEvent('onAjaxSuccess', function () {
35676				checkMinPrice();
35677
35678				var errorText = $.trim($('#warning_message').text());
35679				$('#basket_items_list .error_text').detach();
35680				if (errorText != '') {
35681					$('#warning_message').hide().text('');
35682					$('#basket_items_list').prepend('<div class="error_text">' + errorText + '</div>');
35683				}
35684			});
35685			$(document).on('click', '.bx_ordercart_order_pay_center .checkout, .basket-checkout-section-inner .basket-btn-checkout', function () {
35686				if (checkCounters('google')) {
35687					checkoutCounter(1, 'start order');
35688				}
35689			})
35690		}
35691	}
35692}
35693
35694if (!funcDefined('checkMinPrice')) {
35695	checkMinPrice = function () {
35696		if (arAsproOptions["PAGES"]["BASKET_PAGE"]) {
35697			var summ_raw = 0,
35698				summ = 0;
35699			if ($('#allSum_FORMATED').length) {
35700				summ_raw = $('#allSum_FORMATED').text().replace(/[^0-9\.,]/g, '');
35701				summ = parseFloat(summ_raw);
35702				if ($('#basket_items').length) {
35703					var summ = 0;
35704					$('#basket_items tr').each(function () {
35705						if (typeof ($(this).data('item-price')) !== 'undefined' && $(this).data('item-price'))
35706							summ += $(this).data('item-price') * $(this).find('#QUANTITY_INPUT_' + $(this).attr('id')).val();
35707					})
35708				}
35709				if (!$('.catalog_back').length)
35710					$('.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>');
35711			}
35712
35713			if (arAsproOptions["THEME"]["SHOW_ONECLICKBUY_ON_BASKET_PAGE"] == "Y")
35714				$('.basket-coupon-section').addClass('smallest');
35715
35716			if (typeof BX.Sale !== "undefined") {
35717				if (typeof BX.Sale.BasketComponent !== "undefined" && typeof BX.Sale.BasketComponent.result !== "undefined")
35718					summ = BX.Sale.BasketComponent.result.allSum;
35719			}
35720
35721			if (arAsproOptions["PRICES"]["MIN_PRICE"]) {
35722				if (arAsproOptions["PRICES"]["MIN_PRICE"] > summ) {
35723					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>';
35724					if ($('.oneclickbuy.fast_order').length)
35725						$('.oneclickbuy.fast_order').remove();
35726
35727					if ($('.basket-checkout-container').length) {
35728						if (!$('.icon_error_wrapper').length) {
35729							$('.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>');
35730						}
35731					}
35732					else {
35733						if (!$('.icon_error_wrapper').length && typeof jsPriceFormat !== 'undefined') {
35734							$('.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>');
35735						}
35736						if ($('.bx_ordercart_order_pay .checkout').length)
35737							$('.bx_ordercart_order_pay .checkout').remove();
35738					}
35739				} else {
35740					if ($('.icon_error_wrapper').length)
35741						$('.icon_error_wrapper').remove();
35742
35743					if ($('.basket-checkout-container').length) {
35744						if (!$('.oneclickbuy.fast_order').length && arAsproOptions["THEME"]["SHOW_ONECLICKBUY_ON_BASKET_PAGE"] == "Y" && !$('.basket-btn-checkout.disabled').length)
35745							$('.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>');
35746					}
35747					else {
35748						if ($('.bx_ordercart_order_pay .checkout').length)
35749							$('.bx_ordercart .bx_ordercart_order_pay .checkout').css('opacity', '1');
35750						else
35751							$('.bx_ordercart_order_pay_center').append('<a href="javascript:void(0)" onclick="checkOut();" class="checkout" style="opacity: 1;">' + BX.message("BASKET_ORDER_BUTTON") + '</a>');
35752						if (!$('.oneclickbuy.fast_order').length && arAsproOptions["THEME"]["SHOW_ONECLICKBUY_ON_BASKET_PAGE"] == "Y")
35753							$('.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>');
35754					}
35755				}
35756			} else {
35757				if ($('.basket-checkout-container').length) {
35758					if (!$('.oneclickbuy.fast_order').length && arAsproOptions["THEME"]["SHOW_ONECLICKBUY_ON_BASKET_PAGE"] == "Y" && !$('.basket-btn-checkout.disabled').length)
35759						$('.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>');
35760				}
35761				else {
35762					$('.bx_ordercart .bx_ordercart_order_pay .checkout').css('opacity', '1');
35763					if (!$('.oneclickbuy.fast_order').length && arAsproOptions["THEME"]["SHOW_ONECLICKBUY_ON_BASKET_PAGE"] == "Y")
35764						$('.bx_ordercart_order_pay_center').append('<span class="oneclickbuy btn btn-lg fast_order btn-trans
35764parent-border-color" onclick="oneClickBuyBasket()">' + BX.message("BASKET_QUICK_ORDER_BUTTON") + '</span>');
35765				}
35766			}
35767
35768			$('#basket-root .basket-checkout-container .basket-checkout-section .basket-checkout-block .basket-btn-checkout');
35769			$('#basket-root .basket-checkout-container').addClass('visible');
35770		}
35771	}
35772}
35773
35774var isFrameDataReceived = false;
35775if (typeof window.frameCacheVars !== "undefined") {
35776	BX.addCustomEvent("onFrameDataReceived", function (json) {
35777		initFull();
35778
35779		CheckTopMenuPadding();
35780		CheckTopMenuOncePadding();
35781		CheckTopMenuDotted();
35782
35783		CheckSearchWidth();
35784
35785		checkLinkedArticles();
35786
35787		if ($('.logo-row.v2').length) {
35788			$(window).resize(); // need to check resize flexslider & menu
35789			setTimeout(function () {
35790				CheckTopMenuDotted();
35791			}, 100);
35792		}
35793
35794		if (funcDefined('setNewHeader')) {
35795			if ((BX.message('TYPE_SKU') != 'TYPE_1' || BX.message('HAS_SKU_PROPS') != 'Y')) {
35796				setNewHeader();
35797			} else {
35798				var objNameWrapper = $('.bx_catalog_item_scu[id]');
35799				if (objNameWrapper.length) {
35800					var id = 'ob' + objNameWrapper.attr('id').replace('_skudiv', '');
35801					if (id && window[id] !== undefined) {
35802						var obj = window[id].offers[window[id].offerNum];
35803						if (obj !== undefined) {
35804							setNewHeader(obj);
35805						}
35806					}
35807				}
35808			}
35809		}
35810
35811		isFrameDataReceived = true;
35812	});
35813} else {
35814	$(document).ready(initFull);
35815}
35816
35817if (!funcDefined('setHeightBlockSlider')) {
35818	setHeightBlockSlider = function () {
35819		$(document).find('.specials.tab_slider_wrapp .tabs_content > li.cur').equalize({ children: '.item-title' });
35820		$(document).find('.specials.tab_slider_wrapp .tabs_content > li.cur').equalize({ children: '.item_info' });
35821		$(document).find('.specials.tab_slider_wrapp .tabs_content > li.cur').equalize({ children: '.catalog_item' });
35822
35823		var sliderWidth = $(document).find('.specials.tab_slider_wrapp').outerWidth();
35824
35825		var iCountTabs = $(document).find('.specials.tab_slider_wrapp .tabs_content > li.cur').length;
35826
35827		if (iCountTabs <= 1) {
35828			$(document).find('.specials.tab_slider_wrapp .tabs_content > li.cur').css('height', '');
35829
35830			var itemsButtonsHeight = 0;
35831			if ($(document).find('.specials.tab_slider_wrapp .tabs_content .tab.cur .tabs_slider li .footer_button').length) {
35832				$(document).find('.specials.tab_slider_wrapp .tabs_content .tab.cur .tabs_slider li .footer_button').css('height', 'auto');
35833				itemsButtonsHeight = $(document).find('.specials.tab_slider_wrapp .tabs_content .tab.cur .tabs_slider li .footer_button').height();
35834				$(document).find('.specials.tab_slider_wrapp .tabs_content .tab.cur .tabs_slider li .footer_button').css('height', '');
35835			}
35836			var tabsContentUnhover = $(document).find('.specials.tab_slider_wrapp .tabs_content .tab.cur').height() * 1;
35837			var tabsContentHover = tabsContentUnhover + itemsButtonsHeight + 50;
35838			$(document).find('.specials.tab_slider_wrapp .tabs_content .tab.cur').attr('data-unhover', tabsContentUnhover);
35839			$(document).find('.specials.tab_slider_wrapp .tabs_content .tab.cur').attr('data-hover', tabsContentHover);
35840			$(document).find('.specials.tab_slider_wrapp .tabs_content').height(tabsContentUnhover);
35841			$(document).find('.specials.tab_slider_wrapp .tabs_content .tab.cur .flex-viewport').height(tabsContentUnhover);
35842		}
35843		else {
35844			$(document).find('.specials.tab_slider_wrapp .tabs_content > li.cur').each(function () {
35845				var _th = $(this);
35846				_th.css('height', '');
35847
35848				var itemsButtonsHeight = 0;
35849				if (_th.find('.tabs_slider li .footer_button').length) {
35850					_th.find('.tabs_slider li .footer_button').css('height', 'auto');
35851					itemsButtonsHeight = _th.find('.tabs_slider li .footer_button').height();
35852					_th.find('.tabs_slider li .footer_button').css('height', '');
35853				}
35854
35855				var tabsContentUnhover = _th.height() * 1;
35856				var tabsContentHover = tabsContentUnhover + itemsButtonsHeight + 50;
35857				_th.attr('data-unhover', tabsContentUnhover);
35858				_th.attr('data-hover', tabsContentHover);
35859				_th.parent().height(tabsContentUnhover);
35860				_th.find('.flex-viewport').height(tabsContentUnhover);
35861
35862			})
35863		}
35864	}
35865}
35866
35867if (!funcDefined('checkTopFilter')) {
35868	checkTopFilter = function () {
35869		/*if(window.matchMedia('(max-width: 991px)').matches){
35870			//if($('.group_description_block.top').length){
35871				var top_pos=$('.adaptive_filter').position().top;
35872				$('.bx_filter.bx_filter_vertical').css({'top':top_pos+43});
35873			//}
35874		}*/
35875	}
35876}
35877
35878if (!funcDefined('checkStickyFooter')) {
35879	checkStickyFooter = function () {
35880		try {
35881			ignoreResize.push(true);
35882			$('#content').css('min-height', '');
35883			var contentTop = $('#content').offset().top;
35884			var contentBottom = contentTop + $('#content').outerHeight();
35885			var footerTop = 0;
35886			if ($('footer').length)
35887				footerOffset = $('footer').offset().top;
35888
35889			$('#content').css('min-height', $(window).height() - contentTop - (footerTop - contentBottom) - $('footer').outerHeight() + 'px');
35890			ignoreResize.pop();
35891		}
35892		catch (e) { console.error(e); }
35893	}
35894}
35895
35896if (!funcDefined('checkLinkedArticles')) {
35897	checkLinkedArticles = function () {
35898		try {
35899			if ($('.linked-blog-list.content .item-views').length) {
35900				var mobileRow = $('.linked-blog-list').data('mobile_row'),
35901					desktopRow = $('.linked-blog-list').data('desktop_row'),
35902					parentBlock = $('.ajax_load .js_append'),
35903					widthRow = parentBlock.getFloatWidth(),
35904					elementWidthRow = parentBlock.find('> .item:eq(0)').getFloatWidth(),
35905					elementsCount = parentBlock.find('> .item').length,
35906					slice = Math.floor(widthRow / elementWidthRow),
35907					rowInsertCount = Math.floor(elementsCount / slice),
35908					bCalculateRows = false;
35909				if (window.matchMedia('(max-width: 767px)').matches) {
35910					if (!mobileRow && desktopRow) {
35911						mobileRow = desktopRow;
35912					}
35913					if (mobileRow && mobileRow <= rowInsertCount) {
35914						rowInsertCount = slice * mobileRow;
35915						bCalculateRows = true;
35916					}
35917				} else {
35918					if (desktopRow && desktopRow <= rowInsertCount) {
35919						rowInsertCount = slice * desktopRow;
35920						bCalculateRows = true;
35921					}
35922				}
35923				if (!bCalculateRows) {
35924					rowInsertCount = elementsCount;
35925				}
35926
35927				$('.linked-blog-list').insertAfter(parentBlock.find('> .item:eq(' + (rowInsertCount - 1) + ')'));
35928				setTimeout(function () {
35929					$('.linked-blog-list').addClass('visible');
35930				}, 0);
35931			}
35932		}
35933		catch (e) { console.error(e); }
35934	}
35935}
35936
35937/* EVENTS */
35938var timerResize = false, ignoreResize = [];
35939$(window).resize(function () {
35940	CheckPopupTop();
35941	checkLinkedArticles();
35942
35943	// here immediate functions
35944	if (!ignoreResize.length) {
35945		if (timerResize) {
35946			clearTimeout(timerResize);
35947			timerResize = false;
35948		}
35949		timerResize = setTimeout(function () {
35950			// here delayed functions in event
35951			BX.onCustomEvent('onWindowResize', false);
35952		}, 50);
35953	}
35954});
35955
35956var timerScroll = false, ignoreScroll = [], documentScrollTopLast = $(document).scrollTop(), startScroll = 0;
35957$(window).scroll(function () {
35958	CheckPopupTop();
35959	// here immediate functions
35960	documentScrollTopLast = $(document).scrollTop();
35961	SetFixedAskBlock();
35962	/*if($('.wrapper1.mfixed_Y.mfixed_view_scroll_top #mobileheader').length && window.matchMedia('(max-width: 991px)').matches)
35963	{
35964		if(documentScrollTopLast > startScroll)
35965			$('.wrapper1.mfixed_Y.mfixed_view_scroll_top #mobileheader').removeClass('fixed');
35966		else
35967			$('.wrapper1.mfixed_Y.mfixed_view_scroll_top #mobileheader').addClass('fixed');
35968		startScroll = documentScrollTopLast;
35969	}*/
35970
35971	if (!ignoreScroll.length) {
35972		if (timerScroll) {
35973			clearTimeout(timerScroll);
35974			timerScroll = false;
35975		}
35976		timerScroll = setTimeout(function () {
35977			// here delayed functions in event
35978			BX.onCustomEvent('onWindowScroll', false);
35979		}, 50);
35980	}
35981});
35982
35983BX.addCustomEvent('onWindowResize', function (eventdata) {
35984	try {
35985		ignoreResize.push(true);
35986
35987		CheckTopMenuPadding();
35988		CheckTopMenuOncePadding();
35989		CheckSearchWidth();
35990
35991		CheckTabActive();
35992		CheckTopMenuFullCatalogSubmenu();
35993		CheckHeaderFixedMenu();
35994
35995		CheckTopMenuDotted();
35996		if ($('nav.mega-menu.sliced').length)
35997			$('nav.mega-menu.sliced').removeClass('initied');
35998
35999
36000		CheckTopVisibleMenu();
36001
36002		checkScrollToTop();
36003		CheckObjectsSizes();
36004
36005		CheckFlexSlider();
36006		initSly();
36007
36008		// checkVerticalMobileFilter();
36009
36010		checkMobilePhone();
36011		checkTopFilter();
36012		checkMobileFilter();
36013
36014		if (arAsproOptions['THEME']['COMPACT_FOOTER_MOBILE'] == 'Y') {
36015			if (window.matchMedia('(max-width:767px)').matches) {
36016				$('footer').addClass('mobile');
36017				$('.bottom-menu .items>.wrap_compact_mobile').addClass('accordion-body collapse');
36018				$('.bottom-menu .items>.item.childs').attr('data-toggle', 'collapse');
36019			} else {
36020				$('footer').removeClass('mobile');
36021				$('.bottom-menu .items>.wrap_compact_mobile').removeClass('accordion-body collapse');
36022				$('.bottom-menu .items>.item.childs').removeAttr('data-toggle');
36023			}
36024		}
36025
36026		if (typeof window['stickySidebar'] !== 'undefined') {
36027			if (window.matchMedia('(max-width: 991px)').matches) {
36028				window['stickySidebar'].destroy();
36029			}
36030			else {
36031				window['stickySidebar'].bindEvents();
36032			}
36033		}
36034
36035		if ($('.flexslider.wsmooth').length) {
36036			$('.flexslider.wsmooth').each(function () {
36037				$(this).data('flexslider').smoothHeight();
36038			});
36039		}
36040
36041		if (window.matchMedia('(min-width: 767px)').matches)
36042			$('.wrapper_middle_menu.wrap_menu').removeClass('mobile');
36043
36044		if (window.matchMedia('(max-width: 767px)').matches)
36045			$('.wrapper_middle_menu.wrap_menu').addClass('mobile');
36046
36047
36048		if ($("#basket_form").length && $(window).outerWidth() <= 600) {
36049			$("#basket_form .tabs_content.basket > li.cur td").each(function () { $(this).css("width", ""); });
36050		}
36051
36052		$(".bx_filter_section .bx_filter_select_container").each(function () {
36053			var prop_id = $(this).closest('.bx_filter_parameters_box').attr('property_id');
36054			if ($('#smartFilterDropDown' + prop_id).length) {
36055				$('#smartFilterDropDown' + prop_id).css("max-width", $(this).width());
36056			}
36057		})
36058
36059		if (window.matchMedia('(min-width: 768px)').matches) {
36060			$('.bx_filter .scrollbar').removeClass('mobile-scroll');
36061			$('.bx_filter .srollbar-custom').removeClass('mobile-scroll');
36062			$('.bx_filter .bx_filter_section form .bx_filter_parameters').removeClass('mobile-scroll');
36063			InitScrollBar();
36064			InitCustomScrollBar();
36065		}
36066
36067		if (window.matchMedia('(max-width: 767px)').matches) {
36068			$('.bx_filter .scrollbar').addClass('mobile-scroll');
36069			$('.bx_filter .srollbar-custom').addClass('mobile-scroll');
36070			$('.bx_filter .bx_filter_section form .bx_filter_parameters').addClass('mobile-scroll');
36071			if ($('.bx_filter .mobile-scroll.scrollbar').length)
36072				$('.bx_filter .mobile-scroll.scrollbar').mCustomScrollbar("destroy");
36073			if ($('.bx_filter .mobile-scroll.srollbar-custom').length)
36074				$('.bx_filter .mobile-scroll.srollbar-custom').mCustomScrollbar("destroy");
36075		}
36076
36077	}
36078	catch (e) { }
36079	finally {
36080		ignoreResize.pop();
36081	}
36082});
36083
36084BX.addCustomEvent('onWindowScroll', function (eventdata) {
36085	try {
36086		ignoreScroll.push(true);
36087	}
36088	catch (e) { }
36089	finally {
36090		ignoreScroll.pop();
36091	}
36092});
36093
36094BX.addCustomEvent('onSlideInit', function (eventdata) {
36095	try {
36096		ignoreResize.push(true);
36097		if (eventdata) {
36098			var slider = eventdata.slider;
36099			if (slider) {
36100				if (slider.hasClass('small-gallery'))
36101					$(window).resize();
36102				// add classes .curent & .shown to slide
36103				slider.find('.item').removeClass('current');
36104				var curSlide = slider.find('.item.flex-active-slide'),
36105					curSlideId = curSlide.attr('id'),
36106					nav = slider.find('.flex-direction-nav');
36107
36108				curSlide.addClass('current');
36109
36110				slider.find('.visible').css('opacity', '1');
36111				slider.find('.height0').css('height', 'auto');
36112
36113				if (curSlide.hasClass('shown')) {
36114					slider.find('.item.clone[id=' + curSlideId + '_clone]').addClass('shown');
36115				}
36116
36117				curSlide.addClass('shown');
36118
36119			}
36120		}
36121	}
36122	catch (e) { }
36123	finally {
36124		ignoreResize.pop();
36125	}
36126});
36127
36128BX.addCustomEvent('onCounterGoals', function (eventdata) {
36129	if (arAsproOptions['THEME']['YA_GOALS'] == 'Y' && arAsproOptions['THEME']['YA_COUNTER_ID']) {
36130		var idCounter = arAsproOptions['THEME']['YA_COUNTER_ID'];
36131		idCounter = parseInt(idCounter);
36132
36133		if (typeof eventdata != 'object')
36134			eventdata = { goal: 'undefined' };
36135
36136		if (typeof eventdata.goal != 'string')
36137			eventdata.goal = 'undefined';
36138
36139		if (idCounter) {
36140			try {
36141				waitCounter(idCounter, 50, function () {
36142					var obCounter = window['yaCounter' + idCounter];
36143					if (typeof obCounter == 'object') {
36144						obCounter.reachGoal(eventdata.goal);
36145					}
36146				});
36147			}
36148			catch (e) {
36149				console.error(e)
36150			}
36151		}
36152		else {
36153			console.info('Bad counter id!', idCounter);
36154		}
36155	}
36156})
36157
36158var onCaptchaVerifyinvisible = function (response) {
36159	$('.g-recaptcha:last').each(function () {
36160		var id = $(this).attr('data-widgetid');
36161		if (typeof (id) !== 'undefined' && response) {
36162			if (!$(this).closest('form').find('.g-recaptcha-response').val())
36163				$(this).closest('form').find('.g-recaptcha-response').val(response)
36164			if ($('iframe[src*=recaptcha]').length) {
36165				$('iframe[src*=recaptcha]').each(function () {
36166					var block = $(this).parent().parent();
36167					if (!block.hasClass('grecaptcha-badge'))
36168						block.css('width', '100%');
36169				})
36170			}
36171			$(this).closest('form').submit();
36172		}
36173	})
36174}
36175
36176var onCaptchaVerifynormal = function (response) {
36177	$('.g-recaptcha').each(function () {
36178		var id = $(this).attr('data-widgetid');
36179		if (typeof (id) !== 'undefined') {
36180			if (grecaptcha.getResponse(id) != '') {
36181				$(this).closest('form').find('.recaptcha').valid();
36182			}
36183		}
36184	});
36185}
36186
36187BX.addCustomEvent('onSubmitForm', function (eventdata) {
36188	try {
36189		if (!window.renderRecaptchaById || !window.asproRecaptcha || !window.asproRecaptcha.key) {
36190			eventdata.form.submit();
36191			$(eventdata.form).closest('.form').addClass('sending');
36192			return true;
36193		}
36194
36195		if (window.asproRecaptcha.params.recaptchaSize == 'invisible' && $(eventdata.form).find('.g-recaptcha').length) {
36196			if ($(eventdata.form).find('.g-recaptcha-response').val()) {
36197				eventdata.form.submit();
36198				$(eventdata.form).closest('.form').addClass('sending');
36199				return true;
36200			}
36201			else {
36202				if (typeof grecaptcha != 'undefined') {
36203					grecaptcha.execute($(eventdata.form).find('.g-recaptcha').data('widgetid'));
36204				}
36205				else {
36206					return false;
36207				}
36208			}
36209		}
36210		else {
36211			eventdata.form.submit();
36212			$(eventdata.form).closest('.form').addClass('sending');
36213			return true;
36214		}
36215	}
36216	catch (e) {
36217		console.error(e);
36218		return true;
36219	}
36220})
36221
36222$(document).on('click', '.catalog_reviews_extended span.dropdown-select__list-link', function () {
36223	var _this = $(this);
36224	var ajaxData = _this.data('review_sort_ajax');
36225	var container = _this.closest('[id^=comp_]');
36226	containerId = container.attr('id');
36227	if (containerId !== undefined && containerId) {
36228		ajaxData.containerId = containerId;
36229	}
36230	if (ajaxData !== undefined) {
36231		container.addClass('blur')
36232		$.ajax({
36233			type: 'post',
36234			data: ajaxData,
36235			success: function (html) {
36236				$('#reviews_sort_continer').html(html);
36237			}
36238		});
36239	}
36240});
36241
36242$(document).on('click', '.rating_vote:not(.disable)', function () {
36243
36244	var _this = $(this);
36245	var action = _this.data('action');
36246	var parent = _this.closest('.rating-vote');
36247	var commentId = parent.data('comment_id');
36248	var userId = parent.data('user_id');
36249	var ajaxUrl = parent.data('ajax_url');
36250	$.ajax({
36251		url: ajaxUrl,
36252		dataType: 'json',
36253		data: { 'commentId': commentId, 'action': action, 'userId': userId },
36254		success: function (data) {
36255			if (data.LIKE !== undefined) {
36256				_this.siblings('.rating-vote-result.like').text(data.LIKE);
36257			}
36258			if (data.DISLIKE !== undefined) {
36259				_this.siblings('.rating-vote-result.dislike').text(data.DISLIKE);
36260			}
36261			if (data.SET_ACTIVE_LIKE !== undefined) {
36262				parent.find('.rating_vote.plus').toggleClass('active');
36263			}
36264			if (data.SET_ACTIVE_DISLIKE !== undefined) {
36265				parent.find('.rating_vote.minus').toggleClass('active');
36266			}
36267		}
36268	});
36269
36270});
36271
36272function fileInputInit(message) {
36273	$('input[type=file]').uniform({ fileButtonHtml: BX.message('JS_FILE_BUTTON_NAME'), fileDefaultHtml: message });
36274	$(document).on('change', 'input[type=file]', function () {
36275		if ($(this).val()) {
36276			$(this).closest('.uploader').addClass('files_add');
36277		}
36278		else {
36279			$(this).closest('.uploader').removeClass('files_add');
36280		}
36281	})
36282	$('.form .add_file').on('click', function () {
36283		var index = $(this).closest('.input').find('input[type=file]').length + 1;
36284
36285		$(this).closest('.form-group').find('.input').append('<input type="file" id="POPUP_FILE" name="FILE_n' + index + '"   class="inputfile" value="" />');
36286		$('input[type=file]').uniform({ fileButtonHtml: BX.message('JS_FILE_BUTTON_NAME'), fileDefaultHtml: message });
36287	});
36288
36289	$('.form .add_file').on('click', function () {
36290		var index = $(this).closest('.input').find('input[type=file]').length + 1;
36291
36292		$(this).closest('.form-group').find('.input').append('<input type="file" id="POPUP_FILE" name="FILE_n' + index + '"   class="inputfile" value="" />');
36293		$('input[type=file]').uniform({ fileButtonHtml: BX.message('JS_FILE_BUTTON_NAME'), fileDefaultHtml: message });
36294	});
36295}
36296
36297/*custom event for sku prices*/
36298
36299/*BX.addCustomEvent('onAsproSkuSetPrice', function(eventdata){
36300	console.log(eventdata);
36301})*/
36302
36303/*BX.addCustomEvent('onAsproSkuSetPriceMatrix', function(eventdata){
36304	console.log(eventdata);
36305})*/
36306
36307function toggleServices() {
36308    const dd = document.getElementById('services-dropdown');
36309    const arrow = document.getElementById('services-arrow');
36310    const items = document.getElementById('services-item').closest('.items');
36311
36312    dd.classList.toggle('open');
36313    arrow.classList.toggle('rotated');
36314    if (items) items.classList.toggle('opened');
36315}
36316
36317document.addEventListener('click', function(e) {
36318    const item = document.getElementById('services-item');
36319    const dd = document.getElementById('services-dropdown');
36320    const items = item.closest('.items');
36321
36322    if (dd.contains(e.target)) {
36323        dd.classList.remove('open');
36324        document.getElementById('services-arrow').classList.remove('rotated');
36325        if (items) items.classList.remove('opened');
36326        return;
36327    }
36328
36329    if (!item.contains(e.target)) {
36330        dd.classList.remove('open');
36331        document.getElementById('services-arrow').classList.remove('rotated');
36332        if (items) items.classList.remove('opened');
36333    }
36334});
36335/* End */
36336;
36337; /* Start:"a:4:{s:4:"full";s:62:"/bitrix/templates/aspro_max/js/blocks/blocks.js?17164655377762";s:6:"source";
36337s:47:"/bitrix/templates/aspro_max/js/blocks/blocks.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
36338$(document).ready(function(){
36339	//dropdown-select
36340		$(document).on('click', '.dropdown-select .dropdown-select__title', function(){
36341			var _this = $(this),
36342				menu = _this.parent().find('> .dropdown-select__list'),
36343				bVisibleMeu = (menu.is(':visible')),
36344				animate = (!bVisibleMeu ? 'transition.slideUpIn' : 'fadeOut');
36345
36346			if(!_this.hasClass('clicked'))
36347			{
36348				_this.addClass('clicked');
36349
36350				menu.velocity('stop').velocity(animate, {
36351					duration: 300,
36352					// delay: 250,
36353					begin: function(){
36354						_this.toggleClass('opened');
36355					},
36356					complete: function(){
36357						_this.removeClass('clicked');
36358					}
36359				});
36360			}
36361		})
36362
36363		// close select
36364		$("html, body").on('mousedown', function(e){
36365			if(typeof e.target.className == 'string' && e.target.className.indexOf('adm') < 0)
36366			{
36367				e.stopPropagation();
36368
36369				if(!$(e.target).closest('.dropdown-select').length)
36370				{
36371					$('.dropdown-select .dropdown-select__title.opened').click();
36372				}
36373			}
36374		})
36375	/**/
36376
36377
36378	/*side head block*/
36379	$(document).on('click', '.slide-block .slide-block__head', function(e){
36380		var _this = $(this),
36381			menu = _this.siblings('.slide-block__body'),
36382			bVisibleMeu = (menu.is(':visible')),
36383			animate = (bVisibleMeu ? 'slideUp' : 'slideDown');
36384
36385		if(!_this.hasClass('clicked') && menu.length && !_this.hasClass('ignore') && !$(e.target).attr('href'))
36386		{
36387			var type = _this.data('id');
36388			_this.addClass('clicked');
36389
36390			if(bVisibleMeu)
36391				$.cookie(type+'_CLOSED', 'Y');
36392			else
36393				$.removeCookie(type+'_CLOSED');
36394
36395			menu.velocity('stop').velocity(animate, {
36396				duration: 150,
36397				// delay: 250,
36398				begin: function(){
36399					_this.toggleClass('closed');
36400				},
36401				complete: function(){
36402					_this.removeClass('clicked');
36403					
36404					if(typeof window['stickySidebar'] !== 'undefined')
36405						window['stickySidebar'].updateSticky();
36406				}
36407			});
36408		}
36409	})
36410	/**/
36411
36412	/*sku change props*/
36413	if(!('SelectOfferProp' in window) && typeof window.SelectOfferProp != 'function')
36414	{
36415		SelectOfferProp = function(){
36416			// return false;
36417			var _this = $(this),
36418				obParams = {},
36419				obSelect = {},
36420				objUrl = parseUrlQuery(),
36421				add_url = '',
36422				selectMode = (_this.hasClass('list_values_wrapper') ? true : false),
36423				container = _this.closest('.bx_catalog_item_scu'),
36424				img = _this.closest('.item-parent').find('.thumb img');
36425
36426			/* request params */
36427			obParams = {
36428				'PARAMS': _this.closest('.js_wrapper_items').data('params'),
36429				'ID': container.data('offer_id'),
36430				'SITE_ID': container.data('site_id'),
36431				'LINK_ID': container.data('id')+'_'+_this.closest('.cur').data('code'),
36432				'IBLOCK_ID': container.data('offer_iblockid'),
36433				'PROPERTY_ID': container.data('propertyid'),
36434				'DEPTH': _this.closest('.item_wrapper').index(),
36435				'VALUE': (selectMode ? _this.find('option:selected').data('onevalue') : _this.data('onevalue')),
36436				'CLASS': 'inner_content',
36437				'PICTURE': (img.data('src') ? img.data('src') : img.attr('src')),
36438				'ARTICLE_NAME': _this.closest('.item-parent').find('.article_block').data('name'),
36439				'ARTICLE_VALUE': _this.closest('.item-parent').find('.article_block').data('value'),
36440			}
36441			/**/
36442
36443			if("clear_cache" in objUrl)
36444			{
36445				if(objUrl.clear_cache == "Y")
36446					add_url += "?clear_cache=Y";
36447			}
36448
36449			/* save selected values */
36450			for (i = 0; i < obParams.DEPTH+1; i++)
36451			{
36452				strName = 'PROP_'+container.find('.item_wrapper:eq('+i+') > div').data('id');
36453				if(container.find('.item_wrapper:eq('+i+') select').length)
36454				{
36455					obSelect[strName] = container.find('.item_wrapper:eq('+i+') select option:selected').data('onevalue');
36456					obParams[strName] = container.find('.item_wrapper:eq('+i+') select option:selected').data('onevalue');
36457				}
36458				else
36459				{
36460					obSelect[strName] = container.find('.item_wrapper:eq('+i+') li.item.active').data('onevalue');
36461					obParams[strName] = container.find('.item_wrapper:eq('+i+') li.item.active').data('onevalue');
36462				}
36463			}
36464
36465			// obParams.SELECTED = JSON.stringify(obSelect);
36466			/**/
36467			
36468			if(!selectMode)
36469			{
36470				_this.siblings().removeClass('active');
36471				_this.addClass('active');
36472			}
36473
36474			if(_this.attr('title'))
36475			{
36476				_this.closest('.item_wrapper').find('.show_class span').text(_this.attr('title'))
36477			}
36478			else
36479			{
36480				var img_row = _this.find(' > i');
36481				if(img_row.length && img_row.attr('title'))
36482					_this.closest('.item_wrapper').find('.show_class span').text(img_row.attr('title'))
36483			}
36484
36485			/* get sku */
36486			$.ajax({
36487				url: arMaxOptions['SITE_DIR']+'ajax/js_item_detail.php'+add_url,
36488				type: 'POST',
36489				data: obParams,
36490			}).success(function(html){
36491				var ob = BX.processHTML(html);BX.ajax.processScripts(ob.SCRIPT);
36492				if($('.counter_wrapp.list'))
36493				{
36494					$('.counter_wrapp.list .counter_block.big').removeClass('big');
36495				}
36496			})
36497		}
36498		$(document).on('click', '.ajax_load .bx_catalog_item_scu li.item', SelectOfferProp)
36499		$(document).on('change', '.ajax_load .bx_catalog_item_scu select.list_values_wrapper', SelectOfferProp)
36500	}
36501
36502	/**/
36503
36504	/**/
36505	$('.switch-item-block .switch-item-block__icons').on('click', function(){
36506		var $this = $(this),
36507			animationTime = 200;
36508
36509		if($this.hasClass('switch-item-block__icons--small') && !$this.hasClass('active')){
36510			$this.addClass('active');
36511			$this.siblings('.switch-item-block__icons--big').removeClass('active');
36512			$this.closest('.switch-item-block').find('.switch-item-block__count-wrapper--big').fadeOut(animationTime, function(){
36513				$this.closest('.switch-item-block').find('.switch-item-block__count-wrapper--small').fadeIn(animationTime);
36514			});
36515
36516			$this.closest('.switch-item-block').siblings('.big-gallery-block').fadeOut(animationTime, function(){
36517				$this.closest('.switch-item-block').siblings('.small-gallery-block').fadeIn(animationTime);
36518			});
36519		}
36520		else if($this.hasClass('switch-item-block__icons--big') && !$this.hasClass('active')){
36521			$this.addClass('active');
36522			$this.siblings('.switch-item-block__icons--small').removeClass('active');
36523			$this.closest('.switch-item-block').find('.switch-item-block__count-wrapper--small').fadeOut(animationTime, function(){
36524				$this.closest('.switch-item-block').find('.switch-item-block__count-wrapper--big').fadeIn(animationTime);
36525			});
36526
36527			$this.closest('.switch-item-block').siblings('.small-gallery-block').fadeOut(animationTime, function(){
36528				$this.closest('.switch-item-block').siblings('.big-gallery-block').fadeIn(animationTime);
36529			});
36530		}
36531		setTimeout(function(){
36532			InitLazyLoad();
36533		}, 300);
36534	});
36535	/**/
36536
36537	/*many items menu*/
36538
36539	$('.menu-navigation__sections-wrapper .menu-navigation__sections').menuAim({
36540        firstActiveRow: true,
36541        rowSelector: "> .menu-navigation__sections-item",
36542        activate: function activate(a) {
36543            var _this = $(a),
36544                index = _this.index(),
36545                items = _this.closest('.menu-navigation__sections-wrapper').next(),
36546                link = _this.find('> a');
36547
36548            _this.siblings().find('> a').addClass('dark_link')
36549            link.addClass('colored_theme_text').removeClass('dark_link');
36550            items.find('.parent-items').siblings().hide();
36551            items.find('.parent-items').eq(index).show();
36552        },
36553        deactivate: function deactivate(a) {
36554            var _this = $(a),
36555                index = _this.index(),
36556                items = _this.closest('.menu-navigation__sections-wrapper').next(),
36557                link = _this.find('> a');
36558                
36559          link.removeClass('colored_theme_text').addClass('dark_link');
36560          items.find('.parent-items').siblings().hide();
36561        }
36562    });
36563	/**/
36564})
36565/* End */
36566;
36567; /* 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:"";}"*/
36568function JCTitleSearch(arParams)
36569{
36570	var _this = this;
36571
36572	this.arParams = {
36573		'AJAX_PAGE': arParams.AJAX_PAGE,
36574		'CONTAINER_ID': arParams.CONTAINER_ID,
36575		'INPUT_ID': arParams.INPUT_ID,
36576		'MIN_QUERY_LEN': parseInt(arParams.MIN_QUERY_LEN)
36577	};
36578	if(arParams.WAIT_IMAGE)
36579		this.arParams.WAIT_IMAGE = arParams.WAIT_IMAGE;
36580	if(arParams.MIN_QUERY_LEN <= 0)
36581		arParams.MIN_QUERY_LEN = 1;
36582
36583	this.cache = [];
36584	this.cache_key = null;
36585
36586	this.startText = '';
36587	this.running = false;
36588	this.runningCall = false;
36589	this.currentRow = -1;
36590	this.RESULT = null;
36591	this.CONTAINER = null;
36592	this.INPUT = null;
36593	this.WAIT = null;
36594
36595	this.ShowResult = function(result)
36596	{
36597		if(BX.type.isString(result))
36598		{
36599			_this.RESULT.innerHTML = result;
36600		}
36601
36602		_this.RESULT.style.display = _this.RESULT.innerHTML !== '' ? 'block' : 'none';
36603		var pos = _this.adjustResultNode();
36604
36605		//adjust left column to be an outline
36606		var res_pos;
36607		var th;
36608		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
36609		if(tbl)
36610		{
36611			th = BX.findChild(tbl, {'tag':'th'}, true);
36612		}
36613
36614		if(th)
36615		{
36616			var tbl_pos = BX.pos(tbl);
36617			tbl_pos.width = tbl_pos.right - tbl_pos.left;
36618
36619			var th_pos = BX.pos(th);
36620			th_pos.width = th_pos.right - th_pos.left;
36621			th.style.width = th_pos.width + 'px';
36622
36623			_this.RESULT.style.width = (pos.width + th_pos.width) + 'px';
36624
36625			//Move table to left by width of the first column
36626			_this.RESULT.style.left = (pos.left - th_pos.width - 1)+ 'px';
36627
36628			//Shrink table when it's too wide
36629			if((tbl_pos.width - th_pos.width) > pos.width)
36630				_this.RESULT.style.width = (pos.width + th_pos.width -1) + 'px';
36631
36632			//Check if table is too wide and shrink result div to it's width
36633			tbl_pos = BX.pos(tbl);
36634			res_pos = BX.pos(_this.RESULT);
36635			if(res_pos.right > tbl_pos.right)
36636			{
36637				_this.RESULT.style.width = (tbl_pos.right - tbl_pos.left) + 'px';
36638			}
36639		}
36640
36641		var fade;
36642		if(tbl) fade = BX.findChild(_this.RESULT, {'class':'title-search-fader'}, true);
36643		if(fade && th)
36644		{
36645			res_pos = BX.pos(_this.RESULT);
36646			fade.style.left = (res_pos.right - res_pos.left - 18) + 'px';
36647			fade.style.width = 18 + 'px';
36648			fade.style.top = 0 + 'px';
36649			fade.style.height = (res_pos.bottom - res_pos.top) + 'px';
36650			fade.style.display = 'block';
36651		}
36652	};
36653
36654	this.onKeyPress = function(keyCode)
36655	{
36656		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
36657		if(!tbl)
36658			return false;
36659
36660		var i;
36661		var cnt = tbl.rows.length;
36662
36663		switch (keyCode)
36664		{
36665		case 27: // escape key - close search div
36666			_this.RESULT.style.display = 'none';
36667			_this.currentRow = -1;
36668			_this.UnSelectAll();
36669		return true;
36670
36671		case 40: // down key - navigate down on search results
36672			if(_this.RESULT.style.display == 'none')
36673				_this.RESULT.style.display = 'block';
36674
36675			var first = -1;
36676			for(i = 0; i < cnt; i++)
36677			{
36678				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
36679				{
36680					if(first == -1)
36681						first = i;
36682
36683					if(_this.currentRow < i)
36684					{
36685						_this.currentRow = i;
36686						break;
36687					}
36688					else if(tbl.rows[i].className == 'title-search-selected')
36689					{
36690						tbl.rows[i].className = '';
36691					}
36692				}
36693			}
36694
36695			if(i == cnt && _this.currentRow != i)
36696				_this.currentRow = first;
36697
36698			tbl.rows[_this.currentRow].className = 'title-search-selected';
36699		return true;
36700
36701		case 38: // up key - navigate up on search results
36702			if(_this.RESULT.style.display == 'none')
36703				_this.RESULT.style.display = 'block';
36704
36705			var last = -1;
36706			for(i = cnt-1; i >= 0; i--)
36707			{
36708				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
36709				{
36710					if(last == -1)
36711						last = i;
36712
36713					if(_this.currentRow > i)
36714					{
36715						_this.currentRow = i;
36716						break;
36717					}
36718					else if(tbl.rows[i].className == 'title-search-selected')
36719					{
36720						tbl.rows[i].className = '';
36721					}
36722				}
36723			}
36724
36725			if(i < 0 && _this.currentRow != i)
36726				_this.currentRow = last;
36727
36728			tbl.rows[_this.currentRow].className = 'title-search-selected';
36729		return true;
36730
36731		case 13: // enter key - choose current search result
36732			if(_this.RESULT.style.display == 'block')
36733			{
36734				for(i = 0; i < cnt; i++)
36735				{
36736					if(_this.currentRow == i)
36737					{
36738						if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
36739						{
36740							var a = BX.findChild(tbl.rows[i], {'tag':'a'}, true);
36741							if(a)
36742							{
36743								window.location = a.href;
36744								return true;
36745							}
36746						}
36747					}
36748				}
36749			}
36750		return false;
36751		}
36752
36753		return false;
36754	};
36755
36756	this.onTimeout = function()
36757	{
36758		_this.onChange(function(){
36759			setTimeout(_this.onTimeout, 500);
36760		});
36761	};
36762
36763	this.onChange = function(callback)
36764	{
36765		if (_this.running)
36766		{
36767			_this.runningCall = true;
36768			return;
36769		}
36770		_this.running = true;
36771
36772		if(_this.INPUT.value != _this.oldValue && _this.INPUT.value != _this.startText)
36773		{
36774			_this.oldValue = _this.INPUT.value;
36775			if(_this.INPUT.value.length >= _this.arParams.MIN_QUERY_LEN)
36776			{
36777				_this.cache_key = _this.arParams.INPUT_ID + '|' + _this.INPUT.value;
36778				if(_this.cache[_this.cache_key] == null)
36779				{
36780					if(_this.WAIT)
36781					{
36782						var pos = BX.pos(_this.INPUT);
36783						var height = (pos.bottom - pos.top)-2;
36784						_this.WAIT.style.top = (pos.top+1) + 'px';
36785						_this.WAIT.style.height = height + 'px';
36786						_this.WAIT.style.width = height + 'px';
36787						_this.WAIT.style.left = (pos.right - height + 2) + 'px';
36788						_this.WAIT.style.display = 'block';
36789					}
36790
36791					BX.ajax.post(
36792						_this.arParams.AJAX_PAGE,
36793						{
36794							'ajax_call':'y',
36795							'INPUT_ID':_this.arParams.INPUT_ID,
36796							'q':_this.INPUT.value,
36797							'l':_this.arParams.MIN_QUERY_LEN
36798						},
36799						function(result)
36800						{
36801							_this.cache[_this.cache_key] = result;
36802							_this.ShowResult(result);
36803							_this.currentRow = -1;
36804							_this.EnableMouseEvents();
36805							if(_this.WAIT)
36806								_this.WAIT.style.display = 'none';
36807							if (!!callback)
36808								callback();
36809							_this.running = false;
36810							if (_this.runningCall)
36811							{
36812								_this.runningCall = false;
36813								_this.onChange();
36814							}
36815						}
36816					);
36817					return;
36818				}
36819				else
36820				{
36821					_this.ShowResult(_this.cache[_this.cache_key]);
36822					_this.currentRow = -1;
36823					_this.EnableMouseEvents();
36824				}
36825			}
36826			else
36827			{
36828				_this.RESULT.style.display = 'none';
36829				_this.currentRow = -1;
36830				_this.UnSelectAll();
36831			}
36832		}
36833		if (!!callback)
36834			callback();
36835		_this.running = false;
36836	};
36837
36838	this.onScroll = function ()
36839	{
36840		if(BX.type.isElementNode(_this.RESULT)
36841			&& _this.RESULT.style.display !== "none"
36842			&& _this.RESULT.innerHTML !== ''
36843		)
36844		{
36845			_this.adjustResultNode();
36846		}
36847	};
36848
36849	this.UnSelectAll = function()
36850	{
36851		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
36852		if(tbl)
36853		{
36854			var cnt = tbl.rows.length;
36855			for(var i = 0; i < cnt; i++)
36856				tbl.rows[i].className = '';
36857		}
36858	};
36859
36860	this.EnableMouseEvents = function()
36861	{
36862		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
36863		if(tbl)
36864		{
36865			var cnt = tbl.rows.length;
36866			for(var i = 0; i < cnt; i++)
36867				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
36868				{
36869					tbl.rows[i].id = 'row_' + i;
36870					tbl.rows[i].onmouseover = function (e) {
36871						if(_this.currentRow != this.id.substr(4))
36872						{
36873							_this.UnSelectAll();
36874							this.className = 'title-search-selected';
36875							_this.currentRow = this.id.substr(4);
36876						}
36877					};
36878					tbl.rows[i].onmouseout = function (e) {
36879						this.className = '';
36880						_this.currentRow = -1;
36881					};
36882				}
36883		}
36884	};
36885
36886	this.onFocusLost = function(hide)
36887	{
36888		setTimeout(function(){_this.RESULT.style.display = 'none';}, 250);
36889	};
36890
36891	this.onFocusGain = function()
36892	{
36893		if(_this.RESULT.innerHTML.length)
36894			_this.ShowResult();
36895	};
36896
36897	this.onKeyDown = function(e)
36898	{
36899		if(!e)
36900			e = window.event;
36901
36902		if (_this.RESULT.style.display == 'block')
36903		{
36904			if(_this.onKeyPress(e.keyCode))
36905				return BX.PreventDefault(e);
36906		}
36907	};
36908
36909	this.adjustResultNode = function()
36910	{
36911		if(!(BX.type.isElementNode(_this.RESULT)
36912			&& BX.type.isElementNode(_this.CONTAINER))
36913		)
36914		{
36915			return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 };
36916		}
36917
36918		var pos = BX.pos(_this.CONTAINER);
36919
36920		_this.RESULT.style.position = 'absolute';
36921		_this.RESULT.style.top = (pos.bottom + 2) + 'px';
36922		_this.RESULT.style.left = pos.left + 'px';
36923		_this.RESULT.style.width = pos.width + 'px';
36924
36925		return pos;
36926	};
36927
36928	this._onContainerLayoutChange = function()
36929	{
36930		if(BX.type.isElementNode(_this.RESULT)
36931			&& _this.RESULT.style.display !== "none"
36932			&& _this.RESULT.innerHTML !== ''
36933		)
36934		{
36935			_this.adjustResultNode();
36936		}
36937	};
36938	this.Init = function()
36939	{
36940		this.CONTAINER = document.getElementById(this.arParams.CONTAINER_ID);
36941		BX.addCustomEvent(this.CONTAINER, "OnNodeLayoutChange", this._onContainerLayoutChange);
36942
36943		this.RESULT = document.body.appendChild(document.createElement("DIV"));
36944		this.RESULT.className = 'title-search-result';
36945		this.INPUT = document.getElementById(this.arParams.INPUT_ID);
36946		this.startText = this.oldValue = this.INPUT.value;
36947		BX.bind(this.INPUT, 'focus', function() {_this.onFocusGain()});
36948		BX.bind(this.INPUT, 'blur', function() {_this.onFocusLost()});
36949		this.INPUT.onkeydown = this.onKeyDown;
36950
36951		if(this.arParams.WAIT_IMAGE)
36952		{
36953			this.WAIT = document.body.appendChild(document.createElement("DIV"));
36954			this.WAIT.style.backgroundImage = "url('" + this.arParams.WAIT_IMAGE + "')";
36955			if(!BX.browser.IsIE())
36956				this.WAIT.style.backgroundRepeat = 'none';
36957			this.WAIT.style.display = 'none';
36958			this.WAIT.style.position = 'absolute';
36959			this.WAIT.style.zIndex = '1100';
36960		}
36961
36962		BX.bind(this.INPUT, 'bxchange', function() {_this.onChange()});
36963
36964		var fixedParent = BX.findParent(this.CONTAINER, BX.is_fixed);
36965		if(BX.type.isElementNode(fixedParent))
36966		{
36967			BX.bind(window, 'scroll', BX.throttle(this.onScroll, 100, this));
36968		}
36969	};
36970	BX.ready(function (){_this.Init(arParams)});
36971}
36972
36973/* End */
36974;
36975; /* 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:"";}"*/
36976$(document).ready(function(){
36977	var containerHTML = $('.title-search-input_mega_menu').detach();
36978	$('#title-search_mega_menu').append(containerHTML);
36979});
36980
36981function JCTitleSearch3(arParams)
36982{
36983	var _this = this;
36984
36985	this.arParams = {
36986		'AJAX_PAGE': arParams.AJAX_PAGE,
36987		'CONTAINER_ID': arParams.CONTAINER_ID,
36988		'INPUT_ID': arParams.INPUT_ID,
36989		'MIN_QUERY_LEN': parseInt(arParams.MIN_QUERY_LEN)
36990	};
36991	if(arParams.WAIT_IMAGE)
36992		this.arParams.WAIT_IMAGE = arParams.WAIT_IMAGE;
36993	if(arParams.MIN_QUERY_LEN <= 0)
36994		arParams.MIN_QUERY_LEN = 1;
36995
36996	this.cache = [];
36997	this.cache_key = null;
36998
36999	this.startText = '';
37000	this.running = false;
37001	this.needRunAgain = false;
37002	this.currentRow = -1;
37003	this.RESULT = null;
37004	this.CONTAINER = null;
37005	this.INPUT = null;
37006	this.WAIT = null;
37007
37008	this.ShowResult = function(result)
37009	{
37010		if(BX.type.isString(result))
37011		{
37012			_this.RESULT.innerHTML = result;
37013		}
37014
37015		_this.RESULT.style.display = _this.RESULT.innerHTML !== '' ? 'block' : 'none';
37016		var pos = _this.adjustResultNode();
37017
37018		//adjust left column to be an outline
37019		var res_pos;
37020		var th;
37021		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
37022		if(tbl)
37023		{
37024			th = BX.findChild(tbl, {'tag':'th'}, true);
37025		}
37026		if(th)
37027		{
37028			var tbl_pos = BX.pos(tbl);
37029			tbl_pos.width = tbl_pos.right - tbl_pos.left;
37030
37031			var th_pos = BX.pos(th);
37032			th_pos.width = th_pos.right - th_pos.left;
37033			th.style.width = th_pos.width + 'px';
37034
37035			_this.RESULT.style.width = (pos.width + th_pos.width) + 'px';
37036
37037			//Move table to left by width of the first column
37038			_this.RESULT.style.left = (pos.left - th_pos.width - 1)+ 'px';
37039
37040			//Shrink table when it's too wide
37041			if((tbl_pos.width - th_pos.width) > pos.width)
37042				_this.RESULT.style.width = (pos.width + th_pos.width -1) + 'px';
37043
37044			//Check if table is too wide and shrink result div to it's width
37045			tbl_pos = BX.pos(tbl);
37046			res_pos = BX.pos(_this.RESULT);
37047			if(res_pos.right > tbl_pos.right)
37048			{
37049				_this.RESULT.style.width = (tbl_pos.right - tbl_pos.left) + 'px';
37050			}
37051		}
37052
37053		var fade;
37054		if(tbl) fade = BX.findChild(_this.RESULT, {'class':'title-search-fader'}, true);
37055		if(fade && th)
37056		{
37057			res_pos = BX.pos(_this.RESULT);
37058			fade.style.left = (res_pos.right - res_pos.left - 18) + 'px';
37059			fade.style.width = 18 + 'px';
37060			fade.style.top = 0 + 'px';
37061			fade.style.height = (res_pos.bottom - res_pos.top) + 'px';
37062			fade.style.display = 'block';
37063		}
37064
37065		
37066		$('.bx_searche.scrollbar').mCustomScrollbar({
37067			mouseWheel: {
37068				scrollAmount: 150,
37069				preventDefault: true
37070			}
37071		});
37072	};
37073
37074	this.onKeyPress = function(keyCode)
37075	{
37076		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
37077		if(!tbl)
37078			return false;
37079
37080		var i;
37081		var cnt = tbl.rows.length;
37082
37083		switch (keyCode)
37084		{
37085		case 27: // escape key - close search div
37086			_this.RESULT.style.display = 'none';
37087			_this.currentRow = -1;
37088			_this.UnSelectAll();
37089		return true;
37090
37091		case 40: // down key - navigate down on search results
37092			if(_this.RESULT.style.display == 'none')
37093				_this.RESULT.style.display = 'block';
37094
37095			var first = -1;
37096			for(i = 0; i < cnt; i++)
37097			{
37098				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
37099				{
37100					if(first == -1)
37101						first = i;
37102
37103					if(_this.currentRow < i)
37104					{
37105						_this.currentRow = i;
37106						break;
37107					}
37108					else if(tbl.rows[i].className == 'title-search-selected')
37109					{
37110						tbl.rows[i].className = '';
37111					}
37112				}
37113			}
37114
37115			if(i == cnt && _this.currentRow != i)
37116				_this.currentRow = first;
37117
37118			tbl.rows[_this.currentRow].className = 'title-search-selected';
37119		return true;
37120
37121		case 38: // up key - navigate up on search results
37122			if(_this.RESULT.style.display == 'none')
37123				_this.RESULT.style.display = 'block';
37124
37125			var last = -1;
37126			for(i = cnt-1; i >= 0; i--)
37127			{
37128				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
37129				{
37130					if(last == -1)
37131						last = i;
37132
37133					if(_this.currentRow > i)
37134					{
37135						_this.currentRow = i;
37136						break;
37137					}
37138					else if(tbl.rows[i].className == 'title-search-selected')
37139					{
37140						tbl.rows[i].className = '';
37141					}
37142				}
37143			}
37144
37145			if(i < 0 && _this.currentRow != i)
37146				_this.currentRow = last;
37147
37148			tbl.rows[_this.currentRow].className = 'title-search-selected';
37149		return true;
37150
37151		case 13: // enter key - choose current search result
37152			if(_this.RESULT.style.display == 'block')
37153			{
37154				for(i = 0; i < cnt; i++)
37155				{
37156					if(_this.currentRow == i)
37157					{
37158						if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
37159						{
37160							var a = BX.findChild(tbl.rows[i], {'tag':'a'}, true);
37161							if(a)
37162							{
37163								window.location = a.href;
37164								return true;
37165							}
37166						}
37167					}
37168				}
37169			}
37170		return false;
37171		}
37172
37173		return false;
37174	};
37175
37176	this.onTimeout = function()
37177	{
37178		_this.onChange(function(){
37179			setTimeout(_this.onTimeout, 500);
37180		});
37181	};
37182
37183	this.onChange = function(callback)
37184	{
37185		if (_this.running) {
37186			_this.needRunAgain = true;
37187			return;
37188		}
37189		_this.running = true;
37190
37191		if(_this.INPUT.value != _this.oldValue && _this.INPUT.value != _this.startText)
37192		{
37193			_this.oldValue = _this.INPUT.value;
37194			if(_this.INPUT.value.length >= _this.arParams.MIN_QUERY_LEN)
37195			{
37196				_this.cache_key = _this.arParams.INPUT_ID + '|' + _this.INPUT.value;
37197				if(_this.cache[_this.cache_key] == null)
37198				{
37199					if(_this.WAIT)
37200					{
37201						var pos = BX.pos(_this.INPUT);
37202						var height = (pos.bottom - pos.top)-2;
37203						_this.WAIT.style.top = (pos.top+1) + 'px';
37204						_this.WAIT.style.height = height + 'px';
37205						_this.WAIT.style.width = height + 'px';
37206						_this.WAIT.style.left = (pos.right - height + 2) + 'px';
37207						_this.WAIT.style.display = 'block';
37208					}
37209
37210					BX.ajax.post(
37211						_this.arParams.AJAX_PAGE,
37212						{
37213							'ajax_call':'y',
37214							'INPUT_ID':_this.arParams.INPUT_ID,
37215							'q':_this.INPUT.value,
37216							'l':_this.arParams.MIN_QUERY_LEN
37217						},
37218						function(result)
37219						{
37220							_this.cache[_this.cache_key] = result;
37221							_this.ShowResult(result);
37222							_this.currentRow = -1;
37223							_this.EnableMouseEvents();
37224							if(_this.WAIT)
37225								_this.WAIT.style.display = 'none';
37226							if (!!callback)
37227								callback();
37228							_this.running = false;
37229
37230							if(_this.needRunAgain){
37231								_this.needRunAgain = false;
37232								_this.onChange(callback);
37233							}
37234						}
37235					);
37236					return;
37237				}
37238				else
37239				{
37240					_this.ShowResult(_this.cache[_this.cache_key]);
37241					_this.currentRow = -1;
37242					_this.EnableMouseEvents();
37243				}
37244			}
37245			else
37246			{
37247				_this.RESULT.style.display = 'none';
37248				_this.currentRow = -1;
37249				_this.UnSelectAll();
37250			}
37251		}
37252		if (!!callback)
37253			callback();
37254		_this.running = false;
37255	};
37256
37257	this.UnSelectAll = function()
37258	{
37259		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
37260		if(tbl)
37261		{
37262			var cnt = tbl.rows.length;
37263			for(var i = 0; i < cnt; i++)
37264				tbl.rows[i].className = '';
37265		}
37266	};
37267
37268	this.EnableMouseEvents = function()
37269	{
37270		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
37271		if(tbl)
37272		{
37273			var cnt = tbl.rows.length;
37274			for(var i = 0; i < cnt; i++)
37275				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
37276				{
37277					tbl.rows[i].id = 'row_' + i;
37278					tbl.rows[i].onmouseover = function (e) {
37279						if(_this.currentRow != this.id.substr(4))
37280						{
37281							_this.UnSelectAll();
37282							this.className = 'title-search-selected';
37283							_this.currentRow = this.id.substr(4);
37284						}
37285					};
37286					tbl.rows[i].onmouseout = function (e) {
37287						this.className = '';
37288						_this.currentRow = -1;
37289					};
37290				}
37291		}
37292	};
37293
37294	this.onFocusLost = function(hide)
37295	{
37296		setTimeout(function(){_this.RESULT.style.display = 'none';}, 250);
37297		//_this.RESULT.style.display = 'none';
37298	};
37299
37300	this.onFocusGain = function()
37301	{
37302		if(_this.RESULT.innerHTML.length)
37303			_this.ShowResult();
37304	};
37305
37306	this.onKeyDown = function(e)
37307	{
37308		if(!e)
37309			e = window.event;
37310
37311		if (_this.RESULT.style.display == 'block')
37312		{
37313			if(_this.onKeyPress(e.keyCode))
37314				return BX.PreventDefault(e);
37315		}
37316		
37317		$('.title-search-result.'+_this.arParams.INPUT_ID).removeClass('closed');
37318	};
37319
37320	this.adjustResultNode = function()
37321	{
37322		var pos, pos_input;
37323		var fixedParent = BX.findParent(_this.CONTAINER, BX.is_fixed);
37324		/*if(!!fixedParent)
37325		{
37326			_this.RESULT.style.position = 'fixed';
37327			_this.RESULT.style.zIndex = BX.style(fixedParent, 'z-index') + 2;
37328			pos = BX.pos(_this.CONTAINER, true);
37329		}
37330		else
37331		{*/
37332			_this.RESULT.style.position = 'absolute';
37333			pos = BX.pos(_this.CONTAINER, true);
37334		//}
37335		pos_input = BX.pos(_this.INPUT);
37336
37337		pos.width = pos.right - pos.left;
37338		_this.RESULT.style.top = (pos.bottom + 2) + 'px';
37339		//_this.RESULT.style.left = pos_input.left + 'px';
37340		_this.RESULT.style.left = 0 + 'px';
37341
37342		if($(_this.INPUT).closest('.inline-search-block.with-close').length)
37343			_this.RESULT.style.width = pos_input.width + 'px';
37344		else
37345			_this.RESULT.style.width = pos.width + 'px';
37346		return pos;
37347	};
37348
37349	this._onContainerLayoutChange = function()
37350	{
37351		if(_this.RESULT.style.display !== "none" && _this.RESULT.innerHTML !== '')
37352		{
37353			_this.adjustResultNode();
37354		}
37355	};
37356	this.Init = function()
37357	{
37358		this.CONTAINER = document.getElementById(this.arParams.CONTAINER_ID);
37359		BX.addCustomEvent(this.CONTAINER, "OnNodeLayoutChange", this._onContainerLayoutChange);
37360
37361		this.RESULT = document.body.appendChild(document.createElement("DIV"));
37362
37363		this.RESULT.className = 'title-search-result '+this.arParams.INPUT_ID;
37364		this.INPUT = document.getElementById(this.arParams.INPUT_ID);
37365		this.startText = this.oldValue = this.INPUT.value;
37366		BX.bind(this.INPUT, 'focus', function() {_this.onFocusGain()});
37367		BX.bind(this.INPUT, 'blur', function() {_this.onFocusLost()});
37368
37369		if(BX.browser.IsSafari() || BX.browser.IsIE())
37370			this.INPUT.onkeydown = this.onKeyDown;
37371		else
37372			this.INPUT.onkeypress = this.onKeyDown;
37373
37374		if(this.arParams.WAIT_IMAGE)
37375		{
37376			this.WAIT = document.body.appendChild(document.createElement("DIV"));
37377			this.WAIT.style.backgroundImage = "url('" + this.arParams.WAIT_IMAGE + "')";
37378			if(!BX.browser.IsIE())
37379				this.WAIT.style.backgroundRepeat = 'none';
37380			this.WAIT.style.display = 'none';
37381			this.WAIT.style.position = 'absolute';
37382			this.WAIT.style.zIndex = '1100';
37383		}
37384
37385		BX.bind(this.INPUT, 'bxchange', function() {_this.onChange()});
37386	};
37387	BX.ready(function (){_this.Init(arParams)});
37388}
37389
37390/* End */
37391;
37392; /* 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:"";}"*/
37393$(document).ready(function(){
37394	$('.menu-row .mega-menu table td.wide_menu .dropdown-menu > .customScrollbar').mCustomScrollbar({
37395		mouseWheel: {
37396			scrollAmount: 150,
37397			preventDefault: true
37398		}
37399	})
37400})
37401/* End */
37402;
37403; /* Start:"a:4:{s:4:"full";s:78:"/bitrix/templates/aspro_max/components/bitrix/menu/top/script.
37403js?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:"";}"*/
37404$(document).ready(function(){
37405	$('.menu-row .mega-menu table td.wide_menu .customScrollbar').mCustomScrollbar({
37406		mouseWheel: {
37407			scrollAmount: 150,
37408			preventDefault: true
37409		}
37410	})
37411})
37412/* End */
37413;
37414; /* 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:"";}"*/
37415$(document).ready(function(){
37416	var containerHTML = $('.title-search-input_fixed').detach();
37417	$('#title-search_fixed').append(containerHTML);
37418});
37419
37420$(document).ready(function(){
37421	var containerHTML = $('.title-search-input_fixedtf').detach();
37422	$('#title-search_fixedtf').append(containerHTML);
37423});
37424
37425$(document).ready(function(){
37426	var containerHTML = $('.title-search-input').detach();
37427	$('#title-search').append(containerHTML);
37428});
37429
37430
37431
37432function JCTitleSearch4(arParams)
37433{
37434	var _this = this;
37435	
37436	this.arParams = {
37437		'AJAX_PAGE': arParams.AJAX_PAGE,
37438		'CONTAINER_ID': arParams.CONTAINER_ID,
37439		'INPUT_ID': arParams.INPUT_ID,
37440		'INPUT_ID_TMP': arParams.INPUT_ID_TMP,
37441		'MIN_QUERY_LEN': parseInt(arParams.MIN_QUERY_LEN)
37442	};
37443
37444	if(arParams.WAIT_IMAGE)
37445		this.arParams.WAIT_IMAGE = arParams.WAIT_IMAGE;
37446	if(arParams.MIN_QUERY_LEN <= 0)
37447		arParams.MIN_QUERY_LEN = 1;
37448
37449	this.cache = [];
37450	this.cache_key = null;
37451
37452	this.startText = '';
37453	this.running = false;
37454	this.needRunAgain = false;
37455	this.currentRow = -1;
37456	this.RESULT = null;
37457	this.CONTAINER = null;
37458	this.INPUT = null;
37459	this.WAIT = null;
37460
37461	this.ShowResult = function(result)
37462	{
37463		if(BX.type.isString(result))
37464		{
37465			_this.RESULT.innerHTML = result;
37466		}
37467
37468		_this.RESULT.style.display = _this.RESULT.innerHTML !== '' ? 'block' : 'none';
37469		var pos = _this.adjustResultNode();
37470
37471		//adjust left column to be an outline
37472		var res_pos;
37473		var th;
37474		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
37475		if(tbl)
37476		{
37477			th = BX.findChild(tbl, {'tag':'th'}, true);
37478		}
37479		
37480		if(th)
37481		{
37482			var tbl_pos = BX.pos(tbl);
37483			tbl_pos.width = tbl_pos.right - tbl_pos.left;
37484
37485			var th_pos = BX.pos(th);
37486			th_pos.width = th_pos.right - th_pos.left;
37487			th.style.width = th_pos.width + 'px';
37488
37489			_this.RESULT.style.width = (pos.width + th_pos.width) + 'px';
37490
37491			//Move table to left by width of the first column
37492			_this.RESULT.style.left = '0px';//(pos.left - th_pos.width - 1)+ 'px';
37493
37494			//Shrink table when it's too wide
37495			if((tbl_pos.width - th_pos.width) > pos.width)
37496				_this.RESULT.style.width = (pos.width + th_pos.width -1) + 'px';
37497
37498			//Check if table is too wide and shrink result div to it's width
37499			tbl_pos = BX.pos(tbl);
37500			res_pos = BX.pos(_this.RESULT);
37501			if(res_pos.right > tbl_pos.right)
37502			{
37503				_this.RESULT.style.width = (tbl_pos.right - tbl_pos.left) + 'px';
37504			}
37505		}
37506
37507		var fade;
37508		if(tbl) fade = BX.findChild(_this.RESULT, {'class':'title-search-fader'}, true);
37509		if(fade && th)
37510		{
37511			res_pos = BX.pos(_this.RESULT);
37512			fade.style.left = (res_pos.right - res_pos.left - 18) + 'px';
37513			fade.style.width = 18 + 'px';
37514			fade.style.top = 0 + 'px';
37515			fade.style.height = (res_pos.bottom - res_pos.top) + 'px';
37516			fade.style.display = 'block';
37517		}
37518
37519		
37520		$('.bx_searche.scrollbar').mCustomScrollbar({
37521			mouseWheel: {
37522				scrollAmount: 150,
37523				preventDefault: true
37524			}
37525		});
37526	};
37527
37528	this.onKeyPress = function(keyCode)
37529	{
37530		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
37531		if(!tbl)
37532			return false;
37533
37534		var i;
37535		var cnt = tbl.rows.length;
37536
37537		switch (keyCode)
37538		{
37539		case 27: // escape key - close search div
37540			_this.RESULT.style.display = 'none';
37541			_this.currentRow = -1;
37542			_this.UnSelectAll();
37543		return true;
37544
37545		case 40: // down key - navigate down on search results
37546			if(_this.RESULT.style.display == 'none')
37547				_this.RESULT.style.display = 'block';
37548
37549			var first = -1;
37550			for(i = 0; i < cnt; i++)
37551			{
37552				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
37553				{
37554					if(first == -1)
37555						first = i;
37556
37557					if(_this.currentRow < i)
37558					{
37559						_this.currentRow = i;
37560						break;
37561					}
37562					else if(tbl.rows[i].className == 'title-search-selected')
37563					{
37564						tbl.rows[i].className = '';
37565					}
37566				}
37567			}
37568
37569			if(i == cnt && _this.currentRow != i)
37570				_this.currentRow = first;
37571
37572			tbl.rows[_this.currentRow].className = 'title-search-selected';
37573		return true;
37574
37575		case 38: // up key - navigate up on search results
37576			if(_this.RESULT.style.display == 'none')
37577				_this.RESULT.style.display = 'block';
37578
37579			var last = -1;
37580			for(i = cnt-1; i >= 0; i--)
37581			{
37582				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
37583				{
37584					if(last == -1)
37585						last = i;
37586
37587					if(_this.currentRow > i)
37588					{
37589						_this.currentRow = i;
37590						break;
37591					}
37592					else if(tbl.rows[i].className == 'title-search-selected')
37593					{
37594						tbl.rows[i].className = '';
37595					}
37596				}
37597			}
37598
37599			if(i < 0 && _this.currentRow != i)
37600				_this.currentRow = last;
37601
37602			tbl.rows[_this.currentRow].className = 'title-search-selected';
37603		return true;
37604
37605		case 13: // enter key - choose current search result
37606			if(_this.RESULT.style.display == 'block')
37607			{
37608				for(i = 0; i < cnt; i++)
37609				{
37610					if(_this.currentRow == i)
37611					{
37612						if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
37613						{
37614							var a = BX.findChild(tbl.rows[i], {'tag':'a'}, true);
37615							if(a)
37616							{
37617								window.location = a.href;
37618								return true;
37619							}
37620						}
37621					}
37622				}
37623			}
37624		return false;
37625		}
37626
37627		return false;
37628	};
37629
37630	this.onTimeout = function()
37631	{
37632		_this.onChange(function(){
37633			setTimeout(_this.onTimeout, 500);
37634		});
37635	};
37636
37637	this.onChange = function(callback)
37638	{
37639		if (_this.running){
37640			_this.needRunAgain = true;
37641			return;
37642		}
37643		_this.running = true;
37644
37645		if(_this.INPUT.value != _this.oldValue && _this.INPUT.value != _this.startText)
37646		{
37647			_this.oldValue = _this.INPUT.value;
37648			if(_this.INPUT.value.length >= _this.arParams.MIN_QUERY_LEN)
37649			{
37650				_this.cache_key = _this.arParams.INPUT_ID + '|' + _this.INPUT.value;
37651				if(_this.cache[_this.cache_key] == null)
37652				{
37653					if(_this.WAIT)
37654					{
37655						var pos = BX.pos(_this.INPUT);
37656						var height = (pos.bottom - pos.top)-2;
37657						_this.WAIT.style.top = (pos.top+1) + 'px';
37658						_this.WAIT.style.height = height + 'px';
37659						_this.WAIT.style.width = height + 'px';
37660						_this.WAIT.style.left = (pos.right - height + 2) + 'px';
37661						_this.WAIT.style.display = 'block';
37662					}
37663
37664					BX.ajax.post(
37665						_this.arParams.AJAX_PAGE,
37666						{
37667							'ajax_call':'y',
37668							'INPUT_ID':_this.arParams.INPUT_ID_TMP,
37669							'q':_this.INPUT.value,
37670							'l':_this.arParams.MIN_QUERY_LEN
37671						},
37672						function(result)
37673						{
37674							_this.cache[_this.cache_key] = result;
37675							_this.ShowResult(result);
37676							_this.currentRow = -1;
37677							_this.EnableMouseEvents();
37678							if(_this.WAIT)
37679								_this.WAIT.style.display = 'none';
37680							if (!!callback)
37681								callback();
37682							_this.running = false;
37683
37684							if(_this.needRunAgain){
37685								_this.needRunAgain = false;
37686								_this.onChange(callback);
37687							}
37688						}
37689					);
37690					return;
37691				}
37692				else
37693				{
37694					_this.ShowResult(_this.cache[_this.cache_key]);
37695					_this.currentRow = -1;
37696					_this.EnableMouseEvents();
37697				}
37698			}
37699			else
37700			{
37701				_this.RESULT.style.display = 'none';
37702				_this.currentRow = -1;
37703				_this.UnSelectAll();
37704			}
37705		}
37706		if (!!callback)
37707			callback();
37708		_this.running = false;
37709	};
37710
37711	this.UnSelectAll = function()
37712	{
37713		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
37714		if(tbl)
37715		{
37716			var cnt = tbl.rows.length;
37717			for(var i = 0; i < cnt; i++)
37718				tbl.rows[i].className = '';
37719		}
37720	};
37721
37722	this.EnableMouseEvents = function()
37723	{
37724		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
37725		if(tbl)
37726		{
37727			var cnt = tbl.rows.length;
37728			for(var i = 0; i < cnt; i++)
37729				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
37730				{
37731					tbl.rows[i].id = 'row_' + i;
37732					tbl.rows[i].onmouseover = function (e) {
37733						if(_this.currentRow != this.id.substr(4))
37734						{
37735							_this.UnSelectAll();
37736							this.className = 'title-search-selected';
37737							_this.currentRow = this.id.substr(4);
37738						}
37739					};
37740					tbl.rows[i].onmouseout = function (e) {
37741						this.className = '';
37742						_this.currentRow = -1;
37743					};
37744				}
37745		}
37746	};
37747
37748	this.onFocusLost = function(hide)
37749	{
37750		setTimeout(function(){_this.RESULT.style.display = 'none';}, 300);
37751		// _this.RESULT.style.display = 'none';
37752	};
37753
37754	this.onFocusGain = function()
37755	{
37756		if(_this.RESULT.innerHTML.length)
37757			_this.ShowResult();
37758	};
37759
37760	this.onKeyDown = function(e)
37761	{
37762		if(!e)
37763			e = window.event;
37764		if (_this.RESULT.style.display == 'block')
37765		{
37766			if(_this.onKeyPress(e.keyCode))
37767				return BX.PreventDefault(e);
37768		}
37769	};
37770
37771	this.adjustResultNode = function()
37772	{
37773		var pos, pos_input;
37774		var fixedParent = BX.findParent(_this.CONTAINER, BX.is_fixed);
37775		// if(!!fixedParent)
37776		// {
37777		// 	_this.RESULT.style.position = 'fixed';
37778		// 	_this.RESULT.style.zIndex = BX.style(fixedParent, 'z-index') + 2;
37779		// 	pos = BX.pos(_this.CONTAINER, true);
37780		// }
37781		// else
37782		// {
37783			_this.RESULT.style.position = 'absolute';
37784			pos = BX.pos(_this.CONTAINER);
37785		// }
37786		pos_input = BX.pos(_this.INPUT);
37787
37788		pos.width = pos.right - pos.left;
37789		_this.RESULT.style.top = '100%';
37790		_this.RESULT.style.left = '0px';//pos_input.left + 'px';
37791
37792		if($(_this.INPUT).closest('.inline-search-block.with-close').length)
37793			_this.RESULT.style.width = pos_input.width + 'px';
37794		else
37795			_this.RESULT.style.width = pos.width + 'px';
37796		return pos;
37797	};
37798
37799	this._onContainerLayoutChange = function()
37800	{
37801		if(_this.RESULT.style.display !== "none" && _this.RESULT.innerHTML !== '')
37802		{
37803			_this.adjustResultNode();
37804		}
37805	};
37806	this.Init = function()
37807	{
37808		this.CONTAINER = document.getElementById(this.arParams.CONTAINER_ID);
37809		BX.addCustomEvent(this.CONTAINER, "OnNodeLayoutChange", this._onContainerLayoutChange);
37810
37811		this.RESULT = document.body.appendChild(document.createElement("DIV"));
37812
37813		this.RESULT.className = 'title-search-result '+this.arParams.INPUT_ID;
37814		this.INPUT = document.getElementById(this.arParams.INPUT_ID);
37815		this.startText = this.oldValue = this.INPUT.value;
37816		BX.bind(this.INPUT, 'focus', function(e) {
37817			_this.onFocusGain()
37818		});
37819		BX.bind(this.INPUT, 'blur', function(e) {
37820			if(!$(e.relatedTarget).hasClass('bx_item_block'))
37821				_this.onFocusLost();
37822		});
37823
37824		if(BX.browser.IsSafari() || BX.browser.IsIE())
37825			this.INPUT.onkeydown = this.onKeyDown;
37826		else
37827			this.INPUT.onkeypress = this.onKeyDown;
37828
37829		if(this.arParams.WAIT_IMAGE)
37830		{
37831			this.WAIT = document.body.appendChild(document.createElement("DIV"));
37832			this.WAIT.style.backgroundImage = "url('" + this.arParams.WAIT_IMAGE + "')";
37833			if(!BX.browser.IsIE())
37834				this.WAIT.style.backgroundRepeat = 'none';
37835			this.WAIT.style.display = 'none';
37836			this.WAIT.style.position = 'absolute';
37837			this.WAIT.style.zIndex = '1100';
37838		}
37839
37840		BX.bind(this.INPUT, 'bxchange', function(e) {_this.onChange()});
37841	};
37842	BX.ready(function (){_this.Init(arParams)});
37843}
37844
37845/* End */
37846;
37847; /* Start:"a:4:{s:4:"full";
37847s:102:"/bitrix/templates/aspro_max/components/aspro/com.banners.max/top_big_banner_3/script.js?17164655373073";s:6:"source";s:87:"/bitrix/templates/aspro_max/components/aspro/com.banners.max/top_big_banner_3/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
37848function checkNavColor(slider){
37849	var nav_color_flex = slider.find('.flex-active-slide').data('nav_color'),
37850		menu_color = slider.find('.flex-active-slide').data('text_color');
37851	if(nav_color_flex == 'dark')
37852		slider.find('.flex-control-nav').addClass('flex-dark');
37853	else
37854		slider.find('.flex-control-nav').removeClass('flex-dark');
37855
37856	var eventdata = {slider: slider};
37857	BX.onCustomEvent('onSlide', [eventdata]);
37858}
37859function checkHeight(){}
37860$(document).ready(function(){
37861	if($('.top_slider_wrapp .flexslider').length){
37862		var config = {"controlNav": true, "animationLoop": true, "pauseOnHover" : true, "simulateTouch" : true, 'autoHeight': true};
37863		if(typeof(arMaxOptions['THEME']) != 'undefined'){
37864			var slideshowSpeed = Math.abs(parseInt(arMaxOptions['THEME']['BIGBANNER_SLIDESSHOWSPEED']));
37865			var animationSpeed = Math.abs(parseInt(arMaxOptions['THEME']['BIGBANNER_ANIMATIONSPEED']));
37866			var currentBannerIndex = 0;
37867			config["slideshow"] = (slideshowSpeed && arMaxOptions['THEME']['BIGBANNER_ANIMATIONTYPE'].length ? true : false);
37868			config["animation"] = (arMaxOptions['THEME']['BIGBANNER_ANIMATIONTYPE'] === 'FADE' ? 'fade' : 'slide');
37869			if(animationSpeed >= 0){
37870				config["animationSpeed"] = animationSpeed;
37871			}
37872			if(slideshowSpeed >= 0){
37873				config["slideshowSpeed"] = slideshowSpeed;
37874			}
37875			if(arMaxOptions['THEME']['BIGBANNER_ANIMATIONTYPE'] !== 'FADE'){
37876				config["direction"] = (arMaxOptions['THEME']['BIGBANNER_ANIMATIONTYPE'] === 'SLIDE_VERTICAL' ? 'vertical' : 'horizontal');
37877			}
37878			if($('.top_slider_wrapp .flexslider').find('ul.slides li.box').length < 2) {
37879				config['animationLoop'] = false;
37880			}
37881
37882			if ('CURRENT_BANNER_INDEX' in arMaxOptions && arMaxOptions['CURRENT_BANNER_INDEX']) {
37883				currentBannerIndex = arMaxOptions['CURRENT_BANNER_INDEX'] - 1;
37884				if (currentBannerIndex < $('.top_slider_wrapp .flexslider .slides > li').length) {
37885					config['startAt'] = currentBannerIndex;
37886					config["slideshow"] = false;
37887				}
37888			}
37889			
37890			config.start = function(slider){
37891				checkNavColor(slider);
37892				var activeVideo = slider.find('.box.wvideo.flex-active-slide');
37893				if(activeVideo.length) {
37894					if(activeVideo.data('video_autoplay') == '1') {
37895						BX.onCustomEvent('onSlide', [{slider: slider}] );
37896					}
37897				}
37898				if(slider.count <= 1){
37899					slider.find('.flex-direction-nav li').addClass('flex-disabled');
37900				}
37901				$(slider).find('.flex-control-nav').css('opacity',1);
37902			}
37903			config.after = function(slider){
37904				// checkNavColor(slider);
37905				InitLazyLoad();
37906			}
37907			config.before = function(slider){
37908				setTimeout(function(){
37909					checkNavColor(slider);
37910					InitLazyLoad();
37911				}, 100);
37912			}
37913		}
37914
37915		$(".top_slider_wrapp .flexslider").appear(function(){
37916			var $this = $(this);
37917			$this.flexslider(config);
37918		}, {accX: 0, accY: 150})
37919	}
37920	
37921	checkHeight();
37922
37923	BX.addCustomEvent('onWindowResize', function(eventdata){
37924		try{
37925			ignoreResize.push(true);
37926			checkHeight();
37927			CoverPlayerHtml()
37928		}
37929		catch(e){}
37930		finally{
37931			ignoreResize.pop();
37932		}
37933	})
37934});
37935/* End */
37936;
37937; /* Start:"a:4:{s:4:"full";s: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:"";}"*/
37938$(document).ready(function(){
37939	if($('.dyn_mp_jqm').length)
37940	{
37941		var delayNext = 0;
37942		$('.dyn_mp_jqm').each(function(i, el) {
37943			var jqmBlock = $(el),
37944				delay = 0;
37945
37946			if(!jqmBlock.hasClass('initied')) // first load
37947			{
37948				jqmBlock.addClass('initied');
37949
37950				if(jqmBlock.data('param-delay'))
37951					delay = jqmBlock.data('param-delay')*1000;
37952
37953				if (delayNext == delay) {
37954					delay += 1000;
37955				}
37956
37957				delayNext = delay;
37958
37959				if(typeof localStorage !== 'undefined')
37960				{
37961					var dataLS = localStorage.getItem(jqmBlock.data('ls')),
37962						ls = '';
37963					try{
37964						ls = JSON.parse(dataLS);
37965					}
37966					catch(e){
37967						ls = dataLS
37968					}
37969					if(!ls || (ls && (ls.TIMESTAMP < Date.now() && ls.TIMESTAMP)))
37970					{
37971						/*if (timeoutID) {
37972							clearTimeout(timeoutID);
37973						}*/ 
37974						timeoutID = setTimeout(function(){
37975							console.log(jqmBlock, delay)
37976							jqmBlock.click();
37977						}, delay);
37978					}
37979				}
37980				else
37981				{
37982					var ls = $.cookie(jqmBlock.data('ls'));
37983					if(!ls)
37984					{
37985						/*if (timeoutID) {
37986							clearTimeout(timeoutID);
37987						}*/ 
37988						timeoutID = setTimeout(function(){
37989							jqmBlock.click();
37990						}, delay);
37991					}
37992				}
37993
37994			}
37995			else // ajax popup
37996			{
37997
37998			}
37999
38000		});
38001	}
38002
38003
38004	$(document).on('click', '.dyn_mp_jqm_frame .popup-text-info__btn .btn', function() {
38005		var closeBtn = $(this).closest('.dyn_mp_jqm_frame').find('.jqmClose');
38006
38007		if(closeBtn.length) {
38008			closeBtn.trigger('click');
38009		}
38010	}); 
38011})
38012/* End */
38013;
38014; /* 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:"";}"*/
38015function JCTitleSearch2(arParams)
38016{
38017	var _this = this;
38018
38019	this.arParams = {
38020		'AJAX_PAGE': arParams.AJAX_PAGE,
38021		'CONTAINER_ID': arParams.CONTAINER_ID,
38022		'INPUT_ID': arParams.INPUT_ID,
38023		'INPUT_ID_TMP': arParams.INPUT_ID_TMP,
38024		'MIN_QUERY_LEN': parseInt(arParams.MIN_QUERY_LEN)
38025	};
38026	if(arParams.WAIT_IMAGE)
38027		this.arParams.WAIT_IMAGE = arParams.WAIT_IMAGE;
38028	if(arParams.MIN_QUERY_LEN <= 0)
38029		arParams.MIN_QUERY_LEN = 1;
38030
38031	this.cache = [];
38032	this.cache_key = null;
38033
38034	this.startText = '';
38035	this.running = false;
38036	this.needRunAgain = false;
38037	this.currentRow = -1;
38038	this.RESULT = null;
38039	this.CONTAINER = null;
38040	this.INPUT = null;
38041	this.WAIT = null;
38042
38043	this.ShowResult = function(result)
38044	{
38045		if(BX.type.isString(result))
38046		{
38047			_this.RESULT.innerHTML = result;
38048		}
38049
38050		_this.RESULT.style.display = _this.RESULT.innerHTML !== '' ? 'block' : 'none';
38051		var pos = _this.adjustResultNode();
38052
38053		//adjust left column to be an outline
38054		var res_pos;
38055		var th;
38056		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
38057		if(tbl)
38058		{
38059			th = BX.findChild(tbl, {'tag':'th'}, true);
38060		}
38061		if(th)
38062		{
38063			var tbl_pos = BX.pos(tbl);
38064			tbl_pos.width = tbl_pos.right - tbl_pos.left;
38065
38066			var th_pos = BX.pos(th);
38067			th_pos.width = th_pos.right - th_pos.left;
38068			th.style.width = th_pos.width + 'px';
38069
38070			_this.RESULT.style.width = (pos.width + th_pos.width) + 'px';
38071
38072			//Move table to left by width of the first column
38073			_this.RESULT.style.left = (pos.left - th_pos.width - 1)+ 'px';
38074
38075			//Shrink table when it's too wide
38076			if((tbl_pos.width - th_pos.width) > pos.width)
38077				_this.RESULT.style.width = (pos.width + th_pos.width -1) + 'px';
38078
38079			//Check if table is too wide and shrink result div to it's width
38080			tbl_pos = BX.pos(tbl);
38081			res_pos = BX.pos(_this.RESULT);
38082			if(res_pos.right > tbl_pos.right)
38083			{
38084				_this.RESULT.style.width = (tbl_pos.right - tbl_pos.left) + 'px';
38085			}
38086		}
38087
38088		var fade;
38089		if(tbl) fade = BX.findChild(_this.RESULT, {'class':'title-search-fader'}, true);
38090		if(fade && th)
38091		{
38092			res_pos = BX.pos(_this.RESULT);
38093			fade.style.left = (res_pos.right - res_pos.left - 18) + 'px';
38094			fade.style.width = 18 + 'px';
38095			fade.style.top = 0 + 'px';
38096			fade.style.height = (res_pos.bottom - res_pos.top) + 'px';
38097			fade.style.display = 'block';
38098		}
38099
38100		$('.bx_searche.scrollbar').mCustomScrollbar({
38101			mouseWheel: {
38102				scrollAmount: 150,
38103				preventDefault: true
38104			}
38105		});
38106	};
38107
38108	this.onKeyPress = function(keyCode)
38109	{
38110		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
38111		if(!tbl)
38112			return false;
38113
38114		var i;
38115		var cnt = tbl.rows.length;
38116
38117		switch (keyCode)
38118		{
38119		case 27: // escape key - close search div
38120			_this.RESULT.style.display = 'none';
38121			_this.currentRow = -1;
38122			_this.UnSelectAll();
38123		return true;
38124
38125		case 40: // down key - navigate down on search results
38126			if(_this.RESULT.style.display == 'none')
38127				_this.RESULT.style.display = 'block';
38128
38129			var first = -1;
38130			for(i = 0; i < cnt; i++)
38131			{
38132				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
38133				{
38134					if(first == -1)
38135						first = i;
38136
38137					if(_this.currentRow < i)
38138					{
38139						_this.currentRow = i;
38140						break;
38141					}
38142					else if(tbl.rows[i].className == 'title-search-selected')
38143					{
38144						tbl.rows[i].className = '';
38145					}
38146				}
38147			}
38148
38149			if(i == cnt && _this.currentRow != i)
38150				_this.currentRow = first;
38151
38152			tbl.rows[_this.currentRow].className = 'title-search-selected';
38153		return true;
38154
38155		case 38: // up key - navigate up on search results
38156			if(_this.RESULT.style.display == 'none')
38157				_this.RESULT.style.display = 'block';
38158
38159			var last = -1;
38160			for(i = cnt-1; i >= 0; i--)
38161			{
38162				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
38163				{
38164					if(last == -1)
38165						last = i;
38166
38167					if(_this.currentRow > i)
38168					{
38169						_this.currentRow = i;
38170						break;
38171					}
38172					else if(tbl.rows[i].className == 'title-search-selected')
38173					{
38174						tbl.rows[i].className = '';
38175					}
38176				}
38177			}
38178
38179			if(i < 0 && _this.currentRow != i)
38180				_this.currentRow = last;
38181
38182			tbl.rows[_this.currentRow].className = 'title-search-selected';
38183		return true;
38184
38185		case 13: // enter key - choose current search result
38186			if(_this.RESULT.style.display == 'block')
38187			{
38188				for(i = 0; i < cnt; i++)
38189				{
38190					if(_this.currentRow == i)
38191					{
38192						if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
38193						{
38194							var a = BX.findChild(tbl.rows[i], {'tag':'a'}, true);
38195							if(a)
38196							{
38197								window.location = a.href;
38198								return true;
38199							}
38200						}
38201					}
38202				}
38203			}
38204		return false;
38205		}
38206
38207		return false;
38208	};
38209
38210	this.onTimeout = function()
38211	{
38212		_this.onChange(function(){
38213			setTimeout(_this.onTimeout, 500);
38214		});
38215	};
38216
38217	this.onChange = function(callback)
38218	{
38219		if (_this.running){
38220			_this.needRunAgain = true;
38221			return;
38222		}
38223		_this.running = true;
38224
38225		if(_this.INPUT.value != _this.oldValue && _this.INPUT.value != _this.startText)
38226		{
38227			_this.oldValue = _this.INPUT.value;
38228			if(_this.INPUT.value.length >= _this.arParams.MIN_QUERY_LEN)
38229			{
38230				_this.cache_key = _this.arParams.INPUT_ID + '|' + _this.INPUT.value;
38231				if(_this.cache[_this.cache_key] == null)
38232				{
38233					if(_this.WAIT)
38234					{
38235						var pos = BX.pos(_this.INPUT);
38236						var height = (pos.bottom - pos.top)-2;
38237						_this.WAIT.style.top = (pos.top+1) + 'px';
38238						_this.WAIT.style.height = height + 'px';
38239						_this.WAIT.style.width = height + 'px';
38240						_this.WAIT.style.left = (pos.right - height + 2) + 'px';
38241						_this.WAIT.style.display = 'block';
38242					}
38243
38244					BX.ajax.post(
38245						_this.arParams.AJAX_PAGE,
38246						{
38247							'ajax_call':'y',
38248							'INPUT_ID':_this.arParams.INPUT_ID_TMP,
38249							'q':_this.INPUT.value,
38250							'l':_this.arParams.MIN_QUERY_LEN
38251						},
38252						function(result)
38253						{
38254							_this.cache[_this.cache_key] = result;
38255							_this.ShowResult(result);
38256							_this.currentRow = -1;
38257							_this.EnableMouseEvents();
38258							if(_this.WAIT)
38259								_this.WAIT.style.display = 'none';
38260							if (!!callback)
38261								callback();
38262							_this.running = false;
38263
38264							if(_this.needRunAgain){
38265								_this.needRunAgain = false;
38266								_this.onChange(callback);
38267							}
38268						}
38269					);
38270					return;
38271				}
38272				else
38273				{
38274					_this.ShowResult(_this.cache[_this.cache_key]);
38275					_this.currentRow = -1;
38276					_this.EnableMouseEvents();
38277				}
38278			}
38279			else
38280			{
38281				_this.RESULT.style.display = 'none';
38282				_this.currentRow = -1;
38283				_this.UnSelectAll();
38284			}
38285		}
38286		if (!!callback)
38287			callback();
38288		_this.running = false;
38289	};
38290
38291	this.UnSelectAll = function()
38292	{
38293		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
38294		if(tbl)
38295		{
38296			var cnt = tbl.rows.length;
38297			for(var i = 0; i < cnt; i++)
38298				tbl.rows[i].className = '';
38299		}
38300	};
38301
38302	this.EnableMouseEvents = function()
38303	{
38304		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
38305		if(tbl)
38306		{
38307			var cnt = tbl.rows.length;
38308			for(var i = 0; i < cnt; i++)
38309				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
38310				{
38311					tbl.rows[i].id = 'row_' + i;
38312					tbl.rows[i].onmouseover = function (e) {
38313						if(_this.currentRow != this.id.substr(4))
38314						{
38315							_this.UnSelectAll();
38316							this.className = 'title-search-selected';
38317							_this.currentRow = this.id.substr(4);
38318						}
38319					};
38320					tbl.rows[i].onmouseout = function (e) {
38321						this.className = '';
38322						_this.currentRow = -1;
38323					};
38324				}
38325		}
38326	};
38327
38328	this.onFocusLost = function(hide)
38329	{
38330		setTimeout(function(){_this.RESULT.style.display = 'none';}, 300);
38331		// _this.RESULT.style.display = 'none';
38332	};
38333
38334	this.onFocusGain = function()
38335	{
38336		if(_this.RESULT.innerHTML.length)
38337			_this.ShowResult();
38338	};
38339
38340	this.onKeyDown = function(e)
38341	{
38342		if(!e)
38343			e = window.event;
38344
38345		if (_this.RESULT.style.display == 'block')
38346		{
38347			if(_this.onKeyPress(e.keyCode))
38348				return BX.PreventDefault(e);
38349		}
38350	};
38351
38352	this.adjustResultNode = function()
38353	{
38354		var pos, pos_input;
38355		var fixedParent = BX.findParent(_this.CONTAINER, BX.is_fixed);
38356		if(!!fixedParent)
38357		{
38358			_this.RESULT.style.position = 'fixed';
38359			_this.RESULT.style.zIndex = BX.style(fixedParent, 'z-index') + 2;
38360			pos = BX.pos(_this.CONTAINER, true);
38361		}
38362		else
38363		{
38364			_this.RESULT.style.position = 'absolute';
38365			pos = BX.pos(_this.CONTAINER);
38366		}
38367		//console.log(pos);
38368		//console.log(_this.CONTAINER);
38369		pos_input = BX.pos(_this.INPUT);
38370
38371		pos.width = pos.right - pos.left;
38372		_this.RESULT.style.top = (pos.bottom + 2) + 'px';
38373		_this.RESULT.style.left = pos_input.left + 'px';
38374
38375		if($(_this.INPUT).closest('.inline-search-block.with-close').length)
38376			_this.RESULT.style.width = pos_input.width + 'px';
38377		else
38378			_this.RESULT.style.width = pos.width + 'px';
38379		return pos;
38380	};
38381
38382	this._onContainerLayoutChange = function()
38383	{
38384		if(_this.RESULT.style.display !== "none" && _this.RESULT.innerHTML !== '')
38385		{
38386			_this.adjustResultNode();
38387		}
38388	};
38389	this.Init = function()
38390	{
38391		this.CONTAINER = document.getElementById(this.arParams.CONTAINER_ID);
38392		BX.addCustomEvent(this.CONTAINER, "OnNodeLayoutChange", this._onContainerLayoutChange);
38393
38394		this.RESULT = document.body.appendChild(document.createElement("DIV"));
38395
38396		this.RESULT.className = 'title-search-result '+this.arParams.INPUT_ID;
38397		if(this.arParams.INPUT_ID != 'title-search-input_fixed')
38398			this.RESULT.className += ' '+arMaxOptions['THEME']['TYPE_SEARCH']+'_type';
38399
38400		this.INPUT = document.getElementById(this.arParams.INPUT_ID);
38401		this.startText = this.oldValue = this.INPUT.value;
38402		BX.bind(this.INPUT, 'focus', function() {_this.onFocusGain()});
38403		BX.bind(this.INPUT, 'blur', function() {_this.onFocusLost()});
38404
38405		if(BX.browser.IsSafari() || BX.browser.IsIE())
38406			this.INPUT.onkeydown = this.onKeyDown;
38407		else
38408			this.INPUT.onkeypress = this.onKeyDown;
38409
38410		if(this.arParams.WAIT_IMAGE)
38411		{
38412			this.WAIT = document.body.appendChild(document.createElement("DIV"));
38413			this.WAIT.style.backgroundImage = "url('" + this.arParams.WAIT_IMAGE + "')";
38414			if(!BX.browser.IsIE())
38415				this.WAIT.style.backgroundRepeat = 'none';
38416			this.WAIT.style.display = 'none';
38417			this.WAIT.style.position = 'absolute';
38418			this.WAIT.style.zIndex = '1100';
38419		}
38420
38421		BX.bind(this.INPUT, 'bxchange', function() {_this.onChange()});
38422	};
38423	BX.ready(function (){_this.Init(arParams)});
38424}
38425
38426/* End */
38427;
38428; /* Start:"a:4:{s:4:"full";
38428s: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:"";}"*/
38429
38430//////// SEND DOCUMENT REFFER IF IT'S EXTERNAL (PRE-OG)
38431//console.log(document.referrer);
38432//console.log(document.location.hostname);
38433//console.log(document.location.href);
38434
38435//if (document.referrer.indexOf(document.location.hostname) === -1) {
38436$.ajax({
38437  url: "/ajax/set_referrer.php",
38438  method: "POST",
38439  data: {
38440    document_referrer: document.referrer,
38441    document_location_href: document.location.href
38442  }
38443});
38444  //}
38445/* End */
38446;
38447; /* 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:"";}"*/
38448document.addEventListener('DOMContentLoaded', function() {
38449  var panel = $('.b-fast-panel__index');
38450  var scrollPrev = 0;
38451
38452  $(window).on('scroll', function () {
38453    var width = window.innerWidth;
38454    if (width < 768) {
38455      var scrolled = $(window).scrollTop();
38456      if (scrolled > 0 && scrolled > scrollPrev || scrolled < 10) {
38457        panel.addClass('out');
38458      } else {
38459        panel.removeClass('out');
38460      }
38461      scrollPrev = scrolled;
38462    }
38463  });
38464}, false);
38465/* End */
38466;
38467; /* 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:"";}"*/
38468/*
38469You can use this file with your scripts.
38470It will not be overwritten when you upgrade solution.
38471*/
38472
38473
38474document.addEventListener('DOMContentLoaded', function () {
38475  let quiz_load = true;
38476  if (document.querySelector('#quiz-load') || document.querySelector('#quiz-load-banner')) {
38477    document.querySelector('#quiz-load').addEventListener("click",  quizLoad);
38478    if(document.querySelector('#quiz-load-banner')) {
38479      document.querySelector('#quiz-load-banner').addEventListener("click",  quizLoad);
38480    }
38481    
38482    
38483    async function quizLoad(e) {
38484      e.preventDefault();
38485      if (quiz_load) {
38486        quiz_load = false;
38487        const head = document.querySelector('head');
38488        const body = document.querySelector('body');
38489
38490        function addCSS(id, css, href, media) {
38491          let link = document.createElement('link');
38492          link.id = id;
38493          link.rel = 'stylesheet';
38494          if (css) {
38495            link.type = 'text/css';
38496          }
38497          link.href = href;
38498          if (media) {
38499            link.media = 'all';
38500          }
38501          head.appendChild(link);
38502        };
38503
38504        function addScript(id, src) {
38505          let link = document.createElement('script');
38506          link.id = id;
38507          link.src = src;
38508          body.appendChild(link);
38509        };
38510
38511        addCSS('quiz-css', true, '/quiz/css/style.min.css?00012', true);
38512        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);
38513
38514        await fetch('/quiz/start.php?0001')
38515          .then(function (response) {
38516            return response.text()
38517          })
38518          .then(function (html) {
38519            // console.info(html);
38520            let quiz = document.createElement('div');
38521            quiz.id = 'quiz-block';
38522            // quiz.setAttribute('data-id', '1')
38523            quiz.classList.add('quiz-block');
38524            quiz.innerHTML = html;
38525            body.appendChild(quiz);
38526            // quizForm();
38527            // quizLink();
38528            addScript('quiz-js', '/quiz/js/script.min.js?0008');
38529            // Close
38530            let closeQuiz = document.querySelector('#close-quiz');
38531            let closeSuccess = document.querySelector('#close-success');
38532            let quizBlock = document.querySelector('#quiz-block');
38533            closeQuiz.addEventListener('click', function (e) {
38534              e.preventDefault();
38535              quizBlock.classList.add('dn');
38536            })
38537            closeSuccess.addEventListener('click', function (e) {
38538              e.preventDefault();
38539              quiz_load = true;
38540              quizBlock.remove();
38541              document.querySelector('#quiz-js').remove();
38542              document.querySelector('#quiz-css').remove();
38543              document.querySelector('#quiz-font').remove();
38544            })
38545          })
38546          .catch(function (err) {
38547            console.error('Failed to fetch page: ', err);
38548          });
38549      } else {
38550        document.querySelector('#quiz-block').classList.remove('dn');
38551      }
38552    }
38553    
38554  }
38555}, false);
38556
38557
38558
38559// $(window).on("load", function () {
38560//
38561//   // Маска ввода телефона start
38562//   function setCursorPosition(pos, elem) {
38563//     elem.focus();
38564//     if (elem.setSelectionRange) elem.setSelectionRange(pos, pos);
38565//     else if (elem.createTextRange) {
38566//       var range = elem.createTextRange();
38567//       range.collapse(true);
38568//       range.moveEnd("character", pos);
38569//       range.moveStart("character", pos);
38570//       range.select()
38571//     }
38572//   }
38573//
38574//   function mask(event) {
38575//     var matrix = "+7 (___) ___-__-__",
38576//       i = 0,
38577//       def = matrix.replace(/\D/g, ""),
38578//       val = this.value.replace(/\D/g, "");
38579//     if (def.length >= val.length) val = def;
38580//     this.value = matrix.replace(/./g, function (a) {
38581//       return /[_\d]/.test(a) && i < val.length ? val.charAt(i++) : i >= val.length ? "" : a
38582//     });
38583//     if (event.type == "blur") {
38584//       if (this.value.length == 2) this.value = ""
38585//     } else setCursorPosition(this.value.length, this)
38586//   };
38587//
38588//   var inputPhone = document.querySelectorAll('input[name="phone"].required');
38589//   for (var i = 0; i < inputPhone.length; i++) {
38590//     inputPhone[i].addEventListener("input", mask, false);
38591//     inputPhone[i].addEventListener("focus", mask, false);
38592//     inputPhone[i].addEventListener("blur", mask, false);
38593//   }
38594//   ;
38595//   // Маска ввода телефона end
38596//
38597//
38598//   // показ модалки start
38599//   //ховер start
38600//   if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
38601//     // код для мобильных устройств
38602//   } else {
38603//     $(".modal-form__img, .modal-form__content, .modal-form__form")
38604//       .hover(
38605//         function () {
38606//           $(".modal-form__img").addClass("active");
38607//         },
38608//         function () {
38609//           $(".modal-form__img").removeClass('active');
38610//         }
38611//       );
38612//   }
38613//   //ховер end
38614//
38615//   function modalShow() {
38616//     // console.log("modalShow", sessionStorage.getItem("modalShow"));
38617//     return sessionStorage.getItem("modalShow") == "0" ? false : true
38618//   }
38619//
38620//   function modalActive() {
38621//     if (modalShow()) {
38622//       $(".modal-form_wrap").addClass("active");
38623//       sessionStorage.setItem("modalShow", "0");
38624//     }
38625//   }
38626//
38627//   const dataElement = $(".modal-form_wrap").attr("data-element");
38628//   // console.log("dataElement", dataElement);
38629//   if (dataElement === "" && modalShow()) {
38630//     console.log("dataElement if", dataElement);
38631//     inWindow();
38632//   } else if (dataElement !== "" && modalShow() && dataElement !== undefined) {
38633//     // console.log("dataElement else if", dataElement);
38634//     inWindow(dataElement);
38635//   }
38636//
38637//   function inWindow(elem = "#fast-popup") {
38638//     $(window).scroll(function () {
38639//       let wt = $(window).scrollTop();
38640//       let wh = $(window).height();
38641//       let et = $(elem).offset().top;
38642//       let eh = $(elem).outerHeight();
38643//       if (wt + wh >= et && wt + wh - eh * 2 <= et + (wh - eh)) {
38644//         if (modalShow()) {
38645//           modalActive();
38646//         }
38647//       }
38648//     });
38649//     // $(window).scroll(function(){
38650//     //   let wt = $(window).scrollTop();
38651//     //   let wh = $(window).height();
38652//     //   let et = $(elem).offset().top;
38653//     //   let eh = $(elem).outerHeight();
38654//     //   let dh = $(document).height();
38655//     //   if (wt + wh >= et || wh + wt == dh || eh + et < wh){
38656//     //     modalActive();
38657//     //   }
38658//     // });
38659//   }
38660//
38661//   const dataTime = $(".modal-form_wrap").attr("data-time");
38662//
38663//   // console.log("dataTime", dataTime);
38664//   function funTime(time = 60) {
38665//     setTimeout(modalActive, time + "000");
38666//   }
38667//
38668//   if (dataTime === "" && modalShow()) {
38669//     // console.log("dataTime if", dataTime);
38670//     funTime();
38671//   } else if (dataTime && dataTime > 0 && modalShow()) {
38672//     // console.log("dataTime else if", dataTime);
38673//     funTime(Number(dataTime));
38674//   }
38675//
38676//   const dataScroll = $(".modal-form_wrap").attr("data-scroll");
38677//   // console.log("dataScroll", dataScroll);
38678//   if (dataScroll !== "" && dataScroll !== undefined) {
38679//     // console.log("dataScroll if", dataScroll);
38680//     const heightHTML = $(document).outerHeight(true);
38681//     // console.log("heightHTML", heightHTML);
38682//     const heigh = Math.round(heightHTML / 100 * dataScroll - window.innerHeight / 2); // window.innerHeight / 2
38683//     // console.log("heigh", heigh);
38684//     $(window).scroll(function () {
38685//       let scrollTop = $(this).scrollTop()
38686//       // console.log("scrollTop", scrollTop);
38687//       // if (scrollTop <= heigh+10 && scrollTop >= heigh-10) {
38688//       //   console.log("TEST");
38689//       //   $(".modal-form_wrap").addClass("active");
38690//       // }
38691//       if (scrollTop >= heigh && modalShow()) {
38692//         modalActive();
38693//       }
38694//     });
38695//   }
38696//
38697//   const dataClick = $(".modal-form_wrap").attr("data-click");
38698//
38699//   // console.log("dataClick", dataClick);
38700//   function funClick(click = "#show-fast-popup") {
38701//     $("a[href=" + click + "]").on("click", function () {
38702//       modalActive();
38703//     });
38704//   }
38705//
38706//   if (dataClick === "") {
38707//     // console.log("dataClick if", dataClick);
38708//     funClick();
38709//   } else if (dataClick !== "" && dataClick !== undefined) {
38710//     // console.log("dataClick else if", dataClick);
38711//     funClick(dataClick);
38712//   }
38713//
38714//   const dataMouse = $(".modal-form_wrap").attr("data-mouse");
38715//   // console.log("dataMouse", dataMouse);
38716//   if (dataMouse === "" && modalShow()) {
38717//     $(window).on('mouseleave', function (e) {
38718//       if (e.relatedTarget == null && modalShow()) {
38719//         modalActive();
38720//       }
38721//     });
38722//   }
38723//
38724//   $(".modal-form__close").on("click", function () {
38725//     $(".modal-form_wrap").removeClass("active");
38726//   });
38727//   // показ модалки end
38728//
38729//   // отправка формы start
38730//   if ($(".modal-form_wrap")) {
38731//     // Отправка формы
38732//     $(".modal-form__form-send").on("click", function (e) {
38733//       e.preventDefault();
38734//
38735//       // получаем форму
38736//       var form = $(this).parent(".modal-form__form-form");
38737//       // console.log(form);
38738//
38739//       //укажем url в форме
38740//       var location = window.location.pathname;
38741//       // console.log(location)
38742//       form.find("input[name='url']").val(location);
38743//
38744//       // собираем потомков
38745//       var formChildren = form.find(".modal-form__form-input.required");
38746//       // console.log(formChildren);
38747//
38748//       // очистка поля от обводки ошибки заполнения
38749//       if (formChildren.parent(".modal-form__form-label").hasClass("err")) {
38750//         formChildren.parent(".modal-form__form-label").removeClass("err");
38751//         form.find("div.error").remove();
38752//         // formChildren.parent(".modal-form__form-label").siblings("div.error").remove();
38753//       }
38754//
38755//       // массив ошибок заполнение полей
38756//       var err = [];
38757//
38758//       // Проверка на заполнение полей
38759//       formChildren.each(function () {
38760//         if ($(this).hasClass("required")) {
38761//           var name = $(this).attr("name");
38762//           // console.log(name);
38763//           switch (name) {
38764//             case "name":
38765//               if ($(this).val() === "") {
38766//                 $(this).after('<div class="error">Заполните поле</div>');
38767//                 $(this).parent(".modal-form__form-label").addClass("err");
38768//                 err.push('false');
38769//               }
38770//               break;
38771//             case "phone":
38772//               if ($(this).val() === "") {
38773//                 $(this).after('<div class="error">Заполните поле</div>');
38774//                 $(this).parent(".modal-form__form-label").addClass("err");
38775//                 err.push('false');
38776//               } else if ($(this).val() != $(this).val().match(/\+7 \(\d\d\d\) \d\d\d-\d\d-\d\d/)) {
38777//                 $(this).after('<div class="error">Введите валидный номер</div>');
38778//                 $(this).parent(".modal-form__form-label").addClass("err");
38779//                 err.push('false');
38780//               }
38781//               break;
38782//           }
38783//           setTimeout(function () {
38784//             formChildren.parent(".modal-form__form-label").removeClass("err");
38785//             form.find("div.error").remove();
38786//           }, 5000);
38787//         }
38788//       });
38789//
38790//       // если ошибок нет отправим форму
38791//       if (!err.includes('false')) {
38792//         var formData = new FormData(form.get(0));
38793//         // for(let [name, value] of formData) {
38794//         //   console.log(`${name} = ${value}`);
38795//         // }
38796//
38797//         $.ajax({
38798//           url: "/ajax/custom_form/handler.php",
38799//           type: "POST",
38800//           contentType: false,
38801//           processData: false,
38802//           data: formData,
38803//           success: function (data) {
38804//             // console.log(data);
38805//             // form.html(data);
38806//             // var dt = data.replace(/\s/g, '');
38807//             form.after("<p id='successfully'>Форма успешно отправлена</p>");
38808//             form.hide();
38809//             $(".modal-form__form-privacy").hide();
38810//
38811//             gtag('event', 'Отправка формы', {'event_category': 'Отправка любой формы'});
38812//             ym(66908173, 'reachGoal', 'send_all_form');
38813//
38814//             setTimeout(function () {
38815//               $("#successfully").remove();
38816//               form[0].reset();
38817//               form.show();
38818//               $(".modal-form__form-privacy").show();
38819//             }, 5000);
38820//           },
38821//           error: function (xhr, str) {
38822//             alert('Возникла ошибка: ' + xhr.responseCode);
38823//           }
38824//         });
38825//       }
38826//
38827//     });
38828//   }
38829//   // отправка формы end
38830// });
38831//
38832
38833/* End */
38834;; /* /bitrix/templates/aspro_max/js/lazysizes.min.js?17164655377057*/
38835; /* /bitrix/templates/aspro_max/js/ls.unveilhooks.min.js?17164655371467*/
38836; /* /bitrix/templates/aspro_max/js/jquery.actual.min.js?17164655371251*/
38837; /* /bitrix/templates/aspro_max/vendor/js/jquery.bxslider.js?171646553766080*/
38838; /* /bitrix/templates/aspro_max/js/jqModal.js?171646553710972*/
38839; /* /bitrix/templates/aspro_max/vendor/js/bootstrap.js?171646553727908*/
38840; /* /bitrix/templates/aspro_max/vendor/js/jquery.appear.js?17164655373188*/
38841; /* /bitrix/templates/aspro_max/vendor/js/ripple.js?17164655374702*/
38842; /* /bitrix/templates/aspro_max/vendor/js/velocity/velocity.js?171646553744791*/
38843; /* /bitrix/templates/aspro_max/vendor/js/velocity/velocity.ui.js?171646553713257*/
38844; /* /bitrix/templates/aspro_max/vendor/js/jquery.menu-aim.js?171646553712787*/
38845; /* /bitrix/templates/aspro_max/js/browser.js?17164655371032*/
38846; /* /bitrix/templates/aspro_max/js/jquery.fancybox.js?1716465537160667*/
38847; /* /bitrix/templates/aspro_max/js/jquery.flexslider.js?171646553759389*/
38848; /* /bitrix/templates/aspro_max/js/jquery.uniform.min.js?17164655378308*/
38849;
38849 /* /bitrix/templates/aspro_max/vendor/js/carousel/owl/owl.carousel.js?171646553789992*/
38850; /* /bitrix/templates/aspro_max/vendor/js/moment.min.js?171646553734436*/
38851; /* /bitrix/templates/aspro_max/vendor/js/footable.js?1716465537275478*/
38852; /* /bitrix/templates/aspro_max/vendor/js/ResizeSensor.js?171646553711190*/
38853; /* /bitrix/templates/aspro_max/vendor/js/sticky-sidebar.js?171646553725483*/
38854; /* /bitrix/templates/aspro_max/js/jquery.validate.min.js?171646553722257*/
38855; /* /bitrix/templates/aspro_max/js/aspro_animate_open_fancy.js?17164655371916*/
38856; /* /bitrix/templates/aspro_max/js/jquery.inputmask.bundle.min.js?171646553770933*/
38857; /* /bitrix/templates/aspro_max/js/jquery.easing.1.3.js?17164655378095*/
38858; /* /bitrix/templates/aspro_max/js/equalize.min.js?1716465537588*/
38859; /* /bitrix/templates/aspro_max/js/jquery.alphanumeric.js?17164655371972*/
38860; /* /bitrix/templates/aspro_max/js/jquery.cookie.js?17164655373066*/
38861; /* /bitrix/templates/aspro_max/js/jquery.plugin.min.js?17164655373181*/
38862; /* /bitrix/templates/aspro_max/js/jquery.countdown.min.js?171646553713137*/
38863; /* /bitrix/templates/aspro_max/js/jquery.countdown-ru.js?17164655371885*/
38864; /* /bitrix/templates/aspro_max/js/jquery.ikSelect.js?171646553732030*/
38865; /* /bitrix/templates/aspro_max/js/jquery.mobile.custom.touch.min.js?17164655377784*/
38866; /* /bitrix/templates/aspro_max/js/jquery.dotdotdot.js?17164655375908*/
38867; /* /bitrix/templates/aspro_max/js/rating_likes.js?171646553710797*/
38868; /* /bitrix/templates/aspro_max/js/video_banner.js?171646553732656*/
38869; /* /bitrix/templates/aspro_max/js/mobile.js?171646553721833*/
38870; /* /bitrix/templates/aspro_max/js/jquery.mCustomScrollbar.js?171646553794214*/
38871; /* /bitrix/templates/aspro_max/js/scrollTabs.js?171646553712996*/
38872; /* /bitrix/templates/aspro_max/js/main.js?1777873358290020*/
38873; /* /bitrix/templates/aspro_max/js/blocks/blocks.js?17164655377762*/
38874; /* /bitrix/components/bitrix/search.title/script.js?17164655439847*/
38875; /* /bitrix/templates/aspro_max/components/bitrix/search.title/mega_menu/script.js?171646553710313*/
38876; /* /bitrix/templates/aspro_max/components/bitrix/menu/menu_in_burger/script.js?1716465537208*/
38877; /* /bitrix/templates/aspro_max/components/bitrix/menu/top/script.js?1716465537191*/
38878; /* /bitrix/templates/aspro_max/components/bitrix/search.title/corp/script.
38878js?171646553710607*/
38879; /* /bitrix/templates/aspro_max/components/aspro/com.banners.max/top_big_banner_3/script.js?17164655373073*/
38880; /* /bitrix/components/aspro/marketing.popup.max/templates/.default/script.js?17164655411434*/
38881; /* /bitrix/templates/aspro_max/components/bitrix/search.title/fixed/script.js?171646553710264*/
38882; /* /bitrix/templates/aspro_max/js/set_referrer.js?1716465537420*/
38883; /* /bitrix/templates/aspro_max/js/fast_panel.js?1716465537471*/
38884; /* /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.