PageSourceSearch

https://eco2b.ru/bitrix/cache/js/s1/aspro_next/template_9768a7e5a7…8186d0275221cb3d2b7_v1.js?17658721161374677

js eco2b.ru collected 2026-10-07 18:08:39 UTC 1,374,677 bytes, 25,646 lines download raw bytes

1
2; /* Start:"a:4:{s:4:"full";s:66:"/local/templates/aspro_next/js/jquery.actual.min.js?17259704381251";s:6:"source";s:51:"/local/templates/aspro_next/js/jquery.actual.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
3/*! Copyright 2012, Ben Lin (http://dreamerslab.com/)
4 * Licensed under the MIT License (LICENSE.txt).
5 *
6 * Version: 1.0.18
7 *
8 * Requires: jQuery >= 1.2.3
9 */
10(function(a){if(typeof define==="function"&&define.amd){define(["jquery"],a);
11}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';
12}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; ";
13e=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");
14d+="visibility: hidden !important; display: "+i.display+" !important; ";if(i.absolute===true){d+="position: absolute !important; ";}c.each(function(){var m=a(this);
15var 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");
16}else{o.attr("style",n);}});};}h();var k=/(outer)/.test(b)?e[b](i.includeMargin):e[b]();j();return k;}});}));
17/* End */
18;
19; /* Start:"a:4:{s:4:"full";s:72:"/local/templates/aspro_next/vendor/js/jquery.bxslider.js?172597048166080";s:6:"source";s:56:"/local/templates/aspro_next/vendor/js/jquery.bxslider.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
20/**
21 * bxSlider v4.2.12
22 * Copyright 2013-2015 Steven Wanderski
23 * Written while drinking Belgian ales and listening to jazz
24 * Licensed under MIT (http://opensource.org/licenses/MIT)
25 */
26
27;(function($) {
28
29  var defaults = {
30
31    // GENERAL
32    mode: 'horizontal',
33    slideSelector: '',
34    infiniteLoop: true,
35    hideControlOnEnd: false,
36    speed: 500,
37    easing: null,
38    slideMargin: 0,
39    startSlide: 0,
40    randomStart: false,
41    captions: false,
42    ticker: false,
43    tickerHover: false,
44    adaptiveHeight: false,
45    adaptiveHeightSpeed: 500,
46    video: false,
47    useCSS: true,
48    preloadImages: 'visible',
49    responsive: true,
50    slideZIndex: 50,
51    wrapperClass: 'bx-wrapper',
52
53    // TOUCH
54    touchEnabled: true,
55    swipeThreshold: 50,
56    oneToOneTouch: true,
57    preventDefaultSwipeX: true,
58    preventDefaultSwipeY: false,
59
60    // ACCESSIBILITY
61    ariaLive: true,
62    ariaHidden: true,
63
64    // KEYBOARD
65    keyboardEnabled: false,
66
67    // PAGER
68    pager: true,
69    pagerType: 'full',
70    pagerShortSeparator: ' / ',
71    pagerSelector: null,
72    buildPager: null,
73    pagerCustom: null,
74
75    // CONTROLS
76    controls: true,
77    nextText: 'Next',
78    prevText: 'Prev',
79    nextSelector: null,
80    prevSelector: null,
81    autoControls: false,
82    startText: 'Start',
83    stopText: 'Stop',
84    autoControlsCombine: false,
85    autoControlsSelector: null,
86
87    // AUTO
88    auto: false,
89    pause: 4000,
90    autoStart: true,
91    autoDirection: 'next',
92    stopAutoOnClick: false,
93    autoHover: false,
94    autoDelay: 0,
95    autoSlideForOnePage: false,
96
97    // CAROUSEL
98    minSlides: 1,
99    maxSlides: 1,
100    moveSlides: 0,
101    slideWidth: 0,
102    shrinkItems: false,
103
104    // CALLBACKS
105    onSliderLoad: function() { return true; },
106    onSlideBefore: function() { return true; },
107    onSlideAfter: function() { return true; },
108    onSlideNext: function() { return true; },
109    onSlidePrev: function() { return true; },
110    onSliderResize: function() { return true; },
111	onAutoChange: function() { return true; } //calls when auto slides starts and stops
112  };
113
114  $.fn.bxSlider = function(options) {
115
116    if (this.length === 0) {
117      return this;
118    }
119
120    // support multiple elements
121    if (this.length > 1) {
122      this.each(function() {
123        $(this).bxSlider(options);
124      });
125      return this;
126    }
127
128    // create a namespace to be used throughout the plugin
129    var slider = {},
130    // set a reference to our slider element
131    el = this,
132    // get the original window dimens (thanks a lot IE)
133    windowWidth = $(window).width(),
134    windowHeight = $(window).height();
135
136    // Return if slider is already initialized
137    if ($(el).data('bxSlider')) { return; }
138
139    /**
140     * ===================================================================================
141     * = PRIVATE FUNCTIONS
142     * ===================================================================================
143     */
144
145    /**
146     * Initializes namespace settings to be used throughout plugin
147     */
148    var init = function() {
149      // Return if slider is already initialized
150      if ($(el).data('bxSlider')) { return; }
151      // merge user-supplied options with the defaults
152      slider.settings = $.extend({}, defaults, options);
153      // parse slideWidth setting
154      slider.settings.slideWidth = parseInt(slider.settings.slideWidth);
155      // store the original children
156      slider.children = el.children(slider.settings.slideSelector);
157      // check if actual number of slides is less than minSlides / maxSlides
158      if (slider.children.length < slider.settings.minSlides) { slider.settings.minSlides = slider.children.length; }
159      if (slider.children.length < slider.settings.maxSlides) { slider.settings.maxSlides = slider.children.length; }
160      // if random start, set the startSlide setting to random number
161      if (slider.settings.randomStart) { slider.settings.startSlide = Math.floor(Math.random() * slider.children.length); }
162      // store active slide information
163      slider.active = { index: slider.settings.startSlide };
vendor: 8,753 bytes, lines 164-342
164      // store if the slider is in carousel mode (displaying / moving multiple slides)
165      slider.carousel = slider.settings.minSlides > 1 || slider.settings.maxSlides > 1 ? true : false;
166      // if carousel, force preloadImages = 'all'
167      if (slider.carousel) { slider.settings.preloadImages = 'all'; }
168      // calculate the min / max width thresholds based on min / max number of slides
169      // used to setup and update carousel slides dimensions
170      slider.minThreshold = (slider.settings.minSlides * slider.settings.slideWidth) + ((slider.settings.minSlides - 1) * slider.settings.slideMargin);
171      slider.maxThreshold = (slider.settings.maxSlides * slider.settings.slideWidth) + ((slider.settings.maxSlides - 1) * slider.settings.slideMargin);
172      // store the current state of the slider (if currently animating, working is true)
173      slider.working = false;
174      // initialize the controls object
175      slider.controls = {};
176      // initialize an auto interval
177      slider.interval = null;
178      // determine which property to use for transitions
179      slider.animProp = slider.settings.mode === 'vertical' ? 'top' : 'left';
180      // determine if hardware acceleration can be used
181      slider.usingCSS = slider.settings.useCSS && slider.settings.mode !== 'fade' && (function() {
182        // create our test div element
183        var div = document.createElement('div'),
184        // css transition properties
185        props = ['WebkitPerspective', 'MozPerspective', 'OPerspective', 'msPerspective'];
186        // test for each property
187        for (var i = 0; i < props.length; i++) {
188          if (div.style[props[i]] !== undefined) {
189            slider.cssPrefix = props[i].replace('Perspective', '').toLowerCase();
190            slider.animProp = '-' + slider.cssPrefix + '-transform';
191            return true;
192          }
193        }
194        return false;
195      }());
196      // if vertical mode always make maxSlides and minSlides equal
197      if (slider.settings.mode === 'vertical') { slider.settings.maxSlides = slider.settings.minSlides; }
198      // save original style data
199      el.data('origStyle', el.attr('style'));
200      el.children(slider.settings.slideSelector).each(function() {
201        $(this).data('origStyle', $(this).attr('style'));
202      });
203
204      // perform all DOM / CSS modifications
205      setup();
206    };
207
208    /**
209     * Performs all DOM and CSS modifications
210     */
211    var setup = function() {
212      var preloadSelector = slider.children.eq(slider.settings.startSlide); // set the default preload selector (visible)
213
214      // wrap el in a wrapper
215      el.wrap('<div class="' + slider.settings.wrapperClass + '"><div class="bx-viewport"></div></div>');
216      // store a namespace reference to .bx-viewport
217      slider.viewport = el.parent();
218
219      // add aria-live if the setting is enabled and ticker mode is disabled
220      if (slider.settings.ariaLive && !slider.settings.ticker) {
221        slider.viewport.attr('aria-live', 'polite');
222      }
223      // add a loading div to display while images are loading
224      slider.loader = $('<div class="bx-loading" />');
225      slider.viewport.prepend(slider.loader);
226      // set el to a massive width, to hold any needed slides
227      // also strip any margin and padding from el
228      el.css({
229        width: slider.settings.mode === 'horizontal' ? (slider.children.length * 1000 + 215) + '%' : 'auto',
230        position: 'relative'
231      });
232      // if using CSS, add the easing property
233      if (slider.usingCSS && slider.settings.easing) {
234        el.css('-' + slider.cssPrefix + '-transition-timing-function', slider.settings.easing);
235      // if not using CSS and no easing value was supplied, use the default JS animation easing (swing)
236      } else if (!slider.settings.easing) {
237        slider.settings.easing = 'swing';
238      }
239      // make modifications to the viewport (.bx-viewport)
240      slider.viewport.css({
241        width: '100%',
242        overflow: 'hidden',
243        position: 'relative'
244      });
245      slider.viewport.parent().css({
246        maxWidth: getViewportMaxWidth()
247      });
248      // apply css to all slider children
249      slider.children.css({
250        // the float attribute is a reserved word in compressors like YUI compressor and need to be quoted #48
251        'float': slider.settings.mode === 'horizontal' ? 'left' : 'none',
252        listStyle: 'none',
253        position: 'relative'
254      });
255      // apply the calculated width after the float is applied to prevent scrollbar interference
256      slider.children.css('width', getSlideWidth());
257      // if slideMargin is supplied, add the css
258      if (slider.settings.mode === 'horizontal' && slider.settings.slideMargin > 0) { slider.children.css('marginRight', slider.settings.slideMargin); }
259      if (slider.settings.mode === 'vertical' && slider.settings.slideMargin > 0) { slider.children.css('marginBottom', slider.settings.slideMargin); }
260      // if "fade" mode, add positioning and z-index CSS
261      if (slider.settings.mode === 'fade') {
262        slider.children.css({
263          position: 'absolute',
264          zIndex: 0,
265          display: 'none'
266        });
267        // prepare the z-index on the showing element
268        slider.children.eq(slider.settings.startSlide).css({zIndex: slider.settings.slideZIndex, display: 'block'});
269      }
270      // create an element to contain all slider controls (pager, start / stop, etc)
271      slider.controls.el = $('<div class="bx-controls" />');
272      // if captions are requested, add them
273      if (slider.settings.captions) { appendCaptions(); }
274      // check if startSlide is last slide
275      slider.active.last = slider.settings.startSlide === getPagerQty() - 1;
276      // if video is true, set up the fitVids plugin
277      if (slider.settings.video) { el.fitVids(); }
278      if (slider.settings.preloadImages === 'all' || slider.settings.ticker) { preloadSelector = slider.children; }
279      // only check for control addition if not in "ticker" mode
280      if (!slider.settings.ticker) {
281        // if controls are requested, add them
282        if (slider.settings.controls) { appendControls(); }
283        // if auto is true, and auto controls are requested, add them
284        if (slider.settings.auto && slider.settings.autoControls) { appendControlsAuto(); }
285        // if pager is requested, add it
286        if (slider.settings.pager) { appendPager(); }
287        // if any control option is requested, add the controls wrapper
288        if (slider.settings.controls || slider.settings.autoControls || slider.settings.pager) { slider.viewport.after(slider.controls.el); }
289      // if ticker mode, do not allow a pager
290      } else {
291        slider.settings.pager = false;
292      }
293      loadElements(preloadSelector, start);
294    };
295
296    var loadElements = function(selector, callback) {
297      var total = selector.find('img:not([src=""]), iframe').length,
298      count = 0;
299      if (total === 0) {
300        callback();
301        return;
302      }
303      selector.find('img:not([src=""]), iframe').each(function() {
304        $(this).one('load error', function() {
305          if (++count === total) { callback(); }
306        }).each(function() {
307          if (this.complete || this.src == '') { $(this).trigger('load'); }
308        });
309      });
310    };
311
312    /**
313     * Start the slider
314     */
315    var start = function() {
316      // if infinite loop, prepare additional slides
317      if (slider.settings.infiniteLoop && slider.settings.mode !== 'fade' && !slider.settings.ticker) {
318        var slice    = slider.settings.mode === 'vertical' ? slider.settings.minSlides : slider.settings.maxSlides,
319        sliceAppend  = slider.children.slice(0, slice).clone(true).addClass('bx-clone'),
320        slicePrepend = slider.children.slice(-slice).clone(true).addClass('bx-clone');
321        if (slider.settings.ariaHidden) {
322          sliceAppend.attr('aria-hidden', true);
323          slicePrepend.attr('aria-hidden', true);
324        }
325        el.append(sliceAppend).prepend(slicePrepend);
326      }
327      // remove the loading DOM element
328      slider.loader.remove();
329      // set the left / top position of "el"
330      setSlidePosition();
331      // if "vertical" mode, always use adaptiveHeight to prevent odd behavior
332      if (slider.settings.mode === 'vertical') { slider.settings.adaptiveHeight = true; }
333      // set the viewport height
334      slider.viewport.height(getViewportHeight());
335      // make sure everything is positioned just right (same as a window resize)
336      el.redrawSlider();
337      // onSliderLoad callback
338      slider.settings.onSliderLoad.call(el, slider.active.index);
339      // slider has been fully initialized
340      slider.initialized = true;
341      // bind the resize call to the window
342      if (slider.settings.responsive) { $(window).bind
vendor: 11,109 bytes, lines 342-582
342('resize', resizeWindow); }
343      // if auto is true and has more than 1 page, start the show
344      if (slider.settings.auto && slider.settings.autoStart && (getPagerQty() > 1 || slider.settings.autoSlideForOnePage)) { initAuto(); }
345      // if ticker is true, start the ticker
346      if (slider.settings.ticker) { initTicker(); }
347      // if pager is requested, make the appropriate pager link active
348      if (slider.settings.pager) { updatePagerActive(slider.settings.startSlide); }
349      // check for any updates to the controls (like hideControlOnEnd updates)
350      if (slider.settings.controls) { updateDirectionControls(); }
351      // if touchEnabled is true, setup the touch events
352      if (slider.settings.touchEnabled && !slider.settings.ticker) { initTouch(); }
353      // if keyboardEnabled is true, setup the keyboard events
354      if (slider.settings.keyboardEnabled && !slider.settings.ticker) {
355        $(document).keydown(keyPress);
356      }
357    };
358
359    /**
360     * Returns the calculated height of the viewport, used to determine either adaptiveHeight or the maxHeight value
361     */
362    var getViewportHeight = function() {
363      var height = 0;
364      // first determine which children (slides) should be used in our height calculation
365      var children = $();
366      // if mode is not "vertical" and adaptiveHeight is false, include all children
367      if (slider.settings.mode !== 'vertical' && !slider.settings.adaptiveHeight) {
368        children = slider.children;
369      } else {
370        // if not carousel, return the single active child
371        if (!slider.carousel) {
372          children = slider.children.eq(slider.active.index);
373        // if carousel, return a slice of children
374        } else {
375          // get the individual slide index
376          var currentIndex = slider.settings.moveSlides === 1 ? slider.active.index : slider.active.index * getMoveBy();
377          // add the current slide to the children
378          children = slider.children.eq(currentIndex);
379          // cycle through the remaining "showing" slides
380          for (i = 1; i <= slider.settings.maxSlides - 1; i++) {
381            // if looped back to the start
382            if (currentIndex + i >= slider.children.length) {
383              children = children.add(slider.children.eq(i - 1));
384            } else {
385              children = children.add(slider.children.eq(currentIndex + i));
386            }
387          }
388        }
389      }
390      // if "vertical" mode, calculate the sum of the heights of the children
391      if (slider.settings.mode === 'vertical') {
392        children.each(function(index) {
393          height += $(this).outerHeight();
394        });
395        // add user-supplied margins
396        if (slider.settings.slideMargin > 0) {
397          height += slider.settings.slideMargin * (slider.settings.minSlides - 1);
398        }
399      // if not "vertical" mode, calculate the max height of the children
400      } else {
401        height = Math.max.apply(Math, children.map(function() {
402          return $(this).outerHeight(false);
403        }).get());
404      }
405
406      if (slider.viewport.css('box-sizing') === 'border-box') {
407        height += parseFloat(slider.viewport.css('padding-top')) + parseFloat(slider.viewport.css('padding-bottom')) +
408              parseFloat(slider.viewport.css('border-top-width')) + parseFloat(slider.viewport.css('border-bottom-width'));
409      } else if (slider.viewport.css('box-sizing') === 'padding-box') {
410        height += parseFloat(slider.viewport.css('padding-top')) + parseFloat(slider.viewport.css('padding-bottom'));
411      }
412
413      return height;
414    };
415
416    /**
417     * Returns the calculated width to be used for the outer wrapper / viewport
418     */
419    var getViewportMaxWidth = function() {
420      var width = '100%';
421      if (slider.settings.slideWidth > 0) {
422        if (slider.settings.mode === 'horizontal') {
423          width = (slider.settings.maxSlides * slider.settings.slideWidth) + ((slider.settings.maxSlides - 1) * slider.settings.slideMargin);
424        } else {
425          width = slider.settings.slideWidth;
426        }
427      }
428      return width;
429    };
430
431    /**
432     * Returns the calculated width to be applied to each slide
433     */
434    var getSlideWidth = function() {
435      var newElWidth = slider.settings.slideWidth, // start with any user-supplied slide width
436      wrapWidth      = slider.viewport.width();    // get the current viewport width
437      // if slide width was not supplied, or is larger than the viewport use the viewport width
438      if (slider.settings.slideWidth === 0 ||
439        (slider.settings.slideWidth > wrapWidth && !slider.carousel) ||
440        slider.settings.mode === 'vertical') {
441        newElWidth = wrapWidth;
442      // if carousel, use the thresholds to determine the width
443      } else if (slider.settings.maxSlides > 1 && slider.settings.mode === 'horizontal') {
444        if (wrapWidth > slider.maxThreshold) {
445          return newElWidth;
446        } else if (wrapWidth < slider.minThreshold) {
447          newElWidth = (wrapWidth - (slider.settings.slideMargin * (slider.settings.minSlides - 1))) / slider.settings.minSlides;
448        } else if (slider.settings.shrinkItems) {
449          newElWidth = Math.floor((wrapWidth + slider.settings.slideMargin) / (Math.ceil((wrapWidth + slider.settings.slideMargin) / (newElWidth + slider.settings.slideMargin))) - slider.settings.slideMargin);
450        }
451      }
452      return newElWidth;
453    };
454
455    /**
456     * Returns the number of slides currently visible in the viewport (includes partially visible slides)
457     */
458    var getNumberSlidesShowing = function() {
459      var slidesShowing = 1,
460      childWidth = null;
461      if (slider.settings.mode === 'horizontal' && slider.settings.slideWidth > 0) {
462        // if viewport is smaller than minThreshold, return minSlides
463        if (slider.viewport.width() < slider.minThreshold) {
464          slidesShowing = slider.settings.minSlides;
465        // if viewport is larger than maxThreshold, return maxSlides
466        } else if (slider.viewport.width() > slider.maxThreshold) {
467          slidesShowing = slider.settings.maxSlides;
468        // if viewport is between min / max thresholds, divide viewport width by first child width
469        } else {
470          childWidth = slider.children.first().width() + slider.settings.slideMargin;
471          slidesShowing = Math.floor((slider.viewport.width() +
472            slider.settings.slideMargin) / childWidth) || 1;
473        }
474      // if "vertical" mode, slides showing will always be minSlides
475      } else if (slider.settings.mode === 'vertical') {
476        slidesShowing = slider.settings.minSlides;
477      }
478      return slidesShowing;
479    };
480
481    /**
482     * Returns the number of pages (one full viewport of slides is one "page")
483     */
484    var getPagerQty = function() {
485      var pagerQty = 0,
486      breakPoint = 0,
487      counter = 0;
488      // if moveSlides is specified by the user
489      if (slider.settings.moveSlides > 0) {
490        if (slider.settings.infiniteLoop) {
491          pagerQty = Math.ceil(slider.children.length / getMoveBy());
492        } else {
493          // when breakpoint goes above children length, counter is the number of pages
494          while (breakPoint < slider.children.length) {
495            ++pagerQty;
496            breakPoint = counter + getNumberSlidesShowing();
497            counter += slider.settings.moveSlides <= getNumberSlidesShowing() ? slider.settings.moveSlides : getNumberSlidesShowing();
498          }
499		  return counter;
500        }
501      // if moveSlides is 0 (auto) divide children length by sides showing, then round up
502      } else {
503        pagerQty = Math.ceil(slider.children.length / getNumberSlidesShowing());
504      }
505      return pagerQty;
506    };
507
508    /**
509     * Returns the number of individual slides by which to shift the slider
510     */
511    var getMoveBy = function() {
512      // if moveSlides was set by the user and moveSlides is less than number of slides showing
513      if (slider.settings.moveSlides > 0 && slider.settings.moveSlides <= getNumberSlidesShowing()) {
514        return slider.settings.moveSlides;
515      }
516      // if moveSlides is 0 (auto)
517      return getNumberSlidesShowing();
518    };
519
520    /**
521     * Sets the slider's (el) left or top position
522     */
523    var setSlidePosition = function() {
524      var position, lastChild, lastShowingIndex;
525      // if last slide, not infinite loop, and number of children is larger than specified maxSlides
526      if (slider.children.length > slider.settings.maxSlides && slider.active.last && !slider.settings.infiniteLoop) {
527        if (slider.settings.mode === 'horizontal') {
528          // get the last child's position
529          lastChild = slider.children.last();
530          position = lastChild.position();
531          // set the left position
532          setPositionProperty(-(position.left - (slider.viewport.width() - lastChild.outerWidth())), 'reset', 0);
533        } else if (slider.settings.mode === 'vertical') {
534          // get the last showing index's position
535          lastShowingIndex = slider.children.length - slider.settings.minSlides;
536          position = slider.children.eq(lastShowingIndex).position();
537          // set the top position
538          setPositionProperty(-position.top, 'reset', 0);
539        }
540      // if not last slide
541      } else {
542        // get the position of the first showing slide
543        position = slider.children.eq(slider.active.index * getMoveBy()).position();
544        // check for last slide
545        if (slider.active.index === getPagerQty() - 1) { slider.active.last = true; }
546        // set the respective position
547        if (position !== undefined) {
548          if (slider.settings.mode === 'horizontal') { setPositionProperty(-position.left, 'reset', 0); }
549          else if (slider.settings.mode === 'vertical') { setPositionProperty(-position.top, 'reset', 0); }
550        }
551      }
552    };
553
554    /**
555     * Sets the el's animating property position (which in turn will sometimes animate el).
556     * If using CSS, sets the transform property. If not using CSS, sets the top / left property.
557     *
558     * @param value (int)
559     *  - the animating property's value
560     *
561     * @param type (string) 'slide', 'reset', 'ticker'
562     *  - the type of instance for which the function is being
563     *
564     * @param duration (int)
565     *  - the amount of time (in ms) the transition should occupy
566     *
567     * @param params (array) optional
568     *  - an optional parameter containing any variables that need to be passed in
569     */
570    var setPositionProperty = function(value, type, duration, params) {
571      var animateObj, propValue;
572      // use CSS transform
573      if (slider.usingCSS) {
574        // determine the translate3d value
575        propValue = slider.settings.mode === 'vertical' ? 'translate3d(0, ' + value + 'px, 0)' : 'translate3d(' + value + 'px, 0, 0)';
576        // add the CSS transition-duration
577        el.css('-' + slider.cssPrefix + '-transition-duration', duration / 1000 + 's');
578        if (type === 'slide') {
579          // set the property value
580          el.css(slider.animProp, propValue);
581          if (duration !== 0) {
582            // 
vendor: 6,125 bytes, lines 582-720
582bind a callback method - executes when CSS transition completes
583            el.bind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd', function(e) {
584              //make sure it's the correct one
585              if (!$(e.target).is(el)) { return; }
586              // unbind the callback
587              el.unbind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd');
588              updateAfterSlideTransition();
589            });
590          } else { //duration = 0
591            updateAfterSlideTransition();
592          }
593        } else if (type === 'reset') {
594          el.css(slider.animProp, propValue);
595        } else if (type === 'ticker') {
596          // make the transition use 'linear'
597          el.css('-' + slider.cssPrefix + '-transition-timing-function', 'linear');
598          el.css(slider.animProp, propValue);
599          if (duration !== 0) {
600            el.bind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd', function(e) {
601              //make sure it's the correct one
602              if (!$(e.target).is(el)) { return; }
603              // unbind the callback
604              el.unbind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd');
605              // reset the position
606              setPositionProperty(params.resetValue, 'reset', 0);
607              // start the loop again
608              tickerLoop();
609            });
610          } else { //duration = 0
611            setPositionProperty(params.resetValue, 'reset', 0);
612            tickerLoop();
613          }
614        }
615      // use JS animate
616      } else {
617        animateObj = {};
618        animateObj[slider.animProp] = value;
619        if (type === 'slide') {
620          el.animate(animateObj, duration, slider.settings.easing, function() {
621            updateAfterSlideTransition();
622          });
623        } else if (type === 'reset') {
624          el.css(slider.animProp, value);
625        } else if (type === 'ticker') {
626          el.animate(animateObj, duration, 'linear', function() {
627            setPositionProperty(params.resetValue, 'reset', 0);
628            // run the recursive loop after animation
629            tickerLoop();
630          });
631        }
632      }
633    };
634
635    /**
636     * Populates the pager with proper amount of pages
637     */
638    var populatePager = function() {
639      var pagerHtml = '',
640      linkContent = '',
641      pagerQty = getPagerQty();
642      // loop through each pager item
643      for (var i = 0; i < pagerQty; i++) {
644        linkContent = '';
645        // if a buildPager function is supplied, use it to get pager link value, else use index + 1
646        if (slider.settings.buildPager && $.isFunction(slider.settings.buildPager) || slider.settings.pagerCustom) {
647          linkContent = slider.settings.buildPager(i);
648          slider.pagerEl.addClass('bx-custom-pager');
649        } else {
650          linkContent = i + 1;
651          slider.pagerEl.addClass('bx-default-pager');
652        }
653        // var linkContent = slider.settings.buildPager && $.isFunction(slider.settings.buildPager) ? slider.settings.buildPager(i) : i + 1;
654        // add the markup to the string
655        pagerHtml += '<div class="bx-pager-item"><a href="" data-slide-index="' + i + '" class="bx-pager-link">' + linkContent + '</a></div>';
656      }
657      // populate the pager element with pager links
658      slider.pagerEl.html(pagerHtml);
659    };
660
661    /**
662     * Appends the pager to the controls element
663     */
664    var appendPager = function() {
665      if (!slider.settings.pagerCustom) {
666        // create the pager DOM element
667        slider.pagerEl = $('<div class="bx-pager" />');
668        // if a pager selector was supplied, populate it with the pager
669        if (slider.settings.pagerSelector) {
670          $(slider.settings.pagerSelector).html(slider.pagerEl);
671        // if no pager selector was supplied, add it after the wrapper
672        } else {
673          slider.controls.el.addClass('bx-has-pager').append(slider.pagerEl);
674        }
675        // populate the pager
676        populatePager();
677      } else {
678        slider.pagerEl = $(slider.settings.pagerCustom);
679      }
680      // assign the pager click binding
681      slider.pagerEl.on('click touchend', 'a', clickPagerBind);
682    };
683
684    /**
685     * Appends prev / next controls to the controls element
686     */
687    var appendControls = function() {
688      slider.controls.next = $('<a class="bx-next" href="">' + slider.settings.nextText + '</a>');
689      slider.controls.prev = $('<a class="bx-prev" href="">' + slider.settings.prevText + '</a>');
690      // bind click actions to the controls
691      slider.controls.next.bind('click touchend', clickNextBind);
692      slider.controls.prev.bind('click touchend', clickPrevBind);
693      // if nextSelector was supplied, populate it
694      if (slider.settings.nextSelector) {
695        $(slider.settings.nextSelector).append(slider.controls.next);
696      }
697      // if prevSelector was supplied, populate it
698      if (slider.settings.prevSelector) {
699        $(slider.settings.prevSelector).append(slider.controls.prev);
700      }
701      // if no custom selectors were supplied
702      if (!slider.settings.nextSelector && !slider.settings.prevSelector) {
703        // add the controls to the DOM
704        slider.controls.directionEl = $('<div class="bx-controls-direction" />');
705        // add the control elements to the directionEl
706        slider.controls.directionEl.append(slider.controls.prev).append(slider.controls.next);
707        // slider.viewport.append(slider.controls.directionEl);
708        slider.controls.el.addClass('bx-has-controls-direction').append(slider.controls.directionEl);
709      }
710    };
711
712    /**
713     * Appends start / stop auto controls to the controls element
714     */
715    var appendControlsAuto = function() {
716      slider.controls.start = $('<div class="bx-controls-auto-item"><a class="bx-start" href="">' + slider.settings.startText + '</a></div>');
717      slider.controls.stop = $('<div class="bx-controls-auto-item"><a class="bx-stop" href="">' + slider.settings.stopText + '</a></div>');
718      // add the controls to the DOM
719      slider.controls.autoEl = $('<div class="bx-controls-auto" />');
720      // bind
vendor: 7,523 bytes, lines 720-928
720 click actions to the controls
721      slider.controls.autoEl.on('click', '.bx-start', clickStartBind);
722      slider.controls.autoEl.on('click', '.bx-stop', clickStopBind);
723      // if autoControlsCombine, insert only the "start" control
724      if (slider.settings.autoControlsCombine) {
725        slider.controls.autoEl.append(slider.controls.start);
726      // if autoControlsCombine is false, insert both controls
727      } else {
728        slider.controls.autoEl.append(slider.controls.start).append(slider.controls.stop);
729      }
730      // if auto controls selector was supplied, populate it with the controls
731      if (slider.settings.autoControlsSelector) {
732        $(slider.settings.autoControlsSelector).html(slider.controls.autoEl);
733      // if auto controls selector was not supplied, add it after the wrapper
734      } else {
735        slider.controls.el.addClass('bx-has-controls-auto').append(slider.controls.autoEl);
736      }
737      // update the auto controls
738      updateAutoControls(slider.settings.autoStart ? 'stop' : 'start');
739    };
740
741    /**
742     * Appends image captions to the DOM
743     */
744    var appendCaptions = function() {
745      // cycle through each child
746      slider.children.each(function(index) {
747        // get the image title attribute
748        var title = $(this).find('img:first').attr('title');
749        // append the caption
750        if (title !== undefined && ('' + title).length) {
751          $(this).append('<div class="bx-caption"><span>' + title + '</span></div>');
752        }
753      });
754    };
755
756    /**
757     * Click next binding
758     *
759     * @param e (event)
760     *  - DOM event object
761     */
762    var clickNextBind = function(e) {
763      e.preventDefault();
764      if (slider.controls.el.hasClass('disabled')) { return; }
765      // if auto show is running, stop it
766      if (slider.settings.auto && slider.settings.stopAutoOnClick) { el.stopAuto(); }
767      el.goToNextSlide();
768    };
769
770    /**
771     * Click prev binding
772     *
773     * @param e (event)
774     *  - DOM event object
775     */
776    var clickPrevBind = function(e) {
777      e.preventDefault();
778      if (slider.controls.el.hasClass('disabled')) { return; }
779      // if auto show is running, stop it
780      if (slider.settings.auto && slider.settings.stopAutoOnClick) { el.stopAuto(); }
781      el.goToPrevSlide();
782    };
783
784    /**
785     * Click start binding
786     *
787     * @param e (event)
788     *  - DOM event object
789     */
790    var clickStartBind = function(e) {
791      el.startAuto();
792      e.preventDefault();
793    };
794
795    /**
796     * Click stop binding
797     *
798     * @param e (event)
799     *  - DOM event object
800     */
801    var clickStopBind = function(e) {
802      el.stopAuto();
803      e.preventDefault();
804    };
805
806    /**
807     * Click pager binding
808     *
809     * @param e (event)
810     *  - DOM event object
811     */
812    var clickPagerBind = function(e) {
813      var pagerLink, pagerIndex;
814      e.preventDefault();
815      if (slider.controls.el.hasClass('disabled')) {
816        return;
817      }
818      // if auto show is running, stop it
819      if (slider.settings.auto  && slider.settings.stopAutoOnClick) { el.stopAuto(); }
820      pagerLink = $(e.currentTarget);
821      if (pagerLink.attr('data-slide-index') !== undefined) {
822        pagerIndex = parseInt(pagerLink.attr('data-slide-index'));
823        // if clicked pager link is not active, continue with the goToSlide call
824        if (pagerIndex !== slider.active.index) { el.goToSlide(pagerIndex); }
825      }
826    };
827
828    /**
829     * Updates the pager links with an active class
830     *
831     * @param slideIndex (int)
832     *  - index of slide to make active
833     */
834    var updatePagerActive = function(slideIndex) {
835      // if "short" pager type
836      var len = slider.children.length; // nb of children
837      if (slider.settings.pagerType === 'short') {
838        if (slider.settings.maxSlides > 1) {
839          len = Math.ceil(slider.children.length / slider.settings.maxSlides);
840        }
841        slider.pagerEl.html((slideIndex + 1) + slider.settings.pagerShortSeparator + len);
842        return;
843      }
844      // remove all pager active classes
845      slider.pagerEl.find('a').removeClass('active');
846      // apply the active class for all pagers
847      slider.pagerEl.each(function(i, el) { $(el).find('a').eq(slideIndex).addClass('active'); });
848    };
849
850    /**
851     * Performs needed actions after a slide transition
852     */
853    var updateAfterSlideTransition = function() {
854      // if infinite loop is true
855      if (slider.settings.infiniteLoop) {
856        var position = '';
857        // first slide
858        if (slider.active.index === 0) {
859          // set the new position
860          position = slider.children.eq(0).position();
861        // carousel, last slide
862        } else if (slider.active.index === getPagerQty() - 1 && slider.carousel) {
863          position = slider.children.eq((getPagerQty() - 1) * getMoveBy()).position();
864        // last slide
865        } else if (slider.active.index === slider.children.length - 1) {
866          position = slider.children.eq(slider.children.length - 1).position();
867        }
868        if (position) {
869          if (slider.settings.mode === 'horizontal') { setPositionProperty(-position.left, 'reset', 0); }
870          else if (slider.settings.mode === 'vertical') { setPositionProperty(-position.top, 'reset', 0); }
871        }
872      }
873      // declare that the transition is complete
874      slider.working = false;
875      // onSlideAfter callback
876      slider.settings.onSlideAfter.call(el, slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index);
877    };
878
879    /**
880     * Updates the auto controls state (either active, or combined switch)
881     *
882     * @param state (string) "start", "stop"
883     *  - the new state of the auto show
884     */
885    var updateAutoControls = function(state) {
886      // if autoControlsCombine is true, replace the current control with the new state
887      if (slider.settings.autoControlsCombine) {
888        slider.controls.autoEl.html(slider.controls[state]);
889      // if autoControlsCombine is false, apply the "active" class to the appropriate control
890      } else {
891        slider.controls.autoEl.find('a').removeClass('active');
892        slider.controls.autoEl.find('a:not(.bx-' + state + ')').addClass('active');
893      }
894    };
895
896    /**
897     * Updates the direction controls (checks if either should be hidden)
898     */
899    var updateDirectionControls = function() {
900      if (getPagerQty() === 1) {
901        slider.controls.prev.addClass('disabled');
902        slider.controls.next.addClass('disabled');
903      } else if (!slider.settings.infiniteLoop && slider.settings.hideControlOnEnd) {
904        // if first slide
905        if (slider.active.index === 0) {
906          slider.controls.prev.addClass('disabled');
907          slider.controls.next.removeClass('disabled');
908        // if last slide
909        } else if (slider.active.index === getPagerQty() - 1) {
910          slider.controls.next.addClass('disabled');
911          slider.controls.prev.removeClass('disabled');
912        // if any slide in the middle
913        } else {
914          slider.controls.prev.removeClass('disabled');
915          slider.controls.next.removeClass('disabled');
916        }
917      }
918    };
919	/* auto start and stop functions */
920	var windowFocusHandler = function() { el.startAuto(); };
921	var windowBlurHandler = function() { el.stopAuto(); };
922    /**
923     * Initializes the auto process
924     */
925    var initAuto = function() {
926      // if autoDelay was supplied, launch the auto show using a setTimeout() call
927      if (slider.settings.autoDelay > 0) {
928        
928var timeout =
vendor: 6,544 bytes, lines 928-1094
928 setTimeout(el.startAuto, slider.settings.autoDelay);
929      // if autoDelay was not supplied, start the auto show normally
930      } else {
931        el.startAuto();
932
933        //add focus and blur events to ensure its running if timeout gets paused
934        $(window).focus(windowFocusHandler).blur(windowBlurHandler);
935      }
936      // if autoHover is requested
937      if (slider.settings.autoHover) {
938        // on el hover
939        el.hover(function() {
940          // if the auto show is currently playing (has an active interval)
941          if (slider.interval) {
942            // stop the auto show and pass true argument which will prevent control update
943            el.stopAuto(true);
944            // create a new autoPaused value which will be used by the relative "mouseout" event
945            slider.autoPaused = true;
946          }
947        }, function() {
948          // if the autoPaused value was created be the prior "mouseover" event
949          if (slider.autoPaused) {
950            // start the auto show and pass true argument which will prevent control update
951            el.startAuto(true);
952            // reset the autoPaused value
953            slider.autoPaused = null;
954          }
955        });
956      }
957    };
958
959    /**
960     * Initializes the ticker process
961     */
962    var initTicker = function() {
963      var startPosition = 0,
964      position, transform, value, idx, ratio, property, newSpeed, totalDimens;
965      // if autoDirection is "next", append a clone of the entire slider
966      if (slider.settings.autoDirection === 'next') {
967        el.append(slider.children.clone().addClass('bx-clone'));
968      // if autoDirection is "prev", prepend a clone of the entire slider, and set the left position
969      } else {
970        el.prepend(slider.children.clone().addClass('bx-clone'));
971        position = slider.children.first().position();
972        startPosition = slider.settings.mode === 'horizontal' ? -position.left : -position.top;
973      }
974      setPositionProperty(startPosition, 'reset', 0);
975      // do not allow controls in ticker mode
976      slider.settings.pager = false;
977      slider.settings.controls = false;
978      slider.settings.autoControls = false;
979      // if autoHover is requested
980      if (slider.settings.tickerHover) {
981        if (slider.usingCSS) {
982          idx = slider.settings.mode === 'horizontal' ? 4 : 5;
983          slider.viewport.hover(function() {
984            transform = el.css('-' + slider.cssPrefix + '-transform');
985            value = parseFloat(transform.split(',')[idx]);
986            setPositionProperty(value, 'reset', 0);
987          }, function() {
988            totalDimens = 0;
989            slider.children.each(function(index) {
990              totalDimens += slider.settings.mode === 'horizontal' ? $(this).outerWidth(true) : $(this).outerHeight(true);
991            });
992            // calculate the speed ratio (used to determine the new speed to finish the paused animation)
993            ratio = slider.settings.speed / totalDimens;
994            // determine which property to use
995            property = slider.settings.mode === 'horizontal' ? 'left' : 'top';
996            // calculate the new speed
997            newSpeed = ratio * (totalDimens - (Math.abs(parseInt(value))));
998            tickerLoop(newSpeed);
999          });
1000        } else {
1001          // on el hover
1002          slider.viewport.hover(function() {
1003            el.stop();
1004          }, function() {
1005            // calculate the total width of children (used to calculate the speed ratio)
1006            totalDimens = 0;
1007            slider.children.each(function(index) {
1008              totalDimens += slider.settings.mode === 'horizontal' ? $(this).outerWidth(true) : $(this).outerHeight(true);
1009            });
1010            // calculate the speed ratio (used to determine the new speed to finish the paused animation)
1011            ratio = slider.settings.speed / totalDimens;
1012            // determine which property to use
1013            property = slider.settings.mode === 'horizontal' ? 'left' : 'top';
1014            // calculate the new speed
1015            newSpeed = ratio * (totalDimens - (Math.abs(parseInt(el.css(property)))));
1016            tickerLoop(newSpeed);
1017          });
1018        }
1019      }
1020      // start the ticker loop
1021      tickerLoop();
1022    };
1023
1024    /**
1025     * Runs a continuous loop, news ticker-style
1026     */
1027    var tickerLoop = function(resumeSpeed) {
1028      var speed = resumeSpeed ? resumeSpeed : slider.settings.speed,
1029      position = {left: 0, top: 0},
1030      reset = {left: 0, top: 0},
1031      animateProperty, resetValue, params;
1032
1033      // if "next" animate left position to last child, then reset left to 0
1034      if (slider.settings.autoDirection === 'next') {
1035        position = el.find('.bx-clone').first().position();
1036      // if "prev" animate left position to 0, then reset left to first non-clone child
1037      } else {
1038        reset = slider.children.first().position();
1039      }
1040      animateProperty = slider.settings.mode === 'horizontal' ? -position.left : -position.top;
1041      resetValue = slider.settings.mode === 'horizontal' ? -reset.left : -reset.top;
1042      params = {resetValue: resetValue};
1043      setPositionProperty(animateProperty, 'ticker', speed, params);
1044    };
1045
1046    /**
1047     * Check if el is on screen
1048     */
1049    var isOnScreen = function(el) {
1050      var win = $(window),
1051      viewport = {
1052        top: win.scrollTop(),
1053        left: win.scrollLeft()
1054      },
1055      bounds = el.offset();
1056
1057      viewport.right = viewport.left + win.width();
1058      viewport.bottom = viewport.top + win.height();
1059      bounds.right = bounds.left + el.outerWidth();
1060      bounds.bottom = bounds.top + el.outerHeight();
1061
1062      return (!(viewport.right < bounds.left || viewport.left > bounds.right || viewport.bottom < bounds.top || viewport.top > bounds.bottom));
1063    };
1064
1065    /**
1066     * Initializes keyboard events
1067     */
1068    var keyPress = function(e) {
1069      var activeElementTag = document.activeElement.tagName.toLowerCase(),
1070      tagFilters = 'input|textarea',
1071      p = new RegExp(activeElementTag,['i']),
1072      result = p.exec(tagFilters);
1073
1074      if (result == null && isOnScreen(el)) {
1075        if (e.keyCode === 39) {
1076          clickNextBind(e);
1077          return false;
1078        } else if (e.keyCode === 37) {
1079          clickPrevBind(e);
1080          return false;
1081        }
1082      }
1083    };
1084
1085    /**
1086     * Initializes touch events
1087     */
1088    var initTouch = function() {
1089      // initialize object to contain all touch values
1090      slider.touch = {
1091        start: {x: 0, y: 0},
1092        end: {x: 0, y: 0}
1093      };
1094      slider.viewport.
vendor: 6,703 bytes, lines 1094-1256
1094bind('touchstart MSPointerDown pointerdown', onTouchStart);
1095
1096      //for browsers that have implemented pointer events and fire a click after
1097      //every pointerup regardless of whether pointerup is on same screen location as pointerdown or not
1098      slider.viewport.on('click', '.bxslider a', function(e) {
1099        if (slider.viewport.hasClass('click-disabled')) {
1100          e.preventDefault();
1101          slider.viewport.removeClass('click-disabled');
1102        }
1103      });
1104    };
1105
1106    /**
1107     * Event handler for "touchstart"
1108     *
1109     * @param e (event)
1110     *  - DOM event object
1111     */
1112    var onTouchStart = function(e) {
1113      //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
1114      slider.controls.el.addClass('disabled');
1115
1116      if (slider.working) {
1117        e.preventDefault();
1118        slider.controls.el.removeClass('disabled');
1119      } else {
1120        // record the original position when touch starts
1121        slider.touch.originalPos = el.position();
1122        var orig = e.originalEvent,
1123        touchPoints = (typeof orig.changedTouches !== 'undefined') ? orig.changedTouches : [orig];
1124        // record the starting touch x, y coordinates
1125        slider.touch.start.x = touchPoints[0].pageX;
1126        slider.touch.start.y = touchPoints[0].pageY;
1127
1128        var chromePointerEvents = typeof PointerEvent === 'function'; if (chromePointerEvents) { if (orig.pointerId === undefined) { return; } }
1129        if (slider.viewport.get(0).setPointerCapture) {
1130          slider.pointerId = orig.pointerId;
1131          slider.viewport.get(0).setPointerCapture(slider.pointerId);
1132        }
1133        // bind a "touchmove" event to the viewport
1134        slider.viewport.bind('touchmove MSPointerMove pointermove', onTouchMove);
1135        // bind a "touchend" event to the viewport
1136        slider.viewport.bind('touchend MSPointerUp pointerup', onTouchEnd);
1137        slider.viewport.bind('MSPointerCancel pointercancel', onPointerCancel);
1138      }
1139    };
1140
1141    /**
1142     * Cancel Pointer for Windows Phone
1143     *
1144     * @param e (event)
1145     *  - DOM event object
1146     */
1147    var onPointerCancel = function(e) {
1148      /* onPointerCancel handler is needed to deal with situations when a touchend
1149      doesn't fire after a touchstart (this happens on windows phones only) */
1150      setPositionProperty(slider.touch.originalPos.left, 'reset', 0);
1151
1152      //remove handlers
1153      slider.controls.el.removeClass('disabled');
1154      slider.viewport.unbind('MSPointerCancel pointercancel', onPointerCancel);
1155      slider.viewport.unbind('touchmove MSPointerMove pointermove', onTouchMove);
1156      slider.viewport.unbind('touchend MSPointerUp pointerup', onTouchEnd);
1157      if (slider.viewport.get(0).releasePointerCapture) {
1158        slider.viewport.get(0).releasePointerCapture(slider.pointerId);
1159      }
1160    };
1161
1162    /**
1163     * Event handler for "touchmove"
1164     *
1165     * @param e (event)
1166     *  - DOM event object
1167     */
1168    var onTouchMove = function(e) {
1169      var orig = e.originalEvent,
1170      touchPoints = (typeof orig.changedTouches !== 'undefined') ? orig.changedTouches : [orig],
1171      // if scrolling on y axis, do not prevent default
1172      xMovement = Math.abs(touchPoints[0].pageX - slider.touch.start.x),
1173      yMovement = Math.abs(touchPoints[0].pageY - slider.touch.start.y),
1174      value = 0,
1175      change = 0;
1176
1177      // x axis swipe
1178      if ((xMovement * 3) > yMovement && slider.settings.preventDefaultSwipeX) {
1179        e.preventDefault();
1180      // y axis swipe
1181      } else if ((yMovement * 3) > xMovement && slider.settings.preventDefaultSwipeY) {
1182        e.preventDefault();
1183      }
1184      if (slider.settings.mode !== 'fade' && slider.settings.oneToOneTouch) {
1185        // if horizontal, drag along x axis
1186        if (slider.settings.mode === 'horizontal') {
1187          change = touchPoints[0].pageX - slider.touch.start.x;
1188          value = slider.touch.originalPos.left + change;
1189        // if vertical, drag along y axis
1190        } else {
1191          change = touchPoints[0].pageY - slider.touch.start.y;
1192          value = slider.touch.originalPos.top + change;
1193        }
1194        setPositionProperty(value, 'reset', 0);
1195      }
1196    };
1197
1198    /**
1199     * Event handler for "touchend"
1200     *
1201     * @param e (event)
1202     *  - DOM event object
1203     */
1204    var onTouchEnd = function(e) {
1205      slider.viewport.unbind('touchmove MSPointerMove pointermove', onTouchMove);
1206      //enable slider controls as soon as user stops interacing with slides
1207      slider.controls.el.removeClass('disabled');
1208      var orig    = e.originalEvent,
1209      touchPoints = (typeof orig.changedTouches !== 'undefined') ? orig.changedTouches : [orig],
1210      value       = 0,
1211      distance    = 0;
1212      // record end x, y positions
1213      slider.touch.end.x = touchPoints[0].pageX;
1214      slider.touch.end.y = touchPoints[0].pageY;
1215      // if fade mode, check if absolute x distance clears the threshold
1216      if (slider.settings.mode === 'fade') {
1217        distance = Math.abs(slider.touch.start.x - slider.touch.end.x);
1218        if (distance >= slider.settings.swipeThreshold) {
1219          if (slider.touch.start.x > slider.touch.end.x) {
1220            el.goToNextSlide();
1221          } else {
1222            el.goToPrevSlide();
1223          }
1224          el.stopAuto();
1225        }
1226      // not fade mode
1227      } else {
1228        // calculate distance and el's animate property
1229        if (slider.settings.mode === 'horizontal') {
1230          distance = slider.touch.end.x - slider.touch.start.x;
1231          value = slider.touch.originalPos.left;
1232        } else {
1233          distance = slider.touch.end.y - slider.touch.start.y;
1234          value = slider.touch.originalPos.top;
1235        }
1236        // if not infinite loop and first / last slide, do not attempt a slide transition
1237        if (!slider.settings.infiniteLoop && ((slider.active.index === 0 && distance > 0) || (slider.active.last && distance < 0))) {
1238          setPositionProperty(value, 'reset', 200);
1239        } else {
1240          // check if distance clears threshold
1241          if (Math.abs(distance) >= slider.settings.swipeThreshold) {
1242            if (distance < 0) {
1243              el.goToNextSlide();
1244            } else {
1245              el.goToPrevSlide();
1246            }
1247            el.stopAuto();
1248          } else {
1249            // el.animate(property, 200);
1250            setPositionProperty(value, 'reset', 200);
1251          }
1252        }
1253      }
1254      slider.viewport.unbind('touchend MSPointerUp pointerup', onTouchEnd);
1255      if (slider.viewport.get(0).releasePointerCapture) {
1256        slider.viewport.get(0).releasePointerCapture(slider.pointerId
vendor: 9,203 bytes, lines 1256-1463
1256);
1257      }
1258    };
1259
1260    /**
1261     * Window resize event callback
1262     */
1263    var resizeWindow = function(e) {
1264      // don't do anything if slider isn't initialized.
1265      if (!slider.initialized) { return; }
1266      // Delay if slider working.
1267      if (slider.working) {
1268        window.setTimeout(resizeWindow, 10);
1269      } else {
1270        // get the new window dimens (again, thank you IE)
1271        var windowWidthNew = $(window).width(),
1272        windowHeightNew = $(window).height();
1273        // make sure that it is a true window resize
1274        // *we must check this because our dinosaur friend IE fires a window resize event when certain DOM elements
1275        // are resized. Can you just die already?*
1276        if (windowWidth !== windowWidthNew || windowHeight !== windowHeightNew) {
1277          // set the new window dimens
1278          windowWidth = windowWidthNew;
1279          windowHeight = windowHeightNew;
1280          // update all dynamic elements
1281          el.redrawSlider();
1282          // Call user resize handler
1283          slider.settings.onSliderResize.call(el, slider.active.index);
1284        }
1285      }
1286    };
1287
1288    /**
1289     * Adds an aria-hidden=true attribute to each element
1290     *
1291     * @param startVisibleIndex (int)
1292     *  - the first visible element's index
1293     */
1294    var applyAriaHiddenAttributes = function(startVisibleIndex) {
1295      var numberOfSlidesShowing = getNumberSlidesShowing();
1296      // only apply attributes if the setting is enabled and not in ticker mode
1297      if (slider.settings.ariaHidden && !slider.settings.ticker) {
1298        // add aria-hidden=true to all elements
1299        slider.children.attr('aria-hidden', 'true');
1300        // get the visible elements and change to aria-hidden=false
1301        slider.children.slice(startVisibleIndex, startVisibleIndex + numberOfSlidesShowing).attr('aria-hidden', 'false');
1302      }
1303    };
1304
1305    /**
1306     * Returns index according to present page range
1307     *
1308     * @param slideOndex (int)
1309     *  - the desired slide index
1310     */
1311    var setSlideIndex = function(slideIndex) {
1312      if (slideIndex < 0) {
1313        if (slider.settings.infiniteLoop) {
1314          return getPagerQty() - 1;
1315        }else {
1316          //we don't go to undefined slides
1317          return slider.active.index;
1318        }
1319      // if slideIndex is greater than children length, set active index to 0 (this happens during infinite loop)
1320      } else if (slideIndex >= getPagerQty()) {
1321        if (slider.settings.infiniteLoop) {
1322          return 0;
1323        } else {
1324          //we don't move to undefined pages
1325          return slider.active.index;
1326        }
1327      // set active index to requested slide
1328      } else {
1329        return slideIndex;
1330      }
1331    };
1332
1333    /**
1334     * ===================================================================================
1335     * = PUBLIC FUNCTIONS
1336     * ===================================================================================
1337     */
1338
1339    /**
1340     * Performs slide transition to the specified slide
1341     *
1342     * @param slideIndex (int)
1343     *  - the destination slide's index (zero-based)
1344     *
1345     * @param direction (string)
1346     *  - INTERNAL USE ONLY - the direction of travel ("prev" / "next")
1347     */
1348    el.goToSlide = function(slideIndex, direction) {
1349      // onSlideBefore, onSlideNext, onSlidePrev callbacks
1350      // Allow transition canceling based on returned value
1351      var performTransition = true,
1352      moveBy = 0,
1353      position = {left: 0, top: 0},
1354      lastChild = null,
1355      lastShowingIndex, eq, value, requestEl;
1356      // store the old index
1357      slider.oldIndex = slider.active.index;
1358      //set new index
1359      slider.active.index = setSlideIndex(slideIndex);
1360
1361      // if plugin is currently in motion, ignore request
1362      if (slider.working || slider.active.index === slider.oldIndex) { return; }
1363      // declare that plugin is in motion
1364      slider.working = true;
1365
1366      performTransition = slider.settings.onSlideBefore.call(el, slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index);
1367
1368      // If transitions canceled, reset and return
1369      if (typeof (performTransition) !== 'undefined' && !performTransition) {
1370        slider.active.index = slider.oldIndex; // restore old index
1371        slider.working = false; // is not in motion
1372        return;
1373      }
1374
1375      if (direction === 'next') {
1376        // Prevent canceling in future functions or lack there-of from negating previous commands to cancel
1377        if (!slider.settings.onSlideNext.call(el, slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index)) {
1378          performTransition = false;
1379        }
1380      } else if (direction === 'prev') {
1381        // Prevent canceling in future functions or lack there-of from negating previous commands to cancel
1382        if (!slider.settings.onSlidePrev.call(el, slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index)) {
1383          performTransition = false;
1384        }
1385      }
1386
1387      // check if last slide
1388      slider.active.last = slider.active.index >= getPagerQty() - 1;
1389      // update the pager with active class
1390      if (slider.settings.pager || slider.settings.pagerCustom) { updatePagerActive(slider.active.index); }
1391      // // check for direction control update
1392      if (slider.settings.controls) { updateDirectionControls(); }
1393      // if slider is set to mode: "fade"
1394      if (slider.settings.mode === 'fade') {
1395        // if adaptiveHeight is true and next height is different from current height, animate to the new height
1396        if (slider.settings.adaptiveHeight && slider.viewport.height() !== getViewportHeight()) {
1397          slider.viewport.animate({height: getViewportHeight()}, slider.settings.adaptiveHeightSpeed);
1398        }
1399        // fade out the visible child and reset its z-index value
1400        slider.children.filter(':visible').fadeOut(slider.settings.speed).css({zIndex: 0});
1401        // fade in the newly requested slide
1402        slider.children.eq(slider.active.index).css('zIndex', slider.settings.slideZIndex + 1).fadeIn(slider.settings.speed, function() {
1403          $(this).css('zIndex', slider.settings.slideZIndex);
1404          updateAfterSlideTransition();
1405        });
1406      // slider mode is not "fade"
1407      } else {
1408        // if adaptiveHeight is true and next height is different from current height, animate to the new height
1409        if (slider.settings.adaptiveHeight && slider.viewport.height() !== getViewportHeight()) {
1410          slider.viewport.animate({height: getViewportHeight()}, slider.settings.adaptiveHeightSpeed);
1411        }
1412        // if carousel and not infinite loop
1413        if (!slider.settings.infiniteLoop && slider.carousel && slider.active.last) {
1414          if (slider.settings.mode === 'horizontal') {
1415            // get the last child position
1416            lastChild = slider.children.eq(slider.children.length - 1);
1417            position = lastChild.position();
1418            // calculate the position of the last slide
1419            moveBy = slider.viewport.width() - lastChild.outerWidth();
1420          } else {
1421            // get last showing index position
1422            lastShowingIndex = slider.children.length - slider.settings.minSlides;
1423            position = slider.children.eq(lastShowingIndex).position();
1424          }
1425          // horizontal carousel, going previous while on first slide (infiniteLoop mode)
1426        } else if (slider.carousel && slider.active.last && direction === 'prev') {
1427          // get the last child position
1428          eq = slider.settings.moveSlides === 1 ? slider.settings.maxSlides - getMoveBy() : ((getPagerQty() - 1) * getMoveBy()) - (slider.children.length - slider.settings.maxSlides);
1429          lastChild = el.children('.bx-clone').eq(eq);
1430          position = lastChild.position();
1431        // if infinite loop and "Next" is clicked on the last slide
1432        } else if (direction === 'next' && slider.active.index === 0) {
1433          // get the last clone position
1434          position = el.find('> .bx-clone').eq(slider.settings.maxSlides).position();
1435          slider.active.last = false;
1436        // normal non-zero requests
1437        } else if (slideIndex >= 0) {
1438          //parseInt is applied to allow floats for slides/page
1439          requestEl = slideIndex * parseInt(getMoveBy());
1440          position = slider.children.eq(requestEl).position();
1441        }
1442
1443        /* If the position doesn't exist
1444         * (e.g. if you destroy the slider on a next click),
1445         * it doesn't throw an error.
1446         */
1447        if (typeof (position) !== 'undefined') {
1448          value = slider.settings.mode === 'horizontal' ? -(position.left - moveBy) : -position.top;
1449          // plugin values to be animated
1450          setPositionProperty(value, 'slide', slider.settings.speed);
1451        }
1452        slider.working = false;
1453      }
1454      if (slider.settings.ariaHidden) { applyAriaHiddenAttributes(slider.active.index * getMoveBy()); }
1455    };
1456
1457    /**
1458     * Transitions to the next slide in the show
1459     */
1460    el.goToNextSlide = function() {
1461      // if infiniteLoop is false and last page is showing, disregard call
1462      if (!slider.settings.infiniteLoop && slider.active.last) { return; }
1463	  if (slider.working ==
vendor: 3,105 bytes, lines 1463-1563
1463 true){ return ;}
1464      var pagerIndex = parseInt(slider.active.index) + 1;
1465      el.goToSlide(pagerIndex, 'next');
1466    };
1467
1468    /**
1469     * Transitions to the prev slide in the show
1470     */
1471    el.goToPrevSlide = function() {
1472      // if infiniteLoop is false and last page is showing, disregard call
1473      if (!slider.settings.infiniteLoop && slider.active.index === 0) { return; }
1474	  if (slider.working == true){ return ;}
1475      var pagerIndex = parseInt(slider.active.index) - 1;
1476      el.goToSlide(pagerIndex, 'prev');
1477    };
1478
1479    /**
1480     * Starts the auto show
1481     *
1482     * @param preventControlUpdate (boolean)
1483     *  - if true, auto controls state will not be updated
1484     */
1485    el.startAuto = function(preventControlUpdate) {
1486      // if an interval already exists, disregard call
1487      if (slider.interval) { return; }
1488      // create an interval
1489      slider.interval = setInterval(function() {
1490        if (slider.settings.autoDirection === 'next') {
1491          el.goToNextSlide();
1492        } else {
1493          el.goToPrevSlide();
1494        }
1495      }, slider.settings.pause);
1496	  //allback for when the auto rotate status changes
1497	  slider.settings.onAutoChange.call(el, true);
1498      // if auto controls are displayed and preventControlUpdate is not true
1499      if (slider.settings.autoControls && preventControlUpdate !== true) { updateAutoControls('stop'); }
1500    };
1501
1502    /**
1503     * Stops the auto show
1504     *
1505     * @param preventControlUpdate (boolean)
1506     *  - if true, auto controls state will not be updated
1507     */
1508    el.stopAuto = function(preventControlUpdate) {
1509      // if no interval exists, disregard call
1510      if (!slider.interval) { return; }
1511      // clear the interval
1512      clearInterval(slider.interval);
1513      slider.interval = null;
1514	  //allback for when the auto rotate status changes
1515	  slider.settings.onAutoChange.call(el, false);
1516      // if auto controls are displayed and preventControlUpdate is not true
1517      if (slider.settings.autoControls && preventControlUpdate !== true) { updateAutoControls('start'); }
1518    };
1519
1520    /**
1521     * Returns current slide index (zero-based)
1522     */
1523    el.getCurrentSlide = function() {
1524      return slider.active.index;
1525    };
1526
1527    /**
1528     * Returns current slide element
1529     */
1530    el.getCurrentSlideElement = function() {
1531      return slider.children.eq(slider.active.index);
1532    };
1533
1534    /**
1535     * Returns a slide element
1536     * @param index (int)
1537     *  - The index (zero-based) of the element you want returned.
1538     */
1539    el.getSlideElement = function(index) {
1540      return slider.children.eq(index);
1541    };
1542
1543    /**
1544     * Returns number of slides in show
1545     */
1546    el.getSlideCount = function() {
1547      return slider.children.length;
1548    };
1549
1550    /**
1551     * Return slider.working variable
1552     */
1553    el.isWorking = function() {
1554      return slider.working;
1555    };
1556
1557    /**
1558     * Update all dynamic slider elements
1559     */
1560    el.redrawSlider = function() {
1561      // resize all children in ratio to new screen size
1562      slider.children.add(el.find('.bx-clone')).outerWidth(getSlideWidth());
1563      // adjust the height
1564      slider.viewport.css('height', getViewportHeight());
1565      // update the slide position
1566      if (!slider.settings.ticker) { setSlidePosition(); }
1567      // if active.last was true before the screen resize, we want
1568      // to keep it last no matter what screen size we end on
1569      if (slider.active.last) { slider.active.index = getPagerQty() - 1; }
1570      // if the active index (page) no longer exists due to the resize, simply set the index as last
1571      if (slider.active.index >= getPagerQty()) { slider.active.last = true; }
1572      // if a pager is being displayed and a custom pager is not being used, update it
1573      if (slider.settings.pager && !slider.settings.pagerCustom) {
1574        populatePager();
1575        updatePagerActive(slider.active.index);
1576      }
1577      if (slider.settings.ariaHidden) { applyAriaHiddenAttributes(slider.active.index * getMoveBy()); }
1578    };
1579
1580    /**
1581     * Destroy the current instance of the slider (revert everything back to original state)
1582     */
1583    el.destroySlider = function() {
1584      // don't do anything if slider has already been destroyed
1585      if (!slider.initialized) { return; }
1586      slider.initialized = false;
1587      $('.bx-clone', this).remove();
1588      slider.children.each(function() {
1589        if ($(this).data('origStyle') !== undefined) {
1590          $(this).attr('style', $(this).data('origStyle'));
1591        } else {
1592          $(this).removeAttr('style');
1593        }
1594      });
1595      if ($(this).data('origStyle') !== undefined) {
1596        this.attr('style', $(this).data('origStyle'));
1597      } else {
1598        $(this).removeAttr('style');
1599      }
1600      $(this).unwrap().unwrap();
1601      if (slider.controls.el) { slider.controls.el.remove(); }
1602      if (slider.controls.next) { slider.controls.next.remove(); }
1603      if (slider.controls.prev) { slider.controls.prev.remove(); }
1604      if (slider.pagerEl && slider.settings.controls && !slider.settings.pagerCustom) { slider.pagerEl.remove(); }
1605      $('.bx-caption', this).remove();
1606      if (slider.controls.autoEl) { slider.controls.autoEl.remove(); }
1607      clearInterval(slider.interval);
1608      if (slider.settings.responsive) { $(window).unbind('resize', resizeWindow); }
1609      if (slider.settings.keyboardEnabled) { $(document).unbind('keydown', keyPress); }
1610      //remove self reference in data
1611      $(this).removeData('bxSlider');
1612	  // remove global window handlers
1613	  $(window).off('blur', windowBlurHandler).off('focus', windowFocusHandler);
1614    };
1615
1616    /**
1617     * Reload the slider (revert all DOM changes, and re-initialize)
1618     */
1619    el.reloadSlider = function(settings) {
1620      if (settings !== undefined) { options = settings; }
1621      el.destroySlider();
1622      init();
1623      //store reference to self in order to access public functions later
1624      $(el).data('bxSlider', this);
1625    };
1626
1627    init();
1628
1629    $(el).data('bxSlider', this);
1630
1631    // returns the current jQuery object
1632    return this;
1633  };
1634
1635})(jQuery);
1636
1637/* End */
1638;
1639; /* Start:"a:4:{s:4:"full";s:57:"/local/templates/aspro_next/js/jqModal.js?172597043711022";s:6:"source";s:41:"/local/templates/aspro_next/js/jqModal.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
1640/*
1641 * jqModal - Minimalist Modaling with jQuery
1642 *
1643 * Copyright (c) 2007-2014 Brice Burgess @iceburg_net
1644 * Dual licensed under the MIT and GPL licenses:
1645 *   http://www.opensource.org/licenses/mit-license.php
1646 *   http://www.gnu.org/licenses/gpl.html
1647 * 
1648 * $Version: 1.0.2 (2014.04.10 +r19)
1649 * Requires: jQuery 1.2.3+
1650 */
1651
1652(function($) {
1653	
1654	/**
1655	 * Initialize a set of elements as "modals". Modals typically are popup dialogs,
1656	 * notices, modal windows, &c. 
1657	 * 
1658	 * @name jqm
1659	 * @param options user defined options, augments defaults.
1660	 * @type jQuery
1661	 * @cat Plugins/jqModal
1662	 */
1663	
1664	$.fn.jqm=function(options){
1665		
1666		var o = $.extend({}, $.jqm.params, options);
1667
1668		return this.each(function(){
1669			var e = $(this),
1670				jqm = $(this).data('jqm');
1671			
1672			if(!jqm) jqm = {ID: I++};
1673			
1674			// add/extend options to modal and mark as initialized
1675			e.data('jqm',$.extend(o,jqm)).addClass('jqm-init');
1676			
1677			// ... Attach events to trigger showing of this modal
1678			o.trigger&&$(this).jqmAddTrigger(o.trigger);
1679		});
1680	};
1681	
1682	
1683	/**
1684	 * Matching modals will have their jqmShow() method fired by attaching a
1685	 *   onClick event to elements matching `trigger`.
1686	 * 
1687	 * @name jqmAddTrigger
1688	 * @param trigger a selector String, jQuery collection of elements, or a DOM element.
1689	 */
1690	$.fn.jqmAddTrigger=function(trigger){
1691		return this.each(function(){
1692			if(!addTrigger($(this), 'jqmShow', trigger))
1693				err("jqmAddTrigger must be called on initialized modals")
1694		});
1695	};
1696	
1697	
1698	/**
1699	 * Matching modals will have their jqmHide() method fired by attaching an
1700	 *   onClick event to elements matching `trigger`.
1701	 * 
1702	 * @name jqmAddClose
1703	 * @param trigger a selector String, jQuery collection of elements, or a DOM element.
1704	 */
1705	$.fn.jqmAddClose=function(trigger){
1706		return this.each(function(){
1707			if(!addTrigger($(this), 'jqmHide', trigger))
1708				err("jqmAddClose must be called on initialized modals")
1709		});
1710	};
1711	
1712	
1713	/**
1714	 * Open matching modals (if not shown)
1715	 */
1716	$.fn.jqmShow=function(trigger){
1717		return this.each(function(){ !this._jqmShown&&show($(this), trigger); });
1718	};
1719	
1720	/**
1721	 * Close matching modals
1722	 */
1723	$.fn.jqmHide=function(trigger){
1724		return this.each(function(){ this._jqmShown&&hide($(this), trigger); });
1725	};
1726	
1727	
1728	// utility functions
1729	
1730	var
1731		err = function(msg){
1732			if(window.console && window.console.error) window.console.error(msg);
1733		
1734		
1735	}, show = function(e, t){
1736		
1737		/**
1738		 * e = modal element (as jQuery object)
1739		 * t = triggering element
1740		 * 
1741		 * o = options
1742		 * z = z-index of modal
1743		 * v = overlay element (as jQuery object)
1744		 * h = hash (for jqModal <= r15 compatibility)
1745		 */
1746		
1747		var o = e.data('jqm'),
1748			t = t || window.event,
1749			z = (parseInt(e.css('z-index'))),
1750			z = (z > 0) ? z : 3000,
1751			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}),
1752		
1753			// maintain legacy "hash" construct
1754			h = {w: e, c: o, o: v, t: t};
1755			
1756		e.css('z-index',z);
1757
1758		if(o.ajax){
1759			var target = o.target || e,
1760				url = o.ajax;
1761			
1762			target = (typeof target == 'string') ? $(target,e) : $(target);
1763			if(url.substr(0,1) == '@') url = $(t).attr(url.substring(1));
1764			
1765			 // Load the Ajax Content (and once loaded);
1766			   // Fire the onLoad callback (if exists),
1767			   // Attach closing events to elements inside the modal that match the closingClass,
1768			   // and Execute the jqModal default Open Callback
1769			target.html(o.ajaxText).load(url,function(){
1770				o.onLoad && o.onLoad.call(this,h);
1771				open(h);
1772			});	
1773		}
1774		else { open(h); }
1775		
1776	}, hide = function(e, t){
1777		/**
1778		 * e = modal element (as jQuery object)
1779		 * t = triggering element
1780		 * 
1781		 * o = options
1782		 * h = hash (for jqModal <= r15 compatibility)
1783		 */
1784		
1785		var o = e.data('jqm'),
1786			t = t || window.event,
1787		
1788		// maintain legacy "hash" construct
1789		h = {w: e, c: o, o: e.data('jqmv'), t: t};
1790		
1791		close(h);
1792		
1793	}, onShow = function(hash){
1794		// onShow callback. Responsible for showing a modal and overlay.
1795		//  return false to stop opening modal. 
1796		
1797		// hash object;
1798	    //  w: (jQuery object) The modal element
1799	    //  c: (object) The modal's options object 
1800	    //  o: (jQuery object) The overlay element
1801	    //  t: (DOM object) The triggering element
1802		
1803		// display the overlay (prepend to body) if not disabled
1804		
1805		// prevent double click
1806		if( hash.w[0]._jqmShown )
1807			return false;
1808			
1809		if(hash.c.overlay > 0)
1810			hash.o.prependTo('body');
1811			
1812		// make modal visible
1813		hash.w.show();
1814		
1815		// call focusFunc (attempts to focus on first input in modal)
1816		$.jqm.focusFunc(hash.w);
1817		
1818		return true;
1819		
1820		
1821	}, onHide = function(hash){
1822		// onHide callback. Responsible for hiding a modal and overlay.
1823		//  return false to stop closing modal. 
1824		
1825		// hash object;
1826	    //  w: (jQuery object) The modal element
1827	    //  c: (object) The modal's options object 
1828	    //  o: (jQuery object) The overlay element
1829	    //  t: (DOM object) The triggering element
1830		
1831		// hide modal and if overlay, remove overlay.
1832		hash.w.hide() && hash.o && hash.o.remove();
1833		
1834		return true;
1835		
1836		
1837	},  addTrigger = function(e, key, trigger){
1838		// addTrigger: Adds a jqmShow or jqmHide (key) for a modal (e) 
1839		//  all elements that match trigger string (trigger)\
1840		
1841		// return false if e is not an initialized modal element
1842		if(!e.data('jqm')) return false;
1843		
1844		return $(trigger).each(function(){
1845			// register modal to trigger elements
1846			this[key] = this[key] || [];
1847			this[key].push(e);
1848			
1849		}).click(function(){
1850			
1851			var trigger = this;
1852			
1853			// foreadh modal registered to this trigger, call jqmShow || 
1854			//   jqmHide (key) on modal passing trigger element (e)
1855			$.each(this[key], function(i, e){ e[key](trigger); });
1856			
1857			// stop trigger click event from bubbling
1858			return false;
1859		});
1860		
1861		
1862	},  open = function(h){
1863		// open: executes the onOpen callback + performs common tasks if successful
1864
1865		// transform legacy hash into new var shortcuts 
1866		 var e = h.w,
1867		 	v = h.o,
1868		 	o = h.c;	
1869
1870		// execute onShow callback
1871		if(o.onShow(h) !== false){
1872			// mark modal as shown
1873			e[0]._jqmShown = true;
1874			
1875			// if modal dialog 
1876			//
1877			// Bind the Keep Focus Function [F] if no other Modals are open (!A[0]) +
1878			// Add this modal to the opened modals stack (A) for nested modal support
1879			// 
1880			// else, close dialog when overlay is clicked
1881			if(o.modal){ !A[0]&&F('bind'); A.push(e); }
1882            else e.jqmAddClose(v);
1883			
1884			//  Attach closing events to elements inside the modal that match the closingClass
1885			o.closeClass&&e.jqmAddClose($('.' + o.closeClass,e));
1886			
1887			// IF toTop is true and overlay exists;
1888			//  Add placeholder element <span id="jqmP#ID_of_modal"/> before modal to
1889			//  remember it's position in the DOM and move it to a child of the body tag (after overlay)
1890			o.toTop&&v&&e.before('<span id="jqmP'+o.ID+'"></span>').insertAfter(v);
1891			
1892			// remember overlay (for closing function)
1893			e.data('jqmv',v);
1894		}
1895		
1896		
1897	},  close = function(h){
1898		// close: executes the onHide callback + performs common tasks if successful
1899
1900		// transform legacy hash into new var shortcuts 
1901		 var e = h.w,
1902		 	v = h.o,
1903		 	o = h.c;
1904
1905		// execute onShow callback
1906		if(o.onHide(h) !== false){
1907			// mark modal as !shown
1908			e[0]._jqmShown = false;
1909			
1910			 // If modal, remove from modal stack.
1911			 // If no modals in modal stack, unbind the Keep Focus Function
1912			 if(o.modal){A.pop();!A[0]&&F('unbind');}
1913			 
1914			 // IF toTop was passed and an overlay exists;
1915			 //  Move modal back to its "remembered" position.
1916			 o.toTop&&v&&$('#jqmP'+o.ID).after(e).remove();
1917		}
1918		
1919		
1920	},  F = function(t){
1921		// F: The Keep Focus Function (for modal: true dialos)
1922		// Binds or Unbinds (t) the Focus Examination Function (X) to keypresses and clicks
1923		
1924		$(document)[t]("keypress keydown mousedown",X);
1925		
1926		
1927	}, X = function(e){
1928		// X: The Focus Examination Function (for modal: true dialogs)
1929
1930		var modal = $(e.target).data('jqm') || $(e.target).parents('.jqm-init:first').data('jqm'),
1931			activeModal = A[A.length-1].data('jqm');
1932		
1933		// allow bubbling if event target is within active modal dialog
1934		if(modal && modal.ID == activeModal.ID) return true; 
1935
1936		// else, trigger focusFunc (focus on first input element and halt bubbling)
1937		return $.jqm.focusFunc(activeModal);
1938	}, 
1939	
1940	I = 0,   // modal ID increment (for nested modals) 
1941	A = [];  // array of active modals (used to lock interactivity to appropriate modal)
1942	
1943	
1944	// $.jqm, overridable defaults
1945	$.jqm = {
1946		/**
1947		 *  default options
1948		 *    
1949		 * (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.  
1950		 * (String)    overlayClass - Applied to the body covering overlay. Useful for controlling overlay look (tint, background-image, &c) with CSS.
1951		 * (String)    closeClass   - Children of the modal element matching `closeClass` will fire the onHide event (to close the modal).
1952		 * (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.
1953		 * (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">...)	                
1954		 * (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. 
1955		 *                            Target may be a selector string, jQuery collection of elements, or a DOM element -- and MUST exist as a child of the modal element.
1956		 * (String)    ajaxText     - Text shown while waiting for ajax return. Replaces HTML content of `target` element.
1957		 * (Boolean)   modal        - If true, user interactivity will be locked to the modal window until closed.
1958		 * (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.
1959		 * (Function)  onShow       - User defined callback function fired when modal opened.
1960		 * (Function)  onHide       - User defined callback function fired when modal closed.
1961		 * (Function)  onLoad       - User defined callback function fired when ajax content loads.
1962		 */
1963		params: {
1964			overlay: 50,
1965			overlayClass: 'jqmOverlay',
1966			closeClass: 'jqmClose',
1967			trigger: '.jqModal',
1968			ajax: false,
1969			target: false,
1970			ajaxText: '',
1971			modal: false,
1972			toTop: false,
1973			onShow: onShow,
1974			onHide: onHide,
1975			onLoad: false
1976		},
1977		
1978		// focusFunc is fired when a modal is shown, or when interaction occurs outside
1979		// a modal enabled dialog. Passed the modal element. 
1980		focusFunc: function(e) { $(':input:visible:first',e).focus(); return false; }
1981	};
1982	
1983})( jQuery );
1984/* End */
1985;
1986; /* Start:"a:4:{s:4:"full";s:66:"/local/templates/aspro_next/vendor/js/bootstrap.js?172597048127908";s:6:"source";s:50:"/local/templates/aspro_next/vendor/js/bootstrap.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
1987/*!
1988 * Bootstrap v3.0.0
1989 *
1990 * Copyright 2013 Twitter, Inc
1991 * Licensed under the Apache License v2.0
1992 * http://www.apache.org/licenses/LICENSE-2.0
1993 *
1994 * Designed and built with all the love in the world @twitter by @mdo and @fat.
1995 */
1996
1997+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(
1997d)})},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}
1997,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
1997(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>
1997m?"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 1997-2007
1997e||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)
1998/* End */
1999;
2000; /* Start:"a:4:{s:4:"full";s:69:"/local/templates/aspro_next/vendor/js/jquery.appear.js?17259704813188";s:6:"source";s:54:"/local/templates/aspro_next/vendor/js/jquery.appear.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
2001/*
2002 * jQuery.appear
2003 * https://github.com/bas2k/jquery.appear/
2004 * http://code.google.com/p/jquery-appear/
2005 *
2006 * Copyright (c) 2009 Michael Hixson
2007 * Copyright (c) 2012 Alexander Brovikov
2008 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
2009 */
2010(function($) {
2011	$.fn.appear = function(fn, options) {
2012
2013		var settings = $.extend({
2014
2015			//arbitrary data to pass to fn
2016			data: undefined,
2017
2018			//call fn only on the first appear?
2019			one: true,
2020
2021			// X & Y accuracy
2022			accX: 0,
2023			accY: 0
2024
2025		}, options);
2026
2027		return this.each(function() {
2028
2029			var t = $(this);
2030
2031			//whether the element is currently visible
2032			t.appeared = false;
2033
2034			if (!fn) {
2035
2036				//trigger the custom event
2037				t.trigger('appear', settings.data);
2038				return;
2039			}
2040
2041			var w = $(window);
2042
2043			//fires the appear event when appropriate
2044			var check = function() {
2045
2046				//is the element hidden?
2047				if (!t.is(':visible')) {
2048
2049					//it became hidden
2050					t.appeared = false;
2051					return;
2052				}
2053
2054				//is the element inside the visible window?
2055				var a = w.scrollLeft();
2056				var b = w.scrollTop();
2057				var o = t.offset();
2058				var x = o.left;
2059				var y = o.top;
2060
2061				var ax = settings.accX;
2062				var ay = settings.accY;
2063				var th = t.height();
2064				var wh = w.height();
2065				var tw = t.width();
2066				var ww = w.width();
2067
2068				if (y + th + ay >= b &&
2069					y <= b + wh + ay &&
2070					x + tw + ax >= a &&
2071					x <= a + ww + ax) {
2072
2073					//trigger the custom event
2074					if (!t.appeared) t.trigger('appear', settings.data);
2075
2076				} else {
2077
2078					//it scrolled out of view
2079					t.appeared = false;
2080				}
2081			};
2082
2083			//create a modified fn with some additional logic
2084			var modifiedFn = function() {
2085
2086				//mark the element as visible
2087				t.appeared = true;
2088
2089				//is this supposed to happen only once?
2090				if (settings.one) {
2091
2092					//remove the check
2093					w.unbind('scroll', check);
2094					var i = $.inArray(check, $.fn.appear.checks);
2095					if (i >= 0) $.fn.appear.checks.splice(i, 1);
2096				}
2097
2098				//trigger the original fn
2099				fn.apply(this, arguments);
2100			};
2101
2102			//bind the modified fn to the element
2103			if (settings.one) t.one('appear', settings.data, modifiedFn);
2104			else t.bind('appear', settings.data, modifiedFn);
2105
2106			//check whenever the window scrolls
2107			w.scroll(check);
2108
2109			//check whenever the dom changes
2110			$.fn.appear.checks.push(check);
2111
2112			//check now
2113			(check)();
2114		});
2115	};
2116
2117	//keep a queue of appearance checks
2118	$.extend($.fn.appear, {
2119
2120		checks: [],
2121		timeout: null,
2122
2123		//process the queue
2124		checkAll: function() {
2125			var length = $.fn.appear.checks.length;
2126			if (length > 0) while (length--) ($.fn.appear.checks[length])();
2127		},
2128
2129		//check the queue asynchronously
2130		run: function() {
2131			if ($.fn.appear.timeout) clearTimeout($.fn.appear.timeout);
2132			$.fn.appear.timeout = setTimeout($.fn.appear.checkAll, 20);
2133		}
2134	});
2135
2136	//run checks when these methods are called
2137	$.each(['append', 'prepend', 'after', 'before', 'attr',
2138		'removeAttr', 'addClass', 'removeClass', 'toggleClass',
2139		'remove', 'css', 'show', 'hide'], function(i, n) {
2140		var old = $.fn[n];
2141		if (old) {
2142			$.fn[n] = function() {
2143				var r = old.apply(this, arguments);
2144				$.fn.appear.run();
2145				return r;
2146			}
2147		}
2148	});
2149
2150})(jQuery);
2151/* End */
2152;
2153; /* Start:"a:4:{s:4:"full";s:56:"/local/templates/aspro_next/js/browser.js?17259704371032";s:6:"source";s:41:"/local/templates/aspro_next/js/browser.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
2154var matched, browser;
2155
2156jQuery.uaMatch = function( ua ) {
2157    ua = ua.toLowerCase();
2158
2159    var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
2160        /(webkit)[ \/]([\w.]+)/.exec( ua ) ||
2161        /(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
2162        /(msie)[\s?]([\w.]+)/.exec( ua ) ||       
2163        /(trident)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
2164        ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
2165        [];
2166
2167    return {
2168        browser: match[ 1 ] || "",
2169        version: match[ 2 ] || "0"
2170    };
2171};
vendor: 6,427 bytes, lines 2172-2410
2172
2173matched = jQuery.uaMatch( navigator.userAgent );
2174//IE 11+ fix (Trident) 
2175matched.browser = matched.browser == 'trident' ? 'msie' : matched.browser;
2176browser = {};
2177
2178if ( matched.browser ) {
2179    browser[ matched.browser ] = true;
2180    browser.version = matched.version;
2181}
2182
2183// Chrome is Webkit, but Webkit is also Safari.
2184if ( browser.chrome ) {
2185    browser.webkit = true;
2186} else if ( browser.webkit ) {
2187    browser.safari = true;
2188}
2189
2190jQuery.browser = browser;
2191/* End */
2192;
2193; /* Start:"a:4:{s:4:"full";s:65:"/local/templates/aspro_next/js/jquery.fancybox.js?172597044045889";s:6:"source";s:49:"/local/templates/aspro_next/js/jquery.fancybox.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
2194/*!
2195 * fancyBox - jQuery Plugin
2196 * version: 2.1.0 (Mon, 20 Aug 2012)
2197 * @requires jQuery v1.6 or later
2198 *
2199 * Examples at http://fancyapps.com/fancybox/
2200 * License: www.fancyapps.com/fancybox/#license
2201 *
2202 * Copyright 2012 Janis Skarnelis - [email protected]
2203 *
2204 */
2205
2206(function (window, document, $, undefined) {
2207	"use strict";
2208
2209	var W = $(window),
2210		D = $(document),
2211		F = $.fancybox = function () {
2212			F.open.apply( this, arguments );
2213		},
2214		didUpdate = null,
2215		isTouch	  = document.createTouch !== undefined,
2216
2217		isQuery	= function(obj) {
2218			return obj && obj.hasOwnProperty && obj instanceof $;
2219		},
2220		isString = function(str) {
2221			return str && $.type(str) === "string";
2222		},
2223		isPercentage = function(str) {
2224			return isString(str) && str.indexOf('%') > 0;
2225		},
2226		isScrollable = function(el) {
2227			return (el && !(el.style.overflow && el.style.overflow === 'hidden') && ((el.clientWidth && el.scrollWidth > el.clientWidth) || (el.clientHeight && el.scrollHeight > el.clientHeight)));
2228		},
2229		getScalar = function(value, dim) {
2230			var value_ = parseInt(value, 10);
2231
2232			if (dim && isPercentage(value)) {
2233				value_ = F.getViewport()[ dim ] / 100 * value_;
2234			}
2235
2236			return Math.ceil(value_);
2237		},
2238		getValue = function(value, dim) {
2239			return getScalar(value, dim) + 'px';
2240		};
2241
2242	$.extend(F, {
2243		// The current version of fancyBox
2244		version: '2.1.0',
2245
2246		defaults: {
2247			padding : 15,
2248			margin  : 20,
2249
2250			width     : 800,
2251			height    : 600,
2252			minWidth  : 100,
2253			minHeight : 100,
2254			maxWidth  : 9999,
2255			maxHeight : 9999,
2256
2257			autoSize   : true,
2258			autoHeight : false,
2259			autoWidth  : false,
2260
2261			autoResize  : !isTouch,
2262			autoCenter  : !isTouch,
2263			fitToView   : true,
2264			aspectRatio : false,
2265			topRatio    : 0.5,
2266			leftRatio   : 0.5,
2267
2268			scrolling : 'auto', // 'auto', 'yes' or 'no'
2269			wrapCSS   : '',
2270
2271			arrows     : true,
2272			closeBtn   : true,
2273			closeClick : false,
2274			nextClick  : false,
2275			mouseWheel : true,
2276			autoPlay   : false,
2277			playSpeed  : 3000,
2278			preload    : 3,
2279			modal      : false,
2280			loop       : true,
2281
2282			ajax  : {
2283				dataType : 'html',
2284				headers  : { 'X-fancyBox': true }
2285			},
2286			iframe : {
2287				scrolling : 'auto',
2288				preload   : true
2289			},
2290			swf : {
2291				wmode: 'transparent',
2292				allowfullscreen   : 'true',
2293				allowscriptaccess : 'always'
2294			},
2295
2296			keys  : {
2297				next : {
2298					13 : 'left', // enter
2299					34 : 'up',   // page down
2300					39 : 'left', // right arrow
2301					40 : 'up'    // down arrow
2302				},
2303				prev : {
2304					8  : 'right',  // backspace
2305					33 : 'down',   // page up
2306					37 : 'right',  // left arrow
2307					38 : 'down'    // up arrow
2308				},
2309				close  : [27], // escape key
2310				play   : [32], // space - start/stop slideshow
2311				toggle : [70]  // letter "f" - toggle fullscreen
2312			},
2313
2314			direction : {
2315				next : 'left',
2316				prev : 'right'
2317			},
2318
2319			scrollOutside  : true,
2320
2321			// Override some properties
2322			index   : 0,
2323			type    : null,
2324			href    : null,
2325			content : null,
2326			title   : null,
2327
2328			// HTML templates
2329			tpl: {
2330				wrap     : '<div class="fancybox-wrap" tabIndex="-1"><div class="fancybox-skin"><div class="fancybox-outer"><div class="fancybox-inner"></div></div></div></div>',
2331				image    : '<img class="fancybox-image" src="{href}" alt="" />',
2332				iframe   : '<iframe id="fancybox-frame{rnd}" name="fancybox-frame{rnd}" class="fancybox-iframe" frameborder="0" vspace="0" hspace="0"' + (browser.msie ? ' allowtransparency="true"' : '') + '></iframe>',
2333				error    : '<p class="fancybox-error">The requested content cannot be loaded.<br/>Please try again later.</p>',
2334				closeBtn : '<a title="Close" class="fancybox-item fancybox-close" href="javascript:;"></a>',
2335				next     : '<a title="Next" class="fancybox-nav fancybox-next" href="javascript:;"><span></span></a>',
2336				prev     : '<a title="Previous" class="fancybox-nav fancybox-prev" href="javascript:;"><span></span></a>'
2337			},
2338
2339			// Properties for each animation type
2340			// Opening fancyBox
2341			openEffect  : 'fade', // 'elastic', 'fade' or 'none'
2342			openSpeed   : 250,
2343			openEasing  : 'swing',
2344			openOpacity : true,
2345			openMethod  : 'zoomIn',
2346
2347			// Closing fancyBox
2348			closeEffect  : 'fade', // 'elastic', 'fade' or 'none'
2349			closeSpeed   : 250,
2350			closeEasing  : 'swing',
2351			closeOpacity : true,
2352			closeMethod  : 'zoomOut',
2353
2354			// Changing next gallery item
2355			nextEffect : 'elastic', // 'elastic', 'fade' or 'none'
2356			nextSpeed  : 250,
2357			nextEasing : 'swing',
2358			nextMethod : 'changeIn',
2359
2360			// Changing previous gallery item
2361			prevEffect : 'elastic', // 'elastic', 'fade' or 'none'
2362			prevSpeed  : 250,
2363			prevEasing : 'swing',
2364			prevMethod : 'changeOut',
2365
2366			// Enabled helpers
2367			helpers : {
2368				overlay : {
2369					closeClick : true,
2370					speedOut   : 200,
2371					showEarly  : true,
2372					css        : {}
2373				},
2374				title : {
2375					type : 'float' // 'float', 'inside', 'outside' or 'over'
2376				}
2377			},
2378
2379			// Callbacks
2380			onCancel     : $.noop, // If canceling
2381			beforeLoad   : $.noop, // Before loading
2382			afterLoad    : $.noop, // After loading
2383			beforeShow   : $.noop, // Before changing in current item
2384			afterShow    : $.noop, // After opening
2385			beforeChange : $.noop, // Before changing gallery item
2386			beforeClose  : $.noop, // Before closing
2387			afterClose   : $.noop  // After closing
2388		},
2389
2390		//Current state
2391		group    : {}, // Selected group
2392		opts     : {}, // Group options
2393		previous : null,  // Previous element
2394		coming   : null,  // Element being loaded
2395		current  : null,  // Currently loaded element
2396		isActive : false, // Is activated
2397		isOpen   : false, // Is currently open
2398		isOpened : false, // Have been fully opened at least once
2399
2400		wrap  : null,
2401		skin  : null,
2402		outer : null,
2403		inner : null,
2404
2405		player : {
2406			timer    : null,
2407			isActive : false
2408		},
2409
2410		// Loaders
vendor: 4,143 bytes, lines 2411-2607
2411		ajaxLoad   : null,
2412		imgPreload : null,
2413
2414		// Some collections
2415		transitions : {},
2416		helpers     : {},
2417
2418		/*
2419		 *	Static methods
2420		 */
2421
2422		open: function (group, opts) {
2423			if (!group) {
2424				return;
2425			}
2426
2427			if (!$.isPlainObject(opts)) {
2428				opts = {};
2429			}
2430
2431			// Close if already active
2432			if (false === F.close(true)) {
2433				return;
2434			}
2435
2436			// Normalize group
2437			if (!$.isArray(group)) {
2438				group = isQuery(group) ? $(group).get() : [group];
2439			}
2440
2441			// Recheck if the type of each element is `object` and set content type (image, ajax, etc)
2442			$.each(group, function(i, element) {
2443				var obj = {},
2444					href,
2445					title,
2446					content,
2447					type,
2448					rez,
2449					hrefParts,
2450					selector;
2451
2452				if ($.type(element) === "object") {
2453					// Check if is DOM element
2454					if (element.nodeType) {
2455						element = $(element);
2456					}
2457
2458					if (isQuery(element)) {
2459						obj = {
2460							href    : element.attr('href'),
2461							title   : element.attr('title'),
2462							isDom   : true,
2463							element : element
2464						};
2465
2466						if ($.metadata) {
2467							$.extend(true, obj, element.metadata());
2468						}
2469
2470					} else {
2471						obj = element;
2472					}
2473				}
2474
2475				href  = opts.href  || obj.href || (isString(element) ? element : null);
2476				title = opts.title !== undefined ? opts.title : obj.title || '';
2477
2478				content = opts.content || obj.content;
2479				type    = content ? 'html' : (opts.type  || obj.type);
2480
2481				if (!type && obj.isDom) {
2482					type = element.data('fancybox-type');
2483
2484					if (!type) {
2485						rez  = element.prop('class').match(/fancybox\.(\w+)/);
2486						type = rez ? rez[1] : null;
2487					}
2488				}
2489
2490				if (isString(href)) {
2491					// Try to guess the content type
2492					if (!type) {
2493						if (F.isImage(href)) {
2494							type = 'image';
2495
2496						} else if (F.isSWF(href)) {
2497							type = 'swf';
2498
2499						} else if (href.charAt(0) === '#') {
2500							type = 'inline';
2501
2502						} else if (isString(element)) {
2503							type    = 'html';
2504							content = element;
2505						}
2506					}
2507
2508					// Split url into two pieces with source url and content selector, e.g,
2509					// "/mypage.html #my_id" will load "/mypage.html" and display element having id "my_id"
2510					if (type === 'ajax') {
2511						hrefParts = href.split(/\s+/, 2);
2512						href      = hrefParts.shift();
2513						selector  = hrefParts.shift();
2514					}
2515				}
2516
2517				if (!content) {
2518					if (type === 'inline') {
2519						if (href) {
2520							content = $( isString(href) ? href.replace(/.*(?=#[^\s]+$)/, '') : href ); //strip for ie7
2521
2522						} else if (obj.isDom) {
2523							content = element;
2524						}
2525
2526					} else if (type === 'html') {
2527						content = href;
2528
2529					} else if (!type && !href && obj.isDom) {
2530						type    = 'inline';
2531						content = element;
2532					}
2533				}
2534
2535				$.extend(obj, {
2536					href     : href,
2537					type     : type,
2538					content  : content,
2539					title    : title,
2540					selector : selector
2541				});
2542
2543				group[ i ] = obj;
2544			});
2545
2546			// Extend the defaults
2547			F.opts = $.extend(true, {}, F.defaults, opts);
2548
2549			// All options are merged recursive except keys
2550			if (opts.keys !== undefined) {
2551				F.opts.keys = opts.keys ? $.extend({}, F.defaults.keys, opts.keys) : false;
2552			}
2553
2554			F.group = group;
2555
2556			return F._start(F.opts.index);
2557		},
2558
2559		// Cancel image loading or abort ajax request
2560		cancel: function () {
2561			var coming = F.coming;
2562
2563			if (!coming || false === F.trigger('onCancel')) {
2564				return;
2565			}
2566
2567			F.hideLoading();
2568
2569			if (F.ajaxLoad) {
2570				F.ajaxLoad.abort();
2571			}
2572
2573			F.ajaxLoad = null;
2574
2575			if (F.imgPreload) {
2576				F.imgPreload.onload = F.imgPreload.onerror = null;
2577			}
2578
2579			// If the first item has been canceled, then clear everything
2580			if (coming.wrap) {
2581				coming.wrap.stop(true).trigger('onReset').remove();
2582			}
2583
2584			if (!F.current) {
2585				F.trigger('afterClose');
2586			}
2587
2588			F.coming = null;
2589		},
2590
2591		// Start closing animation if is open; remove immediately if opening/closing
2592		close: function (immediately) {
2593			F.cancel();
2594
2595			if (false === F.trigger('beforeClose')) {
2596				return;
2597			}
2598
2599			F.unbindEvents();
2600
2601			if (!F.isOpen || immediately === true) {
2602				$('.fancybox-wrap').stop(true).trigger('onReset').remove();
2603
2604				F._afterZoomOut();
2605
2606			} else {
2607				F.isOpen = F.isOpened = false;
2608				F.isClosing = true;
2609
2610				$('.fancybox-item, .fancybox-nav').remove();
2611
2612				F.wrap.stop(true, true).removeClass('fancybox-opened');
2613
2614				if (F.wrap.css('position') === 'fixed') {
2615					F.wrap.css(F._getPosition( true ));
2616				}
2617
2618				F.transitions[ F.current.closeMethod ]();
2619			}
2620		},
2621
2622		// Manage slideshow:
2623		//   $.fancybox.play(); - toggle slideshow
2624		//   $.fancybox.play( true ); - start
2625		//   $.fancybox.play( false ); - stop
2626		play: function ( action ) {
2627			var clear = function () {
2628					clearTimeout(F.player.timer);
2629				},
2630				set = function () {
2631					clear();
2632
2633					if (F.current && F.player.isActive) {
2634						F.player.timer = setTimeout(F.next, F.current.playSpeed);
2635					}
2636				},
2637				stop = function () {
2638					clear();
2639
2640					$('body').unbind('.player');
2641
2642					F.player.isActive = false;
2643
2644					F.trigger('onPlayEnd');
2645				},
2646				start = function () {
2647					if (F.current && (F.current.loop || F.current.index < F.group.length - 1)) {
2648						F.player.isActive = true;
2649
2650						$('body').bind({
2651							'afterShow.player onUpdate.player'   : set,
2652							'onCancel.player beforeClose.player' : stop,
2653							'beforeLoad.player' : clear
2654						});
2655
2656						set();
2657
2658						F.trigger('onPlayStart');
2659					}
2660				};
2661
2662			if (action === true || (!F.player.isActive && action !== false)) {
2663				start();
2664			} else {
2665				stop();
2666			}
2667		},
2668
2669		// Navigate to next gallery item
2670		next: function ( direction ) {
2671			var current = F.current;
2672
2673			if (current) {
2674				if (!isString(direction)) {
2675					direction = current.direction.next;
2676				}
2677
2678				F.jumpto(current.index + 1, direction, 'next');
2679			}
2680		},
2681
2682		// Navigate to previous gallery item
2683		prev: function ( direction ) {
2684			var current = F.current;
2685
2686			if (current) {
2687				if (!isString(direction)) {
2688					direction = current.direction.prev;
2689				}
2690
2691				F.jumpto(current.index - 1, direction, 'prev');
2692			}
2693		},
2694
2695		// Navigate to gallery item by index
2696		jumpto: function ( index, direction, router ) {
2697			var current = F.current;
2698
2699			if (!current) {
2700				return;
2701			}
2702
2703			index = getScalar(index);
2704
2705			F.direction = direction || current.direction[ (index >= current.index ? 'next' : 'prev') ];
2706			F.router    = router || 'jumpto';
2707
2708			if (current.loop) {
2709				if (index < 0) {
2710					index = current.group.length + (index % current.group.length);
2711				}
2712
2713				index = index % current.group.length;
2714			}
2715
2716			if (current.group[ index ] !== undefined) {
2717				F.cancel();
2718
2719				F._start(index);
2720			}
2721		},
2722
2723		// Center inside viewport and toggle position type to fixed or absolute if needed
2724		reposition: function (e, onlyAbsolute) {
2725			var pos;
2726
2727			if (F.isOpen) {
2728				pos = F._getPosition(onlyAbsolute);
2729
2730				if (e && e.type === 'scroll') {
2731					delete pos.position;
2732
2733					F.wrap.stop(true, true).animate(pos, 200);
2734
2735				} else {
2736					F.wrap.css(pos);
2737				}
2738			}
2739		},
2740
2741		update: function (e) {
2742			var type = (e && e.type),
2743				anyway = !type || type === 'orientationchange';
2744
2745			if (anyway) {
2746				clearTimeout(didUpdate);
2747
2748				didUpdate = null;
2749			}
2750
2751			if (!F.isOpen || didUpdate) {
2752				return;
2753			}
2754
2755			// Help browser to restore document dimensions
2756			if (anyway || isTouch) {
2757				F.wrap.removeAttr('style').addClass('fancybox-tmp');
2758
2759				F.trigger('onUpdate');
2760			}
2761
2762			didUpdate = setTimeout(function() {
2763				var current = F.current;
2764
2765				if (!current) {
2766					return;
2767				}
2768
2769				F.wrap.removeClass('fancybox-tmp');
2770
2771				if (type !== 'scroll') {
2772					F._setDimension();
2773				}
2774
2775				if (!(type === 'scroll' && current.canShrink)) {
2776					F.reposition(e);
2777				}
2778
2779				F.trigger('onUpdate');
2780
2781				didUpdate = null;
2782
2783			}, (isTouch ? 500 : (anyway ? 20 : 300)));
2784		},
2785
2786		// Shrink content to fit inside viewport or restore if resized
2787		toggle: function ( action ) {
2788			if (F.isOpen) {
2789				F.current.fitToView = $.type(action) === "boolean" ? action : !F.current.fitToView;
2790
2791				F.update();
2792			}
2793		},
2794
2795		hideLoading: function () {
2796			D.unbind('keypress.fb');
2797
2798			$('#fancybox-loading').remove();
2799		},
2800
2801		showLoading: function () {
2802			var el, viewport;
2803
2804			F.hideLoading();
2805
2806			// If user will press the escape-button, the request will be canceled
2807			D.bind('keypress.fb', function(e) {
2808				if ((e.which || e.keyCode) === 27) {
2809					e.preventDefault();
2810					F.cancel();
2811				}
2812			});
2813
2814			el = $('<div id="fancybox-loading"><div></div></div>').click(F.cancel).appendTo('body');
2815
2816			if (!F.defaults.fixed) {
2817				viewport = F.getViewport();
2818
2819				el.css({
2820					position : 'absolute',
2821					top  : (viewport.h * 0.5) + viewport.y,
2822					left : (viewport.w * 0.5) + viewport.x
2823				});
2824			}
2825		},
2826
2827		getViewport: function () {
2828			var lock = F.current ? F.current.locked : false,
2829				rez  = {
2830					x: W.scrollLeft(),
2831					y: W.scrollTop()
2832				};
2833
2834			if (lock) {
2835				rez.w = lock[0].clientWidth;
2836				rez.h = lock[0].clientHeight;
2837
2838			} else {
2839				// See http://bugs.jquery.com/ticket/6724
2840				rez.w = isTouch && window.innerWidth  ? window.innerWidth  : W.width();
2841				rez.h = isTouch && window.innerHeight ? window.innerHeight : W.he
vendor: 25,445 bytes, lines 2841-3871
2841ight();
2842			}
2843
2844			return rez;
2845		},
2846
2847		// Unbind the keyboard / clicking actions
2848		unbindEvents: function () {
2849			if (F.wrap && isQuery(F.wrap)) {
2850				F.wrap.unbind('.fb');
2851			}
2852
2853			D.unbind('.fb');
2854			W.unbind('.fb');
2855		},
2856
2857		bindEvents: function () {
2858			var current = F.current,
2859				keys;
2860
2861			if (!current) {
2862				return;
2863			}
2864
2865			// Changing document height on iOS devices triggers a 'resize' event,
2866			// that can change document height... repeating infinitely
2867			W.bind('orientationchange.fb' + (isTouch ? '' : ' resize.fb' ) + (current.autoCenter && !current.locked ? ' scroll.fb' : ''), F.update);
2868
2869			keys = current.keys;
2870
2871			if (keys) {
2872				D.bind('keydown.fb', function (e) {
2873					var code   = e.which || e.keyCode,
2874						target = e.target || e.srcElement;
2875
2876					// Ignore key combinations and key events within form elements
2877					if (!e.ctrlKey && !e.altKey && !e.shiftKey && !e.metaKey && !(target && (target.type || $(target).is('[contenteditable]')))) {
2878						$.each(keys, function(i, val) {
2879							if (current.group.length > 1 && val[ code ] !== undefined) {
2880								F[ i ]( val[ code ] );
2881
2882								e.preventDefault();
2883								return false;
2884							}
2885
2886							if ($.inArray(code, val) > -1) {
2887								F[ i ] ();
2888
2889								e.preventDefault();
2890								return false;
2891							}
2892						});
2893					}
2894				});
2895			}
2896
2897			if ($.fn.mousewheel && current.mouseWheel) {
2898				F.wrap.bind('mousewheel.fb', function (e, delta, deltaX, deltaY) {
2899					var target = e.target || null,
2900						parent = $(target),
2901						canScroll = false;
2902
2903					while (parent.length) {
2904						if (canScroll || parent.is('.fancybox-skin') || parent.is('.fancybox-wrap')) {
2905							break;
2906						}
2907
2908						canScroll = isScrollable( parent[0] );
2909						parent    = $(parent).parent();
2910					}
2911
2912					if (delta !== 0 && !canScroll) {
2913						if (F.group.length > 1 && !current.canShrink) {
2914							if (deltaY > 0 || deltaX > 0) {
2915								F.prev( deltaY > 0 ? 'down' : 'left' );
2916
2917							} else if (deltaY < 0 || deltaX < 0) {
2918								F.next( deltaY < 0 ? 'up' : 'right' );
2919							}
2920
2921							e.preventDefault();
2922						}
2923					}
2924				});
2925			}
2926		},
2927
2928		trigger: function (event, o) {
2929			var ret, obj = o || F.coming || F.current;
2930
2931			if (!obj) {
2932				return;
2933			}
2934
2935			if ($.isFunction( obj[event] )) {
2936				ret = obj[event].apply(obj, Array.prototype.slice.call(arguments, 1));
2937			}
2938
2939			if (ret === false) {
2940				return false;
2941			}
2942
2943			if (event === 'onCancel' && !F.isOpened) {
2944				F.isActive = false;
2945			}
2946
2947			if (obj.helpers) {
2948				$.each(obj.helpers, function (helper, opts) {
2949					if (opts && F.helpers[helper] && $.isFunction(F.helpers[helper][event])) {
2950						F.helpers[helper][event](opts, obj);
2951					}
2952				});
2953			}
2954
2955			$.event.trigger(event + '.fb');
2956		},
2957
2958		isImage: function (str) {
2959			return isString(str) && str.match(/\.(jp(e|g|eg)|gif|png|bmp|webp)((\?|#).*)?$/i);
2960		},
2961
2962		isSWF: function (str) {
2963			return isString(str) && str.match(/\.(swf)((\?|#).*)?$/i);
2964		},
2965
2966		_start: function (index) {
2967			var coming = {},
2968				obj,
2969				href,
2970				type,
2971				margin,
2972				padding;
2973
2974			index = getScalar( index );
2975			obj   = F.group[ index ] || null;
2976
2977			if (!obj) {
2978				return false;
2979			}
2980
2981			coming = $.extend(true, {}, F.opts, obj);
2982
2983			// Convert margin and padding properties to array - top, right, bottom, left
2984			margin  = coming.margin;
2985			padding = coming.padding;
2986
2987			if ($.type(margin) === 'number') {
2988				coming.margin = [margin, margin, margin, margin];
2989			}
2990
2991			if ($.type(padding) === 'number') {
2992				coming.padding = [padding, padding, padding, padding];
2993			}
2994
2995			// 'modal' propery is just a shortcut
2996			if (coming.modal) {
2997				$.extend(true, coming, {
2998					closeBtn   : false,
2999					closeClick : false,
3000					nextClick  : false,
3001					arrows     : false,
3002					mouseWheel : false,
3003					keys       : null,
3004					helpers: {
3005						overlay : {
3006							closeClick : false
3007						}
3008					}
3009				});
3010			}
3011
3012			// 'autoSize' property is a shortcut, too
3013			if (coming.autoSize) {
3014				coming.autoWidth = coming.autoHeight = true;
3015			}
3016
3017			if (coming.width === 'auto') {
3018				coming.autoWidth = true;
3019			}
3020
3021			if (coming.height === 'auto') {
3022				coming.autoHeight = true;
3023			}
3024
3025			/*
3026			 * Add reference to the group, so it`s possible to access from callbacks, example:
3027			 * afterLoad : function() {
3028			 *     this.title = 'Image ' + (this.index + 1) + ' of ' + this.group.length + (this.title ? ' - ' + this.title : '');
3029			 * }
3030			 */
3031
3032			coming.group  = F.group;
3033			coming.index  = index;
3034
3035			// Give a chance for callback or helpers to update coming item (type, title, etc)
3036			F.coming = coming;
3037
3038			if (false === F.trigger('beforeLoad')) {
3039				F.coming = null;
3040
3041				return;
3042			}
3043
3044			type = coming.type;
3045			href = coming.href;
3046
3047			if (!type) {
3048				F.coming = null;
3049
3050				//If we can not determine content type then drop silently or display next/prev item if looping through gallery
3051				if (F.current && F.router && F.router !== 'jumpto') {
3052					F.current.index = index;
3053
3054					return F[ F.router ]( F.direction );
3055				}
3056
3057				return false;
3058			}
3059
3060			F.isActive = true;
3061
3062			if (type === 'image' || type === 'swf') {
3063				coming.autoHeight = coming.autoWidth = false;
3064				coming.scrolling  = 'visible';
3065			}
3066
3067			if (type === 'image') {
3068				coming.aspectRatio = true;
3069			}
3070
3071			if (type === 'iframe' && isTouch) {
3072				coming.scrolling = 'scroll';
3073			}
3074
3075			// Build the neccessary markup
3076			coming.wrap = $(coming.tpl.wrap).addClass('fancybox-' + (isTouch ? 'mobile' : 'desktop') + ' fancybox-type-' + type + ' fancybox-tmp ' + coming.wrapCSS).appendTo( coming.parent );
3077
3078			$.extend(coming, {
3079				skin  : $('.fancybox-skin',  coming.wrap),
3080				outer : $('.fancybox-outer', coming.wrap),
3081				inner : $('.fancybox-inner', coming.wrap)
3082			});
3083
3084			$.each(["Top", "Right", "Bottom", "Left"], function(i, v) {
3085				coming.skin.css('padding' + v, getValue(coming.padding[ i ]));
3086			});
3087
3088			F.trigger('onReady');
3089
3090			// Check before try to load; 'inline' and 'html' types need content, others - href
3091			if (type === 'inline' || type === 'html') {
3092				if (!coming.content || !coming.content.length) {
3093					return F._error( 'content' );
3094				}
3095
3096			} else if (!href) {
3097				return F._error( 'href' );
3098			}
3099
3100			if (type === 'image') {
3101				F._loadImage();
3102
3103			} else if (type === 'ajax') {
3104				F._loadAjax();
3105
3106			} else if (type === 'iframe') {
3107				F._loadIframe();
3108
3109			} else {
3110				F._afterLoad();
3111			}
3112		},
3113
3114		_error: function ( type ) {
3115			$.extend(F.coming, {
3116				type       : 'html',
3117				autoWidth  : true,
3118				autoHeight : true,
3119				minWidth   : 0,
3120				minHeight  : 0,
3121				scrolling  : 'no',
3122				hasError   : type,
3123				content    : F.coming.tpl.error
3124			});
3125
3126			F._afterLoad();
3127		},
3128
3129		_loadImage: function () {
3130			// Reset preload image so it is later possible to check "complete" property
3131			var img = F.imgPreload = new Image();
3132
3133			img.onload = function () {
3134				this.onload = this.onerror = null;
3135
3136				F.coming.width  = this.width;
3137				F.coming.height = this.height;
3138
3139				F._afterLoad();
3140			};
3141
3142			img.onerror = function () {
3143				this.onload = this.onerror = null;
3144
3145				F._error( 'image' );
3146			};
3147
3148			img.src = F.coming.href;
3149
3150			if (img.complete === undefined || !img.complete) {
3151				F.showLoading();
3152			}
3153		},
3154
3155		_loadAjax: function () {
3156			var coming = F.coming;
3157
3158			F.showLoading();
3159
3160			F.ajaxLoad = $.ajax($.extend({}, coming.ajax, {
3161				url: coming.href,
3162				error: function (jqXHR, textStatus) {
3163					if (F.coming && textStatus !== 'abort') {
3164						F._error( 'ajax', jqXHR );
3165
3166					} else {
3167						F.hideLoading();
3168					}
3169				},
3170				success: function (data, textStatus) {
3171					if (textStatus === 'success') {
3172						coming.content = data;
3173
3174						F._afterLoad();
3175					}
3176				}
3177			}));
3178		},
3179
3180		_loadIframe: function() {
3181			var coming = F.coming,
3182				iframe = $(coming.tpl.iframe.replace(/\{rnd\}/g, new Date().getTime()))
3183					.attr('scrolling', isTouch ? 'auto' : coming.iframe.scrolling)
3184					.attr('src', coming.href);
3185
3186			// This helps IE
3187			$(coming.wrap).bind('onReset', function () {
3188				try {
3189					$(this).find('iframe').hide().attr('src', '//about:blank').end().empty();
3190				} catch (e) {}
3191			});
3192
3193			if (coming.iframe.preload) {
3194				F.showLoading();
3195
3196				iframe.one('load', function() {
3197					$(this).data('ready', 1);
3198
3199					// iOS will lose scrolling if we resize
3200					if (!isTouch) {
3201						$(this).bind('load.fb', F.update);
3202					}
3203
3204					// Without this trick:
3205					//   - iframe won't scroll on iOS devices
3206					//   - IE7 sometimes displays empty iframe
3207					$(this).parents('.fancybox-wrap').width('100%').removeClass('fancybox-tmp').show();
3208
3209					F._afterLoad();
3210				});
3211			}
3212
3213			coming.content = iframe.appendTo( coming.inner );
3214
3215			if (!coming.iframe.preload) {
3216				F._afterLoad();
3217			}
3218		},
3219
3220		_preloadImages: function() {
3221			var group   = F.group,
3222				current = F.current,
3223				len     = group.length,
3224				cnt     = current.preload ? Math.min(current.preload, len - 1) : 0,
3225				item,
3226				i;
3227
3228			for (i = 1; i <= cnt; i += 1) {
3229				item = group[ (current.index + i ) % len ];
3230
3231				if (item.type === 'image' && item.href) {
3232					new Image().src = item.href;
3233				}
3234			}
3235		},
3236
3237		_afterLoad: function () {
3238			var coming   = F.coming,
3239				previous = F.current,
3240				placeholder = 'fancybox-placeholder',
3241				current,
3242				content,
3243				type,
3244				scrolling,
3245				href,
3246				embed;
3247
3248			F.hideLoading();
3249
3250			if (!coming || F.isActive === false) {
3251				return;
3252			}
3253
3254			if (false === F.trigger('afterLoad', coming, previous)) {
3255				coming.wrap.stop(true).trigger('onReset').remove();
3256
3257				F.coming = null;
3258
3259				return;
3260			}
3261
3262			if (previous) {
3263				F.trigger('beforeChange', previous);
3264
3265				previous.wrap.stop(true).removeClass('fancybox-opened')
3266					.find('.fancybox-item, .fancybox-nav')
3267					.remove();
3268
3269				if (previous.wrap.css('position') === 'fixed') {
3270					previous.wrap.css(F._getPosition( true ));
3271				}
3272			}
3273
3274			F.unbindEvents();
3275
3276			current   = coming;
3277			content   = coming.content;
3278			type      = coming.type;
3279			scrolling = coming.scrolling;
3280
3281			$.extend(F, {
3282				wrap  : current.wrap,
3283				skin  : current.skin,
3284				outer : current.outer,
3285				inner : current.inner,
3286				current  : current,
3287				previous : previous
3288			});
3289
3290			href = current.href;
3291
3292			switch (type) {
3293				case 'inline':
3294				case 'ajax':
3295				case 'html':
3296					if (current.selector) {
3297						content = $('<div>').html(content).find(current.selector);
3298
3299					} else if (isQuery(content)) {
3300						if (!content.data(placeholder)) {
3301							content.data(placeholder, $('<div class="' + placeholder + '"></div>').insertAfter( content ).hide() );
3302						}
3303
3304						content = content.show().detach();
3305
3306						current.wrap.bind('onReset', function () {
3307							if ($(this).find(content).length) {
3308								content.hide().replaceAll( content.data(placeholder) ).data(placeholder, false);
3309							}
3310						});
3311					}
3312				break;
3313
3314				case 'image':
3315					content = current.tpl.image.replace('{href}', href);
3316				break;
3317
3318				case 'swf':
3319					content = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="100%" height="100%"><param name="movie" value="' + href + '"></param>';
3320					embed   = '';
3321
3322					$.each(current.swf, function(name, val) {
3323						content += '<param name="' + name + '" value="' + val + '"></param>';
3324						embed   += ' ' + name + '="' + val + '"';
3325					});
3326
3327					content += '<embed src="' + href + '" type="application/x-shockwave-flash" width="100%" height="100%"' + embed + '></embed></object>';
3328				break;
3329			}
3330
3331			if (!(isQuery(content) && content.parent().is(current.inner))) {
3332				current.inner.append( content );
3333			}
3334
3335			// Give a chance for helpers or callbacks to update elements
3336			F.trigger('beforeShow');
3337
3338			// Set scrolling before calculating dimensions
3339			current.inner.css('overflow', scrolling === 'yes' ? 'scroll' : (scrolling === 'no' ? 'hidden' : scrolling));
3340
3341			// Set initial dimensions and start position
3342			F._setDimension();
3343
3344			current.wrap.removeClass('fancybox-tmp');
3345
3346			current.pos = $.extend({}, current.dim, F._getPosition( true ));
3347
3348			F.isOpen = false;
3349			F.coming = null;
3350
3351			F.bindEvents();
3352
3353			if (!F.isOpened) {
3354				$('.fancybox-wrap').not( current.wrap ).stop(true).trigger('onReset').remove();
3355
3356			} else if (previous.prevMethod) {
3357				F.transitions[ previous.prevMethod ]();
3358			}
3359
3360			F.transitions[ F.isOpened ? current.nextMethod : current.openMethod ]();
3361
3362			F._preloadImages();
3363		},
3364
3365		_setDimension: function () {
3366			var viewport   = F.getViewport(),
3367				steps      = 0,
3368				canShrink  = false,
3369				canExpand  = false,
3370				wrap       = F.wrap,
3371				skin       = F.skin,
3372				inner      = F.inner,
3373				current    = F.current,
3374				width      = current.width,
3375				height     = current.height,
3376				minWidth   = current.minWidth,
3377				minHeight  = current.minHeight,
3378				maxWidth   = current.maxWidth,
3379				maxHeight  = current.maxHeight,
3380				scrolling  = current.scrolling,
3381				scrollOut  = current.scrollOutside ? current.scrollbarWidth : 0,
3382				margin     = current.margin,
3383				wMargin    = margin[1] + margin[3],
3384				hMargin    = margin[0] + margin[2],
3385				wPadding,
3386				hPadding,
3387				wSpace,
3388				hSpace,
3389				origWidth,
3390				origHeight,
3391				origMaxWidth,
3392				origMaxHeight,
3393				ratio,
3394				width_,
3395				height_,
3396				maxWidth_,
3397				maxHeight_,
3398				iframe,
3399				body;
3400
3401			// Reset dimensions so we could re-check actual size
3402			wrap.add(skin).add(inner).width('auto').height('auto');
3403
3404			wPadding = skin.outerWidth(true)  - skin.width();
3405			hPadding = skin.outerHeight(true) - skin.height();
3406
3407			// Any space between content and viewport (margin, padding, border, title)
3408			wSpace = wMargin + wPadding;
3409			hSpace = hMargin + hPadding;
3410
3411			origWidth  = isPercentage(width)  ? (viewport.w - wSpace) * getScalar(width)  / 100 : width;
3412			origHeight = isPercentage(height) ? (viewport.h - hSpace) * getScalar(height) / 100 : height;
3413
3414			if (current.type === 'iframe') {
3415				iframe = current.content;
3416
3417				if (current.autoHeight && iframe.data('ready') === 1) {
3418					try {
3419						if (iframe[0].contentWindow.document.location) {
3420							inner.width( origWidth ).height(9999);
3421
3422							body = iframe.contents().find('body');
3423
3424							if (scrollOut) {
3425								body.css('overflow-x', 'hidden');
3426							}
3427
3428							origHeight = body.height();
3429						}
3430
3431					} catch (e) {}
3432				}
3433
3434			} else if (current.autoWidth || current.autoHeight) {
3435				inner.addClass( 'fancybox-tmp' );
3436
3437				// Set width or height in case we need to calculate only one dimension
3438				if (!current.autoWidth) {
3439					inner.width( origWidth );
3440				}
3441
3442				if (!current.autoHeight) {
3443					inner.height( origHeight );
3444				}
3445
3446				if (current.autoWidth) {
3447					origWidth = inner.width();
3448				}
3449
3450				if (current.autoHeight) {
3451					origHeight = inner.height();
3452				}
3453
3454				inner.removeClass( 'fancybox-tmp' );
3455			}
3456
3457			width  = getScalar( origWidth );
3458			height = getScalar( origHeight );
3459
3460			ratio  = origWidth / origHeight;
3461
3462			// Calculations for the content
3463			minWidth  = getScalar(isPercentage(minWidth) ? getScalar(minWidth, 'w') - wSpace : minWidth);
3464			maxWidth  = getScalar(isPercentage(maxWidth) ? getScalar(maxWidth, 'w') - wSpace : maxWidth);
3465
3466			minHeight = getScalar(isPercentage(minHeight) ? getScalar(minHeight, 'h') - hSpace : minHeight);
3467			maxHeight = getScalar(isPercentage(maxHeight) ? getScalar(maxHeight, 'h') - hSpace : maxHeight);
3468
3469			// These will be used to determine if wrap can fit in the viewport
3470			origMaxWidth  = maxWidth;
3471			origMaxHeight = maxHeight;
3472
3473			maxWidth_  = viewport.w - wMargin;
3474			maxHeight_ = viewport.h - hMargin;
3475
3476			if (current.aspectRatio) {
3477				if (width > maxWidth) {
3478					width  = maxWidth;
3479					height = width / ratio;
3480				}
3481
3482				if (height > maxHeight) {
3483					height = maxHeight;
3484					width  = height * ratio;
3485				}
3486
3487				if (width < minWidth) {
3488					width  = minWidth;
3489					height = width / ratio;
3490				}
3491
3492				if (height < minHeight) {
3493					height = minHeight;
3494					width  = height * ratio;
3495				}
3496
3497			} else {
3498				width  = Math.max(minWidth,  Math.min(width,  maxWidth));
3499				height = Math.max(minHeight, Math.min(height, maxHeight));
3500			}
3501
3502			// Try to fit inside viewport (including the title)
3503			if (current.fitToView) {
3504				maxWidth  = Math.min(viewport.w - wSpace, maxWidth);
3505				maxHeight = Math.min(viewport.h - hSpace, maxHeight);
3506
3507				inner.width( getScalar( width ) ).height( getScalar( height ) );
3508
3509				wrap.width( getScalar( width + wPadding ) );
3510
3511				// Real wrap dimensions
3512				width_  = wrap.width();
3513				height_ = wrap.height();
3514
3515				if (current.aspectRatio) {
3516					while ((width_ > maxWidth_ || height_ > maxHeight_) && width > minWidth && height > minHeight) {
3517						if (steps++ > 19) {
3518							break;
3519						}
3520
3521						height = Math.max(minHeight, Math.min(maxHeight, height - 10));
3522						width  = height * ratio;
3523
3524						if (width < minWidth) {
3525							width  = minWidth;
3526							height = width / ratio;
3527						}
3528
3529						if (width > maxWidth) {
3530							width  = maxWidth;
3531							height = width / ratio;
3532						}
3533
3534						inner.width( getScalar( width ) ).height( getScalar( height ) );
3535
3536						wrap.width( getScalar( width + wPadding ) );
3537
3538						width_  = wrap.width();
3539						height_ = wrap.height();
3540					}
3541
3542				} else {
3543					width  = Math.max(minWidth,  Math.min(width,  width  - (width_  - maxWidth_)));
3544					height = Math.max(minHeight, Math.min(height, height - (height_ - maxHeight_)));
3545				}
3546			}
3547
3548			if (scrollOut && scrolling === 'auto' && height < origHeight && (width + wPadding + scrollOut) < maxWidth_) {
3549				width += scrollOut;
3550			}
3551
3552			inner.width( getScalar( width ) ).height( getScalar( height ) );
3553
3554			wrap.width( getScalar( width + wPadding ) );
3555
3556			width_  = wrap.width();
3557			height_ = wrap.height();
3558
3559			canShrink = (width_ > maxWidth_ || height_ > maxHeight_) && width > minWidth && height > minHeight;
3560			canExpand = current.aspectRatio ? (width < origMaxWidth && height < origMaxHeight && width < origWidth && height < origHeight) : ((width < origMaxWidth || height < origMaxHeight) && (width < origWidth || height < origHeight));
3561
3562			$.extend(current, {
3563				dim : {
3564					width	: getValue( width_ ),
3565					height	: getValue( height_ )
3566				},
3567				origWidth  : origWidth,
3568				origHeight : origHeight,
3569				canShrink  : canShrink,
3570				canExpand  : canExpand,
3571				wPadding   : wPadding,
3572				hPadding   : hPadding,
3573				wrapSpace  : height_ - skin.outerHeight(true),
3574				skinSpace  : skin.height() - height
3575			});
3576
3577			if (!iframe && current.autoHeight && height > minHeight && height < maxHeight && !canExpand) {
3578				inner.height('auto');
3579			}
3580		},
3581
3582		_getPosition: function (onlyAbsolute) {
3583			var current  = F.current,
3584				viewport = F.getViewport(),
3585				margin   = current.margin,
3586				width    = F.wrap.width()  + margin[1] + margin[3],
3587				height   = F.wrap.height() + margin[0] + margin[2],
3588				rez      = {
3589					position: 'absolute',
3590					top  : margin[0],
3591					left : margin[3]
3592				};
3593
3594			if (current.autoCenter && current.fixed && !onlyAbsolute && height <= viewport.h && width <= viewport.w) {
3595				rez.position = 'fixed';
3596
3597			} else if (!current.locked) {
3598				rez.top  += viewport.y;
3599				rez.left += viewport.x;
3600			}
3601
3602			rez.top  = getValue(Math.max(rez.top,  rez.top  + ((viewport.h - height) * current.topRatio)));
3603			rez.left = getValue(Math.max(rez.left, rez.left + ((viewport.w - width)  * current.leftRatio)));
3604
3605			return rez;
3606		},
3607
3608		_afterZoomIn: function () {
3609			var current = F.current;
3610
3611			if (!current) {
3612				return;
3613			}
3614
3615			F.isOpen = F.isOpened = true;
3616
3617			F.wrap.addClass('fancybox-opened').css('overflow', 'visible');
3618
3619			F.reposition();
3620
3621			// Assign a click event
3622			if (current.closeClick || current.nextClick) {
3623				F.inner.css('cursor', 'pointer').bind('click.fb', function(e) {
3624					if (!$(e.target).is('a') && !$(e.target).parent().is('a')) {
3625						F[ current.closeClick ? 'close' : 'next' ]();
3626					}
3627				});
3628			}
3629
3630			// Create a close button
3631			if (current.closeBtn) {
3632				$(current.tpl.closeBtn).appendTo(F.skin).bind('click.fb', F.close);
3633			}
3634
3635			// Create navigation arrows
3636			if (current.arrows && F.group.length > 1) {
3637				if (current.loop || current.index > 0) {
3638					$(current.tpl.prev).appendTo(F.outer).bind('click.fb', F.prev);
3639				}
3640
3641				if (current.loop || current.index < F.group.length - 1) {
3642					$(current.tpl.next).appendTo(F.outer).bind('click.fb', F.next);
3643				}
3644			}
3645
3646			F.trigger('afterShow');
3647
3648			// Stop the slideshow if this is the last item
3649			if (!current.loop && current.index === current.group.length - 1) {
3650				F.play( false );
3651
3652			} else if (F.opts.autoPlay && !F.player.isActive) {
3653				F.opts.autoPlay = false;
3654
3655				F.play();
3656			}
3657		},
3658
3659		_afterZoomOut: function () {
3660			var current = F.current;
3661
3662			$('.fancybox-wrap').stop(true).trigger('onReset').remove();
3663
3664			$.extend(F, {
3665				group  : {},
3666				opts   : {},
3667				router : false,
3668				current   : null,
3669				isActive  : false,
3670				isOpened  : false,
3671				isOpen    : false,
3672				isClosing : false,
3673				wrap   : null,
3674				skin   : null,
3675				outer  : null,
3676				inner  : null
3677			});
3678
3679			F.trigger('afterClose', current);
3680		}
3681	});
3682
3683	/*
3684	 *	Default transitions
3685	 */
3686
3687	F.transitions = {
3688		getOrigPosition: function () {
3689			var current  = F.current,
3690				element  = current.element,
3691				orig     = current.orig,
3692				pos      = {},
3693				width    = 50,
3694				height   = 50,
3695				hPadding = current.hPadding,
3696				wPadding = current.wPadding,
3697				viewport = F.getViewport();
3698
3699			if (!orig && current.isDom && element.is(':visible')) {
3700				orig = element.find('img:first');
3701
3702				if (!orig.length) {
3703					orig = element;
3704				}
3705			}
3706
3707			if (isQuery(orig)) {
3708				pos = orig.offset();
3709
3710				if (orig.is('img')) {
3711					width  = orig.outerWidth();
3712					height = orig.outerHeight();
3713				}
3714
3715			} else {
3716				pos.top  = viewport.y + (viewport.h - height) * current.topRatio;
3717				pos.left = viewport.x + (viewport.w - width)  * current.leftRatio;
3718			}
3719
3720			if (current.locked) {
3721				pos.top  -= viewport.y;
3722				pos.left -= viewport.x;
3723			}
3724
3725			pos = {
3726				top     : getValue(pos.top  - hPadding * current.topRatio),
3727				left    : getValue(pos.left - wPadding * current.leftRatio),
3728				width   : getValue(width  + wPadding),
3729				height  : getValue(height + hPadding)
3730			};
3731
3732			return pos;
3733		},
3734
3735		step: function (now, fx) {
3736			var ratio,
3737				padding,
3738				value,
3739				prop       = fx.prop,
3740				current    = F.current,
3741				wrapSpace  = current.wrapSpace,
3742				skinSpace  = current.skinSpace;
3743
3744			if (prop === 'width' || prop === 'height') {
3745				ratio = fx.end === fx.start ? 1 : (now - fx.start) / (fx.end - fx.start);
3746
3747				if (F.isClosing) {
3748					ratio = 1 - ratio;
3749				}
3750
3751				padding = prop === 'width' ? current.wPadding : current.hPadding;
3752				value   = now - padding;
3753
3754				F.skin[ prop ](  getScalar( prop === 'width' ?  value : value - (wrapSpace * ratio) ) );
3755				F.inner[ prop ]( getScalar( prop === 'width' ?  value : value - (wrapSpace * ratio) - (skinSpace * ratio) ) );
3756			}
3757		},
3758
3759		zoomIn: function () {
3760			var current  = F.current,
3761				startPos = current.pos,
3762				effect   = current.openEffect,
3763				elastic  = effect === 'elastic',
3764				endPos   = $.extend({opacity : 1}, startPos);
3765
3766			// Remove "position" property that breaks older IE
3767			delete endPos.position;
3768
3769			if (elastic) {
3770				startPos = this.getOrigPosition();
3771
3772				if (current.openOpacity) {
3773					startPos.opacity = 0.1;
3774				}
3775
3776			} else if (effect === 'fade') {
3777				startPos.opacity = 0.1;
3778			}
3779
3780			F.wrap.css(startPos).animate(endPos, {
3781				duration : effect === 'none' ? 0 : current.openSpeed,
3782				easing   : current.openEasing,
3783				step     : elastic ? this.step : null,
3784				complete : F._afterZoomIn
3785			});
3786		},
3787
3788		zoomOut: function () {
3789			var current  = F.current,
3790				effect   = current.closeEffect,
3791				elastic  = effect === 'elastic',
3792				endPos   = {opacity : 0.1};
3793
3794			if (elastic) {
3795				endPos = this.getOrigPosition();
3796
3797				if (current.closeOpacity) {
3798					endPos.opacity = 0.1;
3799				}
3800			}
3801
3802			F.wrap.animate(endPos, {
3803				duration : effect === 'none' ? 0 : current.closeSpeed,
3804				easing   : current.closeEasing,
3805				step     : elastic ? this.step : null,
3806				complete : F._afterZoomOut
3807			});
3808		},
3809
3810		changeIn: function () {
3811			var current   = F.current,
3812				effect    = current.nextEffect,
3813				startPos  = current.pos,
3814				endPos    = { opacity : 1 },
3815				direction = F.direction,
3816				distance  = 200,
3817				field;
3818
3819			startPos.opacity = 0.1;
3820
3821			if (effect === 'elastic') {
3822				field = direction === 'down' || direction === 'up' ? 'top' : 'left';
3823
3824				if (direction === 'down' || direction === 'right') {
3825					startPos[ field ] = getValue(getScalar(startPos[ field ]) - distance);
3826					endPos[ field ]   = '+=' + distance + 'px';
3827
3828				} else {
3829					startPos[ field ] = getValue(getScalar(startPos[ field ]) + distance);
3830					endPos[ field ]   = '-=' + distance + 'px';
3831				}
3832			}
3833
3834			// Workaround for http://bugs.jquery.com/ticket/12273
3835			if (effect === 'none') {
3836				F._afterZoomIn();
3837
3838			} else {
3839				F.wrap.css(startPos).animate(endPos, {
3840					duration : current.nextSpeed,
3841					easing   : current.nextEasing,
3842					complete : F._afterZoomIn
3843				});
3844			}
3845		},
3846
3847		changeOut: function () {
3848			var previous  = F.previous,
3849				effect    = previous.prevEffect,
3850				endPos    = { opacity : 0.1 },
3851				direction = F.direction,
3852				distance  = 200;
3853
3854			if (effect === 'elastic') {
3855				endPos[ direction === 'down' || direction === 'up' ? 'top' : 'left' ] = ( direction === 'up' || direction === 'left' ? '-' : '+' ) + '=' + distance + 'px';
3856			}
3857
3858			previous.wrap.animate(endPos, {
3859				duration : effect === 'none' ? 0 : previous.prevSpeed,
3860				easing   : previous.prevEasing,
3861				complete : function () {
3862					$(this).trigger('onReset').remove();
3863				}
3864			});
3865		}
3866	};
3867
3868	/*
3869	 *	Overlay helper
3870	 */
3871
3872	F.helpers.overlay = {
3873		overlay: null,
3874
3875		update: function () {
3876			var width = '100%', offsetWidth;
3877
3878			// Reset width/height so it will not mess
3879			this.overlay.width(width).height('100%');
3880
3881			// jQuery does not return reliable result for IE
3882			if ($.browser.msie) {
3883				offsetWidth = Math.max(document.documentElement.offsetWidth, document.body.offsetWidth);
3884
3885				if (D.width() > offsetWidth) {
3886					width = D.width();
3887				}
3888
3889			} else if (D.width() > W.width()) {
3890				width = D.width();
3891			}
3892
3893			this.overlay.width(width).height(D.height());
3894		},
3895
3896		// This is where we can manipulate DOM, because later it would cause iframes to reload
3897		onReady: function (opts, obj) {
3898			$('.fancybox-overlay').stop(true, true);
3899
3900			if (!this.overlay) {
3901				$.extend(this, {
3902					overlay : $('<div class="fancybox-overlay"></div>').appendTo( obj.parent ),
3903					margin  : D.height() > W.height() || $('body').css('overflow-y') === 'scroll' ? $('body').css('margin-right') : false,
3904					el : document.all && !document.querySelector ? $('html') : $('body')
3905				});
3906			}
3907
3908			if (obj.fixed && !isTouch) {
3909				this.overlay.addClass('fancybox-overlay-fixed');
3910
3911				if (obj.autoCenter) {
3912					this.overlay.append( obj.wrap );
3913
3914					obj.locked = this.overlay;
3915				}
3916			}
3917
3918			if (opts.showEarly === true) {
3919				this.beforeShow.apply(this, arguments);
3920			}
3921		},
3922
3923		beforeShow : function(opts, obj) {
3924			var overlay = this.overlay.unbind('.fb').width('auto').height('auto').css( opts.css );
3925
3926			if (opts.closeClick) {
3927				overlay.bind('click.fb', function(e) {
3928					if ($(e.target).hasClass('fancybox-overlay')) {
3929						F.close();
3930					}
3931				});
3932			}
3933
3934			if (obj.fixed && !isTouch) {
3935				if (obj.locked) {
3936					this.el.addClass('fancybox-lock');
3937
3938					if (this.margin !== false) {
3939						$('body').css('margin-right', getScalar( this.margin ) + obj.scrollbarWidth);
3940					}
3941				}
3942
3943			} else {
3944				this.update();
3945			}
3946
3947			overlay.show();
3948		},
3949
3950		onUpdate : function(opts, obj) {
3951			if (!obj.fixed || isTouch) {
3952				this.update();
3953			}
3954		},
3955
3956		afterClose: function (opts) {
3957			var that  = this,
3958				speed = opts.speedOut || 0;
3959
3960			// Remove overlay if exists and fancyBox is not opening
3961			// (e.g., it is not being open using afterClose callback)
3962			if (that.overlay && !F.isActive) {
3963				that.overlay.fadeOut(speed || 0, function () {
3964					$('body').css('margin-right', that.margin);
3965
3966					that.el.removeClass('fancybox-lock');
3967
3968					that.overlay.remove();
3969
3970					that.overlay = null;
3971				});
3972			}
3973		}
3974	};
3975
3976	/*
3977	 *	Title helper
3978	 */
3979
3980	F.helpers.title = {
3981		beforeShow: function (opts) {
3982			var text = F.current.title,
3983				type = opts.type,
3984				title,
3985				target;
3986
3987			if (!isString(text) || $.trim(text) === '') {
3988				return;
3989			}
3990
3991			title = $('<div class="fancybox-title fancybox-title-' + type + '-wrap">' + text + '</div>');
3992
3993			switch (type) {
3994				case 'inside':
3995					target = F.skin;
3996				break;
3997
3998				case 'outside':
3999					target = F.wrap;
4000				break;
4001
4002				case 'over':
4003					target = F.inner;
4004				break;
4005
4006				default: // 'float'
4007					target = F.skin;
4008
4009					title
4010						.appendTo('body')
4011						.width(title.width()) //This helps for some browsers
4012						.wrapInner('<span class="child"></span>');
4013
4014						//Increase bottom margin so this title will also fit into viewport
4015						F.current.margin[2] += Math.abs( getScalar(title.css('margin-bottom')) );
4016				break;
4017			}
4018
4019			if (opts.position === 'top') {
4020				title.prependTo(target);
4021
4022			} else {
4023				title.appendTo(target);
4024			}
4025		}
4026	};
4027
4028	// jQuery plugin initialization
4029	$.fn.fancybox = function (options) {
4030		var index,
4031			that     = $(this),
4032			selector = this.selector || '',
4033			run      = function(e) {
4034				var what = $(this).blur(), idx = index, relType, relVal;
4035
4036				if (!(e.ctrlKey || e.altKey || e.shiftKey || e.metaKey) && !what.is('.fancybox-wrap')) {
4037					relType = options.groupAttr || 'data-fancybox-group';
4038					relVal  = what.attr(relType);
4039
4040					if (!relVal) {
4041						relType = 'rel';
4042						relVal  = what.get(0)[ relType ];
4043					}
4044
4045					if (relVal && relVal !== '' && relVal !== 'nofollow') {
4046						what = selector.length ? $(selector) : that;
4047						what = what.filter('[' + relType + '="' + relVal + '"]');
4048						idx  = what.index(this);
4049					}
4050
4051					options.index = idx;
4052
4053					// Stop an event from bubbling if everything is fine
4054					if (F.open(what, options) !== false) {
4055						e.preventDefault();
4056					}
4057				}
4058			};
4059
4060		options = options || {};
4061		index   = options.index || 0;
4062
4063		if (!selector || options.live === false) {
4064			that.unbind('click.fb-start').bind('click.fb-start', run);
4065		} else {
4066			D.undelegate(selector, 'click.fb-start').delegate(selector + ":not('.fancybox-item, .fancybox-nav')", 'click.fb-start', run);
4067		}
4068
4069		return this;
4070	};
4071
4072	// Tests that need a body at doc ready
4073	D.ready(function() {
4074		if ( $.scrollbarWidth === undefined ) {
4075			// http://benalman.com/projects/jquery-misc-plugins/#scrollbarwidth
4076			$.scrollbarWidth = function() {
4077				var parent = $('<div style="width:50px;height:50px;overflow:auto"><div/></div>').appendTo('body'),
4078					child  = parent.children(),
4079					width  = child.innerWidth() - child.height( 99 ).innerWidth();
4080
4081				parent.remove();
4082
4083				return width;
4084			};
4085		}
4086
4087		if ( $.support.fixedPosition === undefined ) {
4088			$.support.fixedPosition = (function() {
4089				var elem  = $('<div style="position:fixed;top:20px;"></div>').appendTo('body'),
4090					fixed = ( elem[0].offsetTop === 20 || elem[0].offsetTop === 15 );
4091
4092				elem.remove();
4093
4094				return fixed;
4095			}());
4096		}
4097
4098		$.extend(F.defaults, {
4099			scrollbarWidth : $.scrollbarWidth(),
4100			fixed  : $.support.fixedPosition,
4101			parent : $('body')
4102		});
4103	});
4104
4105}(window, document, jQuery));
4106/* End */
4107;
4108; /* Start:"a:4:{s:4:"full";s:67:"/local/templates/aspro_next/js/jquery.flexslider.js?172597044156312";s:6:"source";s:51:"/local/templates/aspro_next/js/jquery.flexslider.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
4109/*
4110 * jQuery FlexSlider v2.6.3
4111 * Copyright 2012 WooThemes
4112 * Contributing Author: Tyler Smith
4113 */
4114;
4115(function ($) {
4116
4117  var focused = true;
4118
4119  //FlexSlider: Object Instance
4120  $.flexslider = function(el, options) {
4121    var slider = $(el);
4122
4123    // making variables public
4124    slider.vars = $.extend({}, $.flexslider.defaults, options);
4125
4126    var namespace = slider.vars.namespace,
4127        msGesture = window.navigator && window.navigator.msPointerEnabled && window.MSGesture,
4128        touch = (( "ontouchstart" in window ) || msGesture || window.DocumentTouch && document instanceof DocumentTouch) && slider.vars.touch,
4129        // depricating this idea, as devices are being released with both of these events
4130        eventType = "click touchend MSPointerUp keyup",
4131        watchedEvent = "",
4132        watchedEventClearTimer,
4133        vertical = slider.vars.direction === "vertical",
4134        reverse = slider.vars.reverse,
4135        carousel = (slider.vars.itemWidth > 0),
4136        fade = slider.vars.animation === "fade",
4137        asNav = slider.vars.asNavFor !== "",
4138        methods = {};
4139
4140    // Store a reference to the slider object
4141    $.data(el, "flexslider", slider);
4142
4143    // Private slider methods
4144    methods = {
4145      init: function() {
4146        slider.animating = false;
4147        // Get current slide and make sure it is a number
4148        slider.currentSlide = parseInt( ( slider.vars.startAt ? slider.vars.startAt : 0), 10 );
4149        if ( isNaN( slider.currentSlide ) ) { slider.currentSlide = 0; }
4150        slider.animatingTo = slider.currentSlide;
4151        slider.atEnd = (slider.currentSlide === 0 || slider.currentSlide === slider.last);
4152        slider.containerSelector = slider.vars.selector.substr(0,slider.vars.selector.search(' '));
4153        slider.slides = $(slider.vars.selector, slider);
4154        slider.container = $(slider.containerSelector, slider);
4155        slider.count = slider.slides.length;
4156        // SYNC:
4157        slider.syncExists = $(slider.vars.sync).length > 0;
4158        // SLIDE:
4159        if (slider.vars.animation === "slide") { slider.vars.animation = "swing"; }
4160        slider.prop = (vertical) ? "top" : "marginLeft";
4161        slider.args = {};
4162        // SLIDESHOW:
4163        slider.manualPause = false;
4164        slider.stopped = false;
4165        //PAUSE WHEN INVISIBLE
4166        slider.started = false;
4167        slider.startTimeout = null;
4168        // TOUCH/USECSS:
4169        slider.transitions = !slider.vars.video && !fade && slider.vars.useCSS && (function() {
4170          var obj = document.createElement('div'),
4171              props = ['perspectiveProperty', 'WebkitPerspective', 'MozPerspective', 'OPerspective', 'msPerspective'];
4172          for (var i in props) {
4173            if ( obj.style[ props[i] ] !== undefined ) {
4174              slider.pfx = props[i].replace('Perspective','').toLowerCase();
4175              slider.prop = "-" + slider.pfx + "-transform";
4176              return true;
4177            }
4178          }
4179          return false;
4180        }());
4181        slider.ensureAnimationEnd = '';
4182        // CONTROLSCONTAINER:
vendor: 5,736 bytes, lines 4183-4311
4183        if (slider.vars.controlsContainer !== "") slider.controlsContainer = $(slider.vars.controlsContainer).length > 0 && $(slider.vars.controlsContainer);
4184        // MANUAL:
4185        if (slider.vars.manualControls !== "") slider.manualControls = $(slider.vars.manualControls).length > 0 && $(slider.vars.manualControls);
4186
4187        // CUSTOM DIRECTION NAV:
4188        if (slider.vars.customDirectionNav !== "") slider.customDirectionNav = $(slider.vars.customDirectionNav).length === 2 && $(slider.vars.customDirectionNav);
4189
4190        // RANDOMIZE:
4191        if (slider.vars.randomize) {
4192          slider.slides.sort(function() { return (Math.round(Math.random())-0.5); });
4193          slider.container.empty().append(slider.slides);
4194        }
4195
4196        slider.doMath();
4197
4198        // INIT
4199        slider.setup("init");
4200
4201        // CONTROLNAV:
4202        if (slider.vars.controlNav) { methods.controlNav.setup(); }
4203
4204        // DIRECTIONNAV:
4205        if (slider.vars.directionNav) { methods.directionNav.setup(); }
4206
4207        // KEYBOARD:
4208        if (slider.vars.keyboard && ($(slider.containerSelector).length === 1 || slider.vars.multipleKeyboard)) {
4209          $(document).bind('keyup', function(event) {
4210            var keycode = event.keyCode;
4211            if (!slider.animating && (keycode === 39 || keycode === 37)) {
4212              var target = (keycode === 39) ? slider.getTarget('next') :
4213                           (keycode === 37) ? slider.getTarget('prev') : false;
4214              slider.flexAnimate(target, slider.vars.pauseOnAction);
4215            }
4216          });
4217        }
4218        // MOUSEWHEEL:
4219        if (slider.vars.mousewheel) {
4220          slider.bind('mousewheel', function(event, delta, deltaX, deltaY) {
4221            event.preventDefault();
4222            var target = (delta < 0) ? slider.getTarget('next') : slider.getTarget('prev');
4223            slider.flexAnimate(target, slider.vars.pauseOnAction);
4224          });
4225        }
4226
4227        // PAUSEPLAY
4228        if (slider.vars.pausePlay) { methods.pausePlay.setup(); }
4229
4230        //PAUSE WHEN INVISIBLE
4231        if (slider.vars.slideshow && slider.vars.pauseInvisible) { methods.pauseInvisible.init(); }
4232
4233        // SLIDSESHOW
4234        if (slider.vars.slideshow) {
4235          if (slider.vars.pauseOnHover) {
4236            slider.hover(function() {
4237              if (!slider.manualPlay && !slider.manualPause) { slider.pause(); }
4238            }, function() {
4239              if (!slider.manualPause && !slider.manualPlay && !slider.stopped) { slider.play(); }
4240            });
4241          }
4242          // initialize animation
4243          //If we're visible, or we don't use PageVisibility API
4244          if(!slider.vars.pauseInvisible || !methods.pauseInvisible.isHidden()) {
4245            (slider.vars.initDelay > 0) ? slider.startTimeout = setTimeout(slider.play, slider.vars.initDelay) : slider.play();
4246          }
4247        }
4248
4249        // ASNAV:
4250        if (asNav) { methods.asNav.setup(); }
4251
4252        // TOUCH
4253        if (touch && slider.vars.touch) { methods.touch(); }
4254
4255        // FADE&&SMOOTHHEIGHT || SLIDE:
4256        if (!fade || (fade && slider.vars.smoothHeight)) { $(window).bind("resize orientationchange", methods.resize); }
4257
4258        slider.find("img").attr("draggable", "false");
4259
4260        // API: start() Callback
4261        setTimeout(function(){
4262          slider.vars.start(slider);
4263        }, 200);
4264      },
4265      asNav: {
4266        setup: function() {
4267          slider.asNav = true;
4268          slider.animatingTo = Math.floor(slider.currentSlide/slider.move);
4269          slider.currentItem = slider.currentSlide;
4270          slider.slides.removeClass(namespace + "active-slide").eq(slider.currentItem).addClass(namespace + "active-slide");
4271          if(!msGesture){
4272              slider.slides.on(eventType, function(e){
4273                e.preventDefault();
4274                var $slide = $(this),
4275                    target = $slide.index();
4276                var posFromLeft = $slide.offset().left - $(slider).scrollLeft(); // Find position of slide relative to left of slider container
4277                if( posFromLeft <= 0 && $slide.hasClass( namespace + 'active-slide' ) ) {
4278                  slider.flexAnimate(slider.getTarget("prev"), true);
4279                } else if (!$(slider.vars.asNavFor).data('flexslider').animating && !$slide.hasClass(namespace + "active-slide")) {
4280                  slider.direction = (slider.currentItem < target) ? "next" : "prev";
4281                  slider.flexAnimate(target, slider.vars.pauseOnAction, false, true, true);
4282                }
4283              });
4284          }else{
4285              el._slider = slider;
4286              slider.slides.each(function (){
4287                  var that = this;
4288                  that._gesture = new MSGesture();
4289                  that._gesture.target = that;
4290                  that.addEventListener("MSPointerDown", function (e){
4291                      e.preventDefault();
4292                      if(e.currentTarget._gesture) {
4293                        e.currentTarget._gesture.addPointer(e.pointerId);
4294                      }
4295                  }, false);
4296                  that.addEventListener("MSGestureTap", function (e){
4297                      e.preventDefault();
4298                      var $slide = $(this),
4299                          target = $slide.index();
4300                      if (!$(slider.vars.asNavFor).data('flexslider').animating && !$slide.hasClass('active')) {
4301                          slider.direction = (slider.currentItem < target) ? "next" : "prev";
4302                          slider.flexAnimate(target, slider.vars.pauseOnAction, false, true, true);
4303                      }
4304                  });
4305              });
4306          }
4307        }
4308      },
4309      controlNav: {
4310        setup: function() {
4311          if (!slider.manualControls) {
4312            methods.controlNav.setupPaging();
4313          } else { // MANUALCONTROLS:
4314            methods.controlNav.setupManual();
4315          }
4316        },
4317        setupPaging: function() {
4318          var type = (slider.vars.controlNav === "thumbnails") ? 'control-thumbs' : 'control-paging',
4319              j = 1,
4320              item,
4321              slide;
4322
4323          slider.controlNavScaffold = $('<ol class="'+ namespace + 'control-nav ' + namespace + type + '"></ol>');
4324
4325          if (slider.pagingCount > 1) {
4326            for (var i = 0; i < slider.pagingCount; i++) {
4327              slide = slider.slides.eq(i);
4328              if ( undefined === slide.attr( 'data-thumb-alt' ) ) { slide.attr( 'data-thumb-alt', '' ); }
4329              var altText = ( '' !== slide.attr( 'data-thumb-alt' ) ) ? altText = ' alt="' + slide.attr( 'data-thumb-alt' ) + '"' : '';
4330              item = (slider.vars.controlNav === "thumbnails") ? '<img src="' + slide.attr( 'data-thumb' ) + '"' + altText + '/>' : '<a href="#">' + j + '</a>';
4331              if ( 'thumbnails' === slider.vars.controlNav && true === slider.vars.thumbCaptions ) {
4332                var captn = slide.attr( 'data-thumbcaption' );
4333                if ( '' !== captn && undefined !== captn ) { item += '<span class="' + namespace + 'caption">' + captn + '</span>'; }
4334              }
4335              slider.controlNavScaffold.append('<li>' + item + '</li>');
4336              j++;
4337            }
4338          }
4339
4340          // CONTROLSCONTAINER:
4341          (slider.controlsContainer) ? $(slider.controlsContainer).append(slider.controlNavScaffold) : slider.append(slider.controlNavScaffold);
4342          methods.controlNav.set();
4343
4344          methods.controlNav.active();
4345
4346          slider.controlNavScaffold.delegate('a, img', eventType, function(event) {
4347            event.preventDefault();
4348
4349            if (watchedEvent === "" || watchedEvent === event.type) {
4350              var $this = $(this),
4351                  target = slider.controlNav.index($this);
4352
4353              if (!$this.hasClass(namespace + 'active')) {
4354                slider.direction = (target > slider.currentSlide) ? "next" : "prev";
4355                slider.flexAnimate(target, slider.vars.pauseOnAction);
4356              }
4357            }
4358
4359            // setup flags to prevent event duplication
4360            if (watchedEvent === "") {
4361              watchedEvent = event.type;
4362            }
4363            methods.setToClearWatchedEvent();
4364
4365          });
4366        },
4367        setupManual: function() {
4368          slider.controlNav = slider.manualControls;
4369          methods.controlNav.active();
4370
4371          slider.controlNav.bind(eventType, function(event) {
4372            event.preventDefault();
4373
4374            if (watchedEvent === "" || watchedEvent === event.type) {
4375              var $this = $(this),
4376                  target = slider.controlNav.index($this);
4377
4378              if (!$this.hasClass(namespace + 'active')) {
4379                (target > slider.currentSlide) ? slider.direction = "next" : slider.direction = "prev";
4380                slider.flexAnimate(target, slider.vars.pauseOnAction);
4381              }
4382            }
4383
4384            // setup flags to prevent event duplication
4385            if (watchedEvent === "") {
4386              watchedEvent = event.type;
4387            }
4388            methods.setToClearWatchedEvent();
4389          });
4390        },
4391        set: function() {
4392          var selector = (slider.vars.controlNav === "thumbnails") ? 'img' : 'a';
4393          slider.controlNav = $('.' + namespace + 'control-nav li ' + selector, (slider.controlsContainer) ? slider.controlsContainer : slider);
4394        },
4395        active: function() {
4396          slider.controlNav.removeClass(namespace + "active").eq(slider.animatingTo).addClass(namespace + "active");
4397        },
4398        update: function(action, pos) {
4399          if (slider.pagingCount > 1 && action === "add") {
4400            slider.controlNavScaffold.append($('<li><a href="#">' + slider.count + '</a></li>'));
4401          } else if (slider.pagingCount === 1) {
4402            slider.controlNavScaffold.find('li').remove();
4403          } else {
4404            slider.controlNav.eq(pos).closest('li').remove();
4405          }
4406          methods.controlNav.set();
4407          (slider.pagingCount > 1 && slider.pagingCount !== slider.controlNav.length) ? slider.update(pos, action) : methods.controlNav.active();
4408        }
4409      },
4410      directionNav: {
4411        setup: function() {
4412          var directionNavScaffold = $('<ul class="' + namespace + 'direction-nav"><li class="' + namespace + 'nav-prev"><a class="' + namespace + 'prev" href="#">
vendor: 15,212 bytes, lines 4412-4763
4412' + slider.vars.prevText + '</a></li><li class="' + namespace + 'nav-next"><a class="' + namespace + 'next" href="#">' + slider.vars.nextText + '</a></li></ul>');
4413
4414          // CUSTOM DIRECTION NAV:
4415          if (slider.customDirectionNav) {
4416            slider.directionNav = slider.customDirectionNav;
4417          // CONTROLSCONTAINER:
4418          } else if (slider.controlsContainer) {
4419            $(slider.controlsContainer).append(directionNavScaffold);
4420            slider.directionNav = $('.' + namespace + 'direction-nav li a', slider.controlsContainer);
4421          } else {
4422            slider.append(directionNavScaffold);
4423            slider.directionNav = $('.' + namespace + 'direction-nav li a', slider);
4424          }
4425
4426          methods.directionNav.update();
4427
4428          slider.directionNav.bind(eventType, function(event) {
4429            event.preventDefault();
4430            var target;
4431
4432            if (watchedEvent === "" || watchedEvent === event.type) {
4433              target = ($(this).hasClass(namespace + 'next')) ? slider.getTarget('next') : slider.getTarget('prev');
4434              slider.flexAnimate(target, slider.vars.pauseOnAction);
4435            }
4436
4437            // setup flags to prevent event duplication
4438            if (watchedEvent === "") {
4439              watchedEvent = event.type;
4440            }
4441            methods.setToClearWatchedEvent();
4442          });
4443        },
4444        update: function() {
4445          var disabledClass = namespace + 'disabled';
4446          if (slider.pagingCount === 1 || slider.pagingCount < 1) {
4447            slider.directionNav.addClass(disabledClass).attr('tabindex', '-1');
4448            slider.directionNav.parent().addClass(disabledClass);
4449          } else if (!slider.vars.animationLoop) {
4450            if (slider.animatingTo === 0) {
4451              slider.directionNav.removeClass(disabledClass).filter('.' + namespace + "prev").addClass(disabledClass).attr('tabindex', '-1');
4452        slider.directionNav.parent().removeClass(disabledClass);
4453        slider.directionNav.filter('.' + namespace + "prev").parent().addClass(disabledClass);
4454            } else if (slider.animatingTo === slider.last) {
4455              slider.directionNav.removeClass(disabledClass).filter('.' + namespace + "next").addClass(disabledClass).attr('tabindex', '-1');
4456        slider.directionNav.parent().removeClass(disabledClass);
4457        slider.directionNav.filter('.' + namespace + "next").parent().addClass(disabledClass);
4458            } else {
4459              slider.directionNav.removeClass(disabledClass).removeAttr('tabindex');
4460        slider.directionNav.parent().removeClass(disabledClass);
4461            }
4462          } else {
4463            slider.directionNav.removeClass(disabledClass).removeAttr('tabindex');
4464      slider.directionNav.parent().removeClass(disabledClass);
4465          }
4466        }
4467      },
4468      pausePlay: {
4469        setup: function() {
4470          var pausePlayScaffold = $('<div class="' + namespace + 'pauseplay"><a href="#"></a></div>');
4471
4472          // CONTROLSCONTAINER:
4473          if (slider.controlsContainer) {
4474            slider.controlsContainer.append(pausePlayScaffold);
4475            slider.pausePlay = $('.' + namespace + 'pauseplay a', slider.controlsContainer);
4476          } else {
4477            slider.append(pausePlayScaffold);
4478            slider.pausePlay = $('.' + namespace + 'pauseplay a', slider);
4479          }
4480
4481          methods.pausePlay.update((slider.vars.slideshow) ? namespace + 'pause' : namespace + 'play');
4482
4483          slider.pausePlay.bind(eventType, function(event) {
4484            event.preventDefault();
4485
4486            if (watchedEvent === "" || watchedEvent === event.type) {
4487              if ($(this).hasClass(namespace + 'pause')) {
4488                slider.manualPause = true;
4489                slider.manualPlay = false;
4490                slider.pause();
4491              } else {
4492                slider.manualPause = false;
4493                slider.manualPlay = true;
4494                slider.play();
4495              }
4496            }
4497
4498            // setup flags to prevent event duplication
4499            if (watchedEvent === "") {
4500              watchedEvent = event.type;
4501            }
4502            methods.setToClearWatchedEvent();
4503          });
4504        },
4505        update: function(state) {
4506          (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);
4507        }
4508      },
4509      touch: function() {
4510        var startX,
4511          startY,
4512          offset,
4513          cwidth,
4514          dx,
4515          startT,
4516          onTouchStart,
4517          onTouchMove,
4518          onTouchEnd,
4519          scrolling = false,
4520          localX = 0,
4521          localY = 0,
4522          accDx = 0;
4523
4524        if(!msGesture){
4525            onTouchStart = function(e) {
4526              if (slider.animating) {
4527                e.preventDefault();
4528              } else if ( ( window.navigator.msPointerEnabled ) || e.touches.length === 1 ) {
4529                slider.pause();
4530                // CAROUSEL:
4531                cwidth = (vertical) ? slider.h : slider. w;
4532                startT = Number(new Date());
4533                // CAROUSEL:
4534
4535                // Local vars for X and Y points.
4536                localX = e.touches[0].pageX;
4537                localY = e.touches[0].pageY;
4538
4539                offset = (carousel && reverse && slider.animatingTo === slider.last) ? 0 :
4540                         (carousel && reverse) ? slider.limit - (((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.animatingTo) :
4541                         (carousel && slider.currentSlide === slider.last) ? slider.limit :
4542                         (carousel) ? ((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.currentSlide :
4543                         (reverse) ? (slider.last - slider.currentSlide + slider.cloneOffset) * cwidth : (slider.currentSlide + slider.cloneOffset) * cwidth;
4544                startX = (vertical) ? localY : localX;
4545                startY = (vertical) ? localX : localY;
4546
4547                el.addEventListener('touchmove', onTouchMove, false);
4548                el.addEventListener('touchend', onTouchEnd, false);
4549              }
4550            };
4551
4552            onTouchMove = function(e) {
4553              // Local vars for X and Y points.
4554
4555              localX = e.touches[0].pageX;
4556              localY = e.touches[0].pageY;
4557
4558              dx = (vertical) ? startX - localY : startX - localX;
4559              scrolling = (vertical) ? (Math.abs(dx) < Math.abs(localX - startY)) : (Math.abs(dx) < Math.abs(localY - startY));
4560
4561              var fxms = 500;
4562
4563              if ( ! scrolling || Number( new Date() ) - startT > fxms ) {
4564                e.preventDefault();
4565                if (!fade && slider.transitions) {
4566                  if (!slider.vars.animationLoop) {
4567                    dx = dx/((slider.currentSlide === 0 && dx < 0 || slider.currentSlide === slider.last && dx > 0) ? (Math.abs(dx)/cwidth+2) : 1);
4568                  }
4569                  slider.setProps(offset + dx, "setTouch");
4570                }
4571              }
4572            };
4573
4574            onTouchEnd = function(e) {
4575              // finish the touch by undoing the touch session
4576              el.removeEventListener('touchmove', onTouchMove, false);
4577
4578              if (slider.animatingTo === slider.currentSlide && !scrolling && !(dx === null)) {
4579                var updateDx = (reverse) ? -dx : dx,
4580                    target = (updateDx > 0) ? slider.getTarget('next') : slider.getTarget('prev');
4581
4582                if (slider.canAdvance(target) && (Number(new Date()) - startT < 550 && Math.abs(updateDx) > 50 || Math.abs(updateDx) > cwidth/2)) {
4583                  slider.flexAnimate(target, slider.vars.pauseOnAction);
4584                } else {
4585                  if (!fade) { slider.flexAnimate(slider.currentSlide, slider.vars.pauseOnAction, true); }
4586                }
4587              }
4588              el.removeEventListener('touchend', onTouchEnd, false);
4589
4590              startX = null;
4591              startY = null;
4592              dx = null;
4593              offset = null;
4594            };
4595
4596            el.addEventListener('touchstart', onTouchStart, false);
4597        }else{
4598            el.style.msTouchAction = "none";
4599            el._gesture = new MSGesture();
4600            el._gesture.target = el;
4601            el.addEventListener("MSPointerDown", onMSPointerDown, false);
4602            el._slider = slider;
4603            el.addEventListener("MSGestureChange", onMSGestureChange, false);
4604            el.addEventListener("MSGestureEnd", onMSGestureEnd, false);
4605
4606            function onMSPointerDown(e){
4607                e.stopPropagation();
4608                if (slider.animating) {
4609                    e.preventDefault();
4610                }else{
4611                    slider.pause();
4612                    el._gesture.addPointer(e.pointerId);
4613                    accDx = 0;
4614                    cwidth = (vertical) ? slider.h : slider. w;
4615                    startT = Number(new Date());
4616                    // CAROUSEL:
4617
4618                    offset = (carousel && reverse && slider.animatingTo === slider.last) ? 0 :
4619                        (carousel && reverse) ? slider.limit - (((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.animatingTo) :
4620                            (carousel && slider.currentSlide === slider.last) ? slider.limit :
4621                                (carousel) ? ((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.currentSlide :
4622                                    (reverse) ? (slider.last - slider.currentSlide + slider.cloneOffset) * cwidth : (slider.currentSlide + slider.cloneOffset) * cwidth;
4623                }
4624            }
4625
4626            function onMSGestureChange(e) {
4627                e.stopPropagation();
4628                var slider = e.target._slider;
4629                if(!slider){
4630                    return;
4631                }
4632                var transX = -e.translationX,
4633                    transY = -e.translationY;
4634
4635                //Accumulate translations.
4636                accDx = accDx + ((vertical) ? transY : transX);
4637                dx = accDx;
4638                scrolling = (vertical) ? (Math.abs(accDx) < Math.abs(-transX)) : (Math.abs(accDx) < Math.abs(-transY));
4639
4640                if(e.detail === e.MSGESTURE_FLAG_INERTIA){
4641                    setImmediate(function (){
4642                        el._gesture.stop();
4643                    });
4644
4645                    return;
4646                }
4647
4648                if (!scrolling || Number(new Date()) - startT > 500) {
4649                    e.preventDefault();
4650                    if (!fade && slider.transitions) {
4651                        if (!slider.vars.animationLoop) {
4652                            dx = accDx / ((slider.currentSlide === 0 && accDx < 0 || slider.currentSlide === slider.last && accDx > 0) ? (Math.abs(accDx) / cwidth + 2) : 1);
4653                        }
4654                        slider.setProps(offset + dx, "setTouch");
4655                    }
4656                }
4657            }
4658
4659            function onMSGestureEnd(e) {
4660                e.stopPropagation();
4661                var slider = e.target._slider;
4662                if(!slider){
4663                    return;
4664                }
4665                if (slider.animatingTo === slider.currentSlide && !scrolling && !(dx === null)) {
4666                    var updateDx = (reverse) ? -dx : dx,
4667                        target = (updateDx > 0) ? slider.getTarget('next') : slider.getTarget('prev');
4668
4669                    if (slider.canAdvance(target) && (Number(new Date()) - startT < 550 && Math.abs(updateDx) > 50 || Math.abs(updateDx) > cwidth/2)) {
4670                        slider.flexAnimate(target, slider.vars.pauseOnAction);
4671                    } else {
4672                        if (!fade) { slider.flexAnimate(slider.currentSlide, slider.vars.pauseOnAction, true); }
4673                    }
4674                }
4675
4676                startX = null;
4677                startY = null;
4678                dx = null;
4679                offset = null;
4680                accDx = 0;
4681            }
4682        }
4683      },
4684      resize: function() {
4685        if (!slider.animating && slider.is(':visible')) {
4686          if (!carousel) { slider.doMath(); }
4687
4688          if (fade) {
4689            // SMOOTH HEIGHT:
4690            methods.smoothHeight();
4691          } else if (carousel) { //CAROUSEL:
4692            slider.slides.width(slider.computedW);
4693
4694            slider.update(slider.pagingCount);
4695            // slider.setProps();
4696          }
4697          else if (vertical) { //VERTICAL:
4698            slider.viewport.height(slider.h);
4699            slider.setProps(slider.h, "setTotal");
4700          } else {
4701            // SMOOTH HEIGHT:
4702            if (slider.vars.smoothHeight) { methods.smoothHeight(); }
4703            slider.newSlides.width(slider.computedW);
4704            slider.setProps(slider.computedW, "setTotal");
4705          }
4706        }
4707      },
4708      smoothHeight: function(dur) {
4709        if (!vertical || fade) {
4710          var $obj = (fade) ? slider : slider.viewport;
4711          (dur) ? $obj.animate({"height": slider.slides.eq(slider.animatingTo).innerHeight()}, dur) : $obj.innerHeight(slider.slides.eq(slider.animatingTo).innerHeight());
4712        }
4713      },
4714      sync: function(action) {
4715        var $obj = $(slider.vars.sync).data("flexslider"),
4716            target = slider.animatingTo;
4717
4718        switch (action) {
4719          case "animate": $obj.flexAnimate(target, slider.vars.pauseOnAction, false, true); break;
4720          case "play": if (!$obj.playing && !$obj.asNav) { $obj.play(); } break;
4721          case "pause": $obj.pause(); break;
4722        }
4723      },
4724      uniqueID: function($clone) {
4725        // Append _clone to current level and children elements with id attributes
4726        $clone.filter( '[id]' ).add($clone.find( '[id]' )).each(function() {
4727          var $this = $(this);
4728          $this.attr( 'id', $this.attr( 'id' ) + '_clone' );
4729        });
4730        return $clone;
4731      },
4732      pauseInvisible: {
4733        visProp: null,
4734        init: function() {
4735          var visProp = methods.pauseInvisible.getHiddenProp();
4736          if (visProp) {
4737            var evtname = visProp.replace(/[H|h]idden/,'') + 'visibilitychange';
4738            document.addEventListener(evtname, function() {
4739              if (methods.pauseInvisible.isHidden()) {
4740                if(slider.startTimeout) {
4741                  clearTimeout(slider.startTimeout); //If clock is ticking, stop timer and prevent from starting while invisible
4742                } else {
4743                  slider.pause(); //Or just pause
4744                }
4745              }
4746              else {
4747                if(slider.started) {
4748                  slider.play(); //Initiated before, just play
4749                } else {
4750                  if (slider.vars.initDelay > 0) {
4751                    setTimeout(slider.play, slider.vars.initDelay);
4752                  } else {
4753                    slider.play(); //Didn't init before: simply init or wait for it
4754                  }
4755                }
4756              }
4757            });
4758          }
4759        },
4760        isHidden: function() {
4761          var prop = methods.pauseInvisible.getHiddenProp();
4762          if (!prop) {
4763            return false;
4764          }
4765          return document[prop];
4766        },
4767        getHiddenProp: function() {
4768          var prefixes = ['webkit','moz','ms','o'];
4769          // if 'hidden' is natively supported just return it
4770          if ('hidden' in document) {
4771            return 'hidden';
4772          }
4773          // otherwise loop over all the known prefixes until we find one
4774          for ( var i = 0; i < prefixes.length; i++ ) {
4775              if ((prefixes[i] + 'Hidden') in document) {
4776                return prefixes[i] + 'Hidden';
4777              }
4778          }
4779          // otherwise it's not supported
4780          return null;
4781        }
4782      },
4783      setToClearWatchedEvent: function() {
4784        clearTimeout(watchedEventClearTimer);
4785        watchedEventClearTimer = setTimeout(function() {
4786          watchedEvent = "";
4787        }, 3000);
4788      }
4789    };
4790
4791    // public methods
4792    slider.flexAnimate = function(target, pause, override, withSync, fromNav) {
4793      if (!slider.vars.animationLoop && target !== slider.currentSlide) {
4794        slider.direction = (target > slider.currentSlide) ? "next" : "prev";
4795      }
4796
4797      if (asNav && slider.pagingCount === 1) slider.direction = (slider.currentItem < target) ? "next" : "prev";
4798
4799      if (!slider.animating && (slider.canAdvance(target, fromNav) || override)/* && slider.is(":visible")*/) {
4800        if (asNav && withSync) {
4801          var master = $(slider.vars.asNavFor).data('flexslider');
4802          slider.atEnd = target === 0 || target === slider.count - 1;
4803          master.flexAnimate(target, true, false, true, fromNav);
4804          slider.direction = (slider.currentItem < target) ? "next" : "prev";
4805          master.direction = slider.direction;
4806
4807          // ++ added by kach
4808          slider.currentItem = target;
4809          slider.slides.removeClass(namespace + "active-slide").eq(target).addClass(namespace + "active-slide");
4810          var newtarget = Math.floor((target + 1)/slider.visible) > 0 ? (Math.floor((target + 1 - slider.visible) / slider.move)) : 0;
4811          if(newtarget != slider.currentSlide){
4812            target = newtarget;
4813          }
4814          else{
4815            return false;
4816          }
4817          // ++
4818
4819          // -- removed by kach
4820          /*
4821          if (Math.ceil((target + 1)/slider.visible) - 1 !== slider.currentSlide && target !== 0) {
4822            slider.currentItem = target;
4823            slider.slides.removeClass(namespace + "active-slide").eq(target).addClass(namespace + "active-slide");
4824            target = Math.floor(target/slider.visible);
4825          } else {
4826            slider.currentItem = target;
4827            slider.slides.removeClass(namespace + "active-slide").eq(target).addClass(namespace + "active-slide");
4828            return false;
4829          }
4830          */
4831          // --
4832        }
4833
4834        slider.animating = true;
4835        slider.animatingTo = target;
4836
4837        // SLIDESHOW:
4838        if (pause) { slider.pause(); }
4839
4840        // API: before() animation Callback
4841        slider.vars.before(slider);
4842
4843        // SYNC:
4844        if (slider.syncExists && !fromNav) { methods.sync("animate"); }
4845
4846        // CONTROLNAV
4847        if (slider.vars.controlNav) { methods.controlNav.active(); }
4848
4849        // !CAROUSEL:
4850        // CANDIDATE: slide active class (for add/remove slide)
4851        if (!carousel) { slider.slides.removeClass(namespace + 'active-slide').eq(target).addClass(namespace + 'active-slide'); }
4852
4853        // INFINITE LOOP:
4854        // CANDIDATE: atEnd
4855        slider.atEnd = target === 0 || target === slider.last;
4856
4857        // DIRECTIONNAV:
4858        if (slider.vars.directionNav) { methods.directionNav.update(); }
4859
4860        if (target === slider.last) {
4861          // API: end() of cycle Callback
4862          slider.vars.end(slider);
4863          // SLIDESHOW && !INFINITE LOOP:
4864          if (!slider.vars.animationLoop) { slider.pause(); }
4865        }
4866
4867        // SLIDE:
4868        if (!fade) {
4869          var dimension = (vertical) ? slider.slides.filter(':first').height() : slider.computedW,
4870              margin, slideString, calcNext;
4871
4872          // INFINITE LOOP / REVERSE:
4873          if (carousel) {
4874            margin = slider.vars.itemMargin;
vendor: 13,809 bytes, lines 4875-5158
4875            calcNext = ((slider.itemW + margin) * slider.move) * slider.animatingTo;
4876            slideString = (calcNext > slider.limit && slider.visible !== 1) ? slider.limit : calcNext;
4877          } else if (slider.currentSlide === 0 && target === slider.count - 1 && slider.vars.animationLoop && slider.direction !== "next") {
4878            slideString = (reverse) ? (slider.count + slider.cloneOffset) * dimension : 0;
4879          } else if (slider.currentSlide === slider.last && target === 0 && slider.vars.animationLoop && slider.direction !== "prev") {
4880            slideString = (reverse) ? 0 : (slider.count + 1) * dimension;
4881          } else {
4882            slideString = (reverse) ? ((slider.count - 1) - target + slider.cloneOffset) * dimension : (target + slider.cloneOffset) * dimension;
4883          }
4884          slider.setProps(slideString, "", slider.vars.animationSpeed);
4885          if (slider.transitions) {
4886            if (!slider.vars.animationLoop || !slider.atEnd) {
4887              slider.animating = false;
4888              slider.currentSlide = slider.animatingTo;
4889            }
4890
4891            // Unbind previous transitionEnd events and re-bind new transitionEnd event
4892            slider.container.unbind("webkitTransitionEnd transitionend");
4893            slider.container.bind("webkitTransitionEnd transitionend", function() {
4894              clearTimeout(slider.ensureAnimationEnd);
4895              slider.wrapup(dimension);
4896            });
4897
4898            // Insurance for the ever-so-fickle transitionEnd event
4899            clearTimeout(slider.ensureAnimationEnd);
4900            slider.ensureAnimationEnd = setTimeout(function() {
4901              slider.wrapup(dimension);
4902            }, slider.vars.animationSpeed + 100);
4903
4904          } else {
4905            slider.container.animate(slider.args, slider.vars.animationSpeed, slider.vars.easing, function(){
4906              slider.wrapup(dimension);
4907            });
4908          }
4909        } else { // FADE:
4910          if (!touch) {
4911            slider.slides.eq(slider.currentSlide).css({"zIndex": 1}).animate({"opacity": 0}, slider.vars.animationSpeed, slider.vars.easing);
4912            slider.slides.eq(target).css({"zIndex": 2}).animate({"opacity": 1}, slider.vars.animationSpeed, slider.vars.easing, slider.wrapup);
4913          } else {
4914            slider.slides.eq(slider.currentSlide).css({ "opacity": 0, "zIndex": 1 });
4915            slider.slides.eq(target).css({ "opacity": 1, "zIndex": 2 });
4916            slider.wrapup(dimension);
4917          }
4918        }
4919        // SMOOTH HEIGHT:
4920        if (slider.vars.smoothHeight) { methods.smoothHeight(slider.vars.animationSpeed); }
4921      }
4922    };
4923    slider.wrapup = function(dimension) {
4924      // SLIDE:
4925      if (!fade && !carousel) {
4926        if (slider.currentSlide === 0 && slider.animatingTo === slider.last && slider.vars.animationLoop) {
4927          slider.setProps(dimension, "jumpEnd");
4928        } else if (slider.currentSlide === slider.last && slider.animatingTo === 0 && slider.vars.animationLoop) {
4929          slider.setProps(dimension, "jumpStart");
4930        }
4931      }
4932      slider.animating = false;
4933      slider.currentSlide = slider.animatingTo;
4934      // API: after() animation Callback
4935      slider.vars.after(slider);
4936    };
4937
4938    // SLIDESHOW:
4939    slider.animateSlides = function() {
4940      if (!slider.animating && focused ) { slider.flexAnimate(slider.getTarget("next")); }
4941    };
4942    // SLIDESHOW:
4943    slider.pause = function() {
4944      clearInterval(slider.animatedSlides);
4945      slider.animatedSlides = null;
4946      slider.playing = false;
4947      // PAUSEPLAY:
4948      if (slider.vars.pausePlay) { methods.pausePlay.update("play"); }
4949      // SYNC:
4950      if (slider.syncExists) { methods.sync("pause"); }
4951    };
4952    // SLIDESHOW:
4953    slider.play = function() {
4954      if (slider.playing) { clearInterval(slider.animatedSlides); }
4955      slider.animatedSlides = slider.animatedSlides || setInterval(slider.animateSlides, slider.vars.slideshowSpeed);
4956      slider.started = slider.playing = true;
4957      // PAUSEPLAY:
4958      if (slider.vars.pausePlay) { methods.pausePlay.update("pause"); }
4959      // SYNC:
4960      if (slider.syncExists) { methods.sync("play"); }
4961    };
4962    // STOP:
4963    slider.stop = function () {
4964      slider.pause();
4965      slider.stopped = true;
4966    };
4967    slider.canAdvance = function(target, fromNav) {
4968      // ASNAV:
4969      var last = (asNav) ? slider.pagingCount - 1 : slider.last;
4970      return (fromNav) ? true :
4971             (asNav && slider.currentItem === slider.count - 1 && target === 0 && slider.direction === "prev") ? true :
4972             (asNav && slider.currentItem === 0 && target === slider.pagingCount - 1 && slider.direction !== "next") ? false :
4973             (target === slider.currentSlide && !asNav) ? false :
4974             (slider.vars.animationLoop) ? true :
4975             (slider.atEnd && slider.currentSlide === 0 && target === last && slider.direction !== "next") ? false :
4976             (slider.atEnd && slider.currentSlide === last && target === 0 && slider.direction === "next") ? false :
4977             true;
4978    };
4979    slider.getTarget = function(dir) {
4980      slider.direction = dir;
4981      if (dir === "next") {
4982        return (slider.currentSlide === slider.last) ? 0 : slider.currentSlide + 1;
4983      } else {
4984        return (slider.currentSlide === 0) ? slider.last : slider.currentSlide - 1;
4985      }
4986    };
4987
4988    // SLIDE:
4989    slider.setProps = function(pos, special, dur) {
4990      var target = (function() {
4991        var posCheck = (pos) ? pos : ((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.animatingTo,
4992            posCalc = (function() {
4993              if (carousel) {
4994                return (special === "setTouch") ? pos :
4995                       (reverse && slider.animatingTo === slider.last) ? 0 :
4996                       (reverse) ? slider.limit - (((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.animatingTo) :
4997                       (slider.animatingTo === slider.last) ? slider.limit : posCheck;
4998              } else {
4999                switch (special) {
5000                  case "setTotal": return (reverse) ? ((slider.count - 1) - slider.currentSlide + slider.cloneOffset) * pos : (slider.currentSlide + slider.cloneOffset) * pos;
5001                  case "setTouch": return (reverse) ? pos : pos;
5002                  case "jumpEnd": return (reverse) ? pos : slider.count * pos;
5003                  case "jumpStart": return (reverse) ? slider.count * pos : pos;
5004                  default: return pos;
5005                }
5006              }
5007            }());
5008
5009            return (posCalc * -1) + "px";
5010          }());
5011
5012      if (slider.transitions) {
5013        target = (vertical) ? "translate3d(0," + target + ",0)" : "translate3d(" + target + ",0,0)";
5014        dur = (dur !== undefined) ? (dur/1000) + "s" : "0s";
5015        slider.container.css("-" + slider.pfx + "-transition-duration", dur);
5016         slider.container.css("transition-duration", dur);
5017      }
5018
5019      slider.args[slider.prop] = target;
5020      if (slider.transitions || dur === undefined) { slider.container.css(slider.args); }
5021
5022      slider.container.css('transform',target);
5023    };
5024
5025    slider.setup = function(type) {
5026      // SLIDE:
5027      if (!fade) {
5028        var sliderOffset, arr;
5029
5030        if (type === "init") {
5031          slider.viewport = $('<div class="' + namespace + 'viewport"></div>').css({"overflow": "hidden", "position": "relative"}).appendTo(slider).append(slider.container);
5032          // INFINITE LOOP:
5033          slider.cloneCount = 0;
5034          slider.cloneOffset = 0;
5035          // REVERSE:
5036          if (reverse) {
5037            arr = $.makeArray(slider.slides).reverse();
5038            slider.slides = $(arr);
5039            slider.container.empty().append(slider.slides);
5040          }
5041        }
5042        // INFINITE LOOP && !CAROUSEL:
5043        if (slider.vars.animationLoop && !carousel) {
5044          slider.cloneCount = 2;
5045          slider.cloneOffset = 1;
5046          // clear out old clones
5047          if (type !== "init") { slider.container.find('.clone').remove(); }
5048          slider.container.append(methods.uniqueID(slider.slides.first().clone().addClass('clone')).attr('aria-hidden', 'true'))
5049                          .prepend(methods.uniqueID(slider.slides.last().clone().addClass('clone')).attr('aria-hidden', 'true'));
5050        }
5051        slider.newSlides = $(slider.vars.selector, slider);
5052
5053        sliderOffset = (reverse) ? slider.count - 1 - slider.currentSlide + slider.cloneOffset : slider.currentSlide + slider.cloneOffset;
5054        // VERTICAL:
5055        if (vertical && !carousel) {
5056          slider.container.height((slider.count + slider.cloneCount) * 200 + "%").css("position", "absolute").width("100%");
5057          setTimeout(function(){
5058            slider.newSlides.css({"display": "block"});
5059            slider.doMath();
5060            slider.viewport.height(slider.h);
5061            slider.setProps(sliderOffset * slider.h, "init");
5062          }, (type === "init") ? 100 : 0);
5063        } else {
5064          slider.container.width((slider.count + slider.cloneCount) * 200 + "%");
5065          slider.setProps(sliderOffset * slider.computedW, "init");
5066          setTimeout(function(){
5067            slider.doMath();
5068            slider.newSlides.css({"width": slider.computedW, "marginRight" : slider.computedM, "float": "left", "display": "block"});
5069            // SMOOTH HEIGHT:
5070            if (slider.vars.smoothHeight) { methods.smoothHeight(); }
5071          }, (type === "init") ? 100 : 0);
5072        }
5073      } else { // FADE:
5074        slider.slides.css({"width": "100%", "float": "left", "marginRight": "-100%", "position": "relative"});
5075        if (type === "init") {
5076          if (!touch) {
5077            //slider.slides.eq(slider.currentSlide).fadeIn(slider.vars.animationSpeed, slider.vars.easing);
5078            if (slider.vars.fadeFirstSlide == false) {
5079              slider.slides.css({ "opacity": 0, "display": "block", "zIndex": 1 }).eq(slider.currentSlide).css({"zIndex": 2}).css({"opacity": 1});
5080            } else {
5081              slider.slides.css({ "opacity": 0, "display": "block", "zIndex": 1 }).eq(slider.currentSlide).css({"zIndex": 2}).animate({"opacity": 1},slider.vars.animationSpeed,slider.vars.easing);
5082            }
5083          } else {
5084            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});
5085          }
5086        }
5087        // SMOOTH HEIGHT:
5088        if (slider.vars.smoothHeight) { methods.smoothHeight(); }
5089      }
5090      // !CAROUSEL:
5091      // CANDIDATE: active slide
5092      if (!carousel) { slider.slides.removeClass(namespace + "active-slide").eq(slider.currentSlide).addClass(namespace + "active-slide"); }
5093
5094      //FlexSlider: init() Callback
5095      slider.vars.init(slider);
5096    };
5097
5098    slider.doMath = function() {
5099      var slide = slider.slides.first(),
5100          slideMargin = slider.vars.itemMargin,
5101          minItems = slider.vars.minItems,
5102          maxItems = slider.vars.maxItems;
5103
5104      slider.w = (slider.viewport===undefined) ? slider.width() : slider.viewport.width();
5105      slider.h = slide.height();
5106      slider.boxPadding = slide.outerWidth() - slide.width();
5107
5108      // CAROUSEL:
5109      if (carousel) {
5110        
5111        slider.itemT = slider.vars.itemWidth + slideMargin; 
5112        slider.itemM = slideMargin;
5113        slider.minW = (minItems) ? minItems * slider.itemT : slider.w;
5114        slider.maxW = (maxItems) ? (maxItems * slider.itemT) - slideMargin : slider.w;
5115        slider.itemW = (slider.minW > slider.w) ? (slider.w - (slideMargin * (minItems - 1)))/minItems :
5116                       (slider.maxW < slider.w) ? (slider.w - (slideMargin * (maxItems - 1)))/maxItems :
5117                       (slider.vars.itemWidth > slider.w) ? slider.w : slider.vars.itemWidth;
5118
5119        slider.visible = Math.floor(slider.w / slider.itemW); // -- removed by kach (added for vertical viewed items)
5120        // 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
5121
5122        slider.move = (slider.vars.move > 0 && slider.vars.move < slider.visible ) ? slider.vars.move : slider.visible;
5123        slider.pagingCount = Math.ceil(((slider.count - slider.visible)/slider.move) + 1);
5124        slider.last =  slider.pagingCount - 1;
5125        slider.limit = (slider.pagingCount === 1) ? 0 :
5126                       (slider.vars.itemWidth > slider.w) ? (slider.itemW * (slider.count - 1)) + (slideMargin * (slider.count - 1)) : ((slider.itemW + slideMargin) * slider.count) - slider.w - slideMargin;
5127      } else {
5128        slider.itemW = slider.w;
5129        slider.itemM = slideMargin;
5130        slider.pagingCount = slider.count;
5131        slider.last = slider.count - 1;
5132      }
5133      slider.computedW = slider.itemW - slider.boxPadding;
5134      slider.computedM = slider.itemM;
5135    };
5136
5137    slider.update = function(pos, action) {
5138      slider.doMath();
5139
5140      // update currentSlide and slider.animatingTo if necessary
5141      if (!carousel) {
5142        if (pos < slider.currentSlide) {
5143          slider.currentSlide += 1;
5144        } else if (pos <= slider.currentSlide && pos !== 0) {
5145          slider.currentSlide -= 1;
5146        }
5147        slider.animatingTo = slider.currentSlide;
5148      }
5149
5150      // update controlNav
5151      if (slider.vars.controlNav && !slider.manualControls) {
5152        if ((action === "add" && !carousel) || slider.pagingCount > slider.controlNav.length) {
5153          methods.controlNav.update("add");
5154        } else if ((action === "remove" && !carousel) || slider.pagingCount < slider.controlNav.length) {
5155          /*if (carousel && slider.currentSlide > slider.last) {
5156            slider.currentSlide -= 1;
5157            slider.animatingTo -= 1;
5158          }*/
vendor: 7,758 bytes, lines 5158-5285
5158
5159          methods.controlNav.update("remove", slider.last);
5160        }
5161      }
5162      // update directionNav
5163      if (slider.vars.directionNav) { methods.directionNav.update(); }
5164
5165    };
5166
5167    slider.addSlide = function(obj, pos) {
5168      var $obj = $(obj);
5169
5170      slider.count += 1;
5171      slider.last = slider.count - 1;
5172
5173      // append new slide
5174      if (vertical && reverse) {
5175        (pos !== undefined) ? slider.slides.eq(slider.count - pos).after($obj) : slider.container.prepend($obj);
5176      } else {
5177        (pos !== undefined) ? slider.slides.eq(pos).before($obj) : slider.container.append($obj);
5178      }
5179
5180      // update currentSlide, animatingTo, controlNav, and directionNav
5181      slider.update(pos, "add");
5182
5183      // update slider.slides
5184      slider.slides = $(slider.vars.selector + ':not(.clone)', slider);
5185      // re-setup the slider to accomdate new slide
5186      slider.setup();
5187
5188      //FlexSlider: added() Callback
5189      slider.vars.added(slider);
5190    };
5191    slider.removeSlide = function(obj) {
5192      var pos = (isNaN(obj)) ? slider.slides.index($(obj)) : obj;
5193
5194      // update count
5195      slider.count -= 1;
5196      slider.last = slider.count - 1;
5197
5198      // remove slide
5199      if (isNaN(obj)) {
5200        $(obj, slider.slides).remove();
5201      } else {
5202        (vertical && reverse) ? slider.slides.eq(slider.last).remove() : slider.slides.eq(obj).remove();
5203      }
5204
5205      // update currentSlide, animatingTo, controlNav, and directionNav
5206      slider.doMath();
5207      slider.update(pos, "remove");
5208
5209      // update slider.slides
5210      slider.slides = $(slider.vars.selector + ':not(.clone)', slider);
5211      // re-setup the slider to accomdate new slide
5212      slider.setup();
5213
5214      // FlexSlider: removed() Callback
5215      slider.vars.removed(slider);
5216    };
5217
5218    //FlexSlider: Initialize
5219    methods.init();
5220  };
5221
5222  // Ensure the slider isn't focussed if the window loses focus.
5223  $( window ).blur( function ( e ) {
5224    focused = false;
5225  }).focus( function ( e ) {
5226    focused = true;
5227  });
5228
5229  //FlexSlider: Default Settings
5230  $.flexslider.defaults = {
5231    namespace: "flex-",             //{NEW} String: Prefix string attached to the class of every element generated by the plugin
5232    selector: ".slides > li",       //{NEW} Selector: Must match a simple pattern. '{container} > {slide}' -- Ignore pattern at your own peril
5233    animation: "fade",              //String: Select your animation type, "fade" or "slide"
5234    easing: "swing",                //{NEW} String: Determines the easing method used in jQuery transitions. jQuery easing plugin is supported!
5235    direction: "horizontal",        //String: Select the sliding direction, "horizontal" or "vertical"
5236    reverse: false,                 //{NEW} Boolean: Reverse the animation direction
5237    animationLoop: true,            //Boolean: Should the animation loop? If false, directionNav will received "disable" classes at either end
5238    smoothHeight: false,            //{NEW} Boolean: Allow height of the slider to animate smoothly in horizontal mode
5239    startAt: 0,                     //Integer: The slide that the slider should start on. Array notation (0 = first slide)
5240    slideshow: true,                //Boolean: Animate slider automatically
5241    slideshowSpeed: 7000,           //Integer: Set the speed of the slideshow cycling, in milliseconds
5242    animationSpeed: 600,            //Integer: Set the speed of animations, in milliseconds
5243    initDelay: 0,                   //{NEW} Integer: Set an initialization delay, in milliseconds
5244    randomize: false,               //Boolean: Randomize slide order
5245    fadeFirstSlide: true,           //Boolean: Fade in the first slide when animation type is "fade"
5246    thumbCaptions: false,           //Boolean: Whether or not to put captions on thumbnails when using the "thumbnails" controlNav.
5247
5248    // Usability features
5249    pauseOnAction: true,            //Boolean: Pause the slideshow when interacting with control elements, highly recommended.
5250    pauseOnHover: false,            //Boolean: Pause the slideshow when hovering over slider, then resume when no longer hovering
5251    pauseInvisible: true,       //{NEW} Boolean: Pause the slideshow when tab is invisible, resume when visible. Provides better UX, lower CPU usage.
5252    useCSS: true,                   //{NEW} Boolean: Slider will use CSS3 transitions if available
5253    touch: true,                    //{NEW} Boolean: Allow touch swipe navigation of the slider on touch-enabled devices
5254    video: false,                   //{NEW} Boolean: If using video in the slider, will prevent CSS3 3D Transforms to avoid graphical glitches
5255
5256    // Primary Controls
5257    controlNav: true,               //Boolean: Create navigation for paging control of each slide? Note: Leave true for manualControls usage
5258    directionNav: true,             //Boolean: Create navigation for previous/next navigation? (true/false)
5259    prevText: "Previous",           //String: Set the text for the "previous" directionNav item
5260    nextText: "Next",               //String: Set the text for the "next" directionNav item
5261
5262    // Secondary Navigation
5263    keyboard: true,                 //Boolean: Allow slider navigating via keyboard left/right keys
5264    multipleKeyboard: false,        //{NEW} Boolean: Allow keyboard navigation to affect multiple sliders. Default behavior cuts out keyboard navigation with more than one slider present.
5265    mousewheel: false,              //{UPDATED} Boolean: Requires jquery.mousewheel.js (https://github.com/brandonaaron/jquery-mousewheel) - Allows slider navigating via mousewheel
5266    pausePlay: false,               //Boolean: Create pause/play dynamic element
5267    pauseText: "Pause",             //String: Set the text for the "pause" pausePlay item
5268    playText: "Play",               //String: Set the text for the "play" pausePlay item
5269
5270    // Special properties
5271    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.
5272    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.
5273    customDirectionNav: "",         //{NEW} 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)
5274    sync: "",                       //{NEW} Selector: Mirror the actions performed on this slider with another slider. Use with care.
5275    asNavFor: "",                   //{NEW} Selector: Internal property exposed for turning the slider into a thumbnail navigation for another slider
5276
5277    // Carousel Options
5278    itemWidth: 0,                   //{NEW} Integer: Box-model width of individual carousel items, including horizontal borders and padding.
5279    itemMargin: 0,                  //{NEW} Integer: Margin between carousel items.
5280    minItems: 1,                    //{NEW} Integer: Minimum number of carousel items that should be visible. Items will resize fluidly when below this.
5281    maxItems: 0,                    //{NEW} Integer: Maxmimum number of carousel items that should be visible. Items will resize fluidly when above this limit.
5282    move: 0,                        //{NEW} Integer: Number of carousel items that should move on animation. If 0, slider will move all visible items.
5283    allowOneSlide: true,           //{NEW} Boolean: Whether or not to allow a slider comprised of a single slide
5284
5285    // 
5285Callback API
5286    start: function(){},            //Callback: function(slider) - Fires when the slider loads the first slide
5287    before: function(){},           //Callback: function(slider) - Fires asynchronously with each slider animation
5288    after: function(){},            //Callback: function(slider) - Fires after each slider animation completes
5289    end: function(){},              //Callback: function(slider) - Fires when the slider reaches the last slide (asynchronous)
5290    added: function(){},            //{NEW} Callback: function(slider) - Fires after a slide is added
5291    removed: function(){},           //{NEW} Callback: function(slider) - Fires after a slide is removed
5292    init: function() {}             //{NEW} Callback: function(slider) - Fires after the slider is initially setup
5293  };
5294
5295  //FlexSlider: Plugin Function
5296  $.fn.flexslider = function(options) {
5297    if (options === undefined) { options = {}; }
5298
5299    if (typeof options === "object") {
5300      return this.each(function() {
5301        var $this = $(this),
5302            selector = (options.selector) ? options.selector : ".slides > li",
5303            $slides = $this.find(selector);
5304
5305      if ( ( $slides.length === 1 && options.allowOneSlide === false ) || $slides.length === 0 ) {
5306          $slides.fadeIn(400);
5307          if (options.start) { options.start($this); }
5308        } else if ($this.data('flexslider') === undefined) {
5309          new $.flexslider(this, options);
5310        }
5311      });
5312    } else {
5313      // Helper strings to quickly perform functions on the slider
5314      var $slider = $(this).data('flexslider');
5315      switch (options) {
5316        case "play": $slider.play(); break;
5317        case "pause": $slider.pause(); break;
5318        case "stop": $slider.stop(); break;
5319        case "next": $slider.flexAnimate($slider.getTarget("next"), true); break;
5320        case "prev":
5321        case "previous": $slider.flexAnimate($slider.getTarget("prev"), true); break;
5322        default: if (typeof options === "number") { $slider.flexAnimate(options, true); }
5323      }
5324    }
5325  };
5326})(jQuery);
5327
5328/* End */
5329;
5330; /* Start:"a:4:{s:4:"full";s:67:"/local/templates/aspro_next/vendor/js/moment.min.js?172597048234436";s:6:"source";s:51:"/local/templates/aspro_next/vendor/js/moment.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
5331//! moment.js
5332//! version : 2.10.3
5333//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
5334//! license : MIT
5335//! momentjs.com
5336!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,invali
5336dFormat:!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;
5336for("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 5336
5336a._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;
5336return 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()]}
5336function 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}
5336|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=
5336xd,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",
5337hh:"%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});
5338/* End */
5339;
5340; /* Start:"a:4:{s:4:"full";s:66:"/local/templates/aspro_next/vendor/js/footable.js?1725970481275478";s:6:"source";s:49:"/local/templates/aspro_next/vendor/js/footable.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
5341/*
5342* FooTable v3 - FooTable is a jQuery plugin that aims to make HTML tables on smaller devices look awesome.
5343* @version 3.1.5
5344* @link http://fooplugins.com
5345* @copyright Steven Usher & Brad Vincent 2015
5346* @license Released under the GPLv3 license.
5347*/
5348(function($, F){
5349	// add in console we use in case it's missing
5350	window.console = window.console || { log:function(){}, error:function(){} };
5351
5352	/**
5353	 * The jQuery plugin initializer.
5354	 * @function jQuery.fn.footable
5355	 * @param {(object|FooTable.Defaults)} [options] - The options to initialize the plugin with.
5356	 * @param {function} [ready] - A callback function to execute for each initialized plugin.
5357	 * @returns {jQuery}
5358	 */
5359	$.fn.footable = function (options, ready) {
5360		options = options || {};
5361		// make sure we only work with tables
5362		return this.filter('table').each(function (i, tbl) {
5363			F.init(tbl, options, ready);
5364		});
5365	};
5366
5367	var debug_defaults = {
5368		events: []
5369	};
5370	F.__debug__ = JSON.parse(localStorage.getItem('footable_debug')) || false;
5371	F.__debug_options__ = JSON.parse(localStorage.getItem('footable_debug_options')) || debug_defaults;
5372
5373	/**
5374	 * Gets or sets the internal debug variable which enables some additional logging to the console.
5375	 * When enabled this value is stored in the localStorage so it can persist across page reloads.
5376	 * @param {boolean} value - Whether or not to enable additional logging.
5377	 * @param {object} [options] - Any debug specific options.
5378	 * @returns {(boolean|undefined)}
5379	 */
5380	F.debug = function(value, options){
5381		if (!F.is.boolean(value)) return F.__debug__;
5382		F.__debug__ = value;
5383		if (F.__debug__){
5384			localStorage.setItem('footable_debug', JSON.stringify(F.__debug__));
5385			F.__debug_options__ = $.extend(true, {}, debug_defaults, options || {});
5386			if (F.is.hash(options)){
5387				localStorage.setItem('footable_debug_options', JSON.stringify(F.__debug_options__));
5388			}
5389		} else {
5390			localStorage.removeItem('footable_debug');
5391			localStorage.removeItem('footable_debug_options');
5392		}
5393	};
5394
5395	/**
5396	 * Gets the FooTable instance of the supplied table if one exists.
5397	 * @param {(jQuery|jQuery.selector|HTMLTableElement)} table - The jQuery table object, selector or the HTMLTableElement to retrieve FooTable from.
5398	 * @returns {(FooTable.Table|undefined)}
5399	 */
5400	F.get = function(table){
5401		return $(table).first().data('__FooTable__');
5402	};
5403
5404	/**
5405	 * Initializes a new instance of FooTable on the supplied table.
5406	 * @param {(jQuery|jQuery.selector|HTMLTableElement)} table - The jQuery table object, selector or the HTMLTableElement to initialize FooTable on.
5407	 * @param {object} options - The options to initialize FooTable with.
5408	 * @param {function} [ready] - A callback function to execute once the plugin is initialized.
5409	 * @returns {FooTable.Table}
5410	 */
5411	F.init = function(table, options, ready){
5412		var ft = F.get(table);
5413		if (ft instanceof F.Table) ft.destroy();
5414		return new F.Table(table, options, ready);
5415	};
5416
5417	/**
5418	 * Gets the FooTable.Row instance for the supplied element.
5419	 * @param {(jQuery|jQuery.selector|HTMLTableElement)} element - A jQuery object, selector or the HTMLElement of an element to retrieve the FooTable.Row for.
5420	 * @returns {FooTable.Row}
5421	 */
5422	F.getRow = function(element){
5423		// to get the FooTable.Row object simply walk up the DOM, find the TR and grab the __FooTableRow__ data value
5424		var $row = $(element).closest('tr');
5425		// if this is a detail row get the previous row in the table to get the main TR element
5426		if ($row.hasClass('footable-detail-row')){
5427			$row = $row.prev();
5428		}
5429		// grab the row object
5430		return $row.data('__FooTableRow__');
5431	};
5432
5433	// The below are external type definitions mainly used as pointers to jQuery docs for important information
5434	/**
5435	 * 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
5436	 * 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.
5437	 * @name jQuery
5438	 * @constructor
5439	 * @returns {jQuery}
5440	 * @see {@link http://api.jquery.com/}
5441	 */
5442
5443	/**
5444	 * 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.
5445	 * @typedef {object} jQuery.Promise
5446	 * @see {@link http://api.jquery.com/Types/#Promise}
5447	 */
5448
5449	/**
5450	 * 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,
5451	 * and relay the success or failure state of any synchronous or asynchronous function.
5452	 * @typedef {object} jQuery.Deferred
5453	 * @see {@link http://api.jquery.com/Types/#Deferred}
5454	 */
5455
5456	/**
5457	 * 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
5458	 * the original event are copied over and normalized to the new event object.
5459	 * @typedef {object} jQuery.Event
5460	 * @see {@link http://api.jquery.com/category/events/event-object/}
5461	 */
5462
5463	/**
5464	 * Provides a way to execute callback functions based on one or more objects, usually Deferred objects that represent asynchronous events.
5465	 * @memberof jQuery
5466	 * @function when
5467	 * @param {...jQuery.Deferred} deferreds - Any number of deferred objects to wait for.
5468	 * @returns {jQuery.Promise}
5469	 * @see {@link http://api.jquery.com/jQuery.when/}
5470	 */
5471
5472	/**
5473	 * The jQuery.fn namespace used to register plugins with jQuery.
5474	 * @memberof jQuery
5475	 * @namespace fn
5476	 * @see {@link http://learn.jquery.com/plugins/basic-plugin-creation/}
5477	 */
5478})(
5479	jQuery,
5480	/**
5481	 * The core FooTable namespace containing all the plugin code.
5482	 * @namespace
5483	 */
5484	FooTable = window.FooTable || {}
5485);
5486(function(F){
5487	var returnTrue = function(){ return true; };
5488
5489	/**
5490	 * This namespace contains commonly used array utility methods.
5491	 * @namespace {object} FooTable.arr
5492	 */
5493	F.arr = {};
5494
5495	/**
5496	 * Iterates over each item in the supplied array and performs the supplied function passing in the current item as the first argument.
5497	 * @memberof FooTable.arr
5498	 * @function each
5499	 * @param {Array} array - The array to iterate
5500	 * @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.
5501	 */
5502	F.arr.each = function (array, func) {
5503		if (!F.is.array(array) || !F.is.fn(func)) return;
5504		for (var i = 0, len = array.length; i < len; i++) {
5505			if (func(array[i], i) === false) break;
5506		}
5507	};
5508
5509	/**
5510	 * Get all items in the supplied array that optionally matches the supplied where function. If no items are found an empty array is returned.
5511	 * @memberof FooTable.arr
5512	 * @function get
5513	 * @param {Array} array - The array to get items from.
5514	 * @param {function} where - This function must return a boolean value, true includes the item in the result array.
5515	 * @returns {Array}
5516	 */
5517	F.arr.get = function (array, where) {
5518		var result = [];
5519		if (!F.is.array(array)) return result;
5520		if (!F.is.fn(where)) return array;
5521		for (var i = 0, len = array.length; i < len; i++) {
5522			if (where(array[i], i)) result.push(array[i]);
5523		}
5524		return result;
5525	};
5526
5527	/**
5528	 * Get a boolean value indicating if any item exists in the supplied array that optionally matches the supplied where function.
5529	 * @memberof FooTable.arr
5530	 * @function any
5531	 * @param {Array} array - The array to check.
5532	 * @param {function} [where] - [Optional] This function must return a boolean value, true indicates that the current item is a valid match.
5533	 * @returns {boolean}
5534	 */
5535	F.arr.any = function (array, where) {
5536		if (!F.is.array(array)) return false;
5537		where = F.is.fn(where) ? where : returnTrue;
5538		for (var i = 0, len = array.length; i < len; i++) {
5539			if (where(array[i], i)) return true;
5540		}
5541		return false;
5542	};
5543
5544	/**
5545	 * Checks if the supplied value exists in the array.
5546	 * @memberof FooTable.arr
5547	 * @function contains
5548	 * @param {Array} array - The array to check.
5549	 * @param {*} value - The value to check for.
5550	 * @returns {boolean}
5551	 */
5552	F.arr.contains = function(array, value){
5553		if (!F.is.array(array) || F.is.undef(value)) return false;
5554		for (var i = 0, len = array.length; i < len; i++) {
5555			if (array[i] == value) return true;
5556		}
5557		return false;
5558	};
5559
5560	/**
5561	 * Get the first item in the supplied array that optionally matches the supplied where function. If no item is found null is returned.
5562	 * @memberof FooTable.arr
5563	 * @function first
5564	 * @param {Array} array - The array to get the item from.
5565	 * @param {function} [where] - [Optional] This function must return a boolean value, true indicates that the current item can be returned.
5566	 * @returns {(*|null)}
5567	 */
5568	F.arr.first = function (array, where) {
5569		if (!F.is.array(array)) return null;
5570		where = F.is.fn(where) ? where : returnTrue;
5571		for (var i = 0, len = array.length; i < len; i++) {
5572			if (where(array[i], i)) return array[i];
5573		}
5574		return null;
5575	};
5576
5577	/**
5578	 * 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.
5579	 * @memberof FooTable.arr
5580	 * @function map
5581	 * @param {Array} array - The array to iterate.
5582	 * @param {function} getter - This function must return either a new value or null.
5583	 * The first argument is the result being returned at this point in the iteration. The second argument is the current item being iterated.
5584	 * @returns {(*|null)}
5585	 */
5586	F.arr.map = function (array, getter) {
5587		var result = [], returned = null;
5588		if (!F.is.array(array) || !F.is.fn(getter)) return result;
5589		for (var i = 0, len = array.length; i < len; i++) {
5590			if ((returned = getter(array[i], i)) != null) result.push(returned);
5591		}
5592		return result;
5593	};
5594
5595	/**
5596	 * Removes items from the array matching the supplied where function. All removed items are returned in a new array.
5597	 * @memberof FooTable.arr
5598	 * @function remove
5599	 * @param {Array} array - The array to iterate and remove items from.
5600	 * @param {function} where - This function must return a boolean value, true includes the item in the result array.
5601	 * @returns {*}
5602	 */
5603	F.arr.remove = function (array, where) {
5604		var remove = [], removed = [];
5605		if (!F.is.array(array) || !F.is.fn(where)) return removed;
5606		var i = 0, len = array.length;
5607		for (; i < len; i++) {
5608			if (where(array[i], i, removed)){
5609				remove.push(i);
5610				removed.push(array[i]);
5611			}
5612		}
5613		// sort the indexes to be removed from largest to smallest
5614		remove.sort(function(a, b){ return b - a; });
5615		i = 0; len = remove.length;
5616		for(; i < len; i++){
5617			var index = remove[i] - i;
5618			array.splice(index, 1);
5619		}
5620		return removed;
5621	};
5622
5623	/**
5624	 * Deletes a single item from the array. The item if removed is returned.
5625	 * @memberof FooTable.arr
5626	 * @function delete
5627	 * @param {Array} array - The array to iterate and delete the item from.
5628	 * @param {*} item - The item to find and delete.
5629	 * @returns {(*|null)}
5630	 */
5631	F.arr.delete = function(array, item){
5632		var remove = -1, removed = null;
5633		if (!F.is.array(array) || F.is.undef(item)) return removed;
5634		var i = 0, len = array.length;
5635		for (; i < len; i++) {
5636			if (array[i] == item){
5637				remove = i;
5638				removed = array[i];
5639				break;
5640			}
5641		}
5642		if (remove != -1) array.splice(remove, 1);
5643		return removed;
5644	};
5645
5646	/**
5647	 * Replaces a single item in the array with a new one.
5648	 * @memberof FooTable.arr
5649	 * @function replace
5650	 * @param {Array} array - The array to iterate and replace the item in.
5651	 * @param {*} oldItem - The item to be replaced.
5652	 * @param {*} newItem - The item to be inserted.
5653	 */
5654	F.arr.replace = function(array, oldItem, newItem){
5655		var index = array.indexOf(oldItem);
5656		if (index !== -1) array[index] = newItem;
5657	};
5658
5659})(FooTable);
5660(function (F) {
5661
5662	/**
5663	 * This namespace contains commonly used 'is' type methods that return boolean values.
5664	 * @namespace FooTable.is
5665	 */
5666	F.is = {};
5667
5668	/**
5669	 * Checks if the type of the value is the same as that supplied.
5670	 * @memberof FooTable.is
5671	 * @function type
5672	 * @param {*} value - The value to check the type of.
5673	 * @param {string} type - The type to check for.
5674	 * @returns {boolean}
5675	 */
5676	F.is.type = function (value, type) {
5677		return typeof value === type;
5678	};
5679
5680	/**
5681	 * Checks if the value is defined.
5682	 * @memberof FooTable.is
5683	 * @function defined
5684	 * @param {*} value - The value to check is defined.
5685	 * @returns {boolean}
5686	 */
5687	F.is.defined = function (value) {
5688		return typeof value !== 'undefined';
5689	};
5690
5691	/**
5692	 * Checks if the value is undefined.
5693	 * @memberof FooTable.is
5694	 * @function undef
5695	 * @param {*} value - The value to check is undefined.
5696	 * @returns {boolean}
5697	 */
5698	F.is.undef = function (value) {
5699		return typeof value === 'undefined';
5700	};
5701
5702	/**
5703	 * Checks if the value is an array.
5704	 * @memberof FooTable.is
5705	 * @function array
5706	 * @param {*} value - The value to check.
5707	 * @returns {boolean}
5708	 */
5709	F.is.array = function (value) {
5710		return '[object Array]' === Object.prototype.toString.call(value);
5711	};
5712
5713	/**
5714	 * Checks if the value is a date.
5715	 * @memberof FooTable.is
5716	 * @function date
5717	 * @param {*} value - The value to check.
5718	 * @returns {boolean}
5719	 */
5720	F.is.date = function (value) {
5721		return '[object Date]' === Object.prototype.toString.call(value) && !isNaN(value.getTime());
5722	};
5723
5724	/**
5725	 * Checks if the value is a boolean.
5726	 * @memberof FooTable.is
5727	 * @function boolean
5728	 * @param {*} value - The value to check.
5729	 * @returns {boolean}
5730	 */
5731	F.is.boolean = function (value) {
5732		return '[object Boolean]' === Object.prototype.toString.call(value);
5733	};
5734
5735	/**
5736	 * Checks if the value is a string.
5737	 * @memberof FooTable.is
5738	 * @function string
5739	 * @param {*} value - The value to check.
5740	 * @returns {boolean}
5741	 */
5742	F.is.string = function (value) {
5743		return '[object String]' === Object.prototype.toString.call(value);
5744	};
5745
5746	/**
5747	 * Checks if the value is a number.
5748	 * @memberof FooTable.is
5749	 * @function number
5750	 * @param {*} value - The value to check.
5751	 * @returns {boolean}
5752	 */
5753	F.is.number = function (value) {
5754		return '[object Number]' === Object.prototype.toString.call(value) && !isNaN(value);
5755	};
5756
5757	/**
5758	 * Checks if the value is a function.
5759	 * @memberof FooTable.is
5760	 * @function fn
5761	 * @param {*} value - The value to check.
5762	 * @returns {boolean}
5763	 */
5764	F.is.fn = function (value) {
5765		return (F.is.defined(window) && value === window.alert) || '[object Function]' === Object.prototype.toString.call(value);
5766	};
5767
5768	/**
5769	 * Checks if the value is an error.
5770	 * @memberof FooTable.is
5771	 * @function error
5772	 * @param {*} value - The value to check.
5773	 * @returns {boolean}
5774	 */
5775	F.is.error = function (value) {
5776		return '[object Error]' === Object.prototype.toString.call(value);
5777	};
5778
5779	/**
5780	 * Checks if the value is an object.
5781	 * @memberof FooTable.is
5782	 * @function object
5783	 * @param {*} value - The value to check.
5784	 * @returns {boolean}
5785	 */
5786	F.is.object = function (value) {
5787		return '[object Object]' === Object.prototype.toString.call(value);
5788	};
5789
5790	/**
5791	 * Checks if the value is a hash.
5792	 * @memberof FooTable.is
5793	 * @function hash
5794	 * @param {*} value - The value to check.
5795	 * @returns {boolean}
5796	 */
5797	F.is.hash = function (value) {
5798		return F.is.object(value) && value.constructor === Object && !value.nodeType && !value.setInterval;
5799	};
5800
5801	/**
5802	 * Checks if the supplied object is an HTMLElement
5803	 * @memberof FooTable.is
5804	 * @function element
5805	 * @param {object} obj - The object to check.
5806	 * @returns {boolean}
5807	 */
5808	F.is.element = function (obj) {
5809		return typeof HTMLElement === 'object'
5810			? obj instanceof HTMLElement
5811			: obj && typeof obj === 'object' && obj !== null && obj.nodeType === 1 && typeof obj.nodeName === 'string';
5812	};
5813
5814	/**
5815	 * 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.
5816	 * The promise object is created as an object literal inside of jQuery.Deferred.
5817	 * It has no prototype, nor any other truly unique properties that could be used to distinguish it.
5818	 * This method should be a little more accurate than the internal jQuery one that simply checks for a "promise" method.
5819	 * @memberof FooTable.is
5820	 * @function promise
5821	 * @param {object} obj - The object to check.
5822	 * @returns {boolean}
5823	 */
5824	F.is.promise = function(obj){
5825		return F.is.object(obj) && F.is.fn(obj.then) && F.is.fn(obj.promise);
5826	};
5827
5828	/**
5829	 * Checks if the supplied object is an instance of a jQuery object.
5830	 * @memberof FooTable.is
5831	 * @function jq
5832	 * @param {object} obj - The object to check.
5833	 * @returns {boolean}
5834	 */
5835	F.is.jq = function(obj){
5836		return F.is.defined(window.jQuery) && obj instanceof jQuery && obj.length > 0;
5837	};
5838
5839	/**
5840	 * Checks if the supplied object is a moment.js date object.
5841	 * @memberof FooTable.is
5842	 * @function moment
5843	 * @param {object} obj - The object to check.
5844	 * @returns {boolean}
5845	 */
5846	F.is.moment = function(obj){
5847		return F.is.defined(window.moment) && F.is.object(obj) && F.is.boolean(obj._isAMomentObject)
5848	};
5849
5850	/**
5851	 * Checks if the supplied value is an object and if it is empty.
5852	 * @memberof FooTable.is
5853	 * @function emptyObject
5854	 * @param {*} value - The value to check.
5855	 * @returns {boolean}
5856	 */
5857	F.is.emptyObject = function(value){
5858		if (!F.is.hash(value)) return false;
5859		for(var prop in value) {
5860			if(value.hasOwnProperty(prop))
5861				return false;
5862		}
5863		return true;
5864	};
5865
5866	/**
5867	 * Checks if the supplied value is an array and if it is empty.
5868	 * @memberof FooTable.is
5869	 * @function emptyArray
5870	 * @param {*} value - The value to check.
5871	 * @returns {boolean}
5872	 */
5873	F.is.emptyArray = function(value){
5874		return F.is.array(value) ? value.length === 0 : true;
5875	};
5876
5877	/**
5878	 * Checks if the supplied value is a string and if it is empty.
5879	 * @memberof FooTable.is
5880	 * @function emptyString
5881	 * @param {*} value - The value to check.
5882	 * @returns {boolean}
5883	 */
5884	F.is.emptyString = function(value){
5885		return F.is.string(value) ? value.length === 0 : true;
5886	};
5887
5888})(FooTable);
5889(function (F) {
5890	/**
5891	 * This namespace contains commonly used string utility methods.
5892	 * @namespace FooTable.str
5893	 */
5894	F.str = {};
5895
5896	/**
5897	 * Checks if the supplied string contains the given substring.
5898	 * @memberof FooTable.str
5899	 * @function contains
5900	 * @param {string} str - The string to check.
5901	 * @param {string} contains - The string to check for.
5902	 * @param {boolean} [ignoreCase=false] - Whether or not to ignore casing when performing the check.
5903	 * @returns {boolean}
5904	 */
5905	F.str.contains = function (str, contains, ignoreCase) {
5906		if (F.is.emptyString(str) || F.is.emptyString(contains)) return false;
5907		return contains.length <= str.length
5908			&& (ignoreCase ? str.toUpperCase().indexOf(contains.toUpperCase()) : str.indexOf(contains)) !== -1;
5909	};
5910
5911	/**
5912	 * Checks if the supplied string contains the exact given substring.
5913	 * @memberof FooTable.str
5914	 * @function contains
5915	 * @param {string} str - The string to check.
5916	 * @param {string} contains - The string to check for.
5917	 * @param {boolean} [ignoreCase=false] - Whether or not to ignore casing when performing the check.
5918	 * @returns {boolean}
5919	 */
5920	F.str.containsExact = function (str, contains, ignoreCase) {
5921		if (F.is.emptyString(str) || F.is.emptyString(contains) || contains.length > str.length) return false;
5922		return new RegExp('\\b'+ F.str.escapeRegExp(contains)+'\\b', ignoreCase ? 'i' : '').test(str);
5923	};
5924
5925	/**
5926	 * Checks if the supplied string contains the given word.
5927	 * @memberof FooTable.str
5928	 * @function containsWord
5929	 * @param {string} str - The string to check.
5930	 * @param {string} word - The word to check for.
5931	 * @param {boolean} [ignoreCase=false] - Whether or not to ignore casing when performing the check.
5932	 * @returns {boolean}
5933	 */
5934	F.str.containsWord = function(str, word, ignoreCase){
5935		if (F.is.emptyString(str) || F.is.emptyString(word) || str.length < word.length)
5936			return false;
5937		var parts = str.split(/\W/);
5938		for (var i = 0, len = parts.length; i < len; i++){
5939			if (ignoreCase ? parts[i].toUpperCase() == word.toUpperCase() : parts[i] == word) return true;
5940		}
5941		return false;
5942	};
5943
5944	/**
5945	 * Returns the remainder of a string split on the first index of the given substring.
5946	 * @memberof FooTable.str
5947	 * @function from
5948	 * @param {string} str - The string to split.
5949	 * @param {string} from - The substring to split on.
5950	 * @returns {string}
5951	 */
5952	F.str.from = function (str, from) {
5953		if (F.is.emptyString(str)) return str;
5954		return F.str.contains(str, from) ? str.substring(str.indexOf(from) + 1) : str;
5955	};
5956
5957	/**
5958	 * Checks if a string starts with the supplied prefix.
5959	 * @memberof FooTable.str
5960	 * @function startsWith
5961	 * @param {string} str - The string to check.
5962	 * @param {string} prefix - The prefix to check for.
5963	 * @returns {boolean}
5964	 */
5965	F.str.startsWith = function (str, prefix) {
5966		if (F.is.emptyString(str)) return str == prefix;
5967		return str.slice(0, prefix.length) == prefix;
5968	};
5969
5970	/**
5971	 * Takes the supplied string and converts it to camel case.
5972	 * @memberof FooTable.str
5973	 * @function toCamelCase
5974	 * @param {string} str - The string to camel case.
5975	 * @returns {string}
5976	 */
5977	F.str.toCamelCase = function (str) {
5978		if (F.is.emptyString(str)) return str;
5979		if (str.toUpperCase() === str) return str.toLowerCase();
5980		return str.replace(/^([A-Z])|[-\s_](\w)/g, function (match, p1, p2) {
5981			if (F.is.string(p2)) return p2.toUpperCase();
5982			return p1.toLowerCase();
5983		});
5984	};
5985
5986	/**
5987	 * Generates a random string 9 characters long using the optional prefix if supplied.
5988	 * @memberof FooTable.str
5989	 * @function random
5990	 * @param {string} [prefix] - The prefix to append to the 9 random characters.
5991	 * @returns {string}
5992	 */
5993	F.str.random = function(prefix){
5994		prefix = F.is.emptyString(prefix) ? '' : prefix;
5995		return prefix + Math.random().toString(36).substr(2, 9);
5996	};
5997
5998	/**
5999	 * Escapes a string for use in a regular expression.
6000	 * @memberof FooTable.str
6001	 * @function escapeRegExp
6002	 * @param {string} str - The string to escape.
6003	 * @returns {string}
6004	 */
6005	F.str.escapeRegExp = function(str){
6006		if (F.is.emptyString(str)) return str;
6007		return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
6008	};
6009
6010})(FooTable);
6011(function (F) {
6012	"use strict";
6013
6014	if (!Object.create) {
6015		Object.create = (function () {
6016			var Object = function () {};
6017			return function (prototype) {
6018				if (arguments.length > 1)
6019					throw Error('Second argument not supported');
6020
6021				if (!F.is.object(prototype))
6022					throw TypeError('Argument must be an object');
6023
6024				Object.prototype = prototype;
6025				var result = new Object();
6026				Object.prototype = null;
6027				return result;
6028			};
6029		})();
6030	}
6031
6032	/**
6033	 * This base implementation does nothing except provide access to the {@link FooTable.Class#extend} method.
6034	 * @constructs FooTable.Class
6035	 * @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
6036	 * compatible by implementing an [Object.create polyfill]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create#Polyfill}
6037	 * for older browsers.
6038	 * @see {@link http://ejohn.org/blog/simple-javascript-inheritance}
6039	 * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create#Polyfill}
6040	 * @returns {FooTable.Class}
6041	 */
6042	function Class() {}
6043
6044	var __extendable__ = /xyz/.test(function () {xyz;}) ? /\b_super\b/ : /.*/;
6045
6046	// this._super() within the context of the new function is a pointer to the original function
6047	// except if the hook param is specified then the this._super variable is the result of the original function
6048	Class.__extend__ = function(proto, name, func, original){
6049		// to all who venture here, here be dragons!
6050		proto[name] = F.is.fn(original) && __extendable__.test(func) ?
6051			(function (name, fn) {
6052				return function () {
6053					var tmp, ret;
6054					tmp = this._super;
6055					this._super = original;
6056					ret = fn.apply(this, arguments);
6057					this._super = tmp;
6058					return ret;
6059				};
6060			})(name, func) : func;
6061	};
6062
6063	/**
6064	 * 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.
6065	 * @param {(object|string)} arg1 - An object containing any new methods/members to implement or the name of the method to extend.
6066	 * @param {function} arg2 - If the first argument is a method name then this is the new function to replace it with.
6067	 * @returns {FooTable.Class} A new class that inherits from the base class.
6068	 * @example <caption>The below shows an example of how to implement inheritance using this method.</caption>
6069	 * var Person = FooTable.Class.extend({
6070	 *   construct: function(isDancing){
6071	 *     this.dancing = isDancing;
6072	 *   },
6073	 *   dance: function(){
6074	 *     return this.dancing;
6075	 *   }
6076	 * });
6077	 *
6078	 * var Ninja = Person.extend({
6079	 *   construct: function(){
6080	 *     this._super( false );
6081	 *   },
6082	 *   dance: function(){
6083	 *     // Call the inherited version of dance()
6084	 *     return this._super();
6085	 *   },
6086	 *   swingSword: function(){
6087	 *     return true;
6088	 *   }
6089	 * });
6090	 *
6091	 * var p = new Person(true);
6092	 * p.dance(); // => true
6093	 *
6094	 * var n = new Ninja();
6095	 * n.dance(); // => false
6096	 * n.swingSword(); // => true
6097	 *
6098	 * // Should all be true
6099	 * p instanceof Person && p instanceof FooTable.Class &&
6100	 * n instanceof Ninja && n instanceof Person && n instanceof FooTable.Class
6101	 */
6102	Class.extend = function (arg1 , arg2) {
6103		var args = Array.prototype.slice.call(arguments);
6104		arg1 = args.shift();
6105		arg2 = args.shift();
6106
6107		function __extend__(proto, name, func, original){
6108			// to all who venture here, here be dragons!
6109			proto[name] = F.is.fn(original) && __extendable__.test(func) ?
6110				(function (name, fn, ofn) {
6111					return function () {
6112						var tmp, ret;
6113						tmp = this._super;
6114						this._super = ofn;
6115						ret = fn.apply(this, arguments);
6116						this._super = tmp;
6117						return ret;
6118					};
6119				})(name, func, original) : func;
6120		}
6121
6122		if (F.is.hash(arg1)){
6123			var proto = Object.create(this.prototype),
6124				_super = this.prototype;
6125			for (var name in arg1) {
6126				if (name === '__ctor__') continue;
6127				__extend__(proto, name, arg1[name], _super[name]);
6128			}
6129			var obj = F.is.fn(proto.__ctor__) ? proto.__ctor__ : function () {
6130				if (!F.is.fn(this.construct))
6131					throw new SyntaxError('FooTable class objects must be constructed with the "new" keyword.');
6132				this.construct.apply(this, arguments);
6133			};
6134			proto.construct = F.is.fn(proto.construct) ? proto.construct : function(){};
6135			obj.prototype = proto;
6136			proto.constructor = obj;
6137			obj.extend = Class.extend;
6138			return obj;
6139		} else if (F.is.string(arg1) && F.is.fn(arg2)) {
6140			__extend__(this.prototype, arg1, arg2, this.prototype[arg1]);
6141		}
6142	};
6143
6144	F.Class = Class;
6145
6146	F.ClassFactory = F.Class.extend(/** @lends FooTable.ClassFactory */{
6147		/**
6148		 * This is a simple factory for {@link FooTable.Class} objects allowing them to be registered using a friendly name
6149		 * and then new instances can be created using this friendly name.
6150		 * @constructs
6151		 * @extends FooTable.Class
6152		 * @returns {FooTable.ClassFactory}
6153		 * @this FooTable.ClassFactory
6154		 */
6155		construct: function(){
6156			/**
6157			 * An object containing all registered classes.
6158			 * @type {{}}
6159			 */
6160			this.registered = {};
6161		},
6162		/**
6163		 * Checks if the factory contains a class registered using the supplied name.
6164		 * @instance
6165		 * @param {string} name - The name of the class to check.
6166		 * @returns {boolean}
6167		 * @this FooTable.ClassFactory
6168		 */
6169		contains: function(name){
6170			return F.is.defined(this.registered[name]);
6171		},
6172		/**
6173		 * Gets an array of all registered names.
6174		 * @instance
6175		 * @returns {Array.<string>}
6176		 * @this FooTable.ClassFactory
6177		 */
6178		names: function(){
6179			var names = [], name;
6180			for (name in this.registered){
6181				if (!this.registered.hasOwnProperty(name)) continue;
6182				names.push(name);
6183			}
6184			return names;
6185		},
6186		/**
6187		 * Registers a class object using the supplied friendly name and priority. The priority is only taken into account when loading all registered classes
6188		 * using the {@link FooTable.ClassFactory#load} method.
6189		 * @instance
6190		 * @param {string} name - The friendly name of the class.
6191		 * @param {function} klass - The class to register.
6192		 * @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.
6193		 * @this FooTable.ClassFactory
6194		 */
6195		register: function(name, klass, priority){
6196			if (!F.is.string(name) || !F.is.fn(klass)) return;
6197			var current = this.registered[name];
6198			this.registered[name] = {
6199				name: name,
6200				klass: klass,
6201				priority: F.is.number(priority) ? priority : (F.is.defined(current) ? current.priority : 0)
6202			};
6203		},
6204		/**
6205		 * Creates new instances of all registered classes using there priority and the supplied arguments to return them in an array.
6206		 * @instance
6207		 * @param {object} subs - An object containing classes to substitute on load.
6208		 * @param {*} arg1 - The first argument to supply when creating new instances of all registered classes.
6209		 * @param {*} [argN...] - Any number of additional arguments to supply when creating new instances of all registered classes.
6210		 * @returns {Array.<FooTable.Class>}
6211		 * @this FooTable.ClassFactory
6212		 */
6213		load: function(subs, arg1, argN){
6214			var self = this, args = Array.prototype.slice.call(arguments), reg = [], loaded = [], name, klass;
6215			subs = args.shift() || {};
6216			for (name in self.registered){
6217				if (!self.registered.hasOwnProperty(name)) continue;
6218				var component = self.registered[name];
6219				if (subs.hasOwnProperty(name)){
6220					klass = subs[name];
6221					if (F.is.string(klass)) klass = F.getFnPointer(subs[name]);
6222					if (F.is.fn(klass)){
6223						component = {name: name, klass: klass, priority: self.registered[name].priority};
6224					}
6225				}
6226				reg.push(component);
6227			}
6228			for (name in subs){
6229				if (!subs.hasOwnProperty(name) || self.registered.hasOwnProperty(name)) continue;
6230				klass = subs[name];
6231				if (F.is.string(klass)) klass = F.getFnPointer(subs[name]);
6232				if (F.is.fn(klass)){
6233					reg.push({name: name, klass: klass, priority: 0});
6234				}
6235			}
6236			reg.sort(function(a, b){ return b.priority - a.priority; });
6237			F.arr.each(reg, function(r){
6238				if (F.is.fn(r.klass)){
6239					loaded.push(self._make(r.klass, args));
6240				}
6241			});
6242			return loaded;
6243		},
6244		/**
6245		 * Create a new instance of a single class using the supplied name and arguments.
6246		 * @instance
6247		 * @param {string} name - The name of the class to create.
6248		 * @param {*} arg1 - The first argument to supply to the new instance.
6249		 * @param {*} [argN...] - Any number of additional arguments to supply to the new instance.
6250		 * @returns {FooTable.Class}
6251		 * @this FooTable.ClassFactory
6252		 */
6253		make: function(name, arg1, argN){
6254			var self = this, args = Array.prototype.slice.call(arguments), reg;
6255			name = args.shift();
6256			reg = self.registered[name];
6257			if (F.is.fn(reg.klass)){
6258				return self._make(reg.klass, args);
6259			}
6260			return null;
6261		},
6262		/**
6263		 * This in effect lets us use the "apply" method on a function using the "new" keyword.
6264		 * @instance
6265		 * @private
6266		 * @param {function} klass
6267		 * @param args
6268		 * @returns {FooTable.Class}
6269		 * @this FooTable.ClassFactory
6270		 */
6271		_make: function(klass, args){
6272			function Class() {
6273				return klass.apply(this, args);
6274			}
6275			Class.prototype = klass.prototype;
6276			return new Class();
6277		}
6278	});
6279
6280})(FooTable);
6281(function($, F){
6282
6283	/**
6284	 * Converts the supplied cssText string into JSON object.
6285	 * @param {string} cssText - The cssText to convert to a JSON object.
6286	 * @returns {object}
6287	 */
6288	F.css2json = function(cssText){
6289		if (F.is.emptyString(cssText)) return {};
6290		var json = {}, props = cssText.split(';'), pair, key, value;
6291		for (var i = 0, i_len = props.length; i < i_len; i++){
6292			if (F.is.emptyString(props[i])) continue;
6293			pair = props[i].split(':');
6294			if (F.is.emptyString(pair[0]) || F.is.emptyString(pair[1])) continue;
6295			key = F.str.toCamelCase($.trim(pair[0]));
6296			value = $.trim(pair[1]);
6297			json[key] = value;
6298		}
6299		return json;
6300	};
6301
6302	/**
6303	 * Attempts to retrieve a function pointer using the given name.
6304	 * @param {string} functionName - The name of the function to fetch a pointer to.
6305	 * @returns {(function|object|null)}
6306	 */
6307	F.getFnPointer = function(functionName){
6308		if (F.is.emptyString(functionName)) return null;
6309		var pointer = window,
6310			parts = functionName.split('.');
6311		F.arr.each(parts, function(part){
6312			if (pointer[part]) pointer = pointer[part];
6313		});
6314		return F.is.fn(pointer) ? pointer : null;
6315	};
6316
6317	/**
6318	 * Checks the value for function properties such as the {@link FooTable.Column#formatter} option which could also be specified using just the name
6319	 * and attempts to return the correct function pointer or null if none was found matching the value.
6320	 * @param {FooTable.Class} self - The class to use as the 'this' keyword within the context of the function.
6321	 * @param {(function|string)} value - The actual function or the name of the function for the property.
6322	 * @param {function} [def] - A default function to return if none is found.
6323	 * @returns {(function|null)}
6324	 */
6325	F.checkFnValue = function(self, value, def){
6326		def = F.is.fn(def) ? def : null;
6327		function wrap(t, fn, d){
6328			if (!F.is.fn(fn)) return d;
6329			return function(){
6330				return fn.apply(t, arguments);
6331			};
6332		}
6333		return F.is.fn(value) ? wrap(self, value, def) : (F.is.type(value, 'string') ? wrap(self, F.getFnPointer(value), def) : def);
6334	};
6335
6336})(jQuery, FooTable);
6337(function($, F){
6338
6339	F.Cell = F.Class.extend(/** @lends FooTable.Cell */{
6340		/**
6341		 * The cell class containing all the properties for cells.
6342		 * @constructs
6343		 * @extends FooTable.Class
6344		 * @param {FooTable.Table} table -  The root {@link FooTable.Table} this cell belongs to.
6345		 * @param {FooTable.Row} row - The parent {@link FooTable.Row} this cell belongs to.
6346		 * @param {FooTable.Column} column - The {@link FooTable.Column} this cell falls under.
6347		 * @param {(*|HTMLElement|jQuery)} valueOrElement - Either the value or the element for the cell.
6348		 * @returns {FooTable.Cell}
6349		 * @this FooTable.Cell
6350		 */
6351		construct: function (table, row, column, valueOrElement) {
6352			/**
6353			 * The root {@link FooTable.Table} for the cell.
6354			 * @instance
6355			 * @readonly
6356			 * @type {FooTable.Table}
6357			 */
6358			this.ft = table;
6359			/**
6360			 * The parent {@link FooTable.Row} for the cell.
6361			 * @instance
6362			 * @readonly
6363			 * @type {FooTable.Row}
6364			 */
6365			this.row = row;
6366			/**
6367			 * The {@link FooTable.Column} this cell falls under.
6368			 * @instance
6369			 * @readonly
6370			 * @type {FooTable.Column}
6371			 */
6372			this.column = column;
6373			this.created = false;
6374			this.define(valueOrElement);
6375		},
6376		/**
6377		 * This is supplied either the value or the cell element/jQuery object if it exists.
6378		 * If supplied the element we need set the $el property and parse the value from it.
6379		 * @instance
6380		 * @protected
6381		 * @param {(*|jQuery)} valueOrElement - The value or element to define the cell.
6382		 * @this FooTable.Cell
6383		 */
6384		define: function(valueOrElement){
6385			/**
6386			 * The jQuery table cell object this instance wraps.
6387			 * @instance
6388			 * @type {jQuery}
6389			 */
6390			this.$el = F.is.element(valueOrElement) || F.is.jq(valueOrElement) ? $(valueOrElement) : null;
6391			/**
6392			 * The jQuery row object that represents this cell in the details table.
6393			 * @type {jQuery}
6394			 */
6395			this.$detail = null;
6396
6397			var hasOptions = F.is.hash(valueOrElement) && F.is.hash(valueOrElement.options) && F.is.defined(valueOrElement.value);
6398
6399			/**
6400			 * The value of the cell.
6401			 * @instance
6402			 * @type {*}
6403			 */
6404			this.value = this.column.parser.call(this.column, F.is.jq(this.$el) ? this.$el : (hasOptions ? valueOrElement.value : valueOrElement), this.ft.o);
6405
6406			/**
6407			 * Contains any options for the cell. These are the options supplied through the plugin constructor as part of the row object itself.
6408			 * @type {object}
6409			 */
6410			this.o = $.extend(true, {
6411				classes: null,
6412				style: null
6413			}, hasOptions ? valueOrElement.options : {});
6414			/**
6415			 * An array of CSS classes for the cell.
6416			 * @instance
6417			 * @protected
6418			 * @type {Array.<string>}
6419			 */
6420			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) : []));
6421			/**
6422			 * The inline styles for the cell.
6423			 * @instance
6424			 * @protected
6425			 * @type {object}
6426			 */
6427			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) : {}));
6428		},
6429		/**
6430		 * After the cell has been defined this ensures that the $el and #detail properties are jQuery objects by either creating or updating them.
6431		 * @instance
6432		 * @protected
6433		 * @this FooTable.Cell
6434		 */
6435		$create: function(){
6436			if (this.created) return;
6437			/*if(F.is.jq(this.$el))
6438			{*/
6439			(this.$el = F.is.jq(this.$el) ? this.$el : $('<td/>'))
6440				.data('value', this.value)
6441				.contents().detach().end()
6442				.append(this.format(this.value));
6443
6444			this._setClasses(this.$el);
6445			this._setStyle(this.$el);
6446
6447			this.$detail = $('<tr/>').addClass(this.row.classes.join(' '))
6448				.data('__FooTableCell__', this)
6449				.append($('<th/>'))
6450				.append($('<td/>'));
6451			// }
6452			this.created = true;
6453		},
6454		/**
6455		 * Collapses this cell and displays it in the details row.
6456		 * @instance
6457		 * @protected
6458		 */
6459		collapse: function(){
6460			if (!this.created) return;
6461			this.$detail.children('th').html(this.column.title);
6462			this.$el.clone()
6463				.attr('id', this.$el.attr('id') ? this.$el.attr('id') + '-detail' : undefined)
6464				.css('display', 'table-cell')
6465				.html('')
6466				.append(this.$el.contents().detach())
6467				.replaceAll(this.$detail.children('td').first());
6468
6469			if (!F.is.jq(this.$detail.parent()))
6470				this.$detail.appendTo(this.row.$details.find('.footable-details > tbody'));
6471		},
6472		/**
6473		 * Restores this cell from a detail row back into the normal row.
6474		 * @instance
6475		 * @protected
6476		 */
6477		restore: function(){
6478			if (!this.created) return;
6479			if (F.is.jq(this.$detail.parent())){
6480				var $cell = this.$detail.children('td').first();
6481				this.$el
6482					.attr('class', $cell.attr('class'))
6483					.attr('style', $cell.attr('style'))
6484					.css('display', (this.column.hidden || !this.column.visible) ? 'none' : 'table-cell')
6485					.append($cell.contents().detach());
6486			}
6487			this.$detail.detach();
6488		},
6489		/**
6490		 * Helper method to call this cell's column parser function supplying the required parameters.
6491		 * @instance
6492		 * @protected
6493		 * @returns {*}
6494		 * @see FooTable.Column#parser
6495		 * @this FooTable.Cell
6496		 */
6497		parse: function(){
6498			return this.column.parser.call(this.column, this.$el, this.ft.o);
6499		},
6500		/**
6501		 * Helper method to call this cell's column formatter function using the supplied value and any additional required parameters.
6502		 * @instance
6503		 * @protected
6504		 * @param {*} value - The value to format.
6505		 * @returns {(string|HTMLElement|jQuery)}
6506		 * @see FooTable.Column#formatter
6507		 * @this FooTable.Cell
6508		 */
6509		format: function(value){
6510			return this.column.formatter.call(this.column, value, this.ft.o, this.row.value);
6511		},
6512		/**
6513		 * 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.
6514		 * Using this method also allows us to supply an object containing options and the value for the cell.
6515		 * @instance
6516		 * @param {*} [value] - The value to set for the cell. If not supplied the current value of the cell is returned.
6517		 * @param {boolean} [redraw=true] - Whether or not to redraw the row once the value has been set.
6518		 * @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.
6519		 * @returns {(*|undefined)}
6520		 * @this FooTable.Cell
6521		 */
6522		val: function(value, redraw, redrawSelf){
6523			if (F.is.undef(value)){
6524				// get
6525				return this.value;
6526			}
6527			// set
6528			var self = this, hasOptions = F.is.hash(value) && F.is.hash(value.options) && F.is.defined(value.value);
6529			this.o = $.extend(true, {
6530				classes: self.classes,
6531				style: self.style
6532			}, hasOptions ? value.options : {});
6533
6534			this.value = hasOptions ? value.value : value;
6535			this.classes = F.is.array(this.o.classes) ? this.o.classes : (F.is.string(this.o.classes) ? this.o.classes.match(/\S+/g) : []);
6536			this.style = F.is.hash(this.o.style) ? this.o.style : (F.is.string(this.o.style) ? F.css2json(this.o.style) : {});
6537
6538			redrawSelf = F.is.boolean(redrawSelf) ? redrawSelf : true;
6539			if (this.created && redrawSelf){
6540				this.$el.data('value', this.value).empty();
6541
6542				var $detail = this.$detail.children('td').first().empty(),
6543					$target = F.is.jq(this.$detail.parent()) ? $detail : this.$el;
6544
6545				$target.append(this.format(this.value));
6546
6547				this._setClasses($target);
6548				this._setStyle($target);
6549
6550				if (F.is.boolean(redraw) ? redraw : true) this.row.draw();
6551			}
6552		},
6553		_setClasses: function($el){
6554			var hasColClasses = !F.is.emptyArray(this.column.classes),
6555				hasClasses = !F.is.emptyArray(this.classes),
6556				classes = null;
6557			$el.removeAttr('class');
6558			if (!hasColClasses && !hasClasses) return;
6559			if (hasColClasses && hasClasses){
6560				classes = this.classes.concat(this.column.classes).join(' ');
6561			} else if (hasColClasses) {
6562				classes = this.column.classes.join(' ');
6563			} else if (hasClasses){
6564				classes = this.classes.join(' ');
6565			}
6566			if (!F.is.emptyString(classes)){
6567				$el.addClass(classes);
6568			}
6569		},
6570		_setStyle: function($el){
6571			var hasColStyle = !F.is.emptyObject(this.column.style),
6572				hasStyle = !F.is.emptyObject(this.style),
6573				style = null;
6574			$el.removeAttr('style');
6575			if (!hasColStyle && !hasStyle) return;
6576			if (hasColStyle && hasStyle){
6577				style = $.extend({}, this.column.style, this.style);
6578			} else if (hasColStyle) {
6579				style = this.column.style;
6580			} else if (hasStyle){
6581				style = this.style;
6582			}
6583			if (F.is.hash(style)){
6584				$el.css(style);
6585			}
6586		}
6587	});
6588
6589})(jQuery, FooTable);
6590(function($, F){
6591
6592	F.Column = F.Class.extend(/** @lends FooTable.Column */{
6593		/**
6594		 * The column class containing all the properties for columns. All members marked as "readonly" should not be used when defining {@link FooTable.Defaults#columns}.
6595		 * @constructs
6596		 * @extends FooTable.Class
6597		 * @param {FooTable.Table} instance -  The parent {@link FooTable.Table} this component belongs to.
6598		 * @param {object} definition - An object containing all the properties to set for the column.
6599		 * @param {string} [type] - The type of column, "text" by default.
6600		 * @returns {FooTable.Column}
6601		 * @this FooTable.Column
6602		 */
6603		construct: function(instance, definition, type){
6604			/**
6605			 * The root {@link FooTable.Table} for the column.
6606			 * @instance
6607			 * @readonly
6608			 * @type {FooTable.Table}
6609			 */
6610			this.ft = instance;
6611			/**
6612			 * The type of data displayed by the column.
6613			 * @instance
6614			 * @readonly
6615			 * @type {string}
6616			 */
6617			this.type = F.is.emptyString(type) ? 'text' : type;
6618			/**
6619			 * Whether or not the column was parsed from a standard table row containing data instead of from an actual header row.
6620			 * @instance
6621			 * @readonly
6622			 * @type {boolean}
6623			 */
6624			this.virtual = F.is.boolean(definition.virtual) ? definition.virtual : false;
6625			/**
6626			 * The jQuery cell object for the column header.
6627			 * @instance
6628			 * @readonly
6629			 * @type {jQuery}
6630			 */
6631			this.$el = F.is.jq(definition.$el) ? definition.$el : null;
6632			/**
6633			 * The index of the column in the table. This is set by the plugin during initialization.
6634			 * @instance
6635			 * @readonly
6636			 * @type {number}
6637			 * @default -1
6638			 */
6639			this.index = F.is.number(definition.index) ? definition.index : -1;
6640			/**
6641			 * Whether or not this in an internal only column.
6642			 * @instance
6643			 * @readonly
6644			 * @type {boolean}
6645			 * @description Internal columns or there cells will not be returned when calling methods such as `FooTable.Row#val`.
6646			 */
6647			this.internal = false;
6648			this.define(definition);
6649			this.$create();
6650		},
6651		/**
6652		 * 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.
6653		 * @instance
6654		 * @protected
6655		 * @param {object} definition - The object containing the column definition.
6656		 * @this FooTable.Column
6657		 */
6658		define: function(definition){
6659			/**
6660			 * Whether or not this column is hidden from view and appears in the details row.
6661			 * @type {boolean}
6662			 * @default false
6663			 */
6664			this.hidden = F.is.boolean(definition.hidden) ? definition.hidden : false;
6665			/**
6666			 * Whether or not this column is completely hidden from view and will not appear in the details row.
6667			 * @type {boolean}
6668			 * @default true
6669			 */
6670			this.visible = F.is.boolean(definition.visible) ? definition.visible : true;
6671
6672			/**
6673			 * The name of the column. This name must correspond to the property name of the JSON row data.
6674			 * @type {string}
6675			 * @default null
6676			 */
6677			this.name = F.is.string(definition.name) ? definition.name : null;
6678			if (this.name == null) this.name = 'col'+(definition.index+1);
6679			/**
6680			 * The title to display in the column header, this can be HTML.
6681			 * @type {string}
6682			 * @default null
6683			 */
6684			this.title = F.is.string(definition.title) ? definition.title : null;
6685			if (!this.virtual && this.title == null && F.is.jq(this.$el)) this.title = this.$el.html();
6686			if (this.title == null) this.title = 'Column '+(definition.index+1);
6687			/**
6688			 * The styles to apply to all cells in this column.
6689			 * @type {object}
6690			 */
6691			this.style = F.is.hash(definition.style) ? definition.style : (F.is.string(definition.style) ? F.css2json(definition.style) : {});
6692			/**
6693			 * The classes to apply to all cells in this column.
6694			 * @type {Array.<string>}
6695			 */
6696			this.classes = F.is.array(definition.classes) ? definition.classes : (F.is.string(definition.classes) ? definition.classes.match(/\S+/g) : []);
6697
6698			// override any default functions ensuring when they are executed "this" within the context of the function points to the instance of this object.
6699			this.parser = F.checkFnValue(this, definition.parser, this.parser);
6700			this.formatter = F.checkFnValue(this, definition.formatter, this.formatter);
6701		},
6702		/**
6703		 * After the column has been defined this ensures that the $el property is a jQuery object by either creating or updating the current value.
6704		 * @instance
6705		 * @protected
6706		 * @this FooTable.Column
6707		 */
6708		$create: function(){
6709			(this.$el = !this.virtual && F.is.jq(this.$el) ? this.$el : $('<th/>')).html(this.title).addClass(this.classes.join(' ')).css(this.style);
6710		},
6711		/**
6712		 * 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
6713		 * to generate the cell contents.
6714		 * @instance
6715		 * @protected
6716		 * @param {(*|jQuery)} valueOrElement - The value or jQuery cell object.
6717		 * @returns {string}
6718		 * @this FooTable.Column
6719		 */
6720		parser: function(valueOrElement){
6721			if (F.is.element(valueOrElement) || F.is.jq(valueOrElement)){ // use jQuery to get the value
6722				var data = $(valueOrElement).data('value');
6723				return F.is.defined(data) ? data : $(valueOrElement).html();
6724			}
6725			if (F.is.defined(valueOrElement) && valueOrElement != null) return valueOrElement+''; // use the native toString of the value
6726			return null; // otherwise we have no value so return null
6727		},
6728		/**
6729		 * This is supplied the value retrieved from the {@link FooTable.Column#parse} function and must return a string, HTMLElement or jQuery object.
6730		 * The return value from this function is what is displayed in the cell in the table.
6731		 * @instance
6732		 * @protected
6733		 * @param {string} value - The value to format.
6734		 * @param {object} options - The current plugin options.
6735		 * @param {object} rowData - An object containing the current row data.
6736		 * @returns {(string|HTMLElement|jQuery)}
6737		 * @this FooTable.Column
6738		 */
6739		formatter: function(value, options, rowData){
6740			return value == null ? '' : value;
6741		},
6742		/**
6743		 * Creates a cell for this column from the supplied {@link FooTable.Row} object. This allows different column types to return different types of cells.
6744		 * @instance
6745		 * @protected
6746		 * @param {FooTable.Row} row - The row to create the cell from.
6747		 * @returns {FooTable.Cell}
6748		 * @this FooTable.Column
6749		 */
6750		createCell: function(row){
6751			var element = F.is.jq(row.$el) ? row.$el.children('td,th').get(this.index) : null,
6752				data = F.is.hash(row.value) ? row.value[this.name] : null;
6753			return new F.Cell(this.ft, row, this, element || data);
6754		}
6755	});
6756
6757	F.columns = new F.ClassFactory();
6758
6759	F.columns.register('text', F.Column);
6760
6761})(jQuery, FooTable);
6762(function ($, F) {
6763
6764	F.Component = F.Class.extend(/** @lends FooTable.Component */{
6765		/**
6766		 * The base class for all FooTable components.
6767		 * @constructs
6768		 * @extends FooTable.Class
6769		 * @param {FooTable.Table} instance - The parent {@link FooTable.Table} object for the component.
6770		 * @param {boolean} enabled - Whether or not the component is enabled.
6771		 * @throws {TypeError} The instance parameter must be an instance of {@link FooTable.Table}.
6772		 * @returns {FooTable.Component}
6773		 */
6774		construct: function (instance, enabled) {
6775			if (!(instance instanceof F.Table))
6776				throw new TypeError('The instance parameter must be an instance of FooTable.Table.');
6777
6778			/**
6779			 * The parent {@link FooTable.Table} for the component.
6780			 * @type {FooTable.Table}
6781			 */
6782			this.ft = instance;
6783			/**
6784			 * Whether or not this component is enabled. Disabled components only have there preinit method called allowing for this value to be overridden.
6785			 * @type {boolean}
6786			 */
6787			this.enabled = F.is.boolean(enabled) ? enabled : false;
6788		},
6789		/**
6790		 * The preinit method is called during the parent {@link FooTable.Table} constructor call.
6791		 * @param {object} data - The jQuery.data() object of the root table.
6792		 * @instance
6793		 * @protected
6794		 * @function
6795		 */
6796		preinit: function(data){},
6797		/**
6798		 * The init method is called during the parent {@link FooTable.Table} constructor call.
6799		 * @instance
6800		 * @protected
6801		 * @function
6802		 */
6803		init: function(){},
6804		/**
6805		 * This method is called from the {@link FooTable.Table#destroy} method.
6806		 * @instance
6807		 * @protected
6808		 * @function
6809		 */
6810		destroy: function(){},
6811		/**
6812		 * This method is called from the {@link FooTable.Table#draw} method.
6813		 * @instance
6814		 * @protected
6815		 * @function
6816		 */
6817		predraw: function(){},
6818		/**
6819		 * This method is called from the {@link FooTable.Table#draw} method.
6820		 * @instance
6821		 * @protected
6822		 * @function
6823		 */
6824		draw: function(){},
6825		/**
6826		 * This method is called from the {@link FooTable.Table#draw} method.
6827		 * @instance
6828		 * @protected
6829		 * @function
6830		 */
6831		postdraw: function(){}
6832	});
6833
6834	F.components = new F.ClassFactory();
6835
6836})(jQuery, FooTable);
6837(function ($, F) {
6838	/**
6839	 * Contains all the available options for the FooTable plugin.
6840	 * @name FooTable.Defaults
6841	 * @function
6842	 * @constructor
6843	 * @returns {FooTable.Defaults}
6844	 */
6845	F.Defaults = function () {
6846		/**
6847		 * 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
6848		 * 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
6849		 * parent and child would be triggered which is not the desired behavior.
6850		 * @type {boolean}
6851		 * @default false
6852		 */
6853		this.stopPropagation = false;
6854		/**
6855		 * 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).
6856		 * @type {object.<string, function>}
6857		 * @default NULL
6858		 * @example <caption>
6858This example shows how to pass an object containing the events and handlers.</caption>
6859		 * "on": {
6860		 * 	"click": function(e){
6861		 * 		// bind a custom click event to do something whenever the table is clicked
6862		 * 	},
6863		 * 	"init.ft.table": function(e, ft){
6864		 * 		// bind to the FooTable initialize event to do something
6865		 * 	}
6866		 * }
6867		 */
6868		this.on = null;
6869	};
6870
6871	/**
6872	 * Contains all the default options for the plugin.
6873	 * @type {FooTable.Defaults}
6874	 */
6875	F.defaults = new F.Defaults();
6876
6877})(jQuery, FooTable);
6878(function($, F){
6879
6880	F.Row = F.Class.extend(/** @lends FooTable.Row */{
6881		/**
6882		 * The row class containing all the properties for a row and its' cells.
6883		 * @constructs
6884		 * @extends FooTable.Class
6885		 * @param {FooTable.Table} table -  The parent {@link FooTable.Table} this component belongs to.
6886		 * @param {Array.<FooTable.Column>} columns - The array of {@link FooTable.Column} for this row.
6887		 * @param {(*|HTMLElement|jQuery)} dataOrElement - Either the data for the row (create) or the element (parse) for the row.
6888		 * @returns {FooTable.Row}
6889		 */
6890		construct: function (table, columns, dataOrElement) {
6891			/**
6892			 * The {@link FooTable.Table} for the row.
6893			 * @type {FooTable.Table}
6894			 */
6895			this.ft = table;
6896			/**
6897			 * The array of {@link FooTable.Column} for this row.
6898			 * @type {Array.<FooTable.Column>}
6899			 */
6900			this.columns = columns;
6901
6902			this.created = false;
6903			this.define(dataOrElement);
6904		},
6905		/**
6906		 * This is supplied either the object containing the values for the row or the row element/jQuery object if it exists.
6907		 * If supplied the element we need to set the $el property and parse the cells from it using the column index.
6908		 * If we have an object we parse the cells from it using the column name.
6909		 * @param {(object|jQuery)} dataOrElement - The row object or element to define the row.
6910		 */
6911		define: function(dataOrElement){
6912			/**
6913			 * The jQuery table row object this instance wraps.
6914			 * @instance
6915			 * @protected
6916			 * @type {jQuery}
6917			 */
6918			this.$el = F.is.element(dataOrElement) || F.is.jq(dataOrElement) ? $(dataOrElement) : null;
6919			/**
6920			 * The jQuery toggle element for the row.
6921			 * @instance
6922			 * @protected
6923			 * @type {jQuery}
6924			 */
6925			this.$toggle = $('<span/>', {'class': 'footable-toggle fooicon fooicon-plus'});
6926
6927			var isObj = F.is.hash(dataOrElement),
6928				hasOptions = isObj && F.is.hash(dataOrElement.options) && F.is.hash(dataOrElement.value);
6929
6930			/**
6931			 * The value of the row.
6932			 * @instance
6933			 * @protected
6934			 * @type {Object}
6935			 */
6936			this.value = isObj ? (hasOptions ? dataOrElement.value : dataOrElement) : null;
6937
6938			/**
6939			 * Contains any options for the row.
6940			 * @type {object}
6941			 */
6942			this.o = $.extend(true, {
6943				expanded: false,
6944				classes: null,
6945				style: null
6946			}, hasOptions ? dataOrElement.options : {});
6947
6948			/**
6949			 * Whether or not this row is expanded and will display it's detail row when there are any hidden columns.
6950			 * @instance
6951			 * @protected
6952			 * @type {boolean}
6953			 */
6954			this.expanded = F.is.jq(this.$el) ? (this.$el.data('expanded') || this.o.expanded) : this.o.expanded;
6955			/**
6956			 * An array of CSS classes for the row.
6957			 * @instance
6958			 * @protected
6959			 * @type {Array.<string>}
6960			 */
6961			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) : []));
6962			/**
6963			 * The inline styles for the row.
6964			 * @instance
6965			 * @protected
6966			 * @type {object}
6967			 */
6968			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) : {}));
6969
6970			/**
6971			 * The cells array. This is populated before the call to the {@link FooTable.Row#$create} method.
6972			 * @instance
6973			 * @type {Array.<FooTable.Cell>}
6974			 */
6975			this.cells = this.createCells();
6976
6977			// this ensures the value contains the parsed cell values and not the supplied values
6978			var self = this;
6979			self.value = {};
6980			F.arr.each(self.cells, function(cell){
6981				self.value[cell.column.name] = cell.val();
6982			});
6983		},
6984		/**
6985		 * After the row has been defined this ensures that the $el property is a jQuery object by either creating or updating the current value.
6986		 * @instance
6987		 * @protected
6988		 * @this FooTable.Row
6989		 */
6990		$create: function(){
6991			if (this.created) return;
6992			(this.$el = F.is.jq(this.$el) ? this.$el : $('<tr/>'))
6993				.data('__FooTableRow__', this);
6994
6995			this._setClasses(this.$el);
6996			this._setStyle(this.$el);
6997
6998			if (this.ft.rows.toggleColumn == 'last') this.$toggle.addClass('last-column');
6999
7000			this.$details = $('<tr/>', { 'class': 'footable-detail-row' })
7001				.append($('<td/>', { colspan: this.ft.columns.visibleColspan })
7002					.append($('<table/>', { 'class': 'footable-details ' + this.ft.classes.join(' ') })
7003						.append('<tbody/>')));
7004
7005			var self = this;
7006			F.arr.each(self.cells, function(cell){
7007				if (!cell.created) cell.$create();
7008				self.$el.append(cell.$el);
7009			});
7010			self.$el.off('click.ft.row').on('click.ft.row', { self: self }, self._onToggle);
7011			this.created = true;
7012		},
7013		/**
7014		 * 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.
7015		 * @instance
7016		 * @protected
7017		 * @returns {Array.<FooTable.Cell>}
7018		 * @this FooTable.Row
7019		 */
7020		createCells: function(){
7021			var self = this;
7022			return F.arr.map(self.columns, function(col){
7023				return col.createCell(self);
7024			});
7025		},
7026		/**
7027		 * 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.
7028		 * Using this method also allows us to supply an object containing options and the data for the row at the same time.
7029		 * @instance
7030		 * @param {object} [data] - The data to set for the row. If not supplied the current value of the row is returned.
7031		 * @param {boolean} [redraw=true] - Whether or not to redraw the table once the value has been set.
7032		 * @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.
7033		 * @returns {(*|undefined)}
7034		 */
7035		val: function(data, redraw, redrawSelf){
7036			var self = this;
7037			if (!F.is.hash(data)){
7038				// get - check the value property and build it from the cells if required.
7039				if (!F.is.hash(this.value) || F.is.emptyObject(this.value)){
7040					this.value = {};
7041					F.arr.each(this.cells, function(cell){
7042						if (!cell.column.internal){
7043							self.value[cell.column.name] = cell.val();
7044						}
7045					});
7046				}
7047				return this.value;
7048			}
7049			// set
7050			this.collapse(false);
7051			var isObj = F.is.hash(data),
7052				hasOptions = isObj && F.is.hash(data.options) && F.is.hash(data.value);
7053
7054			this.o = $.extend(true, {
7055				expanded: self.expanded,
7056				classes: self.classes,
7057				style: self.style
7058			}, hasOptions ? data.options : {});
7059
7060			this.expanded = this.o.expanded;
7061			this.classes = F.is.array(this.o.classes) ? this.o.classes : (F.is.string(this.o.classes) ? this.o.classes.match(/\S+/g) : []);
7062			this.style = F.is.hash(this.o.style) ? this.o.style : (F.is.string(this.o.style) ? F.css2json(this.o.style) : {});
7063			if (isObj) {
7064				if ( hasOptions ) data = data.value;
7065				if (F.is.hash(this.value)){
7066					for (var prop in data) {
7067						if (!data.hasOwnProperty(prop)) continue;
7068						this.value[prop] = data[prop];
7069					}
7070				} else {
7071					this.value = data;
7072				}
7073			} else {
7074				this.value = null;
7075			}
7076
7077			redrawSelf = F.is.boolean(redrawSelf) ? redrawSelf : true;
7078			F.arr.each(this.cells, function(cell){
7079				if (!cell.column.internal && F.is.defined(self.value[cell.column.name])){
7080					cell.val(self.value[cell.column.name], false, redrawSelf);
7081				}
7082			});
7083
7084			if (this.created && redrawSelf){
7085				this._setClasses(this.$el);
7086				this._setStyle(this.$el);
7087				if (F.is.boolean(redraw) ? redraw : true) this.draw();
7088			}
7089		},
7090		_setClasses: function($el){
7091			var hasClasses = !F.is.emptyArray(this.classes),
7092				classes = null;
7093			$el.removeAttr('class');
7094			if (!hasClasses) return;
7095			else classes = this.classes.join(' ');
7096			if (!F.is.emptyString(classes)){
7097				$el.addClass(classes);
7098			}
7099		},
7100		_setStyle: function($el){
7101			var hasStyle = !F.is.emptyObject(this.style),
7102				style = null;
7103			$el.removeAttr('style');
7104			if (!hasStyle) return;
7105			else style = this.style;
7106			if (F.is.hash(style)){
7107				$el.css(style);
7108			}
7109		},
7110		/**
7111		 * Sets the current row to an expanded state displaying any hidden columns in a detail row just below it.
7112		 * @instance
7113		 * @fires FooTable.Row#"expand.ft.row"
7114		 */
7115		expand: function(){
7116			if (!this.created) return;
7117			var self = this;
7118			/**
7119			 * The expand.ft.row event is raised before the the row is expanded.
7120			 * Calling preventDefault on this event will stop the row being expanded.
7121			 * @event FooTable.Row#"expand.ft.row"
7122			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
7123			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
7124			 * @param {FooTable.Row} row - The row about to be expanded.
7125			 */
7126			self.ft.raise('expand.ft.row',[self]).then(function(){
7127				self.__hidden__ = F.arr.map(self.cells, function(cell){
7128					return cell.column.hidden && cell.column.visible ? cell : null;
7129				});
7130
7131				if (self.__hidden__.length > 0){
7132					self.$details.insertAfter(self.$el)
7133						.children('td').first()
7134						.attr('colspan', self.ft.columns.visibleColspan);
7135
7136					F.arr.each(self.__hidden__, function(cell){
7137						cell.collapse();
7138					});
7139				}
7140				self.$el.attr('data-expanded', true);
7141				self.$toggle.removeClass('fooicon-plus').addClass('fooicon-minus');
7142				self.expanded = true;
7143				self.ft.raise('expanded.ft.row', [self]);
7144			});
7145		},
7146		/**
7147		 * Sets the current row to a collapsed state removing the detail row if it exists.
7148		 * @instance
7149		 * @param {boolean} [setExpanded] - Whether or not to set the {@link FooTable.Row#expanded} property to false.
7150		 * @fires FooTable.Row#"collapse.ft.row"
7151		 */
7152		collapse: function(setExpanded){
7153			if (!this.created) return;
7154			var self = this;
7155			/**
7156			 * The collapse.ft.row event is raised before the the row is collapsed.
7157			 * Calling preventDefault on this event will stop the row being collapsed.
7158			 * @event FooTable.Row#"collapse.ft.row"
7159			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
7160			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
7161			 * @param {FooTable.Row} row - The row about to be expanded.
7162			 */
7163			self.ft.raise('collapse.ft.row',[self]).then(function(){
7164				F.arr.each(self.__hidden__, function(cell){
7165					cell.restore();
7166				});
7167				self.$details.detach();
7168				self.$el.removeAttr('data-expanded');
7169				self.$toggle.removeClass('fooicon-minus').addClass('fooicon-plus');
7170				if (F.is.boolean(setExpanded) ? setExpanded : true) self.expanded = false;
7171				self.ft.raise('collapsed.ft.row', [self]);
7172			});
7173		},
7174		/**
7175		 * Prior to drawing this moves the details contents back to there original cells and detaches the toggle element from the row.
7176		 * @instance
7177		 * @param {boolean} [detach] - Whether or not to detach the row.
7178		 * @this FooTable.Row
7179		 */
7180		predraw: function(detach){
7181			if (this.created){
7182				if (this.expanded){
7183					this.collapse(false);
7184				}
7185				this.$toggle.detach();
7186				detach = F.is.boolean(detach) ? detach : true;
7187				if (detach) this.$el.detach();
7188			}
7189		},
7190		/**
7191		 * Draws the current row and cells.
7192		 * @instance
7193		 * @this FooTable.Row
7194		 */
7195		draw: function($parent){
7196			if (!this.created) this.$create();
7197			if (F.is.jq($parent)) $parent.append(this.$el);
7198			var self = this;
7199			F.arr.each(self.cells, function(cell){
7200				cell.$el.css('display', (cell.column.hidden || !cell.column.visible  ? 'none' : 'table-cell'));
7201				if (self.ft.rows.showToggle && self.ft.columns.hasHidden){
7202					if ((self.ft.rows.toggleColumn == 'first' && cell.column.index == self.ft.columns.firstVisibleIndex)
7203						|| (self.ft.rows.toggleColumn == 'last' && cell.column.index == self.ft.columns.lastVisibleIndex)) {
7204						cell.$el.prepend(self.$toggle);
7205					}
7206				}
7207				cell.$el.add(cell.column.$el).removeClass('footable-first-visible footable-last-visible');
7208				if (cell.column.index == self.ft.columns.firstVisibleIndex){
7209					cell.$el.add(cell.column.$el).addClass('footable-first-visible');
7210				}
7211				if (cell.column.index == self.ft.columns.lastVisibleIndex){
7212					cell.$el.add(cell.column.$el).addClass('footable-last-visible');
7213				}
7214			});
7215			if (this.expanded){
7216				this.expand();
7217			}
7218		},
7219		/**
7220		 * Toggles the row between it's expanded and collapsed state if there are hidden columns.
7221		 * @instance
7222		 * @this FooTable.Row
7223		 */
7224		toggle: function(){
7225			if (this.created && this.ft.columns.hasHidden){
7226				if (this.expanded) this.collapse();
7227				else this.expand();
7228			}
7229		},
7230		/**
7231		 * Handles the toggle click event for rows.
7232		 * @instance
7233		 * @param {jQuery.Event} e - The jQuery.Event object for the click event.
7234		 * @private
7235		 * @this jQuery
7236		 */
7237		_onToggle: function (e) {
7238			var self = e.data.self;
7239			// only execute the toggle if the event.target is one of the approved initiators
7240			if ($(e.target).is(self.ft.rows.toggleSelector)){
7241				self.toggle();
7242			}
7243		}
7244	});
7245
7246})(jQuery, FooTable);
7247
7248(function ($, F) {
7249
7250	/**
7251	 * An array of all currently loaded instances of the plugin.
7252	 * @protected
7253	 * @readonly
7254	 * @type {Array.<FooTable.Table>}
7255	 */
7256	F.instances = [];
7257
7258	F.Table = F.Class.extend(/** @lends FooTable.Table */{
7259		/**
7260		 * This class is the core of the plugin and drives the logic of all components.
7261		 * @constructs
7262		 * @this FooTable.Table
7263		 * @extends FooTable.Class
7264		 * @param {(HTMLTableElement|jQuery)} element - The element or jQuery table object to bind the plugin to.
7265		 * @param {object} options - The options to initialize the plugin with.
7266		 * @param {function} [ready] - A callback function to execute once the plugin is initialized.
7267		 * @returns {FooTable.Table}
7268		 */
7269		construct: function (element, options, ready) {
7270			//BEGIN MEMBERS
7271			/**
7272			 * The timeout ID for the resize event.
7273			 * @instance
7274			 * @private
7275			 * @type {?number}
7276			 */
7277			this._resizeTimeout = null;
7278			/**
7279			 * The ID of the FooTable instance.
7280			 * @instance
7281			 * @type {number}
7282			 */
7283			this.id = F.instances.push(this);
7284			/**
7285			 * Whether or not the plugin and all components and add-ons are fully initialized.
7286			 * @instance
7287			 * @type {boolean}
7288			 */
7289			this.initialized = false;
7290			/**
7291			 * The jQuery table object the plugin is bound to.
7292			 * @instance
7293			 * @type {jQuery}
7294			 */
7295			this.$el = (F.is.jq(element) ? element : $(element)).first(); // ensure one table, one instance
7296			/**
7297			 * A loader jQuery instance
7298			 * @instance
7299			 * @type {jQuery}
7300			 */
7301			this.$loader = $('<div/>', { 'class': 'footable-loader' }).append($('<span/>', {'class': 'fooicon fooicon-loader'}));
7302			/**
7303			 * The options for the plugin. This is a merge of user defined options and the default options.
7304			 * @instance
7305			 * @type {object}
7306			 */
7307			this.o = $.extend(true, {}, F.defaults, options);
7308			/**
7309			 * The jQuery data object for the table at initialization.
7310			 * @instance
7311			 * @type {object}
7312			 */
7313			this.data = this.$el.data() || {};
7314			/**
7315			 * An array of all CSS classes on the table that do not start with "footable".
7316			 * @instance
7317			 * @protected
7318			 * @type {Array.<string>}
7319			 */
7320			this.classes = [];
7321			/**
7322			 * 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.
7323			 * @instance
7324			 * @protected
7325			 * @type {object}
7326			 * @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.
7327			 * @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.
7328			 * @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.
7329			 */
7330			this.components = F.components.load((F.is.hash(this.data.components) ? this.data.components : this.o.components), this);
7331			/**
7332			 * The breakpoints component for this instance of the plugin.
7333			 * @instance
7334			 * @type {FooTable.Breakpoints}
7335			 */
7336			this.breakpoints = this.use(FooTable.Breakpoints);
7337			/**
7338			 * The columns component for this instance of the plugin.
7339			 * @instance
7340			 * @type {FooTable.Columns}
7341			 */
7342			this.columns = this.use(FooTable.Columns);
7343			/**
7344			 * The rows component for this instance of the plugin.
7345			 * @instance
7346			 * @type {FooTable.Rows}
7347			 */
7348			this.rows = this.use(FooTable.Rows);
7349
7350			//END MEMBERS
7351			this._construct(ready);
7352		},
7353		/**
7354		 * Once all properties are set this performs the actual initialization of the plugin calling the {@link FooTable.Table#_preinit} and
7355		 * {@link FooTable.Table#_init} methods as well as raising the {@link FooTable.Table#"ready.ft.table"} event.
7356		 * @this FooTable.Table
7357		 * @instance
7358		 * @param {function} [ready] - A callback function to execute once the plugin is initialized.
7359		 * @private
7360		 * @returns {jQuery.Promise}
7361		 * @fires FooTable.Table#"ready.ft.table"
7362		 */
7363		_construct: function(ready){
7364			var self = this;
7365			return this._preinit().then(function(){
7366				return self._init().then(function(){
7367					/**
7368					 * The ready.ft.table event is raised after the plugin has been initialized and the table drawn.
7369					 * Calling preventDefault on this event will stop the ready callback being executed.
7370					 * @event FooTable.Table#"ready.ft.table"
7371					 * @param {jQuery.Event} e - The jQuery.Event object for the event.
7372					 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
7373					 */
7374					return self.raise('ready.ft.table').then(function(){
7375						if (F.is.fn(ready)) ready.call(self, self);
7376					});
7377				});
7378			}).always(function(arg){
7379				self.$el.show();
7380				if (F.is.error(arg)){
7381					console.error('FooTable: unhandled error thrown during initialization.', arg);
7382				}
7383			});
7384		},
7385		/**
7386		 * 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.
7387		 * @instance
7388		 * @private
7389		 * @returns {jQuery.Promise}
7390		 * @fires FooTable.Table#"preinit.ft.table"
7391		 */
7392		_preinit: function(){
7393			var self = this;
7394			/**
7395			 * The preinit.ft.table event is raised before any components.
7396			 * Calling preventDefault on this event will disable the entire plugin.
7397			 * @event FooTable.Table#"preinit.ft.table"
7398			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
7399			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
7400			 * @param {object} data - The jQuery data object from the root table element.
7401			 */
7402			return this.raise('preinit.ft.table', [self.data]).then(function(){
7403				var classes = (self.$el.attr('class') || '').match(/\S+/g) || [];
7404
7405				self.o.ajax = F.checkFnValue(self, self.data.ajax, self.o.ajax);
7406				self.o.stopPropagation = F.is.boolean(self.data.stopPropagation)
7407					? self.data.stopPropagation
7408					: self.o.stopPropagation;
7409
7410				for (var i = 0, len = classes.length; i < len; i++){
7411					if (!F.str.startsWith(classes[i], 'footable')) self.classes.push(classes[i]);
7412				}
7413
7414				self.$el.hide().after(self.$loader);
7415				return self.execute(false, false, 'preinit', self.data);
7416			});
7417		},
7418		/**
7419		 * Initializes this instance of the plugin and calls the callback function if one is supplied once complete.
7420		 * @this FooTable.Table
7421		 * @instance
7422		 * @private
7423		 * @return {jQuery.Promise}
7424		 * @fires FooTable.Table#"init.ft.table"
7425		 */
7426		_init: function(){
7427			var self = this;
7428			/**
7429			 * The init.ft.table event is raised before any components are initialized.
7430			 * Calling preventDefault on this event will disable the entire plugin.
7431			 * @event FooTable.Table#"init.ft.table"
7432			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
7433			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
7434			 */
7435			return self.raise('init.ft.table').then(function(){
7436				var $thead = self.$el.children('thead'),
7437					$tbody = self.$el.children('tbody'),
7438					$tfoot = self.$el.children('tfoot');
7439				self.$el.addClass('footable footable-' + self.id);
7440				if (F.is.hash(self.o.on)) self.$el.on(self.o.on);
7441				if ($tfoot.length == 0) self.$el.append($tfoot = $('<tfoot/>'));
7442				if ($tbody.length == 0) self.$el.append('<tbody/>');
7443				if ($thead.length == 0) self.$el.prepend($thead = $('<thead/>'));
7444				return self.execute(false, true, 'init').then(function(){
7445					self.$el.data('__FooTable__', self);
7446					if ($tfoot.children('tr').length == 0) $tfoot.remove();
7447					if ($thead.children('tr').length == 0) $thead.remove();
7448
7449					/**
7450					 * The postinit.ft.table event is raised after any components are initialized but before the table is
7451					 * drawn for the first time.
7452					 * Calling preventDefault on this event will disable the initial drawing of the table.
7453					 * @event FooTable.Table#"postinit.ft.table"
7454					 * @param {jQuery.Event} e - The jQuery.Event object for the event.
7455					 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
7456					 */
7457					return self.raise('postinit.ft.table').then(function(){
7458						return self.draw();
7459					}).always(function(){
7460						$(window).off('resize.ft'+self.id, self._onWindowResize)
7461							.on('resize.ft'+self.id, { self: self }, self._onWindowResize);
7462						self.initialized = true;
7463					});
7464				});
7465			});
7466		},
7467		/**
7468		 * Destroys this plugin removing it from the table.
7469		 * @this FooTable.Table
7470		 * @instance
7471		 * @fires FooTable.Table#"destroy.ft.table"
7472		 */
7473		destroy: function () {
7474			var self = this;
7475			/**
7476			 * The destroy.ft.table event is called before all core components.
7477			 * Calling preventDefault on this event will prevent the entire plugin from being destroyed.
7478			 * @event FooTable.Table#"destroy.ft.table"
7479			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
7480			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
7481			 */
7482			return self.raise('destroy.ft.table').then(function(){
7483				return self.execute(true, true, 'destroy').then(function () {
7484					self.$el.removeData('__FooTable__').removeClass('footable-' + self.id);
7485					if (F.is.hash(self.o.on)) self.$el.off(self.o.on);
7486					$(window).off('resize.ft'+self.id, self._onWindowResize);
7487					self.initialized = false;
7488					F.instances[self.id] = null;
7489				});
7490			}).fail(function(err){
7491				if (F.is.error(err)){
7492					console.error('FooTable: unhandled error thrown while destroying the plugin.', err);
7493				}
7494			});
7495		},
7496		/**
7497		 * Raises an event on this instance supplying the args array as additional parameters to the handlers.
7498		 * @this FooTable.Table
7499		 * @instance
7500		 * @param {string} eventName - The name of the event to raise, this can include namespaces.
7501		 * @param {Array} [args] - An array containing additional parameters to be passed to any boun
7501d handlers.
7502		 * @returns {jQuery.Event}
7503		 */
7504		raise: function(eventName, args){
7505			var self = this,
7506				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); }));
7507			args = args || [];
7508			args.unshift(this);
7509			return $.Deferred(function(d){
7510				var evt = $.Event(eventName);
7511				if (self.o.stopPropagation == true){
7512					self.$el.one(eventName, function (e) {e.stopPropagation();});
7513				}
7514				if (debug) console.log('FooTable:'+eventName+': ', args);
7515				self.$el.trigger(evt, args);
7516				if (evt.isDefaultPrevented()){
7517					if (debug) console.log('FooTable: default prevented for the "'+eventName+'" event.');
7518					d.reject(evt);
7519				}	else d.resolve(evt);
7520			});
7521		},
7522		/**
7523		 * Attempts to retrieve the instance of the supplied component type for this instance.
7524		 * @this FooTable.Table
7525		 * @instance
7526		 * @param {object} type - The content type to retrieve for this instance.
7527		 * @returns {(*|null)}
7528		 */
7529		use: function(type){
7530			for (var i = 0, len = this.components.length; i < len; i++){
7531				if (this.components[i] instanceof type) return this.components[i];
7532			}
7533			return null;
7534		},
7535		/**
7536		 * Performs the drawing of the table.
7537		 * @this FooTable.Table
7538		 * @instance
7539		 * @protected
7540		 * @returns {jQuery.Promise}
7541		 * @fires FooTable.Table#"predraw.ft.table"
7542		 * @fires FooTable.Table#"draw.ft.table"
7543		 * @fires FooTable.Table#"postdraw.ft.table"
7544		 */
7545		draw: function () {
7546			var self = this;
7547
7548			// Clone the current table and insert it into the original's place
7549			var $elCopy = self.$el.clone().insertBefore(self.$el);
7550
7551			// Detach `self.$el` from the DOM, retaining its event handlers
7552			self.$el.detach();
7553
7554			// when drawing the order that the components are executed is important so chain the methods but use promises to retain async safety.
7555			return self.execute(false, true, 'predraw').then(function(){
7556				/**
7557				 * 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.
7558				 * @event FooTable.Table#"predraw.ft.table"
7559				 * @param {jQuery.Event} e - The jQuery.Event object for the event.
7560				 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
7561				 */
7562				return self.raise('predraw.ft.table').then(function(){
7563					return self.execute(false, true, 'draw').then(function(){
7564						/**
7565						 * The draw.ft.table event is raised after all core components and add-ons have executed there draw functions.
7566						 * @event FooTable.Table#"draw.ft.table"
7567						 * @param {jQuery.Event} e - The jQuery.Event object for the event.
7568						 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
7569						 */
7570						return self.raise('draw.ft.table').then(function(){
7571							return self.execute(false, true, 'postdraw').then(function(){
7572								/**
7573								 * The postdraw.ft.table event is raised after all core components and add-ons have executed there postdraw functions.
7574								 * @event FooTable.Table#"postdraw.ft.table"
7575								 * @param {jQuery.Event} e - The jQuery.Event object for the event.
7576								 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
7577								 */
7578								return self.raise('postdraw.ft.table');
7579							});
7580						});
7581					});
7582				});
7583			}).fail(function(err){
7584				if (F.is.error(err)){
7585					console.error('FooTable: unhandled error thrown during a draw operation.', err);
7586				}
7587			}).always(function(){
7588				// Replace the copy that we added above with the modified `self.$el`
7589				$elCopy.replaceWith(self.$el);
7590				self.$loader.remove();
7591			});
7592		},
7593		/**
7594		 * 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.
7595		 * @this FooTable.Table
7596		 * @instance
7597		 * @protected
7598		 * @param {boolean} reverse - Whether or not to execute the component methods in the reverse order to what they were registered in.
7599		 * @param {boolean} enabled - Whether or not to execute the method on enabled components only.
7600		 * @param {string} methodName - The name of the method to execute.
7601		 * @param {*} [param1] - The first parameter for the method.
7602		 * @param {...*} [paramN] - Any number of additional parameters for the method.
7603		 * @returns {jQuery.Promise}
7604		 */
7605		execute: function(reverse, enabled, methodName, param1, paramN){
7606			var self = this, args = Array.prototype.slice.call(arguments);
7607			reverse = args.shift();
7608			enabled = args.shift();
7609			var components = enabled ? F.arr.get(self.components, function(c){ return c.enabled; }) : self.components.slice(0);
7610			args.unshift(reverse ? components.reverse() : components);
7611			return self._execute.apply(self, args);
7612		},
7613		/**
7614		 * Executes the specified method with the optional number of parameters on all supplied components waiting for the result of each before executing the next.
7615		 * @this FooTable.Table
7616		 * @instance
7617		 * @private
7618		 * @param {Array.<FooTable.Component>} components - The components to call the method on.
7619		 * @param {string} methodName - The name of the method to execute
7620		 * @param {*} [param1] - The first parameter for the method.
7621		 * @param {...*} [paramN] - Any additional parameters for the method.
7622		 * @returns {jQuery.Promise}
7623		 */
7624		_execute: function(components, methodName, param1, paramN){
7625			if (!components || !components.length) return $.when();
7626			var self = this, args = Array.prototype.slice.call(arguments),
7627				component;
7628			components = args.shift();
7629			methodName = args.shift();
7630			component = components.shift();
7631
7632			if (!F.is.fn(component[methodName]))
7633				return self._execute.apply(self, [components, methodName].concat(args));
7634
7635			return $.Deferred(function(d){
7636				try {
7637					var result = component[methodName].apply(component, args);
7638					if (F.is.promise(result)){
7639						return result.then(d.resolve, d.reject);
7640					} else {
7641						d.resolve(result);
7642					}
7643				} catch (err) {
7644					d.reject(err);
7645				}
7646			}).then(function(){
7647				return self._execute.apply(self, [components, methodName].concat(args));
7648			});
7649		},
7650		/**
7651		 * Listens to the window resize event and performs a check to see if the breakpoint has changed.
7652		 * @this window
7653		 * @instance
7654		 * @private
7655		 * @fires FooTable.Table#"resize.ft.table"
7656		 */
7657		_onWindowResize: function (e) {
7658			var self = e.data.self;
7659			if (self._resizeTimeout != null) { clearTimeout(self._resizeTimeout); }
7660			self._resizeTimeout = setTimeout(function () {
7661				self._resizeTimeout = null;
7662				/**
7663				 * The resize event is raised a short time after window resize operations cease.
7664				 * @event FooTable.Table#"resize.ft.table"
7665				 * @param {jQuery.Event} e - The jQuery.Event object for the event.
7666				 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
7667				 */
7668				self.raise('resize.ft.table').then(function(){
7669					self.breakpoints.check();
7670				});
7671			}, 300);
7672		}
7673	});
7674
7675})(jQuery, FooTable);
7676(function($, F){
7677
7678	F.ArrayColumn = F.Column.extend(/** @lends FooTable.ArrayColumn */{
7679		/**
7680		 * @summary A column to handle Array values.
7681		 * @constructs
7682		 * @extends FooTable.Column
7683		 * @param {FooTable.Table} instance -  The parent {@link FooTable.Table} this column belongs to.
7684		 * @param {object} definition - An object containing all the properties to set for the column.
7685		 */
7686		construct: function(instance, definition) {
7687			this._super(instance, definition, 'array');
7688		},
7689		/**
7690		 * @summary Parses the supplied value or element to retrieve a column value.
7691		 * @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.
7692		 * @instance
7693		 * @protected
7694		 * @param {(*|jQuery)} valueOrElement - The value or jQuery cell object.
7695		 * @returns {(array|null)}
7696		 */
7697		parser: function(valueOrElement){
7698			if (F.is.element(valueOrElement) || F.is.jq(valueOrElement)){ // use jQuery to get the value
7699				var $el = $(valueOrElement), data = $el.data('value'); // .data() will automatically convert a JSON string to an array
7700				if (F.is.array(data)) return data;
7701				data = $el.html();
7702				try {
7703					data = JSON.parse(data);
7704				} catch(err) {
7705					data = null;
7706				}
7707				return F.is.array(data) ? data : null; // if we have an array return it
7708			}
7709			if (F.is.array(valueOrElement)) return valueOrElement; // if we have an array return it
7710			return null; // otherwise we have no value so return null
7711		},
7712		/**
7713		 * @summary Formats the column value and creates the HTML seen within a cell.
7714		 * @description This is supplied the value retrieved from the {@link FooTable.ArrayColumn#parser} function and must return a string, HTMLElement or jQuery object.
7715		 * The return value from this function is what is displayed in the cell in the table.
7716		 * @instance
7717		 * @protected
7718		 * @param {?Array} value - The value to format.
7719		 * @param {object} options - The current plugin options.
7720		 * @param {object} rowData - An object containing the current row data.
7721		 * @returns {(string|HTMLElement|jQuery)}
7722		 */
7723		formatter: function(value, options, rowData){
7724			return F.is.array(value) ? JSON.stringify(value) : '';
7725		}
7726	});
7727
7728	F.columns.register('array', F.ArrayColumn);
7729
7730})(jQuery, FooTable);
7731(function($, F){
7732
7733	if (F.is.undef(window.moment)){
7734		// The DateColumn requires moment.js to parse and format date values. Goto http://momentjs.com/ to get it.
7735		return;
7736	}
7737
7738	F.DateColumn = F.Column.extend(/** @lends FooTable.DateColumn */{
7739		/**
7740		 * 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.
7741		 * @constructs
7742		 * @extends FooTable.Column
7743		 * @param {FooTable.Table} instance -  The parent {@link FooTable.Table} this column belongs to.
7744		 * @param {object} definition - An object containing all the properties to set for the column.
7745		 * @returns {FooTable.DateColumn}
7746		 */
7747		construct: function(instance, definition){
7748			this._super(instance, definition, 'date');
7749			/**
7750			 * The format string to use when parsing and formatting dates.
7751			 * @instance
7752			 * @type {string}
7753			 */
7754			this.formatString = F.is.string(definition.formatString) ? definition.formatString : 'MM-DD-YYYY';
7755		},
7756		/**
7757		 * 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
7758		 * to generate the cell contents.
7759		 * @instance
7760		 * @protected
7761		 * @param {(*|jQuery)} valueOrElement - The value or jQuery cell object.
7762		 * @returns {(moment|null)}
7763		 * @this FooTable.DateColumn
7764		 */
7765		parser: function(valueOrElement){
7766			if (F.is.element(valueOrElement) || F.is.jq(valueOrElement)){
7767				var data = $(valueOrElement).data('value');
7768				valueOrElement = F.is.defined(data) ? data : $(valueOrElement).text();
7769				if (F.is.string(valueOrElement)) valueOrElement = isNaN(valueOrElement) ? valueOrElement : +valueOrElement;
7770			}
7771			if (F.is.date(valueOrElement)) return moment(valueOrElement);
7772			if (F.is.object(valueOrElement) && F.is.boolean(valueOrElement._isAMomentObject)) return valueOrElement;
7773			if (F.is.string(valueOrElement)){
7774				// if it looks like a number convert it and do nothing else otherwise create a new moment using the string value and formatString
7775				if (isNaN(valueOrElement)){
7776					return moment(valueOrElement, this.formatString);
7777				} else {
7778					valueOrElement = +valueOrElement;
7779				}
7780			}
7781			if (F.is.number(valueOrElement)){
7782				return moment(valueOrElement);
7783			}
7784			return null;
7785		},
7786		/**
7787		 * This is supplied the value retrieved from the {@link FooTable.DateColumn#parser} function and must return a string, HTMLElement or jQuery object.
7788		 * The return value from this function is what is displayed in the cell in the table.
7789		 * @instance
7790		 * @protected
7791		 * @param {*} value - The value to format.
7792		 * @param {object} options - The current plugin options.
7793		 * @param {object} rowData - An object containing the current row data.
7794		 * @returns {(string|HTMLElement|jQuery)}
7795		 * @this FooTable.DateColumn
7796		 */
7797		formatter: function(value, options, rowData){
7798			return F.is.object(value) && F.is.boolean(value._isAMomentObject) && value.isValid() ? value.format(this.formatString) : '';
7799		},
7800		/**
7801		 * 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.
7802		 * @param {(*|jQuery)} valueOrElement - The value or jQuery cell object.
7803		 * @returns {string}
7804		 * @this FooTable.DateColumn
7805		 */
7806		filterValue: function(valueOrElement){
7807			// if we have an element or a jQuery object use jQuery to get the value
7808			if (F.is.element(valueOrElement) || F.is.jq(valueOrElement)) valueOrElement = $(valueOrElement).data('filterValue') || $(valueOrElement).text();
7809			// if options are supplied with the value
7810			if (F.is.hash(valueOrElement) && F.is.hash(valueOrElement.options)){
7811				if (F.is.string(valueOrElement.options.filterValue)) valueOrElement = valueOrElement.options.filterValue;
7812				if (F.is.defined(valueOrElement.value)) valueOrElement = valueOrElement.value;
7813			}
7814			// if the value is a moment object just return the formatted value
7815			if (F.is.object(valueOrElement) && F.is.boolean(valueOrElement._isAMomentObject)) return valueOrElement.format(this.formatString);
7816			// if its a string
7817			if (F.is.string(valueOrElement)){
7818				// if its not a number return it
7819				if (isNaN(valueOrElement)){
7820					return valueOrElement;
7821				} else { // otherwise convert it and carry on
7822					valueOrElement = +valueOrElement;
7823				}
7824			}
7825			// if the value is a number or date convert to a moment object and return the formatted result.
7826			if (F.is.number(valueOrElement) || F.is.date(valueOrElement)){
7827				return moment(valueOrElement).format(this.formatString);
7828			}
7829			// try use the native toString of the value if its not undefined or null
7830			if (F.is.defined(valueOrElement) && valueOrElement != null) return valueOrElement+'';
7831			return ''; // otherwise we have no value so return an empty string
7832		}
7833	});
7834
7835	F.columns.register('date', F.DateColumn);
7836
7837})(jQuery, FooTable);
7838
7839(function($, F){
7840
7841	F.HTMLColumn = F.Column.extend(/** @lends FooTable.HTMLColumn */{
7842		/**
7843		 * The HTML column class is used to handle any raw HTML columns.
7844		 * @constructs
7845		 * @extends FooTable.Column
7846		 * @param {FooTable.Table} instance -  The parent {@link FooTable.Table} this column belongs to.
7847		 * @param {object} definition - An object containing all the properties to set for the column.
7848		 * @returns {FooTable.HTMLColumn}
7849		 */
7850		construct: function(instance, definition){
7851			this._super(instance, definition, 'html');
7852		},
7853		/**
7854		 * 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
7855		 * to generate the cell contents.
7856		 * @instance
7857		 * @protected
7858		 * @param {(*|jQuery)} valueOrElement - The value or jQuery cell object.
7859		 * @returns {(jQuery|null)}
7860		 * @this FooTable.HTMLColumn
7861		 */
7862		parser: function(valueOrElement){
7863			if (F.is.string(valueOrElement)) valueOrElement = $($.trim(valueOrElement));
7864			if (F.is.element(valueOrElement)) valueOrElement = $(valueOrElement);
7865			if (F.is.jq(valueOrElement)){
7866				var tagName = valueOrElement.prop('tagName').toLowerCase();
7867				if (tagName == 'td' || tagName == 'th'){
7868					var data = valueOrElement.data('value');
7869					return F.is.defined(data) ? data : valueOrElement.contents();
7870				}
7871				return valueOrElement;
7872			}
7873			return null;
7874		}
7875	});
7876
7877	F.columns.register('html', F.HTMLColumn);
7878
7879})(jQuery, FooTable);
7880(function($, F){
7881
7882	F.NumberColumn = F.Column.extend(/** @lends FooTable.NumberColumn */{
7883		/**
7884		 * The number column class is used to handle simple number columns.
7885		 * @constructs
7886		 * @extends FooTable.Column
7887		 * @param {FooTable.Table} instance -  The parent {@link FooTable.Table} this column belongs to.
7888		 * @param {object} definition - An object containing all the properties to set for the column.
7889		 * @returns {FooTable.NumberColumn}
7890		 */
7891		construct: function(instance, definition){
7892			this._super(instance, definition, 'number');
7893			this.decimalSeparator = F.is.string(definition.decimalSeparator) ? definition.decimalSeparator : '.';
7894			this.thousandSeparator = F.is.string(definition.thousandSeparator) ? definition.thousandSeparator : ',';
7895			this.decimalSeparatorRegex = new RegExp(F.str.escapeRegExp(this.decimalSeparator), 'g');
7896			this.thousandSeparatorRegex = new RegExp(F.str.escapeRegExp(this.thousandSeparator), 'g');
7897			this.cleanRegex = new RegExp('[^\-0-9' + F.str.escapeRegExp(this.decimalSeparator) + ']', 'g');
7898		},
7899		/**
7900		 * 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
7901		 * to generate the cell contents.
7902		 * @instance
7903		 * @protected
7904		 * @param {(*|jQuery)} valueOrElement - The value or jQuery cell object.
7905		 * @returns {(number|null)}
7906		 * @this FooTable.NumberColumn
7907		 */
7908		parser: function(valueOrElement){
7909			if (F.is.element(valueOrElement) || F.is.jq(valueOrElement)){
7910				var data = $(valueOrElement).data('value');
7911				valueOrElement = F.is.defined(data) ? data : $(valueOrElement).text().replace(this.cleanRegex, '');
7912			}
7913			if (F.is.string(valueOrElement)){
7914				valueOrElement = valueOrElement.replace(this.thousandSeparatorRegex, '').replace(this.decimalSeparatorRegex, '.');
7915				valueOrElement = parseFloat(valueOrElement);
7916			}
7917			if (F.is.number(valueOrElement)) return valueOrElement;
7918			return null;
7919		},
7920		/**
7921		 * This is supplied the value retrieved from the {@link FooTable.NumberColumn#parse} function and must return a string, HTMLElement or jQuery object.
7922		 * The return value from this function is what is displayed in the cell in the table.
7923		 * @instance
7924		 * @protected
7925		 * @param {number} value - The value to format.
7926		 * @param {object} options - The current plugin options.
7927		 * @param {object} rowData - An object containing the current row data.
7928		 * @returns {(string|HTMLElement|jQuery)}
7929		 * @this FooTable.NumberColumn
7930		 */
7931		formatter: function(value, options, rowData){
7932			if (value == null) return '';
7933			var s = (value + '').split('.');
7934			if (s.length == 2 && s[0].length > 3) {
7935				s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, this.thousandSeparator);
7936			}
7937			return s.join(this.decimalSeparator);
7938		}
7939	});
7940
7941	F.columns.register('number', F.NumberColumn);
7942
7943})(jQuery, FooTable);
7944(function($, F){
7945
7946	F.ObjectColumn = F.Column.extend(/** @lends FooTable.ObjectColumn */{
7947		/**
7948		 * @summary A column to handle Object values.
7949		 * @constructs
7950		 * @extends FooTable.Column
7951		 * @param {FooTable.Table} instance -  The parent {@link FooTable.Table} this column belongs to.
7952		 * @param {object} definition - An object containing all the properties to set for the column.
7953		 */
7954		construct: function(instance, definition) {
7955			this._super(instance, definition, 'object');
7956		},
7957		/**
7958		 * @summary Parses the supplied value or element to retrieve a column value.
7959		 * @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.
7960		 * @instance
7961		 * @protected
7962		 * @param {(*|jQuery)} valueOrElement - The value or jQuery cell object.
7963		 * @returns {(object|null)}
7964		 */
7965		parser: function(valueOrElement){
7966			if (F.is.element(valueOrElement) || F.is.jq(valueOrElement)){ // use jQuery to get the value
7967				var $el = $(valueOrElement), data = $el.data('value'); // .data() will automatically convert a JSON string to an object
7968				if (F.is.object(data)) return data;
7969				data = $el.html();
7970				try {
7971					data = JSON.parse(data);
7972				} catch(err) {
7973					data = null;
7974				}
7975				return F.is.object(data) ? data : null; // if we have an object return it
7976			}
7977			if (F.is.object(valueOrElement)) return valueOrElement; // if we have an object return it
7978			return null; // otherwise we have no value so return null
7979		},
7980		/**
7981		 * @summary Formats the column value and creates the HTML seen within a cell.
7982		 * @description This is supplied the value retrieved from the {@link FooTable.ObjectColumn#parser} function and must return a string, HTMLElement or jQuery object.
7983		 * The return value from this function is what is displayed in the cell in the table.
7984		 * @instance
7985		 * @protected
7986		 * @param {*} value - The value to format.
7987		 * @param {object} options - The current plugin options.
7988		 * @param {object} rowData - An object containing the current row data.
7989		 * @returns {(string|HTMLElement|jQuery)}
7990		 */
7991		formatter: function(value, options, rowData){
7992			return F.is.object(value) ? JSON.stringify(value) : '';
7993		}
7994	});
7995
7996	F.columns.register('object', F.ObjectColumn);
7997
7998})(jQuery, FooTable);
7999(function($, F){
8000
8001	F.Breakpoint = F.Class.extend(/** @lends FooTable.Breakpoint */{
8002		/**
8003		 * The breakpoint class containing the name and maximum width for the breakpoint.
8004		 * @constructs
8005		 * @extends FooTable.Class
8006		 * @param {string} name - The name of the breakpoint. Must contain no spaces or special characters.
8007		 * @param {number} width - The width of the breakpoint in pixels.
8008		 * @returns {FooTable.Breakpoint}
8009		 */
8010		construct: function(name, width){
8011			/**
8012			 * The name of the breakpoint.
8013			 * @type {string}
8014			 */
8015			this.name = name;
8016			/**
8017			 * The maximum width of the breakpoint in pixels.
8018			 * @type {number}
8019			 */
8020			this.width = width;
8021		}
8022	});
8023
8024})(jQuery, FooTable);
8025(function($, F){
8026	F.Breakpoints = F.Component.extend(/** @lends FooTable.Breakpoints */{
8027		/**
8028		 * Contains the logic to calculate and apply breakpoints for the plugin.
8029		 * @constructs
8030		 * @extends FooTable.Component
8031		 * @param {FooTable.Table} table -  The parent {@link FooTable.Table} this component belongs to.
8032		 * @returns {FooTable.Breakpoints}
8033		 */
8034		construct: function(table){
8035			// call the base class constructor
8036			this._super(table, true);
8037
8038			/* PROTECTED */
8039			/**
8040			 * This provides a shortcut to the {@link FooTable.Table#options} object.
8041			 * @protected
8042			 * @type {FooTable.Table#options}
8043			 */
8044			this.o = table.o;
8045
8046			/* PUBLIC */
8047			/**
8048			 * The current breakpoint.
8049			 * @type {FooTable.Breakpoint}
8050			 */
8051			this.current = null;
8052			/**
8053			 * An array of {@link FooTable.Breakpoint} objects created from parsing the options.
8054			 * @type {Array.<FooTable.Breakpoint>}
8055			 */
8056			this.array = [];
8057			/**
8058			 * Whether or not breakpoints cascade. When set to true all breakpoints larger than the current will be hidden along with it.
8059			 * @type {boolean}
8060			 */
8061			this.cascade = this.o.cascade;
8062			/**
8063			 * Whether or not to calculate breakpoints on the width of the parent element rather than the viewport.
8064			 * @type {boolean}
8065			 */
8066			this.useParentWidth = this.o.useParentWidth;
8067			/**
8068			 * 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.
8069			 * @type {string}
8070			 */
8071			this.hidden = null;
8072
8073			/* PRIVATE */
8074			/**
8075			 * 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.
8076			 * @type {string}
8077			 * @private
8078			 */
8079			this._classNames = '';
8080
8081			// check if a function was supplied to override the default getWidth
8082			this.getWidth = F.checkFnValue(this, this.o.getWidth, this.getWidth);
8083		},
8084
8085		/* PROTECTED */
8086		/**
8087		 * Checks the supplied data and options for the breakpoints component.
8088		 * @instance
8089		 * @protected
8090		 * @param {object} data - The jQuery data object from the parent table.
8091		 * @fires FooTable.Breakpoints#"preinit.ft.breakpoints"
8092		 */
8093		preinit: function(data){
8094			var self = this;
8095			/**
8096			 * The preinit.ft.breakpoints event is raised before any UI is created and provides the tables jQuery data object for additional options parsing.
8097			 * Calling preventDefault on this event will disable the entire plugin.
8098			 * @event FooTable.Breakpoints#"preinit.ft.breakpoints"
8099			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
8100			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
8101			 * @param {object} data - The jQuery data object of the table raising the event.
8102			 */
8103			return this.ft.raise('preinit.ft.breakpoints', [data]).then(function(){
8104				self.cascade = F.is.boolean(data.cascade) ? data.cascade : self.cascade;
8105				self.o.breakpoints = F.is.hash(data.breakpoints) ? data.breakpoints : self.o.breakpoints;
8106				self.getWidth = F.checkFnValue(self, data.getWidth, self.getWidth);
8107				if (self.o.breakpoints == null) self.o.breakpoints = { "xs": 480, "sm": 768, "md": 992, "lg": 1200 };
8108				// Create a nice friendly array to work with out of the breakpoints object.
8109				for (var name in self.o.breakpoints) {
8110					if (!self.o.breakpoints.hasOwnProperty(name)) continue;
8111					self.array.push(new F.Breakpoint(name, self.o.breakpoints[name]));
8112					self._classNames += 'breakpoint-' + name + ' ';
8113				}
8114				// Sort the breakpoints so the largest is checked first
8115				self.array.sort(function (a, b) {
8116					return b.width - a.width;
8117				});
8118			});
8119		},
8120		/**
8121		 * Initializes the class parsing the options into a sorted array of {@link FooTable.Breakpoint} objects.
8122		 * @instance
8123		 * @protected
8124		 * @fires FooTable.Breakpoints#"init.ft.breakpoints"
8125		 */
8126		init: function(){
8127			var self = this;
8128			/**
8129			 * The init.ft.breakpoints event is raised before any UI is generated.
8130			 * Calling preventDefault on this event will disable the entire plugin.
8131			 * @event FooTable.Breakpoints#"init.ft.breakpoints"
8132			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
8133			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
8134			 */
8135			return this.ft.raise('init.ft.breakpoints').then(function(){
8136				self.current = self.get();
8137			});
8138		},
8139		/**
8140		 * Whenever the table is drawn this ensures the correct breakpoint class is applied to the table.
8141		 * @instance
8142		 * @protected
8143		 */
8144		draw: function(){
8145			this.ft.$el.removeClass(this._classNames).addClass('breakpoint-' + this.current.name);
8146		},
8147
8148		/* PUBLIC */
8149		/**
8150		 * Calculates the current breakpoint from the {@link FooTable.Breakpoints#array} and sets the {@link FooTable.Breakpoints#current} property.
8151		 * @instance
8152		 * @returns {FooTable.Breakpoint}
8153		 */
8154		calculate: function(){
8155			var self = this, current = null, hidden = [], breakpoint, prev = null, width = self.getWidth();
8156			for (var i = 0, len = self.array.length; i < len; i++) {
8157				breakpoint = self.array[i];
8158				// if the width is smaller than the smallest breakpoint set the smallest as the current.
8159				// if the width is larger than the largest breakpoint set the largest as the current.
8160				// otherwise if the width is somewhere in between check all breakpoints testing if the width
8161				// is greater than the current but smaller than the previous.
8162				if ((!current && i == len -1)
8163					|| (width >= breakpoint.width && (prev instanceof F.Breakpoint ? width < prev.width : true))) {
8164					current = breakpoint;
8165				}
8166				if (!current) hidden.push(breakpoint.name);
8167				prev = breakpoint;
8168			}
8169			hidden.push(current.name);
8170			self.hidden = hidden.join(' ');
8171			return current;
8172		},
8173		/**
8174		 * Supplied a columns breakpoints this returns a boolean value indicating whether or not the column is visible.
8175		 * @param {string} breakpoints - A space separated string of breakpoint names.
8176		 * @returns {boolean}
8177		 */
8178		visible: function(breakpoints){
8179			if (F.is.emptyString(breakpoints)) return true;
8180			if (breakpoints === 'all') return false;
8181			var parts = breakpoints.split(' '), i = 0, len = parts.length;
8182			for (; i < len; i++){
8183				if (this.cascade ? F.str.containsWord(this.hidden, parts[i]) : parts[i] == this.current.name) return false;
8184			}
8185			return true;
8186		},
8187		/**
8188		 * Performs a check between the current breakpoint and the previous breakpoint and performs a redraw if they differ.
8189		 * @instance
8190		 * @fires FooTable.Breakpoints#"before.ft.breakpoints"
8191		 * @fires FooTable.Breakpoints#"after.ft.breakpoints"
8192		 */
8193		check: function(){
8194			var self = this, bp = self.get();
8195			if (!(bp instanceof F.Breakpoint)
8196				|| bp == self.current)
8197				return;
8198
8199			/**
8200			 * 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
8201			 * and the next "new" one that is about to be applied.
8202			 * Calling preventDefault on this event will prevent the next breakpoint from being applied.
8203			 * @event FooTable.Breakpoints#"before.ft.breakpoints"
8204			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
8205			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
8206			 * @param {FooTable.Breakpoint} current - The current breakpoint.
8207			 * @param {FooTable.Breakpoint} next - The breakpoint that is about to be applied.
8208			 */
8209			self.ft.raise('before.ft.breakpoints', [self.current, bp]).then(function(){
8210				var previous = self.current;
8211				self.current = bp;
8212				return self.ft.draw().then(function(){
8213					/**
8214					 * 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
8215					 * and the previous one that was replaced.
8216					 * @event FooTable.Breakpoints#"after.ft.breakpoints"
8217					 * @param {jQuery.Event} e - The jQuery.Event object for the event.
8218					 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
8219					 * @param {FooTable.Breakpoint} current - The current breakpoint.
8220					 * @param {FooTable.Breakpoint} previous - The breakpoint that was just replaced.
8221					 */
8222					self.ft.raise('after.ft.breakpoints', [self.current, previous]);
8223				});
8224			});
8225		},
8226		/**
8227		 * Attempts to return a {@link FooTable.Breakpoint} instance when passed a {@link FooTable.Breakpoint},
8228		 * the {@link FooTable.Breakpoint#name}
8228 string or if nothing is supplied the current breakpoint.
8229		 * @instance
8230		 * @param {(FooTable.Breakpoint|string|number)} [breakpoint] - The breakpoint to retrieve.
8231		 * @returns {FooTable.Breakpoint}
8232		 */
8233		get: function(breakpoint){
8234			if (F.is.undef(breakpoint)) return this.calculate();
8235			if (breakpoint instanceof F.Breakpoint) return breakpoint;
8236			if (F.is.string(breakpoint)) return F.arr.first(this.array, function (bp) { return bp.name == breakpoint; });
8237			if (F.is.number(breakpoint)) return breakpoint >= 0 && breakpoint < this.array.length ? this.array[breakpoint] : null;
8238			return null;
8239		},
8240		/**
8241		 * Gets the width used to determine breakpoints whether it be from the viewport, parent or a custom function.
8242		 * @instance
8243		 * @returns {number}
8244		 */
8245		getWidth: function(){
8246			if (F.is.fn(this.o.getWidth)) return this.o.getWidth(this.ft);
8247			if (this.useParentWidth == true) return this.getParentWidth();
8248			return this.getViewportWidth();
8249		},
8250		/**
8251		 * Gets the tables direct parents width.
8252		 * @instance
8253		 * @returns {number}
8254		 */
8255		getParentWidth: function(){
8256			return this.ft.$el.parent().width();
8257		},
8258		/**
8259		 * Gets the current viewport width.
8260		 * @instance
8261		 * @returns {number}
8262		 */
8263		getViewportWidth: function(){
8264			return Math.max(document.documentElement.clientWidth, window.innerWidth, 0);
8265		}
8266	});
8267
8268	F.components.register('breakpoints', F.Breakpoints, 1000);
8269
8270})(jQuery, FooTable);
8271(function(F){
8272	/**
8273	 * 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.
8274	 * @type {string}
8275	 * @default null
8276	 * @example <caption>The below shows how this value would be set</caption>
8277	 * breakpoints: "md"
8278	 */
8279	F.Column.prototype.breakpoints = null;
8280
8281	F.Column.prototype.__breakpoints_define__ = function(definition){
8282		this.breakpoints = F.is.emptyString(definition.breakpoints) ? null : definition.breakpoints;
8283	};
8284
8285	F.Column.extend('define', function(definition){
8286		this._super(definition);
8287		this.__breakpoints_define__(definition);
8288	});
8289})(FooTable);
8290(function(F){
8291	/**
8292	 * An object containing the breakpoints for the plugin.
8293	 * @type {object.<string, number>}
8294	 * @default { "xs": 480, "sm": 768, "md": 992, "lg": 1200 }
8295	 */
8296	F.Defaults.prototype.breakpoints = null;
8297
8298	/**
8299	 * Whether or not breakpoints cascade. When set to true all breakpoints larger than the current will also be hidden along with it.
8300	 * @type {boolean}
8301	 * @default false
8302	 */
8303	F.Defaults.prototype.cascade = false;
8304
8305	/**
8306	 * Whether or not to calculate breakpoints on the width of the parent element rather than the viewport.
8307	 * @type {boolean}
8308	 * @default false
8309	 */
8310	F.Defaults.prototype.useParentWidth = false;
8311
8312	/**
8313	 * A function used to override the default getWidth function with a custom one.
8314	 * @type {function}
8315	 * @default null
8316	 * @example <caption>The below shows what the default getWidth function would look like.</caption>
8317	 * getWidth: function(instance){
8318	 * 	if (instance.o.useParentWidth == true) return instance.$el.parent().width();
8319	 * 	return instance.breakpoints.getViewportWidth();
8320	 * }
8321	 */
8322	F.Defaults.prototype.getWidth = null;
8323})(FooTable);
8324(function($, F){
8325	F.Columns = F.Component.extend(/** @lends FooTable.Columns */{
8326		/**
8327		 * The columns class contains all the logic for handling columns.
8328		 * @constructs
8329		 * @extends FooTable.Component
8330		 * @param {FooTable.Table} table -  The parent {@link FooTable.Table} this component belongs to.
8331		 * @returns {FooTable.Columns}
8332		 */
8333		construct: function(table){
8334			// call the base class constructor
8335			this._super(table, true);
8336
8337			/* PROTECTED */
8338			/**
8339			 * This provides a shortcut to the {@link FooTable.Table#options} object.
8340			 * @protected
8341			 * @type {FooTable.Table#options}
8342			 */
8343			this.o = table.o;
8344
8345			/* PUBLIC */
8346			/**
8347			 * An array of {@link FooTable.Column} objects created from parsing the options and/or DOM.
8348			 * @type {Array.<FooTable.Column>}
8349			 */
8350			this.array = [];
8351			/**
8352			 * The jQuery header row object.
8353			 * @type {jQuery}
8354			 */
8355			this.$header = null;
8356			/**
8357			 * Whether or not to display the header row.
8358			 * @type {boolean}
8359			 */
8360			this.showHeader = table.o.showHeader;
8361
8362			this._fromHTML = F.is.emptyArray(table.o.columns) && !F.is.promise(table.o.columns);
8363		},
8364
8365		/* PROTECTED */
8366		/**
8367		 * This parses the columns from either the tables rows or the supplied options.
8368		 * @instance
8369		 * @protected
8370		 * @param {object} data - The tables jQuery data object.
8371		 * @returns {jQuery.Promise}
8372		 * @this FooTable.Columns
8373		 */
8374		parse: function(data){
8375			var self = this;
8376			return $.Deferred(function(d){
8377				function merge(cols1, cols2){
8378					var merged = [];
8379					// check if either of the arrays is empty as it can save us having to merge them by index.
8380					if (cols1.length == 0 || cols2.length == 0){
8381						merged = cols1.concat(cols2);
8382					} else {
8383						// at this point we have two arrays of column definitions, we now need to merge them based on there index properties
8384						// first figure out the highest column index provided so we can loop that many times to merge all c
8384olumns and provide
8385						// defaults where nothing was specified (fill in the gaps in the array as it were).
8386						var highest = 0;
8387						F.arr.each(cols1.concat(cols2), function(c){
8388							if (c.index > highest) highest = c.index;
8389						});
8390						highest++;
8391						for (var i = 0, cols1_c, cols2_c; i < highest; i++){
8392							cols1_c = {};
8393							F.arr.each(cols1, function(c){
8394								if (c.index == i){
8395									cols1_c = c;
8396									return false;
8397								}
8398							});
8399							cols2_c = {};
8400							F.arr.each(cols2, function(c){
8401								if (c.index == i){
8402									cols2_c = c;
8403									return false;
8404								}
8405							});
8406							merged.push($.extend(true, {}, cols1_c, cols2_c));
8407						}
8408					}
8409					return merged;
8410				}
8411
8412				var json = [], html = [];
8413				// get the column options from the content
8414				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;
8415				if ($header.length > 0){
8416					var virtual = $header.parent().is('tbody') && $header.children().length == $header.children('td').length;
8417					if (!virtual) self.$header = $header.addClass('footable-header');
8418					$header.children('td,th').each(function(i, cell){
8419						$cell = $(cell);
8420						cdata = $cell.data();
8421						cdata.index = i;
8422						cdata.$el = $cell;
8423						cdata.virtual = virtual;
8424						html.push(cdata);
8425					});
8426					if (virtual) self.showHeader = false;
8427				}
8428				// get the supplied column options
8429				if (F.is.array(self.o.columns) && !F.is.emptyArray(self.o.columns)){
8430					F.arr.each(self.o.columns, function(c, i){
8431						c.index = i;
8432						json.push(c);
8433					});
8434					self.parseFinalize(d, merge(json, html));
8435				} else if (F.is.promise(self.o.columns)){
8436					self.o.columns.then(function(cols){
8437						F.arr.each(cols, function(c, i){
8438							c.index = i;
8439							json.push(c);
8440						});
8441						self.parseFinalize(d, merge(json, html));
8442					}, function(xhr){
8443						d.reject(Error('Columns ajax request error: ' + xhr.status + ' (' + xhr.statusText + ')'));
8444					});
8445				} else {
8446					self.parseFinalize(d, merge(json, html));
8447				}
8448			});
8449		},
8450		/**
8451		 * 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
8452		 * or rejected with an error.
8453		 * @instance
8454		 * @protected
8455		 * @param {jQuery.Deferred} deferred - The deferred object used for parsing.
8456		 * @param {Array.<object>} cols - An array of all merged column definitions.
8457		 */
8458		parseFinalize: function(deferred, cols){
8459			// we now have a merged array of all column definitions supplied to the plugin, time to make the objects.
8460			var self = this, columns = [], column;
8461			F.arr.each(cols, function(def){
8462				// if we have a column registered using the definition type then create an instance of that column otherwise just create a default text column.
8463				if (column = F.columns.contains(def.type) ? F.columns.make(def.type, self.ft, def) : new F.Column(self.ft, def))
8464					columns.push(column);
8465			});
8466			if (F.is.emptyArray(columns)){
8467				deferred.reject(Error("No columns supplied."));
8468			} else {
8469				// make sure to sort by the column index as the merge process may have mixed them up
8470				columns.sort(function(a, b){ return a.index - b.index; });
8471				deferred.resolve(columns);
8472			}
8473		},
8474		/**
8475		 * The columns preinit method is used to parse and check the column options supplied from both static content and through the constructor.
8476		 * @instance
8477		 * @protected
8478		 * @param {object} data - The jQuery data object from the root table element.
8479		 * @this FooTable.Columns
8480		 */
8481		preinit: function(data){
8482			var self = this;
8483			/**
8484			 * The preinit.ft.columns event is raised before any UI is created and provides the tables jQuery data object for additional options parsing.
8485			 * Calling preventDefault on this event will disable the entire plugin.
8486			 * @event FooTable.Columns#"preinit.ft.columns"
8487			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
8488			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
8489			 * @param {object} data - The jQuery data object of the table raising the event.
8490			 */
8491			return self.ft.raise('preinit.ft.columns', [data]).then(function(){
8492				return self.parse(data).then(function(columns){
8493					self.array = columns;
8494					self.showHeader = F.is.boolean(data.showHeader) ? data.showHeader : self.showHeader;
8495				});
8496			});
8497		},
8498		/**
8499		 * Initializes the columns creating the table header if required.
8500		 * @instance
8501		 * @protected
8502		 * @fires FooTable.Columns#"init.ft.columns"
8503		 * @this FooTable.Columns
8504		 */
8505		init: function(){
8506			var self = this;
8507			/**
8508			 * The init.ft.columns event is raised after the header row is created/parsed for c
8508olumn data.
8509			 * @event FooTable.Columns#"init.ft.columns"
8510			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
8511			 * @param {FooTable.Table} instance - The instance of the plugin raising the event.
8512			 * @param {Array.<FooTable.Column>} columns - The array of {@link FooTable.Column} objects parsed from the options and/or DOM.
8513			 */
8514			return this.ft.raise('init.ft.columns', [ self.array ]).then(function(){
8515				self.$create();
8516			});
8517		},
8518		/**
8519		 * Destroys the columns component removing any UI generated from the table.
8520		 * @instance
8521		 * @protected
8522		 * @fires FooTable.Columns#"destroy.ft.columns"
8523		 */
8524		destroy: function(){
8525			/**
8526			 * The destroy.ft.columns event is raised before its UI is removed.
8527			 * Calling preventDefault on this event will prevent the component from being destroyed.
8528			 * @event FooTable.Columns#"destroy.ft.columns"
8529			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
8530			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
8531			 */
8532			var self = this;
8533			this.ft.raise('destroy.ft.columns').then(function(){
8534				if (!self._fromHTML) self.$header.remove();
8535			});
8536		},
8537		/**
8538		 * The predraw method called from within the {@link FooTable.Table#draw} method.
8539		 * @instance
8540		 * @protected
8541		 * @this FooTable.Columns
8542		 */
8543		predraw: function(){
8544			var self = this, first = true;
8545			self.visibleColspan = 0;
8546			self.firstVisibleIndex = 0;
8547			self.lastVisibleIndex = 0;
8548			self.hasHidden = false;
8549			F.arr.each(self.array, function(col){
8550				col.hidden = !self.ft.breakpoints.visible(col.breakpoints);
8551				if (!col.hidden && col.visible){
8552					if (first){
8553						self.firstVisibleIndex = col.index;
8554						first = false;
8555					}
8556					self.lastVisibleIndex = col.index;
8557					self.visibleColspan++;
8558				}
8559				if (col.hidden) self.hasHidden = true;
8560			});
8561			self.ft.$el.toggleClass('breakpoint', self.hasHidden);
8562		},
8563		/**
8564		 * Performs the actual drawing of the columns, hiding or displaying them depending on there breakpoints.
8565		 * @instance
8566		 * @protected
8567		 * @this FooTable.Columns
8568		 */
8569		draw: function(){
8570			F.arr.each(this.array, function(col){
8571				col.$el.css('display', (col.hidden || !col.visible  ? 'none' : 'table-cell'));
8572			});
8573			if (!this.showHeader && F.is.jq(this.$header.parent())){
8574				this.$header.detach();
8575			}
8576		},
8577		/**
8578		 * Creates the header row for the table from the parsed column definitions.
8579		 * @instance
8580		 * @protected
8581		 * @this FooTable.Columns
8582		 */
8583		$create: function(){
8584			var self = this;
8585			self.$header = F.is.jq(self.$header) ? self.$header : $('<tr/>', {'class': 'footable-header'});
8586			self.$header.children('th,td').detach();
8587			F.arr.each(self.array, function(col){
8588				self.$header.append(col.$el);
8589			});
8590			if (self.showHeader && !F.is.jq(self.$header.parent())){
8591				self.ft.$el.children('thead').append(self.$header);
8592			}
8593		},
8594		/**
8595		 * 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.
8596		 * 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.
8597		 * Returning true in the callback will include the column in the result.
8598		 * @instance
8599		 * @param {(FooTable.Column|string|number|function)} column - The column to retrieve.
8600		 * @returns {(Array.<FooTable.Column>|FooTable.Column|null)} The column if one is found otherwise it returns NULL.
8601		 * @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>
8602		 * var column = columns.get('id');
8603		 * if (column instanceof FooTable.Column){
8604		 * 	// found the "id" column
8605		 * } else {
8606		 * 	// no column with a name of "id" exists
8607		 * }
8608		 * // to get an array of all hidden columns
8609		 * var columns = columns.get(function(col){
8610		 *  return col.hidden;
8611		 * });
8612		 */
8613		get: function(column){
8614			if (column instanceof F.Column) return column;
8615			if (F.is.string(column)) return F.arr.first(this.array, function (col) { return col.name == column; });
8616			if (F.is.number(column)) return F.arr.first(this.array, function (col) { return col.index == column; });
8617			if (F.is.fn(column)) return F.arr.get(this.array, column);
8618			return null;
8619		},
8620		/**
8621		 * 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.
8622		 * @instance
8623		 * @param {(Array.<string>|Array.<number>|Array.<FooTable.Column>)} columns - The array of column names, index's or {@link FooTable.Column} to check.
8624		 * @returns {Array.<FooTable.Column>}
8625		 */
8626		ensure: function(columns){
8627			var self = this, result = [];
8628			if (!F.is.array(columns)) return result;
8629			F.arr.each(columns, function(name){
8630				result.push(self.get(name));
8631			});
8632			return result;
8633		}
8634	});
8635
8636	F.components.register('columns', F.Columns, 900);
8637
8638})(jQuery, FooTable);
8639(function(F){
8640	/**
8641	 * 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.
8642	 * @type {(Array.<object>|jQuery.Promise)}
8643	 * @default []
8644	 * @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>
8645	 * columns: [
8646	 * 	{ name: 'id', title: 'ID', type: 'number' },
8647	 *	{ name: 'name', title: 'Name', sorted: true, direction: 'ASC' }
8648	 *	{ name: 'age', title: 'Age', type: 'number', breakpoints: 'xs' }
8649	 * ]
8650	 */
8651	F.Defaults.prototype.columns = [];
8652
8653	/**
8654	 * Specifies whether or not the column headers should be displayed.
8655	 * @type {boolean}
8656	 * @default true
8657	 */
8658	F.Defaults.prototype.showHeader = true;
8659})(FooTable);
8660(function ($, F) {
8661	F.Rows = F.Component.extend(/** @lends FooTable.Rows */{
8662		/**
8663		 * The rows class contains all the logic for handling rows.
8664		 * @constructs
8665		 * @extends FooTable.Component
8666		 * @param {FooTable.Table} table -  The parent {@link FooTable.Table} this component belongs to.
8667		 * @returns {FooTable.Rows}
8668		 */
8669		construct: function (table) {
8670			// call the base class constructor
8671			this._super(table, true);
8672
8673			/**
8674			 * This provides a shortcut to the {@link FooTable.Table#options} object.
8675			 * @instance
8676			 * @protected
8677			 * @type {FooTable.Table#options}
8678			 */
8679			this.o = table.o;
8680			/**
8681			 * The current working array of {@link FooTable.Row} objects.
8682			 * @instance
8683			 * @protected
8684			 * @type {Array.<FooTable.Row>}
8685			 * @default []
8686			 */
8687			this.array = [];
8688			/**
8689			 * The base array of rows parsed from either the DOM or the constructor options.
8690			 * The {@link FooTable.Rows#current} member is populated with a shallow clone of this array
8691			 * during the predraw operation before any core or custom components are executed.
8692			 * @instance
8693			 * @protected
8694			 * @type {Array.<FooTable.Row>}
8695			 * @default []
8696			 */
8697			this.all = [];
8698			/**
8699			 * Whether or not to display a toggle in each row when it contains hidden columns.
8700			 * @type {boolean}
8701			 * @default true
8702			 */
8703			this.showToggle = table.o.showToggle;
8704			/**
8705			 * The CSS selector used to filter row click events. If the event.target property matches the selector the row will be toggled.
8706			 * @type {string}
8707			 * @default "tr,td,.footable-toggle"
8708			 */
8709			this.toggleSelector = table.o.toggleSelector;
8710			/**
8711			 * Specifies which column the row toggle is appended to. Supports only two values; "first" and "last"
8712			 * @type {string}
8713			 */
8714			this.toggleColumn = table.o.toggleColumn;
8715			/**
8716			 * The text to display when the table has no rows.
8717			 * @type {string}
8718			 */
8719			this.emptyString = table.o.empty;
8720			/**
8721			 * Whether or not the first rows details are expanded by default when displayed on a device that hides any columns.
8722			 * @type {boolean}
8723			 */
8724			this.expandFirst = table.o.expandFirst;
8725			/**
8726			 * Whether or not all row details are expanded by default when displayed on a device that hides any columns.
8727			 * @type {boolean}
8728			 */
8729			this.expandAll = table.o.expandAll;
8730			/**
8731			 * The jQuery object that contains the empty row control.
8732			 * @type {jQuery}
8733			 */
8734			this.$empty = null;
8735			this._fromHTML = F.is.emptyArray(table.o.rows) && !F.is.promise(table.o.rows);
8736		},
8737		/**
8738		 * This parses the rows from either the tables rows or the supplied options.
8739		 * @instance
8740		 * @protected
8741		 * @returns {jQuery.Promise}
8742		 */
8743		parse: function(){
8744			var self = this;
8745			return $.Deferred(function(d){
8746				var $rows = self.ft.$el.children('tbody').children('tr');
8747				if (F.is.array(self.o.rows) && self.o.rows.length > 0){
8748					self.parseFinalize(d, self.o.rows);
8749				} else if (F.is.promise(self.o.rows)){
8750					self.o.rows.then(function(rows){
8751						self.parseFinalize(d, rows);
8752					}, function(xhr){
8753						d.reject(Error('Rows ajax request error: ' + xhr.status + ' (' + xhr.statusText + ')'));
8754					});
8755				} else if (F.is.jq($rows)){
8756					self.parseFinalize(d, $rows);
8757					$rows.detach();
8758				} else {
8759					self.parseFinalize(d, []);
8760				}
8761			});
8762		},
8763		/**
8764		 * 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
8765		 * or rejected with an error.
8766		 * @instance
8767		 * @protected
8768		 * @param {jQuery.Deferred} deferred - The deferred object used for parsing.
8769		 * @param {(Array.<object>|jQuery)} rows - An array of row values and options or the jQuery object containing all rows.
8770		 */
8771		parseFinalize: function(deferred, rows){
8772			var self = this, result = $.map(rows, function(r){
8773				return new F.Row(self.ft, self.ft.columns.array, r);
8774			});
8775			deferred.resolve(result);
8776		},
8777		/**
8778		 * The columns preinit method is used to parse and check the column options supplied from both static content and through the constructor.
8779		 * @instance
8780		 * @protected
8781		 * @param {object} data - The jQuery data object from the root table element.
8782		 * @fires FooTable.Rows#"preinit.ft.rows"
8783		 */
8784		preinit: function(data){
8785			var self = this;
8786			/**
8787			 * The preinit.ft.rows event is raised before any UI is created and provides the tables jQuery data object for additional options parsing.
8788			 * Calling preventDefault on this event will disable the entire plugin.
8789			 * @event FooTable.Rows#"preinit.ft.rows"
8790			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
8791			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
8792			 * @param {object} data - The jQuery data object of the table raising the event.
8793			 */
8794			return self.ft.raise('preinit.ft.rows', [data]).then(function(){
8795				return self.parse().then(function(rows){
8796					self.all = rows;
8797					self.array = self.all.slice(0);
8798					self.showToggle = F.is.boolean(data.showToggle) ? data.showToggle : self.showToggle;
8799					self.toggleSelector = F.is.string(data.toggleSelector) ? data.toggleSelector : self.toggleSelector;
8800					self.toggleColumn = F.is.string(data.toggleColumn) ? data.toggleColumn : self.toggleColumn;
8801					if (self.toggleColumn != "first" && self.toggleColumn != "last") self.toggleColumn = "first";
8802					self.emptyString = F.is.string(data.empty) ? data.empty : self.emptyString;
8803					self.expandFirst = F.is.boolean(data.expandFirst) ? data.expandFirst : self.expandFirst;
8804					self.expandAll = F.is.boolean(data.expandAll) ? data.expandAll : self.expandAll;
8805				});
8806			});
8807		},
8808		/**
8809		 * Initializes the rows class using the supplied table and options.
8810		 * @instance
8811		 * @protected
8812		 * @fires FooTable.Rows#"init.ft.rows"
8813		 */
8814		init: function () {
8815			var self = this;
8816			/**
8817			 * The init.ft.rows event is raised after the the rows are parsed from either the DOM or the options.
8818			 * Calling preventDefault on this event will disable the entire plugin.
8819			 * @event FooTable.Rows#"init.ft.rows"
8820			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
8821			 * @param {FooTable.Table} instance - The instance of the plugin raising the event.
8822			 * @param {Array.<FooTable.Row>} rows - The array of {@link FooTable.Row} objects parsed from the DOM or the options.
8823			 */
8824			return self.ft.raise('init.ft.rows', [self.all]).then(function(){
8825				self.$create();
8826			});
8827		},
8828		/**
8829		 * Destroys the rows component removing any UI generated from the table.
8830		 * @instance
8831		 * @protected
8832		 * @fires FooTable.Rows#"destroy.ft.rows"
8833		 */
8834		destroy: function(){
8835			/**
8836			 * The destroy.ft.rows event is raised before its UI is removed.
8837			 * Calling preventDefault on this event will prevent the component from being destroyed.
8838			 * @event FooTable.Rows#"destroy.ft.rows"
8839			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
8840			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
8841			 */
8842			var self = this;
8843			this.ft.raise('destroy.ft.rows').then(function(){
8844				F.arr.each(self.array, function(row){
8845					row.predraw(!self._fromHTML);
8846				});
8847				self.all = self.array = [];
8848			});
8849		},
8850		/**
8851		 * Performs the predraw operations that are required including creating the shallow clone of the {@link FooTable.Rows#array} to work with.
8852		 * @instance
8853		 * @protected
8854		 */
8855		predraw: function(){
8856			F.arr.each(this.array, function(row){
8857				row.predraw();
8858			});
8859			this.array = this.all.slice(0);
8860		},
8861		$create: function(){
8862			this.$empty = $('<tr/>', { 'class': 'footable-empty' }).append($('<td/>').text(this.emptyString));
8863		},
8864		/**
8865		 * Performs the actual drawing of the table rows.
8866		 * @instance
8867		 * @protected
8868		 */
8869		draw: function(){
8870			var self = this, $tbody = self.ft.$el.children('tbody'), first = true;
8871			// if we have rows
8872			if (self.array.length > 0){
8873				self.$empty.detach();
8874				// loop through them appending to the tbody and then drawing
8875				F.arr.each(self.array, function(row){
8876					if ((self.expandFirst && first) || self.expandAll){
8877						row.expanded = true;
8878						first = false;
8879					}
8880					row.draw($tbody);
8881				});
8882			} else {
8883				// otherwise display the $empty row
8884				self.$empty.children('td').attr('colspan', self.ft.columns.visibleColspan);
8885				$tbody.append(self.$empty);
8886			}
8887		},
8888		/**
8889		 * Loads a JSON array of row objects into the table
8890		 * @instance
8891		 * @param {Array.<object>} data - An array of row objects to load.
8892		 * @param {boolean} [append=false] - Whether or not to append the new rows to the current rows array or to replace them entirely.
8893		 */
8894		load: function(data, append){
8895			var self = this, rows = $.map(data, function(r){
8896				return new F.Row(self.ft, self.ft.columns.array, r);
8897			});
8898			F.arr.each(this.array, function(row){
8899				row.predraw();
8900			});
8901			this.all = (F.is.boolean(append) ? append : false) ? this.all.concat(rows) : rows;
8902			this.array = this.all.slice(0);
8903			this.ft.draw();
8904		},
8905		/**
8906		 * Expands all visible rows.
8907		 * @instance
8908		 */
8909		expand: function(){
8910			F.arr.each(this.array, function(row){
8911				row.expand();
8912			});
8913		},
8914		/**
8915		 * Collapses all visible rows.
8916		 * @instance
8917		 */
8918		collapse: function(){
8919			F.arr.each(this.array, function(row){
8920				row.collapse();
8921			});
8922		}
8923	});
8924
8925	F.components.register('rows', F.Rows, 800);
8926
8927})(jQuery, FooTable);
8928(function(F){
8929	/**
8930	 * An array of JSON objects containing the row data or a jQuery promise that resolves returning the row data.
8931	 * @type {(Array.<object>|jQuery.Promise)}
8932	 * @default []
8933	 */
8934	F.Defaults.prototype.rows = [];
8935
8936	/**
8937	 * A string to display when there are no rows in the table.
8938	 * @type {string}
8939	 * @default "No results"
8940	 */
8941	F.Defaults.prototype.empty = 'No results';
8942
8943	/**
8944	 * Whether or not the toggle is appended to each row.
8945	 * @type {boolean}
8946	 * @default true
8947	 */
8948	F.Defaults.prototype.showToggle = true;
8949
8950	/**
8951	 * The CSS selector used to filter row click events. If the event.target property matches the selector the row will be toggled.
8952	 * @type {string}
8953	 * @default "tr,td,.footable-toggle"
8954	 */
8955	F.Defaults.prototype.toggleSelector = 'tr,td,.footable-toggle';
8956
8957	/**
8958	 * Specifies which column to display the row toggle in. The only supported values are "first" or "last".
8959	 * @type {string}
8960	 * @default "first"
8961	 */
8962	F.Defaults.prototype.toggleColumn = 'first';
8963
8964	/**
8965	 * Whether or not the first rows details are expanded by default when displayed on a device that hides any columns.
8966	 * @type {boolean}
8967	 */
8968	F.Defaults.prototype.expandFirst = false;
8969
8970	/**
8971	 * Whether or not all row details are expanded by default when displayed on a device that hides any columns.
8972	 * @type {boolean}
8973	 */
8974	F.Defaults.prototype.expandAll = false;
8975})(FooTable);
8976(function(F){
8977	/**
8978	 * Loads a JSON array of row objects into the table
8979	 * @param {Array.<object>} data - An array of row objects to load.
8980	 * @param {boolean} [append=false] - Whether or not to append the new rows to the current rows array or to replace them entirely.
8981	 */
8982	F.Table.prototype.loadRows = function(data, append){
8983		this.rows.load(data, append);
8984	};
8985})(FooTable);
8986(function(F){
8987	F.Filter = F.Class.extend(/** @lends FooTable.Filter */{
8988		/**
8989		 * The filter object contains the query to filter by and the columns to apply it to.
8990		 * @constructs
8991		 * @extends FooTable.Class
8992		 * @param {string} name - The name for the filter.
8993		 * @param {(string|FooTable.Query)} query - The query for the filter.
8994		 * @param {Array.<FooTable.Column>} columns - The columns to apply the query to.
8995		 * @param {string} [space="AND"] - How the query treats space chars.
8996		 * @param {boolean} [connectors=true] - Whether or not to replace phrase connectors (+.-_) with spaces.
8997		 * @param {boolean} [ignoreCase=true] - Whether or not ignore case when matching.
8998		 * @param {boolean} [hidden=true] - Whether or not this is a hidden filter.
8999		 * @returns {FooTable.Filter}
9000		 */
9001		construct: function(name, query, columns, space, connectors, ignoreCase, hidden){
9002			/**
9003			 * The name of the filter.
9004			 * @instance
9005			 * @type {string}
9006			 */
9007			this.name = name;
9008			/**
9009			 * A string specifying how the filter treats space characters. Can be either "OR" or "AND".
9010			 * @instance
9011			 * @type {string}
9012			 */
9013			this.space = F.is.string(space) && (space == 'OR' || space == 'AND') ? space : 'AND';
9014			/**
9015			 * Whether or not to replace phrase connectors (+.-_) with spaces before executing the query.
9016			 * @instance
9017			 * @type {boolean}
9018			 */
9019			this.connectors = F.is.boolean(connectors) ? connectors : true;
9020			/**
9021			 * Whether or not ignore case when matching.
9022			 * @instance
9023			 * @type {boolean}
9024			 */
9025			this.ignoreCase = F.is.boolean(ignoreCase) ? ignoreCase : true;
9026			/**
9027			 * Whether or not this is a hidden filter.
9028			 * @instance
9029			 * @type {boolean}
9030			 */
9031			this.hidden = F.is.boolean(hidden) ? hidden : false;
9032			/**
9033			 * The query for the filter.
9034			 * @instance
9035			 * @type {(string|FooTable.Query)}
9036			 */
9037			this.query = query instanceof F.Query ? query : new F.Query(query, this.space, this.connectors, this.ignoreCase);
9038			/**
9039			 * The columns to apply the query to.
9040			 * @instance
9041			 * @type {Array.<FooTable.Column>}
9042			 */
9043			this.columns = columns;
9044		},
9045		/**
9046		 * Checks if the current filter matches the supplied string.
9047		 * If the current query property is a string it will be auto converted to a {@link FooTable.Query} object to perform the match.
9048		 * @instance
9049		 * @param {string} str - The string to check.
9050		 * @returns {boolean}
9051		 */
9052		match: function(str){
9053			if (!F.is.string(str)) return false;
9054			if (F.is.string(this.query)){
9055				this.query = new F.Query(this.query, this.space, this.connectors, this.ignoreCase);
9056			}
9057			return this.query instanceof F.Query ? this.query.match(str) : false;
9058		},
9059		/**
9060		 * Checks if the current filter matches the supplied {@link FooTable.Row}.
9061		 * @instance
9062		 * @param {FooTable.Row} row - The row to check.
9063		 * @returns {boolean}
9064		 */
9065		matchRow: function(row){
9066			var self = this, text = F.arr.map(row.cells, function(cell){
9067				return F.arr.contains(self.columns, cell.column) ? cell.filterValue : null;
9068			}).join(' ');
9069			return self.match(text);
9070		}
9071	});
9072
9073})(FooTable);
9074(function ($, F) {
9075	F.Filtering = F.Component.extend(/** @lends FooTable.Filtering */{
9076		/**
9077		 * The filtering component adds a search input and column selector dropdown to the table allowing users to filter the using space delimited queries.
9078		 * @constructs
9079		 * @extends FooTable.Component
9080		 * @param {FooTable.Table} table - The parent {@link FooTable.Table} object for the component.
9081		 * @returns {FooTable.Filtering}
9082		 */
9083		construct: function (table) {
9084			// call the constructor of the base class
9085			this._super(table, table.o.filtering.enabled);
9086
9087			/* PUBLIC */
9088			/**
9089			 * The filters to apply to the current {@link FooTable.Rows#array}.
9090			 * @instance
9091			 * @type {Array.<FooTable.Filter>}
9092			 */
9093			this.filters = table.o.filtering.filters;
9094			/**
9095			 * The delay in milliseconds before the query is auto applied after a change.
9096			 * @instance
9097			 * @type {number}
9098			 */
9099			this.delay = table.o.filtering.delay;
9100			/**
9101			 * The minimum number of characters allowed in the search input before it is auto applied.
9102			 * @instance
9103			 * @type {number}
9104			 */
9105			this.min = table.o.filtering.min;
9106			/**
9107			 * Specifies how whitespace in a filter query is handled.
9108			 * @instance
9109			 * @type {string}
9110			 */
9111			this.space = table.o.filtering.space;
9112			/**
9113			 * Whether or not to replace phrase connectors (+.-_) with spaces before executing the query.
9114			 * @instance
9115			 * @type {boolean}
9116			 */
9117			this.connectors = table.o.filtering.connectors;
9118			/**
9119			 * Whether or not ignore case when matching.
9120			 * @instance
9121			 * @type {boolean}
9122			 */
9123			this.ignoreCase = table.o.filtering.ignoreCase;
9124			/**
9125			 * Whether or not search queries are treated as phrases when matching.
9126			 * @instance
9127			 * @type {boolean}
9128			 */
9129			this.exactMatch = table.o.filtering.exactMatch;
9130			/**
9131			 * The placeholder text to display within the search $input.
9132			 * @instance
9133			 * @type {string}
9134			 */
9135			this.placeholder = table.o.filtering.placeholder;
9136			/**
9137			 * The title to display at the top of the search input column select.
9138			 * @type {string}
9139			 */
9140			this.dropdownTitle = table.o.filtering.dropdownTitle;
9141			/**
9142			 * The position of the $search input within the filtering rows cell.
9143			 * @type {string}
9144			 */
9145			this.position = table.o.filtering.position;
9146			/**
9147			 * Whether or not to focus the search input after the search/clear button is clicked or after auto applying the search input query.
9148			 * @type {boolean}
9149			 */
9150			this.focus = table.o.filtering.focus;
9151			/**
9152			 * 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.
9153			 * @type {string}
9154			 */
9155			this.container = table.o.filtering.container;
9156			/**
9157			 * The jQuery object of the element containing the entire filtering form.
9158			 * @instance
9159			 * @type {jQuery}
9160			 */
9161			this.$container = null;
9162			/**
9163			 * The jQuery row object that contains all the filtering specific elements.
9164			 * @instance
9165			 * @type {jQuery}
9166			 */
9167			this.$row = null;
9168			/**
9169			 * The jQuery cell object that contains the search input and column selector.
9170			 * @instance
9171			 * @type {jQuery}
9172			 */
9173			this.$cell = null;
9174			/**
9175			 * The jQuery form object of the form that contains the search input and column selector.
9176			 * @instance
9177			 * @type {jQuery}
9178			 */
9179			this.$form = null;
9180			/**
9181			 * The jQuery object of the column selector dropdown.
9182			 * @instance
9183			 * @type {jQuery}
9184			 */
9185			this.$dropdown = null;
9186			/**
9187			 * The jQuery object of the search input.
9188			 * @instance
9189			 * @type {jQuery}
9190			 */
9191			this.$input = null;
9192			/**
9193			 * The jQuery object of the search button.
9194			 * @instance
9195			 * @type {jQuery}
9196			 */
9197			this.$button = null;
9198
9199			/* PRIVATE */
9200			/**
9201			 * The timeout ID for the filter changed event.
9202			 * @instance
9203			 * @private
9204			 * @type {?number}
9205			 */
9206			this._filterTimeout = null;
9207			/**
9208			 * The regular expression used to check for encapsulating quotations.
9209			 * @instance
9210			 * @private
9211			 * @type {RegExp}
9212			 */
9213			this._exactRegExp = /^"(.*?)"$/;
9214		},
9215
9216		/* PROTECTED */
9217		/**
9218		 * Checks the supplied data and options for the filtering component.
9219		 * @instance
9220		 * @protected
9221		 * @param {object} data - The jQuery data object from the parent table.
9222		 * @fires FooTable.Filtering#"preinit.ft.filtering"
9223		 */
9224		preinit: function(data){
9225			var self = this;
9226			/**
9227			 * The preinit.ft.filtering event is raised before the UI is created and provides the tables jQuery data object for additional options parsing.
9228			 * Calling preventDefault on this event will disable the component.
9229			 * @event FooTable.Filtering#"preinit.ft.filtering"
9230			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
9231			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
9232			 * @param {object} data - The jQuery data object of the table raising the event.
9233			 */
9234			return self.ft.raise('preinit.ft.filtering').then(function(){
9235				// first check if filtering is enabled via the class being applied
9236				if (self.ft.$el.hasClass('footable-filtering'))
9237					self.enabled = true;
9238				// then check if the data-filtering-enabled attribute has been set
9239				self.enabled = F.is.boolean(data.filtering)
9240					? data.filtering
9241					: self.enabled;
9242
9243				// if filtering is not enabled exit early as we don't need to do anything else
9244				if (!self.enabled) return;
9245
9246				self.space = F.is.string(data.filterSpace)
9247					? data.filterSpace
9248					: self.space;
9249
9250				self.min = F.is.number(data.filterMin)
9251					? data.filterMin
9252					: self.min;
9253
9254				self.connectors = F.is.boolean(data.filterConnectors)
9255					? data.filterConnectors
9256					: self.connectors;
9257
9258				self.ignoreCase = F.is.boolean(data.filterIgnoreCase)
9259					? data.filterIgnoreCase
9260					: self.ignoreCase;
9261
9262				self.exactMatch = F.is.boolean(data.filterExactMatch)
9263					? data.filterExactMatch
9264					: self.exactMatch;
9265
9266				self.focus = F.is.boolean(data.filterFocus)
9267					? data.filterFocus
9268					: self.focus;
9269
9270				self.delay = F.is.number(data.filterDelay)
9271					? data.filterDelay
9272					: self.delay;
9273
9274				self.placeholder = F.is.string(data.filterPlaceholder)
9275					? data.filterPlaceholder
9276					: self.placeholder;
9277
9278				self.dropdownTitle = F.is.string(data.filterDropdownTitle)
9279					? data.filterDropdownTitle
9280					: self.dropdownTitle;
9281
9282				self.container = F.is.string(data.filterContainer)
9283					? data.filterContainer
9284					: self.container;
9285
9286				self.filters = F.is.array(data.filterFilters)
9287					? self.ensure(data.filterFilters)
9288					: self.ensure(self.filters);
9289
9290				if (self.ft.$el.hasClass('footable-filtering-left'))
9291					self.position = 'left';
9292				if (self.ft.$el.hasClass('footable-filtering-center'))
9293					self.position = 'center';
9294				if (self.ft.$el.hasClass('footable-filtering-right'))
9295					self.position = 'right';
9296
9297				self.position = F.is.string(data.filterPosition)
9298					? data.filterPosition
9299					: self.position;
9300			},function(){
9301				self.enabled = false;
9302			});
9303		},
9304		/**
9305		 * Initializes the filtering component for the plugin.
9306		 * @instance
9307		 * @protected
9308		 * @fires FooTable.Filtering#"init.ft.filtering"
9309		 */
9310		init: function () {
9311			var self = this;
9312			/**
9313			 * The init.ft.filtering event is raised before its UI is generated.
9314			 * Calling preventDefault on this event will disable the component.
9315			 * @event FooTable.Filtering#"init.ft.filtering"
9316			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
9317			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
9318			 */
9319			return self.ft.raise('init.ft.filtering').then(function(){
9320				self.$create();
9321			}, function(){
9322				self.enabled = false;
9323			});
9324		},
9325		/**
9326		 * Destroys the filtering component removing any UI from the table.
9327		 * @instance
9328		 * @protected
9329		 * @fires FooTable.Filtering#"destroy.ft.filtering"
9330		 */
9331		destroy: function () {
9332			var self = this;
9333			/**
9334			 * The destroy.ft.filtering event is raised before its UI is removed.
9335			 * Calling preventDefault on this event will prevent the component from being destroyed.
9336			 * @event FooTable.Filtering#"destroy.ft.filtering"
9337			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
9338			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
9339			 */
9340			return self.ft.raise('destroy.ft.filtering').then(function(){
9341				self.ft.$el.removeClass('footable-filtering')
9342					.find('thead > tr.footable-filtering').remove();
9343			});
9344		},
9345		/**
9346		 * Creates the filtering UI from the current options setting the various jQuery properties of this component.
9347		 * @instance
9348		 * @protected
9349		 * @this FooTable.Filtering
9350		 */
9351		$create: function () {
9352			var self = this;
9353			// generate the cell that actually contains all the UI.
9354			var $form_grp = $('<div/>', {'class': 'form-group footable-filtering-search'})
9355					.append($('<label/>', {'class': 'sr-only', text: 'Search'})),
9356				$input_grp = $('<div/>', {'class': 'input-group'}).appendTo($form_grp),
9357				$input_grp_btn = $('<div/>', {'class': 'input-group-btn'}),
9358				$dropdown_toggle = $('<button/>', {type: 'button', 'class': 'btn btn-default dropdown-toggle'})
9359					.on('click', { self: self }, self._onDropdownToggleClicked)
9360					.append($('<span/>', {'class': 'caret'})),
9361				position;
9362
9363			switch (self.position){
9364				case 'left': position = 'footable-filtering-left'; break;
9365				case 'center': position = 'footable-filtering-center'; break;
9366				default: position = 'footable-filtering-right'; break;
9367			}
9368			self.ft.$el.addClass('footable-filtering').addClass(position);
9369
9370			self.$container = self.container === null ? $() : $(self.container).first();
9371			if (!self.$container.length){
9372				// add it to a row and then populate it with the search input and column selector dropdown.
9373				self.$row = $('<tr/>', {'class': 'footable-filtering'}).prependTo(self.ft.$el.children('thead'));
9374				self.$cell = $('<th/>').attr('colspan', self.ft.columns.visibleColspan).appendTo(self.$row);
9375				self.$container = self.$cell;
9376			} else {
9377				self.$container.addClass('footable-filtering-external').addClass(position);
9378			}
9379			self.$form = $('<form/>', {'class': 'form-inline'}).append($form_grp).appendTo(self.$container);
9380
9381			self.$input = $('<input/>', {type: 'text', 'class': 'form-control', placeholder: self.placeholder});
9382
9383			self.$button = $('<button/>', {type: 'button', 'class': 'btn btn-primary'})
9384				.on('click', { self: self }, self._onSearchButtonClicked)
9385				.append($('<span/>', {'class': 'fooicon fooicon-search'}));
9386
9387			self.$dropdown = $('<ul/>', {'class': 'dropdown-menu dropdown-menu-right'});
9388			if (!F.is.emptyString(self.dropdownTitle)){
9389				self.$dropdown.append($('<li/>', {'class': 'dropdown-header','text': self.dropdownTitle}));
9390			}
9391			self.$dropdown.append(
9392				F.arr.map(self.ft.columns.array, function (col) {
9393					return col.filterable ? $('<li/>').append(
9394						$('<a/>', {'class': 'checkbox'}).append(
9395							$('<label/>', {html: col.title}).prepend(
9396								$('<input/>', {type: 'checkbox', checked: true}).data('__FooTableColumn__', col)
9397							)
9398						)
9399					) : null;
9400				})
9401			);
9402
9403			if (self.delay > 0){
9404				self.$input.on('keypress keyup paste', { self: self }, self._onSearchInputChanged);
9405				self.$dropdown.on('click', 'input[type="checkbox"]', {self: self}, self._onSearchColumnClicked);
9406			}
9407
9408			$input_grp_btn.append(self.$button, $dropdown_toggle, self.$dropdown);
9409			$input_grp.append(self.$input, $input_grp_btn);
9410		},
9411		/**
9412		 * Performs the filtering of rows before they are appended to the page.
9413		 * @instance
9414		 * @protected
9415		 */
9416		predraw: function(){
9417			if (F.is.emptyArray(this.filters))
9418				return;
9419
9420			var self = this;
9421			self.ft.rows.array = $.grep(self.ft.rows.array, function(r){
9422				return r.filtered(self.filters);
9423			});
9424		},
9425		/**
9426		 * As the rows are drawn by the {@link FooTable.Rows#draw}
9426 method this simply updates the colspan for the UI.
9427		 * @instance
9428		 * @protected
9429		 */
9430		draw: function(){
9431			if (F.is.jq(this.$cell)){
9432				this.$cell.attr('colspan', this.ft.columns.visibleColspan);
9433			}
9434			var search = this.find('search');
9435			if (search instanceof F.Filter){
9436				var query = search.query.val();
9437				if (this.exactMatch && this._exactRegExp.test(query)){
9438					query = query.replace(this._exactRegExp, '$1');
9439				}
9440				this.$input.val(query);
9441			} else {
9442				this.$input.val(null);
9443			}
9444			this.setButton(!F.arr.any(this.filters, function(f){ return !f.hidden; }));
9445		},
9446
9447		/* PUBLIC */
9448		/**
9449		 * Adds or updates the filter using the supplied name, query and columns.
9450		 * @instance
9451		 * @param {(string|FooTable.Filter|object)} nameOrFilter - The name for the filter or the actual filter object itself.
9452		 * @param {(string|FooTable.Query)} [query] - The query for the filter. This is only optional when the first parameter is a filter object.
9453		 * @param {(Array.<number>|Array.<string>|Array.<FooTable.Column>)} [columns] - The columns to apply the filter to.
9454		 * 	If not supplied the filter will be applied to all selected columns in the search input dropdown.
9455		 * @param {boolean} [ignoreCase=true] - Whether or not ignore case when matching.
9456		 * @param {boolean} [connectors=true] - Whether or not to replace phrase connectors (+.-_) with spaces.
9457		 * @param {string} [space="AND"] - How the query treats space chars.
9458		 * @param {boolean} [hidden=true] - Whether or not this is a hidden filter.
9459		 */
9460		addFilter: function(nameOrFilter, query, columns, ignoreCase, connectors, space, hidden){
9461			var f = this.createFilter(nameOrFilter, query, columns, ignoreCase, connectors, space, hidden);
9462			if (f instanceof F.Filter){
9463				this.removeFilter(f.name);
9464				this.filters.push(f);
9465			}
9466		},
9467		/**
9468		 * Removes the filter using the supplied name if it exists.
9469		 * @instance
9470		 * @param {string} name - The name of the filter to remove.
9471		 */
9472		removeFilter: function(name){
9473			F.arr.remove(this.filters, function(f){ return f.name == name; });
9474		},
9475		/**
9476		 * 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.
9477		 * @instance
9478		 * @param {boolean} [focus=false] - Whether or not to set the focus to the input once filtering is complete.
9479		 * @returns {jQuery.Promise}
9480		 * @fires FooTable.Filtering#"before.ft.filtering"
9481		 * @fires FooTable.Filtering#"after.ft.filtering"
9482		 */
9483		filter: function(focus){
9484			var self = this;
9485			self.filters = self.ensure(self.filters);
9486			/**
9487			 * 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.
9488			 * @event FooTable.Filtering#"before.ft.filtering"
9489			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
9490			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
9491			 * @param {Array.<FooTable.Filter>} filters - The filters that are about to be applied.
9492			 */
9493			return self.ft.raise('before.ft.filtering', [self.filters]).then(function(){
9494				self.filters = self.ensure(self.filters);
9495				if (focus){
9496					var start = self.$input.prop('selectionStart'),
9497						end = self.$input.prop('selectionEnd');
9498				}
9499				return self.ft.draw().then(function(){
9500					if (focus){
9501						self.$input.focus().prop({
9502							selectionStart: start,
9503							selectionEnd: end
9504						});
9505					}
9506					/**
9507					 * The after.ft.filtering event is raised after a filter has been applied.
9508					 * @event FooTable.Filtering#"after.ft.filtering"
9509					 * @param {jQuery.Event} e - The jQuery.Event object for the event.
9510					 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
9511					 * @param {FooTable.Filter} filter - The filters that were applied.
9512					 */
9513					self.ft.raise('after.ft.filtering', [self.filters]);
9514				});
9515			});
9516		},
9517		/**
9518		 * Removes the current search filter.
9519		 * @instance
9520		 * @returns {jQuery.Promise}
9521		 * @fires FooTable.Filtering#"before.ft.filtering"
9522		 * @fires FooTable.Filtering#"after.ft.filtering"
9523		 */
9524		clear: function(){
9525			this.filters = F.arr.get(this.filters, function(f){ return f.hidden; });
9526			return this.filter(this.focus);
9527		},
9528		/**
9529		 * Toggles the button icon between the search and clear icons based on the supplied value.
9530		 * @instance
9531		 * @param {boolean} search - Whether or not to display the search icon.
9532		 */
9533		setButton: function(search){
9534			if (!search){
9535				this.$button.children('.fooicon').removeClass('fooicon-search').addClass('fooicon-remove');
9536			} else {
9537				this.$button.children('.fooicon').removeClass('fooicon-remove').addClass('fooicon-search');
9538			}
9539		},
9540		/**
9541		 * Finds a filter by name.
9542		 * @param {string} name - The name of the filter to find.
9543		 * @returns {(FooTable.Filter|null)}
9544		 */
9545		find: function(name){
9546			return F.arr.first(this.filters, function(f){ return f.name == name; });
9547		},
9548		/**
9549		 * 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.
9550		 * @instance
9551		 * @returns {Array.<FooTable.Column>}
9552		 */
9553		columns: function(){
9554			if (F.is.jq(this.$dropdown)){
9555				// if we have a dropdown containing the column names get the selected columns from there
9556				return this.$dropdown.find('input:checked').map(function(){
9557					return $(this).data('__FooTableColumn__');
9558				}).get();
9559			} else {
9560				// otherwise find all columns that are set to be filterable.
9561				return this.ft.columns.get(function(c){ return c.filterable; });
9562			}
9563		},
9564		/**
9565		 * 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.
9566		 * 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}.
9567		 * @instance
9568		 * @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.
9569		 * @returns {Array.<FooTable.Filter>}
9570		 */
9571		ensure: function(filters){
9572			var self = this, parsed = [], filterable = self.columns();
9573			if (!F.is.emptyArray(filters)){
9574				F.arr.each(filters, function(f){
9575					f = self._ensure(f, filterable);
9576					if (f instanceof F.Filter) parsed.push(f);
9577				});
9578			}
9579			return parsed;
9580		},
9581
9582		/**
9583		 * Creates a new filter using the supplied object or individual parameters to populate it.
9584		 * @instance
9585		 * @param {(string|FooTable.Filter|object)} nameOrObject - The name for the filter or the actual filter object itself.
9586		 * @param {(string|FooTable.Query)} [query] - The query for the filter. This is only optional when the first parameter is a filter object.
9587		 * @param {(Array.<number>|Array.<string>|Array.<FooTable.Column>)} [columns] - The columns to apply the filter to.
9588		 * 	If not supplied the filter will be applied to all selected columns in the search input dropdown.
9589		 * @param {boolean} [ignoreCase=true] - Whether or not ignore case when matching.
9590		 * @param {boolean} [connectors=true] - Whether or not to replace phrase connectors (+.-_) with spaces.
9591		 * @param {string} [space="AND"] - How the query treats space chars.
9592		 * @param {boolean} [hidden=true] - Whether or not this is a hidden filter.
9593		 * @returns {*}
9594		 */
9595		createFilter: function(nameOrObject, query, columns, ignoreCase, connectors, space, hidden){
9596			if (F.is.string(nameOrObject)){
9597				nameOrObject = {name: nameOrObject, query: query, columns: columns, ignoreCase: ignoreCase, connectors: connectors, space: space, hidden: hidden};
9598			}
9599			return this._ensure(nameOrObject, this.columns());
9600		},
9601
9602		/* PRIVATE */
9603		_ensure: function(filter, selectedColumns){
9604			if ((F.is.hash(filter) || filter instanceof F.Filter) && !F.is.emptyString(filter.name) && (!F.is.emptyString(filter.query) || filter.query instanceof F.Query)){
9605				filter.columns = F.is.emptyArray(filter.columns) ? selectedColumns : this.ft.columns.ensure(filter.columns);
9606				filter.ignoreCase = F.is.boolean(filter.ignoreCase) ? filter.ignoreCase : this.ignoreCase;
9607				filter.connectors = F.is.boolean(filter.connectors) ? filter.connectors : this.connectors;
9608				filter.hidden = F.is.boolean(filter.hidden) ? filter.hidden : false;
9609				filter.space = F.is.string(filter.space) && (filter.space === 'AND' || filter.space === 'OR') ? filter.space : this.space;
9610				filter.query = F.is.string(filter.query) ? new F.Query(filter.query, filter.space, filter.connectors, filter.ignoreCase) : filter.query;
9611				return (filter instanceof F.Filter)
9612					? filter
9613					: new F.Filter(filter.name, filter.query, filter.columns, filter.space, filter.connectors, filter.ignoreCase, filter.hidden);
9614			}
9615			return null;
9616		},
9617		/**
9618		 * Handles the change event for the {@link FooTable.Filtering#$input}.
9619		 * @instance
9620		 * @private
9621		 * @param {jQuery.Event} e - The event object for the event.
9622		 */
9623		_onSearchInputChanged: function (e) {
9624			var self = e.data.self;
9625			var alpha = e.type == 'keypress' && !F.is.emptyString(String.fromCharCode(e.charCode)),
9626				ctrl = e.type == 'keyup' && (e.which == 8 || e.which == 46),
9627				paste = e.type == 'paste'; // backspace & delete
9628
9629			// if alphanumeric characters or specific control characters
9630			if(alpha || ctrl || paste) {
9631				if (e.which == 13) e.preventDefault();
9632				if (self._filterTimeout != null) clearTimeout(self._filterTimeout);
9633				self._filterTimeout = setTimeout(function(){
9634					self._filterTimeout = null;
9635					var query = self.$input.val();
9636					if (query.length >= self.min){
9637						if (self.exactMatch && !self._exactRegExp.test(query)){
9638							query = '"' + query + '"';
9639						}
9640						self.addFilter('search', query);
9641						self.filter(self.focus);
9642					} else if (F.is.emptyString(query)){
9643						self.clear();
9644					}
9645				}, self.delay);
9646			}
9647		},
9648		/**
9649		 * Handles the click event for the {@link FooTable.Filtering#$button}.
9650		 * @instance
9651		 * @private
9652		 * @param {jQuery.Event} e - The event object for the event.
9653		 */
9654		_onSearchButtonClicked: function (e) {
9655			e.preventDefault();
9656			var self = e.data.self;
9657			if (self._filterTimeout != null) clearTimeout(self._filterTimeout);
9658			var $icon = self.$button.children('.fooicon');
9659			if ($icon.hasClass('fooicon-remove')) self.clear();
9660			else {
9661				var query = self.$input.val();
9662				if (query.length >= self.min){
9663					if (self.exactMatch && !self._exactRegExp.test(query)){
9664						query = '"' + query + '"';
9665					}
9666					self.addFilter('search', query);
9667					self.filter(self.focus);
9668				}
9669			}
9670		},
9671		/**
9672		 * Handles the click event for the column checkboxes in the {@link FooTable.Filtering#$dropdown}.
9673		 * @instance
9674		 * @private
9675		 * @param {jQuery.Event} e - The event object for the event.
9676		 */
9677		_onSearchColumnClicked: function (e) {
9678			var self = e.data.self;
9679			if (self._filterTimeout != null) clearTimeout(self._filterTimeout);
9680			self._filterTimeout = setTimeout(function(){
9681				self._filterTimeout = null;
9682				var $icon = self.$button.children('.fooicon');
9683				if ($icon.hasClass('fooicon-remove')){
9684					$icon.removeClass('fooicon-remove').addClass('fooicon-search');
9685					self.addFilter('search', self.$input.val());
9686					self.filter();
9687				}
9688			}, self.delay);
9689		},
9690		/**
9691		 * Handles the click event for the {@link FooTable.Filtering#$dropdown} toggle.
9692		 * @instance
9693		 * @private
9694		 * @param {jQuery.Event} e - The event object for the event.
9695		 */
9696		_onDropdownToggleClicked: function (e) {
9697			e.preventDefault();
9698			e.stopPropagation();
9699			var self = e.data.self;
9700			self.$dropdown.parent().toggleClass('open');
9701			if (self.$dropdown.parent().hasClass('open')) $(document).on('click.footable', { self: self }, self._onDocumentClicked);
9702			else $(document).off('click.footable', self._onDocumentClicked);
9703		},
9704		/**
9705		 * Checks all click events when the dropdown is visible and closes the menu if the target is not the dropdown.
9706		 * @instance
9707		 * @private
9708		 * @param {jQuery.Event} e - The event object for the event.
9709		 */
9710		_onDocumentClicked: function(e){
9711			if ($(e.target).closest('.dropdown-menu').length == 0){
9712				e.preventDefault();
9713				var self = e.data.self;
9714				self.$dropdown.parent().removeClass('open');
9715				$(document).off('click.footable', self._onDocumentClicked);
9716			}
9717		}
9718	});
9719
9720	F.components.register('filtering', F.Filtering, 500);
9721
9722})(jQuery, FooTable);
9723
9724(function(F){
9725	F.Query = F.Class.extend(/** @lends FooTable.Query */{
9726		/**
9727		 * The query object is used to parse and test the filtering component's queries
9728		 * @constructs
9729		 * @extends FooTable.Class
9730		 * @param {string} query - The string value of the query.
9731		 * @param {string} [space="AND"] - How the query treats whitespace.
9732		 * @param {boolean} [connectors=true] - Whether or not to replace phrase connectors (+.-_) with spaces.
9733		 * @param {boolean} [ignoreCase=true] - Whether or not ignore case when matching.
9734		 * @returns {FooTable.Query}
9735		 */
9736		construct: function(query, space, connectors, ignoreCase){
9737			/* PRIVATE */
9738			/**
9739			 * Holds the previous value of the query and is used internally in the {@link FooTable.Query#val} method.
9740			 * @type {string}
9741			 * @private
9742			 */
9743			this._original = null;
9744			/**
9745			 * Holds the value for the query. Access to this variable is provided through the {@link FooTable.Query#val} method.
9746			 * @type {string}
9747			 * @private
9748			 */
9749			this._value = null;
9750			/* PUBLIC */
9751			/**
9752			 * A string specifying how the query treats whitespace. Can be either "OR" or "AND".
9753			 * @type {string}
9754			 */
9755			this.space = F.is.string(space) && (space == 'OR' || space == 'AND') ? space : 'AND';
9756			/**
9757			 * Whether or not to replace phrase connectors (+.-_) with spaces before executing the query.
9758			 * @instance
9759			 * @type {boolean}
9760			 */
9761			this.connectors = F.is.boolean(connectors) ? connectors : true;
9762			/**
9763			 * Whether or not ignore case when matching.
9764			 * @instance
9765			 * @type {boolean}
9766			 */
9767			this.ignoreCase = F.is.boolean(ignoreCase) ? ignoreCase : true;
9768			/**
9769			 * The left side of the query if one exists. OR takes precedence over AND.
9770			 * @type {FooTable.Query}
9771			 * @example <caption>The below shows what is meant by the "left" side of a query</caption>
9772			 * query = "Dave AND Mary" - "Dave" is the left side of the query.
9773			 * query = "Dave AND Mary OR John" - "Dave and Mary" is the left side of the query.
9774			 */
9775			this.left = null;
9776			/**
9777			 * The right side of the query if one exists. OR takes precedence over AND.
9778			 * @type {FooTable.Query}
9779			 * @example <caption>The below shows what is meant by the "right" side of a query</caption>
9780			 * query = "Dave AND Mary" - "Mary" is the right side of the query.
9781			 * query = "Dave AND Mary OR John" - "John" is the right side of the query.
9782			 */
9783			this.right = null;
9784			/**
9785			 * The parsed parts of the query. This contains the information used to actually perform a match against a string.
9786			 * @type {Array}
9787			 */
9788			this.parts = [];
9789			/**
9790			 * The type of operand to apply to the results of the individual parts of the query.
9791			 * @type {string}
9792			 */
9793			this.operator = null;
9794			this.val(query);
9795		},
9796		/**
9797		 * Gets or sets the value for the query. During set the value is parsed setting all properties as required.
9798		 * @param {string} [value] - If supplied the value to set for this query.
9799		 * @returns {(string|undefined)}
9800		 */
9801		val: function(value){
9802			// get
9803			if (F.is.emptyString(value)) return this._value;
9804
9805			// set
9806			if (F.is.emptyString(this._original)) this._original = value;
9807			else if (this._original == value) return;
9808
9809			this._value = value;
9810			this._parse();
9811		},
9812		/**
9813		 * Tests the supplied string against the query.
9814		 * @param {string} str - The string to test.
9815		 * @returns {boolean}
9816		 */
9817		match: function(str){
9818			if (F.is.emptyString(this.operator) || this.operator === 'OR')
9819				return this._left(str, false) || this._match(str, false) || this._right(str, false);
9820			if (this.operator === 'AND')
9821				return this._left(str, true) && this._match(str, true) && this._right(str, true);
9822		},
9823		/**
9824		 * Matches this queries parts array against the supplied string.
9825		 * @param {string} str - The string to test.
9826		 * @param {boolean} def - The default value to return based on the operand.
9827		 * @returns {boolean}
9828		 * @private
9829		 */
9830		_match: function(str, def){
9831			var self = this, result = false, empty = F.is.emptyString(str);
9832			if (F.is.emptyArray(self.parts) && self.left instanceof F.Query) return def;
9833			if (F.is.emptyArray(self.parts)) return result;
9834			if (self.space === 'OR'){
9835				// 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
9836				F.arr.each(self.parts, function(p){
9837					if (p.empty && empty){
9838						result = true;
9839						if (p.negate){
9840							result = false;
9841							return result;
9842						}
9843					} else {
9844						var match = (p.exact ? F.str.containsExact : F.str.contains)(str, p.query, self.ignoreCase);
9845						if (match && !p.negate) result = true;
9846						if (match && p.negate) {
9847							result = false;
9848							return result;
9849						}
9850					}
9851				});
9852			} else {
9853				// otherwise with AND we check until the first failure and then exit
9854				result = true;
9855				F.arr.each(self.parts, function(p){
9856					if (p.empty){
9857						if ((!empty && !p.negate) || (empty && p.negate)) result = false;
9858						return result;
9859					} else {
9860						var match = (p.exact ? F.str.containsExact : F.str.contains)(str, p.query, self.ignoreCase);
9861						if ((!match && !p.negate) || (match && p.negate)) result = false;
9862						return result;
9863					}
9864				});
9865			}
9866			return result;
9867		},
9868		/**
9869		 * Matches the left side of the query if one exists with the supplied string.
9870		 * @param {string} str - The string to test.
9871		 * @param {boolean} def - The default value to return based on the operand.
9872		 * @returns {boolean}
9873		 * @private
9874		 */
9875		_left: function(str, def){
9876			return (this.left instanceof F.Query) ? this.left.match(str) : def;
9877		},
9878		/**
9879		 * Matches the right side of the query if one exists with the supplied string.
9880		 * @param {string} str - The string to test.
9881		 * @param {boolean} def - The default value to return based on the operand.
9882		 * @returns {boolean}
9883		 * @private
9884		 */
9885		_right: function(str, def){
9886			return (this.right instanceof F.Query) ? this.right.match(str) : def;
9887		},
9888		/**
9889		 * Parses the private {@link FooTable.Query#_value} property and populates the object.
9890		 * @private
9891		 */
9892		_parse: function(){
9893			if (F.is.emptyString(this._value)) return;
9894			// OR takes precedence so test for it first
9895			if (/\sOR\s/.test(this._value)){
9896				// we have an OR so split the value on the first occurrence of OR to get the left and right sides of the statement
9897				this.operator = 'OR';
9898				var or = this._value.split(/(?:\sOR\s)(.*)?/);
9899				this.left = new F.Query(or[0], this.space, this.connectors, this.ignoreCase);
9900				this.right = new F.Query(or[1], this.space, this.connectors, this.ignoreCase);
9901			} else if (/\sAND\s/.test(this._value)) {
9902				// there are no more OR's so start with AND
9903				this.operator = 'AND';
9904				var and = this._value.split(/(?:\sAND\s)(.*)?/);
9905				this.left = new F.Query(and[0], this.space, this.connectors, this.ignoreCase);
9906				this.right = new F.Query(and[1], this.space, this.connectors, this.ignoreCase);
9907			} else {
9908				// we have no more statements to parse so set the parts array by parsing each part of the remaining query
9909				var self = this;
9910				this.parts = F.arr.map(this._value.match(/(?:[^\s"]+|"[^"]*")+/g), function(str){
9911					return self._part(str);
9912				});
9913			}
9914		},
9915		/**
9916		 * Parses a single part of a query into an object to use during matching.
9917		 * @param {string} str - The string representation of the part.
9918		 * @returns {{query: string, negate: boolean, phrase: boolean, exact: boolean}}
9919		 * @private
9920		 */
9921		_part: function(str){
9922			var p = {
9923				query: str,
9924				negate: false,
9925				phrase: false,
9926				exact: false,
9927				empty: false
9928			};
9929			// support for NEGATE operand - (minus sign). Remove this first so we can get onto phrase checking
9930			if (F.str.startsWith(p.query, '-')){
9931				p.query = F.str.from(p.query, '-');
9932				p.negate = true;
9933			}
9934			// support for PHRASES (exact matches)
9935			if (/^"(.*?)"$/.test(p.query)){ // if surrounded in quotes strip them and nothing else
9936				p.query = p.query.replace(/^"(.*?)"$/, '$1');
9937				p.phrase = true;
9938				p.exact = true;
9939			} else if (this.connectors && /(?:\w)+?([-_\+\.])(?:\w)+?/.test(p.query)) { // otherwise replace supported phrase connectors (-_+.) with spaces
9940				p.query = p.query.replace(/(?:\w)+?([-_\+\.])(?:\w)+?/g, function(match, p1){
9941					return match.replace(p1, ' ');
9942				});
9943				p.phrase = true;
9944			}
9945			p.empty = p.phrase && F.is.emptyString(p.query);
9946			return p;
9947		}
9948	});
9949
9950})(FooTable);
9951(function(F){
9952
9953	/**
9954	 * 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.
9955	 * 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.
9956	 * @type {string}
9957	 * @default null
9958	 */
9959	F.Cell.prototype.filterValue = null;
9960
9961	// this is used to define the filtering specific properties on cell creation
9962	F.Cell.prototype.__filtering_define__ = function(valueOrElement){
9963		this.filterValue = this.column.filterValue.call(this.column, valueOrElement);
9964	};
9965
9966	// this is used to update the filterValue property whenever the cell value is changed
9967	F.Cell.prototype.__filtering_val__ = function(value){
9968		if (F.is.defined(value)){
9969			// set only
9970			this.filterValue = this.column.filterValue.call(this.column, value);
9971		}
9972	};
9973
9974	// overrides the public define method and replaces it with our own
9975	F.Cell.extend('define', function(valueOrElement){
9976		this._super(valueOrElement);
9977		this.__filtering_define__(valueOrElement);
9978	});
9979	// overrides the public val method and replaces it with our own
9980	F.Cell.extend('val', function(value, redraw, redrawSelf){
9981		var val = this._super(value, redraw, redrawSelf);
9982		this.__filtering_val__(value);
9983		return val;
9984	});
9985})(FooTable);
9986(function($, F){
9987	/**
9988	 * Whether or not the column can be used during filtering. Added by the {@link FooTable.Filtering} component.
9989	 * @type {boolean}
9990	 * @default true
9991	 */
9992	F.Column.prototype.filterable = true;
9993
9994	/**
9995	 * This is supplied either the cell value or jQuery object to parse. A str
9995ing value must be returned from this method and will be used during filtering operations.
9996	 * @param {(*|jQuery)} valueOrElement - The value or jQuery cell object.
9997	 * @returns {string}
9998	 * @this FooTable.Column
9999	 */
10000	F.Column.prototype.filterValue = function(valueOrElement){
10001		// if we have an element or a jQuery object use jQuery to get the value
10002		if (F.is.element(valueOrElement) || F.is.jq(valueOrElement)){
10003			var data = $(valueOrElement).data('filterValue');
10004			return F.is.defined(data) ? ''+data : $(valueOrElement).text();
10005		}
10006		// if options are supplied with the value
10007		if (F.is.hash(valueOrElement) && F.is.hash(valueOrElement.options)){
10008			if (F.is.string(valueOrElement.options.filterValue)) return valueOrElement.options.filterValue;
10009			if (F.is.defined(valueOrElement.value)) valueOrElement = valueOrElement.value;
10010		}
10011		if (F.is.defined(valueOrElement) && valueOrElement != null) return valueOrElement+''; // use the native toString of the value
10012		return ''; // otherwise we have no value so return an empty string
10013	};
10014
10015	// this is used to define the filtering specific properties on column creation
10016	F.Column.prototype.__filtering_define__ = function(definition){
10017		this.filterable = F.is.boolean(definition.filterable) ? definition.filterable : this.filterable;
10018		this.filterValue = F.checkFnValue(this, definition.filterValue, this.filterValue);
10019	};
10020
10021	// overrides the public define method and replaces it with our own
10022	F.Column.extend('define', function(definition){
10023		this._super(definition); // call the base so we don't have to redefine any previously set properties
10024		this.__filtering_define__(definition); // then call our own
10025	});
10026})(jQuery, FooTable);
10027(function(F){
10028	/**
10029	 * An object containing the filtering options for the plugin. Added by the {@link FooTable.Filtering} component.
10030	 * @type {object}
10031	 * @prop {boolean} enabled=false - Whether or not to allow filtering on the table.
10032	 * @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}.
10033	 * @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).
10034	 * @prop {number} min=1 - The minimum number of characters allowed in the search input before it is auto applied.
10035	 * @prop {string} space="AND" - Specifies how whitespace in a filter query is handled.
10036	 * @prop {string} placeholder="Search" - The string used as the placeholder for the search input.
10037	 * @prop {string} dropdownTitle=null - The title to display at the top of the search input column select.
10038	 * @prop {string} position="right" - The string used to specify the alignment of the search input.
10039	 * @prop {string} connectors=true - Whether or not to replace phrase connectors (+.-_) with space before executing the query.
10040	 * @prop {boolean} ignoreCase=true - Whether or not ignore case when matching.
10041	 * @prop {boolean} exactMatch=false - Whether or not search queries are treated as phrases when matching.
10042	 * @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.
10043	 * @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.
10044	 */
10045	F.Defaults.prototype.filtering = {
10046		enabled: false,
10047		filters: [],
10048		delay: 1200,
10049		min: 1,
10050		space: 'AND',
10051		placeholder: 'Search',
10052		dropdownTitle: null,
10053		position: 'right',
10054		connectors: true,
10055		ignoreCase: true,
10056		exactMatch: false,
10057		focus: true,
10058		container: null
10059	};
10060})(FooTable);
10061(function(F){
10062	/**
10063	 * Checks if the row is filtered using the supplied filters.
10064	 * @this FooTable.Row
10065	 * @param {Array.<FooTable.Filter>} filters - The filters to apply.
10066	 * @returns {boolean}
10067	 */
10068	F.Row.prototype.filtered = function(filters){
10069		var result = true, self = this;
10070		F.arr.each(filters, function(f){
10071			if ((result = f.matchRow(self)) == false) return false;
10072		});
10073		return result;
10074	};
10075})(FooTable);
10076(function($, F){
10077
10078	F.Sorter = F.Class.extend(/** @lends FooTable.Sorter */{
10079		/**
10080		 * The sorter object contains the column and direction to sort by.
10081		 * @constructs
10082		 * @extends FooTable.Class
10083		 * @param {FooTable.Column} column - The column to sort.
10084		 * @param {string} direction - The direction to sort by.
10085		 * @returns {FooTable.Sorter}
10086		 */
10087		construct: function(column, direction){
10088			/**
10089			 * The column to sort.
10090			 * @type {FooTable.Column}
10091			 */
10092			this.column = column;
10093			/**
10094			 * The direction to sort by.
10095			 * @type {string}
10096			 */
10097			this.direction = direction;
10098		}
10099	});
10100
10101})(jQuery, FooTable);
10102(function ($, F) {
10103	F.Sorting = F.Component.extend(/** @lends FooTable.Sorting */{
10104		/**
10105		 * The sorting component adds a small sort button to specified column headers allowing users to sort those columns in the table.
10106		 * @constructs
10107		 * @extends FooTable.Component
10108		 * @param {FooTable.Table} table - The parent {@link FooTable.Table} object for the component.
10109		 * @returns {FooTable.Sorting}
10110		 */
10111		construct: function (table) {
10112			// call the constructor of the base class
10113			this._super(table, table.o.sorting.enabled);
10114
10115			/* PROTECTED */
10116			/**
10117			 * This provides a shortcut to the {@link FooTable.Table#options}.[sorting]{@link FooTable.Defaults#sorting} object.
10118			 * @instance
10119			 * @protected
10120			 * @type {object}
10121			 */
10122			this.o = table.o.sorting;
10123			/**
10124			 * The current sorted column.
10125			 * @instance
10126			 * @type {FooTable.Column}
10127			 */
10128			this.column = null;
10129			/**
10130			 * Whether or not to allow sorting to occur, should be set using the {@link FooTable.Sorting#toggleAllowed} method.
10131			 * @instance
10132			 * @type {boolean}
10133			 */
10134			this.allowed = true;
10135			/**
10136			 * 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.
10137			 * @instance
10138			 * @type {{isset: boolean, rows: Array.<FooTable.Row>, column: string, direction: ?string}}
10139			 */
10140			this.initial = null;
10141		},
10142
10143		/* PROTECTED */
10144		/**
10145		 * Checks the supplied data and options for the sorting component.
10146		 * @instance
10147		 * @protected
10148		 * @param {object} data - The jQuery data object from the parent table.
10149		 * @fires FooTable.Sorting#"preinit.ft.sorting"
10150		 * @this FooTable.Sorting
10151		 */
10152		preinit: function(data){
10153			var self = this;
10154			/**
10155			 * The preinit.ft.sorting event is raised before the UI is created and provides the tables jQuery data object for additional options parsing.
10156			 * Calling preventDefault on this event will disable the component.
10157			 * @event FooTable.Sorting#"preinit.ft.sorting"
10158			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
10159			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
10160			 * @param {object} data - The jQuery data object of the table raising the event.
10161			 */
10162			this.ft.raise('preinit.ft.sorting', [data]).then(function(){
10163				if (self.ft.$el.hasClass('footable-sorting'))
10164					self.enabled = true;
10165				self.enabled = F.is.boolean(data.sorting)
10166					? data.sorting
10167					: self.enabled;
10168				if (!self.enabled) return;
10169				self.column = F.arr.first(self.ft.columns.array, function(col){ return col.sorted; });
10170			}, function(){
10171				self.enabled = false;
10172			});
10173		},
10174		/**
10175		 * Initializes the sorting component for the plugin using the supplied table and options.
10176		 * @instance
10177		 * @protected
10178		 * @fires FooTable.Sorting#"init.ft.sorting"
10179		 * @this FooTable.Sorting
10180		 */
10181		init: function () {
10182			/**
10183			 * The init.ft.sorting event is raised before its UI is generated.
10184			 * Calling preventDefault on this event will disable the component.
10185			 * @event FooTable.Sorting#"init.ft.sorting"
10186			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
10187			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
10188			 */
10189			var self = this;
10190			this.ft.raise('init.ft.sorting').then(function(){
10191				if (!self.initial){
10192					var isset = !!self.column;
10193					self.initial = {
10194						isset: isset,
10195						// grab a shallow copy of the rows array prior to sorting - allows us to reset without an initial sort
10196						rows: self.ft.rows.all.slice(0),
10197						// if there is a sorted column store its name and direction
10198						column: isset ? self.column.name : null,
10199						direction: isset ? self.column.direction : null
10200					}
10201				}
10202				F.arr.each(self.ft.columns.array, function(col){
10203					if (col.sortable){
10204						col.$el.addClass('footable-sortable').append($('<span/>', {'class': 'fooicon fooicon-sort'}));
10205					}
10206				});
10207				self.ft.$el.on('click.footable', '.footable-sortable', { self: self }, self._onSortClicked);
10208			}, function(){
10209				self.enabled = false;
10210			});
10211		},
10212		/**
10213		 * Destroys the sorting component removing any UI generated from the table.
10214		 * @instance
10215		 * @protected
10216		 * @fires FooTable.Sorting#"destroy.ft.sorting"
10217		 */
10218		destroy: function () {
10219			/**
10220			 * The destroy.ft.sorting event is raised before its UI is removed.
10221			 * Calling preventDefault on this event will prevent the component from being destroyed.
10222			 * @event FooTable.Sorting#"destroy.ft.sorting"
10223			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
10224			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
10225			 */
10226			var self = this;
10227			this.ft.raise('destroy.ft.paging').then(function(){
10228				self.ft.$el.off('click.footable', '.footable-sortable', self._onSortClicked);
10229				self.ft.$el.children('thead').children('tr.footable-header')
10230					.children('.footable-sortable').removeClass('footable-sortable footable-asc footable-desc')
10231					.find('span.fooicon').remove();
10232			});
10233		},
10234		/**
10235		 * Performs the actual sorting against the {@link FooTable.Rows#current} array.
10236		 * @instance
10237		 * @protected
10238		 */
10239		predraw: function () {
10240			if (!this.column) return;
10241			var self = this, col = self.column;
10242			self.ft.rows.array.sort(function (a, b) {
10243				return col.direction == 'DESC'
10244						? col.sorter(b.cells[col.index].sortValue, a.cells[col.index].sortValue)
10245						: col.sorter(a.cells[col.index].sortValue, b.cells[col.index].sortValue);
10246			});
10247		},
10248		/**
10249		 * Updates the sorting UI setting the state of the sort buttons.
10250		 * @instance
10251		 * @protected
10252		 */
10253		draw: function () {
10254			if (!this.column) return;
10255			var self = this,
10256				$sortable = self.ft.$el.find('thead > tr > .footable-sortable'),
10257				$active = self.column.$el;
10258
10259			$sortable.removeClass('footable-asc footable-desc').children('.fooicon').removeClass('fooicon-sort fooicon-sort-asc fooicon-sort-desc');
10260			$sortable.not($active).children('.fooicon').addClass('fooicon-sort');
10261			$active.addClass(self.column.direction == 'DESC' ? 'footable-desc' : 'footable-asc')
10262				.children('.fooicon').addClass(self.column.direction == 'DESC' ? 'fooicon-sort-desc' : 'fooicon-sort-asc');
10263		},
10264
10265		/* PUBLIC */
10266		/**
10267		 * Sets the sorting options and calls the {@link FooTable.Table#draw} method to perform the actual sorting.
10268		 * @instance
10269		 * @param {(string|number|FooTable.Column)} column - The column name, index or the actual {@link FooTable.Column} object to sort by.
10270		 * @param {string} [direction="ASC"] - The direction to sort by, either ASC or DESC.
10271		 * @returns {jQuery.Promise}
10272		 * @fires FooTable.Sorting#"before.ft.sorting"
10273		 * @fires FooTable.Sorting#"after.ft.sorting"
10274		 */
10275		sort: function(column, direction){
10276			return this._sort(column, direction);
10277		},
10278		/**
10279		 * Toggles whether or not sorting is currently allowed.
10280		 * @param {boolean} [state] - You can optionally specify the state you want it to be, if not supplied the current value is flipped.
10281		 */
10282		toggleAllowed: function(state){
10283			state = F.is.boolean(state) ? state : !this.allowed;
10284			this.allowed = state;
10285			this.ft.$el.toggleClass('footable-sorting-disabled', !this.allowed);
10286		},
10287		/**
10288		 * Checks whether any sorting has occurred for the table.
10289		 * @returns {boolean}
10290		 */
10291		hasChanged: function(){
10292			return !(!this.initial || !this.column ||
10293				(this.column.name === this.initial.column &&
10294					(this.column.direction === this.initial.direction || (this.initial.direction === null && this.column.direction === 'ASC')))
10295			);
10296		},
10297		/**
10298		 * Resets the table sorting to the initial state recorded in the components init method.
10299		 */
10300		reset: function(){
10301			if (!!this.initial){
10302				if (this.initial.isset){
10303					// if the initial value specified a column, sort by it
10304					this.sort(this.initial.column, this.initial.direction);
10305				} else {
10306					// if there was no initial column then we need to reset the rows to there original order
10307					if (!!this.column){
10308						// if there is a currently sorted column remove the asc/desc classes and set it to null.
10309						this.column.$el.removeClass('footable-asc footable-desc');
10310						this.column = null;
10311					}
10312					// replace the current all rows array with the one stored in the initial value
10313					this.ft.rows.all = this.initial.rows;
10314					// force the table to redraw itself using the updated rows array
10315					this.ft.draw();
10316				}
10317			}
10318		},
10319
10320		/* PRIVATE */
10321		/**
10322		 * 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.
10323		 * @instance
10324		 * @private
10325		 * @param {(string|number|FooTable.Column)} column - The column name, index or the actual {@link FooTable.Column} object to sort by.
10326		 * @param {string} [direction="ASC"] - The direction to sort by, either ASC or DESC.
10327		 * @returns {jQuery.Promise}
10328		 * @fires FooTable.Sorting#"before.ft.sorting"
10329		 * @fires FooTable.Sorting#"after.ft.sorting"
10330		 */
10331		_sort: function(column, direction){
10332			if (!this.allowed) return $.Deferred().reject('sorting disabled');
10333			var self = this;
10334			var sorter = new F.Sorter(self.ft.columns.get(column), F.Sorting.dir(direction));
10335			/**
10336			 * 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.
10337			 * @event FooTable.Sorting#"before.ft.sorting"
10338			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
10339			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
10340			 * @param {FooTable.Sorter} sorter - The sorter that is about to be applied.
10341			 */
10342			return self.ft.raise('before.ft.sorting', [sorter]).then(function(){
10343				F.arr.each(self.ft.columns.array, function(col){
10344					if (col != self.column) col.direction = null;
10345				});
10346				self.column = self.ft.columns.get(sorter.column);
10347				if (self.column) self.column.direction = F.Sorting.dir(sorter.direction);
10348				return self.ft.draw().then(function(){
10349					/**
10350					 * The after.ft.sorting event is raised after a sorter has been applied.
10351					 * @event FooTable.Sorting#"after.ft.sorting"
10352					 * @param {jQuery.Event} e - The jQuery.Event object for the event.
10353					 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
10354					 * @param {FooTable.Sorter} sorter - The sorter that has been applied.
10355					 */
10356					self.ft.raise('after.ft.sorting', [sorter]);
10357				});
10358			});
10359		},
10360		/**
10361		 * Handles the sort button clicked event.
10362		 * @instance
10363		 * @private
10364		 * @param {jQuery.Event} e - The event object for the event.
10365		 */
10366		_onSortClicked: function (e) {
10367			var self = e.data.self, $header = $(this).closest('th,td'),
10368				direction = $header.is('.footable-asc, .footable-desc')
10369					? ($header.hasClass('footable-desc') ? 'ASC' : 'DESC')
10370					: 'ASC';
10371			self._sort($header.index(), direction);
10372		}
10373	});
10374
10375	/**
10376	 * Checks the supplied string is a valid direction and if not returns ASC as default.
10377	 * @static
10378	 * @protected
10379	 * @param {string} str - The string to check.
10380	 */
10381	F.Sorting.dir = function(str){
10382		return F.is.string(str) && (str == 'ASC' || str == 'DESC') ? str : 'ASC';
10383	};
10384
10385	F.components.register('sorting', F.Sorting, 600);
10386
10387})(jQuery, FooTable);
10388(function(F){
10389
10390	/**
10391	 * The value used by the sorting component during sort operations. Can be set using the data-sort-value attribute on the cell itself.
10392	 * 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.
10393	 * @type {string}
10394	 * @default null
10395	 */
10396	F.Cell.prototype.sortValue = null;
10397
10398	// this is used to define the sorting specific properties on cell creation
10399	F.Cell.prototype.__sorting_define__ = function(valueOrElement){
10400		this.sortValue = this.column.sortValue.call(this.column, valueOrElement);
10401	};
10402
10403	// this is used to update the sortValue property whenever the cell value is changed
10404	F.Cell.prototype.__sorting_val__ = function(value){
10405		if (F.is.defined(value)){
10406			// set only
10407			this.sortValue = this.column.sortValue.call(this.column, value);
10408		}
10409	};
10410
10411	// overrides the public define method and replaces it with our own
10412	F.Cell.extend('define', function(valueOrElement){
10413		this._super(valueOrElement);
10414		this.__sorting_define__(valueOrElement);
10415	});
10416	// overrides the public val method and replaces it with our own
10417	F.Cell.extend('val', function(value, redraw, redrawSelf){
10418		var val = this._super(value, redraw, redrawSelf);
10419		this.__sorting_val__(value);
10420		return val;
10421	});
10422})(FooTable);
10423(function($, F){
10424	/**
10425	 * 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.
10426	 * @type {string}
10427	 * @default null
10428	 */
10429	F.Column.prototype.direction = null;
10430	/**
10431	 * Whether or not the column can be sorted. Added by the {@link FooTable.Sorting} component.
10432	 * @type {boolean}
10433	 * @default true
10434	 */
10435	F.Column.prototype.sortable = true;
10436	/**
10437	 * Whether or not the column is sorted. Added by the {@link FooTable.Sorting} component.
10438	 * @type {boolean}
10439	 * @default false
10440	 */
10441	F.Column.prototype.sorted = false;
10442
10443	/**
10444	 * 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.
10445	 * @param {*} a - The first value to be compared.
10446	 * @param {*} b - The second value to compare to the first.
10447	 * @returns {number}
10448	 * @example <caption>This example shows using pseudo code what a sort function would look like.</caption>
10449	 * "sorter": function(a, b){
10450	 * 	if (a is less than b by some ordering criterion) {
10451	 * 		return -1;
10452	 * 	}
10453	 * 	if (a is greater than b by the ordering criterion) {
10454	 * 		return 1;
10455	 * 	}
10456	 * 	// a must be equal to b
10457	 * 	return 0;
10458	 * }
10459	 */
10460	F.Column.prototype.sorter = function(a, b){
10461		if (typeof a === 'string') a = a.toLowerCase();
10462		if (typeof b === 'string') b = b.toLowerCase();
10463		if (a === b) return 0;
10464		if (a < b) return -1;
10465		return 1;
10466	};
10467
10468	/**
10469	 * 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.
10470	 * @param {(*|jQuery)} valueOrElement - The value or jQuery cell object.
10471	 * @returns {*}
10472	 * @this FooTable.Column
10473	 */
10474	F.Column.prototype.sortValue = function(valueOrElement){
10475		// if we have an element or a jQuery object use jQuery to get the value
10476		if (F.is.element(valueOrElement) || F.is.jq(valueOrElement)){
10477			var data = $(valueOrElement).data('sortValue');
10478			return F.is.defined(data) ? data : this.parser(valueOrElement);
10479		}
10480		// if options are supplied with the value
10481		if (F.is.hash(valueOrElement) && F.is.hash(valueOrElement.options)){
10482			if (F.is.string(valueOrElement.options.sortValue)) return valueOrElement.options.sortValue;
10483			if (F.is.defined(valueOrElement.value)) valueOrElement = valueOrElement.value;
10484		}
10485		if (F.is.defined(valueOrElement) && valueOrElement != null) return valueOrElement;
10486		return null;
10487	};
10488
10489	// this is used to define the sorting specific properties on column creation
10490	F.Column.prototype.__sorting_define__ = function(definition){
10491		this.sorter = F.checkFnValue(this, definition.sorter, this.sorter);
10492		this.direction = F.is.type(definition.direction, 'string') ? F.Sorting.dir(definition.direction) : null;
10493		this.sortable = F.is.boolean(definition.sortable) ? definition.sortable : true;
10494		this.sorted = F.is.boolean(definition.sorted) ? definition.sorted : false;
10495		this.sortValue = F.checkFnValue(this, definition.sortValue, this.sortValue);
10496	};
10497
10498	// overrides the public define method and replaces it with our own
10499	F.Column.extend('define', function(definition){
10500		this._super(definition);
10501		this.__sorting_define__(definition);
10502	});
10503
10504})(jQuery, FooTable);
10505(function(F){
10506	/**
10507	 * An object containing the sorting options for the plugin. Added by the {@link FooTable.Sorting} component.
10508	 * @type {object}
10509	 * @prop {boolean} enabled=false - Whether or not to allow sorting on the table.
10510	 */
10511	F.Defaults.prototype.sorting = {
10512		enabled: false
10513	};
10514})(FooTable);
10515(function($, F){
10516
10517	F.HTMLColumn.extend('__sorting_define__', function(definition){
10518		this._super(definition);
10519		this.sortUse = F.is.string(definition.sortUse) && $.inArray(definition.sortUse, ['html','text']) !== -1 ? definition.sortUse : 'html';
10520	});
10521
10522	/**
10523	 * 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.
10524	 * @param {(*|jQuery)} valueOrElement - The value or jQuery cell object.
10525	 * @returns {*}
10526	 * @this FooTable.HTMLColumn
10527	 */
10528	F.HTMLColumn.prototype.sortValue = function(valueOrElement){
10529		// if we have an element or a jQuery object use jQuery to get the data value or pass it off to the parser
10530		if (F.is.element(valueOrElement) || F.is.jq(valueOrElement)){
10531			var data = $(valueOrElement).data('sortValue');
10532			return F.is.defined(data) ? data : this.parser(valueOrElement);
10533		}
10534		// if options are supplied with the value
10535		if (F.is.hash(valueOrElement) && F.is.hash(valueOrElement.options)){
10536			if (F.is.string(valueOrElement.options.sortValue)) return valueOrElement.options.sortValue;
10537			if (F.is.defined(valueOrElement.value)) valueOrElement = valueOrElement.value;
10538		}
10539		if (F.is.defined(valueOrElement) && valueOrElement != null) return valueOrElement;
10540		return null;
10541	};
10542
10543})(jQuery, FooTable);
10544(function($, F){
10545
10546	/**
10547	 * 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.
10548	 * @param {(*|jQuery)} valueOrElement - The value or jQuery cell object.
10549	 * @returns {*}
10550	 */
10551	F.NumberColumn.prototype.sortValue = function(valueOrElement){
10552		// if we have an element or a jQuery object use jQuery to get the data value or pass it off to the parser
10553		if (F.is.element(valueOrElement) || F.is.jq(valueOrElement)){
10554			var data = $(valueOrElement).data('sortValue');
10555			return F.is.number(data) ? data : this.parser(valueOrElement);
10556		}
10557		// if options are supplied with the value
10558		if (F.is.hash(valueOrElement) && F.is.hash(valueOrElement.options)){
10559			if (F.is.string(valueOrElement.options.sortValue)) return this.parser(valueOrElement);
10560			if (F.is.number(valueOrElement.options.sortValue)) return valueOrElement.options.sortValue;
10561			if (F.is.number(valueOrElement.value)) return valueOrElement.value;
10562		}
10563		if (F.is.string(valueOrElement)) return this.parser(valueOrElement);
10564		if (F.is.number(valueOrElement)) return valueOrElement;
10565		return null;
10566	};
10567
10568})(jQuery, FooTable);
10569(function(F){
10570	/**
10571	 * Sort the table using the specified column and direction. Added by the {@link FooTable.Sorting} component.
10572	 * @instance
10573	 * @param {(string|number|FooTable.Column)} column - The column name, index or the actual {@link FooTable.Column} object to sort by.
10574	 * @param {string} [direction="ASC"] - The direction to sort by, either ASC or DESC.
10575	 * @returns {jQuery.Promise}
10576	 * @fires FooTable.Sorting#"change.ft.sorting"
10577	 * @fires FooTable.Sorting#"changed.ft.sorting"
10578	 * @see FooTable.Sorting#sort
10579	 */
10580	F.Table.prototype.sort = function(column, direction){
10581		return this.use(F.Sorting).sort(column, direction);
10582	};
10583})(FooTable);
10584(function($, F){
10585
10586	F.Pager = F.Class.extend(/** @lends FooTable.Pager */{
10587		/**
10588		 * The pager object contains the page number and direction to page to.
10589		 * @constructs
10590		 * @extends FooTable.Class
10591		 * @param {number} total - The total number of pages available.
10592		 * @param {number} current - The current page number.
10593		 * @param {number} size - The number of rows per page.
10594		 * @param {number} page - The page number to goto.
10595		 * @param {boolean} forward - A boolean indicating the direction of paging, TRUE = forward, FALSE = back.
10596		 * @returns {FooTable.Pager}
10597		 */
10598		construct: function(total, current, size, page, forward){
10599			/**
10600			 * The total number of pages available.
10601			 * @type {number}
10602			 */
10603			this.total = total;
10604			/**
10605			 * The current page number.
10606			 * @type {number}
10607			 */
10608			this.current = current;
10609			/**
10610			 * The number of rows per page.
10611			 * @type {number}
10612			 */
10613			this.size = size;
10614			/**
10615			 * The page number to goto.
10616			 * @type {number}
10617			 */
10618			this.page = page;
10619			/**
10620			 * A boolean indicating the direction of paging, TRUE = forward, FALSE = back.
10621			 * @type {boolean}
10622			 */
10623			this.forward = forward;
10624		}
10625	});
10626
10627})(jQuery, FooTable);
10628(function($, F){
10629	F.Paging = F.Component.extend(/** @lends FooTable.Paging */{
10630		/**
10631		 * The paging component adds a pagination control to the table allowing users to navigate table rows via pages.
10632		 * @constructs
10633		 * @extends FooTable.Component
10634		 * @param {FooTable.Table} table - The parent {@link FooTable.Table} object for the component.
10635		 * @returns {FooTable.Filtering}
10636		 */
10637		construct: function(table){
10638			// call the base constructor
10639			this._super(table, table.o.paging.enabled);
10640
10641			/* PROTECTED */
10642			/**
10643			 * An object containing the strings used by the paging buttons.
10644			 * @type {{ first: string, prev: string, next: string, last: string }}
10645			 */
10646			this.strings = table.o.paging.strings;
10647
10648			/* PUBLIC */
10649			/**
10650			 * The current page number to display.
10651			 * @instance
10652			 * @type {number}
10653			 */
10654			this.current = table.o.paging.current;
10655			/**
10656			 * The number of rows to display per page.
10657			 * @instance
10658			 * @type {number}
10659			 */
10660			this.size = table.o.paging.size;
10661			/**
10662			 * The maximum number of page links to display at once.
10663			 * @instance
10664			 * @type {number}
10665			 */
10666			this.limit = table.o.paging.limit;
10667			/**
10668			 * The position of the pagination control within the paging rows cell.
10669			 * @instance
10670			 * @type {string}
10671			 */
10672			this.position = table.o.paging.position;
10673			/**
10674			 * The format string used to generate the text displayed under the pagination control.
10675			 * @instance
10676			 * @type {string}
10677			 */
10678			this.countFormat = table.o.paging.countFormat;
10679			/**
10680			 * 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.
10681			 * @instance
10682			 * @type {string}
10683			 */
10684			this.container = table.o.paging.container;
10685				/**
10686			 * The total number of pages.
10687			 * @instance
10688			 * @type {number}
10689			 */
10690			this.total = -1;
10691			/**
10692			 * The number of rows in the {@link FooTable.Rows#array} before paging is applied.
10693			 * @instance
10694			 * @type {number}
10695			 */
10696			this.totalRows = 0;
10697			/**
10698			 * A number indicating the previous page displayed.
10699			 * @instance
10700			 * @type {number}
10701			 */
10702			this.previous = -1;
10703			/**
10704			 * 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.
10705			 * @instance
10706			 * @type {string}
10707			 */
10708			this.formattedCount = null;
10709			/**
10710			 * The jQuery object of the element containing the entire paging UI.
10711			 * @instance
10712			 * @type {jQuery}
10713			 */
10714			this.$container = null;
10715			/**
10716			 * The jQuery object of the element wrapping all the paging UI elements.
10717			 * @instance
10718			 * @type {jQuery}
10719			 */
10720			this.$wrapper = null;
10721			/** +
10722			 * The jQuery row object that contains all the paging specific elements.
10723			 * @instance
10724			 * @type {jQuery}
10725			 */
10726			this.$row = null;
10727			/**
10728			 * The jQuery cell object that contains the pagination control and total count.
10729			 * @instance
10730			 * @type {jQuery}
10731			 */
10732			this.$cell = null;
10733			/**
10734			 * The jQuery object that contains the links for the pagination control.
10735			 * @instance
10736			 * @type {jQuery}
10737			 */
10738			this.$pagination = null;
10739			/**
10740			 * The jQuery object that contains the row count.
10741			 * @instance
10742			 * @type {jQuery}
10743			 */
10744			this.$count = null;
10745			/**
10746			 * Whether or not the pagination row is detached from the table.
10747			 * @instance
10748			 * @type {boolean}
10749			 */
10750			this.detached = true;
10751
10752			/* PRIVATE */
10753			/**
10754			 * Used to hold the number of page links created.
10755			 * @instance
10756			 * @type {number}
10757			 * @private
10758			 */
10759			this._createdLinks = 0;
10760		},
10761
10762		/* PROTECTED */
10763		/**
10764		 * Checks the supplied data and options for the paging component.
10765		 * @instance
10766		 * @protected
10767		 * @param {object} data - The jQuery data object from the parent table.
10768		 * @fires FooTable.Paging#"preinit.ft.paging"
10769		 */
10770		preinit: function(data){
10771			var self = this;
10772			/**
10773			 * The preinit.ft.paging event is raised before the UI is created and provides the tables jQuery data object for additional options parsing.
10774			 * Calling preventDefault on this event will disable the component.
10775			 * @event FooTable.Paging#"preinit.ft.paging"
10776			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
10777			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
10778			 * @param {object} data - The jQuery data object of the table raising the event.
10779			 */
10780			this.ft.raise('preinit.ft.paging', [data]).then(function(){
10781				if (self.ft.$el.hasClass('footable-paging'))
10782					self.enabled = true;
10783				self.enabled = F.is.boolean(data.paging)
10784					? data.paging
10785					: self.enabled;
10786
10787				if (!self.enabled) return;
10788
10789				self.size = F.is.number(data.pagingSize)
10790					? data.pagingSize
10791					: self.size;
10792
10793				self.current = F.is.number(data.pagingCurrent)
10794					? data.pagingCurrent
10795					: self.current;
10796
10797				self.limit = F.is.number(data.pagingLimit)
10798					? data.pagingLimit
10799					: self.limit;
10800
10801				if (self.ft.$el.hasClass('footable-paging-left'))
10802					self.position = 'left';
10803				if (self.ft.$el.hasClass('footable-paging-center'))
10804					self.position = 'center';
10805				if (self.ft.$el.hasClass('footable-paging-right'))
10806					self.position = 'right';
10807
10808				self.position = F.is.string(data.pagingPosition)
10809					? data.pagingPosition
10810					: self.position;
10811
10812				self.countFormat = F.is.string(data.pagingCountFormat)
10813					? data.pagingCountFormat
10814					: self.countFormat;
10815
10816				self.container = F.is.string(data.pagingContainer)
10817					? data.pagingContainer
10818					: self.container;
10819
10820				self.total = Math.ceil(self.ft.rows.all.length / self.size);
10821			}, function(){
10822				self.enabled = false;
10823			});
10824		},
10825		/**
10826		 * Initializes the paging component for the plugin using the supplied table and options.
10827		 * @instance
10828		 * @protected
10829		 * @fires FooTable.Paging#"init.ft.paging"
10830		 */
10831		init: function(){
10832			/**
10833			 * The init.ft.paging event is raised before its UI is generated.
10834			 * Calling preventDefault on this event will disable the component.
10835			 * @event FooTable.Paging#"init.ft.paging"
10836			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
10837			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
10838			 */
10839			var self = this;
10840			this.ft.raise('init.ft.paging').then(function(){
10841				self.$create();
10842			}, function(){
10843				self.enabled = false;
10844			});
10845		},
10846		/**
10847		 * Destroys the paging component removing any UI generated from the table.
10848		 * @instance
10849		 * @protected
10850		 * @fires FooTable.Paging#"destroy.ft.paging"
10851		 */
10852		destroy: function () {
10853			/**
10854			 * The destroy.ft.paging event is raised before its UI is removed.
10855			 * Calling preventDefault on this event will prevent the component from being destroyed.
10856			 * @event FooTable.Paging#"destroy.ft.paging"
10857			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
10858			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
10859			 */
10860			var self = this;
10861			this.ft.raise('destroy.ft.paging').then(function(){
10862				self.ft.$el.removeClass('footable-paging')
10863					.find('tfoot > tr.footable-paging').remove();
10864				self.detached = true;
10865				self._createdLinks = 0;
10866			});
10867		},
10868		/**
10869		 * Performs the actual paging against the {@link FooTable.Rows#current} array removing all rows that are not on the current visible page.
10870		 * @instance
10871		 * @protected
10872		 */
10873		predraw: function(){
10874			this.total = Math.ceil(this.ft.rows.array.length / this.size);
10875			this.current = this.current > this.total ? this.total : (this.current < 1 ? 1 : this.current);
10876			this.totalRows = this.ft.rows.array.length;
10877			if (this.totalRows > this.size){
10878				this.ft.rows.array = this.ft.rows.array.splice((this.current - 1) * this.size, this.size);
10879			}
10880			this.formattedCount = this.format(this.countFormat);
10881		},
10882		/**
10883		 * Updates the paging UI setting the state of the pagination control.
10884		 * @instance
10885		 * @protected
10886		 */
10887		draw: function(){
10888			if (this.total <= 1){
10889				if (!this.detached){
10890					if (this.$row){
10891						this.$row.detach();
10892					} else {
10893						this.$wrapper.detach();
10894					}
10895					this.detached = true;
10896				}
10897			} else {
10898				if (this.detached){
10899					if (this.$row){
10900						var $tfoot = this.ft.$el.children('tfoot');
10901						if ($tfoot.length == 0){
10902							$tfoot = $('<tfoot/>');
10903							this.ft.$el.append($tfoot);
10904						}
10905						this.$row.appendTo($tfoot);
10906					} else {
10907						this.$wrapper.appendTo(this.$container);
10908					}
10909					this.detached = false;
10910				}
10911				if (F.is.jq(this.$cell)){
10912					this.$cell.attr('colspan', this.ft.columns.visibleColspan);
10913				}
10914				this._createLinks();
10915				this._setVisible(this.current, this.current > this.previous);
10916				this._setNavigation(true);
10917				this.$count.text(this.formattedCount);
10918			}
10919		},
10920		/**
10921		 * Creates the paging UI from the current options setting the various jQuery properties of this component.
10922		 * @instance
10923		 * @protected
10924		 */
10925		$create: function(){
10926			this._createdLinks = 0;
10927			var position = 'footable-paging-center';
10928			switch (this.position){
10929				case 'left': position = 'footable-paging-left'; break;
10930				case 'right': position = 'footable-paging-right'; break;
10931			}
10932			this.ft.$el.addClass('footable-paging').addClass(position);
10933
10934			this.$container = this.container === null ? null : $(this.container).first();
10935			if (!F.is.jq(this.$container)){
10936				var $tfoot = this.ft.$el.children('tfoot');
10937				if ($tfoot.length == 0){
10938					$tfoot = $('<tfoot/>');
10939					this.ft.$el.append($tfoot);
10940				}
10941				// add it to a row and then populate it with the search input and column selector dropdown.
10942				this.$row = $('<tr/>', {'class': 'footable-paging'}).prependTo($tfoot);
10943				this.$container = this.$cell = $('<td/>').attr('colspan', this.ft.columns.visibleColspan).appendTo(this.$row);
10944			} else {
10945				this.$container.addClass('footable-paging-external').addClass(position);
10946			}
10947			this.$wrapper = $('<div/>', {'class': 'footable-pagination-wrapper'}).appendTo(this.$container);
10948			this.$pagination = $('<ul/>', { 'class': 'pagination' }).on('click.footable', 'a.footable-page-link', { self: this }, this._onPageClicked);
10949			this.$count = $('<span/>', { 'class': 'label label-default' });
10950			this.$wrapper.append(this.$pagination, $('<div/>', {'class': 'divider'}), this.$count);
10951			this.detached = false;
10952		},
10953
10954		/* PUBLIC */
10955		/**
10956		 * @summary Uses the supplied format string and replaces the placeholder strings with the current values.
10957		 * @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:
10958		 * * {CP} - The current page number.
10959		 * * {TP} - The total number of pages.
10960		 * * {PF} - The first row of the current page.
10961		 * * {PL} - The last row of the current page.
10962		 * * {TR} - The total rows available.
10963		 * These placeholders can be supplied in a string like; "Showing {PF} to {PL} of {TR} rows."
10964		 * @param {string} formatString - The string to be formatted with the paging specific variables.
10965		 * @returns {string}
10966		 */
10967		format: function(formatString){
10968			var firstRow = (this.size * (this.current - 1)) + 1,
10969				lastRow = this.size * this.current;
10970			if (this.ft.rows.array.length == 0){
10971				firstRow = 0;
10972				lastRow = 0;
10973			} else {
10974				lastRow = lastRow > this.totalRows ? this.totalRows : lastRow;
10975			}
10976			return formatString.replace(/\{CP}/g, this.current)
10977				.replace(/\{TP}/g, this.total)
10978				.replace(/\{PF}/g, firstRow)
10979				.replace(/\{PL}/g, lastRow)
10980				.replace(/\{TR}/g, this.totalRows);
10981		},
10982		/**
10983		 * Pages to the first page.
10984		 * @instance
10985		 * @returns {jQuery.Promise}
10986		 * @fires FooTable.Paging#"before.ft.paging"
10987		 * @fires FooTable.Paging#"after.ft.paging"
10988		 */
10989		first: function(){
10990			return this._set(1);
10991		},
10992		/**
10993		 * Pages to the previous page.
10994		 * @instance
10995		 * @returns {jQuery.Promise}
10996		 * @fires FooTable.Paging#"before.ft.paging"
10997		 * @fires FooTable.Paging#"after.ft.paging"
10998		 */
10999		prev: function(){
11000			return this._set(this.current - 1 > 0 ? this.current - 1 : 1);
11001		},
11002		/**
11003		 * Pages to the next page.
11004		 * @instance
11005		 * @returns {jQuery.Promise}
11006		 * @fires FooTable.Paging#"before.ft.paging"
11007		 * @fires FooTable.Paging#"after.ft.paging"
11008		 */
11009		next: function(){
11010			return this._set(this.current + 1 < this.total ? this.current + 1 : this.total);
11011		},
11012		/**
11013		 * Pages to the last page.
11014		 * @instance
11015		 * @returns {jQuery.Promise}
11016		 * @fires FooTable.Paging#"before.ft.paging"
11017		 * @fires FooTable.Paging#"after.ft.paging"
11018		 */
11019		last: function(){
11020			return this._set(this.total);
11021		},
11022		/**
11023		 * Pages to the specified page.
11024		 * @instance
11025		 * @param {number} page - The page number to go to.
11026		 * @returns {jQuery.Promise}
11027		 * @fires FooTable.Paging#"before.ft.paging"
11028		 * @fires FooTable.Paging#"after.ft.paging"
11029		 */
11030		goto: function(page){
11031			return this._set(page > this.total ? this.total : (page < 1 ? 1 : page));
11032		},
11033		/**
11034		 * 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.
11035		 * @instance
11036		 */
11037		prevPages: function(){
11038			var page = this.$pagination.children('li.footable-page.visible:first').data('page') - 1;
11039			this._setVisible(page, true);
11040			this._setNavigation(false);
11041		},
11042		/**
11043		 * 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.
11044		 * @instance
11045		 */
11046		nextPages: function(){
11047			var page = this.$pagination.children('li.footable-page.visible:last').data('page') + 1;
11048			this._setVisible(page, false);
11049			this._setNavigation(false);
11050		},
11051		/**
11052		 * Gets or sets the current page size.
11053		 * @instance
11054		 * @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
11054d valid the current page size is returned.
11055		 * @returns {(number|undefined)}
11056		 */
11057		pageSize: function(value){
11058			value = parseInt(value);
11059			if (isNaN(value)){
11060				return this.size;
11061			}
11062			this.size = value;
11063			this.total = Math.ceil(this.ft.rows.all.length / this.size);
11064			if (F.is.jq(this.$wrapper)){
11065				if (this.$container.is("td")){
11066					this.$row.remove();
11067				} else {
11068					this.$wrapper.remove();
11069				}
11070			}
11071			this.$create();
11072			this.ft.draw();
11073		},
11074
11075		/* PRIVATE */
11076		/**
11077		 * 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.
11078		 * @instance
11079		 * @private
11080		 * @param {number} page - The page to set.
11081		 * @returns {jQuery.Promise}
11082		 * @fires FooTable.Paging#"before.ft.paging"
11083		 * @fires FooTable.Paging#"after.ft.paging"
11084		 */
11085		_set: function(page){
11086			var self = this,
11087				pager = new F.Pager(self.total, self.current, self.size, page, page > self.current);
11088			/**
11089			 * 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.
11090			 * @event FooTable.Paging#"before.ft.paging"
11091			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
11092			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
11093			 * @param {FooTable.Pager} pager - The pager that is about to be applied.
11094			 */
11095			return self.ft.raise('before.ft.paging', [pager]).then(function(){
11096				pager.page = pager.page > pager.total ? pager.total	: pager.page;
11097				pager.page = pager.page < 1 ? 1 : pager.page;
11098				if (self.current == page) return $.when();
11099				self.previous = self.current;
11100				self.current = pager.page;
11101				return self.ft.draw().then(function(){
11102					/**
11103					 * The after.ft.paging event is raised after a pager has been applied.
11104					 * @event FooTable.Paging#"after.ft.paging"
11105					 * @param {jQuery.Event} e - The jQuery.Event object for the event.
11106					 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
11107					 * @param {FooTable.Pager} pager - The pager that has been applied.
11108					 */
11109					self.ft.raise('after.ft.paging', [pager]);
11110				});
11111			});
11112		},
11113		/**
11114		 * Creates the pagination links using the current state of the plugin. If the total number of pages is the same as
11115		 * the last time this function was executed it does nothing.
11116		 * @instance
11117		 * @private
11118		 */
11119		_createLinks: function(){
11120			if (this._createdLinks === this.total) return;
11121			var self = this,
11122				multiple = self.total > 1,
11123				link = function(attr, html, klass){
11124					return $('<li/>', {
11125						'class': klass
11126					}).attr('data-page', attr)
11127						.append($('<a/>', {
11128							'class': 'footable-page-link',
11129							href: '#'
11130						}).data('page', attr).html(html));
11131				};
11132			self.$pagination.empty();
11133			if (multiple) {
11134				self.$pagination.append(link('first', self.strings.first, 'footable-page-nav'));
11135				self.$pagination.append(link('prev', self.strings.prev, 'footable-page-nav'));
11136				if (self.limit > 0 && self.limit < self.total){
11137					self.$pagination.append(link('prev-limit', self.strings.prevPages, 'footable-page-nav'));
11138				}
11139			}
11140			for (var i = 0, $li; i < self.total; i++){
11141				$li = link(i + 1, i + 1, 'footable-page');
11142				self.$pagination.append($li);
11143			}
11144			if (multiple){
11145				if (self.limit > 0 && self.limit < self.total){
11146					self.$pagination.append(link('next-limit', self.strings.nextPages, 'footable-page-nav'));
11147				}
11148				self.$pagination.append(link('next', self.strings.next, 'footable-page-nav'));
11149				self.$pagination.append(link('last', self.strings.last, 'footable-page-nav'));
11150			}
11151			self._createdLinks = self.total;
11152		},
11153		/**
11154		 * Sets the state for the navigation links of the pagination control and optionally sets the active class state on the current page link.
11155		 * @instance
11156		 * @private
11157		 * @param {boolean} active - Whether or not to set the active class state on the individual page links.
11158		 */
11159		_setNavigation: function(active){
11160			if (this.current == 1) {
11161				this.$pagination.children('li[data-page="first"],li[data-page="prev"]').addClass('disabled');
11162			} else {
11163				this.$pagination.children('li[data-page="first"],li[data-page="prev"]').removeClass('disabled');
11164			}
11165
11166			if (this.current == this.total) {
11167				this.$pagination.children('li[data-page="next"],li[data-page="last"]').addClass('disabled');
11168			} else {
11169				this.$pagination.children('li[data-page="next"],li[data-page="last"]').removeClass('disabled');
11170			}
11171
11172			if ((this.$pagination.children('li.footable-page.visible:first').data('page') || 1) == 1) {
11173				this.$pagination.children('li[data-page="prev-limit"]').addClass('disabled');
11174			} else {
11175				this.$pagination.children('li[data-page="prev-limit"]').removeClass('disabled');
11176			}
11177
11178			if ((this.$pagination.children('li.footable-page.visible:last').data('page') || this.limit) == this.total) {
11179				this.$pagination.children('li[data-page="next-limit"]').addClass('disabled');
11180			} else {
11181				this.$pagination.children('li[data-page="next-limit"]').removeClass('disabled');
11182			}
11183
11184			if (this.limit > 0 && this.total < this.limit){
11185				this.$pagination.children('li[data-page="prev-limit"],li[data-page="next-limit"]').css('display', 'none');
11186			} else {
11187				this.$pagination.children('li[data-page="prev-limit"],li[data-page="next-limit"]').css('display', '');
11188			}
11189
11190			if (active){
11191				this.$pagination.children('li.footable-page').removeClass('active').filter('li[data-page="' + this.current + '"]').addClass('active');
11192			}
11193		},
11194		/**
11195		 * Sets the visible page using the supplied parameters.
11196		 * @instance
11197		 * @private
11198		 * @param {number} page - The page to make visible.
11199		 * @param {boolean} right - If set to true the supplied page will be the right most visible pagination link.
11200		 */
11201		_setVisible: function(page, right){
11202			if (this.limit > 0 && this.total > this.limit){
11203				if (!this.$pagination.children('li.footable-page[data-page="'+page+'"]').hasClass('visible')){
11204					var start = 0, end = 0;
11205					if (right == true){
11206						end = page > this.total ? this.total : page;
11207						start = end - this.limit;
11208					} else {
11209						start = page < 1 ? 0 : page - 1;
11210						end = start + this.limit;
11211					}
11212					if (start < 0){
11213						start = 0;
11214						end = this.limit > this.total ? this.total : this.limit;
11215					}
11216					if (end > this.total){
11217						end = this.total;
11218						start = this.total - this.limit < 0 ? 0 : this.total - this.limit;
11219					}
11220					this.$pagination.children('li.footable-page').removeClass('visible').slice(start, end).addClass('visible');
11221				}
11222			} else {
11223				this.$pagination.children('li.footable-page').removeClass('visible').slice(0, this.total).addClass('visible');
11224			}
11225		},
11226		/**
11227		 * Handles the click event for all links in the pagination control.
11228		 * @instance
11229		 * @private
11230		 * @param {jQuery.Event} e - The event object for the event.
11231		 */
11232		_onPageClicked: function(e){
11233			e.preventDefault();
11234			if ($(e.target).closest('li').is('.active,.disabled')) return;
11235
11236			var self = e.data.self, page = $(this).data('page');
11237			switch(page){
11238				case 'first': self.first();
11239					return;
11240				case 'prev': self.prev();
11241					return;
11242				case 'next': self.next();
11243					return;
11244				case 'last': self.last();
11245					return;
11246				case 'prev-limit': self.prevPages();
11247					return;
11248				case 'next-limit': self.nextPages();
11249					return;
11250				default: self._set(page);
11251					return;
11252			}
11253		}
11254	});
11255
11256	F.components.register('paging', F.Paging, 400);
11257
11258})(jQuery, FooTable);
11259(function(F){
11260	/**
11261	 * An object containing the paging options for the plugin. Added by the {@link FooTable.Paging} component.
11262	 * @type {object}
11263	 * @prop {boolean} enabled=false - Whether or not to allow paging on the table.
11264	 * @prop {string} countFormat="{CP} of {TP}" - A string format used to generate the page count text.
11265	 * @prop {number} current=1 - The page number to display.
11266	 * @prop {number} limit=5 - The maximum number of page links to display at once.
11267	 * @prop {string} position="center" - The string used to specify the alignment of the pagination control.
11268	 * @prop {number} size=10 - The number of rows displayed per page.
11269	 * @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.
11270	 * @prop {object} strings - An object containing the strings used by the paging buttons.
11271	 * @prop {string} strings.first="&laquo;" - The string used for the 'first' button.
11272	 * @prop {string} strings.prev="&lsaquo;" - The string used for the 'previous' button.
11273	 * @prop {string} strings.next="&rsaquo;" - The string used for the 'next' button.
11274	 * @prop {string} strings.last="&raquo;" - The string used for the 'last' button.
11275	 * @prop {string} strings.prevPages="..." - The string used for the 'previous X pages' button.
11276	 * @prop {string} strings.nextPages="..." - The string used for the 'next X pages' button.
11277	 */
11278	F.Defaults.prototype.paging = {
11279		enabled: false,
11280		countFormat: '{CP} of {TP}',
11281		current: 1,
11282		limit: 5,
11283		position: 'center',
11284		size: 10,
11285		container: null,
11286		strings: {
11287			first: '&laquo;',
11288			prev: '&lsaquo;',
11289			next: '&rsaquo;',
11290			last: '&raquo;',
11291			prevPages: '...',
11292			nextPages: '...'
11293		}
11294	};
11295})(FooTable);
11296(function(F){
11297	/**
11298	 * Navigates to the specified page number. Added by the {@link FooTable.Paging} component.
11299	 * @instance
11300	 * @param {number} num - The page number to go to.
11301	 * @returns {jQuery.Promise}
11302	 * @fires FooTable.Paging#paging_changing
11303	 * @fires FooTable.Paging#paging_changed
11304	 * @see FooTable.Paging#goto
11305	 */
11306	F.Table.prototype.gotoPage = function(num){
11307		return this.use(F.Paging).goto(num);
11308	};
11309
11310	/**
11311	 * Navigates to the next page. Added by the {@link FooTable.Paging} component.
11312	 * @instance
11313	 * @returns {jQuery.Promise}
11314	 * @fires FooTable.Paging#paging_changing
11315	 * @fires FooTable.Paging#paging_changed
11316	 * @see FooTable.Paging#next
11317	 */
11318	F.Table.prototype.nextPage = function(){
11319		return this.use(F.Paging).next();
11320	};
11321
11322	/**
11323	 * Navigates to the previous page. Added by the {@link FooTable.Paging} component.
11324	 * @instance
11325	 * @returns {jQuery.Promise}
11326	 * @fires FooTable.Paging#paging_changing
11327	 * @fires FooTable.Paging#paging_changed
11328	 * @see FooTable.Paging#prev
11329	 */
11330	F.Table.prototype.prevPage = function(){
11331		return this.use(F.Paging).prev();
11332	};
11333
11334	/**
11335	 * Navigates to the first page. Added by the {@link FooTable.Paging} component.
11336	 * @instance
11337	 * @returns {jQuery.Promise}
11338	 * @fires FooTable.Paging#paging_changing
11339	 * @fires FooTable.Paging#paging_changed
11340	 * @see FooTable.Paging#first
11341	 */
11342	F.Table.prototype.firstPage = function(){
11343		return this.use(F.Paging).first();
11344	};
11345
11346	/**
11347	 * Navigates to the last page. Added by the {@link FooTable.Paging} component.
11348	 * @instance
11349	 * @returns {jQuery.Promise}
11350	 * @fires FooTable.Paging#paging_changing
11351	 * @fires FooTable.Paging#paging_changed
11352	 * @see FooTable.Paging#last
11353	 */
11354	F.Table.prototype.lastPage = function(){
11355		return this.use(F.Paging).last();
11356	};
11357
11358	/**
11359	 * 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.
11360	 * @instance
11361	 * @see FooTable.Paging#nextPages
11362	 */
11363	F.Table.prototype.nextPages = function(){
11364		return this.use(F.Paging).nextPages();
11365	};
11366
11367	/**
11368	 * 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.
11369	 * @instance
11370	 * @see FooTable.Paging#prevPages
11371	 */
11372	F.Table.prototype.prevPages = function(){
11373		return this.use(F.Paging).prevPages();
11374	};
11375
11376	/**
11377	 * Gets or sets the current page size
11378	 * @instance
11379	 * @param {number} [value] - The new page size to use.
11380	 * @returns {(number|undefined)}
11381	 * @see FooTable.Paging#pageSize
11382	 */
11383	F.Table.prototype.pageSize = function(value){
11384		return this.use(F.Paging).pageSize(value);
11385	};
11386})(FooTable);
11387(function($, F){
11388
11389	F.Editing = F.Component.extend(/** @lends FooTable.Editing */{
11390		/**
11391		 * 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.
11392		 * @constructs
11393		 * @extends FooTable.Component
11394		 * @param {FooTable.Table} table - The parent {@link FooTable.Table} object for the component.
11395		 * @returns {FooTable.Editing}
11396		 */
11397		construct: function(table){
11398			// call the base constructor
11399			this._super(table, table.o.editing.enabled);
11400
11401			/**
11402			 * Whether or not to automatically page to a new row when it is added to the table.
11403			 * @type {boolean}
11404			 */
11405			this.pageToNew = table.o.editing.pageToNew;
11406
11407			/**
11408			 * Whether or not the editing column and add row button are always visible.
11409			 * @type {boolean}
11410			 */
11411			this.alwaysShow = table.o.editing.alwaysShow;
11412
11413			/**
11414			 * The options for the editing column. @see {@link FooTable.EditingColumn} for more info.
11415			 * @type {object}
11416			 * @prop {string} classes="footable-editing" - A space separated string of class names to apply to all cells in the column.
11417			 * @prop {string} name="editing" - The name of the column.
11418			 * @prop {string} title="" - The title displayed in the header row of the table for the column.
11419			 * @prop {boolean} filterable=false - Whether or not the column should be filterable when using the filtering component.
11420			 * @prop {boolean} sortable=false - Whether or not the column should be sortable when using the sorting component.
11421			 */
11422			this.column = $.extend(true, {}, table.o.editing.column, {visible: this.alwaysShow});
11423
11424			/**
11425			 * The position of the editing column in the table as well as the alignment of the buttons.
11426			 * @type {string}
11427			 */
11428			this.position = table.o.editing.position;
11429
11430
11431			/**
11432			 * The text that appears in the show button. This can contain HTML.
11433			 * @type {string}
11434			 */
11435			this.showText = table.o.editing.showText;
11436
11437			/**
11438			 * The text that appears in the hide button. This can contain HTML.
11439			 * @type {string}
11440			 */
11441			this.hideText = table.o.editing.hideText;
11442
11443			/**
11444			 * The text that appears in the add button. This can contain HTML.
11445			 * @type {string}
11446			 */
11447			this.addText = table.o.editing.addText;
11448
11449			/**
11450			 * The text that appears in the edit button. This can contain HTML.
11451			 * @type {string}
11452			 */
11453			this.editText = table.o.editing.editText;
11454
11455			/**
11456			 * The text that appears in the delete button. This can contain HTML.
11457			 * @type {string}
11458			 */
11459			this.deleteText = table.o.editing.deleteText;
11460			
11461			/**
11462			 * The text that appears in the view button. This can contain HTML.
11463			 * @type {string}
11464			 */
11465			this.viewText = table.o.editing.viewText;
11466
11467			/**
11468			 * Whether or not to show the Add Row button.
11469			 * @type {boolean}
11470			 */
11471			this.allowAdd = table.o.editing.allowAdd;
11472
11473			/**
11474			 * Whether or not to show the Edit Row button.
11475			 * @type {boolean}
11476			 */
11477			this.allowEdit = table.o.editing.allowEdit;
11478
11479			/**
11480			 * Whether or not to show the Delete Row button.
11481			 * @type {boolean}
11482			 */
11483			this.allowDelete = table.o.editing.allowDelete;
11484
11485			/**
11486			 * Whether or not to show the View Row button.
11487			 * @type {boolean}
11488			 */
11489			this.allowView = table.o.editing.allowView;
11490
11491			/**
11492			 * Caches the row button elements to help with performance.
11493			 * @type {(null|jQuery)}
11494			 * @private
11495			 */
11496			this._$buttons = null;
11497
11498			/**
11499			 * This object is used to contain the callbacks for the add, edit and delete row buttons.
11500			 * @type {object}
11501			 * @prop {function} addRow
11502			 * @prop {function} editRow
11503			 * @prop {function} deleteRow
11504			 * @prop {function} viewRow
11505			 */
11506			this.callbacks = {
11507				addRow: F.checkFnValue(this, table.o.editing.addRow),
11508				editRow: F.checkFnValue(this, table.o.editing.editRow),
11509				deleteRow: F.checkFnValue(this, table.o.editing.deleteRow),
11510				viewRow: F.checkFnValue(this, table.o.editing.viewRow)
11511			};
11512		},
11513		/* PROTECTED */
11514		/**
11515		 * Checks the supplied data and options for the editing component.
11516		 * @instance
11517		 * @protected
11518		 * @param {object} data - The jQuery data object from the parent table.
11519		 * @fires FooTable.Editing#"preinit.ft.editing"
11520		 */
11521		preinit: function(data){
11522			var self = this;
11523			/**
11524			 * The preinit.ft.editing event is raised before the UI is created and provides the tables jQuery data object for additional options parsing.
11525			 * Calling preventDefault on this event will disable the component.
11526			 * @event FooTable.Editing#"preinit.ft.editing"
11527			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
11528			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
11529			 * @param {object} data - The jQuery data object of the table raising the event.
11530			 */
11531			this.ft.raise('preinit.ft.editing', [data]).then(function(){
11532				if (self.ft.$el.hasClass('footable-editing'))
11533					self.enabled = true;
11534
11535				self.enabled = F.is.boolean(data.editing)
11536					? data.editing
11537					: self.enabled;
11538
11539				if (!self.enabled) return;
11540
11541				self.pageToNew = F.is.boolean(data.editingPageToNew) ? data.editingPageToNew : self.pageToNew;
11542
11543				self.alwaysShow = F.is.boolean(data.editingAlwaysShow) ? data.editingAlwaysShow : self.alwaysShow;
11544
11545				self.position = F.is.string(data.editingPosition) ? data.editingPosition : self.position;
11546
11547				self.showText = F.is.string(data.editingShowText) ? data.editingShowText : self.showText;
11548
11549				self.hideText = F.is.string(data.editingHideText) ? data.editingHideText : self.hideText;
11550
11551				self.addText = F.is.string(data.editingAddText) ? data.editingAddText : self.addText;
11552
11553				self.editText = F.is.string(data.editingEditText) ? data.editingEditText : self.editText;
11554
11555				self.deleteText = F.is.string(data.editingDeleteText) ? data.editingDeleteText : self.deleteText;
11556
11557				self.viewText = F.is.string(data.editingViewText) ? data.editingViewText : self.viewText;
11558
11559				self.allowAdd = F.is.boolean(data.editingAllowAdd) ? data.editingAllowAdd : self.allowAdd;
11560
11561				self.allowEdit = F.is.boolean(data.editingAllowEdit) ? data.editingAllowEdit : self.allowEdit;
11562
11563				self.allowDelete = F.is.boolean(data.editingAllowDelete) ? data.editingAllowDelete : self.allowDelete;
11564
11565				self.allowView = F.is.boolean(data.editingAllowView) ? data.editingAllowView : self.allowView;
11566
11567				self.column = new F.EditingColumn(self.ft, self, $.extend(true, {}, self.column, data.editingColumn, {visible: self.alwaysShow}));
11568
11569				if (self.ft.$el.hasClass('footable-editing-left'))
11570					self.position = 'left';
11571
11572				if (self.ft.$el.hasClass('footable-editing-right'))
11573					self.position = 'right';
11574
11575				if (self.position === 'right'){
11576					self.column.index = self.ft.columns.array.length;
11577				} else {
11578					self.column.index = 0;
11579					for (var i = 0, len = self.ft.columns.array.length; i < len; i++){
11580						self.ft.columns.array[i].index += 1;
11581					}
11582				}
11583				self.ft.columns.array.push(self.column);
11584				self.ft.columns.array.sort(function(a, b){ return a.index - b.index; });
11585
11586				self.callbacks.addRow = F.checkFnValue(self, data.editingAddRow, self.callbacks.addRow);
11587				self.callbacks.editRow = F.checkFnValue(self, data.editingEditRow, self.callbacks.editRow);
11588				self.callbacks.deleteRow = F.checkFnValue(self, data.editingDeleteRow, self.callbacks.deleteRow);
11589				self.callbacks.viewRow = F.checkFnValue(self, data.editingViewRow, self.callbacks.viewRow);
11590			}, function(){
11591				self.enabled = false;
11592			});
11593		},
11594		/**
11595		 * Initializes the editing component for the plugin using the supplied table and options.
11596		 * @instance
11597		 * @protected
11598		 * @fires FooTable.Editing#"init.ft.editing"
11599		 */
11600		init: function(){
11601			/**
11602			 * The init.ft.editing event is raised before its UI is generated.
11603			 * Calling preventDefault on this event will disable the component.
11604			 * @event FooTable.Editing#"init.ft.editing"
11605			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
11606			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
11607			 */
11608			var self = this;
11609			this.ft.raise('init.ft.editing').then(function(){
11610				self.$create();
11611			}, function(){
11612				self.enabled = false;
11613			});
11614		},
11615		/**
11616		 * Destroys the editing component removing any UI generated from the table.
11617		 * @instance
11618		 * @protected
11619		 * @fires FooTable.Editing#"destroy.ft.editing"
11620		 */
11621		destroy: function () {
11622			/**
11623			 * The destroy.ft.editing event is raised before its UI is removed.
11624			 * Calling preventDefault on this event will prevent the component from being destroyed.
11625			 * @event FooTable.Editing#"destroy.ft.editing"
11626			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
11627			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
11628			 */
11629			var self = this;
11630			this.ft.raise('destroy.ft.editing').then(function(){
11631				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')
11632					.off('click.ft.editing').find('tfoot > tr.footable-editing').remove();
11633			});
11634		},
11635		/**
11636		 * Creates the editing UI from the current options setting the various jQuery properties of this component.
11637		 * @instance
11638		 * @protected
11639		 */
11640		$create: function(){
11641			var self = this, position = self.position === 'right' ? 'footable-editing-right' : 'footable-editing-left';
11642			self.ft.$el.addClass('footable-editing').addClass(position)
11643				.on('click.ft.editing', '.footable-show', {self: self}, self._onShowClick)
11644				.on('click.ft.editing', '.footable-hide', {self: self}, self._onHideClick)
11645				.on('click.ft.editing', '.footable-edit', {self: self}, self._onEditClick)
11646				.on('click.ft.editing', '.footable-delete', {self: self}, self._onDeleteClick)
11647				.on('click.ft.editing', '.footable-view', {self: self}, self._onViewClick)
11648				.on('click.ft.editing', '.footable-add', {self: self}, self._onAddClick);
11649
11650			self.$cell = $('<td/>').attr('colspan', self.ft.columns.visibleColspan).append(self.$buttonShow());
11651			if (self.allowAdd){
11652				self.$cell.append(self.$buttonAdd());
11653			}
11654			self.$cell.append(self.$buttonHide());
11655
11656			if (self.alwaysShow){
11657				self.ft.$el.addClass('footable-editing-always-show');
11658			}
11659
11660			if (!self.allowAdd) self.ft.$el.addClass('footable-editing-no-add');
11661			if (!self.allowEdit) self.ft.$el.addClass('footable-editing-no-edit');
11662			if (!self.allowDelete) self.ft.$el.addClass('footable-editing-no-delete');
11663			if (!self.allowView) self.ft.$el.addClass('footable-editing-no-view');
11664
11665			var $tfoot = self.ft.$el.children('tfoot');
11666			if ($tfoot.length == 0){
11667				$tfoot = $('<tfoot/>');
11668				self.ft.$el.append($tfoot);
11669			}
11670			self.$row = $('<tr/>', { 'class': 'footable-editing' }).append(self.$cell).appendTo($tfoot);
11671		},
11672		/**
11673		 * Creates the show button for the editing component.
11674		 * @instance
11675		 * @protected
11676		 * @returns {(string|HTMLElement|jQuery)}
11677		 */
11678		$buttonShow: function(){
11679			return '<button type="button" class="btn btn-primary footable-show">
11679' + this.showText + '</button>';
11680		},
11681		/**
11682		 * Creates the hide button for the editing component.
11683		 * @instance
11684		 * @protected
11685		 * @returns {(string|HTMLElement|jQuery)}
11686		 */
11687		$buttonHide: function(){
11688			return '<button type="button" class="btn btn-default footable-hide">' + this.hideText + '</button>';
11689		},
11690		/**
11691		 * Creates the add button for the editing component.
11692		 * @instance
11693		 * @protected
11694		 * @returns {(string|HTMLElement|jQuery)}
11695		 */
11696		$buttonAdd: function(){
11697			return '<button type="button" class="btn btn-primary footable-add">' + this.addText + '</button> ';
11698		},
11699		/**
11700		 * Creates the edit button for the editing component.
11701		 * @instance
11702		 * @protected
11703		 * @returns {(string|HTMLElement|jQuery)}
11704		 */
11705		$buttonEdit: function(){
11706			return '<button type="button" class="btn btn-default footable-edit">' + this.editText + '</button> ';
11707		},
11708		/**
11709		 * Creates the delete button for the editing component.
11710		 * @instance
11711		 * @protected
11712		 * @returns {(string|HTMLElement|jQuery)}
11713		 */
11714		$buttonDelete: function(){
11715			return '<button type="button" class="btn btn-default footable-delete">' + this.deleteText + '</button>';
11716		},
11717		/**
11718		 * Creates the view button for the editing component.
11719		 * @instance
11720		 * @protected
11721		 * @returns {(string|HTMLElement|jQuery)}
11722		 */
11723		$buttonView: function(){
11724			return '<button type="button" class="btn btn-default footable-view">' + this.viewText + '</button> ';
11725		},
11726		/**
11727		 * Creates the button group for the row buttons.
11728		 * @instance
11729		 * @protected
11730		 * @returns {(string|HTMLElement|jQuery)}
11731		 */
11732		$rowButtons: function(){
11733			if (F.is.jq(this._$buttons)) return this._$buttons.clone();
11734			this._$buttons = $('<div class="btn-group btn-group-xs" role="group"></div>');
11735			if (this.allowView) this._$buttons.append(this.$buttonView());
11736			if (this.allowEdit) this._$buttons.append(this.$buttonEdit());
11737			if (this.allowDelete) this._$buttons.append(this.$buttonDelete());
11738			return this._$buttons;
11739		},
11740		/**
11741		 * Performs the drawing of the component.
11742		 */
11743		draw: function(){
11744			this.$cell.attr('colspan', this.ft.columns.visibleColspan);
11745		},
11746		/**
11747		 * Handles the edit button click event.
11748		 * @instance
11749		 * @private
11750		 * @param {jQuery.Event} e - The jQuery.Event object for the event.
11751		 * @fires FooTable.Editing#"edit.ft.editing"
11752		 */
11753		_onEditClick: function(e){
11754			e.preventDefault();
11755			var self = e.data.self, row = $(this).closest('tr').data('__FooTableRow__');
11756			if (row instanceof F.Row){
11757				/**
11758				 * The edit.ft.editing event is raised before its callback is executed.
11759				 * Calling preventDefault on this event will prevent the callback from being executed.
11760				 * @event FooTable.Editing#"edit.ft.editing"
11761				 * @param {jQuery.Event} e - The jQuery.Event object for the event.
11762				 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
11763				 * @param {FooTable.Row} row - The row to be edited.
11764				 */
11765				self.ft.raise('edit.ft.editing', [row]).then(function(){
11766					self.callbacks.editRow.call(self.ft, row);
11767				});
11768			}
11769		},
11770		/**
11771		 * Handles the delete button click event.
11772		 * @instance
11773		 * @private
11774		 * @param {jQuery.Event} e - The jQuery.Event object for the event.
11775		 * @fires FooTable.Editing#"delete.ft.editing"
11776		 */
11777		_onDeleteClick: function(e){
11778			e.preventDefault();
11779			var self = e.data.self, row = $(this).closest('tr').data('__FooTableRow__');
11780			if (row instanceof F.Row){
11781				/**
11782				 * The delete.ft.editing event is raised before its callback is executed.
11783				 * Calling preventDefault on this event will prevent the callback from being executed.
11784				 * @event FooTable.Editing#"delete.ft.editing"
11785				 * @param {jQuery.Event} e - The jQuery.Event object for the event.
11786				 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
11787				 * @param {FooTable.Row} row - The row to be deleted.
11788				 */
11789				self.ft.raise('delete.ft.editing', [row]).then(function(){
11790					self.callbacks.deleteRow.call(self.ft, row);
11791				});
11792			}
11793		},
11794		/**
11795		 * Handles the view button click event.
11796		 * @instance
11797		 * @private
11798		 * @param {jQuery.Event} e - The jQuery.Event object for the event.
11799		 * @fires FooTable.Editing#"view.ft.editing"
11800		 */
11801		_onViewClick: function(e){
11802			e.preventDefault();
11803			var self = e.data.self, row = $(this).closest('tr').data('__FooTableRow__');
11804			if (row instanceof F.Row){
11805				/**
11806				 * The view.ft.editing event is raised before its callback is executed.
11807				 * Calling preventDefault on this event will prevent the callback from being executed.
11808				 * @event FooTable.Editing#"view.ft.editing"
11809				 * @param {jQuery.Event} e - The jQuery.Event object for the event.
11810				 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
11811				 * @param {FooTable.Row} row - The row to be viewed.
11812				 */
11813				self.ft.raise('view.ft.editing', [row]).then(function(){
11814					self.callbacks.viewRow.call(self.ft, row);
11815				});
11816			}
11817		},
11818		/**
11819		 * Handles the add button click event.
11820		 * @instance
11821		 * @private
11822		 * @param {jQuery.Event} e - The jQuery.Event object for the event.
11823		 * @fires FooTable.Editing#"add.ft.editing"
11824		 */
11825		_onAddClick: function(e){
11826			e.preventDefault();
11827			var self = e.data.self;
11828			/**
11829			 * The add.ft.editing event is raised before its callback is executed.
11830			 * Calling preventDefault on this event will prevent the callback from being executed.
11831			 * @event FooTable.Editing#"add.ft.editing"
11832			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
11833			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
11834			 */
11835			self.ft.raise('add.ft.editing').then(function(){
11836				self.callbacks.addRow.call(self.ft);
11837			});
11838		},
11839		/**
11840		 * Handles the show button click event.
11841		 * @instance
11842		 * @private
11843		 * @param {jQuery.Event} e - The jQuery.Event object for the event.
11844		 * @fires FooTable.Editing#"show.ft.editing"
11845		 */
11846		_onShowClick: function(e){
11847			e.preventDefault();
11848			var self = e.data.self;
11849			/**
11850			 * The show.ft.editing event is raised before its callback is executed.
11851			 * Calling preventDefault on this event will prevent the callback from being executed.
11852			 * @event FooTable.Editing#"show.ft.editing"
11853			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
11854			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
11855			 */
11856			self.ft.raise('show.ft.editing').then(function(){
11857				self.ft.$el.addClass('footable-editing-show');
11858				self.column.visible = true;
11859				self.ft.draw();
11860			});
11861		},
11862		/**
11863		 * Handles the hide button click event.
11864		 * @instance
11865		 * @private
11866		 * @param {jQuery.Event} e - The jQuery.Event object for the event.
11867		 * @fires FooTable.Editing#"show.ft.editing"
11868		 */
11869		_onHideClick: function(e){
11870			e.preventDefault();
11871			var self = e.data.self;
11872			/**
11873			 * The hide.ft.editing event is raised before its callback is executed.
11874			 * Calling preventDefault on this event will prevent the callback from being executed.
11875			 * @event FooTable.Editing#"hide.ft.editing"
11876			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
11877			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
11878			 */
11879			self.ft.raise('hide.ft.editing').then(function(){
11880				self.ft.$el.removeClass('footable-editing-show');
11881				self.column.visible = false;
11882				self.ft.draw();
11883			});
11884		}
11885	});
11886
11887	F.components.register('editing', F.Editing, 850);
11888
11889})(jQuery, FooTable);
11890
11891(function($, F){
11892
11893	F.EditingColumn = F.Column.extend(/** @lends FooTable.EditingColumn */{
11894		/**
11895		 * The Editing column class is used to create the column containing the editing buttons.
11896		 * @constructs
11897		 * @extends FooTable.Column
11898		 * @param {FooTable.Table} instance -  The parent {@link FooTable.Table} this column belongs to.
11899		 * @param {FooTable.Editing} editing - The parent {@link FooTable.Editing} component this column is used with.
11900		 * @param {object} definition - An object containing all the properties to set for the column.
11901		 * @returns {FooTable.EditingColumn}
11902		 */
11903		construct: function(instance, editing, definition){
11904			this._super(instance, definition, 'editing');
11905			this.editing = editing;
11906			this.internal = true;
11907		},
11908		/**
11909		 * After the column has been defined this ensures that the $el property is a jQuery object by either creating or updating the current value.
11910		 * @instance
11911		 * @protected
11912		 * @this FooTable.Column
11913		 */
11914		$create: function(){
11915			(this.$el = !this.virtual && F.is.jq(this.$el) ? this.$el : $('<th/>', {'class': 'footable-editing'})).html(this.title);
11916		},
11917		/**
11918		 * This is supplied either the cell value or jQuery object to parse. Any value can be returned from this method and
11919		 * will be provided to the {@link FooTable.EditingColumn#format} function
11920		 * to generate the cell contents.
11921		 * @instance
11922		 * @protected
11923		 * @param {(*|jQuery)} valueOrElement - The value or jQuery cell object.
11924		 * @returns {(jQuery)}
11925		 */
11926		parser: function(valueOrElement){
11927			if (F.is.string(valueOrElement)) valueOrElement = $($.trim(valueOrElement));
11928			if (F.is.element(valueOrElement)) valueOrElement = $(valueOrElement);
11929			if (F.is.jq(valueOrElement)){
11930				var tagName = valueOrElement.prop('tagName').toLowerCase();
11931				if (tagName == 'td' || tagName == 'th') return valueOrElement.data('value') || valueOrElement.contents();
11932				return valueOrElement;
11933			}
11934			return null;
11935		},
11936		/**
11937		 * Creates a cell to be used in the supplied row for this column.
11938		 * @param {FooTable.Row} row - The row to create the cell for.
11939		 * @returns {FooTable.Cell}
11940		 */
11941		createCell: function(row){
11942			var $buttons = this.editing.$rowButtons(), $cell = $('<td/>').append($buttons);
11943			if (F.is.jq(row.$el)){
11944				if (this.index === 0){
11945					$cell.prependTo(row.$el);
11946				} else {
11947					$cell.insertAfter(row.$el.children().eq(this.index-1));
11948				}
11949			}
11950			return new F.Cell(this.ft, row, this, $cell || $cell.html());
11951		}
11952	});
11953
11954	F.columns.register('editing', F.EditingColumn);
11955
11956})(jQuery, FooTable);
11957(function($, F) {
11958
11959	/**
11960	 * An object containing the editing options for the plugin. Added by the {@link FooTable.Editing} component.
11961	 * @type {object}
11962	 * @prop {boolean} enabled=false - Whether or not to allow editing on the table.
11963	 * @prop {boolean} pageToNew=true - Whether or not to automatically page to a new row when it is added to the table.
11964	 * @prop {string} position="right" - The position of the editing column in the table as well as the alignment of the buttons.
11965	 * @prop {boolean} alwaysShow=false - Whether or not the editing column and add row button are always visible.
11966	 * @prop {function} addRow - The callback function to execute when the add row button is clicked.
11967	 * @prop {function} editRow - The callback function to execute when the edit row button is clicked.
11968	 * @prop {function} deleteRow - The callback function to execute when the delete row button is clicked.
11969	 * @prop {function} viewRow - The callback function to execute when the view row button is clicked.
11970	 * @prop {string} showText - The text that appears in the show button. This can contain HTML.
11971	 * @prop {string} hideText - The text that appears in the hide button. This can contain HTML.
11972	 * @prop {string} addText - The text that appears in the add button. This can contain HTML.
11973	 * @prop {string} editText - The text that appears in the edit button. This can contain HTML.
11974	 * @prop {string} deleteText - The text that appears in the delete button. This can contain HTML.
11975	 * @prop {string} viewText - The text that appears in the view button. This can contain HTML.
11976	 * @prop {boolean} allowAdd - Whether or not to show the Add Row button.
11977	 * @prop {boolean} allowEdit - Whether or not to show the Edit Row button.
11978	 * @prop {boolean} allowDelete - Whether or not to show the Delete Row button.
11979	 * @prop {boolean} allowView - Whether or not to show the View Row button.
11980	 * @prop {object} column - The options for the editing column. @see {@link FooTable.EditingColumn} for more info.
11981	 * @prop {string} column.classes="footable-editing" - A space separated string of class names to apply to all cells in the column.
11982	 * @prop {string} column.name="editing" - The name of the column.
11983	 * @prop {string} column.title="" - The title displayed in the header row of the table for the column.
11984	 * @prop {boolean} column.filterable=false - Whether or not the column should be filterable when using the filtering component.
11985	 * @prop {boolean} column.sortable=false - Whether or not the column should be sortable when using the sorting component.
11986	 */
11987	F.Defaults.prototype.editing = {
11988		enabled: false,
11989		pageToNew: true,
11990		position: 'right',
11991		alwaysShow: false,
11992		addRow: function(){},
11993		editRow: function(row){},
11994		deleteRow: function(row){},
11995		viewRow: function(row){},
11996		showText: '<span class="fooicon fooicon-pencil" aria-hidden="true"></span> Edit rows',
11997		hideText: 'Cancel',
11998		addText: 'New row',
11999		editText: '<span class="fooicon fooicon-pencil" aria-hidden="true"></span>',
12000		deleteText: '<span class="fooicon fooicon-trash" aria-hidden="true"></span>',
12001		viewText: '<span class="fooicon fooicon-stats" aria-hidden="true"></span>',
12002		allowAdd: true,
12003		allowEdit: true,
12004		allowDelete: true,
12005		allowView: false,
12006		column: {
12007			classes: 'footable-editing',
12008			name: 'editing',
12009			title: '',
12010			filterable: false,
12011			sortable: false
12012		}
12013	};
12014
12015})(jQuery, FooTable);
12016
12017(function($, F){
12018
12019	if (F.is.defined(F.Paging)){
12020		/**
12021		 * 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.
12022		 * @instance
12023		 * @public
12024		 * @type {Array<FooTable.Row>}
12025		 */
12026		F.Paging.prototype.unpaged = [];
12027
12028		// override the default predraw method with one that sets the unpaged property.
12029		F.Paging.extend('predraw', function(){
12030			this.unpaged = this.ft.rows.array.slice(0); // create a shallow clone for later use
12031			this._super(); // call the original method
12032		});
12033	}
12034
12035})(jQuery, FooTable);
12036(function($, F){
12037
12038	/**
12039	 * Adds the row to the table.
12040	 * @param {boolean} [redraw=true] - Whether or not to redraw the table, defaults to true but for bulk operations this
12041	 * can be set to false and then followed by a call to the {@link FooTable.Table#draw} method.
12042	 * @returns {jQuery.Deferred}
12043	 */
12044	F.Row.prototype.add = function(redraw){
12045		redraw = F.is.boolean(redraw) ? redraw : true;
12046		var self = this;
12047		return $.Deferred(function(d){
12048			var index = self.ft.rows.all.push(self) - 1;
12049			if (redraw){
12050				return self.ft.draw().then(function(){
12051					d.resolve(index);
12052				});
12053			} else {
12054				d.resolve(index);
12055			}
12056		});
12057	};
12058
12059	/**
12060	 * Removes the row from the table.
12061	 * @param {boolean} [redraw=true] - Whether or not to redraw the table, defaults to true but for bulk operations this
12062	 * can be set to false and then followed by a call to the {@link FooTable.Table#draw} method.
12063	 * @returns {jQuery.Deferred}
12064	 */
12065	F.Row.prototype.delete = function(redraw){
12066		redraw = F.is.boolean(redraw) ? redraw : true;
12067		var self = this;
12068		return $.Deferred(function(d){
12069			var index = self.ft.rows.all.indexOf(self);
12070			if (F.is.number(index) && index >= 0 && index < self.ft.rows.all.length){
12071				self.ft.rows.all.splice(index, 1);
12072				if (redraw){
12073					return self.ft.draw().then(function(){
12074						d.resolve(self);
12075					});
12076				}
12077			}
12078			d.resolve(self);
12079		});
12080	};
12081
12082	if (F.is.defined(F.Paging)){
12083		// override the default add method with one that supports paging
12084		F.Row.extend('add', function(redraw){
12085			redraw = F.is.boolean(redraw) ? redraw : true;
12086			var self = this,
12087				added = this._super(redraw),
12088				editing = self.ft.use(F.Editing),
12089				paging;
12090			if (editing && editing.pageToNew && (paging = self.ft.use(F.Paging)) && redraw){
12091				return added.then(function(){
12092					var index = paging.unpaged.indexOf(self); // find this row in the unpaged array (this array will be sorted and filtered)
12093					var page = Math.ceil((index + 1) / paging.size); // calculate the page the new row is on
12094					if (paging.current !== page){ // goto the page if we need to
12095						return paging.goto(page);
12096					}
12097				});
12098			}
12099			return added;
12100		});
12101	}
12102
12103	if (F.is.defined(F.Sorting)){
12104		// override the default val method with one that supports sorting and paging
12105		F.Row.extend('val', function(data, redraw){
12106			redraw = F.is.boolean(redraw) ? redraw : true;
12107			var result = this._super(data);
12108			if (!F.is.hash(data)){
12109				return result;
12110			}
12111			var self = this;
12112			if (redraw){
12113				self.ft.draw().then(function(){
12114					var editing = self.ft.use(F.Editing), paging;
12115					if (F.is.defined(F.Paging) && editing && editing.pageToNew && (paging = self.ft.use(F.Paging))){
12116						var index = paging.unpaged.indexOf(self); // find this row in the unpaged array (this array will be sorted and filtered)
12117						var page = Math.ceil((index + 1) / paging.size); // calculate the page the new row is on
12118						if (paging.current !== page){ // goto the page if we need to
12119							return paging.goto(page);
12120						}
12121					}
12122				});
12123			}
12124			return result;
12125		});
12126	}
12127
12128})(jQuery, FooTable);
12129(function(F){
12130
12131	/**
12132	 * Adds a row to the underlying {@link FooTable.Rows#all} array.
12133	 * @param {(object|FooTable.Row)} dataOrRow - A hash containing the row values or an actual {@link FooTable.Row} object.
12134	 * @param {boolean} [redraw=true] - Whether or not to redraw the table, defaults to true but for bulk operations this
12135	 * can be set to false and then followed by a call to the {@link FooTable.Table#draw} method.
12136	 */
12137	F.Rows.prototype.add = function(dataOrRow, redraw){
12138		var row = dataOrRow;
12139		if (F.is.hash(dataOrRow)){
12140			row = new FooTable.Row(this.ft, this.ft.columns.array, dataOrRow);
12141		}
12142		if (row instanceof FooTable.Row){
12143			row.add(redraw);
12144		}
12145	};
12146
12147	/**
12148	 * Updates a row in the underlying {@link FooTable.Rows#all} array.
12149	 * @param {(number|FooTable.Row)} indexOrRow - The index to update or the actual {@link FooTable.Row} object.
12150	 * @param {object} data - A hash containing the new row values.
12151	 * @param {boolean} [redraw=true] - Whether or not to redraw the table, defaults to true but for bulk operations this
12152	 * can be set to false and then followed by a call to the {@link FooTable.Table#draw} method.
12153	 */
12154	F.Rows.prototype.update = function(indexOrRow, data, redraw){
12155		var len = this.ft.rows.all.length, 
12156			row = indexOrRow;
12157		if (F.is.number(indexOrRow) && indexOrRow >= 0 && indexOrRow < len){
12158			row = this.ft.rows.all[indexOrRow];
12159		}
12160		if (row instanceof FooTable.Row && F.is.hash(data)){
12161			row.val(data, redraw);
12162		}
12163	};
12164
12165	/**
12166	 * Deletes a row from the underlying {@link FooTable.Rows#all} array.
12167	 * @param {(number|FooTable.Row)} indexOrRow - The index to delete or the actual {@link FooTable.Row} object.
12168	 * @param {boolean} [redraw=true] - Whether or not to redraw the table, defaults to true but for bulk operations this
12169	 * can be set to false and then followed by a call to the {@link FooTable.Table#draw} method.
12170	 */
12171	F.Rows.prototype.delete = function(indexOrRow, redraw){
12172		var len = this.ft.rows.all.length, 
12173			row = indexOrRow;
12174		if (F.is.number(indexOrRow) && indexOrRow >= 0 && indexOrRow < len){
12175			row = this.ft.rows.all[indexOrRow];
12176		}
12177		if (row instanceof FooTable.Row){
12178			row.delete(redraw);
12179		}
12180	};
12181
12182})(FooTable);
12183
12184(function($, F){
12185
12186	// global int to use if the table has no ID
12187	var _uid = 0,
12188	// a hash value for the current url
12189		_url_hash = (function(str){
12190			var i, l, hval = 0x811c9dc5;
12191			for (i = 0, l = str.length; i < l; i++) {
12192				hval ^= str.charCodeAt(i);
12193				hval += (hval << 1) + (hval << 4) + (hval << 7) + (hval << 8) + (hval << 24);
12194			}
12195			return hval >>> 0;
12196		})(location.origin + location.pathname);
12197
12198	F.State = F.Component.extend(/** @lends FooTable.State */{
12199		/**
12200		 * The state component adds the ability for the table to remember its basic state for filtering, paging and sorting.
12201		 * @constructs
12202		 * @extends FooTable.Component
12203		 * @param {FooTable.Table} table - The parent {@link FooTable.Table} object for the component.
12204		 * @returns {FooTable.State}
12205		 */
12206		construct: function(table){
12207			// call the constructor of the base class
12208			this._super(table, table.o.state.enabled);
12209			// Change this value if an update to this component requires any stored data to be reset
12210			this._key = '1';
12211			/**
12212			 * The key to use to store the state for this table.
12213			 * @type {(null|string)}
12214			 */
12215			this.key = this._key + (F.is.string(table.o.state.key) ? table.o.state.key : this._uid());
12216			/**
12217			 * Whether or not to allow the filtering component to store it's state.
12218			 * @type {boolean}
12219			 */
12220			this.filtering = F.is.boolean(table.o.state.filtering) ? table.o.state.filtering : true;
12221			/**
12222			 * Whether or not to allow the paging component to store it's state.
12223			 * @type {boolean}
12224			 */
12225			this.paging = F.is.boolean(table.o.state.paging) ? table.o.state.paging : true;
12226			/**
12227			 * Whether or not to allow the sorting component to store it's state.
12228			 * @type {boolean}
12229			 */
12230			this.sorting = F.is.boolean(table.o.state.sorting) ? table.o.state.sorting : true;
12231		},
12232		/* PROTECTED */
12233		/**
12234		 * Checks the supplied data and options for the state component.
12235		 * @instance
12236		 * @protected
12237		 * @param {object} data - The jQuery data object from the parent table.
12238		 * @fires FooTable.State#"preinit.ft.state"
12239		 * @this FooTable.State
12240		 */
12241		preinit: function(data){
12242			var self = this;
12243			/**
12244			 * The preinit.ft.state event is raised before the UI is created and provides the tables jQuery data object for additional options parsing.
12245			 * Calling preventDefault on this event will disable the component.
12246			 * @event FooTable.State#"preinit.ft.state"
12247			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
12248			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
12249			 * @param {object} data - The jQuery data object of the table raising the event.
12250			 */
12251			this.ft.raise('preinit.ft.state', [data]).then(function(){
12252
12253				self.enabled = F.is.boolean(data.state)
12254					? data.state
12255					: self.enabled;
12256
12257				if (!self.enabled) return;
12258
12259				self.key = self._key + (F.is.string(data.stateKey) ? data.stateKey : self.key);
12260
12261				self.filtering = F.is.boolean(data.stateFiltering) ? data.stateFiltering : self.filtering;
12262
12263				self.paging = F.is.boolean(data.statePaging) ? data.statePaging : self.paging;
12264
12265				self.sorting = F.is.boolean(data.stateSorting) ? data.stateSorting : self.sorting;
12266
12267			}, function(){
12268				self.enabled = false;
12269			});
12270		},
12271		/**
12272		 * Gets the state value for the specified key for this table.
12273		 * @instance
12274		 * @param {string} key - The key to get the value for.
12275		 * @returns {(*|null)}
12276		 */
12277		get: function(key){
12278			return JSON.parse(localStorage.getItem(this.key + ':' + key));
12279		},
12280		/**
12281		 * Sets the state value for the specified key for this table.
12282		 * @instance
12283		 * @param {string}
12283 key - The key to set the value for.
12284		 * @param {*} data - The value to store for the key. This value must be JSON.stringify friendly.
12285		 */
12286		set: function(key, data){
12287			localStorage.setItem(this.key + ':' + key, JSON.stringify(data));
12288		},
12289		/**
12290		 * Clears the state value for the specified key for this table.
12291		 * @instance
12292		 * @param {string} key - The key to clear the value for.
12293		 */
12294		remove: function(key){
12295			localStorage.removeItem(this.key + ':' + key);
12296		},
12297		/**
12298		 * Executes the {@link FooTable.Component#readState} function on all components.
12299		 * @instance
12300		 */
12301		read: function(){
12302			this.ft.execute(false, true, 'readState');
12303		},
12304		/**
12305		 * Executes the {@link FooTable.Component#writeState} function on all components.
12306		 * @instance
12307		 */
12308		write: function(){
12309			this.ft.execute(false, true, 'writeState');
12310		},
12311		/**
12312		 * Executes the {@link FooTable.Component#clearState} function on all components.
12313		 * @instance
12314		 */
12315		clear: function(){
12316			this.ft.execute(false, true, 'clearState');
12317		},
12318		/**
12319		 * Generates a unique identifier for the current {@link FooTable.Table} if one is not supplied through the options.
12320		 * This value is a combination of the url hash and either the element ID or an incremented global int value.
12321		 * @instance
12322		 * @returns {*}
12323		 * @private
12324		 */
12325		_uid: function(){
12326			var id = this.ft.$el.attr('id');
12327			return _url_hash + '_' + (F.is.string(id) ? id : ++_uid);
12328		}
12329	});
12330
12331	F.components.register('state', F.State, 700);
12332
12333})(jQuery, FooTable);
12334(function(F){
12335
12336	/**
12337	 * This method is called from the {@link FooTable.State#read} method and allows a component to retrieve its' stored state.
12338	 * @instance
12339	 * @protected
12340	 * @function
12341	 */
12342	F.Component.prototype.readState = function(){};
12343
12344	/**
12345	 * This method is called from the {@link FooTable.State#write} method and allows a component to write its' current state to the store.
12346	 * @instance
12347	 * @protected
12348	 * @function
12349	 */
12350	F.Component.prototype.writeState = function(){};
12351
12352	/**
12353	 * This method is called from the {@link FooTable.State#clear} method and allows a component to clear any stored state.
12354	 * @instance
12355	 * @protected
12356	 * @function
12357	 */
12358	F.Component.prototype.clearState = function(){};
12359
12360})(FooTable);
12361(function(F){
12362
12363	/**
12364	 * An object containing the state options for the plugin. Added by the {@link FooTable.State} component.
12365	 * @type {object}
12366	 * @prop {boolean} enabled=false - Whether or not to allow state to be stored for the table. This overrides the individual component enable options.
12367	 * @prop {boolean} filtering=true - Whether or not to allow the filtering state to be stored.
12368	 * @prop {boolean} paging=true - Whether or not to allow the filtering state to be stored.
12369	 * @prop {boolean} sorting=true - Whether or not to allow the filtering state to be stored.
12370	 * @prop {string} key=null - The unique key to use to store the table's data.
12371	 */
12372	F.Defaults.prototype.state = {
12373		enabled: false,
12374		filtering: true,
12375		paging: true,
12376		sorting: true,
12377		key: null
12378	};
12379
12380})(FooTable);
12381(function(F){
12382
12383	if (!F.Filtering) return;
12384
12385	/**
12386	 * Allows the filtering component to retrieve its' stored state.
12387	 */
12388	F.Filtering.prototype.readState = function(){
12389		if (this.ft.state.filtering){
12390			var state = this.ft.state.get('filtering');
12391			if (F.is.hash(state) && !F.is.emptyArray(state.filters)){
12392				this.filters = this.ensure(state.filters);
12393			}
12394		}
12395	};
12396
12397	/**
12398	 * Allows the filtering component to write its' current state to the store.
12399	 */
12400	F.Filtering.prototype.writeState = function(){
12401		if (this.ft.state.filtering) {
12402			var filters = F.arr.map(this.filters, function (f) {
12403				return {
12404					name: f.name,
12405					query: f.query instanceof F.Query ? f.query.val() : f.query,
12406					columns: F.arr.map(f.columns, function (c) {
12407						return c.name;
12408					}),
12409					hidden: f.hidden,
12410					space: f.space,
12411					connectors: f.connectors,
12412					ignoreCase: f.ignoreCase
12413				};
12414			});
12415			this.ft.state.set('filtering', {filters: filters});
12416		}
12417	};
12418
12419	/**
12420	 * Allows the filtering component to clear any stored state.
12421	 */
12422	F.Filtering.prototype.clearState = function(){
12423		if (this.ft.state.filtering) {
12424			this.ft.state.remove('filtering');
12425		}
12426	};
12427
12428})(FooTable);
12429(function(F){
12430
12431	if (!F.Paging) return;
12432
12433	/**
12434	 * Allows the paging component to retrieve its' stored state.
12435	 */
12436	F.Paging.prototype.readState = function(){
12437		if (this.ft.state.paging) {
12438			var state = this.ft.state.get('paging');
12439			if (F.is.hash(state)) {
12440				this.current = state.current;
12441				this.size = state.size;
12442			}
12443		}
12444	};
12445
12446	/**
12447	 * Allows the paging component to write its' current state to the store.
12448	 */
12449	F.Paging.prototype.writeState = function(){
12450		if (this.ft.state.paging) {
12451			this.ft.state.set('paging', {
12452				current: this.current,
12453				size: this.size
12454			});
12455		}
12456	};
12457
12458	/**
12459	 * Allows the paging component to clear any stored state.
12460	 */
12461	F.Paging.prototype.clearState = function(){
12462		if (this.ft.state.paging) {
12463			this.ft.state.remove('paging');
12464		}
12465	};
12466
12467})(FooTable);
12468(function(F){
12469
12470	if (!F.Sorting) return;
12471
12472	/**
12473	 * Allows the sorting component to retrieve its' stored state.
12474	 */
12475	F.Sorting.prototype.readState = function(){
12476		if (this.ft.state.sorting) {
12477			var state = this.ft.state.get('sorting');
12478			if (F.is.hash(state)) {
12479				var column = this.ft.columns.get(state.column);
12480				if (column instanceof F.Column) {
12481					this.column = column;
12482					this.column.direction = state.direction;
12483				}
12484			}
12485		}
12486	};
12487
12488	/**
12489	 * Allows the sorting component to write its' current state to the store.
12490	 */
12491	F.Sorting.prototype.writeState = function(){
12492		if (this.ft.state.sorting && this.column instanceof F.Column){
12493			this.ft.state.set('sorting', {
12494				column: this.column.name,
12495				direction: this.column.direction
12496			});
12497		}
12498	};
12499
12500	/**
12501	 * Allows the sorting component to clear any stored state.
12502	 */
12503	F.Sorting.prototype.clearState = function(){
12504		if (this.ft.state.sorting) {
12505			this.ft.state.remove('sorting');
12506		}
12507	};
12508
12509})(FooTable);
12510(function(F){
12511
12512	// hook into the _construct method so we can add the state property to the table.
12513	F.Table.extend('_construct', function(ready){
12514		this.state = this.use(FooTable.State);
12515		return this._super(ready);
12516	});
12517
12518	// hook into the _preinit method so we can trigger a plugin wide read state operation.
12519	F.Table.extend('_preinit', function(){
12520		var self = this;
12521		return self._super().then(function(){
12522			if (self.state.enabled){
12523				self.state.read();
12524			}
12525		});
12526	});
12527
12528	// hook into the draw method so we can trigger a plugin wide write state operation.
12529	F.Table.extend('draw', function(){
12530		var self = this;
12531		return self._super().then(function(){
12532			if (self.state.enabled){
12533				self.state.write();
12534			}
12535		});
12536	});
12537
12538})(FooTable);
12539(function($, F){
12540
12541	F.Export = F.Component.extend(/** @lends FooTable.Export */{
12542		/**
12543		 * @summary This component provides some basic export functionality.
12544		 * @memberof FooTable
12545		 * @constructs Export
12546		 * @param {FooTable.Table} table - The current instance of the plugin.
12547		 */
12548		construct: function(table){
12549			// call the constructor of the base class
12550			this._super(table, true);
12551			/**
12552			 * @summary A snapshot of the working set of rows prior to being trimmed by the paging component.
12553			 * @memberof FooTable.Export#
12554			 * @name snapshot
12555			 * @type {FooTable.Row[]}
12556			 */
12557			this.snapshot = [];
12558		},
12559		/**
12560		 * @summary Hooks into the predraw pipeline after sorting and filtering have taken place but prior to paging.
12561		 * @memberof FooTable.Export#
12562		 * @function predraw
12563		 * @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.
12564		 */
12565		predraw: function(){
12566			this.snapshot = this.ft.rows.array.slice(0);
12567		},
12568		/**
12569		 * @summary Return the columns as simple JavaScript objects in an array.
12570		 * @memberof FooTable.Export#
12571		 * @function columns
12572		 * @returns {Object[]}
12573		 */
12574		columns: function(){
12575			var result = [];
12576			F.arr.each(this.ft.columns.array, function(column){
12577				if (!column.internal){
12578					result.push({
12579						type: column.type,
12580						name: column.name,
12581						title: column.title,
12582						visible: column.visible,
12583						hidden: column.hidden,
12584						classes: column.classes,
12585						style: column.style
12586					});
12587				}
12588			});
12589			return result;
12590		},
12591		/**
12592		 * @summary Return the rows as simple JavaScript objects in an array.
12593		 * @memberof FooTable.Export#
12594		 * @function rows
12595		 * @param {boolean} [filtered=false] - Whether or not to exclude filtered rows from the result.
12596		 * @returns {Object[]}
12597		 */
12598		rows: function(filtered){
12599			filtered = F.is.boolean(filtered) ? filtered : false;
12600			var rows = filtered ? this.ft.rows.all : this.snapshot, result = [];
12601			F.arr.each(rows, function(row){
12602				result.push(row.val());
12603			});
12604			return result;
12605		},
12606		/**
12607		 * @summary Return the columns and rows as a properly formatted JSON object.
12608		 * @memberof FooTable.Export#
12609		 * @function json
12610		 * @param {boolean} [filtered=false] - Whether or not to exclude filtered rows from the result.
12611		 * @returns {Object}
12612		 */
12613		json: function(filtered){
12614			return JSON.parse(JSON.stringify({columns: this.columns(),rows: this.rows(filtered)}));
12615		},
12616		/**
12617		 * @summary Return the columns and rows as a properly formatted CSV value.
12618		 * @memberof FooTable.Export#
12619		 * @function csv
12620		 * @param {boolean} [filtered=false] - Whether or not to exclude filtered rows from the result.
12621		 * @returns {string}
12622		 */
12623		csv: function(filtered){
12624			var csv = "", columns = this.columns(), value, escaped;
12625			F.arr.each(columns, function(column, i){
12626				escaped = '"' + column.title.replace(/"/g, '""') + '"';
12627				csv += (i === 0 ? escaped : "," + escaped);
12628			});
12629			csv += "\n";
12630
12631			var rows = filtered ? this.ft.rows.all : this.snapshot;
12632			F.arr.each(rows, function(row){
12633				F.arr.each(row.cells, function(cell, i){
12634					if (!cell.column.internal){
12635						value = cell.column.stringify.call(cell.column, cell.value, cell.ft.o, cell.row.value);
12636						escaped = '"' + value.replace(/"/g, '""') + '"';
12637						csv += (i === 0 ? escaped : "," + escaped);
12638					}
12639				});
12640				csv += "\n";
12641			});
12642			return csv;
12643		}
12644	});
12645
12646	// register the component using a priority of 490 which falls just after filtering (500) and before paging (400).
12647	F.components.register("export", F.Export, 490);
12648
12649})(jQuery, FooTable);
12650(function(F){
12651	// this is used to define the filtering specific properties on column creation
12652	F.Column.prototype.__export_define__ = function(definition){
12653		this.stringify = F.checkFnValue(this, definition.stringify, this.stringify);
12654	};
12655
12656	// overrides the public define method and replaces it with our own
12657	F.Column.extend('define', function(definition){
12658		this._super(definition); // call the base so we don't have to redefine any previously set properties
12659		this.__export_define__(definition); // then call our own
12660	});
12661
12662	/**
12663	 * @summary Return the supplied value as a string.
12664	 * @memberof FooTable.Column#
12665	 * @function stringify
12666	 * @returns {string}
12667	 */
12668	F.Column.prototype.stringify = function(value, options, rowData){
12669		return value + "";
12670	};
12671
12672	// override the base method for DateColumns
12673	F.DateColumn.prototype.stringify = function(value, options, rowData){
12674		return F.is.object(value) && F.is.boolean(value._isAMomentObject) && value.isValid() ? value.format(this.formatString) : '';
12675	};
12676
12677	// override the base method for ObjectColumns
12678	F.ObjectColumn.prototype.stringify = function(value, options, rowData){
12679		return F.is.object(value) ? JSON.stringify(value) : "";
12680	};
12681
12682	// override the base method for ArrayColumns
12683	F.ArrayColumn.prototype.stringify = function(value, options, rowData){
12684		return F.is.array(value) ? JSON.stringify(value) : "";
12685	};
12686
12687})(FooTable);
12688(function(F){
12689	/**
12690	 * @summary Return the columns and rows as a properly formatted JSON object.
12691	 * @memberof FooTable.Table#
12692	 * @function toJSON
12693	 * @param {boolean} [filtered=false] - Whether or not to exclude filtered rows from the result.
12694	 * @returns {Object}
12695	 */
12696	F.Table.prototype.toJSON = function(filtered){
12697		return this.use(F.Export).json(filtered);
12698	};
12699
12700	/**
12701	 * @summary Return the columns and rows as a properly formatted CSV value.
12702	 * @memberof FooTable.Table#
12703	 * @function toCSV
12704	 * @param {boolean} [filtered=false] - Whether or not to exclude filtered rows from the result.
12705	 * @returns {string}
12706	 */
12707	F.Table.prototype.toCSV = function(filtered){
12708		return this.use(F.Export).csv(filtered);
12709	};
12710
12711})(FooTable);
12712/* End */
12713;
12714; /* Start:"a:4:{s:4:"full";s:72:"/local/templates/aspro_next/vendor/js/jquery.menu-aim.js?172597048112787";s:6:"source";s:56:"/local/templates/aspro_next/vendor/js/jquery.menu-aim.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
12715/**
12716 * menu-aim is a jQuery plugin for dropdown menus that can differentiate
12717 * between a user trying hover over a dropdown item vs trying to navigate into
12718 * a submenu's contents.
12719 *
12720 * menu-aim assumes that you have are using a menu with submenus that expand
12721 * to the menu's right. It will fire events when the user's mouse enters a new
12722 * dropdown item *and* when that item is being intentionally hovered over.
12723 *
12724 * __________________________
12725 * | Monkeys  >|   Gorilla  |
12726 * | Gorillas >|   Content  |
12727 * | Chimps   >|   Here     |
12728 * |___________|____________|
12729 *
12730 * In the above example, "Gorillas" is selected and its submenu 
12730content is
12731 * being shown on the right. Imagine that the user's cursor is hovering over
12732 * "Gorillas." When they move their mouse into the "Gorilla Content" area, they
12733 * may briefly hover over "Chimps." This shouldn't close the "Gorilla Content"
12734 * area.
12735 *
12736 * This problem is normally solved using timeouts and delays. menu-aim tries to
12737 * solve this by detecting the direction of the user's mouse movement. This can
12738 * make for quicker transitions when navigating up and down the menu. The
12739 * experience is hopefully similar to amazon.com/'s "Shop by Department"
12740 * dropdown.
12741 *
12742 * Use like so:
12743 *
12744 *      $("#menu").menuAim({
12745 *          activate: $.noop,  // fired on row activation
12746 *          deactivate: $.noop  // fired on row deactivation
12747 *      });
12748 *
12749 *  ...to receive events when a menu's row has been purposefully (de)activated.
12750 *
12751 * The following options can be passed to menuAim. All functions execute with
12752 * the relevant row's HTML element as the execution context ('this'):
12753 *
12754 *      .menuAim({
12755 *          // Function to call when a row is purposefully activated. Use this
12756 *          // to show a submenu's content for the activated row.
12757 *          activate: function() {},
12758 *
12759 *          // Function to call when a row is deactivated.
12760 *          deactivate: function() {},
12761 *
12762 *          // Function to call when mouse enters a menu row. Entering a row
12763 *          // does not mean the row has been activated, as the user may be
12764 *          // mousing over to a submenu.
12765 *          enter: function() {},
12766 *
12767 *          // Function to call when mouse exits a menu row.
12768 *          exit: function() {},
12769 *
12770 *          // Selector for identifying which elements in the menu are rows
12771 *          // that can trigger the above events. Defaults to "> li".
12772 *          rowSelector: "> li",
12773 *
12774 *          // You may have some menu rows that aren't submenus and therefore
12775 *          // shouldn't ever need to "activate." If so, filter submenu rows w/
12776 *          // this selector. Defaults to "*" (all elements).
12777 *          submenuSelector: "*",
12778 *
12779 *          // Direction the submenu opens relative to the main menu. Can be
12780 *          // left, right, above, or below. Defaults to "right".
12781 *          submenuDirection: "right"
12782 *      });
12783 *
12784 * https://github.com/kamens/jQuery-menu-aim
12785*/
12786(function($) {
12787
12788    $.fn.menuAim = function(opts) {
12789        // Initialize menu-aim for all elements in jQuery collection
12790        this.each(function() {
12791            init.call(this, opts);
12792        });
12793
12794        return this;
12795    };
12796
12797    function init(opts) {
12798        var $menu = $(this),
12799            activeRow = null,
12800            mouseLocs = [],
12801            lastDelayLoc = null,
12802            timeoutId = null,
12803            options = $.extend({
12804                firstActiveRow: false,
12805                rowSelector: "> li",
12806                submenuSelector: "*",
12807                submenuDirection: "right",
12808                tolerance: 5,  // bigger = more forgivey when entering submenu
12809                enter: $.noop,
12810                exit: $.noop,
12811                activate: $.noop,
12812                deactivate: $.noop,
12813                exitMenu: $.noop
12814            }, opts);
12815
12816        var MOUSE_LOCS_TRACKED = 3,  // number of past mouse locations to track
12817            DELAY = 3000;  // ms delay when user appears to be entering submenu
12818
12819        /**
12820         * Keep track of the last few locations of the mouse.
12821         */
12822        var mousemoveDocument = function(e) {
12823                mouseLocs.push({x: e.pageX, y: e.pageY});
12824
12825                if (mouseLocs.length > MOUSE_LOCS_TRACKED) {
12826                    mouseLocs.shift();
12827                }
12828            };
12829
12830        /**
12831         * Cancel possible row activations when leaving the menu entirely
12832         */
12833        var mouseleaveMenu = function() {
12834                if (timeoutId) {
12835                    clearTimeout(timeoutId);
12836                }
12837
12838                // If exitMenu is supplied and returns true, deactivate the
12839                // currently active row on menu exit.
12840                if (options.exitMenu(this)) {
12841                    if (activeRow) {
12842                        options.deactivate(activeRow);
12843                    }
12844
12845                    activeRow = null;
12846                }
12847            };
12848
12849        /**
12850         * Trigger a possible row activation whenever entering a new row.
12851         */
12852        var mouseenterRow = function() {
12853                if (timeoutId) {
12854                    // Cancel any previous activation delays
12855                    clearTimeout(timeoutId);
12856                }
12857
12858                options.enter(this);
12859                possiblyActivate(this);
12860            },
12861            mouseleaveRow = function() {
12862                options.exit(this);
12863            };
12864
12865        /*
12866         * Immediately activate a row if the user clicks on it.
12867         */
12868        var clickRow = function() {
12869                activate(this);
12870            };
12871
12872        /**
12873         * Activate a menu row.
12874         */
12875        var activate = function(row) {
12876                if (row == activeRow) {
12877                    return;
12878                }
12879
12880                if (activeRow) {
12881                    options.deactivate(activeRow);
12882                }
12883
12884                options.activate(row);
12885                activeRow = row;
12886            };
12887
12888        /**
12889         * Possibly activate a menu row. If mouse movement indicates that we
12890         * shouldn't activate yet because user may be trying to enter
12891         * a submenu's content, then delay and check again later.
12892         */
12893        var possiblyActivate = function(row) {
vendor: 6,925 bytes, lines 12894-13052
12894                var delay = activationDelay();
12895
12896                if (delay) {
12897                    timeoutId = setTimeout(function() {
12898                        possiblyActivate(row);
12899                    }, delay);
12900                } else {
12901                    activate(row);
12902                }
12903            };
12904
12905        /**
12906         * Return the amount of time that should be used as a delay before the
12907         * currently hovered row is activated.
12908         *
12909         * Returns 0 if the activation should happen immediately. Otherwise,
12910         * returns the number of milliseconds that should be delayed before
12911         * checking again to see if the row should be activated.
12912         */
12913        var activationDelay = function() {
12914                if (!activeRow || !$(activeRow).is(options.submenuSelector)) {
12915                    // If there is no other submenu row already active, then
12916                    // go ahead and activate immediately.
12917                    return 0;
12918                }
12919
12920                var offset = $menu.offset(),
12921                    upperLeft = {
12922                        x: offset.left,
12923                        y: offset.top - options.tolerance
12924                    },
12925                    upperRight = {
12926                        x: offset.left + $menu.outerWidth(),
12927                        y: upperLeft.y
12928                    },
12929                    lowerLeft = {
12930                        x: offset.left,
12931                        y: offset.top + $menu.outerHeight() + options.tolerance
12932                    },
12933                    lowerRight = {
12934                        x: offset.left + $menu.outerWidth(),
12935                        y: lowerLeft.y
12936                    },
12937                    loc = mouseLocs[mouseLocs.length - 1],
12938                    prevLoc = mouseLocs[0];
12939
12940                if (!loc) {
12941                    return 0;
12942                }
12943
12944                if (!prevLoc) {
12945                    prevLoc = loc;
12946                }
12947
12948                if (prevLoc.x < offset.left || prevLoc.x > lowerRight.x ||
12949                    prevLoc.y < offset.top || prevLoc.y > lowerRight.y) {
12950                    // If the previous mouse location was outside of the entire
12951                    // menu's bounds, immediately activate.
12952                    return 0;
12953                }
12954
12955                if (lastDelayLoc &&
12956                        loc.x == lastDelayLoc.x && loc.y == lastDelayLoc.y) {
12957                    // If the mouse hasn't moved since the last time we checked
12958                    // for activation status, immediately activate.
12959                    return 0;
12960                }
12961
12962                // Detect if the user is moving towards the currently activated
12963                // submenu.
12964                //
12965                // If the mouse is heading relatively clearly towards
12966                // the submenu's content, we should wait and give the user more
12967                // time before activating a new row. If the mouse is heading
12968                // elsewhere, we can immediately activate a new row.
12969                //
12970                // We detect this by calculating the slope formed between the
12971                // current mouse location and the upper/lower right points of
12972                // the menu. We do the same for the previous mouse location.
12973                // If the current mouse location's slopes are
12974                // increasing/decreasing appropriately compared to the
12975                // previous's, we know the user is moving toward the submenu.
12976                //
12977                // Note that since the y-axis increases as the cursor moves
12978                // down the screen, we are looking for the slope between the
12979                // cursor and the upper right corner to decrease over time, not
12980                // increase (somewhat counterintuitively).
12981                function slope(a, b) {
12982                    return (b.y - a.y) / (b.x - a.x);
12983                };
12984
12985                var decreasingCorner = upperRight,
12986                    increasingCorner = lowerRight;
12987
12988                // Our expectations for decreasing or increasing slope values
12989                // depends on which direction the submenu opens relative to the
12990                // main menu. By default, if the menu opens on the right, we
12991                // expect the slope between the cursor and the upper right
12992                // corner to decrease over time, as explained above. If the
12993                // submenu opens in a different direction, we change our slope
12994                // expectations.
12995                if (options.submenuDirection == "left") {
12996                    decreasingCorner = lowerLeft;
12997                    increasingCorner = upperLeft;
12998                } else if (options.submenuDirection == "below") {
12999                    decreasingCorner = lowerRight;
13000                    increasingCorner = lowerLeft;
13001                } else if (options.submenuDirection == "above") {
13002                    decreasingCorner = upperLeft;
13003                    increasingCorner = upperRight;
13004                }
13005
13006                var decreasingSlope = slope(loc, decreasingCorner),
13007                    increasingSlope = slope(loc, increasingCorner),
13008                    prevDecreasingSlope = slope(prevLoc, decreasingCorner),
13009                    prevIncreasingSlope = slope(prevLoc, increasingCorner);
13010
13011                if (decreasingSlope < prevDecreasingSlope &&
13012                        increasingSlope > prevIncreasingSlope) {
13013                    // Mouse is moving from previous location towards the
13014                    // currently activated submenu. Delay before activating a
13015                    // new menu row, because user may be moving into submenu.
13016                    lastDelayLoc = loc;
13017                    return DELAY;
13018                }
13019
13020                lastDelayLoc = null;
13021                return 0;
13022            };
13023
13024        /**
13025         * Hook up initial menu events
13026         */
13027        $menu
13028            .mouseleave(mouseleaveMenu)
13029            .find(options.rowSelector)
13030                .mouseenter(mouseenterRow)
13031                .mouseleave(mouseleaveRow)
13032                .click(clickRow);
13033
13034        // sets the first active row
13035        if ('firstActiveRow' in options) {
13036            if(!$menu.find(options.rowSelector).hasClass('active')) {
13037                if (options.firstActiveRow === true) {
13038                    activate($menu.find(options.rowSelector).eq(0));
13039                } else {
13040                    activate(options.firstActiveRow);
13041                }
13042            }
13043        }
13044        $(document).mousemove(mousemoveDocument);
13045    };
13046})(jQuery);
13047
13048
13049/* End */
13050;
13051; /* Start:"a:4:{s:4:"full";s:74:"/local/templates/aspro_next/vendor/js/velocity/velocity.js?172597048244791";s:6:"source";s:58:"/local/templates/aspro_next/vendor/js/velocity/velocity.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
13052/*! VelocityJS.org (1.5.0). (C) 2014 Julian Shapiro. MIT @license: en.wikipedia.org/wiki/MIT_License */
vendor: 32,176 bytes, lines 13053-13055
13053/*! VelocityJS.org jQuery Shim (1.0.1). (C) 2014 The jQuery Foundation. MIT @license: en.wikipedia.org/wiki/MIT_License. */
13054!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:{},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]
13055;if(!(k&&k.isSVG||"tween"===l||A.Names.prefixCheck(l)[1]!==!1
vendor: 5,506 bytes, line 13055
13055||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: 3,777 bytes, line 13055
13055y.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.is
13055Function(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)});
13056/* End */
13057;
13058; /* Start:"a:4:{s:4:"full";s:77:"/local/templates/aspro_next/vendor/js/velocity/velocity.ui.js?172597048213257";s:6:"source";s:61:"/local/templates/aspro_next/vendor/js/velocity/velocity.ui.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
13059/* 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. */
13060!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}
vendor: 11,079 bytes, lines 13060-13063
13060s.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)});
13061/* End */
13062;
13063; /* Start:"a:4:{s:4:"full";s:69:"/local/templates/aspro_next/js/jquery.validate.min.js?172597044522257";s:6:"source";s:53:"/local/templates/aspro_next/js/jquery.validate.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
13064/*! jQuery Validation Plugin - v1.13.1 - 10/14/2014
13065 * http://jqueryvalidation.org/
13066 * Copyright (c) 2014 Jörn Zaefferer; Licensed MIT */
13067!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(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)}}
13067,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)),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||
13067!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.validClass),this.showLabel(c.element,c.message);if(this.errorList.length&&(this.toShow=this.toShow.add(this.containers)),this.settings.success)for(a=0;this.successList[a];a++)this.showLabel(this.successList[a]);if(this.settings.unhighlight)for(a=0,b=this.validElements();b[a];a++)this.settings.unhighlight.call(this,b[a],this.settings.errorClass,this.settings.validClass);this.toHide=this.toHide.not(this.toShow),this.hideErrors(),this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return a(this.errorList).map(function(){return this.element})},showLabel:function(b,c){var d,e,f,g=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
13067ame],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);
13067return!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(' ');
13067if(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})}})});
13068/* End */
13069;
13070; /* Start:"a:4:{s:4:"full";s:77:"/local/templates/aspro_next/js/jquery.inputmask.bundle.min.js?172597044370933";s:6:"source";s:61:"/local/templates/aspro_next/js/jquery.inputmask.bundle.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
13071!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.anal
13071yseMask(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;
13071o--)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];
13071if(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({}
13071,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");
13071o.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();
13071do{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("");
13071a.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));
13071else{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.
13071inputmask._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];
13071d=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
13071ay","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[";
13071"].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);
13071if(!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)}
13071var 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)}]);
13072/* End */
13073;
13074; /* Start:"a:4:{s:4:"full";s:67:"/local/templates/aspro_next/js/jquery.uniform.min.js?17259704458308";s:6:"source";s:52:"/local/templates/aspro_next/js/jquery.uniform.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
13075(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 13075
13075for(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
vendor: 9,214 bytes, lines 13075-13276
13075ose 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);
13076/* End */
13077;
13078; /* Start:"a:4:{s:4:"full";s:66:"/local/templates/aspro_next/js/jquery.easing.1.3.js?17259704408095";s:6:"source";s:51:"/local/templates/aspro_next/js/jquery.easing.1.3.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
13079/*
13080 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
13081 *
13082 * Uses the built in easing capabilities added In jQuery 1.1
13083 * to offer multiple easing options
13084 *
13085 * TERMS OF USE - jQuery Easing
13086 * 
13087 * Open source under the BSD License. 
13088 * 
13089 * Copyright © 2008 George McGinley Smith
13090 * All rights reserved.
13091 * 
13092 * Redistribution and use in source and binary forms, with or without modification, 
13093 * are permitted provided that the following conditions are met:
13094 * 
13095 * Redistributions of source code must retain the above copyright notice, this list of 
13096 * conditions and the following disclaimer.
13097 * Redistributions in binary form must reproduce the above copyright notice, this list 
13098 * of conditions and the following disclaimer in the documentation and/or other materials 
13099 * provided with the distribution.
13100 * 
13101 * Neither the name of the author nor the names of contributors may be used to endorse 
13102 * or promote products derived from this software without specific prior written permission.
13103 * 
13104 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
13105 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
13106 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
13107 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
13108 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
13109 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
13110 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
13111 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
13112 * OF THE POSSIBILITY OF SUCH DAMAGE. 
13113 *
13114*/
13115
13116// t: current time, b: begInnIng value, c: change In value, d: duration
13117jQuery.easing['jswing'] = jQuery.easing['swing'];
13118
13119jQuery.extend( jQuery.easing,
13120{
13121	def: 'easeOutQuad',
13122	swing: function (x, t, b, c, d) {
13123		//alert(jQuery.easing.default);
13124		return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
13125	},
13126	easeInQuad: function (x, t, b, c, d) {
13127		return c*(t/=d)*t + b;
13128	},
13129	easeOutQuad: function (x, t, b, c, d) {
13130		return -c *(t/=d)*(t-2) + b;
13131	},
13132	easeInOutQuad: function (x, t, b, c, d) {
13133		if ((t/=d/2) < 1) return c/2*t*t + b;
13134		return -c/2 * ((--t)*(t-2) - 1) + b;
13135	},
13136	easeInCubic: function (x, t, b, c, d) {
13137		return c*(t/=d)*t*t + b;
13138	},
13139	easeOutCubic: function (x, t, b, c, d) {
13140		return c*((t=t/d-1)*t*t + 1) + b;
13141	},
13142	easeInOutCubic: function (x, t, b, c, d) {
13143		if ((t/=d/2) < 1) return c/2*t*t*t + b;
13144		return c/2*((t-=2)*t*t + 2) + b;
13145	},
13146	easeInQuart: function (x, t, b, c, d) {
13147		return c*(t/=d)*t*t*t + b;
13148	},
13149	easeOutQuart: function (x, t, b, c, d) {
13150		return -c * ((t=t/d-1)*t*t*t - 1) + b;
13151	},
13152	easeInOutQuart: function (x, t, b, c, d) {
13153		if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
13154		return -c/2 * ((t-=2)*t*t*t - 2) + b;
13155	},
13156	easeInQuint: function (x, t, b, c, d) {
13157		return c*(t/=d)*t*t*t*t + b;
13158	},
13159	easeOutQuint: function (x, t, b, c, d) {
13160		return c*((t=t/d-1)*t*t*t*t + 1) + b;
13161	},
13162	easeInOutQuint: function (x, t, b, c, d) {
13163		if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
13164		return c/2*((t-=2)*t*t*t*t + 2) + b;
13165	},
13166	easeInSine: function (x, t, b, c, d) {
13167		return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
13168	},
13169	easeOutSine: function (x, t, b, c, d) {
13170		return c * Math.sin(t/d * (Math.PI/2)) + b;
13171	},
13172	easeInOutSine: function (x, t, b, c, d) {
13173		return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
13174	},
13175	easeInExpo: function (x, t, b, c, d) {
13176		return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
13177	},
13178	easeOutExpo: function (x, t, b, c, d) {
13179		return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
13180	},
13181	easeInOutExpo: function (x, t, b, c, d) {
13182		if (t==0) return b;
13183		if (t==d) return b+c;
13184		if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
13185		return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
13186	},
13187	easeInCirc: function (x, t, b, c, d) {
13188		return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
13189	},
13190	easeOutCirc: function (x, t, b, c, d) {
13191		return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
13192	},
13193	easeInOutCirc: function (x, t, b, c, d) {
13194		if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
13195		return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
13196	},
13197	easeInElastic: function (x, t, b, c, d) {
13198		var s=1.70158;var p=0;var a=c;
13199		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
13200		if (a < Math.abs(c)) { a=c; var s=p/4; }
13201		else var s = p/(2*Math.PI) * Math.asin (c/a);
13202		return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
13203	},
13204	easeOutElastic: function (x, t, b, c, d) {
13205		var s=1.70158;var p=0;var a=c;
13206		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
13207		if (a < Math.abs(c)) { a=c; var s=p/4; }
13208		else var s = p/(2*Math.PI) * Math.asin (c/a);
13209		return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
13210	},
13211	easeInOutElastic: function (x, t, b, c, d) {
13212		var s=1.70158;var p=0;var a=c;
13213		if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
13214		if (a < Math.abs(c)) { a=c; var s=p/4; }
13215		else var s = p/(2*Math.PI) * Math.asin (c/a);
13216		if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
13217		return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
13218	},
13219	easeInBack: function (x, t, b, c, d, s) {
13220		if (s == undefined) s = 1.70158;
13221		return c*(t/=d)*t*((s+1)*t - s) + b;
13222	},
13223	easeOutBack: function (x, t, b, c, d, s) {
13224		if (s == undefined) s = 1.70158;
13225		return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
13226	},
13227	easeInOutBack: function (x, t, b, c, d, s) {
13228		if (s == undefined) s = 1.70158; 
13229		if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
13230		return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
13231	},
13232	easeInBounce: function (x, t, b, c, d) {
13233		return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
13234	},
13235	easeOutBounce: function (x, t, b, c, d) {
13236		if ((t/=d) < (1/2.75)) {
13237			return c*(7.5625*t*t) + b;
13238		} else if (t < (2/2.75)) {
13239			return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
13240		} else if (t < (2.5/2.75)) {
13241			return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
13242		} else {
13243			return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
13244		}
13245	},
13246	easeInOutBounce: function (x, t, b, c, d) {
13247		if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
13248		return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
13249	}
13250});
13251
13252/*
13253 *
13254 * TERMS OF USE - EASING EQUATIONS
13255 * 
13256 * Open source under the BSD License. 
13257 * 
13258 * Copyright © 2001 Robert Penner
13259 * All rights reserved.
13260 * 
13261 * Redistribution and use in source and binary forms, with or without modification, 
13262 * are permitted provided that the following conditions are met:
13263 * 
13264 * Redistributions of source code must retain the above copyright notice, this list of 
13265 * conditions and the following disclaimer.
13266 * Redistributions in binary form must reproduce the above copyright notice, this list 
13267 * of conditions and the following disclaimer in the documentation and/or other materials 
13268 * provided with the distribution.
13269 * 
13270 * Neither the name of the author nor the names of contributors may be used to endorse 
13271 * or promote products derived from this software without specific prior written permission.
13272 * 
13273 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
13274 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
13275 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
13276 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
13277 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
13278 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
13279 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
13280 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
13281 * OF THE POSSIBILITY OF SUCH DAMAGE. 
13282 *
13283 */
13284/* End */
13285;
13286; /* Start:"a:4:{s:4:"full";s:60:"/local/templates/aspro_next/js/equalize.min.js?1725970437588";s:6:"source";s:46:"/local/templates/aspro_next/js/equalize.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
13287/**
13288 * equalize.js
13289 * Author & copyright (c) 2012: Tim Svensen
13290 * Dual MIT & GPL license
13291 *
13292 * Page: http://tsvensen.github.com/equalize.js
13293 * Repo: https://github.com/tsvensen/equalize.js/
13294 */
13295(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);
13296/* End */
13297;
13298; /* Start:"a:4:{s:4:"full";s:68:"/local/templates/aspro_next/js/jquery.alphanumeric.js?17259704381972";s:6:"source";s:53:"/local/templates/aspro_next/js/jquery.alphanumeric.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
13299(function ($) {
13300    $.fn.alphanumeric = function (p) {
13301        var input = $(this),
13302            az = "abcdefghijklmnopqrstuvwxyz",
13303            options = $.extend({
13304                ichars: '!@#$%^&*()+=[]\\\';,/{}|":<>?~`.- _',
13305                nchars: '',
13306                allow: ''
13307            }, p),
13308            s = options.allow.split(''),
13309            i = 0,
13310            ch,
13311            regex;
13312
13313        for (i; i < s.length; i++) {
13314            if (options.ichars.indexOf(s[i]) != -1) {
13315                s[i] = '\\' + s[i];
13316            }
13317        }
13318
13319        if (options.nocaps) {
13320            options.nchars += az.toUpperCase();
13321        }
13322        if (options.allcaps) {
13323            options.nchars += az;
13324        }
13325
13326        options.allow = s.join('|');
13327
13328        regex = new RegExp(options.allow, 'gi');
13329        ch = (options.ichars + options.nchars).replace(regex, '');
13330
13331        input.keypress(function (e) {
13332            var key = String.fromCharCode(!e.charCode ? e.which : e.charCode);
13333
13334            if (ch.indexOf(key) != -1 && !e.ctrlKey) {
13335                e.preventDefault();
13336            }
13337        });
13338
13339        input.blur(function () {
13340            var value = input.val(),
13341                j = 0;
13342
13343            for (j; j < value.length; j++) {
13344                if (ch.indexOf(value[j]) != -1) {
13345                    input.val('');
13346                    return false;
13347                }
13348            }
13349            return false;
13350        });
13351
13352        return input;
13353    };
13354
13355    $.fn.numeric = function (p) {
13356        var az = 'abcdefghijklmnopqrstuvwxyz',
13357            aZ = az.toUpperCase();
13358
13359        return this.each(function () {
13360            $(this).alphanumeric($.extend({ nchars: az + aZ }, p));
13361        });
13362    };
13363
13364    $.fn.alpha = function (p) {
13365        var nm = '1234567890';
13366        return this.each(function () {
13367            $(this).alphanumeric($.extend({ nchars: nm }, p));
13368        });
13369    };
13370})(jQuery);
13371/* End */
13372;
13373; /* Start:"a:4:{s:4:"full";s:62:"/local/templates/aspro_next/js/jquery.cookie.js?17259704383066";s:6:"source";s:47:"/local/templates/aspro_next/js/jquery.cookie.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
13374/*!
13375 * jQuery Cookie Plugin v1.4.0
13376 * https://github.com/carhartl/jquery-cookie
13377 *
13378 * Copyright 2013 Klaus Hartl
13379 * Released under the MIT license
13380 */
13381(function (factory) {
13382	if (typeof define === 'function' && define.amd) {
13383		// AMD. Register as anonymous module.
13384		define(['jquery'], factory);
13385	} else {
13386		// Browser globals.
13387		factory(jQuery);
13388	}
13389}(function ($) {
13390
13391	var pluses = /\+/g;
13392
13393	function encode(s) {
13394		return config.raw ? s : encodeURIComponent(s);
13395	}
13396
13397	function decode(s) {
13398		return config.raw ? s : decodeURIComponent(s);
13399	}
13400
13401	function stringifyCookieValue(value) {
13402		return encode(config.json ? JSON.stringify(value) : String(value));
13403	}
13404
13405	function parseCookieValue(s) {
13406		if (s.indexOf('"') === 0) {
13407			// This is a quoted cookie as according to RFC2068, unescape...
13408			s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
13409		}
13410
13411		try {
13412			// Replace server-side written pluses with spaces.
13413			// If we can't decode the cookie, ignore it, it's unusable.
13414			// If we can't parse the cookie, ignore it, it's unusable.
13415			s = decodeURIComponent(s.replace(pluses, ' '));
13416			return config.json ? JSON.parse(s) : s;
13417		} catch(e) {}
13418	}
13419
13420	function read(s, converter) {
13421		var value = config.raw ? s : parseCookieValue(s);
13422		return $.isFunction(converter) ? converter(value) : value;
13423	}
13424
13425	var config = $.cookie = function (key, value, options) {
13426
13427		// Write
13428
13429		if (value !== undefined && !$.isFunction(value)) {
13430			options = $.extend({}, config.defaults, options);
13431
13432			if (typeof options.expires === 'number') {
13433				var days = options.expires, t = options.expires = new Date();
13434				t.setTime(+t + days * 864e+5);
13435			}
13436
13437			return (document.cookie = [
13438				encode(key), '=', stringifyCookieValue(value),
13439				options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
13440				options.path    ? '; path=' + options.path : '',
13441				options.domain  ? '; domain=' + options.domain : '',
13442				options.secure  ? '; secure' : ''
13443			].join(''));
13444		}
13445
13446		// Read
13447
13448		var result = key ? undefined : {};
13449
13450		// To prevent the for loop in the first place assign an empty array
13451		// in case there are no cookies at all. Also prevents odd result when
13452		// calling $.cookie().
13453		var cookies = document.cookie ? document.cookie.split('; ') : [];
13454
13455		for (var i = 0, l = cookies.length; i < l; i++) {
13456			var parts = cookies[i].split('=');
13457			var name = decode(parts.shift());
13458			var cookie = parts.join('=');
13459
13460			if (key && key === name) {
13461				// If second argument (value) is a function it's a converter...
13462				result = read(cookie, value);
13463				break;
13464			}
13465
13466			// Prevent storing a cookie that we couldn't decode.
13467			if (!key && (cookie = read(cookie)) !== undefined) {
13468				result[name] = cookie;
13469			}
13470		}
13471
13472		return result;
13473	};
13474
13475	config.defaults = {};
13476
13477	$.removeCookie = function (key, options) {
13478		if ($.cookie(key) === undefined) {
13479			return false;
13480		}
13481
13482		// Must not alter options, thus extending a fresh object...
13483		$.cookie(key, '', $.extend({}, options, { expires: -1 }));
13484		return !$.cookie(key);
13485	};
13486
13487}));
13488
13489/* End */
13490;
13491; /* Start:"a:4:{s:4:"full";s:66:"/local/templates/aspro_next/js/jquery.plugin.min.js?17259704443181";s:6:"source";s:51:"/local/templates/aspro_next/js/jquery.plugin.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
13492/** Abstract base class for collection plugins v1.0.1.
13493	Written by Keith Wood (kbwood{at}iinet.com.au) December 2013.
13494	Licensed under the MIT (http://keith-wood.name/licence.html) license. */
13495(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);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);
13496/* End */
13497;
13498; /* Start:"a:4:{s:4:"full";s:70:"/local/templates/aspro_next/js/jquery.countdown.min.js?172597043913137";s:6:"source";s:54:"/local/templates/aspro_next/js/jquery.countdown.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
13499!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&&(
13499a=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},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
13499ick)){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
13499ptions["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);
13500/* End */
13501;
13502; /* Start:"a:4:{s:4:"full";s:68:"/local/templates/aspro_next/js/jquery.countdown-ru.js?17259704381400";s:6:"source";s:53:"/local/templates/aspro_next/js/jquery.countdown-ru.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
13503/* http://keith-wood.name/countdown.html
13504 * Russian initialisation for the jQuery countdown extension
13505 * Written by Sergey K. (xslade{at}gmail.com) June 2010. */
13506(function($) {
13507        $.countdown.regionalOptions['ru'] = {
13508		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')],
13509		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')],
13510		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')],
13511		compactLabels: ['л', 'м', 'н', 'д'], compactLabels1: ['г', 'м', 'н', 'д'],
13512		whichLabels: function(amount) {
13513			var units = amount % 10;
13514			var tens = Math.floor((amount % 100) / 10);
13515			return (amount == 1 ? 1 : (units >= 2 && units <= 4 && tens != 1 ? 2 :
13516				(units == 1 && tens != 1 ? 1 : 0)));
13517		},
13518		digits: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
13519		timeSeparator: ':', isRTL: false};
13520	$.countdown.setDefaults($.countdown.regionalOptions['ru']);
13521})(jQuery);
13522/* End */
13523;
13524; /* Start:"a:4:{s:4:"full";s:65:"/local/templates/aspro_next/js/jquery.ikSelect.js?172597044332030";s:6:"source";s:49:"/local/templates/aspro_next/js/jquery.ikSelect.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
13525/*! ikSelect 1.0.3
13526	Copyright (c) 2013 Igor Kozlov
13527	http://igorkozlov.me */
13528
13529;(function ($, window, document, undefined) {
13530	var $window = $(window);
13531	var defaults = {
13532		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>',
13533		autoWidth: true, // set select width according to the longest option
13534		ddFullWidth: true, // set dropdown width according to the longest option
13535		equalWidths: true, // include scrollbar width in fake select calculations
13536		dynamicWidth: false, // change fake select's width according to it's contents
13537		extractLink: false,
13538		customClass: '',
13539		linkCustomClass: '',
13540		ddCustomClass: '',
13541		ddMaxHeight: 200,
13542		filter: false,
13543		nothingFoundText: 'Nothing found',
13544		isDisabled: false,
13545		onInit: function() {},
13546		onShow: function () {},
13547		onHide: function () {},
13548		onKeyUp: function () {},
13549		onKeyDown: function () {},
13550		onHoverMove: function () {}
13551	};
13552
13553	var instOpened; // instance of the currently opened select
13554
13555	// browser detection part was taken from jQuery migrate
13556	// https://github.com/jquery/jquery-migrate/blob/e6bda6a84c294eb1319fceb48c09f51042c80892/src/core.js
13557	var uaMatch = function (ua) {
13558		ua = ua.toLowerCase();
13559
13560		var match = /(chrome)[ \/]([\w.]+)/.exec(ua) ||
13561			/(webkit)[ \/]([\w.]+)/.exec(ua) ||
13562			/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) ||
13563			/(msie) ([\w.]+)/.exec(ua) ||
13564			ua.indexOf('compatible') < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) ||
13565			[];
13566
13567		return {
13568			browser: match[1] || '',
13569			version: match[2] || '0'
13570		};
13571	};
13572
13573	if (! $.browser) {
13574		var matched = uaMatch(navigator.userAgent);
13575		var browser = {};
13576
13577		if (matched.browser) {
13578			browser[matched.browser] = true;
13579			browser.version = matched.version;
13580		}
13581
13582		if (browser.chrome) {
13583			browser.webkit = true;
13584		} else if (browser.webkit) {
13585			browser.safari = true;
13586		}
13587
13588		$.browser = browser;
13589	}
13590
13591	$.browser.mobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile/i.test(navigator.userAgent);
13592	$.browser.operamini = Object.prototype.toString.call(window.operamini) === "[object OperaMini]";
13593
13594	function IkSelect(element, options) {
13595		var dataOptions = {}; // parsed data- attributes
13596
13597		this.el = element;
13598		this.$el = $(element); // original select
13599
13600		for (var key in defaults) {
13601			dataOptions[key] = this.$el.data(key.toLowerCase());
13602		}
13603
13604		this.options = $.extend({}, defaults, options, dataOptions);
13605
13606		if ($.browser.mobile) {
13607			this.options.filter = false;
13608		}
13609
13610		this.init();
13611	}
13612
13613	$.extend(IkSelect.prototype, {
13614		init: function () {
13615			this.$wrapper = $('<div class="ik_select">' + this.options.syntax + '</div>'); // wrapper for the fake select and the fake dropdown
13616			this.$link = $('.ik_select_link', this.$wrapper); // fake select
13617			this.$linkText = $('.ik_select_link_text', this.$wrapper); // fake select's text
13618			this.$dropdown = $('.ik_select_dropdown', this.$wrapper); // fake dropdown
13619			this.$list = $('.ik_select_list', this.$wrapper); // options list inside the fake dropdown
13620			this.$listInner = $('<div class="ik_select_list_inner"/>'); // support dropdown for scrolling
13621			this.$active = $([]); // active fake option
13622			this.$hover = $([]); // hovered fake option
13623			this.hoverIndex = 0; // hovered fake option's index
13624
13625			this.$optionSet = $([]);
13626			this.$optgroupSet = $([]);
13627
13628			this.$list.append(this.$listInner);
13629
13630			if (this.options.filter) {
13631				this.$filter = $([]); // filter text input
13632				this.$optionSetOriginal = $([]); // contains original list items when filtering
13633				this.$nothingFoundText = $('<div class="ik_select_nothing_found"/>').html(this.options.nothingFoundText);
13634				this.$filterWrap = $('.ik_select_filter_wrap', this.$wrapper);
13635
13636				if (! this.$filterWrap.length) {
13637					this.$filterWrap = $('<div class="ik_select_filter_wrap"/>');
13638				}
13639
13640				this.$filter = $('<input type="text" class="ik_select_filter">');
13641
13642				this.$filterWrap.append(this.$filter);
13643				this.$list.prepend(this.$filterWrap);
13644
13645				this.$filter.on({
13646					// keyboard controls should work even if the filter is in focus
13647					'keydown.ikSelect keyup.ikSelect': $.proxy(this, '_elKeyUpDown'),
13648					// actual filtering happens on keyup
13649					'keyup.ikSelect': $.proxy(this, '_filterKeyup')
13650				});
13651			}
13652
13653			this.$wrapper.addClass(this.options.customClass);
13654			this.$link.addClass(this.options.linkCustomClass || (this.options.customClass && this.options.customClass + '-link'));
13655			this.$dropdown.addClass(this.options.ddCustomClass || (this.options.customClass && this.options.customClass + '-dd'));
13656
13657			// creating fake option list
13658			this.reset();
13659
13660			// disable select if an option or attribute are truthy
13661			this.toggle(!(this.options.isDisabled || this.$el.prop('disabled') || this.$el.hasClass('hidden')));
13662
13663			// click event for fake select
13664			this.$link.on('click.ikSelect', $.proxy(this, '_linkClick'));
13665
13666			this.$el.on({
13667				// when focus is on the original select add a focus class to the fake one
13668				'focus.ikSelect': $.proxy(this, '_elFocus'),
13669				// when focus lost remove the focus class from the fake one
13670				'blur.ikSelect': $.proxy(this, '_elBlur'),
13671				// make sure that the fake select shows correct data
13672				'change.ikSelect': $.proxy(this, '_syncOriginalOption'),
13673				// keyboard controls for the fake select
13674				'keydown.ikSelect keyup.ikSelect': $.proxy(this, '_elKeyUpDown')
13675			});
13676
13677			this.$list.on({
13678				'click.ikSelect': $.proxy(this, '_optionClick'),
13679				'mouseover.ikSelect': $.proxy(this, '_optionMouseover')
13680			}, '.ik_select_option');
13681
13682			// stop propagation of click events on the wrapper
13683			this.$wrapper.on('click', function () {
13684				return false;
13685			});
13686
13687			// appending the fake select right after the original one
13688			this.$el.after(this.$wrapper);
13689
13690			// set correct dimensions
13691			this.redraw();
13692
13693			// move original select inside the wrapper
13694			this.$el.appendTo(this.$wrapper);
13695
13696			this.options.onInit(this);
13697			this.$el.trigger('ikinit', this);
13698		},
13699
13700		// click listener for fake select
13701		_linkClick: function () {
13702			if (this.isDisabled) {
13703				return;
13704			}
13705			if (this === instOpened) {
13706				this.hideDropdown();
13707			} else {
13708				this.showDropdown();
13709			}
13710
13711		},
13712
13713		// click listener for the fake options
13714		_optionClick: function () {
13715			this._makeOptionActive(this.searchIndexes ? this.$optionSetOriginal.index(this.$hover) : this.hoverIndex, true);
13716			this.hideDropdown();
13717			this.$el.change().focus();
13718		},
13719
13720		// hover listener for the fake options
13721		_optionMouseover: function (event) {
13722			var $option = $(event.currentTarget);
13723			if ($option.hasClass('ik_select_option_disabled')) {
13724				return;
13725			}
13726			this.$hover.removeClass('ik_select_hover');
13727			this.$hover = $option.addClass('ik_select_hover');
13728			this.hoverIndex = this.$optionSet.index(this.$hover);
13729		},
13730
13731		// makes fake option active without syncing the original select
13732		_makeOptionActive: function (index, shouldSync) {
13733			var $option = $(this.el.options[index]),
13734				text='';
13735			if($option.data('img_src')){
13736				text+='<span class="icon_color" style="background: url('+$option.data('img_src')+')"></span>';
13737				this.$link.addClass('img');
13738			}
13739			if($option.attr('title')){
13740				this.$link.attr('title', $option.attr('title'));
13741			}
13742			text+=$option.text();
13743			this.$linkText.html(text);
13744
13745			this.$link.toggleClass('ik_select_link_novalue', !$option.attr('value'));
13746
13747			this.$hover.removeClass('ik_select_hover');
13748			this.$active.removeClass('ik_select_active');
13749			this.$hover = this.$active = this.$optionSet.eq(index).addClass('ik_select_hover ik_select_active');
13750			this.hoverIndex = index;
13751
13752			if (shouldSync) {
13753				this._syncFakeOption();
13754			}
13755		},
13756
13757		// keyboard controls for the fake select
13758		_elKeyUpDown: function (event) {
13759			var $handle = $(event.currentTarget);
13760			var type = event.type;
13761			var keycode = event.which;
13762			var newTop;
13763
13764			switch (keycode) {
13765			case 38: // up
13766				if (type === 'keydown') {
13767					event.preventDefault();
13768					this._moveToPrevActive();
13769				}
13770				break;
13771			case 40: // down
13772				if (type === 'keydown') {
13773					event.preventDefault();
13774					this._moveToNextActive();
13775				}
13776				break;
13777			case 33: // page up
13778				if (type === 'keydown') {
13779					event.preventDefault();
13780					newTop = this.$hover.position().top - this.$listInner.height();
13781					this._moveToPrevActive(function (optionTop) {
13782						return optionTop <= newTop;
13783					});
13784				}
13785				break;
13786			case 34: // page down
13787				if (type === 'keydown') {
13788					event.preventDefault();
13789					newTop = this.$hover.position().top + this.$listInner.height();
13790					this._moveToNextActive(function (optionTop) {
13791						return optionTop >= newTop;
13792					});
13793				}
13794				break;
13795			case 36: // home
13796				if (type === 'keydown' && $handle.is(this.$el)) {
13797					event.preventDefault();
13798					this._moveToFirstActive();
13799				}
13800				break;
13801			case 35: // end
13802				if (type === 'keydown' && $handle.is(this.$el)) {
13803					event.preventDefault();
13804					this._moveToLastActive();
13805				}
13806				break;
13807			case 32: // space
13808				if (type === 'keydown' && $handle.is(this.$el)) {
13809					event.preventDefault();
13810					if (! this.$dropdown.is(':visible')) {
13811						this._linkClick();
13812					} else {
13813						this.$hover.click();
13814					}
13815				}
13816				break;
13817			case 13: // enter
13818				if (type === 'keydown' && this.$dropdown.is(':visible')) {
13819					event.preventDefault();
13820					this.$hover.click();
13821				}
13822				break;
13823			case 27: // esc
13824				if (type === 'keydown' && this.$dropdown.is(':visible')) {
13825					event.preventDefault();
13826					this.hideDropdown();
13827				}
13828				break;
13829			case 9: // tab
13830				if (type === 'keydown') {
13831					if ($.browser.webkit && this.$dropdown.is(':visible')) {
13832						event.preventDefault();
13833					} else {
13834						this.hideDropdown();
13835					}
13836				}
13837				break;
13838			default:
13839				if (type === 'keyup' && $handle.is(this.$el)) {
13840					this._syncOriginalOption();
13841				}
13842				break;
13843			}
13844
13845			// mozilla ignores preventDefault for select navigation
13846			// this ensures that original select is in sync
13847			if (type === 'keyup' && $.browser.mozilla) {
13848				this._syncFakeOption();
13849			}
13850
13851			if (type === 'keydown') {
13852				this.options.onKeyDown(this, keycode);
13853				this.$el.trigger('ikkeydown', [this, keycode]);
13854			}
13855			if (type === 'keyup') {
13856				this.options.onKeyUp(this, keycode);
13857				this.$el.trigger('ikkeyup', [this, keycode]);
13858			}
13859		},
13860
13861		// controls hover/active states for options and makes selected with keyboard options fully visible
13862		_moveTo: function (index) {
13863			var optionTopLine, optionBottomLine;
13864			var $optgroup;
13865
13866			if (!this.$dropdown.is(':visible') && $.browser.webkit) {
13867				this.showDropdown();
13868				return this;
13869			}
13870
13871			if (!this.$dropdown.is(':visible') || $.browser.mozilla) {
13872				this._makeOptionActive(index, true);
13873			} else {
13874				this.$hover.removeClass('ik_select_hover');
13875				this.$hover = this.$optionSet.eq(index).addClass('ik_select_hover');
13876				this.hoverIndex = index;
13877			}
13878
13879			// make option fully visible
13880			optionTopLine = this.$hover.position().top;
13881			optionBottomLine = optionTopLine + this.$active.outerHeight();
13882			// make optgroup label visible if first option witin this optgroup is hovered
13883			if (!this.$hover.index()) {
13884				$optgroup = this.$hover.closest('.ik_select_optgroup');
13885				if ($optgroup.length) {
13886					optionTopLine = $optgroup.position().top;
13887				}
13888			}
13889			if (optionBottomLine > this.$listInner.height()) {
13890				this.$listInner.scrollTop(this.$listInner.scrollTop() + optionBottomLine - this.$listInner.height());
13891			} else if (optionTopLine < 0) {
13892				this.$listInner.scrollTop(this.$listInner.scrollTop() + optionTopLine);
13893			}
13894
13895			this.options.onHoverMove(this);
13896			this.$el.trigger('ikhovermove', this);
13897		},
13898
13899		_moveToFirstActive: function () {
13900			for (var i = 0; i < this.$optionSet.length; i++) {
13901				if (!this.$optionSet.eq(i).hasClass('ik_select_option_disabled')) {
13902					this._moveTo(i);
13903					break;
13904				}
13905			}
13906		},
13907
13908		_moveToLastActive: function () {
13909			for (var i = this.$optionSet.length - 1; i >= 0; i++) {
13910				if (!this.$optionSet.eq(i).hasClass('ik_select_option_disabled')) {
13911					this._moveTo(i);
13912					break;
13913				}
13914			}
13915		},
13916
13917		_moveToPrevActive: function (condition) {
13918			var $option;
13919			for (var i = this.hoverIndex - 1; i >= 0; i--) {
13920				$option = this.$optionSet.eq(i);
13921				if (!$option.hasClass('ik_select_option_disabled') && (typeof condition === 'undefined' || condition($option.position().top))) {
13922					this._moveTo(i);
13923					break;
13924				}
13925			}
13926		},
13927
13928		_moveToNextActive: function (condition) {
13929			var $option;
13930			for (var i = this.hoverIndex + 1; i < this.$optionSet.length; i++) {
13931				$option = this.$optionSet.eq(i);
13932				if (!$option.hasClass('ik_select_option_disabled') && (typeof condition === 'undefined' || condition($option.position().top))) {
13933					this._moveTo(i);
13934					break;
13935				}
13936			}
13937		},
13938
13939		// when focus is on the original select add a focus class to the fake one
13940		_elFocus:  function () {
13941			var wrapperOffsetTop, wrapperHeight, windowScrollTop, windowHeight;
13942			if (this.isDisabled) {
13943				return this;
13944			}
13945			this.$link.addClass('ik_select_link_focus');
13946
13947			// scroll the window so that focused select is visible
13948			wrapperOffsetTop = this.$wrapper.offset().top;
13949			wrapperHeight = this.$wrapper.height();
13950			windowScrollTop = $window.scrollTop();
13951			windowHeight = $window.height();
13952			if ((wrapperOffsetTop + wrapperHeight > windowScrollTop + windowHeight) ||
13953				(wrapperOffsetTop < windowScrollTop)) {
13954				$window.scrollTop(wrapperOffsetTop - windowHeight / 2);
13955			}
13956		},
13957
13958		// when focus lost remove the focus class from the fake one
13959		_elBlur: function () {
13960			this.$link.removeClass('ik_select_link_focus');
13961		},
13962
13963		// filtering on key up
13964		_filterKeyup: function () {
13965			var filterVal = $.trim(this.$filter.val());
13966			var filterValOld;
13967			this.$listInner.show();
13968
13969			if (typeof this.searchIndexes === 'undefined') {
13970				this.$optionSetOriginal = this.$optionSet;
13971				this.searchIndexes = $.makeArray(this.$optionSet.map(function (optionIndex, option) {
13972					return $(option).text().toLowerCase();
13973				}));
13974			}
13975
13976			if (filterVal !== filterValOld) {
13977				if (filterVal === '') {
13978					this.$optionSet = this.$optionSetOriginal.show();
13979					this.$optgroupSet.show();
13980					this.$nothingFoundText.remove();
13981				} else {
13982					this.$optionSet = $([]);
13983					this.$optgroupSet.show();
13984					this.$optionSetOriginal.each($.proxy(function (optionIndex, option) {
13985						var $option = $(option);
13986						if (this.searchIndexes[optionIndex].indexOf(filterVal.toLowerCase()) >= 0) {
13987							this.$optionSet = this.$optionSet.add($option);
13988							$option.show();
13989						} else {
13990							$option.hide();
13991						}
13992					}, this));
13993
13994					if (this.$optionSet.length) {
13995						this.$nothingFoundText.remove();
13996						this.$optgroupSet.each(function (optgroupIndex, optgroup) {
13997							var $optgroup = $(optgroup);
13998							if (!$('.ik_select_option:visible', $optgroup).length) {
13999								$optgroup.hide();
14000							}
14001						});
14002
14003						if (!this.$hover.is(':visible')) {
14004							this._moveToFirstActive();
14005						}
14006					} else {
14007						this.$listInner.hide();
14008						this.$list.append(this.$nothingFoundText);
14009					}
14010				}
14011
14012				filterValOld = filterVal;
14013			}
14014		},
14015
14016		// sync selected option in the fake select with the original one
14017		_syncFakeOption: function () {
14018			this.el.selectedIndex = this.hoverIndex;
14019		},
14020
14021		// sync selected option in the original select with the fake one
14022		_syncOriginalOption: function () {
14023			this._makeOptionActive(this.el.selectedIndex);
14024		},
14025
14026		// sets fixed height to dropdown if it's bigger than ddMaxHeight
14027		_fixHeight: function () {
14028			this.$dropdown.show();
14029			this.$listInner.css('height', 'auto');
14030			if (this.$listInner.height() > this.options.ddMaxHeight) {
14031				this.$listInner.css({
14032					overflow: 'auto',
14033					height: this.options.ddMaxHeight,
14034					position: 'relative'
14035				});
14036			}
14037			this.$dropdown.hide();
14038		},
14039
14040		// calculates the needed data for showing the dropdown
14041		redraw: function () {
14042			var maxWidthOuter, scrollbarWidth, wrapperParentWidth;
14043
14044			if (this.options.filter) {
14045				this.$filter.hide();
14046			}
14047
14048			this.$wrapper.css({
14049				position: 'relative'
14050			});
14051			this.$dropdown.css({
14052				position: 'absolute',
14053				zIndex: 9998,
14054				width: '100%'
14055			});
14056			this.$list.css({
14057				position: 'relative'
14058			});
14059
14060			this._fixHeight();
14061
14062			// width calculations for the fake select when "autoWidth" is "true"
14063			if (this.options.dynamicWidth || this.options.autoWidth || this.options.ddFullWidth) {
14064				this.$wrapper.width('');
14065
14066				this.$dropdown.show().width(9999);
14067				this.$listInner.css('float', 'left');
14068				this.$list.css('float', 'left');
14069				maxWidthOuter = this.$list.outerWidth(true);
14070				scrollbarWidth = this.$listInner.width() - this.$listInnerUl.width();
14071				this.$list.css('float', '');
14072				this.$listInner.css('float', '');
14073				this.$dropdown.css('width', '100%');
14074
14075				if (this.options.ddFullWidth) {
14076					this.$dropdown.width(maxWidthOuter + scrollbarWidth);
14077				}
14078
14079				if (this.options.dynamicWidth) {
14080					this.$wrapper.css({
14081						display: 'inline-block',
14082						width: 'auto',
14083						verticalAlign: 'top'
14084					});
14085				} else if (this.options.autoWidth) {
14086					this.$wrapper.width(maxWidthOuter + (this.options.equalWidths ? scrollbarWidth : 0)).addClass('ik_select_autowidth');
14087				}
14088
14089				wrapperParentWidth = this.$wrapper.parent().width();
14090				if (this.$wrapper.width() > wrapperParentWidth) {
14091					this.$wrapper.width(wrapperParentWidth);
14092				}
14093			}
14094
14095			if (this.options.filter) {
14096				this.$filter.show().outerWidth(this.$filterWrap.width());
14097			}
14098
14099			this.$dropdown.hide();
14100
14101			// hide the original select
14102			this.$el.css({
14103				position: 'absolute',
14104				margin: 0,
14105				padding: 0,
14106				top: 0,
14107				left: -9999
14108			});
14109
14110			// show the original select in mobile browsers
14111			if ($.browser.mobile) {
14112				this.$el.css({
14113					opacity: 0,
14114					left: 0,
14115					height: this.$wrapper.height(),
14116					width: this.$wrapper.width()
14117				});
14118			}
14119		},
14120
14121		// creates or recreates dropdown and sets selected options's text into fake select
14122		reset: function () {
14123			var html = '';
14124
14125			// init fake select's text
14126			this.$linkText.html(this.$el.val());
14127
14128			this.$listInner.empty();
14129
14130			// creating an ul>li list identical to the original dropdown
14131			html = '<ul>';
14132			this.$el.children().each($.proxy(function (childIndex, child) {
14133				var $child = $(child);
14134				var tagName = child.tagName.toLowerCase();
14135				var options;
14136				if (tagName === 'optgroup') {
14137					options = $child.children().map($.proxy(function (optionIndex, option) {
14138						return this._generateOptionObject($(option));
14139					}, this));
14140					options = $.makeArray(options);
14141					html += this._renderListOptgroup({
14142						label: $child.attr('label') || '&nbsp;',
14143						isDisabled: $child.is(':disabled'),
14144						options: options
14145					});
14146				} else if (tagName === 'option') {
14147					html += this._renderListOption(this._generateOptionObject($child));
14148				}
14149			}, this));
14150			html += '</ul>';
14151			this.$listInner.append(html);
14152			this._syncOriginalOption();
14153
14154			this.$listInnerUl = $('> ul', this.$listInner);
14155			this.$optgroupSet = $('.ik_select_optgroup', this.$listInner);
14156			this.$optionSet = $('.ik_select_option', this.$listInner);
14157		},
14158
14159		// hides dropdown
14160		hideDropdown: function () {
14161			if (this.options.filter) {
14162				this.$filter.val('');
14163				this._filterKeyup();
14164			}
14165
14166			this.$dropdown.hide().appendTo(this.$wrapper).css({
14167				'left': '',
14168				'top': ''
14169			});
14170			if (this.options.extractLink) {
14171				this.$wrapper.outerWidth(this.$wrapper.data('outerWidth'));
14172				this.$wrapper.height('');
14173				this.$link.removeClass('ik_select_link_extracted').css({
14174					position: '',
14175					top: '',
14176					left: '',
14177					zIndex: ''
14178				}).prependTo(this.$wrapper);
14179			}
14180			instOpened = null;
14181			this.$el.focus();
14182
14183			this.options.onHide(this);
14184			this.$el.trigger('ikhide', this);
14185		},
14186
14187		// shows dropdown
14188		showDropdown: function () {
14189			var dropdownOffset, dropdownOuterWidth, dropdownOuterHeight;
14190			var wrapperOffset, wrapperOuterWidth;
14191			var windowWidth, windowHeight, windowScroll;
14192			var linkOffset;
14193
14194			if (instOpened === this || !this.$optionSet.length) {
14195				return;
14196			} else if (instOpened) {
14197				instOpened.hideDropdown();
14198			}
14199
14200			this._syncOriginalOption();
14201			if($('.show_un_props').length)
14202				this.$dropdown.addClass('show_un_props');
14203			else if($('.unshow_un_props').length)
14204				this.$dropdown.addClass('unshow_un_props');
14205			this.$dropdown.show();
14206
14207			dropdownOffset = this.$dropdown.offset();
14208			dropdownOuterWidth = this.$dropdown.outerWidth(true);
14209			dropdownOuterHeight = this.$dropdown.outerHeight(true);
14210			wrapperOffset = this.$wrapper.offset();
14211			windowWidth = $window.width();
14212			windowHeight = $window.height();
14213			windowScroll = $window.scrollTop();
14214
14215			// if the dropdown's right border is beyond window's edge then move the dropdown to the left so that it fits
14216			if (this.options.ddFullWidth && wrapperOffset.left + dropdownOuterWidth > windowWidth) {
14217				dropdownOffset.left = windowWidth - dropdownOuterWidth;
14218			}
14219
14220			// if the dropdown's bottom border is beyond window's edge then move the dropdown to the top so that it fits
14221			if (dropdownOffset.top + dropdownOuterHeight > windowScroll + windowHeight) {
14222				dropdownOffset.top = windowScroll + windowHeight - dropdownOuterHeight;
14223			}
14224
14225			this.$dropdown.css({
14226				left: dropdownOffset.left,
14227				top: dropdownOffset.top,
14228				width: this.$dropdown.width()
14229			}).appendTo('body');
14230
14231			if (this.options.extractLink) {
14232				linkOffset = this.$link.offset();
14233				wrapperOuterWidth = this.$wrapper.outerWidth();
14234				this.$wrapper.data('outerWidth', wrapperOuterWidth);
14235				this.$wrapper.outerWidth(wrapperOuterWidth);
14236				this.$wrapper.outerHeight(this.$wrapper.outerHeight());
14237				this.$link.outerWidth(this.$link.outerWidth());
14238				this.$link.addClass('ik_select_link_extracted').css({
14239					position: 'absolute',
14240					top: linkOffset.top,
14241					left: linkOffset.left,
14242					zIndex: 9999
14243				}).appendTo('body');
14244			}
14245
14246			this.$listInner.scrollTop(this.$active.position().top - this.$list.height() / 2);
14247
14248			if (this.options.filter) {
14249				this.$filter.focus();
14250			} else {
14251				this.$el.focus();
14252			}
14253
14254			instOpened = this;
14255
14256			this.options.onShow(this);
14257			this.$el.trigger('ikshow', this);
14258		},
14259
14260		_generateOptionObject: function ($option) {
14261			
14262			return {
14263				value: $option.val(),
14264				label: $option.html() || '&nbsp;',
14265				isDisabled: $option.is(':disabled'),
14266				dataParam: $option.data(),
14267				className: $option.attr('class'),
14268				title: $option.attr('title')
14269			};
14270		},
14271
14272		// generates option code for the fake dropdown
14273		_renderListOption: function (option) {
14274			var html;
14275			var disabledClass = option.isDisabled ? ' ik_select_option_disabled' : '';
14276			var imgClass = option.dataParam.img_src ? ' img' : '';
14277			var missingClass = option.className=='hidden' ? ' missing' : '';
14278			var title = option.title;
14279			html = '<li class="ik_select_option' + disabledClass + imgClass + missingClass + '" title="'+title+'" data-value="' + option.value + '">';
14280			html += '<span class="ik_select_option_label" title="'+title+'">';
14281			if(option.dataParam.img_src){
14282				html += '<span class="icon_color" style="background: url('+option.dataParam.img_src+')"></span>';
14283			}
14284			html += option.label;
14285			html += '</span>';
14286			html += '</li>';
14287			return html;
14288		},
14289
14290		// generates optgroup code for the fake dropdown
14291		_renderListOptgroup: function (optgroup) {
14292			var html;
14293			var disabledClass = optgroup.isDisabled ? ' ik_select_optgroup_disabled' : '';
14294			html = '<li class="ik_select_optgroup' + disabledClass + '">';
14295			html += '<div class="ik_select_optgroup_label">' + optgroup.label + '</div>';
14296			html += '<ul>';
14297			if ($.isArray(optgroup.options)) {
14298				$.each(optgroup.options, $.proxy(function (optionIndex, option) {
14299					html += this._renderListOption({
14300						value: option.value,
14301						label: option.label || '&nbsp;',
14302						isDisabled: option.isDisabled
14303					});
14304				}, this));
14305			}
14306			html += '</ul>';
14307			html += '</li>';
14308			return html;
14309		},
14310
14311		// generates option code for the select
14312		_renderOption: function (option) {
14313			return '<option value="' + option.value + '">' + option.label + '</option>';
14314		},
14315
14316		// generates optgroup code for the select
14317		_renderOptgroup: function (optgroup) {
14318			var html;
14319			html = '<optgroup label="' + optgroup.label + '">';
14320			if ($.isArray(optgroup.options)) {
14321				$.each(optgroup.options, $.proxy(function (optionIndex, option) {
14322					html += this._renderOption(option);
14323				}, this));
14324			}
14325			html += '</option>';
14326			return html;
14327		},
14328
14329		addOptions: function (options, optionIndex, optgroupIndex) {
14330			var listHtml = '', selectHtml = '';
14331			var $destinationUl = this.$listInnerUl;
14332			var $destinationOptgroup = this.$el;
14333			var $ulOptions, $optgroupOptions;
14334
14335			options = $.isArray(options) ? options : [options];
14336
14337			$.each(options, $.proxy(function (index, option) {
14338				listHtml += this._renderListOption(option);
14339				selectHtml += this._renderOption(option);
14340			}, this));
14341
14342			if ($.isNumeric(optgroupIndex) && optgroupIndex < this.$optgroupSet.length) {
14343				$destinationUl = this.$optgroupSet.eq(optgroupIndex);
14344				$destinationOptgroup = $('optgroup', this.$el).eq(optgroupIndex);
14345			}
14346			if ($.isNumeric(optionIndex)) {
14347				$ulOptions = $('.ik_select_option', $destinationUl);
14348				if (optionIndex < $ulOptions.length) {
14349					$ulOptions.eq(optionIndex).before(listHtml);
14350					$optgroupOptions = $('option', $destinationOptgroup);
14351					$optgroupOptions.eq(optionIndex).before(selectHtml);
14352				}
14353			}
14354			if (!$optgroupOptions) {
14355				$destinationUl.append(listHtml);
14356				$destinationOptgroup.append(selectHtml);
14357			}
14358
14359			this.$optionSet = $('.ik_select_option', this.$listInner);
14360			this._fixHeight();
14361		},
14362
14363		addOptgroups: function (optgroups, optgroupIndex) {
14364			var listHtml = '', selectHtml = '';
14365			if (!optgroups) {
14366				return;
14367			}
14368			optgroups = $.isArray(optgroups) ? optgroups : [optgroups];
14369
14370			$.each(optgroups, $.proxy(function (optgroupIndex, optgroup) {
14371				listHtml += this._renderListOptgroup(optgroup);
14372				selectHtml += this._renderOptgroup(optgroup);
14373			}, this));
14374
14375			if ($.isNumeric(optgroupIndex) && optgroupIndex < this.$optgroupSet.length) {
14376				this.$optgroupSet.eq(optgroupIndex).before(listHtml);
14377				$('optgroup', this.$el).eq(optgroupIndex).before(selectHtml);
14378			} else {
14379				this.$listInnerUl.append(listHtml);
14380				this.$el.append(selectHtml);
14381			}
14382
14383			this.$optgroupSet = $('.ik_select_optgroup', this.$listInner);
14384			this.$optionSet = $('.ik_select_option', this.$listInner);
14385			this._fixHeight();
14386		},
14387
14388		removeOptions: function (optionIndexes, optgroupIndex) {
14389			var $removeList = $([]);
14390			var $listContext;
14391			var $selectContext;
14392
14393			if ($.isNumeric(optgroupIndex)) {
14394				if (optgroupIndex < 0) {
14395					$listContext = $('> .ik_select_option', this.$listInnerUl);
14396					$selectContext = $('> option', this.$el);
14397				} else if (optgroupIndex < this.$optgroupSet.length) {
14398					$listContext = $('.ik_select_option', this.$optgroupSet.eq(optgroupIndex));
14399					$selectContext = $('optgroup', this.$el).eq(optgroupIndex).find('option');
14400				}
14401			}
14402			if (!$listContext) {
14403				$listContext = this.$optionSet;
14404				$selectContext = $(this.el.options);
14405			}
14406
14407			if (!$.isArray(optionIndexes)) {
14408				optionIndexes = [optionIndexes];
14409			}
14410
14411			$.each(optionIndexes, $.proxy(function (index, optionIndex) {
14412				if (optionIndex < $listContext.length) {
14413					$removeList = $removeList.add($listContext.eq(optionIndex)).add($selectContext.eq(optionIndex));
14414				}
14415			}, this));
14416
14417			$removeList.remove();
14418			this.$optionSet = $('.ik_select_option', this.$listInner);
14419			this._syncOriginalOption();
14420			this._fixHeight();
14421		},
14422
14423		removeOptgroups: function (optgroupIndexes) {
14424			var $removeList = $([]);
14425			var $selectOptgroupSet = $('optgroup', this.el);
14426
14427			if (!$.isArray(optgroupIndexes)) {
14428				optgroupIndexes = [optgroupIndexes];
14429			}
14430
14431			$.each(optgroupIndexes, $.proxy(function (index, optgroupIndex) {
14432				if (optgroupIndex < this.$optgroupSet.length) {
14433					$removeList = $removeList.add(this.$optgroupSet.eq(optgroupIndex)).add($selectOptgroupSet.eq(optgroupIndex));
14434				}
14435			}, this));
14436
14437			$removeList.remove();
14438			this.$optionSet = $('.ik_select_option', this.$listInner);
14439			this.$optgroupSet = $('.ik_select_optgroup', this.$listInner);
14440			this._syncOriginalOption();
14441			this._fixHeight();
14442		},
14443
14444		// disable select
14445		disable: function () {
14446			this.toggle(false);
14447		},
14448
14449		// enable select
14450		enable: function () {
14451			this.toggle(true);
14452		},
14453
14454		// toggle select
14455		toggle: function (bool) {
14456			this.isDisabled = typeof bool !== 'undefined' ? !bool : !this.isDisabled;
14457			this.$el.prop('disabled', this.isDisabled);
14458			this.$link.toggleClass('ik_select_link_disabled', this.isDisabled);
14459		},
14460
14461		// make option selected by value
14462		select: function (value, isIndex) {
14463			if (!isIndex) {
14464				this.$el.val(value);
14465			} else {
14466				this.el.selectedIndex = value;
14467			}
14468			this._syncOriginalOption();
14469		},
14470
14471		disableOptgroups: function (optgroupIndexes) {
14472			this.toggleOptgroups(optgroupIndexes, false);
14473		},
14474
14475		enableOptgroups: function (optgroupIndexes) {
14476			this.toggleOptgroups(optgroupIndexes, true);
14477		},
14478
14479		toggleOptgroups: function (optgroupIndexes, bool) {
14480			if (!$.isArray(optgroupIndexes)) {
14481				optgroupIndexes = [optgroupIndexes];
14482			}
14483
14484			$.each(optgroupIndexes, $.proxy(function (index, optgroupIndex) {
14485				var isDisabled;
14486				var $optionSet, indexes = [], indexFirst;
14487				var $optgroup = $('optgroup', this.$el).eq(optgroupIndex);
14488				isDisabled = typeof bool !== 'undefined' ? bool : $optgroup.prop('disabled');
14489				$optgroup.prop('disabled', !isDisabled);
14490				this.$optgroupSet.eq(optgroupIndex).toggleClass('ik_select_optgroup_disabled', !isDisabled);
14491
14492				$optionSet = $('option', $optgroup);
14493				indexFirst = $(this.el.options).index($optionSet.eq(0));
14494				for (var i = indexFirst; i < indexFirst + $optionSet.length; i++) {
14495					indexes.push(i);
14496				}
14497				this.toggleOptions(indexes, true, isDisabled);
14498			}, this));
14499
14500			this._syncOriginalOption();
14501		},
14502
14503		disableOptions: function (lookupValues, isIndex) {
14504			this.toggleOptions(lookupValues, isIndex, false);
14505		},
14506
14507		enableOptions: function (lookupValues, isIndex) {
14508			this.toggleOptions(lookupValues, isIndex, true);
14509		},
14510
14511		toggleOptions: function (lookupValues, isIndex, bool) {
14512			var $selectOptionSet = $('option', this.el);
14513			if (!$.isArray(lookupValues)) {
14514				lookupValues = [lookupValues];
14515			}
14516
14517			var toggleOption = $.proxy(function ($option, optionIndex) {
14518				var isDisabled = typeof bool !== 'undefined' ? bool : $option.prop('disabled');
14519				$option.prop('disabled', !isDisabled);
14520				this.$optionSet.eq(optionIndex).toggleClass('ik_select_option_disabled', !isDisabled);
14521			}, this);
14522
14523			$.each(lookupValues, function (index, lookupValue) {
14524				if (!isIndex) {
14525					$selectOptionSet.each(function (optionIndex, option) {
14526						var $option = $(option);
14527						if ($option.val() === lookupValue) {
14528							toggleOption($option, optionIndex);
14529							return this;
14530						}
14531					});
14532				} else {
14533					toggleOption($selectOptionSet.eq(lookupValue), lookupValue);
14534				}
14535			});
14536
14537			this._syncOriginalOption();
14538		},
14539
14540		// detach plugin from the orignal select
14541		detach: function () {
14542			this.$el.off('.ikSelect').css({
14543				width: '',
14544				height: '',
14545				left: '',
14546				top: '',
14547				position: '',
14548				margin: '',
14549				padding: ''
14550			});
14551
14552			this.$wrapper.before(this.$el);
14553			this.$wrapper.remove();
14554			this.$el.removeData('plugin_ikSelect');
14555		}
14556	});
14557
14558	$.fn.ikSelect = function (options) {
14559		var args;
14560		//do nothing if opera mini
14561		if ($.browser.operamini) {
14562			return this;
14563		}
14564
14565		args = Array.prototype.slice.call(arguments, 1);
14566
14567		return this.each(function () {
14568			var plugin;
14569			if (!$.data(this, 'plugin_ikSelect')) {
14570				$.data(this, 'plugin_ikSelect', new IkSelect(this, options));
14571			} else if (typeof options === 'string') {
14572				plugin = $.data(this, 'plugin_ikSelect');
14573				if (typeof plugin[options] === 'function') {
14574					plugin[options].apply(plugin, args);
14575				}
14576			}
14577		});
14578	};
14579
14580	$.ikSelect = {
14581		extendDefaults: function (options) {
14582			$.extend(defaults, options);
14583		}
14584	};
14585
14586	$(document).bind('click.ikSelect', function () {
14587		if (instOpened) {
14588			instOpened.hideDropdown();
14589		}
14590	});
14591})(jQuery, window, document);
14592
14593/* End */
14594;
14595; /* Start:"a:4:{s:4:"full";s:79:"/local/templates/aspro_next/js/jquery.mobile.custom.touch.min.js?17259704447784";s:6:"source";s:64:"/local/templates/aspro_next/js/jquery.mobile.custom.touch.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
14596/*! jQuery Mobile v1.4.5 | Copyright 2010, 2014 jQuery Foundation, Inc. | jquery.org/license */
14597
14598(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 14598
14598d||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.
14598coords[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)});
14599/* End */
14600;
14601; /* Start:"a:4:{s:4:"full";s:65:"/local/templates/aspro_next/js/jquery.dotdotdot.js?17259704395908";s:6:"source";s:50:"/local/templates/aspro_next/js/jquery.dotdotdot.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
14602!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 14602-14616
14602if(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);
14603/* End */
14604;
14605; /* Start:"a:4:{s:4:"full";s:62:"/local/templates/aspro_next/js/rating_likes.js?172597044710797";s:6:"source";s:46:"/local/templates/aspro_next/js/rating_likes.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
14606if (!BXRL)
14607{
14608	var BXRL = {};
14609	var BXRLW = null;
14610}
14611
14612RatingLikes = function(likeId, entityTypeId, entityId, available, userId, localize, template, pathToUserProfile, pathToAjax)
14613{
14614	this.enabled = true;
14615	this.likeId = likeId;
14616	this.entityTypeId = entityTypeId;
14617	this.entityId = entityId;
14618	this.available = (available == 'Y');
14619	this.userId = userId;
14620	this.localize = localize;
14621	this.template = template;
14622	this.pathToUserProfile = pathToUserProfile;
14623	this.pathToAjax = typeof(pathToAjax) == "string"? pathToAjax: '/bitrix/components/bitrix/rating.vote/vote.ajax.php';
14624
14625	this.box = BX('bx-ilike-button-'+likeId);
14626	if (this.box === null)
14627	{
14628		this.enabled = false;
14629		return false;
14630	}
14631
14632	this.button = BX.findChild(this.box, {className:'bx-ilike-left-wrap'}, true, false);
14633	this.wrapp = BX.findChild(this.box, {className:'all-wrapper'}, true, false);
14634	this.buttonText = BX.findChild(this.button, {className:'bx-ilike-text'}, true, false);
14635	this.count = BX.findChild(this.box,  {tagName:'span', className:'bx-ilike-right-wrap'}, true, false);
14636	this.countText	= BX.findChild(this.count, {tagName:'span', className:'bx-ilike-right'}, true, false);
14637	this.popup = null;
14638	this.popupId = null;
14639	this.popupOpenId = null;
14640	this.popupTimeoutId = null;
14641	this.popupContent = BX.findChild(BX('bx-ilike-popup-cont-'+likeId), {tagName:'span', className:'bx-ilike-popup'}, true, false);
14642	this.popupContentPage = 1;
14643	this.popupListProcess = false;
14644	this.popupTimeout = false;
14645	this.likeTimeout = false;
14646
14647	this.lastVote = BX.hasClass(template == 'standart'? this.button: this.count, 'bx-you-like')? 'plus': 'cancel';
14648};
14649
14650RatingLikes.LiveUpdate = function(params)
14651{
14652	if (params.USER_ID == BX.message('USER_ID'))
14653		return false;
14654
14655	for(var i in BXRL)
14656	{
14657		if (BXRL.hasOwnProperty(i))
14658		{
14659			if (BXRL[i].entityTypeId == params.ENTITY_TYPE_ID && BXRL[i].entityId == params.ENTITY_ID)
14660			{
14661				var element = BXRL[i];
14662				element.countText.innerHTML = parseInt(params.TOTAL_POSITIVE_VOTES);
14663				element.count.insertBefore(
14664					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')})
14665					, element.count.firstChild);
14666
14667				if (element.popup)
14668				{
14669					element.popup.close();
14670					element.popupContentPage = 1;
14671				}
14672			}
14673		}
14674	}
14675};
14676
14677RatingLikes.Set = function(likeId, entityTypeId, entityId, available, userId, localize, template, pathToUserProfile, pathToAjax)
14678{
14679	if (template === undefined)
14680		template = 'standart';
14681
14682	if (!BXRL[likeId] || BXRL[likeId].tryToSet <= 5)
14683	{
14684		var tryToSend = BXRL[likeId] && BXRL[likeId].tryToSet? BXRL[likeId].tryToSet: 1;
14685		BXRL[likeId] = new RatingLikes(likeId, entityTypeId, entityId, available, userId, localize, template, pathToUserProfile, pathToAjax);
14686		if (BXRL[likeId].enabled)
14687		{
14688			RatingLikes.Init(likeId);
14689		}
14690		else
14691		{
14692			setTimeout(function(){
14693				BXRL[likeId].tryToSet = tryToSend+1;
14694				RatingLikes.Set(likeId, entityTypeId, entityId, available, userId, localize, template, pathToUserProfile, pathToAjax);
14695			}, 500);
14696		}
14697	}
14698};
14699
14700RatingLikes.Init = function(likeId)
14701{
14702	// like/unlike button
14703	if (BXRL[likeId].available)
14704	{
14705
14706		BX.bind(BXRL[likeId].template == 'standart'? BXRL[likeId].button: BXRL[likeId].buttonText, 'click' ,function(e) {
14707			clearTimeout(BXRL[likeId].likeTimeout);
14708			if (BX.hasClass(BXRL[likeId].template == 'standart'? this: BXRL[likeId].count, 'bx-you-like'))
14709			{
14710				BXRL[likeId].buttonText.innerHTML	=	BXRL[likeId].localize['LIKE_N'];
14711				BXRL[likeId].countText.innerHTML		= 	parseInt(BXRL[likeId].countText.innerHTML)-1;
14712				BX.removeClass(BXRL[likeId].template == 'standart'? this: BXRL[likeId].count, 'bx-you-like');
14713
14714				BXRL[likeId].likeTimeout = setTimeout(function(){
14715					if (BXRL[likeId].lastVote != 'cancel')
14716						RatingLikes.Vote(likeId, 'cancel');
14717				}, 1000);
14718			}
14719			else
14720			{
14721				BXRL[likeId].buttonText.innerHTML	=	BXRL[likeId].localize['LIKE_Y'];
14722				BXRL[likeId].countText.innerHTML 	= 	parseInt(BXRL[likeId].countText.innerHTML)+1;
14723				BX.addClass(BXRL[likeId].template == 'standart'? this: BXRL[likeId].count, 'bx-you-like');
14724
14725				BXRL[likeId].likeTimeout = setTimeout(function(){
14726					if (BXRL[likeId].lastVote != 'plus')
14727						RatingLikes.Vote(likeId, 'plus');
14728				}, 1000);
14729			}
14730			BX.removeClass(this.box, 'bx-ilike-button-hover');
14731			BX.PreventDefault(e);
14732		});
14733		// Hover/unHover like-button
14734		BX.bind(BXRL[likeId].box, 'mouseover', function() {BX.addClass(this, 'bx-ilike-button-hover')});
14735		BX.bind(BXRL[likeId].box, 'mouseout', function() {BX.removeClass(this, 'bx-ilike-button-hover')});
14736
14737	}
14738	else
14739	{
14740		if (BXRL[likeId].buttonText != undefined)
14741			BXRL[likeId].buttonText.innerHTML	=	BXRL[likeId].localize['LIKE_D'];
14742	}
14743	// get like-user-list
14744	RatingLikes.PopupScroll(likeId);
14745	console.log();
14746	BX.bind(BXRL[likeId].wrapp, 'mouseover' , function() {
14747		clearTimeout(BXRL[likeId].popupTimeoutId);
14748		BXRL[likeId].popupTimeoutId = setTimeout(function(){
14749			if (BXRLW == likeId)
14750				return false;
14751			if (BXRL[likeId].popupContentPage == 1)
14752				RatingLikes.List(likeId, 1);
14753			BXRL[likeId].popupTimeoutId = setTimeout(function() {
14754				RatingLikes.OpenWindow(likeId);
14755			}, 400);
14756		}, 400);
14757	});
14758	BX.bind(BXRL[likeId].wrapp, 'mouseout' , function() {
14759		clearTimeout(BXRL[likeId].popupTimeoutId);
14760	});
14761	/*BX.bind(BXRL[likeId].count, 'click' , function() {
14762		clearTimeout(BXRL[likeId].popupTimeoutId);
14763		if (BXRL[likeId].popupContentPage == 1)
14764			RatingLikes.List(likeId, 1);
14765		RatingLikes.OpenWindow(likeId);
14766	});*/
14767
14768	BX.bind(BXRL[likeId].box, 'mouseover' , function() {
14769		clearTimeout(BXRL[likeId].popupTimeout);
14770	});
14771	BX.bind(BXRL[likeId].box, 'mouseout' , function() {
14772		clearTimeout(BXRL[likeId].popupTimeout);
14773		BXRL[likeId].popupTimeout = setTimeout(function(){
14774			if (BXRL[likeId].popup !== null)
14775			{
14776				BXRL[likeId].popup.close();
14777				BXRLW = null;
14778			}
14779		}, 1000);
14780	});
14781};
14782
14783RatingLikes.OpenWindow = function(likeId)
14784{
14785	if (parseInt(BXRL[likeId].countText.innerHTML) == 0)
14786		return false;
14787
14788	if (BXRL[likeId].popup == null)
14789	{
14790		BXRL[likeId].popup = new BX.PopupWindow('ilike-popup-'+likeId, (BXRL[likeId].template == 'standart'? BXRL[likeId].count: BXRL[likeId].box), {
14791			lightShadow : true,
14792			offsetLeft: 5,
14793			autoHide: true,
14794			closeByEsc: true,
14795			zIndex: 2005,
14796			bindOptions: {position: "top"},
14797			events : {
14798				onPopupClose : function() { BXRLW = null; },
14799				onPopupDestroy : function() {  }
14800			},
14801			content : BX('bx-ilike-popup-cont-'+likeId)
14802		});
14803		BXRL[likeId].popup.setAngle({});
14804
14805		BX.bind(BX('ilike-popup-'+likeId), 'mouseout' , function() {
14806			clearTimeout(BXRL[likeId].popupTimeout);
14807			BXRL[likeId].popupTimeout = setTimeout(function(){
14808				BXRL[likeId].popup.close();
14809			}, 1000);
14810		});
14811
14812		BX.bind(BX('ilike-popup-'+likeId), 'mouseover' , function() {
14813			clearTimeout(BXRL[likeId].popupTimeout);
14814		});
14815	}
14816
14817	if (BXRLW != null)
14818		BXRL[BXRLW].popup.close();
14819
14820	BXRLW = likeId;
14821	BXRL[likeId].popup.show();
14822
14823	RatingLikes.AdjustWindow(likeId);
14824};
14825
14826RatingLikes.Vote = function(likeId, voteAction)
14827{
14828	BX.ajax({
14829		url: BXRL[likeId].pathToAjax,
14830		method: 'POST',
14831		dataType: 'json',
14832		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()},
14833		onsuccess: function(data)	{
14834			BXRL[likeId].lastVote = data.action;
14835			BXRL[likeId].countText.innerHTML = data.items_all;
14836			BXRL[likeId].popupContentPage = 1;
14837
14838			BXRL[likeId].popupContent.innerHTML = '';
14839			spanTag0 = document.createElement("span");
14840			spanTag0.className = "bx-ilike-wait";
14841			BXRL[likeId].popupContent.appendChild(spanTag0);
14842			RatingLikes.AdjustWindow(likeId);
14843
14844			if(BX('ilike-popup-'+likeId) && BX('ilike-popup-'+likeId).style.display == "block")
14845				RatingLikes.List(likeId, null);
14846		},
14847		onfailure: function(data)	{}
14848	});
14849	return false;
14850};
14851
14852RatingLikes.List = function(likeId, page)
14853{
14854	if (parseInt(BXRL[likeId].countText.innerHTML) == 0)
14855		return false;
14856
14857	if (page == null)
14858		page = BXRL[likeId].popupContentPage;
14859	BXRL[likeId].popupListProcess = true;
14860	BX.ajax({
14861		url: BXRL[likeId].pathToAjax,
14862		method: 'POST',
14863		dataType: 'json',
14864		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()},
14865		onsuccess: function(data)
14866		{
14867			BXRL[likeId].countText.innerHTML = data.items_all;
14868
14869			if ( parseInt(data.items_page) == 0 )
14870				return false;
14871
14872			if (page == 1)
14873			{
14874				BXRL[likeId].popupContent.innerHTML = '';
14875				spanTag0 = document.createElement("span");
14876				spanTag0.className = "bx-ilike-bottom_scroll";
14877				BXRL[likeId].popupContent.appendChild(spanTag0);
14878			}
14879			BXRL[likeId].popupContentPage += 1;
14880
14881			var avatarNode = null;
14882
14883			for (var i = 0; i < data.items.length; i++)
14884			{
14885				if (data.items[i]['PHOTO_SRC'].length > 0)
14886				{
14887					avatarNode = BX.create("IMG", {
14888						attrs: {src: data.items[i]['PHOTO_SRC']},
14889						props: {className: "bx-ilike-popup-avatar-img"}
14890					});
14891				}
14892				else
14893				{
14894					avatarNode = BX.create("IMG", {
14895						attrs: {src: '/bitrix/images/main/blank.gif'},
14896						props: {className: "bx-ilike-popup-avatar-img bx-ilike-popup-avatar-img-default"}
14897					});
14898				}
14899
14900				BXRL[likeId].popupContent.appendChild(
14901					BX.create("div", {
14902						/*attrs: {
14903							href: data.items[i]['URL'],
14904							target: '_blank'
14905						},*/
14906						props: {
14907							className: "bx-ilike-popup-img" + (!!data.items[i]['USER_TYPE'] ? " bx-ilike-popup-img-" + data.items[i]['USER_TYPE'] : "")
14908						},
14909						children: [
14910							BX.create("SPAN", {
14911								props: {
14912									className: "bx-ilike-popup-avatar-new"
14913								},
14914								children: [
14915									avatarNode,
14916									BX.create("SPAN", {
14917										props: {className: "bx-ilike-popup-avatar-status-icon"}
14918									})
14919								]
14920							}),
14921							BX.create("SPAN", {
14922								props: {
14923									className: "bx-ilike-popup-name-new"
14924								},
14925								html: data.items[i]['FULL_NAME']
14926							})
14927						]
14928					})
14929				);
14930			}
14931
14932			RatingLikes.AdjustWindow(likeId);
14933			RatingLikes.PopupScroll(likeId);
14934
14935			BXRL[likeId].popupListProcess = false;
14936		},
14937		onfailure: function(data)	{}
14938	});
14939	return false;
14940};
14941
14942RatingLikes.AdjustWindow = function(likeId)
14943{
14944	if (BXRL[likeId].popup != null)
14945	{
14946		BXRL[likeId].popup.bindOptions.forceBindPosition = true;
14947		BXRL[likeId].popup.adjustPosition();
14948		BXRL[likeId].popup.bindOptions.forceBindPosition = false;
14949	}
14950};
14951
14952RatingLikes.PopupScroll = function(likeId)
14953{
14954	BX.bind(BXRL[likeId].popupContent, 'scroll' , function() {
14955		if (this.scrollTop > (this.scrollHeight - this.offsetHeight) / 1.5)
14956		{
14957			RatingLikes.List(likeId, null);
14958			BX.unbindAll(this);
14959		}
14960	});
14961};
14962
14963/* End */
14964;
14965; /* Start:"a:4:{s:4:"full";s:62:"/local/templates/aspro_next/js/blocks/blocks.js?17259704501328";s:6:"source";s:47:"/local/templates/aspro_next/js/blocks/blocks.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
14966InitMenuNavigationAim = function(){
14967	var $block = $('.menu-navigation__sections-wrapper .menu-navigation__sections:not(.aim-init)');
14968	if($block.length){
14969		$block.addClass('aim-init');
14970		$block.menuAim({
14971	        firstActiveRow: true,
14972	        rowSelector: "> .menu-navigation__sections-item",
14973	        activate: function activate(a) {
14974	            var _this = $(a),
14975	                index = _this.index(),
14976	                items = _this.closest('.menu-navigation__sections-wrapper').next(),
14977	                link = _this.find('> a');
14978
14979	            _this.siblings().find('> a').addClass('dark_link')
14980	            link.addClass('colored_theme_text').removeClass('dark_link');
14981	            items.find('.parent-items').siblings().hide();
14982	            items.find('.parent-items').eq(index).show();
14983	        },
14984	        deactivate: function deactivate(a) {
14985	            var _this = $(a),
14986	                index = _this.index(),
14987	                items = _this.closest('.menu-navigation__sections-wrapper').next(),
14988	                link = _this.find('> a');
14989
14990	          link.removeClass('colored_theme_text').addClass('dark_link');
14991	          items.find('.parent-items').siblings().hide();
14992	        }
14993	    });
14994	}
14995}
14996
14997$(document).ready(function(){
14998	/*many items menu*/
14999	InitMenuNavigationAim();
15000	/**/
15001})
15002/* End */
15003;
15004; /* Start:"a:4:{s:4:"full";s:62:"/local/templates/aspro_next/js/video_banner.js?172597044830810";s:6:"source";s:46:"/local/templates/aspro_next/js/video_banner.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
15005var players = {};
15006
15007function pauseMainBanner(){
15008	$('.top_slider_wrapp .flexslider').flexslider('pause');
15009}
15010
15011function playMainBanner(){
15012	$('.top_slider_wrapp .flexslider').flexslider('play');
15013}
15014
15015function startMainBannerSlideVideo($slide){
15016	var slideActiveIndex = $slide.attr('data-slide_index')
15017	var $slides = $slide.closest('.slides').find('.box[data-slide_index="'+ slideActiveIndex +'"]') // current slide & cloned
15018	var videoSource = $slide.attr('data-video_source')
15019	if(videoSource){
15020		$slides.addClass('loading')
15021		pauseMainBanner()
15022
15023		var $slider = $slide.closest('.flexslider')
15024		$slider.addClass('video_visible')
15025		var slidesIndexesWithVideo = $slider.data('slidesIndexesWithVideo')
15026		if(typeof slidesIndexesWithVideo === 'undefined'){
15027			slidesIndexesWithVideo = [];
15028		}
15029		slidesIndexesWithVideo.push(slideActiveIndex)
15030		$slider.data('slidesIndexesWithVideo', slidesIndexesWithVideo)
15031
15032		var videoPlayerSrc = $slide.attr('data-video_src')
15033		var videoSoundDisabled = $slide.attr('data-video_disable_sound')
15034		var bVideoSoundDisabled = videoSoundDisabled == 1
15035		var videoLoop = $slide.attr('data-video_loop')
15036		var bVideoLoop = videoLoop == 1
15037		var videoCover = $slide.attr('data-video_cover')
15038		var bVideoCover = videoCover == 1
15039		var videoUnderText = $slide.attr('data-video_under_text')
15040		var bVideoUnderText = videoUnderText == 1
15041		var videoPlayer = $slide.attr('data-video_player')
15042		var bVideoPlayerYoutube = videoPlayer === 'YOUTUBE'
15043		var bVideoPlayerVimeo = videoPlayer === 'VIMEO'
15044		var bVideoPlayerRutube = videoPlayer === 'RUTUBE'
15045		var bVideoPlayerHtml5 = videoPlayer === 'HTML5'
15046		var videoWidth = bVideoPlayerHtml5 ? false : $slide.attr('data-video_width')
15047		var videoHeight = bVideoPlayerHtml5 ? false : $slide.attr('data-video_height')
15048
15049		if(videoPlayerSrc && !$slide.find('.video').length){
15050			var InitPlayer = function(){
15051				$slides.each(function(i, node){
15052					var $_slide = $(node);
15053					var videoID = getRandomInt(100, 1000);
15054					var bClone = $_slide.hasClass('clone'),
15055						tmp_class = $_slide.attr('id');
15056					if(!$_slide.find('.video.'+tmp_class).length)
15057					{
15058						if(bVideoPlayerYoutube){
15059							$_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>');
15060						}
15061						else if(bVideoPlayerVimeo){
15062							$_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>');
15063						}
15064						else if(bVideoPlayerRutube){
15065							videoPlayerSrc = videoPlayerSrc + '&playerid=' + videoID;
15066							$_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>');
15067						}
15068						else if(bVideoPlayerHtml5){
15069							$_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>');
15070						}
15071					}
15072
15073					if(typeof(players) !== 'undefined' && players){
15074						players[videoID] = {
15075							id: 'player_' + videoID,
15076							mute: bVideoSoundDisabled || bClone,
15077							loop: bVideoLoop,
15078							cover: bVideoCover,
15079							videoPlayer: videoPlayer,
15080							slideIndex: slideActiveIndex,
15081							clone: bClone,
15082							playing: false,
15083							videoWidth: videoWidth,
15084							videoHeight: videoHeight,
15085							videoProportion: ((videoWidth && videoHeight) ? videoWidth / videoHeight : false)
15086						};
15087
15088						if(bVideoPlayerYoutube){
15089							window[players[videoID].id] = new YT.Player(
15090								players[videoID].id, {
15091									events: {
15092										'onReady': onYoutubePlayerReady,
15093										'onStateChange': onYoutubePlayerStateChange
15094									}
15095								}
15096							);
15097						}
15098						else if(bVideoPlayerVimeo){
15099						    window[players[videoID].id] = new Vimeo.Player(document.getElementById(players[videoID].id), {autopause: false, byline: false, loop: false, title: false});
15100						    window[players[videoID].id].on('loaded', onVimeoPlayerReady)
15101						    window[players[videoID].id].on('play', onVimeoPlayerStateChange)
15102						    window[players[videoID].id].on('pause', onVimeoPlayerStateChange)
15103						    window[players[videoID].id].on('ended', onVimeoPlayerStateChange)
15104						}
15105						else if(bVideoPlayerRutube){
15106							document.getElementById(players[videoID].id).onload = function(e){
15107								var videoID = this.id.replace('player_', '')
15108								players[videoID].contentWindow = this.contentWindow
15109								onRutubePlayerReady(videoID)
15110							}
15111						}
15112						else if(bVideoPlayerHtml5){
15113							document.getElementById(players[videoID].id).addEventListener('loadeddata', onHtml5PlayerReady)
15114							document.getElementById(players[videoID].id).addEventListener('play', onHtml5PlayerStateChange)
15115							document.getElementById(players[videoID].id).addEventListener('pause', onHtml5PlayerStateChange)
15116							document.getElementById(players[videoID].id).addEventListener('ended', onHtml5PlayerStateChange)
15117						}
15118					}
15119				});
15120			}
15121
15122			if(!bVideoPlayerHtml5){
15123				var obPlayerVariable = ''
15124				var fnPlayerVariable = ''
15125				if(typeof window['YoutubePlayerScriptLoaded'] === 'undefined'){
15126					window['YoutubePlayerScriptLoaded'] = false
15127				}
15128				if(typeof window['VimeoPlayerScriptLoaded'] === 'undefined'){
15129					window['VimeoPlayerScriptLoaded'] = false
15130				}
15131				if(typeof window['RutubePlayerListnersAdded'] === 'undefined'){
15132					window['RutubePlayerListnersAdded'] = false
15133				}
15134
15135				// load script
15136				if(bVideoPlayerYoutube){
15137					obPlayerVariable = 'YT'
15138					fnPlayerVariable = 'Player'
15139					if(!window['YoutubePlayerScriptLoaded']){
15140						var script = document.createElement('script');
15141						script.src = "https://www.youtube.com/iframe_api";
15142						var firstScriptTag = document.getElementsByTagName('script')[0];
15143						firstScriptTag.parentNode.insertBefore(script, firstScriptTag);
15144						window['YoutubePlayerScriptLoaded'] = true;
15145					}
15146				}
15147				else if(bVideoPlayerVimeo){
15148					obPlayerVariable = 'Vimeo'
15149					if(!window['VimeoPlayerScriptLoaded']){
15150						var script = document.createElement('script');
15151						script.src = 'https://player.vimeo.com/api/player.js';
15152						(document.head || document.documentElement).appendChild(script);
15153						window['VimeoPlayerScriptLoaded'] = true
15154					}
15155				}
15156				else if(bVideoPlayerRutube){
15157					if(!window['RutubePlayerListnersAdded']){
15158						window.addEventListener('message', function(e){
15159							if(e.origin.indexOf('rutube.ru') !== -1){
15160							    var message = JSON.parse(e.data)
15161							    if(typeof message === 'object' && message){
15162							    	if(typeof message.type !== 'undefined' && message.type){
15163							    		var videoID = false
15164
15165							    		for(var j in players){
15166									    	if(typeof players[j].contentWindow !== 'undefined'){
15167									    		if(players[j].contentWindow == e.source){
15168									    			videoID = j
15169									    			break
15170									    		}
15171									    	}
15172									    }
15173
15174									    if(videoID){
15175										    switch (message.type) {
15176										        case 'player:changeState':
15177										            onRutubePlayerStateChange(videoID, message.data.state)
15178										            break
15179										        case 'player:currentTime':
15180										            onRutubePlayerCurrentTime(videoID, message.data.time)
15181										            break
15182										    }
15183										}
15184									}
15185							    }
15186							}
15187						});
15188					}
15189				}
15190
15191				if(!obPlayerVariable.length){
15192					InitPlayer()
15193				}
15194				else{
15195					// wait player class
15196					if(typeof window[obPlayerVariable] === 'object'){
15197						if(!fnPlayerVariable.length || (fnPlayerVariable.length && typeof window[obPlayerVariable][fnPlayerVariable] === 'function')){
15198
15199							InitPlayer()
15200						}
15201					}
15202					else{
15203						var waitPlayerInterval = setInterval(function(){
15204							if(typeof window[obPlayerVariable] === 'object'){
15205								if(!fnPlayerVariable.length || (fnPlayerVariable.length && typeof window[obPlayerVariable][fnPlayerVariable] === 'function')){
15206
15207									clearInterval(waitPlayerInterval)
15208
15209									InitPlayer()
15210								}
15211							}
15212						}, 50)
15213					}
15214				}
15215			}
15216			else{
15217				InitPlayer()
15218			}
15219		}
15220		else
15221		{
15222			// pause play video
15223			if(typeof(players) !== 'undefined' && players){
15224				for(var j in players){
15225					if(/*players[j].playing &&*/ !players[j].clone/* && (players[j].slideIndex != $curSlideIndex)*/){
15226						if((typeof window[players[j].id] == 'object')){
15227							if(players[j].playing)
15228							{
15229								if(players[j].videoPlayer === 'YOUTUBE'){
15230									window[players[j].id].pauseVideo()
15231								}
15232								else if(players[j].videoPlayer === 'VIMEO'){
15233									window[players[j].id].pause()
15234								}
15235								else if(players[j].videoPlayer === 'RUTUBE'){
15236									document.getElementById(players[j].id).contentWindow.postMessage(JSON.stringify({
15237									    type: 'player:pause',
15238									    data: {}
15239									}), '*')
15240								}
15241								else if(players[j].videoPlayer === 'HTML5'){
15242									document.getElementById(players[j].id).pause()
15243								}
15244							}
15245							else if(players[j].slideIndex == slideActiveIndex)
15246							{
15247								if(players[j].videoPlayer === 'YOUTUBE'){
15248									window[players[j].id].playVideo()
15249								}
15250								else if(players[j].videoPlayer === 'VIMEO'){
15251									window[players[j].id].play()
15252								}
15253								else if(players[j].videoPlayer === 'RUTUBE'){
15254									document.getElementById(players[j].id).contentWindow.postMessage(JSON.stringify({
15255									    type: 'player:play',
15256									    data: {}
15257									}), '*')
15258								}
15259								else if(players[j].videoPlayer === 'HTML5'){
15260									document.getElementById(players[j].id).play()
15261								}
15262							}
15263						}
15264					}
15265				}
15266			}
15267		}
15268	}
15269}
15270
15271var CoverPlayer = function(){
15272	$('.top_slider_wrapp .video.cover').each(function(){
15273		var $slide = $(this).closest('.box');
15274		var slideHeight = $slide.height();
15275		var slideWidth = $slide.width();
15276		var videoProportion = $(this).attr('data-video_proportion');
15277		if(videoProportion === undefined){
15278			videoProportion = 16 / 9;
15279		}
15280
15281		// set video width = 100% of slide width
15282		var videoWidth = slideWidth;
15283		// calculate video height proportional
15284		var videoHeight = slideWidth / videoProportion;
15285		// video minimal  height = 100% slide height
15286		if(videoHeight < slideHeight){
15287			// increase video width proportional
15288			videoWidth = slideHeight * videoProportion;
15289			videoHeight = slideHeight;
15290		}
15291
15292		$(this).width(videoWidth).height(videoHeight).css({
15293			'margin-top' : '-' + (videoHeight - slideHeight) / 2 + 'px',
15294			'margin-left' : '-' + (videoWidth - slideWidth) / 2 + 'px'
15295		});
15296	});
15297}
15298
15299function onYoutubePlayerReady(e) {
15300	var videoID = e.target.f.id.replace('player_', '')
15301	if(videoID){
15302		var mute = players[videoID].mute
15303		var cover = players[videoID].cover
15304    	var clone = players[videoID].clone
15305    	var $slide = $('#player_' + videoID).closest('.box')
15306
15307    	// mute sound
15308		if(mute || clone){
15309			window[players[videoID].id].mute()
15310		}
15311
15312    	// cover video
15313		if(cover){
15314			// get video`s original size
15315			if(!players[videoID].videoProportion){
15316				var embedHtml = e.target.getVideoEmbedCode();
15317				if(embedHtml.length){
15318					var match = embedHtml.match(/width="(\d*)"[^>]*height="(\d*)"/);
15319					if(match !== null){
15320						var videoWidth = match[1];
15321						var videoHeight = match[2];
15322
15323						players[videoID].videoWidth = videoWidth;
15324						players[videoID].videoHeight = videoHeight;
15325						players[videoID].videoProportion = videoWidth / videoHeight;
15326
15327						$slide.find('.video').attr('data-video_proportion', players[videoID].videoProportion);
15328					}
15329				}
15330			}
15331
15332	    	CoverPlayer()
15333	    }
15334
15335    	// not start clone video playing
15336    	if(clone){
15337    		setTimeout(function(){
15338				e.target.pauseVideo()
15339    		}, 100)
15340    	}
15341    	else{
15342		    // stop slider
15343			pauseMainBanner()
15344			e.target.playVideo();
15345
15346		    // e.target.playVideo();
15347		    // e.target.playVideo();
15348    	}
15349
15350    	// update slide class
15351		$slide.addClass('started')
15352		// $slide.removeClass('loading')
15353    }
15354}
15355
15356function onYoutubePlayerStateChange(e){
15357	var videoID = e.target.f.id.replace('player_', '')
15358    if(videoID){
15359    	var clone = players[videoID].clone
15360		var loop = players[videoID].loop
15361    	var slideIndex = players[videoID].slideIndex
15362    	if(!clone){
15363			if(e.data === YT.PlayerState.PLAYING){
15364				players[videoID].playing = true
15365
15366				$('#player_'+videoID).closest('.box').find('.wrapper_inner').addClass('loading');
15367				$('#player_'+videoID).closest('.box').find('.wrapper_inner .btn-video').addClass('loading');
15368
15369				// stop slider
15370				pauseMainBanner()
15371
15372				e.target.playVideo()
15373			}
15374			else if(e.data === YT.PlayerState.PAUSED){
15375		    	players[videoID].playing = false
15376
15377		    	// sync time in cloned players & pause
15378	    		var time = Math.floor(window[players[videoID].id].getCurrentTime() * 10) / 10
15379
15380				$('#player_'+videoID).closest('.box').find('.wrapper_inner').removeClass('loading');
15381				$('#player_'+videoID).closest('.box').find('.wrapper_inner .btn-video').removeClass('loading');
15382
15383				window[players[videoID].id].seekTo(time, true)
15384				for(var j in players){
15385					if(players[j].slideIndex == slideIndex && players[j].clone){
15386
15387						if('getCurrentTime' in window[players[j].id])
15388						{
15389							window[players[j].id].pauseVideo()
15390							window[players[j].id].seekTo(time, true)
15391						}
15392					}
15393				}
15394			}
15395			else if(e.data === YT.PlayerState.ENDED){
15396				players[videoID].playing = false
15397		    	if(loop){
15398		    		e.target.playVideo()
15399		    	}
15400		    	else{
15401		    		// play slider
15402					playMainBanner()
15403		    	}
15404			}
15405			else if(e.data === YT.PlayerState.UNSTARTED){
15406				players[videoID].playing = false
15407				$('#player_'+videoID).closest('.box').find('.wrapper_inner .btn-video').removeClass('loading');
15408				//window[players[videoID].id].mute()
15409				e.target.playVideo()
15410			}
15411		}
15412	}
15413}
15414
15415function onVimeoPlayerReady(e){
15416	var videoID = this.element.id.replace('player_', '')
15417	if(videoID){
15418		var mute = players[videoID].mute
15419		var cover = players[videoID].cover
15420    	var clone = players[videoID].clone
15421		var $slide = $('#player_' + videoID).closest('.box')
15422
15423    	// mute sound
15424		if(mute || clone){
15425			window[players[videoID].id].setVolume(0)
15426		}
15427
15428    	// cover video
15429		if(cover){
15430			// get video`s original size
15431			if(!players[videoID].videoProportion){
15432				var widthPromise = window[players[videoID].id].getVideoWidth();
15433				var heightPromise = window[players[videoID].id].getVideoHeight();
15434				widthPromise.then(
15435					function(value) {
15436						var videoWidth = value;
15437
15438						heightPromise.then(
15439							function(value) {
15440								var videoHeight = value;
15441
15442								players[videoID].videoWidth = videoWidth;
15443								players[videoID].videoHeight = videoHeight;
15444								players[videoID].videoProportion = videoWidth / videoHeight;
15445
15446								$slide.find('.video').attr('data-video_proportion', players[videoID].videoProportion);
15447
15448								CoverPlayer();
15449							}
15450						);
15451					}
15452				);
15453			}
15454	    }
15455
15456    	// not start clone video playing
15457    	if(clone){
15458    		setTimeout(function(){
15459				window[players[videoID].id].pause()
15460    		}, 100)
15461    	}
15462    	else{
15463		    // stop slider
15464			pauseMainBanner()
15465
15466		    // start video
15467		    var promise = window[players[videoID].id].play();
15468			if(typeof promise !== 'undefined'){
15469				promise.catch(
15470					function(){
15471						setTimeout(function(){
15472							window[players[videoID].id].setVolume(0)
15473							window[players[videoID].id].play()
15474						}, 100);
15475					}
15476				);
15477			}
15478    	}
15479
15480    	// update slide class
15481		$slide.addClass('started')
15482		// $slide.removeClass('loading')
15483    }
15484}
15485
15486function onVimeoPlayerStateChange(e){
15487	var videoID = this.element.id.replace('player_', '')
15488	if(videoID){
15489		var cover = players[videoID].cover
15490    	var clone = players[videoID].clone
15491		var loop = players[videoID].loop
15492    	var slideIndex = players[videoID].slideIndex
15493
15494    	if(!clone){
15495    		window[players[videoID].id].getPaused().then(function(paused){
15496    			if(paused){
15497			    	players[videoID].playing = false
15498
15499			    	$('#player_'+videoID).closest('.box').find('.wrapper_inner').removeClass('loading');
15500					$('#player_'+videoID).closest('.box').find('.wrapper_inner .btn-video').removeClass('loading');
15501
15502			    	// sync time in cloned players & pause
15503			    	window[players[videoID].id].getCurrentTime().then(function(seconds){
15504			    		var time = Math.floor(seconds * 10) / 10
15505			    		window[players[videoID].id].setCurrentTime(time).then(function(seconds){
15506							for(var j in players){
15507								if(players[j].slideIndex == slideIndex && players[j].clone){
15508									window[players[j].id].pause()
15509									window[players[j].id].setCurrentTime(time).then(function(seconds){})
15510								}
15511							}
15512			    		})
15513			    	})
15514    			}
15515    			else{
15516    				$('#player_'+videoID).closest('.box').find('.wrapper_inner').addClass('loading');
15517					$('#player_'+videoID).closest('.box').find('.wrapper_inner .btn-video').addClass('loading');
15518		    		window[players[videoID].id].getEnded().then(function(ended){
15519		    			if(ended){
15520							players[videoID].playing = false
15521					    	if(loop){
15522					    		window[players[videoID].id].play()
15523					    	}
15524					    	else{
15525					    		// play slider
15526								playMainBanner()
15527					    	}
15528		    			}
15529		    			else{
15530		    				players[videoID].playing = true
15531
15532
15533		    				// stop slider
15534							pauseMainBanner()
15535		    			}
15536		    		})
15537    			}
15538    		})
15539		}
15540	}
15541}
15542
15543function onRutubePlayerReady(videoID){
15544	if(videoID){
15545		var mute = players[videoID].mute
15546		var cover = players[videoID].cover
15547    	var clone = players[videoID].clone
15548    	var player = document.getElementById(players[videoID].id)
15549		var $slide = $('#player_' + videoID).closest('.box')
15550
15551    	// mute sound
15552		if(mute || clone){
15553			player.contentWindow.postMessage(JSON.stringify({
15554			    type: 'player:mute',
15555			    data: {}
15556			}), '*')
15557		}
15558
15559    	// cover video
15560		if(cover){
15561	    	CoverPlayer()
15562	    }
15563
15564    	// not start clone video playing
15565    	if(clone){
15566    		setTimeout(function(){
15567				player.contentWindow.postMessage(JSON.stringify({
15568				    type: 'player:pause',
15569				    data: {}
15570				}), '*')
15571    		}, 100)
15572    	}
15573    	else{
15574		    // stop slider
15575			pauseMainBanner()
15576
15577		    player.contentWindow.postMessage(JSON.stringify({
15578			    type: 'player:play',
15579			    data: {}
15580			}), '*')
15581    	}
15582
15583    	// update slide class
15584		$slide.addClass('started')
15585		// $slide.removeClass('loading')
15586    }
15587}
15588
15589function onRutubePlayerCurrentTime(videoID, time){
15590	if(videoID){
15591		players[videoID].time = time
15592	}
15593}
15594
15595function onRutubePlayerStateChange(videoID, state){
15596	if(videoID){
15597    	var clone = players[videoID].clone
15598		var loop = players[videoID].loop
15599    	var slideIndex = players[videoID].slideIndex
15600    	var player = document.getElementById(players[videoID].id)
15601
15602    	if(!clone){
15603			if(state === 'playing'){
15604				$('#'+videoID).closest('.box').find('.wrapper_inner').addClass('loading');
15605				$('#'+videoID).closest('.box').find('.wrapper_inner .btn-video').addClass('loading');
15606
15607				players[videoID].playing = true
15608
15609				// stop slider
15610				pauseMainBanner()
15611			}
15612			else if(state === 'paused'){
15613				$('#'+videoID).closest('.box').find('.wrapper_inner').removeClass('loading');
15614				$('#'+videoID).closest('.box').find('.wrapper_inner .btn-video').removeClass('loading');
15615
15616		    	players[videoID].playing = false
15617
15618		    	// sync time in cloned players & pause
15619	    		var time = Math.floor(players[videoID].time * 10) / 10
15620				player.contentWindow.postMessage(JSON.stringify({
15621				    type: 'player:setCurrentTime',
15622				    data: {time: time}
15623				}), '*')
15624				for(var j in players){
15625					if(players[j].slideIndex == slideIndex && players[j].clone){
15626						document.getElementById(players[j].id).contentWindow.postMessage(JSON.stringify({
15627						    type: 'player:pause',
15628						    data: {}
15629						}), '*')
15630						document.getElementById(players[j].id).contentWindow.postMessage(JSON.stringify({
15631						    type: 'player:setCurrentTime',
15632						    data: {time: time}
15633						}), '*')
15634					}
15635				}
15636			}
15637			else if(state === 'stopped'){
15638				$('#'+videoID).closest('.box').find('.wrapper_inner').removeClass('loading');
15639				$('#'+videoID).closest('.box').find('.wrapper_inner .btn-video').removeClass('loading');
15640
15641				players[videoID].playing = false
15642		    	if(loop){
15643		    		player.contentWindow.postMessage(JSON.stringify({
15644					    type: 'player:play',
15645					    data: {}
15646					}), '*')
15647		    	}
15648		    	else{
15649		    		// play slider
15650					playMainBanner()
15651		    	}
15652			}
15653		}
15654	}
15655}
15656
15657function onHtml5PlayerReady(e){
15658	var videoID = e.target.id.replace('player_', '')
15659	if(videoID){
15660		var mute = players[videoID].mute
15661		var cover = players[videoID].cover
15662    	var clone = players[videoID].clone
15663		var $slide = $('#player_' + videoID).closest('.box')
15664
15665    	// mute sound
15666		if(mute || clone){
15667			$('#' + players[videoID].id).prop('muted', true);
15668		}
15669
15670    	// cover video
15671		if(cover){
15672			// get video`s original size
15673			if(!players[videoID].videoProportion){
15674				var videoWidth = $slide.find('.video')[0].videoWidth;
15675				var videoHeight = $slide.find('.video')[0].videoHeight;
15676
15677				players[videoID].videoWidth = videoWidth;
15678				players[videoID].videoHeight = videoHeight;
15679				players[videoID].videoProportion = videoWidth / videoHeight;
15680
15681				$slide.find('.video').attr('data-video_proportion', players[videoID].videoProportion);
15682			}
15683
15684	    	CoverPlayer()
15685	    }
15686
15687    	// not start clone video playing
15688    	if(clone){
15689    		e.target.pause()
15690    	}
15691    	else{
15692		    // stop slider
15693			pauseMainBanner()
15694
15695			var promise = e.target.play();
15696		    if(typeof promise !== 'undefined'){
15697				promise.catch(
15698					function(){
15699						setTimeout(function(){
15700							$('#' + players[videoID].id).prop('muted', true);
15701							e.target.play();
15702						}, 100);
15703					}
15704				);
15705			}
15706    	}
15707
15708    	// update slide class
15709		$slide.addClass('started')
15710		// $slide.removeClass('loading')
15711    }
15712}
15713
15714function onHtml5PlayerStateChange(e){
15715	var videoID = e.target.id.replace('player_', '')
15716	if(videoID){
15717    	var cover = players[videoID].cover
15718    	var clone = players[videoID].clone
15719		var loop = players[videoID].loop
15720    	var slideIndex = players[videoID].slideIndex
15721
15722    	if(!clone){
15723			if(e.target.paused){
15724		    	players[videoID].playing = false
15725
15726		    	$('#player_'+videoID).closest('.box').find('.wrapper_inner').removeClass('loading');
15727				$('#player_'+videoID).closest('.box').find('.wrapper_inner .btn-video').removeClass('loading');
15728
15729		    	// sync time in cloned players & pause
15730	    		var time = Math.floor(e.target.currentTime * 10) / 10
15731				e.target.currentTime = time
15732				for(var j in players){
15733					if(players[j].slideIndex == slideIndex && players[j].clone){
15734						document.getElementById(players[j].id).pause()
15735						document.getElementById(players[j].id).currentTime = time
15736					}
15737				}
15738			}
15739			else if(e.target.ended){
15740				players[videoID].playing = false
15741		    	if(loop){
15742		    		$('#player_'+videoID).closest('.box').find('.wrapper_inner').addClass('loading');
15743					$('#player_'+videoID).closest('.box').find('.wrapper_inner .btn-video').addClass('loading');
15744
15745		    		e.target.play()
15746		    	}
15747		    	else{
15748		    		// play slider
15749					playMainBanner()
15750		    	}
15751			}
15752			else{
15753				players[videoID].playing = true
15754
15755				$('#player_'+videoID).closest('.box').find('.wrapper_inner').addClass('loading');
15756				$('#player_'+videoID).closest('.box').find('.wrapper_inner .btn-video').addClass('loading');
15757				// stop slider
15758				pauseMainBanner()
15759			}
15760		}
15761	}
15762}
15763
15764waitYTPlayer = function(delay, callback){
15765	if((typeof YT !== "undefined") && YT && YT.Player)
15766	{
15767		if(typeof callback == 'function')
15768			callback();
15769	}
15770	else
15771	{
15772		setTimeout(function(){
15773			waitYTPlayer(delay, callback);
15774		}, delay);
15775	}
15776}
15777
15778// click on HTML5 video
15779$(document).on('click', 'video.video', function(e){
15780	var videoID = e.target.id.replace('player_', '')
15781    if(videoID){
15782    	if(players[videoID].playing){
15783			e.target.pause()
15784    	}
15785    	else{
15786    		e.target.play()
15787    	}
15788    }
15789})
15790
15791// START VIDEO BUTTON
15792$(document).on('click', '.top_slider_wrapp .box .btn-video', function(e){
15793	e.stopPropagation();
15794	if(!$(this).hasClass('loading'))
15795	{
15796		$(this).addClass('loading');
15797		$(this).closest('.wrapper_inner').addClass('loading');
15798	}
15799	else
15800	{
15801		$(this).removeClass('loading');
15802		$(this).closest('.wrapper_inner').removeClass('loading');
15803	}
15804
15805	startMainBannerSlideVideo($(this).closest('.box'));
15806});
15807
15808// START VIDEO BY BANNER OR GOTO LINK
15809$(document).on('click', '.top_slider_wrapp .box .wrapper_inner', function(e){
15810	var wvideo = $(this).closest('.box').hasClass('wvideo');
15811	var wurl = $(this).closest('.box').hasClass('wurl');
15812
15813	if($(e.target).hasClass('btn')){
15814		if(wvideo){
15815			if($(e.target).hasClass('btn-video')){
15816				e.stopPropagation();
15817				$(this).find('.btn-video').trigger('click');
15818			}
15819		}
15820	}
15821	else{
15822		if(wurl){
15823			var href = $(this).closest('.box').find('.target').attr('href');
15824			if(href.length){
15825				var target = $(this).closest('.box').find('.target').attr('target');
15826				if(typeof target === 'undefined' || target === '_self'){
15827					location.href = href;
15828				}
15829				else{
15830					window.open(href);
15831				}
15832			}
15833		}
15834		else{
15835			if(wvideo){
15836				e.stopPropagation();
15837				$(this).find('.btn-video').trigger('click');
15838			}
15839		}
15840	}
15841})
15842
15843
15844// SLICE HEIGHT OF TABLET TEXT WITH VIEW 2
15845$(document).ready(function(){
15846	$('.top_slider_wrapp.view_2').each(function(){
15847		if($(this).find('.flexslider .slides > li .tablet_text .wrap').length){
15848			$(this).find('.flexslider .slides > li .tablet_text .wrap').sliceHeight({
15849				row: '.top_slider_wrapp.view_2 .flexslider .slides',
15850				item: '.top_slider_wrapp.view_2 .flexslider .slides > li .tablet_text .wrap',
15851				slice: $(this).find('.flexslider .slides > li').length,
15852				autoslicecount: false
15853			});
15854		}
15855	});
15856});
15857
15858getRandomInt = function(min, max){
15859	return Math.floor(Math.random() * (max - min)) + min;
15860}
15861
15862var ignoreResize = [];
15863
15864BX.addCustomEvent('onWindowResize', function(eventdata) {
15865	try{
15866		CoverPlayer();
15867	}
15868	catch(e){}
15869	finally{
15870		ignoreResize.pop();
15871	}
15872});
15873
15874BX.addCustomEvent('onSlideEnd', function(eventdata) {
15875	try{
15876		ignoreResize.push(true);
15877		if(eventdata){
15878			var slider = eventdata.slider;
15879			if(slider){
15880				setTimeout(function(){
15881					$('.banners-big.front .btn-video, .banners-big.front .box').removeClass('loading');
15882				}, 300);
15883			}
15884		}
15885	}
15886	catch(e){}
15887	finally{
15888		ignoreResize.pop();
15889	}
15890});
15891
15892BX.addCustomEvent('onSlide', function(eventdata) {
15893	try{
15894		ignoreResize.push(true);
15895		if(eventdata){
15896			var slider = eventdata.slider;
15897			if(slider){
15898				var $curSlide = slider.find('.box.flex-active-slide');
15899				var $curSlideIndex = $curSlide.attr('data-slide_index');
15900
15901				$('.top_slider_wrapp.view_2').each(function(){
15902					if($(this).find('.flexslider .slides > li .tablet_text .wrap').length){
15903						$(this).find('.flexslider .slides > li .tablet_text .wrap').sliceHeight({
15904							resize: false,
15905							row: '.top_slider_wrapp.view_2 .flexslider .slides',
15906							item: '.top_slider_wrapp.view_2 .flexslider .slides > li .tablet_text .wrap',
15907							slice: $(this).find('.flexslider .slides > li').length,
15908							autoslicecount: false
15909						});
15910					}
15911				});
15912
15913				if(typeof($curSlideIndex) !== 'undefined' && $curSlideIndex.length){
15914					var slidesIndexesWithVideo = slider.data('slidesIndexesWithVideo')
15915					if(typeof slidesIndexesWithVideo === 'undefined'){
15916						slidesIndexesWithVideo = [];
15917					}
15918
15919					var bVideoVisible = slidesIndexesWithVideo.indexOf($curSlideIndex) != -1;
15920					if(bVideoVisible){
15921						slider.addClass('video_visible');
15922					}
15923					else{
15924						slider.removeClass('video_visible');
15925					}
15926
15927					setTimeout(function(){
15928						CoverPlayer();
15929					}, 200);
15930
15931					// pause play video
15932					if(typeof(players) !== 'undefined' && players){
15933						for(var j in players){
15934							if(players[j].playing && !players[j].clone && (players[j].slideIndex != $curSlideIndex)){
15935								if((typeof window[players[j].id] == 'object')){
15936									if(players[j].videoPlayer === 'YOUTUBE'){
15937										window[players[j].id].pauseVideo()
15938									}
15939									else if(players[j].videoPlayer === 'VIMEO'){
15940										window[players[j].id].pause()
15941									}
15942									else if(players[j].videoPlayer === 'RUTUBE'){
15943										document.getElementById(players[j].id).contentWindow.postMessage(JSON.stringify({
15944										    type: 'player:pause',
15945										    data: {}
15946										}), '*')
15947									}
15948									else if(players[j].videoPlayer === 'HTML5'){
15949										document.getElementById(players[j].id).pause()
15950									}
15951								}
15952							}
15953						}
15954					}
15955					// autoplay video
15956					var bVideoAutoPlay = $curSlide.attr('data-video_autoplay') == 1
15957					if(bVideoAutoPlay){
15958						startMainBannerSlideVideo($curSlide)
15959					}
15960				}
15961
15962				if($curSlide.find('video').length && !$curSlide.find('.btn-video').length){
15963					var videoID = $curSlide.find('video').attr('id');
15964					document.getElementById(videoID).play();
15965				}
15966			}
15967		}
15968	}
15969	catch(e){}
15970	finally{
15971		ignoreResize.pop();
15972	}
15973});
15974/* End */
15975;
15976; /* Start:"a:4:{s:4:"full";s:55:"/local/templates/aspro_next/js/main.js?1729513131257858";s:6:"source";s:38:"/local/templates/aspro_next/js/main.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
15977var basketTimeoutSlide;
15978var resizeEventTimer;
15979
15980var funcDefined = function(func){
15981	try
15982	{
15983		if(typeof func == 'function')
15984			return true;
15985		else
15986			return typeof window[func] === "function";
15987	}
15988	catch (e)
15989	{
15990		return false;
15991	}
15992}
15993
15994if(!funcDefined('setLocationSKU')){
15995	function setLocationSKU(ID, offerID){
15996		if(offerID === undefined)
15997			offerID = 'oid';
15998		if (offerID) {
15999			var objUrl = parseUrlQuery(),
16000				j = 0,
16001				prefix = '',
16002				query_string = '',
16003				url = '';
16004			objUrl[offerID] = ID;
16005			for (var i in objUrl) {
16006				if (parseInt(j)>0) {
16007					prefix = '&';
16008				}
16009				query_string += prefix + i + '='+ objUrl[i];
16010				j++;
16011			}
16012			if (query_string) {
16013				url = location.pathname+'?'+query_string;
16014			}
16015			try {
16016				history.replaceState(null, null, url);
16017				return;
16018			}
16019			catch(e){}
16020			location.hash = '#' + url.substr(1)
16021		}
16022	}
16023}
16024
16025if(!funcDefined('ShowOverlay')){
16026	ShowOverlay = function(){
16027		$('<div class="jqmOverlay waiting"></div>').appendTo('body');
16028	}
16029}
16030
16031if(!funcDefined('HideOverlay')){
16032	HideOverlay = function(){
16033		$('.jqmOverlay').remove();
16034	}
16035}
16036
16037if(!funcDefined('trimPrice')){
16038	var trimPrice = function trimPrice(s){
16039		s=s.split(" ").join("");
16040		s=s.split("&nbsp;").join("");
16041		return s;
16042	}
16043}
16044
16045if(!funcDefined('pauseYmObserver')){
16046	// pause ya metrika webvisor MutationObserver callback (DOM indexer)
16047	// use before insert html with some animation
16048	pauseYmObserver = function(){
16049		if(
16050			typeof MutationObserver === 'function' &&
16051			typeof MutationObserver.observers === 'object' &&
16052			typeof MutationObserver.observers.ym === 'object'
16053		){
16054			MutationObserver.observers.ym.pause();
16055		}
16056	}
16057}
16058
16059if(!funcDefined('resumeYmObserver')){
16060	// resume ya metrika webvisor MutationObserver callback
16061	// use when animation finished
16062	resumeYmObserver = function(){
16063		if(
16064			typeof MutationObserver === 'function' &&
16065			typeof MutationObserver.observers === 'object' &&
16066			typeof MutationObserver.observers.ym === 'object'
16067		){
16068			MutationObserver.observers.ym.resume();
16069		}
16070	}
16071}
16072
16073if(!funcDefined('markProductRemoveBasket')){
16074	var markProductRemoveBasket = function markProductRemoveBasket(id){
16075		$('.in-cart[data-item='+id+']').hide();
16076		$('.to-cart[data-item='+id+']').show();
16077		$('.to-cart[data-item='+id+']').closest('.button_block').removeClass('wide');
16078		$('.to-cart[data-item='+id+']').closest('.counter_wrapp').find('.counter_block').show();
16079		$('.counter_block[data-item='+id+']').show();
16080		$('.in-subscribe[data-item='+id+']').hide();
16081		$('.to-subscribe[data-item='+id+']').show();
16082		$('.wish_item[data-item='+id+']').removeClass("added");
16083		$('.wish_item[data-item='+id+'] .value:not(.added)').show();
16084		$('.wish_item[data-item='+id+'] .value.added').hide();
16085
16086		//
16087		$('.to-cart[data-item='+id+']').parents('.footer_button').removeClass('in_cart');
16088		$('.to-cart[data-item='+id+']').parents('.buy_block').removeClass('in_cart');
16089
16090	}
16091}
16091
16092
16093if(!funcDefined('markProductAddBasket')){
16094	var markProductAddBasket = function markProductAddBasket(id){
16095		$('.to-cart[data-item='+id+']').hide();
16096		$('.to-cart[data-item='+id+']').closest('.counter_wrapp').find('.counter_block').show();
16097		$('.to-cart[data-item='+id+']').closest('.button_block').addClass('wide');
16098		$('.in-cart[data-item='+id+']').show();
16099		$('.wish_item[data-item='+id+']').removeClass("added");
16100		$('.wish_item[data-item='+id+'] .value:not(.added)').show();
16101		$('.wish_item[data-item='+id+'] .value.added').hide();
16102	}
16103}
16104
16105if(!funcDefined('markProductDelay')){
16106	var markProductDelay = function markProductDelay(id){
16107		$('.in-cart[data-item='+id+']').hide();
16108		$('.to-cart[data-item='+id+']').show();
16109		$('.to-cart[data-item='+id+']').closest('.counter_wrapp').find('.counter_block').show();
16110		$('.to-cart[data-item='+id+']').closest('.button_block').removeClass('wide');
16111		$('.wish_item[data-item='+id+']').addClass("added");
16112		$('.wish_item[data-item='+id+'] .value:not(.added)').hide();
16113		$('.wish_item[data-item='+id+'] .value.added').css('display','block');
16114	}
16115}
16116
16117if(!funcDefined('markProductSubscribe')){
16118	var markProductSubscribe = function markProductSubscribe(id){
16119		$('.to-subscribe[data-item='+id+']').hide();
16120		$('.in-subscribe[data-item='+id+']').css('display','block');
16121	}
16122}
16123
16124if(!funcDefined('basketFly')){
16125	var basketFly = function basketFly(action,opener,basketBlink){
16126		if(typeof obNextPredictions === 'object'){
16127			obNextPredictions.updateAll();
16128		}
16129		/*if(arNextOptions['PAGES']['BASKET_PAGE'])
16130			return;*/
16131		$.post( arNextOptions['SITE_DIR']+"ajax/basket_fly.php", "PARAMS="+$("#basket_form").find("input#fly_basket_params").val(), $.proxy(function( data ){
16132			var small=$('.opener .basket_count').hasClass('small'),
16133				basket_count=$(data).find('.basket_count').find('.items div').text();
16134			$('#basket_line .basket_fly').addClass('loaded').html(data);
16135
16136			if(action=="refresh")
16137				$('li[data-type=AnDelCanBuy]').trigger('click');
16138
16139			if(typeof(opener) == 'undefined')
16140			{
16141				if(window.matchMedia('(min-width: 769px)').matches)
16142				{
16143					if(action=='open')
16144					{
16145						if(small)
16146						{
16147							if(arNextOptions['THEME']['SHOW_BASKET_ONADDTOCART'] !== 'N')
16148								$('.opener .basket_count').click();
16149						}
16150						else
16151						{
16152							$('.opener .basket_count').removeClass('small')
16153							$('.tabs_content.basket li[item-section="AnDelCanBuy"]').addClass('cur');
16154							$('#basket_line ul.tabs li[item-section="AnDelCanBuy"]').addClass('cur');
16155						}
16156					}
16157					else if(action=='wish')
16158					{
16159						if(small)
16160						{
16161							if(arNextOptions['THEME']['SHOW_BASKET_ONADDTOCART'] !== 'N')
16162								$('.opener .wish_count').click();
16163						}
16164						else
16165						{
16166							$('.opener .wish_count').removeClass('small')
16167							$('.tabs_content.basket li[item-section="DelDelCanBuy"]').addClass('cur');
16168							$('#basket_line ul.tabs li[item-section="DelDelCanBuy"]').addClass('cur');
16169						}
16170					}
16171					else
16172					{
16173						if(arNextOptions['THEME']['SHOW_BASKET_ONADDTOCART'] !== 'N')
16174							$('.opener .basket_count').click();
16175					}
16176				}
16177			}
16178
16179			if (basketBlink) {
16180				$('.basket_fly .opener .basket_count').hover(function() {
16181                    $(this).removeClass('anim');
16182                }, function() {
16183                    //
16184                });
16185                $('.basket_fly .opener .basket_count').addClass('anim');
16186			}
16187
16188		}));
16189	}
16190}
16191
16192//work with hash start
16193var lastHash = location.hash;
16194if("onhashchange" in window)
16195{
16196	$(window).bind('hashchange', function() {
16197		var newHash = location.hash;
16198		if(newHash == '#delayed')
16199		{
16200			if($('#basket_toolbar_button_delayed').length)
16201				$('#basket_toolbar_button_delayed').trigger('click');
16202		}
16203		else
16204		{
16205			if($('#basket_toolbar_button').length)
16206				$('#basket_toolbar_button').trigger('click');
16207		}
16208		// Do something
16209		var diff = compareHash(newHash, lastHash);
16210		// alert("Difference between old and new hash:\n"+diff[0]+"\n\n"+diff[1]);
16211
16212		//At the end of the func:
16213		lastHash = newHash;
16214	});
16215
16216	function compareHash(current, previous){
16217		for(var i=0, len=Math.min(current.length, previous.length); i<len; i++){
16218			if(current.charAt(0) != previous.charAt(0)) break;
16219		}
16220		current = current.substr(i);
16221		previous = previous.substr(i);
16222		for(var i=0, len=Math.min(current.length, previous.length); i<len; i++){
16223			if(current.substr(-1) != previous.substr(-1)) break;
16224		}
16225
16226		//Array: Current = New hash, previous = old hash
16227		return [current, previous];
16228	}
16229}
16230
16231$(document).on('click', ".hint .icon", function(e){
16232	var tooltipWrapp = $(this).parents(".hint");
16233	// tooltipWrapp.click(function(e){e.stopPropagation();})
16234	if(tooltipWrapp.is(".active")){
16235		tooltipWrapp.removeClass("active").find(".tooltip").slideUp(200);
16236	}
16237	else{
16238		tooltipWrapp.addClass("active").find(".tooltip").slideDown(200);
16239		tooltipWrapp.find(".tooltip_close").click(function(e){
16240			e.stopPropagation(); tooltipWrapp.removeClass("active").find(".tooltip").slideUp(100);
16241		});
16242	}
16243});
16244
16245$(document).on('click', ".back-mobile-arrow .arrow-back", function(){
16246
16247	if(document.referrer) {
16248		window.history.back();
16249	} else {
16250		location.href = '/';
16251	}
16252
16253})
16254$(document).on('click', "#basket_toolbar_button", function(){
16255	if(lastHash)
16256		location.hash = 'cart';
16257})
16258$(document).on('click', "#basket_toolbar_button_delayed", function(){
16259	if(lastHash)
16260		location.hash = 'delayed';
16261})
16262//work with hash end
16263
16264$(document).on('click', "#basket_line .basket_fly .opener > div.clicked", function(){
16265	if(arNextOptions['PAGES']['BASKET_PAGE'])
16266		return;
16267	function onOpenFlyBasket(_this){
16268		$("#basket_line .basket_fly .tabs li").removeClass("cur");
16269		$("#basket_line .basket_fly .tabs_content li").removeClass("cur");
16270		$("#basket_line .basket_fly .remove_all_basket").removeClass("cur");
16271		if(!$(_this).is(".wish_count.empty"))
16272		{
16273			$("#basket_line .basket_fly .tabs_content li[item-section="+$(_this).data("type")+"]").addClass("cur");
16274			$("#basket_line .basket_fly .tabs li:eq("+$(_this).index()+")").addClass("cur");
16275			$("#basket_line .basket_fly .remove_all_basket."+$(_this).data("type")).addClass("cur");
16276		}
16277		else
16278		{
16279			$("#basket_line .basket_fly .tabs li").first().addClass("cur").siblings().removeClass("cur");
16280			$("#basket_line .basket_fly .tabs_content li").first().addClass("cur").siblings().removeClass("cur");
16281			$("#basket_line .basket_fly .remove_all_basket").first().addClass("cur");
16282		}
16283		$("#basket_line .basket_fly .opener > div.clicked").removeClass('small');
16284	}
16285
16286	if(window.matchMedia('(min-width: 769px)').matches)
16287	{
16288		var _this = this;
16289		if(parseInt($("#basket_line .basket_fly").css("right")) < 0)
16290		{
16291			$("#basket_line .basket_fly").stop().animate({"right": "0"}, 333, function(){
16292				if($(_this).closest('.basket_fly.loaded').length)
16293				{
16294					onOpenFlyBasket(_this);
16295				}
16296				else
16297				{
16298					$.ajax({
16299						url: arNextOptions['SITE_DIR'] + 'ajax/basket_fly.php',
16300						type: 'post',
16301						success: function(html){
16302							$('#basket_line .basket_fly').addClass('loaded').html(html);
16303							onOpenFlyBasket(_this);
16304						}
16305					});
16306				}
16307			});
16308		}
16309		else if($(this).is(".wish_count:not(.empty)") && !$("#basket_line .basket_fly .basket_sort ul.tabs li.cur").is("[item-section=DelDelCanBuy]"))
16310		{
16311			$("#basket_line .basket_fly .tabs li").removeClass("cur");
16312			$("#basket_line .basket_fly .tabs_content li").removeClass("cur");
16313			$("#basket_line .basket_fly .remove_all_basket").removeClass("cur");
16314			$("#basket_line .basket_fly .tabs_content li[item-section="+$(this).data("type")+"]").addClass("cur");
16315			$("#basket_line  .basket_fly .tabs li:eq("+$(this).index()+")").first().addClass("cur");
16316			$("#basket_line .basket_fly .remove_all_basket."+$(this).data("type")).first().addClass("cur");
16317		}
16318		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]"))
16319		{
16320			$("#basket_line .basket_fly .tabs li").removeClass("cur");
16321			$("#basket_line .basket_fly .tabs_content li").removeClass("cur");
16322			$("#basket_line .basket_fly .remove_all_basket").removeClass("cur");
16323			$("#basket_line  .basket_fly .tabs_content li:eq("+$(this).index()+")").addClass("cur");
16324			$("#basket_line  .basket_fly .tabs li:eq("+$(this).index()+")").first().addClass("cur");
16325			$("#basket_line .basket_fly .remove_all_basket."+$(this).data("type")).first().addClass("cur");
16326		}
16327		else
16328		{
16329			$("#basket_line .basket_fly").stop().animate({"right": -$("#basket_line .basket_fly").outerWidth()}, 150);
16330			$("#basket_line .basket_fly .opener > div.clicked").addClass('small');
16331		}
16332	}
16333});
16334
16335if(!funcDefined("clearViewedProduct")){
16336	function clearViewedProduct(){
16337		try{
16338			var siteID = arNextOptions.SITE_ID;
16339			var localKey = 'NEXT_VIEWED_ITEMS_' + siteID;
16340			var cookieParams = {path: '/', expires: 30};
16341			if(typeof BX.localStorage !== 'undefined')
16342			{
16343				// remove local storage
16344				BX.localStorage.set(localKey, {}, 0);
16345			}
16346			// remove cookie
16347			$.removeCookie(localKey, cookieParams);
16348		}
16349		catch(e){
16350			console.error(e);
16351		}
16352	}
16353}
16354
16355if(!funcDefined("setViewedProduct")){
16356	function setViewedProduct(id, arData){
16357		try{
16358
16359			// save $.cookie option
16360			var bCookieJson = $.cookie.json;
16361			$.cookie.json = true;
16362
16363			var siteID = arNextOptions.SITE_ID;
16364			var localKey = 'NEXT_VIEWED_ITEMS_' + siteID;
16365			var cookieParams = {path: '/', expires: 30};
16366
16367			if((typeof BX.localStorage !== 'undefined') && (typeof id !== 'undefined') && (typeof arData !== 'undefined')){
16368				var PRODUCT_ID = (typeof arData.PRODUCT_ID !== 'undefined') ? arData.PRODUCT_ID : id;
16369				var arViewedLocal = BX.localStorage.get(localKey) ? BX.localStorage.get(localKey) : {};
16370				var arViewedCookie = $.cookie(localKey) ? $.cookie(localKey) : {};
16371				var count = 0;
16372
16373				// delete some items (sync cookie & local storage)
16374				for(var _id in arViewedLocal){
16375					arViewedLocal[_id].IS_LAST = false;
16376					if(typeof arViewedCookie[_id] === 'undefined'){
16377						delete arViewedLocal[_id];
16378					}
16379				}
16380				for(var _id in arViewedCookie){
16381					if(typeof arViewedLocal[_id] === 'undefined'){
16382						delete arViewedCookie[_id];
16383					}
16384				}
16385
16386				for(var _id in arViewedCookie){
16387					count++;
16388				}
16389
16390				// delete item if other item (offer) of that PRODUCT_ID is exists
16391				if(typeof arViewedLocal[PRODUCT_ID] !== 'undefined'){
16392					if(arViewedLocal[PRODUCT_ID].ID != id){
16393						delete arViewedLocal[PRODUCT_ID];
16394						delete arViewedCookie[PRODUCT_ID];
16395					}
16396				}
16397
16398				delete arViewedLocal[2243];
16399				delete arViewedCookie[2243];
16400
16401				var time = new Date().getTime();
16402				arData.ID = id;
16403				arData.ACTIVE_FROM = time;
16404				arData.IS_LAST = true;
16405				arViewedLocal[PRODUCT_ID] = arData;
16406				arViewedCookie[PRODUCT_ID] = [time.toString(), arData.PICTURE_ID];
16407
16408				$.cookie(localKey, arViewedCookie, cookieParams);
16409				BX.localStorage.set(localKey, arViewedLocal, 2592000);  // 30 days
16410			}
16411		}
16412		catch(e){
16413			console.error(e);
16414		}
16415		finally{
16416			// restore $.cookie option
16417			$.cookie.json = bCookieJson;
16418		}
16419	}
16420}
16421
16422
16423
16424if(!funcDefined('initSelects')){
16425	function initSelects(target){
16426		var iOS = ( navigator.userAgent.match(/(iPad|iPhone|iPod)/g) ? true : false );
16427		if ( iOS ) return;
16428		if($("#bx-soa-order").length)
16429			return;
16430		// SELECT STYLING
16431		$(target).find('.wrapper1 select:visible').ikSelect({
16432			syntax: '<div class="ik_select_link"> \
16433						<span class="ik_select_link_text"></span> \
16434						<div class="trigger"></div> \
16435					</div> \
16436					<div class="ik_select_dropdown"> \
16437						<div class="ik_select_list"> \
16438						</div> \
16439					</div>',
16440			dynamicWidth: true,
16441			ddMaxHeight: 112,
16442			customClass: 'common_select',
16443			//equalWidths: true,
16444			onShow: function(inst){
16445				inst.$dropdown.css('top', (parseFloat(inst.$dropdown.css('top'))-5)+'px');
16446				if ( inst.$dropdown.outerWidth() < inst.$link.outerWidth() ){
16447					inst.$dropdown.css('width', inst.$link.outerWidth());
16448				}
16449				if ( inst.$dropdown.outerWidth() > inst.$link.outerWidth() ){
16450					inst.$dropdown.css('width', inst.$link.outerWidth());
16451				}
16452				var count=0,
16453					client_height=0;
16454				inst.$dropdown.css('left', inst.$link.offset().left);
16455				$(inst.$listInnerUl).find('li').each(function(){
16456					if(!$(this).hasClass('ik_select_option_disabled')){
16457						++count;
16458						client_height+=$(this).outerHeight();
16459					}
16460				})
16461				if(client_height<112){
16462					inst.$listInner.css('height', 'auto');
16463				}else{
16464					inst.$listInner.css('height', '112px');
16465				}
16466				inst.$link.addClass('opened');
16467				inst.$listInner.addClass('scroller');
16468				if($('.confirm_region').length)
16469					$('.confirm_region').remove();
16470			},
16471			onHide: function(inst){
16472				inst.$link.removeClass('opened');
16473			}
16474		});
16475		// END OF SELECT STYLING
16476
16477		var timeout;
16478		$(window).on('resize', function(){
16479			ignoreResize.push(true);
16480				clearTimeout(timeout);
16481				timeout = setTimeout(function(){
16482					//$('select:visible').ikSelect('redraw');
16483					var inst='';
16484					if(inst=$('.common_select-link.opened + select').ikSelect().data('plugin_ikSelect')){
16485						inst.$dropdown.css('left', inst.$link.offset().left+'px');
16486					}
16487				}, 20);
16488			ignoreResize.pop();
16489		});
16490	}
16491}
16492
16493if(!funcDefined('CheckTopMenuFullCatalogSubmenu')){
16494	CheckTopMenuFullCatalogSubmenu = function(){
16495		if(arNextOptions['THEME']['MENU_TYPE_VIEW'] != 'HOVER')
16496			return;
16497
16498		var $menu = $('.menu_top_block');
16499		if($menu.length)
16500		{
16501			var $wrapmenu = $menu.parents('.wrap_menu');
16502
16503			var wrapMenuWidth = $menu.closest('.wrapper_inner').actual('width');
16504			if(!wrapMenuWidth)
16505				wrapMenuWidth = $menu.closest('.wraps').actual('width');
16506
16507			var bCatalogFirst = $menu.hasClass('catalogfirst');
16508			var findMenuLi = $('.menu_top_block:visible li.full');
16509			var parentSubmenuWidth = $menu.actual('outerWidth');
16510			var wrapMenuLeft = 0;
16511			var wrapMenuRight = 0;
16512
16513			if($wrapmenu.length)
16514			{
16515				wrapMenuWidth = $wrapmenu.actual('outerWidth');
16516				wrapMenuLeft = $wrapmenu.offset().left;
16517				wrapMenuRight = wrapMenuLeft + wrapMenuWidth;
16518			}
16519
16520			if($('.catalog_block.menu_top_block').length){
16521				if($('.catalog_block.menu_top_block').is(':visible'))
16522					findMenuLi=$('.menu_top_block.catalog_block li.full');
16523			}
16524			findMenuLi.each(function(){
16525				var $this = $(this);
16526				var $submenu = $this.find('>.dropdown');
16527
16528				if($submenu.length){
16529					//if(bCatalogFirst){
16530						$submenu.css({left: parentSubmenuWidth + 'px', width: (wrapMenuWidth - parentSubmenuWidth) + 'px', 'padding-left': '0px', 'padding-right': '0px', 'opacity': 1});
16531					/*}
16532					else{
16533						$submenu.css({left: ($this.offset().left * -1) + 'px', width: ($(window).width() - 1) + 'px', 'padding-left': wrapMenuLeft + 'px', 'padding-right': ($(window).width() - wrapMenuRight) + 'px'});
16534					}*/
16535					// if(!isOnceInited && bCatalogFirst && arNextOptions["THEME"]["MENU_POSITION"] == "TOP"){
16536					if(!isOnceInited && arNextOptions["THEME"]["MENU_POSITION"] == "TOP"){
16537						$this.on('mouseenter', function(){
16538							$submenu.css('min-height', $this.closest('.dropdown').actual('outerHeight') + 'px');
16539						});
16540					}
16541				}
16542			});
16543		}
16544	}
16545}
16546
16547$.fn.getMaxHeights = function( outer, classNull, minHeight ){
16548	var maxHeight = this.map( function( i, e ){
16549		var calc_height=0;
16550		$(e).css('height', '');
16551
16552		if( outer == true )
16553			calc_height=$(e).actual('outerHeight');
16554		else
16555			calc_height=$(e).actual('height');
16556
16557		return calc_height;
16558	}).get();
16559	for(var i = 0, c = maxHeight.length; i < c; ++i)
16560	{
16561		if(maxHeight[i] % 2)
16562			--maxHeight[i];
16563	}
16564	return Math.max.apply( this, maxHeight );
16565}
16566
16567$.fn.equalizeHeights = function( outer, classNull, minHeight ){
16568	var maxHeight = this.map( function( i, e ){
16569		var minus_height=0,
16570			calc_height=0;
16571
16572
16573		if(classNull!==false)
16574		{
16575			if(!isMobile){
16576				minus_height=parseInt($(e).find(classNull).actual('outerHeight'));
16577			}
16578		}
16579
16580		if(minus_height){
16581			minus_height+=12;
16582		}
16583
16584		$(e).css('height', '');
16585
16586		if( outer == true )
16587			calc_height=$(e).actual('outerHeight')-minus_height;
16588		else
16589			calc_height=$(e).actual('height')-minus_height;
16590
16591		if(minHeight!==false)
16592		{
16593			if(calc_height<minHeight)
16594				calc_height+=(minHeight-calc_height);
16595
16596			if(window.matchMedia('(max-width: 520px)').matches)
16597				calc_height=300;
16598
16599			if(window.matchMedia('(max-width: 400px)').matches)
16600				calc_height=200;
16601		}
16602		return calc_height;
16603	}).get();
16604
16605	for(var i = 0, c = maxHeight.length; i < c; ++i){
16606		if(maxHeight[i] % 2){
16607			--maxHeight[i];
16608		}
16609	}
16610	return this.height( Math.max.apply( this, maxHeight ) );
16611}
16612
16613$.fn.getFloatWidth = function(){
16614	var width = 0
16615	if($(this).length){
16616		var rect = $(this)[0].getBoundingClientRect();
16617		if(!(width = rect.width))
16618			width = rect.right - rect.left;
16619	}
16620	return width
16621}
16622
16623$.fn.sliceHeight = function( options ){
16624	function _slice(el){
16625		
16626		el.each(function() {
16627			$(this).css('line-height', '');
16628			$(this).css('height', '');
16629		});
16630
16631		if(options.mobile == true){
16632			if(window.matchMedia('(max-width: 550px)').matches){
16633				return;
16634			}
16635		}
16636
16637		if(typeof options.autoslicecount === 'undefined' || options.autoslicecount !== false){
16638			var elsw = (typeof options.row !== 'undefined' && options.row.length) ?  el.first().parents(options.row).getFloatWidth() : el.first().parents('.items').getFloatWidth();
16639			var elw = (typeof options.item !== 'undefined' && options.item.length) ? $(options.item).first().getFloatWidth() : el.first().closest('.item').getFloatWidth();
16640
16641			if(!elsw){
16642				elsw = el.first().parents('.row').getFloatWidth();
16643			}
16644
16645			if(elw && options.fixWidth){
16646				elw -= options.fixWidth;
16647			}
16648
16649			if(elsw && elw){
16650				options.slice = Math.floor(elsw / elw);
16651			}
16652		}
16653
16654		if(options.customSlice){
16655			//manual slice count
16656			var arBreakpoints = Object.keys(options.breakpoint),
16657				bSliceNext = false;
16658			if(arBreakpoints.length){
16659				var elw = (typeof options.item !== 'undefined' && options.item.length) ? $(options.item).last().getFloatWidth() : el.last().closest('.item').getFloatWidth();
16660
16661				if(elw){
16662					options.sliceNext = Math.floor(elsw / elw);
16663				}
16664
16665				for(var key in arBreakpoints){
16666					if(window.matchMedia(arBreakpoints[key].toString()).matches){
16667						bSliceNext = true;
16668						options.slice = options.breakpoint[arBreakpoints[key]];
16669					}
16670				}
16671			}
16672		}
16673
16674		if(typeof options.typeResize === 'undefined' || options.typeResize == false){
16675			if(options.slice){
16676				for(var i = 0; i < el.length; i += options.slice){
16677					if(options.customSlice && options.sliceNext && bSliceNext && i) //manual slice count
16678						options.slice = options.sliceNext;
16679					$(el.slice(i, i + options.slice)).equalizeHeights(options.outer, options.classNull, options.minHeight, options.typeResize, options.typeValue);
16680				}
16681			}
16682
16683			if(options.lineheight){
16684				var lineheightAdd = parseInt(options.lineheight);
16685				if(isNaN(lineheightAdd)){
16686					lineheightAdd = 0;
16687				}
16688
16689				el.each(function() {
16690					$(this).css('line-height', ($(this).actual('height') + lineheightAdd) + 'px');
16691				});
16692			}
16693		}
16694	}
16695
16696	var options = $.extend({
16697		slice: null,
16698		sliceNext: null,
16699		outer: false,
16700		lineheight: false,
16701		autoslicecount: true,
16702		classNull: false,
16703		minHeight: false,
16704		row:false,
16705		item:false,
16706		typeResize:false,
16707		typeValue:false,
16708		fixWidth:0,
16709		resize:true,
16710		mobile:false,
16711		customSlice:false,
16712		breakpoint:{},
16713	}, options);
16714
16715	var el = $(this);
16716
16717	if(el.length){
16718		if(options.mobile == true){
16719			if(typeof arNextOptions === 'object' && arNextOptions.THEME.MOBILE_CATALOG_LIST_ELEMENTS_COMPACT === 'Y' && el.first().parents('.catalog_block.items').length){
16720				options.mobile = false;
16721			}
16722		}
16723
16724		_slice(el);
16725
16726		if(options.resize){
16727			BX.addCustomEvent('onWindowResize', function(eventdata) {
16728				try{
16729					_slice(el);
16730				}
16731				catch(e){}
16732			});
16733		}
16734
16735		if($(this).find('img.lazyload').length){
16736			BX.addCustomEvent('onLazyLoaded', function(eventdata) {
16737				var bSlice = false;
16738				if(eventdata.length){
16739					for(var i in eventdata){
16740						if($(eventdata[i]).closest(el).length){
16741							bSlice = true;
16742							break;
16743						}
16744					}
16745				}
16746
16747				if(bSlice){
16748					try{
16749						_slice(el);
16750					}
16751					catch(e){}
16752				}
16753			});
16754		}
16755	}
16756}
16757
16758$.fn.sliceHeightNoResize = function( options ){
16759	function _slice(el){
16760		el.each(function() {
16761			$(this).css('line-height', '');
16762			$(this).css('height', '');
16763		});
16764
16765		if(typeof(options.autoslicecount) === 'undefined' || options.autoslicecount !== false){
16766			var elw = el.first().closest('.item').getFloatWidth();
16767			var elsw = el.first().parents('.items').getFloatWidth();
16768
16769			if(!elsw){
16770				elsw = el.first().parents('.row').getFloatWidth();
16771			}
16772
16773			if(elsw && elw){
16774				options.slice = Math.floor(elsw / elw);
16775			}
16776		}
16777
16778		if(options.slice){
16779			for(var i = 0; i < el.length; i += options.slice){
16780
16781				$(el.slice(i, i + options.slice)).equalizeHeights(options.outer, options.classNull, options.minHeight);
16782			}
16783		}
16784		if(options.lineheight){
16785			var lineheightAdd = parseInt(options.lineheight);
16786			if(isNaN(lineheightAdd)){
16787				lineheightAdd = 0;
16788			}
16789			el.each(function() {
16790				$(this).css('line-height', ($(this).actual('height') + lineheightAdd) + 'px');
16791			});
16792		}
16793	}
16794
16795	var options = $.extend({
16796		slice: null,
16797		outer: false,
16798		lineheight: false,
16799		autoslicecount: true,
16800		classNull: false,
16801		minHeight: false,
16802		options: false,
16803		resize: true,
16804	}, options);
16805
16806	var el = $(this);
16807
16808	if(el.length){
16809		_slice(el);
16810
16811		if($(this).find('img.lazyload').length){
16812			BX.addCustomEvent('onLazyLoaded', function(eventdata) {
16813				var bSlice = false;
16814				if(eventdata.length){
16815					for(var i in eventdata){
16816						if($(eventdata[i]).closest(el).length){
16817							bSlice = true;
16818							break;
16819						}
16820					}
16821				}
16822
16823				if(bSlice){
16824					try{
16825						_slice(el);
16826					}
16827					catch(e){}
16828				}
16829			});
16830		}
16831	}
16832}
16833
16834if(!funcDefined('initHoverBlock')){
16835	function initHoverBlock(target){
16836		/*$(target).find('.catalog_item.item_wrap').on('mouseenter', function(){
16837			$(this).addClass('hover');
16838		})
16839		$(target).find('.catalog_item.item_wrap').on('mouseleave', function(){
16840			$(this).removeClass('hover');
16841		})*/
16842	}
16843}
16844if(!funcDefined('setStatusButton')){
16845	function setStatusButton(){
16846		if(!funcDefined('setItemButtonStatus')){
16847			setItemButtonStatus = function(data){
16848				if(data.BASKET){
16849					for( var i in data.BASKET ){
16850						var id = data.BASKET[i];
16851						if(typeof id === 'number' || typeof id === 'string'){
16852							$('.to-cart[data-item='+id+']').hide();
16853							$('.counter_block[data-item='+id+']').hide();
16854							$('.in-cart[data-item='+id+']').show();
16855							//$('.in-cart[data-item='+id+']').closest('.button_block').addClass('wide');
16856						}
16857					}
16858				}
16859				if(data.DELAY){
16860					for( var i in data.DELAY ){
16861						var id = data.DELAY[i];
16862						if(typeof id === 'number' || typeof id === 'string'){
16863							$('.wish_item.to[data-item='+id+']').hide();
16864							$('.wish_item.in[data-item='+id+']').show();
16865							if ($('.wish_item[data-item='+id+']').find(".value.added").length) {
16866								$('.wish_item[data-item='+id+']').addClass("added");
16867								$('.wish_item[data-item='+id+']').find(".value").hide();
16868								$('.wish_item[data-item='+id+']').find(".value.added").show();
16869							}
16870						}
16871					}
16872				}
16873				if(data.SUBSCRIBE){
16874					for( var i in data.SUBSCRIBE ){
16875						var id = data.SUBSCRIBE;
16876						if(typeof id === 'number' || typeof id === 'string'){
16877							$('.to-subscribe[data-item='+id+']').hide();
16878							$('.in-subscribe[data-item='+id+']').show();
16879						}
16880					}
16881				}
16882				if(data.COMPARE){
16883					for( var i in data.COMPARE ){
16884						var id = data.COMPARE;
16885						if(typeof id === 'number' || typeof id === 'string'){
16886							$('.compare_item.to[data-item='+id+']').hide();
16887							$('.compare_item.in[data-item='+id+']').show();
16888							if ($('.compare_item[data-item='+id+']').find(".value.added").length){
16889								$('.compare_item[data-item='+id+']').find(".value").hide();
16890								$('.compare_item[data-item='+id+']').find(".value.added").show();
16891							}
16892						}
16893					}
16894				}
16895			}
16896		}
16897		if(!Object.keys(arStatusBasketAspro).length)
16898		{
16899			if(typeof arNextOptions === 'undefined')
16900			{
16901				var arNextOptions = ({
16902					"SITE_DIR" : '/'
16903				});
16904			}
16905			$.ajax({
16906				url: arNextOptions["SITE_DIR"]+'ajax/getAjaxBasket.php',
16907				type: 'POST',
16908				success: function(data){
16909					arStatusBasketAspro = data;
16910					setItemButtonStatus(arStatusBasketAspro);
16911				}
16912			});
16913		}
16914		else
16915			setItemButtonStatus(arStatusBasketAspro);
16916	}
16917}
16918
16919
16920if(!funcDefined('onLoadjqm')){
16921	var onLoadjqm = function(name, hash, requestData, selector, requestTitle, isButton, thButton){
16922
16923		$.each($(hash.t).get(0).attributes, function(index, attr){
16924			if(/^data\-autoload\-(.+)$/.test(attr.nodeName)){
16925				var key = attr.nodeName.match(/^data\-autoload\-(.+)$/)[1];
16926				var el = $('input[data-sid="'+key.toUpperCase()+'"]');
16927				// el.val( $(hash.t).data('autoload-'+key) ).attr('readonly', 'readonly');
16928				el.val(BX.util.htmlspecialcharsback($(hash.t).data('autoload-'+key))).attr('readonly', 'readonly');
16929				el.closest('.form-group').addClass('input-filed');
16930				el.attr('title', el.val());
16931			}
16932		});
16933
16934		//show gift block
16935		if(hash.w.hasClass('send_gift_frame'))
16936		{
16937			var imgHtml = priceHtml = propsHtml = '';
16938			if($('.offers_img a').length)
16939				imgHtml = $('.offers_img a').html();
16940			else if($('.item_main_info .item_slider:not(.flex) .slides li').length)
16941				imgHtml = $('.item_main_info .item_slider .slides li:first a').html();
16942
16943			if($('.item_main_info *[itemprop="offers"]').length) //show price
16944			{
16945				if($('.offers_img.wof').length || $('.prices_tab').length)
16946				{
16947					if($('.prices_block .price').length)
16948						priceHtml = $('.prices_block .cost.prices').html().replace('id', 'data-id');
16949				}
16950				else
16951				{
16952					if($('.prices_block .with_matrix').length)
16953						priceHtml = '<div class="with_matrix">'+$('.prices_block .with_matrix').html()+'</div>';
16954					else if($('.prices_block .price_group.min').length)
16955						priceHtml = $('.prices_block .price_group.min').html();
16956					else if($('.prices_block .price_matrix_wrapper').length)
16957						priceHtml = $('.prices_block .price_matrix_wrapper').html();
16958				}
16959			}
16960
16961			if($('.buy_block .sku_props').length)
16962			{
16963				propsHtml = '<div class="props_item">';
16964				$('.buy_block .sku_props .bx_catalog_item_scu > div').each(function(){
16965					var title = $(this).find('.bx_item_section_name > span').html();
16966					propsHtml += '<div class="prop_item">'+
16967									'<span>'+
16968										title + (title.indexOf(':') > 0 ? '' : ': ')+
16969										(title.indexOf(':') > 0 ? '' : '<span class="val">'+$(this).find('ul li.active > span').text()+'</span>')+
16970									'</span>'+
16971								'</div>';
16972
16973				})
16974				propsHtml += '</div>';
16975			}
16976			$('<div class="custom_block">'+
16977				'<div class="title">'+BX.message('POPUP_GIFT_TEXT')+'</div>'+
16978				'<div class="item_block">'+
16979					'<table class="item_list"><tr>'+
16980						'<td class="image">'+
16981							'<div>'+imgHtml+'</div>'+
16982						'</td>'+
16983						'<td class="text">'+
16984							'<div class="name">'+$('h1').text()+'</div>'+
16985							priceHtml+
16986							propsHtml+
16987						'</td>'+
16988					'</tr></table>'+
16989				'</div>'+
16990				'</div>').prependTo(hash.w.find('.form_body'))
16991		}
16992
16993		if (hash.w.hasClass('one_click_buy_frame')) {
16994			if (hash.w.height() > $(window).height()) {
16995				hash.w.addClass('scrollbar')
16996			} else {
16997				hash.w.removeClass('scrollbar')
16998			}
16999		}
17000
17001		if(arNextOptions['THEME']['REGIONALITY_SEARCH_ROW'] == 'Y' && (hash.w.hasClass('city_chooser_frame ') || hash.w.hasClass('city_chooser_small_frame')))
17002			hash.w.addClass('small_popup_regions')
17003
17004		hash.w.addClass('show').css({
17005			'margin-left': ($(window).width() > hash.w.outerWidth() ? '-' + hash.w.outerWidth() / 2 + 'px' : '-' + $(window).width() / 2 + 'px'),
17006			'opacity': 1,
17007		});
17008
17009		hash.w.addClass('show').css({
17010			// 'top': $(document).scrollTop() + (($(window).height() > hash.w.outerHeight() ? ($(window).height() - hash.w.outerHeight()) / 2 : 10))   + 'px',
17011			'top': (($(window).height() > hash.w.height()) ? Math.floor(($(window).height() - hash.w.height()) / 2) : 0) + 'px',
17012		});
17013
17014		var eventdata = {action:'loadForm'};
17015		BX.onCustomEvent('onCompleteAction', [eventdata, $(hash.t)[0]]);
17016
17017		if(typeof(requestData) == 'undefined'){
17018			requestData = '';
17019		}
17020		if(typeof(selector) == 'undefined'){
17021			selector = false;
17022		}
17023		var width = $('.'+name+'_frame').width();
17024		$('.'+name+'_frame').css('margin-left', '-'+width/2+'px');
17025
17026		if(name=='order-popup-call') {
17027		}
17028		else if(name=='order-button') {
17029			$(".order-button_frame").find("div[product_name]").find("input").val(hash.t.title).attr("readonly", "readonly").css({"overflow": "hidden", "text-overflow": "ellipsis"});
17030		}
17031		else if(name=='basket_error')
17032		{
17033			$(".basket_error_frame .pop-up-title").text(requestTitle);
17034			$(".basket_error_frame .ajax_text").html(requestData);
17035
17036			if(window.matchMedia('(max-width: 991px)').matches)
17037			{
17038				$("body").addClass("all_viewed");
17039			}
17040
17041			initSelects(document);
17042			if(isButton=="Y" && thButton)
17043				$("<div class='popup_button_basket_wr'>
17043<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"));
17044		}
17045
17046		$('.'+name+'_frame').show();
17047	}
17048}
17049
17050$.fn.jqmEx = function(){
17051	// $(this).each(function(){
17052		var _this = $(this);
17053		var name = _this.data('name');
17054
17055		if(name.length && _this.attr('disabled') != 'disabled'){
17056			var extClass = '',
17057				paramsStr = '',
17058				trigger = '',
17059				arTriggerAttrs = {};
17060
17061			// call counter
17062			if(typeof $.fn.jqmEx.counter === 'undefined'){
17063				$.fn.jqmEx.counter = 0;
17064			}
17065			else{
17066				++$.fn.jqmEx.counter;
17067			}
17068
17069			// trigger attrs and params
17070			$.each(_this.get(0).attributes, function(index, attr){
17071				var attrName = attr.nodeName;
17072				var attrValue = _this.attr(attrName);
17073				if (attrName !== 'onclick') {
17074					trigger += '[' + attrName + '=\"' + attrValue + '\"]';
17075					arTriggerAttrs[attrName] = attrValue;
17076				}
17077				if(/^data\-param\-(.+)$/.test(attrName)){
17078					var key = attrName.match(/^data\-param\
17078-(.+)$/)[1];
17079					paramsStr += key + '=' + attrValue + '&';
17080				}
17081			});
17082			var triggerAttrs = JSON.stringify(arTriggerAttrs);
17083			var encTriggerAttrs = encodeURIComponent(triggerAttrs);
17084
17085			// popup url
17086			var script = arNextOptions['SITE_DIR'] + 'ajax/form.php';
17087			if(name == 'auth'){
17088				script += '?' + paramsStr + 'auth=Y';
17089			}
17090			else{
17091				script += '?' + paramsStr + 'data-trigger=' + encTriggerAttrs;
17092			}
17093
17094			// ext frame class
17095			if(_this.closest('#fast_view_item').length){
17096				extClass = 'fast_view_popup';
17097			}
17098
17099			// unique frame to each trigger
17100			var frame = $('<div class="' + name + '_frame ' + extClass + ' jqmWindow popup" data-popup="' + $.fn.jqmEx.counter + '" data-trigger="' + encTriggerAttrs + '"></div>').appendTo('body');
17101			frame.jqm({
17102				ajax: script,
17103				trigger: trigger,
17104				onLoad: function(hash){
17105					onLoadjqm(name, hash);
17106				},
17107				onHide: function(hash){
17108					onHidejqm(name, hash);
17109				}
17110			});
17111		}
17112	// });
17113}
17114
17115if(!funcDefined('onHidejqm')){
17116	var onHidejqm = function(name, hash){
17117		if (hash.w.find('.one_click_buy_result_success').is(':visible') && name=="one_click_buy_basket") {
17118			window.location.href = window.location.href;
17119		}
17120
17121		if($('.xzoom-source').length)
17122			$('.xzoom-source').remove();
17123		if($('.xzoom-preview').length)
17124			$('.xzoom-preview').remove();
17125
17126		// hash.w.css('opacity', 0).hide();
17127		hash.w.animate({'opacity': 0}, 200, function(){
17128			hash.w.hide();
17129			hash.w.empty();
17130			hash.o.remove();
17131			hash.w.removeClass('show');
17132			hash.w.removeClass('scrollbar')
17133
17134			if(window.matchMedia('(max-width: 991px)').matches)
17135			{
17136				$("body").removeClass("all_viewed");
17137			}
17138
17139			if(name == 'fast_view')
17140				$('.fast_view_popup').remove();
17141				// $('.fast_view_frame').remove();
17142		});
17143	}
17144}
17145
17146if(!funcDefined("scroll_block")) {
17147	function scroll_block(block){
17148		var topPos = block.offset().top,
17149			headerH = $('header').outerHeight(true,true);
17150		if($(".stores_tab").length){
17151			$(".stores_tab").addClass("active").siblings().removeClass("active");
17152		}else{
17153			$(".prices_tab").addClass("active").siblings().removeClass("active");
17154			if($(".prices_tab .opener").length && !$(".prices_tab .opener .opened").length){
17155				var item = $(".prices_tab .opener").first();
17156				item.find(".opener_icon").addClass("opened");
17157				item.parents("tr").addClass("nb")
17158				item.parents("tr").next(".offer_stores").find(".stores_block_wrap").slideDown(200);
17159			}
17160		}
17161		$('html,body').animate({'scrollTop':topPos-80},150);
17162	}
17163}
17164
17165if(!funcDefined("jqmEd")) {
17166	var jqmEd = function (name, form_id, open_trigger, requestData, selector, requestTitle, isButton, thButton){
17167		if(typeof(requestData) == "undefined"){
17168			requestData = '';
17169		}
17170		if(typeof(selector) == "undefined"){
17171			selector = false;
17172		}
17173		$('body').find('.'+name+'_frame').remove();
17174		$('body').append('<div class="'+name+'_frame jqmWindow popup"></div>');
17175		if(typeof open_trigger == "undefined" ){
17176			$('.'+name+'_frame').jqm({trigger: '.'+name+'_frame.popup',onHide: function(hash) { onHidejqm(name,hash); }, onLoad: function( hash ){ onLoadjqm( name , hash , requestData, selector); }, ajax: arNextOptions["SITE_DIR"]+'ajax/form.php?form_id='+form_id+(requestData.length ? '&' + requestData : '')});
17177		}else{
17178			if(name == 'enter'){
17179				$('.'+name+'_frame').jqm({trigger: open_trigger,onHide: function(hash) { onHidejqm(name,hash); },  onLoad: function( hash ){ onLoadjqm( name , hash , requestData, selector); }, ajax: arNextOptions["SITE_DIR"]+'ajax/auth.php'});
17180			}else if(name=='basket_error'){
17181				$('.'+name+'_frame').jqm({trigger: open_trigger, onHide: function(hash) { onHidejqm(name,hash); }, onLoad: function( hash ){ onLoadjqm( name , hash , requestData, selector, requestTitle, isButton, thButton); }, ajax: arNextOptions["SITE_DIR"]+'ajax/basket_error.php'});
17182
17183			}else{
17184				$('.'+name+'_frame').jqm({trigger: open_trigger, onHide: function(hash) { onHidejqm(name,hash); }, onLoad: function( hash ){ onLoadjqm( name , hash , requestData, selector); }, ajax: arNextOptions["SITE_DIR"]+'ajax/form.php?form_id='+form_id+(requestData.length ? '&' + requestData : '')});
17185			}
17186			$(open_trigger).dblclick(function(){return false;})
17187		}
17188		return true;
17189	}
17190}
17191
17192if (!funcDefined("replaceBasketPopup")){
17193	function replaceBasketPopup (hash){
17194		if(typeof hash != "undefined"){
17195			hash.w.hide();
17196			hash.o.hide();
17197		}
17198	}
17199}
17200
17201if(!funcDefined("waitLayer")){
17202	function waitLayer(delay, callback){
17203		if((typeof dataLayer !== 'undefined') && (typeof callback === 'function')){
17204			callback();
17205		}
17206		else{
17207			setTimeout(function() {
17208				waitLayer(delay, callback);
17209			}, delay);
17210		}
17211	}
17212}
17213
17214if(!funcDefined("InitTopestMenuGummi")){
17215	InitTopestMenuGummi = function(){
17216		if(!isOnceInited){
17217			function _init(){
17218				var arItems = $menuTopest.find('>li:not(.more)');
17219				var cntItems = arItems.length;
17220				if(cntItems){
17221					var itemsWidth = 0;
17222					for(var i = 0; i < cntItems; ++i){
17223						var item = arItems.eq(i);
17224						var itemWidth = item.actual('outerWidth',{includeMargin: true});
17225						arItemsHideWidth[i] = (itemsWidth += itemWidth) + (i !== (cntItems - 1) ? moreWidth : 0);
17226					}
17227				}
17228			}
17229
17230			function _gummi(){
17231				var rowWidth = $menuTopest.actual('innerWidth');
17232				var arItems = $menuTopest.find('>li:not(.more),li.more>.dropdown>li');
17233				var cntItems = arItems.length;
17234				if(cntItems){
17235					var bMore = false;
17236					for(var i = cntItems - 1; i >= 0; --i){
17237						var item = arItems.eq(i);
17238						var bInMore = item.parents('.more').length > 0;
17239						if(!bInMore){
17240							if(arItemsHideWidth[i] > rowWidth){
17241								if(!bMore){
17242									bMore = true;
17243									more.removeClass('hidden');
17244								}
17245								var clone = item.clone();
17246								clone.find('>a').addClass('dark_font');
17247								clone.prependTo(moreDropdown);
17248								item.addClass('cloned');
17249							}
17250						}
17251					}
17252					for(var i = 0; i < cntItems; ++i){
17253						var item = arItems.eq(i);
17254						var bInMore = item.parents('.more').length > 0;
17255						if(bInMore){
17256							if(arItemsHideWidth[i] <= rowWidth){
17257								if(i === (cntItems - 1)){
17258									bMore = false;
17259									more.addClass('hidden');
17260								}
17261								var clone = item.clone();
17262								clone.find('>a').removeClass('dark_font');
17263								clone.insertBefore(more);
17264								item.addClass('cloned');
17265							}
17266						}
17267					}
17268					$menuTopest.find('li.cloned').remove();
17269				}
17270			}
17271
17272			var $menuTopest = $('.menu.topest');
17273			if($menuTopest.length)
17274			{
17275				var more = $menuTopest.find('>.more');
17276				var moreDropdown = more.find('>.dropdown');
17277				var moreWidth = more.actual('outerWidth',{includeMargin: true});
17278				var arItemsHideWidth = [];
17279
17280				ignoreResize.push(true);
17281				_init();
17282				_gummi();
17283				ignoreResize.pop();
17284
17285				BX.addCustomEvent('onWindowResize', function(eventdata) {
17286					try{
17287						ignoreResize.push(true);
17288						_gummi();
17289					}
17290					catch(e){}
17291					finally{
17292						ignoreResize.pop();
17293					}
17294				});
17295			}
17296		}
17297	}
17298}
17299
17300if(!funcDefined("InitTopMenuGummi")){
17301	InitTopMenuGummi = function(){
17302		function _init(){
17303			var arItems = $topMenu.closest('.wrap_menu').find('.inc_menu .menu_top_block >li:not(.more)');
17304			var cntItems = arItems.length;
17305			if(cntItems){
17306				var itemsWidth = 0;
17307				for(var i = 0; i < cntItems; ++i){
17308					var item = arItems.eq(i);
17309						var itemWidth = item.actual('outerWidth');
17310						arItemsHideWidth[i] = (itemsWidth += itemWidth) + (i !== (cntItems - 1) ? moreWidth : 0);
17311				}
17312			}
17313
17314		}
17315
17316		function _gummi(){
17317			var rowWidth = $wrapMenu.actual('innerWidth') - $wrapMenuLeft.actual('innerWidth');
17318			var arItems = $topMenu.find('>li:not(.more):not(.catalog),li.more>.dropdown>li');
17319			var cntItems = arItems.length;
17320
17321			if(cntItems){
17322				var bMore = false;
17323				for(var i = cntItems - 1; i >= 0; --i){
17324					var item = arItems.eq(i);
17325					var bInMore = item.parents('.more').length > 0;
17326					if(!bInMore){
17327						if(arItemsHideWidth[i] > rowWidth){
17328							if(!bMore){
17329								bMore = true;
17330								more.removeClass('hidden');
17331							}
17332							var clone = item.clone();
17333							clone.find('>.dropdown').removeAttr('style').removeClass('toleft');
17334							clone.find('>a').addClass('dark_font').removeAttr('style');
17335							clone.prependTo(moreDropdown);
17336							item.addClass('cloned');
17337						}
17338					}
17339				}
17340				for(var i = 0; i < cntItems; ++i){
17341					var item = arItems.eq(i);
17342					var bInMore = item.parents('.more').length > 0;
17343					if(bInMore){
17344						if(arItemsHideWidth[i] <= rowWidth){
17345							if(i === (cntItems - 1)){
17346								bMore = false;
17347								more.addClass('hidden');
17348							}
17349							var clone = item.clone();
17350							clone.find('>a').removeClass('dark_font');
17351							clone.insertBefore(more);
17352							item.addClass('cloned');
17353						}
17354					}
17355				}
17356				$topMenu.find('li.cloned').remove();
17357
17358				var cntItemsVisible = $topMenu.find('>li:not(.more):not(.catalog)').length;
17359				var o = rowWidth - arItemsHideWidth[cntItemsVisible - 1];
17360				var itemsPaddingAdd = Math.floor(o / (cntItemsVisible + (more.hasClass('hidden') ? 0 : 1)));
17361				var itemsPadding_new = itemsPadding_min + itemsPaddingAdd;
17362				var itemsPadding_new_l = Math.floor(itemsPadding_new / 2);
17363				var itemsPadding_new_r = itemsPadding_new - itemsPadding_new_l;
17364
17365				$topMenu.find('>li:not(.catalog):visible>a').each(function(){
17366					$(this).css({'padding-left': itemsPadding_new_l + 'px'});
17367					$(this).css({'padding-right': itemsPadding_new_r + 'px'});
17368				});
17369
17370				var lastItemPadding_new = itemsPadding_new + o - (cntItemsVisible + (more.is(':visible') ? 1 : 0)) * itemsPaddingAdd;
17371				var lastItemPadding_new_l = Math.floor(lastItemPadding_new / 2);
17372				var lastItemPadding_new_r = lastItemPadding_new - lastItemPadding_new_l;
17373				$topMenu.find('>li:visible').last().find('>a').css({'padding-left': lastItemPadding_new_l + 'px'});
17374				$topMenu.find('>li:visible').last().find('>a').css({'padding-right': lastItemPadding_new_r + 'px'});
17375			}
17376			CheckTopMenuFullCatalogSubmenu();
17377		}
17378
17379		var $topMenu = $('.menu_top_block');
17380		if($menuTopest.length)
17381		{
17382			var $wrapMenu = $topMenu.parents('.wrap_menu');
17383			var $wrapMenuLeft = $wrapMenu.find('.catalog_menu_ext');
17384			var more = $topMenu.find('>.more');
17385			var moreWidth = more.actual('outerWidth',{includeMargin: true});
17386			more.addClass('hidden');
17387			var arItemsHideWidth = [];
17388			var moreDropdown = more.find('>.dropdown');
17389			var itemsPadding = parseInt(more.find('>a').css('padding-left')) * 2;
17390			var itemsPadding_min = itemsPadding;
17391
17392			// setTimeout(function(){
17393				ignoreResize.push(true);
17394				_init();
17395				_gummi();
17396				ignoreResize.pop();
17397			// }, 100)
17398
17399			BX.addCustomEvent('onWindowResize', function(eventdata) {
17400				try{
17401					ignoreResize.push(true);
17402					_gummi();
17403				}
17404				catch(e){}
17405				finally{
17406					ignoreResize.pop();
17407				}
17408			});
17409
17410			/*BX.addCustomEvent('onTopPanelFixUnfix', function(eventdata) {
17411				ignoreResize.push(true);
17412				_gummi();
17413				ignoreResize.pop();
17414			});*/
17415		}
17416	}
17417}
17418
17419if(!funcDefined("checkCounters")){
17420	function checkCounters(name){
17421		if(typeof name !== "undefined"){
17422			if(name == "google" && (arNextOptions["COUNTERS"]["GOOGLE_ECOMERCE"] == "Y" && arNextOptions["COUNTERS"]["GOOGLE_COUNTER"] > 0)){
17423				return true;
17424			}
17425			else if(name == "yandex" && (arNextOptions["COUNTERS"]["YANDEX_ECOMERCE"] == "Y" && arNextOptions["COUNTERS"]["YANDEX_COUNTER"] > 0)){
17426				return true;
17427			}
17428			else{
17429				return false;
17430			}
17431		}
17432		else if((arNextOptions["COUNTERS"]["YANDEX_ECOMERCE"] == "Y" && arNextOptions["COUNTERS"]["YANDEX_COUNTER"] > 0) || (arNextOptions["COUNTERS"]["GOOGLE_ECOMERCE"] == "Y" && arNextOptions["COUNTERS"]["GOOGLE_COUNTER"] > 0)) {
17433			return true;
17434		}
17435		else{
17436			return false;
17437		}
17438	}
17439}
17440
17441if(!funcDefined("addBasketCounter")){
17442	function addBasketCounter(id){
17443		if(arNextOptions['COUNTERS']['USE_BASKET_GOALS'] !== 'N'){
17444			var eventdata = {goal: 'goal_basket_add', params: {id: id}};
17445			BX.onCustomEvent('onCounterGoals', [eventdata]);
17446		}
17447		if(checkCounters()){
17448			$.ajax({
17449				url:arNextOptions['SITE_DIR'] + "ajax/goals.php",
17450				dataType: "json",
17451				type: "POST",
17452				data: {"ID": id},
17453				success: function(item){
17454					if(!!item && !!item.ID){
17455						waitLayer(100, function() {
17456							dataLayer.push({
17457								"event": arNextOptions["COUNTERS"]['GOOGLE_EVENTS']['ADD2BASKET'],
17458							    "ecommerce": {
17459							    	"currencyCode": item.CURRENCY,
17460							        "add": {
17461							            "products": [{
17462						                    "id": item.ID,
17463						                    "name": item.NAME,
17464						                    "price": item.PRICE,
17465						                    "brand": item.BRAND,
17466						                    "category": item.CATEGORY,
17467						                    "quantity": item.QUANTITY
17468						                }]
17469							        }
17470							    }
17471							});
17472						});
17473					}
17474				}
17475			});
17476		}
17477	}
17478}
17479
17480if(!funcDefined("purchaseCounter")){
17481	function purchaseCounter(order_id, type, callback){
17482		if(checkCounters()){
17483			$.ajax({
17484				url:arNextOptions['SITE_DIR'] + "ajax/goals.php",
17485				dataType: "json",
17486				type: "POST",
17487				data: {"ORDER_ID": order_id, "TYPE": type},
17488				success: function(order){
17489					var products = [];
17490					if(order.ITEMS){
17491						for(var i in order.ITEMS){
17492							products.push({
17493								"id": order.ITEMS[i].ID,
17494								"sku": order.ITEMS[i].ID,
17495			                    "name": order.ITEMS[i].NAME,
17496			                    "price": order.ITEMS[i].PRICE,
17497			                    "brand": order.ITEMS[i].BRAND,
17498			                    "category": order.ITEMS[i].CATEGORY,
17499			                    "quantity": order.ITEMS[i].QUANTITY
17500							});
17501						}
17502					}
17503					if(order.ID){
17504						waitLayer(100, function() {
17505							var d = {
17506						    	"purchase": {
17507							    	"actionField":{
17508							    		"id": order.ACCOUNT_NUMBER,
17509							    		"shipping": order.PRICE_DELIVERY,
17510							    		"tax": order.TAX_VALUE,
17511							    		"list": type,
17512							    		"revenue": order.PRICE
17513							    	},
17514						            "products": products
17515						        }
17516						    };
17517							dataLayer.push({
17518								"event": arNextOptions["COUNTERS"]['GOOGLE_EVENTS']['PURCHASE'],
17519							    "ecommerce": d
17520							});
17521
17522							if(typeof callback !== 'undefined'){
17523								callback(d);
17524							}
17525						});
17526					}
17527					else{
17528						if(typeof callback !== 'undefined'){
17529							callback();
17530						}
17531					}
17532				},
17533				error: function(){
17534					if(typeof callback !== 'undefined'){
17535						callback();
17536					}
17537				}
17538			});
17539		}
17540	}
17541}
17542
17543if(!funcDefined("viewItemCounter")){
17544	function viewItemCounter(id, price_id){
17545		if(checkCounters()){
17546			$.ajax({
17547				url:arNextOptions['SITE_DIR'] + "ajax/goals.php",
17548				dataType: "json",
17549				type: "POST",
17550				data: {"PRODUCT_ID": id, "PRICE_ID": price_id},
17551				success: function(item){
17552					if(item.ID){
17553						waitLayer(100, function() {
17554							dataLayer.push({
17555								//"event": "",
17556								"ecommerce": {
17557									"detail": {
17558										"products": [{
17559											"id": item.ID,
17560											"name": item.NAME,
17561											"price": item.PRICE,
17562											"brand": item.BRAND,
17563											"category": item.CATEGORY
17564										}]
17565									}
17566								}
17567							});
17568						});
17569					}
17570				}
17571			});
17572		}
17573	}
17574}
17575
17576if(!funcDefined("checkoutCounter")){
17577	function checkoutCounter(step, option, callback){
17578		if(checkCounters('google')){
17579			$.ajax({
17580				url:arNextOptions['SITE_DIR'] + "ajax/goals.php",
17581				dataType: "json",
17582				type: "POST",
17583				data: {"BASKET": "Y"},
17584				success: function(basket){
17585					var products = [];
17586					if(basket.ITEMS){
17587						for(var i in basket.ITEMS){
17588							products.push({
17589								"id": basket.ITEMS[i].ID,
17590			                    "name": basket.ITEMS[i].NAME,
17591			                    "price": basket.ITEMS[i].PRICE,
17592			                    "brand": basket.ITEMS[i].BRAND,
17593			                    "category": basket.ITEMS[i].CATEGORY,
17594			                    "quantity": basket.ITEMS[i].QUANTITY
17595							});
17596						}
17597					}
17598					if(products){
17599						waitLayer(100, function() {
17600							dataLayer.push({
17601								"event": arNextOptions["COUNTERS"]['GOOGLE_EVENTS']['CHECKOUT_ORDER'],
17602							    "ecommerce": {
17603							    	'checkout': {
17604								    	"actionField":{
17605								    		"step": step,
17606								    		"option": option
17607								    	},
17608								        "products": products
17609								    }
17610							    },
17611							    /*"eventCallback": function() {
17612							    	if((typeof callback !== 'undefined') && (typeof callback === 'function')){
17613							    		callback();
17614							    	}
17615							   }*/
17616							});
17617						});
17618					}
17619				}
17620			});
17621		}
17622	}
17623}
17624
17625if(!funcDefined("delFromBasketCounter")){
17626	function delFromBasketCounter(id, callback){
17627		if(checkCounters()){
17628			$.ajax({
17629				url:arNextOptions['SITE_DIR'] + "ajax/goals.php",
17630				dataType: "json",
17631				type: "POST",
17632				data: {"ID": id},
17633				success: function(item){
17634					if(item.ID){
17635						waitLayer(100, function() {
17636							dataLayer.push({
17637								"event": arNextOptions["COUNTERS"]['GOOGLE_EVENTS']['REMOVE_BASKET'],
17638							    "ecommerce": {
17639							        "remove": {
17640							            "products": [{
17641						                    "id": item.ID,
17642						                    "name": item.NAME,
17643						                    "category": item.CATEGORY
17644						                }]
17645							        }
17646							    }
17647							});
17648							if(typeof callback == 'function'){
17649								callback();
17650							}
17651						});
17652					}
17653				}
17654			});
17655		}
17656	}
17657}
17658
17659if(!funcDefined("setHeightCompany")){
17660	function setHeightCompany(){
17661		$('.md-50.img').height($('.md-50.big').outerHeight()-35);
17662	}
17663}
17664
17665if(!funcDefined("initSly")){
17666	function initSly(){
17667		var $frame  = $(document).find('.frame');
17668		var $slidee = $frame.children('ul').eq(0);
17669		var $wrap   = $frame.parent();
17670
17671		if(arNextOptions["PAGES"]["CATALOG_PAGE"] && $frame.length){
17672			$frame.sly({
17673				horizontal: 1,
17674				itemNav: 'basic',
17675				smart: 1,
17676				mouseDragging: 0,
17677				touchDragging: 0,
17678				releaseSwing: 0,
17679				startAt: 0,
17680				scrollBar: $wrap.find('.scrollbar'),
17681				scrollBy: 1,
17682				speed: 300,
17683				elasticBounds: 0,
17684				easing: 'swing',
17685				dragHandle: 1,
17686				dynamicHandle: 1,
17687				clickBar: 1,
17688
17689				// Buttons
17690				forward: $wrap.find('.forward'),
17691				backward: $wrap.find('.backward'),
17692			});
17693			$frame.sly('reload');
17694		}
17695	}
17696}
17697
17698if(!funcDefined("createTableCompare")){
17699	function createTableCompare(originalTable, appendDiv, cloneTable){
17700
17701		try{
17702			var clone = originalTable.clone().removeAttr('id').addClass('clone');
17703			if(cloneTable.length){
17704				cloneTable.remove();
17705				appendDiv.html('');
17706				appendDiv.html(clone);
17707			}else{
17708				appendDiv.append(clone);
17709			}
17710		}
17711		catch(e){}
17712		finally{
17713
17714		}
17715	}
17716}
17717
17718if(!funcDefined('fillBasketPropsExt')){
17719	fillBasketPropsExt = function(that, prop_code, basket_prop_div){
17720		var
17721			i = 0,
17722			propCollection = null,
17723			foundValues = false,
17724			basketParams = {},
17725			obBasketProps = null;
17726
17727		// obBasketProps = that.closest('.catalog_detail').find('.basket_props_block');
17728		obBasketProps = BX(basket_prop_div);
17729
17730		if (!!obBasketProps)
17731		{
17732			propCollection = obBasketProps.getElementsByTagName('select');
17733			if (!!propCollection && !!propCollection.length)
17734			{
17735				for (i = 0; i < propCollection.length; i++)
17736				{
17737					if (!propCollection[i].disabled)
17738					{
17739						switch(propCollection[i].type.toLowerCase())
17740						{
17741							case 'select-one':
17742								basketParams[propCollection[i].name] = propCollection[i].value;
17743								foundValues = true;
17744								break;
17745							default:
17746								break;
17747						}
17748					}
17749				}
17750			}
17751			propCollection = obBasketProps.getElementsByTagName('input');
17752			if (!!propCollection && !!propCollection.length)
17753			{
17754				for (i = 0; i < propCollection.length; i++)
17755				{
17756					if (!propCollection[i].disabled)
17757					{
17758						switch(propCollection[i].type.toLowerCase())
17759						{
17760							case 'hidden':
17761								basketParams[propCollection[i].name] = propCollection[i].value;
17762								foundValues = true;
17763								break;
17764							case 'radio':
17765								if (propCollection[i].checked)
17766								{
17767									basketParams[propCollection[i].name] = propCollection[i].value;
17768									foundValues = true;
17769								}
17770								break;
17771							default:
17772								break;
17773						}
17774					}
17775				}
17776			}
17777		}
17778		if (!foundValues)
17779		{
17780			basketParams[prop_code] = [];
17781			basketParams[prop_code][0] = 0;
17782		}
17783		return basketParams;
17784	}
17785}
17786if(!funcDefined('showBasketError')){
17787	showBasketError = function(mess, title, addButton, th){
17788		var title_set=(title ? title : BX.message("ERROR_BASKET_TITLE")),
17789			isButton="N",
17790			thButton="";
17791		if(typeof addButton!==undefined){
17792			isButton="Y";
17793		}
17794		if(typeof th!==undefined){
17795			thButton=th;
17796		}
17797		$("body").append("<span class='add-error-bakset' style='display:none;'></span>");
17798		jqmEd('basket_error', 'error-bakset', '.add-error-bakset', mess, this, title_set, isButton, thButton);
17799		$("body .add-error-bakset").click();
17800		$("body .add-error-bakset").remove();
17801	}
17802}
17803
17804CheckTopMenuDotted = function(){
17805	var menu = $('nav.mega-menu.sliced');
17806
17807	/*if(isMobile)
17808		return;*/
17809	if(window.matchMedia('(max-width:991px)').matches)
17810		return;
17811
17812	if(menu.length)
17813	{
17814		menu.each(function(){
17815			
17816			if($(this).hasClass('initied'))
17817				return false;
17818
17819			var menuMoreItem = $(this).find('td.js-dropdown');
17820			if($(this).parents('.collapse').css('display') == 'none'){
17821				return false;
17822			}
17823
17824			var block_w = $(this).closest('div').actual('width');
17825			var	menu_w = $(this).find('table').actual('outerWidth');
17826			var afterHide = false;
17827
17828			while(menu_w > block_w) {
17829				menuItemOldSave = $(this).find('td').not('.nosave').last();
17830				if(menuItemOldSave.length){
17831					menuMoreItem.show();
17832					var oldClass = menuItemOldSave.attr('class');
17833					menuItemNewSave = '<li class="menu-item ' + (menuItemOldSave.hasClass('dropdown') ? 'dropdown-submenu ' : '') + (menuItemOldSave.hasClass('active') ? 'active ' : '') + '" data-hidewidth="' + menu_w + '" ' + (oldClass ? 'data-class="' + oldClass + '"' : '') + '>' + menuItemOldSave.find('.wrap').html() + '</li>';
17834					menuItemOldSave.remove();
17835					menuMoreItem.find('> .wrap > .dropdown-menu').prepend(menuItemNewSave);
17836					menu_w = $(this).find('table').actual('outerWidth');
17837					afterHide = true;
17838				}
17839				//menu.find('.nosave').css('display', 'table-cell');
17840				else{
17841					break;
17842				}
17843			}
17844
17845			if(!afterHide) {
17846				do {
17847					var menuItemOldSaveCnt = menuMoreItem.find('.dropdown-menu').find('li').length;
17848					menuItemOldSave = menuMoreItem.find('.dropdown-menu').find('li').first();
17849					if(!menuItemOldSave.length) {
17850						menuMoreItem.hide();
17851						break;
17852					}
17853					else {
17854						var hideWidth = menuItemOldSave.attr('data-hidewidth');
17855						if(hideWidth > block_w) {
17856							break
17857						}
17858						else {
17859							var oldClass = menuItemOldSave.attr('data-class');
17860							menuItemNewSave = '<td class="' + (oldClass ? oldClass + ' ' : '') + '" data-hidewidth="' + block_w + '"><div class="wrap">' + menuItemOldSave.html() + '</div></td>';
17861							menuItemOldSave.remove();
17862							$(menuItemNewSave).insertBefore($(this).find('td.js-dropdown'));
17863							if(!menuItemOldSaveCnt) {
17864								menuMoreItem.hide();
17865								break;
17866							}
17867						}
17868					}
17869					menu_w = $(this).find('table').actual('outerWidth');
17870				}
17871				while(menu_w <= block_w);
17872			}
17873			$(this).find('td').css('visibility', 'visible');
17874			$(this).find('td').removeClass('unvisible');
17875			$(this).addClass('ovisible');
17876			$(this).addClass('initied');
17877		})
17878	}
17879	return false;
17880}
17881
17882CheckTopVisibleMenu = function(){
17883	if(typeof this.timer === 'undefined'){
17884		this.timer = false;
17885	}
17886
17887	if(this.timer){
17888		clearTimeout(this.timer);
17889	}
17890
17891	this.timer = setTimeout(function(){
17892		var dropdownMenus = $('.dropdown-menu:visible');
17893		if(dropdownMenus.length){
17894			var menu = dropdownMenus.closest('.mega-menu');
17895			if(!menu.length){
17896				menu = dropdownMenus.closest('.logo-row');
17897			}
17898			var menu_width = menu.outerWidth();
17899			var menu_left = menu.offset().left;
17900			var menu_right = menu_left + menu_width;
17901
17902			dropdownMenus.each(function(i, item){
17903				var dropdownMenu = $(item);
17904				dropdownMenu.find('a').css('white-space', '');
17905				dropdownMenu.css('left', '');
17906				dropdownMenu.css('right', '');
17907				dropdownMenu.removeClass('toright');
17908
17909				var dropdownMenu_left = dropdownMenu.offset().left;
17910				if(typeof(dropdownMenu_left) != 'undefined'){
17911					var isToRight = dropdownMenu.parents('.toright').length > 0;
17912					var parentsDropdownMenus = dropdownMenu.parents('.dropdown-menu');
17913					var isHasParentDropdownMenu = parentsDropdownMenus.length > 0;
17914					var dropdownMenu_width = dropdownMenu.outerWidth();
17915					var dropdownMenu_right = dropdownMenu_left + dropdownMenu_width;
17916
17917					if(isHasParentDropdownMenu){
17918						var parentDropdownMenu_width = parentsDropdownMenus.first().outerWidth();
17919						var parentDropdownMenu_left = parentsDropdownMenus.first().offset().left;
17920						var parentDropdownMenu_right = parentDropdownMenu_width + parentDropdownMenu_left;
17921					}
17922
17923					if(parentDropdownMenu_right + dropdownMenu.outerWidth() > menu_right){
17924						dropdownMenu.find('a').css('white-space', 'normal');
17925					}
17926
17927					if(dropdownMenu_right > menu_right || isToRight){
17928						var addleft = 0;
17929						addleft = menu_right - dropdownMenu_right;
17930						if(isHasParentDropdownMenu || isToRight){
17931							dropdownMenu.css('left', 'auto');
17932							dropdownMenu.css('right', '100%');
17933							dropdownMenu.addClass('toright');
17934						}
17935						else{
17936							var dropdownMenu_curLeft = parseInt(dropdownMenu.css('left'));
17937							dropdownMenu.css('left', (dropdownMenu_curLeft + addleft) + 'px');
17938						}
17939					}
17940				}
17941			});
17942		}
17943	}, 10);
17944}
17945
17946if(!funcDefined("isRealValue")){
17947	function isRealValue(obj){
17948		return obj && obj !== "null" && obj!== "undefined";
17949	}
17950}
17951
17952if(!funcDefined("rightScroll")){
17953	function rightScroll(prop, id){
17954		var el = BX('prop_' + prop + '_' + id);
17955		if (el) {
17956			var curVal = parseInt(el.style.marginLeft);
17957			if (curVal >= 0) el.style.marginLeft = curVal - 20 + '%';
17958		}
17959	}
17960}
17961
17962if(!funcDefined("leftScroll")){
17963	function leftScroll(prop, id){
17964		var el = BX('prop_' + prop + '_' + id);
17965		if (el) {
17966			var curVal = parseInt(el.style.marginLeft);
17967			if (curVal < 0) el.style.marginLeft = curVal + 20 + '%';
17968		}
17969	}
17970}
17971
17972
17973if(!funcDefined("InitOrderCustom")){
17974	InitOrderCustom = function () {
17975		$('.ps_logo img').wrap('<div class="image"></div>');
17976
17977		$('#bx-soa-order .radio-inline').each(function() {
17978			if ($(this).find('input').attr('checked') == 'checked') {
17979				$(this).addClass('checked');
17980			}
17981		});
17982
17983		$('#bx-soa-order .checkbox input[type=checkbox]').each(function() {
17984			if ($(this).attr('checked') == 'checked')
17985				$(this).parent().addClass('checked');
17986		});
17987
17988		$('#bx-soa-order .bx-authform-starrequired').each(function() {
17989			var html = $(this).html();
17990			var $label = $(this).closest('label').length ? $(this).closest('label') : $(this).closest('.bx-authform-label-container');
17991			var $captcha = $label.find('.bx-captcha');
17992			if($captcha.length){
17993				$('<span class="bx-authform-starrequired"> '+ html + '</span>').insertBefore($captcha);
17994			}
17995			else{
17996				$label.append('<span class="bx-authform-starrequired"> '+ html + '</span>');
17997			}
17998			$(this).remove();
17999		});
18000
18001		$('.bx_ordercart_coupon').each(function() {
18002			if ($(this).find('.bad').length)
18003				$(this).addClass('bad');
18004			else if ($(this).find('.good').length)
18005				$(this).addClass('good');
18006		});
18007
18008		/*if (typeof(propsMap) !== 'undefined') {
18009			$(propsMap).on('click', function () {
18010				var value = $('#orderDescription').val();
18011				if ($('#orderDescription')) {
18012					if (value != '') {
18013						$('#orderDescription').closest('.form-group').addClass('value_y');
18014					}
18015				}
18016			});
18017		}*/
18018	}
18019}
18020
18021if(!funcDefined("InitLabelAnimation")){
18022	InitLabelAnimation = function(className) {
18023		// Fix order labels
18024		if (!$(className).length) {
18025			return;
18026		}
18027		$(className).find('.form-group').each(function() {
18028			if ($(this).find('input[type=text], textarea').length && !$(this).find('.dropdown-block').length && $(this).find('input[type=text], textarea').val() != '') {
18029				$(this).addClass('value_y');
18030			}
18031		});
18032
18033		$(document).on('click', className+' .form-group:not(.bx-soa-pp-field) label', function() {
18034			$(this).parent().find('input, textarea').focus();
18035		});
18036
18037		$(document).on('focusout', className+' .form-group:not(.bx-soa-pp-field) input, '+className+' .form-group:not(.bx-soa-pp-field) textarea', function() {
18038			var value = $(this).val();
18039			if (value != '' && !$(this).closest('.form-group').find('.dropdown-block').length && !$(this).closest('.form-group').find('#profile_change').length) {
18040				$(this).closest('.form-group').addClass('value_y');
18041			}else{
18042				$(this).closest('.form-group').removeClass('value_y');
18043			}
18044		});
18045
18046		$(document).on('focus', className+' .form-group:not(.bx-soa-pp-field) input, '+className+' .form-group:not(.bx-soa-pp-field) textarea', function() {
18047			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 ) {
18048				$(this).closest('.form-group').addClass('value_y');
18049			}
18050		});
18051	};
18052}
18053
18054checkPopupWidth = function(){
18055	$('.popup.show').each(function() {
18056		var width_form = $(this).actual('width');
18057		$(this).css({
18058			'margin-left': ($(window).width() > width_form ? '-' + width_form / 2 + 'px' : '-' + $(window).width() / 2 + 'px'),
18059		});
18060	});
18061}
18062
18063checkCaptchaWidth = function(){
18064	$('.captcha-row').each(function() {
18065		var width = $(this).actual('width');
18066		if($(this).hasClass('b')){
18067			if(width > 320){
18068				$(this).removeClass('b');
18069			}
18070		}
18071		else{
18072			if(width <= 320){
18073				$(this).addClass('b');
18074			}
18075		}
18076	});
18077}
18078
18079checkFormWidth = function(){
18080	$('.form .form_left').each(function() {
18081		var form = $(this).parents('.form');
18082		var width = form.actual('width');
18083		if(form.hasClass('b')){
18084			if(width > 417){
18085				form.removeClass('b');
18086			}
18087		}
18088		else{
18089			if(width <= 417){
18090				form.addClass('b');
18091			}
18092		}
18093	});
18094}
18095
18096checkFormControlWidth = function(){
18097	$('.form-control').each(function() {
18098		var width = $(this).actual('width');
18099		var labelWidth = $(this).find('label:not(.error) > span').actual('width');
18100		var errorWidth = $(this).find('label.error').actual('width');
18101		if(errorWidth > 0){
18102			if($(this).hasClass('h')){
18103				if(width > (labelWidth + errorWidth + 5)){
18104					$(this).removeClass('h');
18105				}
18106			}
18107			else{
18108				if(width <= (labelWidth + errorWidth + 5)){
18109					$(this).addClass('h');
18110				}
18111			}
18112		}
18113		else{
18114			$(this).removeClass('h');
18115		}
18116	});
18117}
18118
18119scrollToTop = function(){
18120	if(arNextOptions['THEME']['SCROLLTOTOP_TYPE'] !== 'NONE'){
18121		var _isScrolling = false;
18122		// Append Button
18123		$('body').append($('<a />').addClass('scroll-to-top ' + arNextOptions['THEME']['SCROLLTOTOP_TYPE'] + ' ' + arNextOptions['THEME']['SCROLLTOTOP_POSITION']).attr({'href': '#', 'id': 'scrollToTop'}));
18124		$('#scrollToTop').click(function(e){
18125			e.preventDefault();
18126			$('body, html').animate({scrollTop : 0}, 500);
18127			return false;
18128		});
18129		// Show/Hide Button on Window Scroll event.
18130		$(window).scroll(function(){
18131			if(!_isScrolling) {
18132				_isScrolling = true;
18133				if($(window).scrollTop() > 150){
18134					$('#scrollToTop').stop(true, true).addClass('visible');
18135					_isScrolling = false;
18136				}
18137				else{
18138					$('#scrollToTop').stop(true, true).removeClass('visible');
18139					_isScrolling = false;
18140				}
18141				checkScrollToTop();
18142			}
18143		});
18144	}
18145}
18146
18147checkScrollToTop = function(){
18148	var bottom = 55,
18149		scrollVal = $(window).scrollTop(),
18150		windowHeight = $(window).height(),
18151		footerOffset = 0;
18152	if($('footer').length)
18153		footerOffset = $('footer').offset().top +70;
18154
18155	if(arNextOptions['THEME']['SCROLLTOTOP_POSITION'] == 'CONTENT'){
18156		warpperWidth = $('body > .wrapper > .wrapper_inner').width();
18157		$('#scrollToTop').css('margin-left', Math.ceil(warpperWidth / 2) + 23);
18158	}
18159
18160	if(scrollVal + windowHeight > footerOffset){
18161		$('#scrollToTop').css('bottom', bottom  + scrollVal + windowHeight - footerOffset + 40);
18162	}
18163	else if(parseInt($('#scrollToTop').css('bottom')) > bottom){
18164		$('#scrollToTop').css('bottom', bottom);
18165	}
18166}
18167
18168CheckObjectsSizes = function() {
18169	$('.container iframe,.container object,.container video').each(function() {
18170		var height_attr = $(this).attr('height');
18171		var width_attr = $(this).attr('width');
18172		if (height_attr && width_attr) {
18173			$(this).css('height', $(this).outerWidth() * height_attr / width_attr);
18174		}
18175	});
18176}
18177
18178if(!funcDefined('reloadTopBasket')){
18179	var reloadTopBasket = function reloadTopBasket(action, basketWindow, speed, delay, slideDown, item){
18180		var obj={
18181				"PARAMS": $('#top_basket_params').val(),
18182				"ACTION": action
18183			};
18184		if(typeof item !== "undefined" ){
18185			obj.delete_top_item='Y';
18186			obj.delete_top_item_id=item.data('id');
18187		}
18188		// $.post( arNextOptions['SITE_DIR']+"ajax/show_basket_popup.php", obj, $.proxy(function( data ){
18189		$.post( arNextOptions['SITE_DIR']+"ajax/show_basket_actual.php", obj, $.proxy(function( data ){
18190			$(basketWindow).html(data);
18191
18192			getActualBasket();
18193
18194			var eventdata = {action:'loadBasket'};
18195			BX.onCustomEvent('onCompleteAction', [eventdata]);
18196
18197			/*if(arNextOptions['THEME']['SHOW_BASKET_ONADDTOCART'] !== 'N'){
18198				if($(window).outerWidth() > 520){
18199					if(slideDown=="Y")
18200						$(basketWindow).find('.basket_popup_wrapp').stop(true,true).slideDown(speed);
18201					clearTimeout(basketTimeoutSlide);
18202					basketTimeoutSlide = setTimeout(function() {
18203						var _this = $('#basket_line').find('.basket_popup_wrapp');
18204						if (_this.is(':hover')) {
18205							_this.show();
18206						}else{
18207							$('#basket_line').find('.basket_popup_wrapp').slideUp(speed);
18208						}
18209					},delay);
18210				}
18211			}*/
18212		}))
18213	}
18214}
18215
18216CheckTabActive = function(){
18217	if(typeof(clicked_tab) && clicked_tab)
18218	{
18219		if(window.matchMedia('(min-width: 768px)').matches)
18220		{
18221			clicked_tab--;
18222			$('.nav.nav-tabs li').each(function(){
18223				if($(this).index() == clicked_tab)
18224					$(this).addClass('active');
18225			})
18226			// $('.nav.nav-tabs li:eq('+clicked_tab+')').addClass('active');
18227			$('.catalog_detail .tab-content .tab-pane:eq('+clicked_tab+')').addClass('active');
18228			$('.catalog_detail .tab-content .tab-pane .title-tab-heading').next().removeAttr('style');
18229			clicked_tab = 0;
18230		}
18231	}
18232}
18233
18234/*countdown start*/
18235if(!funcDefined('initCountdown')){
18236	var initCountdown = function initCountdown(){
18237		if( $('.view_sale_block').size() ){
18238			$('.view_sale_block').each(function(){
18239				var activeTo=$(this).find('.active_to').text(),
18240					dateTo= new Date(activeTo.replace(/(\d+)\.(\d+)\.(\d+)/, '$3/$2/$1'));
18241				$(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']);
18242			})
18243		}
18244	}
18245}
18246
18247if(!funcDefined('initCountdownTime')){
18248	var initCountdownTime = function initCountdownTime(block, time){
18249		if(time)
18250		{
18251			var dateTo= new Date(time.replace(/(\d+)\.(\d+)\.(\d+)/, '$3/$2/$1'));
18252			block.find('.countdown').countdown('destroy');
18253			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']);
18254			block.find('.view_sale_block').show();
18255		}
18256		else
18257		{
18258			block.find('.view_sale_block').hide();
18259		}
18260	}
18261}
18262/*countdown end*/
18263
18264waitCounter = function(idCounter, delay, callback){
18265	var obCounter = window['yaCounter' + idCounter];
18266	if(typeof obCounter == 'object')
18267	{
18268		if(typeof callback == 'function')
18269			callback();
18270
18271	}
18272	else
18273	{
18274		setTimeout(function(){
18275			waitCounter(idCounter, delay, callback);
18276		}, delay);
18277	}
18278}
18279
18280var isOnceInited = insertFilter = false;
18281var animationTime = 200;
18282var delayTime = 200;
18283var topMenuEnterTimer = false;
18284var isMobile = jQuery.browser.mobile;
18285
18286if(isMobile){
18287	document.documentElement.className += ' mobile';
18288}
18289
18290if(navigator.userAgent.indexOf("Edge") != -1){
18291	document.documentElement.className += ' bx-ie-edge';
18292}
18293
18294// ONE CLICK
18295if(!funcDefined("oneClickBuy")) {
18296	var oneClickBuy = function (elementID, iblockID, that) {
18297		var name = 'one_click_buy';
18298		var elementQuantity = 1;
18299		var offerProps = false;
18300		var buy_btn=$(that).closest('.buy_block').find('.to-cart');
18301		var buy_btn2=$(that).closest('tr').find('.to-cart');
18302
18303		if(typeof(that) !== 'undefined'){
18304			elementQuantity = $(that).attr('data-quantity');
18305			offerProps = $(that).attr('data-props');
18306		}
18307
18308		if(elementQuantity < 0){
18309			elementQuantity = 1;
18310		}
18311
18312		var tmp_props=buy_btn.data("props"),
18313			tmp_props2=buy_btn2.data("props"),
18314			props='',
18315			part_props='',
18316			add_props='N',
18317			fill_prop={},
18318			iblockid = buy_btn.data('iblockid'),
18319			item = buy_btn.attr('data-item');
18320
18321		if(tmp_props){
18322			props=tmp_props.toString().split(";");
18323		}else if(tmp_props2){
18324			props=tmp_props2.toString().split(";");
18325		}
18326		if(buy_btn.data("part_props")){
18327			part_props=buy_btn.data("part_props");
18328		}
18329		if(buy_btn.data("add_props")){
18330			add_props=buy_btn.data("add_props");
18331		}
18332
18333		fill_prop=fillBasketPropsExt(buy_btn, 'prop', buy_btn.data('bakset_div'));
18334		fill_prop.iblockID=iblockid;
18335		fill_prop.part_props=part_props;
18336		fill_prop.add_props=add_props;
18337		fill_prop.props=JSON.stringify(props);
18338		fill_prop.item=item;
18339		fill_prop.ocb_item="Y";
18340
18341		if(window.matchMedia('(min-width:992px)').matches)
18342		{
18343			if(!$(that).hasClass('clicked'))
18344			{
18345				$(that).addClass('clicked');
18346				$('body').find('.'+name+'_frame').remove();
18347				$('body').find('.'+name+'_trigger').remove();
18348				$('body').append('<div class="'+name+'_frame popup"></div>');
18349				$('body').append('<div class="'+name+'_trigger"></div>');
18350				$('.'+name+'_frame').jqm({trigger: '.'+name+'_trigger', onHide: function(hash) { onHidejqm(name,hash); }, toTop: false, onLoad: function( hash ){ onLoadjqm(name, hash ); }, ajax: arNextOptions["SITE_DIR"]+'ajax/one_click_buy.php?ELEMENT_ID='+elementID+'&IBLOCK_ID='+iblockID+'&ELEMENT_QUANTITY='+elementQuantity+'&OFFER_PROPS='+fill_prop.props});
18351				$('.'+name+'_trigger').click();
18352			}
18353		}
18354		else
18355		{
18356			var script = arNextOptions['SITE_DIR'] + 'form/';
18357			script += '?name='+name+'&form_id=ocb&path='+window.location.pathname+'&ELEMENT_ID='+elementID+'&IBLOCK_ID='+iblockID+'&ELEMENT_QUANTITY='+elementQuantity+'&OFFER_PROPS='+fill_prop.props
18358			location.href = script;
18359		}
18360	}
18361}
18362
18363if(!funcDefined("oneClickBuyBasket")) {
18364	var oneClickBuyBasket = function () {
18365		name = 'one_click_buy_basket';
18366		if(window.matchMedia('(min-width:992px)').matches)
18367		{
18368			if(!$('.fast_order').hasClass('clicked'))
18369			{
18370				$('.fast_order').addClass('clicked');
18371				$('body').find('.'+name+'_frame').remove();
18372				$('body').find('.'+name+'_trigger').remove();
18373				$('body').append('<div class="'+name+'_frame popup"></div>');
18374				$('body').append('<div class="'+name+'_trigger"></div>');
18375				$('.'+name+'_frame').jqm({trigger: '.'+name+'_trigger', onHide: function(hash) { onHidejqm(name,hash) }, onLoad: function( hash ){ onLoadjqm( name, hash ); }
18375, ajax: arNextOptions["SITE_DIR"]+'ajax/one_click_buy_basket.php'});
18376				$('.'+name+'_trigger').click();
18377			}
18378		}
18379		else
18380		{
18381			var script = arNextOptions['SITE_DIR'] + 'form/';
18382			script += '?name='+name+'&form_id=ocb&path='+window.location.pathname+'&buy_basket=y';
18383			location.href = script;
18384		}
18385	}
18386}
18387
18388// TOP MENU ANIMATION
18389$(document).on('click', '.menu_top_block>li .more a', function(){
18390	$this = $(this);
18391	$this.parents('.dropdown').first().find('>.hidden').removeClass('hidden');
18392	$this.parent().addClass('hidden');
18393	setTimeout(function(){
18394		$this.parent().remove();
18395	}, 500);
18396});
18397
18398$(document).on('mouseenter', '.menu_top_block.catalogfirst>li>.dropdown>li.full', function(){
18399	var $submenu = $(this).find('>.dropdown');
18400
18401	if($submenu.length){
18402		if(topMenuEnterTimer){
18403			clearTimeout(topMenuEnterTimer);
18404			topMenuEnterTimer = false;
18405		}
18406	}
18407});
18408
18409$(document).on('mouseenter', '.menu_top_block>li:not(.full)', function(){
18410	var $submenu = $(this).find('>.dropdown');
18411
18412	if($submenu.length && !$submenu.hasClass('visible')){
18413		var $menu = $(this).parents('.menu');
18414		var $wrapmenu = $menu.parents('.wrap_menu');
18415		var wrapMenuWidth = $wrapmenu.actual('outerWidth');
18416		var wrapMenuLeft = $wrapmenu.offset().left;
18417		var wrapMenuRight = wrapMenuLeft + wrapMenuWidth;
18418		var left = wrapMenuRight - ($(this).offset().left + $submenu.actual('outerWidth'));
18419		if(window.matchMedia('(min-width: 951px)').matches && $(this).hasClass('catalog') && ( $('.banner_auto').hasClass('catalog_page') || $('.banner_auto').hasClass('front_page'))){
18420			return;
18421		}
18422		if(left < 0){
18423			$submenu.css({left: left + 'px'});
18424		}
18425		$submenu.stop().slideDown(animationTime, function(){
18426			$submenu.css({height: '', 'overflow':'visible'});
18427		});
18428
18429
18430		$(this).on('mouseleave', function(){
18431			var leaveTimer = setTimeout(function(){
18432				$submenu.stop().slideUp(animationTime, function(){
18433					$submenu.css({left: ''});
18434				});
18435			}, delayTime);
18436
18437			$(this).on('mouseenter', function(){
18438				if(leaveTimer){
18439					clearTimeout(leaveTimer);
18440					leaveTimer = false;
18441				}
18442			});
18443		});
18444	}
18445});
18446
18447$(document).on('mouseenter', '.menu_top_block>li .dropdown>li', function(){
18448	var $this = $(this);
18449	var $submenu = $this.find('>.dropdown');
18450
18451	if($submenu.length && ((!$this.parents('.full').length && !$this.hasClass('full')) || $this.parents('.more').length)){
18452		var $menu = $this.parents('.menu');
18453		var $wrapmenu = $menu.parents('.wrap_menu');
18454		var arParentSubmenuForOpacity = [];
18455		topMenuEnterTimer = setTimeout(function(){
18456
18457			var wrapMenuWidth = $wrapmenu.actual('outerWidth');
18458			var wrapMenuLeft = $wrapmenu.offset().left;
18459			var wrapMenuRight = wrapMenuLeft + wrapMenuWidth;
18460			var $parentSubmenu = $this.parent();
18461			var bToLeft = $parentSubmenu.hasClass('toleft') ? true : false;
18462			if(!bToLeft){
18463				bToLeft = $this.offset().left + $this.actual('outerWidth') + $submenu.actual('outerWidth') > wrapMenuRight;
18464			}
18465			else{
18466				bToLeft = $this.offset().left + $this.actual('outerWidth') - $submenu.actual('outerWidth') < wrapMenuLeft;
18467			}
18468
18469			if(bToLeft){
18470				$this.find('>.dropdown').addClass('toleft').show();
18471			}
18472			else{
18473				$this.find('>.dropdown').removeClass('toleft').show();
18474			}
18475			var submenuLeft = $submenu.offset().left;
18476			var submenuRight = submenuLeft + $submenu.actual('outerWidth');
18477
18478			$this.parents('.dropdown').each(function(){
18479				var $this = $(this);
18480				var leftOffset = $this.offset().left;
18481				var rightOffset = leftOffset + $this.actual('outerWidth');
18482				if(leftOffset >= submenuLeft  && leftOffset < (submenuRight - 1) || (rightOffset > (submenuLeft + 1) && rightOffset <= submenuRight)){
18483					arParentSubmenuForOpacity.push($this);
18484					$this.find('>li>a').css({opacity: '0.1'});
18485				}
18486			});
18487		}, delayTime);
18488
18489		$this.unbind('mouseleave');
18490		$this.on('mouseleave', function(){
18491			var leaveTimer = setTimeout(function(){
18492				$this.find('.dropdown').removeClass('toleft').hide();
18493				if(arParentSubmenuForOpacity.length){
18494					for(i in arParentSubmenuForOpacity){
18495						arParentSubmenuForOpacity[i].find('>li>a').css({opacity: ''});
18496					}
18497				}
18498			}, delayTime);
18499
18500			$this.unbind('mouseenter');
18501			$this.on('mouseenter', function(){
18502				if(leaveTimer){
18503					clearTimeout(leaveTimer);
18504					leaveTimer = false;
18505				}
18506			});
18507		});
18508	}
18509});
18510
18511/*hover animate*/
18512	//top menu
18513	$(document).on('mouseenter', '.menu .mega-menu table td, .menu-row .mega-menu table td', function(){
18514
18515		var _this = $(this),
18516			menu = _this.find('> .wrap > .dropdown-menu');
18517
18518		if(!_this.hasClass('wide_menu'))
18519		{
18520			menu.show();
18521			CheckTopVisibleMenu();
18522		}
18523
18524		var bDarkness = $('.wrapper1.dark-hover-overlay').length > 0;
18525
18526		menu.velocity('stop');
18527
18528		if(menu.css('opacity') != 0)
18529		{
18530			menu.css('opacity' , '1');
18531		}
18532		else
18533		{
18534			menu.velocity('fadeIn', {
18535				duration: 150,
18536				delay: 250,
18537				complete: function(){
18538
18539				}
18540			});
18541		}
18542
18543		_this.one('mouseleave', function(){
18544			menu.velocity('stop').velocity('fadeOut', {
18545				duration: 50,
18546				delay: 300,
18547				complete: function(){
18548				}
18549			});
18550		});
18551	});
18552/**/
18553
18554$(document).on('mouseenter', '.menu-item:not(.wide_menu) .dropdown-menu .dropdown-submenu', function(){
18555	var _this = $(this),
18556		menu = _this.find('> .dropdown-menu');
18557
18558	menu.velocity('stop');
18559
18560	if(menu.css('opacity') != 0)
18561	{
18562		menu.css('opacity' , '1');
18563	}
18564	else
18565	{
18566		menu.velocity('transition.fadeIn', {
18567			duration: 300,
18568			delay: 250
18569		});
18570	}
18571
18572	_this.one('mouseleave', function(){
18573		menu.velocity('stop').velocity('fadeOut', {
18574			duration: 150,
18575			delay: 300
18576		});
18577	});
18578})
18579
18580getGridSize = function(counts,slider) {
18581	var counts_item=1;
18582		//wide
18583		if(window.matchMedia('(min-width: 1200px)').matches){
18584			counts_item=counts[0];
18585			if(typeof(slider.data('lg_count')) !== 'undefined' && slider.data('lg_count') && $('.front.wide_page').length)
18586				counts_item=slider.data('lg_count');
18587		}
18588
18589		//large
18590		if(window.matchMedia('(max-width: 1200px)').matches){
18591			counts_item=counts[1];
18592		}
18593
18594		//middle
18595		if(window.matchMedia('(max-width: 992px)').matches){
18596			counts_item=counts[2];
18597		}
18598
18599		//small
18600		if(counts[3]){
18601			if(window.matchMedia('(max-width: 600px)').matches){
18602				counts_item=counts[3];
18603			}
18604		}
18605
18606		//exsmall
18607		if(counts[4]){
18608			if(window.matchMedia('(max-width: 400px)').matches){
18609				counts_item=counts[4];
18610			}
18611		}
18612	return counts_item;
18613}
18614
18615CheckFlexSlider = function(){
18616	$('.flexslider:not(.thmb)').each(function(){
18617		var slider = $(this);
18618		if(typeof(slider.data('flexslider')) != 'undefined')
18619		{
18620			if('vars' in slider.data('flexslider'))
18621			{
18622				slider.resize();
18623
18624				var counts = slider.data('flexslider').vars.counts;
18625				if(typeof(counts) != 'undefined' && slider.is(':visible')){
18626					var cnt = getGridSize(counts,slider);
18627					var to0 = (cnt != slider.data('flexslider').vars.minItems || cnt != slider.data('flexslider').vars.maxItems || cnt != slider.data('flexslider').vars.move);
18628					if(to0){
18629						slider.data('flexslider').vars.minItems = cnt;
18630						slider.data('flexslider').vars.maxItems = cnt;
18631						slider.data('flexslider').vars.move = cnt;
18632						slider.flexslider(0);
18633						slider.resize();
18634						slider.resize(); // twise!
18635					}
18636				}
18637			}
18638		}
18639	});
18640}
18641
18642InitFlexSlider = function() {
18643	$('.flexslider:not(.thmb):not(.flexslider-init)').each(function(){
18644		var slider = $(this);
18645		var options;
18646		var defaults = {
18647			animationLoop: false,
18648			controlNav: false,
18649			keyboard: false,
18650			pauseOnAction: false,
18651			pauseInvisible: false,
18652			directionNav: true,
18653			useCSS: false,
18654			animation: "slide"
18655		}
18656		var config = $.extend({}, defaults, options, slider.data('plugin-options'));
18657		if(!slider.parent().hasClass('top_slider_wrapp') && slider.is(':visible')){
18658			if(typeof(config.counts) != 'undefined' && config.direction !== 'vertical'){
18659				config.maxItems =  getGridSize(config.counts,slider);
18660				config.minItems = getGridSize(config.counts,slider);
18661				if (!config.itemWidth) {
18662					config.itemWidth = 200;
18663				}
18664			}
18665			if(typeof(config.move) == 'undefined')
18666				config.move = 1;
18667
18668			config.start = function(slider){
18669				var eventdata = {slider: slider};
18670				BX.onCustomEvent('onSlideInit', [eventdata]);
18671			}
18672
18673			config.after = function(slider){
18674				var eventdata = {slider: slider};
18675				BX.onCustomEvent('onSlideComplete', [eventdata]);
18676			}
18677
18678			config.end = function(slider){
18679				var eventdata = {slider: slider};
18680				BX.onCustomEvent('onSlideEnd', [eventdata]);
18681			}
18682
18683			slider.flexslider(config).addClass('flexslider-init');
18684			if(config.controlNav)
18685				slider.addClass('flexslider-control-nav');
18686			if(config.directionNav)
18687				slider.addClass('flexslider-direction-nav');
18688		}
18689	});
18690}
18691
18692InitZoomPict = function(el) {
18693	var block = $('.zoom_picture');
18694	if(typeof el !== 'undefined')
18695		block = el;
18696	if(block.length){
18697		var slide=block.closest('.slides');
18698		var zoomer = block,
18699			options,
18700			defaults = {
18701				zoomWidth: 200,
18702				zoomHeight: 200,
18703				adaptive: false,
18704				title: true,
18705				Xoffset: 15,
18706
18707			};
18708		var config = $.extend({}, defaults, options, zoomer.data('plugin-options'));
18709			zoomer.xzoom(config);
18710
18711		/*block.on('mouseleave', function(){
18712			if($('.xzoom-lens').length)
18713				block.data('xzoom').closezoom();
18714		})*/
18715		block.on('mouseleave', function(){
18716			block.data('xzoom').movezoom(event);
18717		})
18718	}
18719}
18720
18721var arBasketAsproCounters = arStatusBasketAspro = arBasketPrices = {};
18722SetActualBasketFlyCounters = function(){
18723	if(arBasketAsproCounters.DEFAULT == true){
18724		$.ajax({
18725			url: arNextOptions['SITE_DIR'] + 'ajax/basket_fly.php',
18726			type: 'post',
18727			success: function(html){
18728				$('#basket_line .basket_fly').removeClass('loaded').html(html);
18729			}
18730		});
18731	}
18732	else{
18733		$('.basket_fly .opener .basket_count .count').attr('class', 'count' + (arBasketAsproCounters.READY.COUNT > 0 ? '' : ' empty_items')).find('.items span').text(arBasketAsproCounters.READY.COUNT)
18734		$('.basket_fly .opener .basket_count + a').attr('href', arBasketAsproCounters['READY']['HREF'])
18735		$('.basket_fly .opener .basket_count').attr('title', arBasketAsproCounters.READY.TITLE).attr('class', 'basket_count small clicked' + (arBasketAsproCounters.READY.COUNT > 0 ? '' : ' empty'))
18736
18737		$('.basket_fly .opener .wish_count .count').attr('class', 'count' + (arBasketAsproCounters.DELAY.COUNT > 0 ? '' : ' empty_items')).find('.items span').text(arBasketAsproCounters.DELAY.COUNT)
18738		$('.basket_fly .opener .wish_count + a').attr('href', arBasketAsproCounters.DELAY.HREF)
18739		$('.basket_fly .opener .wish_count').attr('title', arBasketAsproCounters.DELAY.TITLE).attr('class', 'wish_count small clicked' + (arBasketAsproCounters.DELAY.COUNT > 0 ? '' : ' empty'))
18740
18741		$('.basket_fly .opener .compare_count .wraps_icon_block').attr('class', 'wraps_icon_block compare' + (arBasketAsproCounters.COMPARE.COUNT > 0 ? '' : ' empty_block'));
18742		$('.basket_fly .opener .compare_count .count').attr('class', 'count' + (arBasketAsproCounters.COMPARE.COUNT > 0 ? '' : ' empty_items')).find('.items span').text(arBasketAsproCounters.COMPARE.COUNT)
18743		$('.basket_fly .opener .compare_count + a').attr('href', arBasketAsproCounters.COMPARE.HREF)
18744
18745	}
18746}
18747
18748CheckHeaderFixed = function(){
18749	var header = $('header, #headerSimple').first(),
18750		header_fixed = $('#headerfixed, #headerSimple');
18751
18752	if(header_fixed.length){
18753		if(header.length){
18754			var isHeaderFixed = false,
18755				headerCanFix = true,
18756				headerFixedHeight = header_fixed.actual('outerHeight'),
18757				headerNormalHeight = header.actual('outerHeight'),
18758				headerDiffHeight = headerNormalHeight - headerFixedHeight,
18759				mobileBtnMenu = $('.btn.btn-responsive-nav'),
18760				headerTop = $('#panel:visible').actual('outerHeight'),
18761				topBlock = $('.TOP_HEADER').first(),
18762				$headerFixedNlo = header_fixed.find('[data-nlo]'),
18763				isNloLoaded = !$headerFixedNlo.length,
18764				OnHeaderFixedScrollHandler;
18765
18766			if(headerDiffHeight <= 0)
18767				headerDiffHeight = 0;
18768
18769			if(topBlock.length)
18770				headerTop += topBlock.actual('outerHeight');
18771
18772			$(window).scroll(OnHeaderFixedScrollHandler = function(){
18773				var tabs_fixed = $('.product-item-detail-tabs-container-fixed');
18774
18775				if(window.matchMedia('(min-width:768px)').matches){
18776					var scrollTop = $(window).scrollTop(),
18777						tabs_offset = $('.tabs_section .nav.nav-tabs').offset(),
18778						current_is = $('.search-wrapper .search-input:visible'),
18779						headerCanFix = !mobileBtnMenu.is(':visible')/* && !$('.dropdown-menu:visible').length*/;
18780
18781					if(!isHeaderFixed){
18782						if(
18783							headerCanFix &&
18784							(scrollTop > headerNormalHeight + headerTop)
18785						){
18786							if(!isNloLoaded){
18787								if(!$headerFixedNlo.hasClass('nlo-loadings')){
18788									$headerFixedNlo.addClass('nlo-loadings');
18789									setTimeout(function(){
18790										$.ajax({
18791											data: {nlo: $headerFixedNlo.attr('data-nlo')},
18792											success: function(response){
18793												// stop ya metrika webvisor DOM indexer
18794												pauseYmObserver();
18795
18796												isNloLoaded = true;
18797												$headerFixedNlo[0].insertAdjacentHTML('beforebegin', $.trim(response));
18798												$headerFixedNlo.remove();
18799
18800												InitMenuNavigationAim();
18801												OnHeaderFixedScrollHandler();
18802
18803												// resume ya metrika webvisor
18804												// (300ms transition) + (100 ms scroll handler)
18805												setTimeout(resumeYmObserver, 400);
18806												
18807												$('nav.mega-menu.sliced.initied').removeClass('initied');
18808                                				CheckTopMenuDotted();
18809
18810											},
18811											error:function(){
18812												$headerFixedNlo.removeClass('nlo-loadings');
18813											}
18814										});
18815									}, 300);
18816								}
18817							}
18818							else{
18819								isHeaderFixed = true;
18820								header_fixed.addClass('fixed');
18821								headerSimpleHeight = $('#headerSimple').actual('outerHeight');
18822								$('#headerSimple').closest('.header-wrapper').css({'margin-top': headerSimpleHeight});
18823
18824								$('nav.mega-menu.sliced.initied').removeClass('initied');
18825								CheckTopMenuDotted();
18826							}
18827
18828						}
18829					}
18830					else{
18831						if(
18832							isHeaderFixed ||
18833							!headerCanFix
18834						){
18835							if(
18836								!headerCanFix ||
18837								(scrollTop <= headerDiffHeight + headerTop)
18838							){
18839								isHeaderFixed = false;
18840								header_fixed.removeClass('fixed');
18841								$('#headerSimple').closest('.header-wrapper').css({'margin-top': 0});
18842							}
18843						}
18844					}
18845
18846					//fixed tabs
18847					if(tabs_fixed.length){
18848						if(scrollTop + headerFixedHeight > tabs_offset.top){
18849							tabs_fixed.css({'top': header_fixed.actual('outerHeight')});
18850							tabs_fixed.addClass('fixed');
18851						}
18852						else if(tabs_fixed.hasClass('fixed')){
18853							tabs_fixed.removeAttr('style');
18854							tabs_fixed.removeClass('fixed');
18855						}
18856					}
18857				}
18858			});
18859		}
18860	}
18861
18862	//mobile fixed
18863	var mfixed = $('.wrapper1.mfixed_Y #mobileheader, .wrapper1.mfixed_Y #mobileheadersimple');
18864	if(mfixed.length && isMobile)
18865	{
18866		var isMHeaderFixed = false,
18867			mheaderCanFix = true,
18868			//mheaderFixedHeight = mfixed.actual('outerHeight'),
18869			mheaderFixedHeight = 0,
18870			mheaderTop = $('#panel:visible').actual('outerHeight');
18871		$(window).scroll(function(){
18872			var scrollTop = $(window).scrollTop();
18873			if(window.matchMedia('(max-width:991px)').matches)
18874			{
18875				if($('.wrapper1.mfixed_Y.mfixed_view_scroll_top #mobileheader').length || $('.wrapper1.mfixed_Y.mfixed_view_scroll_top #mobileheadersimple').length)
18876				{
18877					if(scrollTop > startScroll)
18878					{
18879						$('.wrapper1.mfixed_Y.mfixed_view_scroll_top #mobileheader').removeClass('fixed');
18880						$('.wrapper1.mfixed_Y.mfixed_view_scroll_top #mobileheadersimple').removeClass('fixed');
18881					}
18882					else if(scrollTop > mheaderFixedHeight + mheaderTop){
18883						$('.wrapper1.mfixed_Y.mfixed_view_scroll_top #mobileheader').addClass('fixed');
18884						$('.wrapper1.mfixed_Y.mfixed_view_scroll_top #mobileheadersimple').addClass('fixed');
18885					}
18886					else if(scrollTop <= mheaderFixedHeight + mheaderTop){
18887						$('.wrapper1.mfixed_Y.mfixed_view_scroll_top #mobileheader').removeClass('fixed');
18888						$('.wrapper1.mfixed_Y.mfixed_view_scroll_top #mobileheadersimple').removeClass('fixed');
18889					}
18890					startScroll = scrollTop;
18891				}
18892				else
18893				{
18894					if(!isMHeaderFixed)
18895					{
18896						if((scrollTop > mheaderFixedHeight + mheaderTop))
18897						{
18898							isMHeaderFixed = true;
18899							mfixed.addClass('fixed');
18900						}
18901					}
18902					else if(isMHeaderFixed)
18903					{
18904						if((scrollTop <= mheaderFixedHeight + mheaderTop))
18905						{
18906							isMHeaderFixed = false;
18907							mfixed.removeClass('fixed');
18908						}
18909					}
18910				}
18911			}
18912			else
18913				mfixed.removeClass('fixed');
18914		})
18915	}
18916}
18917
18918CheckHeaderFixedMenu = function(){
18919	if(arNextOptions['THEME']['HEADER_FIXED'] == 2 && $('#headerfixed .js-nav').length && window.matchMedia('(min-width: 992px)').matches)
18920	{
18921		$('#headerfixed .js-nav').css('width','0');
18922		var all_width = 0,
18923			cont_width = $('#headerfixed .maxwidth-theme').actual('width'),
18924			padding_menu = $('#headerfixed .logo-row.v2 .menu-block').actual('outerWidth')-$('#headerfixed .logo-row.v2 .menu-block').actual('width');
18925		$('#headerfixed .logo-row.v2 > .inner-table-block').each(function(){
18926			if(!$(this).hasClass('menu-block'))
18927				all_width += $(this).actual('outerWidth');
18928		})
18929		$('#headerfixed .js-nav').width(cont_width-all_width-padding_menu);
18930	}
18931}
18932
18933CheckTopMenuPadding = function(){
18934	if($('.logo_and_menu-row .right-icons .wrap_icon').length && $('.logo_and_menu-row .menu-row').length){
18935		var menuPosition = $('.menu-row .menu-only').position().left,
18936			leftPadding = 0,
18937			rightPadding = 0;
18938		$('.logo_and_menu-row .menu-row>div').each(function(indx){
18939			if(!$(this).hasClass('menu-only')){
18940				var elementPosition = $(this).position().left,
18941					elementWidth = $(this).outerWidth()+1;
18942
18943				if(elementPosition > menuPosition){
18944					rightPadding += elementWidth;
18945				}else{
18946					leftPadding += elementWidth;
18947				}
18948			}
18949		}).promise().done(function(){
18950			$('.logo_and_menu-row .menu-only').css({'padding-left': leftPadding, 'padding-right': rightPadding});
18951		});
18952	}
18953}
18954
18955CheckTopMenuOncePadding = function(){
18956	if($('.menu-row.sliced .right-icons .wrap_icon').length){
18957		var menuPosition = $('.menu-row .menu-only').position().left,
18958			leftPadding = 0,
18959			rightPadding = 0;
18960		$('.menu-row.sliced .maxwidth-theme>div>div>div').each(function(indx){
18961			if(!$(this).hasClass('menu-only')){
18962				var elementPosition = $(this).position().left,
18963					elementWidth = $(this).outerWidth()+1;
18964
18965				if(elementPosition > menuPosition){
18966					rightPadding += elementWidth;
18967				}else{
18968					leftPadding += elementWidth;
18969				}
18970			}
18971		}).promise().done(function(){
18972			$('.menu-row.sliced .menu-only').css({'padding-left': leftPadding, 'padding-right': rightPadding});
18973		});
18974	}
18975}
18976
18977CheckSearchWidth = function(){
18978	if($('.logo_and_menu-row .search_wrap').length){
18979		var searchPosition = $('.logo_and_menu-row .search_wrap').position().left,
18980			maxWidth = $('.logo_and_menu-row .maxwidth-theme').width() - 2;
18981			width = 0;
18982
18983		$('.logo_and_menu-row .maxwidth-theme > .row >div').each(function(){
18984			if(!$(this).hasClass('search_wrap')){
18985				var elementWidth = $(this).outerWidth();
18986				width = (width ? width - elementWidth : maxWidth - elementWidth);
18987			}
18988		}).promise().done(function(){
18989			if($('.logo_and_menu-row .search_wrap.wide_search').length)
18990				$('.logo_and_menu-row .search_wrap .search-block').outerWidth(width);
18991			else
18992				$('.logo_and_menu-row .search_wrap').outerWidth(width);
18993			$('.logo_and_menu-row .search_wrap').css({'opacity': 1, 'visibility': 'visible'});
18994		});
18995	}
18996}
18997
18998CheckPhoneDropdown = function(){
18999        var $footer = $('#footer');
19000        var $phoneDropdown = $('#footer .phone .dropdown');
19001        if($footer.length && $phoneDropdown.length){
19002                if($footer.offset().top+$footer.height() < $phoneDropdown.offset().top+$phoneDropdown.height()){
19003                        $phoneDropdown.css({'top':'-'+$phoneDropdown.height()+'px'});
19004                }
19005        }
19006};
19007
19008scrollPreviewBlock = function(){
19009	if(typeof($.cookie('scroll_block')) != 'undefined' && $.cookie('scroll_block'))
19010	{
19011		var scroll_block = $($.cookie('scroll_block'));
19012		if(scroll_block.length)
19013		{
19014			$('body, html').animate({scrollTop: scroll_block.offset().top}, 500);
19015		}
19016		$.cookie('scroll_block', null);
19017	}
19018}
19019
19020lazyLoadPagenBlock = function(){
19021    setTimeout(function(){
19022        if ($('.with-load-block .ajax_load_btn:not(.appear-block)').length) {
19023            $('.with-load-block .ajax_load_btn:not(.appear-block)').appear(function(){
19024                var $this = $(this);
19025                $this.addClass('appear-block').trigger('click');
19026
19027            }, {accX: 0, accY: 200})
19028        }
19029    }, 200)
19030}
19031
19032scrollToBlock = function(block){
19033	if($(block).length)
19034	{
19035		var offset = $(block).offset().top;
19036		if(typeof($(block).data('toggle')) != 'undefined')
19037			$(block).click();
19038
19039		if(typeof($(block).data('offset')) != 'undefined')
19040			offset += $(block).data('offset');
19041		$('body, html').animate({scrollTop: offset}, 500);
19042	}
19043}
19044
19045SetFixedAskBlock = function(){
19046	if($('.ask_a_question_wrapper').length)
19047	{
19048		var offset = $('.ask_a_question_wrapper').offset(),
19049			footer_offset = 0,
19050			block = $('.ask_a_question_wrapper').find('.ask_a_question'),
19051			block_offset = BX.pos(block[0]),
19052			block_height = block_offset.bottom-block_offset.top,
19053			diff_top_scroll = $('#headerfixed').height() + 20;
19054
19055		if($('footer').length)
19056			footer_offset = $('footer').offset().top;
19057
19058		if($('.banner.CONTENT_BOTTOM').length)
19059			footer_offset = $('.banner.CONTENT_BOTTOM').offset().top;
19060
19061		/* removed for ISSUE NEXT-414
19062		if(block_height+130 > block.closest('.fixed_wrapper').height())
19063			block.addClass('nonfixed');
19064		else
19065			block.removeClass('nonfixed');
19066		*/
19067
19068		if(block_height+diff_top_scroll+documentScrollTopLast + 130 > footer_offset)
19069		{
19070			block.removeClass('fixed').css({'top': 'auto', 'width': '', 'bottom': 0});
19071			block.parent().css('position', 'static');
19072			block.parent().parent().css('position', 'static');
19073		}
19074		else
19075		{
19076			block.parent().removeAttr('style');
19077			block.parent().parent().removeAttr('style');
19078
19079			if(documentScrollTopLast + diff_top_scroll > offset.top)
19080			{
19081				var fixed_width = $('.fixed_block_fix').width();
19082				block.addClass('fixed').css({'top': diff_top_scroll, 'bottom': 'auto'});
19083				if(fixed_width)
19084					block.css({'width': $('.fixed_block_fix').width()})
19085			}
19086			else
19087				block.removeClass('fixed').css({'top': 0, 'width': ''});
19088		}
19089	}
19090}
19091
19092MegaMenuFixed = function(){
19093	var animationTime = 150;
19094
19095	$('.logo_and_menu-row .burger').on('click', function(){
19096		$('.mega_fixed_menu').fadeIn(animationTime);
19097		$('.header_wrap').toggleClass('zindexed');
19098	});
19099
19100	$('.mega_fixed_menu .svg.svg-inline-close').on('click', function(){
19101		$(this).closest('.mega_fixed_menu').fadeOut(animationTime);
19102		$('.header_wrap').toggleClass('zindexed');
19103	});
19104
19105	$('.mega_fixed_menu .dropdown-menu .arrow').on('click', function(e){
19106		e.preventDefault();
19107		e.stopPropagation();
19108		$(this).closest('.dropdown-submenu').find('.dropdown-menu').slideToggle(animationTime);
19109		$(this).closest('.dropdown-submenu').addClass('opened');
19110	});
19111}
19112
19113CheckPopupTop = function(){
19114	var popup = $('.jqmWindow.show:last');
19115	if(!popup.length)
19116		popup = $('.jqmWindow.show');
19117	if(!popup.length)
19118		popup = $('.jqm-init.show');
19119	if(popup.length){
19120		var documentScollTop = $(document).scrollTop();
19121		var windowHeight = $(window).height();
19122		var popupTop = parseInt(popup.css('top'));
19123		var popupHeight = popup.height();
19124
19125		if(windowHeight >= popupHeight){
19126			// center
19127			popupTop = (windowHeight - popupHeight) / 2;
19128		}
19129		else{
19130			if(documentScollTop > documentScrollTopLast){
19131				// up
19132				popupTop -= documentScollTop - documentScrollTopLast;
19133			}
19134			else if(documentScollTop < documentScrollTopLast){
19135				// down
19136				popupTop += documentScrollTopLast - documentScollTop;
19137			}
19138
19139			if(popupTop + popupHeight < windowHeight){
19140				// bottom
19141				popupTop = windowHeight - popupHeight;
19142			}
19143			else if(popupTop > 0){
19144				// top
19145				popupTop = 0;
19146			}
19147		}
19148		popup.css('top', popupTop + 'px');
19149	}
19150}
19151
19152initCalculatePreview = function(){
19153	$('.calculate-delivery.with_preview:not(.inited)').each(function(){
19154		var $this = $(this);
19155		var $calculateSpan = $this.find('span[data-event=jqm]');
19156		var $preview = $this.find('.calculate-delivery-preview');
19157
19158		$this.addClass('inited');
19159		$this.appear(function(){
19160			if($calculateSpan.length){
19161				if(typeof window['calculate-delivery-preview-index'] === 'undefined'){
19162					window['calculate-delivery-preview-index'] = 1001;
19163				}
19164				else{
19165					++window['calculate-delivery-preview-index'];
19166				}
19167
19168				var productId = $calculateSpan.attr('data-param-product_id') * 1;
19169				var quantity = $calculateSpan.attr('data-param-quantity') * 1;
19170
19171				if(productId > 0){
19172					var areaIndexSended = window['calculate-delivery-preview-index'];
19173					$calculateSpan.data({areaIndex: areaIndexSended});
19174
19175					$.ajax({
19176						url: arNextOptions['SITE_DIR'] + 'ajax/delivery.php',
19177						type: 'POST',
19178						data: {
19179							is_preview: 'Y',
19180							index: areaIndexSended,
19181							product_id: productId,
19182							quantity: quantity
19183						},
19184						beforeSend: function(){
19185							$this.addClass('loadings');
19186						},
19187						success: function(response){
19188							var areaIndex = $calculateSpan.data('areaIndex');
19189							if(typeof areaIndex !== 'undefined' && areaIndex == areaIndexSended){
19190								$calculateSpan.hide();
19191								$preview.html(response);
19192								if(!$preview.find('.catalog-delivery-preview').length){
19193									$preview.empty();
19194									$calculateSpan.show();
19195								}
19196							}
19197						},
19198						error: function(xhr, ajaxOptions, thrownError){
19199						},
19200						complete: function(){
19201							var areaIndex = $calculateSpan.data('areaIndex');
19202							if(typeof areaIndex !== 'undefined' && areaIndex == areaIndexSended){
19203								$this.removeClass('loadings');
19204							}
19205						}
19206					});
19207				}
19208			}
19209		}, {accX: 0, accY: 0});
19210	});
19211}
19212
19213/*set price item*/
19214if(!funcDefined('setPriceItem')){
19215	var setPriceItem = function setPriceItem(main_block, quantity, rewrite_price, check_quantity, is_sku, show_percent, percent){
19216		var old_quantity = main_block.find('.to-cart').attr('data-ratio'),
19217			value = (typeof rewrite_price !== 'undefined' && rewrite_price ? rewrite_price : main_block.find('.to-cart').attr('data-value')),
19218			currency = main_block.find('.to-cart').attr('data-currency'),
19219			total_block = '<div class="total_summ" style="display:none;"><div>
19219'+BX.message('TOTAL_SUMM_ITEM')+'<span></span></div></div>',
19220			price_block = main_block.find('.cost.prices'),
19221			use_percent = (typeof show_percent !== 'undefined' && show_percent == 'Y'),
19222			percent_number = (typeof percent !== 'undefined' && percent),
19223			sku_checked = (main_block.find('.has_offer_prop').length ? 'Y' : 'N'),
19224			check = (typeof check_quantity !== 'undefined' && check_quantity);
19225		
19226
19227		if(main_block.find('.buy_block').length)
19228		{
19229			if(!main_block.find('.buy_block .total_summ').length && !is_sku)
19230				$(total_block).appendTo(main_block.find('.buy_block'))
19231		}
19232		else if(main_block.find('.counter_wrapp').length)
19233		{
19234			if(main_block.find('.counter_wrapp + .wrapp-one-click').length)
19235			{
19236				/*Elvira start*/
19237				if(!main_block.find('.wrapp-one-click .total_summ').length && !is_sku){
19238					$(total_block).appendTo(main_block.find('.counter_wrapp + .wrapp-one-click'))
19239				}
19240			}else if(!main_block.find('.counter_wrapp .total_summ').length && !is_sku){
19241				$(total_block).appendTo(main_block.find('.counter_wrapp:first'))
19242			}
19243			/*Elvira end*/
19244		}
19245
19246		if(main_block.find('.total_summ').length)
19247		{
19248			if(value && currency)
19249			{
19250				if((1 == quantity && old_quantity == quantity) || (typeof is_sku !== 'undefined' && is_sku && !check))
19251				{
19252					main_block.find('.total_summ').slideUp(50);
19253				}
19254				else
19255				{
19256					main_block.find('.total_summ span').html(BX.Currency.currencyFormat((value*quantity), currency, true));
19257					if(main_block.find('.total_summ').is(':hidden')/* || sku_checked == 'Y'*/)
19258						main_block.find('.total_summ').slideDown(100);
19259				}
19260			}
19261			else
19262			{
19263				main_block.find('.total_summ').slideUp(100);
19264			}
19265		}
19266	}
19267}
19268
19269if(!funcDefined('getCurrentPrice')){
19270	var getCurrentPrice = function getCurrentPrice(price, currency, print_price){
19271		var val = '';
19272		var format_value = BX.Currency.currencyFormat(price, currency);
19273		if(print_price.indexOf(format_value) >= 0)
19274		{
19275			val = print_price.replace(format_value, '<span class="price_value">'+format_value+'</span><span class="price_currency">');
19276			val += '</span>';
19277		}
19278		else
19279		{
19280			val = print_price;
19281		}
19282
19283		return val;
19284	}
19285}
19286
19287$(document).ready(function(){
19288	//check width for menu and search
19289	CheckSearchWidth();
19290	MegaMenuFixed();
19291    CheckPhoneDropdown();
19292
19293	//ecommerce order
19294	if(arNextOptions["PAGES"]["ORDER_PAGE"])
19295	{
19296		var arUrl = parseUrlQuery();
19297		if("ORDER_ID" in arUrl)
19298		{
19299			var _id = arUrl["ORDER_ID"];
19300			if(arNextOptions['COUNTERS']['USE_FULLORDER_GOALS'] !== 'N')
19301			{
19302				var eventdata = {goal: 'goal_order_success', result: _id};
19303				BX.onCustomEvent('onCounterGoals', [eventdata])
19304			}
19305			if(checkCounters())
19306			{
19307				if(typeof localStorage !== 'undefined'){
19308					// var d = BX.localStorage.get('gtm_ee_' + _id);
19309					var val = localStorage.getItem('gtm_e_' + _id),
19310						d = '';
19311					try{
19312						d = JSON.parse(val);
19313					}
19314					catch(e){
19315						d = val
19316					}
19317					if(typeof d === 'object'){
19318						window.dataLayer = window.dataLayer || [];
19319						dataLayer.push({"event": arNextOptions["COUNTERS"]['GOOGLE_EVENTS']['PURCHASE'], "ecommerce": d});
19320					}
19321
19322					if(typeof localStorage !== 'undefined'){
19323						localStorage.removeItem('gtm_e_' + _id);
19324					}
19325				}
19326			}
19327		}
19328	}
19329
19330	var bSafary = false;
19331	if(typeof jQuery.browser == 'object')
19332		bSafary = jQuery.browser.safari;
19333	else if(typeof browser == 'object')
19334		bSafary = browser.safari;
19335	if(!bSafary){
19336		CheckTopMenuPadding();
19337		CheckTopMenuOncePadding();
19338		CheckTopMenuDotted();
19339		CheckHeaderFixed();
19340		setTimeout(function() {$(window).resize();}, 150); // need to check resize flexslider & menu
19341		setTimeout(function() {$(window).scroll();}, 250); // need to check position fixed ask block
19342	}
19343	else{
19344		setTimeout(function(){
19345			$(window).resize(); // need to check resize flexslider & menu
19346			setTimeout(function(){
19347				CheckTopMenuPadding();
19348				CheckTopMenuOncePadding();
19349				CheckTopMenuDotted();
19350				CheckHeaderFixed();
19351
19352				setTimeout(function(){
19353					$(window).scroll();
19354				}, 50);
19355			}, 50);
19356		}, 350);
19357	}
19358
19359	if(arNextOptions['THEME']['USE_DEBUG_GOALS'] === 'Y')
19360		$.cookie('_ym_debug', 1, {path: '/',});
19361	else
19362		$.cookie('_ym_debug', null, {path: '/',});
19363
19364    /*  --- Bind mobile menu  --- */
19365	var $mobileMenu = $("#mobilemenu, #mobileheadersimple");
19366	$mobileMenu.isOpen = false;
19367	if($mobileMenu.length){
19368		$mobileMenu.isOpen = $mobileMenu.hasClass('show')
19369		$mobileMenu.isLeftSide = $mobileMenu.hasClass('leftside')
19370		$mobileMenu.isDowndrop = $mobileMenu.find('>.scroller').hasClass('downdrop')
19371		$mobileMenuNlo = $mobileMenu.find('[data-nlo]')
19372
19373		$(document).on('click', '#mobileheader .burger', function(){
19374			SwipeMobileMenu()
19375		})
19376
19377		if($mobileMenu.isLeftSide){
19378			$mobileMenu.parent().append('<div id="mobilemenu-overlay"></div>')
19379			var $mobileMenuOverlay = $('#mobilemenu-overlay')
19380
19381			$mobileMenuOverlay.click(function(){
19382				if($mobileMenu.isOpen){
19383					CloseMobileMenu()
19384				}
19385			});
19386
19387			$(document).swiperight(function(e) {
19388				if(!$(e.target).closest('.flexslider').length && !$(e.target).closest('.swipeignore').length && !$(e.target).closest('ymaps').length){
19389					OpenMobileMenu()
19390				}
19391			});
19392
19393			$(document).swipeleft(function(e) {
19394				if(!$(e.target).closest('.flexslider').length && !$(e.target).closest('.swipeignore').length && !$(e.target).closest('ymaps').length){
19395					CloseMobileMenu()
19396				}
19397			});
19398		}
19399		else{
19400			$(document).on('click', '#mobileheader', function(e){
19401				if(!$(e.target).closest('#mobilemenu').length && !$(e.target).closest('.burger').length && $mobileMenu.isOpen){
19402					CloseMobileMenu()
19403				}
19404			});
19405		}
19406
19407		$(document).on('click', '#mobilemenu .downdrop .menu a > .arrow, #mobilemenu .scroller:not(.downdrop) .menu a, #mobilemenu .social-icons a', function(e){
19408			var _this = $(this),
19409				$this = _this.closest('a');
19410			if (_this.attr('href')) {
19411				$this = _this;
19412			}
19413			if($this.hasClass('parent')){
19414				e.preventDefault()
19415
19416				if(!$mobileMenu.isDowndrop){
19417					$this.closest('li').addClass('expanded')
19418					MoveMobileMenuWrapNext()
19419				}
19420				else{
19421					if(!$this.closest('li').hasClass('expanded')){
19422						$this.closest('li').addClass('expanded')
19423					}
19424					else{
19425						$this.closest('li').removeClass('expanded')
19426					}
19427				}
19428			}
19429			else{
19430				if(!$this.hasClass('city_item')){
19431					var href = $this.attr('href')
19432					if(typeof href !== 'undefined' && href.length){
19433						e.preventDefault()
19434						window.location.href = href
19435						//window.location.reload()
19436					}
19437				}
19438
19439				if(!$this.closest('.menu_back').length){
19440					CloseMobileMenu()
19441				}
19442			}
19443		})
19444
19445		$(document).on('click', '#mobilemenu .dropdown .menu_back', function(e){
19446			e.preventDefault()
19447			var $this = $(this)
19448			MoveMobileMenuWrapPrev()
19449			setTimeout(function(){
19450				$this.closest('.expanded').removeClass('expanded')
19451			}, 400)
19452		})
19453
19454		OpenMobileMenu = function(){
19455			CloseMobilePhone();
19456
19457			if(!$mobileMenu.isOpen){
19458				// hide styleswitcher
19459				if($('.style-switcher').hasClass('active')){
19460					$('.style-switcher .switch').trigger('click')
19461				}
19462				$('.style-switcher .switch').hide()
19463
19464				if($mobileMenu.isLeftSide){
19465					// show overlay
19466					setTimeout(function(){
19467						$mobileMenuOverlay.fadeIn('fast')
19468					}, 100)
19469
19470					// fix body
19471					$('body').css({'overflow-y':'hidden'});
19472				}
19473				else{
19474					// scroll body to top & set fixed
19475					$('body').scrollTop(0).css({position: 'fixed'})
19476
19477					// set menu top = bottom of header
19478					$mobileMenu.css({top: + ($('#mobileheader').height() + $('#mobileheader').offset().top) + 'px'})
19479
19480					// change burger icon
19481					$('#mobileheader .burger').addClass('c')
19482				}
19483
19484				// show menu
19485				$mobileMenu.addClass('show')
19486				$mobileMenu.isOpen = true;
19487
19488				if(!$mobileMenu.isDowndrop){
19489					var $wrap = $mobileMenu.find('.wrap').first()
19490					var params =  $wrap.data('params')
19491					if(typeof params === 'undefined'){
19492						params = {
19493							depth: 0,
19494							scroll: {},
19495							height: {}
19496						}
19497					}
19498					$wrap.data('params', params)
19499				}
19500
19501				if($mobileMenuNlo.length){
19502					if(!$mobileMenuNlo.hasClass('nlo-loadings')){
19503						$mobileMenuNlo.addClass('nlo-loadings');
19504						setTimeout(function(){
19505							$.ajax({
19506								data: {nlo: $mobileMenuNlo.attr('data-nlo')},
19507								success: function(response){
19508									$mobileMenuNlo[0].insertAdjacentHTML('beforebegin', $.trim(response));
19509									$mobileMenuNlo.remove();
19510								},
19511								error:function(){
19512									$mobileMenuNlo.removeClass('nlo-loadings');
19513								}
19514							});
19515						}, 300);
19516					}
19517				}
19518			}
19519		}
19520
19521		CloseMobileMenu = function(){
19522			if($mobileMenu.isOpen){
19523				// hide menu
19524				$mobileMenu.removeClass('show')
19525				$mobileMenu.isOpen = false
19526
19527				// show styleswitcher
19528				$('.style-switcher .switch').show()
19529
19530				if($mobileMenu.isLeftSide){
19531					// unfix body
19532                    $('body').css({'overflow-y':'auto'});
19533
19534					// hide overlay
19535					setTimeout(function(){
19536						$mobileMenuOverlay.fadeOut('fast')
19537					}, 100)
19538				}
19539				else{
19540					// change burger icon
19541					$('#mobileheader .burger').removeClass('c')
19542
19543					// body unset fixed
19544					$('body').css({position: ''})
19545				}
19546
19547				if(!$mobileMenu.isDowndrop){
19548					setTimeout(function(){
19549						var $scroller = $mobileMenu.find('.scroller').first()
19550						var $wrap = $mobileMenu.find('.wrap').first()
19551						var params =  $wrap.data('params')
19552						params.depth = 0
19553						$wrap.data('params', params).attr('style', '')
19554						$mobileMenu.scrollTop(0)
19555						$scroller.css('height', '')
19556					}, 400)
19557				}
19558			}
19559		}
19560
19561		SwipeMobileMenu = function(){
19562			if($mobileMenu.isOpen){
19563				CloseMobileMenu()
19564			}
19565			else{
19566				OpenMobileMenu()
19567			}
19568		}
19569
19570		MoveMobileMenuWrapNext = function(){
19571			if(!$mobileMenu.isDowndrop){
19572				var $scroller = $mobileMenu.find('.scroller').first()
19573				var $wrap = $mobileMenu.find('.wrap').first()
19574				if($wrap.length){
19575					var params =  $wrap.data('params')
19576					var $dropdownNext = $mobileMenu.find('.expanded>.dropdown').eq(params.depth)
19577					if($dropdownNext.length){
19578						// save scroll position
19579						params.scroll[params.depth] = parseInt($mobileMenu.scrollTop())
19580
19581						// height while move animating
19582						params.height[params.depth + 1] = Math.max($dropdownNext.height(), (!params.depth ? $wrap.height() : $mobileMenu.find('.expanded>.dropdown').eq(params.depth - 1).height()))
19583						$scroller.css('height', params.height[params.depth + 1] + 'px')
19584
19585						// inc depth
19586						++params.depth
19587
19588						// translateX for move
19589						$wrap.css('transform', 'translateX(' + -100 * params.depth + '%)')
19590
19591						// scroll to top
19592						setTimeout(function() {
19593							$mobileMenu.animate({scrollTop : 0}, 200);
19594						}, 100)
19595
19596						// height on enimating end
19597						var h = $dropdownNext.height()
19598						setTimeout(function() {
19599							if(h){
19600								$scroller.css('height', h + 'px')
19601							}
19602							else{
19603								$scroller.css('height', '')
19604							}
19605						}, 200)
19606					}
19607
19608					$wrap.data('params', params)
19609				}
19610			}
19611		}
19612
19613		MoveMobileMenuWrapPrev = function(){
19614			if(!$mobileMenu.isDowndrop){
19615				var $scroller = $mobileMenu.find('.scroller').first()
19616				var $wrap = $mobileMenu.find('.wrap').first()
19617				if($wrap.length){
19618					var params =  $wrap.data('params')
19619					if(params.depth > 0){
19620						var $dropdown = $mobileMenu.find('.expanded>.dropdown').eq(params.depth - 1)
19621						if($dropdown.length){
19622							// height while move animating
19623							$scroller.css('height', params.height[params.depth] + 'px')
19624
19625							// dec depth
19626							--params.depth
19627
19628							// translateX for move
19629							$wrap.css('transform', 'translateX(' + -100 * params.depth + '%)')
19630
19631							// restore scroll position
19632							setTimeout(function() {
19633								$mobileMenu.animate({scrollTop : params.scroll[params.depth]}, 200);
19634							}, 100)
19635
19636							// height on enimating end
19637							var h = (!params.depth ? false : $mobileMenu.find('.expanded>.dropdown').eq(params.depth - 1).height())
19638							setTimeout(function() {
19639								if(h){
19640									$scroller.css('height', h + 'px')
19641								}
19642								else{
19643									$scroller.css('height', '')
19644								}
19645							}, 200)
19646						}
19647					}
19648
19649					$wrap.data('params', params)
19650				}
19651			}
19652		}
19653	}
19654	/*  --- END Bind mobile menu  --- */
19655
19656    /*  --- Bind mobile phone  --- */
19657    var $mobileHeader = $("#mobileheader, #mobileheadersimple");
19658    var $mobilePhone = $("#mobilePhone");
19659    $mobilePhone.isOpen = false;
19660    if($mobilePhone.length){
19661        $mobilePhone.isOpen = $mobilePhone.hasClass('show');
19662
19663        $(document).on('click', '.wrap_phones .svg-inline-phone', function(e){
19664            SwipeMobilePhone();
19665            e.stopPropagation();
19666        });
19667
19668        $(document).on('click', '.wrap_phones .svg-inline-close', function(e){
19669            CloseMobilePhone();
19670            e.stopPropagation();
19671        });
19672    }
19673
19674    SwipeMobilePhone = function(){
19675        if($mobilePhone.isOpen){
19676            CloseMobilePhone();
19677        }
19678        else{
19679            OpenMobilePhone();
19680        }
19681    }
19682
19683    OpenMobilePhone = function(){
19684        if(!$mobilePhone.isOpen){
19685            CloseMobileMenu();
19686
19687            // show overlay
19688            $('<div class="jqmOverlay mobp" style="top:'+($mobileHeader.position().top+$mobileHeader.height())+'px;"></div>').appendTo('body');
19689            // toggle phones
19690            setTimeout(function(){
19691                $mobilePhone.slideDown('fast', function(){
19692                    $mobilePhone.addClass('show');
19693                    $mobilePhone.isOpen = true;
19694                });
19695            }, 100);
19696        }
19697    }
19698
19699    CloseMobilePhone = function(){
19700        if($mobilePhone.isOpen){
19701        	// toggle phones
19702            setTimeout(function(){
19703                $mobilePhone.slideUp('fast', function(){
19704                    $mobilePhone.removeClass('show');
19705                    $mobilePhone.isOpen = false;
19706
19707		        	// hide overlay
19708		            $('.jqmOverlay.mobp').remove();
19709                });
19710            }, 100);
19711        }
19712    }
19713
19714    checkMobilePhone = function(){
19715        if((!window.matchMedia('(max-width: 991px)').matches)){
19716            CloseMobilePhone();
19717		}
19718    }
19719    /*  --- END Bind mobile phone  --- */
19720
19721    /*  --- Bind mobile filter  --- */
19722    var $mobilefilter = $("#mobilefilter");
19723    if($mobilefilter.length){
19724        $mobilefilter.isOpen = $mobileMenu.hasClass('show');
19725        $mobilefilter.isAppendLeft = false;
19726        $mobilefilter.isWrapFilter = false;
19727        $mobilefilter.isHorizontalOrCompact = $('.filter_horizontal').length || $('.bx_filter_vertical.compact').length;
19728        $mobilefilter.close = '<i class="svg svg-close close-icons"></i>';
19729
19730        $(document).on('click', '.filter_opener', function(){
19731            OpenMobileFilter();
19732        });
19733
19734        $(document).on('click', '#mobilefilter .svg-close.close-icons', function(){
19735            CloseMobileFilter();
19736        });
19737
19738        $(document).on('click', '.bx_filter_select_block', function(e){
19739            var bx_filter_select_container = $(e.target).parents('.bx_filter_select_container');
19740            if(bx_filter_select_container.length) {
19741                var prop_id = bx_filter_select_container.closest('.bx_filter_parameters_box').attr('data-property_id');
19742                if($('#smartFilterDropDown'+prop_id).length){
19743					$('#smartFilterDropDown'+prop_id).css({"max-width":bx_filter_select_container.width(), "z-index":"3020"});
19744                }
19745            }
19746        });
19747
19748        $(document).on('mouseup', '.bx_filter_section', function(e){
19749            if($(e.target).hasClass('bx_filter_search_button')) {
19750                CloseMobileFilter();
19751            }
19752        });
19753
19754
19755        $(document).on('mouseup', '.bx_filter_parameters_box_title', function(e){
19756            $("[id^='smartFilterDropDown']").hide();
19757            if($(e.target).hasClass('close-icons')) {
19758                CloseMobileFilter();
19759            }
19760        });
19761
19762        /*$(document).on('DOMSubtreeModified', "#mobilefilter #modef_num_mobile", function() {
19763            mobileFilterNum($(this));
19764        });
19765
19766        $(document).on('DOMSubtreeModified', "#mobilefilter .bx_filter_container_modef", function() {
19767            mobileFilterNum($(this));
19768        });*/
19769
19770        $mobilefilter.parent().append('<div id="mobilefilter-overlay"></div>');
19771        var $mobilefilterOverlay = $('#mobilefilter-overlay');
19772
19773        $mobilefilterOverlay.click(function(){
19774            if($mobilefilter.isOpen){
19775                CloseMobileFilter();
19776                //e.stopPropagation();
19777            }
19778        });
19779
19780        mobileFilterNum = function(num, def){
19781            if(def){
19782                $('.bx_filter_search_button').val(num.data("f"));;
19783            }
19784            else {
19785                var str = "";
19786                var $prosLeng = $('.bx_filter_parameters_box > span');
19787
19788                str += $prosLeng.data("f") + " " + num + " " + declOfNumFilter(num, [$prosLeng.data("fi"), $prosLeng.data("fr"), $prosLeng.data("frm"),]);
19789                $('.bx_filter_search_button').val(str);
19790            }
19791        }
19792
19793        declOfNumFilter = function(number, titles){
19794            cases = [2, 0, 1, 1, 1, 2];
19795            return titles[ (number%100>4 && number%100<20)? 2 : cases[(number%10<5)?number%10:5] ];
19796        }
19797
19798        OpenMobileFilter = function(){
19799            if(!$mobilefilter.isOpen){
19800                if(!$mobilefilter.isAppendLeft){
19801                    if(!$mobilefilter.isWrapFilter){
19802                        $(".bx_filter").wrap("<div id='wrapInlineFilter'></div>");
19803                        $mobilefilter.isWrapFilter = true;
19804                    }
19805                    $(".bx_filter").appendTo($("#mobilefilter")).find('.title .bx_filter_parameters_box_title').append($mobilefilter.close);
19806                    $mobilefilter.isAppendLeft = true;
19807                }
19808
19809                // show overlay
19810                setTimeout(function(){
19811					$mobilefilterOverlay.fadeIn('fast');
19812                }, 100);
19813
19814                // fix body
19815                $('body').css({'overflow-y':'hidden'});
19816
19817                // show mobile filter
19818                $mobilefilter.addClass('show');
19819                $mobilefilter.find('.bx_filter').css({'display':'block'});
19820                $mobilefilter.isOpen = true;
19821
19822                var init =  $mobilefilter.data('init');
19823                if(typeof init === 'undefined'){
19824                    $mobilefilter.scroll(function() {
19825                        $(".bx_filter_section .bx_filter_select_container").each(function(){
19826                            var prop_id=$(this).closest('.bx_filter_parameters_box').attr('data-property_id');
19827                            if($('#smartFilterDropDown'+prop_id).length){
19828                                $('#smartFilterDropDown'+prop_id).hide();
19829                            }
19830                        });
19831                    });
19832
19833                    $mobilefilter.data('init', "Y");
19834                };
19835            };
19836        }
19837
19838        CloseMobileFilter = function(append){
19839            if($mobilefilter.isOpen){
19840            	// scroll to top
19841                $mobilefilter.find('.bx_filter_parameters').scrollTop(0);
19842
19843                // unfix body
19844                $('body').css({'overflow-y':'auto'});
19845
19846                // hide overlay
19847                setTimeout(function(){
19848					$mobilefilterOverlay.fadeOut('fast');
19849                }, 100);
19850
19851                // hide mobile filter
19852                $mobilefilter.removeClass('show');
19853                $mobilefilter.isOpen = false;
19854            }
19855
19856            if(append && $mobilefilter.isAppendLeft){
19857                $(".bx_filter").appendTo($("#wrapInlineFilter")).show().find('.svg-close').remove();
19858                $mobilefilter.isAppendLeft = false;
19859                $mobilefilter.removeData('init');
19860                mobileFilterNum($("#modef_num_mobile"),true);
19861	        }
19862        }
19863
19864        checkMobileFilter = function(){
19865            if((!window.matchMedia('(max-width: 991px)').matches && !$mobilefilter.isHorizontalOrCompact) || (!window.matchMedia('(max-width: 767px)').matches && $mobilefilter.isHorizontalOrCompact)){
19866                CloseMobileFilter(true);
19867			}
19868        }
19869    }
19870    else {
19871        checkTopFilter();
19872        $(document).on('click', '.filter_opener', function(){
19873			$(this).toggleClass("opened");
19874			if($('.visible_mobile_filter').length) {
19875				$('.visible_mobile_filter').show();
19876				$('.bx_filter_vertical, .bx_filter').slideToggle(333);
19877			}
19878			else{
19879				$('.bx_filter_vertical').closest('div[id^=bx_incl]').show();
19880			    $('.bx_filter_vertical, .bx_filter').slideToggle(333);
19881			}
19882        });
19883    }
19884    /*  --- END Bind mobile filter  --- */
19885
19886	/* change type2 menu for fixed */
19887	if($('#headerfixed .js-nav').length)
19888	{
19889		if(arNextOptions['THEME']['HEADER_FIXED'] == 2)
19890			CheckHeaderFixedMenu();
19891
19892		setTimeout(function(){
19893			$('#headerfixed .js-nav').addClass('opacity1');
19894		},350);
19895	}
19896
19897	// -- scroll after apply option
19898	if($('.instagram_ajax').length)
19899	{
19900		BX.addCustomEvent('onCompleteAction', function(eventdata){
19901			if(eventdata.action === 'instagrammLoaded')
19902				scrollPreviewBlock();
19903		});
19904	}
19905	else
19906		scrollPreviewBlock();
19907
19908	scrollToTop();
19909
19910	$.extend( $.validator.messages, {
19911		required: BX.message('JS_REQUIRED'),
19912		email: BX.message('JS_FORMAT'),
19913		equalTo: BX.message('JS_PASSWORD_COPY'),
19914		minlength: BX.message('JS_PASSWORD_LENGTH'),
19915		remote: BX.message('JS_ERROR')
19916	});
19917
19918	$.validator.addMethod(
19919		'regexp', function( value, element, regexp ){
19920			var re = new RegExp( regexp );
19921			return this.optional( element ) || re.test( value );
19922		},
19923		BX.message('JS_FORMAT')
19924	);
19925
19926	$.validator.addMethod(
19927		'filesize', function( value, element, param ){
19928			return this.optional( element ) || ( element.files[0].size <= param )
19929		},
19930		BX.message('JS_FILE_SIZE')
19931	);
19932
19933	$.validator.addMethod(
19934		'date', function( value, element, param ) {
19935			var status = false;
19936			if(!value || value.length <= 0){
19937				status = false;
19938			}
19939			else{
19940				// html5 date allways yyyy-mm-dd
19941				var re = new RegExp('^([0-9]{4})(.)([0-9]{2})(.)([0-9]{2})$');
19942				var matches = re.exec(value);
19943				if(matches){
19944					var composedDate = new Date(matches[1], (matches[3] - 1), matches[5]);
19945					status = ((composedDate.getMonth() == (matches[3] - 1)) && (composedDate.getDate() == matches[5]) && (composedDate.getFullYear() == matches[1]));
19946				}
19947				else{
19948					// firefox
19949					var re = new RegExp('^([0-9]{2})(.)([0-9]{2})(.)([0-9]{4})$');
19950					var matches = re.exec(value);
19951					if(matches){
19952						var composedDate = new Date(matches[5], (matches[3] - 1), matches[1]);
19953						status = ((composedDate.getMonth() == (matches[3] - 1)) && (composedDate.getDate() == matches[1]) && (composedDate.getFullYear() == matches[5]));
19954					}
19955				}
19956			}
19957			return status;
19958		}, BX.message('JS_DATE')
19959	);
19960
19961	$.validator.addMethod(
19962		'extension', function(value, element, param){
19963			param = typeof param === 'string' ? param.replace(/,/g, '|') : 'png|jpe?g|gif';
19964			return this.optional(element) || value.match(new RegExp('.(' + param + ')$', 'i'));
19965		}, BX.message('JS_FILE_EXT')
19966	);
19967
19968	$.validator.addMethod(
19969		'captcha', function( value, element, params ){
19970			return $.validator.methods.remote.call(this, value, element,{
19971				url: arNextOptions['SITE_DIR'] + 'ajax/check-captcha.php',
19972				type: 'post',
19973				data:{
19974					captcha_word: value,
19975					captcha_sid: function(){
19976						return $(element).closest('form').find('input[name="captcha_sid"]').val();
19977					}
19978				}
19979			});
19980		},
19981		BX.message('JS_ERROR')
19982	);
19983
19984	$.validator.addMethod(
19985		'recaptcha', function(value, element, param){
19986			var id = $(element).closest('form').find('.g-recaptcha').attr('data-widgetid');
19987			if(typeof id !== 'undefined'){
19988				return grecaptcha.getResponse(id) != '';
19989			}
19990			else{
19991				return true;
19992			}
19993		}, BX.message('JS_RECAPTCHA_ERROR')
19994	);
19995
19996	$.validator.addClassRules({
19997		'phone':{
19998			regexp: arNextOptions['THEME']['VALIDATE_PHONE_MASK']
19999		},
20000		'confirm_password':{
20001			equalTo: 'input[name="REGISTER\[PASSWORD\]"]',
20002			minlength: 6
20003		},
20004		'password':{
20005			minlength: 6
20006		},
20007		'inputfile':{
20008			extension: arNextOptions['THEME']['VALIDATE_FILE_EXT'],
20009			filesize: 5000000
20010		},
20011		'captcha':{
20012			captcha: ''
20013		},
20014		'recaptcha':{
20015			recaptcha: ''
20016		}
20017	});
20018
20019	if(arNextOptions['THEME']['PHONE_MASK']){
20020		$('input.phone').inputmask('mask', {'mask': arNextOptions['THEME']['PHONE_MASK']});
20021	}
20022
20023	// init calculate delivery with preview
20024	initCalculatePreview();
20025
20026	/*city*/
20027	$('select.region').on('change', function(){
20028		var val = parseInt($(this).val());
20029		if($('select.city').length)
20030		{
20031			if(val)
20032			{
20033				$('select.city option').hide();
20034				$('select.city option').prop('disabled', 'disabled');
20035				$('select.city option[data-parent_section='+val+']').prop('disabled', '');
20036				$('select.city option:eq(0)').prop('disabled', '');
20037				$('select.city').ikSelect('reset');
20038				$('select.city option[data-parent_section='+val+']').show();
20039			}
20040			else
20041				$('select.city option').prop('disabled', 'disabled');
20042				$('select.city option:eq(0)').prop('disabled', '');
20043				$('select.city').ikSelect('reset');
20044		}
20045	})
20046
20047	$('select.city, select.region').on('change', function(){
20048		var _this = $(this),
20049			val = parseInt(_this.val());
20050		if(_this.hasClass('region'))
20051		{
20052			$('select.city option:eq(0)').show();
20053			$('select.city').val(0);
20054		}
20055
20056		if((_this.hasClass('region') && !val) || _this.hasClass('city'))
20057		{
20058			$.ajax({
20059				type: 'POST',
20060				data: {ID: val},
20061			}).success(function(html){
20062				var ob = BX.processHTML(html);
20063				$('.ajax_items')[0].innerHTML = ob.HTML;
20064				BX.ajax.processScripts(ob.SCRIPT);
20065			})
20066		}
20067	})
20068
20069	$(document).on('click', '.mobile_regions .city_item', function(e){
20070    	e.preventDefault();
20071    	var _this = $(this);
20072    	$.removeCookie('current_region');
20073		$.cookie('current_region', _this.data('id'), {path: '/',domain: arNextOptions['SITE_ADDRESS']});
20074		location.href = _this.attr('href');
20075    })
20076
20077	/* toggle */
20078	var $this = this,
20079		previewParClosedHeight = 25;
20080
20081	$('section.toggle >
20081 label').prepend($('<i />').addClass('fa fa-plus'));
20082	$('section.toggle > label').prepend($('<i />').addClass('fa fa-minus'));
20083	$('section.toggle.active > p').addClass('preview-active');
20084	$('section.toggle.active > div.toggle-content').slideDown(350, function() {});
20085
20086	$('section.toggle > label').click(function(e){
20087		var parentSection = $(this).parent(),
20088			parentWrapper = $(this).parents('div.toogle'),
20089			previewPar = false,
20090			isAccordion = parentWrapper.hasClass('toogle-accordion');
20091
20092		if(isAccordion && typeof(e.originalEvent) != 'undefined') {
20093			parentWrapper.find('section.toggle.active > label').trigger('click');
20094		}
20095
20096		parentSection.toggleClass('active');
20097
20098		// Preview Paragraph
20099		if( parentSection.find('> p').get(0) ){
20100			previewPar = parentSection.find('> p');
20101			var previewParCurrentHeight = previewPar.css('height');
20102			previewPar.css('height', 'auto');
20103			var previewParAnimateHeight = previewPar.css('height');
20104			previewPar.css('height', previewParCurrentHeight);
20105		}
20106
20107		// Content
20108		var toggleContent = parentSection.find('> div.toggle-content');
20109
20110		if( parentSection.hasClass('active') ){
20111			$(previewPar).animate({
20112				height: previewParAnimateHeight
20113			}, 350, function() {
20114				$(this).addClass('preview-active');
20115			});
20116			toggleContent.slideDown(350, function() {});
20117		}
20118		else{
20119			$(previewPar).animate({
20120				height: previewParClosedHeight
20121			}, 350, function() {
20122				$(this).removeClass('preview-active');
20123			});
20124			toggleContent.slideUp(350, function() {});
20125		}
20126	});
20127
20128	$(document).on('mouseenter', '.section-gallery-wrapper .section-gallery-wrapper__item', function(){
20129		$(this).siblings().removeClass('_active');
20130		$(this).addClass('_active');
20131	});
20132
20133	$('.tables-responsive .responsive').footable(); //responsive table
20134
20135	$('a[rel=tooltip]').tooltip();
20136	$('span[data-toggle=tooltip]').tooltip();
20137
20138	$('.toggle .more_items').on('click', function(){
20139		$(this).closest('.toggle').find('.collapsed').fadeToggle();
20140		$(this).remove();
20141		if(typeof $(this).data('resize') !== 'undefined' && $(this).data('resize'))
20142			$(window).resize();
20143	})
20144	/*$('.toggle_menu .more_items').on('click', function(){
20145		$(this).closest('.toggle_menu').find('.collapsed').addClass('clicked_exp');
20146		$(this).remove();
20147	})*/
20148
20149	$(document).on('click', '.toggle_menu .more_items', function(){
20150		$(this).closest('.toggle_menu').find('.collapsed').addClass('clicked_exp');
20151		$(this).remove();
20152	});
20153
20154	/* search sync */
20155	$(document).on('keyup', '.search-input-div input', function(e){
20156		var inputValue = $(this).val();
20157		$('.search-input-div input:not(:focus').val(inputValue);
20158
20159		if($(this).closest('#headerfixed').length)
20160		{
20161			if(e.keyCode == 13)
20162				$('.search form').submit();
20163		}
20164	});
20165
20166    $(document).on('keyup', function(e){
20167        if (e.keyCode == 27){
20168            if($('.jqmWindow').length){
20169                $('.jqmWindow').jqmHide();
20170            }
20171            else if($('.inline-search-block.fixed').hasClass('show')){
20172                $('.inline-search-block .close-block').click();
20173                setTimeout(function(){
20174                    $('.title-search-result').hide();
20175                }, 0);
20176            }
20177            else if($('.mega_fixed_menu').is(':visible')){
20178                $('.mega_fixed_menu .svg-inline-close').click();
20179            }
20180        }
20181    });
20182
20183	$(document).on('click', '.search-button-div button', function(e){
20184		if($(this).closest('#headerfixed').length)
20185			$('.search form').submit();
20186	});
20187
20188	$('.inline-search-show, .inline-search-hide').on('click', function(e){
20189		CloseMobilePhone();
20190
20191		if(typeof($(this).data('type_search')) != 'undefined' && $(this).data('type_search') == 'fixed'){
20192			$('.inline-search-block').addClass('fixed');
20193		}
20194
20195		if(arNextOptions['THEME']['TYPE_SEARCH'] == 'fixed'){
20196			$('.inline-search-block.fixed.big .search-input').focus();
20197		}
20198
20199	    if(arNextOptions['THEME']['TYPE_SEARCH'] != 'fixed'){
20200
20201	        var height_block = 0;
20202	        /*if(!$('header > .top-block').length || $('header.long').length)
20203	        {*/
20204	            if($('header.long').length){
20205	                height_block = $('header.long').closest('#header').actual('outerHeight');
20206	            }
20207	            else{
20208	                height_block = $(this).closest('.maxwidth-theme').actual('outerHeight');
20209	                if($(this).closest('.top-block').length){
20210	                    height_block = $(this).closest('.top-block').actual('outerHeight');
20211											// height_block = $('.inline-search-block').actual('outerHeight');
20212	                }
20213	                else if($(this).closest('header.header-v8').length){
20214	                    height_block = $(this).closest('header.header-v8').actual('outerHeight');
20215	                }
20216	            }
20217
20218	            if($('#bx-panel').length){
20219	                height_block += $('#bx-panel').actual('outerHeight');
20220	            }
20221	            $('.inline-search-block').css({
20222	                'height': height_block,
20223	                'line-height': height_block-4+'px',
20224	                // 'top': -height_block
20225	            })
20226	        //}
20227	    }
20228
20229	    $('.inline-search-block').toggleClass('show');
20230
20231	    if($('.top-block').length){
20232	        if($('.inline-search-block').hasClass('show')){
20233	            $('.inline-search-block').css('background', $('.top-block').css('background-color'));
20234				// $('<div class="jqmOverlay search"></div>').appendTo('body');
20235	        }
20236	        else{
20237	            $('.inline-search-block').css('background', '#fff');
20238				$('#title-search-input').blur();
20239				$('.jqmOverlay').detach();
20240	        }
20241	    }
20242
20243	    if(arNextOptions['THEME']['TYPE_SEARCH'] === 'fixed'){
20244	        if($('.inline-search-block').hasClass('show')){
20245	            $('<div class="jqmOverlay search"></div>').appendTo('body');
20246	        }
20247	        else{
20248	            $('.jqmOverlay').remove();
20249	        }
20250	    }
20251	})
20252
20253	/* close search block */
20254	$("html, body").on('mousedown', function(e){
20255		if(typeof e.target.className == 'string' && e.target.className.indexOf('adm') < 0){
20256			e.stopPropagation();
20257			var search_target = $(e.target).closest('.bx_searche');
20258			if(!$(e.target).hasClass('inline-search-block') && !$(e.target).hasClass('svg') && !search_target.length){
20259				$('.inline-search-block').removeClass('show');
20260				$('.title-search-result').hide();
20261				if(arNextOptions['THEME']['TYPE_SEARCH'] === 'fixed'){
20262					$('.jqmOverlay.search').remove();
20263				}
20264			}
20265
20266            if($mobilePhone.length){
20267                CloseMobilePhone();
20268            }
20269
20270			if($('#basket_line .basket_fly').length && parseInt($("#basket_line .basket_fly").css("right")) >= 0){
20271				if(!$(e.target).closest('.basket_wrapp').length){
20272					$("#basket_line .basket_fly").stop().animate({"right": -$("#basket_line .basket_fly").outerWidth()}, 150);
20273				}
20274			}
20275
20276			if(isMobile){
20277				if(search_target.length){
20278					location.href = search_target.attr('href');
20279				}
20280			}
20281
20282			if(!$(e.target).closest('.js-info-block').length && !$(e.target).closest('.js-show-info-block').length)
20283			{
20284				$('.js-show-info-block').removeClass('opened');
20285				$('.js-info-block').fadeOut();
20286			}
20287
20288			var class_name = $(e.target).attr('class');
20289			if(typeof(class_name) == 'undefined' || class_name.indexOf('tooltip') < 0){
20290				//tooltip link
20291				$('.tooltip-link').tooltip('hide');
20292			}
20293		}
20294	});
20295	$('.inline-search-block').find('*').on('mousedown', function(e){
20296		e.stopPropagation();
20297	});
20298
20299	/*check mobile device*/
20300	if(jQuery.browser.mobile){
20301		$(document).on('click', '*[data-event="jqm"]', function(e){
20302			e.preventDefault();
20303			e.stopPropagation();
20304			var _this = $(this);
20305			var name = _this.data('name');
20306
20307			if(window.matchMedia('(min-width:300px)').matches)
20308			{
20309				if(!$(this).hasClass('clicked'))
20310				{
20311					$(this).addClass('clicked');
20312					$(this).jqmEx();
20313					$(this).trigger('click');
20314				}
20315				return false;
20316			}
20317			else if(name.length){
20318				var script = arNextOptions['SITE_DIR'] + 'form/';
20319				var paramsStr = ''; var arTriggerAttrs = {};
20320				$.each(_this.get(0).attributes, function(index, attr){
20321					var attrName = attr.nodeName;
20322					var attrValue = _this.attr(attrName);
20323					if (attrName !== 'onclick') {
20324						arTriggerAttrs[attrName] = attrValue;
20325					}
20326					if(/^data\-param\-(.+)$/.test(attrName)){
20327						var key = attrName.match(/^data\-param\-(.+)$/)[1];
20328						paramsStr += key + '=' + attrValue + '&';
20329					}
20330				});
20331
20332				var triggerAttrs = JSON.stringify(arTriggerAttrs);
20333				var encTriggerAttrs = encodeURIComponent(triggerAttrs);
20334				script += '?name=' + name + '&' + paramsStr + 'data-trigger=' + encTriggerAttrs;
20335
20336				location.href = script;
20337			}
20338		});
20339
20340		$('.fancybox').removeClass('fancybox');
20341	}
20342	else
20343	{
20344		$(document).on('click', '*[data-event="jqm"]', function(e){
20345			e.preventDefault();
20346			e.stopPropagation();
20347			if(!$(this).hasClass('clicked'))
20348			{
20349				$(this).addClass('clicked');
20350				$(this).jqmEx();
20351				$(this).trigger('click');
20352			}
20353			return false;
20354		});
20355	}
20356
20357	$('.animate-load').on('click', function(){
20358		if(!jQuery.browser.mobile)
20359			$(this).parent().addClass('loadings');
20360	})
20361
20362	BX.addCustomEvent('onCompleteAction', function(eventdata, _this){
20363		try{
20364			if(eventdata.action === 'loadForm')
20365			{
20366				$(_this).parent().removeClass('loadings');
20367				$(_this).removeClass('clicked');
20368
20369				if($(_this).hasClass('one_click_buy_trigger'))
20370					$('.one_click').removeClass('clicked')
20371				else if($(_this).hasClass('one_click_buy_basket_trigger'))
20372					$('.fast_order').removeClass('clicked')
20373			}
20374			else if(eventdata.action === 'loadBasket')
20375			{
20376				$('.basket-link.basket').attr('title', arBasketPrices.BASKET_SUMM_TITLE);
20377				$('.basket-link.delay').attr('title', arBasketPrices.DELAY_SUMM_TITLE);
20378
20379				if(arBasketPrices.BASKET_COUNT>0)
20380				{
20381					$('.basket-link.basket').addClass('basket-count');
20382					$('.basket-link.basket .count').removeClass('empted');
20383					if($('.basket-link.basket .prices').length)
20384						$('.basket-link.basket .prices').html(arBasketPrices.BASKET_SUMM);
20385				}
20386				else
20387				{
20388					$('.basket-link.basket').removeClass('basket-count');
20389					$('.basket-link.basket .count').addClass('empted');
20390					if($('.basket-link.basket .prices').length)
20391						$('.basket-link.basket .prices').html(arBasketPrices.BASKET_SUMM_TITLE_SMALL);
20392				}
20393				$('.basket-link.basket .count').text(arBasketPrices.BASKET_COUNT);
20394				if(arBasketPrices.DELAY_COUNT>0)
20395				{
20396					$('.basket-link.delay').addClass('basket-count');
20397					$('.basket-link.delay .count').removeClass('empted');
20398				}
20399				else
20400				{
20401					$('.basket-link.delay').removeClass('basket-count');
20402					$('.basket-link.delay .count').addClass('empted');
20403				}
20404				$('.basket-link.delay .count').text(arBasketPrices.DELAY_COUNT);
20405			}
20406			else if(eventdata.action === 'loadActualBasketCompare')
20407			{
20408				var compare_count = Object.keys(arBasketAspro.COMPARE).length;
20409				if(compare_count>0)
20410				{
20411					$('.basket-link.compare').addClass('basket-count');
20412					$('.basket-link.compare .count').removeClass('empted');
20413					if($('#compare_fly').length)
20414						$('#compare_fly').removeClass('empty_block');
20415				}
20416				else
20417				{
20418					$('.basket-link.compare').removeClass('basket-count');
20419					$('.basket-link.compare .count').addClass('empted');
20420					if($('#compare_fly').length)
20421						$('#compare_fly').addClass('empty_block');
20422				}
20423				$('.basket-link.compare .count').text(compare_count);
20424			}
20425			else if(eventdata.action === 'instagrammLoaded')
20426			{
20427				$('.instagram .scroll-title').mCustomScrollbar({
20428					mouseWheel: {
20429						scrollAmount: 150,
20430						preventDefault: true,
20431					}
20432				});
20433
20434			}
20435			else if(eventdata.action === 'loadRSS')
20436			{
20437			}else if(eventdata.action === 'jsLoadBlock')
20438            {
20439				lazyLoadPagenBlock();
20440			}
20441		}
20442		catch(e){
20443			console.error(e)
20444		}
20445	})
20446
20447	/*slices*/
20448	if($('.banners-small .item.normal-block').length)
20449		$('.banners-small .item.normal-block').sliceHeight();
20450	if($('.teasers .item').length)
20451		$('.teasers .item').sliceHeight();
20452	if($('.wrap-portfolio-front .row.items > div').length)
20453		$('.wrap-portfolio-front .row.items > div').sliceHeight({'row': '.row.items', 'item': '.item1'});
20454
20455	/* bug fix in ff*/
20456	$('img').removeAttr('draggable');
20457
20458	clicked_tab = 0;
20459
20460	$('.title-tab-heading').on('click', function(){
20461		var container = $(this).parent(),
20462			slide_block = $(this).next(),
20463			bReviewTab = container.hasClass('media_review');
20464
20465		clicked_tab = container.index()+1;
20466
20467		container.siblings().removeClass('active');
20468
20469		$('.nav.nav-tabs li').removeClass('active');
20470
20471		if(container.hasClass('active'))
20472		{
20473			if(bReviewTab)
20474			{
20475				$('#reviews_content').slideUp(200, function(){
20476					container.removeClass('active');
20477				});
20478			}
20479			else
20480			{
20481				slide_block.slideUp(200, function(){
20482					container.removeClass('active');
20483				});
20484			}
20485		}
20486		else
20487		{
20488			container.addClass('active');
20489			if(bReviewTab)
20490			{
20491				$('#reviews_content').slideDown();
20492			}
20493			else
20494			{
20495				if($('.tabs_section + #reviews_content').length)
20496					$('.tabs_section + #reviews_content').slideUp();
20497				slide_block.slideDown();
20498				if(typeof container.attr('id') !== 'undefined' && container.attr('id') == 'descr'){
20499					var $gallery = $('.galerys-block');
20500					if($gallery.length){
20501						var bTypeBig = $gallery.find('.big_slider').length;
20502						var $slider = bTypeBig ? $gallery.find('.big_slider') : $gallery.find('.small_slider');
20503						InitFlexSlider();
20504						var interval = setInterval(function(){
20505							if($slider.find('.slides .item').attr('style').indexOf('height') === -1){
20506								$(window).resize();
20507							}
20508							else{
20509								clearInterval(interval);
20510							}
20511						}, 100);
20512					}
20513				}
20514			}
20515		}
20516	})
20517
20518	InitFlexSlider();
20519
20520	setTimeout(function(){
20521		InitTopestMenuGummi();
20522		isOnceInited = true;
20523	},50);
20524
20525	InitZoomPict();
20526
20527	$(document).on('click', '.captcha_reload', function(e){
20528		var captcha = $(this).parents('.captcha-row');
20529		e.preventDefault();
20530		$.ajax({
20531			url: arNextOptions['SITE_DIR'] + 'ajax/captcha.php'
20532		}).done(function(text){
20533			captcha.find('input[name=captcha_sid]').val(text);
20534			captcha.find('input[name=captcha_code]').val(text);
20535			captcha.find('img').attr('src', '/bitrix/tools/captcha.php?captcha_sid=' + text);
20536			captcha.find('input[name=captcha_word]').val('').removeClass('error');
20537			captcha.find('.captcha_input').removeClass('error').find('.error').remove();
20538		});
20539	});
20540
20541	/* show print */
20542	if(arNextOptions["PAGES"]["BASKET_PAGE"])
20543	{
20544		if(arNextOptions["THEME"]["SHOW_BASKET_PRINT"]=="Y")
20545		{
20546			if($('.page-top h1').length)
20547				$('<div class="print-link" title="'+arNextOptions["THEME"]["EXPRESSION_FOR_PRINT_PAGE"]+'"><i class="svg svg-print"></i></div>').insertBefore($('.page-top h1'));
20548		}
20549	}
20550	else
20551	{
20552		if(arNextOptions['THEME']['PRINT_BUTTON'] == 'Y')
20553		{
20554			setTimeout(function(){				
20555				if($('.page-top .rss-block.top').length)
20556				{
20557					$('<div class="print-link" title="'+arNextOptions["THEME"]["EXPRESSION_FOR_PRINT_PAGE"]+'"><i class="svg svg-print"></i></div>').insertBefore($('.page-top .rss-block.top .share_wrapp'));
20558				}
20559				else if($('.page-top .rss').length)
20560				{
20561					$('<div class="print-link" title="'+arNextOptions["THEME"]["EXPRESSION_FOR_PRINT_PAGE"]+'"><i class="svg svg-print"></i></div>').insertAfter($('.page-top .rss'));
20562				}
20563				else if($('.page-top h1').length){
20564					$('<div class="print-link" title="'+arNextOptions["THEME"]["EXPRESSION_FOR_PRINT_PAGE"]+'"><i class="svg svg-print"></i></div>').insertBefore($('.page-top h1'));
20565				}
20566				$('.page-top .page-top-main').addClass('wprint');				
20567				// else
20568					// $('footer .print-block').html('<div class="print-link"><i class="svg svg-print"><svg id="Print.svg" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><path class="cls-1" d="M1553,287h-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,1553,287Zm-8,1h4v-4h-4v4Zm4-12h-4v2h4v-2Zm4,4h-12v5h2v-3h8v3h2v-5Z" transform="translate(-1539 -274)"/></svg></i></div>');
20569			},150);
20570		}
20571	}
20572
20573	$(document).on('click', '.print-link', function(){
20574		window.print();
20575	})
20576
20577	$('.head-block .item-link').on('click', function(){
20578		var _this = $(this);
20579		_this.siblings().removeClass('active');
20580		_this.addClass('active');
20581	})
20582
20583	$('table.table').each(function(){
20584		var _this = $(this),
20585			first_td = _this.find('thead tr th');
20586		if(!first_td.length)
20587			first_td = _this.find('thead tr td');
20588		if(first_td.length)
20589		{
20590			var j = 0;
20591			_this.find('tbody tr td').each(function(i){
20592				if(j > first_td.length-1)
20593					j = 0;
20594				$('<div class="th-mobile">'+first_td[j].textContent+'</div>').appendTo($(this));
20595				j++;
20596			})
20597		}
20598	})
20599
20600	if(window.matchMedia('(min-width: 768px)').matches)
20601		$('.wrapper_middle_menu.wrap_menu').removeClass('mobile');
20602
20603
20604	if(window.matchMedia('(max-width: 767px)').matches)
20605		$('.wrapper_middle_menu.wrap_menu').addClass('mobile');
20606
20607	$('.menu_top_block .v_bottom > a').on('click', function(e){
20608		if($(e.target).hasClass('toggle_block'))
20609			e.preventDefault();
20610	});
20611
20612	$('.menu_top_block .v_bottom > a .toggle_block').on('click', function(e){
20613		$(this).closest('.v_bottom').toggleClass('opened');
20614		$(this).closest('.v_bottom').find('>.dropdown').slideToggle()
20615	});
20616
20617	$(document).on('click', '.show_props', function(){
20618		$(this).prev('.props_list_wrapp').stop().slideToggle(333);
20619		$(this).find('.char_title').toggleClass('opened');
20620	});
20621
20622	$('.see_more').on('click', function(e) {
20623		e.preventDefault();
20624		var see_more = ($(this).is('.see_more') ? $(this) : $(this).parents('.see_more').first());
20625		var see_moreText = (see_more.find('> a').length ? see_more.find('> a') : see_more);
20626		var see_moreHiden = see_more.parent().find('> .d');
20627		if(see_more.hasClass('open')){
20628			see_moreText.text(BX.message('CATALOG_VIEW_MORE'));
20629			see_more.removeClass('open');
20630			see_moreHiden.hide();
20631		}
20632		else{
20633			see_moreText.text(BX.message('CATALOG_VIEW_LESS'));
20634			see_more.addClass('open');
20635			see_moreHiden.show();
20636		}
20637		return false;
20638	});
20639
20640	$('.button.faq_button').click(function(e){
20641		e.preventDefault();
20642		$(this).toggleClass('opened');
20643		$('.faq_ask .form').slideToggle();
20644	});
20645
20646	$('.staff.list .staff_section .staff_section_title a').click(function(e) {
20647		e.preventDefault();
20648		$(this).parents('.staff_section').toggleClass('opened');
20649		$(this).parents('.staff_section').find('.staff_section_items').stop().slideToggle(600);
20650		$(this).parents('.staff_section_title').find('.opener_icon').toggleClass('opened');
20651	});
20652
20653	$('.jobs_wrapp .item .name').click(function(e) {
20654		$(this).closest('.item').toggleClass('opened');
20655		$(this).closest('.item').find('.description_wrapp').stop().slideToggle(600);
20656		$(this).closest('.item').find('.opener_icon').toggleClass('opened');
20657	});
20658
20659	$('.faq.list .item .q a').on('click', function(e){
20660		e.preventDefault();
20661		$(this).parents('.item').toggleClass('opened');
20662		$(this).parents('.item').find('.a').stop().slideToggle();
20663		$(this).parents('.item').find('.q .opener_icon').toggleClass('opened');
20664	});
20665
20666	$('.opener_icon').click(function(e) {
20667		e.preventDefault();
20668		$(this).parent().find('a').trigger('click');
20669	});
20670
20671	$('.dotdot').dotdotdot();
20672
20673	$('.more_block span').on('click', function() {
20674		var content_offset=$('.catalog_detail .tabs_section').offset();
20675		$('html, body').animate({scrollTop: content_offset.top-43}, 400);
20676	});
20677
20678	$(document).on("click", ".counter_block:not(.basket) .plus", function(){
20679		if(!$(this).parents('.basket_wrapp').length){
20680			if($(this).parent().data("offers")!="Y"){
20681				var isDetailSKU2 = $(this).parents('.counter_block_wr').length;
20682					input = $(this).parents(".counter_block").find("input[type=text]")
20683					/*Elvira start*/
20684					//tmp_ratio = !isDetailSKU2 ? $(this).parents(".counter_wrapp").find(".to-cart").data('ratio') : $(this).parents('tr').first().find("td.buy .to-cart").data('ratio'),
20685					tmp_ratio = !isDetailSKU2 ? $(this).parents(".counter_wrapp").find(".to-cart").data('ratio') : $(this).parents('tr').first().find("td.buy .to-cart").data('ratio'),
20686					/*Elvira end*/
20687					isDblQuantity = !isDetailSKU2 ? $(this).parents(".counter_wrapp").find(".to-cart").data('float_ratio') : $(this).parents('tr').first().find("td.buy .to-cart").data('float_ratio'),
20688					ratio=( isDblQuantity ? parseFloat(tmp_ratio) : parseInt(tmp_ratio, 10)),
20689					max_value='';
20690					currentValue = input.val();
20691
20692
20693				if(isDblQuantity)
20694					ratio = Math.round(ratio*arNextOptions.JS_ITEM_CLICK.precisionFactor)/arNextOptions.JS_ITEM_CLICK.precisionFactor;
20695
20696				curValue = (isDblQuantity ? parseFloat(currentValue) : parseInt(currentValue, 10));
20697
20698				curValue += ratio;
20699				if (isDblQuantity){
20700					curValue = Math.round(curValue*arNextOptions.JS_ITEM_CLICK.precisionFactor)/arNextOptions.JS_ITEM_CLICK.precisionFactor;
20701				}
20702				if(parseFloat($(this).data('max'))>0){
20703					if(input.val() < $(this).data('max')){
20704						if(curValue<=$(this).data('max'))
20705							input.val(curValue);
20706
20707						input.change();
20708					}
20709				}else{
20710					input.val(curValue);
20711					input.change();
20712				}
20713
20714				//
20715				if (typeof window.add_prev_timeout != 'undefined') {
20716					clearTimeout(add_prev_timeout);
20717					//console.log('plus clear timeout');
20718				}
20719				let item_id = $(this).parents(".counter_block").attr('data-item');
20720				if (curValue >= 1) {
20721					if (typeof item_id != 'undefined' && $('.basket_fly #basket_form tr[product-id="'+item_id+'"] .counter_block input').length > 0) {
20722
20723						window.add_prev_timeout = setTimeout(function() {
20724							$('.basket_fly #basket_form tr[product-id="'+item_id+'"] .counter_block input').val(curValue).change();
20725							//console.log('plus change');
20726						}, 1000);
20727
20728					}
20729				}
20730
20731			}
20732		}
20733	});
20734
20735	$(document).on("click", ".counter_block:not(.basket) .minus", function(){
20736		if(!$(this).parents('.basket_wrapp').length){
20737			if($(this).parent().data("offers")!="Y"){
20738				var isDetailSKU2 = $(this).parents('.counter_block_wr').length;
20739					input = $(this).parents(".counter_block").find("input[type=text]")
20740					tmp_ratio = !isDetailSKU2 ? $(this).parents(".counter_wrapp").find(".to-cart").data('ratio') : $(this).parents('tr').first().find("td.buy .to-cart").data('ratio'),
20741					isDblQuantity = !isDetailSKU2 ? $(this).parents(".counter_wrapp").find(".to-cart").data('float_ratio') : $(this).parents('tr').first().find("td.buy .to-cart").data('float_ratio'),
20742					ratio=( isDblQuantity ? parseFloat(tmp_ratio) : parseInt(tmp_ratio, 10)),
20743					max_value='';
20744					currentValue = input.val();
20745
20746				if(isDblQuantity)
20747					ratio = Math.round(ratio*arNextOptions.JS_ITEM_CLICK.precisionFactor)/arNextOptions.JS_ITEM_CLICK.precisionFactor;
20748
20749				curValue = (isDblQuantity ? parseFloat(currentValue) : parseInt(currentValue, 10));
20750
20751				curValue -= ratio;
20752				if (isDblQuantity){
20753					curValue = Math.round(curValue*arNextOptions.JS_ITEM_CLICK.precisionFactor)/arNextOptions.JS_ITEM_CLICK.precisionFactor;
20754				}
20755
20756				if(parseFloat($(this).parents(".counter_block").find(".plus").data('max'))>0){
20757					if(currentValue > ratio){
20758						if(curValue<ratio){
20759							input.val(ratio);
20760						}else{
20761							input.val(curValue);
20762						}
20763						input.change();
20764					}
20765				}else{
20766					if(curValue > ratio){
20767						input.val(curValue);
20768					}else{
20769						if(ratio){
20770							input.val(ratio);
20771						}else if(currentValue > 1){
20772							input.val(curValue);
20773						}
20774					}
20775					input.change();
20776				}
20777
20778				//
20779				if (typeof window.rem_prev_timeout != 'undefined') {
20780					clearTimeout(rem_prev_timeout);
20781				}
20782				let item_id = $(this).parents(".counter_block").attr('data-item');
20783				if (curValue >= 1) {
20784					if (typeof item_id != 'undefined' && $('.basket_fly #basket_form tr[product-id="'+item_id+'"] .counter_block input').length > 0) {
20785						window.rem_prev_timeout = setTimeout(function() {
20786							$('.basket_fly #basket_form tr[product-id="'+item_id+'"] .counter_block input').val(curValue).change();
20787						}, 1000);
20788					}
20789				} else {
20790					if (typeof item_id != 'undefined' && $('.basket_fly #basket_form tr[product-id="'+item_id+'"] .remove-cell a.remove').length > 0) {						
20791						$('.basket_fly #basket_form tr[product-id="'+item_id+'"] .remove-cell a.remove').click();
20792					}
20793				}
20794
20795			}
20796		}
20797	});
20798
20799	$('.counter_block input[type=text]').numeric({allow:"."});
20800	$('.counter_block input[type=text]').on('focus', function(){
20801		$(this).addClass('focus');
20802	});
20803	$('.counter_block input[type=text]').on('blur', function(){
20804		$(this).removeClass('focus');
20805	});
20806
20807	var timerInitCalculateDelivery = false;
20808	$(document).on("change", ".counter_block input[type=text]", function(e){
20809		if(!$(this).parents('.basket_wrapp').length){
20810			var val = $(this).val(),
20811				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'),
20812				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'),
20813				ratio=( isDblQuantity ? parseFloat(tmp_ratio) : parseInt(tmp_ratio, 10)),
20814				diff = val % ratio;
20815
20816			if(isDblQuantity)
20817			{
20818				ratio = Math.round(ratio*arNextOptions.JS_ITEM_CLICK.precisionFactor)/arNextOptions.JS_ITEM_CLICK.precisionFactor;
20819				if(Math.round(diff*arNextOptions.JS_ITEM_CLICK.precisionFactor)/arNextOptions.JS_ITEM_CLICK.precisionFactor == ratio)
20820					diff = 0;
20821			}
20822
20823			if($(this).hasClass('focus'))
20824			{
20825				intCount = Math.round(
20826					Math.round(val * arNextOptions.JS_ITEM_CLICK.precisionFactor / ratio) / arNextOptions.JS_ITEM_CLICK.precisionFactor
20827				) || 1;
20828				val = (intCount <= 1 ? ratio : intCount * ratio);
20829				// val -= diff;
20830				val = Math.round(val*arNextOptions.JS_ITEM_CLICK.precisionFactor)/arNextOptions.JS_ITEM_CLICK.precisionFactor;
20831			}
20832
20833			if(parseFloat($(this).parents(".counter_block").find(".plus").data('max'))>0){
20834				if(val>parseFloat($(this).parents(".counter_block").find(".plus").data('max'))){
20835					val=parseFloat($(this).parents(".counter_block").find(".plus").data('max'));
20836					// val -= (val % ratio);
20837				}
20838			}
20839			if(val<ratio){
20840				val=ratio;
20841			}else if(!parseFloat(val)){
20842				val=1;
20843			}
20844
20845			$(this).parents('.counter_block').parent().parent().find('.to-cart').attr('data-quantity', val);
20846			$(this).parents('.counter_block').closest('.buy_block').find('.one_click').attr('data-quantity', val);
20847			$(this).val(val);
20848
20849			var $calculate = $(this).closest('.item').length ? $(this).closest('.item').find('.calculate-delivery') : $(this).closest('.catalog_detail').find('.calculate-delivery');
20850			if($calculate.length){
20851				$calculate.each(function(){
20852					var $calculateSpan = $(this).find('span[data-event=jqm]').first();
20853
20854					if($calculateSpan.length){
20855						var $clone = $calculateSpan.clone();
20856						$clone.attr('data-param-quantity', val).removeClass('clicked');
20857						$clone.insertAfter($calculateSpan).on('click', function(){
20858							if(!jQuery.browser.mobile){
20859								$(this).parent().addClass('loadings');
20860							}
20861						});
20862						$calculateSpan.remove();
20863					}
20864
20865					if($(this).hasClass('with_preview')){
20866						$(this).removeClass('inited');
20867
20868						if(timerInitCalculateDelivery){
20869							clearTimeout(timerInitCalculateDelivery);
20870						}
20871
20872						timerInitCalculateDelivery = setTimeout(function(){
20873							initCalculatePreview();
20874							timerInitCalculateDelivery = false;
20875						}, 1000);
20876					}
20877				});
20878			}
20879
20880			var eventdata = {type: 'change', params: {id: $(this), value: val}};
20881			BX.onCustomEvent('onCounterProductAction', [eventdata]);
20882		}
20883	});
20884
20885	BX.addCustomEvent('onCounterProductAction', function(eventdata) {
20886		if(typeof eventdata != 'object'){
20887			eventdata = {type: 'undefined'};
20888		}
20889		try{
20890			if(typeof eventdata.type != 'undefined'){
20891				if(!eventdata.params.id.closest('.gifts').length) // no gift
20892				{
20893					var obProduct = eventdata.params.id.data('product');
20894
20895					if(eventdata.params.id.closest('.has_offer_prop').length) // type1 for offers in element list
20896					{
20897						if(typeof window['obSkuQuantys'] === 'undefined')
20898							window["obSkuQuantys"] = {};
20899
20900						// if(typeof window['obOffers'] === 'undefined')
20901							window["obSkuQuantys"][eventdata.params.id.closest('.offer_buy_block').find('.to-cart').data('item')] = eventdata.params.value;
20902					}
20903					if(typeof window[obProduct] == 'object')
20904					{
20905						if(obProduct == "obOffers")
20906							setPriceAction('', '', 'Y');
20907						else
20908							window[obProduct].setPriceAction('Y');
20909					}
20910					else if(eventdata.params.id.length)
20911					{
20912						if(eventdata.params.id.closest('.main_item_wrapper').length && arNextOptions['THEME']['SHOW_TOTAL_SUMM'] == 'Y')
20913						{
20914							setPriceItem(eventdata.params.id.closest('.main_item_wrapper'), eventdata.params.value);
20915						}
20916					}
20917					BX.onCustomEvent('onCounterProductActionResize');
20918				}
20919			}
20920		}
20921		catch(e){
20922			console.error(e)
20923		}
20924	});
20925
20926	/*slide cart*/
20927	$(document).on('mouseenter', '#basket_line .basket_normal:not(.empty_cart):not(.bcart) .basket_block ', function() {
20928		$(this).closest('.basket_normal').find('.popup').addClass('block');
20929		$(this).closest('.basket_normal').find('.basket_popup_wrapp').stop(true,true).slideDown(150);
20930	});
20931	$(document).on('mouseleave', '#basket_line .basket_normal .basket_block ', function() {
20932		var th=$(this);
20933		$(this).closest('.basket_normal').find('.basket_popup_wrapp').stop(true,true).slide
20933Up(150, function(){
20934			th.closest('.basket_normal').find('.popup').removeClass('block');
20935		});
20936	});
20937
20938	$(document).on('click', '.popup_button_basket', function(){
20939		var th=$(".to-cart[data-item="+$(this).data("item")+"]");
20940
20941		var val = th.attr('data-quantity');
20942
20943		if(!val) $val = 1;
20944
20945		var tmp_props=th.data("props"),
20946			props='',
20947			part_props='',
20948			add_props='N',
20949			fill_prop={},
20950			iblockid = th.data('iblockid'),
20951			offer = th.data('offers'),
20952			rid='',
20953			basket_props='',
20954			item = th.attr('data-item');
20955
20956		if(offer!="Y"){
20957			offer = "N";
20958		}else{
20959			basket_props=th.closest('.prices_tab').find('.bx_sku_props input').val();
20960		}
20961		if(tmp_props){
20962			props=tmp_props.toString().split(";");
20963		}
20964		if(th.data("part_props")){
20965			part_props=th.data("part_props");
20966		}
20967		if(th.data("add_props")){
20968			add_props=th.data("add_props");
20969		}
20970		if($('.rid_item').length){
20971			rid=$('.rid_item').data('rid');
20972		}else if(th.data('rid')){
20973			rid=th.data('rid');
20974		}
20975
20976		fill_prop=fillBasketPropsExt(th, 'prop', 'bx_ajax_text');
20977
20978		fill_prop.quantity=val;
20979		fill_prop.add_item='Y';
20980		fill_prop.rid=rid;
20981		fill_prop.offers=offer;
20982		fill_prop.iblockID=iblockid;
20983		fill_prop.part_props=part_props;
20984		fill_prop.add_props=add_props;
20985		fill_prop.props=JSON.stringify(props);
20986		fill_prop.item=item;
20987		fill_prop.basket_props=basket_props;
20988
20989		$.ajax({
20990			type:"POST",
20991			url:arNextOptions['SITE_DIR']+"ajax/item.php",
20992			data:fill_prop,
20993			dataType:"json",
20994			success:function(data){
20995				$('.basket_error_frame').jqmHide();
20996				if("STATUS" in data){
20997					getActualBasket(fill_prop.iblockID);
20998					if(data.STATUS === 'OK'){
20999						th.hide();
21000						th.closest('.counter_wrapp').find('.counter_block').hide();
21001						th.parents('tr').find('.counter_block_wr .counter_block').hide();
21002						th.closest('.button_block').addClass('wide');
21003						th.parent().find('.in-cart').show();
21004
21005						addBasketCounter(item);
21006						$('.wish_item[data-item='+item+']').removeClass("added");
21007						$('.wish_item[data-item='+item+']').find(".value").show();
21008						$('.wish_item[data-item='+item+']').find(".value.added").hide();
21009
21010						if($("#ajax_basket").length)
21011							reloadTopBasket('add', $('#ajax_basket'), 200, 5000, 'Y');
21012
21013						if($("#basket_line .basket_fly").length){
21014							if(th.closest('.fast_view_frame').length || window.matchMedia('(max-width: 767px)').matches)
21015								basketFly('open', 'N');
21016							else
21017								basketFly('open');
21018						}
21019
21020					}else{
21021						showBasketError(BX.message(data.MESSAGE));
21022					}
21023				}else{
21024					showBasketError(BX.message("CATALOG_PARTIAL_BASKET_PROPERTIES_ERROR"));
21025				}
21026			}
21027		});
21028	})
21029
21030	$("body").on( 'click', '.to-cart:not(.read_more)', function(e){
21031		e.preventDefault();
21032		var th=$(this);
21033		var ypkr=$(this).attr('data-ypk');
21034		var countr=$(this).attr('data-countr');
21035		if(!th.hasClass('clicked'))
21036		{
21037			th.addClass('clicked');
21038			var val = $(this).attr('data-quantity');
21039
21040
21041			var tmp_props=$(this).data("props"),
21042				props='',
21043				part_props='',
21044				add_props='N',
21045				fill_prop={},
21046				iblockid = $(this).data('iblockid'),
21047				offer = $(this).data('offers'),
21048				rid='',
21049				basket_props='',
21050				item = $(this).attr('data-item');
21051			if(th.closest('.but-cell').length)
21052			{
21053				if($('.counter_block[data-item="'+item+'"]').length)
21054					val = $('.counter_block[data-item="'+item+'"] input').val();
21055			}
21056
21057			if(!val)
21058				val = 1;
21059			if(offer!="Y"){
21060				offer = "N";
21061			}else{
21062				basket_props=$(this).closest('.prices_tab').find('.bx_sku_props input').val();
21063			}
21064			if(tmp_props){
21065				props=tmp_props.toString().split(";");
21066			}
21067			if($(this).data("part_props")){
21068				part_props=$(this).data("part_props");
21069			}
21070			if($(this).data("add_props")){
21071				add_props=$(this).data("add_props");
21072			}
21073			if($('.rid_item').length){
21074				rid=$('.rid_item').data('rid');
21075			}else if($(this).data('rid')){
21076				rid=$(this).data('rid');
21077			}
21078			console.log(countr);
21079			console.log(val);
21080			val = countr*val;
21081			console.log(val);
21082
21083			fill_prop=fillBasketPropsExt(th, 'prop', th.data('bakset_div'));
21084			/*fill_prop.prop = {TSVET:'22'};*/
21085			fill_prop.quantity=val;
21086			fill_prop.add_item='Y';
21087			fill_prop.rid=rid;
21088			fill_prop.offers=offer;
21089			fill_prop.iblockID=iblockid;
21090			fill_prop.ypk=ypkr;
21091			fill_prop.countre=countr;
21092			fill_prop.part_props=part_props;
21093			fill_prop.add_props=add_props;
21094			fill_prop.props=JSON.stringify(props);
21095			fill_prop.item=item;
21096			fill_prop.basket_props=basket_props;
21097
21098			if(th.data("empty_props")=="N"){
21099				showBasketError($("#"+th.data("bakset_div")).html(), BX.message("ERROR_BASKET_PROP_TITLE"), "Y", th);
21100
21101				var eventdata = {action:'loadForm'};
21102				BX.onCustomEvent('onCompleteAction', [eventdata, th[0]]);
21103			}else{
21104				$.ajax({
21105					type:"POST",
21106					url:arNextOptions['SITE_DIR']+"ajax/item.php",
21107					data:fill_prop,
21108					dataType:"json",
21109					cache:false,
21110					success:function(data){
21111						getActualBasket(fill_prop.iblockID);
21112
21113						var eventdata = {action:'loadForm'};
21114						BX.onCustomEvent('onCompleteAction', [eventdata, th[0]]);
21115						arStatusBasketAspro = {};
21116
21117						if(data !==null){
21118							if("STATUS" in data){
21119								if(data.MESSAGE_EXT===null)
21120									data.MESSAGE_EXT='';
21121								if(data.STATUS === 'OK'){
21122									
21123									var titlename = "";
21124									if($('.catalog_detail__title.desk').text().length > 1) {
21125										titlename = $('.catalog_detail__title.desk').text();
21126									}
21127									if(th.parents(".catalog_item").find('.item-title span').text().length > 1){
21128										titlename = th.parents(".catalog_item").find('.item-title span').text();
21129									}
21130									
21131									if(data.QUANBLOCKED === 'OK'){
21132									toastr.options = {
21133										"closeButton": true,
21134										"debug": false,
21135										"newestOnTop": false,
21136										"progressBar": true,
21137										"positionClass": "toast-bottom-left",
21138										"preventDuplicates": false,
21139										"onclick": null,
21140										"showDuration": "300",
21141										"hideDuration": "1000",
21142										"timeOut": "5000",
21143										"extendedTimeOut": "1000",
21144										"showEasing": "swing",
21145										"hideEasing": "linear",
21146										"showMethod": "fadeIn",
21147										"hideMethod": "fadeOut"
21148									}
21149									toastr["error"]("Товар добавлен в корзин
21149у, но сейчас на складе товара меньше чем вы пытаетесь выбрать, попробуйте выбрать другое кол-во товара! <br><br> "+titlename);
21150										
21151									} else {
21152									// th.hide();
21153									toastr.options = {
21154										"closeButton": true,
21155										"debug": false,
21156										"newestOnTop": false,
21157										"progressBar": true,
21158										"positionClass": "toast-bottom-left",
21159										"preventDuplicates": false,
21160										"onclick": null,
21161										"showDuration": "300",
21162										"hideDuration": "1000",
21163										"timeOut": "5000",
21164										"extendedTimeOut": "1000",
21165										"showEasing": "swing",
21166										"hideEasing": "linear",
21167										"showMethod": "fadeIn",
21168										"hideMethod": "fadeOut"
21169									}
21170									toastr["success"]("Товар добавлен в корзину! <br><br> "+titlename);
21171									
21172									}
21173									//$('.to-cart[data-item='+item+']').hide();
21174									$('.to-cart[data-item='+item+']').closest('.counter_wrapp').find('.counter_block').hide();
21175									$('.to-cart[data-item='+item+']').parents('tr').find('.counter_block_wr .counter_block').hide();
21176									$('.to-cart[data-item='+item+']').closest('.button_block').addClass('wide');
21177									// th.parent().find('.in-cart').show();
21178									// $('.in-cart[data-item='+item+']').show();
21179
21180									addBasketCounter(item);
21181									$('.wish_item[data-item='+item+']').removeClass("added");
21182									$('.wish_item[data-item='+item+']').find(".value").show();
21183									$('.wish_item[data-item='+item+']').find(".value.added").hide();
21184
21185									if($("#ajax_basket").length)
21186										reloadTopBasket('add', $('#ajax_basket'), 200, 5000, 'Y');
21187
21188									if($("#basket_line .basket_fly").length){
21189										if(th.closest('.fast_view_frame').length || window.matchMedia('(max-width: 767px)').matches  || $("#basket_line .basket_fly.loaded").length)
21190											basketFly('open', 'N', true);
21191										else
21192											basketFly('open', undefined, true);
21193									}
21194
21195									//
21196									//$('.to-cart[data-item='+item+']').parents('.footer_button').addClass('in_cart');
21197									//$('.to-cart[data-item='+item+']').parents('.buy_block').addClass('in_cart');
21198
21199								}else{
21200									showBasketError(BX.message(data.MESSAGE)+' <br/>'+data.MESSAGE_EXT);
21201								}
21202							}else{
21203								showBasketError(BX.message("CATALOG_PARTIAL_BASKET_PROPERTIES_ERROR"));
21204							}
21205						}else{
21206							// th.hide();
21207							$('.to-cart[data-item='+item+']').hide();
21208							$('.to-cart[data-item='+item+']').closest('.counter_wrapp').find('.counter_block').hide();
21209							$('.to-cart[data-item='+item+']').parents('tr').find('.counter_block_wr .counter_block').hide();
21210							$('.to-cart[data-item='+item+']').closest('.button_block').addClass('wide');
21211							// th.parent().find('.in-cart').show();
21212							$('.in-cart[data-item='+item+']').show();
21213
21214							addBasketCounter(item);
21215							$('.wish_item[data-item='+item+']').removeClass("added");
21216							$('.wish_item[data-item='+item+']').find(".value").show();
21217							$('.wish_item[data-item='+item+']').find(".value.added").hide();
21218
21219							if($("#ajax_basket").length)
21220								reloadTopBasket('add', $('#ajax_basket'), 200, 5000, 'Y');
21221
21222							if($("#basket_line .basket_fly").length)
21223							{
21224								if(th.closest('.fast_view_frame').length || window.matchMedia('(max-width: 767px)').matches  || $("#basket_line .basket_fly.loaded").length)
21225									basketFly('open', 'N');
21226								else
21227									basketFly('open');
21228							}
21229						}
21230					}
21231				});
21232			}
21233		}
21234
21235	})
21236
21237	$(document).on('click', '.to-subscribe', function(e){
21238		e.preventDefault();
21239		var th=$(this);
21240		if(!th.hasClass('clicked'))
21241		{
21242			th.addClass('clicked');
21243			if($(this).is('.auth'))
21244			{
21245				if($(this).hasClass('nsubsc'))
21246				{
21247					$(this).jqmEx();
21248					$(this).trigger('click');
21249				}
21250				else
21251				{
21252					location.href=arNextOptions['SITE_DIR']+'auth/?backurl='+location.pathname;
21253				}
21254			}
21255			else
21256			{
21257				var item = $(this).attr('data-item'),
21258					iblockid = $(this).attr('data-iblockid');
21259				// $(this).hide();
21260				$('.to-subscribe[data-item='+item+']').hide();
21261				$('.to-subscribe[data-item='+item+']').parent().find('.in-subscribe').show();
21262				$.get(arNextOptions['SITE_DIR'] + 'ajax/item.php?item=' + item + '&subscribe_item=Y',
21263					$.proxy(function(data){
21264						arStatusBasketAspro = {};
21265						getActualBasket(iblockid);
21266					})
21267				);
21268				th.removeClass('clicked');
21269			}
21270		}
21271	})
21272
21273	$(document).on('click', '.in-subscribe', function(e){
21274		e.preventDefault();
21275		var item = $(this).attr('data-item'),
21276			iblockid = $(this).attr('data-iblockid');;
21277		// $(this).hide();
21278		$('.in-subscribe[data-item='+item+']').hide();
21279		$('.in-subscribe[data-item='+item+']').parent().find('.to-subscribe').removeClass('clicked');
21280		$('.in-subscribe[data-item='+item+']').parent().find('.to-subscribe').show();
21281		$.get(arNextOptions['SITE_DIR'] + 'ajax/item.php?item=' + item + '&subscribe_item=Y',
21282			$.proxy(function(data){
21283				getActualBasket(iblockid);
21284				arStatusBasketAspro = {};
21285			})
21286		);
21287	})
21288
21289	$(document).on('click', '.wish_item', function(e){
21290		e.preventDefault();
21291		var val = $(this).attr('data-quantity'),
21292			_this = $(this),
21293			offer = $(this).data('offers'),
21294			iblockid = $(this).data('iblock'),
21295			tmp_props=$(this).data("props"),
21296			props='',
21297			item = $(this).attr('data-item');
21298			item2 = $(this).attr('data-item');
21299
21300		if(!_this.hasClass('clicked'))
21301		{
21302			_this.addClass('clicked');
21303			if(!val) $val = 1;
21304			if(offer!="Y") offer = "N";
21305			if(tmp_props){
21306				props=tmp_props.toString().split(";");
21307			}
21308			if(!$(this).hasClass('text')){
21309				if($(this).hasClass('added')){
21310					$(this).hide();
21311					$(this).closest('.wish_item_button').find('.to').show();
21312
21313					$('.like_icons').each(function(){
21314						if($(this).find('.wish_item.text[data-item="'+item+'"]').length){
21315							$(this).find('.wish_item.text[data-item="'+item+'"]').removeClass('added');
21316							$(this).find('.wish_item.text[data-item="'+item+'"]').find('.value').show();
21317							$(this).find('.wish_item.text[data-item="'+item+'"]').find('.value.added').hide();
21318						}
21319						if($(this).find('.wish_item_button').length){
21320							$(this).find('.wish_item_button').find('.wish_item[data-item="'+item+'"]').removeClass('added');
21321							$(this).find('.wish_item_button').find('.wish_item[data-item="'+item+'"]').find('.value').show();
21322							$(this).find('.wish_item_button').find('.wish_item[data-item="'+item+'"]').find('.value.added').hide();
21323						}
21324					})
21325				}
21326				else{
21327					$(this).hide();
21328					$(this).closest('.wish_item_button').find('.in').addClass('added').show();
21329
21330					$('.like_icons').each(function(){
21331						if($(this).find('.wish_item.text[data-item="'+item+'"]').length){
21332							$(this).find('.wish_item.text[data-item="'+item+'"]').addClass('added');
21333							$(this).find('.wish_item.text[data-item="'+item+'"]').find('.value').hide();
21334							$(this).find('.wish_item.text[data-item="'+item+'"]').find('.value.added').css({"display":"block"})
21335						}
21336						if($(this).find('.wish_item_button').length){
21337							$(this).find('.wish_item_button').find('.wish_item[data-item="'+item+'"]').addClass('added');
21338							$(this).find('.wish_item_button').find('.wish_item[data-item="'+item+'"]').find('.value').hide();
21339							$(this).find('.wish_item_button').find('.wish_item[data-item="'+item+'"]').find('.value.added').show();
21340						}
21341					})
21342				}
21343			}else{
21344				if(!$(this).hasClass('added')){
21345					$('.wish_item[data-item=' + item + ']').addClass('added');
21346					$('.wish_item[data-item=' + item + ']').find('.value').hide();
21347					$('.wish_item[data-item=' + item + ']').find('.value.added').css('display','block');
21348
21349					$('.like_icons').each(function(){
21350						if($(this).find('.wish_item_button').length){
21351							$(this).find('.wish_item_button').find('.wish_item[data-item="'+item+'"]').addClass('added');
21352							$(this).find('.wish_item_button').find('.wish_item[data-item="'+item+'"]').find('.value').hide();
21353							$(this).find('.wish_item_button').find('.wish_item[data-item="'+item+'"]').find('.value.added').show();
21354						}
21355					})
21356				}else{
21357					$('.wish_item[data-item=' + item + ']').removeClass('added');
21358					$('.wish_item[data-item=' + item + ']').find('.value').show();
21359					$('.wish_item[data-item=' + item + ']').find('.value.added').hide();
21360
21361					$('.like_icons').each(function(){
21362						if($(this).find('.wish_item_button').length){
21363							$(this).find('.wish_item_button').find('.wish_item[data-item="'+item+'"]').removeClass('added');
21364							$(this).find('.wish_item_button').find('.wish_item[data-item="'+item+'"]').find('.value').show();
21365							$(this).find('.wish_item_button').find('.wish_item[data-item="'+item+'"]').find('.value.added').hide();
21366						}
21367					})
21368				}
21369			}
21370
21371			$('.in-cart[data-item=' + item + ']').hide();
21372			$('.to-cart[data-item=' + item + ']').removeClass('clicked');
21373			$('.to-cart[data-item=' + item + ']').parent().removeClass('wide');
21374			if(!$('.counter_block[data-item=' + item + ']').closest('.counter_wrapp').find('.to-order').length)
21375			{
21376				$('.to-cart[data-item=' + item + ']').show();
21377				$('.counter_block[data-item=' + item + ']').show();
21378			}
21379			if(!$(this).closest('.module-cart').size()){
21380				$.ajax({
21381					type:"GET",
21382					url:arNextOptions['SITE_DIR']+"ajax/item.php",
21383					data:"item="+item2+"&quantity="+val+"&wish_item=Y"+"&offers="+offer+"&iblockID="+iblockid+"&props="+JSON.stringify(props),
21384					dataType:"json",
21385					success: function(data){
21386						getActualBasket(iblockid);
21387						arStatusBasketAspro = {};
21388						if(data !==null){
21389							if(data.MESSAGE_EXT===null)
21390								data.MESSAGE_EXT='';
21391							if("STATUS" in data){
21392								if(data.STATUS === 'OK'){
21393									if(arNextOptions['COUNTERS']['USE_BASKET_GOALS'] !== 'N'){
21394										var eventdata = {goal: 'goal_wish_add', params: {id: item2}};
21395										BX.onCustomEvent('onCounterGoals', [eventdata]);
21396									}
21397									if($("#ajax_basket").length)
21398										reloadTopBasket('wish', $('#ajax_basket'), 200, 5000, 'N');
21399
21400									if($("#basket_line .basket_fly").length){
21401										if(_this.closest('.fast_view_frame').length || window.matchMedia('(max-width: 767px)').matches || $("#basket_line .basket_fly.loaded").length)
21402											basketFly('wish', 'N');
21403										else
21404											basketFly('wish');
21405									}
21406								}else{
21407									showBasketError(BX.message(data.MESSAGE)+' <br/>'+data.MESSAGE_EXT, BX.message("ERROR_ADD_DELAY_ITEM"));
21408								}
21409							}else{
21410								showBasketError(BX.message(data.MESSAGE)+' <br/>'+data.MESSAGE_EXT, BX.message("ERROR_ADD_DELAY_ITEM"));
21411							}
21412						}else{
21413							if($("#ajax_basket").length)
21414								reloadTopBasket('wish', $('#ajax_basket'), 200, 5000, 'N');
21415
21416							if($("#basket_line .basket_fly").length){
21417								if(_this.closest('.fast_view_frame').length || window.matchMedia('(max-width: 767px)').matches || $("#basket_line .basket_fly.loaded").length)
21418									basketFly('wish', 'N');
21419								else
21420									basketFly('wish');
21421							}
21422						}
21423					_this.removeClass('clicked');
21424					}
21425				});
21426			}
21427		}
21428
21429	})
21430
21431	$(document).on('click', '.item_main_info .item_slider .flex-direction-nav li span', function(e){
21432		if($('.inner_slider .slides_block').length)
21433		{
21434			if($(this).parent().hasClass('flex-nav-next'))
21435				$('.inner_slider .slides_block li.current').next().click();
21436			else
21437				$('.inner_slider .slides_block li.current').prev().click();
21438		}
21439	})
21440
21441	$(document).on('click', '.compare_item', function(e){
21442		e.preventDefault();
21443		var item = $(this).attr('data-item');
21444		var iblockID = $(this).attr('data-iblock');
21445		var th=$(this);
21446		if(!th.hasClass('clicked'))
21447		{
21448			th.addClass('clicked');
21449			if(!$(this).hasClass('text')){
21450				if($(this).hasClass('added')){
21451					$(this).hide();
21452					$(this).closest('.compare_item_button').find('.to').show();
21453
21454					/*sync other button*/
21455					$('.like_icons').each(function(){
21456						if($(this).find('.compare_item.text[data-item="'+item+'"]').length){
21457							$(this).find('.compare_item.text[data-item="'+item+'"]').removeClass('added');
21458							$(this).find('.compare_item.text[data-item="'+item+'"]').find('.value').show();
21459							$(this).find('.compare_item.text[data-item="'+item+'"]').find('.value.added').hide();
21460						}
21461						if($(this).find('.compare_item_button').length){
21462							$(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"]').removeClass('added');
21463							$(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"]').find('.value').show();
21464							$(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"]').find('.value.added').hide();
21465						}
21466					})
21467				}
21468				else{
21469					$(this).hide();
21470					$(this).closest('.compare_item_button').find('.in').show();
21471
21472					/*sync other button*/
21473					$('.like_icons').each(function(){
21474						if($(this).find('.compare_item.text[data-item="'+item+'"]').length){
21475							$(this).find('.compare_item.text[data-item="'+item+'"]').addClass('added');;
21476							$(this).find('.compare_item.text[data-item="'+item+'"]').find('.value').hide();
21477							$(this).find('.compare_item.text[data-item="'+item+'"]').find('.value.added').css({"display":"block"});
21478						}
21479						if($(this).find('.compare_item_button').length){
21480							$(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"]').addClass('added');
21481							$(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"]').find('.value.added').show();
21482							$(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"]').find('.value').hide();
21483						}
21484					})
21485				}
21486			}else{
21487				if(!$(this).hasClass('added')){
21488					$('.compare_item[data-item=' + item + ']').addClass('added');
21489					$('.compare_item[data-item=' + item + ']').find('.value').hide();
21490					$('.compare_item[data-item=' + item + ']').find('.value.added').css('display','block');
21491
21492					/*sync other button*/
21493					$('.like_icons').each(function(){
21494						if($(this).find('.compare_item_button').length){
21495							$(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"]').addClass('added');
21496							$(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"]').find('.value.added').show();
21497							$(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"]').find('.value').hide();
21498						}
21499					})
21500				}else{
21501					$('.compare_item[data-item=' + item + ']').removeClass('added');
21502					$('.compare_item[data-item=' + item + ']').find('.value').show();
21503					$('.compare_item[data-item=' + item + ']').find('.value.added').hide();
21504
21505					/*sync other button*/
21506					$('.like_icons').each(function(){
21507						if($(this).find('.compare_item_button').length){
21508							$(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"]').removeClass('added');
21509							$(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"]').find('.value').show();
21510							$(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"]').find('.value.added').hide();
21511						}
21512					})
21513				}
21514			}
21515
21516			$.get(arNextOptions['SITE_DIR'] + 'ajax/item.php?item=' + item + '&compare_item=Y&iblock_id=' + iblockID,
21517				$.proxy(function(data){
21518					getActualBasket(iblockID, 'Compare');
21519					arStatusBasketAspro = {};
21520					if($('#compare_fly').length){
21521						jsAjaxUtil.InsertDataToNode(arNextOptions['SITE_DIR'] + 'ajax/show_compare_preview_fly.php', 'compare_fly', false);
21522					}
21523				th.removeClass('clicked');
21524				})
21525			);
21526		}
21527
21528	});
21529
21530	$('.fancy').fancybox({
21531		openEffect  : 'fade',
21532		closeEffect : 'fade',
21533		nextEffect : 'fade',
21534		prevEffect : 'fade',
21535		tpl:{
21536			closeBtn : '<a title="'+BX.message('FANCY_CLOSE')+'" class="fancybox-item fancybox-close" href="javascript:;"></a>',
21537			next     : '<a title="'+BX.message('FANCY_NEXT')+'" class="fancybox-nav fancybox-next" href="javascript:;"><span></span></a>',
21538			prev     : '<a title="'+BX.message('FANCY_PREV')+'" class="fancybox-nav fancybox-prev" href="javascript:;"><span></span></a>'
21539		},
21540	});
21541	$('.fancybox').fancybox();
21542
21543	$(".video_link").fancybox({
21544		type: "iframe",
21545        maxWidth    : 800,
21546        maxHeight   : 600,
21547        fitToView   : true,
21548        //width       : '70%',
21549        //height      : '70%',
21550        autoSize    : true,
21551        closeClick  : false,
21552    });
21553
21554	$('.tabs>li').on('click', function(){
21555		var parent = $(this).parent();
21556		if(!$(this).hasClass('active')){
21557			var sliderInde
21557x = $(this).index(),
21558				curLiNav=$(this).closest('.top_blocks').find('.slider_navigation').find('>li:eq(' + sliderIndex + ')'),
21559				curLi=$(this).closest('.top_blocks').siblings('.tabs_content').find('>li:eq(' + sliderIndex + ')'),
21560                url = arNextOptions['SITE_DIR'] + 'include/mainpage/comp_catalog_ajax.php',
21561                tabContentNode;
21562			$(this).addClass('active').addClass('cur').siblings().removeClass('active').removeClass('cur');
21563			curLi.addClass('cur').siblings().removeClass('cur');
21564			curLiNav.addClass('cur').siblings().removeClass('cur');
21565
21566            tabContentNode = $(this).closest('.top_blocks').siblings('.tabs_content');
21567			if(parent.hasClass('ajax')) // front tabs
21568			{
21569				if(!$(this).hasClass('clicked'))
21570				{   
21571                    if(tabContentNode && tabContentNode.data('url') && tabContentNode.data('url').length > 0){
21572                        url = tabContentNode.data('url');
21573                    }
21574					$.ajax({
21575						url: url,
21576						type: 'POST',
21577						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')},
21578					}).success(function(html){
21579						curLi.find('.tabs_slider').html(html);
21580						setTimeout(function(){
21581							curLi.addClass('opacity1');
21582						}, 100);
21583
21584						/*equal height*/
21585						//curLi.find('.catalog_block .catalog_item_wrapp .catalog_item .item_info:visible .item-title').sliceHeight({item:'.catalog_item:visible', mobile: true});
21586						//curLi.find('.catalog_block .catalog_item_wrapp .catalog_item .item_info:visible').sliceHeight({item:'.catalog_item:visible', mobile: true});
21587						//curLi.find('.catalog_block .catalog_item_wrapp:visible').sliceHeight({classNull: '.footer_button', item:'.catalog_item:visible', mobile: true});
21588
21589						initCountdown();
21590						showTotalSummItem()
21591					})
21592					$(this).addClass('clicked');
21593
21594				}
21595			}
21596		}
21597	})
21598
21599	/*search click*/
21600	$('.search_block .icon').on('click', function(){
21601		var th=$(this);
21602		if($(this).hasClass('open')){
21603			$(this).closest('.center_block').find('.search_middle_block').removeClass('active');
21604			$(this).removeClass('open');
21605			$(this).closest('.center_block').find('.search_middle_block').find('.noborder').hide();
21606		}else{
21607			setTimeout(function(){
21608				th.closest('.center_block').find('.search_middle_block').find('.noborder').show();
21609			},100);
21610			$(this).closest('.center_block').find('.search_middle_block').addClass('active');
21611			$(this).addClass('open');
21612		}
21613	})
21614	$(document).on('mouseenter', '.display_list .item_wrap', function(){
21615		$(this).prev().addClass('prev');
21616	});
21617	$(document).on('mouseleave', '.display_list .item_wrap', function(){
21618		$(this).prev().removeClass('prev');
21619	});
21620	/*$(document).on('mouseenter', '.catalog_block .item_wrap', function(){
21621		$(this).addClass('shadow_delay');
21622	});
21623	$(document).on('mouseleave', '.catalog_block .item_wrap', function(){
21624		$(this).removeClass('shadow_delay');
21625	});*/
21626	$(document).on('click', '.no_goods .button', function(){
21627		$('.bx_filter .smartfilter .bx_filter_search_reset').trigger('click');
21628	});
21629
21630	$(document).on('click', '.ajax_load_btn', function(){
21631		var url=$(this).closest('.container').find('.module-pagination .flex-direction-nav .flex-next').attr('href'),
21632			bTabsBlock = false,
21633			th=$(this).find('.more_text_ajax');
21634
21635		if (!th.hasClass('loading')) {
21636			th.addClass('loading');
21637			var objUrl = parseUrlQuery(),
21638				add_url = ''
21639				obGetData = {"ajax_get": "Y", "AJAX_REQUEST": "Y"};
21640			
21641			if (th.closest('.goods-block.ajax_load')) {
21642				obGetData.bitrix_include_areas = 'N';
21643			}
21644				
21645			/*hit on front*/
21646			if (th.closest('.tab_slider_wrapp.specials').length) {
21647				var curLi = $(this).closest('.tab');
21648				url = th.closest('.tabs_content').data('url');
21649
21650				bTabsBlock = true;
21651				obGetData.AJAX_POST = 'Y';
21652				obGetData.FILTER_HIT_PROP = curLi.data('code');
21653				obGetData.AJAX_PARAMS = $(this).closest('.tab_slider_wrapp').find('.request-data').data('value');
21654				obGetData.GLOBAL_FILTER = curLi.data('filter');
21655
21656				add_url = '?PAGEN_1=' + curLi.find('.nav-inner-wrapper').data('page');
21657			}
21658			/**/
21659
21660			if ('clear_cache' in objUrl) {
21661				if(objUrl.clear_cache == 'Y')
21662					add_url += (add_url.length ? '&' : '?') + 'clear_cache=Y';
21663			}
21664
21665			$.ajax({
21666				url: url+add_url,
21667				data: obGetData,
21668				type: (bTabsBlock ? 'POST' : 'GET'),
21669				success: function(html){
21670					if($('.ajax_load').length)
21671					{
21672						th.removeClass('loading');
21673
21674						/*hit on front*/
21675						if (th.closest('.tab_slider_wrapp.specials').length) {
21676							curLi.find('.catalog_block').append(html);
21677
21678							//curLi.find('.catalog_block .catalog_item_wrapp .catalog_item .item_info:visible .item-title').sliceHeight({item:'.catalog_item:visible', mobile: true});
21679							//curLi.find('.catalog_block .catalog_item_wrapp .catalog_item .item_info:visible').sliceHeight({item:'.catalog_item:visible', mobile: true});
21680							//curLi.find('.catalog_block .catalog_item_wrapp:visible').sliceHeight({classNull: '.footer_button', item:'.catalog_item:visible', mobile: true});
21681							
21682							curLi.find('.bottom_nav').html($(html).find('.bottom_nav').html());
21683
21684						} else {
21685							if($('.display_list').length){
21686								$('.display_list').append(html);
21687							}else if($('.block_list').length){
21688								$('.block_list').append(html);
21689								touchItemBlock('.catalog_item a');
21690							}else if($('.module_products_list').length){
21691								$('.module_products_list > tbody').append(html);
21692							}
21693							
21694							$('.bottom_nav').html($(html).find('.bottom_nav').html());
21695						}
21696
21697						setStatusButton();
21698						initCountdown();
21699
21700						var eventdata = {action:'ajaxContentLoadedTab'};
21701						BX.onCustomEvent('onAjaxSuccess', [eventdata]);
21702					}
21703					else
21704					{
21705						if($('.banners-small.front').length)
21706						{
21707							$('.banners-small .items.row').append(html);
21708							$('.bottom_nav').html($('.banners-small .items.row .bottom_nav').html());
21709							$('.banners-small .items.row .bottom_nav').remove();
21710						}
21711						else
21712						{
21713							if(th.closest('.item-views').find('.items').length)
21714							{
21715								th.closest('.item-views').find('.items').append(html);
21716							}
21717							else
21718							{
21719								$(html).insertBefore($('.blog .bottom_nav'));
21720							}
21721
21722							$('.bottom_nav').html($('.bottom_nav:hidden').html());
21723							$('.bottom_nav:hidden').remove();
21724						}
21725
21726						var eventdata = {action:'ajaxContentLoaded', content: html};
21727						BX.onCustomEvent('onCompleteAction', [eventdata, th[0]]);
21728
21729						setTimeout(function(){
21730							$('.banners-small .item.normal-block').sliceHeight({resize: false});
21731							if($('.item.slice-item').length)
21732							{
21733								$('.item.slice-item .title').sliceHeight({resize: false});
21734								$('.item.slice-item:not(.no-delay-slice)').sliceHeight({resize: false});
21735							}
21736							th.removeClass('loading');
21737						}, 100);
21738					}
21739				}
21740			})
21741		}
21742	})
21743
21744	//set cookie for basket link click
21745	$(document).on('click', '.bx_ordercart_order_table_container .control > a, .basket-item-actions-remove, a[data-entity=basket-item-remove-delayed]', function(e){
21746		$.removeCookie('click_basket', {path: '/'});
21747		$.cookie('click_basket', 'Y', {path: '/'});
21748	})
21749
21750	$(document).on('click', '.bx_compare .tabs-head li', function(){
21751		var url=$(this).find('.sortbutton').data('href');
21752		BX.showWait(BX("bx_catalog_compare_block"));
21753		$.ajax({
21754			url: url,
21755			data: {'ajax_action': 'Y'},
21756			success: function(html){
21757				history.pushState(null, null, url);
21758				$('#bx_catalog_compare_block').html(html);
21759				BX.closeWait();
21760			}
21761		})
21762	})
21763	var hoveredTrs;
21764	$(document).on({
21765		mouseover: function(e){
21766			var _ = $(this);
21767			var tbodyIndex = _.closest('tbody').index()+1; //+1 for nth-child
21768			var trIndex = _.index()+1; // +1 for nth-child
21769			hoveredTrs = $(e.delegateTarget).find('.data_table_props')
21770				.children(':nth-child('+tbodyIndex+')')
21771				.children(':nth-child('+trIndex+')').addClass('hovered');
21772		},
21773		mouseleave: function(e){
21774			if(hoveredTrs)
21775				hoveredTrs.removeClass('hovered');
21776		}
21777	}, '.bx_compare .data_table_props tbody>tr');
21778	$(document).on('click', '.fancy_offer', function(e){
21779		e.preventDefault();
21780		var arPict=[], index = 0;
21781		$(this).closest('.item_slider').find('.sliders .slides_block li').each(function(){
21782			var obImg = {};
21783			obImg = {
21784				'title': $(this).find('img').attr('alt'),
21785				'href': $(this).data('big')
21786			}
21787			if($(this).hasClass('current')){
21788				index = $(this).index();
21789			}
21790			arPict.push(obImg);
21791		})
21792		$.fancybox(arPict, {
21793			index: index,
21794			openEffect  : 'fade',
21795			closeEffect : 'fade',
21796			nextEffect : 'fade',
21797			prevEffect : 'fade',
21798			type : 'image',
21799			tpl:{
21800				closeBtn : '<a title="'+BX.message('FANCY_CLOSE')+'" class="fancybox-item fancybox-close" href="javascript:;"></a>',
21801				next     : '<a title="'+BX.message('FANCY_NEXT')+'" class="fancybox-nav fancybox-next" href="javascript:;"><span></span></a>',
21802				prev     : '<a title="'+BX.message('FANCY_PREV')+'" class="fancybox-nav fancybox-prev" href="javascript:;"><span></span></a>'
21803			},
21804		});
21805	})
21806
21807	/*tabs*/
21808	$(".tabs_section .tabs-head li").on("click", function(){
21809		if(!$(this).is(".current")){
21810			$(".tabs_section .tabs-head li").removeClass("current");
21811			$(this).addClass("current");
21812			$(".tabs_section ul.tabs_content li").removeClass("current");
21813			if($(this).attr("id") == "product_reviews_tab"){
21814				$(".shadow.common").hide(); $("#reviews_content").show();
21815			}
21816			else{
21817				$(".shadow.common").show();
21818				$("#reviews_content").hide();
21819				$(".tabs_section ul.tabs_content > li:eq("+$(this).index()+")").addClass("current");
21820			}
21821		}
21822	});
21823
21824	/*open first section slide*/
21825	setTimeout(function() {
21826		$('.jobs_wrapp .item:first .name tr').trigger('click');
21827	}, 300);
21828
21829	/*$('.choise').on('click', function(){
21830		var _this = $(this);
21831		if(typeof(_this.data('block')) != 'undefined')
21832		{
21833			scrollToBlock(_this.data('block'));
21834		}
21835	})*/
21836
21837	$(document).on('click', '.choise', function(){
21838		var _this = $(this);
21839		if(typeof(_this.data('block')) != 'undefined')
21840		{
21841			scrollToBlock(_this.data('block'));
21842		}
21843	});
21844
21845	$(document).on('click', '.buy_block .slide_offer', function(){
21846		scroll_block($('.tabs_section'));
21847	});
21848	$('.share  > .share_wrapp .text').on('click', function(){
21849		var block = $(this).parent().find('.shares');
21850		if(!block.is(':visible') && !$(this).closest('.share.top').length)
21851			$('#content').css('z-index',3);
21852		block.fadeToggle(100,function(){
21853			if(!block.is(':visible'))
21854				$('#content').css('z-index',2);
21855		});
21856	})
21857	$('html, body').on('mousedown', function(e) {
21858		if(typeof e.target.className == 'string' && e.target.className.indexOf('adm') < 0)
21859		{
21860			e.stopPropagation();
21861			$('div.shares').fadeOut(100, function(){
21862				$('#content').css('z-index',2);
21863				$('.price_txt .share_wrapp').removeClass('opened');
21864			});
21865			$('.search_middle_block').removeClass('active_wide');
21866		}
21867	})
21868	$('.share_wrapp').find('*').on('mousedown', function(e) {
21869		e.stopPropagation();
21870	});
21871
21872	$('.price_txt .share_wrapp .text').click(function(){
21873		$(this).parent().toggleClass('opened');
21874		$(this).parent().find('.shares').fadeToggle();
21875	})
21876
21877	$(document).on('click', '.reviews-collapse-link', function(){
21878		$('.reviews-reply-form').slideToggle();
21879	})
21880
21881	/* accordion action*/
21882	$('.panel-collapse').on('hidden.bs.collapse', function(){
21883		$(this).parent().toggleClass('opened');
21884	})
21885	$('.panel-collapse').on('show.bs.collapse', function(){
21886		$(this).parent().toggleClass('opened');
21887	})
21888
21889	/* accordion */
21890	$('.accordion-head').on('click', function(e){
21891		e.preventDefault();
21892		if(!$(this).next().hasClass('collapsing')){
21893			$(this).toggleClass('accordion-open');
21894			$(this).toggleClass('accordion-close');
21895		}
21896	});
21897
21898	/* progress bar */
21899	$('[data-appear-progress-animation]').each(function(){
21900		var $this = $(this);
21901		$this.appear(function(){
21902			var delay = ($this.attr('data-appear-animation-delay') ? $this.attr('data-appear-animation-delay') : 1);
21903			if( delay > 1 )
21904				$this.css('animation-delay', delay + 'ms');
21905			$this.addClass($this.attr('data-appear-animation'));
21906
21907			setTimeout(function(){
21908				$this.animate({
21909					width: $this.attr('data-appear-progress-animation')
21910				}, 1500, 'easeOutQuad', function() {
21911					$this.find('.progress-bar-tooltip').animate({
21912						opacity: 1
21913					}, 500, 'easeOutQuad');
21914				});
21915			}, delay);
21916		}, {accX: 0, accY: -50});
21917	});
21918
21919	initCountdown();
21920
21921	/* portfolio item */
21922	if($('.item.animated-block').length)
21923	{
21924		$('.item.animated-block').appear(function(){
21925			var $this = $(this);
21926
21927			$this.addClass($this.data('animation')).addClass('visible');
21928
21929		}, {accX: 0, accY: 150})
21930	}
21931
21932	/* js-load-block appear */
21933	if ($(".js-load-block").length) {
21934		var objUrl = parseUrlQuery();
21935		var bClearCache = false;
21936		if ("clear_cache" in objUrl) {
21937		  if (objUrl.clear_cache == "Y") {
21938			bClearCache = true;
21939		  }
21940		}
21941	
21942		var items = [];
21943		var bIdle = true;
21944		var insertNextBlockContent = function () {
21945		  if (bIdle) {
21946			if (items.length) {
21947			  bIdle = false;
21948			  var item = items.pop();
21949	
21950			  item.content = $.trim(item.content);
21951	
21952			  // remove /bitrix/js/main/core/core_window.js if it was loaded already
21953			  if (item.content.indexOf("/bitrix/js/main/core/core_window.") !== -1 && BX.WindowManager) {
21954				item.content = item.content.replace(
21955				  /<script src="\/bitrix\/js\/main\/core\/core_window\.[^>]*><\/script>/gm,
21956				  ""
21957				);
21958			  }
21959	
21960			  // remove /bitrix/js/currency/core_currency.js if it was loaded already
21961			  if (
21962				item.content.indexOf("/bitrix/js/currency/core_currency.") !== -1 &&
21963				typeof BX.Currency === "object" &&
21964				BX.Currency.defaultFormat
21965			  ) {
21966				item.content = item.content.replace(
21967				  /<script src="\/bitrix\/js\/currency\/core_currency\.[^>]*><\/script>/gm,
21968				  ""
21969				);
21970			  }
21971	
21972			  // remove /bitrix/js/main/pageobject/pageobject.js if it was loaded already
21973			  if (item.content.indexOf("/bitrix/js/main/pageobject/pageobject.") !== -1 && BX.PageObject) {
21974				item.content = item.content.replace(
21975				  /<script src="\/bitrix\/js\/main\/pageobject\/pageobject\.[^>]*><\/script>/gm,
21976				  ""
21977				);
21978			  }
21979	
21980			  // remove /bitrix/js/main/polyfill/promise/js/promise.js if it not need
21981			  if (
21982				item.content.indexOf("/bitrix/js/main/polyfill/promise/js/promise.") !== -1 &&
21983				typeof window.Promise !== "undefined" &&
21984				window.Promise.toString().indexOf("[native code]") !== -1
21985			  ) {
21986				item.content = item.content.replace(
21987				  /<script src="\/bitrix\/js\/main\/polyfill\/promise\/js\/promise\.[^>]*><\/script>/gm,
21988				  ""
21989				);
21990			  }
21991	
21992			  var ob = BX.processHTML(item.content);
21993	
21994			  // stop ya metrika webvisor DOM indexer
21995			  pauseYmObserver();
21996	
21997			  item.block.removeAttr("data-file").removeClass("loader_circle");
21998	
21999			  if (item.block.data("appendTo")) {
22000				item.block.find(item.block.data("appendTo"))[0].innerHTML = ob.HTML;
22001			  } else {
22002				if (item.block.find('> div[id*="bx_incl_"]').length) {
22003				  item.block.find('> div[id*="bx_incl_"]')[0].innerHTML = ob.HTML;
22004				} else {
22005				  item.block[0].innerHTML = ob.HTML;
22006				}
22007			  }
22008	
22009			  BX.ajax.processScripts(ob.SCRIPT);
22010	
22011			  var eventdata = { action: "jsLoadBlock" };
22012			  BX.onCustomEvent("onCompleteAction", [eventdata, item.block]);
22013	
22014			  // resume ya metrika webvisor
22015			  // 500ms
22016			  setTimeout(resumeYmObserver, 500);
22017	
22018			  bIdle = true;
22019			  insertNextBlockContent();
22020			}
22021		  }
22022		};
22023	
22024		$(".js-load-block").appear(
22025		  function () {
22026			var $this = $(this);
22027	
22028			if ($this.data("file")) {
22029			  var add_url = bClearCache ? "?clear_cache=Y" : "";
22030			  if ($this.data("block")) {
22031				if ($this.data("file").indexOf("?") !== -1) {
22032				  if (bClearCache) {
22033					add_url = add_url.slice(1);
22034				  }
22035				  add_url += "&BLOCK=" + $this.data("block");
22036				} else {
22037				  add_url += (bClearCache ? "&" : "?") + "BLOCK=" + $this.data("block");
22038				}
22039			  }
22040	
22041			  // get content
22042			  $.get($this.data("file") + add_url).done(function (html) {
22043				items.push({
22044				  block: $this,
22045				  content: html,
22046				});
22047	
22048				if (items.length == 1) {
22049				  setTimeout(insertNextBlockContent, 100);
22050				}
22051			  });
22052			}
22053		  },
22054		  { accX: 0, accY: isMobile ? 300 : 150 }
22055		);
22056	  }
22057
22058	/*show ajax store amount product*/
22059	$(document).on('click', '.js-show-info-block', function(e){
22060		if (window.matchMedia('(max-width: 500px)').matches) {
22061			return
22062		}
22063		var $this = $(this);
22064		e.stopPropagation();
22065		$('.js-info-block').fadeOut();
22066
22067		if($this.hasClass('opened'))
22068		{
22069			$('.js-show-info-block').removeClass('opened');
22070		}
22071		else
22072		{
22073			$('.js-show-info-block').removeClass('opened');
22074			$this.addClass('opened');
22075		}
22076
22077		if(!$this.siblings('.js-info-block').length)
22078		{
22079			var dataFields = $this.closest('.sa_block').data('fields');
22080			dataFields = dataFields == 'null' || dataFields === undefined ? '' : dataFields;
22081			var dataUserFields = $this.closest('.sa_block').data('user-fields');
22082			dataUserFields = dataUserFields == 'null' || dataUserFields === undefined ? '' : dataUserFields;
22083			var objUrl = parseUrlQuery(),
22084				add_url = '';
22085			if('clear_cache' in objUrl)
22086			{
22087				if(objUrl.clear_cache == 'Y')
22088					add_url += '?clear_cache=Y';
22089			}
22090
22091			var obPostParams = {
22092				'ajax': 'Y',
22093				'ELEMENT_ID': $this.data('id'),
22094				'FIELDS': dataFields,
22095				'USER_FIELDS': dataUserFields,
22096				'STORES': $this.closest('.sa_block').data('stores') || ''
22097			};
22098
22099			$this.addClass('loadings');
22100			$.post(arNextOptions['SITE_DIR']+'ajax/productStoreAmountCompact.php'+add_url, obPostParams)
22101				.done(function(html){
22102					$this.removeClass('loadings');
22103					$(html).appendTo($this.closest('.sa_block'));
22104
22105					$this.siblings('.js-info-block').find('.more-btn a').attr('href', $this.closest('.item_info').find('a').attr('href'));
22106					//InitScrollBar();
22107
22108					var eventdata = {action:'jsShowStores'};
22109					BX.onCustomEvent('onCompleteAction', [eventdata, $this]);
22110				})
22111		}
22112		else
22113		{
22114			if($this.hasClass('opened'))
22115			{
22116				$this.siblings('.js-info-block').find('.more-btn a').attr('href', $this.closest('.item_info').find('a').attr('href'));
22117				$this.siblings('.js-info-block').fadeIn();
22118				//InitScrollBar();
22119			}
22120			else
22121			{
22122				$this.siblings('.js-info-block').fadeOut();
22123			}
22124		}
22125	})
22126	$(document).on('click', '.js-info-block .svg-inline-close', function(){
22127		$('.js-show-info-block').removeClass('opened');
22128		$(this).closest('.js-info-block').fadeOut();
22129	})
22130	/**/
22131
22132	/*adaptive menu start*/
22133	$('.menu.adaptive').on('click', function(){
22134		$(this).toggleClass('opened');
22135		if($(this).hasClass('opened')){
22136			$('.mobile_menu').toggleClass('opened').slideDown();
22137		}else{
22138			$('.mobile_menu').toggleClass('opened').slideUp();
22139		}
22140	});
22141	$('.mobile_menu .has-child >a').on('click', function(e){
22142		var parentLi=$(this).parent();
22143		e.preventDefault();
22144		parentLi.toggleClass('opened');
22145		parentLi.find('.dropdown').slideToggle();
22146	})
22147
22148	$('.mobile_menu .search-input-div input').on('keyup', function(e) {
22149		var inputValue = $(this).val();
22150		$('.center_block .stitle_form input').val(inputValue);
22151		if(e.keyCode == 13){
22152			$('.center_block .stitle_form form').submit();
22153		}
22154	});
22155
22156	$('.center_block .stitle_form input').on('keyup', function(e) {
22157		var inputValue = $(this).val();
22158		$('.mobile_menu .search-input-div input').val(inputValue);
22159		if(e.keyCode == 13){
22160			$('.center_block .stitle_form form').submit();
22161		}
22162	});
22163
22164	$('.mobile_menu .search-button-div button').on('click', function(e) {
22165		e.preventDefault();
22166		var inputValue = $(this).parents().find('input').val();
22167		$('.center_block .stitle_form input').val(inputValue);
22168		$('.center_block .stitle_form form').submit();
22169	});
22170	/*adaptive menu end*/
22171
22172	$(document).on('click', '.mega-menu .dropdown-menu', function(e){
22173		e.stopPropagation()
22174	});
22175
22176	$(document).on('click', '.mega-menu .dropdown-toggle.more-items', function(e){
22177		e.preventDefault();
22178	});
22179
22180	$(document).on('mouseenter', '.table-menu .dropdown,.table-menu .dropdown-submenu,.table-menu .dropdown-toggle', function() {
22181		setTimeout(
22182			function() {
22183				CheckTopVisibleMenu();
22184			},
22185			275
22186		);
22187	});
22188
22189	$(document).on('mouseenter', '#headerfixed .table-menu .dropdown-menu .dropdown-submenu', function() {
22190		setTimeout(
22191			function() {
22192				CheckTopVisibleMenu();
22193			},
22194			275
22195		);
22196	});
22197
22198	$('.mega-menu .search-item .search-icon, .menu-row #title-search .fa-close').on('click', function(e) {
22199		e.preventDefault();
22200		$('.menu-row #title-search').toggleClass('hide');
22201	});
22202
22203	$('.mega-menu ul.nav .search input').on('keyup', function(e) {
22204		var inputValue = $(this).val();
22205		$('.menu-row > .search input').val(inputValue);
22206		if(e.keyCode == 13){
22207			$('.menu-row > .search form').submit();
22208		}
22209	});
22210
22211	$('.menu-row > .search input').on('keyup', function(e) {
22212		var inputValue = $(this).val();
22213		$('.mega-menu ul.nav .search input').val(inputValue);
22214		if(e.keyCode == 13){
22215			$('.menu-row > .search form').submit();
22216		}
22217	});
22218
22219	$('.mega-menu ul.nav .search button').on('click', function(e) {
22220		e.preventDefault();
22221		var inputValue = $(this).parents('.search').find('input').val();
22222		$('.menu-and-search .search input').val(inputValue);
22223		$('.menu-row > .search form').submit();
22224	});
22225
22226	$('.btn.btn-add').on('click', function(){
22227		$.ajax({
22228			type:"GET",
22229			url:arNextOptions['SITE_DIR']+"ajax/clearBasket.php",
22230			success: function(data){
22231			}
22232		});
22233	});
22234
22235	$('.sort_display a').on('click', function(){
22236		$(this).siblings().removeClass('current');
22237		$(this).addClass('current');
22238	});
22239
22240	/*detail order show payments*/
22241	$('.sale-order-detail-payment-options-methods-info-change-link').on('click', function(){
22242		$(this).closest('.sale-order-detail-payment-options-methods-info').addClass('opened').siblings().addClass('opened');
22243	});
22244
22245	/*expand/hide filter values*/
22246	$(document).on('click', '.expand_block', function(){
22247		togglePropBlock($(this));
22248	});
22249
22250	// form rating
22251	$(document).on('mouseenter', '.form .votes_block.with-text .item-rating', function(){
22252		var $this = $(this),
22253			index = $this.index(),
22254			ratingValue = $this.data('rating_value'),
22255			ratingMessage = $this.data('message');
22256
22257		$(this).addClass('filled')
22258		$this.siblings().each(function(){
22259			if($(this).index() <= index)
22260				$(this).addClass('filled')
22261			else
22262				$(this).removeClass('filled')
22263		});
22264		$this.closest('.votes_block').find('.rating_message').text(ratingMessage);
22265	});
22266
22267	$(document).on('mouseleave', '.form .votes_block.with-text', function(){
22268		var $this = $(this),
22269			index = $this.data('rating'),
22270			ratingMessage = $this.closest('.votes_block').find('.rating_message').data('message');
22271
22272		$this.find('.item-rating').each(function(){
22273			if($(this).index() < index && index !== undefined)
22274				$(this).addClass('filled')
22275			else
22276				$(this).removeClass('filled')
22277		});
22278		$this.closest('.votes_block').find('.rating_message').text(ratingMessage);
22279	});
22280
22281	$(document).on('click', '.form .votes_block.with-text .item-rating', function(){
22282		var $this = $(this),
22283			rating = $this.closest('.votes_block').data('rating'),
22284			index = $this.index() + 1,
22285			ratingMessage = $this.data('message');
22286
22287		$this.closest('.votes_block').data('rating', index);
22288		if($this.closest('.form-control').find('input[name=RATING]').length){
22289			$this.closest('.form-control').find('input[name=RATING]').val(index);
22290		}
22291		else{
22292			$this.closest('.form-control').find('input[data-sid=RATING]').val(index);
22293		}
22294		$this.closest('.votes_block').find('.rating_message').data('message', ratingMessage);
22295	});
22296
22297	$(document).on('click', '.reviews-navigation-box .modern-page-navigation a', function(e){
22298		e.preventDefault();
22299
22300		var _this = $(this);
22301
22302		$.ajax({
22303			url:_this.attr('href'),
22304			type: "POST",
22305			data: { "AJAX": "Y" },
22306			success: function(html){
22307				$('#reviews_content').html(html);
22308			},
22309			error: function(){
22310				console.log()
22311			}
22312		})
22313	})
22314
22315	/*touch event*/
22316	document.addEventListener('touchend', function(event) {
22317		if(!$(event.target).closest('.menu-item').length && !$(event.target).hasClass('menu-item')){
22318			$('.menu-row .dropdown-menu').css({'display':'none','opacity':0});
22319			$('.menu-item').removeClass('hover');
22320			$('.bx-breadcrumb-item.drop').removeClass('hover');
22321		}
22322		if(!$(event.target).closest('.menu.topest').length){
22323			$('.menu.topest').css({'overflow': 'hidden'});
22324			$('.menu.topest > li').removeClass('hover');
22325		}
22326		if(!$(event.target).closest('.full.has-child').length){
22327			$('.menu_top_block.catalog_block li').removeClass('hover');
22328		}
22329		if(!$(event.target).closest('.basket_block').length){
22330			$('.basket_block .link').removeClass('hover');
22331			$('.basket_block .basket_popup_wrapp').slideUp();
22332		}
22333		if(!$(event.target).closest('.catalog_item').length){
22334			var tabsContentUnhoverHover = $('.tab:visible').attr('data-unhover') * 1;
22335			$('.tab:visible').stop().animate({'height': tabsContentUnhoverHover}, 100);
22336			$('.tab:visible').find('.catalog_item').removeClass('hover');
22337			$('.tab:visible').find('.catalog_item .buttons_block').stop().fadeOut(233);
22338			if($('.catalog_block').length){
22339				$('.catalog_block').find('.catalog_item_wrapp').removeClass('hover');
22340				$('.catalog_block').find('.catalog_item').removeClass('hover');
22341			}
22342		}
22343		//togglePropBlock($(event.target));
22344
22345	}, false);
22346
22347	touchMenu('.menu-row .menu-item');
22348	touchTopMenu('.menu.topest li');
22349	touchLeftMenu('.menu_top_block li.full');
22350	touchBreadcrumbs('.bx-breadcrumb-item.drop');
22351
22352	$(document).on('keyup', '.coupon .input_coupon input', function(){
22353		if($(this).val().length){
22354			$(this).removeClass('error');
22355			$(this).closest('.input_coupon').find('.error').remove();
22356		}else{
22357			$(this).addClass('error');
22358			$("<label class='error'>"+BX.message("INPUT_COUPON")+"</label>").insertBefore($(this));
22359		}
22360	});
22361	showPhoneMask('input[autocomplete=tel]');
22362	BX.addCustomEvent(window, "onAjaxSuccessFilter", function(e){
22363		setBasketStatusBtn();
22364		if(typeof(e) !== 'undefined' && e && typeof e === 'object' && 'data' in e  && 'result' in e.data) {
22365			if (e.data.result && e.data.result.FILTER_URL != 'undefined' && e.data.result.ELEMENT_COUNT != 'undefined'){
22366				mobileFilterNum(e.data.result.ELEMENT_COUNT);
22367			}
22368		}
22369		lazyLoadPagenBlock();
22370	});
22371
22372	$(document).on('click', '.block_container .items .item', function(){
22373		var _this = $(this),
22374			itemID = _this.data('id'),
22375			animationTime = 200;
22376
22377		_this.closest('.items').fadeOut(animationTime, function(){
22378			_this.closest('.block_container').find('.detail_items').fadeIn(animationTime);
22379			_this.closest('.block_container').find('.detail_items .item[data-id='+itemID+']').fadeIn(animationTime);
22380
22381			var arCoordinates = _this.data('coordinates').split(',');
22382
22383			if(typeof map !== 'undefined')
22384				map.setCenter([arCoordinates[0], arCoordinates[1]], 15);
22385		});
22386	});
22387
22388	$(document).on('click', '.block_container .top-close', function(){
22389		var _this = $(this).closest('.block_container').find('.detail_items .item:visible'),
22390			animationTime = 200;
22391		_this.fadeOut(animationTime);
22392		_this.closest('.block_container').find('.detail_items').fadeOut(animationTime, function(){
22393			_this.closest('.block_container').find('.items').fadeIn(animationTime);
22394
22395			if(typeof map !== 'undefined' && typeof clusterer !== 'undefined')
22396			{
22397				map.setBounds(clusterer.getBounds(), {
22398					zoomMargin: 40,
22399					// checkZoomRange: true
22400				});
22401			}
22402		});
22403	});
22404
22405	BX.addCustomEvent(window, "onAjaxSuccess", function(e){
22406		if(typeof(e) === 'undefined' || e != 'OK')
22407		{
22408            if(typeof(e) !== 'undefined' && e && typeof(e.FILTER_URL) != 'undefined' && typeof(e.ELEMENT_COUNT) != 'undefined'){
22409                mobileFilterNum(e.ELEMENT_COUNT);
22410            }
22411
22412			initSelects(document);
22413			InitOrderCustom();
22414
22415			
22416			showPhoneMask('input[autocomplete=tel]');
22417			if($('.catalog_detail').length && !$('.fast_view_frame').length)
22418			{
22419				$('.bx_filter').remove();
22420				InitFlexSlider();
22421			}
22422
22423			if(arNextOptions["PAGES"]["CATALOG_PAGE"])
22424			{
22425				//setStatusButton();
22426				initCountdown();
22427				if($(".ajax_mode_on").length){
22428					lazyLoadPagenBlock();
22429				}
22430			}
22431
22432			if(arNextOptions["PAGES"]["ORDER_PAGE"])
22433			{
22434				orderActions(e);
22435			}
22436
22437			if (e && typeof e === 'object' && 'action' in e && e.action === 'ajaxContentLoadedTab') {
22438                lazyLoadPagenBlock();
22439            }
22440		}
22441	});
22442
22443	//event for default basket quantity change
22444	BX.addCustomEvent(window, "OnBasketChange", function(e){
22445		if(arNextOptions["PAGES"]["BASKET_PAGE"])
22446		{
22447			var summ = 0,
22448				title = '';
22449
22450			if(typeof BX.Sale !== "undefined")
22451			{
22452				if(typeof BX.Sale.BasketComponent !== "undefined")
22453				{
22454					summ = BX.Sale.BasketComponent.result.allSum;
22455					title = BX.message('JS_BASKET_COUNT_TITLE').replace('SUMM', summ);
22456				}
22457			}
22458			else
22459			{
22460				summ = $('#allSum_FORMATED').html().replace(/&nbsp;/g, ' ');
22461				title = BX.message('JS_BASKET_COUNT_TITLE').replace('SUMM', summ);
22462			}
22463
22464			if($('.js-basket-block .wrap .prices').length)
22465				$('.js-basket-block .wrap .prices').html(summ);
22466			if($('a.basket-link.basket').length)
22467				$('a.basket-link.basket').attr('title', title);
22468			if($('.basket_fly .opener .basket_count').length)
22469				$('.basket_fly .opener .basket_count').attr('title', title);
22470
22471		}
22472	});
22473	BX.addCustomEvent(window, "onFrameDataRequestFail", function(response){
22474		console.log(response);
22475	});
22476});
22477
22478if(!funcDefined('fileInputInit')) {
22479	function fileInputInit(message){
22480		$('input[type=file]').uniform({fileButtonHtml: BX.message('JS_FILE_BUTTON_NAME'), fileDefaultHtml: message});
22481		$(document).on('change', 'input[type=file]', function(){
22482			if($(this).val())
22483			{
22484				$(this).closest('.uploader').addClass('files_add');
22485			}
22486			else
22487			{
22488				$(this).closest('.uploader').removeClass('files_add');
22489			}
22490		})
22491		$('.form .add_file').on('click', function(){
22492			var index = $(this).closest('.input').find('input[type=file]').length+1;
22493	
22494			$(this).closest('.form-group').find('.input').append('<input type="file" id="POPUP_FILE" name="FILE_n'+index+'"   class="inputfile" value="" />');
22495			$('input[type=file]').uniform({fileButtonHtml: BX.message('JS_FILE_BUTTON_NAME'), fileDefaultHtml: message});
22496		});
22497	
22498		$('.form .add_file').on('click', function(){
22499			var index = $(this).closest('.input').find('input[type=file]').length+1;
22500	
22501			$(this).closest('.form-group').find('.input').append('<input type="file" id="POPUP_FILE" name="FILE_n'+index+'"   class="inputfile" value="" />');
22502			$('input[type=file]').uniform({fileButtonHtml: BX.message('JS_FILE_BUTTON_NAME'), fileDefaultHtml: message});
22503		});
22504	}
22505}
22506
22507if(!funcDefined('setBasketStatusBtn')){
22508	setBasketStatusBtn = function(){
22509		if(typeof(arBasketAspro) !== 'undefined')
22510		{
22511			if('BASKET' in arBasketAspro) // basket items
22512			{
22513				if(arBasketAspro.BASKET)
22514				{
22515					for(var i in arBasketAspro.BASKET)
22516					{
22517						//$('.to-cart[data-item='+i+']').hide();
22518						$('.counter_block[data-item='+i+']').show();
22519						//$('.in-cart[data-item='+i+']').show();
22520						//$('.in-cart[data-item='+i+']').closest('.button_block').addClass('wide');
22521
22522						//
22523						//$('.to-cart[data-item='+i+']').parents('.footer_button').addClass('in_cart');
22524						//$('.to-cart[data-item='+i+']').parents('.buy_block').addClass('in_cart');
22525					}
22526				}
22527			}
22528
22529			if('DELAY' in arBasketAspro) // delay items
22530			{
22531				if(arBasketAspro.DELAY)
22532				{
22533					for(var i in arBasketAspro.DELAY)
22534					{
22535						$('.wish_item.to[data-item='+i+']').hide();
22536						$('.wish_item.in[data-item='+i+']').show();
22537						if ($('.wish_item[data-item='+i+']').find(".value.added").length)
22538						{
22539							$('.wish_item[data-item='+i+']').addClass("added");
22540							$('.wish_item[data-item='+i+']').find(".value").hide();
22541							$('.wish_item[data-item='+i+']').find(".value.added").css('display','block');
22542						}
22543					}
22544				}
22545			}
22546
22547			if('SUBSCRIBE' in arBasketAspro) // subscribe items
22548			{
22549				if(arBasketAspro.SUBSCRIBE)
22550				{
22551					for(var i in arBasketAspro.SUBSCRIBE)
22552					{
22553						$('.to-subscribe[data-item='+i+']').hide();
22554						$('.in-subscribe[data-item='+i+']').show();
22555					}
22556				}
22557			}
22558
22559			if('COMPARE' in arBasketAspro) // compare items
22560			{
22561				if(arBasketAspro.COMPARE)
22562				{
22563					for(var i in arBasketAspro.COMPARE)
22564					{
22565						$('.compare_item.to[data-item='+i+']').hide();
22566						$('.compare_item.in[data-item='+i+']').show();
22567						if ($('.compare_item[data-item='+i+']').find(".value.added").length)
22568						{
22569							$('.compare_item[data-item='+i+']').addClass("added");
22570							$('.compare_item[data-item='+i+']').find(".value").hide();
22571							$('.compare_item[data-item='+i+']').find(".value.added").css('display','block');
22572						}
22573					}
22574				}
22575			}
22576		}
22577	}
22578}
22579
22580if(!funcDefined('togglePropBlock')){
22581	togglePropBlock=function(className){
22582		var all_props_block = className.closest('.bx_filter_parameters_box_container').find('.hidden_values');
22583		if(all_props_block.length && (className.hasClass('inner_text') || className.hasClass('expand_block')))
22584		{
22585			if(all_props_block.is(':visible'))
22586			{
22587				className.text(BX.message('FILTER_EXPAND_VALUES'));
22588				all_props_block.hide();
22589			}
22590			else
22591			{
22592				className.text(BX.message('FILTER_HIDE_VALUES'));
22593				all_props_block.show();
22594			}
22595		}
22596	}
22597}
22598
22599if(!funcDefined('showPhoneMask')){
22600	showPhoneMask=function(className){
22601		$(className).inputmask('mask', {'mask': arNextOptions['THEME']['PHONE_MASK'], 'showMaskOnHover':false });
22602	}
22603}
22604
22605if(!funcDefined('parseUrlQuery')){
22606	parseUrlQuery=function() {
22607	    var data = {};
22608	    if(location.search) {
22609	        var pair = (location.search.substr(1)).split('&');
22610	        for(var i = 0; i < pair.length; i ++) {
22611	            var param = pair[i].split('=');
22612	            data[param[0]] = param[1];
22613	        }
22614	    }
22615	    return data;
22616	}
22617}
22618
22619if(!funcDefined('getActualBasket')){
22620	getActualBasket=function(iblockID, type){
22621		var data='';
22622		if(typeof iblockID !=="undefined"){
22623			data={"iblockID":iblockID}
22624		}
22625		$.ajax({
22626			type:"GET",
22627			url:arNextOptions['SITE_DIR']+"ajax/actualBasket.php",
22628			data:data,
22629			success: function(data){
22630				if(!$('.js_ajax').length)
22631					$('body').append('<div class="js_ajax"></div>');
22632				$('.js_ajax').html(data);
22633
22634				if(typeof(type) !== undefined)
22635				{
22636					var eventdata = {action:'loadActualBasket'+type};
22637					BX.onCustomEvent('onCompleteAction', [eventdata]);
22638				}
22639			}
22640		});
22641	}
22642}
22643
22644function touchMenu(selector){
22645	if(isMobile){
22646		if($(selector).length)
22647		{
22648			$(selector).each(function(){
22649				var th=$(this);
22650				th.on('touchend', function(e) {
22651					var _th = $(e.target).closest('.menu-item');
22652
22653					$('.menu.topest > li').removeClass('hover');
22654					$('.menu_top_block.catalog_block li').removeClass('hover');
22655					$('.bx-breadcrumb-item.drop').removeClass('hover');
22656
22657					if (_th.find('.dropdown-menu').length && !_th.hasClass('hover')) {
22658						e.preventDefault();
22659						e.stopPropagation();
22660						_th.siblings().removeClass('hover');
22661						_th.addClass('hover');
22662						$('.menu-row .dropdown-menu').css({'display':'none', 'opacity':0});
22663						if(_th.hasClass('menu-item'))
22664						{
22665							_th.closest('.dropdown-menu').css({'display':'block', 'opacity':1});
22666						}
22667						if(_th.find('> .wrap > .dropdown-menu'))
22668						{
22669							_th.find('> .wrap > .dropdown-menu').css({'display':'block', 'opacity':1});
22670						}
22671						else if(_th.find('> .dropdown-menu'))
22672						{
22673							_th.find('> .dropdown-menu').css({'display':'block', 'opacity':1});
22674						}
22675						CheckTopVisibleMenu();
22676					}
22677					else
22678					{
22679						var href = ($(e.target).attr('href') ? $(e.target).attr('href') : $(e.target).closest('a').attr('href'))
22680						if(href && href !== 'undefined')
22681							location.href = href;
22682					}
22683				})
22684			})
22685		}
22686	}else{
22687		$(selector).off();
22688	}
22689}
22690
22691function touchTopMenu(selector){
22692	if(isMobile){
22693		if($(selector).length)
22694		{
22695			$(selector).each(function(){
22696				var th=$(this);
22697				th.on('touchend', function(e) {
22698					var _th = $(e.target).closest('li');
22699
22700					$('.menu-item').removeClass('hover');
22701					$('.menu_top_block.catalog_block li').removeClass('hover');
22702					$('.bx-breadcrumb-item.drop').removeClass('hover');
22703
22704					if (_th.hasClass('more') && !_th.hasClass('hover')) {
22705						e.preventDefault();
22706						e.stopPropagation();
22707						_th.siblings().removeClass('hover');
22708						_th.addClass('hover');
22709						$('.menu.topest').css({'overflow': 'visible'});
22710					}
22711					else
22712					{
22713						var href = ($(e.target).attr('href') ? $(e.target).attr('href') : $(e.target).closest('a').attr('href'))
22714						if(href && href !== 'undefined')
22715							location.href = href;
22716					}
22717				})
22718			})
22719		}
22720	}else{
22721		$(selector).off();
22722	}
22723}
22724
22725function touchLeftMenu(selector){
22726	if(isMobile){
22727		if($(selector).length)
22728		{
22729			$(selector).each(function(){
22730				var th=$(this);
22731				th.on('touchend', function(e) {
22732					var _th = $(e.target).closest('li');
22733
22734					$('.menu-item').removeClass('hover');
22735					$('.bx-breadcrumb-item.drop').removeClass('hover');
22736					$('.menu.topest > li').removeClass('hover');
22737
22738					if (_th.hasClass('has-child') && !_th.hasClass('hover')) {
22739						e.preventDefault();
22740						e.stopPropagation();
22741						_th.siblings().removeClass('hover');
22742						_th.addClass('hover');
22743					}
22744					else
22745					{
22746						var href = ($(e.target).attr('href') ? $(e.target).attr('href') : $(e.target).closest('a').attr('href'))
22747						if(href && href !== 'undefined')
22748							location.href = href;
22749					}
22750				})
22751			})
22752		}
22753	}else{
22754		$(selector).off();
22755	}
22756}
22757
22758function touchBreadcrumbs(selector){
22759
22760}
22761
22762function touchItemBlock(selector){
22763
22764}
22765function touchBasket(selector){
22766	if(arNextOptions['THEME']['SHOW_BASKET_ONADDTOCART'] !== 'N'){
22767		if($(window).outerWidth()>600){
22768			$(document).find(selector).on('touchend', function(e) {
22769				if ($(this).parent().find('.basket_popup_wrapp').length && !$(this).hasClass('hover')) {
22770					e.preventDefault();
22771					e.stopPropagation();
22772					$(this).addClass('hover');
22773					$(this).parent().find('.basket_popup_wrapp').slideDown();
22774				}
22775			})
22776		}else{
22777			$(selector).off();
22778		}
22779	}
22780}
22781
22782function showTotalSummItem(popup){
22783	//show total summ
22784	if(arNextOptions["THEME"]["SHOW_TOTAL_SUMM_TYPE"] == "ALWAYS" && arNextOptions["THEME"]["SHOW_TOTAL_SUMM"] == "Y")
22785	{
22786		var parent = 'body ';
22787		if(typeof popup  === 'string' && popup == 'Y')
22788			parent = '.popup ';
22789		$(parent+'.counter_wrapp .counter_block input.text').each(function(){
22790			var _th = $(this);
22791			if(_th.data('product'))
22792			{
22793				var obProduct = _th.data('product');
22794				if (typeof window[obProduct] == 'object') {
22795					if ('setPriceAction' in window[obProduct]) {
22796						window[obProduct].setPriceAction('Y');
22797					}
22798
22799				} else {
22800					setPriceItem(_th.closest('.main_item_wrapper'), _th.val());
22801				}
22802			}
22803			else
22804				setPriceItem(_th.closest('.main_item_wrapper'), _th.val());
22805		})
22806	}
22807}
22807
22808
22809function initFull(){
22810	initSelects(document);
22811	initHoverBlock(document);
22812	touchItemBlock('.catalog_item a');
22813	InitOrderCustom();
22814	showTotalSummItem();
22815	basketActions();
22816	orderActions();
22817
22818	checkMobileRegion();
22819}
22820
22821checkMobileRegion = function(){
22822	if($('.confirm_region').length)
22823	{
22824		if(!$('.top_mobile_region').length)
22825			$('<div class="top_mobile_region"><div class="confirm_wrapper"><div class="confirm_region"></div><div class="close_popup"></div></div></div>').insertBefore($('#mobileheader'));
22826		$('.top_mobile_region .confirm_region').html($('.confirm_region').html());
22827
22828		$('.top_mobile_region .close_popup').click(function(){
22829			$(this).closest('.confirm_wrapper').find('.close').trigger('click');
22830			$(this).closest('.confirm_wrapper').remove();
22831		})
22832	}
22833}
22834if(!funcDefined('orderActions')){
22835	orderActions = function(e){
22836		if(arNextOptions["PAGES"]["ORDER_PAGE"]){
22837			//phone
22838			if($('#bx-soa-order input[autocomplete=tel]').length){
22839				// get property phone
22840				for(var i = 0;i<BX.Sale.OrderAjaxComponent.result.ORDER_PROP.properties.length;++i){
22841					if(BX.Sale.OrderAjaxComponent.result.ORDER_PROP.properties[i].IS_PHONE == 'Y'){
22842						var arPropertyPhone = BX.Sale.OrderAjaxComponent.result.ORDER_PROP.properties[i];
22843					}
22844				}
22845
22846				// validate input type=tel
22847				if(typeof(BX.Sale.OrderAjaxComponent) !== 'undefined' && typeof(BX.Sale.OrderAjaxComponent) === 'object' && typeof(arPropertyPhone) == 'object' && arPropertyPhone){
22848					BX.Sale.OrderAjaxComponent.validatePhone = function(input, arProperty, fieldName)
22849					{
22850						if (!input || !arProperty)
22851							return [];
22852
22853						var value = input.value,
22854							errors = [],
22855							name = BX.util.htmlspecialchars(arProperty.NAME),
22856							field = BX.message('SOA_FIELD') + ' "' + name + '"',
22857							re;
22858
22859						if (arProperty.REQUIRED == 'Y' && value.length == 0){
22860							errors.push(field + ' ' + BX.message('SOA_REQUIRED'));
22861						}
22862
22863						if(arProperty.IS_PHONE == 'Y' && value.length > 0){
22864							function regexpPhone(value, element, regexp){
22865								var re = new RegExp( regexp );
22866								return re.test(value);
22867							}
22868
22869							var validPhone = regexpPhone($(input).val(), $(input), arNextOptions['THEME']['VALIDATE_PHONE_MASK'].length ? arNextOptions['THEME']['VALIDATE_PHONE_MASK'] : '.*');
22870
22871							if(!validPhone){
22872								errors.push(field + ' ' +BX.message('JS_FORMAT_ORDER'));
22873							}
22874						}
22875
22876						return errors;
22877					}
22878
22879					BX.Sale.OrderAjaxComponent.getValidationDataPhone = function(arProperty, propContainer){
22880						var data = {}, inputs;
22881						switch (arProperty.TYPE)
22882						{
22883							case 'STRING':
22884								data.action = 'blur';
22885								data.func = BX.delegate(function(input, fieldName){
22886									return this.validatePhone(input, arProperty, fieldName);
22887								}, this);
22888
22889								inputs = propContainer.querySelectorAll('input[type=tel]');
22890								if ($(inputs).length)
22891								{
22892									data.inputs = inputs;
22893									break;
22894								}
22895						}
22896
22897						return data;
22898					};
22899
22900					BX.Sale.OrderAjaxComponent.bindValidationPhone = function(id, propContainer)
22901					{
22902						if (!this.validation.properties || !this.validation.properties[id])
22903							return;
22904
22905						var arProperty = this.validation.properties[id],
22906							data = this.getValidationDataPhone(arProperty, propContainer),
22907							i, k;
22908
22909						if (data && data.inputs && data.action)
22910						{
22911							for (i = 0; i < $(data.inputs).length; i++)
22912							{
22913								if (BX.type.isElementNode(data.inputs[i])){
22914									BX.bind(data.inputs[i], data.action, BX.delegate(function(){
22915										this.isValidProperty(data);
22916									}, this));
22917								}
22918								else{
22919									for (k = 0; k < $(data.inputs[i]).length; k++)
22920										BX.bind(data.inputs[i][k], data.action, BX.delegate(function(){
22921											this.isValidProperty(data);
22922										}, this));
22923								}
22924							}
22925						}
22926					};
22927
22928					BX.Sale.OrderAjaxComponent.isValidPropertiesBlock = function(excludeLocation)
22929					{
22930						if (!this.options.propertyValidation)
22931							return [];
22932
22933						var props = this.orderBlockNode.querySelectorAll('.bx-soa-customer-field[data-property-id-row]'),
22934							propsErrors = [],
22935							id, propContainer, arProperty, data, i;
22936
22937						for (i = 0; i < props.length; i++)
22938						{
22939							id = props[i].getAttribute('data-property-id-row');
22940
22941							if (!!excludeLocation && this.locations[id])
22942								continue;
22943
22944							propContainer = props[i].querySelector('.soa-property-container');
22945							if (propContainer)
22946							{
22947								arProperty = this.validation.properties[id];
22948								data = this.getValidationData(arProperty, propContainer);
22949								dataPhone = this.getValidationDataPhone(arProperty, propContainer);
22950								data = $.extend({}, data, dataPhone);
22951
22952								propsErrors = propsErrors.concat(this.isValidProperty(data, true));
22953							}
22954						}
22955
22956						return propsErrors;
22957					};
22958
22959
22960					// create input type=tel
22961					var input = $('input[autocomplete=tel]'),
22962						inputHTML = input[0].outerHTML,
22963						value = input.val(),
22964						newInput = input[0].outerHTML.replace('type="text"', 'type="tel" value="'+value+'"');
22965
22966					if($(input).length < 2)
22967					{
22968						input.hide();
22969						$(newInput).insertAfter(input);
22970					}
22971					showPhoneMask('input[autocomplete=tel][type=tel]');
22972
22973					// change value input type=text when change input type=tel
22974					$('input[autocomplete=tel][type=tel]').on('blur', function(){
22975						var $this = $(this);
22976
22977						var value = $this.val();
22978						$this.parent().find('input[autocomplete=tel][type=text]').val(value);
22979					});
22980
22981					BX.Sale.OrderAjaxComponent.bindValidationPhone(arPropertyPhone.ID, $('input[autocomplete=tel]').parent()[0]);
22982				}
22983			}
22984
22985			if($('.bx-soa-cart-total').length){
22986				if(!$('.change_basket').length)
22987					$('.bx-soa-cart-total').prepend('<div class="change_basket">'+BX.message("BASKET_CHANGE_TITLE")+'<a href="'+arNextOptions["SITE_DIR"]+'basket/" class="change_link">'+BX.message("BASKET_CHANGE_LINK")+'</a></div>');
22988
22989				if(typeof (BX.Sale.OrderAjaxComponent) == "object"){
22990					if(arNextOptions['COUNTERS']['USE_FULLORDER_GOALS'] !== 'N'){
22991						if(typeof BX.Sale.OrderAjaxComponent.reachgoalbegin === 'undefined'){
22992							BX.Sale.OrderAjaxComponent.reachgoalbegin = true;
22993							var eventdata = {goal: 'goal_order_begin'};
22994							BX.onCustomEvent('onCounterGoals', [eventdata])
22995						}
22996					}
22997
22998					if(BX.Sale.OrderAjaxComponent.hasOwnProperty("params")){
22999						$('.bx-soa-cart-total .change_link').attr('href', BX.Sale.OrderAjaxComponent.params.PATH_TO_BASKET);
23000						if(arNextOptions["PRICES"]["MIN_PRICE"]){
23001							if(arNextOptions["PRICES"]["MIN_PRICE"]>Number(BX.Sale.OrderAjaxComponent.result.TOTAL.ORDER_PRICE)){
23002								$('<div class="fademask_ext"></div>').appendTo($('body'));
23003								location.href=BX.Sale.OrderAjaxComponent.params.PATH_TO_BASKET;
23004							}
23005						}
23006					}
23007
23008					// update oreder auth form
23009					if($('#bx-soa-auth').length && !$('#bx-soa-auth .redisigned').length){
23010						// update input USER_LOGIN
23011						if($('input[name="USER_LOGIN"]').length){
23012							var $label = $('input[name="USER_LOGIN"]').closest('.bx-authform-formgroup-container').find('.bx-authform-label-container');
23013							if(!$label.find('.bx-authform-starrequired').length){
23014								$label.html($label.html() + '<span class="bx-authform-starrequired"> *</span>');
23015							}
23016						}
23017
23018						// update input USER_PASSWORD
23019						if($('input[name="USER_PASSWORD"]').length){
23020							var $label = $('input[name="USER_PASSWORD"]').closest('.bx-authform-formgroup-container').find('.bx-authform-label-container');
23021							if(!$label.find('.bx-authform-starrequired').length){
23022								$label.html($label.html() + '<span class="bx-authform-starrequired"> *</span>');
23023							}
23024						}
23025
23026						if($('input[name="USER_REMEMBER"]').length){
23027							var $label = $('input[name="USER_REMEMBER"]').attr('id', 'ORDER_AUTH_USER_REMEMBER').closest('label').attr('for', 'ORDER_AUTH_USER_REMEMBER');
23028							var html = $('input[name="USER_REMEMBER"]').attr('id', 'ORDER_AUTH_USER_REMEMBER').wrap('<div id="trem_"></div>').parent().html();
23029							$('#trem_').remove();
23030							$label.html($label.text());
23031							$(html).insertBefore($label).closest('.bx-authform-formgroup-container').addClass('filter');
23032							var html = $('#bx-soa-auth .bx-authform>a').addClass('pull-right').addClass('forgot').wrap('<div id="trem_"></div>').parent().html();
23033							$('#trem_').remove();
23034							$(html).insertBefore($label.closest('.checkbox'));
23035						}
23036
23037						$('#bx-soa-auth .bx-soa-reg-block .btn').removeClass('btn-default').removeClass('btn-lg').addClass('transparent').text(BX.message('ORDER_REGISTER_BUTTON'));
23038
23039						$('#bx-soa-auth').append('<div class="redisigned hidden></div>');
23040					}
23041
23042					// update oreder register form
23043					if($('.bx-soa-section-content.reg').length && !$('.bx-soa-section-content.reg .redisigned').length){
23044						var bRebindRegSubmit = false;
23045
23046						if(arNextOptions.THEME.LOGIN_EQUAL_EMAIL === 'Y'){
23047							bRebindRegSubmit = true;
23048
23049							// update input NEW_LOGIN
23050							if($('input[name="NEW_LOGIN"]').length){
23051								$('input[name="NEW_LOGIN"]').closest('.bx-authform-formgroup-container').hide();
23052							}
23053						}
23054
23055						if(arNextOptions.THEME.PERSONAL_ONEFIO === 'Y'){
23056							bRebindRegSubmit = true;
23057
23058							// update input NEW_NAME
23059							if($('input[name="NEW_NAME"]').length){
23060								$('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>');
23061							}
23062
23063							// update input NEW_LAST_NAME
23064							if($('input[name="NEW_LAST_NAME"]').length){
23065								$('input[name="NEW_LAST_NAME"]').closest('.bx-authform-formgroup-container').hide();
23066								$('input[name="NEW_LAST_NAME"]').val(' ');
23067							}
23068						}
23069
23070						if(bRebindRegSubmit){
23071							// bind new handler for submit button
23072							var $regSubmit = $('#do_register~input[type=submit]');
23073							if($regSubmit.length){
23074								BX.unbindAll($regSubmit[0]);
23075								$(document).on('click', '#do_register~input[type=submit]', function(e){
23076									e.preventDefault();
23077									e.stopImmediatePropagation();
23078
23079									if(arNextOptions.THEME.LOGIN_EQUAL_EMAIL === 'Y'){
23080										var email = BX.findChild(BX('bx-soa-auth'), {attribute: {'name': 'NEW_EMAIL'}}, true, false);
23081										var login = BX.findChild(BX('bx-soa-auth'), {attribute: {'name': 'NEW_LOGIN'}}, true, false);
23082
23083										if(login && email){
23084											login.value = email.value;
23085										}
23086									}
23087
23088									BX('do_register').value = 'Y';
23089									BX.Sale.OrderAjaxComponent.sendRequest('showAuthForm');
23090								});
23091							}
23092						}
23093
23094						// update captcha
23095						var $captcha = $('.bx-soa-section-content.reg').find('.bx-captcha');
23096						if($captcha.length){
23097							$captcha.addClass('captcha_image');
23098							$captcha.append('<div class="captcha_reload"></div>');
23099							$captcha.closest('.bx-authform-formgroup-container').addClass('captcha-row').find('input[name=captcha_word]').closest('.bx-authform-input-container').addClass('captcha_input');
23100						}
23101
23102						// update input NEW_NAME && NEW_LAST_NAME
23103						if($('input[name=NEW_NAME]').length && $('input[name=NEW_LAST_NAME]').length && arNextOptions.THEME.PERSONAL_ONEFIO !== 'Y'){
23104							if(!$('input[name=NEW_NAME]').closest('.bx-authform-formgroup-container.col
23104-md-6').length){
23105								$('input[name=NEW_NAME],input[name=NEW_LAST_NAME]').closest('.bx-authform-formgroup-container').addClass('col-md-6');
23106								var html = $('input[name=NEW_LAST_NAME]').closest('.bx-authform-formgroup-container').wrap('<div id="trem_"></div>').parent().html();
23107								$('#trem_').remove();
23108								$(html).insertAfter($('input[name=NEW_NAME]').closest('.bx-authform-formgroup-container').wrap('<div class="row"></div>'));
23109							}
23110						}
23111
23112						// update input NEW_EMAIL && PHONE_NUMBER
23113						if($('input[name=NEW_EMAIL]').length && $('input[name=PHONE_NUMBER]').length){
23114							if(!$('input[name=PHONE_NUMBER]').closest('.bx-authform-formgroup-container.col-md-6').length){
23115								$('input[name=NEW_EMAIL],input[name=PHONE_NUMBER]').closest('.bx-authform-formgroup-container').addClass('col-md-6');
23116								var html = $('input[name=PHONE_NUMBER]').closest('.bx-authform-formgroup-container').wrap('<div id="trem_"></div>').parent().html();
23117								$('#trem_').remove();
23118								$(html).insertAfter($('input[name=NEW_EMAIL]').closest('.bx-authform-formgroup-container').wrap('<div class="row"></div>'));
23119							}
23120						}
23121
23122						// update input NEW_PASSWORD && NEW_PASSWORD_CONFIRM
23123						if($('input[name=NEW_PASSWORD]').length && $('input[name=NEW_PASSWORD_CONFIRM]').length){
23124							if(!$('input[name=NEW_PASSWORD]').closest('.bx-authform-formgroup-container.col
23124-md-6').length){
23125								$('input[name=NEW_PASSWORD],input[name=NEW_PASSWORD_CONFIRM]').closest('.bx-authform-formgroup-container').addClass('col-md-6');
23126								var html = $('input[name=NEW_PASSWORD_CONFIRM]').closest('.bx-authform-formgroup-container').wrap('<div id="trem_"></div>').parent().html();
23127								$('#trem_').remove();
23128								$(html).insertAfter($('input[name=NEW_PASSWORD]').closest('.bx-authform-formgroup-container').wrap('<div class="row"></div>'));
23129							}
23130						}
23131
23132						// update input PHONE_NUMBER
23133						if($('input[name=PHONE_NUMBER]').length){
23134							var input = $('input[name=PHONE_NUMBER]'),
23135								inputHTML = input[0].outerHTML,
23136								value = input.val(),
23137								newInput = input[0].outerHTML.replace('type="text"', 'type="tel" value="'+value+'"');
23138
23139							if($(input).length < 2){
23140								input.hide();
23141								$(newInput).insertAfter(input);
23142
23143								showPhoneMask('input[name=PHONE_NUMBER][type=tel]');
23144
23145								$('input[name=PHONE_NUMBER][type=tel]').on('blur', function(){
23146									var $this = $(this);
23147									var value = $this.val();
23148									$this.parent().find('input[name=PHONE_NUMBER][type=text]').val(value);
23149								});
23150
23151								var $label = $('input[name=PHONE_NUMBER][type=tel]').closest('.bx-authform-formgroup-container').find('.bx-authform-label-container');
23152								$label.html(BX.message('ORDER_PHONE_LABEL') + ($label.find('.bx-authform-starrequired').length ? '<span class="bx-authform-starrequired"> *</span>' : ''));
23153							}
23154						}
23155
23156						$('.bx-soa-section-content.reg').append('<div class="redisigned hidden></div>');
23157					}
23158
23159					var asproShowLicence = arNextOptions["THEME"]["SHOW_LICENCE"] == "Y";
23160					var asproShowOffer = arNextOptions["THEME"]["SHOW_OFFER"] == "Y";
23161
23162					if($('.bx-soa-cart-total-line-total').length && (asproShowLicence ||  asproShowOffer)){
23163						if(typeof(e) === 'undefined'){
23164							BX.Sale.OrderAjaxComponent.state_licence = (arNextOptions['THEME']['LICENCE_CHECKED'] == 'Y' ? 'checked' : '');
23165							BX.Sale.OrderAjaxComponent.state_offer = (arNextOptions['THEME']['OFFER_CHECKED'] == 'Y' ? 'checked' : '');
23166						}
23167							
23168
23169						if(
23170							!$('.bx-soa-auth.bx-active').length &&
23171							( (!$('.licence_block.filter').length && asproShowLicence) || (!$('.offer_block.filter').length && asproShowOffer) )
23172						){
23173
23174							$('<div class="form"><div class="license_order_wrap"></div></div>').insertBefore($('#bx-soa-orderSave'));
23175
23176							if(!$('.licence_block.filter').length && asproShowLicence)
23177								$('<div class="licence_block filter label_block"><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>').appendTo($('.license_order_wrap'));
23178
23179							if(!$('.offer_block.filter').length && asproShowOffer)
23180								$('<div class="offer_block filter label_block"><label data-for="offer_order" class="hidden error">'+BX.message('JS_REQUIRED_OFFER')+'</label><input type="checkbox" name="offer_order" required '+BX.Sale.OrderAjaxComponent.state_offer+' value="Y"><label data-for="offer_order" class="offer_pub">'+BX.message('OFFER_TEXT')+'</label></div>').appendTo($('.license_order_wrap'));
23181							
23182							if(asproShowLicence){
23183								$(document).on('click', '.bx-soa .licence_block label.license', function(){
23184									var id = $(this).data('for');
23185									$('.bx-soa .licence_block label.error').addClass('hidden');
23186									if(!$('input[name='+id+']').prop('checked')){
23187										$('input[name='+id+']').prop('checked', 'checked');
23188										BX.Sale.OrderAjaxComponent.state_licence = 'checked';
23189									}
23190									else{
23191										$('input[name='+id+']').prop('checked', '');
23192										BX.Sale.OrderAjaxComponent.state_licence = '';
23193									}
23194								})
23195							}
23196							
23197							if(asproShowOffer){
23198								$(document).on('click', '.bx-soa .offer_block label.offer_pub', function(){
23199									var id = $(this).data('for');
23200									$('.bx-soa .offer_block label.error').addClass('hidden');
23201									if(!$('input[name='+id+']').prop('checked')){
23202										$('input[name='+id+']').prop('checked', 'checked');
23203										BX.Sale.OrderAjaxComponent.state_offer = 'checked';
23204									}
23205									else{
23206										$('input[name='+id+']').prop('checked', '');
23207										BX.Sale.OrderAjaxComponent.state_offer = '';
23208									}
23209								})
23210							}
23211							
23212
23213							$(document).on('click', '.lic_condition a', function(){
23214								if(BX.hasClass(BX('bx-soa-order'), 'orderform--v1')){
23215									if(BX.Sale.OrderAjaxComponent.isValidForm())
23216									{
23217										BX.Sale.OrderAjaxComponent.animateScrollTo($('.licence_block, .offer_block')[0], 800, 50);
23218									}
23219								}
23220								else{
23221									var iCountErrors = BX.Sale.OrderAjaxComponent.isValidPropertiesBlock().length;
23222									if(!BX.Sale.OrderAjaxComponent.activeSectionId || !iCountErrors)
23223									{
23224										BX.Sale.OrderAjaxComponent.animateScrollTo($('.licence_block, .offer_block')[0], 800, 50);
23225									}
23226								}
23227							})
23228						}
23229
23230						$('#bx-soa-orderSave, .bx-soa-cart-total-button-container').addClass('lic_condition');
23231
23232						if(typeof (BX.Sale.OrderAjaxComponent.oldClickOrderSaveAction) === "undefined" && typeof (BX.Sale.OrderAjaxComponent.clickOrderSaveAction) !== 'undefined'){
23233							BX.Sale.OrderAjaxComponent.oldClickOrderSaveAction = BX.Sale.OrderAjaxComponent.clickOrderSaveAction;
23234							BX.Sale.OrderAjaxComponent.clickOrderSaveAction = function(event){
23235								if(
23236									($('input[name="licenses_order"]').prop('checked') || arNextOptions["THEME"]["SHOW_LICENCE"] != "Y")
23237									&& ($('input[name="offer_order"]').prop('checked') || arNextOptions["THEME"]["SHOW_OFFER"] != "Y")
23238								){
23239									$('.bx-soa .licence_block label.error').addClass('hidden');
23240									$('.bx-soa .offer_block label.error').addClass('hidden');
23241
23242									if (BX.Sale.OrderAjaxComponent.isValidForm())
23243									{
23244										if(typeof BX.Sale.OrderAjaxComponent.allowOrderSave == 'function')
23245											BX.Sale.OrderAjaxComponent.allowOrderSave();
23246										if(typeof BX.Sale.OrderAjaxComponent.doSaveAction == 'function')
23247											BX.Sale.OrderAjaxComponent.doSaveAction();
23248										else
23249											BX.Sale.OrderAjaxComponent.oldClickOrderSaveAction(event);
23250									}
23251								}
23252								else{
23253									if(!$('input[name="licenses_order"]').prop('checked'))
23254										$('.bx-soa .licence_block label.error').removeClass('hidden');
23255
23256									if(!$('input[name="offer_order"]').prop('checked'))
23257										$('.bx-soa .offer_block label.error').removeClass('hidden');
23258								}
23259							}
23260							if(BX.Sale.OrderAjaxComponent.orderSaveBlockNode.querySelector('.checkbox'))
23261							{
23262								if(typeof browser == 'object')
23263								{
23264									if('msie' in browser && browser.msie)
23265										$(BX.Sale.OrderAjaxComponent.orderSaveBlockNode.querySelector('.checkbox')).remove();
23266									else
23267										BX.Sale.OrderAjaxComponent.orderSaveBlockNode.querySelector('.checkbox').remove();
23268								}
23269							}
23270							BX.unbindAll(BX.Sale.OrderAjaxComponent.totalInfoBlockNode.querySelector('a.btn-order-save'));
23271							BX.unbindAll(BX.Sale.OrderAjaxComponent.mobileTotalBlockNode.querySelector('a.btn-order-save'));
23272							BX.unbindAll(BX.Sale.OrderAjaxComponent.orderSaveBlockNode.querySelector('a'));
23273							BX.bind(BX.Sale.OrderAjaxComponent.totalInfoBlockNode.querySelector('a.btn-order-save'), 'click', BX.proxy(BX.Sale.OrderAjaxComponent.clickOrderSaveAction, BX.Sale.OrderAjaxComponent));
23274							BX.bind(BX.Sale.OrderAjaxComponent.mobileTotalBlockNode.querySelector('a.btn-order-save'), 'click', BX.proxy(BX.Sale.OrderAjaxComponent.clickOrderSaveAction, BX.Sale.OrderAjaxComponent));
23275							BX.bind(BX.Sale.OrderAjaxComponent.orderSaveBlockNode.querySelector('a'), 'click', BX.proxy(BX.Sale.OrderAjaxComponent.clickOrderSaveAction, BX.Sale.OrderAjaxComponent));
23276						}
23277					}
23278
23279					// fix hide total block
23280					$(window).scroll();
23281
23282					if(checkCounters() && typeof (BX.Sale.OrderAjaxComponent.oldSaveOrder) === "undefined"){
23283						var saveFunc = typeof (BX.Sale.OrderAjaxComponent.saveOrder) !== 'undefined' ? 's
23283aveOrder' : 'saveOrderWithJson';
23284						if(typeof (BX.Sale.OrderAjaxComponent[saveFunc]) !== 'undefined'){
23285							BX.Sale.OrderAjaxComponent.oldSaveOrder = BX.Sale.OrderAjaxComponent[saveFunc];
23286							BX.Sale.OrderAjaxComponent[saveFunc] = function(result){
23287								var res = BX.parseJSON(result);
23288								if (res && res.order){
23289									if (!res.order.SHOW_AUTH){
23290										if (res.order.REDIRECT_URL && res.order.REDIRECT_URL.length && (!res.order.ERROR || BX.util.object_keys(res.order.ERROR).length < 1)){
23291											if((arMatch = res.order.REDIRECT_URL.match(/ORDER_ID\=[^&=]*/g)) && arMatch.length && (_id = arMatch[0].replace(/ORDER_ID\=/g, '', arMatch[0]))){
23292												$.ajax({
23293													url:arNextOptions['SITE_DIR']+"ajax/check_order.php",
23294													dataType: "json",
23295													type: "POST",
23296													data: { "ID": _id },
23297													success: function(id){
23298														if(parseInt(id)){
23299															purchaseCounter(parseInt(id), BX.message('FULL_ORDER'), function(d){
23300																if(typeof localStorage !== 'undefined' && typeof d === 'object'){
23301																	localStorage.setItem('gtm_e_' + _id, JSON.stringify(d));
23302																}
23303																BX.Sale.OrderAjaxComponent.oldSaveOrder(result);
23304															});
23305														}
23306														else{
23307															BX.Sale.OrderAjaxComponent.oldSaveOrder(result);
23308														}
23309													},
23310													error: function(){
23311														BX.Sale.OrderAjaxComponent.oldSaveOrder(result);
23312													}
23313												})
23314											}
23315											else{
23316												BX.Sale.OrderAjaxComponent.oldSaveOrder(result);
23317											}
23318										}
23319										else{
23320											BX.Sale.OrderAjaxComponent.oldSaveOrder(result);
23321										}
23322									}
23323									else{
23324										BX.Sale.OrderAjaxComponent.oldSaveOrder(result);
23325									}
23326								}
23327								else{
23328									BX.Sale.OrderAjaxComponent.oldSaveOrder(result);
23329								}
23330							}
23331						}
23332					}
23333
23334					if($('#bx-soa-order-form .captcha-row').length){
23335						if(window.asproRecaptcha && window.asproRecaptcha.key && window.asproRecaptcha.params.recaptchaSize == 'invisible'){
23336							$('#bx-soa-order-form .captcha-row').addClass('invisible');
23337							if(asproRecaptcha.params.recaptchaLogoShow === 'n'){
23338								$('#bx-soa-order-form .captcha-row').addClass('logo_captcha_n');
23339							}
23340						}
23341					}
23342
23343					if($('#bx-soa-order-form .captcha-row.invisible').length){
23344						if(typeof (BX.Sale.OrderAjaxComponent.oldSendRequest) === "undefined" && typeof (BX.Sale.OrderAjaxComponent.sendRequest) !== 'undefined'){
23345							var tmpAction, tmpActionData;
23346							BX.Sale.OrderAjaxComponent.oldSendRequest = BX.Sale.OrderAjaxComponent.sendRequest;
23347							BX.Sale.OrderAjaxComponent.sendRequest = function(action, actionData){
23348								var bSend = true;
23349
23350								if($('#bx-soa-order-form .captcha-row.invisible').length){
23351									if(window.renderRecaptchaById && window.asproRecaptcha && window.asproRecaptcha.key){
23352										if(window.asproRecaptcha.params.recaptchaSize == 'invisible'){
23353											var form = BX('bx-soa-order-form');
23354											if($(form).find('.g-recaptcha').length){
23355												if($(form).find('.g-recaptcha-response').val()){
23356													bSend = true;
23357												}
23358												else{
23359													if(typeof grecaptcha != 'undefined'){
23360														grecaptcha.execute($(form).find('.g-recaptcha').data('widgetid'));
23361														bSend = false;
23362													}
23363													else{
23364														bSend = false;
23365													}
23366												}
23367											}
23368										}
23369									}
23370								}
23371
23372								if(bSend){
23373									BX.Sale.OrderAjaxComponent.oldSendRequest(action, actionData);
23374								}
23375								else{
23376									tmpAction = action;
23377									tmpActionData = actionData;
23378								}
23379							}
23380
23381							$(document).on('submit', '#bx-soa-order-form', function(e){
23382								e.preventDefault();
23383
23384								if(typeof tmpAction !== 'undefined' || typeof tmpActionData !== 'undefined'){
23385									BX.Sale.OrderAjaxComponent.sendRequest(tmpAction, tmpActionData);
23386									tmpAction = undefined;
23387									tmpActionData = undefined;
23388								}
23389							});
23390						}
23391					}
23392				}
23393
23394				$('.bx-ui-sls-quick-locations.quick-locations').on('click', function(){
23395					$(this).siblings().removeClass('active');
23396					$(this).addClass('active');
23397				})
23398			}
23399		}
23400	}
23401}
23402
23403if(!funcDefined('basketActions')){
23404	basketActions = function(){
23405		if(arNextOptions["PAGES"]["BASKET_PAGE"]){
23406			checkMinPrice();
23407
23408			//remove4Cart
23409			if(typeof(BX.Sale) !== 'undefined' && typeof(BX.Sale) === 'object')
23410			{
23411				if(typeof(BX.Sale.BasketComponent) !== 'undefined' && typeof(BX.Sale.BasketComponent) === 'object')
23412				{
23413					$(document).on('click', '.basket-item-actions-remove', function(){
23414						var basketID = $(this).closest('.basket-items-list-item-container').data('id');
23415						delFromBasketCounter(BX.Sale.BasketComponent.items[basketID].PRODUCT_ID);
23416					})
23417				}
23418			}
23419
23420			if(location.hash)
23421			{
23422				var hash = location.hash.substring(1);
23423				if($('#basket_toolbar_button_'+hash).length)
23424					$('#basket_toolbar_button_'+hash).trigger('click');
23425
23426				if($('.basket-items-list-header-filter a[data-filter="'+hash+'"]').length)
23427					$('.basket-items-list-header-filter a[data-filter="'+hash+'"]')[0].click();
23428			}
23429
23430			$('.bx_sort_container').append('<div class="top_control basket_sort"><span style="opacity:0;" class="delete_all btn btn-default white white-bg grey remove_all_basket">'+BX.message("BASKET_CLEAR_ALL_BUTTON")+'</span></div>');
23431			if($('.basket-items-list-header-filter').length)
23432			{
23433				$('.basket-items-list-header-filter').append('<div class="top_control basket_sort"><span style="opacity:1;" class="delete_all btn btn-default white white-bg grey remove_all_basket">'+BX.message("BASKET_CLEAR_ALL_BUTTON")+'</span></div>');
23434
23435				var cur_index = $('.basket-items-list-header-filter > a.active').index();
23436				//fix delayed
23437				if(cur_index == 3)
23438					cur_index = 2;
23439
23440				if($('.basket-items-list-header-filter > a.active').data('filter') == 'all')
23441					cur_index = 'all';
23442
23443				$('.basket-items-list-header-filter .top_control .delete_all').data("type",cur_index);
23444
23445				$('.basket-items-list-header-filter > a').on('click', function() {
23446					var index = $(this).index();
23447
23448					//fix delayed
23449					if(index == 3)
23450						index = 2;
23451
23452					if($(this).data('filter') == 'all')
23453						index = 'all';
23454
23455					$('.basket-items-list-header-filter .top_control .delete_all').data("type", index);
23456				});
23457			}
23458			else
23459			{
23460				var cur_index = $('.bx_sort_container a.current').index();
23461				$('.bx_sort_container .top_control .delete_all').data("type",cur_index);
23462				if($('.bx_ordercart > div:eq('+cur_index+') table tbody tr td.item').length)
23463					$('.bx_sort_container .top_control .delete_all').css('opacity',1);
23464
23465				$('.bx_ordercart .bx_ordercart_coupon #coupon').wrap('<div class="input"></div>');
23466
23467				$('.bx_sort_container > a').on('click', function() {
23468					var index = $(this).index();
23469					$('.bx_sort_container .top_control .delete_all').data("type", index);
23470
23471					if($('.bx_ordercart > div:eq('+index+') table tbody tr td.item').length)
23472						$('.bx_sort_container .top_control .delete_all').css('opacity',1);
23473					else
23474						$('.bx_sort_container .top_control .delete_all').css('opacity',0);
23475				});
23476			}
23477
23478
23479			$('.basket_print').on('click', function() {
23480				 // window.open(location.pathname+"?print=Y",'_blank');
23481				 window.print();
23482			});
23483
23484			$('.delete_all').on('click', function() {
23485				if(arNextOptions['COUNTERS']['USE_BASKET_GOALS'] !== 'N'){
23486					var eventdata = {goal: 'goal_basket_clear', params: {type: $(this).data('type')}};
23487					BX.onCustomEvent('onCounterGoals', [eventdata]);
23488				}
23489				$.post( arNextOptions['SITE_DIR']+"ajax/action_basket.php", "TYPE="+$(this).data('type')+"&CLEAR_ALL=Y", $.proxy(function( data ) {
23490					location.reload();
23491				}));
23492			});
23493
23494			$('.bx_item_list_section .bx_catalog_item').sliceHeight({row:'.bx_item_list_slide', item:'.bx_catalog_item'});
23495
23496			BX.addCustomEvent('onAjaxSuccess', function(e) {
23497				checkMinPrice();
23498
23499				var errorText = $.trim($('#warning_message').text());
23500				$('#basket_items_list .error_text').remove();
23501				if (errorText != '') {
23502					$('#warning_message').hide().text('');
23503					$('#basket_items_list').prepend('<div class="error_text">' +errorText+ '</div>');
23504				}
23505				if (typeof e === 'object' && 'BASKET_DATA' in e) {
23506					if ($("#ajax_basket").length) {
23507						reloadTopBasket('add', $('#ajax_basket'), 200, 5000, 'Y');
23508					}
23509					if ($("#basket_line .basket_fly").length) {
23510						basketFly('open', 'N');
23511					}
23512				}
23513				
23514			});
23515			$(document).on('click', '.bx_ordercart_order_pay_center .checkout, .basket-checkout-section-inner .basket-btn-checkout', function(){
23516				if(checkCounters('google')){
23517					checkoutCounter(1, 'start order');
23518				}
23519			})
23520		}
23521	}
23522}
23523
23524if(!funcDefined('checkMinPrice')){
23525	checkMinPrice = function(){
23526		if(arNextOptions["PAGES"]["BASKET_PAGE"]){
23527			var summ_raw=0,
23528				summ=0;
23529			if($('#allSum_FORMATED').length)
23530			{
23531				summ_raw=$('#allSum_FORMATED').text().replace(/[^0-9\.,]/g,'');
23532				summ=parseFloat(summ_raw);
23533				if($('#basket_items').length)
23534				{
23535					var summ = 0;
23536					$('#basket_items tr').each(function(){
23537						if(typeof ($(this).data('item-price')) !== 'undefined' && $(this).data('item-price'))
23538							summ += $(this).data('item-price')*$(this).find('#QUANTITY_INPUT_'+$(this).attr('id')).val();
23539					})
23540				}
23541				if(!$('.catalog_back').length)
23542					$('.bx_ordercart_order_pay_center').prepend('<a href="'+arNextOptions["PAGES"]["CATALOG_PAGE_URL"]+'" class="catalog_back btn btn-default btn-lg white grey">'+BX.message("BASKET_CONTINUE_BUTTON")+'</a>');
23543			}
23544
23545			if(arNextOptions["THEME"]["SHOW_ONECLICKBUY_ON_BASKET_PAGE"] == "Y")
23546				$('.basket-coupon-section').addClass('smallest');
23547
23548			if(typeof BX.Sale !== "undefined")
23549			{
23550				if(typeof BX.Sale.BasketComponent !== "undefined" && typeof BX.Sale.BasketComponent.result !== "undefined")
23551					summ = BX.Sale.BasketComponent.result.allSum;
23552			}
23553
23554			if(arNextOptions["PRICES"]["MIN_PRICE"]){
23555				if(arNextOptions["PRICES"]["MIN_PRICE"]>summ){
23556
23557					if($('.oneclickbuy.fast_order').length)
23558						$('.oneclickbuy.fast_order').remove();
23559
23560					if($('.basket-checkout-container').length)
23561					{
23562						if(!$('.icon_error_wrapper').length){
23563							$('.basket-checkout-block.basket-checkout-block-btn').html('<div class="icon_error_wrapper"><div class="icon_error_block">'+BX.message("MIN_ORDER_PRICE_TEXT").replace("#PRICE#", jsPriceFormat(arNextOptions["PRICES"]["MIN_PRICE"]))+'</div></div>');
23564						}
23565					}
23566					else
23567					{
23568						if(!$('.icon_error_wrapper').length  && typeof jsPriceFormat !== 'undefined'){
23569							$('.bx_ordercart_order_pay_center').prepend('<div class="icon_error_wrapper"><div class="icon_error_block">'+BX.message("MIN_ORDER_PRICE_TEXT").replace("#PRICE#", jsPriceFormat(arNextOptions["PRICES"]["MIN_PRICE"]))+'</div></div>');
23570						}
23571						if($('.bx_ordercart_order_pay .checkout').length)
23572							$('.bx_ordercart_order_pay .checkout').remove();
23573					}
23574				}else{
23575					if($('.icon_error_wrapper').length)
23576						$('.icon_error_wrapper').remove();
23577
23578					if($('.basket-checkout-container').length)
23579					{
23580						if(!$('.oneclickbuy.fast_order').length && arNextOptions["THEME"]["SHOW_ONECLICKBUY_ON_BASKET_PAGE"] == "Y" && !$('.basket-btn-checkout.disabled').length)
23581							$('.basket-checkout-block-btn').append('<div class="fastorder"><span class="oneclickbuy btn btn-default btn-lg btn__new-green fast_order" onclick="oneClickBuyBasket()">'+BX.message("BASKET_QUICK_ORDER_BUTTON")+'</span></div>');
23582					}
23583					else
23584					{
23585						if($('.bx_ordercart_order_pay .checkout').length)
23586							$('.bx_ordercart .bx_ordercart_order_pay .checkout').css('opacity','1');
23587						else
23588							$('.bx_ordercart_order_pay_center').append('<a href="javascript:void(0)" onclick="checkOut();" class="checkout" style="opacity: 1;">'+BX.message("BASKET_ORDER_BUTTON")+'</a>');
23589						if(!$('.oneclickbuy.fast_order').length && arNextOptions["THEME"]["SHOW_ONECLICKBUY_ON_BASKET_PAGE"] == "Y")
23590							$('.bx_ordercart_order_pay_center').append('<span class="oneclickbuy btn btn-default btn-lg fast_order" onclick="oneClickBuyBasket()">'+BX.message("BASKET_QUICK_ORDER_BUTTON")+'</span>');
23591					}
23592				}
23593			}else{
23594				if($('.basket-checkout-container').length)
23595				{
23596					if(!$('.oneclickbuy.fast_order').length && arNextOptions["THEME"]["SHOW_ONECLICKBUY_ON_BASKET_PAGE"] == "Y" && !$('.basket-btn-checkout.disabled').length)
23597						$('.basket-checkout-block-btn').append('<div class="fastorder"><span class="oneclickbuy btn btn-default btn-lg btn__new-green fast_order" onclick="oneClickBuyBasket()">'+BX.message("BASKET_QUICK_ORDER_BUTTON")+'</span></div>');
23598				}
23599				else
23600				{
23601					$('.bx_ordercart .bx_ordercart_order_pay .checkout').css('opacity','1');
23602					if(!$('.oneclickbuy.fast_order').length && arNextOptions["THEME"]["SHOW_ONECLICKBUY_ON_BASKET_PAGE"] == "Y")
23603						$('.bx_ordercart_order_pay_center').append('<span class="oneclickbuy btn btn-default btn-lg fast_order" onclick="oneClickBuyBasket()">'+BX.message("BASKET_QUICK_ORDER_BUTTON")+'</span>');
23604				}
23605			}
23606
23607			//$('#basket-root .basket-checkout-container .basket-checkout-section .basket-checkout-block .basket-btn-checkout').addClass('white');
23608			$('#basket-root .basket-checkout-container').addClass('visible');
23609		}
23610	}
23611}
23612
23613var isFrameDataReceived = false;
23614if (typeof window.frameCacheVars !== "undefined"){
23615	BX.addCustomEvent("onFrameDataReceived", function (json){
23616		initFull();
23617
23618		CheckTopMenuPadding();
23619		CheckTopMenuOncePadding();
23620		CheckTopMenuDotted();
23621
23622		CheckSearchWidth();
23623
23624		if($('.logo-row.v2').length)
23625		{
23626			$(window).resize(); // need to check resize flexslider & menu
23627			setTimeout(function(){
23628				CheckTopMenuDotted();
23629			}, 100);
23630		}
23631
23632		isFrameDataReceived = true;
23633	});
23634}else{
23635	$( document ).ready(initFull);
23636}
23637
23638if(!funcDefined('setHeightBlockSlider')){
23639	setHeightBlockSlider = function(){
23640		/*
23641		$(document).find('.specials.tab_slider_wrapp .tabs_content > li.cur').equalize({children: '.item-title', reset: true});
23642		$(document).find('.specials.tab_slider_wrapp .tabs_content > li.cur').equalize({children: '.item_info', reset: true});
23643		$(document).find('.specials.tab_slider_wrapp .tabs_content > li.cur').equalize({children: '.catalog_item', reset: true});
23644
23645		var sliderWidth = $(document).find('.specials.tab_slider_wrapp').outerWidth();
23646
23647		var iCountTabs = $(document).find('.specials.tab_slider_wrapp .tabs_content > li.cur').length;
23648
23649		if(iCountTabs <= 1)
23650		{
23651			$(document).find('.specials.tab_slider_wrapp .tabs_content > li.cur').css('height', '');
23652
23653			var itemsButtonsHeight = 0;
23654			if($(document).find('.specials.tab_slider_wrapp .tabs_content .tab.cur .tabs_slider li .footer_button').length)
23655			{
23656				$(document).find('.specials.tab_slider_wrapp .tabs_content .tab.cur .tabs_slider li .footer_button').css('height', 'auto');
23657				itemsButtonsHeight = $(document).find('.specials.tab_slider_wrapp .tabs_content .tab.cur .tabs_slider li .footer_button').height();
23658				$(document).find('.specials.tab_slider_wrapp .tabs_content .tab.cur .tabs_slider li .footer_button').css('height', '');
23659			}
23660			var tabsContentUnhover = $(document).find('.specials.tab_slider_wrapp .tabs_content .tab.cur').height() * 1;
23661			var tabsContentHover = tabsContentUnhover + itemsButtonsHeight+50;
23662			$(document).find('.specials.tab_slider_wrapp .tabs_content .tab.cur').attr('data-unhover', tabsContentUnhover);
23663			$(document).find('.specials.tab_slider_wrapp .tabs_content .tab.cur').attr('data-hover', tabsContentHover);
23664			$(document).find('.specials.tab_slider_wrapp .tabs_content').height(tabsContentUnhover);
23665			$(document).find('.specials.tab_slider_wrapp .tabs_content .tab.cur .flex-viewport').height(tabsContentUnhover);
23666		}
23667		else
23668		{
23669			$(document).find('.specials.tab_slider_wrapp .tabs_content > li.cur').each(function(){
23670				var _th = $(this);
23671				_th.css('height', '');
23672
23673				var itemsButtonsHeight = 0;
23674				if(_th.find('.tabs_slider li .footer_button').length)
23675				{
23676					_th.find('.tabs_slider li .footer_button').css('height', 'auto');
23677					itemsButtonsHeight = _th.find('.tabs_slider li .footer_button').height();
23678					_th.find('.tabs_slider li .footer_button').css('height', '');
23679				}
23680
23681				var tabsContentUnhover = _th.height() * 1;
23682				var tabsContentHover = tabsContentUnhover + itemsButtonsHeight+50;
23683				_th.attr('data-unhover', tabsContentUnhover);
23684				_th.attr('data-hover', tabsContentHover);
23685				_th.parent().height(tabsContentUnhover);
23686				_th.find('.flex-viewport').height(tabsContentUnhover);
23687
23688			})
23689		}
23690		*/
23691	}
23692}
23693
23694if(!funcDefined('checkTopFilter')){
23695	checkTopFilter = function() {
23696		if($('.adaptive_filter').length && window.matchMedia('(max-width: 991px)').matches && !$("#mobilefilter").length){
23697                        var top_pos=$('.adaptive_filter').position().top;
23698                        $('.bx_filter.bx_filter_vertical').css({'top':top_pos+43});
23699		}
23700	}
23701}
23702
23703if(!funcDefined('checkStickyFooter')){
23704	checkStickyFooter = function() {
23705		try{
23706			ignoreResize.push(true);
23707			$('#content').css('min-height', '');
23708			var contentTop = $('#content').offset().top;
23709			var contentBottom = contentTop + $('#content').outerHeight();
23710			var footerTop = 0;
23711			if($('footer').length)
23712				footerOffset = $('footer').offset().top;
23713
23714			$('#content').css('min-height', $(window).height() - contentTop - (footerTop - contentBottom) - $('footer').outerHeight() + 'px');
23715			ignoreResize.pop();
23716		}
23717		catch(e){console.error(e);}
23718	}
23719}
23720
23721/* EVENTS */
23722var timerResize = false, ignoreResize = [];
23723$(window).resize(function(){
23724	CheckPopupTop();
23725	/*if(!$('html.print').length)
23726		checkStickyFooter();*/
23727
23728	// here immediate functions
23729	if(!ignoreResize.length){
23730		if(timerResize){
23731			clearTimeout(timerResize);
23732			timerResize = false;
23733		}
23734		timerResize = setTimeout(function(){
23735			// here delayed functions in event
23736			BX.onCustomEvent('onWindowResize', false);
23737		}, 50);
23738	}
23739});
23740
23741var timerScroll = false, ignoreScroll = [], documentScrollTopLast = $(document).scrollTop(), startScroll = 0;
23742$(window).scroll(function(){
23743	CheckPopupTop();
23744	// here immediate functions
23745	documentScrollTopLast = $(document).scrollTop();
23746	SetFixedAskBlock();
23747	/*if($('.wrapper1.mfixed_Y.mfixed_view_scroll_top #mobileheader').length && window.matchMedia('(max-width: 991px)').matches)
23748	{
23749		if(documentScrollTopLast > startScroll)
23750			$('.wrapper1.mfixed_Y.mfixed_view_scroll_top #mobileheader').removeClass('fixed');
23751		else
23752			$('.wrapper1.mfixed_Y.mfixed_view_scroll_top #mobileheader').addClass('fixed');
23753		startScroll = documentScrollTopLast;
23754	}*/
23755
23756	if(!ignoreScroll.length){
23757		if(timerScroll){
23758			clearTimeout(timerScroll);
23759			timerScroll = false;
23760		}
23761		timerScroll = setTimeout(function(){
23762			// here delayed functions in event
23763			BX.onCustomEvent('onWindowScroll', false);
23764		}, 50);
23765	}
23766});
23767
23768var timerLazyLoad = false;
23769var lastLazyLoaded = [];
23770$(document).on('lazyloaded', function(e){
23771	if(timerLazyLoad){
23772		clearTimeout(timerLazyLoad);
23773		timerLazyLoad = false;
23774	}
23775
23776	lastLazyLoaded.push(e.target);
23777	timerLazyLoad = setTimeout(function(){
23778		// here delayed functions in event
23779		BX.onCustomEvent('onLazyLoaded', [lastLazyLoaded]);
23780		lastLazyLoaded = [];
23781	}, 100);
23782});
23783
23784BX.addCustomEvent('onWindowResize', function(eventdata){
23785	try{
23786		ignoreResize.push(true);
23787
23788		CheckTopMenuPadding();
23789		CheckTopMenuOncePadding();
23790		CheckSearchWidth();
23791
23792		CheckTabActive();
23793		CheckTopMenuFullCatalogSubmenu();
23794		CheckHeaderFixedMenu();
23795
23796		
23797		if($('nav.mega-menu.sliced').length)
23798			$('nav.mega-menu.sliced').removeClass('initied');
23799
23800		CheckTopMenuDotted();
23801
23802		CheckTopVisibleMenu();
23803
23804		checkScrollToTop();
23805		CheckObjectsSizes();
23806
23807		CheckFlexSlider();
23808		initSly();
23809
23810		checkMobilePhone();
23811		checkTopFilter();
23812		checkMobileFilter();
23813
23814		if(window.matchMedia('(min-width: 767px)').matches)
23815			$('.wrapper_middle_menu.wrap_menu').removeClass('mobile');
23816
23817		if(window.matchMedia('(max-width: 767px)').matches)
23818			$('.wrapper_middle_menu.wrap_menu').addClass('mobile');
23819
23820		if($("#basket_form").length && $(window).outerWidth()<=600){
23821			$("#basket_form .tabs_content.basket > li.cur td").each(function() { $(this).css("width","");});
23822		}
23823
23824		$(".bx_filter_section .bx_filter_select_container").each(function(){
23825			var prop_id=$(this).closest('.bx_filter_parameters_box').attr('data-property_id');
23826			if($('#smartFilterDropDown'+prop_id).length){
23827				$('#smartFilterDropDown'+prop_id).css("max-width", $(this).width());
23828			}
23829		})
23830	}
23831	catch(e){}
23832	finally{
23833		ignoreResize.pop();
23834	}
23835});
23836
23837BX.addCustomEvent('onWindowScroll', function(eventdata){
23838	try{
23839		ignoreScroll.push(true);
23840	}
23841	catch(e){}
23842	finally{
23843		ignoreScroll.pop();
23844	}
23845});
23846
23847BX.addCustomEvent('onSlideInit', function(eventdata) {
23848	try{
23849		ignoreResize.push(true);
23850		if(eventdata){
23851			var slider = eventdata.slider;
23852			if (slider) {
23853				
23854				if(slider.hasClass('small-gallery'))
23855					$(window).resize();
23856				// add classes .curent & .shown to slide
23857				slider.find('.item').removeClass('current');
23858				var curSlide = slider.find('.item.flex-active-slide'),
23859					curSlideId = curSlide.attr('id'),
23860					nav = slider.find('.flex-direction-nav');
23861
23862				curSlide.addClass('current');
23863
23864				slider.find('.visible').css('opacity', '1');
23865
23866				if(curSlide.hasClass('shown')){
23867					slider.find('.item.clone[id=' + curSlideId + '_clone]').addClass('shown');
23868				}
23869
23870				curSlide.addClass('shown');
23871			}
23872		}
23873	}
23874	catch(e){}
23875	finally{
23876		ignoreResize.pop();
23877	}
23878});
23879
23880BX.addCustomEvent('onCounterGoals', function(eventdata){
23881	if(arNextOptions['THEME']['YA_GOALS'] == 'Y' && arNextOptions['THEME']['YA_COUNTER_ID'])
23882	{
23883		var idCounter = arNextOptions['THEME']['YA_COUNTER_ID'];
23884		idCounter = parseInt(idCounter);
23885
23886		if(typeof eventdata != 'object')
23887			eventdata = {goal: 'undefined'};
23888
23889		if(typeof eventdata.goal != 'string')
23890			eventdata.goal = 'undefined';
23891
23892		if(idCounter)
23893		{
23894			try
23895			{
23896				waitCounter(idCounter, 50, function(){
23897					var obCounter = window['yaCounter' + idCounter];
23898					if(typeof obCounter == 'object'){
23899						obCounter.reachGoal(eventdata.goal);
23900					}
23901				});
23902			}
23903			catch(e)
23904			{
23905				console.error(e)
23906			}
23907		}
23908		else
23909		{
23910			console.info('Bad counter id!', idCounter);
23911		}
23912	}
23913})
23914
23915var onCaptchaVerifyinvisible = function(response){
23916	$('.g-recaptcha:last').each(function(){
23917		var id = $(this).attr('data-widgetid');
23918		if(typeof(id) !== 'undefined' && response){
23919			if(!$(this).closest('form').find('.g-recaptcha-response').val())
23920				$(this).closest('form').find('.g-recaptcha-response').val(response)
23921			if($('iframe[src*=recaptcha]').length)
23922			{
23923				$('iframe[src*=recaptcha]').each(function(){
23924					var block = $(this).parent().parent();
23925					if(!block.hasClass('grecaptcha-badge'))
23926						block.css('width', '100%');
23927				})
23928			}
23929			$(this).closest('form').submit();
23930		}
23931	})
23932}
23933
23934var onCaptchaVerifynormal = function(response){
23935	$('.g-recaptcha').each(function(){
23936		var id = $(this).attr('data-widgetid');
23937		if(typeof(id) !== 'undefined'){
23938			if(grecaptcha.getResponse(id) != ''){
23939				$(this).closest('form').find('.recaptcha').valid();
23940			}
23941		}
23942	});
23943}
23944
23945BX.addCustomEvent('onSubmitForm', function(eventdata){
23946	try{
23947		if(!window.renderRecaptchaById || !window.asproRecaptcha || !window.asproRecaptcha.key)
23948		{
23949			eventdata.form.submit();
23950			$(eventdata.form).closest('.form').addClass('sending');
23951			return true;
23952		}
23953
23954		if(window.asproRecaptcha.params.recaptchaSize == 'invisible' && $(eventdata.form).find('.g-recaptcha').length)
23955		{
23956			if($(eventdata.form).find('.g-recaptcha-response').val())
23957			{
23958				eventdata.form.submit();
23959				$(eventdata.form).closest('.form').addClass('sending');
23960				return true;
23961			}
23962			else
23963			{
23964				if(typeof grecaptcha != 'undefined'){
23965					grecaptcha.execute($(eventdata.form).find('.g-recaptcha').data('widgetid'));
23966				}
23967				else{
23968					return false;
23969				}
23970			}
23971		}
23972		else
23973		{
23974			eventdata.form.submit();
23975			$(eventdata.form).closest('.form').addClass('sending');
23976			return true;
23977		}
23978	}
23979	catch (e){
23980		console.error(e);
23981		return true;
23982	}
23983})
23984
23985/*custom event for sku prices*/
23986
23987/*BX.addCustomEvent('onAsproSkuSetPrice', function(eventdata){
23988	console.log(eventdata);
23989})*/
23990
23991/*BX.addCustomEvent('onAsproSkuSetPriceMatrix', function(eventdata){
23992	console.log(eventdata);
23993})*/
23994
23995/* End */
23996;
23997; /* Start:"a:4:{s:4:"full";s:60:"/local/templates/aspro_next/cdn/slick.min.js?172596984542863";s:6:"source";s:44:"/local/templates/aspro_next/cdn/slick.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
23998!function(i){"use strict";"function"==typeof define&&define.amd?define(["jquery"],i):"undefined"!=typeof exports?module.exports=i(require("jquery")):i(jQuery)}(function(i){"use strict";var e=window.Slick||{};(e=function(){var e=0;return function(t,o){var s,n=this;n.defaults={accessibility:!0,adaptiveHeight:!1,appendArrows:i(t),appendDots:i(t),arrows:!0,asNavFor:null,prevArrow:'<button class="slick-prev" aria-label="Previous" type="button">Previous</button>',nextArrow:'<button class="slick-next" aria-label="Next" type="button">Next</button>',autoplay:!1,autoplaySpeed:3e3,centerMode:!1,centerPadding:"50px",cssEase:"ease",customPaging:function(e,t){return i('<button type="button" />').text(t+1)},dots:!1,dotsClass:"slick-dots",draggable:!0,easing:"linear",edgeFriction:.35,fade:!1,focusOnSelect:!1,focusOnChange:!1,infinite:!0,initialSlide:0,lazyLoad:"ondemand",mobileFirst:!1,pauseOnHover:!0,pauseOnFocus:!0,pauseOnDotsHover:!1,respondTo:"window",responsive:null,rows:1,rtl:!1,slide:"",slidesPerRow:1,slidesToShow:1,slidesToScroll:1,speed:500,swipe:!0,swipeToSlide:!1,touchMove:!0,touchThreshold:5,useCSS:!0,useTransform:!0,variableWidth:!1,vertical:!1,verticalSwiping:!1,waitForAnimate:!0,zIndex:1e3},n.initials={animating:!1,dragging:!1,autoPlayTimer:null,currentDirection:0,currentLeft:null,currentSlide:0,direction:1,$dots:null,listWidth:null,listHeight:null,loadIndex:0,$nextArrow:null,$prevArrow:null,scrolling:!1,slideCount:null,slideWidth:null,$slideTrack:null,$slides:null,sliding:!1,slideOffset:0,swipeLeft:null,swiping:!1,$list:null,touchObject:{},transformsEnabled:!1,unslicked:!1},i.extend(n,n.initials),n.activeBreakpoint=null,n.animType=null,n.animProp=null,n.breakpoints=[],n.breakpointSettings=[],n.cssTransitions=!1,n.focussed=!1,n.interrupted=!1,n.hidden="hidden",n.paused=!0,n.positionProp=null,n.respondTo=null,n.rowCount=1,n.shouldClick=!0,n.$slider=i(t),n.$slidesCache=null,n.transformType=null,n.transitionType=null,n.visibilityChange="visibilitychange",n.windowWidth=0,n.windowTimer=null,s=i(t).data("slick")||{},n.options=i.extend({},n.defaults,o,s),n.currentSlide=n.options.initialSlide,n.originalSettings=n.options,void 0!==document.mozHidden?(n.hidden="mozHidden",n.visibilityChange="mozvisibilitychange"):void 0!==document.webkitHidden&&(n.hidden="webkitHidden",n.visibilityChange="webkitvisibilitychange"),n.autoPlay=i.proxy(n.autoPlay,n),n.autoPlayClear=i.proxy(n.autoPlayClear,n),n.autoPlayIterator=i.proxy(n.autoPlayIterator,n),n.changeSlide=i.proxy(n.changeSlide,n),n.clickHandler=i.proxy(n.clickHandler,n),n.selectHandler=i.proxy(n.selectHandler,n),n.setPosition=i.proxy(n.setPosition,n),n.swipeHandler=i.proxy(n.swipeHandler,n),n.dragHandler=i.proxy(n.dragHandler,n),n.keyHandler=i.proxy(n.keyHandler,n),n.instanceUid=e++,n.htmlExpr=/^(?:\s*(<[\w\W]+>)[^>]*)$/,n.registerBreakpoints(),n.init(!0)}}()).prototype.activateADA=function(){this.$slideTrack.find(".slick-active").attr({"aria-hidden":"false"}).find("a, input, button, select").attr({tabindex:"0"})},e.prototype.addSlide=e.prototype.slickAdd=function(e,t,o){var s=this;if("boolean"==typeof t)o=t,t=null;else if(t<0||t>=s.slideCount)return!1;s.unload(),"number"==typeof t?0===t&&0===s.$slides.length?i(e).appendTo(s.$slideTrack):o?i(e).insertBefore(s.$slides.eq(t)):i(e).insertAfter(s.$slides.eq(t)):!0===o?i(e).prependTo(s.$slideTrack):i(e).appendTo(s.$slideTrack),s.$slides=s.$slideTrack.children(this.options.slide),s.$slideTrack.children(this.options.slide).detach(),s.$slideTrack.append(s.$slides),s.$slides.each(function(e,t){i(t).attr("data-slick-index",e)}),s.$slidesCache=s.$slides,s.reinit()},e.prototype.animateHeight=function(){var i=this;if(1===i.options.slidesToShow&&!0===i.options.adaptiveHeight&&!1===i.options.vertical){var e=i.$slides.eq(i.currentSlide).outerHeight(!0);i.$list.animate({height:e},i.options.speed)}},e.prototype.animateSlide=function(e,t){var o={},s=this;s.animateHeight(),!0===s.options.rtl&&!1===s.options.vertical&&(e=-e),!1===s.transformsEnabled?!1===s.options.vertical?s.$slideTrack.animate({left:e},s.options.speed,s.options.easing,t):s.$slideTrack.animate({top:e},s.options.speed,s.options.easing,t):!1===s.cssTransitions?(!0===s.options.rtl&&(s.currentLeft=-s.currentLeft),i({animStart:s.currentLeft}).animate({animStart:e},{duration:s.options.speed,easing:s.options.easing,step:function(i){i=Math.ceil(i),!1===s.options.vertical?(o[s.animType]="translate("+i+"px, 0px)",s.$slideTrack.css(o)):(o[s.animType]="translate(0px,"+i+"px)",s.$slideTrack.css(o))},complete:function(){t&&t.call()}})):(s.applyTransition(),e=Math.ceil(e),!1===s.options.vertical?o[s.animType]="translate3d("+e+"px, 0px, 0px)":o[s.animType]="translate3d(0px,"+e+"px, 0px)",s.$slideTrack.css(o),t&&setTimeout(function(){s.disableTransition(),t.call()},s.options.speed))},e.prototype.getNavTarget=function(){var e=this,t=e.options.asNavFor;return t&&null!==t&&(t=i(t).not(e.$slider)),t},e.prototype.asNavFor=function(e){var t=this.getNavTarget();null!==t&&"object"==typeof t&&t.each(function(){var t=i(this).slick("getSlick");t.unslicked||t.slideHandler(e,!0)})},e.prototype.applyTransition=function(i){var e=this,t={};!1===e.options.fade?t[e.transitionType]=e.transformType+" "+e.options.speed+"ms "+e.options.cssEase:t[e.transitionType]="opacity "+e.options.speed+"ms "+e.options.cssEase,!1===e.options.fade?e.$slideTrack.css(t):e.$slides.eq(i).css(t)},e.prototype.autoPlay=function(){var i=this;i.autoPlayClear(),i.slideCount>i.options.slidesToShow&&(i.autoPlayTimer=setInterval(i.autoPlayIterator,i.options.autoplaySpeed))},e.prototype.autoPlayClear=function(){var i=this;i.autoPlayTimer&&clearInterval(i.autoPlayTimer)},e.prototype.autoPlayIterator=function(){var i=this,e=i.currentSlide+i.options.slidesToScroll;i.paused||i.interrupted||i.focussed||(!1===i.options.infinite&&(1===i.direction&&i.currentSlide+1===i.slideCount-1?i.direction=0:0===i.direction&&(e=i.currentSlide-i.options.slidesToScroll,i.currentSlide-1==0&&(i.direction=1))),i.slideHandler(e))},e.prototype.buildArrows=function(){var e=this;!0===e.options.arrows&&(e.$prevArrow=i(e.options.prevArrow).addClass("slick-arrow"),e.$nextArrow=i(e.options.nextArrow).addClass("slick-arrow"),e.slideCount>e.options.slidesToShow?(e.$prevArrow.removeClass("slick-hidden").removeAttr("aria-hidden tabindex"),e.$nextArrow.removeClass("slick-hidden").removeAttr("aria-hidden tabindex"),e.htmlExpr.test(e.options.prevArrow)&&e.$prevArrow.prependTo(e.options.appendArrows),e.htmlExpr.test(e.options.nextArrow)&&e.$nextArrow.appendTo(e.options.appendArrows),!0!==e.options.infinite&&e.$prevArrow.addClass("slick-disabled").attr("aria-disabled","true")):e.$prevArrow.add(e.$nextArrow).addClass("slick-hidden").attr({"aria-disabled":"true",tabindex:"-1"}))},e.prototype.buildDots=function(){var e,t,o=this;if(!0===o.options.dots){for(o.$slider.addClass("slick-dotted"),t=i("<ul />").addClass(o.options.dotsClass),e=0;e<=o.getDotCount();e+=1)t.append(i("<li />").append(o.options.customPaging.call(this,o,e)));o.$dots=t.appendTo(o.options.appendDots),o.$dots.find("li").first().addClass("slick-active")}},e.prototype.buildOut=function(){var e=this;e.$slides=e.$slider.children(e.options.slide+":not(.slick-cloned)").addClass("slick-slide"),e.slideCount=e.$slides.length,e.$slides.each(function(e,t){i(t).attr("data-slick-index",e).data("originalStyling",i(t).attr("style")||"")}),e.$slider.addClass("slick-slider"),e.$slideTrack=0===e.slideCount?i('<div class="slick-track"/>').appendTo(e.$slider):e.$slides.wrapAll('<div class="slick-track"/>').parent(),e.$list=e.$slideTrack.wrap('<div class="slick-list"/>').parent(),e.$slideTrack.css("opacity",0),!0!==e.options.centerMode&&!0!==e.options.swipeToSlide||(e.options.slidesToScroll=1),i("img[data-lazy]",e.$slider).not("[src]").addClass("slick-loading"),e.setupInfinite(),e.buildArrows(),e.buildDots(),e.updateDots(),e.setSlideClasses("number"==typeof e.currentSlide?e.currentSlide:0),!0===e.options.draggable&&e.$list.addClass("draggable")},e.prototype.buildRows=function(){var i,e,t,o,s,n,r,l=this;if(o=document.createDocumentFragment(),n=l.$slider.children(),l.o
vendor: 3,442 bytes, line 23998
23998ptions.rows>1){for(r=l.options.slidesPerRow*l.options.rows,s=Math.ceil(n.length/r),i=0;i<s;i++){var d=document.createElement("div");for(e=0;e<l.options.rows;e++){var a=document.createElement("div");for(t=0;t<l.options.slidesPerRow;t++){var c=i*r+(e*l.options.slidesPerRow+t);n.get(c)&&a.appendChild(n.get(c))}d.appendChild(a)}o.appendChild(d)}l.$slider.empty().append(o),l.$slider.children().children().children().css({width:100/l.options.slidesPerRow+"%",display:"inline-block"})}},e.prototype.checkResponsive=function(e,t){var o,s,n,r=this,l=!1,d=r.$slider.width(),a=window.innerWidth||i(window).width();if("window"===r.respondTo?n=a:"slider"===r.respondTo?n=d:"min"===r.respondTo&&(n=Math.min(a,d)),r.options.responsive&&r.options.responsive.length&&null!==r.options.responsive){s=null;for(o in r.breakpoints)r.breakpoints.hasOwnProperty(o)&&(!1===r.originalSettings.mobileFirst?n<r.breakpoints[o]&&(s=r.breakpoints[o]):n>r.breakpoints[o]&&(s=r.breakpoints[o]));null!==s?null!==r.activeBreakpoint?(s!==r.activeBreakpoint||t)&&(r.activeBreakpoint=s,"unslick"===r.breakpointSettings[s]?r.unslick(s):(r.options=i.extend({},r.originalSettings,r.breakpointSettings[s]),!0===e&&(r.currentSlide=r.options.initialSlide),r.refresh(e)),l=s):(r.activeBreakpoint=s,"unslick"===r.breakpointSettings[s]?r.unslick(s):(r.options=i.extend({},r.originalSettings,r.breakpointSettings[s]),!0===e&&(r.currentSlide=r.options.initialSlide),r.refresh(e)),l=s):null!==r.activeBreakpoint&&(r.activeBreakpoint=null,r.options=r.originalSettings,!0===e&&(r.currentSlide=r.options.initialSlide),r.refresh(e),l=s),e||!1===l||r.$slider.trigger("breakpoint",[r,l])}},e.prototype.changeSlide=function(e,t){var o,s,n,r=this,l=i(e.currentTarget);switch(l.is("a")&&e.preventDefault(),l.is("li")||(l=l.closest("li")),n=r.slideCount%r.options.slidesToScroll!=0,o=n?0:(r.slideCount-r.currentSlide)%r.options.slidesToScroll,e.data.message){case"previous":s=0===o?r.options.slidesToScroll:r.options.slidesToShow-o,r.slideCount>r.options.slidesToShow&&r.slideHandler(r.currentSlide-s,!1,t);break;case"next":s=0===o?r.options.slidesToScroll:o,r.slideCount>r.options.slidesToShow&&r.slideHandler(r.currentSlide+s,!1,t);break;case"index":var d=0===e.data.index?0:e.data.index||l.index()*r.options.slidesToScroll;r.slideHandler(r.checkNavigable(d),!1,t),l.children().trigger("focus");break;default:return}},e.prototype.checkNavigable=function(i){var e,t;if(e=this.getNavigableIndexes(),t=0,i>e[e.length-1])i=e[e.length-1];else for(var o in e){if(i<e[o]){i=t;break}t=e[o]}return i},e.prototype.cleanUpEvents=function(){var e=this;e.options.dots&&null!==e.$dots&&(i("li",e.$dots).off("click.slick",e.changeSlide).off("mouseenter.slick",i.proxy(e.interrupt,e,!0)).off("mouseleave.slick",i.proxy(e.interrupt,e,!1)),!0===e.options.accessibility&&e.$dots.off("keydown.slick",e.keyHandler)),e.$slider.off("focus.slick blur.slick"),!0===e.options.arrows&&e.slideCount>e.options.slidesToShow&&(e.$prevArrow&&e.$prevArrow.off("click.slick",e.changeSlide),e.$nextArrow&&e.$nextArrow.off("click.slick",e.changeSlide),!0===e.options.accessibility&&(e.$prevArrow&&e.$prevArrow.off("keydown.slick",e.keyHandler),e.$nextArrow&&e.$nextArrow.off("keydown.slick",e.keyHandler))),e.$list.off("touchstart.slick mousedown.slick",e.swipeHandler),e.$list.off("touchmove.slick mousemove.slick",e.swipeHandler),e.$list.off("touchend.slick mouseup.slick",e.swipeHandler),e.$list.off("touchcancel.slick mouseleave.
23998slick",e.swipeHandler),e.$list.off("click.slick",e.clickHandler),i(document).off(e.visibilityChange,e.visibility),e.cleanUpSlideEvents(),!0===e.options.accessibility&&e.$list.off("keydown.slick",e.keyHandler),!0===e.options.focusOnSelect&&i(e.$slideTrack).children().off("click.slick",e.selectHandler),i(window).off("orientationchange.slick.slick-"+e.instanceUid,e.orientationChange),i(window).off("resize.slick.slick-"+e.instanceUid,e.resize),i("[draggable!=true]",e.$slideTrack).off("dragstart",e.preventDefault),i(window).off("load.slick.slick-"+e.instanceUid,e.setPosition)},e.prototype.cleanUpSlideEvents=function(){var e=this;e.$list.off("mouseenter.slick",i.proxy(e.interrupt,e,!0)),e.$list.off("mouseleave.slick",i.proxy(e.interrupt,e,!1))},e.prototype.cleanUpRows=function(){var i,e=this;e.options.rows>1&&((i=e.$slides.children().children()).removeAttr("style"),e.$slider.empty().append(i))},e.prototype.clickHandler=function(i){!1===this.shouldClick&&(i.stopImmediatePropagation(),i.stopPropagation(),i.preventDefault())},e.prototype.destroy=function(e){var t=this;t.autoPlayClear(),t.touchObject={},t.cleanUpEvents(),i(".slick-cloned",t.$slider).detach(),t.$dots&&t.$dots.remove(),t.$prevArrow&&t.$prevArrow.length&&(t.$prevArrow.removeClass("slick-disabled slick-arrow slick-hidden").removeAttr("aria-hidden aria-disabled tabindex").css("display",""),t.htmlExpr.test(t.options.prevArrow)&&t.$prevArrow.remove()),t.$nextArrow&&t.$nextArrow.length&&(t.$nextArrow.removeClass("slick-disabled slick-arrow slick-hidden").removeAttr("aria-hidden aria-disabled tabindex").css("display",""),t.htmlExpr.test(t.options.nextArrow)&&t.$nextArrow.remove()),t.$slides&&(t.$slides.removeClass("slick-slide slick-active slick-center slick-visible slick-current").removeAttr("aria-hidden").removeAttr("data-slick-index").each(function(){i(this).attr("style",i(this).data("originalStyling"))}),t.$slideTrack.children(this.options.slide).detach(),t.$slideTrack.detach(),t.$list.detach(),t.$slider.append(t.$slides)),t.cleanUpRows(),t.$slider.removeClass("slick-slider"),t.$slider.removeClass("slick-initialized"),t.$slider.removeClass("slick-dotted"),t.unslicked=!0,e||t.$slider.trigger("destroy",[t])},e.prototype.disableTransition=function(i){var e=this,t={};t[e.transitionType]="",!1===e.options.fade?e.$slideTrack.css(t):e.$slides.eq(i).css(t)},e.prototype.fadeSlide=function(i,e){var t=this;!1===t.cssTransitions?(t.$slides.eq(i).css({zIndex:t.options.zIndex}),t.$slides.eq(i).animate({opacity:1},t.options.speed,t.options.easing,e)):(t.applyTransition(i),t.$slides.eq(i).css({opacity:1,zIndex:t.options.zIndex}),e&&setTimeout(function(){t.disableTransition(i),e.call()},t.options.speed))},e.prototype.fadeSlideOut=function(i){var e=this;!1===e.cssTransitions?e.$slides.eq(i).animate({opacity:0,zIndex:e.options.zIndex-2},e.options.speed,e.options.easing):(e.applyTransition(i),e.$slides.eq(i).css({opacity:0,zIndex:e.options.zIndex-2}))},e.prototype.filterSlides=e.prototype.slickFilter=function(i){var e=this;null!==i&&(e.$slidesCache=e.$slides,e.unload(),e.$slideTrack.children(this.options.slide).detach(),e.$slidesCache.filter(i).appendTo(e.$slideTrack),e.reinit())},e.prototype.focusHandler=function(){var e=this;e.$slider.off("focus.slick blur.slick").on("focus.slick blur.slick","*",function(t){t.stopImmediatePropagation();var o=i(this);setTimeout(function(){e.options.pauseOnFocus&&(e.focussed=o.is(":focus"),e.autoPlay())},0)})},e.prototype.getCurrent=e.prototype.slickCurrentSlide=function(){return this.currentSlide},e.prototype.getDotCount=function(){var i=this,e=0,t=0,o=0;if(!0===i.options.infinite)if(i.slideCount<=i.options.slidesToShow)++o;else for(;e<i.slideCount;)++o,e=t+i.options.slidesToScroll,t+=i.options.slidesToScroll<=i.options.slidesToShow?i.options.slidesToScroll:i.options.slidesToShow;else if(!0===i.options.centerMode)o=i.slideCount;else if(i.options.asNavFor)for(;e<i.slideCount;)++o,e=t+i.options.slidesToScroll,t+=i.options.slidesToScroll<=i.options.slidesToShow?i.options.slidesToScroll:i.options.slidesToShow;else o=1+Math.ceil((i.slideCount-i.options.slidesToShow)/i.options.slidesToScroll);return o-1},e.prototype.getLeft=function(i){var e,t,o,s,n=this,r=0;return n.slideOffset=0,t=n.$slides.first().outerHeight(!0),!0===n.options.infinite?(n.slideCount>n.options.slidesToShow&&(n.slideOffset=n.slideWidth*n.options.slidesToShow*-1,s=-1,!0===n.options.vertical&&!0===n.options.centerMode&&(2===n.options.slidesToShow?s=-1.5:1===n.options.slidesToShow&&(s=-2)),r=t*n.options.slidesToShow*s),n.slideCount%n.options.slidesToScroll!=0&&i+n.options.slidesToScroll>n.slideCount&&n.slideCount>n.options.slidesToShow&&(i>n.slideCount?(n.slideOffset=(n.options.slidesToShow-(i-n.slideCount))*n.slideWidth*-1,r=(n.options.slidesToShow-(i-n.slideCount))*t*-1):(n.slideOffset=n.slideCount%n.options.slidesToScroll*n.slideWidth*-1,r=n.slideCount%n.options.slidesToScroll*t*-1))):i+n.options.slidesToShow>n.slideCount&&(n.slideOffset=(i+n.options.slidesToShow-n.slideCount)*n.slideWidth,r=(i+n.options.slidesToShow-n.slideCount)*t),n.slideCount<=n.options.slidesToShow&&(n.slideOffset=0,r=0),!0===n.options.centerMode&&n.slideCount<=n.options.slidesToShow?n.slideOffset=n.slideWidth*Math.floor(n.options.slidesToShow)/2-n.slideWidth*n.slideCount/2:!0===n.options.centerMode&&!0===n.options.infinite?n.slideOffset+=n.slideWidth*Math.floor(n.options.slidesToShow/2)-n.slideWidth:!0===n.options.centerMode&&(n.slideOffset=0,n.slideOffset+=n.slideWidth*Math.floor(n.options.slidesToShow/2)),e=!1===n.options.vertical?i*n.slideWidth*-1+n.slideOffset:i*t*-1+r,!0===n.options.variableWidth&&(o=n.slideCount<=n.options.slidesToShow||!1===n.options.infinite?n.$slideTrack.children(".slick-slide").eq(i):n.$slideTrack.children(".slick-slide").eq(i+n.options.slidesToShow),e=!0===n.options.rtl?o[0]?-1*(n.$slideTrack.width()-o[0].offsetLeft-o.width()):0:o[0]?-1*o[0].offsetLeft:0,!0===n.options.centerMode&&(o=n.slideCount<=n.options.slidesToShow||!1===n.options.infinite?n.$slideTrack.children(".slick-slide").eq(i):n.$slideTrack.children(".slick-slide").eq(i+n.options.slidesToShow+1),e=!0===n.options.rtl?o[0]?-1*(n.$slideTrack.width()-o[0].offsetLeft-o.width()):0:o[0]?-1*o[0].offsetLeft:0,e+=(n.$list.width()-o.outerWidth())/2)),e},e.prototype.getOption=e.prototype.slickGetOption=function(i){return this.options[i]},e.prototype.getNavigableIndexes=function(){var i,e=this,t=0,o=0,s=[];for(!1===e.options.infinite?i=e.slideCount:(t=-1*e.options.slidesToScroll,o=-1*e.options.slidesToScroll,i=2*e.slideCount);t<i;)s.push(t),t=o+e.options.slidesToScroll,o+=e.options.slidesToScroll<=e.options.slidesToShow?e.options.slidesToScroll:e.options.slidesToShow;return s},e.prototype.getSlick=function(){return this},e.prototype.getSlideCount=function(){var e,t,o=this;return t=!0===o.options.centerMode?o.slideWidth*Math.floor(o.options.slidesToShow/2):0,!0===o.options.swipeToSlide?(o.$slideTrack.find(".slick-slide").each(function(s,n){if(n.offsetLeft-t+i(n).outerWidth()/2>-1*o.swipeLeft)return e=n,!1}),Math.abs(i(e).attr("data-slick-index")-o.currentSlide)||1):o.options.slidesToScroll},e.prototype.goTo=e.prototype.slickGoTo=function(i,e){this.changeSlide({data:{message:"index",index:
23998parseInt(i)}},e)},e.prototype.init=function(e){var t=this;i(t.$slider).hasClass("slick-initialized")||(i(t.$slider).addClass("slick-initialized"),t.buildRows(),t.buildOut(),t.setProps(),t.startLoad(),t.loadSlider(),t.initializeEvents(),t.updateArrows(),t.updateDots(),t.checkResponsive(!0),t.focusHandler()),e&&t.$slider.trigger("init",[t]),!0===t.options.accessibility&&t.initADA(),t.options.autoplay&&(t.paused=!1,t.autoPlay())},e.prototype.initADA=function(){var e=this,t=Math.ceil(e.slideCount/e.options.slidesToShow),o=e.getNavigableIndexes().filter(function(i){return i>=0&&i<e.slideCount});e.$slides.add(e.$slideTrack.find(".slick-cloned")).attr({"aria-hidden":"true",tabindex:"-1"}).find("a, input, button, select").attr({tabindex:"-1"}),null!==e.$dots&&(e.$slides.not(e.$slideTrack.find(".slick-cloned")).each(function(t){var s=o.indexOf(t);i(this).attr({role:"tabpanel",id:"slick-slide"+e.instanceUid+t,tabindex:-1}),-1!==s&&i(this).attr({"aria-describedby":"slick-slide-control"+e.instanceUid+s})}),e.$dots.attr("role","tablist").find("li").each(function(s){var n=o[s];i(this).attr({role:"presentation"}),i(this).find("button").first().attr({role:"tab",id:"slick-slide-control"+e.instanceUid+s,"aria-controls":"slick-slide"+e.instanceUid+n,"aria-label":s+1+" of "+t,"aria-selected":null,tabindex:"-1"})}).eq(e.currentSlide).find("button").attr({"aria-selected":"true",tabindex:"0"}).end());for(var s=e.currentSlide,n=s+e.options.slidesToShow;s<n;s++)e.$slides.eq(s).attr("tabindex",0);e.activateADA()},e.prototype.initArrowEvents=function(){var i=this;!0===i.options.arrows&&i.slideCount>i.options.slidesToShow&&(i.$prevArrow.off("click.slick").on("click.slick",{message:"previous"},i.changeSlide),i.$nextArrow.off("click.slick").on("click.slick",{message:"next"},i.changeSlide),!0===i.options.accessibility&&(i.$prevArrow.on("keydown.slick",i.keyHandler),i.$nextArrow.on("keydown.slick",i.keyHandler)))},e.prototype.initDotEvents=function(){var e=this;!0===e.options.dots&&(i("li",e.$dots).on("click.slick",{message:"index"},e.changeSlide),!0===e.options.accessibility&&e.$dots.on("keydown.slick",e.keyHandler)),!0===e.options.dots&&!0===e.options.pauseOnDotsHover&&i("li",e.$dots).on("mouseenter.slick",i.proxy(e.interrupt,e,!0)).on("mouseleave.slick",i.proxy(e.interrupt,e,!1))},e.prototype.initSlideEvents=function(){var e=this;e.options.pauseOnHover&&(e.$list.on("mouseenter.slick",i.proxy(e.interrupt,e,!0)),e.$list.on("mouseleave.slick",i.proxy(e.interrupt,e,!1)))},e.prototype.initializeEvents=function(){var e=this;e.initArrowEvents(),e.initDotEvents(),e.initSlideEvents(),e.$list.on("touchstart.slick mousedown.slick",{action:"start"},e.swipeHandler),e.$list.on("touchmove.slick mousemove.slick",{action:"move"},e.swipeHandler),e.$list.on("touchend.slick mouseup.slick",{action:"end"}
23998,e.swipeHandler),e.$list.on("touchcancel.slick mouseleave.slick",{action:"end"},e.swipeHandler),e.$list.on("click.slick",e.clickHandler),i(document).on(e.visibilityChange,i.proxy(e.visibility,e)),!0===e.options.accessibility&&e.$list.on("keydown.slick",e.keyHandler),!0===e.options.focusOnSelect&&i(e.$slideTrack).children().on("click.slick",e.selectHandler),i(window).on("orientationchange.slick.slick-"+e.instanceUid,i.proxy(e.orientationChange,e)),i(window).on("resize.slick.slick-"+e.instanceUid,i.proxy(e.resize,e)),i("[draggable!=true]",e.$slideTrack).on("dragstart",e.preventDefault),i(window).on("load.slick.slick-"+e.instanceUid,e.setPosition),i(e.setPosition)},e.prototype.initUI=function(){var i=this;!0===i.options.arrows&&i.slideCount>i.options.slidesToShow&&(i.$prevArrow.show(),i.$nextArrow.show()),!0===i.options.dots&&i.slideCount>i.options.slidesToShow&&i.$dots.show()},e.prototype.keyHandler=function(i){var e=this;i.target.tagName.match("TEXTAREA|INPUT|SELECT")||(37===i.keyCode&&!0===e.options.accessibility?e.changeSlide({data:{message:!0===e.options.rtl?"next":"previous"}}):39===i.keyCode&&!0===e.options.accessibility&&e.changeSlide({data:{message:!0===e.options.rtl?"previous":"next"}}))},e.prototype.lazyLoad=function(){function e(e){i("img[data-lazy]",e).each(function(){var e=i(this),t=i(this).attr("data-lazy"),o=i(this).attr("data-srcset"),s=i(this).attr("data-sizes")||n.$slider.attr("data-sizes"),r=document.createElement("img");r.onload=function(){e.animate({opacity:0}
vendor: 5,619 bytes, line 23998
23998,100,function(){o&&(e.attr("srcset",o),s&&e.attr("sizes",s)),e.attr("src",t).animate({opacity:1},200,function(){e.removeAttr("data-lazy data-srcset data-sizes").removeClass("slick-loading")}),n.$slider.trigger("lazyLoaded",[n,e,t])})},r.onerror=function(){e.removeAttr("data-lazy").removeClass("slick-loading").addClass("slick-lazyload-error"),n.$slider.trigger("lazyLoadError",[n,e,t])},r.src=t})}var t,o,s,n=this;if(!0===n.options.centerMode?!0===n.options.infinite?s=(o=n.currentSlide+(n.options.slidesToShow/2+1))+n.options.slidesToShow+2:(o=Math.max(0,n.currentSlide-(n.options.slidesToShow/2+1)),s=n.options.slidesToShow/2+1+2+n.currentSlide):(o=n.options.infinite?n.options.slidesToShow+n.currentSlide:n.currentSlide,s=Math.ceil(o+n.options.slidesToShow),!0===n.options.fade&&(o>0&&o--,s<=n.slideCount&&s++)),t=n.$slider.find(".slick-slide").slice(o,s),"anticipated"===n.options.lazyLoad)for(var r=o-1,l=s,d=n.$slider.find(".slick-slide"),a=0;a<n.options.slidesToScroll;a++)r<0&&(r=n.slideCount-1),t=(t=t.add(d.eq(r))).add(d.eq(l)),r--,l++;e(t),n.slideCount<=n.options.slidesToShow?e(n.$slider.find(".slick-slide")):n.currentSlide>=n.slideCount-n.options.slidesToShow?e(n.$slider.find(".slick-cloned").slice(0,n.options.slidesToShow)):0===n.currentSlide&&e(n.$slider.find(".slick-cloned").slice(-1*n.options.slidesToShow))},e.prototype.loadSlider=function(){var i=this;i.setPosition(),i.$slideTrack.css({opacity:1}),i.$slider.removeClass("slick-loading"),i.initUI(),"progressive"===i.options.lazyLoad&&i.progressiveLazyLoad()},e.prototype.next=e.prototype.slickNext=function(){this.changeSlide({data:{message:"next"}})},e.prototype.orientationChange=function(){var i=this;i.checkResponsive(),i.setPosition()},e.prototype.pause=e.prototype.slickPause=function(){var i=this;i.autoPlayClear(),i.paused=!0},e.prototype.play=e.prototype.slickPlay=function(){var i=this;i.autoPlay(),i.options.autoplay=!0,i.paused=!1,i.focussed=!1,i.interrupted=!1},e.prototype.postSlide=function(e){var t=this;t.unslicked||(t.$slider.trigger("afterChange",[t,e]),t.animating=!1,t.slideCount>t.options.slidesToShow&&t.setPosition(),t.swipeLeft=null,t.options.autoplay&&t.autoPlay(),!0===t.options.accessibility&&(t.initADA(),t.options.focusOnChange&&i(t.$slides.get(t.currentSlide)).attr("tabindex",0).focus()))},e.prototype.prev=e.prototype.slickPrev=function(){this.changeSlide({data:{message:"previous"}})},e.prototype.preventDefault=function(i){i.preventDefault()},e.prototype.progressiveLazyLoad=function(e){e=e||1;var t,o,s,n,r,l=this,d=i("img[data-lazy]",l.$slider);d.length?(t=d.first(),o=t.attr("data-lazy"),s=t.attr("data-srcset"),n=t.attr("data-sizes")||l.$slider.attr("data-sizes"),(r=document.createElement("img")).onload=function(){s&&(t.attr("srcset",s),n&&t.attr("sizes",n)),t.attr("src",o).removeAttr("data-lazy data-srcset data-sizes").removeClass("slick-loading"),!0===l.options.adaptiveHeight&&l.setPosition(),l.$slider.trigger("lazyLoaded",[l,t,o]),l.progressiveLazyLoad()},r.onerror=function(){e<3?setTimeout(function(){l.progressiveLazyLoad(e+1)},500):(t.removeAttr("data-lazy").removeClass("slick-loading").addClass("slick-lazyload-error"),l.$slider.trigger("lazyLoadError",[l,t,o]),l.progressiveLazyLoad())},r.src=o):l.$slider.trigger("allImagesLoaded",[l])},e.prototype.refresh=function(e){var t,o,s=this;o=s.slideCount-s.options.slidesToShow,!s.options.infinite&&s.currentSlide>o&&(s.currentSlide=o),s.slideCount<=s.options.slidesToShow&&(s.currentSlide=0),t=s.currentSlide,s.destroy(!0),i.extend(s,s.initials,{currentSlide:t}),s.init(),e||s.changeSlide({data:{message:"index",index:t}},!1)},e.prototype.registerBreakpoints=function(){var e,t,o,s=this,n=s.options.responsive||null;if("array"===i.type(n)&&n.length){s.respondTo=s.options.respondTo||"window";for(e in n)if(o=s.breakpoints.length-1,n.hasOwnProperty(e)){for(t=n[e].breakpoint;o>=0;)s.breakpoints[o]&&s.breakpoints[o]===t&&s.breakpoints.splice(o,1),o--;s.breakpoints.push(t),s.breakpointSettings[t]=n[e].settings}s.breakpoints.sort(function(i,e){return s.options.mobileFirst?i-e:e-i})}},e.prototype.reinit=function(){var e=this;e.$slides=e.$slideTrack.children(e.options.slide).addClass("slick-slide"),e.slideCount=e.$slides.length,e.currentSlide>=e.slideCount&&0!==e.currentSlide&&(e.currentSlide=e.currentSlide-e.options.slidesToScroll),e.slideCount<=e.options.slidesToShow&&(e.currentSlide=0),e.registerBreakpoints(),e.setProps(),e.setupInfinite(),e.buildArrows(),e.updateArrows(),e.initArrowEvents(),e.buildDots(),e.updateDots(),e.initDotEvents(),e.cleanUpSlideEvents(),e.initSlideEvents(),e.checkResponsive(!1,!0),!0===e.options.focusOnSelect&&i(e.$slideTrack).children().on("click.slick",e.selectHandler),e.setSlideClasses("number"==typeof e.currentSlide?e.currentSlide:0),e.setPosition(),e.focusHandler(),e.paused=!e.options.autoplay,e.autoPlay(),e.$slider.trigger("reInit",[e])},e.prototype.resize=function(){var e=this;i(window).width()!==e.windowWidth&&(clearTimeout(e.windowDelay),e.windowDelay=window.setTimeout(function(){e.windowWidth=i(window).width(),e.checkResponsive(),e.unslicked||e.setPosition()},50))},e.prototype.removeSlide=e.prototype.slickRemove=function(i,e,t){var o=this;if(i="boolean"==typeof i?!0===(e=i)?0:o.slideCount-1:!0===e?--i:i,o.slideCount<1||i<0||i>o.slideCount-1)return!1;o.unload(),!0===t?o.$slideTrack.children().remove():o.$slideTrack.children(this.options.slide).eq(i).remove(),o.$slides=o.$slideTrack.children(this.options.slide),o.$slideTrack.children(this.options.slide).detach(),o.$slideTrack.append(o.$slides),o.$slidesCache=o.$slides,o.reinit()},e.prototype.setCSS=function(i){var e,t,o=this,s={};
23998!0===o.options.rtl&&(i=-i),e="left"==o.positionProp?Math.ceil(i)+"px":"0px",t="top"==o.positionProp?Math.ceil(i)+"px":"0px",s[o.positionProp]=i,!1===o.transformsEnabled?o.$slideTrack.css(s):(s={},!1===o.cssTransitions?(s[o.animType]="translate("+e+", "+t+")",o.$slideTrack.css(s)):(s[o.animType]="translate3d("+e+", "+t+", 0px)",o.$slideTrack.css(s)))},e.prototype.setDimensions=function(){var i=this;!1===i.options.vertical?!0===i.options.centerMode&&i.$list.css({padding:"0px "+i.options.centerPadding}):(i.$list.height(i.$slides.first().outerHeight(!0)*i.options.slidesToShow),!0===i.options.centerMode&&i.$list.css({padding:i.options.centerPadding+" 0px"})),i.listWidth=i.$list.width(),i.listHeight=i.$list.height(),!1===i.options.vertical&&!1===i.options.variableWidth?(i.slideWidth=Math.ceil(i.listWidth/i.options.slidesToShow),i.$slideTrack.width(Math.ceil(i.slideWidth*i.$slideTrack.children(".slick-slide").length))):!0===i.options.variableWidth?i.$slideTrack.width(5e3*i.slideCount):(i.slideWidth=Math.ceil(i.listWidth),i.$slideTrack.height(Math.ceil(i.$slides.first().outerHeight(!0)*i.$slideTrack.children(".slick-slide").length)));var e=i.$slides.first().outerWidth(!0)-i.$slides.first().width();!1===i.options.variableWidth&&i.$slideTrack.children(".slick-slide").width(i.slideWidth-e)},e.prototype.setFade=function(){var e,t=this;t.$slides.each(function(o,s){e=t.slideWidth*o*-1,!0===t.options.rtl?i(s).css({position:"relative",right:e,top:0,zIndex:t.options.zIndex-2,opacity:0}
23998):i(s).css({position:"relative",left:e,top:0,zIndex:t.options.zIndex-2,opacity:0})}),t.$slides.eq(t.currentSlide).css({zIndex:t.options.zIndex-1,opacity:1})},e.prototype.setHeight=function(){var i=this;if(1===i.options.slidesToShow&&!0===i.options.adaptiveHeight&&!1===i.options.vertical){var e=i.$slides.eq(i.currentSlide).outerHeight(!0);i.$list.css("height",e)}},e.prototype.setOption=e.prototype.slickSetOption=function(){var e,t,o,s,n,r=this,l=!1;if("object"===i.type(arguments[0])?(o=arguments[0],l=arguments[1],n="multiple"):"string"===i.type(arguments[0])&&(o=arguments[0],s=arguments[1],l=arguments[2],"responsive"===arguments[0]&&"array"===i.type(arguments[1])?n="responsive":void 0!==arguments[1]&&(n="single")),"single"===n)r.options[o]=s;else if("multiple"===n)i.each(o,function(i,e){r.options[i]=e});else if("responsive"===n)for(t in s)if("array"!==i.type(r.options.responsive))r.options.responsive=[s[t]];else{for(e=r.options.responsive.length-1;e>=0;)r.options.responsive[e].breakpoint===s[t].breakpoint&&r.options.responsive.splice(e,1),e--;r.options.responsive.push(s[t])}l&&(r.unload(),r.reinit())},e.prototype.setPosition=function(){var i=this;i.setDimensions(),i.setHeight(),!1===i.options.fade?i.setCSS(i.getLeft(i.currentSlide)):i.setFade(),i.$slider.trigger("setPosition",[i])},e.prototype.setProps=function(){var i=this,e=document.body.style;i.positionProp=!0===i.options.vertical?"top":"left","top"===i.positionProp?i.$slider.addClass("slick-vertical"):i.$slider.removeClass("slick-vertical"),void 0===e.WebkitTransition&&void 0===e.MozTransition&&void 0===e.msTransition||!0===i.options.useCSS&&(i.cssTransitions=!0),i.options.fade&&("number"==typeof i.options.zIndex?i.options.zIndex<3&&(i.options.zIndex=3):i.options.zIndex=i.defaults.zIndex),void 0!==e.OTransform&&(i.animType="OTransform",i.transformType="-o-transform",i.transitionType="OTransition",void 0===e.perspectiveProperty&&void 0===e.webkitPerspective&&(i.animType=!1)),void 0!==e.MozTransform&&(i.animType="MozTransform",i.transformType="-moz-transform",i.transitionType="MozTransition",void 0===e.perspectiveProperty&&void 0===e.MozPerspective&&(i.animType=!1)),void 0!==e.webkitTransform&&(i.animType="webkitTransform",i.transformType="-webkit-transform",i.transitionType="webkitTransition",void 0===e.perspectiveProperty&&void 0===e.webkitPerspective&&(i.animType=!1)),void 0!==e.msTransform&&(i.animType="msTransform",i.transformType="-ms-transform",i.transitionType="msTransition",void 0===e.msTransform&&(i.animType=!1)),void 0!==e.transform&&!1!==i.animType&&(i.animType="transform",i.transformType="transform",i.transitionType="transition"),i.transformsEnabled=i.options.useTransform&&null!==i.animType&&!1!==i.animType},e.prototype.setSlideClasses=function(i){var e,t,o,s,n=this;if(t=n.$slider.find(".slick-slide").removeClass("slick-active slick-center slick-current").attr("aria-hidden","true"),n.$slides.eq(i).addClass("slick-current"),!0===n.options.centerMode){var r=n.options.slidesToShow%2==0?1:0;e=Math.floor(n.options.slidesToShow/2),!0===n.options.infinite&&(i>=e&&i<=n.slideCount-1-e?n.$slides.slice(i-e+r,i+e+1).addClass("slick-active").attr("aria-hidden","false"):(o=n.options.slidesToShow+i,t.slice(o-e+1+r,o+e+2).addClass("slick-active").attr("aria-hidden","false")),0===i?t.eq(t.length-1-n.options.slidesToShow).addClass("slick-center"):i===n.slideCount-1&&t.eq(n.options.slidesToShow).addClass("slick-center")),n.$slides.eq(i).addClass("slick-center")}else i>=0&&i<=n.slideCount-n.options.slidesToShow?n.$slides.slice(i,i+n.options.slidesToShow).addClass("slick-active").attr("aria-hidden","false"):t.length<=n.options.slidesToShow?t.addClass("slick-active").attr("aria-hidden","false"):(s=n.slideCount%n.options.slidesToShow,o=!0===n.options.infinite?n.options.slidesToShow+i:i,n.options.slidesToShow==n.options.slidesToScroll&&n.slideCount-i<n.options.slidesToShow?t.slice(o-(n.options.slidesToShow-s),o+s).addClass("slick-active").attr("aria-hidden","false"):t.slice(o,o+n.options.slidesToShow).addClass("slick-active").attr("aria-hidden","false"));"ondemand"!==n.options.lazyLoad&&"anticipated"!==n.options.lazyLoad||n.lazyLoad()},e.prototype.setupInfinite=function(){var e,t,o,s=this;if(!0===s.options.fade&&(s.options.centerMode=!1),!0===s.options.infinite&&!1===s.options.fade&&(t=null,s.slideCount>s.options.slidesToShow)){for(o=!0===s.options.centerMode?s.options.slidesToShow+1:s.options.slidesToShow,e=s.slideCount;e>s.slideCount-o;e-=1)t=e-1,i(s.$slides[t]).clone(!0).attr("id","").attr("data-slick-index",t-s.slideCount).prependTo(s.$slideTrack).addClass("slick-cloned");for(e=0;e<o+s.slideCount;e+=1)t=e,i(s.$slides[t]).clone(!0).attr("id","").attr("data-slick-index",t+s.slideCount).appendTo(s.$slideTrack).addClass("slick-cloned");s.$slideTrack.find(".slick-cloned").find("[id]").each(function(){i(this).attr("id","")})}},e.prototype.interrupt=function(i){var e=this;i||e.autoPlay(),e.interrupted=i},e.prototype.selectHandler=function(e){var t=this,o=i(e.target).is(".slick-slide")?i(e.target):i(e.target).parents(".slick-slide"),s=parseInt(o.attr("data-slick-index"));s||(s=0),t.slideCount<=t.options.slidesToShow?t.slideHandler(s,!1,!0):t.slideHandler(s)},e.prototype.slideHandler=function(i,e,t){var o,s,n,r,l,d=null,a=this;if(e=e||!1,!(!0===a.animating&&!0===a.options.waitForAnimate||!0===a.options.fade&&a.currentSlide===i))if(!1===e&&a.asNavFor(i),o=i,d=a.getLeft(o),r=a.getLeft(a.currentSlide),a.currentLeft=null===a.swipeLeft?r:a.swipeLeft,!1===a.options.infinite&&!1===a.options.centerMode&&(i<0||i>a.getDotCount()*a.options.slidesToScroll))!1===a.options.fade&&(o=a.currentSlide,!0!==t?a.animateSlide(r,function(){a.postSlide(o)}):a.postSlide(o));else if(!1===a.options.infinite&&!0===a.options.centerMode&&(i<0||i>a.slideCount-a.options.slidesToScroll))!1===a.options.fade&&(o=a.currentSlide,!0!==t?a.animateSlide(r,function(){a.postSlide(o)}):a.postSlide(o));else{if(a.options.autoplay&&clearInterval(a.autoPlayTimer),s=o<0?a.slideCount%a.options.slidesToScroll!=0?a.slideCount-a.slideCount%a.options.slidesToScroll:a.slideCount+
23998o:o>=a.slideCount?a.slideCount%a.options.slidesToScroll!=0?0:o-a.slideCount:o,a.animating=!0,a.$slider.trigger("beforeChange",[a,a.currentSlide,s]),n=a.currentSlide,a.currentSlide=s,a.setSlideClasses(a.currentSlide),a.options.asNavFor&&(l=(l=a.getNavTarget()).slick("getSlick")).slideCount<=l.options.slidesToShow&&l.setSlideClasses(a.currentSlide),a.updateDots(),a.updateArrows(),!0===a.options.fade)return!0!==t?(a.fadeSlideOut(n),a.fadeSlide(s,function(){a.postSlide(s)})):a.postSlide(s),void a.animateHeight();!0!==t?a.animateSlide(d,function(){a.postSlide(s)}):a.postSlide(s)}},e.prototype.startLoad=function(){var i=this;!0===i.options.arrows&&i.slideCount>i.options.slidesToShow&&(i.$prevArrow.hide(),i.$nextArrow.hide()),!0===i.options.dots&&i.slideCount>i.options.slidesToShow&&i.$dots.hide(),i.$slider.addClass("slick-loading")},e.prototype.swipeDirection=function(){var i,e,t,o,s=this;return i=s.touchObject.startX-s.touchObject.curX,e=s.touchObject.startY-s.touchObject.curY,t=Math.atan2(e,i),(o=Math.round(180*t/Math.PI))<0&&(o=360-Math.abs(o)),o<=45&&o>=0?!1===s.options.rtl?"left":"right":o<=360&&o>=315?!1===s.options.rtl?"left":"right":o>=135&&o<=225?!1===s.options.rtl?"right":"left":!0===s.options.verticalSwiping?o>=35&&o<=135?"down":"up":"vertical"},e.prototype.swipeEnd=function(i){var e,t,o=this;if(o.dragging=!1,o.swiping=!1,o.scrolling)return o.scrolling=!1,!1;if(o.interrupted=!1,o.shouldClick=!(o.touchObject.swipeLength>10),void 0===o.touchObject.curX)return!1;if(!0===o.touchObject.edgeHit&&o.$slider.trigger("edge",[o,o.swipeDirection()]),o.touchObject.swipeLength>=o.touchObject.minSwipe){switch(t=o.swipeDirection()){case"left":case"down":e=o.options.swipeToSlide?o.checkNavigable(o.currentSlide+o.getSlideCount()):o.currentSlide+o.getSlideCount(),o.currentDirection=0;break;case"right":case"up":e=o.options.swipeToSlide?o.checkNavigable(o.currentSlide-o.getSlideCount()):o.currentSlide-o.getSlideCount(),o.currentDirection=1}"vertical"!=t&&(o.slideHandler(e),o.touchObject={},o.$slider.trigger("swipe",[o,t]))}else o.touchObject.startX!==o.touchObject.curX&&(o.slideHandler(o.currentSlide),o.touchObject={})},e.prototype.swipeHandler=function(i){var e=this;if(!(!1===e.options.swipe||"ontouchend"in document&&!1===e.options.swipe||!1===e.options.draggable&&-1!==i.type.indexOf("mouse")))switch(e.touchObject.fingerCount=i.originalEvent&&void 0!==i.originalEvent.touches?i.originalEvent.touches.length:1,e.touchObject.minSwipe=e.listWidth/e.options.touchThreshold,!0===e.options.verticalSwiping&&(e.touchObject.minSwipe=e.listHeight/e.options.touchThreshold),i.data.action){case"start":e.swipeStart(i);break;case"move":e.swipeMove(i);break;case"end":e.swipeEnd(i)}},e.prototype.swipeMove=function(i){var e,t,o,s,n,r,l=this;return n=void 0!==i.originalEvent?i.originalEvent.touches:null,!(!l.dragging||l.scrolling||n&&1!==n.length)&&(e=l.getLeft(l.currentSlide),l.touchObject.curX=void 0!==n?n[0].pageX:i.clientX,l.touchObject.curY=void 0!==n?n[0].pageY:i.clientY,l.touchObject.swipeLength=Math.round(Math.sqrt(Math.pow(l.touchObject.curX-l.touchObject.startX,2))),r=Math.round(Math.sqrt(Math.pow(l.touchObject.curY-l.touchObject.startY,2))),!l.options.verticalSwiping&&!l.swiping&&r>4?(l.scrolling=!0,!1):(!0===l.options.verticalSwiping&&(l.touchObject.swipeLength=r),t=l.swipeDirection(),void 0!==i.originalEvent&&l.touchObject.swipeLength>4&&(l.swiping=!0,i.preventDefault()),s=(!1===l.options.rtl?1:-1)*(l.touchObject.curX>l.touchObject.startX?1:-1),!0===l.options.verticalSwiping&&(s=l.touchObject.curY>l.touchObject.startY?1:-1),o=l.touchObject.swipeLength,l.touchObject.edgeHit=!1,!1===l.options.infinite&&(0===l.currentSlide&&"right"===t||l.currentSlide>=l.getDotCount()&&"left"===t)&&(o=l.touchObject.swipeLength*l.options.edgeFriction,l.touchObject.edgeHit=!0),!1===l.options.vertical?l.swipeLeft=e+o*s:l.swipeLeft=e+o*(l.$list.height()/l.listWidth)*s,!0===l.options.verticalSwiping&&(l.swipeLeft=e+o*s),!0!==l.options.fade&&!1!==l.options.touchMove&&(!0===l.animating?(l.swipeLeft=null,!1):void l.setCSS(l.swipeLeft))))},e.prototype.swipeStart=function(i){var e,t=this;if(t.interrupted=!0,1!==t.touchObject.fingerCount||t.slideCount<=t.options.slidesToShow)return t.touchObject={},!1;void 0!==i.originalEvent&&void 0!==i.originalEvent.touches&&(e=i.originalEvent.touches[0]),t.touchObject.startX=t.touchObject.curX=void 0!==e?e.pageX:i.clientX,t.touchObject.startY=t.touchObject.curY=void 0!==e?e.pageY:i.clientY,t.dragging=!0},e.prototype.unfilterSlides=e.prototype.slickUnfilter=function(){var i=this;null!==i.$slidesCache&&(i.unload(),i.$slideTrack.children(this.options.slide).detach(),i.$slidesCache.appendTo(i.$slideTrack),i.reinit())},e.prototype.unload=function(){var e=this;i(".slick-cloned",e.$slider).remove(),e.$dots&&e.$dots.remove(),e.$prevArrow&&e.htmlExpr.test(e.options.prevArrow)&&e.$prevArrow.remove(),e.$nextArrow&&e.htmlExpr.test(e.options.nextArrow)&&e.$nextArrow.remove(),e.$slides.removeClass("slick-slide slick-active slick-visible slick-current").attr("aria-hidden","true").css("width","")}
23998,e.prototype.unslick=function(i){var e=this;e.$slider.trigger("unslick",[e,i]),e.destroy()},e.prototype.updateArrows=function(){var i=this;Math.floor(i.options.slidesToShow/2),!0===i.options.arrows&&i.slideCount>i.options.slidesToShow&&!i.options.infinite&&(i.$prevArrow.removeClass("slick-disabled").attr("aria-disabled","false"),i.$nextArrow.removeClass("slick-disabled").attr("aria-disabled","false"),0===i.currentSlide?(i.$prevArrow.addClass("slick-disabled").attr("aria-disabled","true"),i.$nextArrow.removeClass("slick-disabled").attr("aria-disabled","false")):i.currentSlide>=i.slideCount-i.options.slidesToShow&&!1===i.options.centerMode?(i.$nextArrow.addClass("slick-disabled").attr("aria-disabled","true"),i.$prevArrow.removeClass("slick-disabled").attr("aria-disabled","false")):i.currentSlide>=i.slideCount-1&&!0===i.options.centerMode&&(i.$nextArrow.addClass("slick-disabled").attr("aria-disabled","true"),i.$prevArrow.removeClass("slick-disabled").attr("aria-disabled","false")))},e.prototype.updateDots=function(){var i=this;null!==i.$dots&&(i.$dots.find("li").removeClass("slick-active").end(),i.$dots.find("li").eq(Math.floor(i.currentSlide/i.options.slidesToScroll)).addClass("slick-active"))},e.prototype.visibility=function(){var i=this;i.options.autoplay&&(document[i.hidden]?i.interrupted=!0:i.interrupted=!1)},i.fn.slick=function(){var i,t,o=this,s=arguments[0],n=Array.prototype.slice.call(arguments,1),r=o.length;for(i=0;i<r;i++)if("object"==typeof s||void 0===s?o[i].slick=new e(o[i],s):t=o[i].slick[s].apply(o[i].slick,n),void 0!==t)return t;return o}});
23999
24000/* End */
24001;
24002; /* Start:"a:4:{s:4:"full";s:64:"/local/templates/aspro_next/cdn/fancybox.umd.js?1725969845105639";s:6:"source";s:47:"/local/templates/aspro_next/cdn/fancybox.umd.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
24003// @fancyapps/ui/Fancybox v4.0.31
24004!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).window=t.window||{})}(this,(function(t){"use strict";function e(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function i(t){for(var i=1;i<arguments.length;i++){var n=null!=arguments[i]?arguments[i]:{};i%2?e(Object(n),!0).forEach((function(e){r(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):e(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function s(t,e,i){return e&&a(t.prototype,e),i&&a(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}function r(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function l(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&h(t,e)}function c(t){return c=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},c(t)}function h(t,e){return h=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},h(t,e)}function d(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function u(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return d(t)}function f(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=c(t);if(e){var o=c(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return u(this,i)}}function v(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=c(t)););return t}function p(){return p="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,
24004i){var n=v(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(arguments.length<3?t:i):o.value}},p.apply(this,arguments)}function g(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==i)return;var n,o,a=[],s=!0,r=!1;try{for(i=i.call(t);!(s=(n=i.next()).done)&&(a.push(n.value),!e||a.length!==e);s=!0);}catch(t){r=!0,o=t}finally{try{s||null==i.return||i.return()}finally{if(r)throw o}}return a}(t,e)||y(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(t){return function(t){if(Array.isArray(t))return b(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||y(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(t,e){if(t){if("string"==typeof t)return b(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?b(t,e):void 0}}function b(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}function x(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=y(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,r=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return s=t.done,t},e:function(t){r=!0,a=t},f:function(){try{s||null==i.return||i.return()}finally{if(r)throw a}}}}var w=function(t){return"object"===n(t)&&null!==t&&t.constructor===Object&&"[object Object]"===Object.prototype.toString.call(t)},k=function t(){for(var e=!1,i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];"boolean"==typeof o[0]&&(e=o.shift());var s=o[0];if(!s||"object"!==n(s))throw new Error("extendee must be an object");for(var r=o.slice(1),l=r.length,c=0;c<l;c++){var h=r[c];for(var d in h)if(h.hasOwnProperty(d)){var u=h[d];if(e&&(Array.isArray(u)||w(u))){var f=Array.isArray(u)?[]:{};s[d]=t(!0,s.hasOwnProperty(d)?s[d]:f,u)}else s[d]=u}}return s},S=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e4;return t=parseFloat(t)||0,Math.round((t+Number.EPSILON)*e)/e},C=function t(e){return!!(e&&"object"===n(e)&&e instanceof Element&&e!==document.body)&&(!e.__Panzoom&&(function(t){var e=getComputedStyle(t)["overflow-y"],i=getComputedStyle(t)["overflow-x"],n=("scroll"===e||"auto"===e)&&Math.abs(t.scrollHeight-t.clientHeight)>1,o=("scroll"===i||"auto"===i)&&Math.abs(t.scrollWidth-t.clientWidth)>1;return n||o}(e)?e:t(e.parentNode)))},$="undefined"!=typeof window&&window.ResizeObserver||function(){function t(e){o(this,t),this.observables=[],this.boundCheck=this.check.bind(this),this.boundCheck(),this.callback=e}return s(t,[{key:"observe",value:function(t){if(!this.observables.some((function(e){return e.el===t}))){var e={el:t,size:{height:t.clientHeight,width:t.clientWidth}};this.observables.push(e)}}},{key:"unobserve",value:function(t){this.observables=this.observables.filter((function(e){return e.el!==t}))}},{key:"disconnect",value:function(){this.observables=[]}},{key:"check",value:function(){var t=this.observables.filter((function(t){var e=t.el.clientHeight,i=t.el.clientWidth;if(t.size.height!==e||t.size.width!==i)return t.size.height=e,t.size.width=i,!0})).map((function(t){return t.el}));t.length>0&&this.callback(t),window.requestAnimationFrame(this.boundCheck)}}]),t}(),E=s((function t(e){o(this,t),this.id=self.Touch&&e instanceof Touch?e.identifier:-1,this.pageX=e.pageX,this.pageY=e.pageY,this.clientX=e.clientX,this.clientY=e.clientY})),P=function(t,e){return e?Math.sqrt(Math.pow(e.clientX-t.clientX,2)+Math.pow(e.clientY-t.clientY,2)):0},T=function(t,e){return e?{clientX:(t.clientX+e.clientX)/2,clientY:(t.clientY+e.clientY)/2}:t},L=function(t){return"changedTouches"in t},_=function(){function t(e){var i=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=n.start,s=void 0===a?function(){return!0}:a,r=n.move,l=void 0===r?function(){}:r,c=n.end,h=void 0===c?function(){}:c;o(this,t),this._element=e,this.startPointers=[],this.currentPointers=[],this._pointerStart=function(t){if(!(t.buttons>0&&0!==t.button)){var e=new E(t);i.currentPointers.some((function(t){return t.id===e.id}))||i._triggerPointerStart(e,t)&&(window.addEventListener("mousemove",i._move),window.addEventListener("mouseup",i._pointerEnd))}},this._touchStart=function(t){for(var e=0,n=Array.from(t.changedTouches||[]);e<n.length;e++){var o=n[e];i._triggerPointerStart(new E(o),t)}},this._move=function(t){var e,n=i.currentPointers.slice(),o=L(t)?Array.from(t.changedTouches).map((function(t){return new E(t)})):[new E(t)],a=[],s=x(o);try{var r=function(){var t=e.value,n=i.currentPointers.findIndex((function(e){return e.id===t.id}));if(n<0)return"continue";a.push(t),i.currentPointers[n]=t};for(s.s();!(e=s.n()).done;)r()}catch(t){s.e(t)}finally{s.f()}i._moveCallback(n,i.currentPointers.slice(),t)},this._triggerPointerEnd=function(t,e){var n=i.currentPointers.findIndex((function(e){return e.id===t.id}));return!(n<0)&&(i.currentPointers.splice(n,1),i.startPointers.splice(n,1),i._endCallback(t,e),!0)},this._pointerEnd=function(t){t.buttons>0&&0!==t.button||i._triggerPointerEnd(new E(t),t)&&(window.removeEventListener("mousemove",i._move,{passive:!1}),window.removeEventListener("mouseup",i._pointerEnd,{passive:!1}))},this._touchEnd=function(t){for(var e=0,n=Array.from(t.changedTouches||[]);e<n.length;e++){var o=n[e];i._triggerPointerEnd(new E(o),t)}},this._startCallback=s,this._moveCallback=l,this._endCallback=h,this._element.addEventListener("mousedown",this._pointerStart,{passive:!1}),this._element.addEventListener("touchstart",this._touchStart,{passive:!1}),this._element.addEventListener("touchmove",this._move,{passive:!1}),this._element.addEventListener("touchend",this._touchEnd),this._element.addEventListener("touchcancel",this._touchEnd)}return s(t,[{key:"stop",value:function(){this._element.removeEventListener("mousedown",this._pointerStart,{passive:!1}),this._element.removeEventListener("touchstart",this._touchStart,{passive:!1}),this._element.removeEventListener("touchmove",this._move,{passive:!1}),this._element.removeEventListener("touchend",this._touchEnd),this._element.removeEventListener("touchcancel",this._touchEnd),window.removeEventListener("mousemove",this._move),window.removeEventListener("mouseup",this._pointerEnd)}},{key:"_triggerPointerStart",value:function(t,e){return!!this._startCallback(t,e)&&(this.currentPointers.push(t),this.startPointers.push(t),!0)}}]),t}(),A=function(t,e){return t.split(".").reduce((function(t,e){return t&&t[e]}
24004),e)},O=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};o(this,t),this.options=k(!0,{},e),this.plugins=[],this.events={};for(var i=0,n=["on","once"];i<n.length;i++)for(var a=n[i],s=0,r=Object.entries(this.options[a]||{});s<r.length;s++){var l=r[s];this[a].apply(this,m(l))}}return s(t,[{key:"option",value:function(t,e){t=String(t);var i=A(t,this.options);if("function"==typeof i){for(var n,o=arguments.length,a=new Array(o>2?o-2:0),s=2;s<o;s++)a[s-2]=arguments[s];i=(n=i).call.apply(n,[this,this].concat(a))}return void 0===i?e:i}},{key:"localize",value:function(t){var e=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return t=(t=String(t).replace(/\{\{(\w+).?(\w+)?\}\}/g,(function(t,n,o){var a="";o?a=e.option("".concat(n[0]+n.toLowerCase().substring(1),".l10n.").concat(o)):n&&(a=e.option("l10n.".concat(n))),a||(a=t);for(var s=0;s<i.length;s++)a=a.split(i[s][0]).join(i[s][1]);return a}))).replace(/\{\{(.*)\}\}/,(function(t,e){return e}))}},{key:"on",value:function(t,e){var i=this;if(w(t)){for(var n=0,o=Object.entries(t);n<o.length;n++){var a=o[n];this.on.apply(this,m(a))}return this}return String(t).split(" ").forEach((function(t){var n=i.events[t]=i.events[t]||[];-1==n.indexOf(e)&&n.push(e)})),this}},{key:"once",value:function(t,e){var i=this;if(w(t)){for(var n=0,o=Object.entries(t);n<o.length;n++){var a=o[n];this.once.apply(this,m(a))}return this}return String(t).split(" ").forEach((function(t){var n=function n(){i.off(t,n);for(var o=arguments.length,a=new Array(o),s=0;s<o;s++)a[s]=arguments[s];e.call.apply(e,[i,i].concat(a))};n._=e,i.on(t,n)})),this}},{key:"off",value:function(t,e){var i=this;if(!w(t))return t.split(" ").forEach((function(t){var n=i.events[t];if(!n||!n.length)return i;for(var o=-1,a=0,s=n.length;a<s;a++){var r=n[a];if(r&&(r===e||r._===e)){o=a;break}}-1!=o&&n.splice(o,1)})),this;for(var n=0,o=Object.entries(t);n<o.length;n++){var a=o[n];this.off.apply(this,m(a))}}},{key:"trigger",value:function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];var o,a=x(m(this.events[t]||[]).slice());try{for(a.s();!(o=a.n()).done;){var s=o.value;if(s&&!1===s.call.apply(s,[this,this].concat(i)))return!1}}catch(t){a.e(t)}finally{a.f()}var r,l=x(m(this.events["*"]||[]).slice());try{for(l.s();!(r=l.n()).done;){var c=r.value;if(c&&!1===c.call.apply(c,[this,t,this].concat(i)))return!1}}catch(t){l.e(t)}finally{l.f()}return!0}},{key:"attachPlugins",value:function(t){for(var e={},i=0,n=Object.entries(t||{});i<n.length;i++){var o=g(n[i],2),a=o[0],s=o[1];!1===this.options[a]||this.plugins[a]||(this.options[a]=k({},s.defaults||{},this.options[a]),e[a]=new s(this))}for(var r=0,l=Object.entries(e);r<l.length;r++){var c=g(l[r],2);c[0],c[1].attach(this)}return this.plugins=Object.assign({},this.plugins,e),this}},{key:"detachPlugins",value:function(){for(var t in this.plugins){var e=void 0;(e=this.plugins[t])&&"function"==typeof e.detach&&e.detach(this)}return this.plugins={},this}}]),t}(),z={touch:!0,zoom:!0,pinchToZoom:!0,panOnlyZoomed:!1,lockAxis:!1,friction:.64,decelFriction:.88,zoomFriction:.74,bounceForce:.2,baseScale:1,minScale:1,maxScale:2,step:.5,textSelection:!1,click:"toggleZoom",wheel:"zoom",wheelFactor:42,wheelLimit:5,draggableClass:"is-draggable",draggingClass:"is-dragging",ratio:1},M=function(t){l(n,t);var e=f(n);function n(t){var i,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};o(this,n),(i=e.call(this,k(!0,{},z,a))).state="init",i.$container=t;for(var s=0,r=["onLoad","onWheel","onClick"];s<r.length;s++){var l=r[s];i[l]=i[l].bind(d(i))}return i.initLayout(),i.resetValues(),i.attachPlugins(n.Plugins),i.trigger("init"),i.updateMetrics(),i.attachEvents(),i.trigger("ready"),!1===i.option("centerOnStart")?i.state="ready":i.panTo({friction:0}),t.__Panzoom=d(i),i}return s(n,[{key:"initLayout",value:function(){var t=this.$container;if(!(t instanceof HTMLElement))throw new Error("Panzoom: Container not found");var e=this.option("content")||t.querySelector(".panzoom__content");if(!e)throw new Error("Panzoom: Content not found");this.$content=e;var i,n=this.option("viewport")||t.querySelector(".panzoom__viewport");n||!1===this.option("wrapInner")||((n=document.createElement("div")).classList.add("panzoom__viewport"),(i=n).append.apply(i,m(t.childNodes)),t.appendChild(n));this.$viewport=n||e.parentNode}},{key:"resetValues",value:function(){this.updateRate=this.option("updateRate",/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)?250:24),this.container={width:0,height:0},this.viewport={width:0,height:0},this.content={origWidth:0,origHeight:0,width:0,height:0,x:this.option("x",0),y:this.option("y",0),scale:this.option("baseScale")},this.transform={x:0,y:0,scale:1},this.resetDragPosition()}},{key:"onLoad",value:function(t){this.updateMetrics(),this.panTo({scale:this.option("baseScale"),friction:0}),this.trigger("load",t)}},{key:"onClick",value:function(t){if(!(t.defaultPrevented||document.activeElement&&document.activeElement.closest("[contenteditable]")))if(!this.option("textSelection")||!window.getSelection().toString().length||t.target&&t.target.hasAttribute("data-fancybox-close")){var e=this.$content.getClientRects()[0];if("ready"!==this.state&&(this.dragPosition.midPoint||Math.abs(e.top-this.dragStart.rect.top)>1||Math.abs(e.left-this.dragStart.rect.left)>1))return t.preventDefault(),void t.stopPropagation();!1!==this.trigger("click",t)&&this.option("zoom")&&"toggleZoom"===this.option("click")&&(t.preventDefault(),t.stopPropagation(),this.zoomWithClick(t))}else t.stopPropagation()}},{key:"onWheel",value:function(t){!1!==this.trigger("wheel",t)&&this.option("zoom")&&this.option("wheel")&&this.zoomWithWheel(t)}},{key:"zoomWithWheel",value:function(t){void 0===this.changedDelta&&(this.changedDelta=0);var e=Math.max(-1,Math.min(1,-t.deltaY||-t.deltaX||t.wheelDelta||-t.detail)),i=this.content.scale,n=i*(100+e*this.option("wheelFactor"))/100;if(e<0&&Math.abs(i-this.option("minScale"))<.01||e>0&&Math.abs(i-this.option("maxScale"))<.01?(this.changedDelta+=Math.abs(e),n=i):(this.changedDelta=0,n=Math.max(Math.min(n,this.option("maxScale")),this.option("minScale"))),!(this.changedDelta>this.option("wheelLimit"))&&(t.preventDefault(),n!==i)){var o=this.$content.getBoundingClientRect(),a=t.clientX-o.left,s=t.clientY-o.top;this.zoomTo(n,{x:a,y:s}
24004)}}},{key:"zoomWithClick",value:function(t){var e=this.$content.getClientRects()[0],i=t.clientX-e.left,n=t.clientY-e.top;this.toggleZoom({x:i,y:n})}},{key:"attachEvents",value:function(){var t=this;this.$content.addEventListener("load",this.onLoad),this.$container.addEventListener("wheel",this.onWheel,{passive:!1}),this.$container.addEventListener("click",this.onClick,{passive:!1}),this.initObserver();var e=new _(this.$container,{start:function(i,n){if(!t.option("touch"))return!1;if(t.velocity.scale<0)return!1;var o=n.composedPath()[0];if(!e.currentPointers.length){if(-1!==["BUTTON","TEXTAREA","OPTION","INPUT","SELECT","VIDEO"].indexOf(o.nodeName))return!1;if(t.option("textSelection")&&function(t,e,i){for(var n=t.childNodes,o=document.createRange(),a=0;a<n.length;a++){var s=n[a];if(s.nodeType===Node.TEXT_NODE){o.selectNodeContents(s);var r=o.getBoundingClientRect();if(e>=r.left&&i>=r.top&&e<=r.right&&i<=r.bottom)return s}}return!1}(o,i.clientX,i.clientY))return!1}return!C(o)&&(!1!==t.trigger("touchStart",n)&&("mousedown"===n.type&&n.preventDefault(),t.state="pointerdown",t.resetDragPosition(),t.dragPosition.midPoint=null,t.dragPosition.time=Date.now(),!0))},move:function(i,n,o){if("pointerdown"===t.state)if(!1!==t.trigger("touchMove",o)){if(!(n.length<2&&!0===t.option("panOnlyZoomed")&&t.content.width<=t.viewport.width&&t.content.height<=t.viewport.height&&t.transform.scale<=t.option("baseScale"))&&(!(n.length>1)||t.option("zoom")&&!1!==t.option("pinchToZoom"))){var a=T(i[0],i[1]),s=T(n[0],n[1]),r=s.clientX-a.clientX,l=s.clientY-a.clientY,c=P(i[0],i[1]),h=P(n[0],n[1]),d=c&&h?h/c:1;t.dragOffset.x+=r,t.dragOffset.y+=l,t.dragOffset.scale*=d,t.dragOffset.time=Date.now()-t.dragPosition.time;var u=1===t.dragStart.scale&&t.option("lockAxis");if(u&&!t.lockAxis){if(Math.abs(t.dragOffset.x)<6&&Math.abs(t.dragOffset.y)<6)return void o.preventDefault();var f=Math.abs(180*Math.atan2(t.dragOffset.y,t.dragOffset.x)/Math.PI);t.lockAxis=f>45&&f<135?"y":"x"}if("xy"===u||"y"!==t.lockAxis){if(o.preventDefault(),o.stopPropagation(),o.stopImmediatePropagation(),t.lockAxis&&(t.dragOffset["x"===t.lockAxis?"y":"x"]=0),t.$container.classList.add(t.option("draggingClass")),t.transform.scale===t.option("baseScale")&&"y"===t.lockAxis||(t.dragPosition.x=t.dragStart.x+t.dragOffset.x),t.transform.scale===t.option("baseScale")&&"x"===t.lockAxis||(t.dragPosition.y=t.dragStart.y+t.dragOffset.y),t.dragPosition.scale=t.dragStart.scale*t.dragOffset.scale,n.length>1){var v=T(e.startPointers[0],e.startPointers[1]),p=v.clientX-t.dragStart.rect.x,g=v.clientY-t.dragStart.rect.y,m=t.getZoomDelta(t.content.scale*t.dragOffset.scale,p,g),y=m.deltaX,b=m.deltaY;t.dragPosition.x-=y,t.dragPosition.y-=b,t.dragPosition.midPoint=s}else t.setDragResistance();t.transform={x:t.dragPosition.x,y:t.dragPosition.y,scale:t.dragPosition.scale},t.startAnimation()}}}else o.preventDefault()},end:function(n,o){if("pointerdown"===t.state)if(t._dragOffset=i({},t.dragOffset),e.currentPointers.length)t.resetDragPosition();else if(t.state="decel",t.friction=t.option("decelFriction"),t.recalculateTransform(),t.$container.classList.remove(t.option("draggingClass")),!1!==t.trigger("touchEnd",o)&&"decel"===t.state){var a=t.option("minScale");if(t.transform.scale<a)t.zoomTo(a,{friction:.64});else{var s=t.option("maxScale");if(t.transform.scale-s>.01){var r=t.dragPosition.midPoint||n,l=t.$content.getClientRects()[0];t.zoomTo(s,{friction:.64,x:r.clientX-l.left,y:r.clientY-l.top})}else;}}}});this.pointerTracker=e}},{key:"initObserver",value:function(){var t=this;this.resizeObserver||(this.resizeObserver=new $((function(){t.updateTimer||(t.updateTimer=setTimeout((function(){var e=t.$container.getBoundingClientRect();e.width&&e.height?((Math.abs(e.width-t.container.width)>1||Math.abs(e.height-t.container.height)>1)&&(t.isAnimating()&&t.endAnimation(!0),t.updateMetrics(),t.panTo({x:t.content.x,y:t.content.y,scale:t.option("baseScale"),friction:0})),t.updateTimer=null):t.updateTimer=null}),t.updateRate))})),this.resizeObserver.observe(this.$container))}},{key:"resetDragPosition",value:function(){this.lockAxis=null,this.friction=this.option("friction"),this.velocity={x:0,y:0,scale:0};var t=this.content,e=t.x,n=t.y,o=t.scale;
24004this.dragStart={rect:this.$content.getBoundingClientRect(),x:e,y:n,scale:o},this.dragPosition=i(i({},this.dragPosition),{},{x:e,y:n,scale:o}),this.dragOffset={x:0,y:0,scale:1,time:0}}},{key:"updateMetrics",value:function(t){!0!==t&&this.trigger("beforeUpdate");var e,n=this.$container,o=this.$content,a=this.$viewport,s=o instanceof HTMLImageElement,r=this.option("zoom"),l=this.option("resizeParent",r),c=this.option("width"),h=this.option("height"),d=c||(e=o,Math.max(parseFloat(e.naturalWidth||0),parseFloat(e.width&&e.width.baseVal&&e.width.baseVal.value||0),parseFloat(e.offsetWidth||0),parseFloat(e.scrollWidth||0))),u=h||function(t){return Math.max(parseFloat(t.naturalHeight||0),parseFloat(t.height&&t.height.baseVal&&t.height.baseVal.value||0),parseFloat(t.offsetHeight||0),parseFloat(t.scrollHeight||0))}(o);Object.assign(o.style,{width:c?"".concat(c,"px"):"",height:h?"".concat(h,"px"):"",maxWidth:"",maxHeight:""}),l&&Object.assign(a.style,{width:"",height:""});var f=this.option("ratio");c=d=S(d*f),h=u=S(u*f);var v=o.getBoundingClientRect(),p=a.getBoundingClientRect(),g=a==n?p:n.getBoundingClientRect(),m=Math.max(a.offsetWidth,S(p.width)),y=Math.max(a.offsetHeight,S(p.height)),b=window.getComputedStyle(a);if(m-=parseFloat(b.paddingLeft)+parseFloat(b.paddingRight),y-=parseFloat(b.paddingTop)+parseFloat(b.paddingBottom),this.viewport.width=m,this.viewport.height=y,r){if(Math.abs(d-v.width)>.1||Math.abs(u-v.height)>.1){var x=function(t,e,i,n){var o=Math.min(i/t||0,n/e);return{width:t*o||0,height:e*o||0}}(d,u,Math.min(d,v.width),Math.min(u,v.height));c=S(x.width),h=S(x.height)}Object.assign(o.style,{width:"".concat(c,"px"),height:"".concat(h,"px"),transform:""})}if(l&&(Object.assign(a.style,{width:"".concat(c,"px"),height:"".concat(h,"px")}),this.viewport=i(i({},this.viewport),{},{width:c,height:h})),s&&r&&"function"!=typeof this.options.maxScale){var w=this.option("maxScale");this.options.maxScale=function(){return this.content.origWidth>0&&this.content.fitWidth>0?this.content.origWidth/this.content.fitWidth:w}}this.content=i(i({},this.content),{},{origWidth:d,origHeight:u,fitWidth:c,fitHeight:h,width:c,height:h,scale:1,isZoomable:r}),this.container={width:g.width,height:g.height},!0!==t&&this.trigger("afterUpdate")}},{key:"zoomIn",value:function(t){this.zoomTo(this.content.scale+(t||this.option("step")))}},{key:"zoomOut",value:function(t){this.zoomTo(this.content.scale-(t||this.option("step")))}},{key:"toggleZoom",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=this.option("maxScale"),i=this.option("baseScale"),n=this.content.scale>i+.5*(e-i)?i:e;this.zoomTo(n,t)}},{key:"zoomTo",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.option("baseScale"),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=e.x,n=void 0===i?null:i,o=e.y,a=void 0===o?null:o;t=Math.max(Math.min(t,this.option("maxScale")),this.option("minScale"));var s=S(this.content.scale/(this.content.width/this.content.fitWidth),1e7);null===n&&(n=this.content.width*s*.5),null===a&&(a=this.content.height*s*.5);var r=this.getZoomDelta(t,n,a),l=r.deltaX,c=r.deltaY;n=this.content.x-l,a=this.content.y-c,this.panTo({x:n,y:a,scale:t,friction:this.option("zoomFriction")})}},{key:"getZoomDelta",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=this.content.fitWidth*this.content.scale,o=this.content.fitHeight*this.content.scale,a=e>0&&n?e/n:0,s=i>0&&o?i/o:0,r=this.content.fitWidth*t,l=this.content.fitHeight*t,c=(r-n)*a,h=(l-o)*s;return{deltaX:c,deltaY:h}}},{key:"panTo",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.x,n=void 0===e?this.content.x:e,o=t.y,a=void 0===o?this.content.y:o,s=t.scale,r=t.friction,l=void 0===r?this.option("friction"):r,c=t.ignoreBounds,h=void 0!==c&&c;if(s=s||this.content.scale||1,!h){var d=this.getBounds(s),u=d.boundX,f=d.boundY;u&&(n=Math.max(Math.min(n,u.to),u.from)),f&&(a=Math.max(Math.min(a,f.to),f.from))}this.friction=l,this.transform=i(i({},this.transform),{},{x:n,y:a,scale:s}),l?(this.state="panning",this.velocity={x:(1/this.friction-1)*(n-this.content.x),y:(1/this.friction-1)*(a-this.content.y),scale:(1/this.friction-1)*(s-this.content.scale)},this.startAnimation()):this.endAnimation()}},{key:"startAnimation",value:function(){var t=this;this.rAF?cancelAnimationFrame(this.rAF):this.trigger("startAnimation"),this.rAF=requestAnimationFrame((function(){return t.animate()}))}},{key:"animate",value:function(){var t=this;if(this.setEdgeForce(),this.setDragForce(),this.velocity.x*=this.friction,this.velocity.y*=this.friction,this.velocity.scale*=this.friction,this.content.x+=this.velocity.x,this.content.y+=this.velocity.y,this.content.scale+=this.velocity.scale,this.isAnimating())this.setTransform();else if("pointerdown"!==this.state)return void this.endAnimation();this.rAF=requestAnimationFrame((function(){return t.animate()}))}},{key:"getBounds",value:function(t){var e=this.boundX,i=this.boundY;if(void 0!==e&&void 0!==i)return{boundX:e,boundY:i};e={from:0,to:0},i={from:0,to:0},t=t||this.transform.scale;var n=this.content.fitWidth*t,o=this.content.fitHeight*t,a=this.viewport.width,s=this.viewport.height;if(n<a){var r=S(.5*(a-n));e.from=r,e.to=r}else e.from=S(a-n);if(o<s){var l=.5*(s-o);i.from=l,i.to=l}else i.from=S(s-o);return{boundX:e,boundY:i}}},{key:"setEdgeForce",value:function(){if("decel"===this.state){var t,e,i,n,o=this.option("bounceForce"),a=this.getBounds(Math.max(this.transform.scale,this.content.scale)),s=a.boundX,r=a.boundY;if(s&&(t=this.content.x<s.from,e=this.content.x>s.to),r&&(i=this.content.y<r.from,n=this.content.y>r.to),t||e){var l=((t?s.from:s.to)-this.content.x)*o,c=this.content.x+(this.velocity.x+l)/this.friction;c>=s.from&&c<=s.to&&(l+=this.velocity.x),this.velocity.x=l,this.recalculateTransform()}if(i||n){var h=((i?r.from:r.to)-this.content.y)*o,d=this.content.y+(h+this.velocity.y)/this.friction;d>=r.from&&d<=r.to&&(h+=this.velocity.y),this.velocity.y=h,this.recalculateTransform()}}}},{key:"setDragResistance",value:function(){if("pointerdown"===this.state){var t,e,i,n,o=this.getBounds(this.dragPosition.scale),a=o.boundX,s=o.boundY;if(a&&(t=this.dragPosition.x<a.from,e=this.dragPosition.x>a.to),s&&(i=this.dragPosition.y<s.from,n=this.dragPosition.y>s.to),(t||e)&&(!t||!e)){var r=t?a.from:a.to,l=r-this.dragPosition.x;this.dragPosition.x=r-.3*l}if((i||n)&&(!i||!n)){var c=i?s.from:s.to,h=c-this.dragPosition.y;this.dragPosition.y=c-.3*h}}}},{key:"setDragForce",value:function(){"pointerdown"===this.state&&(this.velocity.x=this.dragPosition.x-this.content.x,this.velocity.y=this.dragPosition.y-this.content.y,this.velocity.scale=this.dragPosition.scale-this.content.scale)}},{key:"recalculateTransform",value:function(){this.transform.x=this.content.x+this.velocity.x/(1/this.friction-1),this.transform.y=this.content.y+this.velocity.y/(1/this.friction-1),this.transform.scale=this.content.scale+this.velocity.scale/(1/this.friction-1)}},{key:"isAnimating",value:function(){return!(!this.friction||!(Math.abs(this.velocity.x)>.05||Math.abs(this.velocity.y)>.05||Math.abs(this.velocity.scale)>.05))}},{key:"setTransform",value:function(t){var e,n,o,a,s;(t?(e=S(this.transform.x),n=S(this.transform.y),o=this.transform.scale,this.content=i(i({},this.content),{},{x:e,y:n,scale:o})):(e=S(this.content.x),n=S(this.content.y),o=this.content.scale/(this.content.width/this.content.fitWidth),this.content=i(i({},this.content),{},{x:e,y:n})),this.trigger("beforeTransform"),e=S(this.content.x),n=S(this.content.y),t&&this.option("zoom"))?(a=S(this.content.fitWidth*o),s=S(this.content.fitHeight*o),this.content.width=a,this.content.height=s,this.transform=i(i({},this.transform),{},{width:a,height:s,scale:o}),Object.assign(this.$content.style,{width:"".concat(a,"px"),height:"".concat(s,"px"),maxWidth:"none",maxHeight:"none",transform:"translate3d(".concat(e,"px, ").concat(n,"px, 0) scale(1)")})):this.$content.style.transform="translate3d(".concat(e,"px, ").concat(n,"px, 0) scale(").concat(o,")");this.trigger("afterTransform")}},{key:"endAnimation",value:function(t){cancelAnimationFrame(this.rAF),this.rAF=null,this.velocity={x:0,y:0,scale:0}
24004,this.setTransform(!0),this.state="ready",this.handleCursor(),!0!==t&&this.trigger("endAnimation")}},{key:"handleCursor",value:function(){var t=this.option("draggableClass");t&&this.option("touch")&&(1==this.option("panOnlyZoomed")&&this.content.width<=this.viewport.width&&this.content.height<=this.viewport.height&&this.transform.scale<=this.option("baseScale")?this.$container.classList.remove(t):this.$container.classList.add(t))}},{key:"detachEvents",value:function(){this.$content.removeEventListener("load",this.onLoad),this.$container.removeEventListener("wheel",this.onWheel,{passive:!1}),this.$container.removeEventListener("click",this.onClick,{passive:!1}),this.pointerTracker&&(this.pointerTracker.stop(),this.pointerTracker=null),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)}},{key:"destroy",value:function(){"destroy"!==this.state&&(this.state="destroy",clearTimeout(this.updateTimer),this.updateTimer=null,cancelAnimationFrame(this.rAF),this.rAF=null,this.detachEvents(),this.detachPlugins(),this.resetDragPosition())}}]),n}(O);M.version="4.0.31",M.Plugins={};var I=function(t,e){var i=0;return function(){var n=(new Date).getTime();if(!(n-i<e))return i=n,t.apply(void 0,arguments)}},R=function(){function t(e){o(this,t),this.$container=null,this.$prev=null,this.$next=null,this.carousel=e,this.onRefresh=this.onRefresh.bind(this)}return s(t,[{key:"option",value:function(t){return this.carousel.option("Navigation.".concat(t))}},{key:"createButton",value:function(t){var e,i=this,n=document.createElement("button");n.setAttribute("title",this.carousel.localize("{{".concat(t.toUpperCase(),"}}")));var o=this.option("classNames.button")+" "+this.option("classNames.".concat(t));return(e=n.classList).add.apply(e,m(o.split(" "))),n.setAttribute("tabindex","0"),n.innerHTML=this.carousel.localize(this.option("".concat(t,"Tpl"))),n.addEventListener("click",(function(e){e.preventDefault(),e.stopPropagation(),i.carousel["slide".concat("next"===t?"Next":"Prev")]()})),n}},{key:"build",value:function(){var t;this.$container||(this.$container=document.createElement("div"),(t=this.$container.classList).add.apply(t,m(this.option("classNames.main").split(" "))),this.carousel.$container.appendChild(this.$container));this.$next||(this.$next=this.createButton("next"),this.$container.appendChild(this.$next)),this.$prev||(this.$prev=this.createButton("prev"),this.$container.appendChild(this.$prev))}},{key:"onRefresh",value:function(){var t=this.carousel.pages.length;t<=1||t>1&&this.carousel.elemDimWidth<this.carousel.wrapDimWidth&&!Number.isInteger(this.carousel.option("slidesPerPage"))?this.cleanup():(this.build(),this.$prev.removeAttribute("disabled"),this.$next.removeAttribute("disabled"),this.carousel.option("infiniteX",this.carousel.option("infinite"))||(this.carousel.page<=0&&this.$prev.setAttribute("disabled",""),this.carousel.page>=t-1&&this.$next.setAttribute("disabled","")))}},{key:"cleanup",value:function(){this.$prev&&this.$prev.remove(),this.$prev=null,this.$next&&this.$next.remove(),this.$next=null,this.$container&&this.$container.remove(),this.$container=null}},{key:"attach",value:function(){this.carousel.on("refresh change",this.onRefresh)}},{key:"detach",value:function(){this.carousel.off("refresh change",this.onRefresh),this.cleanup()}}]),t}();R.defaults={prevTpl:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" tabindex="-1"><path d="M15 3l-9 9 9 9"/></svg>',nextTpl:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" tabindex="-1"><path d="M9 3l9 9-9 9"/></svg>',classNames:{main:"carousel__nav",button:"carousel__button",next:"is-next",prev:"is-prev"}};var F=function(){function t(e){o(this,t),this.carousel=e,this.$list=null,this.events={change:this.onChange.bind(this),refresh:this.onRefresh.bind(this)}}return s(t,[{key:"buildList",value:function(){var t=this;if(!(this.carousel.pages.length<this.carousel.option("Dots.minSlideCount"))){var e=document.createElement("ol");return e.classList.add("carousel__dots"),e.addEventListener("click",(function(e){if("page"in e.target.dataset){e.preventDefault(),e.stopPropagation();var i=parseInt(e.target.dataset.page,10),n=t.carousel;i!==n.page&&(n.pages.length<3&&n.option("infinite")?n[0==i?"slidePrev":"slideNext"]():n.slideTo(i))}})),this.$list=e,this.carousel.$container.appendChild(e),this.carousel.$container.classList.add("has-dots"),e}}},{key:"removeList",value:function(){this.$list&&(this.$list.parentNode.removeChild(this.$list),this.$list=null),this.carousel.$container.classList.remove("has-dots")}},{key:"rebuildDots",value:function(){var t=this,e=this.$list,i=!!e,n=this.carousel.pages.length;if(n<2)i&&this.removeList();else{i||(e=this.buildList());var o=this.$list.children.length;if(o>n)for(var a=n;a<o;a++)this.$list.removeChild(this.$list.lastChild);else{for(var s=function(e){var i=document.createElement("li");i.classList.add("carousel__dot"),i.dataset.page=e,i.setAttribute("role","button"),i.setAttribute("tabindex","0"),i.setAttribute("title",t.carousel.localize("{{GOTO}}",[["%d",e+1]])),i.addEventListener("keydown",(function(t){var e,n=t.code;"Enter"===n||"NumpadEnter"===n?e=i:"ArrowRight"===n?e=i.nextSibling:"ArrowLeft"===n&&(e=i.previousSibling),e&&e.click()})),t.$list.appendChild(i)},r=o;r<n;r++)s(r);this.setActiveDot()}}}},{key:"setActiveDot",value:function(){if(this.$list){this.$list.childNodes.forEac
24004h((function(t){t.classList.remove("is-selected")}));var t=this.$list.childNodes[this.carousel.page];t&&t.classList.add("is-selected")}}},{key:"onChange",value:function(){this.setActiveDot()}},{key:"onRefresh",value:function(){this.rebuildDots()}},{key:"attach",value:function(){this.carousel.on(this.events)}},{key:"detach",value:function(){this.removeList(),this.carousel.off(this.events),this.carousel=null}}]),t}(),N=function(){function t(e){o(this,t),this.carousel=e,this.selectedIndex=null,this.friction=0,this.onNavReady=this.onNavReady.bind(this),this.onNavClick=this.onNavClick.bind(this),this.onNavCreateSlide=this.onNavCreateSlide.bind(this),this.onTargetChange=this.onTargetChange.bind(this)}return s(t,[{key:"addAsTargetFor",value:function(t){this.target=this.carousel,this.nav=t,this.attachEvents()}},{key:"addAsNavFor",value:function(t){this.target=t,this.nav=this.carousel,this.attachEvents()}},{key:"attachEvents",value:function(){this.nav.options.initialSlide=this.target.options.initialPage,this.nav.on("ready",this.onNavReady),this.nav.on("createSlide",this.onNavCreateSlide),this.nav.on("Panzoom.click",this.onNavClick),this.target.on("change",this.onTargetChange),this.target.on("Panzoom.afterUpdate",this.onTargetChange)}},{key:"onNavReady",value:function(){this.onTargetChange(!0)}},{key:"onNavClick",value:function(t,e,i){var n=i.target.closest(".carousel__slide");if(n){i.stopPropagation();var o=parseInt(n.dataset.index,10),a=this.target.findPageForSlide(o);this.target.page!==a&&this.target.slideTo(a,{friction:this.friction}),this.markSelectedSlide(o)}}},{key:"onNavCreateSlide",value:function(t,e){e.index===this.selectedIndex&&this.markSelectedSlide(e.index)}},{key:"onTargetChange",value:function(){var t=this.target.pages[this.target.page].indexes[0],e=this.nav.findPageForSlide(t);this.nav.slideTo(e),this.markSelectedSlide(t)}},{key:"markSelectedSlide",value:function(t){this.selectedIndex=t,m(this.nav.slides).filter((function(t){return t.$el&&t.$el.classList.remove("is-nav-selected")}));var e=this.nav.slides[t];e&&e.$el&&e.$el.classList.add("is-nav-selected")}},{key:"attach",value:function(t){var e=t.options.Sync;(e.target||e.nav)&&(e.target?this.addAsNavFor(e.target):e.nav&&this.addAsTargetFor(e.nav),this.friction=e.friction)}},{key:"detach",value:function(){this.nav&&(this.nav.off("ready",this.onNavReady),this.nav.off("Panzoom.click",this.onNavClick),this.nav.off("createSlide",this.onNavCreateSlide)),this.target&&(this.target.off("Panzoom.afterUpdate",this.onTargetChange),this.target.off("change",this.onTargetChange))}}]),t}();N.defaults={friction:.92};var D={Navigation:R,Dots:F,Sync:N},B={slides:[],preload:0,slidesPerPage:"auto",initialPage:null,initialSlide:null,friction:.92,center:!0,infinite:!0,fill:!0,dragFree:!1,prefix:"",classNames:{viewport:"carousel__viewport",track:"carousel__track",slide:"carousel__slide",slideSelected:"is-selected"},l10n:{NEXT:"Next slide",PREV:"Previous slide",GOTO:"Go to slide #%d"}},H=function(t){l(n,t);var e=f(n);function n(t){var i,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(o(this,n),a=k(!0,{},B,a),(i=e.call(this,a)).state="init",i.$container=t,!(i.$container instanceof HTMLElement))throw new Error("No root element provided");return i.slideNext=I(i.slideNext.bind(d(i)),250),i.slidePrev=I(i.slidePrev.bind(d(i)),250),i.init(),t.__Carousel=d(i),i}return s(n,[{key:"init",value:function(){this.pages=[],this.page=this.pageIndex=null,this.prevPage=this.prevPageIndex=null,this.attachPlugins(n.Plugins),this.trigger("init"),this.initLayout(),this.initSlides(),this.updateMetrics(),this.$track&&this.pages.length&&(this.$track.style.transform="translate3d(".concat(-1*this.pages[this.page].left,"px, 0px, 0) scale(1)")),this.manageSlideVisiblity(),this.initPanzoom(),this.state="ready",this.trigger("ready")}},{key:"initLayout",value:function(){var t,e,i,n,o=this.option("prefix"),a=this.option("classNames");(this.$viewport=this.option("viewport")||this.$container.querySelector(".".concat(o).concat(a.viewport)),this.$viewport)||(this.$viewport=document.createElement("div"),(t=this.$viewport.classList).add.apply(t,m((o+a.viewport).split(" "))),(e=this.$viewport).append.apply(e,m(this.$container.childNodes)),this.$container.appendChild(this.$viewport));(this.$track=this.option("track")||this.$container.querySelector(".".concat(o).concat(a.track)),this.$track)||(this.$track=document.createElement("div"),(i=this.$track.classList).add.apply(i,m((o+a.track).split(" "))),(n=this.$track).append.apply(n,m(this.$viewport.childNodes)),this.$viewport.appendChild(this.$track))}},{key:"initSlides",value:function(){var t=this;this.slides=[],this.$viewport.querySelectorAll(".".concat(this.option("prefix")).c
24004oncat(this.option("classNames.slide"))).forEach((function(e){var i={$el:e,isDom:!0};t.slides.push(i),t.trigger("createSlide",i,t.slides.length)})),Array.isArray(this.options.slides)&&(this.slides=k(!0,m(this.slides),this.options.slides))}},{key:"updateMetrics",value:function(){var t,e=this,n=0,o=[];this.slides.forEach((function(i,a){var s=i.$el,r=i.isDom||!t?e.getSlideMetrics(s):t;i.index=a,i.width=r,i.left=n,t=r,n+=r,o.push(a)}));var a=Math.max(this.$track.offsetWidth,S(this.$track.getBoundingClientRect().width)),s=getComputedStyle(this.$track);a-=parseFloat(s.paddingLeft)+parseFloat(s.paddingRight),this.contentWidth=n,this.viewportWidth=a;var r=[],l=this.option("slidesPerPage");if(Number.isInteger(l)&&n>a)for(var c=0;c<this.slides.length;c+=l)r.push({indexes:o.slice(c,c+l),slides:this.slides.slice(c,c+l)});else for(var h=0,d=0,u=0;u<this.slides.length;u+=1){var f=this.slides[u];(!r.length||d+f.width>a)&&(r.push({indexes:[],slides:[]}),h=r.length-1,d=0),d+=f.width,r[h].indexes.push(u),r[h].slides.push(f)}var v=this.option("center"),p=this.option("fill");r.forEach((function(t,i){t.index=i,t.width=t.slides.reduce((function(t,e){return t+e.width}),0),t.left=t.slides[0].left,v&&(t.left+=.5*(a-t.width)*-1),p&&!e.option("infiniteX",e.option("infinite"))&&n>a&&(t.left=Math.max(t.left,0),t.left=Math.min(t.left,n-a))}));var g,y=[];r.forEach((function(t){var e=i({},t);g&&e.left===g.left?(g.width+=e.width,g.slides=[].concat(m(g.slides),m(e.slides)),g.indexes=[].concat(m(g.indexes),m(e.indexes))):(e.index=y.length,g=e,y.push(e))})),this.pages=y;var b=this.page;if(null===b){var x=this.option("initialSlide");b=null!==x?this.findPageForSlide(x):parseInt(this.option("initialPage",0),10)||0,y[b]||(b=y.length&&b>y.length?y[y.length-1].index:0),this.page=b,this.pageIndex=b}this.updatePanzoom(),this.trigger("refresh")}},{key:"getSlideMetrics",value:function(t){if(!t){var e,i,n=this.slides[0];if((t=document.createElement("div")).dataset.isTestEl=1,t.style.visibility="hidden",(e=t.classList).add.apply(e,m((this.option("prefix")+this.option("classNames.slide")).split(" "))),n.customClass)(i=t.classList).add.apply(i,m(n.customClass.split(" ")));this.$track.prepend(t)}var o=Math.max(t.offsetWidth,S(t.getBoundingClientRect().width)),a=t.currentStyle||window.getComputedStyle(t);return o=o+(parseFloat(a.marginLeft)||0)+(parseFloat(a.marginRight)||0),t.dataset.isTestEl&&t.remove(),o}},{key:"findPageForSlide",value:function(t){t=parseInt(t,10)||0;var e=this.pages.find((function(e){return e.indexes.indexOf(t)>-1}));return e?e.index:null}},{key:"slideNext",value:function(){this.slideTo(this.pageIndex+1)}},{key:"slidePrev",value:function(){this.slideTo(this.pageIndex-1)}},{key:"slideTo",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=e.x,n=void 0===i?-1*this.setPage(t,!0):i,o=e.y,a=void 0===o?0:o,s=e.friction,r=void 0===s?this.option("friction"):s;this.Panzoom.content.x===n&&!this.Panzoom.velocity.x&&r||(this.Panzoom.panTo({x:n,y:a,friction:r,ignoreBounds:!0}),"ready"===this.state&&"ready"===this.Panzoom.state&&this.trigger("settle"))}},{key:"initPanzoom",value:function(){var t=this;this.Panzoom&&this.Panzoom.destroy();var e=k(!0,{},{content:this.$track,wrapInner:!1,resizeParent:!1,zoom:!1,click:!1,lockAxis:"x",x:this.pages.length?-1*this.pages[this.page].left:0,centerOnStart:!1,textSelection:function(){return t.option("textSelection",!1)},panOnlyZoomed:function(){return this.content.width<=this.viewport.width}},this.option("Panzoom"));this.Panzoom=new M(this.$container,e),this.Panzoom.on({"*":function(e){for(var i=arguments.length,n=new Array(i>1?i-1:0),o=1;o<i;o++)n[o-1]=arguments[o];return t.trigger.apply(t,["Panzoom.".concat(e)].concat(n))},afterUpdate:function(){t.updatePage()},beforeTransform:this.onBeforeTransform.bind(this),touchEnd:this.onTouchEnd.bind(this),endAnimation:function(){t.trigger("settle")}}),this.updateMetrics(),this.manageSlideVisiblity()}},{key:"updatePanzoom",value:function(){this.Panzoom&&(this.Panzoom.content=i(i({},this.Panzoom.content),{},{fitWidth:this.contentWidth,origWidth:this.contentWidth,width:this.contentWidth}
24004),this.pages.length>1&&this.option("infiniteX",this.option("infinite"))?this.Panzoom.boundX=null:this.pages.length&&(this.Panzoom.boundX={from:-1*this.pages[this.pages.length-1].left,to:-1*this.pages[0].left}),this.option("infiniteY",this.option("infinite"))?this.Panzoom.boundY=null:this.Panzoom.boundY={from:0,to:0},this.Panzoom.handleCursor())}},{key:"manageSlideVisiblity",value:function(){var t=this,e=this.contentWidth,i=this.viewportWidth,n=this.Panzoom?-1*this.Panzoom.content.x:this.pages.length?this.pages[this.page].left:0,o=this.option("preload"),a=this.option("infiniteX",this.option("infinite")),s=parseFloat(getComputedStyle(this.$viewport,null).getPropertyValue("padding-left")),r=parseFloat(getComputedStyle(this.$viewport,null).getPropertyValue("padding-right"));this.slides.forEach((function(l){var c,h,d=0;c=n-s,h=n+i+r,c-=o*(i+s+r),h+=o*(i+s+r);var u=l.left+l.width>c&&l.left<h;c=n+e-s,h=n+e+i+r,c-=o*(i+s+r);var f=a&&l.left+l.width>c&&l.left<h;c=n-e-s,h=n-e+i+r,c-=o*(i+s+r);var v=a&&l.left+l.width>c&&l.left<h;f||u||v?(t.createSlideEl(l),u&&(d=0),f&&(d=-1),v&&(d=1),l.left+l.width>n&&l.left<=n+i+r&&(d=0)):t.removeSlideEl(l),l.hasDiff=d}));var l=0,c=0;this.slides.forEach((function(t,i){var n=0;t.$el?(i!==l||t.hasDiff?n=c+t.hasDiff*e:c=0,t.$el.style.left=Math.abs(n)>.1?"".concat(c+t.hasDiff*e,"px"):"",l++):c+=t.width})),this.markSelectedSlides()}},{key:"createSlideEl",value:function(t){var e;if(t){if(!t.$el){var i,n=document.createElement("div");if(n.dataset.index=t.index,(e=n.classList).add.apply(e,m((this.option("prefix")+this.option("classNames.slide")).split(" "))),t.customClass)(i=n.classList).add.apply(i,m(t.customClass.split(" ")));t.html&&(n.innerHTML=t.html);var o=[];this.slides.forEach((function(t,e){t.$el&&o.push(e)}));var a=t.index,s=null;if(o.length){var r=o.reduce((function(t,e){return Math.abs(e-a)<Math.abs(t-a)?e:t}));s=this.slides[r]}return this.$track.insertBefore(n,s&&s.$el?s.index<t.index?s.$el.nextSibling:s.$el:null),t.$el=n,this.trigger("createSlide",t,a),t}var l,c=t.$el.dataset.index;c&&parseInt(c,10)===t.index||(t.$el.dataset.index=t.index,t.$el.querySelectorAll("[data-lazy-srcset]").forEach((function(t){t.srcset=t.dataset.lazySrcset})),t.$el.querySelectorAll("[data-lazy-src]").forEach((function(t){var e=t.dataset.lazySrc;t instanceof HTMLImageElement?t.src=e:t.style.backgroundImage="url('".concat(e,"')")})),(l=t.$el.dataset.lazySrc)&&(t.$el.style.backgroundImage="url('".concat(l,"')")),t.state="ready")}}},{key:"removeSlideEl",value:function(t){t.$el&&!t.isDom&&(this.trigger("removeSlide",t),t.$el.remove(),t.$el=null)}},{key:"markSelectedSlides",value:function(){var t=this,e=this.option("classNames.slideSelected"),i="aria-hidden";this.slides.forEach((function(n,o){var a=n.$el;if(a){var s=t.pages[t.page];s&&s.indexes&&s.indexes.indexOf(o)>-1?(e&&!a.classList.contains(e)&&(a.classList.add(e),t.trigger("selectSlide",n)),a.removeAttribute(i)):(e&&a.classList.contains(e)&&(a.classList.remove(e),t.trigger("unselectSlide",n)),a.setAttribute(i,!0))}}))}},{key:"updatePage",value:function(){this.updateMetrics(),this.slideTo(this.page,{friction:0})}},{key:"onBeforeTransform",value:function(){this.option("infiniteX",this.option("infinite"))&&this.manageInfiniteTrack(),this.manageSlideVisiblity()}},{key:"manageInfiniteTrack",value:function(){var t=this.contentWidth,e=this.viewportWidth;if(!(!this.option("infiniteX",this.option("infinite"))||this.pages.length<2||t<e)){var i=this.Panzoom,n=!1;return i.content.x<-1*(t-e)&&(i.content.x+=t,this.pageIndex=this.pageIndex-this.pages.length,n=!0),i.content.x>e&&(i.content.x-=t,this.pageIndex=this.pageIndex+this.pages.length,n=!0),n&&"pointerdown"===i.state&&i.resetDragPosition(),n}}},{key:"onTouchEnd",value:function(t,e){var i=this.option("dragFree");if(!i&&this.pages.length>1&&t.dragOffset.time<350&&Math.abs(t.dragOffset.y)<1&&Math.abs(t.dragOffset.x)>5)this[t.dragOffset.x<0?"slideNext":"slidePrev"]();else if(i){var n=g(this.getPageFromPosition(-1*t.transform.x),2)[1];this.setPage(n)}else this.slideToClosest()}},{key:"slideToClosest",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=this.getPageFromPosition(-1*this.Panzoom.content.x),i=g(e,2),n=i[1];this.slideTo(n,t)}},{key:"getPageFromPosition",value:function(t){var e=this.pages.length;this.option("center")&&(t+=.5*this.viewportWidth);var i=Math.floor(t/this.contentWidth);t-=i*this.contentWidth;var n=this.slides.find((function(e){return e.left<=t&&e.left+e.width>t}));if(n){var o=this.findPageForSlide(n.index);return[o,o+i*e]}return[0,0]}},{key:"setPage",value:function(t,e){var i=0,n=parseInt(t,10)||0,o=this.page,a=this.pageIndex,s=this.pages.length,r=this.contentWidth,l=this.viewportWidth;if(t=(n%s+s)%s,this.option("infiniteX",this.option("infinite"))&&r>l){var c=Math.floor(n/s)||0,h=r;if(i=this.pages[t].left+c*h,!0===e&&s>2){var d=-1*this.Panzoom.content.x,u=i-h,f=i+h,v=Math.abs(d-i),p=Math.abs(d-u),g=Math.abs(d-f);g<v&&g<=p?(i=f,n+=s):p<v&&p<g&&(i=u,n-=s)}}else t=n=Math.max(0,Math.min(n,s-1)),i=this.pages.length?this.pages[t].left:0;return this.page=t,this.pageIndex=n,null!==o&&t!==o&&(this.prevPage=o,this.prevPageIndex=a,this.trigger("change",t,o)),i}},{key:"destroy",value:function(){var t=this;
24004this.state="destroy",this.slides.forEach((function(e){t.removeSlideEl(e)})),this.slides=[],this.Panzoom.destroy(),this.detachPlugins()}}]),n}(O);H.version="4.0.31",H.Plugins=D;var W=!("undefined"==typeof window||!window.document||!window.document.createElement),j=null,X=["a[href]","area[href]",'input:not([disabled]):not([type="hidden"]):not([aria-hidden])',"select:not([disabled]):not([aria-hidden])","textarea:not([disabled]):not([aria-hidden])","button:not([disabled]):not([aria-hidden])","iframe","object","embed","video","audio","[contenteditable]",'[tabindex]:not([tabindex^="-"]):not([disabled]):not([aria-hidden])'],q=function(t){if(t&&W){null===j&&document.createElement("div").focus({get preventScroll(){return j=!0,!1}});try{if(t.setActive)t.setActive();else if(j)t.focus({preventScroll:!0});else{var e=window.pageXOffset||document.body.scrollTop,i=window.pageYOffset||document.body.scrollLeft;t.focus(),document.body.scrollTo({top:e,left:i,behavior:"auto"})}}catch(t){}}},U=function(){function t(e){o(this,t),this.fancybox=e,this.viewport=null,this.pendingUpdate=null;for(var i=0,n=["onReady","onResize","onTouchstart","onTouchmove"];i<n.length;i++){var a=n[i];this[a]=this[a].bind(this)}}return s(t,[{key:"onReady",value:function(){var t=window.visualViewport;t&&(this.viewport=t,this.startY=0,t.addEventListener("resize",this.onResize),this.updateViewport()),window.addEventListener("touchstart",this.onTouchstart,{passive:!1}),window.addEventListener("touchmove",this.onTouchmove,{passive:!1}),window.addEventListener("wheel",this.onWheel,{passive:!1})}},{key:"onResize",value:function(){this.updateViewport()}},{key:"updateViewport",value:function(){var t=this.fancybox,e=this.viewport,i=e.scale||1,n=t.$container;if(n){var o="",a="",s="";i-1>.1&&(o="".concat(e.width*i,"px"),a="".concat(e.height*i,"px"),s="translate3d(".concat(e.offsetLeft,"px, ").concat(e.offsetTop,"px, 0) scale(").concat(1/i,")")),n.style.width=o,n.style.height=a,n.style.transform=s}}},{key:"onTouchstart",value:function(t){this.startY=t.touches?t.touches[0].screenY:t.screenY}},{key:"onTouchmove",value:function(t){var e=this.startY,i=window.innerWidth/window.document.documentElement.clientWidth;if(t.cancelable&&!(t.touches.length>1||1!==i)){var n=C(t.composedPath()[0]);if(n){var o=window.getComputedStyle(n),a=parseInt(o.getPropertyValue("height"),10),s=t.touches?t.touches[0].screenY:t.screenY,r=e<=s&&0===n.scrollTop,l=e>=s&&n.scrollHeight-n.scrollTop===a;(r||l)&&t.preventDefault()}else t.preventDefault()}}},{key:"onWheel",value:function(t){C(t.composedPath()[0])||t.preventDefault()}},{key:"cleanup",value:function(){this.pendingUpdate&&(cancelAnimationFrame(this.pendingUpdate),this.pendingUpdate=null);var t=this.viewport;t&&(t.removeEventListener("resize",this.onResize),this.viewport=null),window.removeEventListener("touchstart",this.onTouchstart,!1),window.removeEventListener("touchmove",this.onTouchmove,!1),window.removeEventListener("wheel",this.onWheel,{passive:!1})}},{key:"attach",value:function(){this.fancybox.on("initLayout",this.onReady)}},{key:"detach",value:function(){this.fancybox.off("initLayout",this.onReady),this.cleanup()}}]),t}(),Y=function(){function t(e){o(this,t),this.fancybox=e,this.$container=null,this.state="init";for(var i=0,n=["onPrepare","onClosing","onKeydown"];i<n.length;i++){var a=n[i];this[a]=this[a].bind(this)}this.events={prepare:this.onPrepare,closing:this.onClosing,keydown:this.onKeydown}}return s(t,[{key:"onPrepare",value:function(){this.getSlides().length<this.fancybox.option("Thumbs.minSlideCount")?this.state="disabled":!0===this.fancybox.option("Thumbs.autoStart")&&this.fancybox.Carousel.Panzoom.content.height>=this.fancybox.option("Thumbs.minScreenHeight")&&this.build()}},{key:"onClosing",value:function(){this.Carousel&&this.Carousel.Panzoom.detachEvents()}},{key:"onKeydown",value:function(t,e){e===t.option("Thumbs.key")&&this.toggle()}},{key:"build",value:function(){var t=this;if(!this.$container){var e=document.createElement("div");e.classList.add("fancybox__thumbs"),this.fancybox.$carousel.parentNode.insertBefore(e,this.fancybox.$carousel.nextSibling),this.Carousel=new H(e,k(!0,{Dots:!1,Navigation:!1,Sync:{friction:0},infinite:!1,center:!0,fill:!0,dragFree:!0,slidesPerPage:1,preload:1},this.fancybox.option("Thumbs.Carousel"),{Sync:{target:this.fancybox.Carousel},slides:this.getSlides()})),this.Carousel.Panzoom.on("wheel",(function(e,i){i.preventDefault(),t.fancybox[i.deltaY<0?"prev":"next"]()})),this.$container=e,this.state="visible"}}},{key:"getSlides",value:function(){var t,e=[],i=x(this.fancybox.items);try{for(i.s();!(t=i.n()).done;){var n=t.value,o=n.thumb;o&&e.push({html:this.fancybox.option("Thumbs.tpl").replace(/\{\{src\}\}/gi,o),customClass:"has-thumb has-".concat(n.type||"image")})}}catch(t){i.e(t)}finally{i.f()}return e}},{key:"toggle",value:function(){"visible"===this.state?this.hide():"hidden"===this.state?this.show():this.build()}},{key:"show",value:function(){"hidden"===this.state&&(this.$container.style.display="",this.Carousel.Panzoom.attachEvents(),this.state="visible")}},{key:"hide",value:function(){"visible"===this.state&&(this.Carousel.Panzoom.detachEvents(),this.$container.style.display="none",this.state="hidden")}},{key:"cleanup",value:function(){this.Carousel&&(this.Carousel.destroy(),this.Carousel=null),this.$container&&(this.$container.remove(),this.$container=null),this.state="init"}},{key:"attach",value:function(){this.fancybox.on(this.events)}},{key:"detach",value:function(){this.fancybox.off(this.events),this.cleanup()}}]),t}();Y.defaults={minSlideCount:2,minScreenHeight:500,autoStart:!0,key:"t",Carousel:{},tpl:'<div class="fancybox__thumb" style="background-image:url(\'{{src}}\')"></div>'};var V=function(t,e){for(var i=new URL(t),n=new URLSearchParams(i.search),o=new URLSearchParams,a=0,s=[].concat(m(n),m(Object.entries(e)));a<s.length;a++){var r=g(s[a],2),l=r[0],c=r[1];"t"===l?o.set("start",parseInt(c)):o.set(l,c)}o=o.toString();var h=t.match(/#t=((.*)?\d+s)/);return h&&(o+="#t=".concat(h[1])),o},Z={video:{autoplay:!0,ratio:16/9},youtube:{autohide:1,fs:1,rel:0,hd:1,wmode:"transparent",enablejsapi:1,html5:1},vimeo:{hd:1,show_title:1,show_byline:1,show_portrait:0,fullscreen:1},html5video:{tpl:'<video class="fancybox__html5video" playsinline controls controlsList="nodownload" poster="{{poster}}">\n  <source src="{{src}}" type="{{format}}" />Sorry, your browser doesn\'t support embedded videos.</video>',format:""}}
24004,G=function(){function t(e){o(this,t),this.fancybox=e;for(var i=0,n=["onInit","onReady","onCreateSlide","onRemoveSlide","onSelectSlide","onUnselectSlide","onRefresh","onMessage"];i<n.length;i++){var a=n[i];this[a]=this[a].bind(this)}this.events={init:this.onInit,ready:this.onReady,"Carousel.createSlide":this.onCreateSlide,"Carousel.removeSlide":this.onRemoveSlide,"Carousel.selectSlide":this.onSelectSlide,"Carousel.unselectSlide":this.onUnselectSlide,"Carousel.refresh":this.onRefresh}}return s(t,[{key:"onInit",value:function(){var t,e=x(this.fancybox.items);try{for(e.s();!(t=e.n()).done;){var i=t.value;this.processType(i)}}catch(t){e.e(t)}finally{e.f()}}},{key:"processType",value:function(t){if(t.html)return t.src=t.html,t.type="html",void delete t.html;var e=t.src||"",i=t.type||this.fancybox.options.type,n=null;if(!e||"string"==typeof e){if(n=e.match(/(?:youtube\.com|youtu\.be|youtube\-nocookie\.com)\/(?:watch\?(?:.*&)?v=|v\/|u\/|embed\/?)?(videoseries\?list=(?:.*)|[\w-]{11}|\?listType=(?:.*)&list=(?:.*))(?:.*)/i)){var o=V(e,this.fancybox.option("Html.youtube")),a=encodeURIComponent(n[1]);t.videoId=a,t.src="https://www.youtube-nocookie.com/embed/".concat(a,"?").concat(o),t.thumb=t.thumb||"https://i.ytimg.com/vi/".concat(a,"/mqdefault.jpg"),t.vendor="youtube",i="video"}else if(n=e.match(/^.+vimeo.com\/(?:\/)?([\d]+)(.*)?/)){var s=V(e,this.fancybox.option("Html.vimeo")),r=encodeURIComponent(n[1]);t.videoId=r,t.src="https://player.vimeo.com/video/".concat(r,"?").concat(s),t.vendor="vimeo",i="video"}else(n=e.match(/(?:maps\.)?google\.([a-z]{2,3}(?:\.[a-z]{2})?)\/(?:(?:(?:maps\/(?:place\/(?:.*)\/)?\@(.*),(\d+.?\d+?)z))|(?:\?ll=))(.*)?/i))?(t.src="//maps.google.".concat(n[1],"/?ll=").concat((n[2]?n[2]+"&z="+Math.floor(n[3])+(n[4]?n[4].replace(/^\//,"&"):""):n[4]+"").replace(/\?/,"&"),"&output=").concat(n[4]&&n[4].indexOf("layer=c")>0?"svembed":"embed"),i="map"):(n=e.match(/(?:maps\.)?google\.([a-z]{2,3}(?:\.[a-z]{2})?)\/(?:maps\/search\/)(.*)/i))&&(t.src="//maps.google.".concat(n[1],"/maps?q=").concat(n[2].replace("query=","q=").replace("api=1",""),"&output=embed"),i="map");i||("#"===e.charAt(0)?i="inline":(n=e.match(/\.(mp4|mov|ogv|webm)((\?|#).*)?$/i))?(i="html5video",t.format=t.format||"video/"+("ogv"===n[1]?"ogg":n[1])):e.match(/(^data:image\/[a-z0-9+\/=]*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg|ico)((\?|#).*)?$)/i)?i="image":e.match(/\.(pdf)((\?|#).*)?$/i)&&(i="pdf")),t.type=i||this.fancybox.option("defaultType","image"),"html5video"!==i&&"video"!==i||(t.video=k({},this.fancybox.option("Html.video"),t.video),t._width&&t._height?t.ratio=parseFloat(t._width)/parseFloat(t._height):t.ratio=t.ratio||t.video.ratio||Z.video.ratio)}}},{key:"onReady",value:function(){var t=this;this.fancybox.Carousel.slides.forEach((function(e){e.$el&&(t.setContent(e),e.index===t.fancybox.getSlide().index&&t.playVideo(e))}))}},{key:"onCreateSlide",value:function(t,e,i){"ready"===this.fancybox.state&&this.setContent(i)}},{key:"loadInlineContent",value:function(t){var e;if(t.src instanceof HTMLElement)e=t.src;else if("string"==typeof t.src){var i=t.src.split("#",2),n=2===i.length&&""===i[0]?i[1]:i[0];e=document.getElementById(n)}if(e){if("clone"===t.type||e.$placeHolder){var o=(e=e.cloneNode(!0)).getAttribute("id");o=o?"".concat(o,"--clone"):"clone-".concat(this.fancybox.id,"-").concat(t.index),e.setAttribute("id",o)}else{var a=document.createElement("div");a.classList.add("fancybox-placeholder"),e.parentNode.insertBefore(a,e),e.$placeHolder=a}this.fancybox.setContent(t,e)}else this.fancybox.setError(t,"{{ELEMENT_NOT_FOUND}}")}},{key:"loadAjaxContent",value:function(t){var e=this.fancybox,i=new XMLHttpRequest;e.showLoading(t),i.onreadystatechange=function(){i.readyState===XMLHttpRequest.DONE&&"ready"===e.state&&(e.hideLoading(t),200===i.status?e.setContent(t,i.responseText):e.setError(t,404===i.status?"{{AJAX_NOT_FOUND}}":"{{AJAX_FORBIDDEN}}"))};var n=t.ajax||null;i.open(n?"POST":"GET",t.src),i.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),i.setRequestHeader("X-Requested-With","XMLHttpRequest"),i.send(n),t.xhr=i}},{key:"loadIframeContent",value:function(t){var e=this,i=this.fancybox,n=document.createElement("iframe");
24004if(n.className="fancybox__iframe",n.setAttribute("id","fancybox__iframe_".concat(i.id,"_").concat(t.index)),n.setAttribute("allow","autoplay; fullscreen"),n.setAttribute("scrolling","auto"),t.$iframe=n,"iframe"!==t.type||!1===t.preload)return n.setAttribute("src",t.src),this.fancybox.setContent(t,n),void this.resizeIframe(t);i.showLoading(t);var o=document.createElement("div");o.style.visibility="hidden",this.fancybox.setContent(t,o),o.appendChild(n),n.onerror=function(){i.setError(t,"{{IFRAME_ERROR}}")},n.onload=function(){i.hideLoading(t);var o=!1;n.isReady||(n.isReady=!0,o=!0),n.src.length&&(n.parentNode.style.visibility="",e.resizeIframe(t),o&&i.revealContent(t))},n.setAttribute("src",t.src)}},{key:"setAspectRatio",value:function(t){var e=t.$content,i=t.ratio;if(e){var n=t._width,o=t._height;if(i||n&&o){Object.assign(e.style,{width:n&&o?"100%":"",height:n&&o?"100%":"",maxWidth:"",maxHeight:""});var a=e.offsetWidth,s=e.offsetHeight;if(o=o||s,(n=n||a)>a||o>s){var r=Math.min(a/n,s/o);n*=r,o*=r}Math.abs(n/o-i)>.01&&(i<n/o?n=o*i:o=n/i),Object.assign(e.style,{width:"".concat(n,"px"),height:"".concat(o,"px")})}}}},{key:"resizeIframe",value:function(t){var e=t.$iframe;if(e){var i=t._width||0,n=t._height||0;i&&n&&(t.autoSize=!1);var o=e.parentNode,a=o&&o.style;if(!1!==t.preload&&!1!==t.autoSize&&a)try{var s=window.getComputedStyle(o),r=parseFloat(s.paddingLeft)+parseFloat(s.paddingRight),l=parseFloat(s.paddingTop)+parseFloat(s.paddingBottom),c=e.contentWindow.document,h=c.getElementsByTagName("html")[0],d=c.body;a.width="",d.style.overflow="hidden",i=i||h.scrollWidth+r,a.width="".concat(i,"px"),d.style.overflow="",a.flex="0 0 auto",a.height="".concat(d.scrollHeight,"px"),n=h.scrollHeight+l}catch(t){}if(i||n){var u={flex:"0 1 auto"};i&&(u.width="".concat(i,"px")),n&&(u.height="".concat(n,"px")),Object.assign(a,u)}}}},{key:"onRefresh",value:function(t,e){var i=this;e.slides.forEach((function(t){t.$el&&(t.$iframe&&i.resizeIframe(t),t.ratio&&i.setAspectRatio(t))}))}},{key:"setContent",value:function(t){if(t&&!t.isDom){switch(t.type){case"html":this.fancybox.setContent(t,t.src);break;case"html5video":this.fancybox.setContent(t,this.fancybox.option("Html.html5video.tpl").replace(/\{\{src\}\}/gi,t.src).replace("{{format}}",t.format||t.html5video&&t.html5video.format||"").replace("{{poster}}",t.poster||t.thumb||""));break;case"inline":case"clone":this.loadInlineContent(t);break;case"ajax":this.loadAjaxContent(t);break;case"pdf":case"video":case"map":t.preload=!1;case"iframe":this.loadIframeContent(t)}t.ratio&&this.setAspectRatio(t)}}},{key:"onSelectSlide",value:function(t,e,i){"ready"===t.state&&this.playVideo(i)}},{key:"playVideo",value:function(t){if("html5video"===t.type&&t.video.autoplay)try{var e=t.$el.querySelector("video");if(e){var i=e.play();void 0!==i&&i.then((function(){})).catch((function(t){e.muted=!0,e.play()}))}}catch(t){}if("video"===t.type&&t.$iframe&&t.$iframe.contentWindow){!function e(){if("done"===t.state&&t.$iframe&&t.$iframe.contentWindow){var i;if(t.$iframe.isReady)return t.video&&t.video.autoplay&&(i="youtube"==t.vendor?{event:"command",func:"playVideo"}:{method:"play",value:"true"}),void(i&&t.$iframe.contentWindow.postMessage(JSON.stringify(i),"*"));"youtube"===t.vendor&&(i={event:"listening",id:t.$iframe.getAttribute("id")},t.$iframe.contentWindow.postMessage(JSON.stringify(i),"*"))}t.poller=setTimeout(e,250)}()}}},{key:"onUnselectSlide",value:function(t,e,i){if("html5video"!==i.type){var n=!1;"vimeo"==i.vendor?n={method:"pause",value:"true"}:"youtube"===i.vendor&&(n={event:"command",func:"pauseVideo"}),n&&i.$iframe&&i.$iframe.contentWindow&&i.$iframe.contentWindow.postMessage(JSON.stringify(n),"*"),clearTimeout(i.poller)}else try{i.$el.querySelector("video").pause()}catch(t){}}},{key:"onRemoveSlide",value:function(t,e,i){i.xhr&&(i.xhr.abort(),i.xhr=null),i.$iframe&&(i.$iframe.onload=i.$iframe.onerror=null,i.$iframe.src="//about:blank",i.$iframe=null);var n=i.$content;"inline"===i.type&&n&&(n.classList.remove("fancybox__content"),"none"!==n.style.display&&(n.style.display="none")),i.$closeButton&&(i.$closeButton.remove(),i.$closeButton=null);var o=n&&n.$placeHolder;o&&(o.parentNode.insertBefore(n,o),o.remove(),n.$placeHolder=null)}},{key:"onMessage",value:function(t){try{var e=JSON.parse(t.data);if("https://player.vimeo.com"===t.origin){if("ready"===e.event){var i,n=x(document.getElementsByClassName("fancybox__iframe"));try{for(n.s();!(i=n.n()).done;){var o=i.value;o.contentWindow===t.source&&(o.isReady=1)}}catch(t){n.e(t)}finally{n.f()}}}else"https://www.youtube-nocookie.com"===t.origin&&"onReady"===e.event&&(document.getElementById(e.id).isReady=1)}catch(t){}}},{key:"attach",value:function(){this.fancybox.on(this.events),window.addEventListener("message",this.onMessage,!1)}},{key:"detach",value:function(){this.fancybox.off(this.events),window.removeEventListener("message",this.onMessage,!1)}}]),t}();G.defaults=Z;var K=function(){function t(e){o(this,t),this.fancybox=e;for(var i=0,n=["onReady","onClosing","onDone","onPageChange","onCreateSlide","onRemoveSlide","onImageStatusChange"];
24004i<n.length;i++){var a=n[i];this[a]=this[a].bind(this)}this.events={ready:this.onReady,closing:this.onClosing,done:this.onDone,"Carousel.change":this.onPageChange,"Carousel.createSlide":this.onCreateSlide,"Carousel.removeSlide":this.onRemoveSlide}}return s(t,[{key:"onReady",value:function(){var t=this;this.fancybox.Carousel.slides.forEach((function(e){e.$el&&t.setContent(e)}))}},{key:"onDone",value:function(t,e){this.handleCursor(e)}},{key:"onClosing",value:function(t){clearTimeout(this.clickTimer),this.clickTimer=null,t.Carousel.slides.forEach((function(t){t.$image&&(t.state="destroy"),t.Panzoom&&t.Panzoom.detachEvents()})),"closing"===this.fancybox.state&&this.canZoom(t.getSlide())&&this.zoomOut()}},{key:"onCreateSlide",value:function(t,e,i){"ready"===this.fancybox.state&&this.setContent(i)}},{key:"onRemoveSlide",value:function(t,e,i){i.$image&&(i.$el.classList.remove(t.option("Image.canZoomInClass")),i.$image.remove(),i.$image=null),i.Panzoom&&(i.Panzoom.destroy(),i.Panzoom=null),i.$el&&i.$el.dataset&&delete i.$el.dataset.imageFit}},{key:"setContent",value:function(t){var e=this;if(!(t.isDom||t.html||t.type&&"image"!==t.type||t.$image)){t.type="image",t.state="loading";var i=document.createElement("div");i.style.visibility="hidden";var n=document.createElement("img");n.addEventListener("load",(function(i){i.stopImmediatePropagation(),e.onImageStatusChange(t)})),n.addEventListener("error",(function(){e.onImageStatusChange(t)})),n.src=t.src,n.alt="",n.draggable=!1,n.classList.add("fancybox__image"),t.srcset&&n.setAttribute("srcset",t.srcset),t.sizes&&n.setAttribute("sizes",t.sizes),t.$image=n;var o=this.fancybox.option("Image.wrap");if(o){var a=document.createElement("div");a.classList.add("string"==typeof o?o:"fancybox__image-wrap"),a.appendChild(n),i.appendChild(a),t.$wrap=a}else i.appendChild(n);t.$el.dataset.imageFit=this.fancybox.option("Image.fit"),this.fancybox.setContent(t,i),n.complete||n.error?this.onImageStatusChange(t):this.fancybox.showLoading(t)}}},{key:"onImageStatusChange",value:function(t){var e=this,i=t.$image;i&&"loading"===t.state&&(i.complete&&i.naturalWidth&&i.naturalHeight?(this.fancybox.hideLoading(t),"contain"===this.fancybox.option("Image.fit")&&this.initSlidePanzoom(t),t.$el.addEventListener("wheel",(function(i){return e.onWheel(t,i)}),{passive:!1}),t.$content.addEventListener("click",(function(i){return e.onClick(t,i)}),{passive:!1}),this.revealContent(t)):this.fancybox.setError(t,"{{IMAGE_ERROR}}"))}},{key:"initSlidePanzoom",value:function(t){var e=this;t.Panzoom||(t.Panzoom=new M(t.$el,k(!0,this.fancybox.option("Image.Panzoom",{}),{viewport:t.$wrap,content:t.$image,width:t._width,height:t._height,wrapInner:!1,textSelection:!0,touch:this.fancybox.option("Image.touch"),panOnlyZoomed:!0,click:!1,wheel:!1})),t.Panzoom.on("startAnimation",(function(){e.fancybox.trigger("Image.startAnimation",t)})),t.Panzoom.on("endAnimation",(function(){"zoomIn"===t.state&&e.fancybox.done(t),e.handleCursor(t),e.fancybox.trigger("Image.endAnimation",t)})),t.Panzoom.on("afterUpdate",(function(){e.handleCursor(t),e.fancybox.trigger("Image.afterUpdate",t)})))}},{key:"revealContent",value:function(t){null===this.fancybox.Carousel.prevPage&&t.index===this.fancybox.options.startIndex&&this.canZoom(t)?this.zoomIn():this.fancybox.revealContent(t)}},{key:"getZoomInfo",value:function(t){var e=t.$thumb.getBoundingClientRect(),i=e.width,n=e.height,o=t.$content.getBoundingClientRect(),a=o.width,s=o.height,r=o.top-e.top,l=o.left-e.left,c=this.fancybox.option("Image.zoomOpacity");return"auto"===c&&(c=Math.abs(i/n-a/s)>.1),{top:r,left:l,scale:a&&i?i/a:1,opacity:c}}},{key:"canZoom",value:function(t){var e=this.fancybox,i=e.$container;if(window.visualViewport&&1!==window.visualViewport.scale)return!1;if(t.Panzoom&&!t.Panzoom.content.width)return!1;if(!e.option("Image.zoom")||"contain"!==e.option("Image.fit"))return!1;var n=t.$thumb;if(!n||"loading"===t.state)return!1;i.classList.add("fancybox__no-click");var o,a=n.getBoundingClientRect();if(this.fancybox.option("Image.ignoreCoveredThumbnail")){var s=document.elementFromPoint(a.left+1,a.top+1)===n,r=document.elementFromPoint(a.right-1,a.bottom-1)===n;o=s&&r}else o=document.elementFromPoint(a.left+.5*a.width,a.top+.5*a.height)===n;return i.classList.remove("fancybox__no-click"),o}},{key:"zoomIn",value:function(){var t=this.fancybox,e=t.getSlide(),i=e.Panzoom,n=this.getZoomInfo(e),o=n.top,a=n.left,s=n.scale,r=n.opacity;t.trigger("reveal",e),i.panTo({x:-1*a,y:-1*o,scale:s,friction:0,ignoreBounds:!0}),e.$content.style.visibility="",e.state="zoomIn",!0===r&&i.on("afterTransform",(function(t){"zoomIn"!==e.state&&"zoomOut"!==e.state||(t.$content.style.opacity=Math.min(1,1-(1-t.content.scale)/(1-s)))})),i.panTo({x:0,y:0,scale:1,friction:this.fancybox.option("Image.zoomFriction")})}},{key:"zoomOut",value:function(){var t=this,e=this.fancybox,i=e.getSlide(),n=i.Panzoom;if(n){i.state="zoomOut",e.state="customClosing",i.$caption&&(i.$caption.style.visibility="hidden");var o=this.fancybox.option("Image.zoomFriction"),a=function(e){var a=t.getZoomInfo(i),s=a.top,r=a.left,l=a.scale,c=a.opacity;e||c||(o*=.82),n.panTo({x:-1*r,y:-1*s,scale:l,friction:o,ignoreBounds:!0}),o*=.98};window.addEventListener("scroll",a),n.once("endAnimation",(function(){window.removeEventListener("scroll",a),e.destroy()})),a()}}},{key:"handleCursor",value:function(t){if("image"===t.type&&t.$el){var e=t.Panzoom,i=this.fancybox.option("Image.click",!1,t),n=this.fancybox.option("Image.touch"),o=t.$el.classList,a=this.fancybox.option("Image.canZoomInClass"),s=this.fancybox.option("Image.canZoomOutClass");if(o.remove(s),o.remove(a),e&&"toggleZoom"===i)e&&1===e.content.scale&&e.option("maxScale")-e.content.scale>.01?o.add(a):e.content.scale>1&&!n&&o.add(s);else"close"===i&&o.add(s)}}},{key:"onWheel",value:function(t,e){if("ready"===this.fancybox.state&&!1!==this.fancybox.trigger("Image.
24004wheel",e))switch(this.fancybox.option("Image.wheel")){case"zoom":"done"===t.state&&t.Panzoom&&t.Panzoom.zoomWithWheel(e);break;case"close":this.fancybox.close();break;case"slide":this.fancybox[e.deltaY<0?"prev":"next"]()}}},{key:"onClick",value:function(t,e){var i=this;if("ready"===this.fancybox.state){var n=t.Panzoom;if(!n||!n.dragPosition.midPoint&&0===n.dragOffset.x&&0===n.dragOffset.y&&1===n.dragOffset.scale){if(this.fancybox.Carousel.Panzoom.lockAxis)return!1;var o=function(n){switch(n){case"toggleZoom":e.stopPropagation(),t.Panzoom&&t.Panzoom.zoomWithClick(e);break;case"close":i.fancybox.close();break;case"next":e.stopPropagation(),i.fancybox.next()}},a=this.fancybox.option("Image.click"),s=this.fancybox.option("Image.doubleClick");s?this.clickTimer?(clearTimeout(this.clickTimer),this.clickTimer=null,o(s)):this.clickTimer=setTimeout((function(){i.clickTimer=null,o(a)}),300):o(a)}}}},{key:"onPageChange",value:function(t,e){var i=t.getSlide();e.slides.forEach((function(t){t.Panzoom&&"done"===t.state&&t.index!==i.index&&t.Panzoom.panTo({x:0,y:0,scale:1,friction:.8})}))}},{key:"attach",value:function(){this.fancybox.on(this.events)}},{key:"detach",value:function(){this.fancybox.off(this.events)}}]),t}();K.defaults={canZoomInClass:"can-zoom_in",canZoomOutClass:"can-zoom_out",zoom:!0,zoomOpacity:"auto",zoomFriction:.82,ignoreCoveredThumbnail:!1,touch:!0,click:"toggleZoom",doubleClick:null,wheel:"zoom",fit:"contain",wrap:!1,Panzoom:{ratio:1}};var J=function(){function t(e){o(this,t),this.fancybox=e;for(var i=0,n=["onChange","onClosing"];i<n.length;i++){var a=n[i];this[a]=this[a].bind(this)}this.events={initCarousel:this.onChange,"Carousel.change":this.onChange,closing:this.onClosing},this.hasCreatedHistory=!1,this.origHash="",this.timer=null}return s(t,[{key:"onChange",value:function(t){var e=this,i=t.Carousel;this.timer&&clearTimeout(this.timer);var n=null===i.prevPage,o=t.getSlide(),a=new URL(document.URL).hash,s=!1;if(o.slug)s="#"+o.slug;else{var r=o.$trigger&&o.$trigger.dataset,l=t.option("slug")||r&&r.fancybox;l&&l.length&&"true"!==l&&(s="#"+l+(i.slides.length>1?"-"+(o.index+1):""))}n&&(this.origHash=a!==s?a:""),s&&a!==s&&(this.timer=setTimeout((function(){try{window.history[n?"pushState":"replaceState"]({},document.title,window.location.pathname+window.location.search+s),n&&(e.hasCreatedHistory=!0)}catch(t){}}),300))}},{key:"onClosing",value:function(){if(this.timer&&clearTimeout(this.timer),!0!==this.hasSilentClose)try{return void window.history.replaceState({},document.title,window.location.pathname+window.location.search+(this.origHash||""))}catch(t){}}},{key:"attach",value:function(t){t.on(this.events)}},{key:"detach",value:function(t){t.off(this.events)}}],[{key:"startFromUrl",value:function(){var e=t.Fancybox;if(e&&!e.getInstance()&&!1!==e.defaults.Hash){var i=t.getParsedURL(),n=i.hash,o=i.slug,a=i.index;if(o){var s=document.querySelector('[data-slug="'.concat(n,'"]'));if(s&&s.dispatchEvent(new CustomEvent("click",{bubbles:!0,cancelable:!0})),!e.getInstance()){var r=document.querySelectorAll('[data-fancybox="'.concat(o,'"]'));r.length&&(null===a&&1===r.length?s=r[0]:a&&(s=r[a-1]),s&&s.dispatchEvent(new CustomEvent("click",{bubbles:!0,cancelable:!0})))}}}}},{key:"onHashChange",value:function(){var e=t.getParsedURL(),i=e.slug,n=e.index,o=t.Fancybox,a=o&&o.getInstance();if(a&&a.plugins.Hash){if(i){var s=a.Carousel;if(i===a.option("slug"))return s.slideTo(n-1);var r,l=x(s.slides);try{for(l.s();!(r=l.n()).done;){var c=r.value;if(c.slug&&c.slug===i)return s.slideTo(c.index)}}catch(t){l.e(t)}finally{l.f()}var h=a.getSlide(),d=h.$trigger&&h.$trigger.dataset;if(d&&d.fancybox===i)return s.slideTo(n-1)}a.plugins.Hash.hasSilentClose=!0,a.close()}t.startFromUrl()}},{key:"create",value:function(e){function i(){window.addEventListener("hashchange",t.onHashChange,!1),t.startFromUrl()}t.Fancybox=e,W&&window.requestAnimationFrame((function(){/complete|interactive|loaded/.test(document.readyState)?i():document.addEventListener("DOMContentLoaded",i)}))}},{key:"destroy",value:function(){window.removeEventListener("hashchange",t.onHashChange,!1)}},{key:"getParsedURL",value:function(){var t=window.location.hash.substr(1),e=t.split("-"),i=e.length>1&&/^\+?\d+$/.test(e[e.length-1])&&parseInt(e.pop(-1),10)||null;return{hash:t,slug:e.join("-"),index:i}}}]),t}(),Q={pageXOffset:0,pageYOffset:0,element:function(){return document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement},activate:function(t){Q.pageXOffset=window.pageXOffset,Q.pageYOffset=window.pageYOffset,t.requestFullscreen?t.requestFullscreen():t.mozRequestFullScreen?t.mozRequestFullScreen():t.webkitRequestFullscreen?t.webkitRequestFullscreen():t.msRequestFullscreen&&t.msRequestFullscreen()},deactivate:function(){document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()}},tt=function(){function t(e){o(this,t),this.fancybox=e,this.active=!1,this.handleVisibilityChange=this.handleVisibilityChange.bind(this)}return s(t,[{key:"isActive",value:function(){return this.active}},{key:"setTimer",value:function(){var t=this;if(this.active&&!this.timer){var e=this.fancybox.option("slideshow.delay",3e3);this.timer=setTimeout((function(){t.timer=null,t.fancybox.option("infinite")||t.fancybox.getSlide().index!==t.fancybox.Carousel.slides.length-1?t.fancybox.next():t.fancybox.jumpTo(0,{friction:0})}),e);var i=this.$progress;i||((i=document.createElement("div")).classList.add("fancybox__progress"),this.fancybox.$carousel.parentNode.insertBefore(i,this.fancybox.$carousel),this.$progress=i,i.offsetHeight),i.style.transitionDuration="".concat(e,"ms"),i.style.transform="scaleX(1)"}}},{key:"clearTimer",value:function(){clearTimeout(this.timer),this.timer=null,this.$progress&&(this.$progress.style.transitionDuration="",this.$progress.style.transform="",this.$progress.offsetHeight)}},{key:"activate",value:function(){this.active||(this.active=!0,this.fancybox.$container.classList.add("has-slideshow"),"done"===this.fancybox.getSlide().state&&this.setTimer(),document.addEventListener("visibilitychange",this.handleVisibilityChange,!1))}},{key:"handleVisibilityChange",value:function(){this.deactivate()}},{key:"deactivate",value:function(){this.active=!1,this.clearTimer(),this.fancybox.$container.classList.remove("has-slideshow"),document.removeEventListener("visibilitychange",this.handleVisibilityChange,!1)}},{key:"toggle",value:function(){this.active?this.deactivate():this.fancybox.Carousel.slides.length>1&&this.activate()}}]),t}(),et={display:["counter","zoom","slideshow","fullscreen","thumbs","close"],autoEnable:!0,items:{counter:{position:"left",type:"div",class:"fancybox__counter",html:'<span data-fancybox-index=""></span>&nbsp;/&nbsp;<span data-fancybox-count=""></span>',attr:{tabindex:-1}},prev:{type:"button",class:"fancybox__button--prev",label:"PREV",html:'<svg viewBox="0 0 24 24">
24004<path d="M15 4l-8 8 8 8"/></svg>',attr:{"data-fancybox-prev":""}},next:{type:"button",class:"fancybox__button--next",label:"NEXT",html:'<svg viewBox="0 0 24 24"><path d="M8 4l8 8-8 8"/></svg>',attr:{"data-fancybox-next":""}},fullscreen:{type:"button",class:"fancybox__button--fullscreen",label:"TOGGLE_FULLSCREEN",html:'<svg viewBox="0 0 24 24">\n                <g><path d="M3 8 V3h5"></path><path d="M21 8V3h-5"></path><path d="M8 21H3v-5"></path><path d="M16 21h5v-5"></path></g>\n                <g><path d="M7 2v5H2M17 2v5h5M2 17h5v5M22 17h-5v5"/></g>\n            </svg>',click:function(t){t.preventDefault(),Q.element()?Q.deactivate():Q.activate(this.fancybox.$container)}},slideshow:{type:"button",class:"fancybox__button--slideshow",label:"TOGGLE_SLIDESHOW",html:'<svg viewBox="0 0 24 24">\n                <g><path d="M6 4v16"/><path d="M20 12L6 20"/><path d="M20 12L6 4"/></g>\n                <g><path d="M7 4v15M17 4v15"/></g>\n            </svg>',click:function(t){t.preventDefault(),this.Slideshow.toggle()}},zoom:{type:"button",class:"fancybox__button--zoom",label:"TOGGLE_ZOOM",html:'<svg viewBox="0 0 24 24"><circle cx="10" cy="10" r="7"></circle><path d="M16 16 L21 21"></svg>',click:function(t){t.preventDefault();var e=this.fancybox.getSlide().Panzoom;e&&e.toggleZoom()}},download:{type:"link",label:"DOWNLOAD",class:"fancybox__button--download",html:'<svg viewBox="0 0 24 24"><path d="M12 15V3m0 12l-4-4m4 4l4-4M2 17l.62 2.48A2 2 0 004.56 21h14.88a2 2 0 001.94-1.51L22 17"/></svg>',click:function(t){t.stopPropagation()}},thumbs:{type:"button",label:"TOGGLE_THUMBS",class:"fancybox__button--thumbs",html:'<svg viewBox="0 0 24 24"><circle cx="4" cy="4" r="1" /><circle cx="12" cy="4" r="1" transform="rotate(90 12 4)"/><circle cx="20" cy="4" r="1" transform="rotate(90 20 4)"/><circle cx="4" cy="12" r="1" transform="rotate(90 4 12)"/><circle cx="12" cy="12" r="1" transform="rotate(90 12 12)"/><circle cx="20" cy="12" r="1" transform="rotate(90 20 12)"/><circle cx="4" cy="20" r="1" transform="rotate(90 4 20)"/><circle cx="12" cy="20" r="1" transform="rotate(90 12 20)"/><circle cx="20" cy="20" r="1" transform="rotate(90 20 20)"/></svg>',click:function(t){t.stopPropagation();var e=this.fancybox.plugins.Thumbs;e&&e.toggle()}},close:{type:"button",label:"CLOSE",class:"fancybox__button--close",html:'<svg viewBox="0 0 24 24"><path d="M20 20L4 4m16 0L4 20"></path></svg>',attr:{"data-fancybox-close":"",tabindex:0}}}},it=function(){function t(e){var i=this;o(this,t),this.fancybox=e,this.$container=null,this.state="init";for(var n=0,a=["onInit","onPrepare","onDone","onKeydown","onClosing","onChange","onSettle","onRefresh"];n<a.length;n++){var s=a[n];this[s]=this[s].bind(this)}this.events={init:this.onInit,prepare:this.onPrepare,done:this.onDone,keydown:this.onKeydown,closing:this.onClosing,"Carousel.change":this.onChange,"Carousel.settle":this.onSettle,"Carousel.Panzoom.touchStart":function(){return i.onRefresh()},"Image.startAnimation":function(t,e){return i.onRefresh(e)},"Image.afterUpdate":function(t,e){return i.onRefresh(e)}}}return s(t,[{key:"onInit",value:function(){if(this.fancybox.option("Toolbar.autoEnable")){var t,e=!1,i=x(this.fancybox.items);try{for(i.s();!(t=i.n()).done;){if("image"===t.value.type){e=!0;break}}}catch(t){i.e(t)}finally{i.f()}if(!e)return void(this.state="disabled")}var n,o=x(this.fancybox.option("Toolbar.display"));try{for(o.s();!(n=o.n()).done;){var a=n.value;if("close"===(w(a)?a.id:a)){this.fancybox.options.closeButton=!1;break}}}catch(t){o.e(t)}finally{o.f()}}},{key:"onPrepare",value:function(){var t=this.fancybox;if("init"===this.state&&(this.build(),this.update(),this.Slideshow=new tt(t),!t.Carousel.prevPage&&(t.option("slideshow.autoStart")&&this.Slideshow.activate(),t.option("fullscreen.autoStart")&&!Q.element())))try{Q.activate(t.$container)}catch(t){}}},{key:"onFsChange",value:function(){window.scrollTo(Q.pageXOffset,Q.pageYOffset)}},{key:"onSettle",value:function(){var t=this.fancybox,e=this.Slideshow;e&&e.isActive()&&(t.getSlide().index!==t.Carousel.slides.length-1||t.option("infinite")?"done"===t.getSlide().state&&e.setTimer():e.deactivate())}},{key:"onChange",value:function(){this.update(),this.Slideshow&&this.Slideshow.isActive()&&this.Slideshow.clearTimer()}},{key:"onDone",value:function(t,e){var i=this.Slideshow;e.index===t.getSlide().index&&(this.update(),i&&i.isActive()&&(t.option("infinite")||e.index!==t.Carousel.slides.length-1?i.setTimer():i.deactivate()))}},{key:"onRefresh",value:function(t){t&&t.index!==this.fancybox.getSlide().index||(this.update(),!this.Slideshow||!this.Slideshow.isActive()||t&&"done"!==t.state||this.Slideshow.deactivate())}}
24004,{key:"onKeydown",value:function(t,e,i){" "===e&&this.Slideshow&&(this.Slideshow.toggle(),i.preventDefault())}},{key:"onClosing",value:function(){this.Slideshow&&this.Slideshow.deactivate(),document.removeEventListener("fullscreenchange",this.onFsChange)}},{key:"createElement",value:function(t){var e,i;("div"===t.type?e=document.createElement("div"):(e=document.createElement("link"===t.type?"a":"button")).classList.add("carousel__button"),e.innerHTML=t.html,e.setAttribute("tabindex",t.tabindex||0),t.class)&&(i=e.classList).add.apply(i,m(t.class.split(" ")));for(var n in t.attr)e.setAttribute(n,t.attr[n]);t.label&&e.setAttribute("title",this.fancybox.localize("{{".concat(t.label,"}}"))),t.click&&e.addEventListener("click",t.click.bind(this)),"prev"===t.id&&e.setAttribute("data-fancybox-prev",""),"next"===t.id&&e.setAttribute("data-fancybox-next","");var o=e.querySelector("svg");return o&&(o.setAttribute("role","img"),o.setAttribute("tabindex","-1"),o.setAttribute("xmlns","http://www.w3.org/2000/svg")),e}},{key:"build",value:function(){var t=this;this.cleanup();var e,i=this.fancybox.option("Toolbar.items"),n=[{position:"left",items:[]},{position:"center",items:[]},{position:"right",items:[]}],o=this.fancybox.plugins.Thumbs,a=x(this.fancybox.option("Toolbar.display"));try{var s=function(){var a=e.value,s=void 0,r=void 0;if(w(a)?(s=a.id,r=k({},i[s],a)):r=i[s=a],["counter","next","prev","slideshow"].includes(s)&&t.fancybox.items.length<2)return"continue";if("fullscreen"===s){if(!document.fullscreenEnabled||window.fullScreen)return"continue";document.addEventListener("fullscreenchange",t.onFsChange)}if("thumbs"===s&&(!o||"disabled"===o.state))return"continue";if(!r)return"continue";var l=r.position||"right",c=n.find((function(t){return t.position===l}));c&&c.items.push(r)};for(a.s();!(e=a.n()).done;)s()}catch(t){a.e(t)}finally{a.f()}var r=document.createElement("div");r.classList.add("fancybox__toolbar");for(var l=0,c=n;l<c.length;l++){var h=c[l];if(h.items.length){var d=document.createElement("div");d.classList.add("fancybox__toolbar__items"),d.classList.add("fancybox__toolbar__items--".concat(h.position));var u,f=x(h.items);try{for(f.s();!(u=f.n()).done;){var v=u.value;d.appendChild(this.createElement(v))}}catch(t){f.e(t)}finally{f.f()}r.appendChild(d)}}this.fancybox.$carousel.parentNode.insertBefore(r,this.fancybox.$carousel),this.$container=r}},{key:"update",value:function(){var t,e=this.fancybox.getSlide(),i=e.index,n=this.fancybox.items.length,o=e.downloadSrc||("image"!==e.type||e.error?null:e.src),a=x(this.fancybox.$container.querySelectorAll("a.fancybox__button--download"));try{for(a.s();!(t=a.n()).done;){var s=t.value;o?(s.removeAttribute("disabled"),s.removeAttribute("tabindex"),s.setAttribute("href",o),s.setAttribute("download",o),s.setAttribute("target","_blank")):(s.setAttribute("disabled",""),s.setAttribute("tabindex",-1),s.removeAttribute("href"),s.removeAttribute("download"))}}catch(t){a.e(t)}finally{a.f()}var r,l=e.Panzoom,c=l&&l.option("maxScale")>l.option("baseScale"),h=x(this.fancybox.$container.querySelectorAll(".fancybox__button--zoom"));try{for(h.s();!(r=h.n()).done;){var d=r.value;c?d.removeAttribute("disabled"):d.setAttribute("disabled","")}}catch(t){h.e(t)}finally{h.f()}var u,f=x(this.fancybox.$container.querySelectorAll("[data-fancybox-index]"));try{for(f.s();!(u=f.n()).done;){u.value.innerHTML=e.index+1}}catch(t){f.e(t)}finally{f.f()}var v,p=x(this.fancybox.$container.querySelectorAll("[data-fancybox-count]"));try{for(p.s();!(v=p.n()).done;){v.value.innerHTML=n}}catch(t){p.e(t)}finally{p.f()}if(!this.fancybox.option("infinite")){var g,m=x(this.fancybox.$container.querySelectorAll("[data-fancybox-prev]"));try{for(m.s();!(g=m.n()).done;){var y=g.value;0===i?y.setAttribute("disabled",""):y.removeAttribute("disabled")}}catch(t){m.e(t)}finally{m.f()}var b,w=x(this.fancybox.$container.querySelectorAll("[data-fancybox-next]"));try{for(w.s();!(b=w.n()).done;){var k=b.value;i===n-1?k.setAttribute("disabled",""):k.removeAttribute("disabled")}}catch(t){w.e(t)}finally{w.f()}}}},{key:"cleanup",value:function(){this.Slideshow&&this.Slideshow.isActive()&&this.Slideshow.clearTimer(),this.$container&&this.$container.remove(),this.$container=null}},{key:"attach",value:function(){this.fancybox.on(this.events)}},{key:"detach",value:function(){this.fancybox.off(this.events),this.cleanup()}}]),t}();it.defaults=et;var nt={ScrollLock:U,Thumbs:Y,Html:G,Toolbar:it,Image:K,Hash:J},ot={startIndex:0,preload:1,infinite:!0,showClass:"fancybox-zoomInUp",hideClass:"fancybox-fadeOut",animated:!0,hideScrollbar:!0,parentEl:null,mainClass:null,autoFocus:!0,trapFocus:!0,placeFocusBack:!0,click:"close",closeButton:"inside",dragToClose:!0,keyboard:{Escape:"close",Delete:"close",Backspace:"close",PageUp:"next",PageDown:"prev",ArrowUp:"next",ArrowDown:"prev",ArrowRight:"next",ArrowLeft:"prev"},template:{closeButton:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" tabindex="-1">
24004<path d="M20 20L4 4m16 0L4 20"/></svg>',spinner:'<svg xmlns="http://www.w3.org/2000/svg" width="50" height="50" viewBox="25 25 50 50" tabindex="-1"><circle cx="50" cy="50" r="20"/></svg>',main:null},l10n:{CLOSE:"Close",NEXT:"Next",PREV:"Previous",MODAL:"You can close this modal content with the ESC key",ERROR:"Something Went Wrong, Please Try Again Later",IMAGE_ERROR:"Image Not Found",ELEMENT_NOT_FOUND:"HTML Element Not Found",AJAX_NOT_FOUND:"Error Loading AJAX : Not Found",AJAX_FORBIDDEN:"Error Loading AJAX : Forbidden",IFRAME_ERROR:"Error Loading Page",TOGGLE_ZOOM:"Toggle zoom level",TOGGLE_THUMBS:"Toggle thumbnails",TOGGLE_SLIDESHOW:"Toggle slideshow",TOGGLE_FULLSCREEN:"Toggle full-screen mode",DOWNLOAD:"Download"}},at=new Map,st=0,rt=function(t){l(i,t);var e=f(i);function i(t){var n,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return o(this,i),t=t.map((function(t){return t.width&&(t._width=t.width),t.height&&(t._height=t.height),t})),(n=e.call(this,k(!0,{},ot,a))).bindHandlers(),n.state="init",n.setItems(t),n.attachPlugins(i.Plugins),n.trigger("init"),!0===n.option("hideScrollbar")&&n.hideScrollbar(),n.initLayout(),n.initCarousel(),n.attachEvents(),at.set(n.id,d(n)),n.trigger("prepare"),n.state="ready",n.trigger("ready"),n.$container.setAttribute("aria-hidden","false"),n.option("trapFocus")&&n.focus(),n}return s(i,[{key:"option",value:function(t){for(var e,n=this.getSlide(),o=n?n[t]:void 0,a=arguments.length,s=new Array(a>1?a-1:0),r=1;r<a;r++)s[r-1]=arguments[r];if(void 0!==o){var l;if("function"==typeof o)o=(l=o).call.apply(l,[this,this].concat(s));return o}return(e=p(c(i.prototype),"option",this)).call.apply(e,[this,t].concat(s))}},{key:"bindHandlers",value:function(){for(var t=0,e=["onMousedown","onKeydown","onClick","onFocus","onCreateSlide","onSettle","onTouchMove","onTouchEnd","onTransform"];t<e.length;t++){var i=e[t];this[i]=this[i].bind(this)}}},{key:"attachEvents",value:function(){document.addEventListener("mousedown",this.onMousedown),document.addEventListener("keydown",this.onKeydown,!0),this.option("trapFocus")&&document.addEventListener("focus",this.onFocus,!0),this.$container.addEventListener("click",this.onClick)}},{key:"detachEvents",value:function(){document.removeEventListener("mousedown",this.onMousedown),document.removeEventListener("keydown",this.onKeydown,!0),document.removeEventListener("focus",this.onFocus,!0),this.$container.removeEventListener("click",this.onClick)}},{key:"initLayout",value:function(){var t=this;this.$root=this.option("parentEl")||document.body;var e=this.option("template.main");e&&(this.$root.insertAdjacentHTML("beforeend",this.localize(e)),this.$container=this.$root.querySelector(".fancybox__container")),this.$container||(this.$container=document.createElement("div"),this.$root.appendChild(this.$container)),this.$container.onscroll=function(){return t.$container.scrollLeft=0,!1},Object.entries({class:"fancybox__container",role:"dialog",tabIndex:"-1","aria-modal":"true","aria-hidden":"true","aria-label":this.localize("{{MODAL}}")}).forEach((function(e){var i;return(i=t.$container).setAttribute.apply(i,m(e))})),this.option("animated")&&this.$container.classList.add("is-animated"),this.$backdrop=this.$container.querySelector(".fancybox__backdrop"),this.$backdrop||(this.$backdrop=document.createElement("div"),this.$backdrop.classList.add("fancybox__backdrop"),this.$container.appendChild(this.$backdrop)),this.$carousel=this.$container.querySelector(".fancybox__carousel"),this.$carousel||(this.$carousel=document.createElement("div"),this.$carousel.classList.add("fancybox__carousel"),this.$container.appendChild(this.$carousel)),this.$container.Fancybox=this,this.id=this.$container.getAttribute("id"),this.id||(this.id=this.options.id||++st,this.$container.setAttribute("id","fancybox-"+this.id));var i,n=this.option("mainClass");n&&(i=this.$container.classList).add.apply(i,m(n.split(" ")));return document.documentElement.classList.add("with-fancybox"),this.trigger("initLayout"),this}},{key:"setItems",value:function(t){var e,i=[],n=x(t);try{for(n.s();!(e=n.n()).done;){var o=e.value,a=o.$trigger;if(a){var s=a.dataset||{};o.src=s.src||a.getAttribute("href")||o.src,o.type=s.type||o.type,!o.src&&a instanceof HTMLImageElement&&(o.src=a.currentSrc||o.$trigger.src)}var r=o.$thumb;if(!r){var l=o.$trigger&&o.$trigger.origTarget;l&&(r=l instanceof HTMLImageElement?l:l.querySelector("img:not([aria-hidden])")),!r&&o.$trigger&&(r=o.$trigger instanceof HTMLImageElement?o.$trigger:o.$trigger.querySelector("img:not([aria-hidden])"))}o.$thumb=r||null;var c=o.thumb;!c&&r&&!(c=r.currentSrc||r.src)&&r.dataset&&(c=r.dataset.lazySrc||r.dataset.src),c||"image"!==o.type||(c=o.src),o.thumb=c||null,o.caption=o.caption||"",i.push(o)}}catch(t){n.e(t)}finally{n.f()}this.items=i}},{key:"initCarousel",value:function(){var t=this;return this.Carousel=new H(this.$carousel,k(!0,{},{prefix:"",classNames:{viewport:"fancybox__viewport",track:"fancybox__track",slide:"fancybox__slide"},textSelection:!0,preload:this.option("preload"),friction:.88,slides:this.items,initialPage:this.options.startIndex,slidesPerPage:1,infiniteX:this.option("infinite"),infiniteY:!0,l10n:this.option("l10n"),Dots:!1,Navigation:{classNames:{main:"fancybox__nav",button:"carousel__button",next:"is-next",prev:"is-prev"}},Panzoom:{textSelection:!0,panOnlyZoomed:function(){return t.Carousel&&t.Carousel.pages&&t.Carousel.pages.length<2&&!t.option("dragToClose")},lockAxis:function(){if(t.Carousel){var e="x";return t.option("dragToClose")&&(e+="y"),e}}},on:{"*":function(e){for(var i=arguments.length,n=new Array(i>1?i-1:0),o=1;o<i;o++)n[o-1]=arguments[o];
24004return t.trigger.apply(t,["Carousel.".concat(e)].concat(n))},init:function(e){return t.Carousel=e},createSlide:this.onCreateSlide,settle:this.onSettle}},this.option("Carousel"))),this.option("dragToClose")&&this.Carousel.Panzoom.on({touchMove:this.onTouchMove,afterTransform:this.onTransform,touchEnd:this.onTouchEnd}),this.trigger("initCarousel"),this}},{key:"onCreateSlide",value:function(t,e){var i=e.caption||"";if("function"==typeof this.options.caption&&(i=this.options.caption.call(this,this,this.Carousel,e)),"string"==typeof i&&i.length){var n=document.createElement("div"),o="fancybox__caption_".concat(this.id,"_").concat(e.index);n.className="fancybox__caption",n.innerHTML=i,n.setAttribute("id",o),e.$caption=e.$el.appendChild(n),e.$el.classList.add("has-caption"),e.$el.setAttribute("aria-labelledby",o)}}},{key:"onSettle",value:function(){this.option("autoFocus")&&this.focus()}},{key:"onFocus",value:function(t){this.isTopmost()&&this.focus(t)}},{key:"onClick",value:function(t){if(!t.defaultPrevented){var e=t.composedPath()[0];if(e.matches("[data-fancybox-close]"))return t.preventDefault(),void i.close(!1,t);if(e.matches("[data-fancybox-next]"))return t.preventDefault(),void i.next();if(e.matches("[data-fancybox-prev]"))return t.preventDefault(),void i.prev();var n=document.activeElement;if(n){if(n.closest("[contenteditable]"))return;e.matches(X)||n.blur()}if(!e.closest(".fancybox__content"))if(!getSelection().toString().length)if(!1!==this.trigger("click",t))switch(this.option("click")){case"close":this.close();break;case"next":this.next()}}}},{key:"onTouchMove",value:function(){var t=this.getSlide().Panzoom;return!t||1===t.content.scale}},{key:"onTouchEnd",value:function(t){var e=t.dragOffset.y;Math.abs(e)>=150||Math.abs(e)>=35&&t.dragOffset.time<350?(this.option("hideClass")&&(this.getSlide().hideClass="fancybox-throwOut".concat(t.content.y<0?"Up":"Down")),this.close()):"y"===t.lockAxis&&t.panTo({y:0})}},{key:"onTransform",value:function(t){if(this.$backdrop){var e=Math.abs(t.content.y),i=e<1?"":Math.max(.33,Math.min(1,1-e/t.content.fitHeight*1.5));this.$container.style.setProperty("--fancybox-ts",i?"0s":""),this.$container.style.setProperty("--fancybox-opacity",i)}}},{key:"onMousedown",value:function(){"ready"===this.state&&document.body.classList.add("is-using-mouse")}},{key:"onKeydown",value:function(t){if(this.isTopmost()){document.body.classList.remove("is-using-mouse");var e=t.key,i=this.option("keyboard");if(i&&!t.ctrlKey&&!t.altKey&&!t.shiftKey){var n=t.composedPath()[0],o=document.activeElement&&document.activeElement.classList,a=o&&o.contains("carousel__button");if("Escape"!==e&&!a)if(t.target.isContentEditable||-1!==["BUTTON","TEXTAREA","OPTION","INPUT","SELECT","VIDEO"].indexOf(n.nodeName))return;if(!1!==this.trigger("keydown",e,t)){var s=i[e];"function"==typeof this[s]&&this[s]()}}}}},{key:"getSlide",value:function(){var t=this.Carousel;if(!t)return null;var e=null===t.page?t.option("initialPage"):t.page,i=t.pages||[];return i.length&&i[e]?i[e].slides[0]:null}},{key:"focus",value:function(t){if(!(i.ignoreFocusChange||["init","closing","customClosing","destroy"].indexOf(this.state)>-1)){var e=this.$container,n=this.getSlide(),o="done"===n.state?n.$el:null;if(!o||!o.contains(document.activeElement)){t&&t.preventDefault(),i.ignoreFocusChange=!0;for(var a,s=[],r=0,l=Array.from(e.querySelectorAll(X));r<l.length;r++){var c=l[r],h=c.offsetParent,d=o&&o.contains(c),u=!this.Carousel.$viewport.contains(c);h&&(d||u)?(s.push(c),void 0!==c.dataset.origTabindex&&(c.tabIndex=c.dataset.origTabindex,c.removeAttribute("data-orig-tabindex")),(c.hasAttribute("autoFocus")||!a&&d&&!c.classList.contains("carousel__button"))&&(a=c)):(c.dataset.origTabindex=void 0===c.dataset.origTabindex?c.getAttribute("tabindex"):c.dataset.origTabindex,c.tabIndex=-1)}t?s.indexOf(t.target)>-1?this.lastFocus=t.target:this.lastFocus===e?q(s[s.length-1]):q(e):this.option("autoFocus")&&a?q(a):s.indexOf(document.activeElement)<0&&q(e),this.lastFocus=document.activeElement,i.ignoreFocusChange=!1}}}},{key:"hideScrollbar",value:function(){if(W){var t=window.innerWidth-document.documentElement.getBoundingClientRect().width,e="fancybox-style-noscroll",i=document.getElementById(e);i||t>0&&((i=document.createElement("style")).id=e,i.type="text/css",i.innerHTML=".compensate-for-scrollbar {padding-right: ".concat(t,"px;}"),document.getElementsByTagName("head")[0].appendChild(i),document.body.classList.add("compensate-for-scrollbar"))}}},{key:"revealScrollbar",value:function(){document.body.classList.remove("compensate-for-scrollbar");var t=document.getElementById("fancybox-style-noscroll");t&&t.remove()}},{key:"clearContent",value:function(t){this.Carousel.trigger("removeSlide",t),t.$content&&(t.$content.remove(),t.$content=null),t.$closeButton&&(t.$closeButton.remove(),t.$closeButton=null),t._className&&t.$el.classList.remove(t._className)}},{key:"setContent",value:function(t,e){var i,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=t.$el;if(e instanceof HTMLElement)["img","iframe","video","audio"].indexOf(e.nodeName.toLowerCase())>-1?(i=document.createElement("div")).appendChild(e):i=e;else{var a=document.createRange().createContextualFragment(e);(i=document.createElement("div")).appendChild(a)}if(t.filter&&!t.error&&(i=i.querySelector(t.filter)),i instanceof Element)return t._className="has-".concat(n.suffix||t.type||"unknown"),o.classList.add(t._className),i.classList.add("fancybox__content"),"none"!==i.style.display&&"none"!==getComputedStyle(i).getPropertyValue("display")||(i.style.display=t.display||this.option("defaultDisplay")||"flex"),t.id&&i.setAttribute("id",t.id),t.$content=i,o.prepend(i),this.manageCloseButton(t),"loading"!==t.state&&this.revealContent(t),i;this.setError(t,"{{ELEMENT_NOT_FOUND}}")}},{key:"manageCloseButton",value:function(t){var e=this,i=void 0===t.closeButton?this.option("closeButton"):t.closeButton;if(i&&("top"!==i||!this.$closeButton)){var n=document.createElement("button");n.classList.add("carousel__button","is-close"),n.setAttribute("title",this.options.l10n.CLOSE),n.innerHTML=this.option("template.closeButton"),n.addEventListener("click",(function(t){return e.close(t)})),"inside"===i?(t.$closeButton&&t.$closeButton.remove(),t.$closeButton=t.$content.appendChild(n)):this.$closeButton=this.$container.insertBefore(n,this.$container.firstChild)}}},{key:"revealContent",value:function(t){var e=this;this.trigger("reveal",t),t.$content.style.visibility="";var i=!1;t.error||"loading"===t.state||null!==this.Carousel.prevPage||t.index!==this.options.startIndex||(i=void 0===t.showClass?this.option("showClass"):t.showClass),i?(t.state="animating",this.animateCSS(t.$content,i,(function(){e.done(t)}))):this.done(t)}}
24004,{key:"animateCSS",value:function(t,e,i){if(t&&t.dispatchEvent(new CustomEvent("animationend",{bubbles:!0,cancelable:!0})),t&&e){t.addEventListener("animationend",(function n(o){o.currentTarget===this&&(t.removeEventListener("animationend",n),i&&i(),t.classList.remove(e))})),t.classList.add(e)}else"function"==typeof i&&i()}},{key:"done",value:function(t){t.state="done",this.trigger("done",t);var e=this.getSlide();e&&t.index===e.index&&this.option("autoFocus")&&this.focus()}},{key:"setError",value:function(t,e){t.error=e,this.hideLoading(t),this.clearContent(t);var i=document.createElement("div");i.classList.add("fancybox-error"),i.innerHTML=this.localize(e||"<p>{{ERROR}}</p>"),this.setContent(t,i,{suffix:"error"})}},{key:"showLoading",value:function(t){var e=this;t.state="loading",t.$el.classList.add("is-loading");var i=t.$el.querySelector(".fancybox__spinner");i||((i=document.createElement("div")).classList.add("fancybox__spinner"),i.innerHTML=this.option("template.spinner"),i.addEventListener("click",(function(){e.Carousel.Panzoom.velocity||e.close()})),t.$el.prepend(i))}},{key:"hideLoading",value:function(t){var e=t.$el&&t.$el.querySelector(".fancybox__spinner");e&&(e.remove(),t.$el.classList.remove("is-loading")),"loading"===t.state&&(this.trigger("load",t),t.state="ready")}},{key:"next",value:function(){var t=this.Carousel;t&&t.pages.length>1&&t.slideNext()}},{key:"prev",value:function(){var t=this.Carousel;t&&t.pages.length>1&&t.slidePrev()}},{key:"jumpTo",value:function(){var t;this.Carousel&&(t=this.Carousel).slideTo.apply(t,arguments)}},{key:"isClosing",value:function(){return["closing","customClosing","destroy"].includes(this.state)}},{key:"isTopmost",value:function(){return i.getInstance().id==this.id}},{key:"close",value:function(t){var e=this;if(t&&t.preventDefault(),!this.isClosing()&&!1!==this.trigger("shouldClose",t)&&(this.state="closing",this.Carousel.Panzoom.destroy(),this.detachEvents(),this.trigger("closing",t),"destroy"!==this.state)){this.$container.setAttribute("aria-hidden","true"),this.$container.classList.add("is-closing");var i=this.getSlide();if(this.Carousel.slides.forEach((function(t){t.$content&&t.index!==i.index&&e.Carousel.trigger("removeSlide",t)})),"closing"===this.state){var n=void 0===i.hideClass?this.option("hideClass"):i.hideClass;this.animateCSS(i.$content,n,(function(){e.destroy()}),!0)}}}},{key:"destroy",value:function(){if("destroy"!==this.state){this.state="destroy",this.trigger("destroy");var t=this.option("placeFocusBack")?this.option("triggerTarget",this.getSlide().$trigger):null;this.Carousel.destroy(),this.detachPlugins(),this.Carousel=null,this.options={},this.events={},this.$container.remove(),this.$container=this.$backdrop=this.$carousel=null,t&&q(t),at.delete(this.id);var e=i.getInstance();e?e.focus():(document.documentElement.classList.remove("with-fancybox"),document.body.classList.remove("is-using-mouse"),this.revealScrollbar())}}}],[{key:"show",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new i(t,e)}},{key:"fromEvent",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!t.defaultPrevented&&!(t.button&&0!==t.button||t.ctrlKey||t.metaKey||t.shiftKey)){var n,o,a,s=t.composedPath()[0],r=s;if((r.matches("[data-fancybox-trigger]")||(r=r.closest("[data-fancybox-trigger]")))&&(e.triggerTarget=r,n=r&&r.dataset&&r.dataset.fancyboxTrigger),n){var l=document.querySelectorAll('[data-fancybox="'.concat(n,'"]')),c=parseInt(r.dataset.fancyboxIndex,10)||0;r=l.length?l[c]:r}Array.from(i.openers.keys()).reverse().some((function(e){a=r||s;var i=!1;try{a instanceof Element&&("string"==typeof e||e instanceof String)&&(i=a.matches(e)||(a=a.closest(e)))}catch(t){}return!!i&&(t.preventDefault(),o=e,!0)}));var h=!1;if(o){e.event=t,e.target=a,a.origTarget=s,h=i.fromOpener(o,e);var d=i.getInstance();d&&"ready"===d.state&&t.detail&&document.body.classList.add("is-using-mouse")}return h}}},{key:"fromOpener",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=function(t){for(var e=["false","0","no","null","undefined"],i=["true","1","yes"],n=Object.assign({},t.dataset),o={},a=0,s=Object.entries(n);a<s.length;a++){var r=g(s[a],2),l=r[0],c=r[1];if("fancybox"!==l)if("width"===l||"height"===l)o["_".concat(l)]=c;else if("string"==typeof c||c instanceof String)if(e.indexOf(c)>-1)o[l]=!1;else if(i.indexOf(o[l])>-1)o[l]=!0;else try{o[l]=JSON.parse(c)}catch(t){o[l]=c}else o[l]=c}return t instanceof Element&&(o.$trigger=t),o}
24004,o=[],a=e.startIndex||0,s=e.target||null,r=void 0!==(e=k({},e,i.openers.get(t))).groupAll&&e.groupAll,l=void 0===e.groupAttr?"data-fancybox":e.groupAttr,c=l&&s?s.getAttribute("".concat(l)):"";if(!s||c||r){var h=e.root||(s?s.getRootNode():document.body);o=[].slice.call(h.querySelectorAll(t))}if(s&&!r&&(o=c?o.filter((function(t){return t.getAttribute("".concat(l))===c})):[s]),!o.length)return!1;var d=i.getInstance();return!(d&&o.indexOf(d.options.$trigger)>-1)&&(a=s?o.indexOf(s):a,new i(o=o.map(n),k({},e,{startIndex:a,$trigger:s})))}},{key:"bind",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};function n(){document.body.addEventListener("click",i.fromEvent,!1)}W&&(i.openers.size||(/complete|interactive|loaded/.test(document.readyState)?n():document.addEventListener("DOMContentLoaded",n)),i.openers.set(t,e))}},{key:"unbind",value:function(t){i.openers.delete(t),i.openers.size||i.destroy()}},{key:"destroy",value:function(){for(var t;t=i.getInstance();)t.destroy();i.openers=new Map,document.body.removeEventListener("click",i.fromEvent,!1)}},{key:"getInstance",value:function(t){return t?at.get(t):Array.from(at.values()).reverse().find((function(t){return!t.isClosing()&&t}))||null}},{key:"close",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1?arguments[1]:void 0;if(t){var n,o=x(at.values());try{for(o.s();!(n=o.n()).done;){var a=n.value;a.close(e)}}catch(t){o.e(t)}finally{o.f()}}else{var s=i.getInstance();s&&s.close(e)}}},{key:"next",value:function(){var t=i.getInstance();t&&t.next()}},{key:"prev",value:function(){var t=i.getInstance();t&&t.prev()}}]),i}(O);rt.version="4.0.31",rt.defaults=ot,rt.openers=new Map,rt.Plugins=nt,rt.bind("[data-fancybox]");for(var lt=0,ct=Object.entries(rt.Plugins||{});lt<ct.length;lt++){var ht=g(ct[lt],2);ht[0];var dt=ht[1];"function"==typeof dt.create&&dt.create(rt)}t.Carousel=H,t.Fancybox=rt,t.Panzoom=M}));
24005
24006/* End */
24007;
24008; /* Start:"a:4:{s:4:"full";s:73:"/local/templates/aspro_next/cdn/jquery.suggestions.min.js?172596984559206";s:6:"source";s:57:"/local/templates/aspro_next/cdn/jquery.suggestions.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
vendor: 58,903 bytes, lines 24009-24010
24009!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],t):t(e.jQuery)}(this,function(e){"use strict";function t(e,t){return function(n,i){var s,o=[];return t(i)&&(s=k.splitTokens(k.split(n,e)),y.each(i,function(t,i){var r=t.value;if(k.stringEncloses(n,r))return!1;var a=k.splitTokens(k.split(r,e));0===y.minus(s,a).length&&o.push(i)})),1===o.length?o[0]:-1}}function n(e,t){var n=e.data&&e.data[t];return n&&new RegExp("^"+k.escapeRegExChars(n)+"(["+w+"]|$)","i").test(e.value)}function i(e,t){var n=/<strong>/;return n.test(t)&&!n.test(e)?t:e}function s(e,t,n,s,o){var r=this;return i(r.highlightMatches(e,n,s,o),r.highlightMatches(t,n,s,o))}function o(e){this.urlSuffix=e.toLowerCase(),this.noSuggestionsHint="Неизвестное значение",this.matchers=[F.matchByNormalizedQuery(),F.matchByWords()]}function r(t,n){var i=this;i.element=t,i.el=e(t),i.suggestions=[],i.badQueries=[],i.selectedIndex=-1,i.currentValue=i.element.value,i.intervalId=0,i.cachedResponse={},i.enrichmentCache={},i.currentRequest=null,i.inputPhase=e.Deferred(),i.fetchPhase=e.Deferred(),i.enrichPhase=e.Deferred(),i.onChangeTimeout=null,i.triggering={},i.$wrapper=null,i.options=e.extend({},V,n),i.classes=x,i.disabled=!1,i.selection=null,i.$viewport=e(window),i.$body=e(document.body),i.type=null,i.status={},i.setupElement(),i.initializer=e.Deferred(),i.el.is(":visible")?i.initializer.resolve():i.deferInitialization(),i.initializer.done(e.proxy(i.initialize,i))}function a(){L.each(G,function(e){e.abort()}),G={}}function u(){X=null,V.geoLocation=Y}function l(t){return e.map(t,function(e){var t=L.escapeHtml(e.text);return t&&e.matched&&(t="<strong>"+t+"</strong>"),t}).join("")}function c(t,n){var i=t.split(", ");return 1===i.length?t:e.map(i,function(e){return'<span class="'+n+'">'+e+"</span>"}).join(", ")}function d(t,n){var i=!1;return e.each(t,function(e,t){if(i=t.value==n.value&&t!=n)return!1}),i}function f(e,t){var n=t.selection,i=n&&n.data&&t.bounds;return i&&y.each(t.bounds.all,function(t,s){return i=n.data[t]===e.data[t]}),i}function p(e){var t=e.replace(/^(\d{2})(\d*?)(0+)$/g,"$1$2"),n=t.length,i=-1;return n<=2?i=2:n>2&&n<=5?i=5:n>5&&n<=8?i=8:n>8&&n<=11?i=11:n>11&&n<=15?i=15:n>15&&(i=19),k.padEnd(t,i,"0")}function g(e){this.plan=e.status.plan;var t=e.getContainer();this.element=de.selectByClass(x.promo,t)}function h(){new g(this).show()}e=e&&e.hasOwnProperty("default")?e.default:e;var m={isArray:function(e){return Array.isArray(e)},isFunction:function(e){return"[object Function]"===Object.prototype.toString.call(e)},isEmptyObject:function(e){return 0===Object.keys(e).length&&e.constructor===Object},isPlainObject:function(e){return void 0!==e&&"object"==typeof e&&null!==e&&!e.nodeType&&e!==e.window&&!(e.constructor&&!Object.prototype.hasOwnProperty.call(e.constructor.prototype,"isPrototypeOf"))}},y={compact:function(e){return e.filter(function(e){return!!e})},each:function(e,t){if(Array.isArray(e))return void e.some(function(e,n){return!1===t(e,n)});Object.keys(e).some(function(n){var i=e[n];return!1===t(i,n)})},intersect:function(e,t){var n=[];return Array.isArray(e)&&Array.isArray(t)?e.filter(function(e){return-1!==t.indexOf(e)}):n},minus:function(e,t){return t&&0!==t.length?e.filter(function(e){return-1===t.indexOf(e)}):e},makeArray:function(e){return m.isArray(e)?Array.prototype.slice.call(e):[e]},minusWithPartialMatching:function(e,t){return t&&0!==t.length?e.filter(function(e){return!t.some(function(t){return 0===t.indexOf(e)})}):e},slice:function(e,t){return Array.prototype.slice.call(e,t)}},_={delay:function(e,t){return setTimeout(e,t||0)}},v={areSame:function e(t,n){var i=!0;return typeof t==typeof n&&("object"==typeof t&&null!=t&&null!=n?(y.each(t,function(t,s){return i=e(t,n[s])}),i):t===n)},assign:function(e,t){if("function"==typeof Object.assign)return Object.assign.apply(null,arguments);if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var n=Object(e),i=1;i<arguments.length;i++){var s=arguments[i];if(null!=s)for(var o in s)Object.prototype.hasOwnProperty.call(s,o)&&(n[o]=s[o])}return n},clone:function(e){return JSON.parse(JSON.stringify(e))},compact:function(e){var t=v.clone(e);return y.each(t,function(e,n){null!==e&&void 0!==e&&""!==e||delete t[n]}),t},fieldsAreNotEmpty:function(e,t){if(!m.isPlainObject(e))return!1;var n=!0;return y.each(t,function(t,i){return n=!!e[t]}),n},getDeepValue:function e(t,n){var i=n.split("."),s=i.shift();return t&&(i.length?e(t[s],i.join(".")):t[s])},indexObjectsById:function(e,t,n){var i={};return y.each(e,function(e,s){var o=e[t],r={};n&&(r[n]=s),i[o]=v.assign(r,e)}),i}},b={ENTER:13,ESC:27,TAB:9,SPACE:32,UP:38,DOWN:40},x={hint:"suggestions-hint",mobile:"suggestions-mobile",nowrap:"suggestions-nowrap",promo:"suggestions-promo",selected:"suggestions-selected",suggestion:"suggestions-suggestion",subtext:"suggestions-subtext",subtext_inline:"suggestions-subtext suggestions-subtext_inline",subtext_delimiter:"suggestions-subtext-delimiter",subtext_label:"suggestions-subtext suggestions-subtext_label",removeConstraint:"suggestions-remove",value:"suggestions-value"},S=".suggestions",w="\\s\"'~\\*\\.,:\\|\\[\\]\\(\\)\\{\\}<>№",C=new RegExp("["+w+"]+","g"),E=new RegExp("[\\-\\+\\\\\\?!@#$%^&]+","g"),k={escapeHtml:function(e){var t={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","/":"&#x2F;"};return e&&y.each(t,function(t,n){e=e.replace(new RegExp(n,"g"),t)}),e},escapeRegExChars:function(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},formatToken:function(e){return e&&e.toLowerCase().replace(/[ёЁ]/g,"е")},getWordExtractorRegExp:function(){return new RegExp("([^"+w+"]*)(["+w+"]*)","g")},normalize:function(e,t){return k.split(e,t).join(" ")},padEnd:function(e,t,n){return String.prototype.padEnd?e.padEnd(t,n):(t>>=0,n=String(void 0!==n?n:" "),e.length>t?String(e):(t-=e.length,t>n.length&&(n+=n.repeat(t/n.length)),String(e)+n.slice(0,t)))},split:function(e,t){var n=e.toLowerCase().replace("ё","е").replace(/(\d+)([а-я]{2,})/g,"$1 $2").replace(/([а-я]+)(\d+)/g,"$1 $2"),i=y.compact(n.split(C));if(!i.length)return[];var s=i.pop(),o=y.minus(i,t);return o.push(s),o},splitTokens:function(e){var t=[];return y.each(e,function(e,n){var i=e.split(E);t=t.concat(y.compact(i))}),t},stringEncloses:function(e,t){return e.length>t.length&&-1!==e.toLowerCase().indexOf(t.toLowerCase())},tokenize:function(e,t){var n=y.compact(k.formatToken(e).split(C)),i=y.minus(n,t),s=y.minus(n,i);return n=k.withSubTokens(i.concat(s))},withSubTokens:function(e){var t=[];return y.each(e,function(e,n){var i=e.split(E);t.push(e),i.length>1&&(t=t.concat(y.compact(i)))}),t}},B={Deferred:function(){return e.Deferred()},ajax:function(t){return e.ajax(t)},extend:function(){return e.extend.apply(null,arguments)},isJqObject:function(t){return t instanceof e},param:function(t){return e.param(t)},proxy:function(t,n){return e.proxy(t,n)},select:function(t){return e(t)},supportsCors:function(){return e.support.cors}},T={getDefaultType:function(){return B.supportsCors()?"POST":"GET"},getDefaultContentType:function(){return B.supportsCors()?"application/json":"application/x-www-form-urlencoded"},fixURLProtocol:function(e){return B.supportsCors()?e:e.replace(/^https?:/,location.protocol)},addUrlParams:function(e,t){return e+(/\?/.test(e)?"&":"?")+B.param(t)},serialize:function(e){return B.supportsCors()?JSON.stringify(e,function(e,t){return null===t?void 0:t}):(e=v.compact(e),B.param(e,!0))}},j=function(){var e=0;return function(t){return(t||"")+ ++e}}(),L={escapeRegExChars:k.escapeRegExChars,escapeHtml:k.escapeHtml,formatToken:k.formatToken,normalize:k.normalize,reWordExtractor:k.getWordExtractorRegExp,stringEncloses:k.stringEncloses,addUrlParams:T.addUrlParams,getDefaultContentType:T.getDefaultContentType,getDefaultType:T.getDefaultType,fixURLProtocol:T.fixURLProtocol,serialize:T.serialize,arrayMinus:y.minus,arrayMinusWithPartialMatching:y.minusWithPartialMatching,arraysIntersection:y.intersect,compact:y.compact,each:y.each,makeArray:y.makeArray,slice:y.slice,delay:_.delay,areSame:v.areSame,compactObject:v.compact,getDeepValue:v.getDeepValue,fieldsNotEmpty:v.fieldsAreNotEmpty,indexBy:v.indexObjectsById,isArray:m.isArray,isEmptyObject:m.isEmptyObject,isFunction:m.isFunction,isPlainObject:m.isPlainObject,uniqueId:j},V={$helpers:null,autoSelectFirst:!1,containerClass:"suggestions-suggestions",count:5,deferRequestBy:100,enrichmentEnabled:!0,formatResult:null,formatSelected:null,headers:null,hint:"Выберите вариант или продолжите ввод",initializeInterval:100,language:null,minChars:1,mobileWidth:600,noCache:!1,noSuggestionsHint:null,onInvalidateSelection:null,onSearchComplete:e.noop,onSearchError:e.noop,onSearchStart:e.noop,onSelect:null,onSelectNothing:null,onSuggestionsFetch:null,paramName:"query",params:{},preventBadQueries:!1,requestMode:"suggest",scrollOnFocus:!1,serviceUrl:"https://suggestions.dadata.ru/suggestions/api/4_1/rs",tabDisabled:!1,timeout:3e3,triggerSelectOnBlur:!0,triggerSelectOnEnter:!0,triggerSelectOnSpace:!1,type:null,url:null},O=function(e){return function(t){if(0===t.length)return!1;if(1===t.length)return!0;var n=e(t[0].value);return 0===t.filter(function(t){return 0!==e(t.value).indexOf(n)}).length}}(function(e){return e}),F={matchByNormalizedQuery:function(e){return function(t,n){var i=k.normalize(t,e),s=[];return y.each(n,function(n,o){var r=n.value.toLowerCase();return!k.stringEncloses(t,r)&&(!(r.indexOf(i)>0)&&void(i===k.normalize(r,e)&&s.push(o)))}),1===s.length?s[0]:-1}},matchByWords:function(e){return t(e,O)},matchByWordsAddress:function(e){return t(e,O)},matchByFields:function(e){return function(t,n){var i=k.splitTokens(k.split(t)),s=[];return 1===n.length&&(e&&y.each(e,function(e,t){var i=v.getDeepValue(n[0],t),o=i&&k.splitTokens(k.split(i,e));o&&o.length&&(s=s.concat(o))}),0===y.minusWithPartialMatching(i,s).length)?0:-1}}},P=["ао","аобл","дом","респ","а/я","аал","автодорога","аллея","арбан","аул","б-р","берег","бугор","вал","вл","волость","въезд","высел","г","городок","гск","д","двлд","днп","дор","дп","ж/д_будка","ж/д_казарм","ж/д_оп","ж/д_платф","ж/д_пост","ж/д_рзд","ж/д_ст","жилзона","жилрайон","жт","заезд","заимка","зона","к","казарма","канал","кв","кв-л","км","кольцо","комн","кордон","коса","кп","край","линия","лпх","м","массив","местность","мкр","мост","н/п","наб","нп","обл","округ","остров","оф","п","п/о","п/р","п/ст","парк","пгт","пер","переезд","пл","пл-ка","платф","погост","полустанок","починок","пр-кт","проезд","промзона","просек","просека","проселок","проток","протока","проулок","р-н","рзд","россия","рп","ряды","с","с/а","с/мо","с/о","с/п","с/с","сад","сквер","сл","снт","спуск","ст","ст-ца","стр","тер","тракт","туп","у","ул","уч-к","ф/х","ферма","х","ш","бульвар","владение","выселки","гаражно-строительный","город","деревня","домовладение","дорога","квартал","километр","комната","корпус","литер","леспромхоз","местечко","микрорайон","набережная","область","переулок","платформа","площадка","площадь","поселение","поселок","проспект","разъезд","район","республика","село","сельсовет","слобода","сооружение","станица","станция","строение","территория","тупик","улица","улус","участок","хутор","шоссе"],D=[{id:"kladr_id",fields:["kladr_id"],forBounds:!1,forLocations:!0},{id:"postal_code",fields:["postal_code"],forBounds:!1,forLocations:!0},{id:"country_iso_code",fields:["country_iso_code"],forBounds:!1,forLocations:!0},{id:"country",fields:["country"],forBounds:!0,forLocations:!0,kladrFormat:{digits:0,zeros:13},fiasType:"country_iso_code"},{id:"region_iso_code",fields:["region_iso_code"],forBounds:!1,forLocations:!0},{id:"region_fias_id",fields:["region_fias_id"],forBounds:!1,forLocations:!0},{id:"region_type_full",fields:["region_type_full"],forBounds:!1,forLocations:!0,kladrFormat:{digits:2,zeros:11},fiasType:"region_fias_id"},{id:"region",fields:["region","region_type","region_type_full","region_with_type"],forBounds:!0,forLocations:!0,kladrFormat:{digits:2,zeros:11},fiasType:"region_fias_id"},{id:"area_fias_id",fields:["area_fias_id"],forBounds:!1,forLocations:!0},{id:"area_type_full",fields:["area_type_full"],forBounds:!1,forLocations:!0,kladrFormat:{digits:5,zeros:8},fiasType:"area_fias_id"},{id:"area",fields:["area","area_type","area_type_full","area_with_type"],forBounds:!0,forLocations:!0,kladrFormat:{digits:5,zeros:8},fiasType:"area_fias_id"},{id:"city_fias_id",fields:["city_fias_id"],forBounds:!1,forLocations:!0},{id:"city_type_full",fields:["city_type_full"],forBounds:!1,forLocations:!0,kladrFormat:{digits:8,zeros:5},fiasType:"city_fias_id"},{id:"city",fields:["city","city_type","city_type_full","city_with_type"],forBounds:!0,forLocations:!0,kladrFormat:{digits:8,zeros:5},fiasType:"city_fias_id"},{id:"city_district_fias_id",fields:["city_district_fias_id"],forBounds:!1,forLocations:!0},{id:"city_district_type_full",fields:["city_district_type_full"],forBounds:!1,forLocations:!0,kladrFormat:{digits:11,zeros:2},fiasType:"city_district_fias_id"},{id:"city_district",fields:["city_district","city_district_type","city_district_type_full","city_district_with_type"],forBounds:!0,forLocations:!0,kladrFormat:{digits:11,zeros:2},fiasType:"city_district_fias_id"},{id:"settlement_fias_id",fields:["settlement_fias_id"],forBounds:!1,forLocations:!0},{id:"settlement_type_full",fields:["settlement_type_full"],forBounds:!1,forLocations:!0,kladrFormat:{digits:11,zeros:2},fiasType:"settlement_fias_id"},{id:"settlement",fields:["settlement","settlement_type","settlement_type_full","settlement_with_type"],forBounds:!0,forLocations:!0,kladrFormat:{digits:11,zeros:2},fiasType:"settlement_fias_id"},{id:"street_fias_id",fields:["street_fias_id"],forBounds:!1,forLocations:!0},{id:"street_type_full",fields:["street_type_full"],forBounds:!1,forLocations:!0,kladrFormat:{digits:15,zeros:2},fiasType:"street_fias_id"},{id:"street",fields:["street","street_type","street_type_full","street_with_type"],forBounds:!0,forLocations:!0,kladrFormat:{digits:15,zeros:2},fiasType:"street_fias_id"},{id:"house",fields:["house","house_type","house_type_full","block","block_type"],forBounds:!0,forLocations:!0,kladrFormat:{digits:19},fiasType:"house_fias_id"},{id:"flat",fields:["flat","flat_type","flat_type_full"],forBounds:!0,forLocations:!1,kladrFormat:{digits:19},fiasType:"flat_fias_id"}],z={urlSuffix:"address",noSuggestionsHint:"Неизвестный адрес",matchers:[F.matchByNormalizedQuery(P),F.matchByWordsAddress(P)],dataComponents:D,dataComponentsById:v.indexObjectsById(D,"id","index"),unformattableTokens:P,enrichmentEnabled:!0,enrichmentMethod:"suggest",enrichmentParams:{count:1,locations:null,locations_boost:null,from_bound:null,to_bound:null},getEnrichmentQuery:function(e){return e.unrestricted_value},geoEnabled:!0,isDataComplete:function(e){var t=[this.bounds.to||"flat"],n=e.data;return!m.isPlainObject(n)||v.fieldsAreNotEmpty(n,t)},composeValue:function(e,t){var n=e.country,i=e.region_with_type||y.compact([e.region,e.region_type]).join(" ")||e.region_type_full,s=e.area_with_type||y.compact([e.area_type,e.area]).join(" ")||e.area_type_full,o=e.city_with_type||y.compact([e.city_type,e.city]).join(" ")||e.city_type_full,r=e.settlement_with_type||y.compact([e.settlement_type,e.settlement]).join(" ")||e.settlement_type_full,a=e.city_district_with_type||y.compact([e.city_district_type,e.city_district]).join(" ")||e.city_district_type_full,u=e.street_with_type||y.compact([e.street_type,e.street]).join(" ")||e.street_type_full,l=y.compact([e.house_type,e.house,e.block_type,e.block]).join(" "),c=y.compact([e.flat_type,e.flat]).join(" "),d=e.postal_box&&"а/я "+e.postal_box;return i===o&&(i=""),t&&t.saveCityDistrict||(t&&t.excludeCityDistrict?a="":a&&!e.city_district_fias_id&&(a="")),y.compact([n,i,s,o,a,r,u,l,c,d]).join(", ")},formatResult:function(){var e=[],t=!1;return D.forEach(function(n){t&&e.push(n.id),"city_district"===n.id&&(t=!0)}),function(t,n,i,s){var o,r,a,u=this,l=i.data&&i.data.city_district_with_type,c=s&&s.unformattableTokens,d=i.data&&i.data.history_values;return d&&d.length>0&&(o=k.tokenize(n,c),r=this.type.findUnusedTokens(o,t),(a=this.type.getFormattedHistoryValues(r,d))&&(t+=a)),t=u.highlightMatches(t,n,i,s),t=u.wrapFormattedValue(t,i),l&&(!u.bounds.own.length||u.bounds.own.indexOf("street")>=0)&&!m.isEmptyObject(u.copyDataComponents(i.data,e))&&(t+='<div class="'+u.classes.subtext+'">'+u.highlightMatches(l,n,i)+"</div>"),t}}(),findUnusedTokens:function(e,t){return e.filter(function(e){return-1===t.indexOf(e)})},getFormattedHistoryValues:function(e,t){var n=[],i="";return t.forEach(function(t){y.each(e,function(e){if(t.toLowerCase().indexOf(e)>=0)return n.push(t),!1})}),n.length>0&&(i=" (бывш. "+n.join(", ")+")"),i},getSuggestionValue:function(e,t){var n=null;return t.hasSameValues?n=e.options.restrict_value?this.getValueWithinConstraints(e,t.suggestion):e.bounds.own.length?this.getValueWithinBounds(e,t.suggestion):t.suggestion.unrestricted_value:t.hasBeenEnriched&&e.options.restrict_value&&(n=this.getValueWithinConstraints(e,t.suggestion,{excludeCityDistrict:!0})),n},getValueWithinConstraints:function(e,t,n){return this.composeValue(e.getUnrestrictedData(t.data),n)},getValueWithinBounds:function(e,t,n){var i=e.copyDataComponents(t.data,e.bounds.own.concat(["city_district_fias_id"]));return this.composeValue(i,n)}},I=[{id:"kladr_id",fields:["kladr_id"],forBounds:!1,forLocations:!0},{id:"region_fias_id",fields:["region_fias_id"],forBounds:!1,forLocations:!0},{id:"region_type_full",fields:["region_type_full"],forBounds:!1,forLocations:!0,kladrFormat:{digits:2,zeros:11},fiasType:"region_fias_id"},{id:"region",fields:["region","region_type","region_type_full","region_with_type"],forBounds:!0,forLocations:!0,kladrFormat:{digits:2,zeros:11},fiasType:"region_fias_id"},{id:"area_fias_id",fields:["area_fias_id"],forBounds:!1,forLocations:!0},{id:"area_type_full",fields:["area_type_full"],forBounds:!1,forLocations:!0,kladrFormat:{digits:5,zeros:8},fiasType:"area_fias_id"},{id:"area",fields:["area","area_type","area_type_full","area_with_type"],forBounds:!0,forLocations:!0,kladrFormat:{digits:5,zeros:8},fiasType:"area_fias_id"},{id:"city_fias_id",fields:["city_fias_id"],forBounds:!1,forLocations:!0},{id:"city_type_full",fields:["city_type_full"],forBounds:!1,forLocations:!0,kladrFormat:{digits:8,zeros:5},fiasType:"city_fias_id"},{id:"city",fields:["city","city_type","city_type_full","city_with_type"],forBounds:!0,forLocations:!0,kladrFormat:{digits:8,zeros:5},fiasType:"city_fias_id"},{id:"city_district_fias_id",fields:["city_district_fias_id"],forBounds:!1,forLocations:!0},{id:"city_district_type_full",fields:["city_district_type_full"],forBounds:!1,forLocations:!0,kladrFormat:{digits:11,zeros:2},fiasType:"city_district_fias_id"},{id:"city_district",fields:["city_district","city_district_type","city_district_type_full","city_district_with_type"],forBounds:!0,forLocations:!0,kladrFormat:{digits:11,zeros:2},fiasType:"city_district_fias_id"},{id:"settlement_fias_id",fields:["settlement_fias_id"],forBounds:!1,forLocations:!0},{id:"settlement_type_full",fields:["settlement_type_full"],forBounds:!1,forLocations:!0,kladrFormat:{digits:11,zeros:2},fiasType:"settlement_fias_id"},{id:"settlement",fields:["settlement","settlement_type","settlement_type_full","settlement_with_type"],forBounds:!0,forLocations:!0,kladrFormat:{digits:11,zeros:2},fiasType:"settlement_fias_id"},{id:"planning_structure_fias_id",fields:["planning_structure_fias_id"],forBounds:!1,forLocations:!0},{id:"planning_structure_type_full",fields:["planning_structure_type_full"],forBounds:!1,forLocations:!0,kladrFormat:{digits:15,zeros:2},fiasType:"planning_structure_fias_id"},{id:"planning_structure",fields:["planning_structure","planning_structure_type","planning_structure_type_full","planning_structure_with_type"],forBounds:!0,forLocations:!0,kladrFormat:{digits:15,zeros:2},fiasType:"planning_structure_fias_id"},{id:"street_fias_id",fields:["street_fias_id"],forBounds:!1,forLocations:!0},{id:"street_type_full",fields:["street_type_full"],forBounds:!1,forLocations:!0,kladrFormat:{digits:15,zeros:2},fiasType:"street_fias_id"},{id:"street",fields:["street","street_type","street_type_full","street_with_type"],forBounds:!0,forLocations:!0,kladrFormat:{digits:15,zeros:2},fiasType:"street_fias_id"},{id:"house",fields:["house","house_type","block","building_type","building"],forBounds:!0,forLocations:!1,kladrFormat:{digits:19}}],R={urlSuffix:"fias",noSuggestionsHint:"Неизвестный адрес",matchers:[F.matchByNormalizedQuery(P),F.matchByWordsAddress(P)],dataComponents:I,dataComponentsById:v.indexObjectsById(I,"id","index"),unformattableTokens:P,isDataComplete:function(e){var t=[this.bounds.to||"house"],n=e.data;return!m.isPlainObject(n)||v.fieldsAreNotEmpty(n,t)},composeValue:function(e,t){var n=e.country,i=e.region_with_type||y.compact([e.region,e.region_type]).join(" ")||e.region_type_full,s=e.area_with_type||y.compact([e.area_type,e.area]).join(" ")||e.area_type_full,o=e.city_with_type||y.compact([e.city_type,e.city]).join(" ")||e.city_type_full,r=e.settlement_with_type||y.compact([e.settlement_type,e.settlement]).join(" ")||e.settlement_type_full,a=e.city_district_with_type||y.compact([e.city_district_type,e.city_district]).join(" ")||e.city_district_type_full,u=e.planning_structure_with_type||y.compact([e.planning_structure_type,e.planning_structure]).join(" ")||e.planning_structure_type_full,l=e.street_with_type||y.compact([e.street_type,e.street]).join(" ")||e.street_type_full,c=y.compact([e.house_type,e.house,e.block_type,e.block]).join(" "),d=y.compact([e.flat_type,e.flat]).join(" "),f=e.postal_box&&"а/я "+e.postal_box;return i===o&&(i=""),t&&t.saveCityDistrict||(t&&t.excludeCityDistrict?a="":a&&!e.city_district_fias_id&&(a="")),y.compact([n,i,s,o,a,r,u,l,c,d,f]).join(", ")},formatResult:function(){return function(e,t,n,i){var s=this;return e=s.highlightMatches(e,t,n,i),e=s.wrapFormattedValue(e,n)}}(),getSuggestionValue:z.getSuggestionValue,getValueWithinConstraints:z.getValueWithinConstraints,getValueWithinBounds:z.getValueWithinBounds},q={urlSuffix:"fio",noSuggestionsHint:!1,matchers:[F.matchByNormalizedQuery(),F.matchByWords()],fieldNames:{surname:"фамилия",name:"имя",patronymic:"отчество"},isDataComplete:function(e){var t,i=this,s=i.options.params,o=e.data;return m.isFunction(s)&&(s=s.call(i.element,e.value)),s&&s.parts?t=s.parts.map(function(e){return e.toLowerCase()}):(t=["surname","name"],n(e,"surname")&&t.push("patronymic")),v.fieldsAreNotEmpty(o,t)},composeValue:function(e){return y.compact([e.surname,e.name,e.patronymic]).join(" ")}},A={LEGAL:[2,2,5,1],INDIVIDUAL:[2,2,6,2]},$={urlSuffix:"party",noSuggestionsHint:"Неизвестная организация",matchers:[F.matchByFields({value:null,"data.address.value":P,"data.inn":null,"data.ogrn":null})],dataComponents:D,enrichmentEnabled:!0,enrichmentMethod:"findById",enrichmentParams:{count:1,locations_boost:null},getEnrichmentQuery:function(e){return e.data.hid},geoEnabled:!0,formatResult:function(e,t,n,o){var r=this,a=r.type.formatResultInn.call(r,n,t),u=r.highlightMatches(v.getDeepValue(n.data,"ogrn"),t,n),l=i(a,u),c=r.highlightMatches(v.getDeepValue(n.data,"management.name"),t,n),d=v.getDeepValue(n.data,"address.value")||"";return r.isMobile&&((o||(o={})).maxLength=50),e=s.call(r,e,v.getDeepValue(n.data,"name.latin"),t,n,o),e=r.wrapFormattedValue(e,n),d&&(d=d.replace(/^(\d{6}|Россия),\s+/i,""),d=r.isMobile?d.replace(new RegExp("^([^"+w+"]+["+w+"]+[^"+w+"]+).*"),"$1"):r.highlightMatches(d,t,n,{unformattableTokens:P})),(l||d||c)&&(e+='<div class="'+r.classes.subtext+'"><span class="'+r.classes.subtext_inline+'">'+(l||"")+"</span>"+(i(d,c)||"")+"</div>"),e},formatResultInn:function(e,t){var n,i,s=this,o=e.data&&e.data.inn,r=A[e.data&&e.data.type],a=/\d/;if(o)return i=s.highlightMatches(o,t,e),r&&(i=i.split(""),n=r.map(function(e){for(var t,n="";e&&(t=i.shift());)n+=t,a.test(t)&&e--;return n}),i=n.join('<span class="'+s.classes.subtext_delimiter+'"></span>')+i.join("")),i}},N={urlSuffix:"email",noSuggestionsHint:!1,matchers:[F.matchByNormalizedQuery()],isQueryRequestable:function(e){return this.options.suggest_local||e.indexOf("@")>=0}},M={urlSuffix:"bank",noSuggestionsHint:"Неизвестный банк",matchers:[F.matchByFields({value:null,"data.bic":null,"data.swift":null})],dataComponents:D,enrichmentEnabled:!0,enrichmentMethod:"findById",enrichmentParams:{count:1},getEnrichmentQuery:function(e){return e.data.bic},geoEnabled:!0,formatResult:function(e,t,n,i){var s=this,o=s.highlightMatches(v.getDeepValue(n.data,"bic"),t,n),r=v.getDeepValue(n.data,"address.value")||"";return e=s.highlightMatches(e,t,n,i),e=s.wrapFormattedValue(e,n),r&&(r=r.replace(/^\d{6}( РОССИЯ)?, /i,""),r=s.isMobile?r.replace(new RegExp("^([^"+w+"]+["+w+"]+[^"+w+"]+).*"),"$1"):s.highlightMatches(r,t,n,{unformattableTokens:P})),(o||r)&&(e+='<div class="'+s.classes.subtext+'"><span class="'+s.classes.subtext_inline+'">'+o+"</span>"+r+"</div>"),e},formatSelected:function(e){return v.getDeepValue(e,"data.name.payment")||null}},W={NAME:q,ADDRESS:z,FIAS:R,PARTY:$,EMAIL:N,BANK:M};W.get=function(e){return W.hasOwnProperty(e)?W[e]:new o(e)},B.extend(V,{suggest_local:!0});var U={chains:{},on:function(e,t){return this.get(e).push(t),this},get:function(e){var t=this.chains;return t[e]||(t[e]=[])}},H={suggest:{defaultParams:{type:L.getDefaultType(),dataType:"json",contentType:L.getDefaultContentType()},addTypeInUrl:!0},"iplocate/address":{defaultParams:{type:"GET",dataType:"json"},addTypeInUrl:!1},status:{defaultParams:{type:"GET",dataType:"json"},addTypeInUrl:!0},findById:{defaultParams:{type:L.getDefaultType(),dataType:"json",contentType:L.getDefaultContentType()},addTypeInUrl:!0}},Q={suggest:{method:"suggest",userSelect:!0,updateValue:!0,enrichmentEnabled:!0},findById:{method:"findById",userSelect:!1,updateValue:!1,enrichmentEnabled:!1}};r.prototype={initialize:function(){var e=this;e.uniqueId=L.uniqueId("i"),e.createWrapper(),e.notify("initialize"),e.bindWindowEvents(),e.setOptions(),e.inferIsMobile(),e.notify("ready")},deferInitialization:function(){var e,t=this,n="mouseover focus keydown",i=function(){t.initializer.resolve(),t.enable()};t.initializer.always(function(){t.el.off(n,i),clearInterval(e)}),t.disabled=!0,t.el.on(n,i),e=setInterval(function(){t.el.is(":visible")&&i()},t.options.initializeInterval)},isInitialized:function(){return"resolved"===this.initializer.state()},dispose:function(){var e=this;e.initializer.reject(),e.notify("dispose"),e.el.removeData("suggestions").removeClass("suggestions-input"),e.unbindWindowEvents(),e.removeWrapper(),e.el.trigger("suggestions-dispose")},notify:function(t){var n=this,i=L.slice(arguments,1);return e.map(U.get(t),function(e){return e.apply(n,i)})},createWrapper:function(){var t=this;t.$wrapper=e('<div class="suggestions-wrapper"/>'),t.el.after(t.$wrapper),t.$wrapper.on("mousedown"+S,e.proxy(t.onMousedown,t))},removeWrapper:function(){var t=this;t.$wrapper&&t.$wrapper.remove(),e(t.options.$helpers).off(S)},onMousedown:function(t){var n=this;t.preventDefault(),n.cancelBlur=!0,L.delay(function(){delete n.cancelBlur}),0==e(t.target).closest(".ui-menu-item").length&&L.delay(function(){e(document).one("mousedown",function(t){var i=n.el.add(n.$wrapper).add(n.options.$helpers);n.options.floating&&(i=i.add(n.$container)),i=i.filter(function(){return this===t.target||e.contains(this,t.target)}),i.length||n.hide()})})},bindWindowEvents:function(){var t=e.proxy(this.inferIsMobile,this);this.$viewport.on("resize"+S+this.uniqueId,t)},unbindWindowEvents:function(){this.$viewport.off("resize"+S+this.uniqueId)},scrollToTop:function(){var t=this,n=t.options.scrollOnFocus;!0===n&&(n=t.el),n instanceof e&&n.length>0&&e("body,html").animate({scrollTop:n.offset().top},"fast")},setOptions:function(t){var n=this;e.extend(n.options,t),n.type=W.get(n.options.type),e.each({requestMode:Q},function(t,i){if(n[t]=i[n.options[t]],!n[t])throw n.disable(),"`"+t+"` option is incorrect! Must be one of: "+e.map(i,function(e,t){return'"'+t+'"'}).join(", ")}),e(n.options.$helpers).off(S).on("mousedown"+S,e.proxy(n.onMousedown,n)),n.isInitialized()&&n.notify("setOptions")},inferIsMobile:function(){this.isMobile=this.$viewport.width()<=this.options.mobileWidth},clearCache:function(){this.cachedResponse={},this.enrichmentCache={},this.badQueries=[]},clear:function(){var e=this,t=e.selection;e.isInitialized()&&(e.clearCache(),e.currentValue="",e.selection=null,e.hide(),e.suggestions=[],e.el.val(""),e.el.trigger("suggestions-clear"),e.notify("clear"),e.trigger("InvalidateSelection",t))},disable:function(){var e=this;e.disabled=!0,e.abortRequest(),e.visible&&e.hide()},enable:function(){this.disabled=!1},isUnavailable:function(){return this.disabled},update:function(){var e=this,t=e.el.val();e.isInitialized()&&(e.currentValue=t,e.isQueryRequestable(t)?e.updateSuggestions(t):e.hide())},setSuggestion:function(t){var n,i,s=this;e.isPlainObject(t)&&e.isPlainObject(t.data)&&(t=e.extend(!0,{},t),s.isUnavailable()&&s.initializer&&"pending"===s.initializer.state()&&(s.initializer.resolve(),s.enable()),s.bounds.own.length&&(s.checkValueBounds(t),n=s.copyDataComponents(t.data,s.bounds.all),t.data.kladr_id&&(n.kladr_id=s.getBoundedKladrId(t.data.kladr_id,s.bounds.all)),t.data=n),s.selection=t,s.suggestions=[t],i=s.getSuggestionValue(t)||"",s.currentValue=i,s.el.val(i),s.abortRequest(),s.el.trigger("suggestions-set"))},fixData:function(){var t=this,n=t.extendedCurrentValue(),i=t.el.val(),s=e.Deferred();s.done(function(e){t.selectSuggestion(e,0,i,{hasBeenEnriched:!0}),t.el.trigger("suggestions-fixdata",e)}).fail(function(){t.selection=null,t.el.trigger("suggestions-fixdata")}),t.isQueryRequestable(n)?(t.currentValue=n,t.getSuggestions(n,{count:1,from_bound:null,to_bound:null}).done(function(e){var t=e[0];t?s.resolve(t):s.reject()}).fail(function(){s.reject()})):s.reject()},extendedCurrentValue:function(){var t=this,n=t.getParentInstance(),i=n&&n.extendedCurrentValue(),s=e.trim(t.el.val());return L.compact([i,s]).join(" ")},getAjaxParams:function(t,n){var i=this,s=e.trim(i.options.token),o=e.trim(i.options.partner),a=i.options.serviceUrl,u=i.options.url,l=H[t],c=e.extend({timeout:i.options.timeout},l.defaultParams),d={};return u?a=u:(/\/$/.test(a)||(a+="/"),a+=t,l.addTypeInUrl&&(a+="/"+i.type.urlSuffix)),a=L.fixURLProtocol(a),e.support.cors?(s&&(d.Authorization="Token "+s),o&&(d["X-Partner"]=o),d["X-Version"]=r.version,c.headers||(c.headers={}),c.xhrFields||(c.xhrFields={}),e.extend(c.headers,i.options.headers,d),c.xhrFields.withCredentials=!1):(s&&(d.token=s),o&&(d.partner=o),d.version=r.version,a=L.addUrlParams(a,d)),c.url=a,e.extend(c,n)},isQueryRequestable:function(e){var t,n=this;return t=e.length>=n.options.minChars,t&&n.type.isQueryRequestable&&(t=n.type.isQueryRequestable.call(n,e)),t},constructRequestParams:function(t,n){var i=this,s=i.options,o=e.isFunction(s.params)?s.params.call(i.element,t):e.extend({},s.params);return i.type.constructRequestParams&&e.extend(o,i.type.constructRequestParams.call(i)),e.each(i.notify("requestParams"),function(t,n){e.extend(o,n)}),o[s.paramName]=t,e.isNumeric(s.count)&&s.count>0&&(o.count=s.count),s.language&&(o.language=s.language),e.extend(o,n)},updateSuggestions:function(e){var t=this;t.fetchPhase=t.getSuggestions(e).done(function(n){t.assignSuggestions(n,e)})},getSuggestions:function(t,n,i){var s,o=this,r=o.options,a=i&&i.noCallbacks,u=i&&i.useEnrichmentCache,l=i&&i.method||o.requestMode.method,c=o.constructRequestParams(t,n),d=e.param(c||{}),f=e.Deferred();return s=o.cachedResponse[d],s&&e.isArray(s.suggestions)?f.resolve(s.suggestions):o.isBadQuery(t)?f.reject():a||!1!==r.onSearchStart.call(o.element,c)?o.doGetSuggestions(c,l).done(function(e){o.processResponse(e)&&t==o.currentValue?(r.noCache||(u?o.enrichmentCache[t]=e.suggestions[0]:(o.enrichResponse(e,t),o.cachedResponse[d]=e,r.preventBadQueries&&0===e.suggestions.length&&o.badQueries.push(t))),f.resolve(e.suggestions)):f.reject(),
24010a||r.onSearchComplete.call(o.element,t,e.suggestions)}).fail(function(e,n,i){f.reject(),a||"abort"===n||r.onSearchError.call(o.element,t,e,n,i)}):f.reject(),f},doGetSuggestions:function(t,n){var i=this,s=e.ajax(i.getAjaxParams(n,{data:L.serialize(t)}));return i.abortRequest(),i.currentRequest=s,i.notify("request"),s.always(function(){i.currentRequest=null,i.notify("request")}),s},isBadQuery:function(t){if(!this.options.preventBadQueries)return!1;var n=!1;return e.each(this.badQueries,function(e,i){return!(n=0===t.indexOf(i))}),n},abortRequest:function(){var e=this;e.currentRequest&&e.currentRequest.abort()},processResponse:function(t){var n,i=this;return!(!t||!e.isArray(t.suggestions))&&(i.verifySuggestionsFormat(t.suggestions),i.setUnrestrictedValues(t.suggestions),e.isFunction(i.options.onSuggestionsFetch)&&(n=i.options.onSuggestionsFetch.call(i.element,t.suggestions),e.isArray(n)&&(t.suggestions=n)),!0)},verifySuggestionsFormat:function(t){"string"==typeof t[0]&&e.each(t,function(e,n){t[e]={value:n,data:null}})},getSuggestionValue:function(t,n){var i,s=this,o=s.options.formatSelected||s.type.formatSelected,r=n&&n.hasSameValues,a=n&&n.hasBeenEnriched,u=null;return e.isFunction(o)&&(i=o.call(s,t)),"string"!=typeof i&&(i=t.value,s.type.getSuggestionValue&&null!==(u=s.type.getSuggestionValue(s,{suggestion:t,hasSameValues:r,hasBeenEnriched:a}))&&(i=u)),i},hasSameValues:function(t){var n=!1;return e.each(this.suggestions,function(e,i){if(i.value===t.value&&i!==t)return n=!0,!1}),n},assignSuggestions:function(e,t){var n=this;n.suggestions=e,n.notify("assignSuggestions",t)},shouldRestrictValues:function(){var e=this;return e.options.restrict_value&&e.constraints&&1==Object.keys(e.constraints).length},setUnrestrictedValues:function(t){var n=this,i=n.shouldRestrictValues(),s=n.getFirstConstraintLabel();e.each(t,function(e,t){t.unrestricted_value||(t.unrestricted_value=i?s+", "+t.value:t.value)})},areSuggestionsSame:function(e,t){return e&&t&&e.value===t.value&&L.areSame(e.data,t.data)},getNoSuggestionsHint:function(){var e=this;return!1!==e.options.noSuggestionsHint&&(e.options.noSuggestionsHint||e.type.noSuggestionsHint)}};var K={setupElement:function(){this.el.attr("autocomplete","new-password").attr("autocorrect","off").attr("autocapitalize","off").attr("spellcheck","false").addClass("suggestions-input").css("box-sizing","border-box")},bindElementEvents:function(){var t=this;t.el.on("keydown"+S,e.proxy(t.onElementKeyDown,t)),t.el.on(["keyup"+S,"cut"+S,"paste"+S,"input"+S].join(" "),e.proxy(t.onElementKeyUp,t)),t.el.on("blur"+S,e.proxy(t.onElementBlur,t)),t.el.on("focus"+S,e.proxy(t.onElementFocus,t))},unbindElementEvents:function(){this.el.off(S)},onElementBlur:function(){var e=this;if(e.cancelBlur)return void(e.cancelBlur=!1);e.options.triggerSelectOnBlur?e.isUnavailable()||e.selectCurrentValue({noSpace:!0}).always(function(){e.hide()}):e.hide(),e.fetchPhase.abort&&e.fetchPhase.abort()},onElementFocus:function(){var t=this;t.cancelFocus||L.delay(e.proxy(t.completeOnFocus,t)),t.cancelFocus=!1},onElementKeyDown:function(e){var t=this;if(!t.isUnavailable())if(t.visible){switch(e.which){case b.ESC:t.el.val(t.currentValue),t.hide(),t.abortRequest();break;case b.TAB:if(!1===t.options.tabDisabled)return;break;case b.ENTER:t.options.triggerSelectOnEnter&&t.selectCurrentValue();break;case b.SPACE:return void(t.options.triggerSelectOnSpace&&t.isCursorAtEnd()&&(e.preventDefault(),t.selectCurrentValue({continueSelecting:!0,dontEnrich:!0}).fail(function(){t.currentValue+=" ",t.el.val(t.currentValue),t.proceedChangedValue()})));case b.UP:t.moveUp();break;case b.DOWN:t.moveDown();break;default:return}e.stopImmediatePropagation(),e.preventDefault()}else switch(e.which){case b.DOWN:t.suggest();break;case b.ENTER:t.options.triggerSelectOnEnter&&t.triggerOnSelectNothing()}},onElementKeyUp:function(e){var t=this;if(!t.isUnavailable()){switch(e.which){case b.UP:case b.DOWN:case b.ENTER:return}clearTimeout(t.onChangeTimeout),t.inputPhase.reject(),t.currentValue!==t.el.val()&&t.proceedChangedValue()}},proceedChangedValue:function(){var t=this;t.abortRequest(),t.inputPhase=e.Deferred().done(e.proxy(t.onValueChange,t)),t.options.deferRequestBy>0?t.onChangeTimeout=L.delay(function(){t.inputPhase.resolve()},t.options.deferRequestBy):t.inputPhase.resolve()},onValueChange:function(){var e,t=this;t.selection&&(e=t.selection,t.selection=null,t.trigger("InvalidateSelection",e)),t.selectedIndex=-1,t.update(),t.notify("valueChange")},completeOnFocus:function(){var e=this;e.isUnavailable()||e.isElementFocused()&&(e.update(),e.isMobile&&(e.setCursorAtEnd(),e.scrollToTop()))},isElementFocused:function(){return document.activeElement===this.element},isElementDisabled:function(){return Boolean(this.element.getAttribute("disabled")||this.element.getAttribute("readonly"))},isCursorAtEnd:function(){var e,t,n=this,i=n.el.val().length;try{if("number"==typeof(e=n.element.selectionStart))return e===i}catch(e){}return!document.selection||(t=document.selection.createRange(),t.moveStart("character",-i),i===t.text.length)},setCursorAtEnd:function(){var e=this.element;try{e.selectionEnd=e.selectionStart=e.value.length,e.scrollLeft=e.scrollWidth}catch(t){e.value=e.value}}};e.extend(r.prototype,K),U.on("initialize",K.bindElementEvents).on("dispose",K.unbindElementEvents);var G={};a();var J={checkStatus:function(){function e(e){L.isFunction(t.options.onSearchError)&&t.options.onSearchError.call(t.element,null,s,"error",e)}var t=this,n=t.options.token&&t.options.token.trim()||"",i=t.options.type+n,s=G[i];s||(s=G[i]=B.ajax(t.getAjaxParams("status"))),s.done(function(n,i,s){if(n.search){var o=s.getResponseHeader("X-Plan");n.plan=o,B.extend(t.status,n)}else e("Service Unavailable")}).fail(function(){e(s.statusText)})}};r.resetTokens=a,B.extend(r.prototype,J),U.on("setOptions",J.checkStatus);var X,Y=!0,Z={checkLocation:function(){var t=this,n=t.options.geoLocation;t.type.geoEnabled&&n&&(t.geoLocation=e.Deferred(),e.isPlainObject(n)||e.isArray(n)?t.geoLocation.resolve(n):(X||(X=e.ajax(t.getAjaxParams("iplocate/address"))),X.done(function(e){var n=e&&e.location&&e.location.data;n&&n.kladr_id?t.geoLocation.resolve({kladr_id:n.kladr_id}):t.geoLocation.reject()}).fail(function(){t.geoLocation.reject()})))},getGeoLocation:function(){return this.geoLocation},constructParams:function(){var t=this,n={};return t.geoLocation&&e.isFunction(t.geoLocation.promise)&&"resolved"==t.geoLocation.state()&&t.geoLocation.done(function(t){n.locations_boost=e.makeArray(t)}),n}};"GET"!=L.getDefaultType()&&(e.extend(V,{geoLocation:Y}),e.extend(r,{resetLocation:u}),e.extend(r.prototype,{getGeoLocation:Z.getGeoLocation}),U.on("setOptions",Z.checkLocation).on("requestParams",Z.constructParams));var ee={enrichSuggestion:function(t,n){var i=this,s=e.Deferred();if(!i.options.enrichmentEnabled||!i.type.enrichmentEnabled||!i.requestMode.enrichmentEnabled||n&&n.dontEnrich)return s.resolve(t);if(t.data&&null!=t.data.qc)return s.resolve(t);i.disableDropdown();var o=i.type.getEnrichmentQuery(t),r=i.type.enrichmentParams,a={noCallbacks:!0,useEnrichmentCache:!0,method:i.type.enrichmentMethod};return i.currentValue=o,i.enrichPhase=i.getSuggestions(o,r,a).always(function(){i.enableDropdown()}).done(function(e){var n=e&&e[0];s.resolve(n||t,!!n)}).fail(function(){s.resolve(t)}),s},enrichResponse:function(t,n){var i=this,s=i.enrichmentCache[n];s&&e.each(t.suggestions,function(e,i){if(i.value===n)return t.suggestions[e]=s,!1})}};e.extend(r.prototype,ee);var te={width:"auto",floating:!1},ne={createContainer:function(){var t=this,n="."+t.classes.suggestion,i=t.options,s=e("<div/>").addClass(i.containerClass).css({display:"none"});t.$container=s,s.on("click"+S,n,e.proxy(t.onSuggestionClick,t))},showContainer:function(){this.$container.appendTo(this.options.floating?this.$body:this.$wrapper)},getContainer:function(){return this.$container.get(0)},removeContainer:function(){var e=this;e.options.floating&&e.$container.remove()},setContainerOptions:function(){var t=this;t.$container.off("mousedown.suggestions"),t.options.floating&&t.$container.on("mousedown.suggestions",e.proxy(t.onMousedown,t))},onSuggestionClick:function(t){var n,i=this,s=e(t.target);if(!i.dropdownDisabled){for(i.cancelFocus=!0,i.el.focus();s.length&&!(n=s.attr("data-index"));)s=s.closest("."+i.classes.suggestion);n&&!isNaN(n)&&i.select(+n)}},getSuggestionsItems:function(){return this.$container.children("."+this.classes.suggestion)},toggleDropdownEnabling:function(e){this.dropdownDisabled=!e,this.$container.attr("disabled",!e)},disableDropdown:function(){this.toggleDropdownEnabling(!1)},enableDropdown:function(){this.toggleDropdownEnabling(!0)},hasSuggestionsToChoose:function(){var t=this;return t.suggestions.length>1||1===t.suggestions.length&&(!t.selection||e.trim(t.suggestions[0].value)!==e.trim(t.selection.value))},suggest:function(){var t=this,n=t.options,i=[];if(t.requestMode.userSelect){if(t.hasSuggestionsToChoose())n.hint&&t.suggestions.length&&i.push('<div class="'+t.classes.hint+'">'+n.hint+"</div>"),t.selectedIndex=-1,t.suggestions.forEach(function(e,n){e==t.selection&&(t.selectedIndex=n),t.buildSuggestionHtml(e,n,i)});else{if(t.suggestions.length)return void t.hide();var s=t.getNoSuggestionsHint();if(!s)return void t.hide();i.push('<div class="'+t.classes.hint+'">'+s+"</div>")}i.push('<div class="'+x.promo+'"></div>'),i.push("</div>"),t.$container.html(i.join("")),n.autoSelectFirst&&-1===t.selectedIndex&&(t.selectedIndex=0),-1!==t.selectedIndex&&t.getSuggestionsItems().eq(t.selectedIndex).addClass(t.classes.selected),e.isFunction(n.beforeRender)&&n.beforeRender.call(t.element,t.$container),t.$container.show(),t.visible=!0}},buildSuggestionHtml:function(e,t,n){n.push('<div class="'+this.classes.suggestion+'" data-index="'+t+'">');var i=this.options.formatResult||this.type.formatResult||this.formatResult;n.push(i.call(this,e.value,this.currentValue,e,{unformattableTokens:this.type.unformattableTokens}));var s=this.makeSuggestionLabel(this.suggestions,e);s&&n.push('<span class="'+this.classes.subtext_label+'">'+L.escapeHtml(s)+"</span>"),n.push("</div>")},wrapFormattedValue:function(e,t){var n=this,i=L.getDeepValue(t.data,"state.status");return'<span class="'+n.classes.value+'"'+(i?' data-suggestion-status="'+i+'"':"")+">"+e+"</span>"},formatResult:function(e,t,n,i){var s=this;return e=s.highlightMatches(e,t,n,i),s.wrapFormattedValue(e,n)},highlightMatches:function(t,n,i,s){var o,r,a,u,d,f,p,g=this,h=[],m=s&&s.unformattableTokens,y=s&&s.maxLength,_=L.reWordExtractor();if(!t)return"";for(o=k.tokenize(n,m),r=e.map(o,function(e){return new RegExp("^((.*)([\\-\\+\\\\\\?!@#$%^&]+))?("+L.escapeRegExChars(e)+")([^\\-\\+\\\\\\?!@#$%^&]*[\\-\\+\\\\\\?!@#$%^&]*)","i")});(a=_.exec(t))&&a[0];)u=a[1],h.push({text:u,hasUpperCase:u.toLowerCase()!==u,formatted:L.formatToken(u),matchable:!0}),a[2]&&h.push({text:a[2]});for(d=0;d<h.length;d++)f=h[d],!f.matchable||f.matched||-1!==e.inArray(f.formatted,m)&&!f.hasUpperCase||e.each(r,function(e,t){var n,i=t.exec(f.formatted),s=d+1;if(i)return i={before:i[1]||"",beforeText:i[2]||"",beforeDelimiter:i[3]||"",text:i[4]||"",after:i[5]||""},i.before&&(h.splice(d,0,{text:f.text.substr(0,i.beforeText.length),formatted:i.beforeText,matchable:!0},{text:i.beforeDelimiter}),s+=2,n=i.before.length,f.text=f.text.substr(n),f.formatted=f.formatted.substr(n),d--),n=i.text.length+i.after.length,f.formatted.length>n&&(h.splice(s,0,{text:f.text.substr(n),formatted:f.formatted.substr(n),matchable:!0}),f.text=f.text.substr(0,n),f.formatted=f.formatted.substr(0,n)),i.after&&(n=i.text.length,h.splice(s,0,{text:f.text.substr(n),formatted:f.formatted.substr(n)}),f.text=f.text.substr(0,n),f.formatted=f.formatted.substr(0,n)),f.matched=!0,!1});if(y){for(d=0;d<h.length&&y>=0;d++)f=h[d],(y-=f.text.length)<0&&(f.text=f.text.substr(0,f.text.length+y)+"...");h.length=d}return p=l(h),c(p,g.classes.nowrap)},makeSuggestionLabel:function(t,n){var i,s,o=this,r=o.type.fieldNames,a={},u=L.reWordExtractor(),l=[];if(r&&d(t,n)&&n.data&&(e.each(r,function(e){var t=n.data[e];t&&(a[e]=L.formatToken(t))}),!e.isEmptyObject(a))){for(;(i=u.exec(L.formatToken(n.value)))&&(s=i[1]);)e.each(a,function(e,t){if(t==s)return l.push(r[e]),delete a[e],!1});if(l.length)return l.join(", ")}},hide:function(){var e=this;e.visible=!1,e.selectedIndex=-1,e.$container.hide().empty()},activate:function(e){var t,n,i=this,s=i.classes.selected;return!i.dropdownDisabled&&(n=i.getSuggestionsItems(),n.removeClass(s),i.selectedIndex=e,-1!==i.selectedIndex&&n.length>i.selectedIndex)?(t=n.eq(i.selectedIndex),t.addClass(s),t):null},deactivate:function(e){var t=this;t.dropdownDisabled||(t.selectedIndex=-1,t.getSuggestionsItems().removeClass(t.classes.selected),e&&t.el.val(t.currentValue))},moveUp:function(){var e=this;if(!e.dropdownDisabled)return-1===e.selectedIndex?void(e.suggestions.length&&e.adjustScroll(e.suggestions.length-1)):0===e.selectedIndex?void e.deactivate(!0):void e.adjustScroll(e.selectedIndex-1)},moveDown:function(){var e=this;if(!e.dropdownDisabled)return e.selectedIndex===e.suggestions.length-1?void e.deactivate(!0):void e.adjustScroll(e.selectedIndex+1)},adjustScroll:function(e){var t,n,i,s=this,o=s.activate(e),r=s.$container.scrollTop();o&&o.length&&(t=o.position().top,t<0?s.$container.scrollTop(r+t):(n=t+o.outerHeight(),i=s.$container.innerHeight(),n>i&&s.$container.scrollTop(r-i+n)),s.el.val(s.suggestions[e].value))}};e.extend(V,te),e.extend(r.prototype,ne),U.on("initialize",ne.createContainer).on("dispose",ne.removeContainer).on("setOptions",ne.setContainerOptions).on("ready",ne.showContainer).on("assignSuggestions",ne.suggest);var ie={constraints:null,restrict_value:!1},se=["country_iso_code","region_iso_code","region_fias_id","area_fias_id","city_fias_id","city_district_fias_id","settlement_fias_id","planning_structure_fias_id","street_fias_id"],oe=function(e,t){var n,i,s=this,o={};s.instance=t,s.fields={},s.specificity=-1,m.isPlainObject(e)&&t.type.dataComponents&&y.each(t.type.dataComponents,function(t,n){var i=t.id;t.forLocations&&e[i]&&(s.fields[i]=e[i],s.specificity=n)}),n=Object.keys(s.fields),i=y.intersect(n,se),i.length?(y.each(i,function(e,t){o[e]=s.fields[e]}),s.fields=o,s.specificity=s.getFiasSpecificity(i)):s.fields.kladr_id&&(s.fields={kladr_id:s.fields.kladr_id},s.significantKladr=p(s.fields.kladr_id),s.specificity=s.getKladrSpecificity(s.significantKladr))};B.extend(oe.prototype,{getLabel:function(){return this.instance.type.composeValue(this.fields,{saveCityDistrict:!0})},getFields:function(){return this.fields},isValid:function(){return!m.isEmptyObject(this.fields)},getKladrSpecificity:function(e){var t=-1,n=e.length;return y.each(this.instance.type.dataComponents,function(e,i){e.kladrFormat&&n===e.kladrFormat.digits&&(t=i)}),t},getFiasSpecificity:function(e){var t=-1;return y.each(this.instance.type.dataComponents,function(n,i){n.fiasType&&e.indexOf(n.fiasType)>-1&&t<i&&(t=i)}),t},containsData:function(e){var t=!0;return this.fields.kladr_id?!!e.kladr_id&&0===e.kladr_id.indexOf(this.significantKladr):(y.each(this.fields,function(n,i){return t=!!e[i]&&e[i].toLowerCase()===n.toLowerCase()}),t)}}),r.ConstraintLocation=oe;var re=function(e,t){this.id=j("c"),this.deletable=!!e.deletable,this.instance=t;var n=y.makeArray(e&&(e.locations||e.restrictions));this.locations=n.map(function(e){return new oe(e,t)}),this.locations=this.locations.filter(function(e){return e.isValid()}),this.label=e.label,null==this.label&&t.type.composeValue&&(this.label=this.locations.map(function(e){return e.getLabel()}).join(", "))};B.extend(re.prototype,{isValid:function(){return this.locations.length>0},getFields:function(){return this.locations.map(function(e){return e.getFields()})}});var ae={createConstraints:function(){this.constraints={}},setupConstraints:function(){var e,t=this,n=t.options.constraints;if(!n)return void t.unbindFromParent();B.isJqObject(n)||"string"==typeof n||"number"==typeof n.nodeType?(e=B.select(n),e.is(t.constraints)||(t.unbindFromParent(),e.is(t.el)||(t.constraints=e,t.bindToParent()))):(y.each(t.constraints,function(e,n){t.removeConstraint(n)}),y.each(y.makeArray(n),function(e,n){t.addConstraint(e)}))},filteredLocation:function(e){var t=[],n={};if(y.each(this.type.dataComponents,function(){this.forLocations&&t.push(this.id)}),m.isPlainObject(e)&&y.each(e,function(e,i){e&&t.indexOf(i)>=0&&(n[i]=e)}),!m.isEmptyObject(n))return n.kladr_id?{kladr_id:n.kladr_id}:n},addConstraint:function(e){var t=this;e=new re(e,t),e.isValid()&&(t.constraints[e.id]=e)},removeConstraint:function(e){delete this.constraints[e]},constructConstraintsParams:function(){for(var e,t,n=this,i=[],s=n.constraints,o={};B.isJqObject(s)&&(e=s.suggestions())&&!(t=v.getDeepValue(e,"selection.data"));)s=e.constraints;return B.isJqObject(s)?(t=new oe(t,e).getFields())&&(n.bounds.own.indexOf("city")>-1&&delete t.city_fias_id,o.locations=[t],o.restrict_value=!0):s&&(y.each(s,function(e,t){i=i.concat(e.getFields())}),i.length&&(o.locations=i,o.restrict_value=n.options.restrict_value)),o},getFirstConstraintLabel:function(){var e=this,t=m.isPlainObject(e.constraints)&&Object.keys(e.constraints)[0];return t?e.constraints[t].label:""},bindToParent:function(){var e=this;e.constraints.on(["suggestions-select."+e.uniqueId,"suggestions-invalidateselection."+e.uniqueId,"suggestions-clear."+e.uniqueId].join(" "),B.proxy(e.onParentSelectionChanged,e)).on("suggestions-dispose."+e.uniqueId,B.proxy(e.onParentDispose,e))},unbindFromParent:function(){var e=this,t=e.constraints;B.isJqObject(t)&&t.off("."+e.uniqueId)},onParentSelectionChanged:function(e,t,n){("suggestions-select"!==e.type||n)&&this.clear()},onParentDispose:function(e){this.unbindFromParent()},getParentInstance:function(){return B.isJqObject(this.constraints)&&this.constraints.suggestions()},shareWithParent:function(e){var t=this.getParentInstance();t&&t.type===this.type&&!f(e,t)&&(t.shareWithParent(e),t.setSuggestion(e))},getUnrestrictedData:function(e){var t=this,n=[],i={},s=-1;return y.each(t.constraints,function(t,n){y.each(t.locations,function(t,n){t.containsData(e)&&t.specificity>s&&(s=t.specificity)})}),s>=0?(e.region_kladr_id&&e.region_kladr_id===e.city_kladr_id&&n.push.apply(n,t.type.dataComponentsById.city.fields),y.each(t.type.dataComponents.slice(0,s+1),function(e,t){n.push.apply(n,e.fields)}),y.each(e,function(e,t){-1===n.indexOf(t)&&(i[t]=e)})):i=e,i}};B.extend(V,ie),B.extend(r.prototype,ae),"GET"!=T.getDefaultType()&&U.on("initialize",ae.createConstraints).on("setOptions",ae.setupConstraints).on("requestParams",ae.constructConstraintsParams).on("dispose",ae.unbindFromParent);var ue={proceedQuery:function(e){var t=this;e.length>=t.options.minChars?t.updateSuggestions(e):t.hide()},selectCurrentValue:function(e){var t=this,n=B.Deferred();return t.inputPhase.resolve(),t.fetchPhase.done(function(){var i;t.selection&&!t.visible?n.reject():(i=t.findSuggestionIndex(),t.select(i,e),-1===i?n.reject():n.resolve(i))}).fail(function(){n.reject()}),n},selectFoundSuggestion:function(){var e=this;e.requestMode.userSelect||e.select(0)},findSuggestionIndex:function(){var e,t=this,n=t.selectedIndex;return-1===n&&(e=t.el.val().trim())&&t.type.matchers.some(function(i){return-1!==(n=i(e,t.suggestions))}),n},select:function(e,t){var n,i=this,s=i.suggestions[e],o=t&&t.continueSelecting,r=i.currentValue;if(!i.triggering.Select){if(!s)return o||i.selection||i.triggerOnSelectNothing(),void i.onSelectComplete(o);n=i.hasSameValues(s),i.enrichSuggestion(s,t).done(function(s,o){var a=B.extend({hasBeenEnriched:o,hasSameValues:n},t);i.selectSuggestion(s,e,r,a)})}},selectSuggestion:function(e,t,n,i){var s=this,o=i.continueSelecting,r=!s.type.isDataComplete||s.type.isDataComplete.call(s,e),a=s.selection;s.triggering.Select||(s.type.alwaysContinueSelecting&&(o=!0),r&&(o=!1),i.hasBeenEnriched&&s.suggestions[t]&&(s.suggestions[t].data=e.data),s.requestMode.updateValue&&(s.checkValueBounds(e),s.currentValue=s.getSuggestionValue(e,i),!s.currentValue||i.noSpace||r||(s.currentValue+=" "),s.el.val(s.currentValue)),s.currentValue?(s.selection=e,s.areSuggestionsSame(e,a)||s.trigger("Select",e,s.currentValue!=n),s.requestMode.userSelect&&s.onSelectComplete(o)):(s.selection=null,s.triggerOnSelectNothing()),s.shareWithParent(e))},onSelectComplete:function(e){var t=this;e?(t.selectedIndex=-1,t.updateSuggestions(t.currentValue)):t.hide()},triggerOnSelectNothing:function(){var e=this;e.triggering.SelectNothing||e.trigger("SelectNothing",e.currentValue)},trigger:function(e){var t=this,n=L.slice(arguments,1),i=t.options["on"+e];t.triggering[e]=!0,L.isFunction(i)&&i.apply(t.element,n),t.el.trigger.call(t.el,"suggestions-"+e.toLowerCase(),n),t.triggering[e]=!1}};B.extend(r.prototype,ue),U.on("assignSuggestions",ue.selectFoundSuggestion);var le={bounds:null},ce={setupBounds:function(){this.bounds={from:null,to:null}},setBoundsOptions:function(){var t,n=this,i=[],s=e.trim(n.options.bounds).split("-"),o=s[0],r=s[s.length-1],a=[],u=[];n.type.dataComponents&&e.each(n.type.dataComponents,function(){this.forBounds&&i.push(this.id)}),-1===i.indexOf(o)&&(o=null),-1===i.indexOf(r)&&(r=null),(o||r)&&(t=!o,e.each(i,function(e,n){if(n==o&&(t=!0),u.push(n),t&&a.push(n),n==r)return!1})),n.bounds.from=o,n.bounds.to=r,n.bounds.all=u,n.bounds.own=a},constructBoundsParams:function(){var e=this,t={};return e.bounds.from&&(t.from_bound={value:e.bounds.from}),e.bounds.to&&(t.to_bound={value:e.bounds.to}),t},checkValueBounds:function(e){var t,n=this;if(n.bounds.own.length&&n.type.composeValue){var i=n.bounds.own.slice(0);1===i.length&&"city_district"===i[0]&&i.push("city_district_fias_id"),t=n.copyDataComponents(e.data,i),e.value=n.type.composeValue(t)}},copyDataComponents:function(t,n){var i={},s=this.type.dataComponentsById;return s&&e.each(n,function(n,o){e.each(s[o].fields,function(e,n){null!=t[n]&&(i[n]=t[n])})}),i},getBoundedKladrId:function(t,n){var i,s=n[n.length-1];return e.each(this.type.dataComponents,function(e,t){if(t.id===s)return i=t.kladrFormat,!1}),t.substr(0,i.digits)+new Array((i.zeros||0)+1).join("0")}};e.extend(V,le),e.extend(r.prototype,ce),U.on("initialize",ce.setupBounds).on("setOptions",ce.setBoundsOptions).on("requestParams",ce.constructBoundsParams);var de={selectByClass:function(e,t){var n="."+e;return t?t.querySelector(n):document.querySelector(n)},addClass:function(e,t){var n=e.className.split(" ");-1===n.indexOf(t)&&n.push(t),e.className=n.join(" ")},setStyle:function(e,t,n){e.style[t]=n},listenTo:function(e,t,n,i){e.addEventListener(t,i,!1),n&&(eventsByNamespace[n]||(eventsByNamespace[n]=[]),eventsByNamespace[n].push({eventName:t,element:e,callback:i}))},stopListeningNamespace:function(e){var t=eventsByNamespace[e];t&&t.forEach(function(e){e.element.removeEventListener(e.eventName,e.callback,!1)})}};g.prototype.show=function(){"FREE"===this.plan&&this.element&&(this.setStyles(),this.setHtml())},g.prototype.setStyles=function(){this.element.style.display="block"},g.prototype.setHtml=function(){this.element.innerHTML='<a target="_blank" tabindex="-1" href="https://dadata.ru/suggestions/?utm_source=dadata&utm_medium=module&utm_campaign=suggestions-jquery"><svg version="1.1" viewBox="0 0 128 38" xmlns="http://www.w3.org/2000/svg"><path d="m128 19v16.077c0 1.614-1.302 2.923-2.909 2.923h-122.18c-1.607 0-2.909-1.309-2.909-2.923v-32.154c-0-1.614 1.302-2.923 2.909-2.923h122.18c1.607 0 2.909 1.309 2.909 2.923z" fill="#ef4741"/><path d="m59.52 7.912h-8.902v22.098h9.92c3.724 0 9.872-0.341 9.872-6.703v-8.682c-0.01-6.372-7.166-6.713-10.89-6.713zm5.595 14.81c0 3.186-2.308 3.508-4.936 3.508h-4.276v-14.538h3.287c2.628 0 5.954 0.322 5.954 3.508zm-46.545-14.81h-8.834v22.098h9.871c3.724 0 9.872-0.341 9.872-6.703v-8.682c0-6.372-7.137-6.713-10.88-6.713zm5.595 14.81c0 3.186-2.308 3.508-4.936 3.508h-4.247v-14.538h3.258c2.628 0 5.954 0.322 5.954 3.508zm71.757-13.953h-4.945v16.301c-0.018 0.785 0.113 1.565 0.388 2.3 0.203 0.569 0.535 1.082 0.97 1.5 0.446 0.385 0.962 0.677 1.522 0.858 0.58 0.205 1.182 0.343 1.794 0.409 0.575 0.052 1.248 0.081 2.017 0.088 0.917-1e-3 1.834-0.057 2.744-0.166v-2.796h-1.765c-0.393 0.055-0.795 0.032-1.18-0.071-0.385-0.102-0.745-0.28-1.06-0.524-0.413-0.691-0.59-1.498-0.504-2.299v-8.068h4.509v-3.06h-4.509zm20.364 5.535c-1.176-0.741-3.278-1.108-6.303-1.101h-5.741v0.243l0.708 2.826h5.033c0.837-0.051 1.672 0.117 2.424 0.487 0.259 0.248 0.458 0.553 0.579 0.891 0.121 0.339 0.162 0.701 0.119 1.058v1.12h-5.527c-1.939 0-3.271 0.38-3.995 1.14-0.725 0.76-1.099 2.127-1.125 4.102 0 2.154 0.359 3.06 1.086 3.742 0.728 0.682 2.134 1.188 4.344 1.188h6.847c1.706 0 3.345-0.808 3.345-2.747v-8.584c0-2.176-0.589-3.635-1.765-4.375zm-3.19 12.959h-3.249c-0.735 0.081-1.478-0.036-2.152-0.342-0.285-0.227-0.427-0.876-0.427-1.948s0.136-1.741 0.407-2.007c0.625-0.331 1.336-0.46 2.037-0.371h3.384zm-26.667-12.959c-1.176-0.741-3.277-1.108-6.303-1.101h-5.741v0.243l0.708 2.826h5.033c0.836-0.051 1.672 0.117 2.424 0.487 0.259 0.248 0.457 0.553 0.578 0.891 0.121 0.339 0.162 0.701 0.12 1.058v1.12h-5.556c-1.939 0-3.271 0.38-3.995 1.14s-1.086 2.127-1.086 4.102c0 2.154 0.359 3.06 1.086 3.742s2.133 1.188 4.344 1.188h6.846c1.717 0 3.346-0.808 3.346-2.747v-8.584c-7e-3 -2.176-0.595-3.635-1.765-4.375zm-3.181 12.959h-3.248c-0.735 0.081-1.478-0.037-2.153-0.342-0.284-0.227-0.426-0.876-0.426-1.948s0.135-1.741 0.407-2.007c0.624-0.331 1.336-0.46 2.036-0.371h3.384zm-37.74-12.959c-1.176-0.741-3.278-1.108-6.303-1.101h-5.712v0.243l0.708 2.826h5.033c0.837-0.051 1.672 0.117 2.424 0.487 0.259 0.248 0.457 0.553 0.578 0.891 0.121 0.339 0.162 0.701 0.12 1.058v1.12h-5.556c-1.939 0-3.271 0.38-3.995 1.14s-1.099 2.127-1.125 4.102c0 2.154 0.359 3.06 1.086 3.742s2.133 1.188 4.344 1.188h6.846c1.717 0 3.346-0.808 3.346-2.747v-8.584c0-2.176-0.589-3.635-1.765-4.375zm-3.181 12.959h-3.219c-0.735 0.081-1.478-0.037-2.153-0.342-0.284-0.227-0.427-0.876-0.427-1.948s0.136-1.741 0.408-2.007c0.624-0.331 1.336-0.46 2.036-0.371h3.384z" fill="#fff"/></svg></a>'},U.on("assignSuggestions",h),r.defaultOptions=V,r.version="2
vendor: 33,926 bytes, lines 24010-24014
240101.12.0",e.Suggestions=r,e.fn.suggestions=function(t,n){return 0===arguments.length?this.first().data("suggestions"):this.each(function(){var i=e(this),s=i.data("suggestions");"string"==typeof t?s&&"function"==typeof s[t]&&s[t](n):(s&&s.dispose&&s.dispose(),s=new r(this,t),i.data("suggestions",s))})}});
24011/* End */
24012;
24013; /* Start:"a:4:{s:4:"full";s:77:"/local/templates/aspro_next/js/jquery.mCustomScrollbar.min.js?172597044439873";s:6:"source";s:61:"/local/templates/aspro_next/js/jquery.mCustomScrollbar.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
24014!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"undefined"!=typeof module&&module.exports?module.exports=e:e(jQuery,window,document)}(function(e){var t,o,a,n,i,r,l,s,c,d,u,f,h,m,p,g,v,x,_,w,S,b,C,y,B,T,k,M,O,I,D,E,W,R,A,L,z,P,H,U,F,q,j,Y,X,N,V,Q,G,J,K,Z,$,ee,te,oe,ae,ne,ie,re;ne="function"==typeof define&&define.amd,ie="undefined"!=typeof module&&module.exports,re="https:"==document.location.protocol?"https:":"http:",ne||(ie?require("jquery-mousewheel")(e):e.event.special.mousewheel||e("head").append(decodeURI("%3Cscript src="+re+"//cdnjs.cloudflare.com/ajax/libs/jquery-mousewheel/3.1.13/jquery.mousewheel.min.js%3E%3C/script%3E"))),o="mCustomScrollbar",a="mCS",n=".mCustomScrollbar",i={setTop:0,setLeft:0,axis:"y",scrollbarPosition:"inside",scrollInertia:100,autoDraggerLength:!0,alwaysShowScrollbar:0,snapOffset:0,mouseWheel:{enable:!0,scrollAmount:"auto",axis:"y",deltaFactor:"auto",disableOver:["select","option","keygen","datalist","textarea"]},scrollButtons:{scrollType:"stepless",scrollAmount:"auto"},keyboard:{enable:!0,scrollType:"stepless",scrollAmount:"auto"},contentTouchScroll:25,documentTouchScroll:!0,advanced:{autoScrollOnFocus:"input,textarea,select,button,datalist,keygen,a[tabindex],area,object,[contenteditable='true']",updateOnContentResize:!0,updateOnImageLoad:"auto",autoUpdateTimeout:60},theme:"light",callbacks:{onTotalScrollOffset:0,onTotalScrollBackOffset:0,alwaysTriggerOffsets:!0}},r=0,l={},s=window.attachEvent&&!window.addEventListener?1:0,c=!1,d=["mCSB_dragger_onDrag","mCSB_scrollTools_onDrag","mCS_img_loaded","mCS_disabled","mCS_destroyed","mCS_no_scrollbar","mCS-autoHide","mCS-dir-rtl","mCS_no_scrollbar_y","mCS_no_scrollbar_x","mCS_y_hidden","mCS_x_hidden","mCSB_draggerContainer","mCSB_buttonUp","mCSB_buttonDown","mCSB_buttonLeft","mCSB_buttonRight"],u={init:function(t){var t=e.extend(!0,{},i,t),o=f.call(this);if(t.live){var s=t.liveSelector||this.selector||n,c=e(s);if("off"===t.live)return void m(s);l[s]=setTimeout(function(){c.mCustomScrollbar(t),"once"===t.live&&c.length&&m(s)},500)}else m(s);return t.setWidth=t.set_width?t.set_width:t.setWidth,t.setHeight=t.set_height?t.set_height:t.setHeight,t.axis=t.horizontalScroll?"x":p(t.axis),t.scrollInertia=t.scrollInertia>0&&t.scrollInertia<17?17:t.scrollInertia,"object"!=typeof t.mouseWheel&&1==t.mouseWheel&&(t.mouseWheel={enable:!0,scrollAmount:"auto",axis:"y",preventDefault:!1,deltaFactor:"auto",normalizeDelta:!1,invert:!1}),t.mouseWheel.scrollAmount=t.mouseWheelPixels?t.mouseWheelPixels:t.mouseWheel.scrollAmount,t.mouseWheel.normalizeDelta=t.advanced.normalizeMouseWheelDelta?t.advanced.normalizeMouseWheelDelta:t.mouseWheel.normalizeDelta,t.scrollButtons.scrollType=g(t.scrollButtons.scrollType),h(t),e(o).each(function(){var o=e(this);if(!o.data(a)){o.data(a,{idx:++r,opt:t,scrollRatio:{y:null,x:null},overflowed:null,contentReset:{y:null,x:null},bindEvents:!1,tweenRunning:!1,sequential:{},langDir:o.css("direction"),cbOffsets:null,trigger:null,poll:{size:{o:0,n:0},img:{o:0,n:0},change:{o:0,n:0}}});var n=o.data(a),i=n.opt,l=o.data("mcs-axis"),s=o.data("mcs-scrollbar-position"),c=o.data("mcs-theme");l&&(i.axis=l),s&&(i.scrollbarPosition=s),c&&(i.theme=c,h(i)),v.call(this),n&&i.callbacks.onCreate&&"function"==typeof i.callbacks.onCreate&&i.callbacks.onCreate.call(this),e("#mCSB_"+n.idx+"_container img:not(."+d[2]+")").addClass(d[2]),u.update.call(null,o)}})},update:function(t,o){var n=t||f.call(this);return e(n).each(function(){var t=e(this);if(t.data(a)){var n=t.data(a),i=n.opt,r=e("#mCSB_"+n.idx+"_container"),l=e("#mCSB_"+n.idx),s=[e("#mCSB_"+n.idx+"_dragger_vertical"),e("#mCSB_"+n.idx+"_dragger_horizontal")];if(!r.length)return;n.tweenRunning&&V(t),o&&n&&i.callbacks.onBeforeUpdate&&"function"==typeof i.callbacks.onBeforeUpdate&&i.callbacks.onBeforeUpdate.call(this),t.hasClass(d[3])&&t.removeClass(d[3]),t.hasClass(d[4])&&t.removeClass(d[4]),l.css("max-height","none"),l.height()!==t.height()&&l.css("max-height",t.height()),_.call(this),"y"===i.axis||i.advanced.autoExpandHorizontalScroll||r.css("width",x(r)),n.overflowed=y.call(this),M.call(this),i.autoDraggerLength&&S.call(this),b.call(this),T.call(this);var c=[Math.abs(r[0].offsetTop),Math.abs(r[0].offsetLeft)];"x"!==i.axis&&(n.overflowed[0]?s[0].height()>s[0].parent().height()?B.call(this):(Q(t,c[0].toString(),{dir:"y",dur:0,overwrite:"none"}),n.contentReset.y=null):(B.call(this),"y"===i.axis?k.call(this):"yx"===i.axis&&n.overflowed[1]&&Q(t,c[1].toString(),{dir:"x",dur:0,overwrite:"none"}))),"y"!==i.axis&&(n.overflowed[1]?s[1].width()>s[1].parent().width()?B.call(this):(Q(t,c[1].toString(),{dir:"x",dur:0,overwrite:"none"}),n.contentReset.x=null):(B.call(this),"x"===i.axis?k.call(this):"yx"===i.axis&&n.overflowed[0]&&Q(t,c[0].toString(),{dir:"y",dur:0,overwrite:"none"}))),o&&n&&(2===o&&i.callbacks.onImageLoad&&"function"==typeof i.callbacks.onImageLoad?i.callbacks.onImageLoad.call(this):3===o&&i.callbacks.onSelectorChange&&"function"==typeof i.callbacks.onSelectorChange?i.callbacks.onSelectorChange.call(this):i.callbacks.onUpdate&&"function"==typeof i.callbacks.onUpdate&&i.callbacks.onUpdate.call(this)),N.call(this)}})},scrollTo:function(t,o){if(void 0!==t&&null!=t){var n=f.call(this);return e(n).each(function(){var n=e(this);if(n.data(a)){var i=n.data(a),r=i.opt,l={trigger:"external",scrollInertia:r.scrollInertia,scrollEasing:"mcsEaseInOut",moveDragger:!1,timeout:60,callbacks:!0,onStart:!0,onUpdate:!0,onComplete:!0},s=e.extend(!0,{},l,o),c=Y.call(this,t),d=s.scrollInertia>0&&s.scrollInertia<17?17:s.scrollInertia;c[0]=X.call(this,c[0],"y"),c[1]=X.call(this,c[1],"x"),s.moveDragger&&(c[0]*=i.scrollRatio.y,c[1]*=i.scrollRatio.x),s.dur=ae()?0:d,setTimeout(function(){null!==c[0]&&void 0!==c[0]&&"x"!==r.axis&&i.overflowed[0]&&(s.dir="y",s.overwrite="all",Q(n,c[0].toString(),s)),null!==c[1]&&void 0!==c[1]&&"y"!==r.axis&&i.overflowed[1]&&(s.dir="x",s.overwrite="none",Q(n,c[1].toString(),s))},s.timeout)}})}},stop:function(){var t=f.call(this);return e(t).each(function(){var t=e(this);t.data(a)&&V(t)})},disable:function(t){var o=f.call(this);return e(o).each(function(){var o=e(this);o.data(a)&&(o.data(a),N.call(this,"remove"),k.call(this),t&&B.call(this),M.call(this,!0),o.addClass(d[3]))})},destroy:function(){var t=f.call(this);return e(t).each(function(){var n=e(this);if(n.data(a)){var i=n.data(a),r=i.opt,l=e("#mCSB_"+i.idx),s=e("#mCSB_"+i.idx+"_container"),c=e(".mCSB_"+i.idx+"_scrollbar");r.live&&m(r.liveSelector||e(t).selector),N.call(this,"remove"),k.call(this),B.call(this),n.removeData(a),Z(this,"mcs"),c.remove(),s.find("img."+d[2]).removeClass(d[2]),l.replaceWith(s.contents()),n.removeClass(o+" _"+a+"_"+i.idx+" "+d[6]+" "+d[7]+" "+d[5]+" "+d[3]).addClass(d[4])}})}},f=function(){return"object"!=typeof e(this)||e(this).length<1?n:this},h=function(t){t.autoDraggerLength=!(e.inArray(t.theme,["rounded","rounded-dark","rounded-dots","rounded-dots-dark"])>-1)&&t.autoDraggerLength,t.autoExpandScrollbar=!(e.inArray(t.theme,["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"])>-1)&&t.autoExpandScrollbar,t.scrollButtons.enable=!(e.inArray(t.theme,["minimal","minimal-dark"])>-1)&&t.scrollButtons.enable,t.autoHideScrollbar=e.inArray(t.theme,["minimal","minimal-dark"])>-1||t.autoHideScrollbar,t.scrollbarPosition=e.inArray(t.theme,["minimal","minimal-dark"])>-1?"outside":t.scrollbarPosition},m=function(e){l[e]&&(clearTimeout(l[e]),Z(l,e))},p=function(e){return"yx"===e||"xy"===e||"auto"===e?"yx":"x"===e||"horizontal"===e?"x":"y"},g=function(e){return"stepped"===e||"pixels"===e||"step"===e||"click"===e?"stepped":"stepless"},v=function(){var t=e(this),n=t.data(a),i=n.opt,r=i.autoExpandScrollbar?" "+d[1]+"_expand":"",l=["<div id='mCSB_"+n.idx+"_scrollbar_vertical' class='mCSB_scrollTools mCSB_"+n.idx+"_scrollbar mCS-"+i.theme+" mCSB_scrollTools_vertical"+r+"'><div class='"+d[12]+"'><div id='mCSB_"+n.idx+"_dragger_vertical' class='mCSB_dragger' style='position:absolute;'><div class='mCSB_dragger_bar' /></div><div class='mCSB_draggerRail' /></div></div>","<div id='mCSB_"+n.idx+"_scrollbar_horizontal' class='mCSB_scrollTools mCSB_"+n.idx+"_scrollbar mCS-"+i.theme+" mCSB_scrollTools_horizontal"+r+"'><div class='"+d[12]+"'><div id='mCSB_"+n.idx+"_dragger_horizontal' class='mCSB_dragger' style='position:absolute;'><div class='mCSB_dragger_bar' /></div><div class='mCSB_draggerRail' /></div></div>"],s="yx"===i.axis?"mCSB_vertical_horizontal":"x"===i.axis?"mCSB_horizontal":"mCSB_vertical",c="yx"===i.axis?l[0]+l[1]:"x"===i.axis?l[1]:l[0],u="yx"===i.axis?"<div id='mCSB_"+n.idx+"_container_wrapper' class='mCSB_container_wrapper' />":"",f=i.autoHideScrollbar?" "+d[6]:"",h="x"!==i.axis&&"rtl"===n.langDir?" "+d[7]:"";i.setWidth&&t.css("width",i.setWidth),i.setHeight&&t.css("height",i.setHeight),i.setLeft="y"!==i.axis&&"rtl"===n.langDir?"989999px":i.setLeft,t.addClass(o+" _"+a+"_"+n.idx+f+h).wrapInner("<div id='mCSB_"+n.idx+"' class='mCustomScrollBox mCS-"+i.theme+" "+s+"'><div id='mCSB_"+n.idx+"_container' class='mCSB_container' style='position:relative; top:"+i.setTop+"; left:"+i.setLeft+";' dir='"+n.langDir+"' /></div>");var m=e("#mCSB_"+n.idx),p=e("#mCSB_"+n.idx+"_container");"y"===i.axis||i.advanced.autoExpandHorizontalScroll||p.css("width",x(p)),"outside"===i.scrollbarPosition?("static"===t.css("position")&&t.css("position","relative"),t.css("overflow","visible"),m.addClass("mCSB_outside").after(c)):(m.addClass("mCSB_inside").append(c),p.wrap(u)),w.call(this);var g=[e("#mCSB_"+n.idx+"_dragger_vertical"),e("#mCSB_"+n.idx+"_dragger_horizontal")];g[0].css("min-height",g[0].height()),g[1].css("min-width",g[1].width())},x=function(t){var o=[t[0].scrollWidth,Math.max.apply(Math,t.children().map(function(){return e(this).outerWidth(!0)}).get())],a=t.parent().width();return o[0]>a?o[0]:o[1]>a?o[1]:"100%"},_=function(){var t=e(this),o=t.data(a),n=o.opt,i=e("#mCSB_"+o.idx+"_container");if(n.advanced.autoExpandHorizontalScroll&&"y"!==n.axis){i.css({width:"auto","min-width":0,"overflow-x":"scroll"});var r=Math.ceil(i[0].scrollWidth);3===n.advanced.autoExpandHorizontalScroll||2!==n.advanced.autoExpandHorizontalScroll&&r>i.parent().width()?i.css({width:r,"min-width":"100%","overflow-x":"inherit"}):i.css({"overflow-x":"inherit",position:"absolute"}).wrap("<div class='mCSB_h_wrapper' style='position:relative; left:0; width:999999px;' />").css({width:Math.ceil(i[0].getBoundingClientRect().right+.4)-Math.floor(i[0].getBoundingClientRect().left),"min-width":"100%",position:"relative"}).unwrap()}},w=function(){var t=e(this),o=t.data(a),n=o.opt,i=e(".mCSB_"+o.idx+"_scrollbar:first"),r=te(n.scrollButtons.tabindex)?"tabindex='"+n.scrollButtons.tabindex+"'":"",l=["<a href='#' class='"+d[13]+"' "+r+" />","<a href='#' class='"+d[14]+"' "+r+" />","<a href='#' class='"+d[15]+"' "+r+" />","<a href='#' class='"+d[16]+"' "+r+" />"],s=["x"===n.axis?l[2]:l[0],"x"===n.axis?l[3]:l[1],l[2],l[3]];n.scrollButtons.enable&&i.prepend(s[0]).append(s[1]).next(".mCSB_scrollTools").prepend(s[2]).append(s[3])},S=function(){var t=e(this),o=t.data(a),n=e("#mCSB_"+o.idx),i=e("#mCSB_"+o.idx+"_container"),r=[e("#mCSB_"+o.idx+"_dragger_vertical"),e("#mCSB_"+o.idx+"_dragger_horizontal")],l=[n.height()/i.outerHeight(!1),n.width()/i.outerWidth(!1)],c=[parseInt(r[0].css("min-height")),Math.round(l[0]*r[0].parent().height()),parseInt(r[1].css("min-width")),Math.round(l[1]*r[1].parent().width())],d=s&&c[1]<c[0]?c[0]:c[1],u=s&&c[3]<c[2]?c[2]:c[3];r[0].css({height:d,"max-height":r[0].parent().height()-10}).find(".mCSB_dragger_bar").css({"line-height":c[0]+"px"}),r[1].css({width:u,"max-width":r[1].parent().width()-10})},b=function(){var t=e(this),o=t.data(a),n=e("#mCSB_"+o.idx),i=e("#mCSB_"+o.idx+"_container"),r=[e("#mCSB_"+o.idx+"_dragger_vertical"),e("#mCSB_"+o.idx+"_dragger_horizontal")],l=[i.outerHeight(!1)-n.height(),i.outerWidth(!1)-n.width()],s=[l[0]/(r[0].parent().height()-r[0].height()),l[1]/(r[1].parent().width()-r[1].width())];o.scrollRatio={y:s[0],x:s[1]}},C=function(e,t,o){var a=o?d[0]+"_expanded":"",n=e.closest(".mCSB_scrollTools");"active"===t?(e.toggleClass(d[0]+" "+a),n.toggleClass(d[1]),e[0]._draggable=e[0]._draggable?0:1):e[0]._draggable||("hide"===t?(e.removeClass(d[0]),n.removeClass(d[1])):(e.addClass(d[0]),n.addClass(d[1])))},y=function(){var t=e(this),o=t.data(a),n=e("#mCSB_"+o.idx),i=e("#mCSB_"+o.idx+"_container"),r=null==o.overflowed?i.height():i.outerHeight(!1),l=null==o.overflowed?i.width():i.outerWidth(!1),s=i[0].scrollHeight,c=i[0].scrollWidth;return s>r&&(r=s),c>l&&(l=c),[r>n.height(),l>n.width()]},B=function(){var t=e(this),o=t.data(a),n=o.opt,i=e("#mCSB_"+o.idx),r=e("#mCSB_"+o.idx+"_container"),l=[e("#mCSB_"+o.idx+"_dragger_vertical"),e("#mCSB_"+o.idx+"_dragger_horizontal")];if(V(t),("x"!==n.axis&&!o.overflowed[0]||"y"===n.axis&&o.overflowed[0])&&(l[0].add(r).css("top",0),Q(t,"_resetY")),"y"!==n.axis&&!o.overflowed[1]||"x"===n.axis&&o.overflowed[1]){var s=dx=0;"rtl"===o.langDir&&(s=i.width()-r.outerWidth(!1),dx=Math.abs(s/o.scrollRatio.x)),r.css("left",s),l[1].css("left",dx),Q(t,"_resetX")}},T=function(){var t=e(this),o=t.data(a),n=o.opt;if(!o.bindEvents){var i;if(I.call(this),n.contentTouchScroll&&D.call(this),E.call(this),n.mouseWheel.enable)!function o(){i=setTimeout(function(){e.event.special.mousewheel?(clearTimeout(i),W.call(t[0])):o()},100)}();P.call(this),U.call(this),n.advanced.autoScrollOnFocus&&H.call(this),n.scrollButtons.enable&&F.call(this),n.keyboard.enable&&q.call(this),o.bindEvents=!0}},k=function(){var t=e(this),o=t.data(a),n=o.opt,i=a+"_"+o.idx,r=".mCSB_"+o.idx+"_scrollbar",l=e("#mCSB_"+o.idx+",#mCSB_"+o.idx+"_container,#mCSB_"+o.idx+"_container_wrapper,"+r+" ."+d[12]+",#mCSB_"+o.idx+"_dragger_vertical,#mCSB_"+o.idx+"_dragger_horizontal,"+r+">a"),s=e("#mCSB_"+o.idx+"_container");n.advanced.releaseDraggableSelectors&&l.add(e(n.advanced.releaseDraggableSelectors)),n.advanced.extraDraggableSelectors&&l.add(e(n.advanced.extraDraggableSelectors)),o.bindEvents&&(e(document).add(e(!A()||top.document)).unbind("."+i),l.each(function(){e(this).unbind("."+i)}),clearTimeout(t[0]._focusTimeout),Z(t[0],"_focusTimeout"),clearTimeout(o.sequential.step),Z(o.sequential,"step"),clearTimeout(s[0].onCompleteTimeout),Z(s[0],"onCompleteTimeout"),o.bindEvents=!1)},M=function(t){var o=e(this),n=o.data(a),i=n.opt,r=e("#mCSB_"+n.idx+"_container_wrapper"),l=r.length?r:e("#mCSB_"+n.idx+"_container"),s=[e("#mCSB_"+n.idx+"_scrollbar_vertical"),e("#mCSB_"+n.idx+"_scrollbar_horizontal")],c=[s[0].find(".mCSB_dragger"),s[1].find(".mCSB_dragger")];"x"!==i.axis&&(n.overflowed[0]&&!t?(s[0].add(c[0]).add(s[0].children("a")).css("display","block"),l.removeClass(d[8]+" "+d[10])):(i.alwaysShowScrollbar?(2!==i.alwaysShowScrollbar&&c[0].css("display","none"),l.removeClass(d[10])):(s[0].css("display","none"),l.addClass(d[10])),l.addClass(d[8]))),"y"!==i.axis&&(n.overflowed[1]&&!t?(s[1].add(c[1]).add(s[1].children("a")).css("display","block"),l.removeClass(d[9]+" "+d[11])):(i.alwaysShowScrollbar?(2!==i.alwaysShowScrollbar&&c[1].css("display","none"),l.removeClass(d[11])):(s[1].css("display","none"),l.addClass(d[11])),l.addClass(d[9]))),n.overflowed[0]||n.overflowed[1]?o.removeClass(d[5]):o.addClass(d[5])},O=function(t){var o=t.type,a=t.target.ownerDocument!==document&&null!==frameElement?[e(frameElement).offset().top,e(frameElement).offset().left]:null,n=A()&&t.target.ownerDocument!==top.document&&null!==frameElement?[e(t.view.frameElement).offset().top,e(t.view.frameElement).offset().left]:[0,0];switch(o){case"pointerdown":case"MSPointerDown":case"pointermove":case"MSPointerMove":case"pointerup":case"MSPointerUp":return a?[t.originalEvent.pageY-a[0]+n[0],t.originalEvent.pageX-a[1]+n[1],!1]:[t.originalEvent.pageY,t.originalEvent.pageX,!1];case"touchstart":case"touchmove":case"touchend":var i=t.originalEvent.touches[0]||t.originalEvent.changedTouches[0],r=t.originalEvent.touches.length||t.originalEvent.changedTouches.length;return t.target.ownerDocument!==document?[i.screenY,i.screenX,r>1]:[i.pageY,i.pageX,r>1];default:return a?[t.pageY-a[0]+n[0],t.pageX-a[1]+n[1],!1]:[t.pageY,t.pageX,!1]}},I=function(){var t,o,n,i=e(this),r=i.data(a),l=r.opt,d=a+"_"+r.idx,u=["mCSB_"+r.idx+"_dragger_vertical","mCSB_"+r.idx+"_dragger_horizontal"],f=e("#mCSB_"+r.idx+"_container"),h=e("#"+u[0]+",#"+u[1]),m=l.advanced.releaseDraggableSelectors?h.add(e(l.advanced.releaseDraggableSelectors)):h,p=l.advanced.extraDraggableSelectors?e(!A()||top.document).add(e(l.advanced.extraDraggableSelectors)):e(!A()||top.document);function g(e,o,a,n){if(f[0].idleTimer=l.scrollInertia<233?250:0,t.attr("id")===u[1])var s="x",c=(t[0].offsetLeft-o+n)*r.scrollRatio.x;else var s="y",c=(t[0].offsetTop-e+a)*r.scrollRatio.y;Q(i,c.toString(),{dir:s,drag:!0})}h.bind("contextmenu."+d,function(e){e.preventDefault()}).bind("mousedown."+d+" touchstart."+d+" pointerdown."+d+" MSPointerDown."+d,function(a){if(a.stopImmediatePropagation(),a.preventDefault(),$(a)){c=!0,s&&(document.onselectstart=function(){return!1}),L.call(f,!1),V(i);var r=(t=e(this)).offset(),d=O(a)[0]-r.top,u=O(a)[1]-r.left,h=t.height()+r.top,m=t.width()+r.left;d<h&&d>0&&u<m&&u>0&&(o=d,n=u),C(t,"active",l.autoExpandScrollbar)}}).bind("touchmove."+d,function(e){e.stopImmediatePropagation(),e.preventDefault();var a=t.offset(),i=O(e)[0]-a.top,r=O(e)[1]-a.left;g(o,n,i,r)}),e(document).add(p).bind("mousemove."+d+" pointermove."+d+" MSPointerMove."+d,function(e){if(t){var a=t.offset(),i=O(e)[0]-a.top,r=O(e)[1]-a.left;if(o===i&&n===r)return;g(o,n,i,r)}}).add(m).bind("mouseup."+d+" touchend."+d+" pointerup."+d+" MSPointerUp."+d,function(e){t&&(C(t,"active",l.autoExpandScrollbar),t=null),c=!1,s&&(document.onselectstart=null),L.call(f,!0)})},D=function(){var o,n,i,r,l,s,d,u,f,h,m,p,g,v,x=e(this),_=x.data(a),w=_.opt,S=a+"_"+_.idx,b=e("#mCSB_"+_.idx),C=e("#mCSB_"+_.idx+"_container"),y=[e("#mCSB_"+_.idx+"_dragger_vertical"),e("#mCSB_"+_.idx+"_dragger_horizontal")],B=[],T=[],k=0,M="yx"===w.axis?"none":"all",I=[],D=C.find("iframe"),E=["touchstart."+S+" pointerdown."+S+" MSPointerDown."+S,"touchmove."+S+" pointermove."+S+" MSPointerMove."+S,"touchend."+S+" pointerup."+S+" MSPointerUp."+S],W=void 0!==document.body.style.touchAction&&""!==document.body.style.touchAction;function R(e){if(!ee(e)||c||O(e)[2])t=0;else{t=1,g=0,v=0,o=1,x.removeClass("mCS_touch_action");var a=C.offset();n=O(e)[0]-a.top,i=O(e)[1]-a.left,I=[O(e)[0],O(e)[1]]}}function L(e){if(ee(e)&&!c&&!O(e)[2]&&(w.documentTouchScroll||e.preventDefault(),e.stopImmediatePropagation(),(!v||g)&&o)){d=J();var t=b.offset(),a=O(e)[0]-t.top,r=O(e)[1]-t.left,l="mcsLinearOut";if(B.push(a),T.push(r),I[2]=Math.abs(O(e)[0]-I[0]),I[3]=Math.abs(O(e)[1]-I[1]),_.overflowed[0])var s=y[0].parent().height()-y[0].height(),u=n-a>0&&a-n>-s*_.scrollRatio.y&&(2*I[3]<I[2]||"yx"===w.axis);if(_.overflowed[1])var f=y[1].parent().width()-y[1].width(),h=i-r>0&&r-i>-f*_.scrollRatio.x&&(2*I[2]<I[3]||"yx"===w.axis);u||h?(W||e.preventDefault(),g=1):(v=1,x.addClass("mCS_touch_action")),W&&e.preventDefault(),m="yx"===w.axis?[n-a,i-r]:"x"===w.axis?[null,i-r]:[n-a,null],C[0].idleTimer=250,_.overflowed[0]&&U(m[0],k,l,"y","all",!0),_.overflowed[1]&&U(m[1],k,l,"x",M,!0)}}function z(e){if(!ee(e)||c||O(e)[2])t=0;else{t=1,e.stopImmediatePropagation(),V(x),s=J();var o=b.offset();r=O(e)[0]-o.top,l=O(e)[1]-o.left,B=[],T=[]}}function P(e){if(ee(e)&&!c&&!O(e)[2]){o=0,e.stopImmediatePropagation(),g=0,v=0,u=J();var t=b.offset(),a=O(e)[0]-t.top,n=O(e)[1]-t.left;if(!(u-d>30)){var i="mcsEaseOut",x=(h=1e3/(u-s))<2.5,S=x?[B[B.length-2],T[T.length-2]]:[0,0];f=x?[a-S[0],n-S[1]]:[a-r,n-l];var y=[Math.abs(f[0]),Math.abs(f[1])];h=x?[Math.abs(f[0]/4),Math.abs(f[1]/4)]:[h,h];var k=[Math.abs(C[0].offsetTop)-f[0]*H(y[0]/h[0],h[0]),Math.abs(C[0].offsetLeft)-f[1]*H(y[1]/h[1],h[1])];m="yx"===w.axis?[k[0],k[1]]:"x"===w.axis?[null,k[1]]:[k[0],null],p=[4*y[0]+w.scrollInertia,4*y[1]+w.scrollInertia];var I=parseInt(w.contentTouchScroll)||0;m[0]=y[0]>I?m[0]:0,m[1]=y[1]>I?m[1]:0,_.overflowed[0]&&U(m[0],p[0],i,"y",M,!1),_.overflowed[1]&&U(m[1],p[1],i,"x",M,!1)}}}function H(e,t){var o=[1.5*t,2*t,t/1.5,t/2];return e>90?t>4?o[0]:o[3]:e>60?t>3?o[3]:o[2]:e>30?t>8?o[1]:t>6?o[0]:t>4?t:o[2]:t>8?t:o[3]}function U(e,t,o,a,n,i){e&&Q(x,e.toString(),{dur:t,scrollEasing:o,dir:a,overwrite:n,drag:i})}C.bind(E[0],function(e){R(e)}).bind(E[1],function(e){L(e)}),b.bind(E[0],function(e){z(e)}).bind(E[2],function(e){P(e)}),D.length&&D.each(function(){e(this).bind("load",function(){A(this)&&e(this.contentDocument||this.contentWindow.document).bind(E[0],function(e){R(e),z(e)}).bind(E[1],function(e){L(e)}).bind(E[2],function(e){P(e)})})})},E=function(){var o,n=e(this),i=n.data(a),r=i.opt,l=i.sequential,s=a+"_"+i.idx,d=e("#mCSB_"+i.idx+"_container"),u=d.parent();function f(e,t,a){l.type=a&&o?"stepped":"stepless",l.scrollAmount=10,j(n,e,t,"mcsLinearOut",a?60:null)}d.bind("mousedown."+s,function(e){t||o||(o=1,c=!0)}).add(document).bind("mousemove."+s,function(e){if(!t&&o&&(window.getSelection?window.getSelection().toString():document.selection&&"Control"!=document.selection.type&&document.selection.createRange().text)){var a=d.offset(),n=O(e)[0]-a.top+d[0].offsetTop,s=O(e)[1]-a.left+d[0].offsetLeft;n>0&&n<u.height()&&s>0&&s<u.width()?l.step&&f("off",null,"stepped"):("x"!==r.axis&&i.overflowed[0]&&(n<0?f("on",38):n>u.height()&&f("on",40)),"y"!==r.axis&&i.overflowed[1]&&(s<0?f("on",37):s>u.width()&&f("on",39)))}}).bind("mouseup."+s+" dragend."+s,function(e){t||(o&&(o=0,f("off",null)),c=!1)})},W=function(){if(e(this).data(a)){var t=e(this),o=t.data(a),n=o.opt,i=a+"_"+o.idx,r=e("#mCSB_"+o.idx),l=[e("#mCSB_"+o.idx+"_dragger_vertical"),e("#mCSB_"+o.idx+"_dragger_horizontal")],c=e("#mCSB_"+o.idx+"_container").find("iframe");c.length&&c.each(function(){e(this).bind("load",function(){A(this)&&e(this.contentDocument||this.contentWindow.document).bind("mousewheel."+i,function(e,t){d(e,t)})})}),r.bind("mousewheel."+i,function(e,t){d(e,t)})}function d(a,i){if(V(t),!z(t,a.target)){var c="auto"!==n.mouseWheel.deltaFactor?parseInt(n.mouseWheel.deltaFactor):s&&a.deltaFactor<100?100:a.deltaFactor||100,d=n.scrollInertia;if("x"===n.axis||"x"===n.mouseWheel.axis)var u="x",f=[Math.round(c*o.scrollRatio.x),parseInt(n.mouseWheel.scrollAmount)],h="auto"!==n.mouseWheel.scrollAmount?f[1]:f[0]>=r.width()?.9*r.width():f[0],m=Math.abs(e("#mCSB_"+o.idx+"_container")[0].offsetLeft),p=l[1][0].offsetLeft,g=l[1].parent().width()-l[1].width(),v="y"===n.mouseWheel.axis?a.deltaY||i:a.deltaX;else var u="y",f=[Math.round(c*o.scrollRatio.y),parseInt(n.mouseWheel.scrollAmount)],h="auto"!==n.mouseWheel.scrollAmount?f[1]:f[0]>=r.height()?.9*r.height():f[0],m=Math.abs(e("#mCSB_"+o.idx+"_container")[0].offsetTop),p=l[0][0].offsetTop,g=l[0].parent().height()-l[0].height(),v=a.deltaY||i;"y"===u&&!o.overflowed[0]||"x"===u&&!o.overflowed[1]||((n.mouseWheel.invert||a.webkitDirectionInvertedFromDevice)&&(v=-v),n.mouseWheel.normalizeDelta&&(v=v<0?-1:1),(v>0&&0!==p||v<0&&p!==g||n.mouseWheel.preventDefault)&&(a.stopImmediatePropagation(),a.preventDefault()),a.deltaFactor<5&&!n.mouseWheel.normalizeDelta&&(h=a.deltaFactor,d=17),Q(t,(m-v*h).toString(),{dir:u,dur:d}))}}},R=new Object,A=function(t){var o=!1,a=!1,n=null;if(void 0===t?a="#empty":void 0!==e(t).attr("id")&&(a=e(t).attr("id")),!1!==a&&void 0!==R[a])return R[a];if(t){try{var i=t.contentDocument||t.contentWindow.document;n=i.body.innerHTML}catch(e){}o=null!==n}else{try{var i=top.document;n=i.body.innerHTML}catch(e){}o=null!==n}return!1!==a&&(R[a]=o),o},L=function(e){var t=this.find("iframe");if(t.length){var o=e?"auto":"none";t.css("pointer-events",o)}},z=function(t,o){var n=o.nodeName.toLowerCase(),i=t.data(a).opt.mouseWheel.disableOver;return e.inArray(n,i)>-1&&!(e.inArray(n,["select","textarea"])>-1&&!e(o).is(":focus"))},P=function(){var t,o=e(this),n=o.data(a),i=a+"_"+n.idx,r=e("#mCSB_"+n.idx+"_container"),l=r.parent(),s=e(".mCSB_"+n.idx+"_scrollbar ."+d[12]);s.bind("mousedown."+i+" touchstart."+i+" pointerdown."+i+" MSPointerDown."+i,function(o){c=!0,e(o.target).hasClass("mCSB_dragger")||(t=1)}).bind("touchend."+i+" pointerup."+i+" MSPointerUp."+i,function(e){c=!1}).bind("click."+i,function(a){if(t&&(t=0,e(a.target).hasClass(d[12])||e(a.target).hasClass("mCSB_draggerRail"))){V(o);var i=e(this),s=i.find(".mCSB_dragger");if(i.parent(".mCSB_scrollTools_horizontal").length>0){if(!n.overflowed[1])return;var c="x",u=a.pageX>s.offset().left?-1:1,f=Math.abs(r[0].offsetLeft)-u*(.9*l.width())}else{if(!n.overflowed[0])return;var c="y",u=a.pageY>s.offset().top?-1:1,f=Math.abs(r[0].offsetTop)-u*(.9*l.height())}Q(o,f.toString(),{dir:c,scrollEasing:"mcsEaseInOut"})}})},H=function(){var t=e(this),o=t.data(a),n=o.opt,i=a+"_"+o.idx,r=e("#mCSB_"+o.idx+"_container"),l=r.parent();r.bind("focusin."+i,function(o){var a=e(document.activeElement),i=r.find(".mCustomScrollBox").length;a.is(n.advanced.autoScrollOnFocus)&&(V(t),clearTimeout(t[0]._focusTimeout),t[0]._focusTimer=i?17*i:0,t[0]._focusTimeout=setTimeout(function(){var e=[oe(a)[0],oe(a)[1]],o=[r[0].offsetTop,r[0].offsetLeft],i=[o[0]+e[0]>=0&&o[0]+e[0]<l.height()-a.outerHeight(!1),o[1]+e[1]>=0&&o[0]+e[1]<l.width()-a.outerWidth(!1)],s="yx"!==n.axis||i[0]||i[1]?"all":"none";"x"===n.axis||i[0]||Q(t,e[0].toString(),{dir:"y",scrollEasing:"mcsEaseInOut",overwrite:s,dur:0}),"y"===n.axis||i[1]||Q(t,e[1].toString(),{dir:"x",scrollEasing:"mcsEaseInOut",overwrite:s,dur:0})},t[0]._focusTimer))})},U=function(){var t=e(this),o=t.data(a),n=a+"_"+o.idx,i=e("#mCSB_"+o.idx+"_container").parent();i.bind("scroll."+n,function(t){0===i.scrollTop()&&0===i.scrollLeft()||e(".mCSB_"+o.idx+"_scrollbar").css("visibility","hidden")})},F=function(){var t=e(this),o=t.data(a),n=o.opt,i=o.sequential,r=a+"_"+o.idx,l=".mCSB_"+o.idx+"_scrollbar",s=e(l+">a");s.bind("contextmenu."+r,function(e){e.preventDefault()}).bind("mousedown."+r+" touchstart."+r+" pointerdown."+r+" MSPointerDown."+r+" mouseup."+r+" touchend."+r+" pointerup."+r+" MSPointerUp."+r+" mouseout."+r+" pointerout."+r+" MSPointerOut."+r+" click."+r,function(a){if(a.preventDefault(),$(a)){var r=e(this).attr("class");switch(i.type=n.scrollButtons.scrollType,a.type){case"mousedown":case"touchstart":case"pointerdown":case"MSPointerDown":if("stepped"===i.type)return;c=!0,o.tweenRunning=!1,l("on",r);break;case"mouseup":case"touchend":case"pointerup":case"MSPointerUp":case"mouseout":case"pointerout":case"MSPointerOut":if("stepped"===i.type)return;c=!1,i.dir&&l("off",r);break;case"click":if("stepped"!==i.type||o.tweenRunning)return;l("on",r)}}function l(e,o){i.scrollAmount=n.scrollButtons.scrollAmount,j(t,e,o)}})},q=function(){var t=e(this),o=t.data(a),n=o.opt,i=o.sequential,r=a+"_"+o.idx,l=e("#mCSB_"+o.idx),s=e("#mCSB_"+o.idx+"_container"),c=s.parent(),d="input,textarea,select,datalist,keygen,[contenteditable='true']",u=s.find("iframe"),f=["blur."+r+" keydown."+r+" keyup."+r];function h(a){switch(a.type){case"blur":o.tweenRunning&&i.dir&&m("off",null);break;case"keydown":case"keyup":var r=a.keyCode?a.keyCode:a.which,l="on";if("x"!==n.axis&&(38===r||40===r)||"y"!==n.axis&&(37===r||39===r)){if((38===r||40===r)&&!o.overflowed[0]||(37===r||39===r)&&!o.overflowed[1])return;"keyup"===a.type&&(l="off"),e(document.activeElement).is(d)||(a.preventDefault(),a.stopImmediatePropagation(),m(l,r))}else if(33===r||34===r){if((o.overflowed[0]||o.overflowed[1])&&(a.preventDefault(),a.stopImmediatePropagation()),"keyup"===a.type){V(t);var u=34===r?-1:1;if("x"===n.axis||"yx"===n.axis&&o.overflowed[1]&&!o.overflowed[0])var f="x",h=Math.abs(s[0].offsetLeft)-u*(.9*c.width());else var f="y",h=Math.abs(s[0].offsetTop)-u*(.9*c.height());Q(t,h.toString(),{dir:f,scrollEasing:"mcsEaseInOut"})}}else if((35===r||36===r)&&!e(document.activeElement).is(d)&&((o.overflowed[0]||o.overflowed[1])&&(a.preventDefault(),a.stopImmediatePropagation()),"keyup"===a.type)){if("x"===n.axis||"yx"===n.axis&&o.overflowed[1]&&!o.overflowed[0])var f="x",h=35===r?Math.abs(c.width()-s.outerWidth(!1)):0;else var f="y",h=35===r?Math.abs(c.height()-s.outerHeight(!1)):0;Q(t,h.toString(),{dir:f,scrollEasing:"mcsEaseInOut"})}}function m(e,a){i.type=n.keyboard.scrollType,i.scrollAmount=n.keyboard.scrollAmount,"stepped"===i.type&&o.tweenRunning||j(t,e,a)}}u.length&&u.each(function(){e(this).bind("load",function(){A(this)&&e(this.contentDocument||this.contentWindow.document).bind(f[0],function(e){h(e)})})}),l.attr("tabindex","0").bind(f[0],function(e){h(e)})},j=function(t,o,n,i,r){var l=t.data(a),s=l.opt,c=l.sequential,u=e("#mCSB_"+l.idx+"_container"),f="stepped"===c.type,h=s.scrollInertia<26?26:s.scrollInertia,m=s.scrollInertia<1?17:s.scrollInertia;switch(o){case"on":if(c.dir=[n===d[16]||n===d[15]||39===n||37===n?"x":"y",n===d[13]||n===d[15]||38===n||37===n?-1:1],V(t),te(n)&&"stepped"===c.type)return;p(f);break;case"off":clearTimeout(c.step),Z(c,"step"),V(t),(f||l.tweenRunning&&c.dir)&&p(!0)}function p(e){s.snapAmount&&(c.scrollAmount=s.snapAmount instanceof Array?"x"===c.dir[0]?s.snapAmount[1]:s.snapAmount[0]:s.snapAmount);var o="stepped"!==c.type,a=r||(e?o?h/1.5:m:1e3/60),n=e?o?7.5:40:2.5,d=[Math.abs(u[0].offsetTop),Math.abs(u[0].offsetLeft)],f=[l.scrollRatio.y>10?10:l.scrollRatio.y,l.scrollRatio.x>10?10:l.scrollRatio.x],g="x"===c.dir[0]?d[1]+c.dir[1]*(f[1]*n):d[0]+c.dir[1]*(f[0]*n),v="x"===c.dir[0]?d[1]+c.dir[1]*parseInt(c.scrollAmount):d[0]+c.dir[1]*parseInt(c.scrollAmount),x="auto"!==c.scrollAmount?v:g,_=i||(e?o?"mcsLinearOut":"mcsEaseInOut":"mcsLinear"),w=!!e;e&&a<17&&(x="x"===c.dir[0]?d[1]:d[0]),Q(t,x.toString(),{dir:c.dir[0],scrollEasing:_,dur:a,onComplete:w}),e?c.dir=!1:(clearTimeout(c.step),c.step=setTimeout(function(){p()},a))}},Y=function(t){var o=e(this).data(a).opt,n=[];return"function"==typeof t&&(t=t()),t instanceof Array?n=t.length>1?[t[0],t[1]]:"x"===o.axis?[null,t[0]]:[t[0],null]:(n[0]=t.y?t.y:t.x||"x"===o.axis?null:t,n[1]=t.x?t.x:t.y||"y"===o.axis?null:t),"function"==typeof n[0]&&(n[0]=n[0]()),"function"==typeof n[1]&&(n[1]=n[1]()),n},X=function(t,o){if(null!=t&&void 0!==t){var n=e(this),i=n.data(a),r=i.opt,l=e("#mCSB_"+i.idx+"_container"),s=l.parent(),c=typeof t;o||(o="x"===r.axis?"x":"y");var d="x"===o?l.outerWidth(!1)-s.width():l.outerHeight(!1)-s.height(),f="x"===o?l[0].offsetLeft:l[0].offsetTop,h="x"===o?"left":"top";switch(c){case"function":return t();case"object":var m=t.jquery?t:e(t);if(!m.length)return;return"x"===o?oe(m)[1]:oe(m)[0];case"string":case"number":if(te(t))return Math.abs(t);if(-1!==t.indexOf("%"))return Math.abs(d*parseInt(t)/100);if(-1!==t.indexOf("-="))return Math.abs(f-parseInt(t.split("-=")[1]));if(-1!==t.indexOf("+=")){var p=f+parseInt(t.split("+=")[1]);return p>=0?0:Math.abs(p)}if(-1!==t.indexOf("px")&&te(t.split("px")[0]))return Math.abs(t.split("px")[0]);if("top"===t||"left"===t)return 0;if("bottom"===t)return Math.abs(s.height()-l.outerHeight(!1));if("right"===t)return Math.abs(s.width()-l.outerWidth(!1));if("first"===t||"last"===t){var m=l.find(":"+t);return"x"===o?oe(m)[1]:oe(m)[0]}return e(t).length?"x"===o?oe(e(t))[1]:oe(e(t))[0]:(l.css(h,t),void u.update.call(null,n[0]))}}},N=function(t){var o=e(this),n=o.data(a),i=n.opt,r=e("#mCSB_"+n.idx+"_container");if(t)return clearTimeout(r[0].autoUpdate),void Z(r[0],"autoUpdate");function l(e){clearTimeout(r[0].autoUpdate),u.update.call(null,o[0],e)}!function t(){clearTimeout(r[0].autoUpdate),0!==o.parents("html").length?r[0].autoUpdate=setTimeout(function(){return i.advanced.updateOnSelectorChange&&(n.poll.change.n=function(){!0===i.advanced.updateOnSelectorChange&&(i.advanced.updateOnSelectorChange="*");var e=0,t=r.find(i.advanced.updateOnSelectorChange);return i.advanced.updateOnSelectorChange&&t.length>0&&t.each(function(){e+=this.offsetHeight+this.offsetWidth}),e}(),n.poll.change.n!==n.poll.change.o)?(n.poll.change.o=n.poll.change.n,void l(3)):i.advanced.updateOnContentResize&&(n.poll.size.n=o[0].scrollHeight+o[0].scrollWidth+r[0].offsetHeight+o[0].offsetHeight+o[0].offsetWidth,n.poll.size.n!==n.poll.size.o)?(n.poll.size.o=n.poll.size.n,void l(1)):!i.advanced.updateOnImageLoad||"auto"===i.advanced.updateOnImageLoad&&"y"===i.axis||(n.poll.img.n=r.find("img").length,n.poll.img.n===n.poll.img.o)?void((i.advanced.updateOnSelectorChange||i.advanced.updateOnContentResize||i.advanced.updateOnImageLoad)&&t()):(n.poll.img.o=n.poll.img.n,void r.find("img").each(function(){!function(t){if(e(t).hasClass(d[2]))l();else{var o,a,n=new Image;n.onload=(o=n,a=function(){this.onload=null,e(t).addClass(d[2]),l(2)},function(){return a.apply(o,arguments)}),n.src=t.src}}(this)}))},i.advanced.autoUpdateTimeout):o=null}()},V=function(t){var o=t.data(a),n=e("#mCSB_"+o.idx+"_container,#mCSB_"+o.idx+"_container_wrapper,#mCSB_"+o.idx+"_dragger_vertical,#mCSB_"+o.idx+"_dragger_horizontal");n.each(function(){K.call(this)})},Q=function(t,o,n){var i=t.data(a),r=i.opt,l={trigger:"internal",dir:"y",scrollEasing:"mcsEaseOut",drag:!1,dur:r.scrollInertia,overwrite:"all",callbacks:!0,onStart:!0,onUpdate:!0,onComplete:!0},n=e.extend(l,n),s=[n.dur,n.drag?0:n.dur],c=e("#mCSB_"+i.idx),d=e("#mCSB_"+i.idx+"_container"),u=d.parent(),f=r.callbacks.onTotalScrollOffset?Y.call(t,r.callbacks.onTotalScrollOffset):[0,0],h=r.callbacks.onTotalScrollBackOffset?Y.call(t,r.callbacks.onTotalScrollBackOffset):[0,0];if(i.trigger=n.trigger,0===u.scrollTop()&&0===u.scrollLeft()||(e(".mCSB_"+i.idx+"_scrollbar").css("visibility","visible"),u.scrollTop(0).scrollLeft(0)),"_resetY"!==o||i.contentReset.
24014y||(M("onOverflowYNone")&&r.callbacks.onOverflowYNone.call(t[0]),i.contentReset.y=1),"_resetX"!==o||i.contentReset.x||(M("onOverflowXNone")&&r.callbacks.onOverflowXNone.call(t[0]),i.contentReset.x=1),"_resetY"!==o&&"_resetX"!==o){if(!i.contentReset.y&&t[0].mcs||!i.overflowed[0]||(M("onOverflowY")&&r.callbacks.onOverflowY.call(t[0]),i.contentReset.x=null),!i.contentReset.x&&t[0].mcs||!i.overflowed[1]||(M("onOverflowX")&&r.callbacks.onOverflowX.call(t[0]),i.contentReset.x=null),r.snapAmount){var m=r.snapAmount instanceof Array?"x"===n.dir?r.snapAmount[1]:r.snapAmount[0]:r.snapAmount;p=o,g=m,v=r.snapOffset,o=Math.round(p/g)*g-v}var p,g,v;switch(n.dir){case"x":var x=e("#mCSB_"+i.idx+"_dragger_horizontal"),_="left",w=d[0].offsetLeft,S=[c.width()-d.outerWidth(!1),x.parent().width()-x.width()],b=[o,0===o?0:o/i.scrollRatio.x],y=f[1],B=h[1],T=y>0?y/i.scrollRatio.x:0,k=B>0?B/i.scrollRatio.x:0;break;case"y":var x=e("#mCSB_"+i.idx+"_dragger_vertical"),_="top",w=d[0].offsetTop,S=[c.height()-d.outerHeight(!1),x.parent().height()-x.height()],b=[o,0===o?0:o/i.scrollRatio.y],y=f[0],B=h[0],T=y>0?y/i.scrollRatio.y:0,k=B>0?B/i.scrollRatio.y:0}b[1]<0||0===b[0]&&0===b[1]?b=[0,0]:b[1]>=S[1]?b=[S[0],S[1]]:b[0]=-b[0],t[0].mcs||(O(),M("onInit")&&r.callbacks.onInit.call(t[0])),clearTimeout(d[0].onCompleteTimeout),G(x[0],_,Math.round(b[1]),s[1],n.scrollEasing),!i.tweenRunning&&(0===w&&b[0]>=0||w===S[0]&&b[0]<=S[0])||G(d[0],_,Math.round(b[0]),s[0],n.scrollEasing,n.overwrite,{onStart:function(){n.callbacks&&n.onStart&&!i.tweenRunning&&(M("onScrollStart")&&(O(),r.callbacks.onScrollStart.call(t[0])),i.tweenRunning=!0,C(x),i.cbOffsets=[r.callbacks.alwaysTriggerOffsets||w>=S[0]+y,r.callbacks.alwaysTriggerOffsets||w<=-B])},onUpdate:function(){n.callbacks&&n.onUpdate&&M("whileScrolling")&&(O(),r.callbacks.whileScrolling.call(t[0]))},onComplete:function(){if(n.callbacks&&n.onComplete){"yx"===r.axis&&clearTimeout(d[0].onCompleteTimeout);var e=d[0].idleTimer||0;d[0].onCompleteTimeout=setTimeout(function(){M("onScroll")&&(O(),r.callbacks.onScroll.call(t[0])),M("onTotalScroll")&&b[1]>=S[1]-T&&i.cbOffsets[0]&&(O(),r.callbacks.onTotalScroll.call(t[0])),M("onTotalScrollBack")&&b[1]<=k&&i.cbOffsets[1]&&(O(),r.callbacks.onTotalScrollBack.call(t[0])),i.tweenRunning=!1,d[0].idleTimer=0,C(x,"hide")},e)}}})}function M(e){return i&&r.callbacks[e]&&"function"==typeof r.callbacks[e]}function O(){var e=[d[0].offsetTop,d[0].offsetLeft],o=[x[0].offsetTop,x[0].offsetLeft],a=[d.outerHeight(!1),d.outerWidth(!1)],i=[c.height(),c.width()];t[0].mcs={content:d,top:e[0],left:e[1],draggerTop:o[0],draggerLeft:o[1],topPct:Math.round(100*Math.abs(e[0])/(Math.abs(a[0])-i[0])),leftPct:Math.round(100*Math.abs(e[1])/(Math.abs(a[1])-i[1])),direction:n.dir}}},G=function(e,t,o,a,n,i,r){e._mTween||(e._mTween={top:{},left:{}});var l,s,r=r||{},c=r.onStart||function(){},d=r.onUpdate||function(){},u=r.onComplete||function(){},f=J(),h=0,m=e.offsetTop,p=e.style,g=e._mTween[t];"left"===t&&(m=e.offsetLeft);var v=o-m;function x(){g.stop||(h||c.call(),h=J()-f,_(),h>=g.time&&(g.time=h>g.time?h+l-(h-g.time):h+l-1,g.time<h+1&&(g.time=h+1)),g.time<a?g.id=s(x):u.call())}function _(){a>0?(g.currVal=function(e,t,o,a,n){switch(n){case"linear":case"mcsLinear":return o*e/a+t;case"mcsLinearOut":return e/=a,e--,o*Math.sqrt(1-e*e)+t;case"easeInOutSmooth":return(e/=a/2)<1?o/2*e*e+t:-o/2*(--e*(e-2)-1)+t;case"easeInOutStrong":return(e/=a/2)<1?o/2*Math.pow(2,10*(e-1))+t:(e--,o/2*(2-Math.pow(2,-10*e))+t);case"easeInOut":case"mcsEaseInOut":return(e/=a/2)<1?o/2*e*e*e+t:o/2*((e-=2)*e*e+2)+t;case"easeOutSmooth":return e/=a,-o*(--e*e*e*e-1)+t;case"easeOutStrong":return o*(1-Math.pow(2,-10*e/a))+t;case"easeOut":case"mcsEaseOut":default:var i=(e/=a)*e,r=i*e;return t+o*(.499999999999997*r*i+-2.5*i*i+5.5*r+-6.5*i+4*e)}}(g.time,m,v,a,n),p[t]=Math.round(g.currVal)+"px"):p[t]=o+"px",d.call()}g.stop=0,"none"!==i&&null!=g.id&&(window.requestAnimationFrame?window.cancelAnimationFrame(g.id):clearTimeout(g.id),g.id=null),l=1e3/60,g.time=h+l,s=window.requestAnimationFrame?window.requestAnimationFrame:function(e){return _(),setTimeout(e,.01)},g.id=s(x)},J=function(){return window.performance&&window.performance.now?window.performance.now():window.performance&&window.performance.webkitNow?window.performance.webkitNow():Date.now?Date.now():(new Date).getTime()},K=function(){var e=this;e._mTween||(e._mTween={top:{},left:{}});for(var t=["top","left"],o=0;o<t.length;o++){var a=t[o];e._mTween[a].id&&(window.requestAnimationFrame?window.cancelAnimationFrame(e._mTween[a].id):clearTimeout(e._mTween[a].id),e._mTween[a].id=null,e._mTween[a].stop=1)}},Z=function(e,t){try{delete e[t]}catch(o){e[t]=null}},$=function(e){return!(e.which&&1!==e.which)},ee=function(e){var t=e.originalEvent.pointerType;return!(t&&"touch"!==t&&2!==t)},te=function(e){return!isNaN(parseFloat(e))&&isFinite(e)},oe=function(e){var t=e.parents(".mCSB_container");return[e.offset().top-t.offset().top,e.offset().left-t.offset().left]},ae=function(){var e=function(){var e=["webkit","moz","ms","o"];if("hidden"in document)return"hidden";for(var t=0;t<e.length;t++)if(e[t]+"Hidden"in document)return e[t]+"Hidden";return null}();return!!e&&document[e]},e.fn[o]=function(t){return u[t]?u[t].apply(this,Array.prototype.slice.call(arguments,1
vendor: 1,528 bytes, lines 24014-24022
24014)):"object"!=typeof t&&t?void e.error("Method "+t+" does not exist"):u.init.apply(this,arguments)},e[o]=function(t){return u[t]?u[t].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof t&&t?void e.error("Method "+t+" does not exist"):u.init.apply(this,arguments)},e[o].defaults=i,window[o]=!0,e(window).bind("load",function(){e(n)[o](),e.extend(e.expr[":"],{mcsInView:e.expr[":"].mcsInView||function(t){var o,a,n=e(t),i=n.parents(".mCSB_container");if(i.length)return o=i.parent(),(a=[i[0].offsetTop,i[0].offsetLeft])[0]+oe(n)[0]>=0&&a[0]+oe(n)[0]<o.height()-n.outerHeight(!1)&&a[1]+oe(n)[1]>=0&&a[1]+oe(n)[1]<o.width()-n.outerWidth(!1)},mcsInSight:e.expr[":"].mcsInSight||function(t,o,a){var n,i,r,l,s=e(t),c=s.parents(".mCSB_container"),d="exact"===a[3]?[[1,0],[1,0]]:[[.9,.1],[.6,.4]];if(c.length)return n=[s.outerHeight(!1),s.outerWidth(!1)],r=[c[0].offsetTop+oe(s)[0],c[0].offsetLeft+oe(s)[1]],i=[c.parent()[0].offsetHeight,c.parent()[0].offsetWidth],r[0]-i[0]*(l=[n[0]<i[0]?d[0]:d[1],n[1]<i[1]?d[0]:d[1]])[0][0]<0&&r[0]+n[0]-i[0]*l[0][1]>=0&&r[1]-i[1]*l[1][0]<0&&r[1]+n[1]-i[1]*l[1][1]>=0},mcsOverflow:e.expr[":"].mcsOverflow||function(t){var o=e(t).data(a);if(o)return o.overflowed[0]||o.overflowed[1]}})})});
24015/* End */
24016;
24017; /* Start:"a:4:{s:4:"full";s:64:"/bitrix/components/bitrix/search.title/script.js?174721915010542";s:6:"source";s:48:"/bitrix/components/bitrix/search.title/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
24018function JCTitleSearch(arParams)
24019{
24020	var _this = this;
24021
24022	this.arParams = {
24023		'AJAX_PAGE': arParams.AJAX_PAGE,
24024		'CONTAINER_ID': arParams.CONTAINER_ID,
24025		'INPUT_ID': arParams.INPUT_ID,
24026		'MIN_QUERY_LEN': parseInt(arParams.MIN_QUERY_LEN, 10),
24027	};
24028	if (arParams.WAIT_IMAGE)
24029	{
24030		this.arParams.WAIT_IMAGE = arParams.WAIT_IMAGE;
24031	}
24032
24033	if (this.arParams.MIN_QUERY_LEN <= 0)
24034	{
24035		this.arParams.MIN_QUERY_LEN = 1;
24036	}
24037
24038	this.cache = [];
24039	this.cache_key = null;
24040
24041	this.startText = '';
24042	this.running = false;
24043	this.runningCall = false;
24044	this.currentRow = -1;
24045	this.RESULT = null;
24046	this.CONTAINER = null;
24047	this.INPUT = null;
24048	this.WAIT = null;
24049
24050	this.ShowResult = function(result)
24051	{
24052		if (BX.type.isString(result))
24053		{
24054			_this.RESULT.innerHTML = result;
24055		}
24056
24057		_this.RESULT.style.display = _this.RESULT.innerHTML === '' ? 'none' : 'block';
24058		var pos = _this.adjustResultNode();
24059
24060		// adjust left column to be an outline
24061		var resultPosition = null;
24062		var th = null;
24063		var tbl = BX.findChild(_this.RESULT, { 'tag': 'table', 'class': 'title-search-result' }, true);
24064		if (tbl)
24065		{
24066			th = BX.findChild(tbl, { 'tag': 'th' }, true);
24067		}
24068
24069		if (th)
24070		{
24071			var tablePosition = BX.pos(tbl);
24072			tablePosition.width = tablePosition.right - tablePosition.left;
24073
24074			var tableHeaderPosition = BX.pos(th);
24075			tableHeaderPosition.width = tableHeaderPosition.right - tableHeaderPosition.left;
24076			th.style.width = tableHeaderPosition.width + 'px';
24077
24078			_this.RESULT.style.width = (pos.width + tableHeaderPosition.width) + 'px';
24079
24080			// Move table to left by width of the first column
24081			_this.RESULT.style.left = (pos.left - tableHeaderPosition.width - 1) + 'px';
24082
24083			// Shrink table when it's too wide
24084			if ((tablePosition.width - tableHeaderPosition.width) > pos.width)
24085			{
24086				_this.RESULT.style.width = (pos.width + tableHeaderPosition.width - 1) + 'px';
24087			}
24088
24089			// Check if table is too wide and shrink result div to it's width
24090			tablePosition = BX.pos(tbl);
24091			resultPosition = BX.pos(_this.RESULT);
24092			if (resultPosition.right > tablePosition.right)
24093			{
24094				_this.RESULT.style.width = (tablePosition.right - tablePosition.left) + 'px';
24095			}
24096		}
24097
24098		var fade = false;
24099		if (tbl)
24100		{
24101			fade = BX.findChild(_this.RESULT, { 'class': 'title-search-fader' }, true);
24102		}
24103
24104		if (fade && th)
24105		{
24106			resultPosition = BX.pos(_this.RESULT);
24107			fade.style.left = (resultPosition.right - resultPosition.left - 18) + 'px';
24108			fade.style.width = 18 + 'px';
24109			fade.style.top = 0 + 'px';
24110			fade.style.height = (resultPosition.bottom - resultPosition.top) + 'px';
24111			fade.style.display = 'block';
24112		}
24113	};
24114
24115	this.onKeyPress = function(keyCode)
24116	{
24117		var tbl = BX.findChild(_this.RESULT, { 'tag': 'table', 'class': 'title-search-result' }, true);
24118		if (!tbl)
24119		{
24120			return false;
24121		}
24122
24123		var i = 0;
24124		var cnt = tbl.rows.length;
24125
24126		switch (keyCode)
24127		{
24128			case 27: // escape key - close search div
24129				_this.RESULT.style.display = 'none';
24130				_this.currentRow = -1;
24131				_this.UnSelectAll();
24132
24133				return true;
24134			case 40: // down key - navigate down on search results
24135				if (_this.RESULT.style.display == 'none')
24136				{
24137					_this.RESULT.style.display = 'block';
24138				}
24139
24140				var first = -1;
24141				for (i = 0; i < cnt; i++)
24142				{
24143					if (!BX.findChild(tbl.rows[i], { 'class': 'title-search-separator' }, true))
24144					{
24145						if (first == -1)
24146						{
24147							first = i;
24148						}
24149
24150						if (_this.currentRow < i)
24151						{
24152							_this.currentRow = i;
24153							break;
24154						}
24155						else if (tbl.rows[i].className == 'title-search-selected')
24156						{
24157							tbl.rows[i].className = '';
24158						}
24159					}
24160				}
24161
24162				if (i == cnt && _this.currentRow != i)
24163				{
24164					_this.currentRow = first;
24165				}
24166
24167				tbl.rows[_this.currentRow].className = 'title-search-selected';
24168
24169				return true;
24170			case 38: // up key - navigate up on search results
24171				if (_this.RESULT.style.display == 'none')
24172				{
24173					_this.RESULT.style.display = 'block';
24174				}
24175
24176				var last = -1;
24177				for (i = cnt - 1; i >= 0; i--)
24178				{
24179					if (!BX.findChild(tbl.rows[i], { 'class': 'title-search-separator' }, true))
24180					{
24181						if (last == -1)
24182						{
24183							last = i;
24184						}
24185
24186						if (_this.currentRow > i)
24187						{
24188							_this.currentRow = i;
24189							break;
24190						}
24191						else if (tbl.rows[i].className == 'title-search-selected')
24192						{
24193							tbl.rows[i].className = '';
24194						}
24195					}
24196				}
24197
24198				if (i < 0 && _this.currentRow != i)
24199				{
24200					_this.currentRow = last;
24201				}
24202
24203				tbl.rows[_this.currentRow].className = 'title-search-selected';
24204
24205				return true;
24206			case 13: // enter key - choose current search result
24207				if (_this.RESULT.style.display == 'block')
24208				{
24209					for (i = 0; i < cnt; i++)
24210					{
24211						if (
24212							_this.currentRow == i
24213							&& !BX.findChild(tbl.rows[i], { 'class': 'title-search-separator' }, true)
24214						)
24215						{
24216							var a = BX.findChild(tbl.rows[i], { 'tag': 'a' }, true);
24217							if (a)
24218							{
24219								window.location = a.href;
24220
24221								return true;
24222							}
24223						}
24224					}
24225				}
24226
24227				return false;
24228			default:
24229				break;
24230		}
24231
24232		return false;
24233	};
24234
24235	this.onTimeout = function()
24236	{
24237		_this.onChange(function() {
24238			setTimeout(_this.onTimeout, 500);
24239		});
24240	};
24241
24242	this.onChange = function(callback)
24243	{
24244		if (_this.running)
24245		{
24246			_this.runningCall = true;
24247
24248			return;
24249		}
24250		_this.running = true;
24251
24252		if (_this.INPUT.value != _this.oldValue && _this.INPUT.value != _this.startText)
24253		{
24254			_this.oldValue = _this.INPUT.value;
24255			if (_this.INPUT.value.length >= _this.arParams.MIN_QUERY_LEN)
24256			{
24257				_this.cache_key = _this.arParams.INPUT_ID + '|' + _this.INPUT.value;
24258				if (_this.cache[_this.cache_key] == null)
24259				{
24260					if (_this.WAIT)
24261					{
24262						var pos = BX.pos(_this.INPUT);
24263						var height = (pos.bottom - pos.top) - 2;
24264						_this.WAIT.style.top = (pos.top + 1) + 'px';
24265						_this.WAIT.style.height = height + 'px';
24266						_this.WAIT.style.width = height + 'px';
24267						_this.WAIT.style.left = (pos.right - height + 2) + 'px';
24268						_this.WAIT.style.display = 'block';
24269					}
24270
24271					BX.ajax.post(
24272						_this.arParams.AJAX_PAGE,
24273						{
24274							'ajax_call': 'y',
24275							'INPUT_ID': _this.arParams.INPUT_ID,
24276							'q': _this.INPUT.value,
24277							'l': _this.arParams.MIN_QUERY_LEN,
24278						},
24279						function(result)
24280						{
24281							_this.cache[_this.cache_key] = result;
24282							_this.ShowResult(result);
24283							_this.currentRow = -1;
24284							_this.EnableMouseEvents();
24285							if (_this.WAIT)
24286							{
24287								_this.WAIT.style.display = 'none';
24288							}
24289
24290							if (!!callback)
24291							{
24292								callback();
24293							}
24294
24295							_this.running = false;
24296							if (_this.runningCall)
24297							{
24298								_this.runningCall = false;
24299								_this.onChange();
24300							}
24301						}
24302					);
24303
24304					return;
24305				}
24306
24307				_this.ShowResult(_this.cache[_this.cache_key]);
24308				_this.currentRow = -1;
24309				_this.EnableMouseEvents();
24310			}
24311			else
24312			{
24313				_this.RESULT.style.display = 'none';
24314				_this.currentRow = -1;
24315				_this.UnSelectAll();
24316			}
24317		}
24318
24319		if (!!callback)
24320		{
24321			callback();
24322		}
24323		_this.running = false;
24324	};
24325
24326	this.onScroll = function ()
24327	{
24328		if (BX.type.isElementNode(_this.RESULT)
24329			&& _this.RESULT.style.display !== 'none'
24330			&& _this.RESULT.innerHTML !== ''
24331		)
24332		{
24333			_this.adjustResultNode();
24334		}
24335	};
24336
24337	this.UnSelectAll = function()
24338	{
24339		var tbl = BX.findChild(_this.RESULT, { 'tag': 'table', 'class': 'title-search-result' }, true);
24340		if (tbl)
24341		{
24342			var cnt = tbl.rows.length;
24343			for (var i = 0; i < cnt; i++)
24344			{
24345				tbl.rows[i].className = '';
24346			}
24347		}
24348	};
24349
24350	this.EnableMouseEvents = function()
24351	{
24352		var tbl = BX.findChild(_this.RESULT, { 'tag': 'table', 'class': 'title-search-result' }, true);
24353		if (tbl)
24354		{
24355			var cnt = tbl.rows.length;
24356			for (var i = 0; i < cnt; i++)
24357			{
24358				if (!BX.findChild(tbl.rows[i], { 'class': 'title-search-separator' }, true))
24359				{
24360					tbl.rows[i].id = 'row_' + i;
24361					tbl.rows[i].onmouseover = function (e) {
24362						if (_this.currentRow != this.id.substr(4))
24363						{
24364							_this.UnSelectAll();
24365							this.className = 'title-search-selected';
24366							_this.currentRow = this.id.substr(4);
24367						}
24368					};
24369
24370					tbl.rows[i].onmouseout = function (e) {
24371						this.className = '';
24372						_this.currentRow = -1;
24373					};
24374				}
24375			}
24376		}
24377	};
24378
24379	this.onFocusLost = function(hide)
24380	{
24381		setTimeout(function() { _this.RESULT.style.display = 'none'; }, 250);
24382	};
24383
24384	this.onFocusGain = function()
24385	{
24386		if (_this.RESULT.innerHTML.length > 0)
24387		{
24388			_this.ShowResult();
24389		}
24390	};
24391
24392	this.onKeyDown = function(e)
24393	{
24394		if (!e)
24395		{
24396			e = window.event;
24397		}
24398
24399		if (_this.RESULT.style.display == 'block' && _this.onKeyPress(e.keyCode))
24400		{
24401			return BX.PreventDefault(e);
24402		}
24403	};
24404
24405	this.adjustResultNode = function()
24406	{
24407		if (!(BX.type.isElementNode(_this.RESULT)
24408			&& BX.type.isElementNode(_this.CONTAINER))
24409		)
24410		{
24411			return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 };
24412		}
24413
24414		var pos = BX.pos(_this.CONTAINER);
24415
24416		_this.RESULT.style.position = 'absolute';
24417		_this.RESULT.style.top = (pos.bottom + 2) + 'px';
24418		_this.RESULT.style.left = pos.left + 'px';
24419		_this.RESULT.style.width = pos.width + 'px';
24420
24421		return pos;
24422	};
24423
24424	this.onContainerLayoutChange = function()
24425	{
24426		if (BX.type.isElementNode(_this.RESULT)
24427			&& _this.RESULT.style.display !== 'none'
24428			&& _this.RESULT.innerHTML !== ''
24429		)
24430		{
24431			_this.adjustResultNode();
24432		}
24433	};
24434
24435	this.Init = function()
24436	{
24437		this.CONTAINER = document.getElementById(this.arParams.CONTAINER_ID);
24438		BX.addCustomEvent(this.CONTAINER, 'OnNodeLayoutChange', this.onContainerLayoutChange);
24439
24440		this.RESULT = document.body.appendChild(document.createElement("DIV"));
24441		this.RESULT.className = 'title-search-result';
24442		this.INPUT = document.getElementById(this.arParams.INPUT_ID);
24443		this.startText = this.INPUT.value;
24444		this.oldValue = this.INPUT.value;
24445		BX.bind(this.INPUT, 'focus', function() { _this.onFocusGain(); });
24446		BX.bind(this.INPUT, 'blur', function() { _this.onFocusLost(); });
24447		this.INPUT.onkeydown = this.onKeyDown;
24448
24449		if (this.arParams.WAIT_IMAGE)
24450		{
24451			this.WAIT = document.body.appendChild(document.createElement('DIV'));
24452			this.WAIT.style.backgroundImage = "url('" + this.arParams.WAIT_IMAGE + "')";
24453			if (!BX.browser.IsIE())
24454			{
24455				this.WAIT.style.backgroundRepeat = 'none';
24456			}
24457			this.WAIT.style.display = 'none';
24458			this.WAIT.style.position = 'absolute';
24459			this.WAIT.style.zIndex = '1100';
24460		}
24461
24462		BX.bind(this.INPUT, 'bxchange', function() {_this.onChange()});
24463
24464		var fixedParent = BX.findParent(this.CONTAINER, BX.is_fixed);
24465		if (BX.type.isElementNode(fixedParent))
24466		{
24467			BX.bind(window, 'scroll', BX.throttle(this.onScroll, 100, this));
24468		}
24469	};
24470
24471	BX.ready(function() { _this.Init(arParams); });
24472}
24473
24474/* End */
24475;
24476; /* Start:"a:4:{s:4:"full";s:89:"/local/templates/aspro_next/components/bitrix/search.title/corp/script.
24476js?172597034210017";s:6:"source";s:73:"/local/templates/aspro_next/components/bitrix/search.title/corp/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
24477function JCTitleSearch2(arParams)
24478{
24479	var _this = this;
24480
24481	this.arParams = {
24482		'AJAX_PAGE': arParams.AJAX_PAGE,
24483		'CONTAINER_ID': arParams.CONTAINER_ID,
24484		'INPUT_ID': arParams.INPUT_ID,
24485		'INPUT_ID_TMP': arParams.INPUT_ID_TMP,
24486		'MIN_QUERY_LEN': parseInt(arParams.MIN_QUERY_LEN)
24487	};
24488
24489	if(arParams.WAIT_IMAGE)
24490		this.arParams.WAIT_IMAGE = arParams.WAIT_IMAGE;
24491	if(arParams.MIN_QUERY_LEN <= 0)
24492		arParams.MIN_QUERY_LEN = 1;
24493
24494	this.cache = [];
24495	this.cache_key = null;
24496
24497	this.startText = '';
24498	this.running = false;
24499	this.needRunAgain = false;
24500	this.currentRow = -1;
24501	this.RESULT = null;
24502	this.CONTAINER = null;
24503	this.INPUT = null;
24504	this.WAIT = null;
24505
24506	this.ShowResult = function(result)
24507	{
24508		if(BX.type.isString(result))
24509		{
24510			_this.RESULT.innerHTML = result;
24511		}
24512
24513		_this.RESULT.style.display = _this.RESULT.innerHTML !== '' ? 'block' : 'none';
24514		var pos = _this.adjustResultNode();
24515
24516		//adjust left column to be an outline
24517		var res_pos;
24518		var th;
24519		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
24520		if(tbl)
24521		{
24522			th = BX.findChild(tbl, {'tag':'th'}, true);
24523		}
24524		if(th)
24525		{
24526			var tbl_pos = BX.pos(tbl);
24527			tbl_pos.width = tbl_pos.right - tbl_pos.left;
24528
24529			var th_pos = BX.pos(th);
24530			th_pos.width = th_pos.right - th_pos.left;
24531			th.style.width = th_pos.width + 'px';
24532
24533			_this.RESULT.style.width = (pos.width + th_pos.width) + 'px';
24534
24535			//Move table to left by width of the first column
24536			_this.RESULT.style.left = (pos.left - th_pos.width - 1)+ 'px';
24537
24538			//Shrink table when it's too wide
24539			if((tbl_pos.width - th_pos.width) > pos.width)
24540				_this.RESULT.style.width = (pos.width + th_pos.width -1) + 'px';
24541
24542			//Check if table is too wide and shrink result div to it's width
24543			tbl_pos = BX.pos(tbl);
24544			res_pos = BX.pos(_this.RESULT);
24545			if(res_pos.right > tbl_pos.right)
24546			{
24547				_this.RESULT.style.width = (tbl_pos.right - tbl_pos.left) + 'px';
24548			}
24549		}
24550
24551		var fade;
24552		if(tbl) fade = BX.findChild(_this.RESULT, {'class':'title-search-fader'}, true);
24553		if(fade && th)
24554		{
24555			res_pos = BX.pos(_this.RESULT);
24556			fade.style.left = (res_pos.right - res_pos.left - 18) + 'px';
24557			fade.style.width = 18 + 'px';
24558			fade.style.top = 0 + 'px';
24559			fade.style.height = (res_pos.bottom - res_pos.top) + 'px';
24560			fade.style.display = 'block';
24561		}
24562	};
24563
24564	this.onKeyPress = function(keyCode)
24565	{
24566		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
24567		if(!tbl)
24568			return false;
24569
24570		var i;
24571		var cnt = tbl.rows.length;
24572
24573		switch (keyCode)
24574		{
24575		case 27: // escape key - close search div
24576			_this.RESULT.style.display = 'none';
24577			_this.currentRow = -1;
24578			_this.UnSelectAll();
24579		return true;
24580
24581		case 40: // down key - navigate down on search results
24582			if(_this.RESULT.style.display == 'none')
24583				_this.RESULT.style.display = 'block';
24584
24585			var first = -1;
24586			for(i = 0; i < cnt; i++)
24587			{
24588				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
24589				{
24590					if(first == -1)
24591						first = i;
24592
24593					if(_this.currentRow < i)
24594					{
24595						_this.currentRow = i;
24596						break;
24597					}
24598					else if(tbl.rows[i].className == 'title-search-selected')
24599					{
24600						tbl.rows[i].className = '';
24601					}
24602				}
24603			}
24604
24605			if(i == cnt && _this.currentRow != i)
24606				_this.currentRow = first;
24607
24608			tbl.rows[_this.currentRow].className = 'title-search-selected';
24609		return true;
24610
24611		case 38: // up key - navigate up on search results
24612			if(_this.RESULT.style.display == 'none')
24613				_this.RESULT.style.display = 'block';
24614
24615			var last = -1;
24616			for(i = cnt-1; i >= 0; i--)
24617			{
24618				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
24619				{
24620					if(last == -1)
24621						last = i;
24622
24623					if(_this.currentRow > i)
24624					{
24625						_this.currentRow = i;
24626						break;
24627					}
24628					else if(tbl.rows[i].className == 'title-search-selected')
24629					{
24630						tbl.rows[i].className = '';
24631					}
24632				}
24633			}
24634
24635			if(i < 0 && _this.currentRow != i)
24636				_this.currentRow = last;
24637
24638			tbl.rows[_this.currentRow].className = 'title-search-selected';
24639		return true;
24640
24641		case 13: // enter key - choose current search result
24642			if(_this.RESULT.style.display == 'block')
24643			{
24644				for(i = 0; i < cnt; i++)
24645				{
24646					if(_this.currentRow == i)
24647					{
24648						if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
24649						{
24650							var a = BX.findChild(tbl.rows[i], {'tag':'a'}, true);
24651							if(a)
24652							{
24653								window.location = a.href;
24654								return true;
24655							}
24656						}
24657					}
24658				}
24659			}
24660		return false;
24661		}
24662
24663		return false;
24664	};
24665
24666	this.onTimeout = function()
24667	{
24668		_this.onChange(function(){
24669			setTimeout(_this.onTimeout, 500);
24670		});
24671	};
24672
24673	this.onChange = function(callback)
24674	{
24675		if (_this.running){
24676			_this.needRunAgain = true;
24677			return;
24678		}
24679		_this.running = true;
24680
24681		if(_this.INPUT.value != _this.oldValue && _this.INPUT.value != _this.startText)
24682		{
24683			_this.oldValue = _this.INPUT.value;
24684			if(_this.INPUT.value.length >= _this.arParams.MIN_QUERY_LEN)
24685			{
24686				_this.cache_key = _this.arParams.INPUT_ID + '|' + _this.INPUT.value;
24687				if(_this.cache[_this.cache_key] == null)
24688				{
24689					if(_this.WAIT)
24690					{
24691						var pos = BX.pos(_this.INPUT);
24692						var height = (pos.bottom - pos.top)-2;
24693						_this.WAIT.style.top = (pos.top+1) + 'px';
24694						_this.WAIT.style.height = height + 'px';
24695						_this.WAIT.style.width = height + 'px';
24696						_this.WAIT.style.left = (pos.right - height + 2) + 'px';
24697						_this.WAIT.style.display = 'block';
24698					}
24699
24700					BX.ajax.post(
24701						_this.arParams.AJAX_PAGE,
24702						{
24703							'ajax_call':'y',
24704							'INPUT_ID':_this.arParams.INPUT_ID_TMP,
24705							'q':_this.INPUT.value,
24706							'l':_this.arParams.MIN_QUERY_LEN
24707						},
24708						function(result)
24709						{
24710							_this.cache[_this.cache_key] = result;
24711							_this.ShowResult(result);
24712							_this.currentRow = -1;
24713							_this.EnableMouseEvents();
24714							if(_this.WAIT)
24715								_this.WAIT.style.display = 'none';
24716							if (!!callback)
24717								callback();
24718							_this.running = false;
24719
24720							if(_this.needRunAgain){
24721								_this.needRunAgain = false;
24722								_this.onChange(callback);
24723							}
24724						}
24725					);
24726					return;
24727				}
24728				else
24729				{
24730					_this.ShowResult(_this.cache[_this.cache_key]);
24731					_this.currentRow = -1;
24732					_this.EnableMouseEvents();
24733				}
24734			}
24735			else
24736			{
24737				_this.RESULT.style.display = 'none';
24738				_this.currentRow = -1;
24739				_this.UnSelectAll();
24740			}
24741		}
24742		if (!!callback)
24743			callback();
24744		_this.running = false;
24745	};
24746
24747	this.UnSelectAll = function()
24748	{
24749		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
24750		if(tbl)
24751		{
24752			var cnt = tbl.rows.length;
24753			for(var i = 0; i < cnt; i++)
24754				tbl.rows[i].className = '';
24755		}
24756	};
24757
24758	this.EnableMouseEvents = function()
24759	{
24760		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
24761		if(tbl)
24762		{
24763			var cnt = tbl.rows.length;
24764			for(var i = 0; i < cnt; i++)
24765				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
24766				{
24767					tbl.rows[i].id = 'row_' + i;
24768					tbl.rows[i].onmouseover = function (e) {
24769						if(_this.currentRow != this.id.substr(4))
24770						{
24771							_this.UnSelectAll();
24772							this.className = 'title-search-selected';
24773							_this.currentRow = this.id.substr(4);
24774						}
24775					};
24776					tbl.rows[i].onmouseout = function (e) {
24777						this.className = '';
24778						_this.currentRow = -1;
24779					};
24780				}
24781		}
24782	};
24783
24784	this.onFocusLost = function(hide)
24785	{
24786		setTimeout(function(){_this.RESULT.style.display = 'none';}, 300);
24787		// _this.RESULT.style.display = 'none';
24788	};
24789
24790	this.onFocusGain = function()
24791	{
24792		if(_this.RESULT.innerHTML.length)
24793			_this.ShowResult();
24794	};
24795
24796	this.onKeyDown = function(e)
24797	{
24798		if(!e)
24799			e = window.event;
24800		if (_this.RESULT.style.display == 'block')
24801		{
24802			if(_this.onKeyPress(e.keyCode))
24803				return BX.PreventDefault(e);
24804		}
24805	};
24806
24807	this.adjustResultNode = function()
24808	{
24809		var pos, pos_input;
24810		var fixedParent = BX.findParent(_this.CONTAINER, BX.is_fixed);
24811		if(!!fixedParent)
24812		{
24813			_this.RESULT.style.position = 'fixed';
24814			_this.RESULT.style.zIndex = BX.style(fixedParent, 'z-index') + 2;
24815			pos = BX.pos(_this.CONTAINER, true);
24816		}
24817		else
24818		{
24819			_this.RESULT.style.position = 'absolute';
24820			pos = BX.pos(_this.CONTAINER);
24821		}
24822		pos_input = BX.pos(_this.INPUT);
24823
24824		pos.width = pos.right - pos.left;
24825		_this.RESULT.style.top = (pos.bottom + 2) + 'px';
24826		_this.RESULT.style.left = pos_input.left + 'px';
24827
24828		if($(_this.INPUT).closest('.inline-search-block.with-close').length)
24829			_this.RESULT.style.width = pos_input.width + 'px';
24830		else
24831			_this.RESULT.style.width = pos.width + 'px';
24832		return pos;
24833	};
24834
24835	this._onContainerLayoutChange = function()
24836	{
24837		if(_this.RESULT.style.display !== "none" && _this.RESULT.innerHTML !== '')
24838		{
24839			_this.adjustResultNode();
24840		}
24841	};
24842	this.Init = function()
24843	{
24844		this.CONTAINER = document.getElementById(this.arParams.CONTAINER_ID);
24845		BX.addCustomEvent(this.CONTAINER, "OnNodeLayoutChange", this._onContainerLayoutChange);
24846
24847		this.RESULT = document.body.appendChild(document.createElement("DIV"));
24848
24849		this.RESULT.className = 'title-search-result '+this.arParams.INPUT_ID;
24850		this.INPUT = document.getElementById(this.arParams.INPUT_ID);
24851		this.startText = this.oldValue = this.INPUT.value;
24852		BX.bind(this.INPUT, 'focus', function(e) {
24853			_this.onFocusGain()
24854		});
24855		BX.bind(this.INPUT, 'blur', function(e) {
24856			if(!$(e.relatedTarget).hasClass('bx_item_block'))
24857				_this.onFocusLost();
24858		});
24859
24860		if(BX.browser.IsSafari() || BX.browser.IsIE())
24861			this.INPUT.onkeydown = this.onKeyDown;
24862		else
24863			this.INPUT.onkeypress = this.onKeyDown;
24864
24865		if(this.arParams.WAIT_IMAGE)
24866		{
24867			this.WAIT = document.body.appendChild(document.createElement("DIV"));
24868			this.WAIT.style.backgroundImage = "url('" + this.arParams.WAIT_IMAGE + "')";
24869			if(!BX.browser.IsIE())
24870				this.WAIT.style.backgroundRepeat = 'none';
24871			this.WAIT.style.display = 'none';
24872			this.WAIT.style.position = 'absolute';
24873			this.WAIT.style.zIndex = '1100';
24874		}
24875
24876		BX.bind(this.INPUT, 'bxchange', function(e) {_this.onChange()});
24877	};
24878	BX.ready(function (){_this.Init(arParams)});
24879}
24880
24881/* End */
24882;
24883; /* Start:"a:4:{s:4:"full";s:90:"/local/templates/aspro_next/components/bitrix/search.title/fixed/script.
24883js?172597034510084";s:6:"source";s:74:"/local/templates/aspro_next/components/bitrix/search.title/fixed/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
24884function JCTitleSearch2(arParams)
24885{
24886	var _this = this;
24887
24888	this.arParams = {
24889		'AJAX_PAGE': arParams.AJAX_PAGE,
24890		'CONTAINER_ID': arParams.CONTAINER_ID,
24891		'INPUT_ID': arParams.INPUT_ID,
24892		'INPUT_ID_TMP': arParams.INPUT_ID_TMP,
24893		'MIN_QUERY_LEN': parseInt(arParams.MIN_QUERY_LEN)
24894	};
24895	if(arParams.WAIT_IMAGE)
24896		this.arParams.WAIT_IMAGE = arParams.WAIT_IMAGE;
24897	if(arParams.MIN_QUERY_LEN <= 0)
24898		arParams.MIN_QUERY_LEN = 1;
24899
24900	this.cache = [];
24901	this.cache_key = null;
24902
24903	this.startText = '';
24904	this.running = false;
24905	this.needRunAgain = false;
24906	this.currentRow = -1;
24907	this.RESULT = null;
24908	this.CONTAINER = null;
24909	this.INPUT = null;
24910	this.WAIT = null;
24911
24912	this.ShowResult = function(result)
24913	{
24914		if(BX.type.isString(result))
24915		{
24916			_this.RESULT.innerHTML = result;
24917		}
24918
24919		_this.RESULT.style.display = _this.RESULT.innerHTML !== '' ? 'block' : 'none';
24920		var pos = _this.adjustResultNode();
24921
24922		//adjust left column to be an outline
24923		var res_pos;
24924		var th;
24925		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
24926		if(tbl)
24927		{
24928			th = BX.findChild(tbl, {'tag':'th'}, true);
24929		}
24930		if(th)
24931		{
24932			var tbl_pos = BX.pos(tbl);
24933			tbl_pos.width = tbl_pos.right - tbl_pos.left;
24934
24935			var th_pos = BX.pos(th);
24936			th_pos.width = th_pos.right - th_pos.left;
24937			th.style.width = th_pos.width + 'px';
24938
24939			_this.RESULT.style.width = (pos.width + th_pos.width) + 'px';
24940
24941			//Move table to left by width of the first column
24942			_this.RESULT.style.left = (pos.left - th_pos.width - 1)+ 'px';
24943
24944			//Shrink table when it's too wide
24945			if((tbl_pos.width - th_pos.width) > pos.width)
24946				_this.RESULT.style.width = (pos.width + th_pos.width -1) + 'px';
24947
24948			//Check if table is too wide and shrink result div to it's width
24949			tbl_pos = BX.pos(tbl);
24950			res_pos = BX.pos(_this.RESULT);
24951			if(res_pos.right > tbl_pos.right)
24952			{
24953				_this.RESULT.style.width = (tbl_pos.right - tbl_pos.left) + 'px';
24954			}
24955		}
24956
24957		var fade;
24958		if(tbl) fade = BX.findChild(_this.RESULT, {'class':'title-search-fader'}, true);
24959		if(fade && th)
24960		{
24961			res_pos = BX.pos(_this.RESULT);
24962			fade.style.left = (res_pos.right - res_pos.left - 18) + 'px';
24963			fade.style.width = 18 + 'px';
24964			fade.style.top = 0 + 'px';
24965			fade.style.height = (res_pos.bottom - res_pos.top) + 'px';
24966			fade.style.display = 'block';
24967		}
24968	};
24969
24970	this.onKeyPress = function(keyCode)
24971	{
24972		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
24973		if(!tbl)
24974			return false;
24975
24976		var i;
24977		var cnt = tbl.rows.length;
24978
24979		switch (keyCode)
24980		{
24981		case 27: // escape key - close search div
24982			_this.RESULT.style.display = 'none';
24983			_this.currentRow = -1;
24984			_this.UnSelectAll();
24985		return true;
24986
24987		case 40: // down key - navigate down on search results
24988			if(_this.RESULT.style.display == 'none')
24989				_this.RESULT.style.display = 'block';
24990
24991			var first = -1;
24992			for(i = 0; i < cnt; i++)
24993			{
24994				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
24995				{
24996					if(first == -1)
24997						first = i;
24998
24999					if(_this.currentRow < i)
25000					{
25001						_this.currentRow = i;
25002						break;
25003					}
25004					else if(tbl.rows[i].className == 'title-search-selected')
25005					{
25006						tbl.rows[i].className = '';
25007					}
25008				}
25009			}
25010
25011			if(i == cnt && _this.currentRow != i)
25012				_this.currentRow = first;
25013
25014			tbl.rows[_this.currentRow].className = 'title-search-selected';
25015		return true;
25016
25017		case 38: // up key - navigate up on search results
25018			if(_this.RESULT.style.display == 'none')
25019				_this.RESULT.style.display = 'block';
25020
25021			var last = -1;
25022			for(i = cnt-1; i >= 0; i--)
25023			{
25024				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
25025				{
25026					if(last == -1)
25027						last = i;
25028
25029					if(_this.currentRow > i)
25030					{
25031						_this.currentRow = i;
25032						break;
25033					}
25034					else if(tbl.rows[i].className == 'title-search-selected')
25035					{
25036						tbl.rows[i].className = '';
25037					}
25038				}
25039			}
25040
25041			if(i < 0 && _this.currentRow != i)
25042				_this.currentRow = last;
25043
25044			tbl.rows[_this.currentRow].className = 'title-search-selected';
25045		return true;
25046
25047		case 13: // enter key - choose current search result
25048			if(_this.RESULT.style.display == 'block')
25049			{
25050				for(i = 0; i < cnt; i++)
25051				{
25052					if(_this.currentRow == i)
25053					{
25054						if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
25055						{
25056							var a = BX.findChild(tbl.rows[i], {'tag':'a'}, true);
25057							if(a)
25058							{
25059								window.location = a.href;
25060								return true;
25061							}
25062						}
25063					}
25064				}
25065			}
25066		return false;
25067		}
25068
25069		return false;
25070	};
25071
25072	this.onTimeout = function()
25073	{
25074		_this.onChange(function(){
25075			setTimeout(_this.onTimeout, 500);
25076		});
25077	};
25078
25079	this.onChange = function(callback)
25080	{
25081		if (_this.running){
25082			_this.needRunAgain = true;
25083			return;
25084		}
25085		_this.running = true;
25086
25087		if(_this.INPUT.value != _this.oldValue && _this.INPUT.value != _this.startText)
25088		{
25089			_this.oldValue = _this.INPUT.value;
25090			if(_this.INPUT.value.length >= _this.arParams.MIN_QUERY_LEN)
25091			{
25092				_this.cache_key = _this.arParams.INPUT_ID + '|' + _this.INPUT.value;
25093				if(_this.cache[_this.cache_key] == null)
25094				{
25095					if(_this.WAIT)
25096					{
25097						var pos = BX.pos(_this.INPUT);
25098						var height = (pos.bottom - pos.top)-2;
25099						_this.WAIT.style.top = (pos.top+1) + 'px';
25100						_this.WAIT.style.height = height + 'px';
25101						_this.WAIT.style.width = height + 'px';
25102						_this.WAIT.style.left = (pos.right - height + 2) + 'px';
25103						_this.WAIT.style.display = 'block';
25104					}
25105
25106					BX.ajax.post(
25107						_this.arParams.AJAX_PAGE,
25108						{
25109							'ajax_call':'y',
25110							'INPUT_ID':_this.arParams.INPUT_ID_TMP,
25111							'q':_this.INPUT.value,
25112							'l':_this.arParams.MIN_QUERY_LEN
25113						},
25114						function(result)
25115						{
25116							_this.cache[_this.cache_key] = result;
25117							_this.ShowResult(result);
25118							_this.currentRow = -1;
25119							_this.EnableMouseEvents();
25120							if(_this.WAIT)
25121								_this.WAIT.style.display = 'none';
25122							if (!!callback)
25123								callback();
25124							_this.running = false;
25125
25126							if(_this.needRunAgain){
25127								_this.needRunAgain = false;
25128								_this.onChange(callback);
25129							}
25130						}
25131					);
25132					return;
25133				}
25134				else
25135				{
25136					_this.ShowResult(_this.cache[_this.cache_key]);
25137					_this.currentRow = -1;
25138					_this.EnableMouseEvents();
25139				}
25140			}
25141			else
25142			{
25143				_this.RESULT.style.display = 'none';
25144				_this.currentRow = -1;
25145				_this.UnSelectAll();
25146			}
25147		}
25148		if (!!callback)
25149			callback();
25150		_this.running = false;
25151	};
25152
25153	this.UnSelectAll = function()
25154	{
25155		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
25156		if(tbl)
25157		{
25158			var cnt = tbl.rows.length;
25159			for(var i = 0; i < cnt; i++)
25160				tbl.rows[i].className = '';
25161		}
25162	};
25163
25164	this.EnableMouseEvents = function()
25165	{
25166		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
25167		if(tbl)
25168		{
25169			var cnt = tbl.rows.length;
25170			for(var i = 0; i < cnt; i++)
25171				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
25172				{
25173					tbl.rows[i].id = 'row_' + i;
25174					tbl.rows[i].onmouseover = function (e) {
25175						if(_this.currentRow != this.id.substr(4))
25176						{
25177							_this.UnSelectAll();
25178							this.className = 'title-search-selected';
25179							_this.currentRow = this.id.substr(4);
25180						}
25181					};
25182					tbl.rows[i].onmouseout = function (e) {
25183						this.className = '';
25184						_this.currentRow = -1;
25185					};
25186				}
25187		}
25188	};
25189
25190	this.onFocusLost = function(hide)
25191	{
25192		setTimeout(function(){_this.RESULT.style.display = 'none';}, 300);
25193		// _this.RESULT.style.display = 'none';
25194	};
25195
25196	this.onFocusGain = function()
25197	{
25198		if(_this.RESULT.innerHTML.length)
25199			_this.ShowResult();
25200	};
25201
25202	this.onKeyDown = function(e)
25203	{
25204		if(!e)
25205			e = window.event;
25206
25207		if (_this.RESULT.style.display == 'block')
25208		{
25209			if(_this.onKeyPress(e.keyCode))
25210				return BX.PreventDefault(e);
25211		}
25212	};
25213
25214	this.adjustResultNode = function()
25215	{
25216		var pos, pos_input;
25217		var fixedParent = BX.findParent(_this.CONTAINER, BX.is_fixed);
25218		if(!!fixedParent)
25219		{
25220			_this.RESULT.style.position = 'fixed';
25221			_this.RESULT.style.zIndex = BX.style(fixedParent, 'z-index') + 2;
25222			pos = BX.pos(_this.CONTAINER, true);
25223		}
25224		else
25225		{
25226			_this.RESULT.style.position = 'absolute';
25227			pos = BX.pos(_this.CONTAINER);
25228		}
25229		pos_input = BX.pos(_this.INPUT);
25230
25231		pos.width = pos.right - pos.left;
25232		_this.RESULT.style.top = (pos.bottom + 2) + 'px';
25233		_this.RESULT.style.left = pos_input.left + 'px';
25234
25235		if($(_this.INPUT).closest('.inline-search-block.with-close').length)
25236			_this.RESULT.style.width = pos_input.width + 'px';
25237		else
25238			_this.RESULT.style.width = pos.width + 'px';
25239		return pos;
25240	};
25241
25242	this._onContainerLayoutChange = function()
25243	{
25244		if(_this.RESULT.style.display !== "none" && _this.RESULT.innerHTML !== '')
25245		{
25246			_this.adjustResultNode();
25247		}
25248	};
25249	this.Init = function()
25250	{
25251		this.CONTAINER = document.getElementById(this.arParams.CONTAINER_ID);
25252		BX.addCustomEvent(this.CONTAINER, "OnNodeLayoutChange", this._onContainerLayoutChange);
25253
25254		this.RESULT = document.body.appendChild(document.createElement("DIV"));
25255
25256		this.RESULT.className = 'title-search-result '+this.arParams.INPUT_ID;
25257		if(this.arParams.INPUT_ID != 'title-search-input_fixed')
25258			this.RESULT.className += ' '+arNextOptions['THEME']['TYPE_SEARCH']+'_type';
25259
25260		this.INPUT = document.getElementById(this.arParams.INPUT_ID);
25261		this.startText = this.oldValue = this.INPUT.value;
25262		BX.bind(this.INPUT, 'focus', function() {_this.onFocusGain()});
25263		BX.bind(this.INPUT, 'blur', function() {_this.onFocusLost()});
25264
25265		if(BX.browser.IsSafari() || BX.browser.IsIE())
25266			this.INPUT.onkeydown = this.onKeyDown;
25267		else
25268			this.INPUT.onkeypress = this.onKeyDown;
25269
25270		if(this.arParams.WAIT_IMAGE)
25271		{
25272			this.WAIT = document.body.appendChild(document.createElement("DIV"));
25273			this.WAIT.style.backgroundImage = "url('" + this.arParams.WAIT_IMAGE + "')";
25274			if(!BX.browser.IsIE())
25275				this.WAIT.style.backgroundRepeat = 'none';
25276			this.WAIT.style.display = 'none';
25277			this.WAIT.style.position = 'absolute';
25278			this.WAIT.style.zIndex = '1100';
25279		}
25280
25281		BX.bind(this.INPUT, 'bxchange', function() {_this.onChange()});
25282	};
25283	BX.ready(function (){_this.Init(arParams)});
25284}
25285
25286/* End */
25287;
25288; /* Start:"a:4:{s:4:"full";s:56:"/local/templates/aspro_next/js/custom.js?172597043712011";s:6:"source";s:40:"/local/templates/aspro_next/js/custom.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
25289/*
25290You can use this file with your scripts.
25291It will not be overwritten when you upgrade solution.
25292*/
25293$(document).ready(function() {
25294    $('.scroll-init').mCustomScrollbar({
25295        theme:"my-theme",
25296        mouseWheel: {
25297          scrollAmount: 100,
25298          preventDefault: true,
25299        },
25300    });
25301
25302    // popular category
25303    // $('.tags__item').each(function() {
25304    //     if ($(this).hasClass('is-hidden')) {
25305    //         $(this).attr('data-hidden', '')
25306    //     };
25307
25308    //     if ($(this).is(':last-child')) {
25309    //         var $tags = $(this).closest('.tags');
25310    //         var total = $tags.find('[data-hidden]').length;
25311
25312    //         if (total) {
25313    //             $('<div class="tags__item tags__item--toggle"><a href="#">Еще ' + total + '</a></div>').insertAfter(this).find('a').click(function(e) {
25314    //                 e.preventDefault();
25315
25316    //                 if (!$tags.hasClass('is-opened')) {
25317    //                     $tags.addClass('is-opened').find('[data-hidden]').removeClass('is-hidden');
25318    //                     $(this).text('Скрыть');
25319    //                 } else {
25320    //                     $tags.removeClass('is-opened').find('[data-hidden]').addClass('is-hidden');
25321    //                     $(this).text('Еще ' + total);
25322    //                 };
25323    //             });
25324    //         };
25325
25326    //         $tags.addClass('is-ready');
25327    //     };
25328    // });
25329    $('.js-events .row').children().each(function() {
25330        if ($(this).hasClass('is-hidden')) {
25331            $(this).attr('data-hidden', '')
25332        };
25333        if ($(this).is(':last-child')) {
25334            const $events = $(this).closest('.js-events')
25335            const total = $events.find('[data-hidden]').length;
25336            if(total) {
25337                $('.btn').click(function() {
25338                    $events.find('[data-hidden]').removeClass('is-hidden');
25339                    $(this).addClass('is-hidden')
25340                })
25341            }
25342        }
25343    })
25344
25345    // tabs
25346    $(".tabs__link").click(function (e) {
25347        e.preventDefault();
25348
25349        $(this).parent().each(function() {
25350            $(this).attr('checked', false);
25351        })
25352
25353        var $target = $($(this).attr("href"));
25354
25355        $(this).add($target).addClass('is-active').siblings().removeClass('is-active');
25356        $(this).find('input').attr('checked', true);
25357    });
25358
25359    
25360
25361    // $(window).resize(function(){
25362    //     let $windowWidth = $(window).width();
25363    //     if ($windowWidth > 991) {
25364    //         $('.e-teasers__slider-mob').slick('unslick');
25365        
25366    //     } else {
25367    //         $('.e-teasers__slider-mob').slick({
25368    //             responsive: [
25369    //               {
25370    //                 breakpoint: 991,
25371    //                 settings: {
25372    //                   arrows: true,
25373    //                   dots: true,
25374    //                   slidesToShow: 2,
25375    //                   infinite: false,
25376    //                 speed: 300,
25377    //                 prevArrow: $('.e-teasers__prev'),
25378    //                 nextArrow: $('.e-teasers__next'),
25379    //                 }
25380    //               },
25381    //             //   {
25382    //             //     breakpoint: 480,
25383    //             //     settings: {
25384    //             //       arrows: false,
25385    //             //       centerMode: true,
25386    //             //       centerPadding: '40px',
25387    //             //       slidesToShow: 1
25388    //             //     }
25389    //             //   }
25390    //             ]
25391    //           });
25392    //     }
25393    // });
25394    $('.bx_filter_parameters_box.title').click(function () {
25395        $(this).siblings('.bx_filter_parameters').slideToggle()
25396        $(this).find('.bx_filter_parameters_box_title').toggleClass('active')
25397    })
25398    $('.sort_header__mob').click(function () {
25399        $(this).siblings('.sort_filter').slideToggle()
25400        $(this).siblings('.sort_filter').toggleClass('active')
25401    })
25402
25403    // let fast_v = document.querySelector('[data-param-form_id="fast_view"]')
25404    // fast_v.addEventListener('click', function (e) {
25405    //     e.preventDefault()
25406    //     console.log('click')
25407    // });
25408
25409    $(document).on('click','[data-fancybox-fast]', function(e){
25410        e.preventDefault()
25411        let form_id = 'fast_view'
25412        let iblock_id = $(this).attr('data-param-iblock_id')
25413        let id = $(this).attr('data-param-id')
25414        let fid = $(this).attr('data-param-fid')
25415        let item_href = $(this).attr('data-param-item_href')
25416        $.ajax({
25417            type: "GET",
25418            url: "/ajax/form.php",
25419            data: {
25420                'form_id': form_id,
25421                'iblock_id': iblock_id,
25422                'id': id,
25423                'fid': fid,
25424                'item_href': item_href,
25425            }
25426        }).done(function( msg ) {
25427            $('#popup-fast .p-fast').html(msg)
25428        });
25429    });
25430
25431    // t_123386
25432    $('.preview_text_slideDown_con').each(function(index, el) {
25433        let h = $(this).height();
25434        if (h < 120) {
25435            $(this).parents('.preview_text_slideDown').removeClass('collapsed');
25436        } else {
25437            $(this).parents('.preview_text_slideDown').addClass('laded');            
25438        }
25439    });
25440    $(document).on('click', '.preview_text_slideDown_rm', function(event) {
25441        //$(this).prev('.preview_text_slideDown').removeClass('collapsed');
25442        //$(this).remove();
25443        $('.catalog_detail > .tabs_section a[href="#props"]').click();
25444        $('html, body').animate({ scrollTop: $('.catalog_detail > .tabs_section').offset().top - 70 }, 500);
25445        return false;
25446    });
25447    $(document).on('click', '.type_selector_lst_itm', function(event) {
25448        $(this).parent('.type_selector_lst').find('.type_selector_lst_itm').removeClass('active');
25449        $(this).addClass('active');
25450        return false;
25451    });
25452
25453    // t_124456 p_5
25454    if (
25455        location.hash.indexOf("#rating") >= 0 &&
25456        $('.product_reviews_tab > a[href="#review"]').length > 0 &&
25457        $('#reviews_content').length > 0
25458    ) {
25459        $('.product_reviews_tab > a[href="#review"]').click();
25460        $('html, body').animate({ scrollTop: $('#reviews_content').offset().top - 150 }, 500);
25461    }
25462    $(document).on('click', '.js-rating-ancore', function(event) {
25463        if (
25464            $('.product_reviews_tab > a[href="#review"]').length > 0 &&
25465            $('#reviews_content').length > 0
25466        ) {
25467            $('.product_reviews_tab > a[href="#review"]').click();
25468            $('html, body').animate({ scrollTop: $('#reviews_content').offset().top - 150 }, 500);
25469        }
25470        return false;
25471    });
25472
25473    
25474
25475});
25476
25477
25478
25479$(window).on('load resize', function() {
25480    //
25481    if ($(window).width() < 992) {
25482        $('.catalog_page .bx_filter .bx_filter_section .smartfilter').addClass('sf_vis');
25483        $('.catalog_page .bx_filter .bx_filter_section .smartfilter .bx_filter_parameters').hide();
25484    } else {
25485        $('.catalog_page .bx_filter .bx_filter_section .smartfilter .bx_filter_parameters').show();
25486    }
25487    //
25488    if ($(window).width() < 601) {
25489        $(document).off("mouseenter", ".section-gallery-wrapper .section-gallery-wrapper__item");
25490        //
25491        $('.section-gallery-wrapper').each(function(index, el) {
25492            let slides_cnt = $(this).children('.section-gallery-wrapper__item').length;
25493            if (slides_cnt > 1 && !$(this).hasClass('slide_arrows')) {
25494                $(this).addClass('slide_arrows');
25495            }
25496        });
25497    } else {
25498        $(document).off("mouseenter", ".section-gallery-wrapper .section-gallery-wrapper__item");
25499        $(document).off("click", ".section-gallery-wrapper .section-gallery-wrapper__item");
25500        $(document).on('mouseenter', '.section-gallery-wrapper .section-gallery-wrapper__item', function(){
25501            $(this).siblings().removeClass('_active');
25502            $(this).addClass('_active');
25503        });
25504    }
25505});
25506
25507
25508
25509$(document).on('click', '.section-gallery-wrapper__item-nav', function(event) {
25510    if ($(window).width() < 601) {
25511        let parent_item = $(this).parent();
25512        let all_items = parent_item.parent().children('.section-gallery-wrapper__item');
25513        let active_item = parent_item.parent().children('._active');
25514        let first_item = parent_item.parent().children().first();
25515        let next_item = active_item.next('.section-gallery-wrapper__item');
25516        if (all_items.length > 1) {
25517            active_item.removeClass('_active');
25518            if (next_item.length) {
25519                next_item.addClass('_active');
25520            } else {
25521                first_item.addClass('_active');
25522            }
25523        }
25524        return false;
25525    }
25526});
25527
25528
25529
25530$(window).on('load resize', function() {
25531    if ($(window).width() < 991) {
25532      $('.e-teasers__slider-mob:not(.slick-initialized)').slick({
25533        centerMode: false,
25534        dots: true,
25535        arrows: true,
25536        infinite: false,
25537        speed: 300,
25538        slidesToShow: 2,
25539        appendDots: $('.e-teasers__dots'),
25540        prevArrow: $('.e-teasers__prev'),
25541        nextArrow: $('.e-teasers__next'),
25542        responsive: [
25543            {
25544                breakpoint: 605,
25545                settings: {
25546                    slidesToShow: 1,
25547                }
25548            },
25549        ]
25550      });
25551    } else {
25552      $(".e-teasers__slider-mob.slick-initialized").slick("unslick");
25553    }
25554});
25555
25556
25557//
25558$(document).on('click', '.block_analogs_overflow_rm_btn', function(event) {
25559    let ths = $(this);
25560    let wrap = ths.parent('.block_analogs_overflow_rm').prev('.block_analogs_overflow');
25561    if (!ths.hasClass('active')) {
25562        wrap.addClass('no_hide');
25563        ths.addClass('active');
25564        ths.text('Свернуть');
25565    } else {
25566        wrap.removeClass('no_hide');
25567        ths.removeClass('active');
25568        ths.text('Показать все');
25569    }
25570    return false;
25571});
25572$('body').on('click', '.choose_basket_btn', function(){
25573	var datact = $(this).attr('data-ct');
25574	if(datact=='1'){
25575		var price = $(this).parent().parent().find('.price_matrix_wrapper').find('.price').attr('data-value');
25576	}else{
25577		var price = $('.buy_block').find('.button_block').find('span.to-cart').attr('data-value');
25578	}
25579	price = parseFloat(price);
25580	var ct = parseInt($(this).attr('data-count'));
25581	var what = $(this).attr('data-what');
25582	var totalprice = price*ct;
25583	totalprice = totalprice.toFixed(2);
25584	if(datact=='1'){
25585		var price_str = '<span class="values_wrapper"><span class="price_value">'+totalprice+'</span><span class="price_currency"> ₽</span></span><span class="price_measure">/'+what+'</span>';
25586		$(this).parent().parent().find('.price_matrix_wrapper').find('.price').html(price_str);
25587	}else{
25588		var price_str = '<span class="values_wrapper"><span class="price_value">'+totalprice+'</span><span class="price_currency"> ₽</span></span><span class="price_measure">/'+what+'</span>';
25589		$('.right_info').find('.price_matrix_wrapper').find('.price').html(price_str);
25590	}
25591	$(this).parent().find('.choose_basket_btn').each(function(){
25592		$(this).removeClass('choosed');
25593	});
25594	$(this).addClass('choosed');
25595	if(datact=='1'){
25596		/*$(this).parent().parent().parent().next('.footer_button').find('span.to-cart').attr('data-quantity', ct).attr('data-ypk', what);
25597		$(this).parent().parent().parent().next('.footer_button').find('span.to-cart').attr('data-quantity', ct).attr('data-countr', ct);*/
25598		$(this).parent().parent().parent().next('.footer_button').find('span.to-cart').attr('data-ypk', what);
25599		$(this).parent().parent().parent().next('.footer_button').find('span.to-cart').attr('data-countr', ct);
25600	}else{
25601		/*$('.right_info').find('.buy_block').find('.button_block').find('span.to-cart').attr('data-quantity', ct).attr('data-ypk', what);
25602		$('.right_info').find('.buy_block').find('.button_block').find('span.to-cart').attr('data-quantity', ct).attr('data-countr', ct);*/
25603		$('.right_info').find('.buy_block').find('.button_block').find('span.to-cart').attr('data-ypk', what);
25604		$('.right_info').find('.buy_block').find('.button_block').find('span.to-cart').attr('data-countr', ct);
25605	}
25606});
25607
25608/* End */
25609;; /* /local/templates/aspro_next/js/jquery.actual.min.js?17259704381251*/
25610;
25610 /* /local/templates/aspro_next/vendor/js/jquery.bxslider.js?172597048166080*/
25611; /* /local/templates/aspro_next/js/jqModal.js?172597043711022*/
25612; /* /local/templates/aspro_next/vendor/js/bootstrap.js?172597048127908*/
25613; /* /local/templates/aspro_next/vendor/js/jquery.appear.js?17259704813188*/
25614; /* /local/templates/aspro_next/js/browser.js?17259704371032*/
25615; /* /local/templates/aspro_next/js/jquery.fancybox.js?172597044045889*/
25616; /* /local/templates/aspro_next/js/jquery.flexslider.js?172597044156312*/
25617; /* /local/templates/aspro_next/vendor/js/moment.min.js?172597048234436*/
25618; /* /local/templates/aspro_next/vendor/js/footable.js?1725970481275478*/
25619; /* /local/templates/aspro_next/vendor/js/jquery.menu-aim.js?172597048112787*/
25620; /* /local/templates/aspro_next/vendor/js/velocity/velocity.js?172597048244791*/
25621; /* /local/templates/aspro_next/vendor/js/velocity/velocity.ui.js?172597048213257*/
25622; /* /local/templates/aspro_next/js/jquery.validate.min.js?172597044522257*/
25623; /* /local/templates/aspro_next/js/jquery.inputmask.bundle.min.js?172597044370933*/
25624; /* /local/templates/aspro_next/js/jquery.uniform.min.js?17259704458308*/
25625; /* /local/templates/aspro_next/js/jquery.easing.1.3.js?17259704408095*/
25626; /* /local/templates/aspro_next/js/equalize.min.js?1725970437588*/
25627; /* /local/templates/aspro_next/js/jquery.alphanumeric.js?17259704381972*/
25628; /* /local/templates/aspro_next/js/jquery.cookie.js?17259704383066*/
25629; /* /local/templates/aspro_next/js/jquery.plugin.min.js?17259704443181*/
25630; /* /local/templates/aspro_next/js/jquery.countdown.min.js?172597043913137*/
25631; /* /local/templates/aspro_next/js/jquery.countdown-ru.js?17259704381400*/
25632; /* /local/templates/aspro_next/js/jquery.ikSelect.js?172597044332030*/
25633; /* /local/templates/aspro_next/js/jquery.mobile.custom.touch.min.js?17259704447784*/
25634; /* /local/templates/aspro_next/js/jquery.dotdotdot.js?17259704395908*/
25635; /* /local/templates/aspro_next/js/rating_likes.js?172597044710797*/
25636; /* /local/templates/aspro_next/js/blocks/blocks.js?17259704501328*/
25637; /* /local/templates/aspro_next/js/video_banner.js?172597044830810*/
25638; /* /local/templates/aspro_next/js/main.js?1729513131257858*/
25639; /* /local/templates/aspro_next/cdn/slick.min.js?172596984542863*/
25640; /* /local/templates/aspro_next/cdn/fancybox.umd.js?1725969845105639*/
25641; /* /local/templates/aspro_next/cdn/jquery.suggestions.min.js?172596984559206*/
25642; /* /local/templates/aspro_next/js/jquery.mCustomScrollbar.min.js?172597044439873*/
25643; /* /bitrix/components/bitrix/search.title/script.js?174721915010542*/
25644; /* /local/templates/aspro_next/components/bitrix/search.title/corp/script.
25644js?172597034210017*/
25645; /* /local/templates/aspro_next/components/bitrix/search.title/fixed/script.js?172597034510084*/
25646; /* /local/templates/aspro_next/js/custom.js?172597043712011*/

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.